@empathyco/x-components 9.3.2 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/docs/API-reference/api/x-adapter-platform.md +9 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearch.md +0 -19
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.add2cart.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.checkout.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.click.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.display.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.displayclick.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.md +139 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearchtagging.query.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionssearchresponse.md +17 -0
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionssearchresponse.tagging.md +11 -0
- package/docs/API-reference/api/x-components.aimutations.md +19 -0
- package/docs/API-reference/api/x-components.aimutations.setsuggestionssearchtagging.md +13 -0
- package/docs/API-reference/api/x-components.aistate.config.md +2 -0
- package/docs/API-reference/api/x-components.aistate.md +21 -0
- package/docs/API-reference/api/x-components.aistate.suggestionstagging.md +13 -0
- package/docs/API-reference/api/x-components.aixevents.aicomponentunmounted.md +11 -0
- package/docs/API-reference/api/x-components.aixevents.aisuggestionssearchtaggingchanged.md +11 -0
- package/docs/API-reference/api/x-components.aixevents.md +34 -0
- package/docs/API-reference/api/x-components.basecurrency.md +2 -0
- package/docs/API-reference/api/x-components.baseeventsmodalclose.md +1 -1
- package/docs/API-reference/api/x-components.baseeventsmodalopen.md +1 -1
- package/docs/API-reference/api/x-components.basepricefilterlabel.md +2 -0
- package/docs/API-reference/api/x-components.baseresultcurrentprice.md +2 -0
- package/docs/API-reference/api/x-components.baseresultpreviousprice.md +2 -0
- package/docs/API-reference/api/x-components.createtrackaicarouseltaggingwire.md +56 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +2 -0
- package/docs/API-reference/api/x-components.md +46 -2
- package/docs/API-reference/api/x-components.simplefilter.md +2 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +2 -0
- package/docs/API-reference/api/x-components.trackaicarouseladdtocartwire.md +13 -0
- package/docs/API-reference/api/x-components.trackaicarouselquerytagginginfodebouncedwire.md +13 -0
- package/docs/API-reference/api/x-components.trackaicarouselquerytagginginfowire.md +13 -0
- package/docs/API-reference/api/x-components.trackaicarouselresultclickedwire.md +13 -0
- package/docs/API-reference/api/x-types.aisuggestionsearch.md +0 -17
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.add2cart.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.checkout.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.click.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.display.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.displayclick.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.md +139 -0
- package/docs/API-reference/api/x-types.aisuggestionsearchtagging.query.md +11 -0
- package/docs/API-reference/api/x-types.aisuggestionssearchresponse.md +17 -0
- package/docs/API-reference/api/x-types.aisuggestionssearchresponse.suggestionstagging.md +11 -0
- package/docs/API-reference/api/x-types.md +9 -0
- package/docs/API-reference/components/common/currency/x-components.base-currency.md +19 -0
- package/docs/API-reference/components/common/filters/labels/x-components.base-price-filter-label.md +37 -0
- package/docs/API-reference/components/common/result/x-components.base-result-current-price.md +21 -0
- package/docs/API-reference/components/common/result/x-components.base-result-previous-price.md +22 -0
- package/js/components/currency/base-currency.vue.js.map +1 -1
- package/js/components/currency/base-currency.vue2.js +8 -1
- package/js/components/currency/base-currency.vue2.js.map +1 -1
- package/js/components/filters/labels/base-price-filter-label.vue.js +8 -0
- package/js/components/filters/labels/base-price-filter-label.vue.js.map +1 -1
- package/js/components/result/base-result-current-price.vue.js +3 -2
- package/js/components/result/base-result-current-price.vue.js.map +1 -1
- package/js/components/result/base-result-current-price.vue2.js +6 -0
- package/js/components/result/base-result-current-price.vue2.js.map +1 -1
- package/js/components/result/base-result-previous-price.vue.js +3 -2
- package/js/components/result/base-result-previous-price.vue.js.map +1 -1
- package/js/components/result/base-result-previous-price.vue2.js +6 -0
- package/js/components/result/base-result-previous-price.vue2.js.map +1 -1
- package/js/index.js +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js +4 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.js +1 -0
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.js.map +1 -1
- package/js/x-modules/ai/store/emitters.js +4 -0
- package/js/x-modules/ai/store/emitters.js.map +1 -1
- package/js/x-modules/ai/store/module.js +4 -0
- package/js/x-modules/ai/store/module.js.map +1 -1
- package/js/x-modules/tagging/store/module.js +1 -1
- package/js/x-modules/tagging/store/module.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +52 -7
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +4 -4
- package/report/x-adapter-platform.api.json +186 -5
- package/report/x-components.api.json +435 -29
- package/report/x-components.api.md +47 -6
- package/report/x-types.api.json +184 -6
- package/tagging/index.js +1 -1
- package/types/src/components/currency/base-currency.vue.d.ts +12 -0
- package/types/src/components/currency/base-currency.vue.d.ts.map +1 -1
- package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts +12 -0
- package/types/src/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
- package/types/src/components/modals/base-events-modal-close.vue.d.ts +1 -1
- package/types/src/components/modals/base-events-modal-open.vue.d.ts +1 -1
- package/types/src/components/result/base-result-current-price.vue.d.ts +12 -0
- package/types/src/components/result/base-result-current-price.vue.d.ts.map +1 -1
- package/types/src/components/result/base-result-previous-price.vue.d.ts +12 -0
- package/types/src/components/result/base-result-previous-price.vue.d.ts.map +1 -1
- package/types/src/components/snippet-callbacks.vue.d.ts +2 -0
- package/types/src/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/src/x-modules/ai/components/ai-carousel.vue.d.ts.map +1 -1
- package/types/src/x-modules/ai/events.types.d.ts +3 -1
- package/types/src/x-modules/ai/events.types.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/emitters.d.ts +4 -0
- package/types/src/x-modules/ai/store/emitters.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/module.d.ts.map +1 -1
- package/types/src/x-modules/ai/store/types.d.ts +10 -1
- package/types/src/x-modules/ai/store/types.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +2 -0
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts +2 -0
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/src/x-modules/tagging/wiring.d.ts +39 -4
- package/types/src/x-modules/tagging/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-adapter-platform.platformaisuggestionsearch.tagging.md +0 -13
- package/docs/API-reference/api/x-components.trackaisuggestionssearchwire.md +0 -13
- package/docs/API-reference/api/x-types.aisuggestionsearch.tagging.md +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n return Intl.NumberFormat(
|
|
1
|
+
{"version":3,"file":"base-currency.vue2.js","sources":["../../../../src/components/currency/base-currency.vue"],"sourcesContent":["<template>\n <span class=\"x-currency\">{{ currencyText }}</span>\n</template>\n\n<script lang=\"ts\">\nimport type { SnippetConfig } from '@x/x-installer'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\n\nexport default defineComponent({\n props: {\n /**\n * Numeric value to be formatted.\n *\n * @remarks Pass the value with 'v-bind:value' (or ':value' shortcut) instead of plain string.\n * @remarks Be careful using numbers under Number.MAX_SAFE_INTEGER to avoid unexpected errors.\n *\n * @public\n */\n value: {\n type: Number,\n required: true,\n },\n\n /**\n * The ISO 4217 currency value. If not specified we use snippetConfig.currency\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n * Note: 'currency' and 'style' options are managed internally.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the value. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n\n setup(props) {\n const snippetConfig = inject<SnippetConfig>('snippetConfig')\n\n const currencyText = computed<string>(() => {\n const currency = props.currency ?? snippetConfig?.currency ?? 'EUR'\n const locale = props.locale ?? snippetConfig?.uiLang\n return Intl.NumberFormat(locale, {\n style: 'currency',\n ...props.format,\n currency,\n }).format(props.value)\n })\n\n return {\n currencyText,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders the value received as a property, which always must be a JavaScript number, formatted\nusing the Intl.NumberFormat API with ISO 4217 currency codes. The rendered tag is a span in order\nto render a default inline HTML element.\n\n### Basic usage\n\n```vue\n<template>\n <BaseCurrency :value=\"12345678.87654321\" currency=\"EUR\" />\n <!-- output depends on locale, e.g., '12.345.678,88 €' for es-ES -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Customizing decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87654321\"\n currency=\"USD\"\n :format=\"{ minimumFractionDigits: 3, maximumFractionDigits: 3 }\"\n />\n <!-- output: '$12,345,678.877' for en-US locale -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### No decimal places\n\n```vue\n<template>\n <BaseCurrency\n :value=\"12345678.87\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n />\n <!-- output: '12.345.679 €' for es-ES locale (rounds up) -->\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using different currencies\n\n```vue\n<template>\n <div>\n <BaseCurrency :value=\"1234.56\" currency=\"USD\" />\n <!-- output: '$1,234.56' for en-US -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n <!-- output: '1.234,56 €' for es-ES -->\n <BaseCurrency :value=\"1234.56\" currency=\"GBP\" />\n <!-- output: '£1,234.56' for en-GB -->\n <BaseCurrency :value=\"1234.56\" currency=\"JPY\" />\n <!-- output: '¥1,235' for ja-JP -->\n </div>\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Advanced formatting options\n\nYou can pass any valid Intl.NumberFormatOptions (except 'currency' and 'style' which are managed\ninternally):\n\n```vue\n<template>\n <BaseCurrency\n :value=\"1234567.89\"\n currency=\"EUR\"\n :format=\"{\n minimumFractionDigits: 2,\n maximumFractionDigits: 4,\n useGrouping: true,\n }\"\n />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n\n### Using a different locale\n\nBy default the currency is formatted using the `uiLang` of the `snippetConfig`. You can format\nthe value in a different locale using the `locale` prop:\n\n```vue\n<template>\n <!-- output: '€1,234.56' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" locale=\"en-US\" />\n <!-- output: '1234,56 €' for snippetConfig.uiLang 'es-ES' -->\n <BaseCurrency :value=\"1234.56\" currency=\"EUR\" />\n</template>\n\n<script setup>\nimport BaseCurrency from '@empathyco/x-components/js/components/currency/base-currency.vue'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;AASA,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;;;;AAOE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;;AAME;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AAED,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,aAAY,GAAI,MAAM,CAAgB,eAAe,CAAA;AAE3D,QAAA,MAAM,eAAe,QAAQ,CAAS,MAAI;YACxC,MAAM,QAAO,GAAI,KAAK,CAAC,QAAO,IAAK,aAAa,EAAE,QAAO,IAAK,KAAI;YAClE,MAAM,MAAK,GAAI,KAAK,CAAC,UAAU,aAAa,EAAE,MAAK;AACnD,YAAA,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;AAC/B,gBAAA,KAAK,EAAE,UAAU;gBACjB,GAAG,KAAK,CAAC,MAAM;gBACf,QAAQ;AACT,aAAA,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAA;AACvB,QAAA,CAAC,CAAA;QAED,OAAO;YACL,YAAY;SACd;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -28,6 +28,12 @@ var _sfc_main = defineComponent({
|
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
30
|
format: Object,
|
|
31
|
+
/**
|
|
32
|
+
* Locale used to format the currency. If not specified we use snippetConfig.uiLang
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
locale: String,
|
|
31
37
|
/**
|
|
32
38
|
* Message shown when the filter hasn't got the min value defined.
|
|
33
39
|
*
|
|
@@ -78,6 +84,7 @@ var _sfc_main = defineComponent({
|
|
|
78
84
|
value: props.filter.range.min,
|
|
79
85
|
currency: props.currency,
|
|
80
86
|
format: props.format,
|
|
87
|
+
locale: props.locale,
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
else if (partMessage === '{max}') {
|
|
@@ -85,6 +92,7 @@ var _sfc_main = defineComponent({
|
|
|
85
92
|
value: props.filter.range.max,
|
|
86
93
|
currency: props.currency,
|
|
87
94
|
format: props.format,
|
|
95
|
+
locale: props.locale,
|
|
88
96
|
});
|
|
89
97
|
}
|
|
90
98
|
return partMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /**\n * An ISO 4217 currency value.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n currency: props.currency,\n format: props.format,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n currency: props.currency,\n format: props.format,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE,MAAwE;AAChF;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"base-price-filter-label.vue.js","sources":["../../../../../src/components/filters/labels/base-price-filter-label.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { RangeValue } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h } from 'vue'\nimport BaseCurrency from '../../currency/base-currency.vue'\n\n/**\n * Renders a label for a price filter, allowing to select different messages depending on the\n * value of the filter.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /** The filter data for get min and max value. */\n filter: {\n type: Object as PropType<{ range: RangeValue }>,\n required: true,\n },\n /**\n * An ISO 4217 currency value.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n /**\n * Message shown when the filter hasn't got the min value defined.\n *\n * @public\n */\n lessThan: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter has both the min and max values defined.\n *\n * @public\n */\n fromTo: {\n type: String,\n required: true,\n },\n /**\n * Message shown when the filter hasn't got max value defined.\n *\n * @public\n */\n from: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n /**\n * The active label, retrieved from the provided props.\n * It depends on the min and max values of the filter.\n *\n * @returns The active label to be formatted with the min and max values of the filter.\n */\n const label = computed<string>(() => {\n return props.filter.range.min === null\n ? props.lessThan\n : props.filter.range.max === null\n ? props.from\n : props.fromTo\n })\n\n return () => {\n const labelParts = label.value.split(/(\\{min\\}|\\{max\\})/)\n\n const children = labelParts.map(partMessage => {\n if (partMessage === '{min}') {\n return h(BaseCurrency, {\n value: props.filter.range.min as number,\n currency: props.currency,\n format: props.format,\n locale: props.locale,\n })\n } else if (partMessage === '{max}') {\n return h(BaseCurrency, {\n value: props.filter.range.max as number,\n currency: props.currency,\n format: props.format,\n locale: props.locale,\n })\n }\n return partMessage\n })\n\n return h('span', { class: 'x-price-filter-label' }, children)\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Example\n\nRenders a label for a price filter, allowing to select different messages depending on the value of\nthe filter.\n\n- When the `min` value property isn't defined in the filter, you can show a message like\n `Less than $10` by using the `lessThan` prop, combined with the `{max}` placeholder.\n- When the `max` value property isn't defined in the filter, you can show a message like\n `More than $300` by using the `from` prop, combined with the `{min}` placeholder.\n- If both the `min` and `max` values of the filter are defined, you can show a message like\n `$10 - $300` by using the `fromTo` prop.\n\nThis component uses internally the `BaseCurrency` one, so you can pass the same props to configure\nhow the price should look like.\n\n### Basic usage\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 0, maximumFractionDigits: 0 }\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n\n### Using a different locale\n\nBy default the prices are formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat them in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <Facets>\n <template #price=\"{ facet }\">\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\" v-slot=\"{ filter }\">\n <!-- output: 'From $10.00 to $300.00' even if snippetConfig.uiLang is 'es-ES' -->\n <BasePriceFilterLabel\n :filter=\"filter\"\n currency=\"USD\"\n locale=\"en-US\"\n lessThan=\"Less than {max}\"\n fromTo=\"From {min} to {max}\"\n from=\"More than {min}\"\n />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script setup>\nimport BasePriceFilterLabel from '@empathyco/x-components/js/components/filters/labels/base-price-filter-label.vue'\nimport { Filters, Facets, NumberRangeFilter } from '@empathyco/x-components/facets'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAMA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;;AAEL,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAyC;AAC/C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE,MAAwE;AAChF;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACd;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;AAKE;AACF,QAAA,MAAM,KAAI,GAAI,QAAQ,CAAS,MAAI;YACjC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;kBAC9B,KAAK,CAAC;kBACN,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAE,KAAM;sBACzB,KAAK,CAAC;AACR,sBAAE,KAAK,CAAC,MAAK;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,OAAO,MAAI;YACT,MAAM,UAAS,GAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAA;YAExD,MAAM,WAAW,UAAU,CAAC,GAAG,CAAC,WAAU,IAAG;AAC3C,gBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAC3B,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AAAO,qBAAA,IAAI,WAAU,KAAM,OAAO,EAAE;oBAClC,OAAO,CAAC,CAAC,YAAY,EAAE;AACrB,wBAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAa;wBACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,qBAAA,CAAA;gBACH;AACA,gBAAA,OAAO,WAAU;AACnB,YAAA,CAAC,CAAA;AAED,YAAA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAqB,EAAG,EAAE,QAAQ,CAAA;AAC9D,QAAA,CAAA;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -16,8 +16,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
16
16
|
key: 0,
|
|
17
17
|
value: _ctx.result.price.value,
|
|
18
18
|
currency: _ctx.currency,
|
|
19
|
-
format: _ctx.format
|
|
20
|
-
|
|
19
|
+
format: _ctx.format,
|
|
20
|
+
locale: _ctx.locale
|
|
21
|
+
}, null, 8, ["value", "currency", "format", "locale"])) : createCommentVNode("v-if", true)
|
|
21
22
|
])
|
|
22
23
|
],
|
|
23
24
|
2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n :locale=\"locale\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Using a different locale\n\nBy default the price is formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat the price in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <!-- output: '$123.45' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" locale=\"en-US\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAcM,KAAA;AAAA,IAAA;AAAA,MAdA,KAAA,EAAKC,cAAA,CAAA,CAAE,IAAA,CAAA,cAAA,EAAsB,wBAAwB,CAAA,CAAA;AAAA,MAAC,WAAA,EAAU;AAAA,KAAA;;AAKpE,MAAAC,UAAA,CAQO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EARA,MAAA,EAAQ,IAAA,CAAA,MAAA,EAAM,EAArB,MAQO;AAAA,QANG,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,KAAA,IAAAH,SAAA,EAAA,EADtBI,WAAA,CAME,uBAAA,EAAA;AAAA,UAAA,GAAA,EAAA,CAAA;AAJC,UAAA,KAAA,EAAO,YAAO,KAAA,CAAM,KAAA;AAAA,UACpB,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,UACV,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,UACR,MAAA,EAAQ,IAAA,CAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-current-price.vue2.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base-result-current-price.vue2.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.value\"\n :value=\"result.price.value\"\n :currency=\"currency\"\n :format=\"format\"\n :locale=\"locale\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `currency` and `format`\nproperties to customize the display.\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultCurrentPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.456, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Using a different locale\n\nBy default the price is formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat the price in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <!-- output: '$123.45' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseResultCurrentPrice :result=\"result\" currency=\"USD\" locale=\"en-US\" />\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n </BaseResultCurrentPrice>\n</template>\n\n<script setup>\nimport { BaseResultCurrentPrice } from '@empathyco/x-components'\nconst result = {\n price: { value: 123.45, hasDiscount: false },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAyBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;;;AAME;AACF,QAAA,MAAM,cAAa,GAAI,QAAQ,CAAgB,OAAO;YACpD,iCAAiC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,WAAU,IAAK,KAAK;AAC5E,SAAA,CAAC,CAAA;QAEF,OAAO;YACL,cAAc;SAChB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -15,8 +15,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
15
15
|
key: 0,
|
|
16
16
|
value: _ctx.result.price.originalValue,
|
|
17
17
|
currency: _ctx.currency,
|
|
18
|
-
format: _ctx.format
|
|
19
|
-
|
|
18
|
+
format: _ctx.format,
|
|
19
|
+
locale: _ctx.locale
|
|
20
|
+
}, null, 8, ["value", "currency", "format", "locale"])) : createCommentVNode("v-if", true)
|
|
20
21
|
])
|
|
21
22
|
])) : createCommentVNode("v-if", true);
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price?.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;EAGI,KAAA,EAAM,yBAAA;AAAA,EACN,WAAA,EAAU;;;;AAFJ,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,WAAA,IAAAA,SAAA,EAAA,EADtBC,kBAAA,
|
|
1
|
+
{"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price?.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n :locale=\"locale\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Using a different locale\n\nBy default the price is formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat the price in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <!-- output: '$199.99' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" locale=\"en-US\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createBlock","_createCommentVNode"],"mappings":";;;;;;EAGI,KAAA,EAAM,yBAAA;AAAA,EACN,WAAA,EAAU;;;;AAFJ,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,WAAA,IAAAA,SAAA,EAAA,EADtBC,kBAAA,CAkBM,KAAA,EAlBN,UAAA,EAkBM;AAAA,IATJC,UAAA,CAQO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EARA,MAAA,EAAQ,IAAA,CAAA,MAAA,IAAf,MAQO;AAAA,MANG,IAAA,CAAA,MAAA,CAAO,KAAA,EAAO,aAAA,IAAAF,SAAA,EAAA,EADtBG,WAAA,CAME,uBAAA,EAAA;AAAA,QAAA,GAAA,EAAA,CAAA;AAJC,QAAA,KAAA,EAAO,YAAO,KAAA,CAAM,aAAA;AAAA,QACpB,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,QACV,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,QACR,MAAA,EAAQ,IAAA,CAAA;AAAA,OAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,CAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-previous-price.vue2.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price?.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base-result-previous-price.vue2.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price?.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency\n v-if=\"result.price?.originalValue\"\n :value=\"result.price.originalValue\"\n :currency=\"currency\"\n :format=\"format\"\n :locale=\"locale\"\n />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Optional value coming from https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes.\n *\n * @public\n */\n currency: String,\n /**\n * The currency format possibilities from Intl.NumberFormatOptions.\n * Allows customization of decimal places, grouping, etc.\n *\n * @public\n */\n format: {\n type: Object as PropType<Omit<Intl.NumberFormatOptions, 'currency' | 'style'>>,\n default: () => ({}),\n },\n /**\n * Locale used to format the currency. If not specified we use snippetConfig.uiLang\n *\n * @public\n */\n locale: String,\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has optional\n`currency` and `format` props to customize the display.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Customizing format\n\nYou can customize the number formatting using the `format` prop with `Intl.NumberFormatOptions`:\n\n```vue\n<template>\n <BaseResultPreviousPrice\n :result=\"result\"\n currency=\"EUR\"\n :format=\"{ minimumFractionDigits: 2, maximumFractionDigits: 2 }\"\n />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Using a different locale\n\nBy default the price is formatted using the `uiLang` of the `snippetConfig`. If you want to\nformat the price in a different locale, you can pass the `locale` prop:\n\n```vue\n<template>\n <!-- output: '$199.99' even if snippetConfig.uiLang is 'es-ES' -->\n <BaseResultPreviousPrice :result=\"result\" currency=\"USD\" locale=\"en-US\" />\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script setup>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nconst result = {\n price: { originalValue: 199.99, hasDiscount: true },\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AA4BA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,YAAW,EAAG;AAC5B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAwE;AAC9E,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,SAAA;AACD;;;;AAIE;AACF,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AACF,CAAA,CAAA;;;;"}
|
package/js/index.js
CHANGED
|
@@ -454,7 +454,7 @@ export { DefaultExternalTaggingService } from './x-modules/tagging/service/exter
|
|
|
454
454
|
export { track } from './x-modules/tagging/store/actions/track.action.js';
|
|
455
455
|
export { taggingEmitters } from './x-modules/tagging/store/emitters.js';
|
|
456
456
|
export { taggingXStoreModule } from './x-modules/tagging/store/module.js';
|
|
457
|
-
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setBrowseTaggingInfo, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire,
|
|
457
|
+
export { createSetQueryTaggingFromQueryPreview, createTrackAiCarouselTaggingWire, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setBrowseTaggingInfo, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackAiCarouselAddToCartWire, trackAiCarouselQueryTaggingInfoDebouncedWire, trackAiCarouselQueryTaggingInfoWire, trackAiCarouselResultClickedWire, trackBannerClickedWire, trackBrowseWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithFallbackWire, trackNoResultsQueryWithFallbackWireDebounced, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackPromotedClickedWire, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire } from './x-modules/tagging/wiring.js';
|
|
458
458
|
export { taggingXModule } from './x-modules/tagging/x-module.js';
|
|
459
459
|
export { default as UrlHandler } from './x-modules/url/components/url-handler.vue.js';
|
|
460
460
|
export { replaceableParams, urlEmitters } from './x-modules/url/store/emitters.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-carousel.vue.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_normalizeClass","_renderSlot","_Fragment","_renderList","_createTextVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;;;;;EAEyC,KAAA,EAAM;;;;;EA4D7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ATL,UAAA,EASK;AAAA,iCAAAH,SAAA,CAAA,IAAA,CAAA,EARHC,kBAAA;AAAA,kCAOKK,QAAA;AAAA,kCAAA,IAAA;AAAA,kCAAAC,UAAA,CANc,cAAA,EAAc,CAAxB,MAAA,KAAM;wDADfN,kBAAA,CAOK,IAAA,EAAA;AAAA,sCALF,KAAK,MAAA,CAAO,EAAA;AAAA,sCACb,WAAA,EAAU;AAAA,qCAAA,EAAA;AAGV,sCAAAI,UAAA,CAAuC,yBAAlB,MAAA,EAAc;AAAA,qCAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;UAQjDA,UAAA,CAAyC,IAAA,CAAA,MAAA,EAAA,2BAAA;AAAA,SAAA,CAAA,CAAA;QAG3CA,UAAA,CAA6B,IAAA,CAAA,MAAA,EAAA,eAAA,CAAA;AAAA,QAC7BA,UAAA,CAA0B,IAAA,CAAA,MAAA,EAAA,YAAA;AAAA,OAAA,CAAA,IAAAK,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ai-carousel.vue.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n onBeforeUnmount(() => {\n $x.emit('AiComponentUnmounted')\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_normalizeClass","_renderSlot","_Fragment","_renderList","_create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,EAAA,6BAAA;AAAA,6BAAA,CAAA;6CAE7C,MASK;AAAA,8BATLF,kBAAA,CASK,MATL,UAAA,EASK;AAAA,iCAAAH,SAAA,CAAA,IAAA,CAAA,EARHC,kBAAA;AAAA,kCAOKK,QAAA;AAAA,kCAAA,IAAA;AAAA,kCAAAC,UAAA,CANc,cAAA,EAAc,CAAxB,MAAA,KAAM;wDADfN,kBAAA,CAOK,IAAA,EAAA;AAAA,sCALF,KAAK,MAAA,CAAO,EAAA;AAAA,sCACb,WAAA,EAAU;AAAA,qCAAA,EAAA;AAGV,sCAAAI,UAAA,CAAuC,yBAAlB,MAAA,EAAc;AAAA,qCAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;UAQjDA,UAAA,CAAyC,IAAA,CAAA,MAAA,EAAA,2BAAA;AAAA,SAAA,CAAA,CAAA;QAG3CA,UAAA,CAA6B,IAAA,CAAA,MAAA,EAAA,eAAA,CAAA;AAAA,QAC7BA,UAAA,CAA0B,IAAA,CAAA,MAAA,EAAA,YAAA;AAAA,OAAA,CAAA,IAAAK,kBAAA,CAAA,MAAA,EAAA,IAAA;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useResizeObserver } from '@vueuse/core';
|
|
2
|
-
import { defineComponent, ref, computed, watch, onMounted } from 'vue';
|
|
2
|
+
import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount } from 'vue';
|
|
3
3
|
import '../../../components/animations/animate-clip-path.vue2.js';
|
|
4
4
|
import '../../../components/animations/animate-scale.vue2.js';
|
|
5
5
|
import '../../../components/animations/animate-translate.vue2.js';
|
|
@@ -178,6 +178,9 @@ var _sfc_main = defineComponent({
|
|
|
178
178
|
onMounted(() => {
|
|
179
179
|
$x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' });
|
|
180
180
|
});
|
|
181
|
+
onBeforeUnmount(() => {
|
|
182
|
+
$x.emit('AiComponentUnmounted');
|
|
183
|
+
});
|
|
181
184
|
useResizeObserver(titleRef, updateTitleOverflow);
|
|
182
185
|
return {
|
|
183
186
|
ariaLabels,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqJA,gBAAe,eAAe,CAAC;IAC7B,OAAO,EAAE,SAAS,CAAC,IAAI;AACvB,IAAA,UAAU,EAAE;QACV,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,YAAY;QACZ,eAAe;QACf,cAAc;8BACdA,WAAoB;wBACpBC,WAAc;QACd,YAAY;AACb,KAAA;AACD,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE,MAAM;;AAEb,QAAA,mBAAmB,EAAE,MAAM;;AAE3B,QAAA,4BAA4B,EAAE,MAAM;;AAEpC,QAAA,0BAA0B,EAAE,MAAM;;AAElC,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC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AA,CAAC;YACtC;YACA,OAAO,KAAK,CAAC,KAAI;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,KAAK,CAAC,OAAO,EAAE,MAAI;YACjB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAK,GAAI,CAAC,EAAE;AAC5B,gBAAA,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAA;YAC7C;AACF,QAAA,CAAC,CAAA;QAED,SAAS,CAAC,MAAI;AACZ,YAAA,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,aAAY,EAAG,CAAA;AACrE,QAAA,CAAC,CAAA;AAED,QAAA,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,CAAA;QAE/C,OAAO;YACL,UAAU;YACV,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,KAAK;YACL,iBAAiB;YACjB,OAAO;YACP,KAAK;YACL,aAAa;YACb,QAAQ;YACR,oBAAoB;SACtB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n onBeforeUnmount(() => {\n $x.emit('AiComponentUnmounted')\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;YACP,KAAK;YACL,iBAAiB;YACjB,OAAO;YACP,KAAK;YACL,aAAa;YACb,QAAQ;YACR,oBAAoB;SACtB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -21,6 +21,7 @@ const fetchAndSaveAiSuggestionsSearch = async ({ commit, getters }) => {
|
|
|
21
21
|
.then(response => {
|
|
22
22
|
if (response) {
|
|
23
23
|
commit('setSuggestionsSearch', response.suggestions);
|
|
24
|
+
commit('setSuggestionsSearchTagging', response.suggestionsTagging);
|
|
24
25
|
}
|
|
25
26
|
})
|
|
26
27
|
.catch(error => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-and-save-ai-suggestions-search.action.js","sources":["../../../../../../src/x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.ts"],"sourcesContent":["import type { AiXStoreModule } from '../types'\nimport { XPlugin } from '../../../../plugins'\n\n/**\n * Default implementation for the `AiActions.fetchAndSaveAiSuggestionsSearch`.\n *\n * @param _ - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the commits and\n * getters provided by Vuex.\n * @returns The AI search response.\n * @public\n */\nexport const fetchAndSaveAiSuggestionsSearch: AiXStoreModule['actions']['fetchAndSaveAiSuggestionsSearch'] =\n async ({ commit, getters }) => {\n const request = getters.suggestionsSearchRequest\n if (!request) {\n return\n }\n commit('setSuggestionsSearchStatus', 'loading')\n\n return XPlugin.adapter\n .aiSuggestionsSearch(request)\n .then(response => {\n if (response) {\n commit('setSuggestionsSearch', response.suggestions)\n }\n })\n .catch(error => {\n console.error(error)\n })\n .finally(() => {\n commit('setSuggestionsSearchStatus', 'success')\n })\n }\n"],"names":[],"mappings":";;;;AAGA;;;;;;;AAOG;AACI,MAAM,+BAA+B,GAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAI;AAC5B,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,wBAAwB;IAChD,IAAI,CAAC,OAAO,EAAE;QACZ;IACF;AACA,IAAA,MAAM,CAAC,4BAA4B,EAAE,SAAS,CAAC;IAE/C,OAAO,OAAO,CAAC;SACZ,mBAAmB,CAAC,OAAO;SAC3B,IAAI,CAAC,QAAQ,IAAG;QACf,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-and-save-ai-suggestions-search.action.js","sources":["../../../../../../src/x-modules/ai/store/actions/fetch-and-save-ai-suggestions-search.action.ts"],"sourcesContent":["import type { AiXStoreModule } from '../types'\nimport { XPlugin } from '../../../../plugins'\n\n/**\n * Default implementation for the `AiActions.fetchAndSaveAiSuggestionsSearch`.\n *\n * @param _ - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the commits and\n * getters provided by Vuex.\n * @returns The AI search response.\n * @public\n */\nexport const fetchAndSaveAiSuggestionsSearch: AiXStoreModule['actions']['fetchAndSaveAiSuggestionsSearch'] =\n async ({ commit, getters }) => {\n const request = getters.suggestionsSearchRequest\n if (!request) {\n return\n }\n commit('setSuggestionsSearchStatus', 'loading')\n\n return XPlugin.adapter\n .aiSuggestionsSearch(request)\n .then(response => {\n if (response) {\n commit('setSuggestionsSearch', response.suggestions)\n commit('setSuggestionsSearchTagging', response.suggestionsTagging)\n }\n })\n .catch(error => {\n console.error(error)\n })\n .finally(() => {\n commit('setSuggestionsSearchStatus', 'success')\n })\n }\n"],"names":[],"mappings":";;;;AAGA;;;;;;;AAOG;AACI,MAAM,+BAA+B,GAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAI;AAC5B,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,wBAAwB;IAChD,IAAI,CAAC,OAAO,EAAE;QACZ;IACF;AACA,IAAA,MAAM,CAAC,4BAA4B,EAAE,SAAS,CAAC;IAE/C,OAAO,OAAO,CAAC;SACZ,mBAAmB,CAAC,OAAO;SAC3B,IAAI,CAAC,QAAQ,IAAG;QACf,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAAC;AACpD,YAAA,MAAM,CAAC,6BAA6B,EAAE,QAAQ,CAAC,kBAAkB,CAAC;QACpE;AACF,IAAA,CAAC;SACA,KAAK,CAAC,KAAK,IAAG;AACb,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACtB,IAAA,CAAC;SACA,OAAO,CAAC,MAAK;AACZ,QAAA,MAAM,CAAC,4BAA4B,EAAE,SAAS,CAAC;AACjD,IAAA,CAAC,CAAC;AACN;;;;"}
|
|
@@ -11,6 +11,10 @@ const aiEmitters = createStoreEmitters(aiXStoreModule, {
|
|
|
11
11
|
AiSuggestionsRequestUpdated: (_, getters) => getters.suggestionsRequest,
|
|
12
12
|
AiSuggestionsSearchRequestUpdated: (_, getters) => getters.suggestionsSearchRequest,
|
|
13
13
|
AiSuggestionsSearchChanged: state => state.suggestionsSearch,
|
|
14
|
+
AiSuggestionsSearchTaggingChanged: {
|
|
15
|
+
selector: state => state.suggestionsTagging,
|
|
16
|
+
filter: (_newValue, _oldValue, state) => state.suggestionsTagging !== undefined,
|
|
17
|
+
},
|
|
14
18
|
});
|
|
15
19
|
|
|
16
20
|
export { aiEmitters };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/ai/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store'\nimport { aiXStoreModule } from './module'\n\n/**\n * {@link StoreEmitters} For the ai module.\n *\n * @internal\n */\nexport const aiEmitters = createStoreEmitters(aiXStoreModule, {\n AiSuggestionsRequestUpdated: (_, getters) => getters.suggestionsRequest,\n AiSuggestionsSearchRequestUpdated: (_, getters) => getters.suggestionsSearchRequest,\n AiSuggestionsSearchChanged: state => state.suggestionsSearch,\n})\n"],"names":[],"mappings":";;;;AAGA;;;;AAIG;AACI,MAAM,UAAU,GAAG,mBAAmB,CAAC,cAAc,EAAE;IAC5D,2BAA2B,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,kBAAkB;IACvE,iCAAiC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB;AACnF,IAAA,0BAA0B,EAAE,KAAK,IAAI,KAAK,CAAC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/ai/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store'\nimport { aiXStoreModule } from './module'\n\n/**\n * {@link StoreEmitters} For the ai module.\n *\n * @internal\n */\nexport const aiEmitters = createStoreEmitters(aiXStoreModule, {\n AiSuggestionsRequestUpdated: (_, getters) => getters.suggestionsRequest,\n AiSuggestionsSearchRequestUpdated: (_, getters) => getters.suggestionsSearchRequest,\n AiSuggestionsSearchChanged: state => state.suggestionsSearch,\n AiSuggestionsSearchTaggingChanged: {\n selector: state => state.suggestionsTagging!,\n filter: (_newValue, _oldValue, state) => state.suggestionsTagging !== undefined,\n },\n})\n"],"names":[],"mappings":";;;;AAGA;;;;AAIG;AACI,MAAM,UAAU,GAAG,mBAAmB,CAAC,cAAc,EAAE;IAC5D,2BAA2B,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,kBAAkB;IACvE,iCAAiC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB;AACnF,IAAA,0BAA0B,EAAE,KAAK,IAAI,KAAK,CAAC,iBAAiB;AAC5D,IAAA,iCAAiC,EAAE;AACjC,QAAA,QAAQ,EAAE,KAAK,IAAI,KAAK,CAAC,kBAAmB;AAC5C,QAAA,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,kBAAkB,KAAK,SAAS;AAChF,KAAA;AACF,CAAA;;;;"}
|
|
@@ -45,6 +45,9 @@ const aiXStoreModule = {
|
|
|
45
45
|
setSuggestionsSearch: (state, suggestionsSearch) => {
|
|
46
46
|
state.suggestionsSearch = suggestionsSearch;
|
|
47
47
|
},
|
|
48
|
+
setSuggestionsSearchTagging: (state, suggestionsTagging) => {
|
|
49
|
+
state.suggestionsTagging = suggestionsTagging;
|
|
50
|
+
},
|
|
48
51
|
setSuggestionsStatus: (state, status) => {
|
|
49
52
|
state.suggestionsStatus = status;
|
|
50
53
|
},
|
|
@@ -95,6 +98,7 @@ function resettableAiState() {
|
|
|
95
98
|
return {
|
|
96
99
|
queries: [],
|
|
97
100
|
tagging: undefined,
|
|
101
|
+
suggestionsTagging: undefined,
|
|
98
102
|
suggestionsSearch: [],
|
|
99
103
|
suggestionsStatus: 'initial',
|
|
100
104
|
suggestionsSearchStatus: 'initial',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/ai/store/module.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/ai/store/module.ts"],"sourcesContent":["import type {\n AiSuggestionQuery,\n AiSuggestionSearch,\n AiSuggestionSearchTagging,\n Result,\n} from '@empathyco/x-types'\nimport type { RequestStatus } from '../../../store/utils/status-store.utils'\nimport type { AiState, AiXStoreModule } from './types'\nimport { isFacetFilter } from '@empathyco/x-types'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { setQuery } from '../../../store/utils/query.utils'\nimport { groupItemsBy } from '../../../utils/array'\nimport { UNKNOWN_FACET_KEY } from '../../facets/store/constants'\nimport { fetchAndSaveAiSuggestionsSearch } from './actions/fetch-and-save-ai-suggestions-search.action'\nimport { fetchAndSaveAiSuggestions } from './actions/fetch-and-save-ai-suggestions.action'\nimport { saveOrigin } from './actions/save-origin.action'\nimport { setUrlParams } from './actions/set-url-params.action'\nimport {\n aiSuggestionsRequest as suggestionsRequest,\n aiSuggestionsSearchRequest as suggestionsSearchRequest,\n} from './getters'\n\n/**\n * {@link XStoreModule} For the ai module.\n *\n * @internal\n */\nexport const aiXStoreModule: AiXStoreModule = {\n state: () => ({\n ...resettableAiState(),\n selectedFilters: {},\n query: '',\n config: {},\n params: {},\n origin: null,\n relatedTags: [],\n searchTotalResults: 0,\n excludeOptions: {\n resultIds: [],\n },\n }),\n getters: {\n suggestionsRequest,\n suggestionsSearchRequest,\n },\n mutations: {\n /* Streamed fields */\n setQueries: (state, queries: AiSuggestionQuery[]) => {\n state.queries = queries\n },\n setTagging: (state, tagging) => {\n state.tagging = tagging\n },\n /* END Streamed fields */\n setSuggestionsSearch: (state, suggestionsSearch: AiSuggestionSearch[]) => {\n state.suggestionsSearch = suggestionsSearch\n },\n setSuggestionsSearchTagging: (state, suggestionsTagging: AiSuggestionSearchTagging) => {\n state.suggestionsTagging = suggestionsTagging\n },\n setSuggestionsStatus: (state, status: RequestStatus) => {\n state.suggestionsStatus = status\n },\n setSuggestionsSearchStatus: (state, status: RequestStatus) => {\n state.suggestionsSearchStatus = status\n },\n setExcludedResultIds: (state, resultIds: Result['id'][]) => {\n state.excludeOptions.resultIds = resultIds\n },\n setQuery,\n setParams(state, params) {\n state.params = params\n },\n setOrigin(state, origin = null) {\n state.origin = origin\n },\n resetAiState(state) {\n Object.assign(state, resettableAiState())\n },\n setAiRelatedTags(state, relatedTags) {\n state.relatedTags = relatedTags\n },\n setSelectedFilters(state, selectedFilters) {\n state.selectedFilters = groupItemsBy(selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY,\n )\n },\n setSearchTotalResults(state, totalResults) {\n state.searchTotalResults = totalResults\n },\n setConfig,\n mergeConfig,\n },\n actions: {\n fetchAndSaveAiSuggestions,\n fetchAndSaveAiSuggestionsSearch,\n setUrlParams,\n saveOrigin,\n },\n}\n\n/**\n * Function to return the \"resettable\" part of the state. This will be used in the `resetState`\n * mutation to reset to the initial state.\n *\n * @returns The \"resettable\" part of the {@link AiState}.\n *\n * @internal\n */\nfunction resettableAiState() {\n return {\n queries: [],\n tagging: undefined,\n suggestionsTagging: undefined,\n suggestionsSearch: [],\n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0B;KACpD;AACH;;;;"}
|
|
@@ -35,7 +35,7 @@ const taggingXStoreModule = {
|
|
|
35
35
|
state.browseTaggingInfo = browseTaggingInfo;
|
|
36
36
|
},
|
|
37
37
|
setNoResultsTaggingEnabled(state, module) {
|
|
38
|
-
if (module === 'semanticQueries' || module === 'relatedPrompts') {
|
|
38
|
+
if (module === 'semanticQueries' || module === 'relatedPrompts' || module === 'ai') {
|
|
39
39
|
state.noResultsTaggingEnabled = true;
|
|
40
40
|
}
|
|
41
41
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\nimport type { TaggingXStoreModule } from './types'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { track } from './actions/track.action'\n\n/**\n * {@link XStoreModule} For the tagging module.\n *\n * @internal\n */\nexport const taggingXStoreModule: TaggingXStoreModule = {\n state: () => ({\n config: {\n sessionTTLMs: 30 * 60 * 1000,\n queryTaggingDebounceMs: 2000,\n storageKey: null,\n storageTTLMs: null,\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: null,\n toolingTaggingInfo: {\n toolingDisplayClick: null,\n toolingDisplayAdd2Cart: null,\n },\n browseTaggingInfo: null,\n }),\n getters: {},\n mutations: {\n setConsent(state, consent) {\n state.consent = consent\n },\n setQueryTaggingInfo(state, queryTaggingInfo: TaggingRequest) {\n state.queryTaggingInfo = queryTaggingInfo\n },\n setBrowseTaggingInfo(state, browseTaggingInfo: TaggingRequest) {\n state.browseTaggingInfo = browseTaggingInfo\n },\n setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries' || module === 'relatedPrompts') {\n state.noResultsTaggingEnabled = true\n }\n },\n setConfig,\n mergeConfig,\n },\n actions: {\n track,\n },\n}\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACI,MAAM,mBAAmB,GAAwB;AACtD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AAC5B,YAAA,sBAAsB,EAAE,IAAI;AAC5B,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;AACnB,SAAA;AACD,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,uBAAuB,EAAE,KAAK;AAC9B,QAAA,gBAAgB,EAAE,IAAI;AACtB,QAAA,kBAAkB,EAAE;AAClB,YAAA,mBAAmB,EAAE,IAAI;AACzB,YAAA,sBAAsB,EAAE,IAAI;AAC7B,SAAA;AACD,QAAA,iBAAiB,EAAE,IAAI;KACxB,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAAO,GAAG,OAAO;QACzB,CAAC;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgC,EAAA;AACzD,YAAA,KAAK,CAAC,gBAAgB,GAAG,gBAAgB;QAC3C,CAAC;QACD,oBAAoB,CAAC,KAAK,EAAE,iBAAiC,EAAA;AAC3D,YAAA,KAAK,CAAC,iBAAiB,GAAG,iBAAiB;QAC7C,CAAC;QACD,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAA;
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import type { TaggingRequest } from '@empathyco/x-types'\nimport type { TaggingXStoreModule } from './types'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { track } from './actions/track.action'\n\n/**\n * {@link XStoreModule} For the tagging module.\n *\n * @internal\n */\nexport const taggingXStoreModule: TaggingXStoreModule = {\n state: () => ({\n config: {\n sessionTTLMs: 30 * 60 * 1000,\n queryTaggingDebounceMs: 2000,\n storageKey: null,\n storageTTLMs: null,\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: null,\n toolingTaggingInfo: {\n toolingDisplayClick: null,\n toolingDisplayAdd2Cart: null,\n },\n browseTaggingInfo: null,\n }),\n getters: {},\n mutations: {\n setConsent(state, consent) {\n state.consent = consent\n },\n setQueryTaggingInfo(state, queryTaggingInfo: TaggingRequest) {\n state.queryTaggingInfo = queryTaggingInfo\n },\n setBrowseTaggingInfo(state, browseTaggingInfo: TaggingRequest) {\n state.browseTaggingInfo = browseTaggingInfo\n },\n setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries' || module === 'relatedPrompts' || module === 'ai') {\n state.noResultsTaggingEnabled = true\n }\n },\n setConfig,\n mergeConfig,\n },\n actions: {\n track,\n },\n}\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACI,MAAM,mBAAmB,GAAwB;AACtD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AAC5B,YAAA,sBAAsB,EAAE,IAAI;AAC5B,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;AACnB,SAAA;AACD,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,uBAAuB,EAAE,KAAK;AAC9B,QAAA,gBAAgB,EAAE,IAAI;AACtB,QAAA,kBAAkB,EAAE;AAClB,YAAA,mBAAmB,EAAE,IAAI;AACzB,YAAA,sBAAsB,EAAE,IAAI;AAC7B,SAAA;AACD,QAAA,iBAAiB,EAAE,IAAI;KACxB,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAAO,GAAG,OAAO;QACzB,CAAC;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgC,EAAA;AACzD,YAAA,KAAK,CAAC,gBAAgB,GAAG,gBAAgB;QAC3C,CAAC;QACD,oBAAoB,CAAC,KAA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