@depict-ai/react-ui 0.0.105 → 0.0.106
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/index.d.ts +30 -3
- package/dist/main.js +193 -100
- package/dist/module.js +195 -103
- package/dist-server/index.d.ts +6 -1
- package/dist-server/main.js +15 -1
- package/dist-server/module.js +15 -2
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholderProps, TextPlaceholderProps } from "@depict-ai/ui";
|
|
2
2
|
import { Display } from "@depict-ai/utilishared";
|
|
3
3
|
import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
|
|
4
|
+
import { DPC } from "@depict-ai/dpc";
|
|
4
5
|
import { Locale } from "@depict-ai/ui/locales";
|
|
5
|
-
export const version = "0.0.
|
|
6
|
+
export const version = "0.0.106";
|
|
6
7
|
interface PLPConfig<T extends Display> extends BaseProductListingConfig {
|
|
7
8
|
/**
|
|
8
9
|
* The product card to use for rendering products.
|
|
@@ -20,6 +21,32 @@ export interface DepictProductCardProps<T extends Display> {
|
|
|
20
21
|
* Depict product card to use for rendering products.
|
|
21
22
|
*/
|
|
22
23
|
export type DepictProductCard<T extends Display> = (props: DepictProductCardProps<T>) => ReactNode;
|
|
24
|
+
interface UsePerformanceClientReturn {
|
|
25
|
+
dpc: DPC;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook used to access the Depict Performance Client.
|
|
29
|
+
* Calls on the returned DPC instance can not be done server side.
|
|
30
|
+
* @example
|
|
31
|
+
* Send an add-to-cart event
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { useEffect } from "react";
|
|
34
|
+
* import { usePerformanceClient } from "@depict-ai/react-ui";
|
|
35
|
+
*
|
|
36
|
+
* const ProductPage = ({ productId }) => {
|
|
37
|
+
* const { dpc } = usePerformanceClient();
|
|
38
|
+
*
|
|
39
|
+
* useEffect(() => {
|
|
40
|
+
* dpc.setProductId(productId);
|
|
41
|
+
* }, [dpc]);
|
|
42
|
+
*
|
|
43
|
+
* return <div>Showing product {productId}</div>;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
* @returns {UsePerformanceClientReturn}
|
|
47
|
+
}
|
|
48
|
+
*/
|
|
49
|
+
export const usePerformanceClient: () => UsePerformanceClientReturn;
|
|
23
50
|
/**
|
|
24
51
|
* relativeUrl: The relative url to navigate to.
|
|
25
52
|
* replace: Whether to replace the current url or push a new one.
|
|
@@ -322,7 +349,7 @@ interface UseSearchModalReturn {
|
|
|
322
349
|
* );
|
|
323
350
|
* };
|
|
324
351
|
* ```
|
|
325
|
-
* @returns {
|
|
352
|
+
* @returns {UseSearchModalReturn}
|
|
326
353
|
*/
|
|
327
354
|
export function useSearchModal(params?: UseSearchModalParams): UseSearchModalReturn;
|
|
328
355
|
interface SearchFieldProps {
|
|
@@ -380,7 +407,7 @@ interface UseSearchFieldReturn {
|
|
|
380
407
|
* );
|
|
381
408
|
* };
|
|
382
409
|
* ```
|
|
383
|
-
* @returns {
|
|
410
|
+
* @returns {UseSearchFieldReturn}
|
|
384
411
|
*/
|
|
385
412
|
export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
|
|
386
413
|
/**
|
package/dist/main.js
CHANGED
|
@@ -6,6 +6,8 @@ var $4GYXz$depictaiuilocales = require("@depict-ai/ui/locales");
|
|
|
6
6
|
var $4GYXz$solidjsweb = require("solid-js/web");
|
|
7
7
|
var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
|
|
8
8
|
var $4GYXz$reactdom = require("react-dom");
|
|
9
|
+
var $4GYXz$solidjsstore = require("solid-js/store");
|
|
10
|
+
var $4GYXz$depictaidpc = require("@depict-ai/dpc");
|
|
9
11
|
|
|
10
12
|
function $parcel$export(e, n, v, s) {
|
|
11
13
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -21,6 +23,7 @@ $parcel$export(module.exports, "ImagePlaceholder", () => $df522c8a81ed5a01$expor
|
|
|
21
23
|
$parcel$export(module.exports, "TextPlaceholder", () => $7c8b440edc188ad5$export$89c6019e4baa40b1);
|
|
22
24
|
$parcel$export(module.exports, "useSearchModal", () => $ae73b15c325f1b21$export$912994940e660d32);
|
|
23
25
|
$parcel$export(module.exports, "useSearchField", () => $913da7f4d0bc77f2$export$9bb30bbe003b82e0);
|
|
26
|
+
$parcel$export(module.exports, "usePerformanceClient", () => $25c0a91312868994$export$38b98fae14bd1f64);
|
|
24
27
|
$parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
|
|
25
28
|
$parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
|
|
26
29
|
$parcel$export(module.exports, "fetchDepictRecommendations", () => $b03e4eee8610ebbe$re_export$fetchDepictRecommendations);
|
|
@@ -28,7 +31,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
|
|
|
28
31
|
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
29
32
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
30
33
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
31
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.
|
|
34
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.106";
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
|
|
@@ -37,67 +40,21 @@ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.105";
|
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
|
|
40
|
-
let $6319748b4f0426f0$var$set = false;
|
|
41
|
-
let $6319748b4f0426f0$var$padding_animation;
|
|
42
|
-
function $6319748b4f0426f0$export$6453cbc34515a94d(is_search_page) {
|
|
43
|
-
if ($6319748b4f0426f0$var$set) return; // Just being safe
|
|
44
|
-
$6319748b4f0426f0$var$set = true;
|
|
45
|
-
let should_use_old_scroll = false;
|
|
46
|
-
const old_scrollTo = window.scrollTo;
|
|
47
|
-
window.scrollTo = (...args)=>{
|
|
48
|
-
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
|
|
49
|
-
else should_use_old_scroll = true;
|
|
50
|
-
};
|
|
51
|
-
addEventListener("popstate", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
|
|
52
|
-
if (!is_search_page(location)) {
|
|
53
|
-
$6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
should_use_old_scroll = false;
|
|
57
|
-
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
58
|
-
(0, $4GYXz$depictaiutilishared.observer).wait_for_element(".depict.plp .listing-page").then(()=>{
|
|
59
|
-
$6319748b4f0426f0$var$removeLotsOfPadding();
|
|
60
|
-
});
|
|
61
|
-
}));
|
|
62
|
-
(0, $4GYXz$depictaiutilishared.history_replacer)(()=>{
|
|
63
|
-
(0, $4GYXz$depictaiutilishared.queueMacroTask)(()=>{
|
|
64
|
-
$6319748b4f0426f0$var$removeLotsOfPadding();
|
|
65
|
-
});
|
|
66
|
-
}, false);
|
|
67
|
-
window?.next?.router?.events?.on("routeChangeStart", ()=>{
|
|
68
|
-
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/*
|
|
72
|
-
Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
|
|
73
|
-
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.
|
|
74
|
-
*/ function $6319748b4f0426f0$var$addLotsOfPadding() {
|
|
75
|
-
if ($6319748b4f0426f0$var$padding_animation) return; // We're already showing a bunch of padding
|
|
76
|
-
$6319748b4f0426f0$var$padding_animation = document.body.animate({
|
|
77
|
-
paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
|
|
78
|
-
offset: 0
|
|
79
|
-
}, 1);
|
|
80
|
-
$6319748b4f0426f0$var$padding_animation.pause();
|
|
81
|
-
}
|
|
82
|
-
function $6319748b4f0426f0$var$removeLotsOfPadding() {
|
|
83
|
-
if ($6319748b4f0426f0$var$padding_animation) {
|
|
84
|
-
$6319748b4f0426f0$var$padding_animation.play();
|
|
85
|
-
$6319748b4f0426f0$var$padding_animation = undefined;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
43
|
|
|
90
44
|
|
|
91
45
|
const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
92
46
|
search: null,
|
|
93
47
|
category: null,
|
|
94
48
|
api: null,
|
|
49
|
+
dpc: null,
|
|
95
50
|
userId: undefined,
|
|
96
51
|
sessionId: undefined,
|
|
97
52
|
metaData: undefined,
|
|
98
|
-
|
|
53
|
+
known_category_paths: new Set(),
|
|
99
54
|
search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
|
|
100
|
-
required_state_set_: (0, $4GYXz$solidjs.createSignal)(false)
|
|
55
|
+
required_state_set_: (0, $4GYXz$solidjs.createSignal)(false),
|
|
56
|
+
search_page_in_dom: (0, $4GYXz$solidjs.createSignal)(false),
|
|
57
|
+
category_page_in_dom: (0, $4GYXz$solidjs.createSignal)(false)
|
|
101
58
|
};
|
|
102
59
|
|
|
103
60
|
|
|
@@ -107,7 +64,6 @@ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
|
|
|
107
64
|
|
|
108
65
|
|
|
109
66
|
|
|
110
|
-
|
|
111
67
|
let $b4d0d98857ed9934$var$run_on_href_change;
|
|
112
68
|
let $b4d0d98857ed9934$var$old_href = location.href;
|
|
113
69
|
function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
|
|
@@ -119,19 +75,19 @@ function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
|
|
|
119
75
|
$b4d0d98857ed9934$var$run_on_href_change?.(href);
|
|
120
76
|
$b4d0d98857ed9934$var$old_href = href;
|
|
121
77
|
}));
|
|
122
|
-
const $b4d0d98857ed9934$export$775e6b3892b5ad52 = (url)=>url.pathname == (0, $4GYXz$solidjs.untrack)((0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
|
|
123
|
-
const $b4d0d98857ed9934$export$
|
|
124
|
-
|
|
125
|
-
};
|
|
126
|
-
function $b4d0d98857ed9934$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
|
|
78
|
+
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
|
|
79
|
+
const $b4d0d98857ed9934$export$30c8a12df09be0e4 = (url = location)=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
|
|
80
|
+
function $b4d0d98857ed9934$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}) {
|
|
127
81
|
const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
|
|
128
82
|
const wrapper_element_ref = (0, $4GYXz$react.useRef)();
|
|
83
|
+
const [[store, write_store]] = (0, $4GYXz$react.useState)(()=>(0, $4GYXz$solidjsstore.createStore)(props));
|
|
84
|
+
// Update store when props change
|
|
85
|
+
write_store((0, $4GYXz$solidjsstore.reconcile)(props));
|
|
129
86
|
(0, $4GYXz$react.useEffect)(()=>{
|
|
130
87
|
const wrapper_element = wrapper_element_ref.current;
|
|
131
|
-
const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(
|
|
88
|
+
const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(store, set_portals), wrapper_element);
|
|
132
89
|
return dispose;
|
|
133
90
|
}, []);
|
|
134
|
-
react_render_handler?.(props);
|
|
135
91
|
return (0, $4GYXz$react.createElement)(wrapper_type, {
|
|
136
92
|
ref: wrapper_element_ref,
|
|
137
93
|
style: wrapper_style
|
|
@@ -151,17 +107,14 @@ function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set = (0, $0b7c
|
|
|
151
107
|
};
|
|
152
108
|
}
|
|
153
109
|
async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
|
|
110
|
+
let set_react_has_ran_hooks;
|
|
111
|
+
const react_has_ran_hooks = new Promise((r)=>set_react_has_ran_hooks = r);
|
|
154
112
|
const solid_container = document.createElement("div");
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
m_o.observe(solid_container, {
|
|
161
|
-
childList: true
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(react_template, {
|
|
113
|
+
const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)((props)=>{
|
|
114
|
+
// Sneak in a hook into their product card component
|
|
115
|
+
(0, $4GYXz$react.useEffect)(set_react_has_ran_hooks, []);
|
|
116
|
+
return react_template(props);
|
|
117
|
+
}, {
|
|
165
118
|
display: display
|
|
166
119
|
});
|
|
167
120
|
const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
|
|
@@ -176,23 +129,144 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , co
|
|
|
176
129
|
...component_portals
|
|
177
130
|
]);
|
|
178
131
|
});
|
|
179
|
-
await
|
|
132
|
+
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.
|
|
180
133
|
return [
|
|
181
134
|
solid_container
|
|
182
135
|
];
|
|
183
136
|
}
|
|
184
137
|
|
|
185
138
|
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
let $6319748b4f0426f0$var$set = false;
|
|
142
|
+
let $6319748b4f0426f0$var$padding_animation;
|
|
143
|
+
function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
144
|
+
const are_on_search_or_category_page = ()=>(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() || (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)();
|
|
145
|
+
if ($6319748b4f0426f0$var$set) return; // Just being safe
|
|
146
|
+
$6319748b4f0426f0$var$set = true;
|
|
147
|
+
let should_use_old_scroll = false;
|
|
148
|
+
const old_scrollTo = window.scrollTo;
|
|
149
|
+
const next_router_event_target = $6319748b4f0426f0$var$make_next_router_event_target(); // So we can use once: true
|
|
150
|
+
window.scrollTo = (...args)=>{
|
|
151
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page()) return Reflect.apply(old_scrollTo, window, args);
|
|
152
|
+
else should_use_old_scroll = true;
|
|
153
|
+
};
|
|
154
|
+
// 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
|
|
155
|
+
addEventListener("popstate", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
|
|
156
|
+
if (!are_on_search_or_category_page()) {
|
|
157
|
+
$6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
should_use_old_scroll = false;
|
|
161
|
+
const [get_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
|
|
162
|
+
const [get_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
|
|
163
|
+
const search_page_in_dom = (0, $4GYXz$solidjs.untrack)(get_search_page_in_dom);
|
|
164
|
+
const category_page_in_dom = (0, $4GYXz$solidjs.untrack)(get_category_page_in_dom);
|
|
165
|
+
const new_is_search = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)();
|
|
166
|
+
const new_is_category = (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)();
|
|
167
|
+
let accessor_to_wait_for;
|
|
168
|
+
if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
|
|
169
|
+
// Already on the page we're going to
|
|
170
|
+
$6319748b4f0426f0$var$removeLotsOfPadding();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
174
|
+
if (new_is_search && category_page_in_dom) accessor_to_wait_for = get_search_page_in_dom;
|
|
175
|
+
else if (new_is_category && search_page_in_dom) accessor_to_wait_for = get_category_page_in_dom;
|
|
176
|
+
else accessor_to_wait_for = new_is_search ? get_search_page_in_dom : get_category_page_in_dom;
|
|
177
|
+
(0, $4GYXz$solidjs.createRoot)((dispose)=>(0, $4GYXz$solidjs.createEffect)(()=>{
|
|
178
|
+
if (accessor_to_wait_for()) {
|
|
179
|
+
$6319748b4f0426f0$var$removeLotsOfPadding();
|
|
180
|
+
dispose();
|
|
181
|
+
}
|
|
182
|
+
}));
|
|
183
|
+
}));
|
|
184
|
+
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
|
|
185
|
+
"routeChangeStart", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
|
|
186
|
+
// this is for when we navigate to a new page (replaceState or pushState)
|
|
187
|
+
// We need to ensure that the page doesn't get shorter before the new history entry has been pushed
|
|
188
|
+
// 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
|
|
189
|
+
// The challenge is knowing on routeChangeStart if we're in a popstate (back/forward) or a pushState/replaceState
|
|
190
|
+
// We use the deprecated window.event property for that
|
|
191
|
+
// This is catchified, so we should see in sentry when it starts failing if browsers ever remove it???
|
|
192
|
+
if (window.event instanceof PopStateEvent) return;
|
|
193
|
+
$6319748b4f0426f0$var$addLotsOfPadding();
|
|
194
|
+
next_router_event_target.addEventListener("beforeHistoryChange", (0, $4GYXz$depictaiutilishared.catchify)(()=>(0, $4GYXz$depictaiutilishared.queueMacroTask)($6319748b4f0426f0$var$removeLotsOfPadding)), {
|
|
195
|
+
once: true
|
|
196
|
+
});
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
/*
|
|
200
|
+
Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
|
|
201
|
+
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.
|
|
202
|
+
*/ function $6319748b4f0426f0$var$addLotsOfPadding() {
|
|
203
|
+
if ($6319748b4f0426f0$var$padding_animation) return; // We're already showing a bunch of padding
|
|
204
|
+
$6319748b4f0426f0$var$padding_animation = document.body.animate({
|
|
205
|
+
paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
|
|
206
|
+
offset: 0
|
|
207
|
+
}, 1);
|
|
208
|
+
$6319748b4f0426f0$var$padding_animation.pause();
|
|
209
|
+
}
|
|
210
|
+
function $6319748b4f0426f0$var$removeLotsOfPadding() {
|
|
211
|
+
if ($6319748b4f0426f0$var$padding_animation) {
|
|
212
|
+
$6319748b4f0426f0$var$padding_animation.play();
|
|
213
|
+
$6319748b4f0426f0$var$padding_animation = undefined;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function $6319748b4f0426f0$var$make_next_router_event_target() {
|
|
217
|
+
const next_router_event_target = new EventTarget();
|
|
218
|
+
window?.next?.router?.events?.on("beforeHistoryChange", ()=>next_router_event_target.dispatchEvent(new CustomEvent("beforeHistoryChange")));
|
|
219
|
+
return next_router_event_target;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
186
225
|
const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
187
|
-
|
|
226
|
+
let Page;
|
|
227
|
+
(function(Page) {
|
|
228
|
+
Page[Page["OTHER"] = 0] = "OTHER";
|
|
229
|
+
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
230
|
+
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
231
|
+
})(Page || (Page = {}));
|
|
232
|
+
const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
233
|
+
const target_u_o = new URL(relativeUrl, location.origin);
|
|
234
|
+
const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
188
235
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
189
|
-
shallow:
|
|
236
|
+
shallow: current_page === target_page,
|
|
190
237
|
scroll: true
|
|
191
238
|
});
|
|
192
239
|
};
|
|
193
240
|
|
|
194
241
|
|
|
195
242
|
|
|
243
|
+
|
|
244
|
+
const $25c0a91312868994$export$38b98fae14bd1f64 = ()=>{
|
|
245
|
+
if (!(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc) throw new Error("Depict tracking is not configured. Wrap your app in a DepictProvider.");
|
|
246
|
+
return {
|
|
247
|
+
dpc: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
const $25c0a91312868994$export$47e064413edabf36 = (merchant, market, userId, sessionId)=>{
|
|
251
|
+
if (!merchant) return;
|
|
252
|
+
try {
|
|
253
|
+
let { dpc: dpc } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
254
|
+
if (!dpc) dpc = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).dpc = new (0, $4GYXz$depictaidpc.DPC)(merchant, {
|
|
255
|
+
market: market
|
|
256
|
+
});
|
|
257
|
+
dpc.merchant = merchant;
|
|
258
|
+
dpc.market = market;
|
|
259
|
+
dpc.setUserId(userId);
|
|
260
|
+
dpc.setSessionId(sessionId);
|
|
261
|
+
} catch (e) {
|
|
262
|
+
// Make sure to not break the users app if we throw
|
|
263
|
+
queueMicrotask(()=>{
|
|
264
|
+
throw e;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
|
|
196
270
|
function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
|
|
197
271
|
const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId , sessionId: sessionId } = props;
|
|
198
272
|
const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.en);
|
|
@@ -201,13 +275,13 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
|
|
|
201
275
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId = userId;
|
|
202
276
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId = sessionId;
|
|
203
277
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
|
|
278
|
+
(0, $25c0a91312868994$export$47e064413edabf36)(merchant, market, userId, sessionId);
|
|
204
279
|
if (!market || !merchant) {
|
|
205
280
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
|
|
206
281
|
return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
|
|
207
282
|
}
|
|
208
283
|
try {
|
|
209
|
-
const { search: search , category: category , api: api } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
210
|
-
const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
|
|
284
|
+
const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
211
285
|
if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
|
|
212
286
|
const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
|
|
213
287
|
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
|
|
@@ -252,7 +326,7 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
|
|
|
252
326
|
category.merchant = merchant;
|
|
253
327
|
category.localization = usedLocale;
|
|
254
328
|
}
|
|
255
|
-
(0, $6319748b4f0426f0$export$6453cbc34515a94d)(
|
|
329
|
+
(0, $6319748b4f0426f0$export$6453cbc34515a94d)();
|
|
256
330
|
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
257
331
|
} catch (e) {
|
|
258
332
|
// Make sure to not break the users app if we throw
|
|
@@ -298,6 +372,10 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
298
372
|
const update_updating_blocked_signal = ()=>{
|
|
299
373
|
set_search_query_updating_blocked_signal(!(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(location));
|
|
300
374
|
};
|
|
375
|
+
const [, set_search_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_in_dom;
|
|
376
|
+
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
377
|
+
set_search_page_in_dom(true);
|
|
378
|
+
(0, $4GYXz$solidjs.onCleanup)(()=>set_search_page_in_dom(false));
|
|
301
379
|
// 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
|
|
302
380
|
(0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
|
|
303
381
|
(0, $4GYXz$solidjs.createComputed)(()=>{
|
|
@@ -307,8 +385,8 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
307
385
|
const component_portals = new Set();
|
|
308
386
|
return (0, $4GYXz$depictaiui.SearchPage)({
|
|
309
387
|
// Default config goes here
|
|
310
|
-
include_input_field: props.includeInputField ?? true,
|
|
311
|
-
cols_at_size: props.columnsAtSize ?? [
|
|
388
|
+
include_input_field: (0, $4GYXz$solidjs.untrack)(()=>props.includeInputField) ?? true,
|
|
389
|
+
cols_at_size: (0, $4GYXz$solidjs.untrack)(()=>props.columnsAtSize) ?? [
|
|
312
390
|
[
|
|
313
391
|
4
|
|
314
392
|
],
|
|
@@ -321,11 +399,11 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
321
399
|
901
|
|
322
400
|
]
|
|
323
401
|
],
|
|
324
|
-
grid_spacing: props.gridSpacing ?? "2%",
|
|
402
|
+
grid_spacing: (0, $4GYXz$solidjs.untrack)(()=>props.gridSpacing) ?? "2%",
|
|
325
403
|
depict_search: depict_search,
|
|
326
404
|
product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
|
|
327
405
|
display: display,
|
|
328
|
-
react_template: props.productCard,
|
|
406
|
+
react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
|
|
329
407
|
component_portals: component_portals,
|
|
330
408
|
set_portals: set_portals
|
|
331
409
|
})
|
|
@@ -337,25 +415,30 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
337
415
|
|
|
338
416
|
|
|
339
417
|
|
|
340
|
-
let $5aa5fcb9f8a2bebc$var$render_cb;
|
|
341
418
|
function $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d(props) {
|
|
342
419
|
return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(// @ts-ignore
|
|
343
|
-
(0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {}
|
|
420
|
+
(0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {});
|
|
344
421
|
}
|
|
345
422
|
function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
346
423
|
const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
|
|
347
424
|
if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
|
|
348
425
|
const [category_state_set, set_category_state_set] = (0, $4GYXz$solidjs.createSignal)(false);
|
|
349
|
-
$5aa5fcb9f8a2bebc$var$render_cb = (props)=>{
|
|
350
|
-
depict_category.category_id = props.categoryId;
|
|
351
|
-
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path = location.pathname;
|
|
352
|
-
if (props.categoryId) set_category_state_set(true);
|
|
353
|
-
};
|
|
354
|
-
$5aa5fcb9f8a2bebc$var$render_cb(props);
|
|
355
426
|
const component_portals = new Set();
|
|
427
|
+
const [, set_category_page_in_dom] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_page_in_dom;
|
|
428
|
+
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
429
|
+
set_category_page_in_dom(true);
|
|
430
|
+
(0, $4GYXz$solidjs.onCleanup)(()=>set_category_page_in_dom(false));
|
|
431
|
+
(0, $4GYXz$solidjs.createComputed)(()=>{
|
|
432
|
+
const { categoryId: categoryId } = props;
|
|
433
|
+
depict_category.category_id = categoryId;
|
|
434
|
+
if (categoryId) {
|
|
435
|
+
set_category_state_set(true);
|
|
436
|
+
(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
356
439
|
const category = ()=>(0, $4GYXz$depictaiui.CategoryPage)({
|
|
357
440
|
depict_category: depict_category,
|
|
358
|
-
cols_at_size: props.columnsAtSize ?? [
|
|
441
|
+
cols_at_size: (0, $4GYXz$solidjs.untrack)(()=>props.columnsAtSize) ?? [
|
|
359
442
|
[
|
|
360
443
|
4
|
|
361
444
|
],
|
|
@@ -368,13 +451,13 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
368
451
|
901
|
|
369
452
|
]
|
|
370
453
|
],
|
|
371
|
-
grid_spacing: props.gridSpacing ?? "2%",
|
|
372
|
-
category_title: props.categoryTitlePlugin || (0, $4GYXz$depictaiui.CategoryTitle),
|
|
373
|
-
show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
|
|
374
|
-
show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
|
|
454
|
+
grid_spacing: (0, $4GYXz$solidjs.untrack)(()=>props.gridSpacing) ?? "2%",
|
|
455
|
+
category_title: (0, $4GYXz$solidjs.untrack)(()=>props.categoryTitlePlugin) || (0, $4GYXz$depictaiui.CategoryTitle),
|
|
456
|
+
show_breadcrumbs: (0, $4GYXz$solidjs.untrack)(()=>props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs),
|
|
457
|
+
show_quicklinks: (0, $4GYXz$solidjs.untrack)(()=>props.showQuicklinks === undefined ? true : props.showQuicklinks),
|
|
375
458
|
product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
|
|
376
459
|
display: display,
|
|
377
|
-
react_template: props.productCard,
|
|
460
|
+
react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
|
|
378
461
|
component_portals: component_portals,
|
|
379
462
|
set_portals: set_portals
|
|
380
463
|
})
|
|
@@ -415,10 +498,11 @@ function $f16af0e861aff3d0$var$vanilla_quick_links() {
|
|
|
415
498
|
|
|
416
499
|
|
|
417
500
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
501
|
+
|
|
502
|
+
const $df522c8a81ed5a01$export$3f37af283f8fb843 = (props)=>{
|
|
503
|
+
return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((solid_props_store)=>(0, $4GYXz$solidjs.createMemo)(()=>(0, $4GYXz$depictaiutilishared.ContainedPlaceholderImage)({
|
|
504
|
+
aspect_ratio: solid_props_store.aspectRatio
|
|
505
|
+
})), props, "div", {
|
|
422
506
|
"height": "100%"
|
|
423
507
|
});
|
|
424
508
|
};
|
|
@@ -498,10 +582,19 @@ const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props)=>{
|
|
|
498
582
|
|
|
499
583
|
|
|
500
584
|
|
|
585
|
+
|
|
501
586
|
const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
502
|
-
|
|
587
|
+
let Page;
|
|
588
|
+
(function(Page) {
|
|
589
|
+
Page[Page["OTHER"] = 0] = "OTHER";
|
|
590
|
+
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
591
|
+
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
592
|
+
})(Page || (Page = {}));
|
|
593
|
+
const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
594
|
+
const target_u_o = new URL(relativeUrl, location.origin);
|
|
595
|
+
const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
503
596
|
router.push(relativeUrl, undefined, {
|
|
504
|
-
shallow:
|
|
597
|
+
shallow: current_page === target_page,
|
|
505
598
|
scroll: true
|
|
506
599
|
});
|
|
507
600
|
};
|
package/dist/module.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {add_to_version_info as $TZSbU$add_to_version_info, catchify as $TZSbU$catchify,
|
|
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, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
|
|
2
2
|
import {CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, fetchDepictRecommendations as $43099132aad1ceb6$re_export$fetchDepictRecommendations, DepictAPI as $TZSbU$DepictAPI, 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, CategoryPage as $TZSbU$CategoryPage, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, open_modal_with_alignment as $TZSbU$open_modal_with_alignment, SearchField as $TZSbU$SearchField} from "@depict-ai/ui";
|
|
3
|
-
import {createRoot as $TZSbU$createRoot, untrack as $TZSbU$untrack,
|
|
3
|
+
import {createRoot as $TZSbU$createRoot, untrack as $TZSbU$untrack, createEffect as $TZSbU$createEffect, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createSignal as $TZSbU$createSignal, createComputed as $TZSbU$createComputed, createMemo as $TZSbU$createMemo} from "solid-js";
|
|
4
4
|
import {createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, forwardRef as $TZSbU$forwardRef} from "react";
|
|
5
5
|
import {en as $TZSbU$en} from "@depict-ai/ui/locales";
|
|
6
6
|
import {render as $TZSbU$render} from "solid-js/web";
|
|
7
7
|
import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
|
|
8
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";
|
|
9
11
|
|
|
10
12
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
11
13
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
12
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.
|
|
14
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.106";
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
@@ -18,67 +20,21 @@ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.105";
|
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
let $8071251ee4e9ffa1$var$set = false;
|
|
22
|
-
let $8071251ee4e9ffa1$var$padding_animation;
|
|
23
|
-
function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
|
|
24
|
-
if ($8071251ee4e9ffa1$var$set) return; // Just being safe
|
|
25
|
-
$8071251ee4e9ffa1$var$set = true;
|
|
26
|
-
let should_use_old_scroll = false;
|
|
27
|
-
const old_scrollTo = window.scrollTo;
|
|
28
|
-
window.scrollTo = (...args)=>{
|
|
29
|
-
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
|
|
30
|
-
else should_use_old_scroll = true;
|
|
31
|
-
};
|
|
32
|
-
addEventListener("popstate", (0, $TZSbU$catchify)(()=>{
|
|
33
|
-
if (!is_search_page(location)) {
|
|
34
|
-
$8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
should_use_old_scroll = false;
|
|
38
|
-
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
39
|
-
(0, $TZSbU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
|
|
40
|
-
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
41
|
-
});
|
|
42
|
-
}));
|
|
43
|
-
(0, $TZSbU$history_replacer)(()=>{
|
|
44
|
-
(0, $TZSbU$queueMacroTask)(()=>{
|
|
45
|
-
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
46
|
-
});
|
|
47
|
-
}, false);
|
|
48
|
-
window?.next?.router?.events?.on("routeChangeStart", ()=>{
|
|
49
|
-
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/*
|
|
53
|
-
Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
|
|
54
|
-
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.
|
|
55
|
-
*/ function $8071251ee4e9ffa1$var$addLotsOfPadding() {
|
|
56
|
-
if ($8071251ee4e9ffa1$var$padding_animation) return; // We're already showing a bunch of padding
|
|
57
|
-
$8071251ee4e9ffa1$var$padding_animation = document.body.animate({
|
|
58
|
-
paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
|
|
59
|
-
offset: 0
|
|
60
|
-
}, 1);
|
|
61
|
-
$8071251ee4e9ffa1$var$padding_animation.pause();
|
|
62
|
-
}
|
|
63
|
-
function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
|
|
64
|
-
if ($8071251ee4e9ffa1$var$padding_animation) {
|
|
65
|
-
$8071251ee4e9ffa1$var$padding_animation.play();
|
|
66
|
-
$8071251ee4e9ffa1$var$padding_animation = undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
23
|
|
|
71
24
|
|
|
72
25
|
const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
73
26
|
search: null,
|
|
74
27
|
category: null,
|
|
75
28
|
api: null,
|
|
29
|
+
dpc: null,
|
|
76
30
|
userId: undefined,
|
|
77
31
|
sessionId: undefined,
|
|
78
32
|
metaData: undefined,
|
|
79
|
-
|
|
33
|
+
known_category_paths: new Set(),
|
|
80
34
|
search_page_path_: (0, $TZSbU$createSignal)(),
|
|
81
|
-
required_state_set_: (0, $TZSbU$createSignal)(false)
|
|
35
|
+
required_state_set_: (0, $TZSbU$createSignal)(false),
|
|
36
|
+
search_page_in_dom: (0, $TZSbU$createSignal)(false),
|
|
37
|
+
category_page_in_dom: (0, $TZSbU$createSignal)(false)
|
|
82
38
|
};
|
|
83
39
|
|
|
84
40
|
|
|
@@ -88,7 +44,6 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
|
|
|
88
44
|
|
|
89
45
|
|
|
90
46
|
|
|
91
|
-
|
|
92
47
|
let $c83ba9ab79386687$var$run_on_href_change;
|
|
93
48
|
let $c83ba9ab79386687$var$old_href = location.href;
|
|
94
49
|
function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
|
|
@@ -100,19 +55,19 @@ function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
|
|
|
100
55
|
$c83ba9ab79386687$var$run_on_href_change?.(href);
|
|
101
56
|
$c83ba9ab79386687$var$old_href = href;
|
|
102
57
|
}));
|
|
103
|
-
const $c83ba9ab79386687$export$775e6b3892b5ad52 = (url)=>url.pathname == (0, $TZSbU$untrack)((0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0]); // might have changed therefore get it from globalState
|
|
104
|
-
const $c83ba9ab79386687$export$
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
|
|
58
|
+
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
|
|
59
|
+
const $c83ba9ab79386687$export$30c8a12df09be0e4 = (url = location)=>(0, $42858f023ef23dab$export$8e769ad4338a911e).known_category_paths.has(url.pathname);
|
|
60
|
+
function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}) {
|
|
108
61
|
const [portals, set_portals] = (0, $TZSbU$useState)([]);
|
|
109
62
|
const wrapper_element_ref = (0, $TZSbU$useRef)();
|
|
63
|
+
const [[store, write_store]] = (0, $TZSbU$useState)(()=>(0, $TZSbU$createStore)(props));
|
|
64
|
+
// Update store when props change
|
|
65
|
+
write_store((0, $TZSbU$reconcile)(props));
|
|
110
66
|
(0, $TZSbU$useEffect)(()=>{
|
|
111
67
|
const wrapper_element = wrapper_element_ref.current;
|
|
112
|
-
const dispose = (0, $TZSbU$render)(()=>solid_component(
|
|
68
|
+
const dispose = (0, $TZSbU$render)(()=>solid_component(store, set_portals), wrapper_element);
|
|
113
69
|
return dispose;
|
|
114
70
|
}, []);
|
|
115
|
-
react_render_handler?.(props);
|
|
116
71
|
return (0, $TZSbU$createElement)(wrapper_type, {
|
|
117
72
|
ref: wrapper_element_ref,
|
|
118
73
|
style: wrapper_style
|
|
@@ -132,17 +87,14 @@ function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $4285
|
|
|
132
87
|
};
|
|
133
88
|
}
|
|
134
89
|
async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
|
|
90
|
+
let set_react_has_ran_hooks;
|
|
91
|
+
const react_has_ran_hooks = new Promise((r)=>set_react_has_ran_hooks = r);
|
|
135
92
|
const solid_container = document.createElement("div");
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
m_o.observe(solid_container, {
|
|
142
|
-
childList: true
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
const reactProductCard = (0, $TZSbU$jsx)(react_template, {
|
|
93
|
+
const reactProductCard = (0, $TZSbU$jsx)((props)=>{
|
|
94
|
+
// Sneak in a hook into their product card component
|
|
95
|
+
(0, $TZSbU$useEffect)(set_react_has_ran_hooks, []);
|
|
96
|
+
return react_template(props);
|
|
97
|
+
}, {
|
|
146
98
|
display: display
|
|
147
99
|
});
|
|
148
100
|
const portal = $TZSbU$createPortal(reactProductCard, solid_container);
|
|
@@ -157,23 +109,144 @@ async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , co
|
|
|
157
109
|
...component_portals
|
|
158
110
|
]);
|
|
159
111
|
});
|
|
160
|
-
await
|
|
112
|
+
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.
|
|
161
113
|
return [
|
|
162
114
|
solid_container
|
|
163
115
|
];
|
|
164
116
|
}
|
|
165
117
|
|
|
166
118
|
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
let $8071251ee4e9ffa1$var$set = false;
|
|
122
|
+
let $8071251ee4e9ffa1$var$padding_animation;
|
|
123
|
+
function $8071251ee4e9ffa1$export$6453cbc34515a94d() {
|
|
124
|
+
const are_on_search_or_category_page = ()=>(0, $c83ba9ab79386687$export$775e6b3892b5ad52)() || (0, $c83ba9ab79386687$export$30c8a12df09be0e4)();
|
|
125
|
+
if ($8071251ee4e9ffa1$var$set) return; // Just being safe
|
|
126
|
+
$8071251ee4e9ffa1$var$set = true;
|
|
127
|
+
let should_use_old_scroll = false;
|
|
128
|
+
const old_scrollTo = window.scrollTo;
|
|
129
|
+
const next_router_event_target = $8071251ee4e9ffa1$var$make_next_router_event_target(); // So we can use once: true
|
|
130
|
+
window.scrollTo = (...args)=>{
|
|
131
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page()) return Reflect.apply(old_scrollTo, window, args);
|
|
132
|
+
else should_use_old_scroll = true;
|
|
133
|
+
};
|
|
134
|
+
// 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
|
|
135
|
+
addEventListener("popstate", (0, $TZSbU$catchify)(()=>{
|
|
136
|
+
if (!are_on_search_or_category_page()) {
|
|
137
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
should_use_old_scroll = false;
|
|
141
|
+
const [get_search_page_in_dom] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_in_dom;
|
|
142
|
+
const [get_category_page_in_dom] = (0, $42858f023ef23dab$export$8e769ad4338a911e).category_page_in_dom;
|
|
143
|
+
const search_page_in_dom = (0, $TZSbU$untrack)(get_search_page_in_dom);
|
|
144
|
+
const category_page_in_dom = (0, $TZSbU$untrack)(get_category_page_in_dom);
|
|
145
|
+
const new_is_search = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)();
|
|
146
|
+
const new_is_category = (0, $c83ba9ab79386687$export$30c8a12df09be0e4)();
|
|
147
|
+
let accessor_to_wait_for;
|
|
148
|
+
if (search_page_in_dom && new_is_search || category_page_in_dom && new_is_category) {
|
|
149
|
+
// Already on the page we're going to
|
|
150
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
154
|
+
if (new_is_search && category_page_in_dom) accessor_to_wait_for = get_search_page_in_dom;
|
|
155
|
+
else if (new_is_category && search_page_in_dom) accessor_to_wait_for = get_category_page_in_dom;
|
|
156
|
+
else accessor_to_wait_for = new_is_search ? get_search_page_in_dom : get_category_page_in_dom;
|
|
157
|
+
(0, $TZSbU$createRoot)((dispose)=>(0, $TZSbU$createEffect)(()=>{
|
|
158
|
+
if (accessor_to_wait_for()) {
|
|
159
|
+
$8071251ee4e9ffa1$var$removeLotsOfPadding();
|
|
160
|
+
dispose();
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
}));
|
|
164
|
+
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
|
|
165
|
+
"routeChangeStart", (0, $TZSbU$catchify)(()=>{
|
|
166
|
+
// this is for when we navigate to a new page (replaceState or pushState)
|
|
167
|
+
// We need to ensure that the page doesn't get shorter before the new history entry has been pushed
|
|
168
|
+
// 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
|
|
169
|
+
// The challenge is knowing on routeChangeStart if we're in a popstate (back/forward) or a pushState/replaceState
|
|
170
|
+
// We use the deprecated window.event property for that
|
|
171
|
+
// This is catchified, so we should see in sentry when it starts failing if browsers ever remove it???
|
|
172
|
+
if (window.event instanceof PopStateEvent) return;
|
|
173
|
+
$8071251ee4e9ffa1$var$addLotsOfPadding();
|
|
174
|
+
next_router_event_target.addEventListener("beforeHistoryChange", (0, $TZSbU$catchify)(()=>(0, $TZSbU$queueMacroTask)($8071251ee4e9ffa1$var$removeLotsOfPadding)), {
|
|
175
|
+
once: true
|
|
176
|
+
});
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
/*
|
|
180
|
+
Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
|
|
181
|
+
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.
|
|
182
|
+
*/ function $8071251ee4e9ffa1$var$addLotsOfPadding() {
|
|
183
|
+
if ($8071251ee4e9ffa1$var$padding_animation) return; // We're already showing a bunch of padding
|
|
184
|
+
$8071251ee4e9ffa1$var$padding_animation = document.body.animate({
|
|
185
|
+
paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
|
|
186
|
+
offset: 0
|
|
187
|
+
}, 1);
|
|
188
|
+
$8071251ee4e9ffa1$var$padding_animation.pause();
|
|
189
|
+
}
|
|
190
|
+
function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
|
|
191
|
+
if ($8071251ee4e9ffa1$var$padding_animation) {
|
|
192
|
+
$8071251ee4e9ffa1$var$padding_animation.play();
|
|
193
|
+
$8071251ee4e9ffa1$var$padding_animation = undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function $8071251ee4e9ffa1$var$make_next_router_event_target() {
|
|
197
|
+
const next_router_event_target = new EventTarget();
|
|
198
|
+
window?.next?.router?.events?.on("beforeHistoryChange", ()=>next_router_event_target.dispatchEvent(new CustomEvent("beforeHistoryChange")));
|
|
199
|
+
return next_router_event_target;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
167
205
|
const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
168
|
-
|
|
206
|
+
let Page;
|
|
207
|
+
(function(Page) {
|
|
208
|
+
Page[Page["OTHER"] = 0] = "OTHER";
|
|
209
|
+
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
210
|
+
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
211
|
+
})(Page || (Page = {}));
|
|
212
|
+
const current_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
213
|
+
const target_u_o = new URL(relativeUrl, location.origin);
|
|
214
|
+
const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
169
215
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
170
|
-
shallow:
|
|
216
|
+
shallow: current_page === target_page,
|
|
171
217
|
scroll: true
|
|
172
218
|
});
|
|
173
219
|
};
|
|
174
220
|
|
|
175
221
|
|
|
176
222
|
|
|
223
|
+
|
|
224
|
+
const $a00d8f27abd5d0b0$export$38b98fae14bd1f64 = ()=>{
|
|
225
|
+
if (!(0, $42858f023ef23dab$export$8e769ad4338a911e).dpc) throw new Error("Depict tracking is not configured. Wrap your app in a DepictProvider.");
|
|
226
|
+
return {
|
|
227
|
+
dpc: (0, $42858f023ef23dab$export$8e769ad4338a911e).dpc
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
const $a00d8f27abd5d0b0$export$47e064413edabf36 = (merchant, market, userId, sessionId)=>{
|
|
231
|
+
if (!merchant) return;
|
|
232
|
+
try {
|
|
233
|
+
let { dpc: dpc } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
234
|
+
if (!dpc) dpc = (0, $42858f023ef23dab$export$8e769ad4338a911e).dpc = new (0, $TZSbU$DPC)(merchant, {
|
|
235
|
+
market: market
|
|
236
|
+
});
|
|
237
|
+
dpc.merchant = merchant;
|
|
238
|
+
dpc.market = market;
|
|
239
|
+
dpc.setUserId(userId);
|
|
240
|
+
dpc.setSessionId(sessionId);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
// Make sure to not break the users app if we throw
|
|
243
|
+
queueMicrotask(()=>{
|
|
244
|
+
throw e;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
|
|
177
250
|
function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
|
|
178
251
|
const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId , sessionId: sessionId } = props;
|
|
179
252
|
const usedLocale = locale ?? (0, $TZSbU$en);
|
|
@@ -182,13 +255,13 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
|
|
|
182
255
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).userId = userId;
|
|
183
256
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId = sessionId;
|
|
184
257
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData = metaData;
|
|
258
|
+
(0, $a00d8f27abd5d0b0$export$47e064413edabf36)(merchant, market, userId, sessionId);
|
|
185
259
|
if (!market || !merchant) {
|
|
186
260
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
|
|
187
261
|
return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
|
|
188
262
|
}
|
|
189
263
|
try {
|
|
190
|
-
const { search: search , category: category , api: api } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
191
|
-
const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
|
|
264
|
+
const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
192
265
|
if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
|
|
193
266
|
const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
|
|
194
267
|
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
|
|
@@ -233,7 +306,7 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
|
|
|
233
306
|
category.merchant = merchant;
|
|
234
307
|
category.localization = usedLocale;
|
|
235
308
|
}
|
|
236
|
-
(0, $8071251ee4e9ffa1$export$6453cbc34515a94d)(
|
|
309
|
+
(0, $8071251ee4e9ffa1$export$6453cbc34515a94d)();
|
|
237
310
|
(0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
|
|
238
311
|
} catch (e) {
|
|
239
312
|
// Make sure to not break the users app if we throw
|
|
@@ -279,6 +352,10 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
279
352
|
const update_updating_blocked_signal = ()=>{
|
|
280
353
|
set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$775e6b3892b5ad52)(location));
|
|
281
354
|
};
|
|
355
|
+
const [, set_search_page_in_dom] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_in_dom;
|
|
356
|
+
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
357
|
+
set_search_page_in_dom(true);
|
|
358
|
+
(0, $TZSbU$onCleanup)(()=>set_search_page_in_dom(false));
|
|
282
359
|
// 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
|
|
283
360
|
(0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
|
|
284
361
|
(0, $TZSbU$createComputed)(()=>{
|
|
@@ -288,8 +365,8 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
288
365
|
const component_portals = new Set();
|
|
289
366
|
return (0, $TZSbU$SearchPage)({
|
|
290
367
|
// Default config goes here
|
|
291
|
-
include_input_field: props.includeInputField ?? true,
|
|
292
|
-
cols_at_size: props.columnsAtSize ?? [
|
|
368
|
+
include_input_field: (0, $TZSbU$untrack)(()=>props.includeInputField) ?? true,
|
|
369
|
+
cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? [
|
|
293
370
|
[
|
|
294
371
|
4
|
|
295
372
|
],
|
|
@@ -302,11 +379,11 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
302
379
|
901
|
|
303
380
|
]
|
|
304
381
|
],
|
|
305
|
-
grid_spacing: props.gridSpacing ?? "2%",
|
|
382
|
+
grid_spacing: (0, $TZSbU$untrack)(()=>props.gridSpacing) ?? "2%",
|
|
306
383
|
depict_search: depict_search,
|
|
307
384
|
product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
308
385
|
display: display,
|
|
309
|
-
react_template: props.productCard,
|
|
386
|
+
react_template: (0, $TZSbU$untrack)(()=>props.productCard),
|
|
310
387
|
component_portals: component_portals,
|
|
311
388
|
set_portals: set_portals
|
|
312
389
|
})
|
|
@@ -318,25 +395,30 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
318
395
|
|
|
319
396
|
|
|
320
397
|
|
|
321
|
-
let $48d7f568740a317d$var$render_cb;
|
|
322
398
|
function $48d7f568740a317d$export$f7d2f673fc2f091d(props) {
|
|
323
399
|
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(// @ts-ignore
|
|
324
|
-
(0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {}
|
|
400
|
+
(0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {});
|
|
325
401
|
}
|
|
326
402
|
function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
|
|
327
403
|
const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
|
|
328
404
|
if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
|
|
329
405
|
const [category_state_set, set_category_state_set] = (0, $TZSbU$createSignal)(false);
|
|
330
|
-
$48d7f568740a317d$var$render_cb = (props)=>{
|
|
331
|
-
depict_category.category_id = props.categoryId;
|
|
332
|
-
(0, $42858f023ef23dab$export$8e769ad4338a911e).category_path = location.pathname;
|
|
333
|
-
if (props.categoryId) set_category_state_set(true);
|
|
334
|
-
};
|
|
335
|
-
$48d7f568740a317d$var$render_cb(props);
|
|
336
406
|
const component_portals = new Set();
|
|
407
|
+
const [, set_category_page_in_dom] = (0, $42858f023ef23dab$export$8e769ad4338a911e).category_page_in_dom;
|
|
408
|
+
// We should only get here once react already has a DOM node which means we should be in the DOM
|
|
409
|
+
set_category_page_in_dom(true);
|
|
410
|
+
(0, $TZSbU$onCleanup)(()=>set_category_page_in_dom(false));
|
|
411
|
+
(0, $TZSbU$createComputed)(()=>{
|
|
412
|
+
const { categoryId: categoryId } = props;
|
|
413
|
+
depict_category.category_id = categoryId;
|
|
414
|
+
if (categoryId) {
|
|
415
|
+
set_category_state_set(true);
|
|
416
|
+
(0, $42858f023ef23dab$export$8e769ad4338a911e).known_category_paths.add(location.pathname);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
337
419
|
const category = ()=>(0, $TZSbU$CategoryPage)({
|
|
338
420
|
depict_category: depict_category,
|
|
339
|
-
cols_at_size: props.columnsAtSize ?? [
|
|
421
|
+
cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? [
|
|
340
422
|
[
|
|
341
423
|
4
|
|
342
424
|
],
|
|
@@ -349,13 +431,13 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
|
|
|
349
431
|
901
|
|
350
432
|
]
|
|
351
433
|
],
|
|
352
|
-
grid_spacing: props.gridSpacing ?? "2%",
|
|
353
|
-
category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
|
|
354
|
-
show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
|
|
355
|
-
show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
|
|
434
|
+
grid_spacing: (0, $TZSbU$untrack)(()=>props.gridSpacing) ?? "2%",
|
|
435
|
+
category_title: (0, $TZSbU$untrack)(()=>props.categoryTitlePlugin) || (0, $43099132aad1ceb6$re_export$CategoryTitle),
|
|
436
|
+
show_breadcrumbs: (0, $TZSbU$untrack)(()=>props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs),
|
|
437
|
+
show_quicklinks: (0, $TZSbU$untrack)(()=>props.showQuicklinks === undefined ? true : props.showQuicklinks),
|
|
356
438
|
product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
357
439
|
display: display,
|
|
358
|
-
react_template: props.productCard,
|
|
440
|
+
react_template: (0, $TZSbU$untrack)(()=>props.productCard),
|
|
359
441
|
component_portals: component_portals,
|
|
360
442
|
set_portals: set_portals
|
|
361
443
|
})
|
|
@@ -396,10 +478,11 @@ function $b68a14248b7ef667$var$vanilla_quick_links() {
|
|
|
396
478
|
|
|
397
479
|
|
|
398
480
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
481
|
+
|
|
482
|
+
const $f446a84f85ba06f6$export$3f37af283f8fb843 = (props)=>{
|
|
483
|
+
return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((solid_props_store)=>(0, $TZSbU$createMemo)(()=>(0, $TZSbU$ContainedPlaceholderImage)({
|
|
484
|
+
aspect_ratio: solid_props_store.aspectRatio
|
|
485
|
+
})), props, "div", {
|
|
403
486
|
"height": "100%"
|
|
404
487
|
});
|
|
405
488
|
};
|
|
@@ -479,10 +562,19 @@ const $2b886cf548a4775c$export$9bb30bbe003b82e0 = (props)=>{
|
|
|
479
562
|
|
|
480
563
|
|
|
481
564
|
|
|
565
|
+
|
|
482
566
|
const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
483
|
-
|
|
567
|
+
let Page;
|
|
568
|
+
(function(Page) {
|
|
569
|
+
Page[Page["OTHER"] = 0] = "OTHER";
|
|
570
|
+
Page[Page["SEARCH"] = 1] = "SEARCH";
|
|
571
|
+
Page[Page["CATEGORY"] = 2] = "CATEGORY";
|
|
572
|
+
})(Page || (Page = {}));
|
|
573
|
+
const current_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
574
|
+
const target_u_o = new URL(relativeUrl, location.origin);
|
|
575
|
+
const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
484
576
|
router.push(relativeUrl, undefined, {
|
|
485
|
-
shallow:
|
|
577
|
+
shallow: current_page === target_page,
|
|
486
578
|
scroll: true
|
|
487
579
|
});
|
|
488
580
|
};
|
|
@@ -496,4 +588,4 @@ const $97603d19204ec48d$export$b8a61e5c71402559 = {
|
|
|
496
588
|
(0, $TZSbU$add_to_version_info)("react-ui", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
|
|
497
589
|
|
|
498
590
|
|
|
499
|
-
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, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $43099132aad1ceb6$re_export$fetchDepictRecommendations as fetchDepictRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
|
|
591
|
+
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, $a00d8f27abd5d0b0$export$38b98fae14bd1f64 as usePerformanceClient, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $43099132aad1ceb6$re_export$fetchDepictRecommendations as fetchDepictRecommendations, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
|
package/dist-server/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
+
import { DPC } from "@depict-ai/dpc";
|
|
2
3
|
type OpenModal = () => void;
|
|
3
4
|
interface UseSearchModalReturn {
|
|
4
5
|
open: OpenModal;
|
|
@@ -9,7 +10,10 @@ interface UseSearchFieldReturn {
|
|
|
9
10
|
*/
|
|
10
11
|
SearchField: () => ReactElement;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
interface UsePerformanceClientReturn {
|
|
14
|
+
dpc: DPC;
|
|
15
|
+
}
|
|
16
|
+
export const version = "0.0.106";
|
|
13
17
|
export const fetchDepictRecommendations: any;
|
|
14
18
|
export function DepictProvider(props: any): any;
|
|
15
19
|
export function SearchPage(): any;
|
|
@@ -27,3 +31,4 @@ export function TextPlaceholder(): any;
|
|
|
27
31
|
export function useSearchField(): UseSearchFieldReturn;
|
|
28
32
|
export function openModal(): void;
|
|
29
33
|
export function useSearchModal(): UseSearchModalReturn;
|
|
34
|
+
export function usePerformanceClient(): UsePerformanceClientReturn;
|
package/dist-server/main.js
CHANGED
|
@@ -17,10 +17,11 @@ $parcel$export(module.exports, "TextPlaceholder", () => $41e7e5d85b5e0d49$export
|
|
|
17
17
|
$parcel$export(module.exports, "useSearchField", () => $41e7e5d85b5e0d49$export$9bb30bbe003b82e0);
|
|
18
18
|
$parcel$export(module.exports, "openModal", () => $41e7e5d85b5e0d49$export$a7f6cffb6b8ba11c);
|
|
19
19
|
$parcel$export(module.exports, "useSearchModal", () => $41e7e5d85b5e0d49$export$912994940e660d32);
|
|
20
|
+
$parcel$export(module.exports, "usePerformanceClient", () => $41e7e5d85b5e0d49$export$38b98fae14bd1f64);
|
|
20
21
|
$parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.
|
|
24
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.106";
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
const $41e7e5d85b5e0d49$export$58e808b1db15d3bc = ()=>{
|
|
@@ -80,5 +81,18 @@ function $41e7e5d85b5e0d49$export$912994940e660d32() {
|
|
|
80
81
|
open: ()=>{}
|
|
81
82
|
};
|
|
82
83
|
}
|
|
84
|
+
function $41e7e5d85b5e0d49$export$38b98fae14bd1f64() {
|
|
85
|
+
const mock = {
|
|
86
|
+
get: function(target, property) {
|
|
87
|
+
if (typeof target[property] === "undefined") return ()=>{
|
|
88
|
+
throw new Error("Depict Performance Client is currently not available on the server. Please wrap your call in a useEffect hook or user event handler.");
|
|
89
|
+
};
|
|
90
|
+
return target[property];
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
dpc: new Proxy({}, mock)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
83
97
|
|
|
84
98
|
|
package/dist-server/module.js
CHANGED
|
@@ -3,7 +3,7 @@ import {jsx as $1RlIW$jsx} from "react/jsx-runtime";
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.
|
|
6
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.106";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
const $2b1fdeb83610500f$export$58e808b1db15d3bc = ()=>{
|
|
@@ -63,6 +63,19 @@ function $2b1fdeb83610500f$export$912994940e660d32() {
|
|
|
63
63
|
open: ()=>{}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
function $2b1fdeb83610500f$export$38b98fae14bd1f64() {
|
|
67
|
+
const mock = {
|
|
68
|
+
get: function(target, property) {
|
|
69
|
+
if (typeof target[property] === "undefined") return ()=>{
|
|
70
|
+
throw new Error("Depict Performance Client is currently not available on the server. Please wrap your call in a useEffect hook or user event handler.");
|
|
71
|
+
};
|
|
72
|
+
return target[property];
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
dpc: new Proxy({}, mock)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
66
79
|
|
|
67
80
|
|
|
68
|
-
export {$2b1fdeb83610500f$export$58e808b1db15d3bc as fetchDepictRecommendations, $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version};
|
|
81
|
+
export {$2b1fdeb83610500f$export$58e808b1db15d3bc as fetchDepictRecommendations, $2b1fdeb83610500f$export$9fac37a9c21c2f3b as DepictProvider, $2b1fdeb83610500f$export$a54ec244c8863715 as SearchPage, $2b1fdeb83610500f$export$f7d2f673fc2f091d as CategoryPage, $2b1fdeb83610500f$export$5646050d516e06bc as BreadCrumbs, $2b1fdeb83610500f$export$466cdc317043f6cb as QuickLinks, $2b1fdeb83610500f$export$80e99ee6b29cadd2 as ComponentAligner, $2b1fdeb83610500f$export$3f37af283f8fb843 as ImagePlaceholder, $2b1fdeb83610500f$export$89c6019e4baa40b1 as TextPlaceholder, $2b1fdeb83610500f$export$9bb30bbe003b82e0 as useSearchField, $2b1fdeb83610500f$export$a7f6cffb6b8ba11c as openModal, $2b1fdeb83610500f$export$912994940e660d32 as useSearchModal, $2b1fdeb83610500f$export$38b98fae14bd1f64 as usePerformanceClient, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/react-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.106",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -96,9 +96,10 @@
|
|
|
96
96
|
"/locales"
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@depict-ai/
|
|
100
|
-
"@depict-ai/
|
|
101
|
-
"@depict-ai/
|
|
99
|
+
"@depict-ai/dpc": "^1.0.2",
|
|
100
|
+
"@depict-ai/plp-styling": "^1.0.2",
|
|
101
|
+
"@depict-ai/ui": "^1.0.2",
|
|
102
|
+
"@depict-ai/utilishared": "^1.0.2",
|
|
102
103
|
"solid-js": "^1.7.3"
|
|
103
104
|
},
|
|
104
105
|
"peerDependencies": {
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"@babel/preset-typescript": "latest",
|
|
112
113
|
"@babel/runtime": "latest",
|
|
113
114
|
"@babel/runtime-corejs3": "latest",
|
|
114
|
-
"@depict-ai/plp-styling": "^1.0.
|
|
115
|
+
"@depict-ai/plp-styling": "^1.0.2",
|
|
115
116
|
"@jest/globals": "^29.3.1",
|
|
116
117
|
"@parcel/babel-preset-env": "latest",
|
|
117
118
|
"@parcel/resolver-default": "^2.8.0",
|