@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/latest/index.cjs
CHANGED
|
@@ -10,6 +10,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
10
10
|
configurable: true
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
+
$parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
|
|
14
|
+
$parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
|
|
15
|
+
$parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
|
|
16
|
+
$parcel$export(module.exports, "ShopifyContainedImage", () => $a33065cfed827fc0$export$e4b984597b71e989);
|
|
13
17
|
$parcel$export(module.exports, "SlidableItems", () => $a0e53f99354809d9$export$6649caad96ef8870);
|
|
14
18
|
$parcel$export(module.exports, "make_accurate_size_accessor", () => $e5f442fb78c98741$export$9f191182275e9ef);
|
|
15
19
|
$parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
|
|
@@ -62,7 +66,122 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
62
66
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
63
67
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
64
68
|
/*! Depict.ai search and product listing SDK */
|
|
65
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.
|
|
69
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.16";
|
|
70
|
+
const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$5vyXB$solidjs.createContext();
|
|
71
|
+
function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
72
|
+
const our_object = {};
|
|
73
|
+
return $5vyXB$solidjsweb.createComponent($84798aaa863a4909$var$ListingContext.Provider, {
|
|
74
|
+
value: our_object,
|
|
75
|
+
get children() {
|
|
76
|
+
return props.children;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
|
|
81
|
+
return $5vyXB$solidjs.useContext($84798aaa863a4909$var$ListingContext);
|
|
82
|
+
}
|
|
83
|
+
const $93304d59a9747aa6$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
84
|
+
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
85
|
+
return $5vyXB$solidjsweb.ssr($93304d59a9747aa6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(`position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`));
|
|
86
|
+
}
|
|
87
|
+
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
88
|
+
const [size, setSize] = $5vyXB$solidjs.createSignal(0);
|
|
89
|
+
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
90
|
+
for (let j = 0; j < records.length; j++) {
|
|
91
|
+
const {
|
|
92
|
+
width: width
|
|
93
|
+
} = records[j].contentRect;
|
|
94
|
+
if (!width) continue;
|
|
95
|
+
// 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
|
|
96
|
+
const new_size = width * 1.05 * ((0, $5vyXB$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
97
|
+
setSize(Math.round(new_size));
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
// 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.
|
|
101
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
102
|
+
const disconnect = (0, $5vyXB$depictaiutilishared.observer).onexists(whatToWatch, ({
|
|
103
|
+
element: element
|
|
104
|
+
}) => requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
|
|
105
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
106
|
+
resizeObserver.disconnect();
|
|
107
|
+
disconnect();
|
|
108
|
+
});
|
|
109
|
+
return size;
|
|
110
|
+
}
|
|
111
|
+
function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
112
|
+
// Enable reactive props
|
|
113
|
+
const otherOptions = $5vyXB$solidjs.createMemo(() => {
|
|
114
|
+
const cloned_props = {
|
|
115
|
+
...props
|
|
116
|
+
};
|
|
117
|
+
delete cloned_props.resolutions;
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
delete cloned_props.size;
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
delete cloned_props.src;
|
|
122
|
+
return cloned_props;
|
|
123
|
+
});
|
|
124
|
+
const src_options = $5vyXB$solidjs.createMemo(() => {
|
|
125
|
+
const src = new URL(props.src, location.origin);
|
|
126
|
+
const fallback_src = $19950faaac026e09$var$generateImageUrl(src, 400);
|
|
127
|
+
const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
|
|
128
|
+
return {
|
|
129
|
+
src: fallback_src,
|
|
130
|
+
srcset: srcset
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
return $5vyXB$solidjsweb.ssrElement("img", () => ({
|
|
134
|
+
...otherOptions,
|
|
135
|
+
...src_options(),
|
|
136
|
+
"sizes": props.size() + "px"
|
|
137
|
+
}), undefined, true);
|
|
138
|
+
}
|
|
139
|
+
function $19950faaac026e09$var$make_srcset(url, resolutions) {
|
|
140
|
+
return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
|
|
141
|
+
}
|
|
142
|
+
function $19950faaac026e09$var$generateImageUrl(url, width) {
|
|
143
|
+
url.searchParams.set("width", width);
|
|
144
|
+
return url.href;
|
|
145
|
+
}
|
|
146
|
+
const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$5vyXB$solidjs.createSignal();
|
|
147
|
+
const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
148
|
+
function $a33065cfed827fc0$export$e4b984597b71e989(props) {
|
|
149
|
+
const context = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
|
|
150
|
+
if (context && !context[$a33065cfed827fc0$export$d7b7ab832c20e2f4])
|
|
151
|
+
// create a signal that's the same for all items in this listing
|
|
152
|
+
context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $5vyXB$solidjs.createSignal();
|
|
153
|
+
const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
154
|
+
const container = $5vyXB$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
|
|
155
|
+
get aspectRatio() {
|
|
156
|
+
return props.aspectRatio;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const owner = $5vyXB$solidjs.getOwner();
|
|
160
|
+
let createdSizeAccessor = false;
|
|
161
|
+
let wasCleanedUp = false;
|
|
162
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
163
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
164
|
+
// ensure we always have a size accessor
|
|
165
|
+
// 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
|
|
166
|
+
setCurrentImageSize(() => $5vyXB$solidjs.runWithOwner(owner, () => $19950faaac026e09$export$e6fffe67d4cdd848(container)));
|
|
167
|
+
});
|
|
168
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
169
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
170
|
+
if (!createdSizeAccessor) return;
|
|
171
|
+
$5vyXB$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
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
container.append($5vyXB$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
|
|
175
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
176
|
+
get size() {
|
|
177
|
+
return $5vyXB$solidjs.createMemo(() => currentImageSize()?.() || 0);
|
|
178
|
+
},
|
|
179
|
+
get src() {
|
|
180
|
+
return props.src;
|
|
181
|
+
}
|
|
182
|
+
}));
|
|
183
|
+
return container;
|
|
184
|
+
}
|
|
66
185
|
const $0f313083912e447a$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>'];
|
|
67
186
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
68
187
|
return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
|
|
@@ -608,15 +727,19 @@ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
|
608
727
|
};
|
|
609
728
|
});
|
|
610
729
|
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
611
|
-
return $5vyXB$solidjsweb.ssr($72f96c4782db0b1b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
730
|
+
return $5vyXB$solidjsweb.ssr($72f96c4782db0b1b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
731
|
+
get children() {
|
|
732
|
+
return $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
733
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
734
|
+
recommendations_resource_: recommendations_resource_,
|
|
735
|
+
market_: () => props.market,
|
|
736
|
+
merchant_: () => props.merchant,
|
|
737
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
738
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
739
|
+
...grid_spacing_override()
|
|
740
|
+
}))
|
|
741
|
+
});
|
|
742
|
+
}
|
|
620
743
|
})));
|
|
621
744
|
}, "RecommendationSlider failed");
|
|
622
745
|
}
|
|
@@ -704,70 +827,23 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
|
704
827
|
};
|
|
705
828
|
});
|
|
706
829
|
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
707
|
-
return $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
830
|
+
return $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
831
|
+
get children() {
|
|
832
|
+
return $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
833
|
+
rows_object_: rows_object_,
|
|
834
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
835
|
+
recommendations_resource_: recommendations_resource_,
|
|
836
|
+
market_: () => props.market,
|
|
837
|
+
merchant_: () => props.merchant,
|
|
838
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
839
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
840
|
+
...grid_spacing_override()
|
|
841
|
+
}))
|
|
842
|
+
});
|
|
843
|
+
}
|
|
717
844
|
})));
|
|
718
845
|
}, "RecommendationGrid failed");
|
|
719
846
|
}
|
|
720
|
-
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
721
|
-
const [size, setSize] = $5vyXB$solidjs.createSignal(0);
|
|
722
|
-
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
723
|
-
for (let j = 0; j < records.length; j++) {
|
|
724
|
-
const {
|
|
725
|
-
width: width
|
|
726
|
-
} = records[j].contentRect;
|
|
727
|
-
if (!width) continue;
|
|
728
|
-
// 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
|
|
729
|
-
const new_size = width * 1.05 * ((0, $5vyXB$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
730
|
-
setSize(Math.round(new_size));
|
|
731
|
-
}
|
|
732
|
-
}));
|
|
733
|
-
// 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.
|
|
734
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
735
|
-
const disconnect = (0, $5vyXB$depictaiutilishared.observer).onexists(whatToWatch, ({
|
|
736
|
-
element: element
|
|
737
|
-
}) => requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
|
|
738
|
-
$5vyXB$solidjs.onCleanup(() => {
|
|
739
|
-
resizeObserver.disconnect();
|
|
740
|
-
disconnect();
|
|
741
|
-
});
|
|
742
|
-
return size;
|
|
743
|
-
}
|
|
744
|
-
function $19950faaac026e09$export$6e5611bc7e57e477({
|
|
745
|
-
src: raw_src,
|
|
746
|
-
size: size,
|
|
747
|
-
resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
|
|
748
|
-
...otherOptions
|
|
749
|
-
}) {
|
|
750
|
-
const src = new URL(raw_src, location.origin);
|
|
751
|
-
const fallbackSrc = $19950faaac026e09$var$generateImageUrl(src, 400);
|
|
752
|
-
const srcset = $19950faaac026e09$var$make_srcset(src, resolutions);
|
|
753
|
-
return $5vyXB$solidjsweb.ssrElement("img", () => ({
|
|
754
|
-
...otherOptions,
|
|
755
|
-
"src": fallbackSrc,
|
|
756
|
-
"srcset": srcset,
|
|
757
|
-
"sizes": size() + "px"
|
|
758
|
-
}), undefined, true);
|
|
759
|
-
}
|
|
760
|
-
function $19950faaac026e09$var$make_srcset(url, resolutions) {
|
|
761
|
-
return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
|
|
762
|
-
}
|
|
763
|
-
function $19950faaac026e09$var$generateImageUrl(url, width) {
|
|
764
|
-
url.searchParams.set("width", width);
|
|
765
|
-
return url.href;
|
|
766
|
-
}
|
|
767
|
-
const $93304d59a9747aa6$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
768
|
-
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
769
|
-
return $5vyXB$solidjsweb.ssr($93304d59a9747aa6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(`position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`));
|
|
770
|
-
}
|
|
771
847
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
772
848
|
const {
|
|
773
849
|
collapse: collapse,
|
|
@@ -5272,26 +5348,30 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
5272
5348
|
severity_: "error",
|
|
5273
5349
|
message_: "Showing results failed",
|
|
5274
5350
|
get children() {
|
|
5275
|
-
return $
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5351
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
5352
|
+
get children() {
|
|
5353
|
+
return $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
5354
|
+
min_products_to_fetch_:
|
|
5355
|
+
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
5356
|
+
min_products_to_fetch_,
|
|
5357
|
+
query_base_: query_base_,
|
|
5358
|
+
plp_results_: plp_results_,
|
|
5359
|
+
depict_api_: depict_api_,
|
|
5360
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
5361
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
5362
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
5363
|
+
layout_options_: layout_options_,
|
|
5364
|
+
product_card_template_: product_card_template_,
|
|
5365
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
5366
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
5367
|
+
id_currently_querying_for_: query_id_,
|
|
5368
|
+
no_results_options_: {
|
|
5369
|
+
selected_filters_: selected_filters_,
|
|
5370
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
5371
|
+
i18n_: i18n_,
|
|
5372
|
+
local_filter_cache_: local_filter_cache_
|
|
5373
|
+
}
|
|
5374
|
+
});
|
|
5295
5375
|
}
|
|
5296
5376
|
});
|
|
5297
5377
|
}
|
|
@@ -6124,8 +6204,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6124
6204
|
}) {
|
|
6125
6205
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6126
6206
|
const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
6127
|
-
const [recommendations_resource] = $5vyXB$solidjs.createResource(
|
|
6128
|
-
|
|
6207
|
+
const [recommendations_resource] = $5vyXB$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
|
|
6208
|
+
// only fetch/refetch if all products are loaded
|
|
6209
|
+
query => query && depict_api_.get_recommended(query).then(r => r.displays));
|
|
6210
|
+
const should_show = $5vyXB$solidjs.createMemo(() => !!((recommendations_resource.loading || recommendations_resource()?.length) && all_products_loaded_()));
|
|
6129
6211
|
const num_placeholders_ = $5vyXB$solidjs.createMemo(() => (0, $aec24316ed262dc0$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
|
|
6130
6212
|
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
6131
6213
|
const elements = $5vyXB$solidjsweb.ssr($fb29c6201c369e39$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(i18n_.search_recs_title_()), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
|
|
@@ -6146,7 +6228,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6146
6228
|
get children() {
|
|
6147
6229
|
return (() => {
|
|
6148
6230
|
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6149
|
-
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(
|
|
6231
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(prev => {
|
|
6232
|
+
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
|
|
6233
|
+
return recommendations_resource() || [];
|
|
6234
|
+
}));
|
|
6150
6235
|
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
6151
6236
|
displays_by_key_: displays_by_key_,
|
|
6152
6237
|
merchant_: $5vyXB$solidjs.createMemo(() => search_query_base_().tenant),
|
|
@@ -6160,7 +6245,7 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6160
6245
|
}))));
|
|
6161
6246
|
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
6162
6247
|
get when() {
|
|
6163
|
-
return
|
|
6248
|
+
return should_show();
|
|
6164
6249
|
},
|
|
6165
6250
|
children: elements
|
|
6166
6251
|
});
|
|
@@ -7303,17 +7388,21 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
7303
7388
|
severity_: "error",
|
|
7304
7389
|
message_: "Instant results failed",
|
|
7305
7390
|
get children() {
|
|
7306
|
-
return $
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7391
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
7392
|
+
get children() {
|
|
7393
|
+
return $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
7394
|
+
search_field_value_: search_field_value_,
|
|
7395
|
+
depict_api_: depict_api_,
|
|
7396
|
+
tenant_: tenant_,
|
|
7397
|
+
i18n_: i18n_,
|
|
7398
|
+
market_: market_,
|
|
7399
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7400
|
+
router_: router_,
|
|
7401
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7402
|
+
content_search_enabled_: content_search_enabled_,
|
|
7403
|
+
...instant_results_options_
|
|
7404
|
+
});
|
|
7405
|
+
}
|
|
7317
7406
|
});
|
|
7318
7407
|
}
|
|
7319
7408
|
})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
@@ -8087,14 +8176,18 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8087
8176
|
return content_search_enabled_();
|
|
8088
8177
|
},
|
|
8089
8178
|
get children() {
|
|
8090
|
-
return $5vyXB$solidjsweb.createComponent((0, $
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8179
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8180
|
+
get children() {
|
|
8181
|
+
return $5vyXB$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
|
|
8182
|
+
content_results_rows_: content_results_rows_,
|
|
8183
|
+
search_results_: search_results_,
|
|
8184
|
+
i18n_: i18n_,
|
|
8185
|
+
get_search_query_: get_search_query_,
|
|
8186
|
+
layout_options_: content_layout_options_,
|
|
8187
|
+
router_: router_,
|
|
8188
|
+
query_base_: search_query_base_
|
|
8189
|
+
});
|
|
8190
|
+
}
|
|
8098
8191
|
});
|
|
8099
8192
|
}
|
|
8100
8193
|
});
|
|
@@ -8125,28 +8218,32 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8125
8218
|
severity_: "error",
|
|
8126
8219
|
message_: "Search results failed",
|
|
8127
8220
|
get children() {
|
|
8128
|
-
return $
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8221
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8222
|
+
get children() {
|
|
8223
|
+
return $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
8224
|
+
all_products_loaded_: all_products_loaded_,
|
|
8225
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
8226
|
+
query_base_: search_query_base_,
|
|
8227
|
+
plp_results_: search_results_,
|
|
8228
|
+
depict_api_: depict_api_,
|
|
8229
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
8230
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
8231
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
8232
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
8233
|
+
product_card_template_: product_card_template_,
|
|
8234
|
+
layout_options_: layout_options_,
|
|
8235
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
8236
|
+
id_currently_querying_for_: get_search_query_,
|
|
8237
|
+
no_results_options_: {
|
|
8238
|
+
selected_filters_: selected_filters_,
|
|
8239
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8240
|
+
local_filter_cache_: local_filter_cache_,
|
|
8241
|
+
i18n_: {
|
|
8242
|
+
...i18n_,
|
|
8243
|
+
no_results_text_: no_results_text_
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
});
|
|
8150
8247
|
}
|
|
8151
8248
|
});
|
|
8152
8249
|
}
|
|
@@ -8158,17 +8255,21 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8158
8255
|
severity_: "error",
|
|
8159
8256
|
message_: "Search recommendations failed",
|
|
8160
8257
|
get children() {
|
|
8161
|
-
return $5vyXB$solidjsweb.createComponent((0, $
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8258
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8259
|
+
get children() {
|
|
8260
|
+
return $5vyXB$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
|
|
8261
|
+
depict_api_: depict_api_,
|
|
8262
|
+
i18n_: i18n_,
|
|
8263
|
+
search_query_base_: search_query_base_,
|
|
8264
|
+
get layout_options_() {
|
|
8265
|
+
return $5vyXB$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
|
|
8266
|
+
},
|
|
8267
|
+
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8268
|
+
view_more_button_: search_recs_view_more_,
|
|
8269
|
+
product_card_template_: product_card_template_,
|
|
8270
|
+
all_products_loaded_: get_all_products_loaded
|
|
8271
|
+
});
|
|
8272
|
+
}
|
|
8172
8273
|
});
|
|
8173
8274
|
}
|
|
8174
8275
|
});
|
package/server/latest/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/latest";
|
|
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;
|