@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
package/dist/esm/components/Trackers/Recommendation/ProfileTracker/RecommendationProfileTracker.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Fragment, toChildArray } from 'preact';
|
|
3
|
+
import { jsx, css } from '@emotion/react';
|
|
4
|
+
import { useRef } from 'preact/hooks';
|
|
5
|
+
import { observer } from 'mobx-react-lite';
|
|
6
|
+
import { useTheme } from '../../../../providers';
|
|
7
|
+
import { useIntersection } from '../../../../hooks';
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
const CSS = {
|
|
10
|
+
RecommendationProfileTracker: () => css({}),
|
|
11
|
+
};
|
|
12
|
+
export const RecommendationProfileTracker = observer((properties) => {
|
|
13
|
+
const globalTheme = useTheme();
|
|
14
|
+
const props = {
|
|
15
|
+
// default props
|
|
16
|
+
// global theme
|
|
17
|
+
...globalTheme?.components?.RecommendationProfileTracker,
|
|
18
|
+
// props
|
|
19
|
+
...properties,
|
|
20
|
+
...properties.theme?.components?.RecommendationProfileTracker,
|
|
21
|
+
};
|
|
22
|
+
const { children, controller, className, style, disableStyles } = props;
|
|
23
|
+
const childs = toChildArray(children);
|
|
24
|
+
// do impression tracking for "profile"
|
|
25
|
+
const componentRef = useRef(null);
|
|
26
|
+
const inViewport = useIntersection(componentRef, '0px');
|
|
27
|
+
if (inViewport) {
|
|
28
|
+
controller.track.impression();
|
|
29
|
+
}
|
|
30
|
+
// takes care of rendering profile
|
|
31
|
+
childs.length && controller.track.render();
|
|
32
|
+
const styling = {};
|
|
33
|
+
if (!disableStyles) {
|
|
34
|
+
styling.css = [CSS.RecommendationProfileTracker(), style];
|
|
35
|
+
}
|
|
36
|
+
else if (style) {
|
|
37
|
+
styling.css = [style];
|
|
38
|
+
}
|
|
39
|
+
return childs.length ? (jsx("div", { className: classnames('ss__recommendation-profile-tracker', className), onClick: (e) => controller.track.click(e), ref: componentRef, ...styling }, children)) : (jsx(Fragment, null));
|
|
40
|
+
});
|
|
@@ -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,48 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { ArgsTable, PRIMARY_STORY } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { RecommendationProfileTracker } from './RecommendationProfileTracker';
|
|
4
|
+
import { componentArgs } from '../../../../utilities';
|
|
5
|
+
import Readme from '../ProfileTracker/readme.md';
|
|
6
|
+
import { Snapify } from '../../../../utilities/snapify';
|
|
7
|
+
import { Carousel } from '../../../Molecules/Carousel';
|
|
8
|
+
import { Result } from '../../../Molecules/Result';
|
|
9
|
+
export default {
|
|
10
|
+
title: `Trackers/Recommendation/Profile`,
|
|
11
|
+
component: RecommendationProfileTracker,
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: () => (h("div", null,
|
|
15
|
+
h(Readme, null),
|
|
16
|
+
h(ArgsTable, { story: PRIMARY_STORY }))),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
controller: {
|
|
21
|
+
description: 'Recommendation Controller reference',
|
|
22
|
+
type: { required: true },
|
|
23
|
+
table: {
|
|
24
|
+
type: {
|
|
25
|
+
summary: 'Controller',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
control: { type: 'none' },
|
|
29
|
+
},
|
|
30
|
+
...componentArgs,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const snapInstance = Snapify.recommendation({ id: 'Recommendation', tag: 'trending', globals: { siteId: '8uyt2m' } });
|
|
34
|
+
export const Default = (props, { loaded: { controller } }) => {
|
|
35
|
+
return (h(RecommendationProfileTracker, { ...props, controller: controller },
|
|
36
|
+
h("h2", null, "Recommended for You"),
|
|
37
|
+
h(Carousel, null, controller.store.results.map((result, idx) => {
|
|
38
|
+
return h(Result, { result: result, key: idx });
|
|
39
|
+
}))));
|
|
40
|
+
};
|
|
41
|
+
Default.loaders = [
|
|
42
|
+
async () => {
|
|
43
|
+
await snapInstance.search();
|
|
44
|
+
return {
|
|
45
|
+
controller: snapInstance,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
];
|
|
@@ -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 @@
|
|
|
1
|
+
export * from './RecommendationProfileTracker';
|
package/dist/esm/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"}
|
package/dist/esm/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, css } from '@emotion/react';
|
|
2
|
+
import { useRef } from 'preact/hooks';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
import { useTheme } from '../../../../providers';
|
|
5
|
+
import { useIntersection } from '../../../../hooks';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
const CSS = {
|
|
8
|
+
RecommendationResultTracker: () => css({}),
|
|
9
|
+
};
|
|
10
|
+
export const RecommendationResultTracker = observer((properties) => {
|
|
11
|
+
const globalTheme = useTheme();
|
|
12
|
+
const props = {
|
|
13
|
+
// default props
|
|
14
|
+
// global theme
|
|
15
|
+
...globalTheme?.components?.RecommendationResultTracker,
|
|
16
|
+
// props
|
|
17
|
+
...properties,
|
|
18
|
+
...properties.theme?.components?.RecommendationResultTracker,
|
|
19
|
+
};
|
|
20
|
+
const { children, result, controller, className, disableStyles, style } = props;
|
|
21
|
+
const resultRef = useRef(null);
|
|
22
|
+
const resultInViewport = useIntersection(resultRef, '0px');
|
|
23
|
+
if (!controller.events.render) {
|
|
24
|
+
controller.log.warn('<RecommendationResultTracker> used without <RecommendationProfileTracker>');
|
|
25
|
+
}
|
|
26
|
+
controller.track.product.render(result);
|
|
27
|
+
if (resultInViewport) {
|
|
28
|
+
// intersection observer can trigger in any random order,
|
|
29
|
+
// so we need to check if profile impression has been sent and send if not.
|
|
30
|
+
if (!controller.events.impression) {
|
|
31
|
+
controller.track.impression();
|
|
32
|
+
}
|
|
33
|
+
controller.track.product.impression(result);
|
|
34
|
+
}
|
|
35
|
+
const styling = {};
|
|
36
|
+
if (!disableStyles) {
|
|
37
|
+
styling.css = [CSS.RecommendationResultTracker(), style];
|
|
38
|
+
}
|
|
39
|
+
else if (style) {
|
|
40
|
+
styling.css = [style];
|
|
41
|
+
}
|
|
42
|
+
return (jsx("div", { className: classnames('ss__recommendation-result-tracker', className), onClick: (e) => controller.track.product.click(e, result), ref: resultRef, ...styling }, children));
|
|
43
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { h } from 'preact';
|
|
3
|
+
import { RecommendationResultTrackerProps } from './RecommendationResultTracker';
|
|
4
|
+
import type { RecommendationController } from '@searchspring/snap-controller';
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: ((properties: RecommendationResultTrackerProps) => JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: () => h.JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
decorators: ((Story: any) => h.JSX.Element)[];
|
|
16
|
+
argTypes: {
|
|
17
|
+
className: {
|
|
18
|
+
description: string;
|
|
19
|
+
table: {
|
|
20
|
+
type: {
|
|
21
|
+
summary: string;
|
|
22
|
+
};
|
|
23
|
+
defaultValue: {
|
|
24
|
+
summary: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
control: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
disableStyles: {
|
|
32
|
+
defaultValue: boolean;
|
|
33
|
+
description: string;
|
|
34
|
+
table: {
|
|
35
|
+
type: {
|
|
36
|
+
summary: string;
|
|
37
|
+
};
|
|
38
|
+
defaultValue: {
|
|
39
|
+
summary: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
control: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
style: {
|
|
47
|
+
description: string;
|
|
48
|
+
table: {
|
|
49
|
+
type: {
|
|
50
|
+
summary: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
control: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
theme: {
|
|
58
|
+
description: string;
|
|
59
|
+
table: {
|
|
60
|
+
type: {
|
|
61
|
+
summary: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
control: {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
controller: {
|
|
69
|
+
description: string;
|
|
70
|
+
type: {
|
|
71
|
+
required: boolean;
|
|
72
|
+
};
|
|
73
|
+
table: {
|
|
74
|
+
type: {
|
|
75
|
+
summary: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
control: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
result: {
|
|
83
|
+
description: string;
|
|
84
|
+
type: {
|
|
85
|
+
required: boolean;
|
|
86
|
+
};
|
|
87
|
+
table: {
|
|
88
|
+
type: {
|
|
89
|
+
summary: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
control: {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export default _default;
|
|
99
|
+
export declare const Default: {
|
|
100
|
+
(props: RecommendationResultTrackerProps, { loaded: { controller } }: {
|
|
101
|
+
loaded: {
|
|
102
|
+
controller: RecommendationController;
|
|
103
|
+
};
|
|
104
|
+
}): h.JSX.Element;
|
|
105
|
+
loaders: (() => Promise<{
|
|
106
|
+
controller: RecommendationController;
|
|
107
|
+
}>)[];
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=RecommendationResultTracker.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecommendationResultTracker.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ResultTracker/RecommendationResultTracker.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,OAAO,EAA+B,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAI9G,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;;yBAiBpE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAdb,wBA4CE;AAIF,eAAO,MAAM,OAAO;YACZ,gCAAgC;;wBACa,wBAAwB;;;;;;CAO5E,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { ArgsTable, PRIMARY_STORY } from '@storybook/addon-docs/blocks';
|
|
3
|
+
import { RecommendationResultTracker } from './RecommendationResultTracker';
|
|
4
|
+
import { componentArgs } from '../../../../utilities';
|
|
5
|
+
import Readme from '../ResultTracker/readme.md';
|
|
6
|
+
import { Snapify } from '../../../../utilities/snapify';
|
|
7
|
+
import { Result } from '../../../Molecules/Result';
|
|
8
|
+
export default {
|
|
9
|
+
title: `Trackers/Recommendation/Result`,
|
|
10
|
+
component: RecommendationResultTracker,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: () => (h("div", null,
|
|
14
|
+
h(Readme, null),
|
|
15
|
+
h(ArgsTable, { story: PRIMARY_STORY }))),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (h("div", { style: { maxWidth: '250px' } },
|
|
20
|
+
h(Story, null))),
|
|
21
|
+
],
|
|
22
|
+
argTypes: {
|
|
23
|
+
controller: {
|
|
24
|
+
description: 'Recommendation Controller reference',
|
|
25
|
+
type: { required: true },
|
|
26
|
+
table: {
|
|
27
|
+
type: {
|
|
28
|
+
summary: 'Controller',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
control: { type: 'none' },
|
|
32
|
+
},
|
|
33
|
+
result: {
|
|
34
|
+
description: 'Result store Product reference',
|
|
35
|
+
type: { required: true },
|
|
36
|
+
table: {
|
|
37
|
+
type: {
|
|
38
|
+
summary: 'result store Product object',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
control: { type: 'none' },
|
|
42
|
+
},
|
|
43
|
+
...componentArgs,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const snapInstance = Snapify.recommendation({ id: 'Recommendation', tag: 'trending', globals: { siteId: '8uyt2m' } });
|
|
47
|
+
export const Default = (props, { loaded: { controller } }) => {
|
|
48
|
+
return (h(RecommendationResultTracker, { ...props, controller: controller, result: controller?.store?.results[0] },
|
|
49
|
+
h(Result, { result: controller?.store?.results[0] })));
|
|
50
|
+
};
|
|
51
|
+
Default.loaders = [
|
|
52
|
+
async () => {
|
|
53
|
+
await snapInstance.search();
|
|
54
|
+
return {
|
|
55
|
+
controller: snapInstance,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Trackers/Recommendation/ResultTracker/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RecommendationResultTracker';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export * from './components/Atoms/Merchandising';
|
|
|
10
10
|
export * from './components/Atoms/Overlay';
|
|
11
11
|
export * from './components/Atoms/Price';
|
|
12
12
|
export * from './components/Atoms/Skeleton';
|
|
13
|
+
export * from './components/Trackers/Recommendation/ResultTracker';
|
|
14
|
+
export * from './components/Trackers/Recommendation/ProfileTracker';
|
|
13
15
|
export * from './components/Molecules/Carousel';
|
|
14
16
|
export * from './components/Molecules/Checkbox';
|
|
15
17
|
export * from './components/Molecules/ErrorHandler';
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AACzC,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,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AACzC,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,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AAGpE,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAG/C,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export * from './components/Atoms/Merchandising';
|
|
|
11
11
|
export * from './components/Atoms/Overlay';
|
|
12
12
|
export * from './components/Atoms/Price';
|
|
13
13
|
export * from './components/Atoms/Skeleton';
|
|
14
|
+
export * from './components/Trackers/Recommendation/ResultTracker';
|
|
15
|
+
export * from './components/Trackers/Recommendation/ProfileTracker';
|
|
14
16
|
// MOLECULES
|
|
15
17
|
export * from './components/Molecules/Carousel';
|
|
16
18
|
export * from './components/Molecules/Checkbox';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-preact-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"description": "Snap Preact Component Library",
|
|
5
5
|
"author": "Searchspring",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@emotion/react": "11.9.0",
|
|
29
|
-
"@searchspring/snap-toolbox": "^0.
|
|
29
|
+
"@searchspring/snap-toolbox": "^0.41.1",
|
|
30
30
|
"classnames": "^2.3.2",
|
|
31
31
|
"deepmerge": "4.2.2",
|
|
32
32
|
"mobx-react-lite": "3.4.0",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"preact": "10.9.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@searchspring/snap-client": "^0.
|
|
41
|
-
"@searchspring/snap-controller": "^0.
|
|
42
|
-
"@searchspring/snap-event-manager": "^0.
|
|
43
|
-
"@searchspring/snap-logger": "^0.
|
|
44
|
-
"@searchspring/snap-profiler": "^0.
|
|
45
|
-
"@searchspring/snap-store-mobx": "^0.
|
|
46
|
-
"@searchspring/snap-tracker": "^0.
|
|
47
|
-
"@searchspring/snap-url-manager": "^0.
|
|
40
|
+
"@searchspring/snap-client": "^0.41.1",
|
|
41
|
+
"@searchspring/snap-controller": "^0.41.1",
|
|
42
|
+
"@searchspring/snap-event-manager": "^0.41.1",
|
|
43
|
+
"@searchspring/snap-logger": "^0.41.1",
|
|
44
|
+
"@searchspring/snap-profiler": "^0.41.1",
|
|
45
|
+
"@searchspring/snap-store-mobx": "^0.41.1",
|
|
46
|
+
"@searchspring/snap-tracker": "^0.41.1",
|
|
47
|
+
"@searchspring/snap-url-manager": "^0.41.1",
|
|
48
48
|
"@storybook/addon-actions": "6.4.22",
|
|
49
49
|
"@storybook/addon-controls": "6.4.22",
|
|
50
50
|
"@storybook/addon-docs": "6.4.22",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"ts-loader": "9.3.0"
|
|
67
67
|
},
|
|
68
68
|
"sideEffects": false,
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "7df982d99e4a16a4346074a224958b871663a6e4"
|
|
70
70
|
}
|