@depict-ai/react-ui 1.5.3 → 1.5.4

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