From 66f2d6c814a322210296a38409f58f3ae943c750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20CG?= Date: Thu, 27 Jun 2024 10:24:03 +0200 Subject: [PATCH] feat: build a Vue3 test search component --- packages/_vue3-migration-test/src/App.vue | 11 ++++- .../src/components/index.ts | 1 + .../src/components/test-search.vue | 45 +++++++++++++++++++ packages/_vue3-migration-test/src/main.ts | 19 ++------ packages/_vue3-migration-test/src/router.ts | 8 +++- 5 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 packages/_vue3-migration-test/src/components/test-search.vue diff --git a/packages/_vue3-migration-test/src/App.vue b/packages/_vue3-migration-test/src/App.vue index dadc1fe5ac..627b5fdf38 100644 --- a/packages/_vue3-migration-test/src/App.vue +++ b/packages/_vue3-migration-test/src/App.vue @@ -12,7 +12,16 @@ - + diff --git a/packages/_vue3-migration-test/src/main.ts b/packages/_vue3-migration-test/src/main.ts index fe773026db..09487d59fa 100644 --- a/packages/_vue3-migration-test/src/main.ts +++ b/packages/_vue3-migration-test/src/main.ts @@ -1,16 +1,16 @@ import { QuerySuggestionsRequest, XComponentsAdapter } from '@empathyco/x-types'; import { Component, configureCompat, createApp } from 'vue'; import { createStore } from 'vuex'; +// import { platformAdapter } from '@empathyco/x-adapter-platform'; 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 { baseSnippetConfig } from '../../x-components/src/views/base-config'; import App from './App.vue'; import router from './router'; import { @@ -69,15 +69,6 @@ const adapter = { ] }); }), - search: () => - new Promise(resolve => { - resolve({ - results: getResultsStub(10), - totalResults: 50, - promoteds: getPromotedsStub(), - banners: getBannersStub() - }); - }), identifierResults: () => new Promise(resolve => resolve({ results: ['123A', '123B', '123C', '123D'].map(id => createResultStub(id)) }) @@ -91,10 +82,8 @@ createApp(App as Component) .use(store) .mount('#app'); -window.initX = { - instance: 'empathy', - lang: 'en' -}; +window.initX = baseSnippetConfig; + new XInstaller({ adapter, store, diff --git a/packages/_vue3-migration-test/src/router.ts b/packages/_vue3-migration-test/src/router.ts index e9a253de77..f6f4ad423b 100644 --- a/packages/_vue3-migration-test/src/router.ts +++ b/packages/_vue3-migration-test/src/router.ts @@ -41,10 +41,16 @@ import { TestPopularSearches, TestNextQueries, TestIdentifierResults, - TestExtraParams + TestExtraParams, + TestSearch } from './'; const routes = [ + { + path: '/', + name: 'Home', + component: TestSearch + }, { path: '/animate-width', name: 'AnimateWidth',