@depict-ai/react-ui 1.5.20 → 2.0.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.
Files changed (49) hide show
  1. package/ES10/index.cjs +152 -69
  2. package/ES10/index.d.ts +549 -37
  3. package/ES10/index.js +155 -74
  4. package/README.md +2 -1
  5. package/dist/main.js +293 -0
  6. package/dist/module.js +285 -0
  7. package/dist/styles/components/PLP/Buttons.scss +124 -0
  8. package/dist/styles/components/PLP/MorphingSign.scss +31 -0
  9. package/dist/styles/components/PLP/PLPResults.scss +20 -0
  10. package/dist/styles/components/PLP/ProductListingPage.scss +142 -0
  11. package/dist/styles/components/PLP/ScrollStatus.scss +24 -0
  12. package/dist/styles/components/PLP/SelectedFilters.scss +74 -0
  13. package/dist/styles/components/PLP/SlidableItems.scss +99 -0
  14. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +75 -0
  15. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +728 -0
  16. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +160 -0
  17. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +148 -0
  18. package/dist/styles/components/PLP/Toast.scss +54 -0
  19. package/dist/styles/components/PLP/index.scss +45 -0
  20. package/dist/styles/components/category/BreadCrumbs.scss +23 -0
  21. package/dist/styles/components/category/CategoryTitle.scss +28 -0
  22. package/dist/styles/components/category/QuickLinks.scss +71 -0
  23. package/dist/styles/components/category/index.scss +23 -0
  24. package/dist/styles/components/search/Autocomplete.scss +117 -0
  25. package/dist/styles/components/search/CategorySuggestions.scss +74 -0
  26. package/dist/styles/components/search/InstantCard.scss +117 -0
  27. package/dist/styles/components/search/InstantResults.scss +10 -0
  28. package/dist/styles/components/search/PreviousSearches.scss +77 -0
  29. package/dist/styles/components/search/QueryInput.scss +167 -0
  30. package/dist/styles/components/search/SearchModal.scss +95 -0
  31. package/dist/styles/components/search/SearchRecommendations.scss +25 -0
  32. package/dist/styles/components/search/ShowingResultsFor.scss +10 -0
  33. package/dist/styles/components/search/index.scss +40 -0
  34. package/dist/styles/default.css +1 -0
  35. package/dist/styles/helpers/custom_input.scss +162 -0
  36. package/dist/styles/helpers/supports-hover.scss +5 -0
  37. package/dist/styles/helpers/utils.scss +82 -0
  38. package/dist/styles/plain-css-fallback-styling.css +1 -1
  39. package/dist/styles/variables.scss +47 -0
  40. package/latest/index.cjs +148 -68
  41. package/latest/index.d.ts +549 -37
  42. package/latest/index.js +151 -73
  43. package/package.json +9 -9
  44. package/server/ES10/index.cjs +128 -1
  45. package/server/ES10/index.d.ts +549 -37
  46. package/server/ES10/index.js +130 -5
  47. package/server/latest/index.cjs +125 -1
  48. package/server/latest/index.d.ts +549 -37
  49. package/server/latest/index.js +127 -5
package/latest/index.js CHANGED
@@ -1,19 +1,20 @@
1
1
  import { add_to_version_info as $2GFvs$add_to_version_info, catchify as $2GFvs$catchify, queueMacroTask as $2GFvs$queueMacroTask, instant_exec_on_suspect_history_change as $2GFvs$instant_exec_on_suspect_history_change, derror as $2GFvs$derror } from "@depict-ai/utilishared/latest";
2
- import { CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictAPI as $2GFvs$DepictAPI, ProductCardError as $2GFvs$ProductCardError, DepictSearch as $2GFvs$DepictSearch, DepictCategory as $2GFvs$DepictCategory, get_search_query_updating_blocked_signal as $2GFvs$get_search_query_updating_blocked_signal, SearchPage as $2GFvs$SearchPage, defaultColsAtSize as $2GFvs$defaultColsAtSize, defaultGridSpacing as $2GFvs$defaultGridSpacing, CategoryPage as $2GFvs$CategoryPage, defaultCategoryTitlePlugin as $2GFvs$defaultCategoryTitlePlugin, BreadCrumbs as $2GFvs$BreadCrumbs, QuickLinks as $2GFvs$QuickLinks, ImagePlaceholder as $2GFvs$ImagePlaceholder, TextPlaceholder as $2GFvs$TextPlaceholder, open_modal_with_alignment as $2GFvs$open_modal_with_alignment, SearchField as $2GFvs$SearchField, fetchDepictRecommendations as $2GFvs$fetchDepictRecommendations } from "@depict-ai/ui/latest";
3
- import { untrack as $2GFvs$untrack, createRoot as $2GFvs$createRoot, createEffect as $2GFvs$createEffect, createMemo as $2GFvs$createMemo, createComponent as $2GFvs$createComponent, Show as $2GFvs$Show, getOwner as $2GFvs$getOwner, runWithOwner as $2GFvs$runWithOwner, onCleanup as $2GFvs$onCleanup, createSignal as $2GFvs$createSignal, createComputed as $2GFvs$createComputed } from "solid-js";
4
- import { createElement as $2GFvs$createElement, Fragment as $2GFvs$Fragment, useEffect as $2GFvs$useEffect, useState as $2GFvs$useState, useRef as $2GFvs$useRef, Component as $2GFvs$Component, forwardRef as $2GFvs$forwardRef, useCallback as $2GFvs$useCallback } from "react";
2
+ import { CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictAPI as $2GFvs$DepictAPI, DepictSearch as $2GFvs$DepictSearch, DepictCategory as $2GFvs$DepictCategory, get_search_query_updating_blocked_signal as $2GFvs$get_search_query_updating_blocked_signal, SearchPage as $2GFvs$SearchPage, defaultColsAtSize as $2GFvs$defaultColsAtSize, defaultGridSpacing as $2GFvs$defaultGridSpacing, ProductCardError as $2GFvs$ProductCardError, CategoryPage as $2GFvs$CategoryPage, defaultCategoryTitlePlugin as $2GFvs$defaultCategoryTitlePlugin, BreadCrumbs as $2GFvs$BreadCrumbs, QuickLinks as $2GFvs$QuickLinks, ImagePlaceholder as $2GFvs$ImagePlaceholder, TextPlaceholder as $2GFvs$TextPlaceholder, RecommendationSlider as $2GFvs$RecommendationSlider, RecommendationGrid as $2GFvs$RecommendationGrid, open_modal_with_alignment as $2GFvs$open_modal_with_alignment, SearchField as $2GFvs$SearchField, fetchDepictRecommendations as $2GFvs$fetchDepictRecommendations } from "@depict-ai/ui/latest";
3
+ import { untrack as $2GFvs$untrack, createRoot as $2GFvs$createRoot, createEffect as $2GFvs$createEffect, createMemo as $2GFvs$createMemo, createComponent as $2GFvs$createComponent, Show as $2GFvs$Show, createSignal as $2GFvs$createSignal, createComputed as $2GFvs$createComputed, onCleanup as $2GFvs$onCleanup, getOwner as $2GFvs$getOwner, runWithOwner as $2GFvs$runWithOwner } from "solid-js";
4
+ import { createElement as $2GFvs$createElement, Fragment as $2GFvs$Fragment, useEffect as $2GFvs$useEffect, useState as $2GFvs$useState, useRef as $2GFvs$useRef, forwardRef as $2GFvs$forwardRef, Component as $2GFvs$Component, useCallback as $2GFvs$useCallback } from "react";
5
5
  import { defaultLocale as $2GFvs$defaultLocale } from "@depict-ai/ui/locales/latest";
6
- import { render as $2GFvs$render, hydrate as $2GFvs$hydrate } from "solid-js/web";
7
- import { jsx as $2GFvs$jsx } from "react/jsx-runtime";
8
- import { createPortal as $2GFvs$createPortal } from "react-dom";
6
+ import { render as $2GFvs$render, hydrate as $2GFvs$hydrate, isServer as $2GFvs$isServer } from "solid-js/web";
9
7
  import { createStore as $2GFvs$createStore, reconcile as $2GFvs$reconcile } from "solid-js/store";
10
8
  import { DPC as $2GFvs$DPC } from "@depict-ai/dpc/latest";
9
+ import { jsx as $2GFvs$jsx } from "react/jsx-runtime";
10
+ import { createPortal as $2GFvs$createPortal } from "react-dom";
11
+ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
11
12
 
12
13
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
13
14
  // Note, if you add an export here, also add one in src-server/main.ts
14
15
  import { register_es_version } from "../multi_import_deduplicator.mjs";
15
16
  register_es_version("react-ui", "latest");
16
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.5.20";
17
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.1";
17
18
  const $42858f023ef23dab$export$8e769ad4338a911e = {
18
19
  usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
19
20
  search_instances: new Map(),
@@ -33,31 +34,6 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
33
34
  category_meta_title_suffix: $2GFvs$createSignal(),
34
35
  disable_override_query_id: $2GFvs$createSignal()
35
36
  };
36
- class $d5c9e1f3545b4984$export$d0f82e3ef89b1f22 extends (0, $2GFvs$Component) {
37
- constructor(props) {
38
- super(props);
39
- this.state = {
40
- hasError: false
41
- };
42
- }
43
- static getDerivedStateFromError() {
44
- // Update state so the next render will show the fallback UI.
45
- return {
46
- hasError: true
47
- };
48
- }
49
- componentDidCatch(error) {
50
- this.props.on_error(error);
51
- }
52
- render() {
53
- if (this.state.hasError)
54
- // You can render any custom fallback UI
55
- return $2GFvs$createElement("div", {
56
- children: "Component failed"
57
- });
58
- return this.props.children;
59
- }
60
- }
61
37
  let $c83ba9ab79386687$var$run_on_href_change;
62
38
  let $c83ba9ab79386687$var$old_href = location.href;
63
39
  function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
@@ -126,44 +102,6 @@ function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set) {
126
102
  });
127
103
  };
128
104
  }
129
- async function $c83ba9ab79386687$export$79c79419c1ef0081({
130
- display: display,
131
- component_portals: component_portals,
132
- set_portals: set_portals,
133
- react_template: react_template
134
- }) {
135
- let set_react_has_ran_hooks;
136
- let was_cleaned_up = false;
137
- const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
138
- const solid_container = document.createElement("div");
139
- const owner = $2GFvs$getOwner();
140
- const reactProductCard = $2GFvs$jsx(props => {
141
- // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
142
- $2GFvs$useEffect(set_react_has_ran_hooks, []);
143
- return react_template(props);
144
- }, {
145
- display: display
146
- });
147
- const reactProductCardInErrorBoundary = $2GFvs$jsx((0, $d5c9e1f3545b4984$export$d0f82e3ef89b1f22), {
148
- children: reactProductCard,
149
- on_error: error => $2GFvs$runWithOwner(owner, () => {
150
- if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
151
- throw new (0, $2GFvs$ProductCardError)(error);
152
- })
153
- });
154
- const portal = $2GFvs$createPortal(reactProductCardInErrorBoundary, solid_container);
155
- component_portals.add(portal);
156
- set_portals([...component_portals]);
157
- $2GFvs$onCleanup(() => {
158
- was_cleaned_up = true;
159
- // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
160
- component_portals.delete(portal);
161
- // Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
162
- queueMicrotask(() => set_portals([...component_portals]));
163
- });
164
- await react_has_ran_hooks; // After react has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
165
- return [solid_container];
166
- }
167
105
  let $8071251ee4e9ffa1$var$set = false;
168
106
  let $8071251ee4e9ffa1$var$padding_animation;
169
107
  function $8071251ee4e9ffa1$export$6453cbc34515a94d() {
@@ -504,6 +442,69 @@ function $99489374cd4f601d$export$f4d89133c6985668(type, stateKey, componentName
504
442
  });
505
443
  return instance.instance;
506
444
  }
445
+ class $d5c9e1f3545b4984$export$d0f82e3ef89b1f22 extends (0, $2GFvs$Component) {
446
+ constructor(props) {
447
+ super(props);
448
+ this.state = {
449
+ hasError: false
450
+ };
451
+ }
452
+ static getDerivedStateFromError() {
453
+ // Update state so the next render will show the fallback UI.
454
+ return {
455
+ hasError: true
456
+ };
457
+ }
458
+ componentDidCatch(error) {
459
+ this.props.on_error(error);
460
+ }
461
+ render() {
462
+ if (this.state.hasError)
463
+ // You can render any custom fallback UI
464
+ return $2GFvs$createElement("div", {
465
+ children: "Component failed"
466
+ });
467
+ return this.props.children;
468
+ }
469
+ }
470
+ async function $75f1064c8b836348$export$79c79419c1ef0081({
471
+ display: display,
472
+ component_portals: component_portals,
473
+ set_portals: set_portals,
474
+ react_template: react_template
475
+ }) {
476
+ let set_react_has_ran_hooks;
477
+ let was_cleaned_up = false;
478
+ const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
479
+ const solid_container = document.createElement("div");
480
+ const owner = $2GFvs$getOwner();
481
+ const reactProductCard = $2GFvs$jsx(props => {
482
+ // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
483
+ $2GFvs$useEffect(set_react_has_ran_hooks, []);
484
+ return react_template(props);
485
+ }, {
486
+ display: display
487
+ });
488
+ const reactProductCardInErrorBoundary = $2GFvs$jsx((0, $d5c9e1f3545b4984$export$d0f82e3ef89b1f22), {
489
+ children: reactProductCard,
490
+ on_error: error => $2GFvs$runWithOwner(owner, () => {
491
+ if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
492
+ throw new (0, $2GFvs$ProductCardError)(error);
493
+ })
494
+ });
495
+ const portal = $2GFvs$createPortal(reactProductCardInErrorBoundary, solid_container);
496
+ component_portals.add(portal);
497
+ set_portals([...component_portals]);
498
+ $2GFvs$onCleanup(() => {
499
+ was_cleaned_up = true;
500
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
501
+ component_portals.delete(portal);
502
+ // Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
503
+ queueMicrotask(() => set_portals([...component_portals]));
504
+ });
505
+ await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
506
+ return [solid_container];
507
+ }
507
508
  const $4a678f0c87b12e78$var$rendered_components_with_state_key = new Set();
508
509
  function $4a678f0c87b12e78$export$a54ec244c8863715(props) {
509
510
  return $c83ba9ab79386687$export$f6e64e17bd69eeef({
@@ -565,7 +566,7 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
565
566
  return props.gridSpacing ?? (0, $2GFvs$defaultGridSpacing);
566
567
  },
567
568
  depict_search: depict_search(),
568
- product_card_template: display => $c83ba9ab79386687$export$79c79419c1ef0081({
569
+ product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
569
570
  display: display,
570
571
  react_template: $2GFvs$untrack(() => props.productCard),
571
572
  component_portals: component_portals,
@@ -644,7 +645,7 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
644
645
  get show_quicklinks() {
645
646
  return props.showQuicklinks;
646
647
  },
647
- product_card_template: display => $c83ba9ab79386687$export$79c79419c1ef0081({
648
+ product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
648
649
  display: display,
649
650
  react_template: $2GFvs$untrack(() => props.productCard),
650
651
  component_portals: component_portals,
@@ -711,6 +712,83 @@ const $cbd250061abf11cb$export$89c6019e4baa40b1 = raw_react_props => {
711
712
  }
712
713
  });
713
714
  };
715
+ function $4fd5dc0e231a60d9$export$82cfdc85a4d15688(props) {
716
+ return $c83ba9ab79386687$export$f6e64e17bd69eeef({
717
+ solid_component: $4fd5dc0e231a60d9$export$5abb40edfde2a843,
718
+ props: props
719
+ });
720
+ }
721
+ function $4fd5dc0e231a60d9$export$5abb40edfde2a843(props, set_portals) {
722
+ const component_portals = new Set();
723
+ return $2GFvs$RecommendationSlider({
724
+ get recommendations() {
725
+ return props.recommendations;
726
+ },
727
+ product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
728
+ display: display,
729
+ react_template: $2GFvs$untrack(() => props.productCard),
730
+ component_portals: component_portals,
731
+ set_portals: set_portals
732
+ }),
733
+ get cols_at_size() {
734
+ return props.columnsAtSize || (0, $2GFvs$defaultColsAtSize);
735
+ },
736
+ get grid_spacing() {
737
+ return props.gridSpacing ?? (0, $2GFvs$defaultGridSpacing);
738
+ }
739
+ });
740
+ }
741
+ function $8bee51f55543fe0c$export$bd8acc07a8bae229(props, set_portals) {
742
+ const component_portals = new Set();
743
+ return $2GFvs$RecommendationGrid({
744
+ get recommendations() {
745
+ return props.recommendations;
746
+ },
747
+ product_card_template: display => {
748
+ if (0, $2GFvs$isServer)
749
+ // This function can't be async on the server
750
+ // @ts-ignore
751
+ return {
752
+ t: $2GFvs$renderToString($2GFvs$createElement(() => props.productCard({
753
+ display: display
754
+ })))
755
+ };
756
+ return $75f1064c8b836348$export$79c79419c1ef0081({
757
+ display: display,
758
+ react_template: $2GFvs$untrack(() => props.productCard),
759
+ component_portals: component_portals,
760
+ set_portals: set_portals
761
+ });
762
+ },
763
+ get cols_at_size() {
764
+ return props.columnsAtSize || (0, $2GFvs$defaultColsAtSize);
765
+ },
766
+ get grid_spacing() {
767
+ return props.gridSpacing ?? (0, $2GFvs$defaultGridSpacing);
768
+ },
769
+ get max_rows() {
770
+ return props.maxRows;
771
+ },
772
+ get view_more_button() {
773
+ const {
774
+ viewMoreButton: viewMoreButton
775
+ } = props;
776
+ return viewMoreButton ? {
777
+ text: viewMoreButton.text,
778
+ start_rows: viewMoreButton.startRows ?? 2,
779
+ rows_per_click: viewMoreButton.rowsPerClick
780
+ } : undefined;
781
+ }
782
+ });
783
+ }
784
+ function $73b783bfc241b2d9$export$b0a773486c1c2312(props) {
785
+ return $c83ba9ab79386687$export$f6e64e17bd69eeef({
786
+ solid_component: (0, $8bee51f55543fe0c$export$bd8acc07a8bae229),
787
+ props: props,
788
+ hydrate_function_when_ssr: (0, $2GFvs$hydrate),
789
+ wrapper_type: "section"
790
+ });
791
+ }
714
792
  const $41cab674edff4277$export$d69d8daa20eae175 = createOpenModalParams => {
715
793
  const {
716
794
  location = "centered",
@@ -821,4 +899,4 @@ const $97603d19204ec48d$export$b8a61e5c71402559 = {
821
899
  nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35
822
900
  };
823
901
  $2GFvs$add_to_version_info("react-ui", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
824
- export { $b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $421f32789b6f111f$export$80e99ee6b29cadd2 as ComponentAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$f7d2f673fc2f091d as CategoryPage, $4a678f0c87b12e78$export$a54ec244c8863715 as SearchPage, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $70344e5e0d0fea06$export$912994940e660d32 as useSearchModal, $2b886cf548a4775c$export$9bb30bbe003b82e0 as useSearchField, $1bb4271dc44722e2$export$6501da23a2770fc as useFetchRecommendations, $a00d8f27abd5d0b0$export$38b98fae14bd1f64 as usePerformanceClient, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation };
902
+ export { $b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $421f32789b6f111f$export$80e99ee6b29cadd2 as ComponentAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$f7d2f673fc2f091d as CategoryPage, $4a678f0c87b12e78$export$a54ec244c8863715 as SearchPage, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $73b783bfc241b2d9$export$b0a773486c1c2312 as RecommendationGrid, $4fd5dc0e231a60d9$export$82cfdc85a4d15688 as RecommendationSlider, $70344e5e0d0fea06$export$912994940e660d32 as useSearchModal, $2b886cf548a4775c$export$9bb30bbe003b82e0 as useSearchField, $1bb4271dc44722e2$export$6501da23a2770fc as useFetchRecommendations, $a00d8f27abd5d0b0$export$38b98fae14bd1f64 as usePerformanceClient, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "1.5.20",
3
+ "version": "2.0.1",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "types": "ES10/index.d.ts",
@@ -135,10 +135,10 @@
135
135
  "@babel/plugin-transform-typescript": "^7.22.9",
136
136
  "@babel/runtime": "latest",
137
137
  "@babel/runtime-corejs3": "latest",
138
- "@depict-ai/dpc": "^1.0.39",
139
- "@depict-ai/plp-styling": "^1.1.3",
140
- "@depict-ai/ui": "^1.4.23",
141
- "@depict-ai/utilishared": "^1.0.39",
138
+ "@depict-ai/dpc": "^1.0.40",
139
+ "@depict-ai/plp-styling": "^1.2.1",
140
+ "@depict-ai/ui": "^2.0.1",
141
+ "@depict-ai/utilishared": "^1.0.41",
142
142
  "solid-js": "^1.7.3"
143
143
  },
144
144
  "peerDependencies": {
@@ -150,10 +150,10 @@
150
150
  "@babel/core": "latest",
151
151
  "@babel/preset-env": "latest",
152
152
  "@babel/preset-typescript": "latest",
153
- "@depict-ai/plp-styling": "^1.1.3",
153
+ "@depict-ai/plp-styling": "^1.2.1",
154
154
  "@jest/globals": "^29.3.1",
155
- "@parcel/babel-preset-env": "latest",
156
- "@parcel/transformer-sass": "latest",
155
+ "@parcel/babel-preset-env": "^2.9.3",
156
+ "@parcel/transformer-sass": "^2.9.3",
157
157
  "@types/jest": "^29.2.6",
158
158
  "@types/node": "^18.11.11",
159
159
  "@types/react": "^18.0.26",
@@ -164,7 +164,7 @@
164
164
  "jest-haste-map": "^29.3.1",
165
165
  "jest-resolve": "^29.3.1",
166
166
  "next": "^13.4.10",
167
- "parcel": "latest",
167
+ "parcel": "^2.9.3",
168
168
  "react": "^18.2.0",
169
169
  "react-dom": "^18.2.0",
170
170
  "ts-jest": "^29.0.5"
@@ -1,6 +1,10 @@
1
1
  var $aNCHr$react = require("react");
2
2
  var $aNCHr$depictaiui = require("@depict-ai/ui/ES10");
3
3
  var $aNCHr$solidjsweb = require("solid-js/web");
4
+ var $aNCHr$solidjs = require("solid-js");
5
+ var $aNCHr$reactdomserver = require("react-dom/server");
6
+ var $aNCHr$reactjsxruntime = require("react/jsx-runtime");
7
+ var $aNCHr$reactdom = require("react-dom");
4
8
  require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "ES10");
5
9
  function $parcel$export(e, n, v, s) {
6
10
  Object.defineProperty(e, n, {
@@ -15,8 +19,10 @@ $parcel$export(module.exports, "SearchPage", () => $202459d454907b31$export$a54e
15
19
  $parcel$export(module.exports, "CategoryPage", () => $202459d454907b31$export$f7d2f673fc2f091d);
16
20
  $parcel$export(module.exports, "BreadCrumbs", () => $202459d454907b31$export$5646050d516e06bc);
17
21
  $parcel$export(module.exports, "QuickLinks", () => $202459d454907b31$export$466cdc317043f6cb);
22
+ $parcel$export(module.exports, "RecommendationSlider", () => $202459d454907b31$export$82cfdc85a4d15688);
18
23
  $parcel$export(module.exports, "ComponentAligner", () => $202459d454907b31$export$80e99ee6b29cadd2);
19
24
  $parcel$export(module.exports, "ImagePlaceholder", () => $202459d454907b31$export$3f37af283f8fb843);
25
+ $parcel$export(module.exports, "RecommendationGrid", () => $202459d454907b31$export$b0a773486c1c2312);
20
26
  $parcel$export(module.exports, "TextPlaceholder", () => $202459d454907b31$export$89c6019e4baa40b1);
21
27
  $parcel$export(module.exports, "useSearchField", () => $202459d454907b31$export$9bb30bbe003b82e0);
22
28
  $parcel$export(module.exports, "openModal", () => $202459d454907b31$export$a7f6cffb6b8ba11c);
@@ -42,7 +48,116 @@ function $f144be06c518d0ac$export$4b564d7f5a1b1d43(_ref) {
42
48
  }
43
49
  }));
44
50
  }
45
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "1.5.20";
51
+ class $e9048b15cf1e8792$export$d0f82e3ef89b1f22 extends (0, $aNCHr$react.Component) {
52
+ constructor(props) {
53
+ super(props);
54
+ this.state = {
55
+ hasError: false
56
+ };
57
+ }
58
+ static getDerivedStateFromError() {
59
+ // Update state so the next render will show the fallback UI.
60
+ return {
61
+ hasError: true
62
+ };
63
+ }
64
+ componentDidCatch(error) {
65
+ this.props.on_error(error);
66
+ }
67
+ render() {
68
+ if (this.state.hasError)
69
+ // You can render any custom fallback UI
70
+ return $aNCHr$react.createElement("div", {
71
+ children: "Component failed"
72
+ });
73
+ return this.props.children;
74
+ }
75
+ }
76
+ async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
77
+ let {
78
+ display: display,
79
+ component_portals: component_portals,
80
+ set_portals: set_portals,
81
+ react_template: react_template
82
+ } = _ref;
83
+ let set_react_has_ran_hooks;
84
+ let was_cleaned_up = false;
85
+ const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
86
+ const solid_container = document.createElement("div");
87
+ const owner = $aNCHr$solidjs.getOwner();
88
+ const reactProductCard = $aNCHr$reactjsxruntime.jsx(props => {
89
+ // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
90
+ $aNCHr$react.useEffect(set_react_has_ran_hooks, []);
91
+ return react_template(props);
92
+ }, {
93
+ display: display
94
+ });
95
+ const reactProductCardInErrorBoundary = $aNCHr$reactjsxruntime.jsx((0, $e9048b15cf1e8792$export$d0f82e3ef89b1f22), {
96
+ children: reactProductCard,
97
+ on_error: error => $aNCHr$solidjs.runWithOwner(owner, () => {
98
+ if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
99
+ throw new (0, $aNCHr$depictaiui.ProductCardError)(error);
100
+ })
101
+ });
102
+ const portal = $aNCHr$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
103
+ component_portals.add(portal);
104
+ set_portals([...component_portals]);
105
+ $aNCHr$solidjs.onCleanup(() => {
106
+ was_cleaned_up = true;
107
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
108
+ component_portals.delete(portal);
109
+ // Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
110
+ queueMicrotask(() => set_portals([...component_portals]));
111
+ });
112
+ await react_has_ran_hooks; // After React has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
113
+ return [solid_container];
114
+ }
115
+ function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
116
+ const component_portals = new Set();
117
+ return $aNCHr$depictaiui.RecommendationGrid({
118
+ get recommendations() {
119
+ return props.recommendations;
120
+ },
121
+ product_card_template: display => {
122
+ if (0, $aNCHr$solidjsweb.isServer)
123
+ // This function can't be async on the server
124
+ // @ts-ignore
125
+ return {
126
+ t: $aNCHr$reactdomserver.renderToString($aNCHr$react.createElement(() => props.productCard({
127
+ display: display
128
+ })))
129
+ };
130
+ return $99405615baa3d774$export$79c79419c1ef0081({
131
+ display: display,
132
+ react_template: $aNCHr$solidjs.untrack(() => props.productCard),
133
+ component_portals: component_portals,
134
+ set_portals: set_portals
135
+ });
136
+ },
137
+ get cols_at_size() {
138
+ return props.columnsAtSize || (0, $aNCHr$depictaiui.defaultColsAtSize);
139
+ },
140
+ get grid_spacing() {
141
+ var _props$gridSpacing;
142
+ return (_props$gridSpacing = props.gridSpacing) !== null && _props$gridSpacing !== void 0 ? _props$gridSpacing : (0, $aNCHr$depictaiui.defaultGridSpacing);
143
+ },
144
+ get max_rows() {
145
+ return props.maxRows;
146
+ },
147
+ get view_more_button() {
148
+ var _viewMoreButton$start;
149
+ const {
150
+ viewMoreButton: viewMoreButton
151
+ } = props;
152
+ return viewMoreButton ? {
153
+ text: viewMoreButton.text,
154
+ start_rows: (_viewMoreButton$start = viewMoreButton.startRows) !== null && _viewMoreButton$start !== void 0 ? _viewMoreButton$start : 2,
155
+ rows_per_click: viewMoreButton.rowsPerClick
156
+ } : undefined;
157
+ }
158
+ });
159
+ }
160
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.1";
46
161
  function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
47
162
  return props.children;
48
163
  }
@@ -66,6 +181,11 @@ function $202459d454907b31$export$466cdc317043f6cb() {
66
181
  children: []
67
182
  });
68
183
  }
184
+ function $202459d454907b31$export$82cfdc85a4d15688() {
185
+ return $aNCHr$react.createElement("div", {
186
+ children: []
187
+ });
188
+ }
69
189
  function $202459d454907b31$export$80e99ee6b29cadd2() {
70
190
  return $aNCHr$react.createElement("div", {
71
191
  className: "depict aligner",
@@ -85,6 +205,13 @@ function $202459d454907b31$export$3f37af283f8fb843(raw_react_props) {
85
205
  wrapper_type: "span"
86
206
  });
87
207
  }
208
+ function $202459d454907b31$export$b0a773486c1c2312(props) {
209
+ return $f144be06c518d0ac$export$4b564d7f5a1b1d43({
210
+ solid_component: (0, $27d583018ba6e604$export$bd8acc07a8bae229),
211
+ props: props,
212
+ wrapper_type: "section"
213
+ });
214
+ }
88
215
  function $202459d454907b31$export$89c6019e4baa40b1(raw_react_props) {
89
216
  const react_props = {
90
217
  ...raw_react_props,