@depict-ai/ui 2.0.14 → 2.0.15
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 +272 -169
- package/ES10/index.d.ts +50 -33
- package/ES10/index.js +272 -173
- package/latest/index.cjs +259 -158
- package/latest/index.d.ts +50 -33
- package/latest/index.js +259 -162
- package/package.json +1 -1
- package/server/ES10/index.cjs +262 -158
- package/server/ES10/index.d.ts +50 -33
- package/server/ES10/index.js +262 -162
- package/server/latest/index.cjs +249 -147
- package/server/latest/index.d.ts +50 -33
- package/server/latest/index.js +249 -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,123 @@ $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.15";
|
|
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
|
+
$5vyXB$depictaiutilishared.dlog("Checking for", $a33065cfed827fc0$export$d7b7ab832c20e2f4, "in", context);
|
|
154
|
+
const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
155
|
+
const container = $5vyXB$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
|
|
156
|
+
get aspectRatio() {
|
|
157
|
+
return props.aspectRatio;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const owner = $5vyXB$solidjs.getOwner();
|
|
161
|
+
let createdSizeAccessor = false;
|
|
162
|
+
let wasCleanedUp = false;
|
|
163
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
164
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
165
|
+
// ensure we always have a size accessor
|
|
166
|
+
// 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
|
|
167
|
+
setCurrentImageSize(() => $5vyXB$solidjs.runWithOwner(owner, () => $19950faaac026e09$export$e6fffe67d4cdd848(container)));
|
|
168
|
+
});
|
|
169
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
170
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
171
|
+
if (!createdSizeAccessor) return;
|
|
172
|
+
$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
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
container.append($5vyXB$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
|
|
176
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
177
|
+
get size() {
|
|
178
|
+
return $5vyXB$solidjs.createMemo(() => currentImageSize()?.() || 0);
|
|
179
|
+
},
|
|
180
|
+
get src() {
|
|
181
|
+
return props.src;
|
|
182
|
+
}
|
|
183
|
+
}));
|
|
184
|
+
return container;
|
|
185
|
+
}
|
|
66
186
|
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
187
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
68
188
|
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 +728,19 @@ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
|
608
728
|
};
|
|
609
729
|
});
|
|
610
730
|
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
|
-
|
|
731
|
+
return $5vyXB$solidjsweb.ssr($72f96c4782db0b1b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
732
|
+
get children() {
|
|
733
|
+
return $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
734
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
735
|
+
recommendations_resource_: recommendations_resource_,
|
|
736
|
+
market_: () => props.market,
|
|
737
|
+
merchant_: () => props.merchant,
|
|
738
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
739
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
740
|
+
...grid_spacing_override()
|
|
741
|
+
}))
|
|
742
|
+
});
|
|
743
|
+
}
|
|
620
744
|
})));
|
|
621
745
|
}, "RecommendationSlider failed");
|
|
622
746
|
}
|
|
@@ -704,70 +828,23 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
|
704
828
|
};
|
|
705
829
|
});
|
|
706
830
|
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
|
-
|
|
831
|
+
return $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
832
|
+
get children() {
|
|
833
|
+
return $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
834
|
+
rows_object_: rows_object_,
|
|
835
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
836
|
+
recommendations_resource_: recommendations_resource_,
|
|
837
|
+
market_: () => props.market,
|
|
838
|
+
merchant_: () => props.merchant,
|
|
839
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
840
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
841
|
+
...grid_spacing_override()
|
|
842
|
+
}))
|
|
843
|
+
});
|
|
844
|
+
}
|
|
717
845
|
})));
|
|
718
846
|
}, "RecommendationGrid failed");
|
|
719
847
|
}
|
|
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
848
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
772
849
|
const {
|
|
773
850
|
collapse: collapse,
|
|
@@ -5272,26 +5349,30 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
5272
5349
|
severity_: "error",
|
|
5273
5350
|
message_: "Showing results failed",
|
|
5274
5351
|
get children() {
|
|
5275
|
-
return $
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5352
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
5353
|
+
get children() {
|
|
5354
|
+
return $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
5355
|
+
min_products_to_fetch_:
|
|
5356
|
+
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
5357
|
+
min_products_to_fetch_,
|
|
5358
|
+
query_base_: query_base_,
|
|
5359
|
+
plp_results_: plp_results_,
|
|
5360
|
+
depict_api_: depict_api_,
|
|
5361
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
5362
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
5363
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
5364
|
+
layout_options_: layout_options_,
|
|
5365
|
+
product_card_template_: product_card_template_,
|
|
5366
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
5367
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
5368
|
+
id_currently_querying_for_: query_id_,
|
|
5369
|
+
no_results_options_: {
|
|
5370
|
+
selected_filters_: selected_filters_,
|
|
5371
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
5372
|
+
i18n_: i18n_,
|
|
5373
|
+
local_filter_cache_: local_filter_cache_
|
|
5374
|
+
}
|
|
5375
|
+
});
|
|
5295
5376
|
}
|
|
5296
5377
|
});
|
|
5297
5378
|
}
|
|
@@ -6124,8 +6205,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6124
6205
|
}) {
|
|
6125
6206
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6126
6207
|
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
|
-
|
|
6208
|
+
const [recommendations_resource] = $5vyXB$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
|
|
6209
|
+
// only fetch/refetch if all products are loaded
|
|
6210
|
+
query => query && depict_api_.get_recommended(query).then(r => r.displays));
|
|
6211
|
+
const should_show = $5vyXB$solidjs.createMemo(() => !!((recommendations_resource.loading || recommendations_resource()?.length) && all_products_loaded_()));
|
|
6129
6212
|
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
6213
|
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
6131
6214
|
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 +6229,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6146
6229
|
get children() {
|
|
6147
6230
|
return (() => {
|
|
6148
6231
|
// 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(
|
|
6232
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(prev => {
|
|
6233
|
+
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
|
|
6234
|
+
return recommendations_resource() || [];
|
|
6235
|
+
}));
|
|
6150
6236
|
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
6151
6237
|
displays_by_key_: displays_by_key_,
|
|
6152
6238
|
merchant_: $5vyXB$solidjs.createMemo(() => search_query_base_().tenant),
|
|
@@ -6160,7 +6246,7 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6160
6246
|
}))));
|
|
6161
6247
|
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
6162
6248
|
get when() {
|
|
6163
|
-
return
|
|
6249
|
+
return should_show();
|
|
6164
6250
|
},
|
|
6165
6251
|
children: elements
|
|
6166
6252
|
});
|
|
@@ -7303,17 +7389,21 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
7303
7389
|
severity_: "error",
|
|
7304
7390
|
message_: "Instant results failed",
|
|
7305
7391
|
get children() {
|
|
7306
|
-
return $
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7392
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
7393
|
+
get children() {
|
|
7394
|
+
return $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
7395
|
+
search_field_value_: search_field_value_,
|
|
7396
|
+
depict_api_: depict_api_,
|
|
7397
|
+
tenant_: tenant_,
|
|
7398
|
+
i18n_: i18n_,
|
|
7399
|
+
market_: market_,
|
|
7400
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7401
|
+
router_: router_,
|
|
7402
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7403
|
+
content_search_enabled_: content_search_enabled_,
|
|
7404
|
+
...instant_results_options_
|
|
7405
|
+
});
|
|
7406
|
+
}
|
|
7317
7407
|
});
|
|
7318
7408
|
}
|
|
7319
7409
|
})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
@@ -8087,14 +8177,18 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8087
8177
|
return content_search_enabled_();
|
|
8088
8178
|
},
|
|
8089
8179
|
get children() {
|
|
8090
|
-
return $5vyXB$solidjsweb.createComponent((0, $
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8180
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8181
|
+
get children() {
|
|
8182
|
+
return $5vyXB$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
|
|
8183
|
+
content_results_rows_: content_results_rows_,
|
|
8184
|
+
search_results_: search_results_,
|
|
8185
|
+
i18n_: i18n_,
|
|
8186
|
+
get_search_query_: get_search_query_,
|
|
8187
|
+
layout_options_: content_layout_options_,
|
|
8188
|
+
router_: router_,
|
|
8189
|
+
query_base_: search_query_base_
|
|
8190
|
+
});
|
|
8191
|
+
}
|
|
8098
8192
|
});
|
|
8099
8193
|
}
|
|
8100
8194
|
});
|
|
@@ -8125,28 +8219,32 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8125
8219
|
severity_: "error",
|
|
8126
8220
|
message_: "Search results failed",
|
|
8127
8221
|
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
|
-
|
|
8222
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8223
|
+
get children() {
|
|
8224
|
+
return $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
8225
|
+
all_products_loaded_: all_products_loaded_,
|
|
8226
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
8227
|
+
query_base_: search_query_base_,
|
|
8228
|
+
plp_results_: search_results_,
|
|
8229
|
+
depict_api_: depict_api_,
|
|
8230
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
8231
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
8232
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
8233
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
8234
|
+
product_card_template_: product_card_template_,
|
|
8235
|
+
layout_options_: layout_options_,
|
|
8236
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
8237
|
+
id_currently_querying_for_: get_search_query_,
|
|
8238
|
+
no_results_options_: {
|
|
8239
|
+
selected_filters_: selected_filters_,
|
|
8240
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8241
|
+
local_filter_cache_: local_filter_cache_,
|
|
8242
|
+
i18n_: {
|
|
8243
|
+
...i18n_,
|
|
8244
|
+
no_results_text_: no_results_text_
|
|
8245
|
+
}
|
|
8246
|
+
}
|
|
8247
|
+
});
|
|
8150
8248
|
}
|
|
8151
8249
|
});
|
|
8152
8250
|
}
|
|
@@ -8158,17 +8256,21 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8158
8256
|
severity_: "error",
|
|
8159
8257
|
message_: "Search recommendations failed",
|
|
8160
8258
|
get children() {
|
|
8161
|
-
return $5vyXB$solidjsweb.createComponent((0, $
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8259
|
+
return $5vyXB$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
8260
|
+
get children() {
|
|
8261
|
+
return $5vyXB$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
|
|
8262
|
+
depict_api_: depict_api_,
|
|
8263
|
+
i18n_: i18n_,
|
|
8264
|
+
search_query_base_: search_query_base_,
|
|
8265
|
+
get layout_options_() {
|
|
8266
|
+
return $5vyXB$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
|
|
8267
|
+
},
|
|
8268
|
+
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8269
|
+
view_more_button_: search_recs_view_more_,
|
|
8270
|
+
product_card_template_: product_card_template_,
|
|
8271
|
+
all_products_loaded_: get_all_products_loaded
|
|
8272
|
+
});
|
|
8273
|
+
}
|
|
8172
8274
|
});
|
|
8173
8275
|
}
|
|
8174
8276
|
});
|
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.15";
|
|
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;
|