@depict-ai/ui 2.0.14 → 2.0.16
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/ES10/index.cjs +271 -169
- package/ES10/index.d.ts +50 -33
- package/ES10/index.js +271 -173
- package/latest/index.cjs +258 -158
- package/latest/index.d.ts +50 -33
- package/latest/index.js +258 -162
- package/package.json +1 -1
- package/server/ES10/index.cjs +261 -158
- package/server/ES10/index.d.ts +50 -33
- package/server/ES10/index.js +261 -162
- package/server/latest/index.cjs +248 -147
- package/server/latest/index.d.ts +50 -33
- package/server/latest/index.js +248 -151
package/server/ES10/index.cjs
CHANGED
|
@@ -16,6 +16,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
16
16
|
function $parcel$interopDefault(a) {
|
|
17
17
|
return a && a.__esModule ? a.default : a;
|
|
18
18
|
}
|
|
19
|
+
$parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $28535bb7671c63d1$export$d7b7ab832c20e2f4);
|
|
20
|
+
$parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export$e68cff63f76bd15b);
|
|
21
|
+
$parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
|
|
22
|
+
$parcel$export(module.exports, "ShopifyContainedImage", () => $28535bb7671c63d1$export$e4b984597b71e989);
|
|
19
23
|
$parcel$export(module.exports, "SlidableItems", () => $ad8ec7729fffeb9c$export$6649caad96ef8870);
|
|
20
24
|
$parcel$export(module.exports, "make_accurate_size_accessor", () => $13671aa5e984acd9$export$9f191182275e9ef);
|
|
21
25
|
$parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
|
|
@@ -68,7 +72,128 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
68
72
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
69
73
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
70
74
|
/*! Depict.ai search and product listing SDK */
|
|
71
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.
|
|
75
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.16";
|
|
76
|
+
const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
|
|
77
|
+
function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
|
|
78
|
+
const our_object = {};
|
|
79
|
+
return $3hooq$solidjsweb.createComponent($d067f3a30f047b41$var$ListingContext.Provider, {
|
|
80
|
+
value: our_object,
|
|
81
|
+
get children() {
|
|
82
|
+
return props.children;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function $d067f3a30f047b41$export$8d0c4fdbb05a2f2e() {
|
|
87
|
+
return $3hooq$solidjs.useContext($d067f3a30f047b41$var$ListingContext);
|
|
88
|
+
}
|
|
89
|
+
const $ce467edb5343cfcd$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
90
|
+
function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
|
|
91
|
+
return $3hooq$solidjsweb.ssr($ce467edb5343cfcd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%")));
|
|
92
|
+
}
|
|
93
|
+
function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
94
|
+
const [size, setSize] = $3hooq$solidjs.createSignal(0);
|
|
95
|
+
const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => {
|
|
96
|
+
for (let j = 0; j < records.length; j++) {
|
|
97
|
+
const {
|
|
98
|
+
width: width
|
|
99
|
+
} = records[j].contentRect;
|
|
100
|
+
if (!width) continue;
|
|
101
|
+
// add extra 5% just in case. + safari is (in some cases) acting a bit questionable and needs a third extra to fill the set width
|
|
102
|
+
const new_size = width * 1.05 * ((0, $3hooq$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
103
|
+
setSize(Math.round(new_size));
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
107
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
108
|
+
const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
|
|
109
|
+
let {
|
|
110
|
+
element: element
|
|
111
|
+
} = _ref;
|
|
112
|
+
return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
|
|
113
|
+
});
|
|
114
|
+
$3hooq$solidjs.onCleanup(() => {
|
|
115
|
+
resizeObserver.disconnect();
|
|
116
|
+
disconnect();
|
|
117
|
+
});
|
|
118
|
+
return size;
|
|
119
|
+
}
|
|
120
|
+
function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
121
|
+
// Enable reactive props
|
|
122
|
+
const otherOptions = $3hooq$solidjs.createMemo(() => {
|
|
123
|
+
const cloned_props = {
|
|
124
|
+
...props
|
|
125
|
+
};
|
|
126
|
+
delete cloned_props.resolutions;
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
delete cloned_props.size;
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
delete cloned_props.src;
|
|
131
|
+
return cloned_props;
|
|
132
|
+
});
|
|
133
|
+
const src_options = $3hooq$solidjs.createMemo(() => {
|
|
134
|
+
const src = new URL(props.src, location.origin);
|
|
135
|
+
const fallback_src = $858fdcf73148519f$var$generateImageUrl(src, 400);
|
|
136
|
+
const srcset = $858fdcf73148519f$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
|
|
137
|
+
return {
|
|
138
|
+
src: fallback_src,
|
|
139
|
+
srcset: srcset
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
return $3hooq$solidjsweb.ssrElement("img", () => ({
|
|
143
|
+
...otherOptions,
|
|
144
|
+
...src_options(),
|
|
145
|
+
"sizes": props.size() + "px"
|
|
146
|
+
}), undefined, true);
|
|
147
|
+
}
|
|
148
|
+
function $858fdcf73148519f$var$make_srcset(url, resolutions) {
|
|
149
|
+
return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
150
|
+
}
|
|
151
|
+
function $858fdcf73148519f$var$generateImageUrl(url, width) {
|
|
152
|
+
url.searchParams.set("width", width);
|
|
153
|
+
return url.href;
|
|
154
|
+
}
|
|
155
|
+
const $28535bb7671c63d1$var$backupSizeSignal = /*@__PURE__*/$3hooq$solidjs.createSignal();
|
|
156
|
+
const $28535bb7671c63d1$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
157
|
+
function $28535bb7671c63d1$export$e4b984597b71e989(props) {
|
|
158
|
+
const context = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
|
|
159
|
+
if (context && !context[$28535bb7671c63d1$export$d7b7ab832c20e2f4])
|
|
160
|
+
// create a signal that's the same for all items in this listing
|
|
161
|
+
context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $3hooq$solidjs.createSignal();
|
|
162
|
+
const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$28535bb7671c63d1$export$d7b7ab832c20e2f4]) || $28535bb7671c63d1$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
163
|
+
const container = $3hooq$solidjsweb.createComponent((0, $ce467edb5343cfcd$export$94026ee33dbabc26), {
|
|
164
|
+
get aspectRatio() {
|
|
165
|
+
return props.aspectRatio;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const owner = $3hooq$solidjs.getOwner();
|
|
169
|
+
let createdSizeAccessor = false;
|
|
170
|
+
let wasCleanedUp = false;
|
|
171
|
+
$3hooq$solidjs.createEffect(() => {
|
|
172
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
173
|
+
// ensure we always have a size accessor
|
|
174
|
+
// what this whole thing does is set the sizes attribute to the actual size of one of the existing image containers, therefore the value doesn't have to manually be specified
|
|
175
|
+
setCurrentImageSize(() => $3hooq$solidjs.runWithOwner(owner, () => $858fdcf73148519f$export$e6fffe67d4cdd848(container)));
|
|
176
|
+
});
|
|
177
|
+
$3hooq$solidjs.onCleanup(() => {
|
|
178
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
179
|
+
if (!createdSizeAccessor) return;
|
|
180
|
+
$3hooq$depictaiutilishared.queueMacroTask(() => setCurrentImageSize(undefined)); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
container.append($3hooq$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), {
|
|
184
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
185
|
+
get size() {
|
|
186
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
187
|
+
var _currentImageSize;
|
|
188
|
+
return ((_currentImageSize = currentImageSize()) === null || _currentImageSize === void 0 ? void 0 : _currentImageSize()) || 0;
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
get src() {
|
|
192
|
+
return props.src;
|
|
193
|
+
}
|
|
194
|
+
}));
|
|
195
|
+
return container;
|
|
196
|
+
}
|
|
72
197
|
const $9d19451330d04c3c$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
|
|
73
198
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
74
199
|
var _$escape2, _$escape3;
|
|
@@ -644,17 +769,21 @@ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
|
|
|
644
769
|
};
|
|
645
770
|
});
|
|
646
771
|
const [recommendations_resource_] = $3hooq$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
647
|
-
return $3hooq$solidjsweb.ssr($2badc30d7c6610e1$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($
|
|
648
|
-
|
|
649
|
-
return
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
772
|
+
return $3hooq$solidjsweb.ssr($2badc30d7c6610e1$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
773
|
+
get children() {
|
|
774
|
+
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
775
|
+
product_card_template_: function () {
|
|
776
|
+
return props.product_card_template(...arguments);
|
|
777
|
+
},
|
|
778
|
+
recommendations_resource_: recommendations_resource_,
|
|
779
|
+
market_: () => props.market,
|
|
780
|
+
merchant_: () => props.merchant,
|
|
781
|
+
layout_options_: $3hooq$solidjs.createMemo(() => ({
|
|
782
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
783
|
+
...grid_spacing_override()
|
|
784
|
+
}))
|
|
785
|
+
});
|
|
786
|
+
}
|
|
658
787
|
})));
|
|
659
788
|
}, "RecommendationSlider failed");
|
|
660
789
|
}
|
|
@@ -747,76 +876,25 @@ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
|
|
|
747
876
|
};
|
|
748
877
|
});
|
|
749
878
|
const [recommendations_resource_] = $3hooq$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
750
|
-
return $3hooq$solidjsweb.ssr($41227f10ad680afd$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
879
|
+
return $3hooq$solidjsweb.ssr($41227f10ad680afd$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
880
|
+
get children() {
|
|
881
|
+
return $2c920813c92d6987$export$7da560f849543dff({
|
|
882
|
+
rows_object_: rows_object_,
|
|
883
|
+
product_card_template_: function () {
|
|
884
|
+
return props.product_card_template(...arguments);
|
|
885
|
+
},
|
|
886
|
+
recommendations_resource_: recommendations_resource_,
|
|
887
|
+
market_: () => props.market,
|
|
888
|
+
merchant_: () => props.merchant,
|
|
889
|
+
layout_options_: $3hooq$solidjs.createMemo(() => ({
|
|
890
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
891
|
+
...grid_spacing_override()
|
|
892
|
+
}))
|
|
893
|
+
});
|
|
894
|
+
}
|
|
762
895
|
})));
|
|
763
896
|
}, "RecommendationGrid failed");
|
|
764
897
|
}
|
|
765
|
-
function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
766
|
-
const [size, setSize] = $3hooq$solidjs.createSignal(0);
|
|
767
|
-
const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => {
|
|
768
|
-
for (let j = 0; j < records.length; j++) {
|
|
769
|
-
const {
|
|
770
|
-
width: width
|
|
771
|
-
} = records[j].contentRect;
|
|
772
|
-
if (!width) continue;
|
|
773
|
-
// add extra 5% just in case. + safari is (in some cases) acting a bit questionable and needs a third extra to fill the set width
|
|
774
|
-
const new_size = width * 1.05 * ((0, $3hooq$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
775
|
-
setSize(Math.round(new_size));
|
|
776
|
-
}
|
|
777
|
-
}));
|
|
778
|
-
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
779
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
780
|
-
const disconnect = (0, $3hooq$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
|
|
781
|
-
let {
|
|
782
|
-
element: element
|
|
783
|
-
} = _ref;
|
|
784
|
-
return requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
|
|
785
|
-
});
|
|
786
|
-
$3hooq$solidjs.onCleanup(() => {
|
|
787
|
-
resizeObserver.disconnect();
|
|
788
|
-
disconnect();
|
|
789
|
-
});
|
|
790
|
-
return size;
|
|
791
|
-
}
|
|
792
|
-
function $858fdcf73148519f$export$6e5611bc7e57e477(_ref2) {
|
|
793
|
-
let {
|
|
794
|
-
src: raw_src,
|
|
795
|
-
size: size,
|
|
796
|
-
resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
|
|
797
|
-
...otherOptions
|
|
798
|
-
} = _ref2;
|
|
799
|
-
const src = new URL(raw_src, location.origin);
|
|
800
|
-
const fallbackSrc = $858fdcf73148519f$var$generateImageUrl(src, 400);
|
|
801
|
-
const srcset = $858fdcf73148519f$var$make_srcset(src, resolutions);
|
|
802
|
-
return $3hooq$solidjsweb.ssrElement("img", () => ({
|
|
803
|
-
...otherOptions,
|
|
804
|
-
"src": fallbackSrc,
|
|
805
|
-
"srcset": srcset,
|
|
806
|
-
"sizes": size() + "px"
|
|
807
|
-
}), undefined, true);
|
|
808
|
-
}
|
|
809
|
-
function $858fdcf73148519f$var$make_srcset(url, resolutions) {
|
|
810
|
-
return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
811
|
-
}
|
|
812
|
-
function $858fdcf73148519f$var$generateImageUrl(url, width) {
|
|
813
|
-
url.searchParams.set("width", width);
|
|
814
|
-
return url.href;
|
|
815
|
-
}
|
|
816
|
-
const $ce467edb5343cfcd$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
817
|
-
function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
|
|
818
|
-
return $3hooq$solidjsweb.ssr($ce467edb5343cfcd$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%")));
|
|
819
|
-
}
|
|
820
898
|
function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
|
|
821
899
|
const {
|
|
822
900
|
collapse: collapse,
|
|
@@ -5698,26 +5776,30 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
5698
5776
|
severity_: "error",
|
|
5699
5777
|
message_: "Showing results failed",
|
|
5700
5778
|
get children() {
|
|
5701
|
-
return $
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5779
|
+
return $3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
5780
|
+
get children() {
|
|
5781
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
5782
|
+
min_products_to_fetch_:
|
|
5783
|
+
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
5784
|
+
min_products_to_fetch_,
|
|
5785
|
+
query_base_: query_base_,
|
|
5786
|
+
plp_results_: plp_results_,
|
|
5787
|
+
depict_api_: depict_api_,
|
|
5788
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
5789
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
5790
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
5791
|
+
layout_options_: layout_options_,
|
|
5792
|
+
product_card_template_: product_card_template_,
|
|
5793
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
5794
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
5795
|
+
id_currently_querying_for_: query_id_,
|
|
5796
|
+
no_results_options_: {
|
|
5797
|
+
selected_filters_: selected_filters_,
|
|
5798
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
5799
|
+
i18n_: i18n_,
|
|
5800
|
+
local_filter_cache_: local_filter_cache_
|
|
5801
|
+
}
|
|
5802
|
+
});
|
|
5721
5803
|
}
|
|
5722
5804
|
});
|
|
5723
5805
|
}
|
|
@@ -6667,10 +6749,12 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
6667
6749
|
} = _ref;
|
|
6668
6750
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6669
6751
|
const rows_object = view_more_button_ ? $c77adcdf5346b187$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
6670
|
-
const [recommendations_resource] = $3hooq$solidjs.createResource(
|
|
6671
|
-
|
|
6752
|
+
const [recommendations_resource] = $3hooq$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
|
|
6753
|
+
// only fetch/refetch if all products are loaded
|
|
6754
|
+
query => query && depict_api_.get_recommended(query).then(r => r.displays));
|
|
6755
|
+
const should_show = $3hooq$solidjs.createMemo(() => {
|
|
6672
6756
|
var _recommendations_reso;
|
|
6673
|
-
return recommendations_resource.loading || (
|
|
6757
|
+
return !!((recommendations_resource.loading || (_recommendations_reso = recommendations_resource()) !== null && _recommendations_reso !== void 0 && _recommendations_reso.length) && all_products_loaded_());
|
|
6674
6758
|
});
|
|
6675
6759
|
const num_placeholders_ = $3hooq$solidjs.createMemo(() => (0, $da887c42f8e8847a$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(_ref2 => {
|
|
6676
6760
|
let [per_column] = _ref2;
|
|
@@ -6695,7 +6779,10 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
6695
6779
|
get children() {
|
|
6696
6780
|
return (() => {
|
|
6697
6781
|
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6698
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(
|
|
6782
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(prev => {
|
|
6783
|
+
if (!should_show() && prev) return prev; // When we're invisible, don't update what we're rendering to be possibly undefined to preserve the same products if possible
|
|
6784
|
+
return recommendations_resource() || [];
|
|
6785
|
+
}));
|
|
6699
6786
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
6700
6787
|
displays_by_key_: displays_by_key_,
|
|
6701
6788
|
merchant_: $3hooq$solidjs.createMemo(() => search_query_base_().tenant),
|
|
@@ -6709,7 +6796,7 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
6709
6796
|
}))));
|
|
6710
6797
|
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
6711
6798
|
get when() {
|
|
6712
|
-
return
|
|
6799
|
+
return should_show();
|
|
6713
6800
|
},
|
|
6714
6801
|
children: elements
|
|
6715
6802
|
});
|
|
@@ -7920,17 +8007,21 @@ function $24419668d5fcfcd5$export$1c593cbd6f1e10bc(_ref) {
|
|
|
7920
8007
|
severity_: "error",
|
|
7921
8008
|
message_: "Instant results failed",
|
|
7922
8009
|
get children() {
|
|
7923
|
-
return $
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
8010
|
+
return $3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
8011
|
+
get children() {
|
|
8012
|
+
return $6e8d48eea3d0469d$export$62f101a8aa597bf8({
|
|
8013
|
+
search_field_value_: search_field_value_,
|
|
8014
|
+
depict_api_: depict_api_,
|
|
8015
|
+
tenant_: tenant_,
|
|
8016
|
+
i18n_: i18n_,
|
|
8017
|
+
market_: market_,
|
|
8018
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
8019
|
+
router_: router_,
|
|
8020
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
8021
|
+
content_search_enabled_: content_search_enabled_,
|
|
8022
|
+
...instant_results_options_
|
|
8023
|
+
});
|
|
8024
|
+
}
|
|
7934
8025
|
});
|
|
7935
8026
|
}
|
|
7936
8027
|
})), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
@@ -8768,14 +8859,18 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8768
8859
|
return content_search_enabled_();
|
|
8769
8860
|
},
|
|
8770
8861
|
get children() {
|
|
8771
|
-
return $3hooq$solidjsweb.createComponent((0, $
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8862
|
+
return $3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
8863
|
+
get children() {
|
|
8864
|
+
return $3hooq$solidjsweb.createComponent((0, $eab939d0b95b75ee$export$6d0c9c22f6652669), {
|
|
8865
|
+
content_results_rows_: content_results_rows_,
|
|
8866
|
+
search_results_: search_results_,
|
|
8867
|
+
i18n_: i18n_,
|
|
8868
|
+
get_search_query_: get_search_query_,
|
|
8869
|
+
layout_options_: content_layout_options_,
|
|
8870
|
+
router_: router_,
|
|
8871
|
+
query_base_: search_query_base_
|
|
8872
|
+
});
|
|
8873
|
+
}
|
|
8779
8874
|
});
|
|
8780
8875
|
}
|
|
8781
8876
|
});
|
|
@@ -8807,28 +8902,32 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8807
8902
|
severity_: "error",
|
|
8808
8903
|
message_: "Search results failed",
|
|
8809
8904
|
get children() {
|
|
8810
|
-
return $
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8905
|
+
return $3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
8906
|
+
get children() {
|
|
8907
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
8908
|
+
all_products_loaded_: all_products_loaded_,
|
|
8909
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
8910
|
+
query_base_: search_query_base_,
|
|
8911
|
+
plp_results_: search_results_,
|
|
8912
|
+
depict_api_: depict_api_,
|
|
8913
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
8914
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
8915
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
8916
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
8917
|
+
product_card_template_: product_card_template_,
|
|
8918
|
+
layout_options_: layout_options_,
|
|
8919
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
8920
|
+
id_currently_querying_for_: get_search_query_,
|
|
8921
|
+
no_results_options_: {
|
|
8922
|
+
selected_filters_: selected_filters_,
|
|
8923
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8924
|
+
local_filter_cache_: local_filter_cache_,
|
|
8925
|
+
i18n_: {
|
|
8926
|
+
...i18n_,
|
|
8927
|
+
no_results_text_: no_results_text_
|
|
8928
|
+
}
|
|
8929
|
+
}
|
|
8930
|
+
});
|
|
8832
8931
|
}
|
|
8833
8932
|
});
|
|
8834
8933
|
}
|
|
@@ -8840,20 +8939,24 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8840
8939
|
severity_: "error",
|
|
8841
8940
|
message_: "Search recommendations failed",
|
|
8842
8941
|
get children() {
|
|
8843
|
-
return $3hooq$solidjsweb.createComponent((0, $
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8942
|
+
return $3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
8943
|
+
get children() {
|
|
8944
|
+
return $3hooq$solidjsweb.createComponent((0, $c77adcdf5346b187$export$7de92c4c2205ebf3), {
|
|
8945
|
+
depict_api_: depict_api_,
|
|
8946
|
+
i18n_: i18n_,
|
|
8947
|
+
search_query_base_: search_query_base_,
|
|
8948
|
+
get layout_options_() {
|
|
8949
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
8950
|
+
var _recommendations_layo;
|
|
8951
|
+
return (_recommendations_layo = recommendations_layout_options_ === null || recommendations_layout_options_ === void 0 ? void 0 : recommendations_layout_options_()) !== null && _recommendations_layo !== void 0 ? _recommendations_layo : layout_options_();
|
|
8952
|
+
});
|
|
8953
|
+
},
|
|
8954
|
+
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8955
|
+
view_more_button_: search_recs_view_more_,
|
|
8956
|
+
product_card_template_: product_card_template_,
|
|
8957
|
+
all_products_loaded_: get_all_products_loaded
|
|
8851
8958
|
});
|
|
8852
|
-
}
|
|
8853
|
-
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8854
|
-
view_more_button_: search_recs_view_more_,
|
|
8855
|
-
product_card_template_: product_card_template_,
|
|
8856
|
-
all_products_loaded_: get_all_products_loaded
|
|
8959
|
+
}
|
|
8857
8960
|
});
|
|
8858
8961
|
}
|
|
8859
8962
|
});
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSX,
|
|
1
|
+
import { JSX, Accessor, Signal, Setter } from "solid-js";
|
|
2
2
|
import { Amazing_Slider, Display, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { SearchFilter, SearchRequest } from "@depict-ai/types/api/SearchRequest";
|
|
4
4
|
import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
@@ -7,7 +7,55 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
|
|
|
7
7
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
8
8
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
9
9
|
import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
|
|
10
|
-
export const version = "2.0.
|
|
10
|
+
export const version = "2.0.16";
|
|
11
|
+
/**
|
|
12
|
+
* Provider to wrap every listing (group of products) in
|
|
13
|
+
* Used for example for deduplicating ResizeObservers for responsive images
|
|
14
|
+
*/
|
|
15
|
+
export function ListingProvider(props: {
|
|
16
|
+
children: JSX.Element;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Use this to get the context object if your component is within a ListingProvider
|
|
20
|
+
*/
|
|
21
|
+
export function useListing(): Record<symbol, any> | undefined;
|
|
22
|
+
/** @jsxImportSource solid-js */
|
|
23
|
+
/**
|
|
24
|
+
* ImageContainer for using the padding hack to set the aspect ratio of an image
|
|
25
|
+
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
26
|
+
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
27
|
+
*/
|
|
28
|
+
export function ImageContainer(props: {
|
|
29
|
+
aspectRatio: number;
|
|
30
|
+
}): HTMLDivElement;
|
|
31
|
+
/**
|
|
32
|
+
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
33
|
+
*/
|
|
34
|
+
export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
37
|
+
* This is used for our responsive images:
|
|
38
|
+
* 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
|
|
39
|
+
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
40
|
+
* 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
|
|
41
|
+
*/
|
|
42
|
+
export function ShopifyResponsiveImg(props: {
|
|
43
|
+
resolutions?: number[];
|
|
44
|
+
size: Accessor<number>;
|
|
45
|
+
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
|
|
46
|
+
src: string;
|
|
47
|
+
}): HTMLImageElement;
|
|
48
|
+
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
49
|
+
/**
|
|
50
|
+
* Abstraction built on top of ShopifyResponsiveImg
|
|
51
|
+
* @param src TODO
|
|
52
|
+
* @param aspectRatio
|
|
53
|
+
* @constructor
|
|
54
|
+
*/
|
|
55
|
+
export function ShopifyContainedImage(props: {
|
|
56
|
+
src: string;
|
|
57
|
+
aspectRatio: number;
|
|
58
|
+
}): HTMLDivElement;
|
|
11
59
|
/** @jsxImportSource solid-js */
|
|
12
60
|
export function GenericSliderArrowButton(props?: {
|
|
13
61
|
width_?: number;
|
|
@@ -154,37 +202,6 @@ export function RecommendationGrid<T extends Display>(props: {
|
|
|
154
202
|
merchant?: never;
|
|
155
203
|
market?: never;
|
|
156
204
|
} & RecommendationGridBaseProps<T>): HTMLDivElement;
|
|
157
|
-
/**
|
|
158
|
-
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
159
|
-
*/
|
|
160
|
-
export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
161
|
-
/**
|
|
162
|
-
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
163
|
-
* This is used for our responsive images:
|
|
164
|
-
* 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
|
|
165
|
-
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
166
|
-
* 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
|
|
167
|
-
*/
|
|
168
|
-
export function ShopifyResponsiveImg({
|
|
169
|
-
src: raw_src,
|
|
170
|
-
size,
|
|
171
|
-
resolutions,
|
|
172
|
-
...otherOptions
|
|
173
|
-
}: {
|
|
174
|
-
resolutions?: number[];
|
|
175
|
-
size: Accessor<number>;
|
|
176
|
-
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
|
|
177
|
-
src: string;
|
|
178
|
-
}): HTMLImageElement;
|
|
179
|
-
/** @jsxImportSource solid-js */
|
|
180
|
-
/**
|
|
181
|
-
* ImageContainer for using the padding hack to set the aspect ratio of an image
|
|
182
|
-
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
183
|
-
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
184
|
-
*/
|
|
185
|
-
export function ImageContainer(props: {
|
|
186
|
-
aspectRatio: number;
|
|
187
|
-
}): HTMLDivElement;
|
|
188
205
|
export function ExpandingDetails(props: {
|
|
189
206
|
details_: HTMLDetailsElement;
|
|
190
207
|
summary_: HTMLElement;
|