@depict-ai/react-ui 2.0.10 → 2.0.12
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 +22 -7
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +23 -8
- package/latest/index.cjs +17 -7
- package/latest/index.d.ts +1 -1
- package/latest/index.js +18 -8
- package/package.json +4 -4
- package/server/ES10/index.cjs +17 -4
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +18 -5
- package/server/latest/index.cjs +14 -4
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +15 -5
package/ES10/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
|
|
|
38
38
|
$parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$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 $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.
|
|
41
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.12";
|
|
42
42
|
const $ef516b1f92253963$export$8e769ad4338a911e = {
|
|
43
43
|
usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
|
|
44
44
|
search_instances: new Map(),
|
|
@@ -515,16 +515,19 @@ async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
|
|
|
515
515
|
display: display,
|
|
516
516
|
component_portals: component_portals,
|
|
517
517
|
set_portals: set_portals,
|
|
518
|
-
|
|
518
|
+
get_react_template: get_react_template
|
|
519
519
|
} = _ref;
|
|
520
520
|
let set_react_has_ran_hooks;
|
|
521
521
|
let was_cleaned_up = false;
|
|
522
522
|
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
523
523
|
const solid_container = document.createElement("div");
|
|
524
|
+
let call_when_template_changes;
|
|
524
525
|
const owner = $2kiy7$solidjs.getOwner();
|
|
525
526
|
const reactProductCard = $2kiy7$reactjsxruntime.jsx(props => {
|
|
526
527
|
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
527
528
|
$2kiy7$react.useEffect(set_react_has_ran_hooks, []);
|
|
529
|
+
const [react_template, set_react_template] = $2kiy7$react.useState(() => $2kiy7$solidjs.untrack(get_react_template));
|
|
530
|
+
call_when_template_changes = set_react_template;
|
|
528
531
|
return react_template(props);
|
|
529
532
|
}, {
|
|
530
533
|
display: display
|
|
@@ -539,6 +542,16 @@ async function $99405615baa3d774$export$79c79419c1ef0081(_ref) {
|
|
|
539
542
|
const portal = $2kiy7$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
540
543
|
component_portals.add(portal);
|
|
541
544
|
set_portals([...component_portals]);
|
|
545
|
+
$2kiy7$solidjs.createEffect($2kiy7$solidjs.on(get_react_template, new_template => queueMicrotask(() => {
|
|
546
|
+
var _call_when_template_c;
|
|
547
|
+
return (
|
|
548
|
+
// 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"
|
|
549
|
+
// Therefore do it after a microtask to evade detection
|
|
550
|
+
(_call_when_template_c = call_when_template_changes) === null || _call_when_template_c === void 0 ? void 0 : _call_when_template_c(() => new_template)
|
|
551
|
+
);
|
|
552
|
+
}), {
|
|
553
|
+
defer: true
|
|
554
|
+
})); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
|
|
542
555
|
$2kiy7$solidjs.onCleanup(() => {
|
|
543
556
|
was_cleaned_up = true;
|
|
544
557
|
// 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
|
|
@@ -615,7 +628,7 @@ function $735104b46c50160f$var$SolidSearchPage(props, set_portals) {
|
|
|
615
628
|
depict_search: depict_search(),
|
|
616
629
|
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
617
630
|
display: display,
|
|
618
|
-
|
|
631
|
+
get_react_template: () => props.productCard,
|
|
619
632
|
component_portals: component_portals,
|
|
620
633
|
set_portals: set_portals
|
|
621
634
|
})
|
|
@@ -645,7 +658,9 @@ const $15691268d8df90a9$var$rendered_components_with_state_key = new Set();
|
|
|
645
658
|
function $15691268d8df90a9$export$f7d2f673fc2f091d(props) {
|
|
646
659
|
return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
|
|
647
660
|
// @ts-ignore
|
|
648
|
-
solid_component:
|
|
661
|
+
solid_component: function () {
|
|
662
|
+
return $e7ba61a7074c02d3$export$e5139bbbb9a05035($15691268d8df90a9$var$SolidCategoryPage)(...arguments);
|
|
663
|
+
},
|
|
649
664
|
props: props,
|
|
650
665
|
wrapper_type: "div",
|
|
651
666
|
wrapper_style: {}
|
|
@@ -696,7 +711,7 @@ function $15691268d8df90a9$var$SolidCategoryPage(props, set_portals) {
|
|
|
696
711
|
},
|
|
697
712
|
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
698
713
|
display: display,
|
|
699
|
-
|
|
714
|
+
get_react_template: () => props.productCard,
|
|
700
715
|
component_portals: component_portals,
|
|
701
716
|
set_portals: set_portals
|
|
702
717
|
})
|
|
@@ -776,7 +791,7 @@ function $745b83c12baac3c0$export$5abb40edfde2a843(props, set_portals) {
|
|
|
776
791
|
},
|
|
777
792
|
product_card_template: display => $99405615baa3d774$export$79c79419c1ef0081({
|
|
778
793
|
display: display,
|
|
779
|
-
|
|
794
|
+
get_react_template: () => props.productCard,
|
|
780
795
|
component_portals: component_portals,
|
|
781
796
|
set_portals: set_portals
|
|
782
797
|
}),
|
|
@@ -806,7 +821,7 @@ function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
|
|
|
806
821
|
};
|
|
807
822
|
return $99405615baa3d774$export$79c79419c1ef0081({
|
|
808
823
|
display: display,
|
|
809
|
-
|
|
824
|
+
get_react_template: () => props.productCard,
|
|
810
825
|
component_portals: component_portals,
|
|
811
826
|
set_portals: set_portals
|
|
812
827
|
});
|
package/ES10/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/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.
|
|
6
|
+
export const version = "2.0.12";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
package/ES10/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { add_to_version_info as $jb2Oo$add_to_version_info, catchify as $jb2Oo$catchify, queueMacroTask as $jb2Oo$queueMacroTask, instant_exec_on_suspect_history_change as $jb2Oo$instant_exec_on_suspect_history_change, derror as $jb2Oo$derror } from "@depict-ai/utilishared/ES10";
|
|
2
2
|
import { CategoryTitle as $383b6fd56bf151bd$re_export$CategoryTitle, embedded_num_products as $383b6fd56bf151bd$re_export$EmbeddedNumProducts, DepictAPI as $jb2Oo$DepictAPI, DepictSearch as $jb2Oo$DepictSearch, DepictCategory as $jb2Oo$DepictCategory, get_search_query_updating_blocked_signal as $jb2Oo$get_search_query_updating_blocked_signal, SearchPage as $jb2Oo$SearchPage, defaultColsAtSize as $jb2Oo$defaultColsAtSize, defaultGridSpacing as $jb2Oo$defaultGridSpacing, ProductCardError as $jb2Oo$ProductCardError, CategoryPage as $jb2Oo$CategoryPage, defaultCategoryTitlePlugin as $jb2Oo$defaultCategoryTitlePlugin, BreadCrumbs as $jb2Oo$BreadCrumbs, QuickLinks as $jb2Oo$QuickLinks, ImagePlaceholder as $jb2Oo$ImagePlaceholder, TextPlaceholder as $jb2Oo$TextPlaceholder, RecommendationSlider as $jb2Oo$RecommendationSlider, RecommendationGrid as $jb2Oo$RecommendationGrid, open_modal_with_alignment as $jb2Oo$open_modal_with_alignment, SearchField as $jb2Oo$SearchField, fetchDepictRecommendations as $jb2Oo$fetchDepictRecommendations } from "@depict-ai/ui/ES10";
|
|
3
|
-
import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createMemo as $jb2Oo$createMemo, createComponent as $jb2Oo$createComponent, Show as $jb2Oo$Show, createSignal as $jb2Oo$createSignal, createComputed as $jb2Oo$createComputed, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner } from "solid-js";
|
|
3
|
+
import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createMemo as $jb2Oo$createMemo, createComponent as $jb2Oo$createComponent, Show as $jb2Oo$Show, createSignal as $jb2Oo$createSignal, createComputed as $jb2Oo$createComputed, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner, on as $jb2Oo$on } from "solid-js";
|
|
4
4
|
import { createElement as $jb2Oo$createElement, Fragment as $jb2Oo$Fragment, useEffect as $jb2Oo$useEffect, useState as $jb2Oo$useState, useRef as $jb2Oo$useRef, forwardRef as $jb2Oo$forwardRef, Component as $jb2Oo$Component, useCallback as $jb2Oo$useCallback } from "react";
|
|
5
5
|
import { defaultLocale as $jb2Oo$defaultLocale } from "@depict-ai/ui/locales/ES10";
|
|
6
6
|
import { render as $jb2Oo$render, hydrate as $jb2Oo$hydrate, isServer as $jb2Oo$isServer } from "solid-js/web";
|
|
@@ -14,7 +14,7 @@ import { renderToString as $jb2Oo$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", "ES10");
|
|
17
|
-
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.0.
|
|
17
|
+
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.0.12";
|
|
18
18
|
const $8c691d7f86317052$export$8e769ad4338a911e = {
|
|
19
19
|
usedLocale: $jb2Oo$createSignal((0, $jb2Oo$defaultLocale)),
|
|
20
20
|
search_instances: new Map(),
|
|
@@ -491,16 +491,19 @@ async function $6593e4e126cb318f$export$79c79419c1ef0081(_ref) {
|
|
|
491
491
|
display: display,
|
|
492
492
|
component_portals: component_portals,
|
|
493
493
|
set_portals: set_portals,
|
|
494
|
-
|
|
494
|
+
get_react_template: get_react_template
|
|
495
495
|
} = _ref;
|
|
496
496
|
let set_react_has_ran_hooks;
|
|
497
497
|
let was_cleaned_up = false;
|
|
498
498
|
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
499
499
|
const solid_container = document.createElement("div");
|
|
500
|
+
let call_when_template_changes;
|
|
500
501
|
const owner = $jb2Oo$getOwner();
|
|
501
502
|
const reactProductCard = $jb2Oo$jsx(props => {
|
|
502
503
|
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
503
504
|
$jb2Oo$useEffect(set_react_has_ran_hooks, []);
|
|
505
|
+
const [react_template, set_react_template] = $jb2Oo$useState(() => $jb2Oo$untrack(get_react_template));
|
|
506
|
+
call_when_template_changes = set_react_template;
|
|
504
507
|
return react_template(props);
|
|
505
508
|
}, {
|
|
506
509
|
display: display
|
|
@@ -515,6 +518,16 @@ async function $6593e4e126cb318f$export$79c79419c1ef0081(_ref) {
|
|
|
515
518
|
const portal = $jb2Oo$createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
516
519
|
component_portals.add(portal);
|
|
517
520
|
set_portals([...component_portals]);
|
|
521
|
+
$jb2Oo$createEffect($jb2Oo$on(get_react_template, new_template => queueMicrotask(() => {
|
|
522
|
+
var _call_when_template_c;
|
|
523
|
+
return (
|
|
524
|
+
// 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"
|
|
525
|
+
// Therefore do it after a microtask to evade detection
|
|
526
|
+
(_call_when_template_c = call_when_template_changes) === null || _call_when_template_c === void 0 ? void 0 : _call_when_template_c(() => new_template)
|
|
527
|
+
);
|
|
528
|
+
}), {
|
|
529
|
+
defer: true
|
|
530
|
+
})); // If we get a new template. call the useState hook thing so we correctly re-execute with the new template
|
|
518
531
|
$jb2Oo$onCleanup(() => {
|
|
519
532
|
was_cleaned_up = true;
|
|
520
533
|
// 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
|
|
@@ -591,7 +604,7 @@ function $d059770e7af9e2dc$var$SolidSearchPage(props, set_portals) {
|
|
|
591
604
|
depict_search: depict_search(),
|
|
592
605
|
product_card_template: display => $6593e4e126cb318f$export$79c79419c1ef0081({
|
|
593
606
|
display: display,
|
|
594
|
-
|
|
607
|
+
get_react_template: () => props.productCard,
|
|
595
608
|
component_portals: component_portals,
|
|
596
609
|
set_portals: set_portals
|
|
597
610
|
})
|
|
@@ -621,7 +634,9 @@ const $e86a296a07b17ad5$var$rendered_components_with_state_key = new Set();
|
|
|
621
634
|
function $e86a296a07b17ad5$export$f7d2f673fc2f091d(props) {
|
|
622
635
|
return $0dd9d9a9c7da4c1d$export$f6e64e17bd69eeef({
|
|
623
636
|
// @ts-ignore
|
|
624
|
-
solid_component:
|
|
637
|
+
solid_component: function () {
|
|
638
|
+
return $0dd9d9a9c7da4c1d$export$e5139bbbb9a05035($e86a296a07b17ad5$var$SolidCategoryPage)(...arguments);
|
|
639
|
+
},
|
|
625
640
|
props: props,
|
|
626
641
|
wrapper_type: "div",
|
|
627
642
|
wrapper_style: {}
|
|
@@ -672,7 +687,7 @@ function $e86a296a07b17ad5$var$SolidCategoryPage(props, set_portals) {
|
|
|
672
687
|
},
|
|
673
688
|
product_card_template: display => $6593e4e126cb318f$export$79c79419c1ef0081({
|
|
674
689
|
display: display,
|
|
675
|
-
|
|
690
|
+
get_react_template: () => props.productCard,
|
|
676
691
|
component_portals: component_portals,
|
|
677
692
|
set_portals: set_portals
|
|
678
693
|
})
|
|
@@ -752,7 +767,7 @@ function $c02e9fd51f31a1bd$export$5abb40edfde2a843(props, set_portals) {
|
|
|
752
767
|
},
|
|
753
768
|
product_card_template: display => $6593e4e126cb318f$export$79c79419c1ef0081({
|
|
754
769
|
display: display,
|
|
755
|
-
|
|
770
|
+
get_react_template: () => props.productCard,
|
|
756
771
|
component_portals: component_portals,
|
|
757
772
|
set_portals: set_portals
|
|
758
773
|
}),
|
|
@@ -782,7 +797,7 @@ function $48b0916cc674770c$export$bd8acc07a8bae229(props, set_portals) {
|
|
|
782
797
|
};
|
|
783
798
|
return $6593e4e126cb318f$export$79c79419c1ef0081({
|
|
784
799
|
display: display,
|
|
785
|
-
|
|
800
|
+
get_react_template: () => props.productCard,
|
|
786
801
|
component_portals: component_portals,
|
|
787
802
|
set_portals: set_portals
|
|
788
803
|
});
|
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.
|
|
41
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.12";
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
6
|
+
export const version = "2.0.12";
|
|
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.
|
|
17
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.12";
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "2.0.12",
|
|
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.
|
|
138
|
+
"@depict-ai/dpc": "^1.0.42",
|
|
139
139
|
"@depict-ai/plp-styling": "^1.2.5",
|
|
140
|
-
"@depict-ai/ui": "^2.0.
|
|
141
|
-
"@depict-ai/utilishared": "^1.0.
|
|
140
|
+
"@depict-ai/ui": "^2.0.22",
|
|
141
|
+
"@depict-ai/utilishared": "^1.0.46",
|
|
142
142
|
"solid-js": "^1.7.3"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
package/server/ES10/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
173
|
+
const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.0.12";
|
|
161
174
|
function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
|
|
162
175
|
return props.children;
|
|
163
176
|
}
|
package/server/ES10/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/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.
|
|
6
|
+
export const version = "2.0.12";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
package/server/ES10/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
150
|
+
const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.0.12";
|
|
138
151
|
function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
|
|
139
152
|
return props.children;
|
|
140
153
|
}
|
package/server/latest/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
166
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "2.0.12";
|
|
157
167
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
|
158
168
|
return props.children;
|
|
159
169
|
}
|
package/server/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.
|
|
6
|
+
export const version = "2.0.12";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
package/server/latest/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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.
|
|
143
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.0.12";
|
|
134
144
|
function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
|
|
135
145
|
return props.children;
|
|
136
146
|
}
|