@athoscommerce/snap-preact 1.2.3-beta.4 → 1.2.3-beta.6
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/README.md +16 -0
- package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
- package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
- package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -3
- package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +2 -0
- package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +24 -25
- package/dist/cjs/components/src/components/Molecules/Filter/Filter.d.ts +1 -1
- package/dist/cjs/components/src/components/Molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/Result/Result.js +11 -6
- package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts +4 -1
- package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.js +3 -3
- package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
- package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.js +31 -31
- package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -36
- package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts +7 -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 +638 -431
- package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.js +4 -3
- package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts +3 -1
- package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/MessageText.js +22 -19
- package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts +3 -1
- package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.js +39 -21
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +7 -11
- package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
- package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +461 -0
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
- package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.js +17 -0
- package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
- package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
- package/dist/cjs/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
- package/dist/cjs/components/src/hooks/useAcRenderedInput.js +65 -15
- package/dist/cjs/components/src/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/cjs/components/src/hooks/useMediaQuery.js +3 -1
- package/dist/cjs/components/src/index.d.ts +1 -0
- package/dist/cjs/components/src/index.d.ts.map +1 -1
- package/dist/cjs/components/src/index.js +1 -0
- package/dist/cjs/components/src/providers/theme.d.ts +1 -1
- package/dist/cjs/components/src/providers/theme.d.ts.map +1 -1
- package/dist/cjs/components/src/themes/base/base.js +3 -3
- package/dist/cjs/components/src/utilities/Colour/Colour.d.ts +11 -0
- package/dist/cjs/components/src/utilities/Colour/Colour.d.ts.map +1 -1
- package/dist/cjs/components/src/utilities/Colour/Colour.js +32 -0
- package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts +3 -1
- package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
- package/dist/cjs/src/Instantiators/RecommendationInstantiator.js +162 -123
- package/dist/cjs/src/Snap.d.ts +1 -1
- package/dist/cjs/src/Snap.d.ts.map +1 -1
- package/dist/cjs/src/Snap.js +18 -6
- package/dist/cjs/src/SnapHybrid.d.ts.map +1 -1
- package/dist/cjs/src/Templates/SnapTemplates.d.ts +13 -72
- package/dist/cjs/src/Templates/SnapTemplates.d.ts.map +1 -1
- package/dist/cjs/src/Templates/SnapTemplates.js +123 -72
- package/dist/cjs/src/Templates/Stores/TargetStore.d.ts +7 -6
- package/dist/cjs/src/Templates/Stores/TargetStore.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TargetStore.js +14 -8
- package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
- package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +467 -96
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +123 -70
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +86 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +33 -14
- package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts +93 -30
- package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/TemplateStore.js +33 -41
- package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts +2 -8
- package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
- package/dist/cjs/src/Templates/Stores/ThemeStore.js +3 -28
- package/dist/cjs/src/Templates/index.d.ts +1 -1
- package/dist/cjs/src/Templates/index.d.ts.map +1 -1
- package/dist/cjs/src/create/createChatController.js +1 -1
- package/dist/cjs/src/index.d.ts +1 -0
- package/dist/cjs/src/index.d.ts.map +1 -1
- package/dist/cjs/src/setupEvents.d.ts +13 -0
- package/dist/cjs/src/setupEvents.d.ts.map +1 -1
- package/dist/cjs/src/setupEvents.js +56 -8
- package/dist/cjs/src/types.d.ts +3 -1
- package/dist/cjs/src/types.d.ts.map +1 -1
- package/dist/cjs/src/utils/combineMerge.d.ts +2 -0
- package/dist/cjs/src/utils/combineMerge.d.ts.map +1 -0
- package/dist/cjs/src/utils/combineMerge.js +22 -0
- package/dist/cjs/src/utils/index.d.ts +1 -0
- package/dist/cjs/src/utils/index.d.ts.map +1 -1
- package/dist/cjs/src/utils/index.js +3 -1
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
- package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
- package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +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 +3 -3
- package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +2 -0
- package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +24 -26
- package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts +1 -1
- package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/Result/Result.js +9 -4
- package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts +4 -1
- package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.js +3 -3
- package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
- package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.js +29 -29
- package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
- package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -35
- package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +7 -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 +557 -359
- package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +4 -3
- package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts +3 -1
- package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/MessageText.js +21 -19
- package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts +3 -1
- package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +36 -21
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +7 -11
- package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
- package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
- package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
- package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
- package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +436 -0
- package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
- package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
- package/dist/esm/components/src/components/Organisms/ProductQuickView/index.js +1 -0
- package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
- package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
- package/dist/esm/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
- package/dist/esm/components/src/hooks/useAcRenderedInput.js +61 -11
- package/dist/esm/components/src/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/esm/components/src/hooks/useMediaQuery.js +3 -1
- package/dist/esm/components/src/index.d.ts +1 -0
- package/dist/esm/components/src/index.d.ts.map +1 -1
- package/dist/esm/components/src/index.js +1 -0
- package/dist/esm/components/src/providers/theme.d.ts +1 -1
- package/dist/esm/components/src/providers/theme.d.ts.map +1 -1
- package/dist/esm/components/src/themes/base/base.js +3 -3
- package/dist/esm/components/src/utilities/Colour/Colour.d.ts +11 -0
- package/dist/esm/components/src/utilities/Colour/Colour.d.ts.map +1 -1
- package/dist/esm/components/src/utilities/Colour/Colour.js +30 -0
- package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts +3 -1
- package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
- package/dist/esm/src/Instantiators/RecommendationInstantiator.js +131 -84
- package/dist/esm/src/Snap.d.ts +1 -1
- package/dist/esm/src/Snap.d.ts.map +1 -1
- package/dist/esm/src/Snap.js +21 -6
- package/dist/esm/src/SnapHybrid.d.ts.map +1 -1
- package/dist/esm/src/Templates/SnapTemplates.d.ts +13 -72
- package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
- package/dist/esm/src/Templates/SnapTemplates.js +137 -78
- package/dist/esm/src/Templates/Stores/TargetStore.d.ts +7 -6
- package/dist/esm/src/Templates/Stores/TargetStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TargetStore.js +14 -8
- package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
- package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +447 -89
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +118 -66
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +82 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +27 -8
- package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +93 -30
- package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/TemplateStore.js +29 -38
- package/dist/esm/src/Templates/Stores/ThemeStore.d.ts +2 -8
- package/dist/esm/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
- package/dist/esm/src/Templates/Stores/ThemeStore.js +3 -26
- package/dist/esm/src/Templates/index.d.ts +1 -1
- package/dist/esm/src/Templates/index.d.ts.map +1 -1
- package/dist/esm/src/create/createChatController.js +1 -1
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/setupEvents.d.ts +13 -0
- package/dist/esm/src/setupEvents.d.ts.map +1 -1
- package/dist/esm/src/setupEvents.js +25 -8
- package/dist/esm/src/types.d.ts +3 -1
- package/dist/esm/src/types.d.ts.map +1 -1
- package/dist/esm/src/utils/combineMerge.d.ts +2 -0
- package/dist/esm/src/utils/combineMerge.d.ts.map +1 -0
- package/dist/esm/src/utils/combineMerge.js +16 -0
- package/dist/esm/src/utils/index.d.ts +1 -0
- package/dist/esm/src/utils/index.d.ts.map +1 -1
- package/dist/esm/src/utils/index.js +1 -0
- package/package.json +20 -14
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'preact/hooks';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import { Overlay } from '../../Atoms/Overlay';
|
|
7
|
+
import { Image } from '../../Atoms/Image';
|
|
8
|
+
import { Button } from '../../Atoms/Button';
|
|
9
|
+
import { Price } from '../../Atoms/Price';
|
|
10
|
+
import { Icon } from '../../Atoms/Icon';
|
|
11
|
+
import { useTheme, useTreePath } from '../../../providers';
|
|
12
|
+
import { mergeProps, mergeStyles } from '../../../utilities';
|
|
13
|
+
// Fields that have dedicated rendering on the product card; skip them in the info table.
|
|
14
|
+
const CARD_FIELDS = new Set([
|
|
15
|
+
'name',
|
|
16
|
+
'brand',
|
|
17
|
+
'price',
|
|
18
|
+
'msrp',
|
|
19
|
+
'imageUrl',
|
|
20
|
+
'thumbnailImageUrl',
|
|
21
|
+
'secureImageUrl',
|
|
22
|
+
'secureThumbnailImageUrl',
|
|
23
|
+
'url',
|
|
24
|
+
'addToCartUrl',
|
|
25
|
+
'uid',
|
|
26
|
+
'sku',
|
|
27
|
+
'parentId',
|
|
28
|
+
'parentImageUrl',
|
|
29
|
+
'description',
|
|
30
|
+
'caption',
|
|
31
|
+
'popularity',
|
|
32
|
+
'stockMessage',
|
|
33
|
+
]);
|
|
34
|
+
// Preferred ordering for the structured info table — anything else is appended after.
|
|
35
|
+
const PREFERRED_INFO_ORDER = ['material', 'fit', 'color', 'sizes', 'size', 'category', 'rating', 'availability'];
|
|
36
|
+
const FEATURE_KEYS = ['features', 'feature_list', 'productFeatures', 'product_features', 'highlights'];
|
|
37
|
+
const formatLabel = (key) => {
|
|
38
|
+
return key
|
|
39
|
+
.replace(/[_-]+/g, ' ')
|
|
40
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
41
|
+
.trim();
|
|
42
|
+
};
|
|
43
|
+
const stripHtml = (str) => str.replace(/<[^>]*>/g, '');
|
|
44
|
+
const formatValue = (value) => {
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
return stripHtml(value.filter((v) => v != null && v !== '').join(', '));
|
|
47
|
+
}
|
|
48
|
+
if (value == null)
|
|
49
|
+
return '';
|
|
50
|
+
// Upstream sometimes ships array fields as JSON-encoded strings (e.g. `'["VersaWearCo"]'`).
|
|
51
|
+
// Detect and unwrap before stringifying so the raw brackets/quotes don't leak into the UI.
|
|
52
|
+
if (typeof value === 'string') {
|
|
53
|
+
const trimmed = value.trim();
|
|
54
|
+
if ((trimmed.startsWith('[') && trimmed.endsWith(']')) || (trimmed.startsWith('{') && trimmed.endsWith('}'))) {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(trimmed);
|
|
57
|
+
if (Array.isArray(parsed)) {
|
|
58
|
+
return stripHtml(parsed.filter((v) => v != null && v !== '').join(', '));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// fall through — value wasn't valid JSON, just treat it as a string
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return stripHtml(String(value));
|
|
67
|
+
};
|
|
68
|
+
const collectFeatures = (display) => {
|
|
69
|
+
const attributes = display?.attributes || {};
|
|
70
|
+
for (const key of FEATURE_KEYS) {
|
|
71
|
+
const raw = attributes[key];
|
|
72
|
+
if (Array.isArray(raw) && raw.length > 0) {
|
|
73
|
+
return raw.map((v) => String(v)).filter(Boolean);
|
|
74
|
+
}
|
|
75
|
+
if (typeof raw === 'string' && raw.trim()) {
|
|
76
|
+
return raw
|
|
77
|
+
.split(/\r?\n|,/)
|
|
78
|
+
.map((v) => v.trim())
|
|
79
|
+
.filter(Boolean);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return [];
|
|
83
|
+
};
|
|
84
|
+
const collectInfoRows = (display, displayFields) => {
|
|
85
|
+
const core = display?.mappings?.core || {};
|
|
86
|
+
const attributes = display?.attributes || {};
|
|
87
|
+
const filterByDisplayFields = displayFields && displayFields.length > 0;
|
|
88
|
+
const displayFieldsLower = filterByDisplayFields ? displayFields.map((f) => f.toLowerCase()) : [];
|
|
89
|
+
const merged = {};
|
|
90
|
+
// When displayFields is specified, include matching core fields that are normally skipped.
|
|
91
|
+
if (filterByDisplayFields) {
|
|
92
|
+
Object.entries(core).forEach(([key, value]) => {
|
|
93
|
+
if (displayFieldsLower.includes(key.toLowerCase()) && value != null) {
|
|
94
|
+
merged[key] = value;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// Pull selected core fields (rating + availability) regardless.
|
|
99
|
+
if (core.rating != null) {
|
|
100
|
+
const rating = core.rating;
|
|
101
|
+
const ratingCount = core.ratingCount;
|
|
102
|
+
merged.rating = ratingCount ? `${rating}/5.0 (${ratingCount} reviews)` : `${rating}/5.0`;
|
|
103
|
+
}
|
|
104
|
+
if (core.available != null) {
|
|
105
|
+
merged.availability = core.available ? 'In Stock' : 'Out of Stock';
|
|
106
|
+
}
|
|
107
|
+
// Merge product attributes, skipping ones already shown on the card and the feature lists.
|
|
108
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
109
|
+
if (!filterByDisplayFields && CARD_FIELDS.has(key))
|
|
110
|
+
return;
|
|
111
|
+
if (FEATURE_KEYS.includes(key))
|
|
112
|
+
return;
|
|
113
|
+
const formatted = formatValue(value);
|
|
114
|
+
if (!formatted)
|
|
115
|
+
return;
|
|
116
|
+
merged[key] = formatted;
|
|
117
|
+
});
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
const ordered = [];
|
|
120
|
+
PREFERRED_INFO_ORDER.forEach((preferred) => {
|
|
121
|
+
const match = Object.keys(merged).find((k) => k.toLowerCase() === preferred);
|
|
122
|
+
if (match && !seen.has(match)) {
|
|
123
|
+
seen.add(match);
|
|
124
|
+
ordered.push({ key: match, rawKey: match, label: formatLabel(match), value: formatValue(merged[match]) });
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
Object.keys(merged).forEach((key) => {
|
|
128
|
+
if (seen.has(key))
|
|
129
|
+
return;
|
|
130
|
+
seen.add(key);
|
|
131
|
+
ordered.push({ key, rawKey: key, label: formatLabel(key), value: formatValue(merged[key]) });
|
|
132
|
+
});
|
|
133
|
+
if (filterByDisplayFields) {
|
|
134
|
+
const filtered = ordered.filter((row) => displayFieldsLower.includes(row.rawKey.toLowerCase()));
|
|
135
|
+
filtered.sort((a, b) => displayFieldsLower.indexOf(a.rawKey.toLowerCase()) - displayFieldsLower.indexOf(b.rawKey.toLowerCase()));
|
|
136
|
+
return filtered;
|
|
137
|
+
}
|
|
138
|
+
return ordered;
|
|
139
|
+
};
|
|
140
|
+
const defaultStyles = () => {
|
|
141
|
+
return css({
|
|
142
|
+
// Fixed viewport-level wrapper that hosts both the backdrop and the centered panel.
|
|
143
|
+
position: 'fixed',
|
|
144
|
+
inset: 0,
|
|
145
|
+
zIndex: 10004,
|
|
146
|
+
display: 'flex',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
justifyContent: 'center',
|
|
149
|
+
'.ss__product-quick-view__panel': {
|
|
150
|
+
background: '#fff',
|
|
151
|
+
borderRadius: '8px',
|
|
152
|
+
padding: '1.5em',
|
|
153
|
+
maxWidth: '760px',
|
|
154
|
+
width: '90vw',
|
|
155
|
+
maxHeight: '85vh',
|
|
156
|
+
overflowY: 'auto',
|
|
157
|
+
position: 'relative',
|
|
158
|
+
boxShadow: '0 10px 40px rgba(0, 0, 0, 0.2)',
|
|
159
|
+
zIndex: 10004,
|
|
160
|
+
display: 'flex',
|
|
161
|
+
flexDirection: 'column',
|
|
162
|
+
gap: '1em',
|
|
163
|
+
},
|
|
164
|
+
'.ss__product-quick-view__close': {
|
|
165
|
+
position: 'absolute',
|
|
166
|
+
top: '0.75em',
|
|
167
|
+
right: '0.75em',
|
|
168
|
+
cursor: 'pointer',
|
|
169
|
+
padding: '4px',
|
|
170
|
+
zIndex: 1,
|
|
171
|
+
},
|
|
172
|
+
'.ss__product-quick-view__error': {
|
|
173
|
+
padding: '0.75em 1em',
|
|
174
|
+
background: '#fee',
|
|
175
|
+
color: '#a00',
|
|
176
|
+
borderRadius: '4px',
|
|
177
|
+
},
|
|
178
|
+
'.ss__product-quick-view__loading': {
|
|
179
|
+
padding: '2em',
|
|
180
|
+
textAlign: 'center',
|
|
181
|
+
color: '#6A7282',
|
|
182
|
+
},
|
|
183
|
+
'.ss__product-quick-view__body': {
|
|
184
|
+
display: 'flex',
|
|
185
|
+
gap: '1.5em',
|
|
186
|
+
alignItems: 'flex-start',
|
|
187
|
+
flexWrap: 'wrap',
|
|
188
|
+
},
|
|
189
|
+
'.ss__product-quick-view__left': {
|
|
190
|
+
flex: '0 0 auto',
|
|
191
|
+
width: '40%',
|
|
192
|
+
maxWidth: '280px',
|
|
193
|
+
minWidth: '180px',
|
|
194
|
+
display: 'flex',
|
|
195
|
+
flexDirection: 'column',
|
|
196
|
+
gap: '0.75em',
|
|
197
|
+
// On narrow viewports the body wraps to stack vertically — let the image column
|
|
198
|
+
// stretch full-width so the image doesn't sit awkwardly at a fixed 40%/280px.
|
|
199
|
+
// The flex wraps once the panel can't fit the 280px left + gap + 320px right basis,
|
|
200
|
+
// which lands around a 680px viewport given the 90vw panel and 1.5em padding.
|
|
201
|
+
'@media (max-width: 700px)': {
|
|
202
|
+
width: '100%',
|
|
203
|
+
maxWidth: 'none',
|
|
204
|
+
minWidth: 0,
|
|
205
|
+
},
|
|
206
|
+
'.ss__product-quick-view__left__image': {
|
|
207
|
+
width: '100%',
|
|
208
|
+
objectFit: 'contain',
|
|
209
|
+
borderRadius: '0.33em',
|
|
210
|
+
overflow: 'hidden',
|
|
211
|
+
},
|
|
212
|
+
'.ss__product-quick-view__left__actions': {
|
|
213
|
+
display: 'flex',
|
|
214
|
+
flexDirection: 'column',
|
|
215
|
+
gap: '0.5em',
|
|
216
|
+
'.ss__product-quick-view__left__actions__go-to-product': {
|
|
217
|
+
textAlign: 'center',
|
|
218
|
+
a: {
|
|
219
|
+
fontSize: '1em',
|
|
220
|
+
textDecoration: 'underline',
|
|
221
|
+
cursor: 'pointer',
|
|
222
|
+
color: '#374151',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
'.ss__product-quick-view__left__actions__add-to-cart .ss__button': {
|
|
226
|
+
width: '100%',
|
|
227
|
+
// Center the button text — the Button atom defaults to inline-flex with
|
|
228
|
+
// alignItems:center only, so longer labels would otherwise stay left-aligned.
|
|
229
|
+
justifyContent: 'center',
|
|
230
|
+
textAlign: 'center',
|
|
231
|
+
background: '#253B80',
|
|
232
|
+
color: '#fff',
|
|
233
|
+
border: '1px solid #253B80',
|
|
234
|
+
fontWeight: 'bold',
|
|
235
|
+
padding: '0.6em 0.75em',
|
|
236
|
+
'&:not(.ss__button--disabled):hover': {
|
|
237
|
+
background: '#1e3068',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
'.ss__product-quick-view__right': {
|
|
243
|
+
flex: '1 1 320px',
|
|
244
|
+
minWidth: 0,
|
|
245
|
+
display: 'flex',
|
|
246
|
+
flexDirection: 'column',
|
|
247
|
+
gap: '1em',
|
|
248
|
+
'.ss__product-quick-view__title': {
|
|
249
|
+
display: 'flex',
|
|
250
|
+
flexDirection: 'column',
|
|
251
|
+
gap: '0.25em',
|
|
252
|
+
'.ss__product-quick-view__title__name': {
|
|
253
|
+
fontWeight: 'bold',
|
|
254
|
+
fontSize: '1.25em',
|
|
255
|
+
lineHeight: 1.3,
|
|
256
|
+
a: { color: 'inherit', textDecoration: 'none', '&:hover': { textDecoration: 'underline' } },
|
|
257
|
+
},
|
|
258
|
+
'.ss__product-quick-view__title__brand': {
|
|
259
|
+
fontSize: '0.9em',
|
|
260
|
+
color: '#6A7282',
|
|
261
|
+
},
|
|
262
|
+
'.ss__product-quick-view__title__price': {
|
|
263
|
+
fontWeight: 'bold',
|
|
264
|
+
fontSize: '1.15em',
|
|
265
|
+
display: 'flex',
|
|
266
|
+
gap: '0.5em',
|
|
267
|
+
alignItems: 'center',
|
|
268
|
+
marginTop: '0.25em',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
'.ss__product-quick-view__variants': {
|
|
273
|
+
'.ss__product-quick-view__variants__label': {
|
|
274
|
+
fontWeight: 600,
|
|
275
|
+
fontSize: '0.9em',
|
|
276
|
+
color: '#374151',
|
|
277
|
+
textTransform: 'uppercase',
|
|
278
|
+
marginBottom: '0.5em',
|
|
279
|
+
},
|
|
280
|
+
'.ss__product-quick-view__variants__swatches': {
|
|
281
|
+
display: 'flex',
|
|
282
|
+
flexWrap: 'wrap',
|
|
283
|
+
gap: '0.5em',
|
|
284
|
+
'.ss__product-quick-view__variants__swatch': {
|
|
285
|
+
display: 'flex',
|
|
286
|
+
flexDirection: 'column',
|
|
287
|
+
alignItems: 'center',
|
|
288
|
+
gap: '0.25em',
|
|
289
|
+
cursor: 'pointer',
|
|
290
|
+
padding: '0.25em',
|
|
291
|
+
borderRadius: '0.5em',
|
|
292
|
+
border: '2px solid transparent',
|
|
293
|
+
transition: 'border-color 0.15s ease',
|
|
294
|
+
'&:hover': { borderColor: '#253B80' },
|
|
295
|
+
'&.ss__product-quick-view__variants__swatch--selected': {
|
|
296
|
+
borderColor: '#253B80',
|
|
297
|
+
borderWidth: '3px',
|
|
298
|
+
padding: '0.15em',
|
|
299
|
+
},
|
|
300
|
+
'&.ss__product-quick-view__variants__swatch--unavailable': {
|
|
301
|
+
opacity: 0.4,
|
|
302
|
+
},
|
|
303
|
+
'.ss__product-quick-view__variants__swatch__image': {
|
|
304
|
+
width: '48px',
|
|
305
|
+
height: '48px',
|
|
306
|
+
objectFit: 'cover',
|
|
307
|
+
borderRadius: '50%',
|
|
308
|
+
border: '1px solid #E5E7EB',
|
|
309
|
+
},
|
|
310
|
+
'.ss__product-quick-view__variants__swatch__value': {
|
|
311
|
+
fontSize: '0.75em',
|
|
312
|
+
color: '#374151',
|
|
313
|
+
textAlign: 'center',
|
|
314
|
+
maxWidth: '60px',
|
|
315
|
+
overflow: 'hidden',
|
|
316
|
+
textOverflow: 'ellipsis',
|
|
317
|
+
whiteSpace: 'nowrap',
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
'.ss__product-quick-view__section': {
|
|
323
|
+
'.ss__product-quick-view__section__title': {
|
|
324
|
+
fontWeight: 600,
|
|
325
|
+
fontSize: '0.9em',
|
|
326
|
+
color: '#374151',
|
|
327
|
+
marginBottom: '0.4em',
|
|
328
|
+
},
|
|
329
|
+
'.ss__product-quick-view__section__table': {
|
|
330
|
+
width: '100%',
|
|
331
|
+
borderCollapse: 'collapse',
|
|
332
|
+
fontSize: '0.9em',
|
|
333
|
+
tr: {
|
|
334
|
+
borderBottom: '1px solid #E5E7EB',
|
|
335
|
+
},
|
|
336
|
+
td: {
|
|
337
|
+
padding: '0.4em 0',
|
|
338
|
+
verticalAlign: 'top',
|
|
339
|
+
wordBreak: 'break-word',
|
|
340
|
+
overflowWrap: 'anywhere',
|
|
341
|
+
},
|
|
342
|
+
'td:first-of-type': {
|
|
343
|
+
color: '#6A7282',
|
|
344
|
+
width: '40%',
|
|
345
|
+
},
|
|
346
|
+
'td:last-of-type': {
|
|
347
|
+
textAlign: 'right',
|
|
348
|
+
color: '#374151',
|
|
349
|
+
},
|
|
350
|
+
'.ss__product-quick-view__section__table__availability--in-stock': {
|
|
351
|
+
color: '#10B981',
|
|
352
|
+
},
|
|
353
|
+
'.ss__product-quick-view__section__table__availability--out-of-stock': {
|
|
354
|
+
color: '#DC2626',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
'.ss__product-quick-view__section__description': {
|
|
358
|
+
fontSize: '0.9em',
|
|
359
|
+
color: '#374151',
|
|
360
|
+
lineHeight: 1.5,
|
|
361
|
+
},
|
|
362
|
+
'.ss__product-quick-view__section__features': {
|
|
363
|
+
margin: 0,
|
|
364
|
+
padding: '0 0 0 1.25em',
|
|
365
|
+
fontSize: '0.9em',
|
|
366
|
+
listStyle: 'disc',
|
|
367
|
+
li: {
|
|
368
|
+
padding: '0.2em 0',
|
|
369
|
+
color: '#374151',
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
export const ProductQuickView = observer((properties) => {
|
|
376
|
+
const globalTheme = useTheme();
|
|
377
|
+
const globalTreePath = useTreePath();
|
|
378
|
+
const defaultProps = {
|
|
379
|
+
treePath: globalTreePath,
|
|
380
|
+
};
|
|
381
|
+
const props = mergeProps('productQuickView', globalTheme, defaultProps, properties);
|
|
382
|
+
const { controller, displayFields, className, internalClassName } = props;
|
|
383
|
+
const store = controller?.store?.productQuickView;
|
|
384
|
+
if (!store)
|
|
385
|
+
return null;
|
|
386
|
+
const product = store.product;
|
|
387
|
+
const error = store.error;
|
|
388
|
+
const loading = store.loading;
|
|
389
|
+
const open = product !== null;
|
|
390
|
+
const close = () => store.clear();
|
|
391
|
+
const styling = mergeStyles(props, defaultStyles);
|
|
392
|
+
// Lock body scroll while the quickview is open.
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
if (!open)
|
|
395
|
+
return;
|
|
396
|
+
const previousOverflow = document.body.style.overflow;
|
|
397
|
+
document.body.style.overflow = 'hidden';
|
|
398
|
+
return () => {
|
|
399
|
+
document.body.style.overflow = previousOverflow;
|
|
400
|
+
};
|
|
401
|
+
}, [open]);
|
|
402
|
+
if (!open)
|
|
403
|
+
return null;
|
|
404
|
+
return (_jsxs("div", { className: classnames('ss__product-quick-view', className, internalClassName), ...styling, children: [_jsx(Overlay, { active: true, color: "rgba(0,0,0,0.7)", onClick: close }), _jsxs("div", { className: "ss__product-quick-view__panel", children: [_jsx("div", { className: "ss__product-quick-view__close", onClick: close, role: "button", "aria-label": "Close", children: _jsx(Icon, { icon: "close-thin", size: "16px" }) }), product ? (_jsx(ProductQuickViewBody, { product: product, loading: loading, error: error, controller: controller, displayFields: displayFields })) : (_jsx("div", { className: "ss__product-quick-view__loading", children: "Loading..." }))] })] }));
|
|
405
|
+
});
|
|
406
|
+
const ProductQuickViewBody = observer((props) => {
|
|
407
|
+
const { product, loading, error, controller, displayFields } = props;
|
|
408
|
+
const displayed = product.display;
|
|
409
|
+
const displayedCore = displayed.mappings?.core || {};
|
|
410
|
+
const variants = product.variants;
|
|
411
|
+
const selections = variants?.selections || [];
|
|
412
|
+
const displayedData = {
|
|
413
|
+
mappings: displayed.mappings,
|
|
414
|
+
attributes: displayed.attributes || {},
|
|
415
|
+
};
|
|
416
|
+
const allInfoRows = collectInfoRows(displayedData, displayFields);
|
|
417
|
+
const descriptionRow = allInfoRows.find((row) => row.rawKey.toLowerCase() === 'description');
|
|
418
|
+
const infoRows = allInfoRows.filter((row) => row.rawKey.toLowerCase() !== 'description');
|
|
419
|
+
const features = collectFeatures(displayedData);
|
|
420
|
+
// `addToCart` exists on Recommendation/Chat controllers but not on Search/Autocomplete.
|
|
421
|
+
const supportsAddToCart = typeof controller?.addToCart === 'function';
|
|
422
|
+
return (_jsxs("div", { children: [error && _jsx("div", { className: "ss__product-quick-view__error", children: error }), _jsxs("div", { className: "ss__product-quick-view__body", children: [_jsxs("div", { className: "ss__product-quick-view__left", children: [displayedCore.imageUrl ? (_jsx(Image, { className: "ss__product-quick-view__left__image", src: displayedCore.imageUrl, alt: displayedCore.name || '' })) : null, _jsxs("div", { className: "ss__product-quick-view__left__actions", children: [supportsAddToCart && (_jsx("div", { className: "ss__product-quick-view__left__actions__add-to-cart", children: _jsx(Button, { content: 'Add to Cart', onClick: () => {
|
|
423
|
+
controller?.track?.product?.addToCart?.(product);
|
|
424
|
+
controller.addToCart(product);
|
|
425
|
+
} }) })), displayedCore.url && (_jsx("div", { className: "ss__product-quick-view__left__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" }) }))] })] }), _jsxs("div", { className: "ss__product-quick-view__right", children: [_jsxs("div", { className: "ss__product-quick-view__title", children: [displayedCore.name && (_jsx("div", { className: "ss__product-quick-view__title__name", children: displayedCore.url ? (_jsx("a", { href: displayedCore.url, onClick: (e) => controller?.track?.product?.click?.(e, product), target: "_blank", rel: "noopener noreferrer", children: formatValue(displayedCore.name) })) : (formatValue(displayedCore.name)) })), displayedCore.brand != null && formatValue(displayedCore.brand) && (_jsx("div", { className: "ss__product-quick-view__title__brand", children: formatValue(displayedCore.brand) })), displayedCore.price != null && (_jsxs("div", { className: "ss__product-quick-view__title__price", children: [displayedCore.msrp != null && Number(displayedCore.msrp) > Number(displayedCore.price) && (_jsx(Price, { value: displayedCore.msrp, lineThrough: true })), _jsx(Price, { value: displayedCore.price })] }))] }), selections.length > 0 && (_jsx("div", { className: "ss__product-quick-view__variants", children: selections.map((selection) => (_jsxs("div", { children: [_jsxs("div", { className: "ss__product-quick-view__variants__label", children: [formatLabel(selection.field), " (", selection.values.length, ")"] }), _jsx("div", { className: "ss__product-quick-view__variants__swatches", children: selection.values.map((selectionValue) => {
|
|
426
|
+
const isUnavailable = !selectionValue.available;
|
|
427
|
+
const isSelected = selection.selected?.value === selectionValue.value;
|
|
428
|
+
return (_jsxs("div", { className: classnames('ss__product-quick-view__variants__swatch', {
|
|
429
|
+
'ss__product-quick-view__variants__swatch--selected': isSelected,
|
|
430
|
+
'ss__product-quick-view__variants__swatch--unavailable': isUnavailable,
|
|
431
|
+
}), title: selectionValue.value, onClick: () => selection.select(selectionValue.value), children: [selectionValue.thumbnailImageUrl ? (_jsx(Image, { className: "ss__product-quick-view__variants__swatch__image", src: selectionValue.thumbnailImageUrl, alt: selectionValue.value })) : null, _jsx("span", { className: "ss__product-quick-view__variants__swatch__value", children: selectionValue.value })] }, selectionValue.value));
|
|
432
|
+
}) })] }, selection.field))) })), infoRows.length > 0 && (_jsxs("div", { className: "ss__product-quick-view__section", children: [_jsx("div", { className: "ss__product-quick-view__section__title", children: "Product Information" }), _jsx("table", { className: "ss__product-quick-view__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({
|
|
433
|
+
'ss__product-quick-view__section__table__availability--in-stock': row.value === 'In Stock',
|
|
434
|
+
'ss__product-quick-view__section__table__availability--out-of-stock': row.value === 'Out of Stock',
|
|
435
|
+
}), children: row.value === 'In Stock' ? `✓ ${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: "ss__product-quick-view__section", children: [_jsx("div", { className: "ss__product-quick-view__section__title", children: "Description" }), _jsx("div", { className: "ss__product-quick-view__section__description", children: descriptionRow.value })] })), features.length > 0 && (_jsxs("div", { className: "ss__product-quick-view__section", children: [_jsx("div", { className: "ss__product-quick-view__section__title", children: "Features" }), _jsx("ul", { className: "ss__product-quick-view__section__features", children: features.map((feature, idx) => (_jsx("li", { children: feature }, idx))) })] })), loading && selections.length === 0 && infoRows.length === 0 && !descriptionRow && features.length === 0 && (_jsx("div", { className: "ss__product-quick-view__loading", children: "Loading product details..." }))] })] })] }));
|
|
436
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/ProductQuickView/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProductQuickView';
|
package/dist/esm/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;
|
|
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;AA4DjG,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"}
|
|
@@ -21,7 +21,6 @@ const defaultStyles = ({ width, height, theme }) => {
|
|
|
21
21
|
right: '0',
|
|
22
22
|
top: '0',
|
|
23
23
|
zIndex: 1001,
|
|
24
|
-
pointerEvents: 'none',
|
|
25
24
|
'& .ss__autocomplete-modal__inner': {
|
|
26
25
|
position: 'absolute',
|
|
27
26
|
left: 0,
|
|
@@ -36,7 +35,6 @@ const defaultStyles = ({ width, height, theme }) => {
|
|
|
36
35
|
width: width,
|
|
37
36
|
height: height,
|
|
38
37
|
maxWidth: '100vw',
|
|
39
|
-
pointerEvents: 'auto',
|
|
40
38
|
},
|
|
41
39
|
'& .ss__overlay': {
|
|
42
40
|
zIndex: 1000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAcRenderedInput.d.ts","sourceRoot":"","sources":["../../../../../components/src/hooks/useAcRenderedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAY,UAAU,EAAa,MAAM,cAAc,CAAC;AAE/D,wBAAgB,kBAAkB,CAAC,EAClC,KAAK,EACL,UAAU,EACV,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,GACT,EAAE;IACF,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,sBAAsB,CAAC;IACnC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACtD,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,
|
|
1
|
+
{"version":3,"file":"useAcRenderedInput.d.ts","sourceRoot":"","sources":["../../../../../components/src/hooks/useAcRenderedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAY,UAAU,EAAa,MAAM,cAAc,CAAC;AAE/D,wBAAgB,kBAAkB,CAAC,EAClC,KAAK,EACL,UAAU,EACV,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,GACT,EAAE;IACF,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,sBAAsB,CAAC;IACnC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACtD,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,kBAkHA"}
|
|
@@ -18,6 +18,12 @@ export function useAcRenderedInput({ input, controller, renderInput, buttonSelec
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
useEffect(() => {
|
|
21
|
+
// track pointer-initiated focus to avoid rendering the overlay between mousedown and mouseup,
|
|
22
|
+
// which splits the click target to the nearest common ancestor instead of the input element
|
|
23
|
+
let pointerFocus = false;
|
|
24
|
+
const clearPointerFocus = () => {
|
|
25
|
+
pointerFocus = false;
|
|
26
|
+
};
|
|
21
27
|
if (renderInput && buttonSelector) {
|
|
22
28
|
let button;
|
|
23
29
|
if (typeof buttonSelector == 'string') {
|
|
@@ -27,31 +33,75 @@ export function useAcRenderedInput({ input, controller, renderInput, buttonSelec
|
|
|
27
33
|
button = buttonSelector;
|
|
28
34
|
}
|
|
29
35
|
if (button) {
|
|
30
|
-
|
|
36
|
+
const onMousedown = () => {
|
|
37
|
+
pointerFocus = true;
|
|
38
|
+
};
|
|
39
|
+
const onClickBtn = (e) => {
|
|
40
|
+
pointerFocus = false;
|
|
31
41
|
e.stopPropagation();
|
|
32
42
|
onClick();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
};
|
|
44
|
+
const onFocusBtn = () => {
|
|
45
|
+
if (!pointerFocus) {
|
|
46
|
+
onClick();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const onSelectBtn = () => onClick();
|
|
50
|
+
button.addEventListener('mousedown', onMousedown);
|
|
51
|
+
document.addEventListener('mouseup', clearPointerFocus, true);
|
|
52
|
+
button.addEventListener('click', onClickBtn);
|
|
53
|
+
button.addEventListener('focus', onFocusBtn);
|
|
54
|
+
button.addEventListener('select', onSelectBtn);
|
|
55
|
+
return () => {
|
|
56
|
+
button.removeEventListener('mousedown', onMousedown);
|
|
57
|
+
document.removeEventListener('mouseup', clearPointerFocus, true);
|
|
58
|
+
button.removeEventListener('click', onClickBtn);
|
|
59
|
+
button.removeEventListener('focus', onFocusBtn);
|
|
60
|
+
button.removeEventListener('select', onSelectBtn);
|
|
61
|
+
};
|
|
36
62
|
}
|
|
37
63
|
}
|
|
38
64
|
else {
|
|
39
65
|
if (setActive) {
|
|
40
|
-
|
|
66
|
+
const onMousedown = () => {
|
|
67
|
+
pointerFocus = true;
|
|
68
|
+
};
|
|
69
|
+
const onClickInput = (e) => {
|
|
70
|
+
pointerFocus = false;
|
|
41
71
|
e.stopPropagation();
|
|
42
72
|
setActive(true);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
};
|
|
74
|
+
const onFocusInput = () => {
|
|
75
|
+
if (!pointerFocus) {
|
|
76
|
+
setActive(true);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const onSelectInput = () => setActive(true);
|
|
80
|
+
input.addEventListener('mousedown', onMousedown);
|
|
81
|
+
document.addEventListener('mouseup', clearPointerFocus, true);
|
|
82
|
+
input.addEventListener('click', onClickInput);
|
|
83
|
+
input.addEventListener('focus', onFocusInput);
|
|
84
|
+
input.addEventListener('select', onSelectInput);
|
|
85
|
+
return () => {
|
|
86
|
+
input.removeEventListener('mousedown', onMousedown);
|
|
87
|
+
document.removeEventListener('mouseup', clearPointerFocus, true);
|
|
88
|
+
input.removeEventListener('click', onClickInput);
|
|
89
|
+
input.removeEventListener('focus', onFocusInput);
|
|
90
|
+
input.removeEventListener('select', onSelectInput);
|
|
91
|
+
};
|
|
46
92
|
}
|
|
47
93
|
}
|
|
48
94
|
}, []);
|
|
49
95
|
// this is used to keep the values consistent between the native input and the rendered input
|
|
50
96
|
useEffect(() => {
|
|
51
|
-
if (input !== _input) {
|
|
52
|
-
|
|
97
|
+
if (input !== _input && _input) {
|
|
98
|
+
const onInput = () => {
|
|
53
99
|
input.value = _input.value;
|
|
54
|
-
}
|
|
100
|
+
};
|
|
101
|
+
_input.addEventListener('input', onInput);
|
|
102
|
+
return () => {
|
|
103
|
+
_input.removeEventListener('input', onInput);
|
|
104
|
+
};
|
|
55
105
|
}
|
|
56
106
|
}, [_input]);
|
|
57
107
|
return _input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../../../../components/src/hooks/useMediaQuery.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../../../../components/src/hooks/useMediaQuery.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAmB/E"}
|
|
@@ -5,12 +5,14 @@ export function useMediaQuery(query, runOnCleanup) {
|
|
|
5
5
|
const mediaQuery = window.matchMedia(query);
|
|
6
6
|
const [match, setMatch] = useState(!!mediaQuery.matches);
|
|
7
7
|
useEffect(() => {
|
|
8
|
+
// sync state immediately in case query changed
|
|
9
|
+
setMatch(!!mediaQuery.matches);
|
|
8
10
|
const handler = () => setMatch(!!mediaQuery.matches);
|
|
9
11
|
mediaQuery.addListener(handler);
|
|
10
12
|
return () => {
|
|
11
13
|
runOnCleanup instanceof Function && runOnCleanup();
|
|
12
14
|
mediaQuery.removeListener(handler);
|
|
13
15
|
};
|
|
14
|
-
}, []);
|
|
16
|
+
}, [query]);
|
|
15
17
|
return match;
|
|
16
18
|
}
|
|
@@ -55,6 +55,7 @@ export * from './components/Organisms/FacetsHorizontal';
|
|
|
55
55
|
export * from './components/Organisms/FilterSummary';
|
|
56
56
|
export * from './components/Organisms/MobileSidebar';
|
|
57
57
|
export * from './components/Organisms/NoResults';
|
|
58
|
+
export * from './components/Organisms/ProductQuickView';
|
|
58
59
|
export * from './components/Organisms/Results';
|
|
59
60
|
export * from './components/Organisms/Sidebar';
|
|
60
61
|
export * from './components/Organisms/Toolbar';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAG5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qC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9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AAGzD,cAAc,SAAS,CAAC;AAGxB,cAAc,qDAAqD,CAAC;AACpE,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACN,aAAa,IAAI,2BAA2B,EAC5C,kBAAkB,IAAI,gCAAgC,GACtD,MAAM,qCAAqC,CAAC;AAG7C,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC"}
|
|
@@ -59,6 +59,7 @@ export * from './components/Organisms/FacetsHorizontal';
|
|
|
59
59
|
export * from './components/Organisms/FilterSummary';
|
|
60
60
|
export * from './components/Organisms/MobileSidebar';
|
|
61
61
|
export * from './components/Organisms/NoResults';
|
|
62
|
+
export * from './components/Organisms/ProductQuickView';
|
|
62
63
|
export * from './components/Organisms/Results';
|
|
63
64
|
export * from './components/Organisms/Sidebar';
|
|
64
65
|
export * from './components/Organisms/Toolbar';
|
|
@@ -53,7 +53,7 @@ export type ThemeResponsiveComplete = ThemeResponsive & {
|
|
|
53
53
|
default?: ThemeComponentsRestricted;
|
|
54
54
|
};
|
|
55
55
|
type WithCustomComponent<T> = {
|
|
56
|
-
[K in keyof T]: T[K] & {
|
|
56
|
+
[K in keyof T]: [unknown] extends [T[K]] ? T[K] : T[K] & {
|
|
57
57
|
customComponent?: string;
|
|
58
58
|
};
|
|
59
59
|
};
|