diff --git a/packages/_vue3-migration-test/CHANGELOG.md b/packages/_vue3-migration-test/CHANGELOG.md index 953dbef7ba..68e242cf04 100644 --- a/packages/_vue3-migration-test/CHANGELOG.md +++ b/packages/_vue3-migration-test/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.0-alpha.35](https://github.com/empathyco/x/compare/vue3-migration-test@1.0.0-alpha.34...vue3-migration-test@1.0.0-alpha.35) (2024-06-24) + + +### Features + +* replace DisableAnimationMixin by useDisableAnimation composable (#1469) ([f498d3f](https://github.com/empathyco/x/commit/f498d3fba5d294391dcfca47f9724558e98f50f0)) + + + +## [1.0.0-alpha.34](https://github.com/empathyco/x/compare/vue3-migration-test@1.0.0-alpha.33...vue3-migration-test@1.0.0-alpha.34) (2024-06-24) + + +### Features + +* **extra-params:** migrate extra params and snippet config extra params (#1531) ([d869f18](https://github.com/empathyco/x/commit/d869f1886c11f74af8a6350033d7567385ad629d)) + + + +## [1.0.0-alpha.33](https://github.com/empathyco/x/compare/vue3-migration-test@1.0.0-alpha.32...vue3-migration-test@1.0.0-alpha.33) (2024-06-19) + + +### Features + +* migrate popular-searches x-module (#1524) ([f79456d](https://github.com/empathyco/x/commit/f79456d4589b3f9dee5fd86fad9625b853dde267)) + + + ## [1.0.0-alpha.32](https://github.com/empathyco/x/compare/vue3-migration-test@1.0.0-alpha.31...vue3-migration-test@1.0.0-alpha.32) (2024-06-18) diff --git a/packages/_vue3-migration-test/package.json b/packages/_vue3-migration-test/package.json index 681f02e6dd..042051a216 100644 --- a/packages/_vue3-migration-test/package.json +++ b/packages/_vue3-migration-test/package.json @@ -1,7 +1,7 @@ { "name": "vue3-migration-test", "private": "true", - "version": "1.0.0-alpha.32", + "version": "1.0.0-alpha.35", "scripts": { "dev": "vite", "preview": "vite preview", diff --git a/packages/_vue3-migration-test/src/components/extra-params/test-extra-params.vue b/packages/_vue3-migration-test/src/components/extra-params/test-extra-params.vue new file mode 100644 index 0000000000..a7638946e6 --- /dev/null +++ b/packages/_vue3-migration-test/src/components/extra-params/test-extra-params.vue @@ -0,0 +1,13 @@ + + diff --git a/packages/_vue3-migration-test/src/components/index.ts b/packages/_vue3-migration-test/src/components/index.ts index 45c4690d74..66a0cf6ff6 100644 --- a/packages/_vue3-migration-test/src/components/index.ts +++ b/packages/_vue3-migration-test/src/components/index.ts @@ -14,3 +14,4 @@ export { default as TestBasePanel } from './panels/test-base-panel.vue'; export { default as TestBaseKeyboardNavigation } from './test-base-keyboard-navigation.vue'; export { default as TestBaseEventsModal } from './modals/test-base-events-modal.vue'; export { default as TestBaseIdModal } from './modals/test-base-id-modal.vue'; +export { default as TestExtraParams } from './extra-params/test-extra-params.vue'; diff --git a/packages/_vue3-migration-test/src/main.ts b/packages/_vue3-migration-test/src/main.ts index de859ebc69..fe773026db 100644 --- a/packages/_vue3-migration-test/src/main.ts +++ b/packages/_vue3-migration-test/src/main.ts @@ -1,20 +1,22 @@ import { QuerySuggestionsRequest, XComponentsAdapter } from '@empathyco/x-types'; import { Component, configureCompat, createApp } from 'vue'; import { createStore } from 'vuex'; -import { xPlugin } from '../../x-components/src/plugins/x-plugin'; import { getRelatedTagsStub } from '../../x-components/src/__stubs__/related-tags-stubs.factory'; import { getQuerySuggestionsStub } from '../../x-components/src/__stubs__/query-suggestions-stubs.factory'; import { + createResultStub, getBannersStub, getNextQueriesStub, getPromotedsStub, getResultsStub } from '../../x-components/src/__stubs__/index'; +import { XInstaller } from '../../x-components/src/x-installer/x-installer/x-installer'; import App from './App.vue'; import router from './router'; import { facetsXModule, nextQueriesXModule, + popularSearchesXModule, queriesPreviewXModule, recommendationsXModule, scrollXModule, @@ -75,7 +77,11 @@ const adapter = { promoteds: getPromotedsStub(), banners: getBannersStub() }); - }) + }), + identifierResults: () => + new Promise(resolve => + resolve({ results: ['123A', '123B', '123C', '123D'].map(id => createResultStub(id)) }) + ) } as unknown as XComponentsAdapter; const store = createStore({}); @@ -83,18 +89,24 @@ const store = createStore({}); createApp(App as Component) .use(router) .use(store) - .use(xPlugin, { - adapter, - store, - __PRIVATE__xModules: { - facets: facetsXModule, - nextQueries: nextQueriesXModule, - scroll: scrollXModule, - search: searchXModule, - queriesPreview: queriesPreviewXModule, - semanticQueries: semanticQueriesXModule, - recommendations: recommendationsXModule, - identifierResults: identifierResultsXModule - } - }) .mount('#app'); + +window.initX = { + instance: 'empathy', + lang: 'en' +}; +new XInstaller({ + adapter, + store, + __PRIVATE__xModules: { + facets: facetsXModule, + nextQueries: nextQueriesXModule, + scroll: scrollXModule, + search: searchXModule, + queriesPreview: queriesPreviewXModule, + semanticQueries: semanticQueriesXModule, + recommendations: recommendationsXModule, + identifierResults: identifierResultsXModule, + popularSearches: popularSearchesXModule + } +}).init(); diff --git a/packages/_vue3-migration-test/src/router.ts b/packages/_vue3-migration-test/src/router.ts index 6a9454ec3a..e9a253de77 100644 --- a/packages/_vue3-migration-test/src/router.ts +++ b/packages/_vue3-migration-test/src/router.ts @@ -38,8 +38,10 @@ import { TestQuerySuggestions, TestSemanticQueries, TestRecommendations, + TestPopularSearches, TestNextQueries, - TestIdentifierResults + TestIdentifierResults, + TestExtraParams } from './'; const routes = [ @@ -233,6 +235,11 @@ const routes = [ name: 'Recommendations', component: TestRecommendations }, + { + path: '/popular-searches', + name: 'PopularSearches', + component: TestPopularSearches + }, { path: '/next-queries', name: 'NextQueries', @@ -242,6 +249,11 @@ const routes = [ path: '/identifier-results', name: 'IdentifierResults', component: TestIdentifierResults + }, + { + path: '/snippet-config-extraparams', + name: 'SnippetConfigExtraparams', + component: TestExtraParams } ]; diff --git a/packages/_vue3-migration-test/src/x-modules/identifier-results/x-module.ts b/packages/_vue3-migration-test/src/x-modules/identifier-results/x-module.ts index 70ba15093a..d801729f7f 100644 --- a/packages/_vue3-migration-test/src/x-modules/identifier-results/x-module.ts +++ b/packages/_vue3-migration-test/src/x-modules/identifier-results/x-module.ts @@ -1,6 +1,5 @@ import { PrivateXModuleOptions } from '../../../../x-components/src/plugins/x-plugin.types'; import { IdentifierResultsXModule } from '../../../../x-components/src/x-modules/identifier-results/x-module'; -import { createResultStub } from '../../../../x-components/src/__stubs__/results-stubs.factory'; export const identifierResultsXModule: PrivateXModuleOptions = { storeModule: { @@ -11,7 +10,7 @@ export const identifierResultsXModule: PrivateXModuleOptions createResultStub(id)), + identifierResults: [], origin: null, query: 'test', params: {}, diff --git a/packages/_vue3-migration-test/src/x-modules/index.ts b/packages/_vue3-migration-test/src/x-modules/index.ts index a78483264e..c935daf10c 100644 --- a/packages/_vue3-migration-test/src/x-modules/index.ts +++ b/packages/_vue3-migration-test/src/x-modules/index.ts @@ -10,4 +10,5 @@ export * from './history-queries'; export * from './query-suggestions'; export * from './semantic-queries'; export * from './recommendations'; +export * from './popular-searches'; export * from './identifier-results'; diff --git a/packages/_vue3-migration-test/src/x-modules/popular-searches/index.ts b/packages/_vue3-migration-test/src/x-modules/popular-searches/index.ts new file mode 100644 index 0000000000..5b975a41d8 --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/popular-searches/index.ts @@ -0,0 +1,2 @@ +export * from './x-module'; +export { default as TestPopularSearches } from './test-popular-searches.vue'; diff --git a/packages/_vue3-migration-test/src/x-modules/popular-searches/test-popular-searches.vue b/packages/_vue3-migration-test/src/x-modules/popular-searches/test-popular-searches.vue new file mode 100644 index 0000000000..c00389b39c --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/popular-searches/test-popular-searches.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/packages/_vue3-migration-test/src/x-modules/popular-searches/x-module.ts b/packages/_vue3-migration-test/src/x-modules/popular-searches/x-module.ts new file mode 100644 index 0000000000..0aeaee7431 --- /dev/null +++ b/packages/_vue3-migration-test/src/x-modules/popular-searches/x-module.ts @@ -0,0 +1,16 @@ +import { PopularSearchesXModule } from '../../../../x-components/src/x-modules/popular-searches/x-module'; +import { PrivateXModuleOptions } from '../../../../x-components/src/plugins'; +import { createPopularSearch } from '../../../../x-components/src/__stubs__/popular-searches-stubs.factory'; + +export const popularSearchesXModule: PrivateXModuleOptions = { + storeModule: { + state: { + popularSearches: ['patata', 'salchicón', 'pan', 'queso', 'leche', 'galletas'].map(query => + createPopularSearch(query) + ), + config: { + hideSessionQueries: false + } + } + } +}; diff --git a/packages/x-components/CHANGELOG.md b/packages/x-components/CHANGELOG.md index d0e50dc52e..659ed5a190 100644 --- a/packages/x-components/CHANGELOG.md +++ b/packages/x-components/CHANGELOG.md @@ -3,6 +3,51 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [5.0.0-alpha.54](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.53...@empathyco/x-components@5.0.0-alpha.54) (2024-06-24) + + +### Features + +* replace DisableAnimationMixin by useDisableAnimation composable (#1469) ([f498d3f](https://github.com/empathyco/x/commit/f498d3fba5d294391dcfca47f9724558e98f50f0)) + + + +## [5.0.0-alpha.53](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.52...@empathyco/x-components@5.0.0-alpha.53) (2024-06-24) + + +### Features + +* **extra-params:** migrate extra params and snippet config extra params (#1531) ([d869f18](https://github.com/empathyco/x/commit/d869f1886c11f74af8a6350033d7567385ad629d)) + + + +## [5.0.0-alpha.52](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.51...@empathyco/x-components@5.0.0-alpha.52) (2024-06-20) + + +### Features + +* migrate `QueryPreviewButton` component to composition API (#1525) ([3eff0c7](https://github.com/empathyco/x/commit/3eff0c7c9479abbebbda59e8cc538af6f55375e1)) + + + +## [5.0.0-alpha.51](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.50...@empathyco/x-components@5.0.0-alpha.51) (2024-06-19) + + +### Features + +* migrate popular-searches x-module (#1524) ([f79456d](https://github.com/empathyco/x/commit/f79456d4589b3f9dee5fd86fad9625b853dde267)) + + + +## [5.0.0-alpha.50](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.49...@empathyco/x-components@5.0.0-alpha.50) (2024-06-19) + + +### Features + +* migrate `facets provider` component to use Composition API (#1523) ([eff7b8d](https://github.com/empathyco/x/commit/eff7b8d92c54aece07061c2d8ce58507a56e7d01)) + + + ## [5.0.0-alpha.49](https://github.com/empathyco/x/compare/@empathyco/x-components@5.0.0-alpha.48...@empathyco/x-components@5.0.0-alpha.49) (2024-06-18) diff --git a/packages/x-components/package.json b/packages/x-components/package.json index b07bdbd3c7..96f4814caf 100644 --- a/packages/x-components/package.json +++ b/packages/x-components/package.json @@ -1,6 +1,6 @@ { "name": "@empathyco/x-components", - "version": "5.0.0-alpha.49", + "version": "5.0.0-alpha.54", "description": "Empathy X Components", "author": "Empathy Systems Corporation S.L.", "license": "Apache-2.0", diff --git a/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts b/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts index bb3c969a0c..23e2ec1da4 100644 --- a/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts +++ b/packages/x-components/src/plugins/__tests__/x-plugin-alias.spec.ts @@ -47,7 +47,7 @@ describe('testing plugin alias', () => { status: { identifierResults: 'initial', // It is already registered by the `identifierResultsXModule` import itself nextQueries: 'initial', // It is already registered by the `nextQueriesXModule` import itself - popularSearches: undefined, + popularSearches: 'initial', // It is already registered by the `popularSearchesXModule` import itself querySuggestions: 'initial', // It is already registered by the `querySuggestionsXModule` import itself recommendations: 'initial', // It is already registered by the `recommendationsXModule` import itself relatedTags: 'initial', // It is already registered by the `relatedTagsXModule` import itself diff --git a/packages/x-components/src/x-modules/extra-params/components/__tests__/extra-params.spec.ts b/packages/x-components/src/x-modules/extra-params/components/__tests__/extra-params.spec.ts index 5376cdff4c..a226e19003 100644 --- a/packages/x-components/src/x-modules/extra-params/components/__tests__/extra-params.spec.ts +++ b/packages/x-components/src/x-modules/extra-params/components/__tests__/extra-params.spec.ts @@ -40,7 +40,7 @@ describe('testing extra params component', () => { expect(extraParamsProvidedCallback).toHaveBeenCalledWith<[WirePayload>]>({ eventPayload: { warehouse: 1234 }, - metadata: { moduleName: 'extraParams', location: undefined, replaceable: true } + metadata: { moduleName: 'extraParams', location: 'none', replaceable: true } }); expect(extraParamsProvidedCallback).toHaveBeenCalledTimes(1); @@ -48,7 +48,7 @@ describe('testing extra params component', () => { expect(extraParamsProvidedCallback).toHaveBeenCalledWith<[WirePayload>]>({ eventPayload: { warehouse: 5678 }, - metadata: { moduleName: 'extraParams', location: undefined, replaceable: true } + metadata: { moduleName: 'extraParams', location: 'none', replaceable: true } }); expect(extraParamsProvidedCallback).toHaveBeenCalledTimes(2); }); diff --git a/packages/x-components/src/x-modules/extra-params/components/extra-params.vue b/packages/x-components/src/x-modules/extra-params/components/extra-params.vue index d24dc6301e..4d96cddc97 100644 --- a/packages/x-components/src/x-modules/extra-params/components/extra-params.vue +++ b/packages/x-components/src/x-modules/extra-params/components/extra-params.vue @@ -1,9 +1,9 @@ diff --git a/packages/x-components/src/x-modules/extra-params/components/snippet-config-extra-params.vue b/packages/x-components/src/x-modules/extra-params/components/snippet-config-extra-params.vue index a6e86d798c..b62ed09319 100644 --- a/packages/x-components/src/x-modules/extra-params/components/snippet-config-extra-params.vue +++ b/packages/x-components/src/x-modules/extra-params/components/snippet-config-extra-params.vue @@ -4,87 +4,59 @@ diff --git a/packages/x-components/src/x-modules/extra-params/x-module.ts b/packages/x-components/src/x-modules/extra-params/x-module.ts index 241efc6bd8..26033bcecc 100644 --- a/packages/x-components/src/x-modules/extra-params/x-module.ts +++ b/packages/x-components/src/x-modules/extra-params/x-module.ts @@ -1,4 +1,5 @@ import { XModule } from '../x-modules.types'; +import { XPlugin } from '../../plugins/index'; import { extraParamsEmitters } from './store/emitters'; import { extraParamsXStoreModule } from './store/module'; import { ExtraParamsXStoreModule } from './store/types'; @@ -23,3 +24,5 @@ export const extraParamsXModule: ExtraParamsXModule = { storeEmitters: extraParamsEmitters, wiring: extraParamsWiring }; + +XPlugin.registerXModule(extraParamsXModule); diff --git a/packages/x-components/src/x-modules/facets/components/facets/facets-provider.vue b/packages/x-components/src/x-modules/facets/components/facets/facets-provider.vue index d34c8811eb..63ab6d9000 100644 --- a/packages/x-components/src/x-modules/facets/components/facets/facets-provider.vue +++ b/packages/x-components/src/x-modules/facets/components/facets/facets-provider.vue @@ -1,15 +1,12 @@