@depict-ai/ui 4.10.11 → 4.10.13

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
@@ -109,7 +109,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
109
109
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
110
110
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
111
111
  /*! Depict.ai search and product listing SDK */
112
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.11";
112
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.13";
113
113
  function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
114
114
  const signal = $gVhhF$solidjs.createSignal(false);
115
115
  $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
@@ -2714,7 +2714,16 @@ function $0fe1e7efdf4200d6$export$ca21a16d65b3dd8({
2714
2714
  var _c$ = $gVhhF$solidjsweb.memo(() => !!get_show_extras());
2715
2715
  return () => _c$() ? i18n_.view_less_() : i18n_.view_more_();
2716
2716
  })());
2717
- $gVhhF$solidjsweb.effect(() => _el$.classList.toggle("expanded", !!get_show_extras()));
2717
+ $gVhhF$solidjsweb.effect(_p$ => {
2718
+ var _v$ = get_show_extras(),
2719
+ _v$2 = !!get_show_extras();
2720
+ _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$, "aria-expanded", _p$.e = _v$);
2721
+ _v$2 !== _p$.t && _el$.classList.toggle("expanded", _p$.t = _v$2);
2722
+ return _p$;
2723
+ }, {
2724
+ e: undefined,
2725
+ t: undefined
2726
+ });
2718
2727
  $gVhhF$solidjsweb.runHydrationEvents();
2719
2728
  return _el$;
2720
2729
  })();
@@ -3033,7 +3042,7 @@ function $c1dc1554c1b94233$export$430444115f70a734({
3033
3042
  return _el$;
3034
3043
  })();
3035
3044
  }
3036
- var $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=range><div class=input-group><div class=field><input type=number></div><div class=separator>-</div><div class=field><input type=number></div></div><!$><!/><div class=value-text><span class=min><!$><!/><!$><!/><!$><!/></span><span class=max><!$><!/><!$><!/><!$><!/>`),
3045
+ var $0b7222ba8a8bb72f$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=range><div class=input-group><div class=field><input type=number></div><div class=separator aria-hidden=true>-</div><div class=field><input type=number></div></div><!$><!/><div class=value-text><span class=min><!$><!/><!$><!/><!$><!/></span><span class=max><!$><!/><!$><!/><!$><!/>`),
3037
3046
  $0b7222ba8a8bb72f$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=slider><div class=progress>`),
3038
3047
  $0b7222ba8a8bb72f$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=range-group><input type=range step=any><input type=range step=any>`);
3039
3048
  function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
@@ -3167,7 +3176,8 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
3167
3176
  min_: min_,
3168
3177
  current_range_: current_range_,
3169
3178
  i18n_: i18n_,
3170
- should_be_disabled_: should_be_disabled_
3179
+ should_be_disabled_: should_be_disabled_,
3180
+ priceFormatting_: price_formatting_
3171
3181
  }), _el$24, _co$7);
3172
3182
  $gVhhF$solidjsweb.insert(_el$9, pre_price, _el$11, _co$);
3173
3183
  $gVhhF$solidjsweb.insert(_el$9, $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
@@ -3231,7 +3241,8 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
3231
3241
  min_: min_,
3232
3242
  i18n_: i18n_,
3233
3243
  max_: max_,
3234
- should_be_disabled_: should_be_disabled_
3244
+ should_be_disabled_: should_be_disabled_,
3245
+ priceFormatting_: priceFormatting_
3235
3246
  }) {
3236
3247
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
3237
3248
  const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
@@ -3265,7 +3276,8 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
3265
3276
  max_: modified_max,
3266
3277
  offset_value_calculator_: offset_value_calculator_,
3267
3278
  i18n_: i18n_,
3268
- should_be_disabled_: should_be_disabled_
3279
+ should_be_disabled_: should_be_disabled_,
3280
+ priceFormatting_: priceFormatting_
3269
3281
  });
3270
3282
  }
3271
3283
  function $0b7222ba8a8bb72f$var$LinearSlider({
@@ -3274,12 +3286,17 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3274
3286
  current_range_: current_range_,
3275
3287
  offset_value_calculator_: offset_value_calculator_,
3276
3288
  i18n_: i18n_,
3277
- should_be_disabled_: should_be_disabled_
3289
+ should_be_disabled_: should_be_disabled_,
3290
+ priceFormatting_: priceFormatting_
3278
3291
  }) {
3279
3292
  let range_input_1;
3280
3293
  let range_input_2;
3281
3294
  let clickable_slider;
3282
3295
  const [get_current_range, set_current_range] = current_range_;
3296
+ const formatRealPrice = value => {
3297
+ const priceFormatting = priceFormatting_();
3298
+ return priceFormatting.pre_ + $gVhhF$depictaiutilishared.standard_price_format(value, priceFormatting.places_after_comma_, priceFormatting.decimal_places_delimiter_, priceFormatting.thousands_delimiter_) + priceFormatting.post_;
3299
+ };
3283
3300
  const progress_styling = $gVhhF$solidjs.createMemo(() => {
3284
3301
  const min = min_();
3285
3302
  const span = max_() - min;
@@ -3336,20 +3353,24 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3336
3353
  $gVhhF$solidjsweb.effect(_p$ => {
3337
3354
  var _v$10 = should_be_disabled_(),
3338
3355
  _v$11 = i18n_.range_filter_low_point_aria_label_(),
3339
- _v$12 = min_(),
3340
- _v$13 = max_(),
3341
- _v$14 = should_be_disabled_(),
3342
- _v$15 = i18n_.range_filter_high_point_aria_label_(),
3343
- _v$16 = min_(),
3344
- _v$17 = max_();
3356
+ _v$12 = formatRealPrice(get_current_range()[0]),
3357
+ _v$13 = min_(),
3358
+ _v$14 = max_(),
3359
+ _v$15 = should_be_disabled_(),
3360
+ _v$16 = i18n_.range_filter_high_point_aria_label_(),
3361
+ _v$17 = formatRealPrice(get_current_range()[1]),
3362
+ _v$18 = min_(),
3363
+ _v$19 = max_();
3345
3364
  _v$10 !== _p$.e && $gVhhF$solidjsweb.setProperty(_el$28, "disabled", _p$.e = _v$10);
3346
3365
  _v$11 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-label", _p$.t = _v$11);
3347
- _v$12 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$.a = _v$12);
3348
- _v$13 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$.o = _v$13);
3349
- _v$14 !== _p$.i && $gVhhF$solidjsweb.setProperty(_el$29, "disabled", _p$.i = _v$14);
3350
- _v$15 !== _p$.n && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$.n = _v$15);
3351
- _v$16 !== _p$.s && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$.s = _v$16);
3352
- _v$17 !== _p$.h && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$.h = _v$17);
3366
+ _v$12 !== _p$.a && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-valuetext", _p$.a = _v$12);
3367
+ _v$13 !== _p$.o && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$.o = _v$13);
3368
+ _v$14 !== _p$.i && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$.i = _v$14);
3369
+ _v$15 !== _p$.n && $gVhhF$solidjsweb.setProperty(_el$29, "disabled", _p$.n = _v$15);
3370
+ _v$16 !== _p$.s && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$.s = _v$16);
3371
+ _v$17 !== _p$.h && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-valuetext", _p$.h = _v$17);
3372
+ _v$18 !== _p$.r && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$.r = _v$18);
3373
+ _v$19 !== _p$.d && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$.d = _v$19);
3353
3374
  return _p$;
3354
3375
  }, {
3355
3376
  e: undefined,
@@ -3359,7 +3380,9 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
3359
3380
  i: undefined,
3360
3381
  n: undefined,
3361
3382
  s: undefined,
3362
- h: undefined
3383
+ h: undefined,
3384
+ r: undefined,
3385
+ d: undefined
3363
3386
  });
3364
3387
  $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setProperty(_el$28, "value", $gVhhF$solidjs.createMemo(() => {
3365
3388
  min_();
@@ -4241,6 +4264,13 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
4241
4264
  _el$7 = _el$6.nextSibling,
4242
4265
  [_el$8, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$7.nextSibling);
4243
4266
  $gVhhF$solidjsweb.spread(_el$2, $gVhhF$solidjsweb.mergeProps(attributes, {
4267
+ "type": "button",
4268
+ get ["aria-pressed"]() {
4269
+ return is_selected();
4270
+ },
4271
+ get ["aria-label"]() {
4272
+ return $gVhhF$solidjsweb.memo(() => value().count_ != undefined)() ? `${label()}, ${value().count_}` : label();
4273
+ },
4244
4274
  get disabled() {
4245
4275
  return $gVhhF$solidjsweb.memo(() => !!count_zero())() && !is_selected();
4246
4276
  },
@@ -4444,7 +4474,14 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
4444
4474
  return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
4445
4475
  });
4446
4476
  const value = $gVhhF$solidjs.createMemo(() => checkbox().value_);
4447
- const label_text = $gVhhF$solidjs.createMemo(() => checkbox().name_ || value() + "");
4477
+ const label_text = $gVhhF$solidjs.createMemo(() => {
4478
+ const name = checkbox().name_;
4479
+ if (name) return name;
4480
+ const value_string = value() + "";
4481
+ if (backendFilterV2()) return value_string;
4482
+ // Legacy values are "Name;#hex" - split is used to get the name so that screen readers don't announce the hex code
4483
+ return value_string.split(";")[0] || value_string;
4484
+ });
4448
4485
  const count = $gVhhF$solidjs.createMemo(() => checkbox().count_);
4449
4486
  const colorNameDatasetValue = $gVhhF$solidjs.createMemo(() => {
4450
4487
  if (backendFilterV2()) return label_text();
@@ -4916,7 +4953,7 @@ $gVhhF$solidjsweb.delegateEvents(["input", "click"]);
4916
4953
  var $aff9a96d30ed3563$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible>`),
4917
4954
  $aff9a96d30ed3563$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class=clear-group><!$><!/><span>`),
4918
4955
  $aff9a96d30ed3563$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=view-more-clear><!$><!/><!$><!/>`),
4919
- $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
4956
+ $aff9a96d30ed3563$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-collapsible-body><fieldset class=filter-part><!$><!/><!$><!/></fieldset><!$><!/>`),
4920
4957
  $aff9a96d30ed3563$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<details class=filter-collapsible>`),
4921
4958
  $aff9a96d30ed3563$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
4922
4959
  $aff9a96d30ed3563$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=ungrouped>`),
@@ -5006,6 +5043,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5006
5043
  const a_filter_is_selected = $gVhhF$solidjs.createMemo(() => selected_filters_in_group().size);
5007
5044
  const [get_details_width, set_get_details_width] = $gVhhF$solidjs.createSignal();
5008
5045
  const details_element_width_ = $gVhhF$solidjs.createMemo(() => get_details_width?.()?.());
5046
+ const title_id = $gVhhF$depictaiutilishared.make_random_classname();
5009
5047
  return $gVhhF$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
5010
5048
  is_open_: is_open,
5011
5049
  get details_() {
@@ -5026,6 +5064,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5026
5064
  [_el$25, _co$7] = $gVhhF$solidjsweb.getNextMarker(_el$24.nextSibling),
5027
5065
  _el$26 = _el$25.nextSibling,
5028
5066
  [_el$27, _co$8] = $gVhhF$solidjsweb.getNextMarker(_el$26.nextSibling);
5067
+ $gVhhF$solidjsweb.setAttribute(_el$22, "id", title_id);
5029
5068
  $gVhhF$solidjsweb.insert(_el$22, section_);
5030
5069
  $gVhhF$solidjsweb.insert(_el$23, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
5031
5070
  get when() {
@@ -5060,6 +5099,7 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
5060
5099
  [_el$7, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$6.nextSibling),
5061
5100
  _el$17 = _el$3.nextSibling,
5062
5101
  [_el$18, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$17.nextSibling);
5102
+ $gVhhF$solidjsweb.setAttribute(_el$3, "aria-labelledby", title_id);
5063
5103
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
5064
5104
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Index), {
5065
5105
  get each() {
@@ -7582,7 +7622,7 @@ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
7582
7622
  })));
7583
7623
  return container;
7584
7624
  }
7585
- const $d212a67662c5cf38$var$customUrls = (url, width) => {
7625
+ const $d212a67662c5cf38$var$defaultCustomUrls = (url, width) => {
7586
7626
  if (url?.startsWith?.("https://cdn.shopify.com"))
7587
7627
  // The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
7588
7628
  // but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
@@ -7591,18 +7631,21 @@ const $d212a67662c5cf38$var$customUrls = (url, width) => {
7591
7631
  return `https://app.depict.ai/cdn-cgi/image/width=${width},format=auto/${url}`;
7592
7632
  };
7593
7633
  function $d212a67662c5cf38$export$9d4a4b669b1929ab(props) {
7634
+ const resolvedCustomUrls = props.imageResizer_ ?? $d212a67662c5cf38$var$defaultCustomUrls;
7594
7635
  return $gVhhF$solidjsweb.createComponent((0, $a33065cfed827fc0$export$e4b984597b71e989), $gVhhF$solidjsweb.mergeProps(props, {
7595
7636
  get imgProps() {
7596
7637
  return {
7597
7638
  ...props.imgProps,
7598
- customUrls: $d212a67662c5cf38$var$customUrls
7639
+ customUrls: resolvedCustomUrls
7599
7640
  };
7600
7641
  }
7601
7642
  }));
7602
7643
  }
7603
7644
  function $d212a67662c5cf38$export$140423fa4bfb6d63(props) {
7604
7645
  return $gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), $gVhhF$solidjsweb.mergeProps(props, {
7605
- customUrls: $d212a67662c5cf38$var$customUrls
7646
+ get customUrls() {
7647
+ return props.imageResizer_ ?? $d212a67662c5cf38$var$defaultCustomUrls;
7648
+ }
7606
7649
  }));
7607
7650
  }
7608
7651
  let $20ff40266d725403$var$cachedHlsModule;
@@ -7627,7 +7670,8 @@ function $32c662f618f5d80d$export$780a853d15174484({
7627
7670
  router_: router_,
7628
7671
  setAspectRatioWas_: setAspectRatioWas_,
7629
7672
  mediaUrl_: mediaUrl_,
7630
- aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
7673
+ aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_,
7674
+ imageResizer_: imageResizer_
7631
7675
  }) {
7632
7676
  let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
7633
7677
  const [wrapperSize, setWrapperSize] = $gVhhF$solidjs.createSignal();
@@ -7677,7 +7721,8 @@ function $32c662f618f5d80d$export$780a853d15174484({
7677
7721
  src: mediaUrl_,
7678
7722
  "class": "d-standard-content",
7679
7723
  onDecoded: () => setHasLoaded(true),
7680
- ref: el => el.addEventListener("load", $gVhhF$depictaiutilisharedlatest.catchify(() => setAspectRatio(el.naturalWidth / el.naturalHeight)))
7724
+ ref: el => el.addEventListener("load", $gVhhF$depictaiutilisharedlatest.catchify(() => setAspectRatio(el.naturalWidth / el.naturalHeight))),
7725
+ imageResizer_: imageResizer_
7681
7726
  });
7682
7727
  }
7683
7728
  }), $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Match), {
@@ -7728,7 +7773,7 @@ function $32c662f618f5d80d$export$780a853d15174484({
7728
7773
  }
7729
7774
  }));
7730
7775
  }
7731
- function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_) {
7776
+ function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_, imageResizer_) {
7732
7777
  let hasSeenContentBlock = false;
7733
7778
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
7734
7779
  const contentComponents = new Map();
@@ -7783,7 +7828,8 @@ function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_
7783
7828
  ...prev.aspectRatios,
7784
7829
  [componentCacheKey]: Math.round(aspectRatio * 100) / 100
7785
7830
  }
7786
- }))
7831
+ })),
7832
+ imageResizer_: imageResizer_
7787
7833
  });
7788
7834
  contentComponents.set(componentCacheKey, component);
7789
7835
  }
@@ -7845,7 +7891,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7845
7891
  filterModalParent_: filterModalParent_,
7846
7892
  showSliderArrow_: showSliderArrow_,
7847
7893
  hideCount0FilterOptions_: hideCount0FilterOptions_,
7848
- switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
7894
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_,
7895
+ imageResizer_: imageResizer_
7849
7896
  }) {
7850
7897
  let results_for;
7851
7898
  let only_show_filters_opener_;
@@ -7941,7 +7988,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7941
7988
  setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
7942
7989
  return result;
7943
7990
  }));
7944
- const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, () => plp_products_.loading);
7991
+ const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, () => plp_products_.loading, imageResizer_);
7945
7992
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
7946
7993
  const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
7947
7994
  ...sort,
@@ -8493,7 +8540,8 @@ function $0540c3739b32dc79$export$b73ed90f0ee50dc3({
8493
8540
  outerRef_: outerRef_,
8494
8541
  animationDuration_: animationDuration_,
8495
8542
  priceFormatting_: priceFormatting_,
8496
- pseudoRouter_: pseudoRouter_
8543
+ pseudoRouter_: pseudoRouter_,
8544
+ imageResizer_: imageResizer_
8497
8545
  }) {
8498
8546
  const variantToUse = $gVhhF$solidjs.createMemo(() => {
8499
8547
  const display = display_();
@@ -8567,7 +8615,8 @@ function $0540c3739b32dc79$export$b73ed90f0ee50dc3({
8567
8615
  },
8568
8616
  imgProps: {
8569
8617
  keyRatioUpdating: true
8570
- }
8618
+ },
8619
+ imageResizer_: imageResizer_
8571
8620
  });
8572
8621
  }
8573
8622
  }));
@@ -8768,7 +8817,8 @@ function $912d9a717ceee184$export$ebf0b1d4f90c09ae({
8768
8817
  supportsHover_: supportsHover_,
8769
8818
  priceFormatting_: priceFormatting_,
8770
8819
  pseudoRouter_: pseudoRouter_,
8771
- containerHeight_: containerHeight_
8820
+ containerHeight_: containerHeight_,
8821
+ imageResizer_: imageResizer_
8772
8822
  }) {
8773
8823
  let isAffectedByChromeBug = false;
8774
8824
  // If the user requests the drawer to be expanded or not
@@ -8833,6 +8883,7 @@ function $912d9a717ceee184$export$ebf0b1d4f90c09ae({
8833
8883
  userWantsExpandedSignal_: userWantsExpandedSignal_,
8834
8884
  textFadeInAnimationRunning_: textFadeInAnimationRunning,
8835
8885
  priceFormatting_: priceFormatting_,
8886
+ imageResizer_: imageResizer_,
8836
8887
  outerRef_: el => $gVhhF$solidjs.createEffect(() => {
8837
8888
  if (index !== 0) return;
8838
8889
  const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
@@ -8891,7 +8942,8 @@ function $bda357ff87c46163$export$44809a8a3e867e30({
8891
8942
  placeholderImageAspectRatio_: placeholderImageAspectRatio_,
8892
8943
  animationDuration_: animationDuration_,
8893
8944
  priceFormatting_: priceFormatting_,
8894
- pseudoRouter_: pseudoRouter_
8945
+ pseudoRouter_: pseudoRouter_,
8946
+ imageResizer_: imageResizer_
8895
8947
  }) {
8896
8948
  let container;
8897
8949
  const useWantsExpandedSignal_ = $gVhhF$solidjs.createSignal(false);
@@ -8978,7 +9030,8 @@ function $bda357ff87c46163$export$44809a8a3e867e30({
8978
9030
  return display_()?.image_urls?.[0];
8979
9031
  },
8980
9032
  aspectRatio: placeholderImageAspectRatio_,
8981
- autoAdjustAspectRatio: true
9033
+ autoAdjustAspectRatio: true,
9034
+ imageResizer_: imageResizer_
8982
9035
  });
8983
9036
  }
8984
9037
  }), _el$3, _co$);
@@ -8991,7 +9044,8 @@ function $bda357ff87c46163$export$44809a8a3e867e30({
8991
9044
  FavoriteButton_: FavoriteButton_,
8992
9045
  priceFormatting_: priceFormatting_,
8993
9046
  pseudoRouter_: pseudoRouter_,
8994
- containerHeight_: containerHeight_
9047
+ containerHeight_: containerHeight_,
9048
+ imageResizer_: imageResizer_
8995
9049
  }), _el$5, _co$2);
8996
9050
  $gVhhF$solidjsweb.effect(() => _el$.classList.toggle("placeholder", !display_()));
8997
9051
  $gVhhF$solidjsweb.runHydrationEvents();
@@ -9251,7 +9305,8 @@ function $a3bbfa5fdaa39f3a$export$2c9f9bf2092486aa(props) {
9251
9305
  animationDuration_: expandingAnimationDuration,
9252
9306
  expandedLooksSignal_: $a3bbfa5fdaa39f3a$var$expandedLooksSignal_,
9253
9307
  priceFormatting_: () => props.priceFormatting_,
9254
- pseudoRouter_: pseudoRouter
9308
+ pseudoRouter_: pseudoRouter,
9309
+ imageResizer_: props.imageResizer_
9255
9310
  }),
9256
9311
  recommendations_resource_: looksResource,
9257
9312
  title_: () => props.title_,
@@ -11134,7 +11189,8 @@ function $1f3b5fa875714dea$export$67152d26d4f56ee8({
11134
11189
  merchant_: merchant_,
11135
11190
  keyboardNavigationGroupIndex_: keyboardNavigationGroupIndex_,
11136
11191
  index_: index_,
11137
- selected_index_: [read_selected_index_, write_selected_index_]
11192
+ selected_index_: [read_selected_index_, write_selected_index_],
11193
+ imageResizer_: imageResizer_
11138
11194
  }) {
11139
11195
  const href = $gVhhF$solidjs.createMemo(() => listing_()?.page_url); // <- could be made reactive getter created in displayTransformers, read it in memo here since it might create computations (for example in the preview-brower), and there's no owner in the onClick handler
11140
11196
  const LinkToListing = props => (() => {
@@ -11190,7 +11246,8 @@ function $1f3b5fa875714dea$export$67152d26d4f56ee8({
11190
11246
  get children() {
11191
11247
  var _el$3 = $gVhhF$solidjsweb.getNextElement($1f3b5fa875714dea$var$_tmpl$2);
11192
11248
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent($1f3b5fa875714dea$export$ea41102db9bd68c3, {
11193
- image_urls_: image_urls
11249
+ image_urls_: image_urls,
11250
+ imageResizer_: imageResizer_
11194
11251
  }));
11195
11252
  return _el$3;
11196
11253
  }
@@ -11233,7 +11290,8 @@ function $1f3b5fa875714dea$export$67152d26d4f56ee8({
11233
11290
  })();
11234
11291
  }
11235
11292
  function $1f3b5fa875714dea$export$ea41102db9bd68c3({
11236
- image_urls_: image_urls_
11293
+ image_urls_: image_urls_,
11294
+ imageResizer_: imageResizer_
11237
11295
  }) {
11238
11296
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
11239
11297
  get when() {
@@ -11256,7 +11314,8 @@ function $1f3b5fa875714dea$export$ea41102db9bd68c3({
11256
11314
  },
11257
11315
  imgProps: {
11258
11316
  style: "object-fit: cover;"
11259
- }
11317
+ },
11318
+ imageResizer_: imageResizer_
11260
11319
  })
11261
11320
  });
11262
11321
  }
@@ -11286,7 +11345,8 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
11286
11345
  selected_index_: selected_index_,
11287
11346
  modalLayoutStacked_: modalLayoutStacked_,
11288
11347
  showPlaceholders_: showPlaceholders_,
11289
- currently_showing_suggestions_: [, set_currently_showing_suggestions]
11348
+ currently_showing_suggestions_: [, set_currently_showing_suggestions],
11349
+ imageResizer_: imageResizer_
11290
11350
  }) {
11291
11351
  const listings_by_id = $gVhhF$solidjs.createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
11292
11352
  const productCards = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
@@ -11304,7 +11364,8 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
11304
11364
  merchant_: merchant_,
11305
11365
  keyboardNavigationGroupIndex_: itemIndex_,
11306
11366
  index_: index,
11307
- selected_index_: selected_index_
11367
+ selected_index_: selected_index_,
11368
+ imageResizer_: imageResizer_
11308
11369
  });
11309
11370
  }
11310
11371
  });
@@ -11686,7 +11747,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11686
11747
  sorting_query_param_: sorting_query_param_,
11687
11748
  filter_query_param_prefix_: filter_query_param_prefix_,
11688
11749
  setSearchFieldOuterWidth_: setSearchFieldOuterWidth_,
11689
- forceUseDiv_: forceUseDiv_
11750
+ forceUseDiv_: forceUseDiv_,
11751
+ imageResizer_: imageResizer_
11690
11752
  }) {
11691
11753
  let on_enter_in_search_field_function;
11692
11754
  let listingSuggestionsDebounceTimeout;
@@ -11897,7 +11959,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11897
11959
  },
11898
11960
  imgProps: {
11899
11961
  alt: "Product image"
11900
- }
11962
+ },
11963
+ imageResizer_: imageResizer_
11901
11964
  }),
11902
11965
  ...instant_results_options_
11903
11966
  }), _el$4, _co$);
@@ -11928,7 +11991,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
11928
11991
  selected_index_: selected_index_,
11929
11992
  currently_showing_suggestions_: currently_showing_suggestions_,
11930
11993
  modalLayoutStacked_: modalLayoutStacked_,
11931
- showPlaceholders_: () => !suggestions_response_.latest
11994
+ showPlaceholders_: () => !suggestions_response_.latest,
11995
+ imageResizer_: imageResizer_
11932
11996
  });
11933
11997
  }
11934
11998
  });
@@ -15026,6 +15090,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
15026
15090
  display_transformers: display_transformers,
15027
15091
  api: api,
15028
15092
  searchModalComponent: searchModalComponent,
15093
+ imageResizer_: imageResizer_,
15029
15094
  // Stuff needed for non-standard customer deployments that we shouldn't actually expose
15030
15095
  disable_scrolling_during_modal = true,
15031
15096
  bottom_distance_under_modal: bottom_distance_under_modal,
@@ -15156,6 +15221,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
15156
15221
  },
15157
15222
  i18n_: i18n_,
15158
15223
  enable_category_suggestions_: enable_category_suggestions,
15224
+ imageResizer_: imageResizer_,
15159
15225
  disable_scrolling_: disable_scrolling_during_modal,
15160
15226
  bottom_distance_under_modal_: bottom_distance_under_modal
15161
15227
  }, override_modal_element);
@@ -15939,7 +16005,8 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
15939
16005
  product_card_template_: product_card_template,
15940
16006
  sorting_query_param_: sorting_query_param_,
15941
16007
  filter_query_param_prefix_: filter_query_param_prefix_,
15942
- switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_
16008
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_,
16009
+ imageResizer_: props.imageResizer_
15943
16010
  });
15944
16011
  }, "Entire CategoryPage failed");
15945
16012
  }
package/latest/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.10.11";
14
+ export const version = "4.10.13";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -632,14 +632,19 @@ export function ShopifyContainedImage(props: {
632
632
  class?: string;
633
633
  imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
634
634
  }): HTMLDivElement;
635
+ export type ImageResizer = (url: string, width: number) => string;
635
636
  /**
636
637
  * Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
637
638
  */
638
- export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
639
+ export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyContainedImage>[0] & {
640
+ imageResizer_?: ImageResizer;
641
+ }): import("solid-js").JSX.Element;
639
642
  /**
640
643
  * Wrapper around ShopifyResponsiveImg (component that just does an image, without wrapping in div). The wrapper allows ShopifyResponsiveImg to work both with shopify CDN URLs and arbitrary URLs, where the latter will be fed through Depict's cloudflare resizer.
641
644
  */
642
- export function ModernResponsiveImage(props: Parameters<typeof ShopifyResponsiveImg>[0]): import("solid-js").JSX.Element;
645
+ export function ModernResponsiveImage(props: Parameters<typeof ShopifyResponsiveImg>[0] & {
646
+ imageResizer_?: ImageResizer;
647
+ }): import("solid-js").JSX.Element;
643
648
  export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
644
649
  /**
645
650
  * Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
@@ -730,7 +735,8 @@ declare function RawSearchModalV2<InputDisplay extends Display, OutputDisplay ex
730
735
  sorting_query_param_,
731
736
  filter_query_param_prefix_,
732
737
  setSearchFieldOuterWidth_,
733
- forceUseDiv_
738
+ forceUseDiv_,
739
+ imageResizer_
734
740
  }: {
735
741
  search_field_value_: Signal<string>;
736
742
  get_search_query_: Accessor<string>;
@@ -767,6 +773,7 @@ declare function RawSearchModalV2<InputDisplay extends Display, OutputDisplay ex
767
773
  enable_category_suggestions_?: boolean;
768
774
  dont_sync_search_field_value_except_on_submit_?: boolean;
769
775
  content_search_enabled_: Accessor<boolean>;
776
+ imageResizer_?: ImageResizer;
770
777
  }): HTMLDivElement[];
771
778
  export const SearchModalV2: typeof RawSearchModalV2;
772
779
  /**
@@ -855,6 +862,13 @@ export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformed
855
862
  * We recommend to just use an incrementing number for this, e.g. "1", "2", "3", ...
856
863
  */
857
864
  uniqueInstanceKeyForState?: string;
865
+ /**
866
+ * Optional function to override the default image resizing CDN. When provided, this function is called
867
+ * with the original image URL and desired width, and should return the resized image URL.
868
+ * By default, Depict uses Cloudflare's image resizer for non-Shopify images, and Shopify's built-in
869
+ * resizer for Shopify CDN images.
870
+ */
871
+ imageResizer?: (url: string, width: number) => string;
858
872
  } & (InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
859
873
  /**
860
874
  * Functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
@@ -1150,7 +1164,8 @@ export function LookCard({
1150
1164
  placeholderImageAspectRatio_,
1151
1165
  animationDuration_,
1152
1166
  priceFormatting_,
1153
- pseudoRouter_
1167
+ pseudoRouter_,
1168
+ imageResizer_
1154
1169
  }: {
1155
1170
  display_: Accessor<FeaturedInDisplay | null>;
1156
1171
  FavoriteButton_?: (props: {
@@ -1161,6 +1176,7 @@ export function LookCard({
1161
1176
  expandedLooksSignal_: Signal<Set<symbol>>;
1162
1177
  priceFormatting_: Accessor<plp_shared_i18n["price_formatting_"]>;
1163
1178
  pseudoRouter_: PseudoRouter;
1179
+ imageResizer_?: ImageResizer;
1164
1180
  }): JSX.Element;
1165
1181
  /**
1166
1182
  * Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
@@ -1193,6 +1209,7 @@ export function LooksSliderOrGrid(props: {
1193
1209
  };
1194
1210
  onNavigation_?: OnNavigation;
1195
1211
  priceFormatting_: plp_shared_i18n["price_formatting_"];
1212
+ imageResizer_?: (url: string, width: number) => string;
1196
1213
  }): HTMLDivElement;
1197
1214
  export const prefixes_to_preserve_in_history_dot_state: Set<string>;
1198
1215
  /**
@@ -1427,6 +1444,7 @@ type GeneralConstructorOptions<InputDisplay extends Display, OutputDisplay exten
1427
1444
  enable_content_search?: boolean;
1428
1445
  unique_instance_key_for_state?: string;
1429
1446
  searchModalComponent: typeof SearchModalV2<InputDisplay, OutputDisplay> | typeof ClassicSearchModal;
1447
+ imageResizer_?: (url: string, width: number) => string;
1430
1448
  disable_scrolling_during_modal?: boolean;
1431
1449
  bottom_distance_under_modal?: Accessor<number | undefined>;
1432
1450
  override_modal_element?: HTMLElement | ShadowRoot;
@@ -1462,6 +1480,7 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
1462
1480
  display_transformers,
1463
1481
  api,
1464
1482
  searchModalComponent,
1483
+ imageResizer_,
1465
1484
  disable_scrolling_during_modal,
1466
1485
  bottom_distance_under_modal,
1467
1486
  override_modal_element,
@@ -1623,5 +1642,6 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1623
1642
  filterModalParent_?: HTMLElement | ShadowRoot;
1624
1643
  showSliderArrow_?: boolean;
1625
1644
  hideCount0FilterOptions_?: boolean;
1645
+ imageResizer_?: (url: string, width: number) => string;
1626
1646
  }): import("@depict-ai/utilishared/latest").Node_Array;
1627
1647
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";