@depict-ai/react-ui 4.0.23 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +205 -92
- package/ES10/index.d.ts +11 -2
- package/ES10/index.js +204 -92
- package/latest/index.cjs +190 -87
- package/latest/index.d.ts +11 -2
- package/latest/index.js +189 -87
- package/package.json +2 -2
- package/server/ES10/index.cjs +10 -1
- package/server/ES10/index.d.ts +11 -2
- package/server/ES10/index.js +10 -2
- package/server/latest/index.cjs +10 -1
- package/server/latest/index.d.ts +11 -2
- package/server/latest/index.js +10 -2
package/latest/index.cjs
CHANGED
|
@@ -23,16 +23,17 @@ $parcel$export(module.exports, "QuickLinks", () => $f16af0e861aff3d0$export$466c
|
|
|
23
23
|
$parcel$export(module.exports, "BreadCrumbs", () => $d88e98b11c182b8e$export$5646050d516e06bc);
|
|
24
24
|
$parcel$export(module.exports, "ComponentAligner", () => $883a881f7926405d$export$80e99ee6b29cadd2);
|
|
25
25
|
$parcel$export(module.exports, "DepictProvider", () => $24b00503eef73528$export$9fac37a9c21c2f3b);
|
|
26
|
-
$parcel$export(module.exports, "CategoryPage", () => $
|
|
27
|
-
$parcel$export(module.exports, "SearchPage", () => $
|
|
26
|
+
$parcel$export(module.exports, "CategoryPage", () => $03d75efbc2476217$export$f7d2f673fc2f091d);
|
|
27
|
+
$parcel$export(module.exports, "SearchPage", () => $4e47e1e003da166e$export$a54ec244c8863715);
|
|
28
28
|
$parcel$export(module.exports, "ImagePlaceholder", () => $df522c8a81ed5a01$export$3f37af283f8fb843);
|
|
29
29
|
$parcel$export(module.exports, "TextPlaceholder", () => $7c8b440edc188ad5$export$89c6019e4baa40b1);
|
|
30
30
|
$parcel$export(module.exports, "RecommendationGrid", () => $48732d1a919ddb4c$export$b0a773486c1c2312);
|
|
31
31
|
$parcel$export(module.exports, "RecommendationSlider", () => $8ffd7da37fdd46be$export$82cfdc85a4d15688);
|
|
32
32
|
$parcel$export(module.exports, "useSearchModal", () => $ae73b15c325f1b21$export$912994940e660d32);
|
|
33
|
-
$parcel$export(module.exports, "useSearchField", () => $
|
|
33
|
+
$parcel$export(module.exports, "useSearchField", () => $c8b22e24c4b8035c$export$9bb30bbe003b82e0);
|
|
34
34
|
$parcel$export(module.exports, "useFetchRecommendations", () => $a134ea100690b628$export$6501da23a2770fc);
|
|
35
35
|
$parcel$export(module.exports, "usePerformanceClient", () => $25c0a91312868994$export$38b98fae14bd1f64);
|
|
36
|
+
$parcel$export(module.exports, "useCategoryFilterHelpers", () => $a2654d3e936d0024$export$72616730c1fad2f4);
|
|
36
37
|
$parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
|
|
37
38
|
$parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
|
|
38
39
|
$parcel$export(module.exports, "SearchModalV2", () => $b03e4eee8610ebbe$re_export$SearchModalV2);
|
|
@@ -41,7 +42,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
|
|
|
41
42
|
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
42
43
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
43
44
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
44
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "4.
|
|
45
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "4.1.1";
|
|
45
46
|
const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
46
47
|
usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
|
|
47
48
|
search_instances: new Map(),
|
|
@@ -59,21 +60,21 @@ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
|
59
60
|
enable_content_search: $2IzJs$solidjs.createSignal(),
|
|
60
61
|
disable_override_listing_id: $2IzJs$solidjs.createSignal()
|
|
61
62
|
};
|
|
62
|
-
let $
|
|
63
|
-
let $
|
|
64
|
-
function $
|
|
65
|
-
$
|
|
63
|
+
let $69121eedef466fe9$var$run_on_href_change;
|
|
64
|
+
let $69121eedef466fe9$var$old_href = location.href;
|
|
65
|
+
function $69121eedef466fe9$export$74f3924c5027fe1d(cb) {
|
|
66
|
+
$69121eedef466fe9$var$run_on_href_change = cb;
|
|
66
67
|
}
|
|
67
68
|
(0, $2IzJs$depictaiutilishared.instant_exec_on_suspect_history_change).add($2IzJs$depictaiutilishared.catchify(() => {
|
|
68
69
|
const {
|
|
69
70
|
href: href
|
|
70
71
|
} = location;
|
|
71
|
-
if ($
|
|
72
|
-
$
|
|
72
|
+
if ($69121eedef466fe9$var$run_on_href_change && $69121eedef466fe9$var$old_href !== href) $69121eedef466fe9$var$run_on_href_change(href);
|
|
73
|
+
$69121eedef466fe9$var$old_href = href;
|
|
73
74
|
}));
|
|
74
|
-
const $
|
|
75
|
-
const $
|
|
76
|
-
function $
|
|
75
|
+
const $69121eedef466fe9$export$775e6b3892b5ad52 = (url = location) => url.pathname == $2IzJs$solidjs.untrack((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
|
|
76
|
+
const $69121eedef466fe9$export$30c8a12df09be0e4 = (url = location) => (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
|
|
77
|
+
function $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
77
78
|
solid_component: solid_component,
|
|
78
79
|
props: props,
|
|
79
80
|
wrapper_type = "div",
|
|
@@ -106,7 +107,7 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
106
107
|
const dispose = render_function(() => solid_component(store, set_portals), wrapper_element);
|
|
107
108
|
return dispose;
|
|
108
109
|
}, []);
|
|
109
|
-
return
|
|
110
|
+
return /*#__PURE__*/$2IzJs$react.createElement((0, $2IzJs$react.Fragment), null, /*#__PURE__*/$2IzJs$react.createElement(wrapper_type, {
|
|
110
111
|
ref: wrapper_element_ref,
|
|
111
112
|
style: wrapper_style,
|
|
112
113
|
...(hydrate_function_when_ssr ? {
|
|
@@ -118,35 +119,13 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
118
119
|
} : {})
|
|
119
120
|
}), ...portals);
|
|
120
121
|
}
|
|
121
|
-
function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set) {
|
|
122
|
-
return (...args) => {
|
|
123
|
-
const default_is_set = $2IzJs$solidjs.createMemo(() => !!((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).usedLocale[0]()?.backend_locale_)); // Apparently Show re-renders kids otherwise even if the falsiness of the condition doesn't change
|
|
124
|
-
const should_show = $2IzJs$solidjs.createMemo(prev => {
|
|
125
|
-
if (!prev && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
126
|
-
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
127
|
-
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
128
|
-
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
129
|
-
return false;
|
|
130
|
-
return (is_set || default_is_set)();
|
|
131
|
-
});
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
return $2IzJs$solidjs.createComponent((0, $2IzJs$solidjs.Show), {
|
|
134
|
-
get when() {
|
|
135
|
-
return should_show();
|
|
136
|
-
},
|
|
137
|
-
get children() {
|
|
138
|
-
return component(...args);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
122
|
let $6319748b4f0426f0$var$set = false;
|
|
144
123
|
let $6319748b4f0426f0$var$padding_animation;
|
|
145
124
|
function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
146
125
|
/// WARNING WARNING WARNING
|
|
147
126
|
// If you are debugging scroll restoration, make sure you're not in strict mode!!!!! Scroll restoration in nextjs won't work in strict mode because react will nuke all our elements from the DOM and render them again during going back
|
|
148
127
|
// Next 13.x+ has strict mode by default, opt out by setting reactStrictMode: false in next.config.js
|
|
149
|
-
const are_on_search_or_category_page = () => $
|
|
128
|
+
const are_on_search_or_category_page = () => $69121eedef466fe9$export$775e6b3892b5ad52() || $69121eedef466fe9$export$30c8a12df09be0e4();
|
|
150
129
|
if ($6319748b4f0426f0$var$set) return; // Just being safe
|
|
151
130
|
$6319748b4f0426f0$var$set = true;
|
|
152
131
|
// We used to initialise this variable with false which in some cases (scroll to top button in FloatingButtons) would cause the scroll to be blocked when it shouldn't (see https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686141321127089?thread_ts=1686134246.109689&cid=C058KQ3MU8Z)
|
|
@@ -169,8 +148,8 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
169
148
|
const [get_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
|
|
170
149
|
const search_page_in_dom = $2IzJs$solidjs.untrack(get_search_page_in_dom);
|
|
171
150
|
const category_page_in_dom = $2IzJs$solidjs.untrack(get_category_page_in_dom);
|
|
172
|
-
const new_is_search = $
|
|
173
|
-
const new_is_category = $
|
|
151
|
+
const new_is_search = $69121eedef466fe9$export$775e6b3892b5ad52();
|
|
152
|
+
const new_is_category = $69121eedef466fe9$export$30c8a12df09be0e4();
|
|
174
153
|
let accessor_to_wait_for;
|
|
175
154
|
if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
|
|
176
155
|
// Already on the page we're going to
|
|
@@ -233,9 +212,9 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace, scrol
|
|
|
233
212
|
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
234
213
|
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
235
214
|
})(Page || (Page = {}));
|
|
236
|
-
const current_page = $
|
|
215
|
+
const current_page = $69121eedef466fe9$export$775e6b3892b5ad52() ? Page.SEARCH : $69121eedef466fe9$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
|
|
237
216
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
238
|
-
const target_page = $
|
|
217
|
+
const target_page = $69121eedef466fe9$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $69121eedef466fe9$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
239
218
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
240
219
|
shallow: current_page === target_page && target_page !== Page.OTHER,
|
|
241
220
|
scroll:
|
|
@@ -574,14 +553,41 @@ function $7ba951bfed42cf93$export$84601d922bd37be1(blocks, component_portals, se
|
|
|
574
553
|
};
|
|
575
554
|
});
|
|
576
555
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
556
|
+
function $1e18e5335ff79474$export$eb5844afe948564b(props) {
|
|
557
|
+
const default_is_set = $2IzJs$solidjs.createMemo(() => !!((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).usedLocale[0]()?.backend_locale_));
|
|
558
|
+
const should_show = $2IzJs$solidjs.createMemo(prev => {
|
|
559
|
+
if (!prev && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
560
|
+
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
561
|
+
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
562
|
+
// Otherwise as soon as tenant and market is set we render the CategoryPage, but we might not have a DepictCategory yet, see https://depictaiworkspace.slack.com/archives/C04UZ2Z0RNE/p1690895918347289?thread_ts=1688391305.529449&cid=C04UZ2Z0RNE
|
|
563
|
+
return false;
|
|
564
|
+
return (props.isSet || default_is_set)();
|
|
565
|
+
});
|
|
566
|
+
return $2IzJs$solidjsweb.createComponent((0, $2IzJs$solidjs.Show), {
|
|
567
|
+
get when() {
|
|
568
|
+
return should_show();
|
|
569
|
+
},
|
|
570
|
+
get children() {
|
|
571
|
+
return props.children;
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
const $4e47e1e003da166e$var$rendered_components_with_state_key = new Set();
|
|
576
|
+
function $4e47e1e003da166e$export$a54ec244c8863715(props) {
|
|
577
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
578
|
+
solid_component: (...args) => {
|
|
579
|
+
// Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
|
|
580
|
+
const ourArguments = args;
|
|
581
|
+
return $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
582
|
+
get children() {
|
|
583
|
+
return $4e47e1e003da166e$var$SolidSearchPage(...ourArguments);
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
},
|
|
581
587
|
props: props
|
|
582
588
|
});
|
|
583
589
|
}
|
|
584
|
-
function $
|
|
590
|
+
function $4e47e1e003da166e$var$SolidSearchPage(props, set_portals) {
|
|
585
591
|
const depict_search = $2IzJs$solidjs.createMemo(() => {
|
|
586
592
|
const instance = $2506fd72fd4393aa$export$f4d89133c6985668("search", props.stateKey, "SearchPage");
|
|
587
593
|
$2IzJs$solidjs.onCleanup(() => {
|
|
@@ -604,7 +610,7 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
604
610
|
// This is because on the front page the search_query updating is blocked because it's not the search page, and that means that `filtered_previous_searches` in Autocomplete.tsx doesn't filter out the current search query
|
|
605
611
|
// Because it's so minor and would be quite hard to fix (one would need a second "actual search query" signal just for this purpose) it's wontfix for now
|
|
606
612
|
// EDIT: now that we're resetting this in the onCleanup of the memo above this might no longer be the case
|
|
607
|
-
write_signal(!$
|
|
613
|
+
write_signal(!$69121eedef466fe9$export$775e6b3892b5ad52(location));
|
|
608
614
|
};
|
|
609
615
|
const [, set_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
|
|
610
616
|
const component_portals = new Set();
|
|
@@ -612,18 +618,18 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
612
618
|
set_search_page_in_dom(true);
|
|
613
619
|
$2IzJs$solidjs.onCleanup(() => set_search_page_in_dom(false));
|
|
614
620
|
// react is really slow with disposing components, we want to avoid a flash of another search query when you click on a product and navigate away
|
|
615
|
-
$
|
|
621
|
+
$69121eedef466fe9$export$74f3924c5027fe1d(update_updating_blocked_signal); // if we navigate, re-check
|
|
616
622
|
$2IzJs$solidjs.createComputed(() => {
|
|
617
623
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
|
|
618
624
|
update_updating_blocked_signal();
|
|
619
625
|
});
|
|
620
|
-
$
|
|
626
|
+
$4e47e1e003da166e$var$search_page_path_checker();
|
|
621
627
|
return $2IzJs$solidjs.createMemo(() => {
|
|
622
628
|
const stateKey = $2IzJs$solidjs.untrack(() => props.stateKey);
|
|
623
|
-
if ($
|
|
629
|
+
if ($4e47e1e003da166e$var$rendered_components_with_state_key.has(stateKey)) throw new Error(`You have multiple SearchPage components with the same stateKey: ${stateKey}. Each SearchPage component must have a unique stateKey.`);
|
|
624
630
|
const transformed_content_blocks = $7ba951bfed42cf93$export$84601d922bd37be1(() => props.contentBlocksByRow, component_portals, set_portals);
|
|
625
|
-
$
|
|
626
|
-
$2IzJs$solidjs.onCleanup(() => $
|
|
631
|
+
$4e47e1e003da166e$var$rendered_components_with_state_key.add(stateKey);
|
|
632
|
+
$2IzJs$solidjs.onCleanup(() => $4e47e1e003da166e$var$rendered_components_with_state_key.delete(stateKey));
|
|
627
633
|
return $2IzJs$depictaiui.SearchPage({
|
|
628
634
|
// Default config goes here
|
|
629
635
|
get include_input_field() {
|
|
@@ -653,7 +659,7 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
653
659
|
/**
|
|
654
660
|
* Users often set the searchPagePath to something without the market which breaks everything using the searchPagePath internally, notably refining the search query. Add a warning for them.
|
|
655
661
|
*/
|
|
656
|
-
function $
|
|
662
|
+
function $4e47e1e003da166e$var$search_page_path_checker() {
|
|
657
663
|
let has_warned = false;
|
|
658
664
|
$2IzJs$solidjs.createEffect(() => {
|
|
659
665
|
if (has_warned) return;
|
|
@@ -669,17 +675,25 @@ function $7ad7a3d0011b7b1b$var$search_page_path_checker() {
|
|
|
669
675
|
}
|
|
670
676
|
});
|
|
671
677
|
}
|
|
672
|
-
const $
|
|
673
|
-
function $
|
|
674
|
-
return $
|
|
678
|
+
const $03d75efbc2476217$var$rendered_components_with_state_key = new Set();
|
|
679
|
+
function $03d75efbc2476217$export$f7d2f673fc2f091d(props) {
|
|
680
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
675
681
|
// @ts-ignore
|
|
676
|
-
solid_component: (...args) =>
|
|
682
|
+
solid_component: (...args) => {
|
|
683
|
+
// Work around some kind of babel bug where an optimisation turns ...args into `arguments` in the ES10 build which becomes the wrong arguments when read from teh getter
|
|
684
|
+
const ourArguments = args;
|
|
685
|
+
return $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
686
|
+
get children() {
|
|
687
|
+
return $03d75efbc2476217$var$SolidCategoryPage(...ourArguments);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
},
|
|
677
691
|
props: props,
|
|
678
692
|
wrapper_type: "div",
|
|
679
693
|
wrapper_style: {}
|
|
680
694
|
});
|
|
681
695
|
}
|
|
682
|
-
function $
|
|
696
|
+
function $03d75efbc2476217$var$SolidCategoryPage(props, set_portals) {
|
|
683
697
|
const depict_category = $2IzJs$solidjs.createMemo(() => $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "CategoryPage") // stateKey can change
|
|
684
698
|
);
|
|
685
699
|
|
|
@@ -699,11 +713,11 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
699
713
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
|
|
700
714
|
}
|
|
701
715
|
});
|
|
702
|
-
const
|
|
716
|
+
const Category = () => $2IzJs$solidjs.createMemo(() => {
|
|
703
717
|
const stateKey = $2IzJs$solidjs.untrack(() => props.stateKey);
|
|
704
|
-
if ($
|
|
705
|
-
$
|
|
706
|
-
$2IzJs$solidjs.onCleanup(() => $
|
|
718
|
+
if ($03d75efbc2476217$var$rendered_components_with_state_key.has(stateKey)) throw new Error(`You have multiple CategoryPage components with the same stateKey: ${stateKey}. Each CategoryPage component must have a unique stateKey.`);
|
|
719
|
+
$03d75efbc2476217$var$rendered_components_with_state_key.add(stateKey);
|
|
720
|
+
$2IzJs$solidjs.onCleanup(() => $03d75efbc2476217$var$rendered_components_with_state_key.delete(stateKey));
|
|
707
721
|
const transformed_content_blocks = $7ba951bfed42cf93$export$84601d922bd37be1(() => props.contentBlocksByRow, component_portals, set_portals);
|
|
708
722
|
return $2IzJs$depictaiui.CategoryPage({
|
|
709
723
|
depict_category: depict_category(),
|
|
@@ -738,15 +752,24 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
738
752
|
})
|
|
739
753
|
});
|
|
740
754
|
});
|
|
741
|
-
return $
|
|
755
|
+
return $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
756
|
+
isSet: category_state_set,
|
|
757
|
+
get children() {
|
|
758
|
+
return $2IzJs$solidjsweb.createComponent(Category, {});
|
|
759
|
+
}
|
|
760
|
+
});
|
|
742
761
|
}
|
|
743
762
|
function $d88e98b11c182b8e$export$5646050d516e06bc(react_props) {
|
|
744
|
-
return $
|
|
745
|
-
solid_component: $
|
|
763
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
764
|
+
solid_component: solidProps => $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
765
|
+
get children() {
|
|
766
|
+
return $2IzJs$solidjsweb.createComponent($d88e98b11c182b8e$var$VanillaBreadcrumbs, solidProps);
|
|
767
|
+
}
|
|
768
|
+
}),
|
|
746
769
|
props: react_props
|
|
747
770
|
});
|
|
748
771
|
}
|
|
749
|
-
function $d88e98b11c182b8e$var$
|
|
772
|
+
function $d88e98b11c182b8e$var$VanillaBreadcrumbs(props) {
|
|
750
773
|
// memo so stateKey can be dynamically changed
|
|
751
774
|
return $2IzJs$solidjs.createMemo(() => {
|
|
752
775
|
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "BreadCrumbs");
|
|
@@ -756,12 +779,16 @@ function $d88e98b11c182b8e$var$vanilla_breadcrumbs(props) {
|
|
|
756
779
|
});
|
|
757
780
|
}
|
|
758
781
|
function $f16af0e861aff3d0$export$466cdc317043f6cb(react_props = {}) {
|
|
759
|
-
return $
|
|
760
|
-
solid_component: $
|
|
782
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
783
|
+
solid_component: solidProps => $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
784
|
+
get children() {
|
|
785
|
+
return $2IzJs$solidjsweb.createComponent($f16af0e861aff3d0$var$VanillaQuickLinks, solidProps);
|
|
786
|
+
}
|
|
787
|
+
}),
|
|
761
788
|
props: react_props
|
|
762
789
|
});
|
|
763
790
|
}
|
|
764
|
-
function $f16af0e861aff3d0$var$
|
|
791
|
+
function $f16af0e861aff3d0$var$VanillaQuickLinks(props) {
|
|
765
792
|
// memo so stateKey can be dynamically changed
|
|
766
793
|
return $2IzJs$solidjs.createMemo(() => {
|
|
767
794
|
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "QuickLinks");
|
|
@@ -775,7 +802,7 @@ const $df522c8a81ed5a01$export$3f37af283f8fb843 = raw_react_props => {
|
|
|
775
802
|
class: raw_react_props.className,
|
|
776
803
|
...raw_react_props
|
|
777
804
|
};
|
|
778
|
-
return $
|
|
805
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
779
806
|
solid_component: props_store => $2IzJs$depictaiui.ImagePlaceholder(props_store),
|
|
780
807
|
props: react_props,
|
|
781
808
|
wrapper_type: "span",
|
|
@@ -787,7 +814,7 @@ const $7c8b440edc188ad5$export$89c6019e4baa40b1 = raw_react_props => {
|
|
|
787
814
|
class: raw_react_props.className,
|
|
788
815
|
...raw_react_props
|
|
789
816
|
};
|
|
790
|
-
return $
|
|
817
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
791
818
|
solid_component: props_store => $2IzJs$depictaiui.TextPlaceholder(props_store),
|
|
792
819
|
props: react_props,
|
|
793
820
|
wrapper_type: "span",
|
|
@@ -809,7 +836,7 @@ function $67657ea54664baa8$export$4daadad26e48a2c7(props) {
|
|
|
809
836
|
}
|
|
810
837
|
function $8ffd7da37fdd46be$export$82cfdc85a4d15688(props) {
|
|
811
838
|
$67657ea54664baa8$export$4daadad26e48a2c7(props);
|
|
812
|
-
return $
|
|
839
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
813
840
|
solid_component: $8ffd7da37fdd46be$export$5abb40edfde2a843,
|
|
814
841
|
props: props
|
|
815
842
|
});
|
|
@@ -889,7 +916,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
|
|
|
889
916
|
}
|
|
890
917
|
function $48732d1a919ddb4c$export$b0a773486c1c2312(props) {
|
|
891
918
|
$67657ea54664baa8$export$4daadad26e48a2c7(props);
|
|
892
|
-
return $
|
|
919
|
+
return $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
893
920
|
solid_component: (0, $c6b960f2a07285c8$export$e46079a2793e9ec7),
|
|
894
921
|
props: props,
|
|
895
922
|
hydrate_function_when_ssr: (0, $2IzJs$solidjsweb.hydrate),
|
|
@@ -936,25 +963,27 @@ function $ae73b15c325f1b21$export$912994940e660d32(params = {}) {
|
|
|
936
963
|
open: open
|
|
937
964
|
};
|
|
938
965
|
}
|
|
939
|
-
const $
|
|
966
|
+
const $c8b22e24c4b8035c$export$9bb30bbe003b82e0 = (props = {}) => {
|
|
940
967
|
// We should just export a plain SearchField component here, not a weird hook thing, but I don't want to make a breaking change. Just fixing the re-rendering issue for now.
|
|
941
968
|
// Create signal that persists across renders
|
|
942
969
|
const [[get_aligner_signal_value, set_aligner_signal_value]] = $2IzJs$react.useState($2IzJs$solidjs.createSignal());
|
|
943
970
|
// Update signal value when alignerRef changes
|
|
944
971
|
set_aligner_signal_value(props?.alignerRef);
|
|
945
972
|
// Make sure react never re-renders the actual SearchField component
|
|
946
|
-
const componentFunction = $2IzJs$react.useCallback(() => $
|
|
947
|
-
solid_component: $
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
973
|
+
const componentFunction = $2IzJs$react.useCallback(() => $69121eedef466fe9$export$f6e64e17bd69eeef({
|
|
974
|
+
solid_component: () => $2IzJs$solidjsweb.createComponent((0, $1e18e5335ff79474$export$eb5844afe948564b), {
|
|
975
|
+
get children() {
|
|
976
|
+
return $2IzJs$solidjs.createMemo(() => {
|
|
977
|
+
const depict_search = $2506fd72fd4393aa$export$f4d89133c6985668("search", props.stateKey, "useSearchField");
|
|
978
|
+
return $2IzJs$depictaiui.SearchField({
|
|
979
|
+
depict_search: depict_search,
|
|
980
|
+
get aligner_ref() {
|
|
981
|
+
// React mutates the object at some random time so only get the current value once it actually is requested
|
|
982
|
+
return get_aligner_signal_value()?.current;
|
|
983
|
+
}
|
|
984
|
+
});
|
|
956
985
|
});
|
|
957
|
-
}
|
|
986
|
+
}
|
|
958
987
|
}),
|
|
959
988
|
props: {}
|
|
960
989
|
}), []);
|
|
@@ -994,6 +1023,80 @@ async function $a134ea100690b628$var$fetchRecommendations(opts) {
|
|
|
994
1023
|
});
|
|
995
1024
|
return fetchedRecs;
|
|
996
1025
|
}
|
|
1026
|
+
function $a2654d3e936d0024$export$72616730c1fad2f4(stateKey) {
|
|
1027
|
+
// Create signal that will persist re-renders
|
|
1028
|
+
const [[getStateKeySignalValue, setStateKeySignalValue]] = $2IzJs$react.useState($2IzJs$solidjs.createSignal(stateKey));
|
|
1029
|
+
const [cachedFunctionCalls] = $2IzJs$react.useState({});
|
|
1030
|
+
const [hookFunctionsObject, setHookFunctionsObject] = $2IzJs$react.useState(new Proxy({}, {
|
|
1031
|
+
get(target, property) {
|
|
1032
|
+
return (...args) => {
|
|
1033
|
+
// Cache function calls until we have the real functions
|
|
1034
|
+
cachedFunctionCalls[property] = args;
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
}));
|
|
1038
|
+
$2IzJs$react.useEffect(() => {
|
|
1039
|
+
// get_instance_and_track_component may first return something in useEffect because the next-js router first gives us stuff from the URL after hydration (effects have ran) and we only create the instances if merchant and market is set
|
|
1040
|
+
return $2IzJs$solidjs.createRoot(dispose => {
|
|
1041
|
+
let firstRun = true;
|
|
1042
|
+
$2IzJs$solidjs.createRenderEffect(() => {
|
|
1043
|
+
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", getStateKeySignalValue(), "useCategoryFilterHelpers");
|
|
1044
|
+
const functions = $a2654d3e936d0024$var$createHookFunctions(depict_category);
|
|
1045
|
+
if (firstRun) {
|
|
1046
|
+
firstRun = false;
|
|
1047
|
+
// Run cached function calls
|
|
1048
|
+
Object.entries(cachedFunctionCalls).forEach(([key, args]) => functions[key]?.(...args));
|
|
1049
|
+
}
|
|
1050
|
+
setHookFunctionsObject(functions);
|
|
1051
|
+
});
|
|
1052
|
+
return dispose;
|
|
1053
|
+
});
|
|
1054
|
+
}, []);
|
|
1055
|
+
// When props change, update our signal value so solid can react to stateKey changing
|
|
1056
|
+
$2IzJs$react.useEffect(() => {
|
|
1057
|
+
setStateKeySignalValue(stateKey);
|
|
1058
|
+
}, [stateKey]);
|
|
1059
|
+
return hookFunctionsObject;
|
|
1060
|
+
}
|
|
1061
|
+
function $a2654d3e936d0024$var$createHookFunctions(depictCategory) {
|
|
1062
|
+
const categorySetShouldShowFilters = newValue => {
|
|
1063
|
+
const {
|
|
1064
|
+
historyStateSignals_: {
|
|
1065
|
+
filters_open: [, setFiltersOpen],
|
|
1066
|
+
sorting_open: [, setSortingOpen]
|
|
1067
|
+
}
|
|
1068
|
+
} = depictCategory;
|
|
1069
|
+
if (newValue)
|
|
1070
|
+
// Close sorting so we don't show both at once
|
|
1071
|
+
setSortingOpen(false);
|
|
1072
|
+
setFiltersOpen(newValue);
|
|
1073
|
+
};
|
|
1074
|
+
const categorySetFilter = filter => {
|
|
1075
|
+
const [selectedFilters, setSelectedFilters] = depictCategory.selectedFilters_;
|
|
1076
|
+
const filteredFilters = $2IzJs$solidjs.untrack(selectedFilters).filter(({
|
|
1077
|
+
field: field,
|
|
1078
|
+
op: op
|
|
1079
|
+
}) => field !== filter.field && op !== filter.op);
|
|
1080
|
+
filteredFilters.push(filter);
|
|
1081
|
+
setSelectedFilters(filteredFilters);
|
|
1082
|
+
};
|
|
1083
|
+
const categoryExpandFilterGroup = groupToExpand => {
|
|
1084
|
+
const [expandedFilters, setExpandedFilters] = depictCategory.historyStateSignals_.expanded_filters;
|
|
1085
|
+
const newExpanded = $2IzJs$solidjs.untrack(expandedFilters).filter(({
|
|
1086
|
+
section_: section_
|
|
1087
|
+
}) => section_ !== groupToExpand);
|
|
1088
|
+
newExpanded.push({
|
|
1089
|
+
section_: groupToExpand,
|
|
1090
|
+
expanded_: true
|
|
1091
|
+
});
|
|
1092
|
+
setExpandedFilters(newExpanded);
|
|
1093
|
+
};
|
|
1094
|
+
return {
|
|
1095
|
+
categorySetShouldShowFilters: categorySetShouldShowFilters,
|
|
1096
|
+
categorySetFilter: categorySetFilter,
|
|
1097
|
+
categoryExpandFilterGroup: categoryExpandFilterGroup
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
997
1100
|
const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
998
1101
|
scroll: scroll,
|
|
999
1102
|
replace: replace
|
|
@@ -1004,9 +1107,9 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
|
1004
1107
|
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
1005
1108
|
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
1006
1109
|
})(Page || (Page = {}));
|
|
1007
|
-
const current_page = $
|
|
1110
|
+
const current_page = $69121eedef466fe9$export$775e6b3892b5ad52() ? Page.SEARCH : $69121eedef466fe9$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
|
|
1008
1111
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
1009
|
-
const target_page = $
|
|
1112
|
+
const target_page = $69121eedef466fe9$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $69121eedef466fe9$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
1010
1113
|
router[replace ? "replace" : "push"](relativeUrl, undefined, {
|
|
1011
1114
|
shallow: current_page === target_page && target_page !== Page.OTHER,
|
|
1012
1115
|
scroll:
|
package/latest/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DPC } from "@depict-ai/dpc/latest";
|
|
2
2
|
import React, { PropsWithChildren, FC, ReactNode, ReactPortal, ReactElement } from "react";
|
|
3
|
-
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
|
|
3
|
+
import { BaseCategoryProviderConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ListingQuery, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations, FilterWithData } from "@depict-ai/ui/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 = "4.
|
|
6
|
+
export const version = "4.1.1";
|
|
7
7
|
interface UsePerformanceClientReturn {
|
|
8
8
|
dpc: DPC;
|
|
9
9
|
}
|
|
@@ -602,6 +602,15 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
602
602
|
* @returns {UseFetchRecommendationsReturn}
|
|
603
603
|
*/
|
|
604
604
|
export function useFetchRecommendations<T extends ModernDisplay>(): UseFetchRecommendationsReturn<T>;
|
|
605
|
+
/**
|
|
606
|
+
* Gives you some helpers that let you interact with the state of a category page
|
|
607
|
+
* @param stateKey the stateKey of the components to effect, leave unset if you haven't set a stateKey on your components.
|
|
608
|
+
*/
|
|
609
|
+
export function useCategoryFilterHelpers(stateKey: string | undefined): {
|
|
610
|
+
categorySetShouldShowFilters: (shouldShow: boolean) => void;
|
|
611
|
+
categorySetFilter: (filter: FilterWithData) => void;
|
|
612
|
+
categoryExpandFilterGroup: (title: string) => void;
|
|
613
|
+
};
|
|
605
614
|
/**
|
|
606
615
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
607
616
|
*/
|