@depict-ai/react-ui 1.5.3 → 1.5.5

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