@empathyco/x-components 6.0.0-alpha.36 → 6.0.0-alpha.38
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 +18 -0
- package/design-system/deprecated-full-theme.css +578 -578
- package/docs/API-reference/api/x-adapter-platform.md +3 -0
- package/docs/API-reference/api/x-adapter-platform.nextqueriesrelatedpromptsschema.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +1 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.tagging.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.md +22 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplay.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayadd2cart.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayclick.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.md +21 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.nextqueries.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.toolingdisplay.md +11 -0
- package/docs/API-reference/api/x-components.baseaddtocart.md +1 -0
- package/docs/API-reference/api/x-components.createtracktoolingadd2cartwire.md +19 -0
- package/docs/API-reference/api/x-components.createtracktoolingdisplaywire.md +19 -0
- package/docs/API-reference/api/x-components.featurelocation.md +1 -1
- package/docs/API-reference/api/x-components.globalxbus.md +4 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +2 -0
- package/docs/API-reference/api/x-components.md +7 -2
- package/docs/API-reference/api/x-components.queryfeature.md +1 -1
- package/docs/API-reference/api/x-components.relatedprompt.md +4 -25
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +40 -6
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +2 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptadd2cart.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptresult.md +13 -0
- 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.tracktoolingadd2cartwire.md +13 -0
- package/docs/API-reference/api/x-components.tracktoolingdisplayclickedwire.md +13 -0
- package/docs/API-reference/api/x-components.typingoptions.md +22 -0
- package/docs/API-reference/api/x-components.typingoptions.speed.md +13 -0
- package/docs/API-reference/api/x-components.typingoptions.targetattr.md +18 -0
- package/docs/API-reference/api/x-components.typingoptions.text.md +13 -0
- package/docs/API-reference/api/x-types.md +1 -0
- package/docs/API-reference/api/x-types.relatedprompt.md +2 -1
- package/docs/API-reference/api/x-types.relatedprompt.relatedpromptnextqueries.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.toolingdisplaytagging.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptnextquery.md +23 -0
- package/docs/API-reference/api/x-types.relatedpromptnextquery.query.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayadd2carttagging.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayclicktagging.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplaytagging.md +13 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +4 -14
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +16 -10
- package/js/components/result/base-result-add-to-cart.vue.js +2 -1
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue2.js +19 -5
- package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
- package/js/directives/typing.js +52 -0
- package/js/directives/typing.js.map +1 -0
- package/js/index.js +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js +16 -43
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js +5 -36
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +76 -68
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +176 -22
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +1 -1
- package/js/x-modules/tagging/store/module.js +5 -1
- package/js/x-modules/tagging/store/module.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +64 -1
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +4 -4
- package/report/x-adapter-platform.api.json +254 -0
- package/report/x-components.api.json +746 -64
- package/report/x-components.api.md +84 -34
- package/report/x-types.api.json +167 -5
- package/tagging/index.js +1 -1
- package/types/components/global-x-bus.vue.d.ts +4 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/result/base-result-add-to-cart.vue.d.ts +2 -0
- package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts +2 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/directives/index.d.ts +1 -0
- package/types/directives/index.d.ts.map +1 -1
- package/types/directives/typing.d.ts +30 -0
- package/types/directives/typing.d.ts.map +1 -0
- package/types/types/origin.d.ts +2 -2
- package/types/types/origin.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +4 -27
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +87 -6
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/events.types.d.ts +11 -1
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -1
- package/types/x-modules/tagging/store/module.d.ts.map +1 -1
- package/types/x-modules/tagging/wiring.d.ts +36 -2
- package/types/x-modules/tagging/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +0 -13
|
@@ -1,78 +1,86 @@
|
|
|
1
1
|
import _sfc_main from './related-prompts-tag-list.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock,
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, TransitionGroup, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle } from 'vue';
|
|
3
3
|
import './related-prompts-tag-list.vue3.js';
|
|
4
4
|
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
6
|
+
const _hoisted_1 = ["data-index"];
|
|
6
7
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
7
8
|
const _component_RelatedPrompt = resolveComponent("RelatedPrompt");
|
|
9
|
+
const _component_DisplayEmitter = resolveComponent("DisplayEmitter");
|
|
8
10
|
const _component_SlidingPanel = resolveComponent("SlidingPanel");
|
|
9
|
-
return openBlock(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"sliding-panel-left-button"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"sliding-panel-right-button"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
11
|
+
return openBlock(), createBlock(_component_SlidingPanel, {
|
|
12
|
+
key: _ctx.x.query.search,
|
|
13
|
+
"reset-on-content-change": false,
|
|
14
|
+
"button-class": _ctx.buttonClass,
|
|
15
|
+
"scroll-container-class": "x-related-prompts-tag-list-scroll-container"
|
|
16
|
+
}, {
|
|
17
|
+
"sliding-panel-left-button": withCtx(() => [
|
|
18
|
+
renderSlot(_ctx.$slots, "sliding-panel-left-button")
|
|
19
|
+
]),
|
|
20
|
+
"sliding-panel-right-button": withCtx(() => [
|
|
21
|
+
renderSlot(_ctx.$slots, "sliding-panel-right-button")
|
|
22
|
+
]),
|
|
23
|
+
default: withCtx(() => [
|
|
24
|
+
createVNode(TransitionGroup, {
|
|
25
|
+
onBeforeEnter: _ctx.onBeforeEnter,
|
|
26
|
+
onEnter: _ctx.onEnter,
|
|
27
|
+
onLeave: _ctx.onLeave,
|
|
28
|
+
class: "x-related-prompts-tag-list",
|
|
29
|
+
css: false,
|
|
30
|
+
tag: "ul",
|
|
31
|
+
appear: ""
|
|
32
|
+
}, {
|
|
33
|
+
default: withCtx(() => [
|
|
34
|
+
(openBlock(true), createElementBlock(
|
|
35
|
+
Fragment,
|
|
36
|
+
null,
|
|
37
|
+
renderList(_ctx.visibleRelatedPrompts, ({ index, ...relatedPrompt }) => {
|
|
38
|
+
return openBlock(), createElementBlock("li", {
|
|
39
|
+
ref_for: true,
|
|
40
|
+
ref: "listItems",
|
|
41
|
+
key: relatedPrompt.suggestionText,
|
|
42
|
+
class: normalizeClass(["x-related-prompts-tag-list-item", [_ctx.tagClass, _ctx.tagColors && _ctx.tagColors[index % _ctx.tagColors.length]]]),
|
|
43
|
+
"data-index": index,
|
|
44
|
+
style: normalizeStyle(_ctx.isAnimating && { pointerEvents: "none" }),
|
|
45
|
+
"data-test": "related-prompts-tag-list-item"
|
|
46
|
+
}, [
|
|
47
|
+
renderSlot(_ctx.$slots, "default", {
|
|
48
|
+
relatedPrompt,
|
|
49
|
+
onSelect: () => _ctx.onSelect(index),
|
|
50
|
+
isSelected: _ctx.isSelected(index)
|
|
51
|
+
}, () => [
|
|
52
|
+
createVNode(_component_DisplayEmitter, {
|
|
53
|
+
payload: relatedPrompt.toolingDisplayTagging,
|
|
54
|
+
eventMetadata: {
|
|
55
|
+
feature: "related-prompts",
|
|
56
|
+
displayOriginalQuery: _ctx.x.query.searchBox,
|
|
57
|
+
replaceable: false
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
default: withCtx(() => [
|
|
61
|
+
createVNode(_component_RelatedPrompt, {
|
|
62
|
+
onClick: ($event) => _ctx.onSelect(index),
|
|
63
|
+
"related-prompt": relatedPrompt,
|
|
64
|
+
selected: _ctx.isSelected(index)
|
|
65
|
+
}, null, 8, ["onClick", "related-prompt", "selected"])
|
|
66
|
+
]),
|
|
67
|
+
_: 2
|
|
68
|
+
/* DYNAMIC */
|
|
69
|
+
}, 1032, ["payload", "eventMetadata"])
|
|
70
|
+
])
|
|
71
|
+
], 14, _hoisted_1);
|
|
72
|
+
}),
|
|
73
|
+
128
|
|
74
|
+
/* KEYED_FRAGMENT */
|
|
75
|
+
))
|
|
76
|
+
]),
|
|
77
|
+
_: 3
|
|
78
|
+
/* FORWARDED */
|
|
79
|
+
}, 8, ["onBeforeEnter", "onEnter", "onLeave"])
|
|
80
|
+
]),
|
|
81
|
+
_: 3
|
|
82
|
+
/* FORWARDED */
|
|
83
|
+
}, 8, ["button-class"]);
|
|
76
84
|
}
|
|
77
85
|
var relatedPromptsTagList = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
78
86
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <div>\n <template v-if=\"$slots.header\">\n <slot name=\"header\" />\n </template>\n <SlidingPanel\n :reset-on-content-change=\"true\"\n :button-class=\"buttonClass\"\n :scroll-container-class=\"\n selectedPrompt === -1 ? 'desktop:x-sliding-panel-fade desktop:x-sliding-panel-fade-sm' : ''\n \"\n >\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panel-left-button\" />\n </template>\n\n <slot name=\"sliding-panel-content\">\n <div\n ref=\"slidingPanelContent\"\n class=\"x-related-prompt__sliding-panel-content\"\n :class=\"{ 'x-related-prompt__sliding-panel-content-selected': selectedPrompt !== -1 }\"\n >\n <div\n v-for=\"(suggestion, index) in relatedPrompts\"\n :key=\"index\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`\n }\"\n class=\"x-related-prompt x-staggered-initial\"\n :class=\"[\n { 'x-staggered-animation': arePromptsVisible },\n { 'x-hidden': hidePrompt(index) },\n { 'x-related-prompt-selected': isSelected(index) }\n ]\"\n data-test=\"related-prompt-item\"\n >\n <slot\n name=\"related-prompt-button\"\n v-bind=\"{ suggestion, index, arePromptsVisible, isSelected }\"\n >\n <RelatedPrompt\n :related-prompt=\"suggestion\"\n :index=\"index\"\n :is-prompt-visible=\"arePromptsVisible\"\n :is-selected=\"isSelected(index)\"\n />\n </slot>\n </div>\n </div>\n </slot>\n\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, onMounted, onUnmounted, ref } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/index';\n import RelatedPrompt from './related-prompt.vue';\n\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { RelatedPrompt, SlidingPanel },\n props: {\n buttonClass: String\n },\n setup() {\n const { relatedPrompts, selectedPrompt } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const slidingPanelContent = ref<Element>();\n const arePromptsVisible = ref(false);\n\n const observer = new IntersectionObserver(([entry]) => {\n arePromptsVisible.value = entry.isIntersecting;\n });\n\n onMounted(() => {\n observer.observe(slidingPanelContent.value as Element);\n });\n\n onUnmounted(() => {\n observer.disconnect();\n });\n\n const isSelected = (index: number): boolean => selectedPrompt.value === index;\n\n const hidePrompt = (index: number): boolean =>\n selectedPrompt.value !== -1 && selectedPrompt.value !== index;\n\n return {\n arePromptsVisible,\n hidePrompt,\n isSelected,\n relatedPrompts,\n selectedPrompt,\n slidingPanelContent\n };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n\n .x-related-prompt__sliding-panel-content-selected {\n width: calc(100%);\n }\n\n .x-related-prompt {\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n min-height: 112px;\n height: 100%;\n width: 303px;\n }\n\n .x-related-prompt-selected {\n width: 100% !important;\n min-height: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n\n &__button {\n width: 100% !important;\n }\n }\n\n .x-related-prompt__button {\n display: flex;\n flex-direction: row;\n gap: 12px;\n justify-content: space-between;\n align-items: start;\n text-align: start;\n padding: 16px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n flex-grow: 1;\n width: 303px;\n }\n\n .x-related-prompt__button-info {\n display: flex;\n min-height: 32px;\n }\n\n @media (max-width: 743px) {\n .x-related-prompt {\n width: 204px;\n &__button {\n width: 204px;\n }\n }\n }\n\n .x-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n\n .x-no-scrollbar {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n\n .x-typewritter-initial {\n color: #0000;\n background: linear-gradient(-90deg, transparent 5px, #0000 0) 10px 0,\n linear-gradient(#575757 0 0) 0 0;\n background-size: 0 200%;\n -webkit-background-clip: padding-box, text;\n background-clip: padding-box, text;\n background-repeat: no-repeat;\n }\n\n .x-typewritter-animation {\n animation: typewritter calc(var(--suggestion-text-length) * 0.05s)\n steps(var(--suggestion-text-length)) forwards;\n }\n\n @keyframes typewritter {\n from {\n background-size: 0 200%;\n }\n to {\n background-size: calc(var(--suggestion-text-length) * 1ch) 200%;\n }\n }\n\n .x-staggered-initial {\n opacity: 0;\n transform: translateY(20px);\n }\n\n .x-staggered-animation {\n animation: fadeInUp 0.6s forwards;\n }\n\n @keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n</style>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_renderSlot","_createCommentVNode","_createVNode","selectedPrompt","_withCtx","_createElementVNode","_normalizeClass","relatedPrompts","_Fragment","_renderList","hidePrompt","isSelected","_mergeProps"],"mappings":";;;;;;;kCACEA,gBAsDM,CAAA,cAAA,CAAA,CAAA;AApDF,EAAA,OAAAC,SAAA,EAHN,EAAAC,kBAAA,CAAA,KAAA,EAAA,IAAA,EA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CAAA;4CAC8FW,CAAgB,sCAAA,EAAA;AAAA,wBAAA,EAAA,uBAAA,EAAA,IAAA,CAAkDC,iBAAW,EAAA;AAAA,wBAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,CAAA,KAAA,CAAA,EAAA;AAKjL,wBAAA,EAAA,2BAAA,EAAU,IAAqB,CAAA,UAAA,CAAA,KAAA,CAAA,EAAA;AAAA,uBAAA,CAAA,CAAA;sBAE/B,WAUO,EAAA,qBAAA;AAAA,qBAAA;;AALF,sBAAAX,UAAA,CAAA,IAAA,CAAA,MAAA,EAAgB,uBAAU,EAAAY,UAAA,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,CAAA,iBAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA;AAAA,wBAAAV,WAAA,CACnB,wBAAK,EAAA;AAAA,0BACZ,gBAAA,EAAA,UAAA;AAAA,0BACA,KAAA;AAAA,0BAAA,mBAAA,EAAA,IAAA,CAAA,iBAAA;;;;;;;;;;;;;;;;AA5CjB,SAAA,CAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n scroll-container-class=\"x-related-prompts-tag-list-scroll-container\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"isAnimating && { pointerEvents: 'none' }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :relatedPrompt=\"relatedPrompt\"\n :onSelect=\"() => onSelect(index)\"\n :isSelected=\"isSelected(index)\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.toolingDisplayTagging\"\n :eventMetadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false\n }\"\n >\n <RelatedPrompt\n @click=\"onSelect(index)\"\n :related-prompt=\"relatedPrompt\"\n :selected=\"isSelected(index)\"\n />\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\n import { RelatedPrompt as RelatedPromptModel } from '@empathyco/x-types';\n import { computed, defineComponent, PropType, ref, watch } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { use$x, useState } from '../../../composables';\n import DisplayEmitter from '../../../components/display-emitter.vue';\n import RelatedPrompt from './related-prompt.vue';\n\n /**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700\n }\n },\n setup(props) {\n const x = use$x();\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const clickedListItemIndex = ref<number | null>(null);\n const initialOffsetLefts: Record<number, number> = {};\n const isAnimating = ref(false);\n const listItems = ref<HTMLElement[]>([]);\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!)\n )\n );\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length)\n );\n\n const indexRelatedPrompts = computed(() =>\n (relatedPrompts.value as RelatedPromptModel[]).map(\n (relatedPrompt: RelatedPromptModel, index: number) => ({\n ...relatedPrompt,\n index\n })\n )\n );\n\n const visibleRelatedPrompts = computed(() => {\n return selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value;\n });\n\n let timeOutId: number;\n const resetTransitionStyle = () => {\n if (timeOutId) {\n clearTimeout(timeOutId);\n }\n\n isAnimating.value = true;\n timeOutId = +setTimeout(() => {\n isAnimating.value = false;\n clickedListItemIndex.value = null;\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (property !== 'width') {\n element.style.removeProperty(property);\n }\n });\n });\n }, props.animationDurationInMs);\n };\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle();\n\n clickedListItemIndex.value = selectedIndex;\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex\n )!;\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n initialOffsetLefts[index] = element.offsetLeft;\n element.style.left = `${element.offsetLeft}px`;\n element.style.position = 'absolute';\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n\n if (index !== selectedIndex) {\n element.style.opacity = '1';\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`;\n }\n });\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`;\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth;\n\n selected.style.left = '0px';\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important'\n );\n });\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n selected.style.left = '0px';\n selected.style.position = 'absolute';\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width');\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`;\n });\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex);\n };\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement;\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n // Prepare the element for the enter animation\n element.style.opacity = '0';\n element.style.transform = 'translateY(5px)';\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`;\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n };\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement;\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`;\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1';\n element.style.position = 'absolute';\n element.style.transform = 'translateY(0)';\n });\n\n done();\n };\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement;\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0';\n element.style.transform = 'translateY(5px)';\n });\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs);\n };\n\n const isSelected = (index: number): boolean => selectedPromptIndex.value === index;\n\n // Changing the query will trigger the appear animation, so we need to reset the\n // style after it finishes\n watch(() => x.query.search, resetTransitionStyle, { immediate: true });\n\n return {\n isSelected,\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x\n };\n }\n });\n</script>\n<style lang=\"css\">\n .x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n }\n .x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n }\n .x-related-prompts-tag-list-item {\n height: 100%;\n }\n</style>\n"],"names":["_resolveComponent","_openBlock","_createBlock","buttonClass","_renderSlot","_withCtx","onBeforeEnter","onEnter","onLeave","_createElementBlock","_Fragment","_renderList","_normalizeClass","isAnimating","_normalizeStyle","onSelect","_createVNode","isSelected"],"mappings":";;;;;;;;;kCACEA,gBAiEe,CAAA,cAAA,CAAA,CAAA;SA/DZC,SAA8B,EAAA,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAC9B,GAAcC,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,MAAAA;AAAAA,IACf,yBAAuB,EAAA,KAAA;AAAA,IAAA,cAAA,EAAA,IAAA,CAAA,WAAA;AAEZ,IAAA,wBAAA,EAAA,6CAAA;AAAA,GAAA,EAAA;;MAqDAC,UAIiC,CAAA,IAAA,CAAA,MAAA,EAAA,2BAAA,CAAA;AAAA,KAAA,CAAA;;MAhEhDA,UA2DuB,CAAA,IAAA,CAAA,MAAA,EAAA,4BAAA,CAAA;AAAA,KAAA,CAAA;AA7ChB,IAAA,OAAA,EAAAC,OAAA,CAAY,MAAEC;AAAAA,MAAAA,WAAAA,CACPC,eAAO,EAAA;AAAA,QACd,aAAOC,EAAAA,IAAAA,CAAAA,aAAAA;AAAAA,QACR,OAAM,EAAA,IAAA,CAAA,OAAA;AAAA,QACL,SAAK,IAAK,CAAA,OAAA;AAAA,QACX,KAAI,EAAA,4BAAA;AAAA,QACJ,GAAA,EAAA,KAAA;AAAA,QAAA,GAAA,EAAA,IAAA;AApBN,QAAA,MAAA,EAAA,EAAA;AAAA,OAAA,EAAA;;AAAA,WAAAP,SAAA,CAAA,IAAA,CAAA,EAAAQ,kBAAA;AAAA,YAAAC,QAAA;AAAA,YAAA,IAAA;AAAA,YAAAC,UAAA,CAAA,IAAA,CAAA,qBAAA,EAAA,CAAA,EAAA,KAAA,EAAA,GAAA,aAAA,EAAA,KAAA;qBAwBYV,SAAW,EAAA,EAAAQ,kBAAA,CAAA,IAAA,EAAA;AAAA,gBACd,OAAK,EAA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A,GAAA;AAAA;AAAA,WAAA;AAAA,SAAA,CAAA;;;AAAA,OAAA,EAAA,CAAA,EAAA,CAAA,eAAA,EAAA,SAAA,EAAA,SAAA,CAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, computed, watch } from 'vue';
|
|
2
2
|
import SlidingPanel from '../../../components/sliding-panel.vue.js';
|
|
3
3
|
import { relatedPromptsXModule } from '../x-module.js';
|
|
4
4
|
import '../../../composables/create-use-device.js';
|
|
5
|
+
import { use$x } from '../../../composables/use-_x.js';
|
|
5
6
|
import '@vue/devtools-api';
|
|
6
7
|
import '../../../plugins/devtools/timeline.devtools.js';
|
|
7
8
|
import '@empathyco/x-utils';
|
|
@@ -13,40 +14,193 @@ import '../../../plugins/x-plugin.js';
|
|
|
13
14
|
import 'vuex';
|
|
14
15
|
import '@vueuse/core';
|
|
15
16
|
import { useState } from '../../../composables/use-state.js';
|
|
17
|
+
import _sfc_main$1 from '../../../components/display-emitter.vue.js';
|
|
16
18
|
import RelatedPrompt from './related-prompt.vue.js';
|
|
17
19
|
|
|
20
|
+
/**
|
|
21
|
+
* This component shows the list of `RelatedPrompts` components.
|
|
22
|
+
*
|
|
23
|
+
* If the default slot is reimplemented in the consumer, `onSelect` function will be
|
|
24
|
+
* necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
18
28
|
var _sfc_main = defineComponent({
|
|
19
29
|
name: 'RelatedPromptsTagList',
|
|
20
30
|
xModule: relatedPromptsXModule.name,
|
|
21
|
-
components: { RelatedPrompt, SlidingPanel },
|
|
31
|
+
components: { DisplayEmitter: _sfc_main$1, RelatedPrompt, SlidingPanel },
|
|
22
32
|
props: {
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The CSS class for the left and right button of the sliding panel.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
buttonClass: String,
|
|
39
|
+
/**
|
|
40
|
+
* The CSS class for all the related prompt wrapper elements.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
tagClass: String,
|
|
45
|
+
/**
|
|
46
|
+
* Array of colors to apply to the related prompts. It will be applied to tag
|
|
47
|
+
* elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
tagColors: Array,
|
|
52
|
+
/**
|
|
53
|
+
* The duration of the total animation in milliseconds.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
animationDurationInMs: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 700
|
|
60
|
+
}
|
|
24
61
|
},
|
|
25
|
-
setup() {
|
|
26
|
-
const
|
|
62
|
+
setup(props) {
|
|
63
|
+
const x = use$x();
|
|
64
|
+
const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts', [
|
|
27
65
|
'relatedPrompts',
|
|
28
66
|
'selectedPrompt'
|
|
29
67
|
]);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
68
|
+
const clickedListItemIndex = ref(null);
|
|
69
|
+
const initialOffsetLefts = {};
|
|
70
|
+
const isAnimating = ref(false);
|
|
71
|
+
const listItems = ref([]);
|
|
72
|
+
const sortedListItems = computed(() => [...listItems.value].sort((a, b) => Number.parseInt(b.getAttribute('data-index')) -
|
|
73
|
+
Number.parseInt(a.getAttribute('data-index'))));
|
|
74
|
+
// The duration of a single animation (enter or leave) in milliseconds
|
|
75
|
+
// if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related
|
|
76
|
+
// prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)
|
|
77
|
+
const singleAnimationDurationInMs = computed(() => props.animationDurationInMs /
|
|
78
|
+
(clickedListItemIndex.value !== null
|
|
79
|
+
? relatedPrompts.value.length - 1
|
|
80
|
+
: relatedPrompts.value.length));
|
|
81
|
+
const indexRelatedPrompts = computed(() => relatedPrompts.value.map((relatedPrompt, index) => ({
|
|
82
|
+
...relatedPrompt,
|
|
83
|
+
index
|
|
84
|
+
})));
|
|
85
|
+
const visibleRelatedPrompts = computed(() => {
|
|
86
|
+
return selectedPromptIndex.value !== -1
|
|
87
|
+
? [indexRelatedPrompts.value[selectedPromptIndex.value]]
|
|
88
|
+
: indexRelatedPrompts.value;
|
|
34
89
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
90
|
+
let timeOutId;
|
|
91
|
+
const resetTransitionStyle = () => {
|
|
92
|
+
if (timeOutId) {
|
|
93
|
+
clearTimeout(timeOutId);
|
|
94
|
+
}
|
|
95
|
+
isAnimating.value = true;
|
|
96
|
+
timeOutId = +setTimeout(() => {
|
|
97
|
+
isAnimating.value = false;
|
|
98
|
+
clickedListItemIndex.value = null;
|
|
99
|
+
sortedListItems.value.forEach(element => {
|
|
100
|
+
element.style.cssText
|
|
101
|
+
.split(';')
|
|
102
|
+
.map(rule => rule.split(':')[0]?.trim())
|
|
103
|
+
.forEach(property => {
|
|
104
|
+
if (property !== 'width') {
|
|
105
|
+
element.style.removeProperty(property);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}, props.animationDurationInMs);
|
|
110
|
+
};
|
|
111
|
+
const onSelect = (selectedIndex) => {
|
|
112
|
+
resetTransitionStyle();
|
|
113
|
+
clickedListItemIndex.value = selectedIndex;
|
|
114
|
+
const selected = sortedListItems.value.find(element => Number.parseInt(element.getAttribute('data-index')) === selectedIndex);
|
|
115
|
+
// selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'
|
|
116
|
+
if (selectedPromptIndex.value === -1) {
|
|
117
|
+
// Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are
|
|
118
|
+
// sorted in descending order by index.
|
|
119
|
+
sortedListItems.value.forEach(element => {
|
|
120
|
+
const index = Number.parseInt(element.getAttribute('data-index'));
|
|
121
|
+
initialOffsetLefts[index] = element.offsetLeft;
|
|
122
|
+
element.style.left = `${element.offsetLeft}px`;
|
|
123
|
+
element.style.position = 'absolute';
|
|
124
|
+
element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;
|
|
125
|
+
if (index !== selectedIndex) {
|
|
126
|
+
element.style.opacity = '1';
|
|
127
|
+
element.style.transitionDelay = `${(index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value}ms`;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
// Synchronize the transition delay of the selected element with the last
|
|
131
|
+
// element to leave
|
|
132
|
+
selected.style.transitionDelay = `${(relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *
|
|
133
|
+
singleAnimationDurationInMs.value}ms`;
|
|
134
|
+
// Trigger the animation (selecting) for the selected element
|
|
135
|
+
requestAnimationFrame(() => {
|
|
136
|
+
const maxWidth = getComputedStyle(selected).maxWidth;
|
|
137
|
+
selected.style.left = '0px';
|
|
138
|
+
selected.style.setProperty('width', `${maxWidth !== 'none' ? maxWidth : '100%'}`, 'important');
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Prepare the selected element for the deselecting animation
|
|
143
|
+
selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;
|
|
144
|
+
selected.style.left = '0px';
|
|
145
|
+
selected.style.position = 'absolute';
|
|
146
|
+
// Trigger the animation (deselecting) for the selected element
|
|
147
|
+
selected.style.removeProperty('width');
|
|
148
|
+
requestAnimationFrame(() => {
|
|
149
|
+
selected.style.left = `${initialOffsetLefts[selectedIndex]}px`;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
x.emit('UserSelectedARelatedPrompt', selectedIndex);
|
|
153
|
+
};
|
|
154
|
+
const onBeforeEnter = (el) => {
|
|
155
|
+
const element = el;
|
|
156
|
+
const index = Number.parseInt(element.getAttribute('data-index'));
|
|
157
|
+
// Prepare the element for the enter animation
|
|
158
|
+
element.style.opacity = '0';
|
|
159
|
+
element.style.transform = 'translateY(5px)';
|
|
160
|
+
element.style.transitionDelay = `${(clickedListItemIndex.value !== null && index > clickedListItemIndex.value
|
|
161
|
+
? index - 1
|
|
162
|
+
: index) * singleAnimationDurationInMs.value}ms`;
|
|
163
|
+
element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;
|
|
164
|
+
};
|
|
165
|
+
const onEnter = (el, done) => {
|
|
166
|
+
const element = el;
|
|
167
|
+
const index = Number.parseInt(element.getAttribute('data-index'));
|
|
168
|
+
// Also part of the preparation for the enter animation, but it needs to be done
|
|
169
|
+
// once the element is inserted in DOM (if not the offsetLeft will be always 0)
|
|
170
|
+
element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`;
|
|
171
|
+
// trigger enter animation
|
|
172
|
+
requestAnimationFrame(() => {
|
|
173
|
+
element.style.opacity = '1';
|
|
174
|
+
element.style.position = 'absolute';
|
|
175
|
+
element.style.transform = 'translateY(0)';
|
|
176
|
+
});
|
|
177
|
+
done();
|
|
178
|
+
};
|
|
179
|
+
const onLeave = (el, done) => {
|
|
180
|
+
const element = el;
|
|
181
|
+
// trigger leave animation
|
|
182
|
+
requestAnimationFrame(() => {
|
|
183
|
+
element.style.opacity = '0';
|
|
184
|
+
element.style.transform = 'translateY(5px)';
|
|
185
|
+
});
|
|
186
|
+
// Wait for the animation to finish (done() exectution extracts the element from the DOM)
|
|
187
|
+
setTimeout(done, props.animationDurationInMs);
|
|
188
|
+
};
|
|
189
|
+
const isSelected = (index) => selectedPromptIndex.value === index;
|
|
190
|
+
// Changing the query will trigger the appear animation, so we need to reset the
|
|
191
|
+
// style after it finishes
|
|
192
|
+
watch(() => x.query.search, resetTransitionStyle, { immediate: true });
|
|
43
193
|
return {
|
|
44
|
-
arePromptsVisible,
|
|
45
|
-
hidePrompt,
|
|
46
194
|
isSelected,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
195
|
+
onSelect,
|
|
196
|
+
onBeforeEnter,
|
|
197
|
+
onEnter,
|
|
198
|
+
onLeave,
|
|
199
|
+
selectedPromptIndex,
|
|
200
|
+
visibleRelatedPrompts,
|
|
201
|
+
listItems,
|
|
202
|
+
isAnimating,
|
|
203
|
+
x
|
|
50
204
|
};
|
|
51
205
|
}
|
|
52
206
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompts-tag-list.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <div>\n <template v-if=\"$slots.header\">\n <slot name=\"header\" />\n </template>\n <SlidingPanel\n :reset-on-content-change=\"true\"\n :button-class=\"buttonClass\"\n :scroll-container-class=\"\n selectedPrompt === -1 ? 'desktop:x-sliding-panel-fade desktop:x-sliding-panel-fade-sm' : ''\n \"\n >\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panel-left-button\" />\n </template>\n\n <slot name=\"sliding-panel-content\">\n <div\n ref=\"slidingPanelContent\"\n class=\"x-related-prompt__sliding-panel-content\"\n :class=\"{ 'x-related-prompt__sliding-panel-content-selected': selectedPrompt !== -1 }\"\n >\n <div\n v-for=\"(suggestion, index) in relatedPrompts\"\n :key=\"index\"\n :style=\"{\n animationDelay: `${index * 0.4 + 0.05}s`\n }\"\n class=\"x-related-prompt x-staggered-initial\"\n :class=\"[\n { 'x-staggered-animation': arePromptsVisible },\n { 'x-hidden': hidePrompt(index) },\n { 'x-related-prompt-selected': isSelected(index) }\n ]\"\n data-test=\"related-prompt-item\"\n >\n <slot\n name=\"related-prompt-button\"\n v-bind=\"{ suggestion, index, arePromptsVisible, isSelected }\"\n >\n <RelatedPrompt\n :related-prompt=\"suggestion\"\n :index=\"index\"\n :is-prompt-visible=\"arePromptsVisible\"\n :is-selected=\"isSelected(index)\"\n />\n </slot>\n </div>\n </div>\n </slot>\n\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, onMounted, onUnmounted, ref } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/index';\n import RelatedPrompt from './related-prompt.vue';\n\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { RelatedPrompt, SlidingPanel },\n props: {\n buttonClass: String\n },\n setup() {\n const { relatedPrompts, selectedPrompt } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const slidingPanelContent = ref<Element>();\n const arePromptsVisible = ref(false);\n\n const observer = new IntersectionObserver(([entry]) => {\n arePromptsVisible.value = entry.isIntersecting;\n });\n\n onMounted(() => {\n observer.observe(slidingPanelContent.value as Element);\n });\n\n onUnmounted(() => {\n observer.disconnect();\n });\n\n const isSelected = (index: number): boolean => selectedPrompt.value === index;\n\n const hidePrompt = (index: number): boolean =>\n selectedPrompt.value !== -1 && selectedPrompt.value !== index;\n\n return {\n arePromptsVisible,\n hidePrompt,\n isSelected,\n relatedPrompts,\n selectedPrompt,\n slidingPanelContent\n };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n\n .x-related-prompt__sliding-panel-content-selected {\n width: calc(100%);\n }\n\n .x-related-prompt {\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n min-height: 112px;\n height: 100%;\n width: 303px;\n }\n\n .x-related-prompt-selected {\n width: 100% !important;\n min-height: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n\n &__button {\n width: 100% !important;\n }\n }\n\n .x-related-prompt__button {\n display: flex;\n flex-direction: row;\n gap: 12px;\n justify-content: space-between;\n align-items: start;\n text-align: start;\n padding: 16px;\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 500ms;\n flex-grow: 1;\n width: 303px;\n }\n\n .x-related-prompt__button-info {\n display: flex;\n min-height: 32px;\n }\n\n @media (max-width: 743px) {\n .x-related-prompt {\n width: 204px;\n &__button {\n width: 204px;\n }\n }\n }\n\n .x-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n\n .x-no-scrollbar {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n\n .x-typewritter-initial {\n color: #0000;\n background: linear-gradient(-90deg, transparent 5px, #0000 0) 10px 0,\n linear-gradient(#575757 0 0) 0 0;\n background-size: 0 200%;\n -webkit-background-clip: padding-box, text;\n background-clip: padding-box, text;\n background-repeat: no-repeat;\n }\n\n .x-typewritter-animation {\n animation: typewritter calc(var(--suggestion-text-length) * 0.05s)\n steps(var(--suggestion-text-length)) forwards;\n }\n\n @keyframes typewritter {\n from {\n background-size: 0 200%;\n }\n to {\n background-size: calc(var(--suggestion-text-length) * 1ch) 200%;\n }\n }\n\n .x-staggered-initial {\n opacity: 0;\n transform: translateY(20px);\n }\n\n .x-staggered-animation {\n animation: fadeInUp 0.6s forwards;\n }\n\n @keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n</style>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgEE,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,EAAE,aAAa,EAAE,cAAc;AAC3C,IAAA,KAAK,EAAE;AACL,QAAA,WAAW,EAAE,MAAK;AACnB,KAAA;IACD,KAAK,GAAA;QACH,MAAM,EAAE,cAAc,EAAE,cAAa,EAAI,GAAE,QAAQ,CAAC,gBAAgB,EAAE;YACpE,gBAAgB;YAChB,gBAAe;AAChB,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,mBAAkB,GAAI,GAAG,EAAW,CAAA;AAC1C,QAAA,MAAM,iBAAgB,GAAI,GAAG,CAAC,KAAK,CAAC,CAAA;QAEpC,MAAM,QAAS,GAAE,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;AACrD,YAAA,iBAAiB,CAAC,KAAM,GAAE,KAAK,CAAC,cAAc,CAAA;AAChD,SAAC,CAAC,CAAA;QAEF,SAAS,CAAC,MAAM;AACd,YAAA,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAgB,CAAC,CAAA;AACxD,SAAC,CAAC,CAAA;QAEF,WAAW,CAAC,MAAM;YAChB,QAAQ,CAAC,UAAU,EAAE,CAAA;AACvB,SAAC,CAAC,CAAA;AAEF,QAAA,MAAM,UAAW,GAAE,CAAC,KAAa,KAAc,cAAc,CAAC,KAAI,KAAM,KAAK,CAAA;AAE7E,QAAA,MAAM,UAAW,GAAE,CAAC,KAAa,KAC/B,cAAc,CAAC,KAAI,KAAM,CAAC,CAAA,IAAK,cAAc,CAAC,KAAM,KAAI,KAAK,CAAA;QAE/D,OAAO;YACL,iBAAiB;YACjB,UAAU;YACV,UAAU;YACV,cAAc;YACd,cAAc;YACd,mBAAkB;SACnB,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n scroll-container-class=\"x-related-prompts-tag-list-scroll-container\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"isAnimating && { pointerEvents: 'none' }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :relatedPrompt=\"relatedPrompt\"\n :onSelect=\"() => onSelect(index)\"\n :isSelected=\"isSelected(index)\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.toolingDisplayTagging\"\n :eventMetadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false\n }\"\n >\n <RelatedPrompt\n @click=\"onSelect(index)\"\n :related-prompt=\"relatedPrompt\"\n :selected=\"isSelected(index)\"\n />\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\n import { RelatedPrompt as RelatedPromptModel } from '@empathyco/x-types';\n import { computed, defineComponent, PropType, ref, watch } from 'vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n import { relatedPromptsXModule } from '../x-module';\n import { use$x, useState } from '../../../composables';\n import DisplayEmitter from '../../../components/display-emitter.vue';\n import RelatedPrompt from './related-prompt.vue';\n\n /**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700\n }\n },\n setup(props) {\n const x = use$x();\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts', [\n 'relatedPrompts',\n 'selectedPrompt'\n ]);\n\n const clickedListItemIndex = ref<number | null>(null);\n const initialOffsetLefts: Record<number, number> = {};\n const isAnimating = ref(false);\n const listItems = ref<HTMLElement[]>([]);\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!)\n )\n );\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length)\n );\n\n const indexRelatedPrompts = computed(() =>\n (relatedPrompts.value as RelatedPromptModel[]).map(\n (relatedPrompt: RelatedPromptModel, index: number) => ({\n ...relatedPrompt,\n index\n })\n )\n );\n\n const visibleRelatedPrompts = computed(() => {\n return selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value;\n });\n\n let timeOutId: number;\n const resetTransitionStyle = () => {\n if (timeOutId) {\n clearTimeout(timeOutId);\n }\n\n isAnimating.value = true;\n timeOutId = +setTimeout(() => {\n isAnimating.value = false;\n clickedListItemIndex.value = null;\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (property !== 'width') {\n element.style.removeProperty(property);\n }\n });\n });\n }, props.animationDurationInMs);\n };\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle();\n\n clickedListItemIndex.value = selectedIndex;\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex\n )!;\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n initialOffsetLefts[index] = element.offsetLeft;\n element.style.left = `${element.offsetLeft}px`;\n element.style.position = 'absolute';\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n\n if (index !== selectedIndex) {\n element.style.opacity = '1';\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`;\n }\n });\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`;\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth;\n\n selected.style.left = '0px';\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important'\n );\n });\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n selected.style.left = '0px';\n selected.style.position = 'absolute';\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width');\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`;\n });\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex);\n };\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement;\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n // Prepare the element for the enter animation\n element.style.opacity = '0';\n element.style.transform = 'translateY(5px)';\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`;\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`;\n };\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement;\n const index = Number.parseInt(element.getAttribute('data-index')!);\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`;\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1';\n element.style.position = 'absolute';\n element.style.transform = 'translateY(0)';\n });\n\n done();\n };\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement;\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0';\n element.style.transform = 'translateY(5px)';\n });\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs);\n };\n\n const isSelected = (index: number): boolean => selectedPromptIndex.value === index;\n\n // Changing the query will trigger the appear animation, so we need to reset the\n // style after it finishes\n watch(() => x.query.search, resetTransitionStyle, { immediate: true });\n\n return {\n isSelected,\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x\n };\n }\n });\n</script>\n<style lang=\"css\">\n .x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n }\n .x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n }\n .x-related-prompts-tag-list-item {\n height: 100%;\n }\n</style>\n"],"names":["DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;AA8EE;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,UAAU,EAAE,kBAAEA,WAAc,EAAE,aAAa,EAAE,YAAW,EAAG;AAC3D,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,WAAW,EAAE,MAAM;AACnB;;;;AAIE;AACF,QAAA,QAAQ,EAAE,MAAM;AAChB;;;;;AAKE;AACF,QAAA,SAAS,EAAE,KAA2B;AACtC;;;;AAIE;AACF,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAE;AACb,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,CAAE,GAAE,KAAK,EAAE,CAAA;QACjB,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAoB,EAAA,GAAI,QAAQ,CAAC,gBAAgB,EAAE;YACzF,gBAAgB;YAChB,gBAAe;AAChB,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,uBAAuB,GAAG,CAAgB,IAAI,CAAC,CAAA;QACrD,MAAM,kBAAkB,GAA2B,EAAE,CAAA;AACrD,QAAA,MAAM,WAAU,GAAI,GAAG,CAAC,KAAK,CAAC,CAAA;AAC9B,QAAA,MAAM,SAAU,GAAE,GAAG,CAAgB,EAAE,CAAC,CAAA;AAExC,QAAA,MAAM,eAAc,GAAI,QAAQ,CAAgB,MAC9C,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,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CAAC,UAAU,IAAI,CAAA;;YAG3E,qBAAqB,CAAC,MAAM;AAC1B,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAQ,GAAE,GAAG,CAAA;AAC3B,gBAAA,OAAO,CAAC,KAAK,CAAC,QAAO,GAAI,UAAU,CAAA;AACnC,gBAAA,OAAO,CAAC,KAAK,CAAC,SAAU,GAAE,eAAe,CAAA;AAC3C,aAAC,CAAC,CAAA;AAEF,YAAA,IAAI,EAAE,CAAA;AACR,SAAC,CAAA;AAED,QAAA,MAAM,UAAU,CAAC,EAAW,EAAE,IAAgB,KAAK;YACjD,MAAM,OAAM,GAAI,EAAiB,CAAA;;YAGjC,qBAAqB,CAAC,MAAM;AAC1B,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAQ,GAAE,GAAG,CAAA;AAC3B,gBAAA,OAAO,CAAC,KAAK,CAAC,YAAY,iBAAiB,CAAA;AAC7C,aAAC,CAAC,CAAA;;AAGF,YAAA,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAA;AAC/C,SAAC,CAAA;AAED,QAAA,MAAM,aAAa,CAAC,KAAa,KAAc,mBAAmB,CAAC,KAAM,KAAI,KAAK,CAAA;;;AAIlF,QAAA,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAG,EAAG,CAAC,CAAA;QAEtE,OAAO;YACL,UAAU;YACV,QAAQ;YACR,aAAa;YACb,OAAO;YACP,OAAO;YACP,mBAAmB;YACnB,qBAAqB;YACrB,SAAS;YACT,WAAW;YACX,CAAA;SACD,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import injectCss from '../../../../tools/inject-css.js';
|
|
2
2
|
|
|
3
|
-
var css = ".x-related-
|
|
3
|
+
var css = ".x-related-prompts-tag-list-scroll-container{height:100%;position:relative}.x-related-prompts-tag-list{display:flex;gap:16px;min-width:100%}.x-related-prompts-tag-list-item{height:100%}";
|
|
4
4
|
injectCss(css);
|
|
5
5
|
|
|
6
6
|
export { css, css as default };
|
|
@@ -16,7 +16,11 @@ const taggingXStoreModule = {
|
|
|
16
16
|
},
|
|
17
17
|
consent: null,
|
|
18
18
|
noResultsTaggingEnabled: false,
|
|
19
|
-
queryTaggingInfo: null
|
|
19
|
+
queryTaggingInfo: null,
|
|
20
|
+
toolingTaggingInfo: {
|
|
21
|
+
toolingDisplayClick: null,
|
|
22
|
+
toolingDisplayAdd2Cart: null
|
|
23
|
+
}
|
|
20
24
|
}),
|
|
21
25
|
getters: {},
|
|
22
26
|
mutations: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { track } from './actions/track.action';\nimport { TaggingXStoreModule } from './types';\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 clickedResultStorageKey: null,\n clickedResultStorageTTLMs: null\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: 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 setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries') {\n state.noResultsTaggingEnabled = true;\n }\n },\n setConfig,\n mergeConfig\n },\n actions: {\n track\n }\n};\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACU,MAAA,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,uBAAuB,EAAE,IAAI;AAC7B,YAAA,yBAAyB,EAAE,IAAI;AAChC,SAAA;AACD,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,uBAAuB,EAAE,KAAK;AAC9B,QAAA,gBAAgB,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { track } from './actions/track.action';\nimport { TaggingXStoreModule } from './types';\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 clickedResultStorageKey: null,\n clickedResultStorageTTLMs: null\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: null,\n toolingTaggingInfo: {\n toolingDisplayClick: null,\n toolingDisplayAdd2Cart: null\n }\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 setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries') {\n state.noResultsTaggingEnabled = true;\n }\n },\n setConfig,\n mergeConfig\n },\n actions: {\n track\n }\n};\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACU,MAAA,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,uBAAuB,EAAE,IAAI;AAC7B,YAAA,yBAAyB,EAAE,IAAI;AAChC,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;KACF,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgC,EAAA;AACzD,YAAA,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;SAC3C;QACD,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAA;YACtC,IAAI,MAAM,KAAK,iBAAiB,EAAE;AAChC,gBAAA,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;AACtC,aAAA;SACF;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,KAAK;AACN,KAAA;;;;;"}
|
|
@@ -135,6 +135,18 @@ const trackAddToCartWire = createTrackWire('add2cart');
|
|
|
135
135
|
* @public
|
|
136
136
|
*/
|
|
137
137
|
const trackDisplayClickedWire = createTrackDisplayWire('displayClick');
|
|
138
|
+
/**
|
|
139
|
+
* Performs a track of a display result being clicked.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
const trackToolingDisplayClickedWire = createTrackToolingDisplayWire();
|
|
144
|
+
/**
|
|
145
|
+
* Performs a track of a display result being clicked.
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
const trackToolingAdd2CartWire = createTrackToolingAdd2CartWire();
|
|
138
150
|
/**
|
|
139
151
|
* Performs a track of a display element appearing.
|
|
140
152
|
*
|
|
@@ -198,6 +210,51 @@ function createTrackDisplayWire(property) {
|
|
|
198
210
|
return taggingInfo;
|
|
199
211
|
}), ({ eventPayload: { tagging } }) => !!tagging?.[property]);
|
|
200
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Update the tooling tagging params with the result information.
|
|
215
|
+
*
|
|
216
|
+
* @param taggingRequest - The tooling tagging request to be updated.
|
|
217
|
+
* @param result - The clicked result.
|
|
218
|
+
* @returns The tagging request updated.
|
|
219
|
+
*
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
function updateToolingTaggingWithResult(taggingRequest, result) {
|
|
223
|
+
taggingRequest.params.productId = result.id;
|
|
224
|
+
taggingRequest.params.title = result.name;
|
|
225
|
+
taggingRequest.params.url = result.url;
|
|
226
|
+
return taggingRequest;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Factory helper to create a wire for the track of the tooling display click.
|
|
230
|
+
*
|
|
231
|
+
* @returns A new wire for the tooling display click of the taggable element.
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
function createTrackToolingDisplayWire() {
|
|
236
|
+
return filter(wireDispatch('track', ({ eventPayload, metadata }) => {
|
|
237
|
+
const taggingInfo = metadata.toolingTagging;
|
|
238
|
+
const resultInfo = eventPayload;
|
|
239
|
+
updateToolingTaggingWithResult(taggingInfo, resultInfo);
|
|
240
|
+
return taggingInfo;
|
|
241
|
+
}), ({ metadata }) => !!metadata?.toolingTagging);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Factory helper to create a wire for the track of the tooling display click.
|
|
245
|
+
*
|
|
246
|
+
* @returns A new wire for the tooling display add to cart of the taggable element.
|
|
247
|
+
*
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
250
|
+
function createTrackToolingAdd2CartWire() {
|
|
251
|
+
return filter(wireDispatch('track', ({ eventPayload, metadata }) => {
|
|
252
|
+
const taggingInfo = metadata.toolingAdd2CartTagging;
|
|
253
|
+
const resultInfo = eventPayload;
|
|
254
|
+
updateToolingTaggingWithResult(taggingInfo, resultInfo);
|
|
255
|
+
return taggingInfo;
|
|
256
|
+
}), ({ metadata }) => !!metadata?.toolingAdd2CartTagging);
|
|
257
|
+
}
|
|
201
258
|
/**
|
|
202
259
|
* Factory helper to create a wire to set the queryTagging.
|
|
203
260
|
*
|
|
@@ -261,8 +318,14 @@ const taggingWiring = createWiring({
|
|
|
261
318
|
},
|
|
262
319
|
ModuleRegistered: {
|
|
263
320
|
setNoResultsTaggingEnabledWire
|
|
321
|
+
},
|
|
322
|
+
UserClickedARelatedPromptResult: {
|
|
323
|
+
trackToolingDisplayClickedWire
|
|
324
|
+
},
|
|
325
|
+
UserClickedARelatedPromptAdd2Cart: {
|
|
326
|
+
trackToolingAdd2CartWire
|
|
264
327
|
}
|
|
265
328
|
});
|
|
266
329
|
|
|
267
|
-
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackResultClickedWire };
|
|
330
|
+
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire };
|
|
268
331
|
//# sourceMappingURL=wiring.js.map
|