@athoscommerce/snap-preact 1.2.3-beta.2 → 1.2.3-beta.4
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/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +4 -1
- package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +8 -2
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts +1 -0
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +238 -53
- package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts +2 -3
- package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.js +26 -7
- package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.js +54 -23
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +14 -6
- package/dist/cjs/components/src/components/Organisms/Facet/Facet.js +2 -1
- package/dist/cjs/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +2 -1
- package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +4 -1
- package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +1 -1
- package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +8 -2
- package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +1 -0
- package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/Chat.js +231 -49
- package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts +2 -3
- package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +26 -7
- package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +51 -21
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +14 -6
- package/dist/esm/components/src/components/Organisms/Facet/Facet.js +1 -1
- package/dist/esm/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +1 -1
- package/package.json +12 -12
|
@@ -32,8 +32,17 @@ var defaultStyles = function () {
|
|
|
32
32
|
overflow: 'hidden',
|
|
33
33
|
'.ss__chat__result__image': {
|
|
34
34
|
width: '100%',
|
|
35
|
+
aspectRatio: '1 / 1',
|
|
35
36
|
position: 'relative',
|
|
36
37
|
overflow: 'hidden',
|
|
38
|
+
// fixed-aspect frame: scale the image to fill it and crop overflow so
|
|
39
|
+
// results with different intrinsic image aspect ratios still line up
|
|
40
|
+
// at the same height when displayed side-by-side.
|
|
41
|
+
img: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%',
|
|
44
|
+
objectFit: 'cover',
|
|
45
|
+
},
|
|
37
46
|
'.ss__chat__result__image__buttons': {
|
|
38
47
|
position: 'absolute',
|
|
39
48
|
bottom: 0,
|
|
@@ -114,8 +123,8 @@ var defaultStyles = function () {
|
|
|
114
123
|
},
|
|
115
124
|
});
|
|
116
125
|
};
|
|
117
|
-
exports.ChatResult = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
118
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
126
|
+
exports.ChatResult = (0, providers_1.withTracking)((0, mobx_react_lite_1.observer)(function (properties) {
|
|
127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
119
128
|
var globalTheme = (0, providers_1.useTheme)();
|
|
120
129
|
var globalTreePath = (0, providers_1.useTreePath)();
|
|
121
130
|
var snap = (0, providers_1.useSnap)();
|
|
@@ -123,7 +132,7 @@ exports.ChatResult = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
123
132
|
treePath: globalTreePath,
|
|
124
133
|
};
|
|
125
134
|
var props = (0, utilities_1.mergeProps)('chatResult', globalTheme, defaultProps, properties);
|
|
126
|
-
var controller = props.controller, result = props.result, scrollToBottom = props.scrollToBottom, customComponent = props.customComponent;
|
|
135
|
+
var controller = props.controller, result = props.result, scrollToBottom = props.scrollToBottom, customComponent = props.customComponent, trackingRef = props.trackingRef;
|
|
127
136
|
if (customComponent) {
|
|
128
137
|
var ComponentOverride = (0, hooks_1.useComponent)(((_a = snap === null || snap === void 0 ? void 0 : snap.templates) === null || _a === void 0 ? void 0 : _a.library.import.component.result) || {}, customComponent);
|
|
129
138
|
if (ComponentOverride) {
|
|
@@ -131,6 +140,9 @@ exports.ChatResult = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
131
140
|
}
|
|
132
141
|
}
|
|
133
142
|
var isInComparison = (_b = controller.store.currentChat) === null || _b === void 0 ? void 0 : _b.comparisons.items.some(function (item) { var _a; return ((_a = item.result) === null || _a === void 0 ? void 0 : _a.id) === result.id; });
|
|
143
|
+
// a result is "configurable" when it ships with selectable variant options
|
|
144
|
+
// (e.g. color/size); those need a selection before they can be added to cart
|
|
145
|
+
var isConfigurable = !!((_c = result.variants) === null || _c === void 0 ? void 0 : _c.optionConfig) && Object.keys(result.variants.optionConfig).length > 0;
|
|
134
146
|
var subProps = {
|
|
135
147
|
button: {
|
|
136
148
|
// component theme overrides
|
|
@@ -146,13 +158,20 @@ exports.ChatResult = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
146
158
|
},
|
|
147
159
|
};
|
|
148
160
|
var styling = (0, utilities_1.mergeStyles)(properties, defaultStyles);
|
|
149
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "ss__chat__result" }, styling, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__image", children: [(0, jsx_runtime_1.jsx)(__1.OverlayBadge, { controller: controller, result: result, renderEmpty: true, children: (0, jsx_runtime_1.jsx)(Image_1.Image, __assign({ className: 'ss__chat__result__detail-slot__image', alt: ((
|
|
161
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "ss__chat__result", ref: trackingRef }, styling, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__image", children: [(0, jsx_runtime_1.jsx)(__1.OverlayBadge, { controller: controller, result: result, renderEmpty: true, children: (0, jsx_runtime_1.jsx)(Image_1.Image, __assign({ className: 'ss__chat__result__detail-slot__image', alt: ((_d = result.display.mappings.core) === null || _d === void 0 ? void 0 : _d.name) || '', src: ((_e = result.display.mappings.core) === null || _e === void 0 ? void 0 : _e.imageUrl) || '' }, subProps.image)) }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__image__buttons", children: [controller.store.features.similarProducts.enabled && ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__result__image__buttons__similar', content: 'Similar', onClick: function () {
|
|
150
162
|
controller.discussProduct(result, { requestType: 'productSimilar' });
|
|
151
163
|
} })), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__result__image__buttons__compare', content: isInComparison ? undefined : 'Compare', icon: isInComparison ? { icon: 'check-thin', title: 'Added to comparison' } : undefined, onClick: function () {
|
|
152
164
|
controller.compareProduct(result);
|
|
153
165
|
} })] }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__image__icons", children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__result__image__icons__icon--inquire', icon: { icon: 'chat', title: 'Discuss Product' }, onClick: function () {
|
|
154
166
|
controller.discussProduct(result, { requestType: 'productQuery' });
|
|
155
|
-
} }), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__result__image__icons__icon--cart', icon: { icon: 'cart', title: 'Add to Cart' }, onClick: function () {
|
|
167
|
+
} }), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__result__image__icons__icon--cart', icon: { icon: 'cart', title: isConfigurable ? 'Configure' : 'Add to Cart' }, onClick: function () {
|
|
168
|
+
// configurable products need a variant selection — open the product
|
|
169
|
+
// information panel so the user can pick options before adding to cart
|
|
170
|
+
if (isConfigurable) {
|
|
171
|
+
controller.viewProduct(result);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
controller.track.product.addToCart(result);
|
|
156
175
|
controller.addToCart(result);
|
|
157
|
-
} })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__content", children: [((
|
|
158
|
-
});
|
|
176
|
+
} })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__result__content", children: [((_f = result.display.mappings.core) === null || _f === void 0 ? void 0 : _f.name) && ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__result__content__title--primary", children: (_g = result.display.mappings.core) === null || _g === void 0 ? void 0 : _g.name })), ((_h = result.display.mappings.core) === null || _h === void 0 ? void 0 : _h.price) && ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__result__content__price", children: (0, jsx_runtime_1.jsx)(__1.Price, { value: (_j = result.display.mappings.core) === null || _j === void 0 ? void 0 : _j.price }) })), (0, jsx_runtime_1.jsx)(__1.CalloutBadge, { controller: controller, result: result })] })] })));
|
|
177
|
+
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageUser.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/MessageUser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageUser.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/MessageUser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAuIhE,eAAO,MAAM,WAAW,WAAoB,gBAAgB;;CA2F1D,CAAC;AAEH,UAAU,gBAAgB;IACzB,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;CACvC"}
|
|
@@ -19,7 +19,6 @@ var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
19
19
|
var mobx_react_lite_1 = require("mobx-react-lite");
|
|
20
20
|
var classnames_1 = __importDefault(require("classnames"));
|
|
21
21
|
var Image_1 = require("../../Atoms/Image");
|
|
22
|
-
var marked_1 = require("marked");
|
|
23
22
|
var Icon_1 = require("../../Atoms/Icon");
|
|
24
23
|
var __1 = require("../../..");
|
|
25
24
|
var utilities_1 = require("../../../utilities");
|
|
@@ -44,6 +43,11 @@ var defaultStyles = function () {
|
|
|
44
43
|
alignItems: 'center',
|
|
45
44
|
gap: '10px',
|
|
46
45
|
},
|
|
46
|
+
'.ss__chat__message-user__text-wrapper': {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
alignItems: 'flex-end',
|
|
50
|
+
},
|
|
47
51
|
'.ss__chat__message-user__text': {
|
|
48
52
|
padding: '0.5em 1em',
|
|
49
53
|
borderRadius: '12px',
|
|
@@ -56,9 +60,10 @@ var defaultStyles = function () {
|
|
|
56
60
|
padding: 0,
|
|
57
61
|
margin: 0,
|
|
58
62
|
display: 'flex',
|
|
59
|
-
|
|
60
|
-
flexWrap: 'nowrap',
|
|
63
|
+
flexWrap: 'wrap',
|
|
61
64
|
justifyContent: 'flex-end',
|
|
65
|
+
flex: '0 0 40px',
|
|
66
|
+
alignSelf: 'flex-end',
|
|
62
67
|
'.ss__chat__message-user__attachment__product, .ss__chat__message-user__attachment__image, .ss__chat__message-user__attachment__facet': {
|
|
63
68
|
width: '40px',
|
|
64
69
|
height: '40px',
|
|
@@ -84,10 +89,16 @@ var defaultStyles = function () {
|
|
|
84
89
|
borderColor: colorPrimary,
|
|
85
90
|
},
|
|
86
91
|
},
|
|
92
|
+
'.ss__chat__message-user__attachment__facet--overflow': {
|
|
93
|
+
fontSize: '12px',
|
|
94
|
+
fontWeight: 600,
|
|
95
|
+
color: '#555',
|
|
96
|
+
},
|
|
87
97
|
},
|
|
88
98
|
});
|
|
89
99
|
};
|
|
90
100
|
function getRequestTypeLabel(chatItem) {
|
|
101
|
+
var _a, _b;
|
|
91
102
|
var requestType = chatItem.requestType;
|
|
92
103
|
if (!requestType || requestType === 'general')
|
|
93
104
|
return undefined;
|
|
@@ -97,7 +108,12 @@ function getRequestTypeLabel(chatItem) {
|
|
|
97
108
|
case 'productComparison':
|
|
98
109
|
return 'Comparing products';
|
|
99
110
|
case 'productSearch':
|
|
100
|
-
|
|
111
|
+
if ((_b = (_a = chatItem.request) === null || _a === void 0 ? void 0 : _a.searchFilters) === null || _b === void 0 ? void 0 : _b.length) {
|
|
112
|
+
return 'Filtering products';
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return 'Searching products';
|
|
116
|
+
}
|
|
101
117
|
case 'imageSearch':
|
|
102
118
|
return 'Searching by image';
|
|
103
119
|
case 'productSimilar':
|
|
@@ -147,7 +163,6 @@ function findProductInChat(chat, productId) {
|
|
|
147
163
|
return null;
|
|
148
164
|
}
|
|
149
165
|
exports.MessageUser = (0, mobx_react_lite_1.observer)(function (props) {
|
|
150
|
-
var _a, _b;
|
|
151
166
|
var controller = props.controller, chatItem = props.chatItem, onViewProduct = props.onViewProduct;
|
|
152
167
|
var store = controller.store;
|
|
153
168
|
var styling = (0, utilities_1.mergeStyles)(props, defaultStyles);
|
|
@@ -169,24 +184,40 @@ exports.MessageUser = (0, mobx_react_lite_1.observer)(function (props) {
|
|
|
169
184
|
onViewProduct === null || onViewProduct === void 0 ? void 0 : onViewProduct(product);
|
|
170
185
|
}
|
|
171
186
|
};
|
|
172
|
-
return ((0, jsx_runtime_1.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "ss__chat__message-user" }, styling, { children: (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__message-user__row", children: [(0, jsx_runtime_1.jsx)("ul", { className: "ss__chat__message-user__attachments", children: (function () {
|
|
188
|
+
var _a;
|
|
189
|
+
if (!((_a = chatItem.attachments) === null || _a === void 0 ? void 0 : _a.length))
|
|
190
|
+
return null;
|
|
191
|
+
var resolved = chatItem.attachments.map(function (id) { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.get(id); }).filter(Boolean);
|
|
192
|
+
var totalFacets = resolved.filter(function (a) { return a.type === 'facet'; }).length;
|
|
193
|
+
var hiddenFacetCount = Math.max(0, totalFacets - 2);
|
|
194
|
+
var facetIndex = 0;
|
|
195
|
+
var items = resolved
|
|
196
|
+
.map(function (attachment) {
|
|
197
|
+
var _a;
|
|
198
|
+
switch (attachment.type) {
|
|
199
|
+
case 'image':
|
|
200
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: "ss__chat__message-user__attachment__image", children: (0, jsx_runtime_1.jsx)(Image_1.Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || attachment.base64 || '', alt: '' }) }, attachment.id));
|
|
201
|
+
case 'product': {
|
|
202
|
+
var canOpen = !!findProductInChat((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.chat, attachment.productId);
|
|
203
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: (0, classnames_1.default)('ss__chat__message-user__attachment__product', {
|
|
204
|
+
'ss__chat__message-user__attachment__product--clickable': canOpen,
|
|
205
|
+
}), onClick: canOpen ? function () { return handleProductAttachmentClick(attachment); } : undefined, title: canOpen ? "View details for ".concat(attachment.name) : undefined, children: (0, jsx_runtime_1.jsx)(Image_1.Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || '', alt: attachment.name }) }, attachment.id));
|
|
206
|
+
}
|
|
207
|
+
case 'facet': {
|
|
208
|
+
facetIndex += 1;
|
|
209
|
+
if (facetIndex > 2)
|
|
188
210
|
return null;
|
|
211
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: "ss__chat__message-user__attachment__facet", children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { title: "Filter: ".concat(attachment.facetLabel, " = ").concat(attachment.label), icon: "filter-funnel", size: 27 }) }, attachment.id));
|
|
189
212
|
}
|
|
190
|
-
|
|
191
|
-
|
|
213
|
+
default:
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
.filter(Boolean);
|
|
218
|
+
if (hiddenFacetCount > 0) {
|
|
219
|
+
items.push((0, jsx_runtime_1.jsxs)("li", { className: "ss__chat__message-user__attachment__facet ss__chat__message-user__attachment__facet--overflow", title: "".concat(hiddenFacetCount, " more filter").concat(hiddenFacetCount === 1 ? '' : 's'), children: ["+", hiddenFacetCount] }, "facet-overflow"));
|
|
220
|
+
}
|
|
221
|
+
return items;
|
|
222
|
+
})() }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__message-user__text-wrapper", children: [requestTypeLabel ? (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-user__request-type", children: requestTypeLabel }) : null, chatItem.text ? (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-user__text", children: chatItem.text }) : null] })] }) })));
|
|
192
223
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultsDisplay.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/ResultsDisplay.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAgChE,eAAO,MAAM,cAAc,WAAoB,mBAAmB;;
|
|
1
|
+
{"version":3,"file":"ResultsDisplay.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/ResultsDisplay.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAgChE,eAAO,MAAM,cAAc,WAAoB,mBAAmB;;CAmFhE,CAAC;AAEH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
|
|
@@ -53,34 +53,42 @@ exports.ResultsDisplay = (0, mobx_react_lite_1.observer)(function (props) {
|
|
|
53
53
|
['inspirationResult', 'productComparison', 'productQuery'].includes(activeMessage.messageType) &&
|
|
54
54
|
(currentChat === null || currentChat === void 0 ? void 0 : currentChat.dismissedSideChatMessageId) !== activeMessage.id;
|
|
55
55
|
var isNarrow = typeof window !== 'undefined' && window.innerWidth < 550;
|
|
56
|
-
|
|
56
|
+
// only the tablet range needs the narrower carousel when the side chat is open;
|
|
57
|
+
// at >= 1200px there's room to keep 2.9 slides alongside the secondary chat
|
|
58
|
+
var isConstrained = !isNarrow && isSideChatOpen && typeof window !== 'undefined' && window.innerWidth >= 768 && window.innerWidth <= 1200;
|
|
57
59
|
var slidesPerView = isNarrow || isConstrained ? 1.9 : 2.9;
|
|
58
|
-
var
|
|
60
|
+
var visibleSlides = Math.ceil(slidesPerView);
|
|
61
|
+
// When all results fit, use a whole-number slidesPerView so the last slide
|
|
62
|
+
// isn't clipped to a fraction; otherwise keep the fractional value to hint
|
|
63
|
+
// at additional content beyond the viewport.
|
|
64
|
+
var resolveSlidesPerView = function (count) { return (count <= visibleSlides ? count : slidesPerView); };
|
|
65
|
+
var buildCarouselProps = function (count) { return ({
|
|
59
66
|
breakpoints: undefined,
|
|
60
|
-
slidesPerView:
|
|
67
|
+
slidesPerView: resolveSlidesPerView(count),
|
|
61
68
|
slidesPerGroup: isNarrow || isConstrained ? 2 : 3,
|
|
62
69
|
loop: false,
|
|
63
70
|
pagination: false,
|
|
64
71
|
centerInsufficientSlides: false,
|
|
65
72
|
freeMode: true,
|
|
66
73
|
styleScript: carouselStyleScript,
|
|
67
|
-
};
|
|
74
|
+
}); };
|
|
68
75
|
var handleResultClick = function (e, result) {
|
|
69
76
|
// buttons should be able to be clicked without triggering the product click
|
|
70
77
|
if (e.composedPath().some(function (el) { return el instanceof HTMLElement && el.matches('button, .ss__button, a'); }))
|
|
71
78
|
return;
|
|
79
|
+
controller.track.product.click(e, result);
|
|
72
80
|
controller.viewProduct(result);
|
|
73
81
|
onViewProduct === null || onViewProduct === void 0 ? void 0 : onViewProduct();
|
|
74
82
|
};
|
|
75
83
|
if (chatItem.messageType === 'productRecommendation' && ((_a = chatItem.recommendationResult) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
76
84
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: chatItem.recommendationResult.map(function (recommendation, index) {
|
|
77
85
|
var _a;
|
|
78
|
-
return ((_a = recommendation.results) === null || _a === void 0 ? void 0 : _a.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(Carousel_1.Carousel, __assign({},
|
|
86
|
+
return ((_a = recommendation.results) === null || _a === void 0 ? void 0 : _a.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(Carousel_1.Carousel, __assign({}, buildCarouselProps(recommendation.results.length), { hideButtons: recommendation.results.length <= visibleSlides, children: recommendation.results.map(function (result) {
|
|
79
87
|
return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: function (e) { return handleResultClick(e, result); }, children: (0, jsx_runtime_1.jsx)(ChatResult_1.ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
|
|
80
88
|
}) })) }, index)) : null;
|
|
81
89
|
}) }));
|
|
82
90
|
}
|
|
83
|
-
return ((_b = chatItem.results) === null || _b === void 0 ? void 0 : _b.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(Carousel_1.Carousel, __assign({},
|
|
91
|
+
return ((_b = chatItem.results) === null || _b === void 0 ? void 0 : _b.length) > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(Carousel_1.Carousel, __assign({}, buildCarouselProps(chatItem.results.length), { hideButtons: chatItem.results.length <= visibleSlides, children: chatItem.results.map(function (result) {
|
|
84
92
|
return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: function (e) { return handleResultClick(e, result); }, children: (0, jsx_runtime_1.jsx)(ChatResult_1.ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
|
|
85
93
|
}) })) })) : null;
|
|
86
94
|
});
|
|
@@ -379,8 +379,9 @@ exports.Facet = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
379
379
|
return facet && renderFacet ? ((0, jsx_runtime_1.jsx)(providers_1.CacheProvider, { children: (0, jsx_runtime_1.jsx)("div", __assign({}, styling, { className: (0, classnames_1.default)('ss__facet', "ss__facet--".concat(facet.field), "".concat(facet.collapsed ? 'ss__facet--collapsed' : ''), className, internalClassName, "".concat(facet.display ? "ss__facet--".concat(facet.display) : ''), (statefulOverflow ? (overflowState === null || overflowState === void 0 ? void 0 : overflowState.remaining) || 0 > 0 : (((_s = facet === null || facet === void 0 ? void 0 : facet.overflow) === null || _s === void 0 ? void 0 : _s.remaining) || 0) > 0) || (facet === null || facet === void 0 ? void 0 : facet.display) == 'slider'
|
|
380
380
|
? ''
|
|
381
381
|
: 'ss__facet--showing-all'), children: justContent ? ((0, jsx_runtime_1.jsx)(FacetContent, __assign({}, facetContentProps, { mergedLang: mergedLang }))) : ((0, jsx_runtime_1.jsx)(Dropdown_1.Dropdown, __assign({}, subProps.dropdown, { open: disableCollapse || !(facet === null || facet === void 0 ? void 0 : facet.collapsed), onClick: function () { return !disableCollapse && facet.toggleCollapse && (facet === null || facet === void 0 ? void 0 : facet.toggleCollapse()); }, disableA11y: true, button: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "ss__facet__header", ref: function (e) { return (0, useA11y_1.useA11y)(e, disableCollapse ? -1 : 0); }, role: "heading", "aria-level": 3 }, mergedLang.dropdownButton.attributes, { children: [(0, jsx_runtime_1.jsxs)("span", { className: "ss__facet__header__inner", children: [(0, jsx_runtime_1.jsx)("span", __assign({}, mergedLang.dropdownButton.value, { children: facet === null || facet === void 0 ? void 0 : facet.label })), showSelectedCount && selectedCount && facet.type !== 'range' ? ((0, jsx_runtime_1.jsx)("span", { className: "ss__facet__header__selected-count", children: hideSelectedCountParenthesis ? selectedCount : "(".concat(selectedCount, ")") })) : null, (mergedLang.clearAllText.value || clearAllIcon) && selectedCount ? ((0, jsx_runtime_1.jsx)(Button_1.Button, __assign({}, subProps.button, { internalClassName: "ss__facet__header__clear-all", name: 'reset-facet', onClick: function (e) {
|
|
382
|
+
var _a;
|
|
382
383
|
e.stopPropagation();
|
|
383
|
-
facet === null || facet === void 0 ? void 0 : facet.clear.url.link.onClick();
|
|
384
|
+
(_a = facet === null || facet === void 0 ? void 0 : facet.clear.url) === null || _a === void 0 ? void 0 : _a.link.onClick();
|
|
384
385
|
}, icon: clearAllIcon ? clearAllIcon : undefined, children: mergedLang.clearAllText.value && showClearAllText ? (0, jsx_runtime_1.jsx)("label", __assign({}, mergedLang.clearAllText.all)) : null }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}))] }), !disableCollapse && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, __assign({}, subProps.icon, ((facet === null || facet === void 0 ? void 0 : facet.collapsed)
|
|
385
386
|
? __assign({}, (typeof iconExpand == 'string' ? { icon: iconExpand } : iconExpand)) : __assign({}, (typeof iconCollapse == 'string' ? { icon: iconCollapse } : iconCollapse))), { name: (facet === null || facet === void 0 ? void 0 : facet.collapsed) ? 'expand' : 'collapse' })))] })), children: (0, jsx_runtime_1.jsx)(FacetContent, __assign({}, facetContentProps, { mergedLang: mergedLang })) }))) })) })) : null;
|
|
386
387
|
});
|
|
@@ -230,8 +230,9 @@ exports.FacetsHorizontal = (0, mobx_react_lite_1.observer)(function (properties)
|
|
|
230
230
|
setSelectedFacet(undefined);
|
|
231
231
|
}
|
|
232
232
|
}, button: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "ss__dropdown__button__heading" }, mergedLang.dropdownButton.attributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__facet__header__inner", children: [(0, jsx_runtime_1.jsx)("span", __assign({}, mergedLang.dropdownButton.value, { children: facet === null || facet === void 0 ? void 0 : facet.label })), showSelectedCount && selectedCount && facet.type !== 'range' ? ((0, jsx_runtime_1.jsx)("span", { className: "ss__facet__header__selected-count", children: hideSelectedCountParenthesis ? selectedCount : "(".concat(selectedCount, ")") })) : null, (mergedLang.clearAllText.value || clearAllIcon) && selectedCount ? ((0, jsx_runtime_1.jsx)(Button_1.Button, __assign({}, subProps.button, { internalClassName: "ss__facet__header__clear-all", name: 'reset-facet', onClick: function (e) {
|
|
233
|
+
var _a;
|
|
233
234
|
e.stopPropagation();
|
|
234
|
-
facet === null || facet === void 0 ? void 0 : facet.clear.url.link.onClick();
|
|
235
|
+
(_a = facet === null || facet === void 0 ? void 0 : facet.clear.url) === null || _a === void 0 ? void 0 : _a.link.onClick();
|
|
235
236
|
}, icon: clearAllIcon ? clearAllIcon : undefined, children: mergedLang.clearAllText.value && showClearAllText ? (0, jsx_runtime_1.jsx)("label", __assign({}, mergedLang.clearAllText.all)) : null }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}))] }), (0, jsx_runtime_1.jsx)(Icon_1.Icon, __assign({}, subProps.icon, ((selectedFacet === null || selectedFacet === void 0 ? void 0 : selectedFacet.field) === facet.field
|
|
236
237
|
? __assign({}, (typeof iconExpand == 'string' ? { icon: iconExpand } : iconExpand)) : __assign({}, (typeof iconCollapse == 'string' ? { icon: iconCollapse } : iconCollapse)))))] })), disableOverlay: false, children: (0, jsx_runtime_1.jsx)(Facet_1.Facet, __assign({}, subProps.facet, { facet: facet })) })));
|
|
237
238
|
}), !hideFiltersButton && (isOverflowing || alwaysShowFiltersButton) && ((0, jsx_runtime_1.jsx)(MobileSidebar_1.MobileSidebar, __assign({ controller: controller }, subProps.MobileSidebar)))] }) })) })) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInspirationResultMessage.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAoB,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAyDjG,eAAO,MAAM,4BAA4B,gBAAyB,iCAAiC;;
|
|
1
|
+
{"version":3,"file":"ChatInspirationResultMessage.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAoB,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAyDjG,eAAO,MAAM,4BAA4B,gBAAyB,iCAAiC;;CA8GjG,CAAC;AAMH,MAAM,MAAM,iCAAiC,GAAG;IAC/C,QAAQ,EAAE,iCAAiC,CAAC;IAC5C,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC,gCAAgC,CAAC,CAAC;CACjD,GAAG,+CAA+C,GAClD,cAAc,CAAC,iCAAiC,CAAC,CAAC;AAEnD,MAAM,MAAM,+CAA+C,GAAG;IAC7D,QAAQ,EAAE,iCAAiC,CAAC;CAC5C,CAAC;AAEF,MAAM,WAAW,gCAAgC;CAKhD"}
|
|
@@ -98,10 +98,13 @@ export const ChatInspirationResultMessage = observer((properties) => {
|
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
100
|
return inspirationSections.length ? (_jsx(CacheProvider, { children: _jsx("div", { className: classnames('ss__chat-inspiration-result-message', className, internalClassName), ...styling, children: _jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections'), children: inspirationSections.map((section, index) => (_jsxs("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section'), children: [_jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__title'), children: section.clusterTitle }), _jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__description'), children: section.clusterDescription }), _jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__queries'), children: section.searchQueries.map((searchTerm, index) => (_jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__queries__query'), onClick: () => {
|
|
101
|
+
if (controller?.store.loading || controller?.store.blocked)
|
|
102
|
+
return;
|
|
101
103
|
controller?.search({ data: { requestType: 'productSearch', searchTerm } });
|
|
102
104
|
}, children: searchTerm }, index))) }), _jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__products'), children: _jsx(Carousel, { ...subProps.Carousel, children: section.products.map((product) => {
|
|
103
105
|
const display = product?.display || product;
|
|
104
|
-
return (_jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__products__product'), children: _jsx(Image, { onClick: () => {
|
|
106
|
+
return (_jsx("div", { className: classnames('ss__chat-inspiration-result-message__inspiration-sections__section__products__product'), children: _jsx(Image, { onClick: (e) => {
|
|
107
|
+
controller?.track.product.click(e, product);
|
|
105
108
|
controller?.viewProduct(product);
|
|
106
109
|
onViewProduct?.();
|
|
107
110
|
}, alt: display?.mappings?.core?.name || '', src: display?.mappings?.core?.imageUrl || '' }) }, product.id));
|
|
@@ -73,7 +73,7 @@ export const ChatProductComparisonMessage = observer((properties) => {
|
|
|
73
73
|
console.warn('ChatProductComparisonMessage received message with unsupported type:', messageType, 'Expected type: productComparison');
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
const headings =
|
|
76
|
+
const headings = searchResults.length ? searchResults.map((r) => String(r?.id)) : [];
|
|
77
77
|
const getDisplay = (r) => r?.display || r;
|
|
78
78
|
const allProductsHaveImage = headings.length > 0 && headings.every((heading) => !!getDisplay(searchResults.find((r) => r?.id === heading))?.mappings?.core?.imageUrl);
|
|
79
79
|
return comparisonData.features.length ? (_jsx(CacheProvider, { children: _jsx("div", { className: classnames('ss__chat-product-comparison-message', className, internalClassName), ...styling, children: _jsx("div", { className: classnames('ss__chat-product-comparison-message__table-wrapper'), children: _jsxs("table", { className: classnames('ss__chat-product-comparison-message__table'), children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", {}), headings.map((heading) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatProductQueryMessage.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatProductQueryMessage.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAkarE,eAAO,MAAM,uBAAuB,gBAAyB,4BAA4B;;CAkPvF,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,2BAA2B,CAAC;IACtC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC5C,GAAG,0CAA0C,GAC7C,cAAc,CAAC,4BAA4B,CAAC,CAAC;AAE9C,MAAM,MAAM,2BAA2B,GAAG;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,cAAc,CAAC;IAC5B,aAAa,EAAE,GAAG,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG;IACxD,QAAQ,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,2BAA2B;CAE3C"}
|
|
@@ -77,6 +77,9 @@ const defaultStyles = () => {
|
|
|
77
77
|
fontWeight: 'bold',
|
|
78
78
|
fontSize: '1.1em',
|
|
79
79
|
color: '#D4A843',
|
|
80
|
+
display: 'flex',
|
|
81
|
+
gap: '0.5em',
|
|
82
|
+
alignItems: 'center',
|
|
80
83
|
},
|
|
81
84
|
},
|
|
82
85
|
'.ss__chat-product-query-message__header__product__actions': {
|
|
@@ -407,7 +410,10 @@ export const ChatProductQueryMessage = observer((properties) => {
|
|
|
407
410
|
controller?.store.currentChat?.popProductQueryMessage(chatItem.sourceMessageId);
|
|
408
411
|
controller?.store.clearProductQuickview();
|
|
409
412
|
};
|
|
410
|
-
return (_jsx(CacheProvider, { children: _jsxs("div", { className: classnames('ss__chat-product-query-message', className, internalClassName), ...styling, children: [_jsxs("div", { className: classnames('ss__chat-product-query-message__header'), children: [cameFromInspiration && (_jsxs("div", { className: classnames('ss__chat-product-query-message__header__back'), onClick: handleBack, children: [_jsx(Icon, { icon: "angle-left", size: "14px" }), _jsx("span", { children: "Back to inspiration" })] })), _jsxs("div", { className: classnames('ss__chat-product-query-message__header__product'), children: [displayedCore.imageUrl && (_jsx(Image, { className: classnames('ss__chat-product-query-message__header__product__image'), src: displayedCore.imageUrl, alt: displayedCore.name || '' })), _jsxs("div", { className: classnames('ss__chat-product-query-message__header__product__details'), children: [displayedCore.name && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__name'), children: displayedCore.url ? (_jsx("a", { href: displayedCore.url, target: "_blank", rel: "noopener noreferrer", children: displayedCore.name })) : (displayedCore.name) })), displayedCore.brand && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__brand'), children: displayedCore.brand })), displayedCore.price != null && (
|
|
413
|
+
return (_jsx(CacheProvider, { children: _jsxs("div", { className: classnames('ss__chat-product-query-message', className, internalClassName), ...styling, children: [_jsxs("div", { className: classnames('ss__chat-product-query-message__header'), children: [cameFromInspiration && (_jsxs("div", { className: classnames('ss__chat-product-query-message__header__back'), onClick: handleBack, children: [_jsx(Icon, { icon: "angle-left", size: "14px" }), _jsx("span", { children: "Back to inspiration" })] })), _jsxs("div", { className: classnames('ss__chat-product-query-message__header__product'), children: [displayedCore.imageUrl && (_jsx(Image, { className: classnames('ss__chat-product-query-message__header__product__image'), src: displayedCore.imageUrl, alt: displayedCore.name || '' })), _jsxs("div", { className: classnames('ss__chat-product-query-message__header__product__details'), children: [displayedCore.name && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__name'), children: displayedCore.url ? (_jsx("a", { href: displayedCore.url, onClick: (e) => controller?.track.product.click(e, product), target: "_blank", rel: "noopener noreferrer", children: displayedCore.name })) : (displayedCore.name) })), displayedCore.brand && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__brand'), children: displayedCore.brand })), displayedCore.price != null && (_jsxs("div", { className: classnames('ss__chat-product-query-message__header__product__details__price'), children: [displayedCore.msrp != null && Number(displayedCore.msrp) > Number(displayedCore.price) && (_jsx(Price, { value: displayedCore.msrp, lineThrough: true })), _jsx(Price, { value: displayedCore.price })] }))] }), _jsxs("div", { className: classnames('ss__chat-product-query-message__header__product__actions'), children: [displayedCore.url && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__actions__go-to-product'), children: _jsx("a", { href: displayedCore.url, onClick: (e) => controller?.track.product.click(e, product), target: "_blank", rel: "noopener noreferrer", children: "Go to product" }) })), _jsx("div", { className: classnames('ss__chat-product-query-message__header__product__actions__add-to-cart'), children: _jsx(Button, { content: 'Add to Cart', onClick: () => {
|
|
414
|
+
controller?.track.product.addToCart(product);
|
|
415
|
+
controller?.addToCart(product);
|
|
416
|
+
} }) }), controller?.store.features.similarProducts.enabled && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__actions__show-similar'), children: _jsx(Button, { content: 'Show Similar', onClick: () => controller?.discussProduct(sourceProduct, { requestType: 'productSimilar' }) }) }))] })] })] }), selections.length > 0 && (_jsx("div", { className: classnames('ss__chat-product-query-message__variants'), children: selections.map((selection) => (_jsxs("div", { children: [_jsxs("div", { className: classnames('ss__chat-product-query-message__variants__label'), children: [formatLabel(selection.field), " (", selection.values.length, ")"] }), _jsx("div", { className: classnames('ss__chat-product-query-message__variants__swatches'), children: selection.values.map((selectionValue) => {
|
|
411
417
|
const isUnavailable = !selectionValue.available;
|
|
412
418
|
const isSelected = selection.selected?.value === selectionValue.value;
|
|
413
419
|
return (_jsxs("div", { className: classnames('ss__chat-product-query-message__variants__swatch', {
|
|
@@ -417,5 +423,5 @@ export const ChatProductQueryMessage = observer((properties) => {
|
|
|
417
423
|
}) })] }, selection.field))) })), infoRows.length > 0 && (_jsxs("div", { className: classnames('ss__chat-product-query-message__section'), children: [_jsx("div", { className: classnames('ss__chat-product-query-message__section__title'), children: "Product Information" }), _jsx("table", { className: classnames('ss__chat-product-query-message__section__table'), children: _jsx("tbody", { children: infoRows.map((row) => (_jsxs("tr", { children: [_jsx("td", { children: row.label }), _jsx("td", { children: row.rawKey === 'availability' ? (_jsx("span", { className: classnames({
|
|
418
424
|
'ss__chat-product-query-message__section__table__availability--in-stock': row.value === 'In Stock',
|
|
419
425
|
'ss__chat-product-query-message__section__table__availability--out-of-stock': row.value === 'Out of Stock',
|
|
420
|
-
}), children: row.value === 'In Stock' ? `\u2713 ${row.value}` : row.value })) : (row.value) })] }, row.key))) }) })] })), descriptionRow && (_jsxs("div", { className: classnames('ss__chat-product-query-message__section'), children: [_jsx("div", { className: classnames('ss__chat-product-query-message__section__title'), children: "Description" }), _jsx("div", { className: classnames('ss__chat-product-query-message__section__description'), children: descriptionRow.value })] })), features.length > 0 && (_jsxs("div", { className: classnames('ss__chat-product-query-message__section'), children: [_jsx("div", { className: classnames('ss__chat-product-query-message__section__title'), children: "Features" }), _jsx("ul", { className: classnames('ss__chat-product-query-message__section__features'), children: features.map((feature, idx) => (_jsx("li", { children: feature }, idx))) })] }))] }) }));
|
|
426
|
+
}), children: row.value === 'In Stock' ? `\u2713 ${row.value}` : row.value })) : row.rawKey.toLowerCase() === 'price' ? (_jsxs("span", { style: { display: 'flex', gap: '0.5em', alignItems: 'center', justifyContent: 'flex-end' }, children: [displayedCore.msrp != null && Number(displayedCore.msrp) > Number(row.value) && (_jsx(Price, { value: Number(displayedCore.msrp), lineThrough: true })), _jsx(Price, { value: Number(row.value) })] })) : (row.value) })] }, row.key))) }) })] })), descriptionRow && (_jsxs("div", { className: classnames('ss__chat-product-query-message__section'), children: [_jsx("div", { className: classnames('ss__chat-product-query-message__section__title'), children: "Description" }), _jsx("div", { className: classnames('ss__chat-product-query-message__section__description'), children: descriptionRow.value })] })), features.length > 0 && (_jsxs("div", { className: classnames('ss__chat-product-query-message__section'), children: [_jsx("div", { className: classnames('ss__chat-product-query-message__section__title'), children: "Features" }), _jsx("ul", { className: classnames('ss__chat-product-query-message__section__features'), children: features.map((feature, idx) => (_jsx("li", { children: feature }, idx))) })] }))] }) }));
|
|
421
427
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/Chat.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/Chat.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAqhCrE,eAAO,MAAM,IAAI,gBAAyB,SAAS,KAAG,GAAG,CAAC,OAAO;;CAi1C/D,CAAC;AAEH,MAAM,WAAW,SAAU,SAAQ,cAAc;IAChD,UAAU,EAAE,cAAc,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+BAA+B,CAAC,EAAE,OAAO,CAAC;CAC1C"}
|