@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/latest/index.cjs CHANGED
@@ -10,6 +10,10 @@ function $parcel$export(e, n, v, s) {
10
10
  configurable: true
11
11
  });
12
12
  }
13
+ $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
14
+ $parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
15
+ $parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
16
+ $parcel$export(module.exports, "ShopifyContainedImage", () => $a33065cfed827fc0$export$e4b984597b71e989);
13
17
  $parcel$export(module.exports, "SlidableItems", () => $a0e53f99354809d9$export$6649caad96ef8870);
14
18
  $parcel$export(module.exports, "make_accurate_size_accessor", () => $e5f442fb78c98741$export$9f191182275e9ef);
15
19
  $parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
@@ -62,7 +66,132 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
62
66
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
63
67
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
64
68
  /*! Depict.ai search and product listing SDK */
65
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.14";
69
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.16";
70
+ const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
71
+ function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
72
+ const our_object = {};
73
+ return $gVhhF$solidjsweb.createComponent($84798aaa863a4909$var$ListingContext.Provider, {
74
+ value: our_object,
75
+ get children() {
76
+ return props.children;
77
+ }
78
+ });
79
+ }
80
+ function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
81
+ return $gVhhF$solidjs.useContext($84798aaa863a4909$var$ListingContext);
82
+ }
83
+ const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
84
+ function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
85
+ return (() => {
86
+ const _el$ = $gVhhF$solidjsweb.getNextElement($93304d59a9747aa6$var$_tmpl$);
87
+ $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.style(_el$, `position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`, _$p));
88
+ return _el$;
89
+ })();
90
+ }
91
+ const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
92
+ function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
93
+ const [size, setSize] = $gVhhF$solidjs.createSignal(0);
94
+ const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
95
+ for (let j = 0; j < records.length; j++) {
96
+ const {
97
+ width: width
98
+ } = records[j].contentRect;
99
+ if (!width) continue;
100
+ // 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
101
+ const new_size = width * 1.05 * ((0, $gVhhF$depictaiutilishared.is_safari) ? 4 / 3 : 1);
102
+ setSize(Math.round(new_size));
103
+ }
104
+ }));
105
+ // 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.
106
+ // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
107
+ const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
108
+ element: element
109
+ }) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
110
+ $gVhhF$solidjs.onCleanup(() => {
111
+ resizeObserver.disconnect();
112
+ disconnect();
113
+ });
114
+ return size;
115
+ }
116
+ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
117
+ // Enable reactive props
118
+ const otherOptions = $gVhhF$solidjs.createMemo(() => {
119
+ const cloned_props = {
120
+ ...props
121
+ };
122
+ delete cloned_props.resolutions;
123
+ // @ts-ignore
124
+ delete cloned_props.size;
125
+ // @ts-ignore
126
+ delete cloned_props.src;
127
+ return cloned_props;
128
+ });
129
+ const src_options = $gVhhF$solidjs.createMemo(() => {
130
+ const src = new URL(props.src, location.origin);
131
+ const fallback_src = $19950faaac026e09$var$generateImageUrl(src, 400);
132
+ const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
133
+ return {
134
+ src: fallback_src,
135
+ srcset: srcset
136
+ };
137
+ });
138
+ return (() => {
139
+ const _el$ = $gVhhF$solidjsweb.getNextElement($19950faaac026e09$var$_tmpl$);
140
+ $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(otherOptions, src_options, {
141
+ get sizes() {
142
+ return props.size() + "px";
143
+ }
144
+ }), false, false);
145
+ $gVhhF$solidjsweb.runHydrationEvents();
146
+ return _el$;
147
+ })();
148
+ }
149
+ function $19950faaac026e09$var$make_srcset(url, resolutions) {
150
+ return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
151
+ }
152
+ function $19950faaac026e09$var$generateImageUrl(url, width) {
153
+ url.searchParams.set("width", width);
154
+ return url.href;
155
+ }
156
+ const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$gVhhF$solidjs.createSignal();
157
+ const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
158
+ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
159
+ const context = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
160
+ if (context && !context[$a33065cfed827fc0$export$d7b7ab832c20e2f4])
161
+ // create a signal that's the same for all items in this listing
162
+ context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $gVhhF$solidjs.createSignal();
163
+ const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
164
+ const container = $gVhhF$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
165
+ get aspectRatio() {
166
+ return props.aspectRatio;
167
+ }
168
+ });
169
+ const owner = $gVhhF$solidjs.getOwner();
170
+ let createdSizeAccessor = false;
171
+ let wasCleanedUp = false;
172
+ $gVhhF$solidjs.createEffect(() => {
173
+ if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
174
+ // ensure we always have a size accessor
175
+ // 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
176
+ setCurrentImageSize(() => $gVhhF$solidjs.runWithOwner(owner, () => $19950faaac026e09$export$e6fffe67d4cdd848(container)));
177
+ });
178
+ $gVhhF$solidjs.onCleanup(() => {
179
+ wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
180
+ if (!createdSizeAccessor) return;
181
+ $gVhhF$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
182
+ });
183
+
184
+ container.append($gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
185
+ style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
186
+ get size() {
187
+ return $gVhhF$solidjs.createMemo(() => currentImageSize()?.() || 0);
188
+ },
189
+ get src() {
190
+ return props.src;
191
+ }
192
+ }));
193
+ return container;
194
+ }
66
195
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$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);
67
196
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
68
197
  return (() => {
@@ -660,15 +789,19 @@ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
660
789
  const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
661
790
  return (() => {
662
791
  const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
663
- $gVhhF$solidjsweb.insert(_el$, () => $363ce4d1d71041aa$export$d41d19e89346fa2({
664
- product_card_template_: (...args) => props.product_card_template(...args),
665
- recommendations_resource_: recommendations_resource_,
666
- market_: () => props.market,
667
- merchant_: () => props.merchant,
668
- layout_options_: $gVhhF$solidjs.createMemo(() => ({
669
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
670
- ...grid_spacing_override()
671
- }))
792
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
793
+ get children() {
794
+ return $363ce4d1d71041aa$export$d41d19e89346fa2({
795
+ product_card_template_: (...args) => props.product_card_template(...args),
796
+ recommendations_resource_: recommendations_resource_,
797
+ market_: () => props.market,
798
+ merchant_: () => props.merchant,
799
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
800
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
801
+ ...grid_spacing_override()
802
+ }))
803
+ });
804
+ }
672
805
  }));
673
806
  return _el$;
674
807
  })();
@@ -773,83 +906,25 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
773
906
  const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
774
907
  return (() => {
775
908
  const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
776
- $gVhhF$solidjsweb.insert(_el$2, () => $b8e79813f4f7ebe4$export$7da560f849543dff({
777
- rows_object_: rows_object_,
778
- product_card_template_: (...args) => props.product_card_template(...args),
779
- recommendations_resource_: recommendations_resource_,
780
- market_: () => props.market,
781
- merchant_: () => props.merchant,
782
- layout_options_: $gVhhF$solidjs.createMemo(() => ({
783
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
784
- ...grid_spacing_override()
785
- }))
909
+ $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
910
+ get children() {
911
+ return $b8e79813f4f7ebe4$export$7da560f849543dff({
912
+ rows_object_: rows_object_,
913
+ product_card_template_: (...args) => props.product_card_template(...args),
914
+ recommendations_resource_: recommendations_resource_,
915
+ market_: () => props.market,
916
+ merchant_: () => props.merchant,
917
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
918
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
919
+ ...grid_spacing_override()
920
+ }))
921
+ });
922
+ }
786
923
  }));
787
924
  return _el$2;
788
925
  })();
789
926
  }, "RecommendationGrid failed");
790
927
  }
791
- const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
792
- function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
793
- const [size, setSize] = $gVhhF$solidjs.createSignal(0);
794
- const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
795
- for (let j = 0; j < records.length; j++) {
796
- const {
797
- width: width
798
- } = records[j].contentRect;
799
- if (!width) continue;
800
- // 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
801
- const new_size = width * 1.05 * ((0, $gVhhF$depictaiutilishared.is_safari) ? 4 / 3 : 1);
802
- setSize(Math.round(new_size));
803
- }
804
- }));
805
- // 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.
806
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
807
- const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
808
- element: element
809
- }) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
810
- $gVhhF$solidjs.onCleanup(() => {
811
- resizeObserver.disconnect();
812
- disconnect();
813
- });
814
- return size;
815
- }
816
- function $19950faaac026e09$export$6e5611bc7e57e477({
817
- src: raw_src,
818
- size: size,
819
- resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
820
- ...otherOptions
821
- }) {
822
- const src = new URL(raw_src, location.origin);
823
- const fallbackSrc = $19950faaac026e09$var$generateImageUrl(src, 400);
824
- const srcset = $19950faaac026e09$var$make_srcset(src, resolutions);
825
- return (() => {
826
- const _el$ = $gVhhF$solidjsweb.getNextElement($19950faaac026e09$var$_tmpl$);
827
- $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(otherOptions, {
828
- "src": fallbackSrc,
829
- "srcset": srcset,
830
- get sizes() {
831
- return size() + "px";
832
- }
833
- }), false, false);
834
- $gVhhF$solidjsweb.runHydrationEvents();
835
- return _el$;
836
- })();
837
- }
838
- function $19950faaac026e09$var$make_srcset(url, resolutions) {
839
- return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
840
- }
841
- function $19950faaac026e09$var$generateImageUrl(url, width) {
842
- url.searchParams.set("width", width);
843
- return url.href;
844
- }
845
- const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
846
- function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
847
- return (() => {
848
- const _el$ = $gVhhF$solidjsweb.getNextElement($93304d59a9747aa6$var$_tmpl$);
849
- $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.style(_el$, `position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`, _$p));
850
- return _el$;
851
- })();
852
- }
853
928
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
854
929
  const {
855
930
  collapse: collapse,
@@ -6541,26 +6616,30 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6541
6616
  severity_: "error",
6542
6617
  message_: "Showing results failed",
6543
6618
  get children() {
6544
- return $fe76fb463cc60b89$export$3925f87b1545cfc6({
6545
- min_products_to_fetch_:
6546
- // if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
6547
- min_products_to_fetch_,
6548
- query_base_: query_base_,
6549
- plp_results_: plp_results_,
6550
- depict_api_: depict_api_,
6551
- first_result_in_viewport_: first_result_in_viewport_,
6552
- last_result_in_viewport_: last_result_in_viewport_,
6553
- scroll_restoration_data_: scroll_restoration_data_,
6554
- layout_options_: layout_options_,
6555
- product_card_template_: product_card_template_,
6556
- sort_or_filter_open_: sort_or_filter_open_,
6557
- desktop_filter_elements_: desktop_filter_elements_,
6558
- id_currently_querying_for_: query_id_,
6559
- no_results_options_: {
6560
- selected_filters_: selected_filters_,
6561
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6562
- i18n_: i18n_,
6563
- local_filter_cache_: local_filter_cache_
6619
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
6620
+ get children() {
6621
+ return $fe76fb463cc60b89$export$3925f87b1545cfc6({
6622
+ min_products_to_fetch_:
6623
+ // if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
6624
+ min_products_to_fetch_,
6625
+ query_base_: query_base_,
6626
+ plp_results_: plp_results_,
6627
+ depict_api_: depict_api_,
6628
+ first_result_in_viewport_: first_result_in_viewport_,
6629
+ last_result_in_viewport_: last_result_in_viewport_,
6630
+ scroll_restoration_data_: scroll_restoration_data_,
6631
+ layout_options_: layout_options_,
6632
+ product_card_template_: product_card_template_,
6633
+ sort_or_filter_open_: sort_or_filter_open_,
6634
+ desktop_filter_elements_: desktop_filter_elements_,
6635
+ id_currently_querying_for_: query_id_,
6636
+ no_results_options_: {
6637
+ selected_filters_: selected_filters_,
6638
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6639
+ i18n_: i18n_,
6640
+ local_filter_cache_: local_filter_cache_
6641
+ }
6642
+ });
6564
6643
  }
6565
6644
  });
6566
6645
  }
@@ -7562,8 +7641,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7562
7641
  }) {
7563
7642
  const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
7564
7643
  const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
7565
- const [recommendations_resource] = $gVhhF$solidjs.createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
7566
- const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
7644
+ const [recommendations_resource] = $gVhhF$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
7645
+ // only fetch/refetch if all products are loaded
7646
+ query => query && depict_api_.get_recommended(query).then(r => r.displays));
7647
+ const should_show = $gVhhF$solidjs.createMemo(() => !!((recommendations_resource.loading || recommendations_resource()?.length) && all_products_loaded_()));
7567
7648
  const num_placeholders_ = $gVhhF$solidjs.createMemo(() => (0, $aec24316ed262dc0$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
7568
7649
  // Don't tear down elements every time one updates the page - don't put them within <Show>
7569
7650
  const elements = (() => {
@@ -7593,7 +7674,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7593
7674
  get children() {
7594
7675
  return (() => {
7595
7676
  // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
7596
- const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource() || []));
7677
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(prev => {
7678
+ 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
7679
+ return recommendations_resource() || [];
7680
+ }));
7597
7681
  return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
7598
7682
  displays_by_key_: displays_by_key_,
7599
7683
  merchant_: $gVhhF$solidjs.createMemo(() => search_query_base_().tenant),
@@ -7609,7 +7693,7 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7609
7693
  })();
7610
7694
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
7611
7695
  get when() {
7612
- return $gVhhF$solidjsweb.memo(() => !!is_showing_something())() && all_products_loaded_();
7696
+ return should_show();
7613
7697
  },
7614
7698
  children: elements
7615
7699
  });
@@ -9067,17 +9151,21 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
9067
9151
  severity_: "error",
9068
9152
  message_: "Instant results failed",
9069
9153
  get children() {
9070
- return $6ae556e536054e87$export$62f101a8aa597bf8({
9071
- search_field_value_: search_field_value_,
9072
- depict_api_: depict_api_,
9073
- tenant_: tenant_,
9074
- i18n_: i18n_,
9075
- market_: market_,
9076
- set_total_num_results_accessor_: set_total_num_results_accessor_,
9077
- router_: router_,
9078
- set_modal_search_results_: set_modal_search_results_,
9079
- content_search_enabled_: content_search_enabled_,
9080
- ...instant_results_options_
9154
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
9155
+ get children() {
9156
+ return $6ae556e536054e87$export$62f101a8aa597bf8({
9157
+ search_field_value_: search_field_value_,
9158
+ depict_api_: depict_api_,
9159
+ tenant_: tenant_,
9160
+ i18n_: i18n_,
9161
+ market_: market_,
9162
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
9163
+ router_: router_,
9164
+ set_modal_search_results_: set_modal_search_results_,
9165
+ content_search_enabled_: content_search_enabled_,
9166
+ ...instant_results_options_
9167
+ });
9168
+ }
9081
9169
  });
9082
9170
  }
9083
9171
  }), _el$10, _co$2);
@@ -9978,14 +10066,18 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
9978
10066
  return content_search_enabled_();
9979
10067
  },
9980
10068
  get children() {
9981
- return $gVhhF$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
9982
- content_results_rows_: content_results_rows_,
9983
- search_results_: search_results_,
9984
- i18n_: i18n_,
9985
- get_search_query_: get_search_query_,
9986
- layout_options_: content_layout_options_,
9987
- router_: router_,
9988
- query_base_: search_query_base_
10069
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10070
+ get children() {
10071
+ return $gVhhF$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
10072
+ content_results_rows_: content_results_rows_,
10073
+ search_results_: search_results_,
10074
+ i18n_: i18n_,
10075
+ get_search_query_: get_search_query_,
10076
+ layout_options_: content_layout_options_,
10077
+ router_: router_,
10078
+ query_base_: search_query_base_
10079
+ });
10080
+ }
9989
10081
  });
9990
10082
  }
9991
10083
  });
@@ -10019,28 +10111,32 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10019
10111
  severity_: "error",
10020
10112
  message_: "Search results failed",
10021
10113
  get children() {
10022
- return $fe76fb463cc60b89$export$3925f87b1545cfc6({
10023
- all_products_loaded_: all_products_loaded_,
10024
- min_products_to_fetch_: min_products_to_fetch_,
10025
- query_base_: search_query_base_,
10026
- plp_results_: search_results_,
10027
- depict_api_: depict_api_,
10028
- first_result_in_viewport_: first_result_in_viewport_,
10029
- last_result_in_viewport_: last_result_in_viewport_,
10030
- scroll_restoration_data_: scroll_restoration_data_,
10031
- desktop_filter_elements_: desktop_filter_elements_,
10032
- product_card_template_: product_card_template_,
10033
- layout_options_: layout_options_,
10034
- sort_or_filter_open_: sort_or_filter_open_,
10035
- id_currently_querying_for_: get_search_query_,
10036
- no_results_options_: {
10037
- selected_filters_: selected_filters_,
10038
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
10039
- local_filter_cache_: local_filter_cache_,
10040
- i18n_: {
10041
- ...i18n_,
10042
- no_results_text_: no_results_text_
10043
- }
10114
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10115
+ get children() {
10116
+ return $fe76fb463cc60b89$export$3925f87b1545cfc6({
10117
+ all_products_loaded_: all_products_loaded_,
10118
+ min_products_to_fetch_: min_products_to_fetch_,
10119
+ query_base_: search_query_base_,
10120
+ plp_results_: search_results_,
10121
+ depict_api_: depict_api_,
10122
+ first_result_in_viewport_: first_result_in_viewport_,
10123
+ last_result_in_viewport_: last_result_in_viewport_,
10124
+ scroll_restoration_data_: scroll_restoration_data_,
10125
+ desktop_filter_elements_: desktop_filter_elements_,
10126
+ product_card_template_: product_card_template_,
10127
+ layout_options_: layout_options_,
10128
+ sort_or_filter_open_: sort_or_filter_open_,
10129
+ id_currently_querying_for_: get_search_query_,
10130
+ no_results_options_: {
10131
+ selected_filters_: selected_filters_,
10132
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
10133
+ local_filter_cache_: local_filter_cache_,
10134
+ i18n_: {
10135
+ ...i18n_,
10136
+ no_results_text_: no_results_text_
10137
+ }
10138
+ }
10139
+ });
10044
10140
  }
10045
10141
  });
10046
10142
  }
@@ -10053,17 +10149,21 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10053
10149
  severity_: "error",
10054
10150
  message_: "Search recommendations failed",
10055
10151
  get children() {
10056
- return $gVhhF$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
10057
- depict_api_: depict_api_,
10058
- i18n_: i18n_,
10059
- search_query_base_: search_query_base_,
10060
- get layout_options_() {
10061
- return $gVhhF$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
10062
- },
10063
- showing_recommendation_rows_: showing_recommendation_rows_,
10064
- view_more_button_: search_recs_view_more_,
10065
- product_card_template_: product_card_template_,
10066
- all_products_loaded_: get_all_products_loaded
10152
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10153
+ get children() {
10154
+ return $gVhhF$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
10155
+ depict_api_: depict_api_,
10156
+ i18n_: i18n_,
10157
+ search_query_base_: search_query_base_,
10158
+ get layout_options_() {
10159
+ return $gVhhF$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
10160
+ },
10161
+ showing_recommendation_rows_: showing_recommendation_rows_,
10162
+ view_more_button_: search_recs_view_more_,
10163
+ product_card_template_: product_card_template_,
10164
+ all_products_loaded_: get_all_products_loaded
10165
+ });
10166
+ }
10067
10167
  });
10068
10168
  }
10069
10169
  });
package/latest/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSX, Signal, Accessor, Setter } from "solid-js";
1
+ import { JSX, Accessor, Signal, Setter } from "solid-js";
2
2
  import { Amazing_Slider, Display, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
3
3
  import { SearchFilter, SearchRequest } from "@depict-ai/types/api/SearchRequest";
4
4
  import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
@@ -7,7 +7,55 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.14";
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;