@athoscommerce/snap-preact 1.2.3-beta.1 → 1.2.3-beta.3
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 +5 -2
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +143 -39
- 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 +17 -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 -22
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +4 -1
- package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +6 -10
- package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +4 -8
- package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +5 -9
- package/dist/cjs/components/src/hooks/useAcRenderedInput.js +1 -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 +5 -2
- package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/Chat.js +131 -28
- 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 +17 -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 -20
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +4 -1
- package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +4 -8
- package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +4 -8
- package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +4 -8
- package/dist/esm/components/src/hooks/useAcRenderedInput.js +1 -1
- package/package.json +12 -12
|
@@ -44,6 +44,11 @@ var defaultStyles = function () {
|
|
|
44
44
|
alignItems: 'center',
|
|
45
45
|
gap: '10px',
|
|
46
46
|
},
|
|
47
|
+
'.ss__chat__message-user__text-wrapper': {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
alignItems: 'flex-end',
|
|
51
|
+
},
|
|
47
52
|
'.ss__chat__message-user__text': {
|
|
48
53
|
padding: '0.5em 1em',
|
|
49
54
|
borderRadius: '12px',
|
|
@@ -56,9 +61,10 @@ var defaultStyles = function () {
|
|
|
56
61
|
padding: 0,
|
|
57
62
|
margin: 0,
|
|
58
63
|
display: 'flex',
|
|
59
|
-
|
|
60
|
-
flexWrap: 'nowrap',
|
|
64
|
+
flexWrap: 'wrap',
|
|
61
65
|
justifyContent: 'flex-end',
|
|
66
|
+
flex: '0 0 40px',
|
|
67
|
+
alignSelf: 'flex-end',
|
|
62
68
|
'.ss__chat__message-user__attachment__product, .ss__chat__message-user__attachment__image, .ss__chat__message-user__attachment__facet': {
|
|
63
69
|
width: '40px',
|
|
64
70
|
height: '40px',
|
|
@@ -84,10 +90,16 @@ var defaultStyles = function () {
|
|
|
84
90
|
borderColor: colorPrimary,
|
|
85
91
|
},
|
|
86
92
|
},
|
|
93
|
+
'.ss__chat__message-user__attachment__facet--overflow': {
|
|
94
|
+
fontSize: '12px',
|
|
95
|
+
fontWeight: 600,
|
|
96
|
+
color: '#555',
|
|
97
|
+
},
|
|
87
98
|
},
|
|
88
99
|
});
|
|
89
100
|
};
|
|
90
101
|
function getRequestTypeLabel(chatItem) {
|
|
102
|
+
var _a, _b;
|
|
91
103
|
var requestType = chatItem.requestType;
|
|
92
104
|
if (!requestType || requestType === 'general')
|
|
93
105
|
return undefined;
|
|
@@ -97,7 +109,12 @@ function getRequestTypeLabel(chatItem) {
|
|
|
97
109
|
case 'productComparison':
|
|
98
110
|
return 'Comparing products';
|
|
99
111
|
case 'productSearch':
|
|
100
|
-
|
|
112
|
+
if ((_b = (_a = chatItem.request) === null || _a === void 0 ? void 0 : _a.searchFilters) === null || _b === void 0 ? void 0 : _b.length) {
|
|
113
|
+
return 'Filtering products';
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return 'Searching products';
|
|
117
|
+
}
|
|
101
118
|
case 'imageSearch':
|
|
102
119
|
return 'Searching by image';
|
|
103
120
|
case 'productSimilar':
|
|
@@ -147,7 +164,6 @@ function findProductInChat(chat, productId) {
|
|
|
147
164
|
return null;
|
|
148
165
|
}
|
|
149
166
|
exports.MessageUser = (0, mobx_react_lite_1.observer)(function (props) {
|
|
150
|
-
var _a, _b;
|
|
151
167
|
var controller = props.controller, chatItem = props.chatItem, onViewProduct = props.onViewProduct;
|
|
152
168
|
var store = controller.store;
|
|
153
169
|
var styling = (0, utilities_1.mergeStyles)(props, defaultStyles);
|
|
@@ -169,24 +185,40 @@ exports.MessageUser = (0, mobx_react_lite_1.observer)(function (props) {
|
|
|
169
185
|
onViewProduct === null || onViewProduct === void 0 ? void 0 : onViewProduct(product);
|
|
170
186
|
}
|
|
171
187
|
};
|
|
172
|
-
return ((0, jsx_runtime_1.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
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 () {
|
|
189
|
+
var _a;
|
|
190
|
+
if (!((_a = chatItem.attachments) === null || _a === void 0 ? void 0 : _a.length))
|
|
191
|
+
return null;
|
|
192
|
+
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);
|
|
193
|
+
var totalFacets = resolved.filter(function (a) { return a.type === 'facet'; }).length;
|
|
194
|
+
var hiddenFacetCount = Math.max(0, totalFacets - 2);
|
|
195
|
+
var facetIndex = 0;
|
|
196
|
+
var items = resolved
|
|
197
|
+
.map(function (attachment) {
|
|
198
|
+
var _a;
|
|
199
|
+
switch (attachment.type) {
|
|
200
|
+
case 'image':
|
|
201
|
+
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));
|
|
202
|
+
case 'product': {
|
|
203
|
+
var canOpen = !!findProductInChat((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.chat, attachment.productId);
|
|
204
|
+
return ((0, jsx_runtime_1.jsx)("li", { className: (0, classnames_1.default)('ss__chat__message-user__attachment__product', {
|
|
205
|
+
'ss__chat__message-user__attachment__product--clickable': canOpen,
|
|
206
|
+
}), 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));
|
|
207
|
+
}
|
|
208
|
+
case 'facet': {
|
|
209
|
+
facetIndex += 1;
|
|
210
|
+
if (facetIndex > 2)
|
|
188
211
|
return null;
|
|
212
|
+
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
213
|
}
|
|
190
|
-
|
|
191
|
-
|
|
214
|
+
default:
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
.filter(Boolean);
|
|
219
|
+
if (hiddenFacetCount > 0) {
|
|
220
|
+
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"));
|
|
221
|
+
}
|
|
222
|
+
return items;
|
|
223
|
+
})() }), (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", dangerouslySetInnerHTML: { __html: marked_1.marked.parse(chatItem.text) } })) : null] })] }) })));
|
|
192
224
|
});
|
|
@@ -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;;CA8EhE,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,7 +53,9 @@ 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
60
|
var carouselProps = {
|
|
59
61
|
breakpoints: undefined,
|
|
@@ -69,6 +71,7 @@ exports.ResultsDisplay = (0, mobx_react_lite_1.observer)(function (props) {
|
|
|
69
71
|
// buttons should be able to be clicked without triggering the product click
|
|
70
72
|
if (e.composedPath().some(function (el) { return el instanceof HTMLElement && el.matches('button, .ss__button, a'); }))
|
|
71
73
|
return;
|
|
74
|
+
controller.track.product.click(e, result);
|
|
72
75
|
controller.viewProduct(result);
|
|
73
76
|
onViewProduct === null || onViewProduct === void 0 ? void 0 : onViewProduct();
|
|
74
77
|
};
|
package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteFixed.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AA+CjG,eAAO,MAAM,iBAAiB,gBAAyB,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"AutocompleteFixed.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AA+CjG,eAAO,MAAM,iBAAiB,gBAAyB,sBAAsB;;CAsN3E,CAAC;AAEH,UAAU,WAAW;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAQD,MAAM,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,CAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;CAC7C,GAAG,oCAAoC,GACvC,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAEzC,MAAM,MAAM,oCAAoC,GAAG;IAClD,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;CAC9C,GAAG,uBAAuB,CAAC"}
|
|
@@ -73,7 +73,10 @@ exports.AutocompleteFixed = (0, mobx_react_lite_1.observer)(function (properties
|
|
|
73
73
|
};
|
|
74
74
|
var props = (0, utilities_1.mergeProps)('autocompleteFixed', globalTheme, defaultProps, properties);
|
|
75
75
|
var _a = (0, hooks_1.useState)(false), active = _a[0], setActive = _a[1];
|
|
76
|
-
|
|
76
|
+
// Use an empty inputName so the rendered SearchInput does not participate in form
|
|
77
|
+
// serialization. The original input retains its name (e.g. 'q') so that native form
|
|
78
|
+
// submission still produces the expected ?q= query parameter.
|
|
79
|
+
var inputName = '';
|
|
77
80
|
var input = props.input;
|
|
78
81
|
var buttonSelector = props.buttonSelector;
|
|
79
82
|
var inputPlaceholderText = undefined;
|
|
@@ -81,13 +84,6 @@ exports.AutocompleteFixed = (0, mobx_react_lite_1.observer)(function (properties
|
|
|
81
84
|
if (typeof input === 'string') {
|
|
82
85
|
input = document.querySelector(input);
|
|
83
86
|
}
|
|
84
|
-
var existingInputName = input === null || input === void 0 ? void 0 : input.getAttribute('name');
|
|
85
|
-
if (existingInputName) {
|
|
86
|
-
setInputName(existingInputName);
|
|
87
|
-
if (props.renderInput) {
|
|
88
|
-
input.setAttribute('name', '');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
87
|
inputPlaceholderText = input === null || input === void 0 ? void 0 : input.getAttribute('placeholder');
|
|
92
88
|
}
|
|
93
89
|
if (!buttonSelector && input) {
|
|
@@ -171,12 +167,12 @@ exports.AutocompleteFixed = (0, mobx_react_lite_1.observer)(function (properties
|
|
|
171
167
|
};
|
|
172
168
|
}
|
|
173
169
|
};
|
|
174
|
-
var
|
|
170
|
+
var _b = (0, hooks_1.useState)({
|
|
175
171
|
top: 0,
|
|
176
172
|
left: 0,
|
|
177
173
|
width: 0,
|
|
178
174
|
height: 0,
|
|
179
|
-
}), inputBounds =
|
|
175
|
+
}), inputBounds = _b[0], setInputBounds = _b[1];
|
|
180
176
|
var checkForInputChange = function () {
|
|
181
177
|
var currentInputBounds = getInputBounds(input);
|
|
182
178
|
if (inputBounds.height !== currentInputBounds.height ||
|
package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteModal.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteModal/AutocompleteModal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AA8DjG,eAAO,MAAM,iBAAiB,gBAAyB,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"AutocompleteModal.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteModal/AutocompleteModal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AA8DjG,eAAO,MAAM,iBAAiB,gBAAyB,sBAAsB;;CAiK3E,CAAC;AAQH,MAAM,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,CAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;CAC7C,GAAG,oCAAoC,GACvC,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAEzC,MAAM,MAAM,oCAAoC,GAAG;IAClD,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,uBAAuB,CAAC"}
|
|
@@ -91,20 +91,16 @@ exports.AutocompleteModal = (0, mobx_react_lite_1.observer)(function (properties
|
|
|
91
91
|
};
|
|
92
92
|
var props = (0, utilities_1.mergeProps)('autocompleteModal', globalTheme, defaultProps, properties);
|
|
93
93
|
var _a = (0, hooks_1.useState)(false), active = _a[0], setActive = _a[1];
|
|
94
|
-
|
|
94
|
+
// Use an empty inputName so the rendered SearchInput does not participate in form
|
|
95
|
+
// serialization. The original input retains its name (e.g. 'q') so that native form
|
|
96
|
+
// submission still produces the expected ?q= query parameter.
|
|
97
|
+
var inputName = '';
|
|
95
98
|
var input = props.input;
|
|
96
99
|
var buttonSelector = props.buttonSelector;
|
|
97
100
|
if (input) {
|
|
98
101
|
if (typeof input === 'string') {
|
|
99
102
|
input = document.querySelector(input);
|
|
100
103
|
}
|
|
101
|
-
var existingInputName = input === null || input === void 0 ? void 0 : input.getAttribute('name');
|
|
102
|
-
if (existingInputName) {
|
|
103
|
-
setInputName(existingInputName);
|
|
104
|
-
if (props.renderInput) {
|
|
105
|
-
input.setAttribute('name', '');
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
104
|
}
|
|
109
105
|
if (!buttonSelector && input) {
|
|
110
106
|
buttonSelector = input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteSlideout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAA2B,MAAM,0BAA0B,CAAC;AAsBvF,eAAO,MAAM,oBAAoB,gBAAyB,yBAAyB;;
|
|
1
|
+
{"version":3,"file":"AutocompleteSlideout.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAAE,cAAc,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAsB,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAA2B,MAAM,0BAA0B,CAAC;AAsBvF,eAAO,MAAM,oBAAoB,gBAAyB,yBAAyB;;CAyJjF,CAAC;AAOH,MAAM,MAAM,yBAAyB,GAAG;IACvC,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,CAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;CAC7C,GAAG,uCAAuC,GAC1C,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAEzC,MAAM,MAAM,uCAAuC,GAAG;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,uBAAuB,CAAC"}
|
package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js
CHANGED
|
@@ -51,20 +51,16 @@ exports.AutocompleteSlideout = (0, mobx_react_lite_1.observer)(function (propert
|
|
|
51
51
|
renderInput: true,
|
|
52
52
|
};
|
|
53
53
|
var props = (0, utilities_1.mergeProps)('autocompleteSlideout', globalTheme, defaultProps, properties);
|
|
54
|
-
|
|
54
|
+
// Use an empty inputName so the rendered SearchInput does not participate in form
|
|
55
|
+
// serialization. The original input retains its name (e.g. 'q') so that native form
|
|
56
|
+
// submission still produces the expected ?q= query parameter.
|
|
57
|
+
var inputName = '';
|
|
55
58
|
var input = props.input;
|
|
56
59
|
var buttonSelector = props.buttonSelector;
|
|
57
60
|
if (input) {
|
|
58
61
|
if (typeof input === 'string') {
|
|
59
62
|
input = document.querySelector(input);
|
|
60
63
|
}
|
|
61
|
-
var existingInputName = input === null || input === void 0 ? void 0 : input.getAttribute('name');
|
|
62
|
-
if (existingInputName) {
|
|
63
|
-
setInputName(existingInputName);
|
|
64
|
-
if (props.renderInput) {
|
|
65
|
-
input.setAttribute('name', '');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
64
|
}
|
|
69
65
|
if (!buttonSelector && input) {
|
|
70
66
|
buttonSelector = input;
|
|
@@ -112,7 +108,7 @@ exports.AutocompleteSlideout = (0, mobx_react_lite_1.observer)(function (propert
|
|
|
112
108
|
treePath: "".concat(treePath, " slideout"), theme: props === null || props === void 0 ? void 0 : props.theme }),
|
|
113
109
|
};
|
|
114
110
|
var styling = (0, utilities_1.mergeStyles)(props, defaultStyles);
|
|
115
|
-
var
|
|
111
|
+
var _a = (0, hooks_1.useState)(false), active = _a[0], setActive = _a[1];
|
|
116
112
|
var _input;
|
|
117
113
|
if (input) {
|
|
118
114
|
(0, hooks_1.useEffect)(function () {
|
|
@@ -55,7 +55,7 @@ function useAcRenderedInput(_a) {
|
|
|
55
55
|
case 0:
|
|
56
56
|
if (!!renderedInputInitialized) return [3 /*break*/, 2];
|
|
57
57
|
setInput(renderedInputRef.current);
|
|
58
|
-
controller.config.selector =
|
|
58
|
+
controller.config.selector = "".concat(controller.config.selector, ", .autocomplete__search-input input");
|
|
59
59
|
return [4 /*yield*/, controller.bind()];
|
|
60
60
|
case 1:
|
|
61
61
|
_b.sent();
|
|
@@ -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;AA+ZrE,eAAO,MAAM,uBAAuB,gBAAyB,4BAA4B;;
|
|
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;AA+ZrE,eAAO,MAAM,uBAAuB,gBAAyB,4BAA4B;;CA0OvF,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"}
|
|
@@ -407,7 +407,10 @@ export const ChatProductQueryMessage = observer((properties) => {
|
|
|
407
407
|
controller?.store.currentChat?.popProductQueryMessage(chatItem.sourceMessageId);
|
|
408
408
|
controller?.store.clearProductQuickview();
|
|
409
409
|
};
|
|
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 && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__price'), children: _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, 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: () =>
|
|
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, 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 && (_jsx("div", { className: classnames('ss__chat-product-query-message__header__product__details__price'), children: _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: () => {
|
|
411
|
+
controller?.track.product.addToCart(product);
|
|
412
|
+
controller?.addToCart(product);
|
|
413
|
+
} }) }), 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
414
|
const isUnavailable = !selectionValue.available;
|
|
412
415
|
const isSelected = selection.selected?.value === selectionValue.value;
|
|
413
416
|
return (_jsxs("div", { className: classnames('ss__chat-product-query-message__variants__swatch', {
|
|
@@ -417,5 +420,5 @@ export const ChatProductQueryMessage = observer((properties) => {
|
|
|
417
420
|
}) })] }, 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
421
|
'ss__chat-product-query-message__section__table__availability--in-stock': row.value === 'In Stock',
|
|
419
422
|
'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))) })] }))] }) }));
|
|
423
|
+
}), children: row.value === 'In Stock' ? `\u2713 ${row.value}` : row.value })) : row.rawKey.toLowerCase() === 'price' ? (_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
424
|
});
|
|
@@ -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;AAwgCrE,eAAO,MAAM,IAAI,gBAAyB,SAAS,KAAG,GAAG,CAAC,OAAO;;CAwwC/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;CAC5B"}
|