@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
|
@@ -3,7 +3,7 @@ import { observer } from 'mobx-react-lite';
|
|
|
3
3
|
import { Image } from '../../Atoms/Image';
|
|
4
4
|
import { Button } from '../../Atoms/Button';
|
|
5
5
|
import { mergeProps, mergeStyles } from '../../../utilities';
|
|
6
|
-
import { css, useTheme, useTreePath, useSnap } from '../../../providers';
|
|
6
|
+
import { css, useTheme, useTreePath, useSnap, withTracking } from '../../../providers';
|
|
7
7
|
import { CalloutBadge, OverlayBadge, Price } from '../../..';
|
|
8
8
|
import { useComponent } from '../../../hooks';
|
|
9
9
|
const defaultStyles = () => {
|
|
@@ -18,8 +18,17 @@ const defaultStyles = () => {
|
|
|
18
18
|
overflow: 'hidden',
|
|
19
19
|
'.ss__chat__result__image': {
|
|
20
20
|
width: '100%',
|
|
21
|
+
aspectRatio: '1 / 1',
|
|
21
22
|
position: 'relative',
|
|
22
23
|
overflow: 'hidden',
|
|
24
|
+
// fixed-aspect frame: scale the image to fill it and crop overflow so
|
|
25
|
+
// results with different intrinsic image aspect ratios still line up
|
|
26
|
+
// at the same height when displayed side-by-side.
|
|
27
|
+
img: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%',
|
|
30
|
+
objectFit: 'cover',
|
|
31
|
+
},
|
|
23
32
|
'.ss__chat__result__image__buttons': {
|
|
24
33
|
position: 'absolute',
|
|
25
34
|
bottom: 0,
|
|
@@ -100,7 +109,7 @@ const defaultStyles = () => {
|
|
|
100
109
|
},
|
|
101
110
|
});
|
|
102
111
|
};
|
|
103
|
-
export const ChatResult = observer((properties) => {
|
|
112
|
+
export const ChatResult = withTracking(observer((properties) => {
|
|
104
113
|
const globalTheme = useTheme();
|
|
105
114
|
const globalTreePath = useTreePath();
|
|
106
115
|
const snap = useSnap();
|
|
@@ -108,7 +117,7 @@ export const ChatResult = observer((properties) => {
|
|
|
108
117
|
treePath: globalTreePath,
|
|
109
118
|
};
|
|
110
119
|
const props = mergeProps('chatResult', globalTheme, defaultProps, properties);
|
|
111
|
-
const { controller, result, scrollToBottom, customComponent } = props;
|
|
120
|
+
const { controller, result, scrollToBottom, customComponent, trackingRef } = props;
|
|
112
121
|
if (customComponent) {
|
|
113
122
|
const ComponentOverride = useComponent(snap?.templates?.library.import.component.result || {}, customComponent);
|
|
114
123
|
if (ComponentOverride) {
|
|
@@ -116,6 +125,9 @@ export const ChatResult = observer((properties) => {
|
|
|
116
125
|
}
|
|
117
126
|
}
|
|
118
127
|
const isInComparison = controller.store.currentChat?.comparisons.items.some((item) => item.result?.id === result.id);
|
|
128
|
+
// a result is "configurable" when it ships with selectable variant options
|
|
129
|
+
// (e.g. color/size); those need a selection before they can be added to cart
|
|
130
|
+
const isConfigurable = !!result.variants?.optionConfig && Object.keys(result.variants.optionConfig).length > 0;
|
|
119
131
|
const subProps = {
|
|
120
132
|
button: {
|
|
121
133
|
// component theme overrides
|
|
@@ -131,13 +143,20 @@ export const ChatResult = observer((properties) => {
|
|
|
131
143
|
},
|
|
132
144
|
};
|
|
133
145
|
const styling = mergeStyles(properties, defaultStyles);
|
|
134
|
-
return (_jsxs("div", { className: "ss__chat__result", ...styling, children: [_jsxs("div", { className: "ss__chat__result__image", children: [_jsx(OverlayBadge, { controller: controller, result: result, renderEmpty: true, children: _jsx(Image, { className: 'ss__chat__result__detail-slot__image', alt: result.display.mappings.core?.name || '', src: result.display.mappings.core?.imageUrl || '', ...subProps.image }) }), _jsxs("div", { className: "ss__chat__result__image__buttons", children: [controller.store.features.similarProducts.enabled && (_jsx(Button, { className: 'ss__chat__result__image__buttons__similar', content: 'Similar', onClick: () => {
|
|
146
|
+
return (_jsxs("div", { className: "ss__chat__result", ref: trackingRef, ...styling, children: [_jsxs("div", { className: "ss__chat__result__image", children: [_jsx(OverlayBadge, { controller: controller, result: result, renderEmpty: true, children: _jsx(Image, { className: 'ss__chat__result__detail-slot__image', alt: result.display.mappings.core?.name || '', src: result.display.mappings.core?.imageUrl || '', ...subProps.image }) }), _jsxs("div", { className: "ss__chat__result__image__buttons", children: [controller.store.features.similarProducts.enabled && (_jsx(Button, { className: 'ss__chat__result__image__buttons__similar', content: 'Similar', onClick: () => {
|
|
135
147
|
controller.discussProduct(result, { requestType: 'productSimilar' });
|
|
136
148
|
} })), _jsx(Button, { className: 'ss__chat__result__image__buttons__compare', content: isInComparison ? undefined : 'Compare', icon: isInComparison ? { icon: 'check-thin', title: 'Added to comparison' } : undefined, onClick: () => {
|
|
137
149
|
controller.compareProduct(result);
|
|
138
150
|
} })] }), _jsxs("div", { className: "ss__chat__result__image__icons", children: [_jsx(Button, { className: 'ss__chat__result__image__icons__icon--inquire', icon: { icon: 'chat', title: 'Discuss Product' }, onClick: () => {
|
|
139
151
|
controller.discussProduct(result, { requestType: 'productQuery' });
|
|
140
|
-
} }), _jsx(Button, { className: 'ss__chat__result__image__icons__icon--cart', icon: { icon: 'cart', title: 'Add to Cart' }, onClick: () => {
|
|
152
|
+
} }), _jsx(Button, { className: 'ss__chat__result__image__icons__icon--cart', icon: { icon: 'cart', title: isConfigurable ? 'Configure' : 'Add to Cart' }, onClick: () => {
|
|
153
|
+
// configurable products need a variant selection — open the product
|
|
154
|
+
// information panel so the user can pick options before adding to cart
|
|
155
|
+
if (isConfigurable) {
|
|
156
|
+
controller.viewProduct(result);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
controller.track.product.addToCart(result);
|
|
141
160
|
controller.addToCart(result);
|
|
142
|
-
} })] })] }), _jsxs("div", { className: "ss__chat__result__content", children: [result.display.mappings.core?.name && _jsx("div", { className: "ss__chat__result__content__title--primary", children: result.display.mappings.core?.name }), result.display.mappings.core?.price && (_jsx("div", { className: "ss__chat__result__content__price", children: _jsx(Price, { value: result.display.mappings.core?.price }) })), _jsx(CalloutBadge, { controller: controller, result: result })] })] }));
|
|
143
|
-
});
|
|
161
|
+
} })] })] }), _jsxs("div", { className: "ss__chat__result__content", children: [result.display.mappings.core?.name && (_jsx("div", { className: "ss__chat__result__content__title--primary", children: result.display.mappings.core?.name })), result.display.mappings.core?.price && (_jsx("div", { className: "ss__chat__result__content__price", children: _jsx(Price, { value: result.display.mappings.core?.price }) })), _jsx(CalloutBadge, { controller: controller, result: result })] })] }));
|
|
162
|
+
}));
|
|
@@ -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"}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { observer } from 'mobx-react-lite';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Image } from '../../Atoms/Image';
|
|
5
|
-
import { marked } from 'marked';
|
|
6
5
|
import { Icon } from '../../Atoms/Icon';
|
|
7
6
|
import { css } from '../../..';
|
|
8
7
|
import { mergeStyles } from '../../../utilities';
|
|
@@ -27,6 +26,11 @@ const defaultStyles = () => {
|
|
|
27
26
|
alignItems: 'center',
|
|
28
27
|
gap: '10px',
|
|
29
28
|
},
|
|
29
|
+
'.ss__chat__message-user__text-wrapper': {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
alignItems: 'flex-end',
|
|
33
|
+
},
|
|
30
34
|
'.ss__chat__message-user__text': {
|
|
31
35
|
padding: '0.5em 1em',
|
|
32
36
|
borderRadius: '12px',
|
|
@@ -39,9 +43,10 @@ const defaultStyles = () => {
|
|
|
39
43
|
padding: 0,
|
|
40
44
|
margin: 0,
|
|
41
45
|
display: 'flex',
|
|
42
|
-
|
|
43
|
-
flexWrap: 'nowrap',
|
|
46
|
+
flexWrap: 'wrap',
|
|
44
47
|
justifyContent: 'flex-end',
|
|
48
|
+
flex: '0 0 40px',
|
|
49
|
+
alignSelf: 'flex-end',
|
|
45
50
|
'.ss__chat__message-user__attachment__product, .ss__chat__message-user__attachment__image, .ss__chat__message-user__attachment__facet': {
|
|
46
51
|
width: '40px',
|
|
47
52
|
height: '40px',
|
|
@@ -67,6 +72,11 @@ const defaultStyles = () => {
|
|
|
67
72
|
borderColor: colorPrimary,
|
|
68
73
|
},
|
|
69
74
|
},
|
|
75
|
+
'.ss__chat__message-user__attachment__facet--overflow': {
|
|
76
|
+
fontSize: '12px',
|
|
77
|
+
fontWeight: 600,
|
|
78
|
+
color: '#555',
|
|
79
|
+
},
|
|
70
80
|
},
|
|
71
81
|
});
|
|
72
82
|
};
|
|
@@ -80,7 +90,12 @@ function getRequestTypeLabel(chatItem) {
|
|
|
80
90
|
case 'productComparison':
|
|
81
91
|
return 'Comparing products';
|
|
82
92
|
case 'productSearch':
|
|
83
|
-
|
|
93
|
+
if (chatItem.request?.searchFilters?.length) {
|
|
94
|
+
return 'Filtering products';
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return 'Searching products';
|
|
98
|
+
}
|
|
84
99
|
case 'imageSearch':
|
|
85
100
|
return 'Searching by image';
|
|
86
101
|
case 'productSimilar':
|
|
@@ -142,23 +157,38 @@ export const MessageUser = observer((props) => {
|
|
|
142
157
|
onViewProduct?.(product);
|
|
143
158
|
}
|
|
144
159
|
};
|
|
145
|
-
return (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
return (_jsx("div", { className: "ss__chat__message-user", ...styling, children: _jsxs("div", { className: "ss__chat__message-user__row", children: [_jsx("ul", { className: "ss__chat__message-user__attachments", children: (() => {
|
|
161
|
+
if (!chatItem.attachments?.length)
|
|
162
|
+
return null;
|
|
163
|
+
const resolved = chatItem.attachments.map((id) => store.currentChat?.attachments.get(id)).filter(Boolean);
|
|
164
|
+
const totalFacets = resolved.filter((a) => a.type === 'facet').length;
|
|
165
|
+
const hiddenFacetCount = Math.max(0, totalFacets - 2);
|
|
166
|
+
let facetIndex = 0;
|
|
167
|
+
const items = resolved
|
|
168
|
+
.map((attachment) => {
|
|
169
|
+
switch (attachment.type) {
|
|
170
|
+
case 'image':
|
|
171
|
+
return (_jsx("li", { className: "ss__chat__message-user__attachment__image", children: _jsx(Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || attachment.base64 || '', alt: '' }) }, attachment.id));
|
|
172
|
+
case 'product': {
|
|
173
|
+
const canOpen = !!findProductInChat(store.currentChat?.chat, attachment.productId);
|
|
174
|
+
return (_jsx("li", { className: classnames('ss__chat__message-user__attachment__product', {
|
|
175
|
+
'ss__chat__message-user__attachment__product--clickable': canOpen,
|
|
176
|
+
}), onClick: canOpen ? () => handleProductAttachmentClick(attachment) : undefined, title: canOpen ? `View details for ${attachment.name}` : undefined, children: _jsx(Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || '', alt: attachment.name }) }, attachment.id));
|
|
177
|
+
}
|
|
178
|
+
case 'facet': {
|
|
179
|
+
facetIndex += 1;
|
|
180
|
+
if (facetIndex > 2)
|
|
160
181
|
return null;
|
|
182
|
+
return (_jsx("li", { className: "ss__chat__message-user__attachment__facet", children: _jsx(Icon, { title: `Filter: ${attachment.facetLabel} = ${attachment.label}`, icon: "filter-funnel", size: 27 }) }, attachment.id));
|
|
161
183
|
}
|
|
162
|
-
|
|
163
|
-
|
|
184
|
+
default:
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
.filter(Boolean);
|
|
189
|
+
if (hiddenFacetCount > 0) {
|
|
190
|
+
items.push(_jsxs("li", { className: "ss__chat__message-user__attachment__facet ss__chat__message-user__attachment__facet--overflow", title: `${hiddenFacetCount} more filter${hiddenFacetCount === 1 ? '' : 's'}`, children: ["+", hiddenFacetCount] }, "facet-overflow"));
|
|
191
|
+
}
|
|
192
|
+
return items;
|
|
193
|
+
})() }), _jsxs("div", { className: "ss__chat__message-user__text-wrapper", children: [requestTypeLabel ? _jsx("div", { className: "ss__chat__message-user__request-type", children: requestTypeLabel }) : null, chatItem.text ? _jsx("div", { className: "ss__chat__message-user__text", children: chatItem.text }) : null] })] }) }));
|
|
164
194
|
});
|
|
@@ -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"}
|
|
@@ -38,33 +38,41 @@ export const ResultsDisplay = observer((props) => {
|
|
|
38
38
|
['inspirationResult', 'productComparison', 'productQuery'].includes(activeMessage.messageType) &&
|
|
39
39
|
currentChat?.dismissedSideChatMessageId !== activeMessage.id;
|
|
40
40
|
const isNarrow = typeof window !== 'undefined' && window.innerWidth < 550;
|
|
41
|
-
|
|
41
|
+
// only the tablet range needs the narrower carousel when the side chat is open;
|
|
42
|
+
// at >= 1200px there's room to keep 2.9 slides alongside the secondary chat
|
|
43
|
+
const isConstrained = !isNarrow && isSideChatOpen && typeof window !== 'undefined' && window.innerWidth >= 768 && window.innerWidth <= 1200;
|
|
42
44
|
const slidesPerView = isNarrow || isConstrained ? 1.9 : 2.9;
|
|
43
|
-
const
|
|
45
|
+
const visibleSlides = Math.ceil(slidesPerView);
|
|
46
|
+
// When all results fit, use a whole-number slidesPerView so the last slide
|
|
47
|
+
// isn't clipped to a fraction; otherwise keep the fractional value to hint
|
|
48
|
+
// at additional content beyond the viewport.
|
|
49
|
+
const resolveSlidesPerView = (count) => (count <= visibleSlides ? count : slidesPerView);
|
|
50
|
+
const buildCarouselProps = (count) => ({
|
|
44
51
|
breakpoints: undefined,
|
|
45
|
-
slidesPerView,
|
|
52
|
+
slidesPerView: resolveSlidesPerView(count),
|
|
46
53
|
slidesPerGroup: isNarrow || isConstrained ? 2 : 3,
|
|
47
54
|
loop: false,
|
|
48
55
|
pagination: false,
|
|
49
56
|
centerInsufficientSlides: false,
|
|
50
57
|
freeMode: true,
|
|
51
58
|
styleScript: carouselStyleScript,
|
|
52
|
-
};
|
|
59
|
+
});
|
|
53
60
|
const handleResultClick = (e, result) => {
|
|
54
61
|
// buttons should be able to be clicked without triggering the product click
|
|
55
62
|
if (e.composedPath().some((el) => el instanceof HTMLElement && el.matches('button, .ss__button, a')))
|
|
56
63
|
return;
|
|
64
|
+
controller.track.product.click(e, result);
|
|
57
65
|
controller.viewProduct(result);
|
|
58
66
|
onViewProduct?.();
|
|
59
67
|
};
|
|
60
68
|
if (chatItem.messageType === 'productRecommendation' && chatItem.recommendationResult?.length) {
|
|
61
69
|
return (_jsx(_Fragment, { children: chatItem.recommendationResult.map((recommendation, index) => {
|
|
62
|
-
return recommendation.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...
|
|
70
|
+
return recommendation.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...buildCarouselProps(recommendation.results.length), hideButtons: recommendation.results.length <= visibleSlides, children: recommendation.results.map((result) => {
|
|
63
71
|
return (_jsx("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: (e) => handleResultClick(e, result), children: _jsx(ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
|
|
64
72
|
}) }) }, index)) : null;
|
|
65
73
|
}) }));
|
|
66
74
|
}
|
|
67
|
-
return chatItem.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...
|
|
75
|
+
return chatItem.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...buildCarouselProps(chatItem.results.length), hideButtons: chatItem.results.length <= visibleSlides, children: chatItem.results.map((result) => {
|
|
68
76
|
return (_jsx("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: (e) => handleResultClick(e, result), children: _jsx(ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
|
|
69
77
|
}) }) })) : null;
|
|
70
78
|
});
|
|
@@ -419,7 +419,7 @@ export const Facet = observer((properties) => {
|
|
|
419
419
|
? ''
|
|
420
420
|
: 'ss__facet--showing-all'), children: justContent ? (_jsx(FacetContent, { ...facetContentProps, mergedLang: mergedLang })) : (_jsx(Dropdown, { ...subProps.dropdown, open: disableCollapse || !facet?.collapsed, onClick: () => !disableCollapse && facet.toggleCollapse && facet?.toggleCollapse(), disableA11y: true, button: _jsxs("div", { className: "ss__facet__header", ref: (e) => useA11y(e, disableCollapse ? -1 : 0), role: "heading", "aria-level": 3, ...mergedLang.dropdownButton.attributes, children: [_jsxs("span", { className: "ss__facet__header__inner", children: [_jsx("span", { ...mergedLang.dropdownButton.value, children: facet?.label }), showSelectedCount && selectedCount && facet.type !== 'range' ? (_jsx("span", { className: "ss__facet__header__selected-count", children: hideSelectedCountParenthesis ? selectedCount : `(${selectedCount})` })) : null, (mergedLang.clearAllText.value || clearAllIcon) && selectedCount ? (_jsx(Button, { ...subProps.button, internalClassName: "ss__facet__header__clear-all", name: 'reset-facet', onClick: (e) => {
|
|
421
421
|
e.stopPropagation();
|
|
422
|
-
facet?.clear.url
|
|
422
|
+
facet?.clear.url?.link.onClick();
|
|
423
423
|
}, icon: clearAllIcon ? clearAllIcon : undefined, children: mergedLang.clearAllText.value && showClearAllText ? _jsx("label", { ...mergedLang.clearAllText.all }) : null })) : (_jsx(_Fragment, {}))] }), !disableCollapse && (_jsx(Icon, { ...subProps.icon, ...(facet?.collapsed
|
|
424
424
|
? { ...(typeof iconExpand == 'string' ? { icon: iconExpand } : iconExpand) }
|
|
425
425
|
: { ...(typeof iconCollapse == 'string' ? { icon: iconCollapse } : iconCollapse) }), name: facet?.collapsed ? 'expand' : 'collapse' }))] }), children: _jsx(FacetContent, { ...facetContentProps, mergedLang: mergedLang }) })) }) })) : null;
|
|
@@ -237,7 +237,7 @@ export const FacetsHorizontal = observer((properties) => {
|
|
|
237
237
|
}
|
|
238
238
|
}, button: _jsxs("div", { className: "ss__dropdown__button__heading", ...mergedLang.dropdownButton.attributes, children: [_jsxs("div", { className: "ss__facet__header__inner", children: [_jsx("span", { ...mergedLang.dropdownButton.value, children: facet?.label }), showSelectedCount && selectedCount && facet.type !== 'range' ? (_jsx("span", { className: "ss__facet__header__selected-count", children: hideSelectedCountParenthesis ? selectedCount : `(${selectedCount})` })) : null, (mergedLang.clearAllText.value || clearAllIcon) && selectedCount ? (_jsx(Button, { ...subProps.button, internalClassName: "ss__facet__header__clear-all", name: 'reset-facet', onClick: (e) => {
|
|
239
239
|
e.stopPropagation();
|
|
240
|
-
facet?.clear.url
|
|
240
|
+
facet?.clear.url?.link.onClick();
|
|
241
241
|
}, icon: clearAllIcon ? clearAllIcon : undefined, children: mergedLang.clearAllText.value && showClearAllText ? _jsx("label", { ...mergedLang.clearAllText.all }) : null })) : (_jsx(_Fragment, {}))] }), _jsx(Icon, { ...subProps.icon, ...(selectedFacet?.field === facet.field
|
|
242
242
|
? { ...(typeof iconExpand == 'string' ? { icon: iconExpand } : iconExpand) }
|
|
243
243
|
: { ...(typeof iconCollapse == 'string' ? { icon: iconCollapse } : iconCollapse) }) })] }), disableOverlay: false, children: _jsx(Facet, { ...subProps.facet, facet: facet }) }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athoscommerce/snap-preact",
|
|
3
|
-
"version": "1.2.3-beta.
|
|
3
|
+
"version": "1.2.3-beta.4+cf2eeebec",
|
|
4
4
|
"description": "Snap Preact",
|
|
5
5
|
"main": "dist/cjs/src/index.js",
|
|
6
6
|
"module": "dist/esm/src/index.js",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"storybook": "storybook dev -c ./components/.storybook -p 6006"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@athoscommerce/snap-client": "1.2.3-beta.
|
|
30
|
-
"@athoscommerce/snap-controller": "1.2.3-beta.
|
|
31
|
-
"@athoscommerce/snap-event-manager": "1.2.3-beta.
|
|
32
|
-
"@athoscommerce/snap-logger": "1.2.3-beta.
|
|
33
|
-
"@athoscommerce/snap-platforms": "1.2.3-beta.
|
|
34
|
-
"@athoscommerce/snap-profiler": "1.2.3-beta.
|
|
35
|
-
"@athoscommerce/snap-store-mobx": "1.2.3-beta.
|
|
36
|
-
"@athoscommerce/snap-toolbox": "1.2.3-beta.
|
|
37
|
-
"@athoscommerce/snap-tracker": "1.2.3-beta.
|
|
38
|
-
"@athoscommerce/snap-url-manager": "1.2.3-beta.
|
|
29
|
+
"@athoscommerce/snap-client": "1.2.3-beta.4+cf2eeebec",
|
|
30
|
+
"@athoscommerce/snap-controller": "1.2.3-beta.4+cf2eeebec",
|
|
31
|
+
"@athoscommerce/snap-event-manager": "1.2.3-beta.4+cf2eeebec",
|
|
32
|
+
"@athoscommerce/snap-logger": "1.2.3-beta.4+cf2eeebec",
|
|
33
|
+
"@athoscommerce/snap-platforms": "1.2.3-beta.4+cf2eeebec",
|
|
34
|
+
"@athoscommerce/snap-profiler": "1.2.3-beta.4+cf2eeebec",
|
|
35
|
+
"@athoscommerce/snap-store-mobx": "1.2.3-beta.4+cf2eeebec",
|
|
36
|
+
"@athoscommerce/snap-toolbox": "1.2.3-beta.4+cf2eeebec",
|
|
37
|
+
"@athoscommerce/snap-tracker": "1.2.3-beta.4+cf2eeebec",
|
|
38
|
+
"@athoscommerce/snap-url-manager": "1.2.3-beta.4+cf2eeebec",
|
|
39
39
|
"@emotion/react": "11.13.0",
|
|
40
40
|
"classnames": "^2.3.2",
|
|
41
41
|
"color": "^4.2.3",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"require": "./dist/cjs/toolbox/src/index.js"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "cf2eeebec7baf5a7746dcd90c21bccd9a5b15544"
|
|
101
101
|
}
|