@depict-ai/react-ui 1.5.12 → 1.5.13

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/dist/main.js DELETED
@@ -1,879 +0,0 @@
1
- var $4GYXz$depictaiutilishared = require("@depict-ai/utilishared");
2
- var $4GYXz$depictaiui = require("@depict-ai/ui");
3
- var $4GYXz$solidjs = require("solid-js");
4
- var $4GYXz$react = require("react");
5
- var $4GYXz$depictaiuilocales = require("@depict-ai/ui/locales");
6
- var $4GYXz$solidjsweb = require("solid-js/web");
7
- var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
8
- var $4GYXz$reactdom = require("react-dom");
9
- var $4GYXz$solidjsstore = require("solid-js/store");
10
- var $4GYXz$depictaidpc = require("@depict-ai/dpc");
11
-
12
- function $parcel$export(e, n, v, s) {
13
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
- }
15
-
16
- $parcel$export(module.exports, "QuickLinks", () => $f16af0e861aff3d0$export$466cdc317043f6cb);
17
- $parcel$export(module.exports, "BreadCrumbs", () => $d88e98b11c182b8e$export$5646050d516e06bc);
18
- $parcel$export(module.exports, "ComponentAligner", () => $883a881f7926405d$export$80e99ee6b29cadd2);
19
- $parcel$export(module.exports, "DepictProvider", () => $24b00503eef73528$export$9fac37a9c21c2f3b);
20
- $parcel$export(module.exports, "CategoryPage", () => $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d);
21
- $parcel$export(module.exports, "SearchPage", () => $7ad7a3d0011b7b1b$export$a54ec244c8863715);
22
- $parcel$export(module.exports, "ImagePlaceholder", () => $df522c8a81ed5a01$export$3f37af283f8fb843);
23
- $parcel$export(module.exports, "TextPlaceholder", () => $7c8b440edc188ad5$export$89c6019e4baa40b1);
24
- $parcel$export(module.exports, "useSearchModal", () => $ae73b15c325f1b21$export$912994940e660d32);
25
- $parcel$export(module.exports, "useSearchField", () => $913da7f4d0bc77f2$export$9bb30bbe003b82e0);
26
- $parcel$export(module.exports, "useFetchRecommendations", () => $a134ea100690b628$export$6501da23a2770fc);
27
- $parcel$export(module.exports, "usePerformanceClient", () => $25c0a91312868994$export$38b98fae14bd1f64);
28
- $parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
29
- $parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
30
- $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
31
- $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
32
- /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
33
- // Note, if you add an export here, also add one in src-server/main.ts
34
- const $db7b67857900028b$export$83d89fbfd8236492 = "1.5.1";
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
47
- usedLocale: (0, $4GYXz$solidjs.createSignal)((0, $4GYXz$depictaiuilocales.defaultLocale)),
48
- search_instances: new Map(),
49
- category_instances: new Map(),
50
- api: null,
51
- dpc: null,
52
- merchant: (0, $4GYXz$solidjs.createSignal)(),
53
- market: (0, $4GYXz$solidjs.createSignal)(),
54
- userId: (0, $4GYXz$solidjs.createSignal)(),
55
- sessionId: (0, $4GYXz$solidjs.createSignal)(),
56
- known_category_paths: new Set(),
57
- search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
58
- search_page_in_dom: (0, $4GYXz$solidjs.createSignal)(false),
59
- category_page_in_dom: (0, $4GYXz$solidjs.createSignal)(false)
60
- };
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
- class $d7a14567b529586f$export$d0f82e3ef89b1f22 extends (0, $4GYXz$react.Component) {
71
- constructor(props){
72
- super(props);
73
- this.state = {
74
- hasError: false
75
- };
76
- }
77
- static getDerivedStateFromError() {
78
- // Update state so the next render will show the fallback UI.
79
- return {
80
- hasError: true
81
- };
82
- }
83
- componentDidCatch(error) {
84
- this.props.on_error(error);
85
- }
86
- render() {
87
- if (this.state.hasError) // You can render any custom fallback UI
88
- return (0, $4GYXz$react.createElement)("div", {
89
- children: "Component failed"
90
- });
91
- return this.props.children;
92
- }
93
- }
94
-
95
-
96
-
97
- let $b4d0d98857ed9934$var$run_on_href_change;
98
- let $b4d0d98857ed9934$var$old_href = location.href;
99
- function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
100
- $b4d0d98857ed9934$var$run_on_href_change = cb;
101
- }
102
- (0, $4GYXz$depictaiutilishared.instant_exec_on_suspect_history_change).add((0, $4GYXz$depictaiutilishared.catchify)(()=>{
103
- const { href: href } = location;
104
- if ($b4d0d98857ed9934$var$run_on_href_change && $b4d0d98857ed9934$var$old_href !== href) $b4d0d98857ed9934$var$run_on_href_change(href);
105
- $b4d0d98857ed9934$var$old_href = href;
106
- }));
107
- const $b4d0d98857ed9934$export$775e6b3892b5ad52 = (url = location)=>url.pathname == (0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
108
- const $b4d0d98857ed9934$export$30c8a12df09be0e4 = (url = location)=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
109
- function $b4d0d98857ed9934$export$f6e64e17bd69eeef({ solid_component: solid_component, props: props, wrapper_type: wrapper_type = "div", wrapper_style: wrapper_style = {}, hydrate_function_when_ssr: hydrate_function_when_ssr }) {
110
- const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
111
- const wrapper_element_ref = (0, $4GYXz$react.useRef)();
112
- const [[store, write_store]] = (0, $4GYXz$react.useState)(()=>(0, $4GYXz$solidjsstore.createStore)(props));
113
- // Update store when props change
114
- write_store((0, $4GYXz$solidjsstore.reconcile)(props));
115
- (0, $4GYXz$react.useEffect)(()=>{
116
- const wrapper_element = wrapper_element_ref.current;
117
- // 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
118
- // This can happen for HMR or when SSR capable components are only rendered on the client
119
- const render_function = hydrate_function_when_ssr && wrapper_element.childNodes.length ? hydrate_function_when_ssr : (0, $4GYXz$solidjsweb.render);
120
- const dispose = render_function(()=>solid_component(store, set_portals), wrapper_element);
121
- return dispose;
122
- }, []);
123
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, (0, $4GYXz$react.createElement)(wrapper_type, {
124
- ref: wrapper_element_ref,
125
- style: wrapper_style,
126
- ...hydrate_function_when_ssr ? {
127
- // We need this because on the server we put the solid SSR rendered string into html but it won't match on the client, luckily we can just suppress it
128
- suppressHydrationWarning: true,
129
- dangerouslySetInnerHTML: {
130
- __html: ""
131
- }
132
- } : {}
133
- }), ...portals);
134
- }
135
- function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set) {
136
- return (...args)=>{
137
- const default_is_set = (0, $4GYXz$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
138
- // @ts-ignore
139
- return (0, $4GYXz$solidjs.createComponent)((0, $4GYXz$solidjs.Show), {
140
- get when () {
141
- return (is_set || default_is_set)();
142
- },
143
- get children () {
144
- return component(...args);
145
- }
146
- });
147
- };
148
- }
149
- async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display, component_portals: component_portals, set_portals: set_portals, react_template: react_template }) {
150
- let set_react_has_ran_hooks;
151
- let was_cleaned_up = false;
152
- const react_has_ran_hooks = new Promise((r)=>set_react_has_ran_hooks = r);
153
- const solid_container = document.createElement("div");
154
- const owner = (0, $4GYXz$solidjs.getOwner)();
155
- const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)((props)=>{
156
- // Sneak in a hook into their product card component to know once react has finished rendering and running hooks
157
- (0, $4GYXz$react.useEffect)(set_react_has_ran_hooks, []);
158
- return react_template(props);
159
- }, {
160
- display: display
161
- });
162
- const reactProductCardInErrorBoundary = (0, $4GYXz$reactjsxruntime.jsx)((0, $d7a14567b529586f$export$d0f82e3ef89b1f22), {
163
- children: reactProductCard,
164
- on_error: (error)=>(0, $4GYXz$solidjs.runWithOwner)(owner, ()=>{
165
- 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.
166
- throw new (0, $4GYXz$depictaiui.ProductCardError)(error);
167
- })
168
- });
169
- const portal = $4GYXz$reactdom.createPortal(reactProductCardInErrorBoundary, solid_container);
170
- component_portals.add(portal);
171
- set_portals([
172
- ...component_portals
173
- ]);
174
- (0, $4GYXz$solidjs.onCleanup)(()=>{
175
- was_cleaned_up = true;
176
- // 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
177
- component_portals.delete(portal);
178
- // Updating i.e. the merchant will cause a setState call while rendering the DepictProvider component which is illegal because it usually infinite loops react apps. In our case it doesn't though, so we just evade detection by doing it a microtask later. See also https://github.com/facebook/react/issues/18178#issuecomment-595846312
179
- queueMicrotask(()=>set_portals([
180
- ...component_portals
181
- ]));
182
- });
183
- await react_has_ran_hooks; // After react has created elements it still takes some time to actually connect the refs and run the hooks. We don't want to replace placeholders before then.
184
- return [
185
- solid_container
186
- ];
187
- }
188
-
189
-
190
-
191
-
192
- let $6319748b4f0426f0$var$set = false;
193
- let $6319748b4f0426f0$var$padding_animation;
194
- function $6319748b4f0426f0$export$6453cbc34515a94d() {
195
- const are_on_search_or_category_page = ()=>(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() || (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)();
196
- if ($6319748b4f0426f0$var$set) return; // Just being safe
197
- $6319748b4f0426f0$var$set = true;
198
- // 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)
199
- // I don't know why we'd want to initialise it with false? The only reason I can see is in the hopes of scroll restoration working on initial page load, but it basically never does due to react rendering and executing our component too late
200
- let should_use_old_scroll = true;
201
- const old_scrollTo = window.scrollTo;
202
- const next_router_event_target = $6319748b4f0426f0$var$make_next_router_event_target(); // So we can use once: true
203
- window.scrollTo = (...args)=>{
204
- if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page() || history.scrollRestoration === "manual" // I.e. Chimi has manual scroll restoration that we don't want to block https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686658007164019?thread_ts=1686134246.109689&cid=C058KQ3MU8Z
205
- ) return Reflect.apply(old_scrollTo, window, args);
206
- else should_use_old_scroll = true;
207
- };
208
- // 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
209
- addEventListener("popstate", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
210
- if (!are_on_search_or_category_page()) {
211
- $6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
212
- return;
213
- }
214
- should_use_old_scroll = false;
215
- const [get_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
216
- const [get_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
217
- const search_page_in_dom = (0, $4GYXz$solidjs.untrack)(get_search_page_in_dom);
218
- const category_page_in_dom = (0, $4GYXz$solidjs.untrack)(get_category_page_in_dom);
219
- const new_is_search = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)();
220
- const new_is_category = (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)();
221
- let accessor_to_wait_for;
222
- if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
223
- // Already on the page we're going to
224
- $6319748b4f0426f0$var$removeLotsOfPadding();
225
- return;
226
- }
227
- $6319748b4f0426f0$var$addLotsOfPadding();
228
- if (new_is_search && category_page_in_dom) accessor_to_wait_for = get_search_page_in_dom;
229
- else if (new_is_category && search_page_in_dom) accessor_to_wait_for = get_category_page_in_dom;
230
- else accessor_to_wait_for = new_is_search ? get_search_page_in_dom : get_category_page_in_dom;
231
- (0, $4GYXz$solidjs.createRoot)((dispose)=>(0, $4GYXz$solidjs.createEffect)(()=>{
232
- if (accessor_to_wait_for()) {
233
- $6319748b4f0426f0$var$removeLotsOfPadding();
234
- dispose();
235
- }
236
- }));
237
- }));
238
- window?.next?.router?.events?.on(// 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
239
- "routeChangeStart", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
240
- // this is for when we navigate to a new page (replaceState or pushState)
241
- // We need to ensure that the page doesn't get shorter before the new history entry has been pushed
242
- // 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
243
- // The challenge is knowing on routeChangeStart if we're in a popstate (back/forward) or a pushState/replaceState
244
- // We use the deprecated window.event property for that
245
- // This is catchified, so we should see in sentry when it starts failing if browsers ever remove it???
246
- if (window.event instanceof PopStateEvent) return;
247
- $6319748b4f0426f0$var$addLotsOfPadding();
248
- next_router_event_target.addEventListener("beforeHistoryChange", (0, $4GYXz$depictaiutilishared.catchify)(()=>(0, $4GYXz$depictaiutilishared.queueMacroTask)($6319748b4f0426f0$var$removeLotsOfPadding)), {
249
- once: true
250
- });
251
- }));
252
- }
253
- /*
254
- Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
255
- The best way to achieve this is using an animation that with the fill set to none. This is because animations have the absolute highest precedence in CSS, even higher than !important. Then, to revert to the old padding, we just play the animation which is 1ms long so, it immediately finishes and whatever was defined before takes precedence again.
256
- */ function $6319748b4f0426f0$var$addLotsOfPadding() {
257
- if ($6319748b4f0426f0$var$padding_animation) return; // We're already showing a bunch of padding
258
- $6319748b4f0426f0$var$padding_animation = document.body.animate({
259
- paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
260
- offset: 0
261
- }, 1);
262
- $6319748b4f0426f0$var$padding_animation.pause();
263
- }
264
- function $6319748b4f0426f0$var$removeLotsOfPadding() {
265
- if ($6319748b4f0426f0$var$padding_animation) {
266
- $6319748b4f0426f0$var$padding_animation.play();
267
- $6319748b4f0426f0$var$padding_animation = undefined;
268
- }
269
- }
270
- function $6319748b4f0426f0$var$make_next_router_event_target() {
271
- const next_router_event_target = new EventTarget();
272
- window?.next?.router?.events?.on("beforeHistoryChange", ()=>next_router_event_target.dispatchEvent(new CustomEvent("beforeHistoryChange")));
273
- return next_router_event_target;
274
- }
275
-
276
-
277
-
278
-
279
- const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
280
- let Page;
281
- (function(Page) {
282
- Page[Page["OTHER"] = 0] = "OTHER";
283
- Page[Page["SEARCH"] = 1] = "SEARCH";
284
- Page[Page["CATEGORY"] = 2] = "CATEGORY";
285
- })(Page || (Page = {}));
286
- const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
287
- const target_u_o = new URL(relativeUrl, location.origin);
288
- const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
289
- window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
290
- shallow: current_page === target_page && target_page !== Page.OTHER,
291
- scroll: // Can't go shallowly to other pages
292
- scroll
293
- });
294
- };
295
-
296
-
297
-
298
-
299
- const $25c0a91312868994$export$38b98fae14bd1f64 = ()=>{
300
- if (!(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc) throw new Error("Depict tracking is not configured. Wrap your app in a DepictProvider.");
301
- return {
302
- dpc: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc
303
- };
304
- };
305
- const $25c0a91312868994$export$47e064413edabf36 = (merchant, market, userId, sessionId)=>{
306
- if (!merchant) return;
307
- try {
308
- let { dpc: dpc } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
309
- if (!dpc) dpc = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc = new (0, $4GYXz$depictaidpc.DPC)(merchant, {
310
- market: market
311
- });
312
- dpc.merchant = merchant;
313
- dpc.market = market;
314
- dpc.setUserId(userId);
315
- dpc.setSessionId(sessionId);
316
- } catch (e) {
317
- // Make sure to not break the users app if we throw
318
- queueMicrotask(()=>{
319
- throw e;
320
- });
321
- }
322
- };
323
-
324
-
325
-
326
-
327
-
328
- function $b1cf911fa603e77a$export$bae2769a30719c48(disposable, stateKey) {
329
- const actual_function = (dispose)=>{
330
- const { usedLocale: [get_locale], merchant: [get_merchant], market: [get_market], search_query_url_param_name: search_query_url_param_name, search_page_path_: [get_search_page_path] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
331
- const instance = new (0, $4GYXz$depictaiui.DepictSearch)({
332
- api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
333
- search_query_url_param_name: search_query_url_param_name,
334
- market: (0, $4GYXz$solidjs.untrack)(get_market),
335
- // TODO: check if we can do this
336
- merchant: (0, $4GYXz$solidjs.untrack)(get_merchant),
337
- enable_category_suggestions: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).enableCategorySuggestions ?? false,
338
- // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
339
- localization: (0, $4GYXz$solidjs.untrack)(get_locale),
340
- url_transformer: (url)=>url.pathname = (0, $4GYXz$solidjs.untrack)(get_search_page_path),
341
- on_navigation: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation,
342
- unique_instance_key_for_state: stateKey
343
- });
344
- (0, $4GYXz$solidjs.createComputed)(()=>{
345
- const new_merchant = get_merchant();
346
- if (new_merchant) instance.merchant = new_merchant;
347
- });
348
- (0, $4GYXz$solidjs.createComputed)(()=>{
349
- const new_market = get_market();
350
- if (new_market) instance.market = new_market;
351
- });
352
- (0, $4GYXz$solidjs.createComputed)(()=>instance.localization = get_locale());
353
- return {
354
- instance: instance,
355
- dispose: dispose,
356
- users: 0
357
- };
358
- };
359
- const function_length_0 = ()=>actual_function();
360
- const function_length_1 = (dispose)=>actual_function(dispose);
361
- return (0, $4GYXz$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
362
- }
363
-
364
-
365
-
366
-
367
-
368
- function $da98aca6c7d4c3f9$export$248b95d5073d5bab(disposable, stateKey) {
369
- const actual_function = (dispose)=>{
370
- const { usedLocale: [get_locale], merchant: [get_merchant], market: [get_market] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
371
- const instance = new (0, $4GYXz$depictaiui.DepictCategory)({
372
- api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
373
- market: (0, $4GYXz$solidjs.untrack)(get_market),
374
- // TODO: check if we can do this
375
- merchant: (0, $4GYXz$solidjs.untrack)(get_merchant),
376
- localization: (0, $4GYXz$solidjs.untrack)(get_locale),
377
- on_navigation: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation,
378
- unique_instance_key_for_state: stateKey
379
- });
380
- (0, $4GYXz$solidjs.createComputed)(()=>{
381
- const new_merchant = get_merchant();
382
- if (new_merchant) instance.merchant = new_merchant;
383
- });
384
- (0, $4GYXz$solidjs.createComputed)(()=>{
385
- const new_market = get_market();
386
- if (new_market) instance.market = new_market;
387
- });
388
- (0, $4GYXz$solidjs.createComputed)(()=>instance.localization = get_locale());
389
- return {
390
- instance: instance,
391
- dispose: dispose,
392
- users: 0
393
- };
394
- };
395
- const function_length_0 = ()=>actual_function();
396
- const function_length_1 = (dispose)=>actual_function(dispose);
397
- return (0, $4GYXz$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
398
- }
399
-
400
-
401
- let $24b00503eef73528$var$provider_instances = 0;
402
- function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
403
- const { children: children, navigateFunction: navigateFunction, market: market, merchant: merchant, locale: locale, metaData: metaData, userId: userId, sessionId: sessionId } = props;
404
- const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.defaultLocale);
405
- const { searchPagePath: searchPagePath, urlParamName: urlParamName, enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
406
- $24b00503eef73528$var$multiple_depictprovider_guard();
407
- // Will run on other prop changes, but harmless
408
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId[1](userId);
409
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId[1](sessionId);
410
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).usedLocale[1](usedLocale);
411
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
412
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_query_url_param_name = urlParamName;
413
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).enableCategorySuggestions = enableCategorySuggestions;
414
- (0, $25c0a91312868994$export$47e064413edabf36)(merchant, market, userId, sessionId);
415
- if (!market || !merchant) return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
416
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).market[1](market);
417
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).merchant[1](merchant);
418
- (0, $6319748b4f0426f0$export$6453cbc34515a94d)();
419
- try {
420
- const { search_instances: search_instances, category_instances: category_instances, api: api, search_page_path_: [, set_search_page_path] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
421
- if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
422
- const on_navigation = ({ is_replace: is_replace, new_url: new_url, scroll: scroll })=>{
423
- const new_relative_url = new_url.origin === location.origin ? new_url.pathname + new_url.search + new_url.hash : new_url.href; // bail out of making URL relative if it's not possible
424
- if (navigateFunction) navigateFunction(new_relative_url, {
425
- replace: is_replace,
426
- scroll: scroll
427
- });
428
- else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
429
- };
430
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).on_navigation = on_navigation;
431
- if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)({
432
- get_metadata: async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
433
- get_user_id: ()=>(0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId[0]),
434
- get_session_id: ()=>(0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId[0])
435
- });
436
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
437
- if (searchPagePath) set_search_page_path($24b00503eef73528$var$ensure_correct_formatting(searchPagePath));
438
- if (!search_instances.get(undefined)) {
439
- // 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.
440
- // Also, it emulates the behavior pre-supporting multiple "depict blocks" on the same page
441
- const instance = (0, $b1cf911fa603e77a$export$bae2769a30719c48)(false);
442
- search_instances.set(undefined, instance);
443
- }
444
- if (!category_instances.get(undefined)) {
445
- const instance = (0, $da98aca6c7d4c3f9$export$248b95d5073d5bab)(false);
446
- category_instances.set(undefined, instance);
447
- }
448
- } catch (e) {
449
- // Make sure to not break the users app if we throw
450
- queueMicrotask(()=>{
451
- throw e;
452
- });
453
- }
454
- return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
455
- }
456
- function $24b00503eef73528$var$ensure_correct_formatting(path) {
457
- // Make sure the path starts with a slash as it always will and is_page will fail otherwise
458
- if (!path.startsWith("/")) return "/" + path;
459
- return path;
460
- }
461
- function $24b00503eef73528$var$multiple_depictprovider_guard() {
462
- (0, $4GYXz$react.useEffect)(()=>{
463
- $24b00503eef73528$var$provider_instances++;
464
- 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.");
465
- return ()=>{
466
- $24b00503eef73528$var$provider_instances--;
467
- };
468
- }, []);
469
- }
470
-
471
-
472
-
473
- const $883a881f7926405d$export$80e99ee6b29cadd2 = /*#__PURE__*/ (0, $4GYXz$react.forwardRef)((_, ref)=>{
474
- return /*#__PURE__*/ (0, $4GYXz$react.createElement)("div", {
475
- className: "depict aligner",
476
- style: {
477
- height: "100%"
478
- },
479
- ref: ref
480
- });
481
- });
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
- function $2506fd72fd4393aa$export$f4d89133c6985668(type, stateKey, componentName) {
494
- const instances = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e)[type + "_instances"];
495
- 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.`);
496
- let instance = instances.get(stateKey);
497
- if (!instance) {
498
- instance = type === "search" ? (0, $b1cf911fa603e77a$export$bae2769a30719c48)(true, stateKey) : (0, $da98aca6c7d4c3f9$export$248b95d5073d5bab)(true, stateKey);
499
- instances.set(stateKey, instance);
500
- }
501
- instance.users++;
502
- (0, $4GYXz$solidjs.onCleanup)(()=>{
503
- instance.users--;
504
- if (!instance.users && instance?.dispose) {
505
- // main instance is not disposable, and shouldn't be deletable either
506
- instance.dispose();
507
- instances.delete(stateKey);
508
- }
509
- });
510
- return instance.instance;
511
- }
512
-
513
-
514
- const $7ad7a3d0011b7b1b$var$rendered_components_with_state_key = new Set();
515
- function $7ad7a3d0011b7b1b$export$a54ec244c8863715(props) {
516
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
517
- solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($7ad7a3d0011b7b1b$var$SolidSearchPage),
518
- props: props
519
- });
520
- }
521
- function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
522
- const depict_search = (0, $4GYXz$solidjs.createMemo)(()=>{
523
- const instance = (0, $2506fd72fd4393aa$export$f4d89133c6985668)("search", props.stateKey, "SearchPage");
524
- (0, $4GYXz$solidjs.onCleanup)(()=>{
525
- // Make sure we don't block the search query updating signal when we switch to a new provider instance
526
- (0, $4GYXz$depictaiui.get_search_query_updating_blocked_signal)(instance)?.[1](false);
527
- });
528
- return instance;
529
- });
530
- const update_updating_blocked_signal = ()=>{
531
- // if search instances changes, also re-check for good measure (otherwise would have untrack around depict_search)
532
- const signal = (0, $4GYXz$depictaiui.get_search_query_updating_blocked_signal)(depict_search());
533
- if (!signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
534
- const [, write_signal] = signal;
535
- // This causes a bug. To reproduce:
536
- // 1. Go to front page
537
- // 2. Make a search
538
- // 3. Press back button
539
- // 4. Open search modal
540
- // 5. Check the list of previous queries - the query just made isn't shown
541
- // 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
542
- // 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
543
- // EDIT: now that we're resetting this in the onCleanup of the memo above this might no longer be the case
544
- write_signal(!(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(location));
545
- };
546
- const [, set_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
547
- const component_portals = new Set();
548
- // We should only get here once react already has a DOM node which means we should be in the DOM
549
- set_search_page_in_dom(true);
550
- (0, $4GYXz$solidjs.onCleanup)(()=>set_search_page_in_dom(false));
551
- // 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
552
- (0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
553
- (0, $4GYXz$solidjs.createComputed)(()=>{
554
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
555
- update_updating_blocked_signal();
556
- });
557
- $7ad7a3d0011b7b1b$var$search_page_path_checker();
558
- return (0, $4GYXz$solidjs.createMemo)(()=>{
559
- const stateKey = (0, $4GYXz$solidjs.untrack)(()=>props.stateKey);
560
- 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.`);
561
- $7ad7a3d0011b7b1b$var$rendered_components_with_state_key.add(stateKey);
562
- (0, $4GYXz$solidjs.onCleanup)(()=>$7ad7a3d0011b7b1b$var$rendered_components_with_state_key.delete(stateKey));
563
- return (0, $4GYXz$depictaiui.SearchPage)({
564
- // Default config goes here
565
- get include_input_field () {
566
- return props.includeInputField;
567
- },
568
- get cols_at_size () {
569
- return props.columnsAtSize ?? (0, $4GYXz$depictaiui.defaultColsAtSize);
570
- },
571
- get grid_spacing () {
572
- return props.gridSpacing ?? (0, $4GYXz$depictaiui.defaultGridSpacing);
573
- },
574
- depict_search: depict_search(),
575
- product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
576
- display: display,
577
- react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
578
- component_portals: component_portals,
579
- set_portals: set_portals
580
- })
581
- });
582
- });
583
- }
584
- /**
585
- * 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.
586
- */ function $7ad7a3d0011b7b1b$var$search_page_path_checker() {
587
- let has_warned = false;
588
- (0, $4GYXz$solidjs.createEffect)(()=>{
589
- if (has_warned) return;
590
- const should_be_path = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]();
591
- const { pathname: pathname } = location;
592
- if (// allow some variability just to be sure
593
- should_be_path !== pathname && should_be_path + "/" !== pathname && should_be_path !== pathname + "/") {
594
- (0, $4GYXz$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.");
595
- has_warned = true;
596
- }
597
- });
598
- }
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
- const $5aa5fcb9f8a2bebc$var$rendered_components_with_state_key = new Set();
607
- function $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d(props) {
608
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
609
- // @ts-ignore
610
- solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage),
611
- props: props,
612
- wrapper_type: "div",
613
- wrapper_style: {}
614
- });
615
- }
616
- function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
617
- const depict_category = (0, $4GYXz$solidjs.createMemo)(()=>(0, $2506fd72fd4393aa$export$f4d89133c6985668)("category", props.stateKey, "CategoryPage") // stateKey can change
618
- );
619
- const [category_state_set, set_category_state_set] = (0, $4GYXz$solidjs.createSignal)(false);
620
- const component_portals = new Set();
621
- const [, set_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
622
- // We should only get here once react already has a DOM node which means we should be in the DOM
623
- set_category_page_in_dom(true);
624
- (0, $4GYXz$solidjs.onCleanup)(()=>set_category_page_in_dom(false));
625
- (0, $4GYXz$solidjs.createComputed)(()=>{
626
- const { categoryId: categoryId } = props;
627
- depict_category().category_id = categoryId;
628
- if (categoryId) {
629
- set_category_state_set(true);
630
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
631
- }
632
- });
633
- (0, $4GYXz$solidjs.createComputed)(()=>depict_category().listing_type = props.listingType);
634
- const category = ()=>(0, $4GYXz$solidjs.createMemo)(()=>{
635
- const stateKey = (0, $4GYXz$solidjs.untrack)(()=>props.stateKey);
636
- 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.`);
637
- $5aa5fcb9f8a2bebc$var$rendered_components_with_state_key.add(stateKey);
638
- (0, $4GYXz$solidjs.onCleanup)(()=>$5aa5fcb9f8a2bebc$var$rendered_components_with_state_key.delete(stateKey));
639
- return (0, $4GYXz$depictaiui.CategoryPage)({
640
- depict_category: depict_category(),
641
- get cols_at_size () {
642
- return props.columnsAtSize ?? (0, $4GYXz$depictaiui.defaultColsAtSize);
643
- },
644
- get grid_spacing () {
645
- return props.gridSpacing ?? (0, $4GYXz$depictaiui.defaultGridSpacing);
646
- },
647
- category_title: (0, $4GYXz$solidjs.untrack)(()=>props.categoryTitlePlugin) || (0, $4GYXz$depictaiui.defaultCategoryTitlePlugin),
648
- get show_breadcrumbs () {
649
- return props.showBreadcrumbs;
650
- },
651
- get show_quicklinks () {
652
- return props.showQuicklinks;
653
- },
654
- product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
655
- display: display,
656
- react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
657
- component_portals: component_portals,
658
- set_portals: set_portals
659
- })
660
- });
661
- });
662
- return (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(category, category_state_set);
663
- }
664
-
665
-
666
-
667
-
668
-
669
-
670
- function $d88e98b11c182b8e$export$5646050d516e06bc(react_props) {
671
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
672
- solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($d88e98b11c182b8e$var$vanilla_breadcrumbs),
673
- props: react_props
674
- });
675
- }
676
- function $d88e98b11c182b8e$var$vanilla_breadcrumbs(props) {
677
- // memo so stateKey can be dynamically changed
678
- return (0, $4GYXz$solidjs.createMemo)(()=>{
679
- const depict_category = (0, $2506fd72fd4393aa$export$f4d89133c6985668)("category", props.stateKey, "BreadCrumbs");
680
- return (0, $4GYXz$depictaiui.BreadCrumbs)({
681
- depict_category: depict_category
682
- });
683
- });
684
- }
685
-
686
-
687
-
688
-
689
-
690
-
691
- function $f16af0e861aff3d0$export$466cdc317043f6cb(react_props = {}) {
692
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
693
- solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($f16af0e861aff3d0$var$vanilla_quick_links),
694
- props: react_props
695
- });
696
- }
697
- function $f16af0e861aff3d0$var$vanilla_quick_links(props) {
698
- // memo so stateKey can be dynamically changed
699
- return (0, $4GYXz$solidjs.createMemo)(()=>{
700
- const depict_category = (0, $2506fd72fd4393aa$export$f4d89133c6985668)("category", props.stateKey, "QuickLinks");
701
- return (0, $4GYXz$depictaiui.QuickLinks)({
702
- depict_category: depict_category
703
- });
704
- });
705
- }
706
-
707
-
708
-
709
-
710
-
711
- const $df522c8a81ed5a01$export$3f37af283f8fb843 = (raw_react_props)=>{
712
- const react_props = {
713
- class: raw_react_props.className,
714
- ...raw_react_props
715
- };
716
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
717
- solid_component: (props_store)=>(0, $4GYXz$depictaiui.ImagePlaceholder)(props_store),
718
- props: react_props,
719
- wrapper_type: "span",
720
- hydrate_function_when_ssr: (0, $4GYXz$solidjsweb.hydrate)
721
- });
722
- };
723
-
724
-
725
-
726
-
727
-
728
- const $7c8b440edc188ad5$export$89c6019e4baa40b1 = (raw_react_props)=>{
729
- const react_props = {
730
- class: raw_react_props.className,
731
- ...raw_react_props
732
- };
733
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
734
- solid_component: (props_store)=>(0, $4GYXz$depictaiui.TextPlaceholder)(props_store),
735
- props: react_props,
736
- wrapper_type: "span",
737
- hydrate_function_when_ssr: (0, $4GYXz$solidjsweb.hydrate),
738
- wrapper_style: {
739
- "height": "100%"
740
- }
741
- });
742
- };
743
-
744
-
745
-
746
-
747
-
748
-
749
-
750
-
751
-
752
- const $177ac8f5258066ba$export$d69d8daa20eae175 = (createOpenModalParams)=>{
753
- const { location: location = "centered", alignerRef: alignerRef, stateKey: stateKey } = createOpenModalParams;
754
- let [deduped_variable, set_deduped_variable] = (0, $4GYXz$react.useState)();
755
- // When component using this hook unmounts, "untrack" our component and dispose the search instance if needed
756
- (0, $4GYXz$react.useEffect)(()=>deduped_variable?.[1]?.(), []);
757
- const openModal = ()=>{
758
- // Get the search instance and track this component, but only once (basically work around re-rendering)
759
- // We have to do this in the openModal function since people might call this hook before creating DepictProvider
760
- if (!deduped_variable) {
761
- deduped_variable = (0, $4GYXz$solidjs.createRoot)((dispose)=>[
762
- (0, $2506fd72fd4393aa$export$f4d89133c6985668)("search", stateKey, "useSearchModal"),
763
- dispose
764
- ]);
765
- set_deduped_variable(deduped_variable);
766
- }
767
- const [search] = deduped_variable;
768
- if (location === "aligned" && alignerRef?.current) (0, $4GYXz$depictaiui.open_modal_with_alignment)({
769
- "element": alignerRef.current,
770
- "location": location,
771
- "search": search
772
- });
773
- else (0, $4GYXz$depictaiui.open_modal_with_alignment)({
774
- "location": "centered",
775
- "search": search
776
- });
777
- };
778
- return openModal;
779
- };
780
-
781
-
782
- function $ae73b15c325f1b21$export$912994940e660d32(params = {}) {
783
- const open = (0, $177ac8f5258066ba$export$d69d8daa20eae175)({
784
- globalState: $0b7cd4fb39fc3502$export$8e769ad4338a911e,
785
- ...params
786
- });
787
- return {
788
- open: open
789
- };
790
- }
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
- const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props = {})=>{
799
- // 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.
800
- // Create signal that persists across renders
801
- const [[get_aligner_signal_value, set_aligner_signal_value]] = (0, $4GYXz$react.useState)((0, $4GYXz$solidjs.createSignal)());
802
- // Update signal value when alignerRef changes
803
- set_aligner_signal_value(props?.alignerRef);
804
- // Make sure react never re-renders the actual SearchField component
805
- const componentFunction = (0, $4GYXz$react.useCallback)(()=>(0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
806
- solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(()=>{
807
- return (0, $4GYXz$solidjs.createMemo)(()=>{
808
- const depict_search = (0, $2506fd72fd4393aa$export$f4d89133c6985668)("search", props.stateKey, "useSearchField");
809
- return (0, $4GYXz$depictaiui.SearchField)({
810
- depict_search: depict_search,
811
- get aligner_ref () {
812
- // React mutates the object at some random time so only get the current value once it actually is requested
813
- return get_aligner_signal_value()?.current;
814
- }
815
- });
816
- });
817
- }),
818
- props: {}
819
- }), []);
820
- return {
821
- SearchField: componentFunction
822
- };
823
- };
824
-
825
-
826
-
827
-
828
-
829
-
830
- function $a134ea100690b628$export$6501da23a2770fc() {
831
- return {
832
- fetchRecommendations: $a134ea100690b628$var$fetchRecommendations
833
- };
834
- }
835
- function $a134ea100690b628$var$fetchRecommendations(opts) {
836
- const { merchant: [get_merchant], market: [get_market], userId: [get_userId], sessionId: [get_sessionId] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
837
- const merchant = (0, $4GYXz$solidjs.untrack)(get_merchant);
838
- const market = (0, $4GYXz$solidjs.untrack)(get_market);
839
- if (!merchant || !market) throw new Error("Depict recommendations are not configured. Wrap your app in a DepictProvider.");
840
- return (0, $4GYXz$depictaiui.fetchDepictRecommendations)({
841
- merchant: merchant,
842
- market: market,
843
- userId: (0, $4GYXz$solidjs.untrack)(get_userId),
844
- sessionId: (0, $4GYXz$solidjs.untrack)(get_sessionId),
845
- ...opts
846
- });
847
- }
848
-
849
-
850
-
851
-
852
-
853
-
854
- const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl, { scroll: scroll, replace: replace })=>{
855
- let Page;
856
- (function(Page) {
857
- Page[Page["OTHER"] = 0] = "OTHER";
858
- Page[Page["SEARCH"] = 1] = "SEARCH";
859
- Page[Page["CATEGORY"] = 2] = "CATEGORY";
860
- })(Page || (Page = {}));
861
- const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
862
- const target_u_o = new URL(relativeUrl, location.origin);
863
- const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
864
- router[replace ? "replace" : "push"](relativeUrl, undefined, {
865
- shallow: current_page === target_page && target_page !== Page.OTHER,
866
- scroll: // Can't go shallowly to other pages
867
- scroll
868
- });
869
- };
870
-
871
-
872
- const $b742053c966024b4$export$b8a61e5c71402559 = {
873
- nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35
874
- };
875
-
876
-
877
- (0, $4GYXz$depictaiutilishared.add_to_version_info)("react-ui", (0, $db7b67857900028b$export$83d89fbfd8236492));
878
-
879
-