@depict-ai/ui 2.0.13 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  var $52FdA$depictaiutilishared = require("@depict-ai/utilishared/ES10");
2
- var $52FdA$solidjs = require("solid-js");
3
2
  var $52FdA$solidjsweb = require("solid-js/web");
3
+ var $52FdA$solidjs = require("solid-js");
4
4
  var $52FdA$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
5
5
  var $52FdA$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
6
6
  var $52FdA$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
@@ -16,6 +16,11 @@ 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);
23
+ $parcel$export(module.exports, "SlidableItems", () => $ad8ec7729fffeb9c$export$6649caad96ef8870);
19
24
  $parcel$export(module.exports, "make_accurate_size_accessor", () => $13671aa5e984acd9$export$9f191182275e9ef);
20
25
  $parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
21
26
  $parcel$export(module.exports, "RecommendationGrid", () => $41227f10ad680afd$export$9756467d34d91cdb);
@@ -67,7 +72,199 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
67
72
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
68
73
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
69
74
  /*! Depict.ai search and product listing SDK */
70
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.13";
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
+ }
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);
209
+ function $9d19451330d04c3c$export$8be2714ec7f169ee() {
210
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
211
+ return (() => {
212
+ const _el$ = $52FdA$solidjsweb.getNextElement($9d19451330d04c3c$var$_tmpl$);
213
+ $52FdA$solidjsweb.effect(_p$ => {
214
+ var _props$width_, _props$height_;
215
+ const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
216
+ _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
217
+ _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
218
+ _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
219
+ return _p$;
220
+ }, {
221
+ _v$: undefined,
222
+ _v$2: undefined
223
+ });
224
+ return _el$;
225
+ })();
226
+ }
227
+ const $ad8ec7729fffeb9c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
228
+ function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
229
+ let {
230
+ children: children,
231
+ slider_ref_: slider_ref_,
232
+ faded_opacity_ = 0.7,
233
+ mutation_plugins_ = [],
234
+ disable_fading_: disable_fading_,
235
+ arrow_width_: arrow_width_,
236
+ arrow_height_: arrow_height_
237
+ } = _ref;
238
+ const slider = new (0, $52FdA$depictaiutilishared.Amazing_Slider)({
239
+ button_contents: {
240
+ left: [(() => {
241
+ const _el$ = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
242
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {
243
+ height_: arrow_height_,
244
+ width_: arrow_width_
245
+ }));
246
+ return _el$;
247
+ })()],
248
+ right: [(() => {
249
+ const _el$2 = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
250
+ $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {
251
+ height_: arrow_height_,
252
+ width_: arrow_width_
253
+ }));
254
+ return _el$2;
255
+ })()]
256
+ },
257
+ constructor_plugins: [$52FdA$depictaiutilishared.slider_snap_css().constructor_plugin],
258
+ mutation_plugins: [...(disable_fading_ ? [] : [$52FdA$depictaiutilishared.slider_fading_factory({
259
+ threshold_: 0.96,
260
+ faded_opacity_: faded_opacity_
261
+ }).mutation_plugin_]), ...mutation_plugins_]
262
+ });
263
+ $52FdA$solidjsweb.insert(slider.insert_here, children);
264
+ $52FdA$solidjs.onCleanup(() => slider.observer.disconnect());
265
+ slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
266
+ return slider.container;
267
+ }
71
268
 
72
269
  /** @jsxImportSource solid-js */
73
270
 
@@ -530,66 +727,6 @@ function $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, container_element) {
530
727
  return [container_element, $52FdA$solidjsweb.memo(view_more_button_container), $52FdA$solidjsweb.memo(view_less_button_container), style_element];
531
728
  }
532
729
  $52FdA$solidjsweb.delegateEvents(["click"]);
533
- 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);
534
- function $9d19451330d04c3c$export$8be2714ec7f169ee() {
535
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
536
- return (() => {
537
- const _el$ = $52FdA$solidjsweb.getNextElement($9d19451330d04c3c$var$_tmpl$);
538
- $52FdA$solidjsweb.effect(_p$ => {
539
- var _props$width_, _props$height_;
540
- const _v$ = (_props$width_ = props.width_) !== null && _props$width_ !== void 0 ? _props$width_ : 14,
541
- _v$2 = (_props$height_ = props.height_) !== null && _props$height_ !== void 0 ? _props$height_ : 26;
542
- _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
543
- _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
544
- return _p$;
545
- }, {
546
- _v$: undefined,
547
- _v$2: undefined
548
- });
549
- return _el$;
550
- })();
551
- }
552
- const $ad8ec7729fffeb9c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
553
- function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
554
- let {
555
- children: children,
556
- slider_ref_: slider_ref_,
557
- faded_opacity_ = 0.7,
558
- mutation_plugins_ = [],
559
- disable_fading_: disable_fading_,
560
- arrow_width_: arrow_width_,
561
- arrow_height_: arrow_height_
562
- } = _ref;
563
- const slider = new (0, $52FdA$depictaiutilishared.Amazing_Slider)({
564
- button_contents: {
565
- left: [(() => {
566
- const _el$ = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
567
- $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {
568
- height_: arrow_height_,
569
- width_: arrow_width_
570
- }));
571
- return _el$;
572
- })()],
573
- right: [(() => {
574
- const _el$2 = $52FdA$solidjsweb.getNextElement($ad8ec7729fffeb9c$var$_tmpl$);
575
- $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $9d19451330d04c3c$export$8be2714ec7f169ee), {
576
- height_: arrow_height_,
577
- width_: arrow_width_
578
- }));
579
- return _el$2;
580
- })()]
581
- },
582
- constructor_plugins: [$52FdA$depictaiutilishared.slider_snap_css().constructor_plugin],
583
- mutation_plugins: [...(disable_fading_ ? [] : [$52FdA$depictaiutilishared.slider_fading_factory({
584
- threshold_: 0.96,
585
- faded_opacity_: faded_opacity_
586
- }).mutation_plugin_]), ...mutation_plugins_]
587
- });
588
- $52FdA$solidjsweb.insert(slider.insert_here, children);
589
- $52FdA$solidjs.onCleanup(() => slider.observer.disconnect());
590
- slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
591
- return slider.container;
592
- }
593
730
  function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
594
731
  let {
595
732
  recommendations_resource_: recommendations_resource_,
@@ -704,17 +841,21 @@ function $2badc30d7c6610e1$export$9574e176201e5e8d(props) {
704
841
  const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
705
842
  return (() => {
706
843
  const _el$ = $52FdA$solidjsweb.getNextElement($2badc30d7c6610e1$var$_tmpl$);
707
- $52FdA$solidjsweb.insert(_el$, () => $236a257ee52e5414$export$d41d19e89346fa2({
708
- product_card_template_: function () {
709
- return props.product_card_template(...arguments);
710
- },
711
- recommendations_resource_: recommendations_resource_,
712
- market_: () => props.market,
713
- merchant_: () => props.merchant,
714
- layout_options_: $52FdA$solidjs.createMemo(() => ({
715
- cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
716
- ...grid_spacing_override()
717
- }))
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
+ }
718
859
  }));
719
860
  return _el$;
720
861
  })();
@@ -824,89 +965,27 @@ function $41227f10ad680afd$export$9756467d34d91cdb(props) {
824
965
  const [recommendations_resource_] = $52FdA$solidjs.createResource(() => props.recommendations, recs => recs);
825
966
  return (() => {
826
967
  const _el$2 = $52FdA$solidjsweb.getNextElement($41227f10ad680afd$var$_tmpl$2);
827
- $52FdA$solidjsweb.insert(_el$2, () => $2c920813c92d6987$export$7da560f849543dff({
828
- rows_object_: rows_object_,
829
- product_card_template_: function () {
830
- return props.product_card_template(...arguments);
831
- },
832
- recommendations_resource_: recommendations_resource_,
833
- market_: () => props.market,
834
- merchant_: () => props.merchant,
835
- layout_options_: $52FdA$solidjs.createMemo(() => ({
836
- cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
837
- ...grid_spacing_override()
838
- }))
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
+ }
839
984
  }));
840
985
  return _el$2;
841
986
  })();
842
987
  }, "RecommendationGrid failed");
843
988
  }
844
- const $858fdcf73148519f$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<img>`, 1);
845
- function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
846
- const [size, setSize] = $52FdA$solidjs.createSignal(0);
847
- const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
848
- for (let j = 0; j < records.length; j++) {
849
- const {
850
- width: width
851
- } = records[j].contentRect;
852
- if (!width) continue;
853
- // 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
854
- const new_size = width * 1.05 * ((0, $52FdA$depictaiutilishared.is_safari) ? 4 / 3 : 1);
855
- setSize(Math.round(new_size));
856
- }
857
- }));
858
- // 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.
859
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
860
- const disconnect = (0, $52FdA$depictaiutilishared.observer).onexists(whatToWatch, _ref => {
861
- let {
862
- element: element
863
- } = _ref;
864
- return requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
865
- });
866
- $52FdA$solidjs.onCleanup(() => {
867
- resizeObserver.disconnect();
868
- disconnect();
869
- });
870
- return size;
871
- }
872
- function $858fdcf73148519f$export$6e5611bc7e57e477(_ref2) {
873
- let {
874
- src: raw_src,
875
- size: size,
876
- resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
877
- ...otherOptions
878
- } = _ref2;
879
- const src = new URL(raw_src, location.origin);
880
- const fallbackSrc = $858fdcf73148519f$var$generateImageUrl(src, 400);
881
- const srcset = $858fdcf73148519f$var$make_srcset(src, resolutions);
882
- return (() => {
883
- const _el$ = $52FdA$solidjsweb.getNextElement($858fdcf73148519f$var$_tmpl$);
884
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(otherOptions, {
885
- "src": fallbackSrc,
886
- "srcset": srcset,
887
- get sizes() {
888
- return size() + "px";
889
- }
890
- }), false, false);
891
- $52FdA$solidjsweb.runHydrationEvents();
892
- return _el$;
893
- })();
894
- }
895
- function $858fdcf73148519f$var$make_srcset(url, resolutions) {
896
- return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
897
- }
898
- function $858fdcf73148519f$var$generateImageUrl(url, width) {
899
- url.searchParams.set("width", width);
900
- return url.href;
901
- }
902
- const $ce467edb5343cfcd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2);
903
- function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
904
- return (() => {
905
- const _el$ = $52FdA$solidjsweb.getNextElement($ce467edb5343cfcd$var$_tmpl$);
906
- $52FdA$solidjsweb.effect(_$p => $52FdA$solidjsweb.style(_el$, "position:relative;width:100%;padding-bottom:".concat(1 / props.aspectRatio * 100, "%"), _$p));
907
- return _el$;
908
- })();
909
- }
910
989
  function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
911
990
  const {
912
991
  collapse: collapse,
@@ -7024,26 +7103,30 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7024
7103
  severity_: "error",
7025
7104
  message_: "Showing results failed",
7026
7105
  get children() {
7027
- return $484eec37514a982e$export$3925f87b1545cfc6({
7028
- min_products_to_fetch_:
7029
- // if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
7030
- min_products_to_fetch_,
7031
- query_base_: query_base_,
7032
- plp_results_: plp_results_,
7033
- depict_api_: depict_api_,
7034
- first_result_in_viewport_: first_result_in_viewport_,
7035
- last_result_in_viewport_: last_result_in_viewport_,
7036
- scroll_restoration_data_: scroll_restoration_data_,
7037
- layout_options_: layout_options_,
7038
- product_card_template_: product_card_template_,
7039
- sort_or_filter_open_: sort_or_filter_open_,
7040
- desktop_filter_elements_: desktop_filter_elements_,
7041
- id_currently_querying_for_: query_id_,
7042
- no_results_options_: {
7043
- selected_filters_: selected_filters_,
7044
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7045
- i18n_: i18n_,
7046
- local_filter_cache_: local_filter_cache_
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
+ });
7047
7130
  }
7048
7131
  });
7049
7132
  }
@@ -8164,10 +8247,12 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
8164
8247
  } = _ref;
8165
8248
  const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
8166
8249
  const rows_object = view_more_button_ ? $c77adcdf5346b187$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
8167
- const [recommendations_resource] = $52FdA$solidjs.createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
8168
- const is_showing_something = $52FdA$solidjs.createMemo(() => {
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(() => {
8169
8254
  var _recommendations_reso;
8170
- return recommendations_resource.loading || ((_recommendations_reso = recommendations_resource()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
8255
+ return !!((recommendations_resource.loading || (_recommendations_reso = recommendations_resource()) !== null && _recommendations_reso !== void 0 && _recommendations_reso.length) && all_products_loaded_());
8171
8256
  });
8172
8257
  const num_placeholders_ = $52FdA$solidjs.createMemo(() => (0, $da887c42f8e8847a$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(_ref2 => {
8173
8258
  let [per_column] = _ref2;
@@ -8201,7 +8286,10 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
8201
8286
  get children() {
8202
8287
  return (() => {
8203
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
8204
- const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource() || []));
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
+ }));
8205
8293
  return $76012c4468a53d1f$export$43f0fb951fcb0c54({
8206
8294
  displays_by_key_: displays_by_key_,
8207
8295
  merchant_: $52FdA$solidjs.createMemo(() => search_query_base_().tenant),
@@ -8217,7 +8305,7 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
8217
8305
  })();
8218
8306
  return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
8219
8307
  get when() {
8220
- return $52FdA$solidjsweb.memo(() => !!is_showing_something())() && all_products_loaded_();
8308
+ return should_show();
8221
8309
  },
8222
8310
  children: elements
8223
8311
  });
@@ -9746,17 +9834,21 @@ function $24419668d5fcfcd5$export$1c593cbd6f1e10bc(_ref) {
9746
9834
  severity_: "error",
9747
9835
  message_: "Instant results failed",
9748
9836
  get children() {
9749
- return $6e8d48eea3d0469d$export$62f101a8aa597bf8({
9750
- search_field_value_: search_field_value_,
9751
- depict_api_: depict_api_,
9752
- tenant_: tenant_,
9753
- i18n_: i18n_,
9754
- market_: market_,
9755
- set_total_num_results_accessor_: set_total_num_results_accessor_,
9756
- router_: router_,
9757
- set_modal_search_results_: set_modal_search_results_,
9758
- content_search_enabled_: content_search_enabled_,
9759
- ...instant_results_options_
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
+ }
9760
9852
  });
9761
9853
  }
9762
9854
  }), _el$10, _co$2);
@@ -10723,14 +10815,18 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
10723
10815
  return content_search_enabled_();
10724
10816
  },
10725
10817
  get children() {
10726
- return $52FdA$solidjsweb.createComponent((0, $eab939d0b95b75ee$export$6d0c9c22f6652669), {
10727
- content_results_rows_: content_results_rows_,
10728
- search_results_: search_results_,
10729
- i18n_: i18n_,
10730
- get_search_query_: get_search_query_,
10731
- layout_options_: content_layout_options_,
10732
- router_: router_,
10733
- query_base_: search_query_base_
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
+ }
10734
10830
  });
10735
10831
  }
10736
10832
  });
@@ -10765,28 +10861,32 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
10765
10861
  severity_: "error",
10766
10862
  message_: "Search results failed",
10767
10863
  get children() {
10768
- return $484eec37514a982e$export$3925f87b1545cfc6({
10769
- all_products_loaded_: all_products_loaded_,
10770
- min_products_to_fetch_: min_products_to_fetch_,
10771
- query_base_: search_query_base_,
10772
- plp_results_: search_results_,
10773
- depict_api_: depict_api_,
10774
- first_result_in_viewport_: first_result_in_viewport_,
10775
- last_result_in_viewport_: last_result_in_viewport_,
10776
- scroll_restoration_data_: scroll_restoration_data_,
10777
- desktop_filter_elements_: desktop_filter_elements_,
10778
- product_card_template_: product_card_template_,
10779
- layout_options_: layout_options_,
10780
- sort_or_filter_open_: sort_or_filter_open_,
10781
- id_currently_querying_for_: get_search_query_,
10782
- no_results_options_: {
10783
- selected_filters_: selected_filters_,
10784
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
10785
- local_filter_cache_: local_filter_cache_,
10786
- i18n_: {
10787
- ...i18n_,
10788
- no_results_text_: no_results_text_
10789
- }
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
+ });
10790
10890
  }
10791
10891
  });
10792
10892
  }
@@ -10799,20 +10899,24 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
10799
10899
  severity_: "error",
10800
10900
  message_: "Search recommendations failed",
10801
10901
  get children() {
10802
- return $52FdA$solidjsweb.createComponent((0, $c77adcdf5346b187$export$7de92c4c2205ebf3), {
10803
- depict_api_: depict_api_,
10804
- i18n_: i18n_,
10805
- search_query_base_: search_query_base_,
10806
- get layout_options_() {
10807
- return $52FdA$solidjs.createMemo(() => {
10808
- var _recommendations_layo;
10809
- 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_();
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
10810
10918
  });
10811
- },
10812
- showing_recommendation_rows_: showing_recommendation_rows_,
10813
- view_more_button_: search_recs_view_more_,
10814
- product_card_template_: product_card_template_,
10815
- all_products_loaded_: get_all_products_loaded
10919
+ }
10816
10920
  });
10817
10921
  }
10818
10922
  });