@depict-ai/react-ui 1.5.17 → 1.5.19
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 +143 -143
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +143 -143
- package/latest/index.cjs +143 -143
- package/latest/index.d.ts +1 -1
- package/latest/index.js +143 -143
- package/package.json +6 -6
- package/server/ES10/index.cjs +14 -14
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +14 -14
- package/server/latest/index.cjs +14 -14
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +14 -14
package/latest/index.cjs
CHANGED
|
@@ -35,25 +35,25 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
|
|
|
35
35
|
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
36
36
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
37
37
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
38
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "1.5.
|
|
38
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "1.5.19";
|
|
39
39
|
const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
40
|
-
usedLocale:
|
|
40
|
+
usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
|
|
41
41
|
search_instances: new Map(),
|
|
42
42
|
category_instances: new Map(),
|
|
43
43
|
api: null,
|
|
44
44
|
dpc: null,
|
|
45
|
-
merchant:
|
|
46
|
-
market:
|
|
47
|
-
userId:
|
|
48
|
-
sessionId:
|
|
45
|
+
merchant: $2IzJs$solidjs.createSignal(),
|
|
46
|
+
market: $2IzJs$solidjs.createSignal(),
|
|
47
|
+
userId: $2IzJs$solidjs.createSignal(),
|
|
48
|
+
sessionId: $2IzJs$solidjs.createSignal(),
|
|
49
49
|
known_category_paths: new Set(),
|
|
50
|
-
search_page_path_:
|
|
51
|
-
search_page_in_dom:
|
|
52
|
-
category_page_in_dom:
|
|
53
|
-
provider_is_updating:
|
|
54
|
-
enable_content_search:
|
|
55
|
-
category_meta_title_suffix:
|
|
56
|
-
disable_override_query_id:
|
|
50
|
+
search_page_path_: $2IzJs$solidjs.createSignal(),
|
|
51
|
+
search_page_in_dom: $2IzJs$solidjs.createSignal(false),
|
|
52
|
+
category_page_in_dom: $2IzJs$solidjs.createSignal(false),
|
|
53
|
+
provider_is_updating: $2IzJs$solidjs.createSignal(false),
|
|
54
|
+
enable_content_search: $2IzJs$solidjs.createSignal(),
|
|
55
|
+
category_meta_title_suffix: $2IzJs$solidjs.createSignal(),
|
|
56
|
+
disable_override_query_id: $2IzJs$solidjs.createSignal()
|
|
57
57
|
};
|
|
58
58
|
class $d7a14567b529586f$export$d0f82e3ef89b1f22 extends (0, $2IzJs$react.Component) {
|
|
59
59
|
constructor(props) {
|
|
@@ -74,7 +74,7 @@ class $d7a14567b529586f$export$d0f82e3ef89b1f22 extends (0, $2IzJs$react.Compone
|
|
|
74
74
|
render() {
|
|
75
75
|
if (this.state.hasError)
|
|
76
76
|
// You can render any custom fallback UI
|
|
77
|
-
return
|
|
77
|
+
return $2IzJs$react.createElement("div", {
|
|
78
78
|
children: "Component failed"
|
|
79
79
|
});
|
|
80
80
|
return this.props.children;
|
|
@@ -85,14 +85,14 @@ let $b4d0d98857ed9934$var$old_href = location.href;
|
|
|
85
85
|
function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
|
|
86
86
|
$b4d0d98857ed9934$var$run_on_href_change = cb;
|
|
87
87
|
}
|
|
88
|
-
(0, $2IzJs$depictaiutilishared.instant_exec_on_suspect_history_change).add(
|
|
88
|
+
(0, $2IzJs$depictaiutilishared.instant_exec_on_suspect_history_change).add($2IzJs$depictaiutilishared.catchify(() => {
|
|
89
89
|
const {
|
|
90
90
|
href: href
|
|
91
91
|
} = location;
|
|
92
92
|
if ($b4d0d98857ed9934$var$run_on_href_change && $b4d0d98857ed9934$var$old_href !== href) $b4d0d98857ed9934$var$run_on_href_change(href);
|
|
93
93
|
$b4d0d98857ed9934$var$old_href = href;
|
|
94
94
|
}));
|
|
95
|
-
const $b4d0d98857ed9934$export$775e6b3892b5ad52 = (url = location) => url.pathname ==
|
|
95
|
+
const $b4d0d98857ed9934$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
|
|
96
96
|
const $b4d0d98857ed9934$export$30c8a12df09be0e4 = (url = location) => (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
|
|
97
97
|
function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
98
98
|
solid_component: solid_component,
|
|
@@ -101,12 +101,12 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
101
101
|
wrapper_style = {},
|
|
102
102
|
hydrate_function_when_ssr: hydrate_function_when_ssr
|
|
103
103
|
}) {
|
|
104
|
-
const [portals, set_portals] =
|
|
105
|
-
const wrapper_element_ref =
|
|
106
|
-
const [[store, write_store]] =
|
|
104
|
+
const [portals, set_portals] = $2IzJs$react.useState([]);
|
|
105
|
+
const wrapper_element_ref = $2IzJs$react.useRef();
|
|
106
|
+
const [[store, write_store]] = $2IzJs$react.useState(() => $2IzJs$solidjsstore.createStore(props));
|
|
107
107
|
// Update store when props change
|
|
108
|
-
write_store(
|
|
109
|
-
|
|
108
|
+
write_store($2IzJs$solidjsstore.reconcile(props));
|
|
109
|
+
$2IzJs$react.useEffect(() => {
|
|
110
110
|
const wrapper_element = wrapper_element_ref.current;
|
|
111
111
|
// If someone only rendered a solid component on the client that *could* be hydrated (no childNodes) then we fall back to `render` to avoid solid complaining about not being able to hydrate or crashing because the result of generateHydrationScript hasn't run at all
|
|
112
112
|
// This can happen for HMR or when SSR capable components are only rendered on the client
|
|
@@ -114,7 +114,7 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
114
114
|
const dispose = render_function(() => solid_component(store, set_portals), wrapper_element);
|
|
115
115
|
return dispose;
|
|
116
116
|
}, []);
|
|
117
|
-
return
|
|
117
|
+
return $2IzJs$react.createElement((0, $2IzJs$react.Fragment), null, $2IzJs$react.createElement(wrapper_type, {
|
|
118
118
|
ref: wrapper_element_ref,
|
|
119
119
|
style: wrapper_style,
|
|
120
120
|
...(hydrate_function_when_ssr ? {
|
|
@@ -128,8 +128,8 @@ function $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
|
128
128
|
}
|
|
129
129
|
function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set) {
|
|
130
130
|
return (...args) => {
|
|
131
|
-
const default_is_set =
|
|
132
|
-
const should_show =
|
|
131
|
+
const default_is_set = $2IzJs$solidjs.createMemo(() => !!((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[0]() && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[0]())); // Apparently Show re-renders kids otherwise even if the falsiness of the condition doesn't change
|
|
132
|
+
const should_show = $2IzJs$solidjs.createMemo(prev => {
|
|
133
133
|
if (!prev && (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).provider_is_updating[0]())
|
|
134
134
|
// Why `!prev`? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7854#note_1495776987
|
|
135
135
|
// If we weren't showing the component and the DepictProvider is currently updating, wait for it to have finished updating before showing the component
|
|
@@ -138,7 +138,7 @@ function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set) {
|
|
|
138
138
|
return (is_set || default_is_set)();
|
|
139
139
|
});
|
|
140
140
|
// @ts-ignore
|
|
141
|
-
return
|
|
141
|
+
return $2IzJs$solidjs.createComponent((0, $2IzJs$solidjs.Show), {
|
|
142
142
|
get when() {
|
|
143
143
|
return should_show();
|
|
144
144
|
},
|
|
@@ -158,17 +158,17 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({
|
|
|
158
158
|
let was_cleaned_up = false;
|
|
159
159
|
const react_has_ran_hooks = new Promise(r => set_react_has_ran_hooks = r);
|
|
160
160
|
const solid_container = document.createElement("div");
|
|
161
|
-
const owner =
|
|
162
|
-
const reactProductCard =
|
|
161
|
+
const owner = $2IzJs$solidjs.getOwner();
|
|
162
|
+
const reactProductCard = $2IzJs$reactjsxruntime.jsx(props => {
|
|
163
163
|
// Sneak in a hook into their product card component to know once react has finished rendering and running hooks
|
|
164
|
-
|
|
164
|
+
$2IzJs$react.useEffect(set_react_has_ran_hooks, []);
|
|
165
165
|
return react_template(props);
|
|
166
166
|
}, {
|
|
167
167
|
display: display
|
|
168
168
|
});
|
|
169
|
-
const reactProductCardInErrorBoundary =
|
|
169
|
+
const reactProductCardInErrorBoundary = $2IzJs$reactjsxruntime.jsx((0, $d7a14567b529586f$export$d0f82e3ef89b1f22), {
|
|
170
170
|
children: reactProductCard,
|
|
171
|
-
on_error: error =>
|
|
171
|
+
on_error: error => $2IzJs$solidjs.runWithOwner(owner, () => {
|
|
172
172
|
if (was_cleaned_up) return; // Would infinite loop if we'd throw after we've already been cleaned up. That is because the `ErrorBoundary` won't be "registered" with the cleaned-up owner anymore so react would hear about the throw and attempt to re-render the error boundary or something which would throw again, etc.
|
|
173
173
|
throw new (0, $2IzJs$depictaiui.ProductCardError)(error);
|
|
174
174
|
})
|
|
@@ -176,7 +176,7 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({
|
|
|
176
176
|
const portal = $2IzJs$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
|
|
177
177
|
component_portals.add(portal);
|
|
178
178
|
set_portals([...component_portals]);
|
|
179
|
-
|
|
179
|
+
$2IzJs$solidjs.onCleanup(() => {
|
|
180
180
|
was_cleaned_up = true;
|
|
181
181
|
// 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
|
|
182
182
|
component_portals.delete(portal);
|
|
@@ -189,7 +189,7 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({
|
|
|
189
189
|
let $6319748b4f0426f0$var$set = false;
|
|
190
190
|
let $6319748b4f0426f0$var$padding_animation;
|
|
191
191
|
function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
192
|
-
const are_on_search_or_category_page = () =>
|
|
192
|
+
const are_on_search_or_category_page = () => $b4d0d98857ed9934$export$775e6b3892b5ad52() || $b4d0d98857ed9934$export$30c8a12df09be0e4();
|
|
193
193
|
if ($6319748b4f0426f0$var$set) return; // Just being safe
|
|
194
194
|
$6319748b4f0426f0$var$set = true;
|
|
195
195
|
// 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)
|
|
@@ -202,7 +202,7 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
202
202
|
) return Reflect.apply(old_scrollTo, window, args);else should_use_old_scroll = true;
|
|
203
203
|
};
|
|
204
204
|
// When popping state, add padding in the same event as the "popstate" event (required) and then remove it once our stuff is in the DOM
|
|
205
|
-
addEventListener("popstate",
|
|
205
|
+
addEventListener("popstate", $2IzJs$depictaiutilishared.catchify(() => {
|
|
206
206
|
if (!are_on_search_or_category_page()) {
|
|
207
207
|
$6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
|
|
208
208
|
return;
|
|
@@ -210,10 +210,10 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
210
210
|
should_use_old_scroll = false;
|
|
211
211
|
const [get_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
|
|
212
212
|
const [get_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
|
|
213
|
-
const search_page_in_dom =
|
|
214
|
-
const category_page_in_dom =
|
|
215
|
-
const new_is_search =
|
|
216
|
-
const new_is_category =
|
|
213
|
+
const search_page_in_dom = $2IzJs$solidjs.untrack(get_search_page_in_dom);
|
|
214
|
+
const category_page_in_dom = $2IzJs$solidjs.untrack(get_category_page_in_dom);
|
|
215
|
+
const new_is_search = $b4d0d98857ed9934$export$775e6b3892b5ad52();
|
|
216
|
+
const new_is_category = $b4d0d98857ed9934$export$30c8a12df09be0e4();
|
|
217
217
|
let accessor_to_wait_for;
|
|
218
218
|
if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
|
|
219
219
|
// Already on the page we're going to
|
|
@@ -222,7 +222,7 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
222
222
|
}
|
|
223
223
|
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
224
224
|
if (new_is_search && category_page_in_dom) accessor_to_wait_for = get_search_page_in_dom;else if (new_is_category && search_page_in_dom) accessor_to_wait_for = get_category_page_in_dom;else accessor_to_wait_for = new_is_search ? get_search_page_in_dom : get_category_page_in_dom;
|
|
225
|
-
|
|
225
|
+
$2IzJs$solidjs.createRoot(dispose => $2IzJs$solidjs.createEffect(() => {
|
|
226
226
|
if (accessor_to_wait_for()) {
|
|
227
227
|
$6319748b4f0426f0$var$removeLotsOfPadding();
|
|
228
228
|
dispose();
|
|
@@ -231,7 +231,7 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
231
231
|
}));
|
|
232
232
|
window?.next?.router?.events?.on(
|
|
233
233
|
// We have to use the actual next router here, if we'd use next_router_event_target for this window.event wouldn't be the popstate anymore
|
|
234
|
-
"routeChangeStart",
|
|
234
|
+
"routeChangeStart", $2IzJs$depictaiutilishared.catchify(() => {
|
|
235
235
|
// this is for when we navigate to a new page (replaceState or pushState)
|
|
236
236
|
// We need to ensure that the page doesn't get shorter before the new history entry has been pushed
|
|
237
237
|
// There is beforeHistoryChange which fires literally the line of code before the history API is called, so we make the page long until a task after that
|
|
@@ -240,7 +240,7 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
240
240
|
// This is catchified, so we should see in sentry when it starts failing if browsers ever remove it???
|
|
241
241
|
if (window.event instanceof PopStateEvent) return;
|
|
242
242
|
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
243
|
-
next_router_event_target.addEventListener("beforeHistoryChange",
|
|
243
|
+
next_router_event_target.addEventListener("beforeHistoryChange", $2IzJs$depictaiutilishared.catchify(() => $2IzJs$depictaiutilishared.queueMacroTask($6319748b4f0426f0$var$removeLotsOfPadding)), {
|
|
244
244
|
once: true
|
|
245
245
|
});
|
|
246
246
|
}));
|
|
@@ -275,9 +275,9 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace, scrol
|
|
|
275
275
|
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
276
276
|
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
277
277
|
})(Page || (Page = {}));
|
|
278
|
-
const current_page =
|
|
278
|
+
const current_page = $b4d0d98857ed9934$export$775e6b3892b5ad52() ? Page.SEARCH : $b4d0d98857ed9934$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
|
|
279
279
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
280
|
-
const target_page =
|
|
280
|
+
const target_page = $b4d0d98857ed9934$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $b4d0d98857ed9934$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
281
281
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
282
282
|
shallow: current_page === target_page && target_page !== Page.OTHER,
|
|
283
283
|
scroll:
|
|
@@ -324,27 +324,27 @@ function $b1cf911fa603e77a$export$bae2769a30719c48(disposable, stateKey) {
|
|
|
324
324
|
const instance = new (0, $2IzJs$depictaiui.DepictSearch)({
|
|
325
325
|
api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
|
|
326
326
|
search_query_url_param_name: search_query_url_param_name,
|
|
327
|
-
market:
|
|
327
|
+
market: $2IzJs$solidjs.untrack(get_market),
|
|
328
328
|
// TODO: check if we can do this
|
|
329
|
-
merchant:
|
|
329
|
+
merchant: $2IzJs$solidjs.untrack(get_merchant),
|
|
330
330
|
enable_category_suggestions: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).enableCategorySuggestions ?? false,
|
|
331
331
|
// default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
|
|
332
|
-
localization:
|
|
333
|
-
url_transformer: url => url.pathname =
|
|
332
|
+
localization: $2IzJs$solidjs.untrack(get_locale),
|
|
333
|
+
url_transformer: url => url.pathname = $2IzJs$solidjs.untrack(get_search_page_path),
|
|
334
334
|
on_navigation: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation,
|
|
335
335
|
unique_instance_key_for_state: stateKey,
|
|
336
|
-
enable_content_search:
|
|
336
|
+
enable_content_search: $2IzJs$solidjs.untrack(get_enable_content_search)
|
|
337
337
|
});
|
|
338
|
-
|
|
338
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
339
339
|
const new_merchant = get_merchant();
|
|
340
340
|
if (new_merchant) instance.merchant = new_merchant;
|
|
341
341
|
});
|
|
342
|
-
|
|
342
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
343
343
|
const new_market = get_market();
|
|
344
344
|
if (new_market) instance.market = new_market;
|
|
345
345
|
});
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
$2IzJs$solidjs.createComputed(() => instance.localization = get_locale());
|
|
347
|
+
$2IzJs$solidjs.createComputed(() => instance.enable_content_search = get_enable_content_search());
|
|
348
348
|
return {
|
|
349
349
|
instance: instance,
|
|
350
350
|
dispose: dispose,
|
|
@@ -353,7 +353,7 @@ function $b1cf911fa603e77a$export$bae2769a30719c48(disposable, stateKey) {
|
|
|
353
353
|
};
|
|
354
354
|
const function_length_0 = () => actual_function();
|
|
355
355
|
const function_length_1 = dispose => actual_function(dispose);
|
|
356
|
-
return
|
|
356
|
+
return $2IzJs$solidjs.createRoot(disposable ? function_length_1 : function_length_0); // solid-js creates roots differently based on if it can detect a dispose argument, with function.length. That's why this is written like this
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
|
|
@@ -367,24 +367,24 @@ function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
|
|
|
367
367
|
} = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
368
368
|
const instance = new (0, $2IzJs$depictaiui.DepictCategory)({
|
|
369
369
|
api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
|
|
370
|
-
market:
|
|
370
|
+
market: $2IzJs$solidjs.untrack(get_market),
|
|
371
371
|
// TODO: check if we can do this
|
|
372
|
-
merchant:
|
|
373
|
-
localization:
|
|
372
|
+
merchant: $2IzJs$solidjs.untrack(get_merchant),
|
|
373
|
+
localization: $2IzJs$solidjs.untrack(get_locale),
|
|
374
374
|
on_navigation: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation,
|
|
375
375
|
unique_instance_key_for_state: stateKey
|
|
376
376
|
});
|
|
377
|
-
|
|
377
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
378
378
|
const new_merchant = get_merchant();
|
|
379
379
|
if (new_merchant) instance.merchant = new_merchant;
|
|
380
380
|
});
|
|
381
|
-
|
|
381
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
382
382
|
const new_market = get_market();
|
|
383
383
|
if (new_market) instance.market = new_market;
|
|
384
384
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
$2IzJs$solidjs.createComputed(() => instance.localization = get_locale());
|
|
386
|
+
$2IzJs$solidjs.createComputed(() => instance.meta_title_suffix = get_category_meta_title_suffix());
|
|
387
|
+
$2IzJs$solidjs.createComputed(() => instance.disable_override_query_id = get_disable_override_query_id());
|
|
388
388
|
return {
|
|
389
389
|
instance: instance,
|
|
390
390
|
dispose: dispose,
|
|
@@ -393,7 +393,7 @@ function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
|
|
|
393
393
|
};
|
|
394
394
|
const function_length_0 = () => actual_function();
|
|
395
395
|
const function_length_1 = dispose => actual_function(dispose);
|
|
396
|
-
return
|
|
396
|
+
return $2IzJs$solidjs.createRoot(disposable ? function_length_1 : function_length_0); // solid-js creates roots differently based on if it can detect a dispose argument, with function.length. That's why this is written like this
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
let $24b00503eef73528$var$provider_instances = 0;
|
|
@@ -434,11 +434,11 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
|
|
|
434
434
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
|
|
435
435
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_meta_title_suffix[1](props.category?.metaTitleSuffix);
|
|
436
436
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).disable_override_query_id[1](props.category?.disableOverrideQueryId);
|
|
437
|
-
|
|
438
|
-
if (!market || !merchant) return
|
|
437
|
+
$25c0a91312868994$export$47e064413edabf36(merchant, market, userId, sessionId);
|
|
438
|
+
if (!market || !merchant) return $2IzJs$react.createElement((0, $2IzJs$react.Fragment), null, children);
|
|
439
439
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[1](market);
|
|
440
440
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[1](merchant);
|
|
441
|
-
|
|
441
|
+
$6319748b4f0426f0$export$6453cbc34515a94d();
|
|
442
442
|
try {
|
|
443
443
|
const {
|
|
444
444
|
search_instances: search_instances,
|
|
@@ -455,13 +455,13 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
|
|
|
455
455
|
if (navigateFunction) navigateFunction(new_relative_url, {
|
|
456
456
|
replace: is_replace,
|
|
457
457
|
scroll: scroll
|
|
458
|
-
});else
|
|
458
|
+
});else $bc389476eeb2b615$export$599d4515591ef232(new_relative_url, is_replace, scroll);
|
|
459
459
|
};
|
|
460
460
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation = on_navigation;
|
|
461
461
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api ||= new (0, $2IzJs$depictaiui.DepictAPI)({
|
|
462
462
|
get_metadata: async () => (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
|
|
463
|
-
get_user_id: () =>
|
|
464
|
-
get_session_id: () =>
|
|
463
|
+
get_user_id: () => $2IzJs$solidjs.untrack((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId[0]),
|
|
464
|
+
get_session_id: () => $2IzJs$solidjs.untrack((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId[0])
|
|
465
465
|
});
|
|
466
466
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
|
|
467
467
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.display_transformers = props.displayTransformers;
|
|
@@ -469,11 +469,11 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
|
|
|
469
469
|
if (!search_instances.get(undefined)) {
|
|
470
470
|
// Create initial search instance which always exists. It i.e. gards against the state getting deleted from history.state by someone pushing to it with an empty object, which commonly people copy from code snippets.
|
|
471
471
|
// Also, it emulates the behavior pre-supporting multiple "depict blocks" on the same page
|
|
472
|
-
const instance =
|
|
472
|
+
const instance = $b1cf911fa603e77a$export$bae2769a30719c48(false);
|
|
473
473
|
search_instances.set(undefined, instance);
|
|
474
474
|
}
|
|
475
475
|
if (!category_instances.get(undefined)) {
|
|
476
|
-
const instance =
|
|
476
|
+
const instance = $da98aca6c7d4c3f9$export$248b95d5073d5bab(false);
|
|
477
477
|
category_instances.set(undefined, instance);
|
|
478
478
|
}
|
|
479
479
|
} catch (e) {
|
|
@@ -482,7 +482,7 @@ function $24b00503eef73528$var$ActualDepictProvider(props) {
|
|
|
482
482
|
throw e;
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
-
return
|
|
485
|
+
return $2IzJs$react.createElement((0, $2IzJs$react.Fragment), null, children);
|
|
486
486
|
}
|
|
487
487
|
function $24b00503eef73528$var$ensure_correct_formatting(path) {
|
|
488
488
|
// Make sure the path starts with a slash as it always will and is_page will fail otherwise
|
|
@@ -490,7 +490,7 @@ function $24b00503eef73528$var$ensure_correct_formatting(path) {
|
|
|
490
490
|
return path;
|
|
491
491
|
}
|
|
492
492
|
function $24b00503eef73528$var$multiple_depictprovider_guard() {
|
|
493
|
-
|
|
493
|
+
$2IzJs$react.useEffect(() => {
|
|
494
494
|
$24b00503eef73528$var$provider_instances++;
|
|
495
495
|
if ($24b00503eef73528$var$provider_instances > 1) throw new Error("You are using multiple DepictProviders. This is not supported and will lead to unexpected behavior. You can create multiple SearchPage and CategoryPage components, but only one DepictProvider.");
|
|
496
496
|
return () => {
|
|
@@ -498,8 +498,8 @@ function $24b00503eef73528$var$multiple_depictprovider_guard() {
|
|
|
498
498
|
};
|
|
499
499
|
}, []);
|
|
500
500
|
}
|
|
501
|
-
const $883a881f7926405d$export$80e99ee6b29cadd2 = /*#__PURE__
|
|
502
|
-
return /*#__PURE__
|
|
501
|
+
const $883a881f7926405d$export$80e99ee6b29cadd2 = /*#__PURE__*/$2IzJs$react.forwardRef((_, ref) => {
|
|
502
|
+
return /*#__PURE__*/$2IzJs$react.createElement("div", {
|
|
503
503
|
className: "depict aligner",
|
|
504
504
|
style: {
|
|
505
505
|
height: "100%"
|
|
@@ -512,11 +512,11 @@ function $2506fd72fd4393aa$export$f4d89133c6985668(type, stateKey, componentName
|
|
|
512
512
|
if (!instances.get(undefined)) throw Error(`${componentName}: State not set up. Did you forget to wrap your app in DepictProvider? Also make sure you've provided a merchant and a market.`);
|
|
513
513
|
let instance = instances.get(stateKey);
|
|
514
514
|
if (!instance) {
|
|
515
|
-
instance = type === "search" ?
|
|
515
|
+
instance = type === "search" ? $b1cf911fa603e77a$export$bae2769a30719c48(true, stateKey) : $da98aca6c7d4c3f9$export$248b95d5073d5bab(true, stateKey);
|
|
516
516
|
instances.set(stateKey, instance);
|
|
517
517
|
}
|
|
518
518
|
instance.users++;
|
|
519
|
-
|
|
519
|
+
$2IzJs$solidjs.onCleanup(() => {
|
|
520
520
|
instance.users--;
|
|
521
521
|
if (!instance.users && instance?.dispose) {
|
|
522
522
|
// main instance is not disposable, and shouldn't be deletable either
|
|
@@ -528,23 +528,23 @@ function $2506fd72fd4393aa$export$f4d89133c6985668(type, stateKey, componentName
|
|
|
528
528
|
}
|
|
529
529
|
const $7ad7a3d0011b7b1b$var$rendered_components_with_state_key = new Set();
|
|
530
530
|
function $7ad7a3d0011b7b1b$export$a54ec244c8863715(props) {
|
|
531
|
-
return
|
|
532
|
-
solid_component:
|
|
531
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
532
|
+
solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035($7ad7a3d0011b7b1b$var$SolidSearchPage),
|
|
533
533
|
props: props
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
536
|
function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
537
|
-
const depict_search =
|
|
538
|
-
const instance =
|
|
539
|
-
|
|
537
|
+
const depict_search = $2IzJs$solidjs.createMemo(() => {
|
|
538
|
+
const instance = $2506fd72fd4393aa$export$f4d89133c6985668("search", props.stateKey, "SearchPage");
|
|
539
|
+
$2IzJs$solidjs.onCleanup(() => {
|
|
540
540
|
// Make sure we don't block the search query updating signal when we switch to a new provider instance
|
|
541
|
-
|
|
541
|
+
$2IzJs$depictaiui.get_search_query_updating_blocked_signal(instance)?.[1](false);
|
|
542
542
|
});
|
|
543
543
|
return instance;
|
|
544
544
|
});
|
|
545
545
|
const update_updating_blocked_signal = () => {
|
|
546
546
|
// if search instances changes, also re-check for good measure (otherwise would have untrack around depict_search)
|
|
547
|
-
const signal =
|
|
547
|
+
const signal = $2IzJs$depictaiui.get_search_query_updating_blocked_signal(depict_search());
|
|
548
548
|
if (!signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
|
|
549
549
|
const [, write_signal] = signal;
|
|
550
550
|
// This causes a bug. To reproduce:
|
|
@@ -556,26 +556,26 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
556
556
|
// 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
|
|
557
557
|
// 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
|
|
558
558
|
// EDIT: now that we're resetting this in the onCleanup of the memo above this might no longer be the case
|
|
559
|
-
write_signal(
|
|
559
|
+
write_signal(!$b4d0d98857ed9934$export$775e6b3892b5ad52(location));
|
|
560
560
|
};
|
|
561
561
|
const [, set_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
|
|
562
562
|
const component_portals = new Set();
|
|
563
563
|
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
564
564
|
set_search_page_in_dom(true);
|
|
565
|
-
|
|
565
|
+
$2IzJs$solidjs.onCleanup(() => set_search_page_in_dom(false));
|
|
566
566
|
// 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
|
|
567
|
-
|
|
568
|
-
|
|
567
|
+
$b4d0d98857ed9934$export$74f3924c5027fe1d(update_updating_blocked_signal); // if we navigate, re-check
|
|
568
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
569
569
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
|
|
570
570
|
update_updating_blocked_signal();
|
|
571
571
|
});
|
|
572
572
|
$7ad7a3d0011b7b1b$var$search_page_path_checker();
|
|
573
|
-
return
|
|
574
|
-
const stateKey =
|
|
573
|
+
return $2IzJs$solidjs.createMemo(() => {
|
|
574
|
+
const stateKey = $2IzJs$solidjs.untrack(() => props.stateKey);
|
|
575
575
|
if ($7ad7a3d0011b7b1b$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.`);
|
|
576
576
|
$7ad7a3d0011b7b1b$var$rendered_components_with_state_key.add(stateKey);
|
|
577
|
-
|
|
578
|
-
return
|
|
577
|
+
$2IzJs$solidjs.onCleanup(() => $7ad7a3d0011b7b1b$var$rendered_components_with_state_key.delete(stateKey));
|
|
578
|
+
return $2IzJs$depictaiui.SearchPage({
|
|
579
579
|
// Default config goes here
|
|
580
580
|
get include_input_field() {
|
|
581
581
|
return props.includeInputField;
|
|
@@ -587,9 +587,9 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
587
587
|
return props.gridSpacing ?? (0, $2IzJs$depictaiui.defaultGridSpacing);
|
|
588
588
|
},
|
|
589
589
|
depict_search: depict_search(),
|
|
590
|
-
product_card_template: display =>
|
|
590
|
+
product_card_template: display => $b4d0d98857ed9934$export$79c79419c1ef0081({
|
|
591
591
|
display: display,
|
|
592
|
-
react_template:
|
|
592
|
+
react_template: $2IzJs$solidjs.untrack(() => props.productCard),
|
|
593
593
|
component_portals: component_portals,
|
|
594
594
|
set_portals: set_portals
|
|
595
595
|
})
|
|
@@ -601,7 +601,7 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
601
601
|
*/
|
|
602
602
|
function $7ad7a3d0011b7b1b$var$search_page_path_checker() {
|
|
603
603
|
let has_warned = false;
|
|
604
|
-
|
|
604
|
+
$2IzJs$solidjs.createEffect(() => {
|
|
605
605
|
if (has_warned) return;
|
|
606
606
|
const should_be_path = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]();
|
|
607
607
|
const {
|
|
@@ -610,32 +610,32 @@ function $7ad7a3d0011b7b1b$var$search_page_path_checker() {
|
|
|
610
610
|
if (
|
|
611
611
|
// allow some variability just to be sure
|
|
612
612
|
should_be_path !== pathname && should_be_path + "/" !== pathname && should_be_path !== pathname + "/") {
|
|
613
|
-
|
|
613
|
+
$2IzJs$depictaiutilishared.derror("searchPagePath is set to", should_be_path, "but the SearchPage is rendered at", pathname, ". Please double-check your searchPagePath is where the SearchPage component ends up being rendered, after all redirects, unless you're sure this is intentional.");
|
|
614
614
|
has_warned = true;
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
const $5aa5fcb9f8a2bebc$var$rendered_components_with_state_key = new Set();
|
|
619
619
|
function $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d(props) {
|
|
620
|
-
return
|
|
620
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
621
621
|
// @ts-ignore
|
|
622
|
-
solid_component:
|
|
622
|
+
solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035($5aa5fcb9f8a2bebc$var$SolidCategoryPage),
|
|
623
623
|
props: props,
|
|
624
624
|
wrapper_type: "div",
|
|
625
625
|
wrapper_style: {}
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
628
|
function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
629
|
-
const depict_category =
|
|
629
|
+
const depict_category = $2IzJs$solidjs.createMemo(() => $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "CategoryPage") // stateKey can change
|
|
630
630
|
);
|
|
631
631
|
|
|
632
|
-
const [category_state_set, set_category_state_set] =
|
|
632
|
+
const [category_state_set, set_category_state_set] = $2IzJs$solidjs.createSignal(false);
|
|
633
633
|
const component_portals = new Set();
|
|
634
634
|
const [, set_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
|
|
635
635
|
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
636
636
|
set_category_page_in_dom(true);
|
|
637
|
-
|
|
638
|
-
|
|
637
|
+
$2IzJs$solidjs.onCleanup(() => set_category_page_in_dom(false));
|
|
638
|
+
$2IzJs$solidjs.createComputed(() => {
|
|
639
639
|
const {
|
|
640
640
|
categoryId: categoryId
|
|
641
641
|
} = props;
|
|
@@ -645,13 +645,13 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
645
645
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
|
|
646
646
|
}
|
|
647
647
|
});
|
|
648
|
-
|
|
649
|
-
const category = () =>
|
|
650
|
-
const stateKey =
|
|
648
|
+
$2IzJs$solidjs.createComputed(() => depict_category().listing_type = props.listingType);
|
|
649
|
+
const category = () => $2IzJs$solidjs.createMemo(() => {
|
|
650
|
+
const stateKey = $2IzJs$solidjs.untrack(() => props.stateKey);
|
|
651
651
|
if ($5aa5fcb9f8a2bebc$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.`);
|
|
652
652
|
$5aa5fcb9f8a2bebc$var$rendered_components_with_state_key.add(stateKey);
|
|
653
|
-
|
|
654
|
-
return
|
|
653
|
+
$2IzJs$solidjs.onCleanup(() => $5aa5fcb9f8a2bebc$var$rendered_components_with_state_key.delete(stateKey));
|
|
654
|
+
return $2IzJs$depictaiui.CategoryPage({
|
|
655
655
|
depict_category: depict_category(),
|
|
656
656
|
get cols_at_size() {
|
|
657
657
|
return props.columnsAtSize ?? (0, $2IzJs$depictaiui.defaultColsAtSize);
|
|
@@ -659,49 +659,49 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
659
659
|
get grid_spacing() {
|
|
660
660
|
return props.gridSpacing ?? (0, $2IzJs$depictaiui.defaultGridSpacing);
|
|
661
661
|
},
|
|
662
|
-
category_title:
|
|
662
|
+
category_title: $2IzJs$solidjs.untrack(() => props.categoryTitlePlugin) || (0, $2IzJs$depictaiui.defaultCategoryTitlePlugin),
|
|
663
663
|
get show_breadcrumbs() {
|
|
664
664
|
return props.showBreadcrumbs;
|
|
665
665
|
},
|
|
666
666
|
get show_quicklinks() {
|
|
667
667
|
return props.showQuicklinks;
|
|
668
668
|
},
|
|
669
|
-
product_card_template: display =>
|
|
669
|
+
product_card_template: display => $b4d0d98857ed9934$export$79c79419c1ef0081({
|
|
670
670
|
display: display,
|
|
671
|
-
react_template:
|
|
671
|
+
react_template: $2IzJs$solidjs.untrack(() => props.productCard),
|
|
672
672
|
component_portals: component_portals,
|
|
673
673
|
set_portals: set_portals
|
|
674
674
|
})
|
|
675
675
|
});
|
|
676
676
|
});
|
|
677
|
-
return
|
|
677
|
+
return $b4d0d98857ed9934$export$e5139bbbb9a05035(category, category_state_set);
|
|
678
678
|
}
|
|
679
679
|
function $d88e98b11c182b8e$export$5646050d516e06bc(react_props) {
|
|
680
|
-
return
|
|
681
|
-
solid_component:
|
|
680
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
681
|
+
solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035($d88e98b11c182b8e$var$vanilla_breadcrumbs),
|
|
682
682
|
props: react_props
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
function $d88e98b11c182b8e$var$vanilla_breadcrumbs(props) {
|
|
686
686
|
// memo so stateKey can be dynamically changed
|
|
687
|
-
return
|
|
688
|
-
const depict_category =
|
|
689
|
-
return
|
|
687
|
+
return $2IzJs$solidjs.createMemo(() => {
|
|
688
|
+
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "BreadCrumbs");
|
|
689
|
+
return $2IzJs$depictaiui.BreadCrumbs({
|
|
690
690
|
depict_category: depict_category
|
|
691
691
|
});
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
function $f16af0e861aff3d0$export$466cdc317043f6cb(react_props = {}) {
|
|
695
|
-
return
|
|
696
|
-
solid_component:
|
|
695
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
696
|
+
solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035($f16af0e861aff3d0$var$vanilla_quick_links),
|
|
697
697
|
props: react_props
|
|
698
698
|
});
|
|
699
699
|
}
|
|
700
700
|
function $f16af0e861aff3d0$var$vanilla_quick_links(props) {
|
|
701
701
|
// memo so stateKey can be dynamically changed
|
|
702
|
-
return
|
|
703
|
-
const depict_category =
|
|
704
|
-
return
|
|
702
|
+
return $2IzJs$solidjs.createMemo(() => {
|
|
703
|
+
const depict_category = $2506fd72fd4393aa$export$f4d89133c6985668("category", props.stateKey, "QuickLinks");
|
|
704
|
+
return $2IzJs$depictaiui.QuickLinks({
|
|
705
705
|
depict_category: depict_category
|
|
706
706
|
});
|
|
707
707
|
});
|
|
@@ -711,8 +711,8 @@ const $df522c8a81ed5a01$export$3f37af283f8fb843 = raw_react_props => {
|
|
|
711
711
|
class: raw_react_props.className,
|
|
712
712
|
...raw_react_props
|
|
713
713
|
};
|
|
714
|
-
return
|
|
715
|
-
solid_component: props_store =>
|
|
714
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
715
|
+
solid_component: props_store => $2IzJs$depictaiui.ImagePlaceholder(props_store),
|
|
716
716
|
props: react_props,
|
|
717
717
|
wrapper_type: "span",
|
|
718
718
|
hydrate_function_when_ssr: (0, $2IzJs$solidjsweb.hydrate)
|
|
@@ -723,8 +723,8 @@ const $7c8b440edc188ad5$export$89c6019e4baa40b1 = raw_react_props => {
|
|
|
723
723
|
class: raw_react_props.className,
|
|
724
724
|
...raw_react_props
|
|
725
725
|
};
|
|
726
|
-
return
|
|
727
|
-
solid_component: props_store =>
|
|
726
|
+
return $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
727
|
+
solid_component: props_store => $2IzJs$depictaiui.TextPlaceholder(props_store),
|
|
728
728
|
props: react_props,
|
|
729
729
|
wrapper_type: "span",
|
|
730
730
|
hydrate_function_when_ssr: (0, $2IzJs$solidjsweb.hydrate),
|
|
@@ -739,22 +739,22 @@ const $177ac8f5258066ba$export$d69d8daa20eae175 = createOpenModalParams => {
|
|
|
739
739
|
alignerRef: alignerRef,
|
|
740
740
|
stateKey: stateKey
|
|
741
741
|
} = createOpenModalParams;
|
|
742
|
-
let [deduped_variable, set_deduped_variable] =
|
|
742
|
+
let [deduped_variable, set_deduped_variable] = $2IzJs$react.useState();
|
|
743
743
|
// When component using this hook unmounts, "untrack" our component and dispose the search instance if needed
|
|
744
|
-
|
|
744
|
+
$2IzJs$react.useEffect(() => deduped_variable?.[1]?.(), []);
|
|
745
745
|
const openModal = () => {
|
|
746
746
|
// Get the search instance and track this component, but only once (basically work around re-rendering)
|
|
747
747
|
// We have to do this in the openModal function since people might call this hook before creating DepictProvider
|
|
748
748
|
if (!deduped_variable) {
|
|
749
|
-
deduped_variable =
|
|
749
|
+
deduped_variable = $2IzJs$solidjs.createRoot(dispose => [$2506fd72fd4393aa$export$f4d89133c6985668("search", stateKey, "useSearchModal"), dispose]);
|
|
750
750
|
set_deduped_variable(deduped_variable);
|
|
751
751
|
}
|
|
752
752
|
const [search] = deduped_variable;
|
|
753
|
-
if (location === "aligned" && alignerRef?.current)
|
|
753
|
+
if (location === "aligned" && alignerRef?.current) $2IzJs$depictaiui.open_modal_with_alignment({
|
|
754
754
|
"element": alignerRef.current,
|
|
755
755
|
"location": location,
|
|
756
756
|
"search": search
|
|
757
|
-
});else
|
|
757
|
+
});else $2IzJs$depictaiui.open_modal_with_alignment({
|
|
758
758
|
"location": "centered",
|
|
759
759
|
"search": search
|
|
760
760
|
});
|
|
@@ -762,7 +762,7 @@ const $177ac8f5258066ba$export$d69d8daa20eae175 = createOpenModalParams => {
|
|
|
762
762
|
return openModal;
|
|
763
763
|
};
|
|
764
764
|
function $ae73b15c325f1b21$export$912994940e660d32(params = {}) {
|
|
765
|
-
const open =
|
|
765
|
+
const open = $177ac8f5258066ba$export$d69d8daa20eae175({
|
|
766
766
|
globalState: $0b7cd4fb39fc3502$export$8e769ad4338a911e,
|
|
767
767
|
...params
|
|
768
768
|
});
|
|
@@ -773,15 +773,15 @@ function $ae73b15c325f1b21$export$912994940e660d32(params = {}) {
|
|
|
773
773
|
const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props = {}) => {
|
|
774
774
|
// 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.
|
|
775
775
|
// Create signal that persists across renders
|
|
776
|
-
const [[get_aligner_signal_value, set_aligner_signal_value]] =
|
|
776
|
+
const [[get_aligner_signal_value, set_aligner_signal_value]] = $2IzJs$react.useState($2IzJs$solidjs.createSignal());
|
|
777
777
|
// Update signal value when alignerRef changes
|
|
778
778
|
set_aligner_signal_value(props?.alignerRef);
|
|
779
779
|
// Make sure react never re-renders the actual SearchField component
|
|
780
|
-
const componentFunction =
|
|
781
|
-
solid_component:
|
|
782
|
-
return
|
|
783
|
-
const depict_search =
|
|
784
|
-
return
|
|
780
|
+
const componentFunction = $2IzJs$react.useCallback(() => $b4d0d98857ed9934$export$f6e64e17bd69eeef({
|
|
781
|
+
solid_component: $b4d0d98857ed9934$export$e5139bbbb9a05035(() => {
|
|
782
|
+
return $2IzJs$solidjs.createMemo(() => {
|
|
783
|
+
const depict_search = $2506fd72fd4393aa$export$f4d89133c6985668("search", props.stateKey, "useSearchField");
|
|
784
|
+
return $2IzJs$depictaiui.SearchField({
|
|
785
785
|
depict_search: depict_search,
|
|
786
786
|
get aligner_ref() {
|
|
787
787
|
// React mutates the object at some random time so only get the current value once it actually is requested
|
|
@@ -808,14 +808,14 @@ function $a134ea100690b628$var$fetchRecommendations(opts) {
|
|
|
808
808
|
userId: [get_userId],
|
|
809
809
|
sessionId: [get_sessionId]
|
|
810
810
|
} = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
811
|
-
const merchant =
|
|
812
|
-
const market =
|
|
811
|
+
const merchant = $2IzJs$solidjs.untrack(get_merchant);
|
|
812
|
+
const market = $2IzJs$solidjs.untrack(get_market);
|
|
813
813
|
if (!merchant || !market) throw new Error("Depict recommendations are not configured. Wrap your app in a DepictProvider.");
|
|
814
|
-
return
|
|
814
|
+
return $2IzJs$depictaiui.fetchDepictRecommendations({
|
|
815
815
|
merchant: merchant,
|
|
816
816
|
market: market,
|
|
817
|
-
userId:
|
|
818
|
-
sessionId:
|
|
817
|
+
userId: $2IzJs$solidjs.untrack(get_userId),
|
|
818
|
+
sessionId: $2IzJs$solidjs.untrack(get_sessionId),
|
|
819
819
|
...opts
|
|
820
820
|
});
|
|
821
821
|
}
|
|
@@ -829,9 +829,9 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
|
829
829
|
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
830
830
|
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
831
831
|
})(Page || (Page = {}));
|
|
832
|
-
const current_page =
|
|
832
|
+
const current_page = $b4d0d98857ed9934$export$775e6b3892b5ad52() ? Page.SEARCH : $b4d0d98857ed9934$export$30c8a12df09be0e4() ? Page.CATEGORY : Page.OTHER;
|
|
833
833
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
834
|
-
const target_page =
|
|
834
|
+
const target_page = $b4d0d98857ed9934$export$775e6b3892b5ad52(target_u_o) ? Page.SEARCH : $b4d0d98857ed9934$export$30c8a12df09be0e4(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
835
835
|
router[replace ? "replace" : "push"](relativeUrl, undefined, {
|
|
836
836
|
shallow: current_page === target_page && target_page !== Page.OTHER,
|
|
837
837
|
scroll:
|
|
@@ -842,4 +842,4 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = router => (relativeUrl, {
|
|
|
842
842
|
const $b742053c966024b4$export$b8a61e5c71402559 = {
|
|
843
843
|
nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35
|
|
844
844
|
};
|
|
845
|
-
|
|
845
|
+
$2IzJs$depictaiutilishared.add_to_version_info("react-ui", (0, $db7b67857900028b$export$83d89fbfd8236492));
|