@athoscommerce/snap-preact 1.13.3-beta.168 → 1.13.3-beta.191

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.
Files changed (126) hide show
  1. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -1
  2. package/dist/cjs/components/src/components/Molecules/ChatMessageText/ChatMessageText.js +2 -1
  3. package/dist/cjs/components/src/components/Molecules/ChatMessageUser/ChatMessageUser.js +4 -0
  4. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +1 -0
  5. package/dist/cjs/components/src/components/Molecules/ChatQuickview/ChatQuickview.js +514 -0
  6. package/dist/cjs/components/src/components/Molecules/{ChatProductQueryMessage → ChatQuickview}/index.js +1 -1
  7. package/dist/cjs/components/src/components/Molecules/ChatResultsDisplay/ChatResultsDisplay.js +2 -2
  8. package/dist/cjs/components/src/components/Molecules/Slideshow/Slideshow.js +47 -20
  9. package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +12 -5
  10. package/dist/cjs/components/src/components/Organisms/Chat/Chat.lang.js +5 -0
  11. package/dist/cjs/components/src/components/Organisms/Chat/components/ChatAttachments.js +5 -4
  12. package/dist/cjs/components/src/components/Organisms/Chat/components/ChatComposer.js +3 -3
  13. package/dist/cjs/components/src/components/Organisms/Chat/components/ChatSideChat.js +3 -3
  14. package/dist/cjs/components/src/components/Organisms/Chat/components/chatAccentTheme.js +22 -20
  15. package/dist/cjs/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +44 -11
  16. package/dist/cjs/components/src/index.js +1 -1
  17. package/dist/cjs/components/src/providers/themeComponents.js +1 -1
  18. package/dist/cjs/src/Snap.js +13 -1
  19. package/dist/cjs/src/Templates/Stores/LibraryStore.js +2 -2
  20. package/dist/cjs/src/Templates/Stores/library/languages/ar.js +45 -34
  21. package/dist/cjs/src/Templates/Stores/library/languages/de.js +45 -34
  22. package/dist/cjs/src/Templates/Stores/library/languages/es.js +45 -34
  23. package/dist/cjs/src/Templates/Stores/library/languages/fr.js +45 -34
  24. package/dist/cjs/src/Templates/Stores/library/languages/hi.js +45 -34
  25. package/dist/cjs/src/Templates/Stores/library/languages/it.js +45 -34
  26. package/dist/cjs/src/Templates/Stores/library/languages/ja.js +45 -34
  27. package/dist/cjs/src/Templates/Stores/library/languages/ko.js +45 -34
  28. package/dist/cjs/src/Templates/Stores/library/languages/nl.js +45 -34
  29. package/dist/cjs/src/Templates/Stores/library/languages/pt.js +45 -34
  30. package/dist/cjs/src/Templates/Stores/library/languages/ru.js +45 -34
  31. package/dist/cjs/src/Templates/Stores/library/languages/tr.js +45 -34
  32. package/dist/cjs/src/Templates/Stores/library/languages/vi.js +45 -34
  33. package/dist/cjs/src/Templates/Stores/library/languages/zh.js +45 -34
  34. package/dist/cjs/src/create/createChatController.js +1 -0
  35. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts +1 -1
  36. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts.map +1 -1
  37. package/dist/esm/components/src/components/Molecules/ChatAttachmentContext/ChatAttachmentContext.d.ts +12 -5
  38. package/dist/esm/components/src/components/Molecules/ChatAttachmentContext/ChatAttachmentContext.d.ts.map +1 -1
  39. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +13 -2
  40. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
  41. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -1
  42. package/dist/esm/components/src/components/Molecules/ChatMessageText/ChatMessageText.d.ts.map +1 -1
  43. package/dist/esm/components/src/components/Molecules/ChatMessageText/ChatMessageText.js +2 -1
  44. package/dist/esm/components/src/components/Molecules/ChatMessageUser/ChatMessageUser.d.ts +17 -3
  45. package/dist/esm/components/src/components/Molecules/ChatMessageUser/ChatMessageUser.d.ts.map +1 -1
  46. package/dist/esm/components/src/components/Molecules/ChatMessageUser/ChatMessageUser.js +4 -0
  47. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts +7 -1
  48. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts.map +1 -1
  49. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +1 -0
  50. package/dist/esm/components/src/components/Molecules/ChatQuickview/ChatQuickview.d.ts +30 -0
  51. package/dist/esm/components/src/components/Molecules/ChatQuickview/ChatQuickview.d.ts.map +1 -0
  52. package/dist/esm/components/src/components/Molecules/ChatQuickview/ChatQuickview.js +508 -0
  53. package/dist/esm/components/src/components/Molecules/ChatQuickview/index.d.ts +2 -0
  54. package/dist/esm/components/src/components/Molecules/ChatQuickview/index.d.ts.map +1 -0
  55. package/dist/esm/components/src/components/Molecules/ChatQuickview/index.js +1 -0
  56. package/dist/esm/components/src/components/Molecules/ChatResultsDisplay/ChatResultsDisplay.js +2 -2
  57. package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.d.ts.map +1 -1
  58. package/dist/esm/components/src/components/Molecules/Slideshow/Slideshow.js +47 -20
  59. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
  60. package/dist/esm/components/src/components/Organisms/Chat/Chat.js +12 -5
  61. package/dist/esm/components/src/components/Organisms/Chat/Chat.lang.d.ts +3 -0
  62. package/dist/esm/components/src/components/Organisms/Chat/Chat.lang.d.ts.map +1 -1
  63. package/dist/esm/components/src/components/Organisms/Chat/Chat.lang.js +5 -0
  64. package/dist/esm/components/src/components/Organisms/Chat/components/ChatAttachments.d.ts.map +1 -1
  65. package/dist/esm/components/src/components/Organisms/Chat/components/ChatAttachments.js +5 -4
  66. package/dist/esm/components/src/components/Organisms/Chat/components/ChatComposer.d.ts.map +1 -1
  67. package/dist/esm/components/src/components/Organisms/Chat/components/ChatComposer.js +3 -3
  68. package/dist/esm/components/src/components/Organisms/Chat/components/ChatSideChat.d.ts.map +1 -1
  69. package/dist/esm/components/src/components/Organisms/Chat/components/ChatSideChat.js +3 -3
  70. package/dist/esm/components/src/components/Organisms/Chat/components/chatAccentTheme.d.ts +1 -1
  71. package/dist/esm/components/src/components/Organisms/Chat/components/chatAccentTheme.d.ts.map +1 -1
  72. package/dist/esm/components/src/components/Organisms/Chat/components/chatAccentTheme.js +22 -20
  73. package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.d.ts +5 -1
  74. package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.d.ts.map +1 -1
  75. package/dist/esm/components/src/components/Organisms/QuickviewLayout/QuickviewLayout.js +44 -11
  76. package/dist/esm/components/src/index.d.ts +1 -1
  77. package/dist/esm/components/src/index.d.ts.map +1 -1
  78. package/dist/esm/components/src/index.js +1 -1
  79. package/dist/esm/components/src/providers/langComponents.d.ts +2 -2
  80. package/dist/esm/components/src/providers/langComponents.d.ts.map +1 -1
  81. package/dist/esm/components/src/providers/themeComponents.d.ts +7 -7
  82. package/dist/esm/components/src/providers/themeComponents.d.ts.map +1 -1
  83. package/dist/esm/components/src/providers/themeComponents.js +1 -1
  84. package/dist/esm/src/Snap.d.ts +1 -0
  85. package/dist/esm/src/Snap.d.ts.map +1 -1
  86. package/dist/esm/src/Snap.js +13 -1
  87. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts +2 -2
  88. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  89. package/dist/esm/src/Templates/Stores/LibraryStore.js +2 -2
  90. package/dist/esm/src/Templates/Stores/library/languages/ar.d.ts.map +1 -1
  91. package/dist/esm/src/Templates/Stores/library/languages/ar.js +45 -34
  92. package/dist/esm/src/Templates/Stores/library/languages/de.d.ts.map +1 -1
  93. package/dist/esm/src/Templates/Stores/library/languages/de.js +45 -34
  94. package/dist/esm/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
  95. package/dist/esm/src/Templates/Stores/library/languages/es.js +45 -34
  96. package/dist/esm/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
  97. package/dist/esm/src/Templates/Stores/library/languages/fr.js +45 -34
  98. package/dist/esm/src/Templates/Stores/library/languages/hi.d.ts.map +1 -1
  99. package/dist/esm/src/Templates/Stores/library/languages/hi.js +45 -34
  100. package/dist/esm/src/Templates/Stores/library/languages/it.d.ts.map +1 -1
  101. package/dist/esm/src/Templates/Stores/library/languages/it.js +45 -34
  102. package/dist/esm/src/Templates/Stores/library/languages/ja.d.ts.map +1 -1
  103. package/dist/esm/src/Templates/Stores/library/languages/ja.js +45 -34
  104. package/dist/esm/src/Templates/Stores/library/languages/ko.d.ts.map +1 -1
  105. package/dist/esm/src/Templates/Stores/library/languages/ko.js +45 -34
  106. package/dist/esm/src/Templates/Stores/library/languages/nl.d.ts.map +1 -1
  107. package/dist/esm/src/Templates/Stores/library/languages/nl.js +45 -34
  108. package/dist/esm/src/Templates/Stores/library/languages/pt.d.ts.map +1 -1
  109. package/dist/esm/src/Templates/Stores/library/languages/pt.js +45 -34
  110. package/dist/esm/src/Templates/Stores/library/languages/ru.d.ts.map +1 -1
  111. package/dist/esm/src/Templates/Stores/library/languages/ru.js +45 -34
  112. package/dist/esm/src/Templates/Stores/library/languages/tr.d.ts.map +1 -1
  113. package/dist/esm/src/Templates/Stores/library/languages/tr.js +45 -34
  114. package/dist/esm/src/Templates/Stores/library/languages/vi.d.ts.map +1 -1
  115. package/dist/esm/src/Templates/Stores/library/languages/vi.js +45 -34
  116. package/dist/esm/src/Templates/Stores/library/languages/zh.d.ts.map +1 -1
  117. package/dist/esm/src/Templates/Stores/library/languages/zh.js +45 -34
  118. package/dist/esm/src/create/createChatController.js +1 -0
  119. package/package.json +12 -12
  120. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +0 -577
  121. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +0 -38
  122. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +0 -1
  123. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +0 -571
  124. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts +0 -2
  125. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts.map +0 -1
  126. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.js +0 -1
@@ -189,10 +189,11 @@ exports.ChatInspirationResultMessage = (0, mobx_react_lite_1.observer)((properti
189
189
  }, ...queryMergedLang.searchQueryButton.attributes }));
190
190
  }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat-inspiration-result-message__inspiration-sections__section__products'), children: (0, jsx_runtime_1.jsx)(Slideshow_1.Slideshow, { ...subProps.slideshow, slides: section.products.map((product) => {
191
191
  const display = product?.display || product;
192
+ const productName = display?.mappings?.core?.name;
192
193
  const productDefaultLang = {
193
194
  openProductButton: {
194
195
  attributes: {
195
- 'aria-label': `Open ${display?.mappings?.core?.name || 'product'}`,
196
+ 'aria-label': `Open ${productName || 'product'}`,
196
197
  },
197
198
  },
198
199
  };
@@ -201,6 +202,7 @@ exports.ChatInspirationResultMessage = (0, mobx_react_lite_1.observer)((properti
201
202
  controller,
202
203
  chatItem,
203
204
  product,
205
+ productName,
204
206
  }, { activeBreakpoint: globalTheme?.activeBreakpoint });
205
207
  return {
206
208
  content: ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat-inspiration-result-message__inspiration-sections__section__products__product'), role: "button", ref: (e) => (0, hooks_1.useA11y)(e), onClick: (e) => handleProductClick(e, product), ...productMergedLang.openProductButton.attributes, children: (0, jsx_runtime_1.jsx)(Image_1.Image, { ...subProps.image, alt: display?.mappings?.core?.name || '', src: display?.mappings?.core?.imageUrl || display?.mappings?.core?.parentImageUrl || '' }) }, product.id)),
@@ -238,7 +238,8 @@ exports.ChatMessageText = (0, mobx_react_lite_1.observer)((properties) => {
238
238
  const isSideChatActive = hasSideChatView && !!sideChatOpen && currentChat?.activeMessage?.id === chatItem.id;
239
239
  const toggleSideChat = () => {
240
240
  if (isSideChatActive) {
241
- currentChat?.dismissSideChat();
241
+ // dismiss through the controller so a product quickview closes with the window
242
+ controller.dismissSideChat();
242
243
  }
243
244
  else {
244
245
  currentChat?.setActiveMessage(chatItem.id);
@@ -250,6 +250,8 @@ exports.ChatMessageUser = (0, mobx_react_lite_1.observer)((properties) => {
250
250
  const mergedLang = (0, hooks_1.useLang)(lang, {
251
251
  controller,
252
252
  chatItem,
253
+ filterOptions,
254
+ hiddenFacetCount,
253
255
  }, { activeBreakpoint: globalTheme?.activeBreakpoint });
254
256
  return ((0, jsx_runtime_1.jsx)(providers_1.CacheProvider, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat-message-user', className, internalClassName), ...styling, children: (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat-message-user__row", children: [hasAttachments && ((0, jsx_runtime_1.jsxs)("ul", { className: "ss__chat-message-user__attachments", children: [resolved.map((attachment) => {
255
257
  switch (attachment.type) {
@@ -269,6 +271,8 @@ exports.ChatMessageUser = (0, mobx_react_lite_1.observer)((properties) => {
269
271
  const attachmentMergedLang = (0, hooks_1.useLang)(attachmentLang, {
270
272
  controller,
271
273
  chatItem,
274
+ filterOptions,
275
+ hiddenFacetCount,
272
276
  attachment,
273
277
  }, { activeBreakpoint: globalTheme?.activeBreakpoint });
274
278
  return ((0, jsx_runtime_1.jsx)("li", { className: (0, classnames_1.default)('ss__chat-message-user__attachment__product', {
@@ -167,6 +167,7 @@ exports.ChatProductComparisonMessage = (0, mobx_react_lite_1.observer)((properti
167
167
  controller,
168
168
  chatItem,
169
169
  product,
170
+ productName,
170
171
  }, { activeBreakpoint: globalTheme?.activeBreakpoint });
171
172
  return ((0, jsx_runtime_1.jsx)("th", { scope: "col", className: (0, classnames_1.default)('ss__chat-product-comparison-message__table__product-header'), children: (0, jsx_runtime_1.jsxs)(Button_1.Button, { ...subProps.productHeaderButton, internalClassName: (0, classnames_1.default)('ss__chat-product-comparison-message__table__product-header__link'), onClick: handleOpenProduct, ...productMergedLang.viewProductButton.attributes, children: [allProductsHaveImage && ((0, jsx_runtime_1.jsx)(Image_1.Image, { ...subProps.image, className: (0, classnames_1.default)('ss__chat-product-comparison-message__table__product-header__image'), src: (display.mappings.core.imageUrl || display.mappings.core.parentImageUrl), alt: productName })), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat-product-comparison-message__table__product-header__name'), children: productName })] }) }, heading));
172
173
  })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: comparisonData.features.map((feature, index) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { scope: "row", className: (0, classnames_1.default)('ss__chat-product-comparison-message__table__feature-name'), children: feature.featureName }), headings.map((heading) => ((0, jsx_runtime_1.jsx)("td", { className: (0, classnames_1.default)('ss__chat-product-comparison-message__table__value'), children: feature.values[heading] ?? '—' }, heading)))] }, index))) })] }) }) }) })) : null;
@@ -0,0 +1,514 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChatQuickview = void 0;
7
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
+ const mobx_react_lite_1 = require("mobx-react-lite");
9
+ const react_1 = require("@emotion/react");
10
+ const classnames_1 = __importDefault(require("classnames"));
11
+ const deepmerge_1 = __importDefault(require("deepmerge"));
12
+ const providers_1 = require("../../../providers");
13
+ const utilities_1 = require("../../../utilities");
14
+ const hooks_1 = require("../../../hooks");
15
+ const Button_1 = require("../../Atoms/Button");
16
+ const QuickviewLayout_1 = require("../../Organisms/QuickviewLayout");
17
+ const defaultStyles = ({ primaryColor, primaryColorText, theme }) => {
18
+ const colorPrimary = primaryColor || utilities_1.Colour.concrete(theme?.variables?.colors?.primary) || '#253B80';
19
+ const colorPrimaryText = primaryColorText || '#fff';
20
+ const colorCta = utilities_1.Colour.concrete(theme?.variables?.colors?.accent) || '#feeeae';
21
+ // neutral colors — no theme variable equivalents
22
+ const colorText = '#374151';
23
+ const colorBorder = '#E5E7EB';
24
+ return (0, react_1.css)({
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ paddingBottom: '1em',
28
+ '.ss__chat-quickview__header__back.ss__button': {
29
+ // Overlay banner pinned to the top of the secondary chat's scrollable messages
30
+ // container so it stays visible while the product details scroll underneath.
31
+ // Styling mirrors `.ss__chat__session-feedback` (dark primary bg, primary text,
32
+ // 8px/15px padding, 10px gap, 14px font).
33
+ position: 'sticky',
34
+ top: 0,
35
+ zIndex: 2,
36
+ display: 'flex',
37
+ flexDirection: 'row-reverse',
38
+ justifyContent: 'flex-end',
39
+ alignItems: 'center',
40
+ gap: '10px',
41
+ padding: '8px 15px',
42
+ background: colorPrimary,
43
+ color: colorPrimaryText,
44
+ fontSize: '14px',
45
+ cursor: 'pointer',
46
+ border: 'none',
47
+ font: 'inherit',
48
+ width: 'auto',
49
+ '.ss__button__content': {
50
+ width: 'auto',
51
+ },
52
+ // pin the background so the Chat organism's generic `.ss__button:hover`
53
+ // lightening rule (higher specificity) doesn't recolor the banner
54
+ '&:not(.ss__button--disabled):hover': {
55
+ background: colorPrimary,
56
+ },
57
+ '&:focus-visible': {
58
+ outline: `2px solid ${colorPrimaryText}`,
59
+ outlineOffset: '-2px',
60
+ },
61
+ svg: {
62
+ fill: colorPrimaryText,
63
+ stroke: colorPrimaryText,
64
+ },
65
+ },
66
+ // Content sizing for the chat's secondary window, overriding QuickviewLayout's modal sizing
67
+ // (close-button padding and min/max widths) — the extra `.ss__quickview` class out-ranks the
68
+ // layout's own same-specificity rule, whose styles are inserted after these. The content
69
+ // spans the panel with no gutter of its own so the header banner can bleed to the panel
70
+ // edges; every other section row gets the standard gutter below.
71
+ '.ss__quickview .ss__quickview__content': {
72
+ padding: 0,
73
+ minWidth: 'auto',
74
+ maxWidth: '100%',
75
+ display: 'flex',
76
+ flexDirection: 'column',
77
+ gap: '1em',
78
+ },
79
+ '.ss__quickview__content > .ss__quickview__row': {
80
+ padding: '0 1em',
81
+ },
82
+ // Default layout only: the component fills the chat's secondary window, the header banner row
83
+ // stays put, and the remaining rows (grouped in column 3) scroll on their own. A custom
84
+ // `layout` opts out since its rows are not grouped this way.
85
+ '&.ss__chat-quickview--default-layout': {
86
+ height: '100%',
87
+ minHeight: 0,
88
+ boxSizing: 'border-box',
89
+ '.ss__quickview, .ss__quickview__content': {
90
+ flex: '1 1 auto',
91
+ minHeight: 0,
92
+ display: 'flex',
93
+ flexDirection: 'column',
94
+ },
95
+ '.ss__quickview__content > .ss__quickview__row:first-of-type': {
96
+ flex: '0 0 auto',
97
+ },
98
+ '.ss__quickview__content > .ss__quickview__row:first-of-type + .ss__quickview__row': {
99
+ flex: '1 1 auto',
100
+ minHeight: 0,
101
+ overflowY: 'auto',
102
+ padding: 0,
103
+ },
104
+ '.ss__quickview__column.ss__quickview__column--c3': {
105
+ padding: '0 1em',
106
+ gap: '1em',
107
+ },
108
+ },
109
+ // Header banner: product image beside the name/price/actions on the primary color.
110
+ // The column flex rules out-rank QuickviewLayout's own (viewport-based) column sizing so
111
+ // the header keeps its side-by-side arrangement at every panel width.
112
+ '.ss__quickview__content > .ss__quickview__row:first-of-type': {
113
+ background: colorPrimary,
114
+ color: colorPrimaryText,
115
+ padding: '1em',
116
+ gap: '1em',
117
+ flexWrap: 'nowrap',
118
+ '.ss__quickview__column.ss__quickview__column--c1': {
119
+ flex: '0 0 25%',
120
+ maxWidth: '25%',
121
+ },
122
+ '.ss__quickview__column.ss__quickview__column--c2': {
123
+ flex: '1 1 auto',
124
+ maxWidth: '100%',
125
+ gap: '0.5em',
126
+ justifyContent: 'space-evenly',
127
+ '.ss__quickview__row': {
128
+ padding: 0,
129
+ gap: '0.5em',
130
+ },
131
+ },
132
+ // the header thumbnail is a plain image — hide the slideshow chrome
133
+ '.ss__quickview__slideshow': {
134
+ background: '#fff',
135
+ borderRadius: '0.33em',
136
+ overflow: 'hidden',
137
+ '.ss__slideshow__navigation, .ss__slideshow__pagination': {
138
+ display: 'none',
139
+ },
140
+ },
141
+ '.ss__quickview__title': {
142
+ fontWeight: 'bold',
143
+ fontSize: '1.2em',
144
+ padding: 0,
145
+ },
146
+ '.ss__quickview__price': {
147
+ fontWeight: 'bold',
148
+ fontSize: '1.1em',
149
+ '.ss__price': {
150
+ color: colorPrimaryText,
151
+ },
152
+ },
153
+ '.ss__button': {
154
+ flexDirection: 'row-reverse', // icon renders after the label — reverse to place it left
155
+ borderRadius: '0.5em',
156
+ padding: '0.4em 0.75em',
157
+ fontWeight: 'bold',
158
+ whiteSpace: 'nowrap',
159
+ cursor: 'pointer',
160
+ fontSize: '0.8em',
161
+ justifyContent: 'center',
162
+ textAlign: 'center',
163
+ '.ss__button__content': {
164
+ width: 'auto',
165
+ },
166
+ },
167
+ },
168
+ // Action button colors. Kept at the same specificity as the Chat organism's accent theme
169
+ // (chatAccentTheme.ts), which is applied after these and wins. The hover rules pin the
170
+ // backgrounds so the Chat organism's generic `.ss__button:hover` lightening rule doesn't
171
+ // recolor them.
172
+ '.ss__quickview__add-to-cart.ss__button': {
173
+ background: colorCta,
174
+ color: '#000',
175
+ border: 'none',
176
+ svg: {
177
+ fill: '#000',
178
+ stroke: '#000',
179
+ },
180
+ '&:not(.ss__button--disabled):hover': {
181
+ background: colorCta,
182
+ filter: 'brightness(0.97)',
183
+ },
184
+ },
185
+ '.ss__quickview__more-info.ss__button, .ss__quickview__similar.ss__button, .ss__quickview__discuss.ss__button': {
186
+ background: '#000',
187
+ color: '#fff',
188
+ border: 'none',
189
+ svg: {
190
+ fill: '#fff',
191
+ stroke: '#fff',
192
+ },
193
+ '&:not(.ss__button--disabled):hover': {
194
+ background: '#000',
195
+ },
196
+ },
197
+ '.ss__quickview__content .ss__quickview__variant-title': {
198
+ fontWeight: 600,
199
+ fontSize: '0.9em',
200
+ color: colorText,
201
+ textTransform: 'uppercase',
202
+ marginBottom: '0.5em',
203
+ },
204
+ // untyped selections (e.g. size) render as a row of selectable tiles
205
+ '.ss__variant-selection--list': {
206
+ '.ss__list__title': {
207
+ display: 'none', // the variant-title above already labels the selection
208
+ },
209
+ '.ss__list__options': {
210
+ display: 'flex',
211
+ flexDirection: 'row',
212
+ flexWrap: 'wrap',
213
+ gap: '0.5em',
214
+ margin: 0,
215
+ padding: 0,
216
+ },
217
+ '.ss__list__option': {
218
+ flex: '1 1 auto',
219
+ justifyContent: 'center',
220
+ textAlign: 'center',
221
+ border: '2px solid transparent',
222
+ borderRadius: '0.5em',
223
+ padding: '0.4em 0.75em',
224
+ color: colorText,
225
+ cursor: 'pointer',
226
+ transition: 'border-color 0.15s ease',
227
+ '.ss__list__option__label': {
228
+ cursor: 'pointer',
229
+ },
230
+ '&:hover': {
231
+ borderColor: colorPrimary,
232
+ },
233
+ '&.ss__list__option--selected': {
234
+ borderColor: colorPrimary,
235
+ borderWidth: '3px',
236
+ padding: '0.3em 0.65em',
237
+ fontWeight: 'normal',
238
+ },
239
+ '&.ss__list__option--unavailable': {
240
+ opacity: 0.4,
241
+ },
242
+ },
243
+ },
244
+ // a selection with a single value offers no choice — the legacy panel left these out
245
+ '.ss__quickview__variant:has(.ss__list__option:only-child), .ss__quickview__variant:has(.ss__slideshow__slide:only-child)': {
246
+ display: 'none',
247
+ },
248
+ // swatch selections (e.g. colour) mirror the legacy chat panel: the Swatches slideshow is
249
+ // flattened into a wrapping row of tiles, each a thumbnail with its value label
250
+ // beneath. Values without a thumbnail fall back to the legacy text-only pill.
251
+ '.ss__variant-selection--swatches .ss__swatches': {
252
+ '.ss__slideshow': {
253
+ overflow: 'visible',
254
+ '.ss__slideshow__navigation, .ss__slideshow__pagination': {
255
+ display: 'none',
256
+ },
257
+ '.ss__slideshow__container': {
258
+ width: '100%',
259
+ margin: 0,
260
+ },
261
+ '.ss__slideshow__track': {
262
+ flexWrap: 'wrap',
263
+ justifyContent: 'flex-start',
264
+ gap: '0.5em',
265
+ width: '100%',
266
+ transform: 'none !important',
267
+ transition: 'none',
268
+ },
269
+ '.ss__slideshow__slide': {
270
+ display: 'flex',
271
+ flex: '1 1 auto',
272
+ width: 'auto',
273
+ minWidth: 0,
274
+ maxWidth: 'none',
275
+ margin: 0,
276
+ },
277
+ },
278
+ '.ss__swatches__slideshow__swatch': {
279
+ boxSizing: 'border-box',
280
+ width: '100%',
281
+ aspectRatio: 'auto',
282
+ flexDirection: 'column',
283
+ alignItems: 'center',
284
+ justifyContent: 'flex-start',
285
+ padding: '0.25em',
286
+ paddingBottom: 'calc(0.25em + 1em)', // reserve room for the label positioned below the thumbnail
287
+ border: '2px solid transparent',
288
+ borderRadius: '0.5em',
289
+ background: 'transparent',
290
+ color: colorText,
291
+ transition: 'border-color 0.15s ease',
292
+ '&:hover': {
293
+ borderColor: colorPrimary,
294
+ },
295
+ '&:focus-visible': {
296
+ outline: `2px solid ${colorPrimary}`,
297
+ outlineOffset: '2px',
298
+ },
299
+ '&.ss__swatches__slideshow__swatch--selected': {
300
+ borderColor: colorPrimary,
301
+ borderWidth: '3px',
302
+ padding: '0.15em',
303
+ paddingBottom: 'calc(0.15em + 1em)',
304
+ },
305
+ '&.ss__swatches__slideshow__swatch--disabled, &.ss__swatches__slideshow__swatch--unavailable': {
306
+ opacity: 0.4,
307
+ '&:before': {
308
+ display: 'none', // the faded tile replaces the strike-through
309
+ },
310
+ },
311
+ '&.ss__swatches__slideshow__swatch--unavailable': {
312
+ cursor: 'not-allowed',
313
+ },
314
+ '&.ss__swatches__slideshow__swatch--dark': {
315
+ color: colorText,
316
+ },
317
+ '.ss__swatches__slideshow__swatch__inner': {
318
+ position: 'relative',
319
+ flex: '0 0 auto',
320
+ width: '48px',
321
+ height: '48px',
322
+ '.ss__image': {
323
+ width: '100%',
324
+ height: '100%',
325
+ img: {
326
+ width: '100%',
327
+ height: '100%',
328
+ objectFit: 'contain',
329
+ },
330
+ },
331
+ },
332
+ '.ss__swatches__slideshow__swatch__value': {
333
+ position: 'absolute',
334
+ top: '100%',
335
+ left: '50%',
336
+ transform: 'translateX(-50%)',
337
+ marginTop: '0.25em',
338
+ fontSize: '0.75em',
339
+ lineHeight: 1,
340
+ color: colorText,
341
+ textAlign: 'center',
342
+ maxWidth: '60px',
343
+ overflow: 'hidden',
344
+ textOverflow: 'ellipsis',
345
+ whiteSpace: 'nowrap',
346
+ },
347
+ // text-only tile: no thumbnail to show, so the colour chip is dropped and the label
348
+ // itself becomes the pill
349
+ '&:not(:has(.ss__image))': {
350
+ padding: '0.4em 0.75em',
351
+ alignSelf: 'center',
352
+ '&.ss__swatches__slideshow__swatch--selected': {
353
+ padding: '0.3em 0.65em',
354
+ },
355
+ '.ss__swatches__slideshow__swatch__inner': {
356
+ width: 'auto',
357
+ height: 'auto',
358
+ background: 'none !important',
359
+ },
360
+ '.ss__swatches__slideshow__swatch__value': {
361
+ position: 'static',
362
+ transform: 'none',
363
+ margin: 0,
364
+ fontSize: '1em',
365
+ lineHeight: 'inherit',
366
+ maxWidth: 'none',
367
+ },
368
+ },
369
+ },
370
+ },
371
+ '.ss__quickview__content .ss__quickview__attributes': {
372
+ '& tr': {
373
+ borderBottom: `1px solid ${colorBorder}`,
374
+ transition: 'background-color 0.15s ease',
375
+ },
376
+ '& tbody tr:hover': {
377
+ background: '#F3F4F6',
378
+ },
379
+ '& th': {
380
+ color: '#6B7280',
381
+ letterSpacing: '0.03em',
382
+ },
383
+ '& td': {
384
+ textAlign: 'right',
385
+ color: '#111827',
386
+ fontWeight: 500,
387
+ },
388
+ },
389
+ '.ss__quickview__content .ss__quickview__description': {
390
+ fontSize: '0.9em',
391
+ color: colorText,
392
+ lineHeight: 1.5,
393
+ },
394
+ });
395
+ };
396
+ exports.ChatQuickview = (0, mobx_react_lite_1.observer)((properties) => {
397
+ const globalTheme = (0, providers_1.useTheme)();
398
+ const globalTreePath = (0, providers_1.useTreePath)();
399
+ const defaultProps = {
400
+ treePath: globalTreePath,
401
+ hideBadge: true,
402
+ // legacy chat presentation: non-swatch selections render as a row of selectable tiles
403
+ variantDropdownType: 'list',
404
+ // mirrors the legacy chat product panel: a header banner (image beside name/price and the
405
+ // add-to-cart/more-info/similar/discuss actions) followed by variants, the attribute table,
406
+ // and the description — the banner styling lives in defaultStyles above. The detail rows are
407
+ // grouped in column 3 so they can scroll independently of the banner (see defaultStyles).
408
+ layout: [['c1', 'c2'], ['c3']],
409
+ column1: {
410
+ layout: ['slideshow'],
411
+ width: '25%',
412
+ },
413
+ column2: {
414
+ layout: [
415
+ ['productDetail.mappings.core.name'],
416
+ ['productDetail.mappings.core.price'],
417
+ ['button.add-to-cart', 'button.more-info', 'button.similar', 'button.discuss'],
418
+ ],
419
+ width: 'auto',
420
+ },
421
+ column3: {
422
+ layout: [['variantSelections'], ['productDetailTable'], ['productDetail.mappings.core.description']],
423
+ width: '100%',
424
+ },
425
+ };
426
+ const props = (0, utilities_1.mergeProps)('chatQuickview', globalTheme, defaultProps, properties);
427
+ const { chatItem, controller, disableStyles, className, internalClassName, treePath, layout, hideBadge, variantDropdownType, column1, column2, column3, column4, recommendation, } = props;
428
+ const { overrideElement, shouldRenderDefault } = (0, hooks_1.useCustomComponentOverride)('chatQuickview', props);
429
+ // the fixed-header/scrolling-details styling only applies to this component's own default layout
430
+ const isDefaultLayout = layout === defaultProps.layout;
431
+ const styling = (0, utilities_1.mergeStyles)(props, defaultStyles);
432
+ const { messageType } = chatItem;
433
+ const quickviewManager = controller?.quickviewManager;
434
+ const chatMessages = controller?.store.currentChat?.chat || [];
435
+ const sourceMessage = chatItem.sourceMessageId ? chatMessages.find((m) => m.id === chatItem.sourceMessageId) : null;
436
+ const cameFromInspiration = sourceMessage?.messageType === 'inspirationResult';
437
+ const cameFromComparison = sourceMessage?.messageType === 'productComparison';
438
+ // after all hooks — an override that resolves or fails mid-lifecycle must not
439
+ // change the hook count between renders
440
+ if (!shouldRenderDefault) {
441
+ return overrideElement;
442
+ }
443
+ //initialize lang
444
+ const defaultLang = {
445
+ backToComparisonButton: {
446
+ value: 'Back to comparison',
447
+ attributes: {
448
+ 'aria-label': 'Back to comparison',
449
+ },
450
+ },
451
+ backToInspirationButton: {
452
+ value: 'Back to inspiration',
453
+ attributes: {
454
+ 'aria-label': 'Back to inspiration',
455
+ },
456
+ },
457
+ };
458
+ //deep merge with props.lang
459
+ const lang = (0, deepmerge_1.default)(defaultLang, props.lang || {});
460
+ if (messageType !== 'productQuery') {
461
+ controller?.log?.warn('ChatQuickview received message with unsupported type:', messageType, 'Expected type: productQuery');
462
+ return null;
463
+ }
464
+ if (!quickviewManager) {
465
+ controller?.log?.warn(`ChatQuickview requires the controller's quickview manager — chat controllers receive one from Snap whenever they are configured`);
466
+ return null;
467
+ }
468
+ // legacy chat presentation, injected through the theme so the children apply it via their own
469
+ // prop pipeline (the incoming theme wins on conflict): the action buttons carry icons, and swatch
470
+ // tiles show their value label beneath (the Swatches default hides labels).
471
+ const themePresentationProps = {
472
+ components: {
473
+ 'button.add-to-cart': {
474
+ icon: 'cart',
475
+ },
476
+ 'button.more-info': {
477
+ icon: 'info',
478
+ },
479
+ 'button.similar': {
480
+ icon: 'search-thin',
481
+ },
482
+ 'button.discuss': {
483
+ icon: 'chat',
484
+ },
485
+ swatches: {
486
+ hideLabels: false,
487
+ },
488
+ },
489
+ };
490
+ props.theme = deepmerge_1.default.all([themePresentationProps, props?.theme || {}], { arrayMerge: (destinationArray, sourceArray) => sourceArray });
491
+ const subProps = {
492
+ button: {
493
+ disableStyles,
494
+ theme: props.theme,
495
+ treePath,
496
+ },
497
+ quickviewLayout: {
498
+ // default props
499
+ ...(0, utilities_1.defined)({ hideBadge, variantDropdownType, column1, column2, column3, column4, recommendation, lang }),
500
+ // inherited props
501
+ ...(0, utilities_1.defined)({
502
+ disableStyles,
503
+ }),
504
+ // component theme overrides
505
+ theme: props.theme,
506
+ treePath,
507
+ },
508
+ };
509
+ const handleBack = () => {
510
+ controller?.store.currentChat?.popProductQueryMessage(chatItem.sourceMessageId);
511
+ controller?.closeProductQuickview();
512
+ };
513
+ return ((0, jsx_runtime_1.jsx)(providers_1.CacheProvider, { children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)('ss__chat-quickview', { 'ss__chat-quickview--default-layout': isDefaultLayout }, className, internalClassName), ...styling, children: [(cameFromInspiration || cameFromComparison) && ((0, jsx_runtime_1.jsx)(Button_1.Button, { ...subProps.button, internalClassName: (0, classnames_1.default)('ss__chat-quickview__header__back'), icon: { icon: 'angle-left', size: '14px' }, onClick: handleBack, lang: { button: cameFromComparison ? lang.backToComparisonButton : lang.backToInspirationButton } })), (0, jsx_runtime_1.jsx)(QuickviewLayout_1.QuickviewLayout, { inline: true, quickviewManager: quickviewManager, ...subProps.quickviewLayout, layout: layout })] }) }));
514
+ });
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ChatProductQueryMessage"), exports);
17
+ __exportStar(require("./ChatQuickview"), exports);
@@ -56,10 +56,10 @@ exports.ChatResultsDisplay = (0, mobx_react_lite_1.observer)((properties) => {
56
56
  currentChat?.dismissedSideChatMessageId !== activeMessage.id;
57
57
  const isNarrow = (0, hooks_1.useMediaQuery)('(max-width: 549px)');
58
58
  // only the tablet range needs the narrower slideshow when the side chat is open;
59
- // at >= 1200px there's room to keep 2.9 slides alongside the secondary chat
59
+ // at >= 1200px there's room to keep 3 slides alongside the secondary chat
60
60
  const isTabletRange = (0, hooks_1.useMediaQuery)('(min-width: 768px) and (max-width: 1200px)');
61
61
  const isConstrained = !isNarrow && isSideChatOpen && isTabletRange;
62
- const slidesToShow = isNarrow || isConstrained ? 1.9 : 2.9;
62
+ const slidesToShow = isNarrow || isConstrained ? 2 : 3;
63
63
  // after all hooks — an override that resolves or fails mid-lifecycle must not
64
64
  // change the hook count between renders
65
65
  if (!shouldRenderDefault) {