@depict-ai/react-ui 4.0.23 → 4.1.1

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
@@ -23,16 +23,17 @@ $parcel$export(module.exports, "QuickLinks", () => $df17258939eea14f$export$466c
23
23
  $parcel$export(module.exports, "BreadCrumbs", () => $5f792cc5817de4b4$export$5646050d516e06bc);
24
24
  $parcel$export(module.exports, "ComponentAligner", () => $6d02bf18967c1604$export$80e99ee6b29cadd2);
25
25
  $parcel$export(module.exports, "DepictProvider", () => $6f994ff16ce375bb$export$9fac37a9c21c2f3b);
26
- $parcel$export(module.exports, "CategoryPage", () => $15691268d8df90a9$export$f7d2f673fc2f091d);
27
- $parcel$export(module.exports, "SearchPage", () => $735104b46c50160f$export$a54ec244c8863715);
26
+ $parcel$export(module.exports, "CategoryPage", () => $b0f04d11b78e06c3$export$f7d2f673fc2f091d);
27
+ $parcel$export(module.exports, "SearchPage", () => $a81b3f46133355c5$export$a54ec244c8863715);
28
28
  $parcel$export(module.exports, "ImagePlaceholder", () => $95af6193353bea10$export$3f37af283f8fb843);
29
29
  $parcel$export(module.exports, "TextPlaceholder", () => $07e1b96355935829$export$89c6019e4baa40b1);
30
30
  $parcel$export(module.exports, "RecommendationGrid", () => $8f89f8a832210d6b$export$b0a773486c1c2312);
31
31
  $parcel$export(module.exports, "RecommendationSlider", () => $745b83c12baac3c0$export$82cfdc85a4d15688);
32
32
  $parcel$export(module.exports, "useSearchModal", () => $0991f250194bf9f3$export$912994940e660d32);
33
- $parcel$export(module.exports, "useSearchField", () => $fea6ed5be1bf2b27$export$9bb30bbe003b82e0);
33
+ $parcel$export(module.exports, "useSearchField", () => $22f9dd60da27081f$export$9bb30bbe003b82e0);
34
34
  $parcel$export(module.exports, "useFetchRecommendations", () => $2ea1d71b29581906$export$6501da23a2770fc);
35
35
  $parcel$export(module.exports, "usePerformanceClient", () => $18f442be2cc59de2$export$38b98fae14bd1f64);
36
+ $parcel$export(module.exports, "useCategoryFilterHelpers", () => $b8893da801486712$export$72616730c1fad2f4);
36
37
  $parcel$export(module.exports, "CategoryTitle", () => $151509d164ba25a9$re_export$CategoryTitle);
37
38
  $parcel$export(module.exports, "EmbeddedNumProducts", () => $151509d164ba25a9$re_export$EmbeddedNumProducts);
38
39
  $parcel$export(module.exports, "SearchModalV2", () => $151509d164ba25a9$re_export$SearchModalV2);
@@ -41,7 +42,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
41
42
  $parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$export$b8a61e5c71402559);
42
43
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
43
44
  // Note, if you add an export here, also add one in src-server/main.ts
44
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.0.23";
45
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "4.1.1";
45
46
  const $ef516b1f92253963$export$8e769ad4338a911e = {
46
47
  usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
47
48
  search_instances: new Map(),
@@ -59,27 +60,27 @@ const $ef516b1f92253963$export$8e769ad4338a911e = {
59
60
  enable_content_search: $2kiy7$solidjs.createSignal(),
60
61
  disable_override_listing_id: $2kiy7$solidjs.createSignal()
61
62
  };
62
- let $e7ba61a7074c02d3$var$run_on_href_change;
63
- let $e7ba61a7074c02d3$var$old_href = location.href;
64
- function $e7ba61a7074c02d3$export$74f3924c5027fe1d(cb) {
65
- $e7ba61a7074c02d3$var$run_on_href_change = cb;
63
+ let $f8d878722c3bc07d$var$run_on_href_change;
64
+ let $f8d878722c3bc07d$var$old_href = location.href;
65
+ function $f8d878722c3bc07d$export$74f3924c5027fe1d(cb) {
66
+ $f8d878722c3bc07d$var$run_on_href_change = cb;
66
67
  }
67
68
  (0, $2kiy7$depictaiutilishared.instant_exec_on_suspect_history_change).add($2kiy7$depictaiutilishared.catchify(() => {
68
69
  const {
69
70
  href: href
70
71
  } = location;
71
- if ($e7ba61a7074c02d3$var$run_on_href_change && $e7ba61a7074c02d3$var$old_href !== href) $e7ba61a7074c02d3$var$run_on_href_change(href);
72
- $e7ba61a7074c02d3$var$old_href = href;
72
+ if ($f8d878722c3bc07d$var$run_on_href_change && $f8d878722c3bc07d$var$old_href !== href) $f8d878722c3bc07d$var$run_on_href_change(href);
73
+ $f8d878722c3bc07d$var$old_href = href;
73
74
  }));
74
- const $e7ba61a7074c02d3$export$775e6b3892b5ad52 = function () {
75
+ const $f8d878722c3bc07d$export$775e6b3892b5ad52 = function () {
75
76
  let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location;
76
77
  return url.pathname == $2kiy7$solidjs.untrack((0, $ef516b1f92253963$export$8e769ad4338a911e).search_page_path_[0]);
77
78
  }; // might have changed therefore get it from globalState
78
- const $e7ba61a7074c02d3$export$30c8a12df09be0e4 = function () {
79
+ const $f8d878722c3bc07d$export$30c8a12df09be0e4 = function () {
79
80
  let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : location;
80
81
  return (0, $ef516b1f92253963$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
81
82
  };
82
- function $e7ba61a7074c02d3$export$f6e64e17bd69eeef(_ref) {
83
+ function $f8d878722c3bc07d$export$f6e64e17bd69eeef(_ref) {
83
84
  let {
84
85
  solid_component: solid_component,
85
86
  props: props,
@@ -114,7 +115,7 @@ function $e7ba61a7074c02d3$export$f6e64e17bd69eeef(_ref) {
114
115
  const dispose = render_function(() => solid_component(store, set_portals), wrapper_element);
115
116
  return dispose;
116
117
  }, []);
117
- return $2kiy7$react.createElement((0, $2kiy7$react.Fragment), null, $2kiy7$react.createElement(wrapper_type, {
118
+ return /*#__PURE__*/$2kiy7$react.createElement((0, $2kiy7$react.Fragment), null, /*#__PURE__*/$2kiy7$react.createElement(wrapper_type, {
118
119
  ref: wrapper_element_ref,
119
120
  style: wrapper_style,
120
121
  ...(hydrate_function_when_ssr ? {
@@ -126,32 +127,6 @@ function $e7ba61a7074c02d3$export$f6e64e17bd69eeef(_ref) {
126
127
  } : {})
127
128
  }), ...portals);
128
129
  }
129
- function $e7ba61a7074c02d3$export$e5139bbbb9a05035(component, is_set) {
130
- return function () {
131
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
132
- const default_is_set = $2kiy7$solidjs.createMemo(() => {
133
- var _globalState$usedLoca;
134
- return !!((0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0]() && (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $ef516b1f92253963$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
135
- }); // Apparently Show re-renders kids otherwise even if the falsiness of the condition doesn't change
136
- const should_show = $2kiy7$solidjs.createMemo(prev => {
137
- if (!prev && (0, $ef516b1f92253963$export$8e769ad4338a911e).provider_is_updating[0]())
138
- // Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
139
- // If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
140
- // Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
141
- return false;
142
- return (is_set || default_is_set)();
143
- });
144
- // @ts-ignore
145
- return $2kiy7$solidjs.createComponent((0, $2kiy7$solidjs.Show), {
146
- get when() {
147
- return should_show();
148
- },
149
- get children() {
150
- return component(...args);
151
- }
152
- });
153
- };
154
- }
155
130
  let $abe6528d061993d2$var$set = false;
156
131
  let $abe6528d061993d2$var$padding_animation;
157
132
  function $abe6528d061993d2$export$6453cbc34515a94d() {
@@ -159,7 +134,7 @@ function $abe6528d061993d2$export$6453cbc34515a94d() {
159
134
  /// WARNING WARNING WARNING
160
135
  // If you are debugging scroll restoration, make sure you're not in strict mode!!!!! Scroll restoration in nextjs won't work in strict mode because react will nuke all our elements from the DOM and render them again during going back
161
136
  // Next 13.x+ has strict mode by default, opt out by setting reactStrictMode: false in next.config.js
162
- const are_on_search_or_category_page = () => $e7ba61a7074c02d3$export$775e6b3892b5ad52() || $e7ba61a7074c02d3$export$30c8a12df09be0e4();
137
+ const are_on_search_or_category_page = () => $f8d878722c3bc07d$export$775e6b3892b5ad52() || $f8d878722c3bc07d$export$30c8a12df09be0e4();
163
138
  if ($abe6528d061993d2$var$set) return; // Just being safe
164
139
  $abe6528d061993d2$var$set = true;
165
140
  // We used to initialise this variable with false which in some cases (scroll to top button in FloatingButtons) would cause the scroll to be blocked when it shouldn't (see https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686141321127089?thread_ts=1686134246.109689&cid=C058KQ3MU8Z)
@@ -185,8 +160,8 @@ function $abe6528d061993d2$export$6453cbc34515a94d() {
185
160
  const [get_category_page_in_dom] = (0, $ef516b1f92253963$export$8e769ad4338a911e).category_page_in_dom;
186
161
  const search_page_in_dom = $2kiy7$solidjs.untrack(get_search_page_in_dom);
187
162
  const category_page_in_dom = $2kiy7$solidjs.untrack(get_category_page_in_dom);
188
- const new_is_search = $e7ba61a7074c02d3$export$775e6b3892b5ad52();
189
- const new_is_category = $e7ba61a7074c02d3$export$30c8a12df09be0e4();
163
+ const new_is_search = $f8d878722c3bc07d$export$775e6b3892b5ad52();
164
+ const new_is_category = $f8d878722c3bc07d$export$30c8a12df09be0e4();
190
165
  let accessor_to_wait_for;
191
166
  if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
192
167
  // Already on the page we're going to
@@ -252,9 +227,9 @@ const $4a695f491f8300eb$export$599d4515591ef232 = (relativeUrl, isReplace, scrol
252
227
  Page[Page["SEARCH"] = 1] = "SEARCH";
253
228
  Page[Page["CATEGORY"] = 2] = "CATEGORY";
254
229
  })(Page || (Page = {}));
255
- const current_page = $e7ba61a7074c02d3$export$775e6b3892b5ad52() ? Page.SEARCH : $e7ba61a7074c02d3$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
230
+ const current_page = $f8d878722c3bc07d$export$775e6b3892b5ad52() ? Page.SEARCH : $f8d878722c3bc07d$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
256
231
  const target_u_o = new URL(relativeUrl, location.origin);
257
- const target_page = $e7ba61a7074c02d3$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $e7ba61a7074c02d3$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
232
+ const target_page = $f8d878722c3bc07d$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $f8d878722c3bc07d$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
258
233
  window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
259
234
  shallow: current_page === target_page && target_page !== Page.OTHER,
260
235
  scroll:
@@ -605,14 +580,45 @@ function $5e001d14635c1518$export$84601d922bd37be1(blocks, component_portals, se
605
580
  };
606
581
  });
607
582
  }
608
- const $735104b46c50160f$var$rendered_components_with_state_key = new Set();
609
- function $735104b46c50160f$export$a54ec244c8863715(props) {
610
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
611
- solid_component: $e7ba61a7074c02d3$export$e5139bbbb9a05035($735104b46c50160f$var$SolidSearchPage),
583
+ function $c14f9d5966bcfc3c$export$eb5844afe948564b(props) {
584
+ const default_is_set = $2kiy7$solidjs.createMemo(() => {
585
+ var _globalState$usedLoca;
586
+ return !!((0, $ef516b1f92253963$export$8e769ad4338a911e).merchant[0]() && (0, $ef516b1f92253963$export$8e769ad4338a911e).market[0]() && (_globalState$usedLoca = (0, $ef516b1f92253963$export$8e769ad4338a911e).usedLocale[0]()) !== null && _globalState$usedLoca !== void 0 && _globalState$usedLoca.backend_locale_);
587
+ });
588
+ const should_show = $2kiy7$solidjs.createMemo(prev => {
589
+ if (!prev && (0, $ef516b1f92253963$export$8e769ad4338a911e).provider_is_updating[0]())
590
+ // Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
591
+ // If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
592
+ // Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
593
+ return false;
594
+ return (props.isSet || default_is_set)();
595
+ });
596
+ return $2kiy7$solidjsweb.createComponent((0, $2kiy7$solidjs.Show), {
597
+ get when() {
598
+ return should_show();
599
+ },
600
+ get children() {
601
+ return props.children;
602
+ }
603
+ });
604
+ }
605
+ const $a81b3f46133355c5$var$rendered_components_with_state_key = new Set();
606
+ function $a81b3f46133355c5$export$a54ec244c8863715(props) {
607
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
608
+ solid_component: function () {
609
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
610
+ // Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
611
+ const ourArguments = args;
612
+ return $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
613
+ get children() {
614
+ return $a81b3f46133355c5$var$SolidSearchPage(...ourArguments);
615
+ }
616
+ });
617
+ },
612
618
  props: props
613
619
  });
614
620
  }
615
- function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
621
+ function $a81b3f46133355c5$var$SolidSearchPage(props, set_portals) {
616
622
  const depict_search = $2kiy7$solidjs.createMemo(() => {
617
623
  const instance = $fe70497a7dcbe63d$export$f4d89133c6985668("search", props.stateKey, "SearchPage");
618
624
  $2kiy7$solidjs.onCleanup(() => {
@@ -636,7 +642,7 @@ function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
636
642
  // This is because on the front page the search_query updating is blocked because it's not the search page, and that means that `filtered_previous_searches` in Autocomplete.tsx doesn't filter out the current search query
637
643
  // Because it's so minor and would be quite hard to fix (one would need a second "actual search query" signal just for this purpose) it's wontfix for now
638
644
  // EDIT: now that we're resetting this in the onCleanup of the memo above this might no longer be the case
639
- write_signal(!$e7ba61a7074c02d3$export$775e6b3892b5ad52(location));
645
+ write_signal(!$f8d878722c3bc07d$export$775e6b3892b5ad52(location));
640
646
  };
641
647
  const [, set_search_page_in_dom] = (0, $ef516b1f92253963$export$8e769ad4338a911e).search_page_in_dom;
642
648
  const component_portals = new Set();
@@ -644,18 +650,18 @@ function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
644
650
  set_search_page_in_dom(true);
645
651
  $2kiy7$solidjs.onCleanup(() => set_search_page_in_dom(false));
646
652
  // react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
647
- $e7ba61a7074c02d3$export$74f3924c5027fe1d(update_updating_blocked_signal); // if we navigate, re-check
653
+ $f8d878722c3bc07d$export$74f3924c5027fe1d(update_updating_blocked_signal); // if we navigate, re-check
648
654
  $2kiy7$solidjs.createComputed(() => {
649
655
  (0, $ef516b1f92253963$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
650
656
  update_updating_blocked_signal();
651
657
  });
652
- $735104b46c50160f$var$search_page_path_checker();
658
+ $a81b3f46133355c5$var$search_page_path_checker();
653
659
  return $2kiy7$solidjs.createMemo(() => {
654
660
  const stateKey = $2kiy7$solidjs.untrack(() => props.stateKey);
655
- if ($735104b46c50160f$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple SearchPage components with the same stateKey: ".concat(stateKey, ". Each SearchPage component must have a unique stateKey."));
661
+ if ($a81b3f46133355c5$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple SearchPage components with the same stateKey: ".concat(stateKey, ". Each SearchPage component must have a unique stateKey."));
656
662
  const transformed_content_blocks = $5e001d14635c1518$export$84601d922bd37be1(() => props.contentBlocksByRow, component_portals, set_portals);
657
- $735104b46c50160f$var$rendered_components_with_state_key.add(stateKey);
658
- $2kiy7$solidjs.onCleanup(() => $735104b46c50160f$var$rendered_components_with_state_key.delete(stateKey));
663
+ $a81b3f46133355c5$var$rendered_components_with_state_key.add(stateKey);
664
+ $2kiy7$solidjs.onCleanup(() => $a81b3f46133355c5$var$rendered_components_with_state_key.delete(stateKey));
659
665
  return $2kiy7$depictaiui.SearchPage({
660
666
  // Default config goes here
661
667
  get include_input_field() {
@@ -687,7 +693,7 @@ function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
687
693
  /**
688
694
  * Users often set the searchPagePath to something without the market which breaks everything using the searchPagePath internally, notably refining the search query. Add a warning for them.
689
695
  */
690
- function $735104b46c50160f$var$search_page_path_checker() {
696
+ function $a81b3f46133355c5$var$search_page_path_checker() {
691
697
  let has_warned = false;
692
698
  $2kiy7$solidjs.createEffect(() => {
693
699
  if (has_warned) return;
@@ -703,19 +709,26 @@ function $735104b46c50160f$var$search_page_path_checker() {
703
709
  }
704
710
  });
705
711
  }
706
- const $15691268d8df90a9$var$rendered_components_with_state_key = new Set();
707
- function $15691268d8df90a9$export$f7d2f673fc2f091d(props) {
708
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
712
+ const $b0f04d11b78e06c3$var$rendered_components_with_state_key = new Set();
713
+ function $b0f04d11b78e06c3$export$f7d2f673fc2f091d(props) {
714
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
709
715
  // @ts-ignore
710
716
  solid_component: function () {
711
- return $e7ba61a7074c02d3$export$e5139bbbb9a05035($15691268d8df90a9$var$SolidCategoryPage)(...arguments);
717
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
718
+ // Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
719
+ const ourArguments = args;
720
+ return $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
721
+ get children() {
722
+ return $b0f04d11b78e06c3$var$SolidCategoryPage(...ourArguments);
723
+ }
724
+ });
712
725
  },
713
726
  props: props,
714
727
  wrapper_type: "div",
715
728
  wrapper_style: {}
716
729
  });
717
730
  }
718
- function $15691268d8df90a9$var$SolidCategoryPage(props, set_portals) {
731
+ function $b0f04d11b78e06c3$var$SolidCategoryPage(props, set_portals) {
719
732
  const depict_category = $2kiy7$solidjs.createMemo(() => $fe70497a7dcbe63d$export$f4d89133c6985668("category", props.stateKey, "CategoryPage") // stateKey can change
720
733
  );
721
734
 
@@ -735,11 +748,11 @@ function $15691268d8df90a9$var$SolidCategoryPage(props, set_portals) {
735
748
  (0, $ef516b1f92253963$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
736
749
  }
737
750
  });
738
- const category = () => $2kiy7$solidjs.createMemo(() => {
751
+ const Category = () => $2kiy7$solidjs.createMemo(() => {
739
752
  const stateKey = $2kiy7$solidjs.untrack(() => props.stateKey);
740
- if ($15691268d8df90a9$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple CategoryPage components with the same stateKey: ".concat(stateKey, ". Each CategoryPage component must have a unique stateKey."));
741
- $15691268d8df90a9$var$rendered_components_with_state_key.add(stateKey);
742
- $2kiy7$solidjs.onCleanup(() => $15691268d8df90a9$var$rendered_components_with_state_key.delete(stateKey));
753
+ if ($b0f04d11b78e06c3$var$rendered_components_with_state_key.has(stateKey)) throw new Error("You have multiple CategoryPage components with the same stateKey: ".concat(stateKey, ". Each CategoryPage component must have a unique stateKey."));
754
+ $b0f04d11b78e06c3$var$rendered_components_with_state_key.add(stateKey);
755
+ $2kiy7$solidjs.onCleanup(() => $b0f04d11b78e06c3$var$rendered_components_with_state_key.delete(stateKey));
743
756
  const transformed_content_blocks = $5e001d14635c1518$export$84601d922bd37be1(() => props.contentBlocksByRow, component_portals, set_portals);
744
757
  return $2kiy7$depictaiui.CategoryPage({
745
758
  depict_category: depict_category(),
@@ -776,15 +789,24 @@ function $15691268d8df90a9$var$SolidCategoryPage(props, set_portals) {
776
789
  })
777
790
  });
778
791
  });
779
- return $e7ba61a7074c02d3$export$e5139bbbb9a05035(category, category_state_set);
792
+ return $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
793
+ isSet: category_state_set,
794
+ get children() {
795
+ return $2kiy7$solidjsweb.createComponent(Category, {});
796
+ }
797
+ });
780
798
  }
781
799
  function $5f792cc5817de4b4$export$5646050d516e06bc(react_props) {
782
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
783
- solid_component: $e7ba61a7074c02d3$export$e5139bbbb9a05035($5f792cc5817de4b4$var$vanilla_breadcrumbs),
800
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
801
+ solid_component: solidProps => $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
802
+ get children() {
803
+ return $2kiy7$solidjsweb.createComponent($5f792cc5817de4b4$var$VanillaBreadcrumbs, solidProps);
804
+ }
805
+ }),
784
806
  props: react_props
785
807
  });
786
808
  }
787
- function $5f792cc5817de4b4$var$vanilla_breadcrumbs(props) {
809
+ function $5f792cc5817de4b4$var$VanillaBreadcrumbs(props) {
788
810
  // memo so stateKey can be dynamically changed
789
811
  return $2kiy7$solidjs.createMemo(() => {
790
812
  const depict_category = $fe70497a7dcbe63d$export$f4d89133c6985668("category", props.stateKey, "BreadCrumbs");
@@ -795,12 +817,16 @@ function $5f792cc5817de4b4$var$vanilla_breadcrumbs(props) {
795
817
  }
796
818
  function $df17258939eea14f$export$466cdc317043f6cb() {
797
819
  let react_props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
798
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
799
- solid_component: $e7ba61a7074c02d3$export$e5139bbbb9a05035($df17258939eea14f$var$vanilla_quick_links),
820
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
821
+ solid_component: solidProps => $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
822
+ get children() {
823
+ return $2kiy7$solidjsweb.createComponent($df17258939eea14f$var$VanillaQuickLinks, solidProps);
824
+ }
825
+ }),
800
826
  props: react_props
801
827
  });
802
828
  }
803
- function $df17258939eea14f$var$vanilla_quick_links(props) {
829
+ function $df17258939eea14f$var$VanillaQuickLinks(props) {
804
830
  // memo so stateKey can be dynamically changed
805
831
  return $2kiy7$solidjs.createMemo(() => {
806
832
  const depict_category = $fe70497a7dcbe63d$export$f4d89133c6985668("category", props.stateKey, "QuickLinks");
@@ -814,7 +840,7 @@ const $95af6193353bea10$export$3f37af283f8fb843 = raw_react_props => {
814
840
  class: raw_react_props.className,
815
841
  ...raw_react_props
816
842
  };
817
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
843
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
818
844
  solid_component: props_store => $2kiy7$depictaiui.ImagePlaceholder(props_store),
819
845
  props: react_props,
820
846
  wrapper_type: "span",
@@ -826,7 +852,7 @@ const $07e1b96355935829$export$89c6019e4baa40b1 = raw_react_props => {
826
852
  class: raw_react_props.className,
827
853
  ...raw_react_props
828
854
  };
829
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
855
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
830
856
  solid_component: props_store => $2kiy7$depictaiui.TextPlaceholder(props_store),
831
857
  props: react_props,
832
858
  wrapper_type: "span",
@@ -849,7 +875,7 @@ function $6e5ce22b65512b0a$export$4daadad26e48a2c7(props) {
849
875
  }
850
876
  function $745b83c12baac3c0$export$82cfdc85a4d15688(props) {
851
877
  $6e5ce22b65512b0a$export$4daadad26e48a2c7(props);
852
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
878
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
853
879
  solid_component: $745b83c12baac3c0$export$5abb40edfde2a843,
854
880
  props: props
855
881
  });
@@ -932,7 +958,7 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
932
958
  }
933
959
  function $8f89f8a832210d6b$export$b0a773486c1c2312(props) {
934
960
  $6e5ce22b65512b0a$export$4daadad26e48a2c7(props);
935
- return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
961
+ return $f8d878722c3bc07d$export$f6e64e17bd69eeef({
936
962
  solid_component: (0, $3b36cc844440a979$export$e46079a2793e9ec7),
937
963
  props: props,
938
964
  hydrate_function_when_ssr: (0, $2kiy7$solidjsweb.hydrate),
@@ -984,7 +1010,7 @@ function $0991f250194bf9f3$export$912994940e660d32() {
984
1010
  open: open
985
1011
  };
986
1012
  }
987
- const $fea6ed5be1bf2b27$export$9bb30bbe003b82e0 = function () {
1013
+ const $22f9dd60da27081f$export$9bb30bbe003b82e0 = function () {
988
1014
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
989
1015
  // We should just export a plain SearchField component here, not a weird hook thing, but I don't want to make a breaking change. Just fixing the re-rendering issue for now.
990
1016
  // Create signal that persists across renders
@@ -992,19 +1018,21 @@ const $fea6ed5be1bf2b27$export$9bb30bbe003b82e0 = function () {
992
1018
  // Update signal value when alignerRef changes
993
1019
  set_aligner_signal_value(props === null || props === void 0 ? void 0 : props.alignerRef);
994
1020
  // Make sure react never re-renders the actual SearchField component
995
- const componentFunction = $2kiy7$react.useCallback(() => $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
996
- solid_component: $e7ba61a7074c02d3$export$e5139bbbb9a05035(() => {
997
- return $2kiy7$solidjs.createMemo(() => {
998
- const depict_search = $fe70497a7dcbe63d$export$f4d89133c6985668("search", props.stateKey, "useSearchField");
999
- return $2kiy7$depictaiui.SearchField({
1000
- depict_search: depict_search,
1001
- get aligner_ref() {
1002
- var _get_aligner_signal_v;
1003
- // React mutates the object at some random time so only get the current value once it actually is requested
1004
- return (_get_aligner_signal_v = get_aligner_signal_value()) === null || _get_aligner_signal_v === void 0 ? void 0 : _get_aligner_signal_v.current;
1005
- }
1021
+ const componentFunction = $2kiy7$react.useCallback(() => $f8d878722c3bc07d$export$f6e64e17bd69eeef({
1022
+ solid_component: () => $2kiy7$solidjsweb.createComponent((0, $c14f9d5966bcfc3c$export$eb5844afe948564b), {
1023
+ get children() {
1024
+ return $2kiy7$solidjs.createMemo(() => {
1025
+ const depict_search = $fe70497a7dcbe63d$export$f4d89133c6985668("search", props.stateKey, "useSearchField");
1026
+ return $2kiy7$depictaiui.SearchField({
1027
+ depict_search: depict_search,
1028
+ get aligner_ref() {
1029
+ var _get_aligner_signal_v;
1030
+ // React mutates the object at some random time so only get the current value once it actually is requested
1031
+ return (_get_aligner_signal_v = get_aligner_signal_value()) === null || _get_aligner_signal_v === void 0 ? void 0 : _get_aligner_signal_v.current;
1032
+ }
1033
+ });
1006
1034
  });
1007
- });
1035
+ }
1008
1036
  }),
1009
1037
  props: {}
1010
1038
  }), []);
@@ -1045,6 +1073,91 @@ async function $2ea1d71b29581906$var$fetchRecommendations(opts) {
1045
1073
  });
1046
1074
  return fetchedRecs;
1047
1075
  }
1076
+ function $b8893da801486712$export$72616730c1fad2f4(stateKey) {
1077
+ // Create signal that will persist re-renders
1078
+ const [[getStateKeySignalValue, setStateKeySignalValue]] = $2kiy7$react.useState($2kiy7$solidjs.createSignal(stateKey));
1079
+ const [cachedFunctionCalls] = $2kiy7$react.useState({});
1080
+ const [hookFunctionsObject, setHookFunctionsObject] = $2kiy7$react.useState(new Proxy({}, {
1081
+ get(target, property) {
1082
+ return function () {
1083
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
1084
+ // Cache function calls until we have the real functions
1085
+ cachedFunctionCalls[property] = args;
1086
+ };
1087
+ }
1088
+ }));
1089
+ $2kiy7$react.useEffect(() => {
1090
+ // get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
1091
+ return $2kiy7$solidjs.createRoot(dispose => {
1092
+ let firstRun = true;
1093
+ $2kiy7$solidjs.createRenderEffect(() => {
1094
+ const depict_category = $fe70497a7dcbe63d$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
1095
+ const functions = $b8893da801486712$var$createHookFunctions(depict_category);
1096
+ if (firstRun) {
1097
+ firstRun = false;
1098
+ // Run cached function calls
1099
+ Object.entries(cachedFunctionCalls).forEach(_ref => {
1100
+ var _functions$key;
1101
+ let [key, args] = _ref;
1102
+ return (_functions$key = functions[key]) === null || _functions$key === void 0 ? void 0 : _functions$key.call(functions, ...args);
1103
+ });
1104
+ }
1105
+ setHookFunctionsObject(functions);
1106
+ });
1107
+ return dispose;
1108
+ });
1109
+ }, []);
1110
+ // When props change, update our signal value so solid can react to stateKey changing
1111
+ $2kiy7$react.useEffect(() => {
1112
+ setStateKeySignalValue(stateKey);
1113
+ }, [stateKey]);
1114
+ return hookFunctionsObject;
1115
+ }
1116
+ function $b8893da801486712$var$createHookFunctions(depictCategory) {
1117
+ const categorySetShouldShowFilters = newValue => {
1118
+ const {
1119
+ historyStateSignals_: {
1120
+ filters_open: [, setFiltersOpen],
1121
+ sorting_open: [, setSortingOpen]
1122
+ }
1123
+ } = depictCategory;
1124
+ if (newValue)
1125
+ // Close sorting so we don't show both at once
1126
+ setSortingOpen(false);
1127
+ setFiltersOpen(newValue);
1128
+ };
1129
+ const categorySetFilter = filter => {
1130
+ const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
1131
+ const filteredFilters = $2kiy7$solidjs.untrack(selectedFilters).filter(_ref2 => {
1132
+ let {
1133
+ field: field,
1134
+ op: op
1135
+ } = _ref2;
1136
+ return field !== filter.field && op !== filter.op;
1137
+ });
1138
+ filteredFilters.push(filter);
1139
+ setSelectedFilters(filteredFilters);
1140
+ };
1141
+ const categoryExpandFilterGroup = groupToExpand => {
1142
+ const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
1143
+ const newExpanded = $2kiy7$solidjs.untrack(expandedFilters).filter(_ref3 => {
1144
+ let {
1145
+ section_: section_
1146
+ } = _ref3;
1147
+ return section_ !== groupToExpand;
1148
+ });
1149
+ newExpanded.push({
1150
+ section_: groupToExpand,
1151
+ expanded_: true
1152
+ });
1153
+ setExpandedFilters(newExpanded);
1154
+ };
1155
+ return {
1156
+ categorySetShouldShowFilters: categorySetShouldShowFilters,
1157
+ categorySetFilter: categorySetFilter,
1158
+ categoryExpandFilterGroup: categoryExpandFilterGroup
1159
+ };
1160
+ }
1048
1161
  const $6bf91538dbdf0252$export$804fac5697cfbe35 = router => (relativeUrl, _ref) => {
1049
1162
  let {
1050
1163
  scroll: scroll,
@@ -1056,9 +1169,9 @@ const $6bf91538dbdf0252$export$804fac5697cfbe35 = router => (relativeUrl, _ref)
1056
1169
  Page[Page["SEARCH"] = 1] = "SEARCH";
1057
1170
  Page[Page["CATEGORY"] = 2] = "CATEGORY";
1058
1171
  })(Page || (Page = {}));
1059
- const current_page = $e7ba61a7074c02d3$export$775e6b3892b5ad52() ? Page.SEARCH : $e7ba61a7074c02d3$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
1172
+ const current_page = $f8d878722c3bc07d$export$775e6b3892b5ad52() ? Page.SEARCH : $f8d878722c3bc07d$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
1060
1173
  const target_u_o = new URL(relativeUrl, location.origin);
1061
- const target_page = $e7ba61a7074c02d3$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $e7ba61a7074c02d3$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
1174
+ const target_page = $f8d878722c3bc07d$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $f8d878722c3bc07d$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
1062
1175
  router[replace ? "replace" : "push"](relativeUrl, undefined, {
1063
1176
  shallow: current_page === target_page && target_page !== Page.OTHER,
1064
1177
  scroll:
package/ES10/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { DPC } from "@depict-ai/dpc/ES10";
2
2
  import React, { PropsWithChildren, FC, ReactNode, ReactPortal, ReactElement } from "react";
3
- import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/ES10";
3
+ import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } from "@depict-ai/ui/ES10";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "4.0.23";
6
+ export const version = "4.1.1";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
602
602
  * @returns {UseFetchRecommendationsReturn}
603
603
  */
604
604
  export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
605
+ /**
606
+ * Gives you some helpers that let you interact with the state of a category page
607
+ * @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
608
+ */
609
+ export function useCategoryFilterHelpers(stateKey: string | undefined): {
610
+ categorySetShouldShowFilters: (shouldShow: boolean) => void;
611
+ categorySetFilter: (filter: FilterWithData) => void;
612
+ categoryExpandFilterGroup: (title: string) => void;
613
+ };
605
614
  /**
606
615
  * Helper function to navigate to a new page depending on the navigation library used.
607
616
  */