@searchspring/snap-preact-components 0.40.0 → 0.41.1
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/Molecules/Carousel/Carousel.d.ts +2 -1
- package/dist/cjs/components/Molecules/Carousel/Carousel.d.ts.map +1 -1
- package/dist/cjs/components/Molecules/Carousel/Carousel.js +13 -2
- package/dist/cjs/components/Molecules/Carousel/Carousel.stories.js +3 -3
- package/dist/cjs/components/Organisms/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/cjs/components/Organisms/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/cjs/components/Organisms/Autocomplete/Autocomplete.js +19 -9
- package/dist/cjs/components/Organisms/Recommendation/Recommendation.d.ts.map +1 -1
- package/dist/cjs/components/Organisms/Recommendation/Recommendation.js +10 -48
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.d.ts +10 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.js +51 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.d.ts +94 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.js +106 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/index.d.ts +2 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/index.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/index.js +17 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.d.ts +12 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.js +54 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.d.ts +109 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.js +116 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/index.d.ts +2 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/index.d.ts.map +1 -0
- package/dist/cjs/components/Trackers/Recommendation/ResultTracker/index.js +17 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/esm/components/Molecules/Carousel/Carousel.d.ts +2 -1
- package/dist/esm/components/Molecules/Carousel/Carousel.d.ts.map +1 -1
- package/dist/esm/components/Molecules/Carousel/Carousel.js +16 -2
- package/dist/esm/components/Molecules/Carousel/Carousel.stories.js +3 -3
- package/dist/esm/components/Organisms/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/esm/components/Organisms/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/esm/components/Organisms/Autocomplete/Autocomplete.js +19 -9
- package/dist/esm/components/Organisms/Recommendation/Recommendation.d.ts.map +1 -1
- package/dist/esm/components/Organisms/Recommendation/Recommendation.js +9 -47
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.d.ts +10 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.js +40 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.d.ts +94 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.js +48 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/index.d.ts +2 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/index.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ProfileTracker/index.js +1 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.d.ts +12 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.js +43 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.d.ts +109 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.js +58 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/index.d.ts +2 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/index.d.ts.map +1 -0
- package/dist/esm/components/Trackers/Recommendation/ResultTracker/index.js +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/package.json +11 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import SwiperCore from 'swiper/core';
|
|
3
|
+
import { SwiperOptions } from 'swiper';
|
|
3
4
|
import { ComponentProps, BreakpointsProps } from '../../../types';
|
|
4
5
|
export declare const defaultCarouselBreakpoints: {
|
|
5
6
|
0: {
|
|
@@ -45,7 +46,7 @@ export interface CarouselProps extends ComponentProps {
|
|
|
45
46
|
hideButtons?: boolean;
|
|
46
47
|
loop?: boolean;
|
|
47
48
|
vertical?: boolean;
|
|
48
|
-
pagination?: boolean;
|
|
49
|
+
pagination?: boolean | SwiperOptions['pagination'];
|
|
49
50
|
autoAdjustSlides?: boolean;
|
|
50
51
|
onClick?: (swiper: SwiperCore, e: MouseEvent | TouchEvent | PointerEvent) => void;
|
|
51
52
|
onNextButtonClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/Molecules/Carousel/Carousel.tsx"],"names":[],"mappings":";AAQA,OAAO,UAAsC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/Molecules/Carousel/Carousel.tsx"],"names":[],"mappings":";AAQA,OAAO,UAAsC,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAKvC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AA8H9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BtC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;CAM9C,CAAC;AAEF,eAAO,MAAM,QAAQ,gBAAyB,aAAa,KAAG,WAAW;;CA+JvE,CAAC;AAEH,MAAM,WAAW,aAAc,SAAQ,cAAc;IACpD,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,YAAY,KAAK,IAAI,CAAC;IAClF,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3E,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;CACxB"}
|
|
@@ -235,7 +235,8 @@ exports.Carousel = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
235
235
|
}
|
|
236
236
|
props = __assign(__assign(__assign({}, props), displaySettings), { theme: theme_1 });
|
|
237
237
|
}
|
|
238
|
-
var children = props.children, breakpoints = props.breakpoints, loop = props.loop,
|
|
238
|
+
var children = props.children, breakpoints = props.breakpoints, loop = props.loop, nextButton = props.nextButton, prevButton = props.prevButton, hideButtons = props.hideButtons, vertical = props.vertical, autoAdjustSlides = props.autoAdjustSlides, onInit = props.onInit, onNextButtonClick = props.onNextButtonClick, onPrevButtonClick = props.onPrevButtonClick, onClick = props.onClick, disableStyles = props.disableStyles, style = props.style, modules = props.modules, className = props.className, additionalProps = __rest(props, ["children", "breakpoints", "loop", "nextButton", "prevButton", "hideButtons", "vertical", "autoAdjustSlides", "onInit", "onNextButtonClick", "onPrevButtonClick", "onClick", "disableStyles", "style", "modules", "className"]);
|
|
239
|
+
var pagination = props.pagination;
|
|
239
240
|
var subProps = {
|
|
240
241
|
icon: __assign(__assign(__assign({
|
|
241
242
|
// default props
|
|
@@ -259,6 +260,16 @@ exports.Carousel = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
259
260
|
else if (style) {
|
|
260
261
|
styling.css = [style];
|
|
261
262
|
}
|
|
263
|
+
if (pagination) {
|
|
264
|
+
if (typeof pagination == 'object') {
|
|
265
|
+
pagination = __assign({ clickable: true }, pagination);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
pagination = {
|
|
269
|
+
clickable: true,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
262
273
|
return (children === null || children === void 0 ? void 0 : children.length) ? ((0, react_1.jsx)(providers_1.CacheProvider, null,
|
|
263
274
|
(0, react_1.jsx)("div", __assign({ ref: rootComponentRef }, styling, { className: (0, classnames_1.default)('ss__carousel', vertical ? 'ss__carousel-vertical' : '', className) }),
|
|
264
275
|
(0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__carousel__prev-wrapper', { 'ss__carousel__prev-wrapper--hidden': hideButtons }) },
|
|
@@ -273,7 +284,7 @@ exports.Carousel = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
273
284
|
}
|
|
274
285
|
}, onClick: function (swiper, e) {
|
|
275
286
|
onClick && onClick(swiper, e);
|
|
276
|
-
}, direction: vertical ? 'vertical' : 'horizontal', loop: loop, threshold: 7 }, additionalProps, displaySettings, { pagination: pagination
|
|
287
|
+
}, direction: vertical ? 'vertical' : 'horizontal', loop: loop, threshold: 7 }, additionalProps, displaySettings, { pagination: pagination }), children.map(function (child) {
|
|
277
288
|
return (0, react_1.jsx)(react_2.SwiperSlide, null, child);
|
|
278
289
|
})),
|
|
279
290
|
(0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__carousel__next-wrapper', { 'ss__carousel__next-wrapper--hidden': hideButtons }) },
|
|
@@ -50,14 +50,14 @@ exports.default = {
|
|
|
50
50
|
control: { type: 'boolean' },
|
|
51
51
|
}, pagination: {
|
|
52
52
|
defaultValue: false,
|
|
53
|
-
description: '
|
|
53
|
+
description: 'Configuration for pagination dots',
|
|
54
54
|
table: {
|
|
55
55
|
type: {
|
|
56
|
-
summary: 'boolean',
|
|
56
|
+
summary: 'boolean | SwiperOptions.pagination',
|
|
57
57
|
},
|
|
58
58
|
defaultValue: { summary: false },
|
|
59
59
|
},
|
|
60
|
-
control: { type: 'boolean' },
|
|
60
|
+
control: { type: 'boolean | SwiperOptions.pagination' },
|
|
61
61
|
}, vertical: {
|
|
62
62
|
defaultValue: false,
|
|
63
63
|
description: 'Carousel vertical slide direction',
|
|
@@ -32,7 +32,7 @@ export interface AutocompleteProps extends ComponentProps {
|
|
|
32
32
|
linkSlot?: JSX.Element;
|
|
33
33
|
breakpoints?: BreakpointsProps;
|
|
34
34
|
width?: string;
|
|
35
|
-
onFacetOptionClick?: (e: React.MouseEvent<
|
|
36
|
-
onTermClick?: (e: React.MouseEvent<
|
|
35
|
+
onFacetOptionClick?: (e: React.MouseEvent<Element, MouseEvent>) => void;
|
|
36
|
+
onTermClick?: (e: React.MouseEvent<Element, MouseEvent>) => void;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=Autocomplete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/Organisms/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAS5E,OAAO,EAAE,cAAc,EAAgB,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAqJ5F,eAAO,MAAM,YAAY,gBAAyB,iBAAiB,KAAG,WAAW;;
|
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/components/Organisms/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAS5E,OAAO,EAAE,cAAc,EAAgB,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAqJ5F,eAAO,MAAM,YAAY,gBAAyB,iBAAiB,KAAG,WAAW;;CAqd/E,CAAC;AAoCH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACxD,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,UAAU,EAAE,sBAAsB,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACxE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CACjE"}
|
|
@@ -194,6 +194,16 @@ exports.Autocomplete = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
194
194
|
clearTimeout(delayTimeout);
|
|
195
195
|
},
|
|
196
196
|
};
|
|
197
|
+
var facetClickEvent = function (e) {
|
|
198
|
+
properties.onFacetOptionClick && properties.onFacetOptionClick(e);
|
|
199
|
+
// remove focus from input (close the autocomplete)
|
|
200
|
+
(controller === null || controller === void 0 ? void 0 : controller.setFocused) && (controller === null || controller === void 0 ? void 0 : controller.setFocused());
|
|
201
|
+
};
|
|
202
|
+
var termClickEvent = function (e) {
|
|
203
|
+
properties.onTermClick && properties.onTermClick(e);
|
|
204
|
+
// remove focus from input (close the autocomplete)
|
|
205
|
+
(controller === null || controller === void 0 ? void 0 : controller.setFocused) && (controller === null || controller === void 0 ? void 0 : controller.setFocused());
|
|
206
|
+
};
|
|
197
207
|
var themeOverride = {
|
|
198
208
|
components: {
|
|
199
209
|
facet: {
|
|
@@ -205,21 +215,21 @@ exports.Autocomplete = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
205
215
|
},
|
|
206
216
|
facetGridOptions: {
|
|
207
217
|
columns: 3,
|
|
208
|
-
onClick:
|
|
218
|
+
onClick: facetClickEvent,
|
|
209
219
|
},
|
|
210
220
|
facetHierarchyOptions: {
|
|
211
221
|
hideCount: true,
|
|
212
|
-
onClick:
|
|
222
|
+
onClick: facetClickEvent,
|
|
213
223
|
},
|
|
214
224
|
facetListOptions: {
|
|
215
225
|
hideCheckbox: true,
|
|
216
226
|
hideCount: true,
|
|
217
|
-
onClick:
|
|
227
|
+
onClick: facetClickEvent,
|
|
218
228
|
},
|
|
219
229
|
facetPaletteOptions: {
|
|
220
230
|
hideLabel: true,
|
|
221
231
|
columns: 3,
|
|
222
|
-
onClick:
|
|
232
|
+
onClick: facetClickEvent,
|
|
223
233
|
},
|
|
224
234
|
result: {
|
|
225
235
|
hideBadge: true,
|
|
@@ -297,7 +307,7 @@ exports.Autocomplete = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
297
307
|
showHistory = true;
|
|
298
308
|
}
|
|
299
309
|
var facetsToShow = facets.length ? facets.filter(function (facet) { return facet.display !== types_1.FacetDisplay.SLIDER; }) : [];
|
|
300
|
-
var onlyTerms = (trending === null || trending === void 0 ? void 0 : trending.length) && !loaded;
|
|
310
|
+
var onlyTerms = ((trending === null || trending === void 0 ? void 0 : trending.length) || history.length) && !loaded;
|
|
301
311
|
// results logic
|
|
302
312
|
var showResults = Boolean(results.length > 0 || Object.keys(merchandising.content).length > 0 || ((_h = search === null || search === void 0 ? void 0 : search.query) === null || _h === void 0 ? void 0 : _h.string));
|
|
303
313
|
var trendingActive = trending === null || trending === void 0 ? void 0 : trending.filter(function (term) { return term.active; }).pop();
|
|
@@ -346,21 +356,21 @@ exports.Autocomplete = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
346
356
|
(0, react_1.jsx)("div", { className: "ss__autocomplete__terms__options" }, terms.map(function (term) { return ((0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__autocomplete__terms__option', {
|
|
347
357
|
'ss__autocomplete__terms__option--active': term.active,
|
|
348
358
|
}) },
|
|
349
|
-
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return
|
|
359
|
+
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return termClickEvent(e); }, href: term.url.href }, valueProps, { onFocus: function () { return term.preview(); } }), emIfy(term.value, state.input || '')))); })))) : null,
|
|
350
360
|
showTrending && !hideTrending ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__terms__trending" },
|
|
351
361
|
trendingTitle ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__title ss__autocomplete__title--trending" },
|
|
352
362
|
(0, react_1.jsx)("h5", null, trendingTitle))) : null,
|
|
353
363
|
(0, react_1.jsx)("div", { className: "ss__autocomplete__terms__options" }, trending.map(function (term) { return ((0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__autocomplete__terms__option', {
|
|
354
364
|
'ss__autocomplete__terms__option--active': term.active,
|
|
355
365
|
}) },
|
|
356
|
-
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return
|
|
366
|
+
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return termClickEvent(e); }, href: term.url.href }, valueProps, { onFocus: function () { return term.preview(); } }), emIfy(term.value, state.input || '')))); })))) : null,
|
|
357
367
|
showHistory && !hideHistory ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__terms__history" },
|
|
358
368
|
historyTitle ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__title ss__autocomplete__title--history" },
|
|
359
369
|
(0, react_1.jsx)("h5", null, historyTitle))) : null,
|
|
360
370
|
(0, react_1.jsx)("div", { className: "ss__autocomplete__terms__options" }, history.map(function (term) { return ((0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__autocomplete__terms__option', {
|
|
361
371
|
'ss__autocomplete__terms__option--active': term.active,
|
|
362
372
|
}) },
|
|
363
|
-
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return
|
|
373
|
+
(0, react_1.jsx)("a", __assign({ onClick: function (e) { return termClickEvent(e); }, href: term.url.href }, valueProps, { onFocus: function () { return term.preview(); } }), emIfy(term.value, state.input || '')))); })))) : null)))),
|
|
364
374
|
!hideFacets &&
|
|
365
375
|
(facetsSlot ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__facets" }, (0, utilities_1.cloneWithProps)(facetsSlot, { facets: facetsToShow, merchandising: merchandising, facetsTitle: facetsTitle, hideBanners: hideBanners, controller: controller, valueProps: valueProps }))) : (facetsToShow.length > 0 && ((0, react_1.jsx)(preact_1.Fragment, null,
|
|
366
376
|
facetsTitle && vertical ? ((0, react_1.jsx)("div", { className: (0, classnames_1.default)('ss__autocomplete__title', 'ss__autocomplete__title--facets') },
|
|
@@ -385,7 +395,7 @@ exports.Autocomplete = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
385
395
|
(0, react_1.jsx)("p", null, "Please try another search."))))),
|
|
386
396
|
!hideBanners ? (0, react_1.jsx)(Banner_1.Banner, __assign({}, subProps.banner, { content: merchandising.content, type: snap_store_mobx_1.ContentType.FOOTER })) : null,
|
|
387
397
|
!hideLink ? (linkSlot ? ((0, utilities_1.cloneWithProps)(linkSlot, { search: search, results: results, pagination: pagination, filters: filters, controller: controller })) : ((_m = search === null || search === void 0 ? void 0 : search.query) === null || _m === void 0 ? void 0 : _m.string) && results.length > 0 ? ((0, react_1.jsx)("div", { className: "ss__autocomplete__content__info" },
|
|
388
|
-
(0, react_1.jsx)("a", { href: state.url.href },
|
|
398
|
+
(0, react_1.jsx)("a", { href: state.url.href, onClick: function () { return (controller === null || controller === void 0 ? void 0 : controller.setFocused) && controller.setFocused(); } },
|
|
389
399
|
"See ",
|
|
390
400
|
pagination.totalResults,
|
|
391
401
|
" ",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Recommendation.d.ts","sourceRoot":"","sources":["../../../../../src/components/Organisms/Recommendation/Recommendation.tsx"],"names":[],"mappings":";AAAA,eAAe;AACf,OAAO,EAAe,iBAAiB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Recommendation.d.ts","sourceRoot":"","sources":["../../../../../src/components/Organisms/Recommendation/Recommendation.tsx"],"names":[],"mappings":";AAAA,eAAe;AACf,OAAO,EAAe,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAMxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAW,MAAM,+BAA+B,CAAC;AAMhF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAe9E,eAAO,MAAM,cAAc,gBAAyB,mBAAmB,KAAG,WAAW;;CA+HnF,CAAC;AAEH,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IAC1D,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,wBAAwB,CAAC;IACrC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -28,7 +28,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
28
28
|
exports.Recommendation = void 0;
|
|
29
29
|
/** @jsx jsx */
|
|
30
30
|
var preact_1 = require("preact");
|
|
31
|
-
var hooks_1 = require("preact/hooks");
|
|
32
31
|
var react_1 = require("@emotion/react");
|
|
33
32
|
var classnames_1 = __importDefault(require("classnames"));
|
|
34
33
|
var mobx_react_lite_1 = require("mobx-react-lite");
|
|
@@ -37,8 +36,9 @@ var Carousel_1 = require("../../Molecules/Carousel");
|
|
|
37
36
|
var Result_1 = require("../../Molecules/Result");
|
|
38
37
|
var utilities_1 = require("../../../utilities");
|
|
39
38
|
var providers_1 = require("../../../providers");
|
|
40
|
-
var hooks_2 = require("../../../hooks");
|
|
41
39
|
var useDisplaySettings_1 = require("../../../hooks/useDisplaySettings");
|
|
40
|
+
var ProfileTracker_1 = require("../../Trackers/Recommendation/ProfileTracker");
|
|
41
|
+
var ResultTracker_1 = require("../../Trackers/Recommendation/ResultTracker");
|
|
42
42
|
var CSS = {
|
|
43
43
|
recommendation: function (_a) {
|
|
44
44
|
var vertical = _a.vertical;
|
|
@@ -51,7 +51,7 @@ var CSS = {
|
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
exports.Recommendation = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
54
|
-
var _a, _b, _c, _d, _e, _f
|
|
54
|
+
var _a, _b, _c, _d, _e, _f;
|
|
55
55
|
var globalTheme = (0, providers_1.useTheme)();
|
|
56
56
|
var props = __assign(__assign(__assign({
|
|
57
57
|
// default props
|
|
@@ -89,31 +89,6 @@ exports.Recommendation = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
89
89
|
// component theme overrides
|
|
90
90
|
theme: props === null || props === void 0 ? void 0 : props.theme }),
|
|
91
91
|
};
|
|
92
|
-
var rootComponentRef = (0, hooks_1.useRef)(null);
|
|
93
|
-
var _h = (0, hooks_1.useState)([0, 0]), initialIndexes = _h[0], setInitialIndexes = _h[1];
|
|
94
|
-
var inViewport = (0, hooks_2.useIntersection)(rootComponentRef, '0px', true);
|
|
95
|
-
var sendProductImpression = function (index, count) {
|
|
96
|
-
if (!inViewport)
|
|
97
|
-
return;
|
|
98
|
-
var resultLoopCount = [index, index + count];
|
|
99
|
-
var resultLoopOverCount;
|
|
100
|
-
if (index + count > resultsToRender.length - 1) {
|
|
101
|
-
resultLoopCount = [index];
|
|
102
|
-
resultLoopOverCount = [0, index + count - resultsToRender.length];
|
|
103
|
-
}
|
|
104
|
-
var resultsImpressions = resultsToRender.slice.apply(resultsToRender, resultLoopCount);
|
|
105
|
-
if (resultLoopOverCount) {
|
|
106
|
-
resultsImpressions = resultsImpressions.concat(resultsToRender.slice.apply(resultsToRender, resultLoopOverCount));
|
|
107
|
-
}
|
|
108
|
-
resultsImpressions.map(function (result) {
|
|
109
|
-
controller.track.product.impression(result);
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
if (inViewport) {
|
|
113
|
-
controller.track.impression();
|
|
114
|
-
sendProductImpression(initialIndexes[0], initialIndexes[1]);
|
|
115
|
-
}
|
|
116
|
-
(children || resultsToRender.length) && ((_g = controller === null || controller === void 0 ? void 0 : controller.track) === null || _g === void 0 ? void 0 : _g.render());
|
|
117
92
|
var styling = {};
|
|
118
93
|
if (!disableStyles) {
|
|
119
94
|
styling.css = [CSS.recommendation({ vertical: vertical }), style];
|
|
@@ -122,24 +97,11 @@ exports.Recommendation = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
|
122
97
|
styling.css = [style];
|
|
123
98
|
}
|
|
124
99
|
return children || (resultsToRender === null || resultsToRender === void 0 ? void 0 : resultsToRender.length) ? ((0, react_1.jsx)(providers_1.CacheProvider, null,
|
|
125
|
-
(0, react_1.jsx)("div", __assign({
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
sendProductImpression(swiper.realIndex, swiper.passedParams.slidesPerView);
|
|
133
|
-
}, onSlideChange: function (swiper) {
|
|
134
|
-
//@ts-ignore
|
|
135
|
-
sendProductImpression(swiper.realIndex, swiper.passedParams.slidesPerView);
|
|
136
|
-
}, prevButton: prevButton, nextButton: nextButton, hideButtons: hideButtons, onNextButtonClick: function (e) { return controller.track.click(e); }, onPrevButtonClick: function (e) { return controller.track.click(e); }, onClick: function (swiper, e) {
|
|
137
|
-
var clickedIndex = swiper.realIndex + (swiper.clickedIndex - swiper.activeIndex);
|
|
138
|
-
controller.track.click(e);
|
|
139
|
-
if (!Number.isNaN(clickedIndex)) {
|
|
140
|
-
controller.track.product.click(e, resultsToRender[clickedIndex]);
|
|
141
|
-
}
|
|
142
|
-
}, loop: loop, pagination: pagination, breakpoints: breakpoints }, subProps.carousel, additionalProps, displaySettings), Array.isArray(children) && children.length
|
|
143
|
-
? children.map(function (child) { return child; })
|
|
144
|
-
: resultsToRender.map(function (result) { return (0, react_1.jsx)(Result_1.Result, __assign({}, subProps.result, { controller: controller, result: result })); }))))) : ((0, react_1.jsx)(preact_1.Fragment, null));
|
|
100
|
+
(0, react_1.jsx)("div", __assign({}, styling, { className: (0, classnames_1.default)('ss__recommendation', className) }),
|
|
101
|
+
(0, react_1.jsx)(ProfileTracker_1.RecommendationProfileTracker, { controller: controller },
|
|
102
|
+
title && (0, react_1.jsx)("h3", { className: "ss__recommendation__title" }, title),
|
|
103
|
+
(0, react_1.jsx)(Carousel_1.Carousel, __assign({ prevButton: prevButton, nextButton: nextButton, hideButtons: hideButtons, loop: loop, pagination: pagination, breakpoints: breakpoints }, subProps.carousel, additionalProps, displaySettings), Array.isArray(children) && children.length
|
|
104
|
+
? children.map(function (child, idx) { return ((0, react_1.jsx)(ResultTracker_1.RecommendationResultTracker, { controller: controller, result: resultsToRender[idx] }, child)); })
|
|
105
|
+
: resultsToRender.map(function (result) { return ((0, react_1.jsx)(ResultTracker_1.RecommendationResultTracker, { controller: controller, result: result },
|
|
106
|
+
(0, react_1.jsx)(Result_1.Result, __assign({}, subProps.result, { controller: controller, result: result })))); })))))) : ((0, react_1.jsx)(preact_1.Fragment, null));
|
|
145
107
|
});
|
package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RecommendationController } from '@searchspring/snap-controller';
|
|
2
|
+
import { ComponentProps } from '../../../../types';
|
|
3
|
+
export declare const RecommendationProfileTracker: ((properties: RecommendationProfileTrackerProps) => JSX.Element) & {
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export interface RecommendationProfileTrackerProps extends ComponentProps {
|
|
7
|
+
children: any;
|
|
8
|
+
controller: RecommendationController;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=RecommendationProfileTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecommendationProfileTracker.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAO/D,eAAO,MAAM,4BAA4B,gBAAyB,iCAAiC,KAAG,WAAW;;CA+C/G,CAAC;AAEH,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACxE,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,wBAAwB,CAAC;CACrC"}
|
package/dist/cjs/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.RecommendationProfileTracker = void 0;
|
|
18
|
+
/** @jsx jsx */
|
|
19
|
+
var preact_1 = require("preact");
|
|
20
|
+
var react_1 = require("@emotion/react");
|
|
21
|
+
var hooks_1 = require("preact/hooks");
|
|
22
|
+
var mobx_react_lite_1 = require("mobx-react-lite");
|
|
23
|
+
var providers_1 = require("../../../../providers");
|
|
24
|
+
var hooks_2 = require("../../../../hooks");
|
|
25
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
26
|
+
var CSS = {
|
|
27
|
+
RecommendationProfileTracker: function () { return (0, react_1.css)({}); },
|
|
28
|
+
};
|
|
29
|
+
exports.RecommendationProfileTracker = (0, mobx_react_lite_1.observer)(function (properties) {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
var globalTheme = (0, providers_1.useTheme)();
|
|
32
|
+
var props = __assign(__assign(__assign({}, (_a = globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.components) === null || _a === void 0 ? void 0 : _a.RecommendationProfileTracker), properties), (_c = (_b = properties.theme) === null || _b === void 0 ? void 0 : _b.components) === null || _c === void 0 ? void 0 : _c.RecommendationProfileTracker);
|
|
33
|
+
var children = props.children, controller = props.controller, className = props.className, style = props.style, disableStyles = props.disableStyles;
|
|
34
|
+
var childs = (0, preact_1.toChildArray)(children);
|
|
35
|
+
// do impression tracking for "profile"
|
|
36
|
+
var componentRef = (0, hooks_1.useRef)(null);
|
|
37
|
+
var inViewport = (0, hooks_2.useIntersection)(componentRef, '0px');
|
|
38
|
+
if (inViewport) {
|
|
39
|
+
controller.track.impression();
|
|
40
|
+
}
|
|
41
|
+
// takes care of rendering profile
|
|
42
|
+
childs.length && controller.track.render();
|
|
43
|
+
var styling = {};
|
|
44
|
+
if (!disableStyles) {
|
|
45
|
+
styling.css = [CSS.RecommendationProfileTracker(), style];
|
|
46
|
+
}
|
|
47
|
+
else if (style) {
|
|
48
|
+
styling.css = [style];
|
|
49
|
+
}
|
|
50
|
+
return childs.length ? ((0, react_1.jsx)("div", __assign({ className: (0, classnames_1.default)('ss__recommendation-profile-tracker', className), onClick: function (e) { return controller.track.click(e); }, ref: componentRef }, styling), children)) : ((0, react_1.jsx)(preact_1.Fragment, null));
|
|
51
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { h } from 'preact';
|
|
3
|
+
import { RecommendationProfileTrackerProps } from './RecommendationProfileTracker';
|
|
4
|
+
import type { RecommendationController } from '@searchspring/snap-controller';
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: ((properties: RecommendationProfileTrackerProps) => JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: () => h.JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
argTypes: {
|
|
16
|
+
className: {
|
|
17
|
+
description: string;
|
|
18
|
+
table: {
|
|
19
|
+
type: {
|
|
20
|
+
summary: string;
|
|
21
|
+
};
|
|
22
|
+
defaultValue: {
|
|
23
|
+
summary: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
control: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
disableStyles: {
|
|
31
|
+
defaultValue: boolean;
|
|
32
|
+
description: string;
|
|
33
|
+
table: {
|
|
34
|
+
type: {
|
|
35
|
+
summary: string;
|
|
36
|
+
};
|
|
37
|
+
defaultValue: {
|
|
38
|
+
summary: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
control: {
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
style: {
|
|
46
|
+
description: string;
|
|
47
|
+
table: {
|
|
48
|
+
type: {
|
|
49
|
+
summary: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
control: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
theme: {
|
|
57
|
+
description: string;
|
|
58
|
+
table: {
|
|
59
|
+
type: {
|
|
60
|
+
summary: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
control: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
controller: {
|
|
68
|
+
description: string;
|
|
69
|
+
type: {
|
|
70
|
+
required: boolean;
|
|
71
|
+
};
|
|
72
|
+
table: {
|
|
73
|
+
type: {
|
|
74
|
+
summary: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
control: {
|
|
78
|
+
type: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export default _default;
|
|
84
|
+
export declare const Default: {
|
|
85
|
+
(props: RecommendationProfileTrackerProps, { loaded: { controller } }: {
|
|
86
|
+
loaded: {
|
|
87
|
+
controller: RecommendationController;
|
|
88
|
+
};
|
|
89
|
+
}): h.JSX.Element;
|
|
90
|
+
loaders: (() => Promise<{
|
|
91
|
+
controller: RecommendationController;
|
|
92
|
+
}>)[];
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=RecommendationProfileTracker.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecommendationProfileTracker.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,OAAO,EAAgC,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAIjH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAI9E,wBA2BE;AAIF,eAAO,MAAM,OAAO;YACZ,iCAAiC;;wBACY,wBAAwB;;;;;;CAY5E,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.Default = void 0;
|
|
54
|
+
var preact_1 = require("preact");
|
|
55
|
+
var blocks_1 = require("@storybook/addon-docs/blocks");
|
|
56
|
+
var RecommendationProfileTracker_1 = require("./RecommendationProfileTracker");
|
|
57
|
+
var utilities_1 = require("../../../../utilities");
|
|
58
|
+
var readme_md_1 = __importDefault(require("../ProfileTracker/readme.md"));
|
|
59
|
+
var snapify_1 = require("../../../../utilities/snapify");
|
|
60
|
+
var Carousel_1 = require("../../../Molecules/Carousel");
|
|
61
|
+
var Result_1 = require("../../../Molecules/Result");
|
|
62
|
+
exports.default = {
|
|
63
|
+
title: "Trackers/Recommendation/Profile",
|
|
64
|
+
component: RecommendationProfileTracker_1.RecommendationProfileTracker,
|
|
65
|
+
parameters: {
|
|
66
|
+
docs: {
|
|
67
|
+
page: function () { return ((0, preact_1.h)("div", null,
|
|
68
|
+
(0, preact_1.h)(readme_md_1.default, null),
|
|
69
|
+
(0, preact_1.h)(blocks_1.ArgsTable, { story: blocks_1.PRIMARY_STORY }))); },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
argTypes: __assign({ controller: {
|
|
73
|
+
description: 'Recommendation Controller reference',
|
|
74
|
+
type: { required: true },
|
|
75
|
+
table: {
|
|
76
|
+
type: {
|
|
77
|
+
summary: 'Controller',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
control: { type: 'none' },
|
|
81
|
+
} }, utilities_1.componentArgs),
|
|
82
|
+
};
|
|
83
|
+
var snapInstance = snapify_1.Snapify.recommendation({ id: 'Recommendation', tag: 'trending', globals: { siteId: '8uyt2m' } });
|
|
84
|
+
var Default = function (props, _a) {
|
|
85
|
+
var controller = _a.loaded.controller;
|
|
86
|
+
return ((0, preact_1.h)(RecommendationProfileTracker_1.RecommendationProfileTracker, __assign({}, props, { controller: controller }),
|
|
87
|
+
(0, preact_1.h)("h2", null, "Recommended for You"),
|
|
88
|
+
(0, preact_1.h)(Carousel_1.Carousel, null, controller.store.results.map(function (result, idx) {
|
|
89
|
+
return (0, preact_1.h)(Result_1.Result, { result: result, key: idx });
|
|
90
|
+
}))));
|
|
91
|
+
};
|
|
92
|
+
exports.Default = Default;
|
|
93
|
+
exports.Default.loaders = [
|
|
94
|
+
function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, snapInstance.search()];
|
|
98
|
+
case 1:
|
|
99
|
+
_a.sent();
|
|
100
|
+
return [2 /*return*/, {
|
|
101
|
+
controller: snapInstance,
|
|
102
|
+
}];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); },
|
|
106
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ProfileTracker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./RecommendationProfileTracker"), exports);
|
package/dist/cjs/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RecommendationController } from '@searchspring/snap-controller';
|
|
2
|
+
import { ComponentProps } from '../../../../types';
|
|
3
|
+
import type { Product } from '@searchspring/snap-store-mobx';
|
|
4
|
+
export declare const RecommendationResultTracker: ((properties: RecommendationResultTrackerProps) => JSX.Element) & {
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
export interface RecommendationResultTrackerProps extends ComponentProps {
|
|
8
|
+
children: any;
|
|
9
|
+
result: Product;
|
|
10
|
+
controller: RecommendationController;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=RecommendationResultTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecommendationResultTracker.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAO7D,eAAO,MAAM,2BAA2B,gBAAyB,gCAAgC,KAAG,WAAW;;CAiD7G,CAAC;AAEH,MAAM,WAAW,gCAAiC,SAAQ,cAAc;IACvE,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,wBAAwB,CAAC;CACrC"}
|