@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/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,138 @@ $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__*/$52FdA$solidjs.createContext();
|
|
77
|
+
function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
|
|
78
|
+
const our_object = {};
|
|
79
|
+
return $52FdA$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 $52FdA$solidjs.useContext($d067f3a30f047b41$var$ListingContext);
|
|
88
|
+
}
|
|
89
|
+
const $ce467edb5343cfcd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
|
|
90
|
+
function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
|
|
91
|
+
return (() => {
|
|
92
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($ce467edb5343cfcd$var$_tmpl$);
|
|
93
|
+
$52FdA$solidjsweb.effect(_$p => $52FdA$solidjsweb.style(_el$, "position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%"), _$p));
|
|
94
|
+
return _el$;
|
|
95
|
+
})();
|
|
96
|
+
}
|
|
97
|
+
const $858fdcf73148519f$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<img>`, 1);
|
|
98
|
+
function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
99
|
+
const [size, setSize] = $52FdA$solidjs.createSignal(0);
|
|
100
|
+
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
|
|
101
|
+
for (let j = 0; j < records.length; j++) {
|
|
102
|
+
const {
|
|
103
|
+
width: width
|
|
104
|
+
} = records[j].contentRect;
|
|
105
|
+
if (!width) continue;
|
|
106
|
+
// 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
|
|
107
|
+
const new_size = width * 1.05 * ((0, $52FdA$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
108
|
+
setSize(Math.round(new_size));
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
// 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.
|
|
112
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
113
|
+
const disconnect = (0, $52FdA$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
|
|
114
|
+
let {
|
|
115
|
+
element: element
|
|
116
|
+
} = _ref;
|
|
117
|
+
return requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
|
|
118
|
+
});
|
|
119
|
+
$52FdA$solidjs.onCleanup(() => {
|
|
120
|
+
resizeObserver.disconnect();
|
|
121
|
+
disconnect();
|
|
122
|
+
});
|
|
123
|
+
return size;
|
|
124
|
+
}
|
|
125
|
+
function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
126
|
+
// Enable reactive props
|
|
127
|
+
const otherOptions = $52FdA$solidjs.createMemo(() => {
|
|
128
|
+
const cloned_props = {
|
|
129
|
+
...props
|
|
130
|
+
};
|
|
131
|
+
delete cloned_props.resolutions;
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
delete cloned_props.size;
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
delete cloned_props.src;
|
|
136
|
+
return cloned_props;
|
|
137
|
+
});
|
|
138
|
+
const src_options = $52FdA$solidjs.createMemo(() => {
|
|
139
|
+
const src = new URL(props.src, location.origin);
|
|
140
|
+
const fallback_src = $858fdcf73148519f$var$generateImageUrl(src, 400);
|
|
141
|
+
const srcset = $858fdcf73148519f$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
|
|
142
|
+
return {
|
|
143
|
+
src: fallback_src,
|
|
144
|
+
srcset: srcset
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
return (() => {
|
|
148
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($858fdcf73148519f$var$_tmpl$);
|
|
149
|
+
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(otherOptions, src_options, {
|
|
150
|
+
get sizes() {
|
|
151
|
+
return props.size() + "px";
|
|
152
|
+
}
|
|
153
|
+
}), false, false);
|
|
154
|
+
$52FdA$solidjsweb.runHydrationEvents();
|
|
155
|
+
return _el$;
|
|
156
|
+
})();
|
|
157
|
+
}
|
|
158
|
+
function $858fdcf73148519f$var$make_srcset(url, resolutions) {
|
|
159
|
+
return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
160
|
+
}
|
|
161
|
+
function $858fdcf73148519f$var$generateImageUrl(url, width) {
|
|
162
|
+
url.searchParams.set("width", width);
|
|
163
|
+
return url.href;
|
|
164
|
+
}
|
|
165
|
+
const $28535bb7671c63d1$var$backupSizeSignal = /*@__PURE__*/$52FdA$solidjs.createSignal();
|
|
166
|
+
const $28535bb7671c63d1$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
167
|
+
function $28535bb7671c63d1$export$e4b984597b71e989(props) {
|
|
168
|
+
const context = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
|
|
169
|
+
if (context && !context[$28535bb7671c63d1$export$d7b7ab832c20e2f4])
|
|
170
|
+
// create a signal that's the same for all items in this listing
|
|
171
|
+
context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $52FdA$solidjs.createSignal();
|
|
172
|
+
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
|
|
173
|
+
const container = $52FdA$solidjsweb.createComponent((0, $ce467edb5343cfcd$export$94026ee33dbabc26), {
|
|
174
|
+
get aspectRatio() {
|
|
175
|
+
return props.aspectRatio;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const owner = $52FdA$solidjs.getOwner();
|
|
179
|
+
let createdSizeAccessor = false;
|
|
180
|
+
let wasCleanedUp = false;
|
|
181
|
+
$52FdA$solidjs.createEffect(() => {
|
|
182
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
183
|
+
// ensure we always have a size accessor
|
|
184
|
+
// 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
|
|
185
|
+
setCurrentImageSize(() => $52FdA$solidjs.runWithOwner(owner, () => $858fdcf73148519f$export$e6fffe67d4cdd848(container)));
|
|
186
|
+
});
|
|
187
|
+
$52FdA$solidjs.onCleanup(() => {
|
|
188
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
189
|
+
if (!createdSizeAccessor) return;
|
|
190
|
+
$52FdA$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
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
container.append($52FdA$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), {
|
|
194
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
195
|
+
get size() {
|
|
196
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
197
|
+
var _currentImageSize;
|
|
198
|
+
return ((_currentImageSize = currentImageSize()) === null || _currentImageSize === void 0 ? void 0 : _currentImageSize()) || 0;
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
get src() {
|
|
202
|
+
return props.src;
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
return container;
|
|
206
|
+
}
|
|
72
207
|
const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<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>`, 4);
|
|
73
208
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
74
209
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -705,17 +840,21 @@ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
|
|
|
705
840
|
const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
706
841
|
return (() => {
|
|
707
842
|
const _el$ = $52FdA$solidjsweb.getNextElement($2badc30d7c6610e1$var$_tmpl$);
|
|
708
|
-
$52FdA$solidjsweb.insert(_el$, (
|
|
709
|
-
|
|
710
|
-
return
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
843
|
+
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
844
|
+
get children() {
|
|
845
|
+
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
846
|
+
product_card_template_: function () {
|
|
847
|
+
return props.product_card_template(...arguments);
|
|
848
|
+
},
|
|
849
|
+
recommendations_resource_: recommendations_resource_,
|
|
850
|
+
market_: () => props.market,
|
|
851
|
+
merchant_: () => props.merchant,
|
|
852
|
+
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
853
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
854
|
+
...grid_spacing_override()
|
|
855
|
+
}))
|
|
856
|
+
});
|
|
857
|
+
}
|
|
719
858
|
}));
|
|
720
859
|
return _el$;
|
|
721
860
|
})();
|
|
@@ -825,89 +964,27 @@ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
|
|
|
825
964
|
const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
826
965
|
return (() => {
|
|
827
966
|
const _el$2 = $52FdA$solidjsweb.getNextElement($41227f10ad680afd$var$_tmpl$2);
|
|
828
|
-
$52FdA$solidjsweb.insert(_el$2, (
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
967
|
+
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
968
|
+
get children() {
|
|
969
|
+
return $2c920813c92d6987$export$7da560f849543dff({
|
|
970
|
+
rows_object_: rows_object_,
|
|
971
|
+
product_card_template_: function () {
|
|
972
|
+
return props.product_card_template(...arguments);
|
|
973
|
+
},
|
|
974
|
+
recommendations_resource_: recommendations_resource_,
|
|
975
|
+
market_: () => props.market,
|
|
976
|
+
merchant_: () => props.merchant,
|
|
977
|
+
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
978
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
979
|
+
...grid_spacing_override()
|
|
980
|
+
}))
|
|
981
|
+
});
|
|
982
|
+
}
|
|
840
983
|
}));
|
|
841
984
|
return _el$2;
|
|
842
985
|
})();
|
|
843
986
|
}, "RecommendationGrid failed");
|
|
844
987
|
}
|
|
845
|
-
const $858fdcf73148519f$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<img>`, 1);
|
|
846
|
-
function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
847
|
-
const [size, setSize] = $52FdA$solidjs.createSignal(0);
|
|
848
|
-
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
|
|
849
|
-
for (let j = 0; j < records.length; j++) {
|
|
850
|
-
const {
|
|
851
|
-
width: width
|
|
852
|
-
} = records[j].contentRect;
|
|
853
|
-
if (!width) continue;
|
|
854
|
-
// 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
|
|
855
|
-
const new_size = width * 1.05 * ((0, $52FdA$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
856
|
-
setSize(Math.round(new_size));
|
|
857
|
-
}
|
|
858
|
-
}));
|
|
859
|
-
// 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.
|
|
860
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
861
|
-
const disconnect = (0, $52FdA$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
|
|
862
|
-
let {
|
|
863
|
-
element: element
|
|
864
|
-
} = _ref;
|
|
865
|
-
return requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
|
|
866
|
-
});
|
|
867
|
-
$52FdA$solidjs.onCleanup(() => {
|
|
868
|
-
resizeObserver.disconnect();
|
|
869
|
-
disconnect();
|
|
870
|
-
});
|
|
871
|
-
return size;
|
|
872
|
-
}
|
|
873
|
-
function $858fdcf73148519f$export$6e5611bc7e57e477(_ref2) {
|
|
874
|
-
let {
|
|
875
|
-
src: raw_src,
|
|
876
|
-
size: size,
|
|
877
|
-
resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
|
|
878
|
-
...otherOptions
|
|
879
|
-
} = _ref2;
|
|
880
|
-
const src = new URL(raw_src, location.origin);
|
|
881
|
-
const fallbackSrc = $858fdcf73148519f$var$generateImageUrl(src, 400);
|
|
882
|
-
const srcset = $858fdcf73148519f$var$make_srcset(src, resolutions);
|
|
883
|
-
return (() => {
|
|
884
|
-
const _el$ = $52FdA$solidjsweb.getNextElement($858fdcf73148519f$var$_tmpl$);
|
|
885
|
-
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(otherOptions, {
|
|
886
|
-
"src": fallbackSrc,
|
|
887
|
-
"srcset": srcset,
|
|
888
|
-
get sizes() {
|
|
889
|
-
return size() + "px";
|
|
890
|
-
}
|
|
891
|
-
}), false, false);
|
|
892
|
-
$52FdA$solidjsweb.runHydrationEvents();
|
|
893
|
-
return _el$;
|
|
894
|
-
})();
|
|
895
|
-
}
|
|
896
|
-
function $858fdcf73148519f$var$make_srcset(url, resolutions) {
|
|
897
|
-
return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
898
|
-
}
|
|
899
|
-
function $858fdcf73148519f$var$generateImageUrl(url, width) {
|
|
900
|
-
url.searchParams.set("width", width);
|
|
901
|
-
return url.href;
|
|
902
|
-
}
|
|
903
|
-
const $ce467edb5343cfcd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
|
|
904
|
-
function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
|
|
905
|
-
return (() => {
|
|
906
|
-
const _el$ = $52FdA$solidjsweb.getNextElement($ce467edb5343cfcd$var$_tmpl$);
|
|
907
|
-
$52FdA$solidjsweb.effect(_$p => $52FdA$solidjsweb.style(_el$, "position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%"), _$p));
|
|
908
|
-
return _el$;
|
|
909
|
-
})();
|
|
910
|
-
}
|
|
911
988
|
function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
|
|
912
989
|
const {
|
|
913
990
|
collapse: collapse,
|
|
@@ -7025,26 +7102,30 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
7025
7102
|
severity_: "error",
|
|
7026
7103
|
message_: "Showing results failed",
|
|
7027
7104
|
get children() {
|
|
7028
|
-
return $
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7105
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
7106
|
+
get children() {
|
|
7107
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
7108
|
+
min_products_to_fetch_:
|
|
7109
|
+
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
7110
|
+
min_products_to_fetch_,
|
|
7111
|
+
query_base_: query_base_,
|
|
7112
|
+
plp_results_: plp_results_,
|
|
7113
|
+
depict_api_: depict_api_,
|
|
7114
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
7115
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
7116
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
7117
|
+
layout_options_: layout_options_,
|
|
7118
|
+
product_card_template_: product_card_template_,
|
|
7119
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
7120
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
7121
|
+
id_currently_querying_for_: query_id_,
|
|
7122
|
+
no_results_options_: {
|
|
7123
|
+
selected_filters_: selected_filters_,
|
|
7124
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7125
|
+
i18n_: i18n_,
|
|
7126
|
+
local_filter_cache_: local_filter_cache_
|
|
7127
|
+
}
|
|
7128
|
+
});
|
|
7048
7129
|
}
|
|
7049
7130
|
});
|
|
7050
7131
|
}
|
|
@@ -8165,10 +8246,12 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8165
8246
|
} = _ref;
|
|
8166
8247
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
8167
8248
|
const rows_object = view_more_button_ ? $c77adcdf5346b187$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
8168
|
-
const [recommendations_resource] = $52FdA$solidjs.createResource(
|
|
8169
|
-
|
|
8249
|
+
const [recommendations_resource] = $52FdA$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
|
|
8250
|
+
// only fetch/refetch if all products are loaded
|
|
8251
|
+
query => query && depict_api_.get_recommended(query).then(r => r.displays));
|
|
8252
|
+
const should_show = $52FdA$solidjs.createMemo(() => {
|
|
8170
8253
|
var _recommendations_reso;
|
|
8171
|
-
return recommendations_resource.loading || (
|
|
8254
|
+
return !!((recommendations_resource.loading || (_recommendations_reso = recommendations_resource()) !== null && _recommendations_reso !== void 0 && _recommendations_reso.length) && all_products_loaded_());
|
|
8172
8255
|
});
|
|
8173
8256
|
const num_placeholders_ = $52FdA$solidjs.createMemo(() => (0, $da887c42f8e8847a$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(_ref2 => {
|
|
8174
8257
|
let [per_column] = _ref2;
|
|
@@ -8202,7 +8285,10 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8202
8285
|
get children() {
|
|
8203
8286
|
return (() => {
|
|
8204
8287
|
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
8205
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(
|
|
8288
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(prev => {
|
|
8289
|
+
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
|
|
8290
|
+
return recommendations_resource() || [];
|
|
8291
|
+
}));
|
|
8206
8292
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
8207
8293
|
displays_by_key_: displays_by_key_,
|
|
8208
8294
|
merchant_: $52FdA$solidjs.createMemo(() => search_query_base_().tenant),
|
|
@@ -8218,7 +8304,7 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8218
8304
|
})();
|
|
8219
8305
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
8220
8306
|
get when() {
|
|
8221
|
-
return
|
|
8307
|
+
return should_show();
|
|
8222
8308
|
},
|
|
8223
8309
|
children: elements
|
|
8224
8310
|
});
|
|
@@ -9747,17 +9833,21 @@ function $24419668d5fcfcd5$export$1c593cbd6f1e10bc(_ref) {
|
|
|
9747
9833
|
severity_: "error",
|
|
9748
9834
|
message_: "Instant results failed",
|
|
9749
9835
|
get children() {
|
|
9750
|
-
return $
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9836
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
9837
|
+
get children() {
|
|
9838
|
+
return $6e8d48eea3d0469d$export$62f101a8aa597bf8({
|
|
9839
|
+
search_field_value_: search_field_value_,
|
|
9840
|
+
depict_api_: depict_api_,
|
|
9841
|
+
tenant_: tenant_,
|
|
9842
|
+
i18n_: i18n_,
|
|
9843
|
+
market_: market_,
|
|
9844
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
9845
|
+
router_: router_,
|
|
9846
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
9847
|
+
content_search_enabled_: content_search_enabled_,
|
|
9848
|
+
...instant_results_options_
|
|
9849
|
+
});
|
|
9850
|
+
}
|
|
9761
9851
|
});
|
|
9762
9852
|
}
|
|
9763
9853
|
}), _el$10, _co$2);
|
|
@@ -10724,14 +10814,18 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10724
10814
|
return content_search_enabled_();
|
|
10725
10815
|
},
|
|
10726
10816
|
get children() {
|
|
10727
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10817
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10818
|
+
get children() {
|
|
10819
|
+
return $52FdA$solidjsweb.createComponent((0, $eab939d0b95b75ee$export$6d0c9c22f6652669), {
|
|
10820
|
+
content_results_rows_: content_results_rows_,
|
|
10821
|
+
search_results_: search_results_,
|
|
10822
|
+
i18n_: i18n_,
|
|
10823
|
+
get_search_query_: get_search_query_,
|
|
10824
|
+
layout_options_: content_layout_options_,
|
|
10825
|
+
router_: router_,
|
|
10826
|
+
query_base_: search_query_base_
|
|
10827
|
+
});
|
|
10828
|
+
}
|
|
10735
10829
|
});
|
|
10736
10830
|
}
|
|
10737
10831
|
});
|
|
@@ -10766,28 +10860,32 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10766
10860
|
severity_: "error",
|
|
10767
10861
|
message_: "Search results failed",
|
|
10768
10862
|
get children() {
|
|
10769
|
-
return $
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10863
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10864
|
+
get children() {
|
|
10865
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
10866
|
+
all_products_loaded_: all_products_loaded_,
|
|
10867
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
10868
|
+
query_base_: search_query_base_,
|
|
10869
|
+
plp_results_: search_results_,
|
|
10870
|
+
depict_api_: depict_api_,
|
|
10871
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
10872
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
10873
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
10874
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
10875
|
+
product_card_template_: product_card_template_,
|
|
10876
|
+
layout_options_: layout_options_,
|
|
10877
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
10878
|
+
id_currently_querying_for_: get_search_query_,
|
|
10879
|
+
no_results_options_: {
|
|
10880
|
+
selected_filters_: selected_filters_,
|
|
10881
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
10882
|
+
local_filter_cache_: local_filter_cache_,
|
|
10883
|
+
i18n_: {
|
|
10884
|
+
...i18n_,
|
|
10885
|
+
no_results_text_: no_results_text_
|
|
10886
|
+
}
|
|
10887
|
+
}
|
|
10888
|
+
});
|
|
10791
10889
|
}
|
|
10792
10890
|
});
|
|
10793
10891
|
}
|
|
@@ -10800,20 +10898,24 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10800
10898
|
severity_: "error",
|
|
10801
10899
|
message_: "Search recommendations failed",
|
|
10802
10900
|
get children() {
|
|
10803
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10901
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10902
|
+
get children() {
|
|
10903
|
+
return $52FdA$solidjsweb.createComponent((0, $c77adcdf5346b187$export$7de92c4c2205ebf3), {
|
|
10904
|
+
depict_api_: depict_api_,
|
|
10905
|
+
i18n_: i18n_,
|
|
10906
|
+
search_query_base_: search_query_base_,
|
|
10907
|
+
get layout_options_() {
|
|
10908
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
10909
|
+
var _recommendations_layo;
|
|
10910
|
+
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_();
|
|
10911
|
+
});
|
|
10912
|
+
},
|
|
10913
|
+
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10914
|
+
view_more_button_: search_recs_view_more_,
|
|
10915
|
+
product_card_template_: product_card_template_,
|
|
10916
|
+
all_products_loaded_: get_all_products_loaded
|
|
10811
10917
|
});
|
|
10812
|
-
}
|
|
10813
|
-
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10814
|
-
view_more_button_: search_recs_view_more_,
|
|
10815
|
-
product_card_template_: product_card_template_,
|
|
10816
|
-
all_products_loaded_: get_all_products_loaded
|
|
10918
|
+
}
|
|
10817
10919
|
});
|
|
10818
10920
|
}
|
|
10819
10921
|
});
|
package/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;
|