@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/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,139 @@ $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.15";
|
|
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
|
+
$52FdA$depictaiutilishared.dlog("Checking for", $28535bb7671c63d1$export$d7b7ab832c20e2f4, "in", context);
|
|
173
|
+
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
|
|
174
|
+
const container = $52FdA$solidjsweb.createComponent((0, $ce467edb5343cfcd$export$94026ee33dbabc26), {
|
|
175
|
+
get aspectRatio() {
|
|
176
|
+
return props.aspectRatio;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const owner = $52FdA$solidjs.getOwner();
|
|
180
|
+
let createdSizeAccessor = false;
|
|
181
|
+
let wasCleanedUp = false;
|
|
182
|
+
$52FdA$solidjs.createEffect(() => {
|
|
183
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
184
|
+
// ensure we always have a size accessor
|
|
185
|
+
// 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
|
|
186
|
+
setCurrentImageSize(() => $52FdA$solidjs.runWithOwner(owner, () => $858fdcf73148519f$export$e6fffe67d4cdd848(container)));
|
|
187
|
+
});
|
|
188
|
+
$52FdA$solidjs.onCleanup(() => {
|
|
189
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
190
|
+
if (!createdSizeAccessor) return;
|
|
191
|
+
$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
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
container.append($52FdA$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), {
|
|
195
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
196
|
+
get size() {
|
|
197
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
198
|
+
var _currentImageSize;
|
|
199
|
+
return ((_currentImageSize = currentImageSize()) === null || _currentImageSize === void 0 ? void 0 : _currentImageSize()) || 0;
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
get src() {
|
|
203
|
+
return props.src;
|
|
204
|
+
}
|
|
205
|
+
}));
|
|
206
|
+
return container;
|
|
207
|
+
}
|
|
72
208
|
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
209
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
74
210
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -705,17 +841,21 @@ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
|
|
|
705
841
|
const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
706
842
|
return (() => {
|
|
707
843
|
const _el$ = $52FdA$solidjsweb.getNextElement($2badc30d7c6610e1$var$_tmpl$);
|
|
708
|
-
$52FdA$solidjsweb.insert(_el$, (
|
|
709
|
-
|
|
710
|
-
return
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
844
|
+
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
845
|
+
get children() {
|
|
846
|
+
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
847
|
+
product_card_template_: function () {
|
|
848
|
+
return props.product_card_template(...arguments);
|
|
849
|
+
},
|
|
850
|
+
recommendations_resource_: recommendations_resource_,
|
|
851
|
+
market_: () => props.market,
|
|
852
|
+
merchant_: () => props.merchant,
|
|
853
|
+
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
854
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
855
|
+
...grid_spacing_override()
|
|
856
|
+
}))
|
|
857
|
+
});
|
|
858
|
+
}
|
|
719
859
|
}));
|
|
720
860
|
return _el$;
|
|
721
861
|
})();
|
|
@@ -825,89 +965,27 @@ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
|
|
|
825
965
|
const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
826
966
|
return (() => {
|
|
827
967
|
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
|
-
|
|
968
|
+
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
969
|
+
get children() {
|
|
970
|
+
return $2c920813c92d6987$export$7da560f849543dff({
|
|
971
|
+
rows_object_: rows_object_,
|
|
972
|
+
product_card_template_: function () {
|
|
973
|
+
return props.product_card_template(...arguments);
|
|
974
|
+
},
|
|
975
|
+
recommendations_resource_: recommendations_resource_,
|
|
976
|
+
market_: () => props.market,
|
|
977
|
+
merchant_: () => props.merchant,
|
|
978
|
+
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
979
|
+
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
980
|
+
...grid_spacing_override()
|
|
981
|
+
}))
|
|
982
|
+
});
|
|
983
|
+
}
|
|
840
984
|
}));
|
|
841
985
|
return _el$2;
|
|
842
986
|
})();
|
|
843
987
|
}, "RecommendationGrid failed");
|
|
844
988
|
}
|
|
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
989
|
function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
|
|
912
990
|
const {
|
|
913
991
|
collapse: collapse,
|
|
@@ -7025,26 +7103,30 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
7025
7103
|
severity_: "error",
|
|
7026
7104
|
message_: "Showing results failed",
|
|
7027
7105
|
get children() {
|
|
7028
|
-
return $
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7106
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
7107
|
+
get children() {
|
|
7108
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
7109
|
+
min_products_to_fetch_:
|
|
7110
|
+
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
7111
|
+
min_products_to_fetch_,
|
|
7112
|
+
query_base_: query_base_,
|
|
7113
|
+
plp_results_: plp_results_,
|
|
7114
|
+
depict_api_: depict_api_,
|
|
7115
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
7116
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
7117
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
7118
|
+
layout_options_: layout_options_,
|
|
7119
|
+
product_card_template_: product_card_template_,
|
|
7120
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
7121
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
7122
|
+
id_currently_querying_for_: query_id_,
|
|
7123
|
+
no_results_options_: {
|
|
7124
|
+
selected_filters_: selected_filters_,
|
|
7125
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7126
|
+
i18n_: i18n_,
|
|
7127
|
+
local_filter_cache_: local_filter_cache_
|
|
7128
|
+
}
|
|
7129
|
+
});
|
|
7048
7130
|
}
|
|
7049
7131
|
});
|
|
7050
7132
|
}
|
|
@@ -8165,10 +8247,12 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8165
8247
|
} = _ref;
|
|
8166
8248
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
8167
8249
|
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
|
-
|
|
8250
|
+
const [recommendations_resource] = $52FdA$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
|
|
8251
|
+
// only fetch/refetch if all products are loaded
|
|
8252
|
+
query => query && depict_api_.get_recommended(query).then(r => r.displays));
|
|
8253
|
+
const should_show = $52FdA$solidjs.createMemo(() => {
|
|
8170
8254
|
var _recommendations_reso;
|
|
8171
|
-
return recommendations_resource.loading || (
|
|
8255
|
+
return !!((recommendations_resource.loading || (_recommendations_reso = recommendations_resource()) !== null && _recommendations_reso !== void 0 && _recommendations_reso.length) && all_products_loaded_());
|
|
8172
8256
|
});
|
|
8173
8257
|
const num_placeholders_ = $52FdA$solidjs.createMemo(() => (0, $da887c42f8e8847a$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(_ref2 => {
|
|
8174
8258
|
let [per_column] = _ref2;
|
|
@@ -8202,7 +8286,10 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8202
8286
|
get children() {
|
|
8203
8287
|
return (() => {
|
|
8204
8288
|
// 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(
|
|
8289
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(prev => {
|
|
8290
|
+
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
|
|
8291
|
+
return recommendations_resource() || [];
|
|
8292
|
+
}));
|
|
8206
8293
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
8207
8294
|
displays_by_key_: displays_by_key_,
|
|
8208
8295
|
merchant_: $52FdA$solidjs.createMemo(() => search_query_base_().tenant),
|
|
@@ -8218,7 +8305,7 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8218
8305
|
})();
|
|
8219
8306
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
8220
8307
|
get when() {
|
|
8221
|
-
return
|
|
8308
|
+
return should_show();
|
|
8222
8309
|
},
|
|
8223
8310
|
children: elements
|
|
8224
8311
|
});
|
|
@@ -9747,17 +9834,21 @@ function $24419668d5fcfcd5$export$1c593cbd6f1e10bc(_ref) {
|
|
|
9747
9834
|
severity_: "error",
|
|
9748
9835
|
message_: "Instant results failed",
|
|
9749
9836
|
get children() {
|
|
9750
|
-
return $
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9837
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
9838
|
+
get children() {
|
|
9839
|
+
return $6e8d48eea3d0469d$export$62f101a8aa597bf8({
|
|
9840
|
+
search_field_value_: search_field_value_,
|
|
9841
|
+
depict_api_: depict_api_,
|
|
9842
|
+
tenant_: tenant_,
|
|
9843
|
+
i18n_: i18n_,
|
|
9844
|
+
market_: market_,
|
|
9845
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
9846
|
+
router_: router_,
|
|
9847
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
9848
|
+
content_search_enabled_: content_search_enabled_,
|
|
9849
|
+
...instant_results_options_
|
|
9850
|
+
});
|
|
9851
|
+
}
|
|
9761
9852
|
});
|
|
9762
9853
|
}
|
|
9763
9854
|
}), _el$10, _co$2);
|
|
@@ -10724,14 +10815,18 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10724
10815
|
return content_search_enabled_();
|
|
10725
10816
|
},
|
|
10726
10817
|
get children() {
|
|
10727
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10818
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10819
|
+
get children() {
|
|
10820
|
+
return $52FdA$solidjsweb.createComponent((0, $eab939d0b95b75ee$export$6d0c9c22f6652669), {
|
|
10821
|
+
content_results_rows_: content_results_rows_,
|
|
10822
|
+
search_results_: search_results_,
|
|
10823
|
+
i18n_: i18n_,
|
|
10824
|
+
get_search_query_: get_search_query_,
|
|
10825
|
+
layout_options_: content_layout_options_,
|
|
10826
|
+
router_: router_,
|
|
10827
|
+
query_base_: search_query_base_
|
|
10828
|
+
});
|
|
10829
|
+
}
|
|
10735
10830
|
});
|
|
10736
10831
|
}
|
|
10737
10832
|
});
|
|
@@ -10766,28 +10861,32 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10766
10861
|
severity_: "error",
|
|
10767
10862
|
message_: "Search results failed",
|
|
10768
10863
|
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
|
-
|
|
10864
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10865
|
+
get children() {
|
|
10866
|
+
return $484eec37514a982e$export$3925f87b1545cfc6({
|
|
10867
|
+
all_products_loaded_: all_products_loaded_,
|
|
10868
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
10869
|
+
query_base_: search_query_base_,
|
|
10870
|
+
plp_results_: search_results_,
|
|
10871
|
+
depict_api_: depict_api_,
|
|
10872
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
10873
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
10874
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
10875
|
+
desktop_filter_elements_: desktop_filter_elements_,
|
|
10876
|
+
product_card_template_: product_card_template_,
|
|
10877
|
+
layout_options_: layout_options_,
|
|
10878
|
+
sort_or_filter_open_: sort_or_filter_open_,
|
|
10879
|
+
id_currently_querying_for_: get_search_query_,
|
|
10880
|
+
no_results_options_: {
|
|
10881
|
+
selected_filters_: selected_filters_,
|
|
10882
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
10883
|
+
local_filter_cache_: local_filter_cache_,
|
|
10884
|
+
i18n_: {
|
|
10885
|
+
...i18n_,
|
|
10886
|
+
no_results_text_: no_results_text_
|
|
10887
|
+
}
|
|
10888
|
+
}
|
|
10889
|
+
});
|
|
10791
10890
|
}
|
|
10792
10891
|
});
|
|
10793
10892
|
}
|
|
@@ -10800,20 +10899,24 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10800
10899
|
severity_: "error",
|
|
10801
10900
|
message_: "Search recommendations failed",
|
|
10802
10901
|
get children() {
|
|
10803
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10902
|
+
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
10903
|
+
get children() {
|
|
10904
|
+
return $52FdA$solidjsweb.createComponent((0, $c77adcdf5346b187$export$7de92c4c2205ebf3), {
|
|
10905
|
+
depict_api_: depict_api_,
|
|
10906
|
+
i18n_: i18n_,
|
|
10907
|
+
search_query_base_: search_query_base_,
|
|
10908
|
+
get layout_options_() {
|
|
10909
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
10910
|
+
var _recommendations_layo;
|
|
10911
|
+
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_();
|
|
10912
|
+
});
|
|
10913
|
+
},
|
|
10914
|
+
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10915
|
+
view_more_button_: search_recs_view_more_,
|
|
10916
|
+
product_card_template_: product_card_template_,
|
|
10917
|
+
all_products_loaded_: get_all_products_loaded
|
|
10811
10918
|
});
|
|
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
|
|
10919
|
+
}
|
|
10817
10920
|
});
|
|
10818
10921
|
}
|
|
10819
10922
|
});
|
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.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;
|