@depict-ai/react-ui 0.0.104 → 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 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.104";
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.
@@ -81,9 +108,8 @@ type ProviderConfig = BaseProviderConfig & {
81
108
  */
82
109
  userId?: string;
83
110
  /**
84
- * Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
111
+ * Options that are required for search functionality.
85
112
  */
86
- metaData?: Record<string, string>;
87
113
  search?: BaseSearchProviderConfig;
88
114
  };
89
115
  /**
@@ -323,7 +349,7 @@ interface UseSearchModalReturn {
323
349
  * );
324
350
  * };
325
351
  * ```
326
- * @returns {JSX.Element}
352
+ * @returns {UseSearchModalReturn}
327
353
  */
328
354
  export function useSearchModal(params?: UseSearchModalParams): UseSearchModalReturn;
329
355
  interface SearchFieldProps {
@@ -381,7 +407,7 @@ interface UseSearchFieldReturn {
381
407
  * );
382
408
  * };
383
409
  * ```
384
- * @returns {JSX.Element}
410
+ * @returns {UseSearchFieldReturn}
385
411
  */
386
412
  export const useSearchField: (props?: SearchFieldProps) => UseSearchFieldReturn;
387
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.104";
34
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.106";
32
35
 
33
36
 
34
37
 
@@ -37,65 +40,21 @@ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.104";
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,
50
+ userId: undefined,
51
+ sessionId: undefined,
95
52
  metaData: undefined,
96
- category_path: null,
53
+ known_category_paths: new Set(),
97
54
  search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
98
- 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)
99
58
  };
100
59
 
101
60
 
@@ -105,7 +64,6 @@ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
105
64
 
106
65
 
107
66
 
108
-
109
67
  let $b4d0d98857ed9934$var$run_on_href_change;
110
68
  let $b4d0d98857ed9934$var$old_href = location.href;
111
69
  function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
@@ -117,19 +75,19 @@ function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
117
75
  $b4d0d98857ed9934$var$run_on_href_change?.(href);
118
76
  $b4d0d98857ed9934$var$old_href = href;
119
77
  }));
120
- 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
121
- const $b4d0d98857ed9934$export$92a8f8b3c630fa0d = (url)=>{
122
- return $b4d0d98857ed9934$export$775e6b3892b5ad52(url) || url.pathname === (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path;
123
- };
124
- 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 = {}) {
125
81
  const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
126
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));
127
86
  (0, $4GYXz$react.useEffect)(()=>{
128
87
  const wrapper_element = wrapper_element_ref.current;
129
- const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(props, set_portals), wrapper_element);
88
+ const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(store, set_portals), wrapper_element);
130
89
  return dispose;
131
90
  }, []);
132
- react_render_handler?.(props);
133
91
  return (0, $4GYXz$react.createElement)(wrapper_type, {
134
92
  ref: wrapper_element_ref,
135
93
  style: wrapper_style
@@ -149,17 +107,14 @@ function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set = (0, $0b7c
149
107
  };
150
108
  }
151
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);
152
112
  const solid_container = document.createElement("div");
153
- const react_has_rendered = new Promise((r)=>{
154
- const m_o = new MutationObserver(()=>{
155
- m_o.disconnect();
156
- r();
157
- });
158
- m_o.observe(solid_container, {
159
- childList: true
160
- });
161
- });
162
- 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
+ }, {
163
118
  display: display
164
119
  });
165
120
  const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
@@ -174,17 +129,111 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , co
174
129
  ...component_portals
175
130
  ]);
176
131
  });
177
- await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
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.
178
133
  return [
179
134
  solid_container
180
135
  ];
181
136
  }
182
137
 
183
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
+
184
225
  const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
185
- const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
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;
186
235
  window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
187
- shallow: shallow,
236
+ shallow: current_page === target_page,
188
237
  scroll: true
189
238
  });
190
239
  };
@@ -192,29 +241,47 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
192
241
 
193
242
 
194
243
 
195
- const $24b00503eef73528$var$orig_user_id_fn = (0, $4GYXz$depictaiutilishared.get_user_id);
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
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId } = props;
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);
199
273
  const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
200
- // Will run on other prop changes because of object comparison, but harmless
201
- (0, $4GYXz$react.useEffect)(()=>{
202
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
203
- }, [
204
- metaData
205
- ]);
206
- (0, $4GYXz$react.useEffect)(()=>{
207
- (0, $4GYXz$depictaiutilishared.set_user_id_fn)(userId ? ()=>userId : $24b00503eef73528$var$orig_user_id_fn);
208
- }, [
209
- userId
210
- ]);
274
+ // Will run on other prop changes, but harmless
275
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId = userId;
276
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId = sessionId;
277
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
278
+ (0, $25c0a91312868994$export$47e064413edabf36)(merchant, market, userId, sessionId);
211
279
  if (!market || !merchant) {
212
280
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
213
281
  return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
214
282
  }
215
283
  try {
216
- const { search: search , category: category , api: api } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
217
- 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);
218
285
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
219
286
  const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
220
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
@@ -223,7 +290,11 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
223
290
  });
224
291
  else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace);
225
292
  };
226
- if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)(async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData);
293
+ if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)({
294
+ get_metadata: async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
295
+ get_user_id: ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId,
296
+ get_session_id: ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId
297
+ });
227
298
  if (searchPagePath) {
228
299
  set_search_page_path($24b00503eef73528$var$ensure_correct_formatting(searchPagePath));
229
300
  if (!search) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
@@ -255,7 +326,7 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
255
326
  category.merchant = merchant;
256
327
  category.localization = usedLocale;
257
328
  }
258
- (0, $6319748b4f0426f0$export$6453cbc34515a94d)((0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d));
329
+ (0, $6319748b4f0426f0$export$6453cbc34515a94d)();
259
330
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
260
331
  } catch (e) {
261
332
  // Make sure to not break the users app if we throw
@@ -301,6 +372,10 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
301
372
  const update_updating_blocked_signal = ()=>{
302
373
  set_search_query_updating_blocked_signal(!(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(location));
303
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));
304
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
305
380
  (0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
306
381
  (0, $4GYXz$solidjs.createComputed)(()=>{
@@ -310,8 +385,8 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
310
385
  const component_portals = new Set();
311
386
  return (0, $4GYXz$depictaiui.SearchPage)({
312
387
  // Default config goes here
313
- include_input_field: props.includeInputField ?? true,
314
- 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) ?? [
315
390
  [
316
391
  4
317
392
  ],
@@ -324,11 +399,11 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
324
399
  901
325
400
  ]
326
401
  ],
327
- grid_spacing: props.gridSpacing ?? "2%",
402
+ grid_spacing: (0, $4GYXz$solidjs.untrack)(()=>props.gridSpacing) ?? "2%",
328
403
  depict_search: depict_search,
329
404
  product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
330
405
  display: display,
331
- react_template: props.productCard,
406
+ react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
332
407
  component_portals: component_portals,
333
408
  set_portals: set_portals
334
409
  })
@@ -340,25 +415,30 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
340
415
 
341
416
 
342
417
 
343
- let $5aa5fcb9f8a2bebc$var$render_cb;
344
418
  function $5aa5fcb9f8a2bebc$export$f7d2f673fc2f091d(props) {
345
419
  return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(// @ts-ignore
346
- (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {}, (props)=>$5aa5fcb9f8a2bebc$var$render_cb?.(props));
420
+ (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {});
347
421
  }
348
422
  function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
349
423
  const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
350
424
  if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
351
425
  const [category_state_set, set_category_state_set] = (0, $4GYXz$solidjs.createSignal)(false);
352
- $5aa5fcb9f8a2bebc$var$render_cb = (props)=>{
353
- depict_category.category_id = props.categoryId;
354
- (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path = location.pathname;
355
- if (props.categoryId) set_category_state_set(true);
356
- };
357
- $5aa5fcb9f8a2bebc$var$render_cb(props);
358
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
+ });
359
439
  const category = ()=>(0, $4GYXz$depictaiui.CategoryPage)({
360
440
  depict_category: depict_category,
361
- cols_at_size: props.columnsAtSize ?? [
441
+ cols_at_size: (0, $4GYXz$solidjs.untrack)(()=>props.columnsAtSize) ?? [
362
442
  [
363
443
  4
364
444
  ],
@@ -371,13 +451,13 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
371
451
  901
372
452
  ]
373
453
  ],
374
- grid_spacing: props.gridSpacing ?? "2%",
375
- category_title: props.categoryTitlePlugin || (0, $4GYXz$depictaiui.CategoryTitle),
376
- show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
377
- 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),
378
458
  product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
379
459
  display: display,
380
- react_template: props.productCard,
460
+ react_template: (0, $4GYXz$solidjs.untrack)(()=>props.productCard),
381
461
  component_portals: component_portals,
382
462
  set_portals: set_portals
383
463
  })
@@ -418,10 +498,11 @@ function $f16af0e861aff3d0$var$vanilla_quick_links() {
418
498
 
419
499
 
420
500
 
421
- const $df522c8a81ed5a01$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
422
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(()=>(0, $4GYXz$depictaiutilishared.ContainedPlaceholderImage)({
423
- aspect_ratio: aspectRatio
424
- }), {}, "div", {
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", {
425
506
  "height": "100%"
426
507
  });
427
508
  };
@@ -501,10 +582,19 @@ const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props)=>{
501
582
 
502
583
 
503
584
 
585
+
504
586
  const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
505
- const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
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;
506
596
  router.push(relativeUrl, undefined, {
507
- shallow: shallow,
597
+ shallow: current_page === target_page,
508
598
  scroll: true
509
599
  });
510
600
  };
package/dist/module.js CHANGED
@@ -1,15 +1,17 @@
1
- import {add_to_version_info as $TZSbU$add_to_version_info, get_user_id as $TZSbU$get_user_id, set_user_id_fn as $TZSbU$set_user_id_fn, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, 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";
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, createSignal as $TZSbU$createSignal, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createComputed as $TZSbU$createComputed} from "solid-js";
4
- import {useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, forwardRef as $TZSbU$forwardRef} from "react";
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
+ 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.104";
14
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.106";
13
15
 
14
16
 
15
17
 
@@ -18,65 +20,21 @@ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.104";
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,
30
+ userId: undefined,
31
+ sessionId: undefined,
76
32
  metaData: undefined,
77
- category_path: null,
33
+ known_category_paths: new Set(),
78
34
  search_page_path_: (0, $TZSbU$createSignal)(),
79
- 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)
80
38
  };
81
39
 
82
40
 
@@ -86,7 +44,6 @@ const $42858f023ef23dab$export$8e769ad4338a911e = {
86
44
 
87
45
 
88
46
 
89
-
90
47
  let $c83ba9ab79386687$var$run_on_href_change;
91
48
  let $c83ba9ab79386687$var$old_href = location.href;
92
49
  function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
@@ -98,19 +55,19 @@ function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
98
55
  $c83ba9ab79386687$var$run_on_href_change?.(href);
99
56
  $c83ba9ab79386687$var$old_href = href;
100
57
  }));
101
- 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
102
- const $c83ba9ab79386687$export$92a8f8b3c630fa0d = (url)=>{
103
- return $c83ba9ab79386687$export$775e6b3892b5ad52(url) || url.pathname === (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path;
104
- };
105
- 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 = {}) {
106
61
  const [portals, set_portals] = (0, $TZSbU$useState)([]);
107
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));
108
66
  (0, $TZSbU$useEffect)(()=>{
109
67
  const wrapper_element = wrapper_element_ref.current;
110
- const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), wrapper_element);
68
+ const dispose = (0, $TZSbU$render)(()=>solid_component(store, set_portals), wrapper_element);
111
69
  return dispose;
112
70
  }, []);
113
- react_render_handler?.(props);
114
71
  return (0, $TZSbU$createElement)(wrapper_type, {
115
72
  ref: wrapper_element_ref,
116
73
  style: wrapper_style
@@ -130,17 +87,14 @@ function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $4285
130
87
  };
131
88
  }
132
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);
133
92
  const solid_container = document.createElement("div");
134
- const react_has_rendered = new Promise((r)=>{
135
- const m_o = new MutationObserver(()=>{
136
- m_o.disconnect();
137
- r();
138
- });
139
- m_o.observe(solid_container, {
140
- childList: true
141
- });
142
- });
143
- 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
+ }, {
144
98
  display: display
145
99
  });
146
100
  const portal = $TZSbU$createPortal(reactProductCard, solid_container);
@@ -155,17 +109,111 @@ async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , co
155
109
  ...component_portals
156
110
  ]);
157
111
  });
158
- await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
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.
159
113
  return [
160
114
  solid_container
161
115
  ];
162
116
  }
163
117
 
164
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
+
165
205
  const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
166
- const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
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;
167
215
  window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
168
- shallow: shallow,
216
+ shallow: current_page === target_page,
169
217
  scroll: true
170
218
  });
171
219
  };
@@ -173,29 +221,47 @@ const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
173
221
 
174
222
 
175
223
 
176
- const $5376eb2a386cd90d$var$orig_user_id_fn = (0, $TZSbU$get_user_id);
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
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId } = props;
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);
180
253
  const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
181
- // Will run on other prop changes because of object comparison, but harmless
182
- (0, $TZSbU$useEffect)(()=>{
183
- (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData = metaData;
184
- }, [
185
- metaData
186
- ]);
187
- (0, $TZSbU$useEffect)(()=>{
188
- (0, $TZSbU$set_user_id_fn)(userId ? ()=>userId : $5376eb2a386cd90d$var$orig_user_id_fn);
189
- }, [
190
- userId
191
- ]);
254
+ // Will run on other prop changes, but harmless
255
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).userId = userId;
256
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId = sessionId;
257
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData = metaData;
258
+ (0, $a00d8f27abd5d0b0$export$47e064413edabf36)(merchant, market, userId, sessionId);
192
259
  if (!market || !merchant) {
193
260
  (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
194
261
  return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
195
262
  }
196
263
  try {
197
- const { search: search , category: category , api: api } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
198
- 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);
199
265
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
200
266
  const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
201
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
@@ -204,7 +270,11 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
204
270
  });
205
271
  else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url, is_replace);
206
272
  };
207
- if (!api) (0, $42858f023ef23dab$export$8e769ad4338a911e).api = new (0, $TZSbU$DepictAPI)(async ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData);
273
+ if (!api) (0, $42858f023ef23dab$export$8e769ad4338a911e).api = new (0, $TZSbU$DepictAPI)({
274
+ get_metadata: async ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData,
275
+ get_user_id: ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).userId,
276
+ get_session_id: ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId
277
+ });
208
278
  if (searchPagePath) {
209
279
  set_search_page_path($5376eb2a386cd90d$var$ensure_correct_formatting(searchPagePath));
210
280
  if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
@@ -236,7 +306,7 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
236
306
  category.merchant = merchant;
237
307
  category.localization = usedLocale;
238
308
  }
239
- (0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$92a8f8b3c630fa0d));
309
+ (0, $8071251ee4e9ffa1$export$6453cbc34515a94d)();
240
310
  (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
241
311
  } catch (e) {
242
312
  // Make sure to not break the users app if we throw
@@ -282,6 +352,10 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
282
352
  const update_updating_blocked_signal = ()=>{
283
353
  set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$775e6b3892b5ad52)(location));
284
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));
285
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
286
360
  (0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
287
361
  (0, $TZSbU$createComputed)(()=>{
@@ -291,8 +365,8 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
291
365
  const component_portals = new Set();
292
366
  return (0, $TZSbU$SearchPage)({
293
367
  // Default config goes here
294
- include_input_field: props.includeInputField ?? true,
295
- cols_at_size: props.columnsAtSize ?? [
368
+ include_input_field: (0, $TZSbU$untrack)(()=>props.includeInputField) ?? true,
369
+ cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? [
296
370
  [
297
371
  4
298
372
  ],
@@ -305,11 +379,11 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
305
379
  901
306
380
  ]
307
381
  ],
308
- grid_spacing: props.gridSpacing ?? "2%",
382
+ grid_spacing: (0, $TZSbU$untrack)(()=>props.gridSpacing) ?? "2%",
309
383
  depict_search: depict_search,
310
384
  product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
311
385
  display: display,
312
- react_template: props.productCard,
386
+ react_template: (0, $TZSbU$untrack)(()=>props.productCard),
313
387
  component_portals: component_portals,
314
388
  set_portals: set_portals
315
389
  })
@@ -321,25 +395,30 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
321
395
 
322
396
 
323
397
 
324
- let $48d7f568740a317d$var$render_cb;
325
398
  function $48d7f568740a317d$export$f7d2f673fc2f091d(props) {
326
399
  return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(// @ts-ignore
327
- (0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {}, (props)=>$48d7f568740a317d$var$render_cb?.(props));
400
+ (0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {});
328
401
  }
329
402
  function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
330
403
  const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
331
404
  if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
332
405
  const [category_state_set, set_category_state_set] = (0, $TZSbU$createSignal)(false);
333
- $48d7f568740a317d$var$render_cb = (props)=>{
334
- depict_category.category_id = props.categoryId;
335
- (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path = location.pathname;
336
- if (props.categoryId) set_category_state_set(true);
337
- };
338
- $48d7f568740a317d$var$render_cb(props);
339
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
+ });
340
419
  const category = ()=>(0, $TZSbU$CategoryPage)({
341
420
  depict_category: depict_category,
342
- cols_at_size: props.columnsAtSize ?? [
421
+ cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? [
343
422
  [
344
423
  4
345
424
  ],
@@ -352,13 +431,13 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
352
431
  901
353
432
  ]
354
433
  ],
355
- grid_spacing: props.gridSpacing ?? "2%",
356
- category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
357
- show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
358
- 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),
359
438
  product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
360
439
  display: display,
361
- react_template: props.productCard,
440
+ react_template: (0, $TZSbU$untrack)(()=>props.productCard),
362
441
  component_portals: component_portals,
363
442
  set_portals: set_portals
364
443
  })
@@ -399,10 +478,11 @@ function $b68a14248b7ef667$var$vanilla_quick_links() {
399
478
 
400
479
 
401
480
 
402
- const $f446a84f85ba06f6$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
403
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$ContainedPlaceholderImage)({
404
- aspect_ratio: aspectRatio
405
- }), {}, "div", {
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", {
406
486
  "height": "100%"
407
487
  });
408
488
  };
@@ -482,10 +562,19 @@ const $2b886cf548a4775c$export$9bb30bbe003b82e0 = (props)=>{
482
562
 
483
563
 
484
564
 
565
+
485
566
  const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
486
- const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
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;
487
576
  router.push(relativeUrl, undefined, {
488
- shallow: shallow,
577
+ shallow: current_page === target_page,
489
578
  scroll: true
490
579
  });
491
580
  };
@@ -499,4 +588,4 @@ const $97603d19204ec48d$export$b8a61e5c71402559 = {
499
588
  (0, $TZSbU$add_to_version_info)("react-ui", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
500
589
 
501
590
 
502
- 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};
@@ -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
- export const version = "0.0.104";
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;
@@ -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.104";
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
 
@@ -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.104";
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.104",
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/plp-styling": "^0.0.45",
100
- "@depict-ai/ui": "^0.0.83",
101
- "@depict-ai/utilishared": "^0.0.87",
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": "^0.0.45",
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",