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