From 7e7d8947ee4770ea669a0f084c2552d31f076051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20CG?= Date: Tue, 26 Nov 2024 17:49:39 +0100 Subject: [PATCH] prettier: format files --- .github/CODE_OF_CONDUCT.md | 22 +- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +- .github/ISSUE_TEMPLATE/feature_request.yml | 24 +- .github/PULL_REQUEST_TEMPLATE.md | 11 +- .github/actions/deploy/action.yaml | 10 +- .github/workflows/codeql.yml | 20 +- .github/workflows/deploy-docker.yml | 6 +- .postcssrc.js | 6 +- build/instrumentation.build.mjs | 88 +++--- cypress.config.ts | 20 +- docs/deployment.md | 12 +- docs/i18n.md | 42 +-- docs/pr-preview.md | 10 +- index.html | 2 +- package.json | 6 +- public/snippet-script.js | 96 +++--- rollup.config.mjs | 18 +- src/components/collapse-height-animation.vue | 48 +-- src/components/column-picker.vue | 50 ++-- src/components/custom-header-toggle-panel.vue | 36 +-- src/components/custom-main-modal.vue | 38 +-- src/components/custom-sliding-panel.vue | 28 +- .../desktop-header-floating-predictive.vue | 34 +-- .../desktop-header-full-predictive.vue | 34 +-- src/components/desktop/desktop-sub-header.vue | 60 ++-- src/components/desktop/desktop-toolbar.vue | 26 +- .../desktop/desktop-top-section.vue | 22 +- src/components/desktop/desktop.vue | 86 +++--- src/components/history-query-filters.vue | 44 +-- src/components/logo.vue | 8 +- src/components/main.vue | 54 ++-- src/components/mobile/mobile-close-aside.vue | 18 +- src/components/mobile/mobile-open-aside.vue | 16 +- src/components/mobile/mobile-sub-header.vue | 44 +-- src/components/mobile/mobile-toolbar.vue | 22 +- src/components/mobile/mobile.vue | 110 ++++--- .../my-history/custom-my-history.vue | 46 +-- .../my-history/my-history-aside.vue | 52 ++-- .../my-history-confirm-disable-modal.vue | 56 ++-- .../pre-search/pre-search-manager.vue | 80 ++--- .../full-width-predictive.vue | 200 ++++++------- .../predictive-identifier-results.vue | 32 +- .../predictive-layer/predictive-layer.vue | 148 +++++----- .../predictive-next-queries.vue | 32 +- .../predictive-popular-searches.vue | 30 +- .../predictive-query-suggestions.vue | 32 +- .../sliding-recommendations.vue | 36 +-- .../results/custom-recommendations.vue | 42 +-- src/components/results/result.vue | 66 ++--- src/components/scroll-to-top.vue | 28 +- src/components/search-box.vue | 38 +-- .../search/custom-semantic-queries.vue | 54 ++-- src/components/search/desktop-aside.vue | 34 +-- .../search/display-click-provider.vue | 80 ++--- .../search/facets/custom-facets.vue | 68 ++--- .../search/facets/custom-sliced-filters.vue | 20 +- .../search/facets/facet-selected-filters.vue | 22 +- .../search/facets/price-filter-label.vue | 24 +- .../search/facets/searchable-filters.vue | 46 +-- .../search/facets/selected-filters.vue | 60 ++-- .../search/fallback-disclaimer-message.vue | 6 +- src/components/search/index.ts | 28 +- src/components/search/mobile-aside.vue | 36 +-- src/components/search/no-results-message.vue | 22 +- src/components/search/redirection.vue | 20 +- src/components/search/related-tags.vue | 56 ++-- .../results/custom-next-query-preview.vue | 70 ++--- .../search/results/partial-results.vue | 40 +-- src/components/search/results/results.vue | 94 +++--- src/components/search/sort.vue | 58 ++-- src/components/search/spellcheck-message.vue | 32 +- src/composables/use-device.composable.ts | 6 +- .../use-experience-controls.composable.ts | 26 +- .../use-has-searched.composable.ts | 24 +- .../use-predictive-helpers.composable.ts | 56 ++-- src/device-breakpoints.ts | 4 +- src/i18n/currencies.ts | 4 +- src/i18n/messages.types.ts | 194 ++++++------ src/i18n/messages/de.messages.json | 278 +++++++++--------- src/i18n/messages/es.messages.json | 2 +- src/shims-i18n.d.ts | 6 +- src/shims-x-components.d.ts | 4 +- src/store/index.ts | 6 +- src/tailwind/plugin-options.js | 12 +- .../wiring/semantic-queries.wiring.ts | 8 +- tailwind.config.js | 10 +- tests/.eslintrc.js | 6 +- tests/e2e/cucumber/banner.spec.ts | 8 +- tests/e2e/cucumber/column-picker.spec.ts | 16 +- tests/e2e/cucumber/global-definitions.ts | 8 +- tests/e2e/cucumber/mocked-responses.spec.ts | 48 +-- .../cucumber/multiple-interactions.spec.ts | 18 +- tests/e2e/cucumber/my-history.spec.ts | 26 +- tests/e2e/cucumber/no-results.spec.ts | 10 +- .../cucumber/predictive-components.spec.ts | 78 ++--- tests/e2e/cucumber/promoted.spec.ts | 6 +- tests/e2e/cucumber/results.spec.ts | 6 +- tests/e2e/cucumber/scroll.spec.ts | 34 +-- tests/e2e/cucumber/sort.spec.ts | 16 +- tests/e2e/cucumber/spellcheck.spec.ts | 6 +- tests/e2e/cucumber/tagging.spec.ts | 32 +- tests/e2e/cucumber/url.spec.ts | 12 +- tsconfig.json | 18 +- vite.config.mts | 18 +- 104 files changed, 1977 insertions(+), 1994 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index ae663145..3e6013da 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index cd054a6a..8b1fd55a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,15 +1,15 @@ --- name: Bug report description: Create a report to help us improve -title: "[BUG]: " +title: '[BUG]: ' labels: [bug] body: - type: markdown attributes: - value: "Thank you for taking the time to provide feedback!" + value: 'Thank you for taking the time to provide feedback!' - type: markdown attributes: - value: Before creating a new bug, please check for [existing issues](https://github.com/empathyco/x-archetype/issues). + value: Before creating a new bug, please check for [existing issues](https://github.com/empathyco/x-archetype/issues). - type: textarea id: bug-environment attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index a7c2b697..ab585390 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,29 +1,29 @@ --- name: Feature request description: Add a new suggestion for feature -title: "[FEATURE]: " -labels: [feature,enhancement] +title: '[FEATURE]: ' +labels: [feature, enhancement] body: - type: markdown attributes: - value: "Welcome!" + value: 'Welcome!' - type: markdown attributes: - value: When suggesting a new feature for the Interface X project, submit your idea as a user story and provide as much information as possible on how you would solve it, so the team can assess and analyze your idea. - When defining your new feature, you need to consider it from two points of view. - - - the **Final User** who accesses the commerce website that uses the component. + value: + When suggesting a new feature for the Interface X project, submit your idea as a user story and provide as much information as possible on how you would solve it, so the team can assess and analyze your idea. + When defining your new feature, you need to consider it from two points of view. - - the **Developer User** who is going to use the component to build a website. - - Depending on the feature, you may need to consider one or both. + - the **Final User** who accesses the commerce website that uses the component. + + - the **Developer User** who is going to use the component to build a website. + + Depending on the feature, you may need to consider one or both. - type: textarea id: suggestion attributes: label: How can the project be improved? description: Describe the problem encountered, what you need to solve it, and what you expect. Include details of other requirements that the feature must cover such as dependencies and actions covered by other services. - placeholder: - e.g. Display a list of search queries already performed by the user. / Each search query of the list has a button to delete it from the list. / The list of search queries must be maintained in the same device over time, even when the tab is closed. / If there are no search queries, then nothing should be displayed. + placeholder: e.g. Display a list of search queries already performed by the user. / Each search query of the list has a button to delete it from the list. / The list of search queries must be maintained in the same device over time, even when the tab is closed. / If there are no search queries, then nothing should be displayed. - type: textarea id: solution attributes: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b537a362..a802b19d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,13 @@ # Pull request template - + + + Describe the purpose of the change, the specific changes done in detail, and the issue you have fixed. ## Motivation and context + @@ -13,14 +16,18 @@ Describe the purpose of the change, the specific changes done in detail, and the - [ ] Open issue. If applicable, link: ## Type of change + + - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that causes existing functionality to not work as expected) - [ ] Change requires a documentation update ## What is the destination branch of this PR? + + - [ ] `Main` - [ ] Other. Specify: @@ -28,7 +35,7 @@ Describe the purpose of the change, the specific changes done in detail, and the -Tests performed according to [testing guidelines](https://github.com/empathyco/x/blob/main/.github/contributing/tests.md): +Tests performed according to [testing guidelines](https://github.com/empathyco/x/blob/main/.github/contributing/tests.md): ## Checklist: diff --git a/.github/actions/deploy/action.yaml b/.github/actions/deploy/action.yaml index 72aff284..1efbd945 100644 --- a/.github/actions/deploy/action.yaml +++ b/.github/actions/deploy/action.yaml @@ -14,11 +14,11 @@ inputs: description: cache value for s3 sync command required: true cloudfront_distribution_id: - description: the CloudFront cache id to invalidate - required: true + description: the CloudFront cache id to invalidate + required: true cloudfront_invalidation_paths: - description: the CloudFront path to invalidate - required: true + description: the CloudFront path to invalidate + required: true runs: using: 'composite' steps: @@ -33,4 +33,4 @@ runs: shell: bash - name: Invalidate CloudFront cache run: AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ inputs.cloudfront_distribution_id }} --paths ${{ inputs.cloudfront_invalidation_paths }} - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b4c6f8f4..c9768b34 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,16 +1,14 @@ - - # Learn more about CodeQL at https://codeql.github.com/docs/ # Learn more about code scanning at https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: # Runs periodically at 00:00 UTC on Monday - cron: '00 00 * * 1' @@ -26,11 +24,11 @@ jobs: fail-fast: false steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index 7e42075c..609b1844 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -1,8 +1,8 @@ name: Create and publish a Docker image # Configures this workflow to run every time a change is pushed to the `main` branch. -on: - push: +on: + push: branches: ['main'] # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. @@ -18,7 +18,7 @@ jobs: permissions: contents: read packages: write - # + # steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.postcssrc.js b/.postcssrc.js index 4f39c9bf..066e6110 100644 --- a/.postcssrc.js +++ b/.postcssrc.js @@ -6,6 +6,6 @@ module.exports = { require('postcss-import'), require('postcss-logical'), require('postcss-dir-pseudo-class'), - require('cssnano')({ preset: ['default', { mergeLonghand: false }] }) - ] -}; + require('cssnano')({ preset: ['default', { mergeLonghand: false }] }), + ], +} diff --git a/build/instrumentation.build.mjs b/build/instrumentation.build.mjs index cc8a9bf5..5b76a39f 100644 --- a/build/instrumentation.build.mjs +++ b/build/instrumentation.build.mjs @@ -1,18 +1,18 @@ -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import resolve from '@rollup/plugin-node-resolve'; -import replace from '@rollup/plugin-replace'; -import * as fs from 'fs'; -import path from 'path'; -import copy from 'rollup-plugin-copy'; -import del from 'rollup-plugin-delete'; -import htmlTemplate from 'rollup-plugin-generate-html-template'; -import sourcemaps from 'rollup-plugin-sourcemaps'; -import styles from 'rollup-plugin-styles'; -import { terser } from 'rollup-plugin-terser'; -import typescript from 'rollup-plugin-typescript2'; -import { visualizer } from 'rollup-plugin-visualizer'; -import vue3 from '@vitejs/plugin-vue'; +import commonjs from '@rollup/plugin-commonjs' +import json from '@rollup/plugin-json' +import resolve from '@rollup/plugin-node-resolve' +import replace from '@rollup/plugin-replace' +import * as fs from 'fs' +import path from 'path' +import copy from 'rollup-plugin-copy' +import del from 'rollup-plugin-delete' +import htmlTemplate from 'rollup-plugin-generate-html-template' +import sourcemaps from 'rollup-plugin-sourcemaps' +import styles from 'rollup-plugin-styles' +import { terser } from 'rollup-plugin-terser' +import typescript from 'rollup-plugin-typescript2' +import { visualizer } from 'rollup-plugin-visualizer' +import vue3 from '@vitejs/plugin-vue' /** * Creates a rollup configuration for projects that use X-Components. This configuration can be @@ -33,7 +33,7 @@ export function createConfig({ output, plugins = {}, prePlugins = [], - postPlugins = [] + postPlugins = [], } = {}) { /** * Merges a default config with the user one coming from this rollup plugin options. @@ -45,8 +45,8 @@ export function createConfig({ function mergeConfig(pluginName, defaultConfig = {}) { return { ...defaultConfig, - ...plugins[pluginName] - }; + ...plugins[pluginName], + } } const mergedOutput = { @@ -55,8 +55,8 @@ export function createConfig({ sourcemap: true, assetFileNames: '[name][extname]', entryFileNames: 'app.js', - ...output - }; + ...output, + } return { input, @@ -66,46 +66,46 @@ export function createConfig({ ...prePlugins, del( mergeConfig('del', { - targets: [`${mergedOutput.dir}/*`] - }) + targets: [`${mergedOutput.dir}/*`], + }), ), copy({ - targets: [{ src: ['public/**'], dest: `${mergedOutput.dir}` }] + targets: [{ src: ['public/**'], dest: `${mergedOutput.dir}` }], }), // Resolving plugins replace( mergeConfig('replace', { 'process.env.NODE_ENV': JSON.stringify('production'), 'process.env.VUE_APP_DEVELOPMENT_DOCKER': JSON.stringify( - !!process.env.VUE_APP_DEVELOPMENT_DOCKER + !!process.env.VUE_APP_DEVELOPMENT_DOCKER, ), STRIP_SSR_INJECTOR: true, - preventAssignment: true - }) + preventAssignment: true, + }), ), commonjs(mergeConfig('commonjs')), resolve( mergeConfig('resolve', { - browser: true - }) + browser: true, + }), ), // Code transpiling plugins vue3( mergeConfig('vue3', { template: { compilerOptions: { - whitespace: 'condense' - } - } - }) + whitespace: 'condense', + }, + }, + }), ), styles(mergeConfig('styles')), typescript( mergeConfig('typescript', { tsconfigOverride: { - exclude: ['node_modules', '**/*.spec.ts', '*test*'] - } - }) + exclude: ['node_modules', '**/*.spec.ts', '*test*'], + }, + }), ), json(), htmlTemplate( @@ -116,22 +116,22 @@ export function createConfig({ '': '', '': fs.readFileSync( - 'node_modules/@empathyco/x-archetype-utils/dist/home/home-template.html' - ) + 'node_modules/@empathyco/x-archetype-utils/dist/home/home-template.html', + ), }, - attrs: ["type='module'"] - }) + attrs: ["type='module'"], + }), ), sourcemaps(mergeConfig('sourcemaps')), terser( mergeConfig('terser', { - output: { comments: false } - }) + output: { comments: false }, + }), ), /* Can't calculate real minified size with `sourcemap: true` and `gzipSize: true`: https://github.com/btd/rollup-plugin-visualizer/issues/72 */ visualizer(mergeConfig('visualizer', { sourcemap: true })), - ...postPlugins - ] - }; + ...postPlugins, + ], + } } diff --git a/cypress.config.ts b/cypress.config.ts index 622fc891..7aee689f 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from 'cypress'; -import createBundler from '@bahmutov/cypress-esbuild-preprocessor'; -import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'; -import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild'; +import { defineConfig } from 'cypress' +import createBundler from '@bahmutov/cypress-esbuild-preprocessor' +import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor' +import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild' export default defineConfig({ e2e: { @@ -22,12 +22,12 @@ export default defineConfig({ // https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/quick-start.md async setupNodeEvents(on, config) { // This is required for the preprocessor to be able to generate JSON reports after each run, and more. - await addCucumberPreprocessorPlugin(on, config); + await addCucumberPreprocessorPlugin(on, config) - on('file:preprocessor', createBundler({ plugins: [createEsbuildPlugin(config)] })); + on('file:preprocessor', createBundler({ plugins: [createEsbuildPlugin(config)] })) // Make sure to return the config object as it might have been modified by the plugin. - return config; - } - } -}); + return config + }, + }, +}) diff --git a/docs/deployment.md b/docs/deployment.md index 3537236b..1a9f9ccf 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -3,11 +3,11 @@ This project uses the following [Jenkins file](https://github.com/empathyco/platform-jenkins-library/blob/master/vars/XComponentsPipeline.groovy). To deploy the project in the different environments you should take this into account: -| Environment | Branch | Tag | -|-------------|------------|-----------| -| test | any branch | test | -| staging | main | | -| production | main | release-* | +| Environment | Branch | Tag | +| ----------- | ---------- | ---------- | +| test | any branch | test | +| staging | main | | +| production | main | release-\* | Every time a commit is made to `main`, the changes are going to be deployed to `staging`. To deploy to `test` or `production` the correspondent tag must be created. @@ -15,5 +15,3 @@ To deploy to `test` or `production` the correspondent tag must be created. Every PR created will be deployed as a [PR Preview](./pr-preview.md) To do a rollback, the previous tag can be manually launched again in Jenkins. In main, a revert of the commit should be done. - - diff --git a/docs/i18n.md b/docs/i18n.md index 05049cb9..ead005c2 100644 --- a/docs/i18n.md +++ b/docs/i18n.md @@ -29,10 +29,10 @@ define the following messages for the next steps. export interface Messages { historyQueries: { - clear: string; - removeLabel: string; - title: string; - }; + clear: string + removeLabel: string + title: string + } } ``` @@ -52,9 +52,9 @@ includes english and spanish messages, so let's add a new german locale. historyQueries: { clear: 'Löschen Sie Verlaufsabfragen', removeLabel: 'Entfernen Sie {suggestion} aus Verlaufsabfragen', - title: 'Verlaufsabfragen' - } - }); + title: 'Verlaufsabfragen', + }, + }) ``` Have you noticed the `{suggestion}` inside the `removeLabel` message? This is to interpolate a @@ -67,7 +67,7 @@ includes english and spanish messages, so let's add a new german locale. ```typescript // File src/i18n/messages.index.ts -export { default as de } from './de.messages.ts'; +export { default as de } from './de.messages.ts' ``` Congratulations! Now you should be able to set `de` as a locale, and all the messages should be @@ -102,17 +102,17 @@ you were extending the `HistoryQueries` component you can write: ``` @@ -133,13 +133,13 @@ previously wrote: ```typescript // File src/i18n/messages.index.ts -export { default as de } from './de.messages.ts'; +export { default as de } from './de.messages.ts' ``` Simply change it to: ```typescript -export const de = () => import('./de.messages'); +export const de = () => import('./de.messages') ``` Now the german language will be split to another chunk in the build, and will not increase the diff --git a/docs/pr-preview.md b/docs/pr-preview.md index 95d65675..834d3eb1 100644 --- a/docs/pr-preview.md +++ b/docs/pr-preview.md @@ -6,7 +6,7 @@ environment **if the build and the tests execution were successful**. The url will follow the pattern: -```https://x.test.empathy.co/preview/${instance}/${pr_number}/index.html``` +`https://x.test.empathy.co/preview/${instance}/${pr_number}/index.html` Where the `instance` value must be configured for the `XComponentsPipeline` on the [Jenkinsfile](https://github.com/empathyco/x-archetype/blob/main/Jenkinsfile#L2) and the `pr_number` is the pull @@ -16,13 +16,9 @@ Every commit to the origin branch will update the deployment automatically. Afte add a comment to the pull request with the url to the preview. In the case of the `Archetype` this value will be ignored and the url will follow: -```https://x.test.empathy.co/preview/${pr_number}/index.html``` - +`https://x.test.empathy.co/preview/${pr_number}/index.html` ## Lifecycle -The pull request preview environment will be available during `7 days`. After this time the deployment will not be accessible. +The pull request preview environment will be available during `7 days`. After this time the deployment will not be accessible. This time can be configured via terraform. - - - diff --git a/index.html b/index.html index d16b633c..baa691c6 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + diff --git a/package.json b/package.json index 67118504..34109ef3 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "@empathyco/x-archetype", - "author": "Empathy Systems Corporation S.L.", "version": "1.0.0", + "private": true, + "description": "Starting point to setup a X Components project", + "author": "Empathy Systems Corporation S.L.", "license": "Apache-2.0", "homepage": "https://github.com/empathyco/x-archetype", - "description": "Starting point to setup a X Components project", - "private": true, "scripts": { "serve": "vite dev --host", "serve:docker": "VUE_APP_DEVELOPMENT_DOCKER=true vite dev", diff --git a/public/snippet-script.js b/public/snippet-script.js index 469488f0..ae0d2eb6 100644 --- a/public/snippet-script.js +++ b/public/snippet-script.js @@ -1,70 +1,70 @@ function getAllURLParameters() { - const parameterRegex = /[?&]+([^=&;$]+)=([^&#;$]*)/gi; - const parameters = {}; + const parameterRegex = /[?&]+([^=&;$]+)=([^&#;$]*)/gi + const parameters = {} while ((regexMatch = parameterRegex.exec(window.location.href)) !== null) { - parameters[regexMatch[1]] = decodeParameterValue(regexMatch[2]); + parameters[regexMatch[1]] = decodeParameterValue(regexMatch[2]) } - return parameters; + return parameters } function decodeParameterValue(parameterValue) { - return decodeURIComponent(parameterValue.replace(/\+/g, '%20')) || null; + return decodeURIComponent(parameterValue.replace(/\+/g, '%20')) || null } function popURLParameter(parametersDictionary, parameterKey) { - const parameterValue = parametersDictionary[parameterKey]; + const parameterValue = parametersDictionary[parameterKey] if (parameterValue) { - delete parametersDictionary[parameterKey]; - return parameterValue; + delete parametersDictionary[parameterKey] + return parameterValue } } -const URLParameters = getAllURLParameters(); -const popFromURLParameters = popURLParameter.bind(this, URLParameters); +const URLParameters = getAllURLParameters() +const popFromURLParameters = popURLParameter.bind(this, URLParameters) function getEnv() { - const env = popFromURLParameters('env'); + const env = popFromURLParameters('env') const envsDict = { live: '', staging: 'staging', - test: 'test' - }; + test: 'test', + } if (env) { - return envsDict[env]; + return envsDict[env] } if (!!document.location.host.match(/localhost|\.test\.|\.staging\./)) { - return 'staging'; + return 'staging' } - return undefined; + return undefined } function getIsolationStrategy() { - const isolation = popFromURLParameters('isolation'); + const isolation = popFromURLParameters('isolation') - return isolation === undefined ? undefined : isolation === 'true'; + return isolation === undefined ? undefined : isolation === 'true' } -const instance = popFromURLParameters('instance') || 'empathy'; -const env = getEnv(); -const scope = popFromURLParameters('scope') || 'desktop'; -const lang = popFromURLParameters('lang') || 'en'; -const device = popFromURLParameters('device') || undefined; -const uiLang = popFromURLParameters('uiLang') || lang; -const currency = popFromURLParameters('currency') || 'EUR'; -const consent = popFromURLParameters('consent') !== 'false'; -const documentDirection = popFromURLParameters('doc-dir') || 'ltr'; -const store = popFromURLParameters('store') || undefined; -const isolate = getIsolationStrategy(); -popFromURLParameters('query'); // prevent the query from be included as extra param -popFromURLParameters('filter'); // Prevent the filters to be included as extra param +const instance = popFromURLParameters('instance') || 'empathy' +const env = getEnv() +const scope = popFromURLParameters('scope') || 'desktop' +const lang = popFromURLParameters('lang') || 'en' +const device = popFromURLParameters('device') || undefined +const uiLang = popFromURLParameters('uiLang') || lang +const currency = popFromURLParameters('currency') || 'EUR' +const consent = popFromURLParameters('consent') !== 'false' +const documentDirection = popFromURLParameters('doc-dir') || 'ltr' +const store = popFromURLParameters('store') || undefined +const isolate = getIsolationStrategy() +popFromURLParameters('query') // prevent the query from be included as extra param +popFromURLParameters('filter') // Prevent the filters to be included as extra param -window.__enableVueDevtools__ = true; +window.__enableVueDevtools__ = true window.initX = { instance, env, @@ -82,51 +82,51 @@ window.initX = { { query: 'dress', title: 'Autumn dresses by Marni', - filters: ['brand:marni', 'categoryIds:12fad53d7'] + filters: ['brand:marni', 'categoryIds:12fad53d7'], }, { query: 'belted legging', filters: ['categoryIds:1b5f82125'], - title: 'Belted leggings' + title: 'Belted leggings', }, { query: 'bags', extraParams: { - sort: 'price desc' + sort: 'price desc', }, - title: 'Exclusive bags' + title: 'Exclusive bags', }, { query: 'sunglasses', - title: 'Sunshine ready' + title: 'Sunshine ready', }, { query: 'woven hat', - title: 'Elegant Sunshield' - } - ] -}; + title: 'Elegant Sunshield', + }, + ], +} window.addEventListener('load', () => { window.wysiwyg.setConfig({ auth: { baseUrl: 'https://iam.empathy.co', - clientId: 'wysiwyg' + clientId: 'wysiwyg', }, analytics: { - baseUrl: 'https://api.staging.empathy.co/statistics/v2' + baseUrl: 'https://api.staging.empathy.co/statistics/v2', }, conversational: { - baseUrl: 'https://gplay-rag.internal.test.empathy.co' + baseUrl: 'https://gplay-rag.internal.test.empathy.co', }, search: { - baseUrl: 'https://api.staging.empathy.co/search/v1' + baseUrl: 'https://api.staging.empathy.co/search/v1', }, instance, lang, audience: 'enterprise', playboardUrl: `https://playboard-platform.staging.empathy.co/${instance}`, appContainerSelector: '.x-root-container', - searchLayerSelector: '.x' - }); -}); + searchLayerSelector: '.x', + }) +}) diff --git a/rollup.config.mjs b/rollup.config.mjs index c1ac4c6a..ac062f57 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,5 +1,5 @@ -import { createConfig } from './build/instrumentation.build.mjs'; -import { rollupCssInjectorConfig } from "@empathyco/x-archetype-utils"; +import { createConfig } from './build/instrumentation.build.mjs' +import { rollupCssInjectorConfig } from '@empathyco/x-archetype-utils' export default createConfig({ /* @@ -10,16 +10,16 @@ export default createConfig({ chunkFileNames: chunkInfo => { switch (chunkInfo.name) { case 'custom-main-modal': - return 'x-empty-search-[hash].js'; + return 'x-empty-search-[hash].js' case 'index': - return 'x-search-[hash].js'; + return 'x-search-[hash].js' default: - return '[name].[hash].js'; + return '[name].[hash].js' } - } + }, }, plugins: { // Modify plugins options here. - ...rollupCssInjectorConfig - } -}); + ...rollupCssInjectorConfig, + }, +}) diff --git a/src/components/collapse-height-animation.vue b/src/components/collapse-height-animation.vue index 0bc0d45d..60d0c501 100644 --- a/src/components/collapse-height-animation.vue +++ b/src/components/collapse-height-animation.vue @@ -2,7 +2,7 @@
@@ -10,35 +10,35 @@ diff --git a/src/components/column-picker.vue b/src/components/column-picker.vue index ce56b129..d975e0d0 100644 --- a/src/components/column-picker.vue +++ b/src/components/column-picker.vue @@ -16,35 +16,35 @@ diff --git a/src/components/custom-header-toggle-panel.vue b/src/components/custom-header-toggle-panel.vue index 43c00ce0..14a9b849 100644 --- a/src/components/custom-header-toggle-panel.vue +++ b/src/components/custom-header-toggle-panel.vue @@ -14,26 +14,26 @@ diff --git a/src/components/custom-main-modal.vue b/src/components/custom-main-modal.vue index a6a8a057..b14335c0 100644 --- a/src/components/custom-main-modal.vue +++ b/src/components/custom-main-modal.vue @@ -6,25 +6,25 @@ diff --git a/src/components/custom-sliding-panel.vue b/src/components/custom-sliding-panel.vue index 52241482..fbc8bdbc 100644 --- a/src/components/custom-sliding-panel.vue +++ b/src/components/custom-sliding-panel.vue @@ -22,19 +22,19 @@ diff --git a/src/components/desktop/desktop-header-floating-predictive.vue b/src/components/desktop/desktop-header-floating-predictive.vue index 557dcea0..57dcacfb 100644 --- a/src/components/desktop/desktop-header-floating-predictive.vue +++ b/src/components/desktop/desktop-header-floating-predictive.vue @@ -20,22 +20,22 @@ diff --git a/src/components/desktop/desktop-header-full-predictive.vue b/src/components/desktop/desktop-header-full-predictive.vue index bdcf7dee..c3d37feb 100644 --- a/src/components/desktop/desktop-header-full-predictive.vue +++ b/src/components/desktop/desktop-header-full-predictive.vue @@ -23,22 +23,22 @@ diff --git a/src/components/desktop/desktop-sub-header.vue b/src/components/desktop/desktop-sub-header.vue index 410081d7..9daaf876 100644 --- a/src/components/desktop/desktop-sub-header.vue +++ b/src/components/desktop/desktop-sub-header.vue @@ -20,37 +20,37 @@ diff --git a/src/components/desktop/desktop-toolbar.vue b/src/components/desktop/desktop-toolbar.vue index 5d10f94b..2d2d7e81 100644 --- a/src/components/desktop/desktop-toolbar.vue +++ b/src/components/desktop/desktop-toolbar.vue @@ -37,18 +37,18 @@ diff --git a/src/components/desktop/desktop-top-section.vue b/src/components/desktop/desktop-top-section.vue index 4d31af29..b5e15d98 100644 --- a/src/components/desktop/desktop-top-section.vue +++ b/src/components/desktop/desktop-top-section.vue @@ -12,16 +12,16 @@ diff --git a/src/components/desktop/desktop.vue b/src/components/desktop/desktop.vue index 47e04ab2..ec755bda 100644 --- a/src/components/desktop/desktop.vue +++ b/src/components/desktop/desktop.vue @@ -52,52 +52,50 @@ diff --git a/src/components/history-query-filters.vue b/src/components/history-query-filters.vue index 3bb9b1ae..52375bd7 100644 --- a/src/components/history-query-filters.vue +++ b/src/components/history-query-filters.vue @@ -10,29 +10,29 @@ diff --git a/src/components/logo.vue b/src/components/logo.vue index 6d240619..35cfa600 100644 --- a/src/components/logo.vue +++ b/src/components/logo.vue @@ -54,8 +54,8 @@ diff --git a/src/components/main.vue b/src/components/main.vue index 6da52e81..4fb59430 100644 --- a/src/components/main.vue +++ b/src/components/main.vue @@ -17,34 +17,34 @@ diff --git a/src/components/mobile/mobile-close-aside.vue b/src/components/mobile/mobile-close-aside.vue index e47c6ad5..1c788440 100644 --- a/src/components/mobile/mobile-close-aside.vue +++ b/src/components/mobile/mobile-close-aside.vue @@ -17,14 +17,14 @@ diff --git a/src/components/mobile/mobile-open-aside.vue b/src/components/mobile/mobile-open-aside.vue index e5d16ea2..f2db9f10 100644 --- a/src/components/mobile/mobile-open-aside.vue +++ b/src/components/mobile/mobile-open-aside.vue @@ -17,13 +17,13 @@ diff --git a/src/components/mobile/mobile-sub-header.vue b/src/components/mobile/mobile-sub-header.vue index 157232c6..826829ec 100644 --- a/src/components/mobile/mobile-sub-header.vue +++ b/src/components/mobile/mobile-sub-header.vue @@ -12,28 +12,28 @@ diff --git a/src/components/mobile/mobile-toolbar.vue b/src/components/mobile/mobile-toolbar.vue index c9aae6bf..235cd724 100644 --- a/src/components/mobile/mobile-toolbar.vue +++ b/src/components/mobile/mobile-toolbar.vue @@ -16,16 +16,16 @@ diff --git a/src/components/mobile/mobile.vue b/src/components/mobile/mobile.vue index 02a8fd00..c8ff7150 100644 --- a/src/components/mobile/mobile.vue +++ b/src/components/mobile/mobile.vue @@ -77,66 +77,64 @@ diff --git a/src/components/my-history/custom-my-history.vue b/src/components/my-history/custom-my-history.vue index feb181b9..422c77e7 100644 --- a/src/components/my-history/custom-my-history.vue +++ b/src/components/my-history/custom-my-history.vue @@ -52,31 +52,31 @@ diff --git a/src/components/my-history/my-history-aside.vue b/src/components/my-history/my-history-aside.vue index adb9bfe3..5d9eafff 100644 --- a/src/components/my-history/my-history-aside.vue +++ b/src/components/my-history/my-history-aside.vue @@ -50,33 +50,33 @@ diff --git a/src/components/my-history/my-history-confirm-disable-modal.vue b/src/components/my-history/my-history-confirm-disable-modal.vue index a6d7e9e4..0bf98436 100644 --- a/src/components/my-history/my-history-confirm-disable-modal.vue +++ b/src/components/my-history/my-history-confirm-disable-modal.vue @@ -29,39 +29,39 @@ diff --git a/src/components/pre-search/pre-search-manager.vue b/src/components/pre-search/pre-search-manager.vue index d1ae46d8..176fdb26 100644 --- a/src/components/pre-search/pre-search-manager.vue +++ b/src/components/pre-search/pre-search-manager.vue @@ -8,50 +8,50 @@ diff --git a/src/components/predictive-layer/full-width-predictive.vue b/src/components/predictive-layer/full-width-predictive.vue index e1d72add..e0d05c13 100644 --- a/src/components/predictive-layer/full-width-predictive.vue +++ b/src/components/predictive-layer/full-width-predictive.vue @@ -62,7 +62,7 @@ @@ -140,123 +140,123 @@ diff --git a/src/components/predictive-layer/predictive-identifier-results.vue b/src/components/predictive-layer/predictive-identifier-results.vue index 64764c01..e68e09b2 100644 --- a/src/components/predictive-layer/predictive-identifier-results.vue +++ b/src/components/predictive-layer/predictive-identifier-results.vue @@ -20,23 +20,23 @@ diff --git a/src/components/predictive-layer/predictive-layer.vue b/src/components/predictive-layer/predictive-layer.vue index bf336296..0d580d67 100644 --- a/src/components/predictive-layer/predictive-layer.vue +++ b/src/components/predictive-layer/predictive-layer.vue @@ -123,90 +123,90 @@ diff --git a/src/components/predictive-layer/predictive-next-queries.vue b/src/components/predictive-layer/predictive-next-queries.vue index cb148877..e2a20e1a 100644 --- a/src/components/predictive-layer/predictive-next-queries.vue +++ b/src/components/predictive-layer/predictive-next-queries.vue @@ -23,23 +23,23 @@ diff --git a/src/components/predictive-layer/predictive-popular-searches.vue b/src/components/predictive-layer/predictive-popular-searches.vue index bd7ac907..a86ed2ad 100644 --- a/src/components/predictive-layer/predictive-popular-searches.vue +++ b/src/components/predictive-layer/predictive-popular-searches.vue @@ -22,22 +22,22 @@ diff --git a/src/components/predictive-layer/predictive-query-suggestions.vue b/src/components/predictive-layer/predictive-query-suggestions.vue index 5cb0d3d5..d281277d 100644 --- a/src/components/predictive-layer/predictive-query-suggestions.vue +++ b/src/components/predictive-layer/predictive-query-suggestions.vue @@ -19,23 +19,23 @@ diff --git a/src/components/predictive-layer/sliding-recommendations.vue b/src/components/predictive-layer/sliding-recommendations.vue index 9398dcf7..754f9334 100644 --- a/src/components/predictive-layer/sliding-recommendations.vue +++ b/src/components/predictive-layer/sliding-recommendations.vue @@ -40,23 +40,23 @@
diff --git a/src/components/results/custom-recommendations.vue b/src/components/results/custom-recommendations.vue index f39c582b..d6f2b55a 100644 --- a/src/components/results/custom-recommendations.vue +++ b/src/components/results/custom-recommendations.vue @@ -26,27 +26,27 @@ diff --git a/src/components/results/result.vue b/src/components/results/result.vue index 0616a462..6d041e4a 100644 --- a/src/components/results/result.vue +++ b/src/components/results/result.vue @@ -53,44 +53,44 @@ diff --git a/src/components/scroll-to-top.vue b/src/components/scroll-to-top.vue index 16c4273c..6f9931f6 100644 --- a/src/components/scroll-to-top.vue +++ b/src/components/scroll-to-top.vue @@ -10,21 +10,21 @@ diff --git a/src/components/search-box.vue b/src/components/search-box.vue index c02571e7..da2a2ba8 100644 --- a/src/components/search-box.vue +++ b/src/components/search-box.vue @@ -28,25 +28,25 @@ diff --git a/src/components/search/custom-semantic-queries.vue b/src/components/search/custom-semantic-queries.vue index 70f3fe38..f1c888c9 100644 --- a/src/components/search/custom-semantic-queries.vue +++ b/src/components/search/custom-semantic-queries.vue @@ -41,34 +41,34 @@ diff --git a/src/components/search/desktop-aside.vue b/src/components/search/desktop-aside.vue index 88a2a04b..bc9319d3 100644 --- a/src/components/search/desktop-aside.vue +++ b/src/components/search/desktop-aside.vue @@ -31,22 +31,22 @@ diff --git a/src/components/search/display-click-provider.vue b/src/components/search/display-click-provider.vue index 5d9fa98b..0a8dae73 100644 --- a/src/components/search/display-click-provider.vue +++ b/src/components/search/display-click-provider.vue @@ -1,47 +1,47 @@ diff --git a/src/components/search/facets/custom-facets.vue b/src/components/search/facets/custom-facets.vue index 93d993f8..7010631a 100644 --- a/src/components/search/facets/custom-facets.vue +++ b/src/components/search/facets/custom-facets.vue @@ -115,44 +115,44 @@ diff --git a/src/components/search/facets/custom-sliced-filters.vue b/src/components/search/facets/custom-sliced-filters.vue index 7a0bda41..31eaea01 100644 --- a/src/components/search/facets/custom-sliced-filters.vue +++ b/src/components/search/facets/custom-sliced-filters.vue @@ -13,15 +13,15 @@ diff --git a/src/components/search/facets/facet-selected-filters.vue b/src/components/search/facets/facet-selected-filters.vue index ed0baffe..66f24457 100644 --- a/src/components/search/facets/facet-selected-filters.vue +++ b/src/components/search/facets/facet-selected-filters.vue @@ -9,16 +9,16 @@ diff --git a/src/components/search/facets/price-filter-label.vue b/src/components/search/facets/price-filter-label.vue index 24a64917..8d9ae10b 100644 --- a/src/components/search/facets/price-filter-label.vue +++ b/src/components/search/facets/price-filter-label.vue @@ -8,17 +8,17 @@ diff --git a/src/components/search/facets/searchable-filters.vue b/src/components/search/facets/searchable-filters.vue index f4464992..c1fda910 100644 --- a/src/components/search/facets/searchable-filters.vue +++ b/src/components/search/facets/searchable-filters.vue @@ -9,31 +9,31 @@ diff --git a/src/components/search/facets/selected-filters.vue b/src/components/search/facets/selected-filters.vue index af982ca0..2505c055 100644 --- a/src/components/search/facets/selected-filters.vue +++ b/src/components/search/facets/selected-filters.vue @@ -55,41 +55,41 @@ diff --git a/src/components/search/fallback-disclaimer-message.vue b/src/components/search/fallback-disclaimer-message.vue index a6b5dc17..5a7f1b19 100644 --- a/src/components/search/fallback-disclaimer-message.vue +++ b/src/components/search/fallback-disclaimer-message.vue @@ -9,7 +9,7 @@ diff --git a/src/components/search/index.ts b/src/components/search/index.ts index aa05db86..587ac630 100644 --- a/src/components/search/index.ts +++ b/src/components/search/index.ts @@ -1,15 +1,15 @@ -import DesktopAside from './desktop-aside.vue'; -import CustomFacets from './facets/custom-facets.vue'; -import SelectedFilters from './facets/selected-filters.vue'; -import FallbackDisclaimerMessage from './fallback-disclaimer-message.vue'; -import MobileAside from './mobile-aside.vue'; -import NoResultsMessage from './no-results-message.vue'; -import Redirection from './redirection.vue'; -import RelatedTags from './related-tags.vue'; -import PartialResults from './results/partial-results.vue'; -import Results from './results/results.vue'; -import Sort from './sort.vue'; -import SpellcheckMessage from './spellcheck-message.vue'; +import DesktopAside from './desktop-aside.vue' +import CustomFacets from './facets/custom-facets.vue' +import SelectedFilters from './facets/selected-filters.vue' +import FallbackDisclaimerMessage from './fallback-disclaimer-message.vue' +import MobileAside from './mobile-aside.vue' +import NoResultsMessage from './no-results-message.vue' +import Redirection from './redirection.vue' +import RelatedTags from './related-tags.vue' +import PartialResults from './results/partial-results.vue' +import Results from './results/results.vue' +import Sort from './sort.vue' +import SpellcheckMessage from './spellcheck-message.vue' export { CustomFacets, @@ -23,5 +23,5 @@ export { Results, SelectedFilters, Sort, - SpellcheckMessage -}; + SpellcheckMessage, +} diff --git a/src/components/search/mobile-aside.vue b/src/components/search/mobile-aside.vue index 42282b4c..5ae87ebd 100644 --- a/src/components/search/mobile-aside.vue +++ b/src/components/search/mobile-aside.vue @@ -15,23 +15,23 @@ diff --git a/src/components/search/no-results-message.vue b/src/components/search/no-results-message.vue index 96d25eb8..a94c4aa1 100644 --- a/src/components/search/no-results-message.vue +++ b/src/components/search/no-results-message.vue @@ -14,18 +14,18 @@ diff --git a/src/components/search/redirection.vue b/src/components/search/redirection.vue index 9d887e72..9e663241 100644 --- a/src/components/search/redirection.vue +++ b/src/components/search/redirection.vue @@ -25,15 +25,15 @@ diff --git a/src/components/search/related-tags.vue b/src/components/search/related-tags.vue index bae80827..6cfc7f09 100644 --- a/src/components/search/related-tags.vue +++ b/src/components/search/related-tags.vue @@ -29,39 +29,39 @@ diff --git a/src/components/search/results/custom-next-query-preview.vue b/src/components/search/results/custom-next-query-preview.vue index a81ec993..4bf5d9e2 100644 --- a/src/components/search/results/custom-next-query-preview.vue +++ b/src/components/search/results/custom-next-query-preview.vue @@ -43,46 +43,46 @@ diff --git a/src/components/search/results/partial-results.vue b/src/components/search/results/partial-results.vue index f1155578..c4dba499 100644 --- a/src/components/search/results/partial-results.vue +++ b/src/components/search/results/partial-results.vue @@ -31,26 +31,26 @@ diff --git a/src/components/search/results/results.vue b/src/components/search/results/results.vue index 9a1ea14f..2df5859d 100644 --- a/src/components/search/results/results.vue +++ b/src/components/search/results/results.vue @@ -42,60 +42,60 @@ diff --git a/src/components/search/sort.vue b/src/components/search/sort.vue index 56b729d8..bedbaabc 100644 --- a/src/components/search/sort.vue +++ b/src/components/search/sort.vue @@ -24,39 +24,39 @@ diff --git a/src/components/search/spellcheck-message.vue b/src/components/search/spellcheck-message.vue index da8554b4..f4bc98de 100644 --- a/src/components/search/spellcheck-message.vue +++ b/src/components/search/spellcheck-message.vue @@ -15,23 +15,23 @@ diff --git a/src/composables/use-device.composable.ts b/src/composables/use-device.composable.ts index d9d4189f..c2a7911d 100644 --- a/src/composables/use-device.composable.ts +++ b/src/composables/use-device.composable.ts @@ -1,4 +1,4 @@ -import { createUseDevice } from '@empathyco/x-components'; -import { breakpoints } from '../device-breakpoints'; +import { createUseDevice } from '@empathyco/x-components' +import { breakpoints } from '../device-breakpoints' -export const useDevice = createUseDevice(breakpoints); +export const useDevice = createUseDevice(breakpoints) diff --git a/src/composables/use-experience-controls.composable.ts b/src/composables/use-experience-controls.composable.ts index 11d34cae..fb6a1c52 100644 --- a/src/composables/use-experience-controls.composable.ts +++ b/src/composables/use-experience-controls.composable.ts @@ -1,7 +1,7 @@ -import type { ComputedRef } from 'vue'; -import { useState } from '@empathyco/x-components'; -import { getSafePropertyChain } from '@empathyco/x-utils'; -import { computed } from 'vue'; +import type { ComputedRef } from 'vue' +import { useState } from '@empathyco/x-components' +import { getSafePropertyChain } from '@empathyco/x-utils' +import { computed } from 'vue' /** * Given a controls' object property chain, gets the experience controls values from the response. @@ -11,20 +11,20 @@ import { computed } from 'vue'; * and set the experience controls property value. */ export const useExperienceControls = (): { - getControlFromPath: (path: string, defaultValue?: SomeType) => ComputedRef; + getControlFromPath: (path: string, defaultValue?: SomeType) => ComputedRef } => { - const experienceControls = useState('experienceControls', ['controls']).controls; + const experienceControls = useState('experienceControls', ['controls']).controls const getControlFromPath = ( path: string, - defaultValue?: SomeType + defaultValue?: SomeType, ): ComputedRef => { return computed(() => { - return getSafePropertyChain(experienceControls.value, path, defaultValue) as SomeType; - }); - }; + return getSafePropertyChain(experienceControls.value, path, defaultValue) as SomeType + }) + } return { - getControlFromPath - }; -}; + getControlFromPath, + } +} diff --git a/src/composables/use-has-searched.composable.ts b/src/composables/use-has-searched.composable.ts index 8aac8b34..8e1815eb 100644 --- a/src/composables/use-has-searched.composable.ts +++ b/src/composables/use-has-searched.composable.ts @@ -1,23 +1,23 @@ -import type { Ref} from 'vue'; -import { isStringEmpty, useXBus } from '@empathyco/x-components'; -import { ref } from 'vue'; +import type { Ref } from 'vue' +import { isStringEmpty, useXBus } from '@empathyco/x-components' +import { ref } from 'vue' export const useHasSearched = (): { hasSearched: Ref } => { - const bus = useXBus(); - const hasSearched = ref(false); + const bus = useXBus() + const hasSearched = ref(false) const searchEvents = [ 'UserAcceptedAQuery', 'ParamsLoadedFromUrl', - 'UserAcceptedAQueryPreview' - ] as const; + 'UserAcceptedAQueryPreview', + ] as const searchEvents.forEach(event => { bus.on(event, true).subscribe(({ eventPayload }) => { if (typeof eventPayload === 'string' || !isStringEmpty(eventPayload.query)) { - hasSearched.value = true; + hasSearched.value = true } - }); - }); + }) + }) - return { hasSearched }; -}; + return { hasSearched } +} diff --git a/src/composables/use-predictive-helpers.composable.ts b/src/composables/use-predictive-helpers.composable.ts index 4563fb5a..1adbaa8b 100644 --- a/src/composables/use-predictive-helpers.composable.ts +++ b/src/composables/use-predictive-helpers.composable.ts @@ -1,15 +1,15 @@ -import type { ComputedRef } from 'vue'; -import { use$x } from '@empathyco/x-components'; -import { computed } from 'vue'; +import type { ComputedRef } from 'vue' +import { use$x } from '@empathyco/x-components' +import { computed } from 'vue' interface PredictiveHelpers { - navigationHijacker: { xEvent: string; moduleName: string; direction: string }[]; - showIdentifierResults: ComputedRef; - showHistoryQueries: ComputedRef; - showQuerySuggestions: ComputedRef; - showNextQueries: ComputedRef; - showPopularSearches: ComputedRef; - showEmpathize: ComputedRef; + navigationHijacker: { xEvent: string; moduleName: string; direction: string }[] + showIdentifierResults: ComputedRef + showHistoryQueries: ComputedRef + showQuerySuggestions: ComputedRef + showNextQueries: ComputedRef + showPopularSearches: ComputedRef + showEmpathize: ComputedRef } /** @@ -20,32 +20,32 @@ interface PredictiveHelpers { export const usePredictiveHelpers = (): PredictiveHelpers => { const navigationHijacker = [ { xEvent: 'UserPressedArrowKey', moduleName: 'scroll', direction: 'ArrowDown' }, - { xEvent: 'UserPressedArrowKey', moduleName: 'searchBox', direction: 'ArrowDown' } - ]; + { xEvent: 'UserPressedArrowKey', moduleName: 'searchBox', direction: 'ArrowDown' }, + ] - const $x = use$x(); + const $x = use$x() const showIdentifierResults = computed(() => { - return $x.identifierResults.length > 0; - }); + return $x.identifierResults.length > 0 + }) const showHistoryQueries = computed(() => { - return $x.historyQueriesWithResults.length > 0; - }); + return $x.historyQueriesWithResults.length > 0 + }) const showQuerySuggestions = computed(() => { return ( !!$x.query.searchBox && $x.identifierResults.length === 0 && $x.querySuggestions.length > 0 - ); - }); + ) + }) const showNextQueries = computed(() => { - return $x.nextQueries.length > 0 && $x.identifierResults.length === 0; - }); + return $x.nextQueries.length > 0 && $x.identifierResults.length === 0 + }) const showPopularSearches = computed(() => { - return $x.popularSearches.length > 0 && !$x.query.searchBox; - }); + return $x.popularSearches.length > 0 && !$x.query.searchBox + }) const showEmpathize = computed(() => { return ( @@ -53,8 +53,8 @@ export const usePredictiveHelpers = (): PredictiveHelpers => { showQuerySuggestions.value || showNextQueries.value || showPopularSearches.value - ); - }); + ) + }) return { navigationHijacker, @@ -63,6 +63,6 @@ export const usePredictiveHelpers = (): PredictiveHelpers => { showQuerySuggestions, showNextQueries, showPopularSearches, - showEmpathize - }; -}; + showEmpathize, + } +} diff --git a/src/device-breakpoints.ts b/src/device-breakpoints.ts index 9b8d89b8..b3c19a1a 100644 --- a/src/device-breakpoints.ts +++ b/src/device-breakpoints.ts @@ -2,5 +2,5 @@ export const breakpoints = { mobile: 0, tablet: 744, desktop: 1280, - large: 2560 -}; + large: 2560, +} diff --git a/src/i18n/currencies.ts b/src/i18n/currencies.ts index 729708c9..a2c6990e 100644 --- a/src/i18n/currencies.ts +++ b/src/i18n/currencies.ts @@ -1,4 +1,4 @@ export default { EUR: 'i.iii,dd €', - USD: '$i,iii.dd' -} as Record; + USD: '$i,iii.dd', +} as Record diff --git a/src/i18n/messages.types.ts b/src/i18n/messages.types.ts index 67ff08f1..162cf38c 100644 --- a/src/i18n/messages.types.ts +++ b/src/i18n/messages.types.ts @@ -2,130 +2,130 @@ export interface Messages { searchBox: { - clear: string; - placeholder: string; - }; + clear: string + placeholder: string + } popularSearches: { - title: string; - }; + title: string + } historyQueries: { - clear: string; - removeLabel: string; - title: string; - }; + clear: string + removeLabel: string + title: string + } myHistory: { - title: string; - subtitle: string; + title: string + subtitle: string message: { - header: string; - body: string; - footer: string; - }; - noHistory: string; - openButton: string; - suggestionResults: string; + header: string + body: string + footer: string + } + noHistory: string + openButton: string + suggestionResults: string switch: { - title: string; - enable: string; - disable: string; - }; + title: string + enable: string + disable: string + } confirmDisableModal: { - title: string; - message: string; - dismiss: string; - confirm: string; - }; - }; + title: string + message: string + dismiss: string + confirm: string + } + } nextQueries: { - title: string; - }; + title: string + } nextQueriesGroup: { - message: string; - }; + message: string + } nextQueryPreview: { - message: string; - query: string; - totalResults: string; - viewResults: string; - }; + message: string + query: string + totalResults: string + viewResults: string + } identifierResults: { - title: string; - }; + title: string + } recommendations: { - title: string; - }; + title: string + } facets: { - gender: string; - categoryPaths: string; - price: string; - brand: string; - fit: string; - collection: string; - genres: string; - isAdult: string; - type: string; - runtimeMinutes: string; - }; + gender: string + categoryPaths: string + price: string + brand: string + fit: string + collection: string + genres: string + isAdult: string + type: string + runtimeMinutes: string + } facetsPanel: { - title: string; - viewResults: string; - }; + title: string + viewResults: string + } filters: { - all: string; - showMore: string; - showLess: string; - }; + all: string + showMore: string + showLess: string + } partialResults: { - query: string; - totalResults: string; - viewResults: string; - }; + query: string + totalResults: string + viewResults: string + } priceFilter: { - lessThan: string; - fromTo: string; - from: string; - }; + lessThan: string + fromTo: string + from: string + } toggleAside: { - showAside: string; - }; + showAside: string + } totalResults: { - message: string; - }; + message: string + } semanticQueries: { - title: string; - }; + title: string + } sort: { - label: string; + label: string values: { - 'price asc': string; - 'price desc': string; - default: string; - }; - }; + 'price asc': string + 'price desc': string + default: string + } + } selectedFilters: { - clear: string; - }; + clear: string + } result: { - addToCart: string; - }; + addToCart: string + } spellcheck: { - message: string; - }; + message: string + } noResults: { - message: string; - }; + message: string + } fallbackDisclaimer: { - message: string; - }; + message: string + } columnPicker: { - message: string; - }; + message: string + } queryPreview: { - viewResults: string; - }; + viewResults: string + } redirections: { - title: string; - accept: string; - reject: string; - }; + title: string + accept: string + reject: string + } } diff --git a/src/i18n/messages/de.messages.json b/src/i18n/messages/de.messages.json index 6e2e9bba..19b594a7 100644 --- a/src/i18n/messages/de.messages.json +++ b/src/i18n/messages/de.messages.json @@ -1,145 +1,145 @@ { - "base": { - "searchBox": { - "clear": "Löschen", - "placeholder": "Wonach suchen Sie?" - }, - "popularSearches": { - "title": "Beliebte Suchanfragen" - }, - "historyQueries": { - "clear": "Alle löschen", - "removeLabel": "{suggestion} aus Verlauf löschen", - "title": "Verlaufsanfragen" - }, - "myHistory": { - "title": "Mein Verlauf", - "subtitle": "Dies ist die vollständige Liste der Verlaufsanfragen", - "message": { - "header": "Diese Daten werden lokal gespeichert. Nur auf Ihrem Gerät und verlassen es nie.", - "body": "Sie können die Verlaufsanfragen jederzeit deaktivieren.", - "footer": "Ihre Privatsphäre unter Ihrer Kontrolle." - }, - "noHistory": "Keine Verlaufaktivität vorhanden", - "openButton": "Mein Verlauf", - "suggestionResults": "({totalResults} Ergebnisse)", - "switch": { - "title": "Verlaufsanfragen", - "enable": "Aktivieren", - "disable": "Deaktivieren und löschen" - }, - "confirmDisableModal": { - "title": "Verlaufsanfragen deaktivieren?", - "message": "Durch Deaktivieren der Verlaufsanfragen löschen Sie auch die gesamte Verlaufsliste.", - "dismiss": "Abbrechen", - "confirm": "Deaktivieren" - } - }, - "nextQueries": { - "title": "Was kommt als Nächstes" - }, - "nextQueriesGroup": { - "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:" - }, - "nextQueryPreview": { - "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:", - "query": "{query}", - "totalResults": "({totalResults})", - "viewResults": "Alle Ergebnisse anzeigen" - }, - "identifierResults": { - "title": "SKU-Suche" - }, - "recommendations": { - "title": "Top-Klicks" - }, - "facets": { - "gender": "Geschlecht", - "categoryPaths": "Kategorien", - "price": "Preis", - "brand": "Marke", - "fit": "Passform", - "collection": "Kollektion", - "genres": "Geschlechter", - "isAdult": "Inhalt für", - "type": "Kerl", - "runtimeMinutes": "Dauer in Minuten" - }, - "facetsPanel": { - "title": "SORTIEREN & FILTERN", - "viewResults": "ERGEBNISSE ANZEIGEN ({totalResults})" - }, - "filters": { - "all": "Alle", - "showMore": "Mehr anzeigen", - "showLess": "Weniger anzeigen" - }, - "partialResults": { - "query": "{query}", - "totalResults": "({totalResults})", - "viewResults": "Alle anzeigen" - }, - "priceFilter": { - "lessThan": "weniger als {'{max}'}", - "fromTo": "{'{min}'} - {'{max}'}", - "from": "ab {'{min}'}" - }, - "toggleAside": { - "showAside": "Sortieren & Filtern" - }, - "totalResults": { - "message": "{totalResults} Ergebnisse für {query}" - }, - "semanticQueries": { - "title": "Sind Sie an „{query}“ interessiert? Entdecken Sie diese Vorschläge:" - }, - "sort": { - "label": "Sortieren nach", - "values": { - "price asc": "Preis: Niedrig bis Hoch", - "price desc": "Preis: Hoch bis Niedrig", - "default": "Relevanz" - } - }, - "selectedFilters": { - "clear": "FILTER LÖSCHEN ({selectedFiltersNumber})" - }, - "result": { - "addToCart": "IN DEN WARENKORB LEGEN" - }, - "spellcheck": { - "message": "Keine Ergebnisse gefunden für {query}. Wir zeigen Ihnen Ergebnisse für" - }, - "noResults": { - "message": "Es tut uns leid, aber es gibt keine Ergebnisse für {query}. Sie könnten an diesen Produkten interessiert sein" - }, - "fallbackDisclaimer": { - "message": "Keine Ergebnisse gefunden für {query} mit den ausgewählten Filtern. Die Filter wurden aufgehoben" - }, - "columnPicker": { - "message": "Ansicht" - }, - "queryPreview": { - "viewResults": "Alle Ergebnisse anzeigen" - }, - "redirections": { - "title": "Ihre Suche entspricht einem besonderen Ort auf unserer Website. Um ihn zu besuchen, werden Sie umgeleitet", - "accept": "Ja, leite mich um", - "reject": "Nein, ich bleibe hier" + "base": { + "searchBox": { + "clear": "Löschen", + "placeholder": "Wonach suchen Sie?" + }, + "popularSearches": { + "title": "Beliebte Suchanfragen" + }, + "historyQueries": { + "clear": "Alle löschen", + "removeLabel": "{suggestion} aus Verlauf löschen", + "title": "Verlaufsanfragen" + }, + "myHistory": { + "title": "Mein Verlauf", + "subtitle": "Dies ist die vollständige Liste der Verlaufsanfragen", + "message": { + "header": "Diese Daten werden lokal gespeichert. Nur auf Ihrem Gerät und verlassen es nie.", + "body": "Sie können die Verlaufsanfragen jederzeit deaktivieren.", + "footer": "Ihre Privatsphäre unter Ihrer Kontrolle." + }, + "noHistory": "Keine Verlaufaktivität vorhanden", + "openButton": "Mein Verlauf", + "suggestionResults": "({totalResults} Ergebnisse)", + "switch": { + "title": "Verlaufsanfragen", + "enable": "Aktivieren", + "disable": "Deaktivieren und löschen" + }, + "confirmDisableModal": { + "title": "Verlaufsanfragen deaktivieren?", + "message": "Durch Deaktivieren der Verlaufsanfragen löschen Sie auch die gesamte Verlaufsliste.", + "dismiss": "Abbrechen", + "confirm": "Deaktivieren" } }, - "mobile": { - "nextQueriesGroup": { - "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:" - }, - "nextQueryPreview": { - "viewResults": "Alle anzeigen" - }, - "totalResults": { - "message": "{totalResults} Ergebnisse" - }, - "queryPreview": { - "viewResults": "Alle anzeigen" + "nextQueries": { + "title": "Was kommt als Nächstes" + }, + "nextQueriesGroup": { + "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:" + }, + "nextQueryPreview": { + "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:", + "query": "{query}", + "totalResults": "({totalResults})", + "viewResults": "Alle Ergebnisse anzeigen" + }, + "identifierResults": { + "title": "SKU-Suche" + }, + "recommendations": { + "title": "Top-Klicks" + }, + "facets": { + "gender": "Geschlecht", + "categoryPaths": "Kategorien", + "price": "Preis", + "brand": "Marke", + "fit": "Passform", + "collection": "Kollektion", + "genres": "Geschlechter", + "isAdult": "Inhalt für", + "type": "Kerl", + "runtimeMinutes": "Dauer in Minuten" + }, + "facetsPanel": { + "title": "SORTIEREN & FILTERN", + "viewResults": "ERGEBNISSE ANZEIGEN ({totalResults})" + }, + "filters": { + "all": "Alle", + "showMore": "Mehr anzeigen", + "showLess": "Weniger anzeigen" + }, + "partialResults": { + "query": "{query}", + "totalResults": "({totalResults})", + "viewResults": "Alle anzeigen" + }, + "priceFilter": { + "lessThan": "weniger als {'{max}'}", + "fromTo": "{'{min}'} - {'{max}'}", + "from": "ab {'{min}'}" + }, + "toggleAside": { + "showAside": "Sortieren & Filtern" + }, + "totalResults": { + "message": "{totalResults} Ergebnisse für {query}" + }, + "semanticQueries": { + "title": "Sind Sie an „{query}“ interessiert? Entdecken Sie diese Vorschläge:" + }, + "sort": { + "label": "Sortieren nach", + "values": { + "price asc": "Preis: Niedrig bis Hoch", + "price desc": "Preis: Hoch bis Niedrig", + "default": "Relevanz" } + }, + "selectedFilters": { + "clear": "FILTER LÖSCHEN ({selectedFiltersNumber})" + }, + "result": { + "addToCart": "IN DEN WARENKORB LEGEN" + }, + "spellcheck": { + "message": "Keine Ergebnisse gefunden für {query}. Wir zeigen Ihnen Ergebnisse für" + }, + "noResults": { + "message": "Es tut uns leid, aber es gibt keine Ergebnisse für {query}. Sie könnten an diesen Produkten interessiert sein" + }, + "fallbackDisclaimer": { + "message": "Keine Ergebnisse gefunden für {query} mit den ausgewählten Filtern. Die Filter wurden aufgehoben" + }, + "columnPicker": { + "message": "Ansicht" + }, + "queryPreview": { + "viewResults": "Alle Ergebnisse anzeigen" + }, + "redirections": { + "title": "Ihre Suche entspricht einem besonderen Ort auf unserer Website. Um ihn zu besuchen, werden Sie umgeleitet", + "accept": "Ja, leite mich um", + "reject": "Nein, ich bleibe hier" + } + }, + "mobile": { + "nextQueriesGroup": { + "message": "Diejenigen, die nach {query} gesucht haben, haben auch angesehen:" + }, + "nextQueryPreview": { + "viewResults": "Alle anzeigen" + }, + "totalResults": { + "message": "{totalResults} Ergebnisse" + }, + "queryPreview": { + "viewResults": "Alle anzeigen" } } +} diff --git a/src/i18n/messages/es.messages.json b/src/i18n/messages/es.messages.json index a49a5487..07c12789 100644 --- a/src/i18n/messages/es.messages.json +++ b/src/i18n/messages/es.messages.json @@ -123,7 +123,7 @@ "viewResults": "Ver todos los resultados" }, "redirections": { - "title": "Tu búsqueda coincide con una página especial de nuestra web, vas a ser redirigido a:", + "title": "Tu búsqueda coincide con una página especial de nuestra web, vas a ser redirigido a:", "accept": "Sí, redirígeme", "reject": "No, me quedaré aquí" } diff --git a/src/shims-i18n.d.ts b/src/shims-i18n.d.ts index c1d44480..d7eaf56f 100644 --- a/src/shims-i18n.d.ts +++ b/src/shims-i18n.d.ts @@ -1,9 +1,9 @@ // https://vuejs.org/guide/typescript/options-api.html#type-augmentation-placement -export {}; +export {} declare module 'vue' { interface ComponentCustomProperties { - $setLocale: (lang: string) => void; - $setLocaleDevice: (device: string) => void; + $setLocale: (lang: string) => void + $setLocaleDevice: (device: string) => void } } diff --git a/src/shims-x-components.d.ts b/src/shims-x-components.d.ts index 7769b06e..303339ba 100644 --- a/src/shims-x-components.d.ts +++ b/src/shims-x-components.d.ts @@ -1,7 +1,7 @@ -import type { SemanticQueriesConfig } from '@empathyco/x-components/semantic-queries'; +import type { SemanticQueriesConfig } from '@empathyco/x-components/semantic-queries' declare module '@empathyco/x-components' { interface XEventsTypes { - SemanticQueriesConfigProvided: SemanticQueriesConfig; + SemanticQueriesConfigProvided: SemanticQueriesConfig } } diff --git a/src/store/index.ts b/src/store/index.ts index c4f7a18f..52007b97 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,9 +1,9 @@ -import { createStore } from 'vuex'; +import { createStore } from 'vuex' export default createStore({ strict: false, state: {}, mutations: {}, actions: {}, - modules: {} -}); + modules: {}, +}) diff --git a/src/tailwind/plugin-options.js b/src/tailwind/plugin-options.js index 6455c576..c0aec89d 100644 --- a/src/tailwind/plugin-options.js +++ b/src/tailwind/plugin-options.js @@ -15,11 +15,11 @@ module.exports = { textAlign: 'center', '@screen desktop': { paddingTop: theme('spacing.24'), - paddingBottom: theme('spacing.24') - } + paddingBottom: theme('spacing.24'), + }, }, '.transform-style-3d': { - transformStyle: 'preserve-3d' - } - }) -}; + transformStyle: 'preserve-3d', + }, + }), +} diff --git a/src/x-components/wiring/semantic-queries.wiring.ts b/src/x-components/wiring/semantic-queries.wiring.ts index b832f05c..15aac44f 100644 --- a/src/x-components/wiring/semantic-queries.wiring.ts +++ b/src/x-components/wiring/semantic-queries.wiring.ts @@ -1,7 +1,7 @@ -import { namespacedWireCommit } from '@empathyco/x-components'; +import { namespacedWireCommit } from '@empathyco/x-components' -const moduleName = 'semanticQueries'; +const moduleName = 'semanticQueries' -const wireCommit = namespacedWireCommit(moduleName); +const wireCommit = namespacedWireCommit(moduleName) -export const mergeSemanticQueriesConfigWire = wireCommit('mergeConfig'); +export const mergeSemanticQueriesConfigWire = wireCommit('mergeConfig') diff --git a/tailwind.config.js b/tailwind.config.js index c1edfed1..d244a0dc 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,14 +1,14 @@ -const { xTailwindPlugin } = require('@empathyco/x-tailwindcss'); -const options = require('./src/tailwind/plugin-options'); +const { xTailwindPlugin } = require('@empathyco/x-tailwindcss') +const options = require('./src/tailwind/plugin-options') /** @type {import('tailwindcss').Config} */ module.exports = { content: [ './public/index.html', './src/**/*.vue', - 'node_modules/@empathyco/x-components/**/components/**/*.js' + 'node_modules/@empathyco/x-components/**/components/**/*.js', ], prefix: 'x-', important: true, - plugins: [xTailwindPlugin(options)] -}; + plugins: [xTailwindPlugin(options)], +} diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js index dcc70d5c..c1b1cf46 100644 --- a/tests/.eslintrc.js +++ b/tests/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { parserOptions: { tsconfigRootDir: __dirname, - project: './tsconfig.json' - } -}; + project: './tsconfig.json', + }, +} diff --git a/tests/e2e/cucumber/banner.spec.ts b/tests/e2e/cucumber/banner.spec.ts index 93b055a3..28b33bcc 100644 --- a/tests/e2e/cucumber/banner.spec.ts +++ b/tests/e2e/cucumber/banner.spec.ts @@ -1,6 +1,6 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor' Then('banner is displayed', () => { - cy.getByDataTest('banner').should('have.attr', 'href'); - cy.getByDataTest('banner').children().should('have.attr', 'src'); -}); + cy.getByDataTest('banner').should('have.attr', 'href') + cy.getByDataTest('banner').children().should('have.attr', 'src') +}) diff --git a/tests/e2e/cucumber/column-picker.spec.ts b/tests/e2e/cucumber/column-picker.spec.ts index a5e523e3..42281c85 100644 --- a/tests/e2e/cucumber/column-picker.spec.ts +++ b/tests/e2e/cucumber/column-picker.spec.ts @@ -1,17 +1,17 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' Then('grid shows {int} results per row', (columns: number) => { - cy.getByDataTest('base-grid').should('have.class', `x-base-grid--cols-${columns || 'auto'}`); -}); + cy.getByDataTest('base-grid').should('have.class', `x-base-grid--cols-${columns || 'auto'}`) +}) When('value {int} from column picker list is clicked', (columns: number) => { - cy.get(`.x-column-picker-list__button--${columns}-cols`).click({ scrollBehavior: false }); -}); + cy.get(`.x-column-picker-list__button--${columns}-cols`).click({ scrollBehavior: false }) +}) Then('column picker list value {int} is selected', (columns: number) => { cy.get(`.x-column-picker-list__button--${columns}-cols`).should( 'have.attr', 'aria-pressed', - 'true' - ); -}); + 'true', + ) +}) diff --git a/tests/e2e/cucumber/global-definitions.ts b/tests/e2e/cucumber/global-definitions.ts index e6e321d9..10adc429 100644 --- a/tests/e2e/cucumber/global-definitions.ts +++ b/tests/e2e/cucumber/global-definitions.ts @@ -1,9 +1,9 @@ -import { defineParameterType } from '@badeball/cypress-cucumber-preprocessor'; +import { defineParameterType } from '@badeball/cypress-cucumber-preprocessor' defineParameterType({ name: 'boolean', regexp: /true|false/, transformer(string) { - return string === 'true'; - } -}); + return string === 'true' + }, +}) diff --git a/tests/e2e/cucumber/mocked-responses.spec.ts b/tests/e2e/cucumber/mocked-responses.spec.ts index 58533863..5190af2c 100644 --- a/tests/e2e/cucumber/mocked-responses.spec.ts +++ b/tests/e2e/cucumber/mocked-responses.spec.ts @@ -1,46 +1,46 @@ -import { Given } from '@badeball/cypress-cucumber-preprocessor'; -const mockedApiUrl = 'https://api.staging.empathy.co'; -const searchEndpoint = `${mockedApiUrl}/search/v1/query/empathy/search*`; -const trackEndpoint = `${mockedApiUrl}/tagging/v1/track/empathy`; +import { Given } from '@badeball/cypress-cucumber-preprocessor' +const mockedApiUrl = 'https://api.staging.empathy.co' +const searchEndpoint = `${mockedApiUrl}/search/v1/query/empathy/search*` +const trackEndpoint = `${mockedApiUrl}/tagging/v1/track/empathy` // Results Given('an intercepted search response', () => { - cy.intercept(searchEndpoint).as('interceptedResults'); -}); + cy.intercept(searchEndpoint).as('interceptedResults') +}) Given('an intercepted search response from {string}', (origin: string) => { cy.intercept({ url: searchEndpoint, query: { origin: `*${origin}*` } }).as( - `interceptedResultsFrom:${origin}` - ); -}); + `interceptedResultsFrom:${origin}`, + ) +}) Given('a results API with query {string}', (query: string) => { cy.intercept({ - query: { q: query } - }).as('interceptedResults'); -}); + query: { q: query }, + }).as('interceptedResults') +}) Given('a results API with a promoted', () => { cy.intercept(searchEndpoint, { fixture: 'search-response-with-promoted' }).as( - 'interceptedPromoted' - ); -}); + 'interceptedPromoted', + ) +}) Given('a results API with a banner', () => { - cy.intercept(searchEndpoint, { fixture: 'search-response-with-banner' }).as('interceptedBanner'); -}); + cy.intercept(searchEndpoint, { fixture: 'search-response-with-banner' }).as('interceptedBanner') +}) Given('a results API with known results', () => { cy.intercept(searchEndpoint, { fixture: 'search-response-with-known-results' }).as( - 'interceptedResults' - ); -}); + 'interceptedResults', + ) +}) // Tagging Given('a query tagging API', () => { - cy.intercept(`${trackEndpoint}/query*`).as('queryTagging'); -}); + cy.intercept(`${trackEndpoint}/query*`).as('queryTagging') +}) Given('an add to cart tagging API', () => { - cy.intercept(`${trackEndpoint}/add2cart*`).as('addToCartTagging'); -}); + cy.intercept(`${trackEndpoint}/add2cart*`).as('addToCartTagging') +}) diff --git a/tests/e2e/cucumber/multiple-interactions.spec.ts b/tests/e2e/cucumber/multiple-interactions.spec.ts index 5ee48a63..ea17c395 100644 --- a/tests/e2e/cucumber/multiple-interactions.spec.ts +++ b/tests/e2e/cucumber/multiple-interactions.spec.ts @@ -1,4 +1,4 @@ -import { When } from '@badeball/cypress-cucumber-preprocessor'; +import { When } from '@badeball/cypress-cucumber-preprocessor' When('next query number {int} is clicked', (nextQueryItem: number) => { cy.getByDataTest('next-query') @@ -6,12 +6,12 @@ When('next query number {int} is clicked', (nextQueryItem: number) => { .eq(nextQueryItem) .click() .invoke('text') - .as('searchedQuery'); -}); + .as('searchedQuery') +}) When('scroll down for two seconds', () => { - cy.get('#main-scroll').scrollTo(0, 1000, { duration: 2000, ensureScrollable: false }); -}); + cy.get('#main-scroll').scrollTo(0, 1000, { duration: 2000, ensureScrollable: false }) +}) When('related tag number {int} is clicked', (relatedTagItem: number) => { cy.getByDataTest('related-tag') @@ -19,13 +19,13 @@ When('related tag number {int} is clicked', (relatedTagItem: number) => { .eq(relatedTagItem) .click() .invoke('text') - .as('clickedRelatedTag'); -}); + .as('clickedRelatedTag') +}) When('clicked related tag is clicked again', function (this: { clickedRelatedTag: string }) { cy.getByDataTest('related-tag') .contains(this.clickedRelatedTag) .click() .invoke('text') - .as('clickedRelatedTag'); -}); + .as('clickedRelatedTag') +}) diff --git a/tests/e2e/cucumber/my-history.spec.ts b/tests/e2e/cucumber/my-history.spec.ts index 821bfc2c..be557f57 100644 --- a/tests/e2e/cucumber/my-history.spec.ts +++ b/tests/e2e/cucumber/my-history.spec.ts @@ -1,28 +1,28 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' When('my history button is clicked', () => { - cy.getByDataTest('my-history-button').click(); -}); + cy.getByDataTest('my-history-button').click() +}) Then('my history queries are displayed', () => { - cy.getByDataTest('my-history-query').should('have.length.at.least', 1); -}); + cy.getByDataTest('my-history-query').should('have.length.at.least', 1) +}) When('my history query number {int} is clicked', (position: number) => { - cy.getByDataTest('my-history-query').eq(position).getByDataTest('history-query').click(); -}); + cy.getByDataTest('my-history-query').eq(position).getByDataTest('history-query').click() +}) When('my history query number {int} delete button is clicked', (position: number) => { cy.getByDataTest('my-history-query') .eq(position) .getByDataTest('remove-history-query') - .trigger('click'); -}); + .trigger('click') +}) Then('my history is visible', () => { - cy.getByDataTest('my-history-queries').should('be.visible'); -}); + cy.getByDataTest('my-history-queries').should('be.visible') +}) Then('my history is not visible', () => { - cy.getByDataTest('my-history-queries').should('not.be.visible'); -}); + cy.getByDataTest('my-history-queries').should('not.be.visible') +}) diff --git a/tests/e2e/cucumber/no-results.spec.ts b/tests/e2e/cucumber/no-results.spec.ts index 3531564a..4cecb2f1 100644 --- a/tests/e2e/cucumber/no-results.spec.ts +++ b/tests/e2e/cucumber/no-results.spec.ts @@ -1,9 +1,9 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor' Then('no results message is displayed', () => { - cy.getByDataTest('no-results-message').should('exist'); -}); + cy.getByDataTest('no-results-message').should('exist') +}) Then('there are no results', () => { - cy.getByDataTest('search-grid-result').should('not.exist'); -}); + cy.getByDataTest('search-grid-result').should('not.exist') +}) diff --git a/tests/e2e/cucumber/predictive-components.spec.ts b/tests/e2e/cucumber/predictive-components.spec.ts index e5f2f432..8aa3dbd0 100644 --- a/tests/e2e/cucumber/predictive-components.spec.ts +++ b/tests/e2e/cucumber/predictive-components.spec.ts @@ -1,37 +1,37 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' Then('recommendations are displayed', () => { - cy.getByDataTest('recommendation-item').should('have.length.at.least', 1); -}); + cy.getByDataTest('recommendation-item').should('have.length.at.least', 1) +}) Then('search input is focused', () => { - cy.getByDataTest('search-input').should('be.focused'); -}); + cy.getByDataTest('search-input').should('be.focused') +}) Then('popular searches are displayed', () => { - cy.getByDataTest('popular-search').should('have.length.at.least', 1); -}); + cy.getByDataTest('popular-search').should('have.length.at.least', 1) +}) Then('query suggestions are displayed', () => { - cy.getByDataTest('query-suggestion').should('have.length.at.least', 1); -}); + cy.getByDataTest('query-suggestion').should('have.length.at.least', 1) +}) When('focus is set on the search input', () => { - cy.focusSearchInput(); -}); + cy.focusSearchInput() +}) Then('next queries are displayed', () => { - cy.getByDataTest('next-query').should('have.length.at.least', 1); -}); + cy.getByDataTest('next-query').should('have.length.at.least', 1) +}) Then('history queries are displayed', () => { - cy.getByDataTest('history-query').should('have.length.at.least', 1); -}); + cy.getByDataTest('history-query').should('have.length.at.least', 1) +}) // Scenario 2 Then('related tags are displayed', () => { - cy.getByDataTest('related-tag').should('have.length.at.least', 1); -}); + cy.getByDataTest('related-tag').should('have.length.at.least', 1) +}) When('related tag {int} is clicked', (relatedTagIndex: number) => { cy.getByDataTest('related-tag') @@ -39,8 +39,8 @@ When('related tag {int} is clicked', (relatedTagIndex: number) => { .eq(relatedTagIndex) .click() .invoke('text') - .as('clickedRelatedTag'); -}); + .as('clickedRelatedTag') +}) Then( 'clicked related tag is shown in position {int} as selected', @@ -48,15 +48,15 @@ Then( cy.getByDataTest('related-tag') .eq(relatedTagPosition) .should('have.text', this.clickedRelatedTag) - .should('have.class', 'x-related-tag--is-selected'); - } -); + .should('have.class', 'x-related-tag--is-selected') + }, +) Then('related tag {int} is displayed as not selected', (relatedTagItem: number) => { cy.getByDataTest('related-tag') .eq(relatedTagItem) - .should('not.have.class', 'x-related-tag--is-selected'); -}); + .should('not.have.class', 'x-related-tag--is-selected') +}) // Scenario 3 @@ -66,31 +66,31 @@ When('history query number {int} delete button is clicked', (historyQueryItem: n .invoke('text') .as('deletedHistoryQuery') .then(() => { - cy.focusSearchInput(); - cy.getByDataTest('remove-history-query').eq(historyQueryItem).click(); - }); -}); + cy.focusSearchInput() + cy.getByDataTest('remove-history-query').eq(historyQueryItem).click() + }) +}) Then( 'the deleted history query is removed from history queries', function (this: { deletedHistoryQuery: string }) { cy.getByDataTest('history-query').should(historicalQueries => { historicalQueries.each((_, historyQuery) => { - expect(historyQuery).to.not.have.text(this.deletedHistoryQuery); - }); - }); - } -); + expect(historyQuery).to.not.have.text(this.deletedHistoryQuery) + }) + }) + }, +) // Scenario 4 When('an empty search-box', () => { - cy.clearSearchInput(); -}); + cy.clearSearchInput() +}) When('clear history queries button is clicked', () => { - cy.getByDataTest('clear-history-queries').click(); -}); + cy.getByDataTest('clear-history-queries').click() +}) Then('no history queries are displayed', () => { - cy.getByDataTest('history-queries').should('not.exist'); -}); + cy.getByDataTest('history-queries').should('not.exist') +}) diff --git a/tests/e2e/cucumber/promoted.spec.ts b/tests/e2e/cucumber/promoted.spec.ts index 605ec000..0f11e119 100644 --- a/tests/e2e/cucumber/promoted.spec.ts +++ b/tests/e2e/cucumber/promoted.spec.ts @@ -1,5 +1,5 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor' Then('promoted is displayed', () => { - cy.getByDataTest('promoted').should('exist').children().should('have.attr', 'src'); -}); + cy.getByDataTest('promoted').should('exist').children().should('have.attr', 'src') +}) diff --git a/tests/e2e/cucumber/results.spec.ts b/tests/e2e/cucumber/results.spec.ts index 8552c80b..5033bb69 100644 --- a/tests/e2e/cucumber/results.spec.ts +++ b/tests/e2e/cucumber/results.spec.ts @@ -1,5 +1,5 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor' Then('related results are displayed and contain expected elements', () => { - cy.getByDataTest('search-grid-result').should('have.length', 24); -}); + cy.getByDataTest('search-grid-result').should('have.length', 24) +}) diff --git a/tests/e2e/cucumber/scroll.spec.ts b/tests/e2e/cucumber/scroll.spec.ts index 2b5ae4b1..8321f76f 100644 --- a/tests/e2e/cucumber/scroll.spec.ts +++ b/tests/e2e/cucumber/scroll.spec.ts @@ -1,28 +1,28 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' When('scrolling down to result {string}', (resultId: string) => { - cy.get(`[data-scroll=${resultId}]`).eq(0).scrollIntoView().should('be.visible'); -}); + cy.get(`[data-scroll=${resultId}]`).eq(0).scrollIntoView().should('be.visible') +}) Then('url is updated with result {string}', (resultId: string) => { - cy.url().should('contain', `scroll=${resultId}`); -}); + cy.url().should('contain', `scroll=${resultId}`) +}) When('the page is reloaded', () => { - cy.reload(); -}); + cy.reload() +}) Then('result {string} is visible', (resultId: string) => { - cy.get(`[data-scroll=${resultId}]`).getByDataTest('result-link').should('be.visible'); -}); + cy.get(`[data-scroll=${resultId}]`).getByDataTest('result-link').should('be.visible') +}) When('scroll to top is clicked', () => { - cy.getByDataTest('scroll-to-top').click(); -}); + cy.getByDataTest('scroll-to-top').click() +}) Then('scroll position is at top', () => { - cy.url().should('not.contain', 'scroll'); -}); + cy.url().should('not.contain', 'scroll') +}) /** * In this step we have to make 2 scrolls, because in the second scenario in scroll.feature file @@ -34,7 +34,7 @@ When('scrolling down to the bottom', () => { cy.getByDataTest('query-preview-item') .should('have.length.at.least', 5) .then(() => { - cy.getByDataTest('base-scroll').scrollTo('center', { duration: 1000 }); - cy.getByDataTest('base-scroll').scrollTo('bottom', { duration: 500 }); - }); -}); + cy.getByDataTest('base-scroll').scrollTo('center', { duration: 1000 }) + cy.getByDataTest('base-scroll').scrollTo('bottom', { duration: 500 }) + }) +}) diff --git a/tests/e2e/cucumber/sort.spec.ts b/tests/e2e/cucumber/sort.spec.ts index 8e1dd0f9..b34fd8b9 100644 --- a/tests/e2e/cucumber/sort.spec.ts +++ b/tests/e2e/cucumber/sort.spec.ts @@ -1,16 +1,16 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' Then('results are ordered by {string}', (sortOrder: string) => { - cy.getByDataTest('toggle-panel-header').should('contain', sortOrder); -}); + cy.getByDataTest('toggle-panel-header').should('contain', sortOrder) +}) When('{string} order is clicked in {string}', (sortOrder: string, sortMenuName: string) => { - cy.getByDataTest('toggle-panel-header').contains(sortMenuName).click(); - cy.getByDataTest('sort-picker-button').contains(sortOrder).should('exist').click(); -}); + cy.getByDataTest('toggle-panel-header').contains(sortMenuName).click() + cy.getByDataTest('sort-picker-button').contains(sortOrder).should('exist').click() +}) Then('search request contains the selected sort {string}', (sortURL: string) => { cy.wait('@interceptedResults') .its('request.url') - .should('contain', `sort=${sortURL.replace(' ', '+')}`); -}); + .should('contain', `sort=${sortURL.replace(' ', '+')}`) +}) diff --git a/tests/e2e/cucumber/spellcheck.spec.ts b/tests/e2e/cucumber/spellcheck.spec.ts index 0c3366a5..7c09a5f2 100644 --- a/tests/e2e/cucumber/spellcheck.spec.ts +++ b/tests/e2e/cucumber/spellcheck.spec.ts @@ -1,9 +1,9 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor' Then('spellcheck message is displayed', function (this: { searchedQuery: string }) { cy.getByDataTest('spellcheck-message') .should('exist') .should('contain', this.searchedQuery) .getByDataTest('set-spellcheck') - .should('exist'); -}); + .should('exist') +}) diff --git a/tests/e2e/cucumber/tagging.spec.ts b/tests/e2e/cucumber/tagging.spec.ts index 91917ea5..a29642cf 100644 --- a/tests/e2e/cucumber/tagging.spec.ts +++ b/tests/e2e/cucumber/tagging.spec.ts @@ -1,33 +1,33 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' When('scrolls down to next page', () => { - cy.getByDataTest('result-link').last().scrollIntoView({ easing: 'linear', duration: 2000 }); -}); + cy.getByDataTest('result-link').last().scrollIntoView({ easing: 'linear', duration: 2000 }) +}) Then('query tagging request should be triggered', () => { - cy.wait('@queryTagging'); -}); + cy.wait('@queryTagging') +}) Then('query tagging request has been triggered', () => { - cy.get('@queryTagging').should('exist'); -}); + cy.get('@queryTagging').should('exist') +}) Then('page {int} query tagging request is triggered', (pageNumber: number) => { - cy.wait('@queryTagging').its('request.url').should('contain', `page=${pageNumber}`); -}); + cy.wait('@queryTagging').its('request.url').should('contain', `page=${pageNumber}`) +}) Then('results page number {int} is loaded', (page: number) => { - cy.getByDataTest('search-grid-result').should('have.length', 24 * page); -}); + cy.getByDataTest('search-grid-result').should('have.length', 24 * page) +}) Then('add product to cart tagging request has been triggered', () => { - cy.wait('@addToCartTagging').should('exist'); -}); + cy.wait('@addToCartTagging').should('exist') +}) When('pdp add to cart button is clicked', () => { - cy.getByDataTest('search-grid-result').should('be.visible').first().as('firstVisibleResult'); + cy.getByDataTest('search-grid-result').should('be.visible').first().as('firstVisibleResult') cy.get('@firstVisibleResult') .getByDataTest('result-add-to-cart') .invoke('show') - .click({ force: true }); -}); + .click({ force: true }) +}) diff --git a/tests/e2e/cucumber/url.spec.ts b/tests/e2e/cucumber/url.spec.ts index 05cfc79c..c8470908 100644 --- a/tests/e2e/cucumber/url.spec.ts +++ b/tests/e2e/cucumber/url.spec.ts @@ -1,11 +1,11 @@ -import { Given } from '@badeball/cypress-cucumber-preprocessor'; -import ViewportPreset = Cypress.ViewportPreset; +import { Given } from '@badeball/cypress-cucumber-preprocessor' +import ViewportPreset = Cypress.ViewportPreset // Scenario 1 Given( 'a URL with query parameter {string} and {string} size view', (query: string, view: ViewportPreset) => { - cy.viewport(view); - cy.visit(`/?query=${query}`); - } -); + cy.viewport(view) + cy.visit(`/?query=${query}`) + }, +) diff --git a/tsconfig.json b/tsconfig.json index f16322aa..88c94d03 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,20 +13,8 @@ "sourceMap": true, "baseUrl": ".", "skipLibCheck": true, - "lib": [ - "esnext", - "dom", - "dom.iterable", - "scripthost" - ] + "lib": ["esnext", "dom", "dom.iterable", "scripthost"] }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "src/**/*.vue", - "vite.config.mts" - ], - "exclude": [ - "node_modules" - ] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "vite.config.mts"], + "exclude": ["node_modules"] } diff --git a/vite.config.mts b/vite.config.mts index 9501d24d..318edc85 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -1,17 +1,17 @@ -import vue from '@vitejs/plugin-vue'; -import { defineConfig } from 'vite'; -import Inspector from 'vite-plugin-vue-inspector'; -import injectHTML from 'vite-plugin-html-inject'; +import vue from '@vitejs/plugin-vue' +import { defineConfig } from 'vite' +import Inspector from 'vite-plugin-vue-inspector' +import injectHTML from 'vite-plugin-html-inject' export default defineConfig({ define: { - 'process.env': {} + 'process.env': {}, }, plugins: [injectHTML(), vue(), Inspector()], server: { - port: 8080 + port: 8080, }, preview: { - port: 8080 - } -}); + port: 8080, + }, +})