@depict-ai/react-ui 2.0.10 → 2.0.11

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 (47) hide show
  1. package/ES10/index.cjs +22 -7
  2. package/ES10/index.d.ts +1 -1
  3. package/ES10/index.js +23 -8
  4. package/dist/main.js +527 -0
  5. package/dist/module.js +510 -0
  6. package/dist/styles/components/PLP/Buttons.scss +181 -0
  7. package/dist/styles/components/PLP/MorphingSign.scss +30 -0
  8. package/dist/styles/components/PLP/PLPResults.scss +26 -0
  9. package/dist/styles/components/PLP/ProductListingPage.scss +168 -0
  10. package/dist/styles/components/PLP/ScrollStatus.scss +31 -0
  11. package/dist/styles/components/PLP/SelectedFilters.scss +82 -0
  12. package/dist/styles/components/PLP/SlidableItems.scss +121 -0
  13. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +84 -0
  14. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +800 -0
  15. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +158 -0
  16. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +152 -0
  17. package/dist/styles/components/PLP/Toast.scss +59 -0
  18. package/dist/styles/components/PLP/index.scss +51 -0
  19. package/dist/styles/components/category/BreadCrumbs.scss +32 -0
  20. package/dist/styles/components/category/CategoryTitle.scss +40 -0
  21. package/dist/styles/components/category/QuickLinks.scss +80 -0
  22. package/dist/styles/components/category/index.scss +23 -0
  23. package/dist/styles/components/search/Autocomplete.scss +197 -0
  24. package/dist/styles/components/search/CategorySuggestions.scss +82 -0
  25. package/dist/styles/components/search/InstantCard.scss +122 -0
  26. package/dist/styles/components/search/InstantResults.scss +12 -0
  27. package/dist/styles/components/search/PreviousSearches.scss +90 -0
  28. package/dist/styles/components/search/QueryInput.scss +189 -0
  29. package/dist/styles/components/search/SearchModal.scss +101 -0
  30. package/dist/styles/components/search/SearchRecommendations.scss +28 -0
  31. package/dist/styles/components/search/ShowingResultsFor.scss +13 -0
  32. package/dist/styles/components/search/index.scss +40 -0
  33. package/dist/styles/default.css +1 -0
  34. package/dist/styles/helpers/custom_input.scss +194 -0
  35. package/dist/styles/helpers/supports-hover.scss +7 -0
  36. package/dist/styles/helpers/utils.scss +90 -0
  37. package/dist/styles/variables.scss +61 -0
  38. package/latest/index.cjs +17 -7
  39. package/latest/index.d.ts +1 -1
  40. package/latest/index.js +18 -8
  41. package/package.json +1 -1
  42. package/server/ES10/index.cjs +17 -4
  43. package/server/ES10/index.d.ts +1 -1
  44. package/server/ES10/index.js +18 -5
  45. package/server/latest/index.cjs +14 -4
  46. package/server/latest/index.d.ts +1 -1
  47. package/server/latest/index.js +15 -5
package/latest/index.cjs CHANGED
@@ -38,7 +38,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
38
38
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
39
39
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
40
40
  // Note, if you add an export here, also add one in src-server/main.ts
41
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.10";
41
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.11";
42
42
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
43
43
  usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
44
44
  search_instances: new Map(),
@@ -495,16 +495,19 @@ async function $ecaac5ceddb08f39$export$79c79419c1ef0081({
495
495
  display: display,
496
496
  component_portals: component_portals,
497
497
  set_portals: set_portals,
498
- react_template: react_template
498
+ get_react_template: get_react_template
499
499
  }) {
500
500
  let set_react_has_ran_hooks;
501
501
  let was_cleaned_up = false;
502
502
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
503
503
  const solid_container = document.createElement("div");
504
+ let call_when_template_changes;
504
505
  const owner = $2IzJs$solidjs.getOwner();
505
506
  const reactProductCard = $2IzJs$reactjsxruntime.jsx(props => {
506
507
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
507
508
  $2IzJs$react.useEffect(set_react_has_ran_hooks, []);
509
+ const [react_template, set_react_template] = $2IzJs$react.useState(() => $2IzJs$solidjs.untrack(get_react_template));
510
+ call_when_template_changes = set_react_template;
508
511
  return react_template(props);
509
512
  }, {
510
513
  display: display
@@ -519,6 +522,13 @@ async function $ecaac5ceddb08f39$export$79c79419c1ef0081({
519
522
  const portal = $2IzJs$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
520
523
  component_portals.add(portal);
521
524
  set_portals([...component_portals]);
525
+ $2IzJs$solidjs.createEffect($2IzJs$solidjs.on(get_react_template, new_template => queueMicrotask(() =>
526
+ // When the parent react component re-executes and provides a new product card, we want our react portal to also re-render
527
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
528
+ // Therefore do it after a microtask to evade detection
529
+ call_when_template_changes?.(() => new_template)), {
530
+ defer: true
531
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
522
532
  $2IzJs$solidjs.onCleanup(() => {
523
533
  was_cleaned_up = true;
524
534
  // 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
@@ -592,7 +602,7 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
592
602
  depict_search: depict_search(),
593
603
  product_card_template: display => $ecaac5ceddb08f39$export$79c79419c1ef0081({
594
604
  display: display,
595
- react_template: $2IzJs$solidjs.untrack(() => props.productCard),
605
+ get_react_template: () => props.productCard,
596
606
  component_portals: component_portals,
597
607
  set_portals: set_portals
598
608
  })
@@ -622,7 +632,7 @@ const $5aa5fcb9f8a2bebc$var$rendered_components_with_state_key = new Set();
622
632
  function $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d(props) {
623
633
  return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
624
634
  // @ts-ignore
625
- solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035($5aa5fcb9f8a2bebc$var$SolidCategoryPage),
635
+ solid_component: (...args) => $b4d0d98857ed9934$export$e5139bbbb9a05035($5aa5fcb9f8a2bebc$var$SolidCategoryPage)(...args),
626
636
  props: props,
627
637
  wrapper_type: "div",
628
638
  wrapper_style: {}
@@ -671,7 +681,7 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
671
681
  },
672
682
  product_card_template: display => $ecaac5ceddb08f39$export$79c79419c1ef0081({
673
683
  display: display,
674
- react_template: $2IzJs$solidjs.untrack(() => props.productCard),
684
+ get_react_template: () => props.productCard,
675
685
  component_portals: component_portals,
676
686
  set_portals: set_portals
677
687
  })
@@ -750,7 +760,7 @@ function $8ffd7da37fdd46be$export$5abb40edfde2a843(props, set_portals) {
750
760
  },
751
761
  product_card_template: display => $ecaac5ceddb08f39$export$79c79419c1ef0081({
752
762
  display: display,
753
- react_template: $2IzJs$solidjs.untrack(() => props.productCard),
763
+ get_react_template: () => props.productCard,
754
764
  component_portals: component_portals,
755
765
  set_portals: set_portals
756
766
  }),
@@ -779,7 +789,7 @@ function $0aaa03f81d756b85$export$bd8acc07a8bae229(props, set_portals) {
779
789
  };
780
790
  return $ecaac5ceddb08f39$export$79c79419c1ef0081({
781
791
  display: display,
782
- react_template: $2IzJs$solidjs.untrack(() => props.productCard),
792
+ get_react_template: () => props.productCard,
783
793
  component_portals: component_portals,
784
794
  set_portals: set_portals
785
795
  });
package/latest/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, ReactPortal, ReactElement } from "
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.0.10";
6
+ export const version = "2.0.11";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
package/latest/index.js CHANGED
@@ -1,6 +1,6 @@
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
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";
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, on as $2GFvs$on } from "solid-js";
4
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
6
  import { render as $2GFvs$render, hydrate as $2GFvs$hydrate, isServer as $2GFvs$isServer } from "solid-js/web";
@@ -14,7 +14,7 @@ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
14
14
  // Note, if you add an export here, also add one in src-server/main.ts
15
15
  import { register_es_version } from "../multi_import_deduplicator.mjs";
16
16
  register_es_version("react-ui", "latest");
17
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.10";
17
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.11";
18
18
  const $42858f023ef23dab$export$8e769ad4338a911e = {
19
19
  usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
20
20
  search_instances: new Map(),
@@ -471,16 +471,19 @@ async function $75f1064c8b836348$export$79c79419c1ef0081({
471
471
  display: display,
472
472
  component_portals: component_portals,
473
473
  set_portals: set_portals,
474
- react_template: react_template
474
+ get_react_template: get_react_template
475
475
  }) {
476
476
  let set_react_has_ran_hooks;
477
477
  let was_cleaned_up = false;
478
478
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
479
479
  const solid_container = document.createElement("div");
480
+ let call_when_template_changes;
480
481
  const owner = $2GFvs$getOwner();
481
482
  const reactProductCard = $2GFvs$jsx(props => {
482
483
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
483
484
  $2GFvs$useEffect(set_react_has_ran_hooks, []);
485
+ const [react_template, set_react_template] = $2GFvs$useState(() => $2GFvs$untrack(get_react_template));
486
+ call_when_template_changes = set_react_template;
484
487
  return react_template(props);
485
488
  }, {
486
489
  display: display
@@ -495,6 +498,13 @@ async function $75f1064c8b836348$export$79c79419c1ef0081({
495
498
  const portal = $2GFvs$createPortal(reactProductCardInErrorBoundary, solid_container);
496
499
  component_portals.add(portal);
497
500
  set_portals([...component_portals]);
501
+ $2GFvs$createEffect($2GFvs$on(get_react_template, new_template => queueMicrotask(() =>
502
+ // When the parent react component re-executes and provides a new product card, we want our react portal to also re-render
503
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
504
+ // Therefore do it after a microtask to evade detection
505
+ call_when_template_changes?.(() => new_template)), {
506
+ defer: true
507
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
498
508
  $2GFvs$onCleanup(() => {
499
509
  was_cleaned_up = true;
500
510
  // 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
@@ -568,7 +578,7 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
568
578
  depict_search: depict_search(),
569
579
  product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
570
580
  display: display,
571
- react_template: $2GFvs$untrack(() => props.productCard),
581
+ get_react_template: () => props.productCard,
572
582
  component_portals: component_portals,
573
583
  set_portals: set_portals
574
584
  })
@@ -598,7 +608,7 @@ const $48d7f568740a317d$var$rendered_components_with_state_key = new Set();
598
608
  function $48d7f568740a317d$export$f7d2f673fc2f091d(props) {
599
609
  return $c83ba9ab79386687$export$f6e64e17bd69eeef({
600
610
  // @ts-ignore
601
- solid_component: $c83ba9ab79386687$export$e5139bbbb9a05035($48d7f568740a317d$var$SolidCategoryPage),
611
+ solid_component: (...args) => $c83ba9ab79386687$export$e5139bbbb9a05035($48d7f568740a317d$var$SolidCategoryPage)(...args),
602
612
  props: props,
603
613
  wrapper_type: "div",
604
614
  wrapper_style: {}
@@ -647,7 +657,7 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
647
657
  },
648
658
  product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
649
659
  display: display,
650
- react_template: $2GFvs$untrack(() => props.productCard),
660
+ get_react_template: () => props.productCard,
651
661
  component_portals: component_portals,
652
662
  set_portals: set_portals
653
663
  })
@@ -726,7 +736,7 @@ function $4fd5dc0e231a60d9$export$5abb40edfde2a843(props, set_portals) {
726
736
  },
727
737
  product_card_template: display => $75f1064c8b836348$export$79c79419c1ef0081({
728
738
  display: display,
729
- react_template: $2GFvs$untrack(() => props.productCard),
739
+ get_react_template: () => props.productCard,
730
740
  component_portals: component_portals,
731
741
  set_portals: set_portals
732
742
  }),
@@ -755,7 +765,7 @@ function $8bee51f55543fe0c$export$bd8acc07a8bae229(props, set_portals) {
755
765
  };
756
766
  return $75f1064c8b836348$export$79c79419c1ef0081({
757
767
  display: display,
758
- react_template: $2GFvs$untrack(() => props.productCard),
768
+ get_react_template: () => props.productCard,
759
769
  component_portals: component_portals,
760
770
  set_portals: set_portals
761
771
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "types": "ES10/index.d.ts",
@@ -1,8 +1,8 @@
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
4
  var $aNCHr$reactdomserver = require("react-dom/server");
5
+ var $aNCHr$solidjs = require("solid-js");
6
6
  var $aNCHr$reactjsxruntime = require("react/jsx-runtime");
7
7
  var $aNCHr$reactdom = require("react-dom");
8
8
  require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "ES10");
@@ -78,16 +78,19 @@ async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
78
78
  display: display,
79
79
  component_portals: component_portals,
80
80
  set_portals: set_portals,
81
- react_template: react_template
81
+ get_react_template: get_react_template
82
82
  } = _ref;
83
83
  let set_react_has_ran_hooks;
84
84
  let was_cleaned_up = false;
85
85
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
86
86
  const solid_container = document.createElement("div");
87
+ let call_when_template_changes;
87
88
  const owner = $aNCHr$solidjs.getOwner();
88
89
  const reactProductCard = $aNCHr$reactjsxruntime.jsx(props => {
89
90
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
90
91
  $aNCHr$react.useEffect(set_react_has_ran_hooks, []);
92
+ const [react_template, set_react_template] = $aNCHr$react.useState(() => $aNCHr$solidjs.untrack(get_react_template));
93
+ call_when_template_changes = set_react_template;
91
94
  return react_template(props);
92
95
  }, {
93
96
  display: display
@@ -102,6 +105,16 @@ async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
102
105
  const portal = $aNCHr$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
103
106
  component_portals.add(portal);
104
107
  set_portals([...component_portals]);
108
+ $aNCHr$solidjs.createEffect($aNCHr$solidjs.on(get_react_template, new_template => queueMicrotask(() => {
109
+ var _call_when_template_c;
110
+ return (
111
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
112
+ // Therefore do it after a microtask to evade detection
113
+ (_call_when_template_c = call_when_template_changes) === null || _call_when_template_c === void 0 ? void 0 : _call_when_template_c(() => new_template)
114
+ );
115
+ }), {
116
+ defer: true
117
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
105
118
  $aNCHr$solidjs.onCleanup(() => {
106
119
  was_cleaned_up = true;
107
120
  // 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
@@ -129,7 +142,7 @@ function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
129
142
  };
130
143
  return $99405615baa3d774$export$79c79419c1ef0081({
131
144
  display: display,
132
- react_template: $aNCHr$solidjs.untrack(() => props.productCard),
145
+ get_react_template: () => props.productCard,
133
146
  component_portals: component_portals,
134
147
  set_portals: set_portals
135
148
  });
@@ -157,7 +170,7 @@ function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
157
170
  }
158
171
  });
159
172
  }
160
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.10";
173
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.11";
161
174
  function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
162
175
  return props.children;
163
176
  }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, ReactPortal, ReactElement } from "
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } 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 = "2.0.10";
6
+ export const version = "2.0.11";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -1,8 +1,8 @@
1
- import { createElement as $7h5e1$createElement, useRef as $7h5e1$useRef, Fragment as $7h5e1$Fragment, useEffect as $7h5e1$useEffect, Component as $7h5e1$Component } from "react";
1
+ import { createElement as $7h5e1$createElement, useRef as $7h5e1$useRef, Fragment as $7h5e1$Fragment, useEffect as $7h5e1$useEffect, useState as $7h5e1$useState, Component as $7h5e1$Component } from "react";
2
2
  import { ImagePlaceholder as $7h5e1$ImagePlaceholder, TextPlaceholder as $7h5e1$TextPlaceholder, RecommendationGrid as $7h5e1$RecommendationGrid, defaultColsAtSize as $7h5e1$defaultColsAtSize, defaultGridSpacing as $7h5e1$defaultGridSpacing, ProductCardError as $7h5e1$ProductCardError } from "@depict-ai/ui/ES10";
3
3
  import { renderToString as $7h5e1$renderToString, generateHydrationScript as $7h5e1$generateHydrationScript, isServer as $7h5e1$isServer } from "solid-js/web";
4
- import { untrack as $7h5e1$untrack, getOwner as $7h5e1$getOwner, runWithOwner as $7h5e1$runWithOwner, onCleanup as $7h5e1$onCleanup } from "solid-js";
5
4
  import { renderToString as $7h5e1$renderToString1 } from "react-dom/server";
5
+ import { getOwner as $7h5e1$getOwner, untrack as $7h5e1$untrack, runWithOwner as $7h5e1$runWithOwner, createEffect as $7h5e1$createEffect, on as $7h5e1$on, onCleanup as $7h5e1$onCleanup } from "solid-js";
6
6
  import { jsx as $7h5e1$jsx } from "react/jsx-runtime";
7
7
  import { createPortal as $7h5e1$createPortal } from "react-dom";
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
@@ -55,16 +55,19 @@ async function $6593e4e126cb318f$export$79c79419c1ef0081(_ref) {
55
55
  display: display,
56
56
  component_portals: component_portals,
57
57
  set_portals: set_portals,
58
- react_template: react_template
58
+ get_react_template: get_react_template
59
59
  } = _ref;
60
60
  let set_react_has_ran_hooks;
61
61
  let was_cleaned_up = false;
62
62
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
63
63
  const solid_container = document.createElement("div");
64
+ let call_when_template_changes;
64
65
  const owner = $7h5e1$getOwner();
65
66
  const reactProductCard = $7h5e1$jsx(props => {
66
67
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
67
68
  $7h5e1$useEffect(set_react_has_ran_hooks, []);
69
+ const [react_template, set_react_template] = $7h5e1$useState(() => $7h5e1$untrack(get_react_template));
70
+ call_when_template_changes = set_react_template;
68
71
  return react_template(props);
69
72
  }, {
70
73
  display: display
@@ -79,6 +82,16 @@ async function $6593e4e126cb318f$export$79c79419c1ef0081(_ref) {
79
82
  const portal = $7h5e1$createPortal(reactProductCardInErrorBoundary, solid_container);
80
83
  component_portals.add(portal);
81
84
  set_portals([...component_portals]);
85
+ $7h5e1$createEffect($7h5e1$on(get_react_template, new_template => queueMicrotask(() => {
86
+ var _call_when_template_c;
87
+ return (
88
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
89
+ // Therefore do it after a microtask to evade detection
90
+ (_call_when_template_c = call_when_template_changes) === null || _call_when_template_c === void 0 ? void 0 : _call_when_template_c(() => new_template)
91
+ );
92
+ }), {
93
+ defer: true
94
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
82
95
  $7h5e1$onCleanup(() => {
83
96
  was_cleaned_up = true;
84
97
  // 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
@@ -106,7 +119,7 @@ function $48b0916cc674770c$export$bd8acc07a8bae229(props, set_portals) {
106
119
  };
107
120
  return $6593e4e126cb318f$export$79c79419c1ef0081({
108
121
  display: display,
109
- react_template: $7h5e1$untrack(() => props.productCard),
122
+ get_react_template: () => props.productCard,
110
123
  component_portals: component_portals,
111
124
  set_portals: set_portals
112
125
  });
@@ -134,7 +147,7 @@ function $48b0916cc674770c$export$bd8acc07a8bae229(props, set_portals) {
134
147
  }
135
148
  });
136
149
  }
137
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.0.10";
150
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.0.11";
138
151
  function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
139
152
  return props.children;
140
153
  }
@@ -1,8 +1,8 @@
1
1
  var $7QqFM$react = require("react");
2
2
  var $7QqFM$depictaiui = require("@depict-ai/ui/latest");
3
3
  var $7QqFM$solidjsweb = require("solid-js/web");
4
- var $7QqFM$solidjs = require("solid-js");
5
4
  var $7QqFM$reactdomserver = require("react-dom/server");
5
+ var $7QqFM$solidjs = require("solid-js");
6
6
  var $7QqFM$reactjsxruntime = require("react/jsx-runtime");
7
7
  var $7QqFM$reactdom = require("react-dom");
8
8
  require("../../multi_import_deduplicator.cjs").register_es_version("react-ui", "latest");
@@ -76,16 +76,19 @@ async function $ecaac5ceddb08f39$export$79c79419c1ef0081({
76
76
  display: display,
77
77
  component_portals: component_portals,
78
78
  set_portals: set_portals,
79
- react_template: react_template
79
+ get_react_template: get_react_template
80
80
  }) {
81
81
  let set_react_has_ran_hooks;
82
82
  let was_cleaned_up = false;
83
83
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
84
84
  const solid_container = document.createElement("div");
85
+ let call_when_template_changes;
85
86
  const owner = $7QqFM$solidjs.getOwner();
86
87
  const reactProductCard = $7QqFM$reactjsxruntime.jsx(props => {
87
88
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
88
89
  $7QqFM$react.useEffect(set_react_has_ran_hooks, []);
90
+ const [react_template, set_react_template] = $7QqFM$react.useState(() => $7QqFM$solidjs.untrack(get_react_template));
91
+ call_when_template_changes = set_react_template;
89
92
  return react_template(props);
90
93
  }, {
91
94
  display: display
@@ -100,6 +103,13 @@ async function $ecaac5ceddb08f39$export$79c79419c1ef0081({
100
103
  const portal = $7QqFM$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
101
104
  component_portals.add(portal);
102
105
  set_portals([...component_portals]);
106
+ $7QqFM$solidjs.createEffect($7QqFM$solidjs.on(get_react_template, new_template => queueMicrotask(() =>
107
+ // When the parent react component re-executes and provides a new product card, we want our react portal to also re-render
108
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
109
+ // Therefore do it after a microtask to evade detection
110
+ call_when_template_changes?.(() => new_template)), {
111
+ defer: true
112
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
103
113
  $7QqFM$solidjs.onCleanup(() => {
104
114
  was_cleaned_up = true;
105
115
  // 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
@@ -127,7 +137,7 @@ function $0aaa03f81d756b85$export$bd8acc07a8bae229(props, set_portals) {
127
137
  };
128
138
  return $ecaac5ceddb08f39$export$79c79419c1ef0081({
129
139
  display: display,
130
- react_template: $7QqFM$solidjs.untrack(() => props.productCard),
140
+ get_react_template: () => props.productCard,
131
141
  component_portals: component_portals,
132
142
  set_portals: set_portals
133
143
  });
@@ -153,7 +163,7 @@ function $0aaa03f81d756b85$export$bd8acc07a8bae229(props, set_portals) {
153
163
  }
154
164
  });
155
165
  }
156
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.10";
166
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.11";
157
167
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
158
168
  return props.children;
159
169
  }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, ReactPortal, ReactElement } from "
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.0.10";
6
+ export const version = "2.0.11";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -1,8 +1,8 @@
1
- import { createElement as $eOXet$createElement, useRef as $eOXet$useRef, Fragment as $eOXet$Fragment, useEffect as $eOXet$useEffect, Component as $eOXet$Component } from "react";
1
+ import { createElement as $eOXet$createElement, useRef as $eOXet$useRef, Fragment as $eOXet$Fragment, useEffect as $eOXet$useEffect, useState as $eOXet$useState, Component as $eOXet$Component } from "react";
2
2
  import { ImagePlaceholder as $eOXet$ImagePlaceholder, TextPlaceholder as $eOXet$TextPlaceholder, RecommendationGrid as $eOXet$RecommendationGrid, defaultColsAtSize as $eOXet$defaultColsAtSize, defaultGridSpacing as $eOXet$defaultGridSpacing, ProductCardError as $eOXet$ProductCardError } from "@depict-ai/ui/latest";
3
3
  import { renderToString as $eOXet$renderToString, generateHydrationScript as $eOXet$generateHydrationScript, isServer as $eOXet$isServer } from "solid-js/web";
4
- import { untrack as $eOXet$untrack, getOwner as $eOXet$getOwner, runWithOwner as $eOXet$runWithOwner, onCleanup as $eOXet$onCleanup } from "solid-js";
5
4
  import { renderToString as $eOXet$renderToString1 } from "react-dom/server";
5
+ import { getOwner as $eOXet$getOwner, untrack as $eOXet$untrack, runWithOwner as $eOXet$runWithOwner, createEffect as $eOXet$createEffect, on as $eOXet$on, onCleanup as $eOXet$onCleanup } from "solid-js";
6
6
  import { jsx as $eOXet$jsx } from "react/jsx-runtime";
7
7
  import { createPortal as $eOXet$createPortal } from "react-dom";
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
@@ -53,16 +53,19 @@ async function $75f1064c8b836348$export$79c79419c1ef0081({
53
53
  display: display,
54
54
  component_portals: component_portals,
55
55
  set_portals: set_portals,
56
- react_template: react_template
56
+ get_react_template: get_react_template
57
57
  }) {
58
58
  let set_react_has_ran_hooks;
59
59
  let was_cleaned_up = false;
60
60
  const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
61
61
  const solid_container = document.createElement("div");
62
+ let call_when_template_changes;
62
63
  const owner = $eOXet$getOwner();
63
64
  const reactProductCard = $eOXet$jsx(props => {
64
65
  // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
65
66
  $eOXet$useEffect(set_react_has_ran_hooks, []);
67
+ const [react_template, set_react_template] = $eOXet$useState(() => $eOXet$untrack(get_react_template));
68
+ call_when_template_changes = set_react_template;
66
69
  return react_template(props);
67
70
  }, {
68
71
  display: display
@@ -77,6 +80,13 @@ async function $75f1064c8b836348$export$79c79419c1ef0081({
77
80
  const portal = $eOXet$createPortal(reactProductCardInErrorBoundary, solid_container);
78
81
  component_portals.add(portal);
79
82
  set_portals([...component_portals]);
83
+ $eOXet$createEffect($eOXet$on(get_react_template, new_template => queueMicrotask(() =>
84
+ // When the parent react component re-executes and provides a new product card, we want our react portal to also re-render
85
+ // if we update the state inside the portal synchronously from the parent call react gets confused with "Warning: Cannot update a component (`Unknown`) while rendering a different component (`$48d7f568740a317d$export$f7d2f673fc2f091d`). To locate the bad setState() call inside `$48d7f568740a317d$export$f7d2f673fc2f091d`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render"
86
+ // Therefore do it after a microtask to evade detection
87
+ call_when_template_changes?.(() => new_template)), {
88
+ defer: true
89
+ })); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
80
90
  $eOXet$onCleanup(() => {
81
91
  was_cleaned_up = true;
82
92
  // 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
@@ -104,7 +114,7 @@ function $8bee51f55543fe0c$export$bd8acc07a8bae229(props, set_portals) {
104
114
  };
105
115
  return $75f1064c8b836348$export$79c79419c1ef0081({
106
116
  display: display,
107
- react_template: $eOXet$untrack(() => props.productCard),
117
+ get_react_template: () => props.productCard,
108
118
  component_portals: component_portals,
109
119
  set_portals: set_portals
110
120
  });
@@ -130,7 +140,7 @@ function $8bee51f55543fe0c$export$bd8acc07a8bae229(props, set_portals) {
130
140
  }
131
141
  });
132
142
  }
133
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.10";
143
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.11";
134
144
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
135
145
  return props.children;
136
146
  }