@depict-ai/react-ui 2.1.12 → 2.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -38,7 +38,7 @@ $parcel$export(module.exports, "version", () => $efbdd2dab4314170$export$83d89fb
38
38
  $parcel$export(module.exports, "Navigation", () => $0d3a2413fdeb34b9$export$b8a61e5c71402559);
39
39
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
40
40
  // Note, if you add an export here, also add one in src-server/main.ts
41
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.12";
41
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.13";
42
42
  const $ef516b1f92253963$export$8e769ad4338a911e = {
43
43
  usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
44
44
  search_instances: new Map(),
package/ES10/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/ES10";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "2.1.12";
6
+ export const version = "2.1.13";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
package/ES10/index.js CHANGED
@@ -14,7 +14,7 @@ import { renderToString as $jb2Oo$renderToString } from "react-dom/server";
14
14
  // Note, if you add an export here, also add one in src-server/main.ts
15
15
  import { register_es_version } from "../multi_import_deduplicator.mjs";
16
16
  register_es_version("react-ui", "ES10");
17
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.12";
17
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.13";
18
18
  const $8c691d7f86317052$export$8e769ad4338a911e = {
19
19
  usedLocale: $jb2Oo$createSignal((0, $jb2Oo$defaultLocale)),
20
20
  search_instances: new Map(),
package/dist/main.js ADDED
@@ -0,0 +1,527 @@
1
+ var $4GYXz$depictaiutilishared = require("@depict-ai/utilishared");
2
+ var $4GYXz$depictaiui = require("@depict-ai/ui");
3
+ var $4GYXz$solidjs = require("solid-js");
4
+ var $4GYXz$solidjsweb = require("solid-js/web");
5
+ var $4GYXz$react = require("react");
6
+ var $4GYXz$reactjsxruntime = require("react/jsx-runtime");
7
+ var $4GYXz$reactdom = require("react-dom");
8
+ var $4GYXz$depictaiuilocales = require("@depict-ai/ui/locales");
9
+
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+
14
+ $parcel$export(module.exports, "QuickLinks", () => $f16af0e861aff3d0$export$466cdc317043f6cb);
15
+ $parcel$export(module.exports, "BreadCrumbs", () => $d88e98b11c182b8e$export$5646050d516e06bc);
16
+ $parcel$export(module.exports, "DepictAligner", () => $d96434e62e08087d$export$3f4580d6398c5027);
17
+ $parcel$export(module.exports, "DepictProvider", () => $24b00503eef73528$export$9fac37a9c21c2f3b);
18
+ $parcel$export(module.exports, "DepictCategoryPage", () => $5aa5fcb9f8a2bebc$export$d87c61cecb2edf0d);
19
+ $parcel$export(module.exports, "DepictSearchPage", () => $7ad7a3d0011b7b1b$export$210723f5a54a7028);
20
+ $parcel$export(module.exports, "DepictSearchField", () => $03c714523ff406fc$export$4c0fa313cf50c4ad);
21
+ $parcel$export(module.exports, "ImagePlaceholder", () => $df522c8a81ed5a01$export$3f37af283f8fb843);
22
+ $parcel$export(module.exports, "TextPlaceholder", () => $7c8b440edc188ad5$export$89c6019e4baa40b1);
23
+ $parcel$export(module.exports, "useDepictSearchModal", () => $3647cad61d03b89c$export$cc1e9aaf280afdcb);
24
+ $parcel$export(module.exports, "CategoryTitle", () => $b03e4eee8610ebbe$re_export$CategoryTitle);
25
+ $parcel$export(module.exports, "EmbeddedNumProducts", () => $b03e4eee8610ebbe$re_export$EmbeddedNumProducts);
26
+ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
27
+ $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
28
+ /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
29
+ // Note, if you add an export here, also add one in src-server/main.ts
30
+
31
+
32
+
33
+ const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
34
+ search: null,
35
+ category: null,
36
+ category_path: null,
37
+ search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
38
+ required_state_set_: (0, $4GYXz$solidjs.createSignal)(false)
39
+ };
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ let $b4d0d98857ed9934$var$run_on_href_change;
48
+ function $b4d0d98857ed9934$export$74f3924c5027fe1d(cb) {
49
+ $b4d0d98857ed9934$var$run_on_href_change = cb;
50
+ }
51
+ (async ()=>{
52
+ for await (const href of (0, $4GYXz$depictaiutilishared.href_change_ipns))$b4d0d98857ed9934$var$run_on_href_change?.(href);
53
+ })();
54
+ 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
55
+ const $b4d0d98857ed9934$export$92a8f8b3c630fa0d = (url)=>{
56
+ return $b4d0d98857ed9934$export$775e6b3892b5ad52(url) || url.pathname === (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path;
57
+ };
58
+ function $b4d0d98857ed9934$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
59
+ const [portals, set_portals] = (0, $4GYXz$react.useState)([]);
60
+ const wrapper_element_ref = (0, $4GYXz$react.useRef)();
61
+ (0, $4GYXz$react.useEffect)(()=>{
62
+ const wrapper_element = wrapper_element_ref.current;
63
+ const dispose = (0, $4GYXz$solidjsweb.render)(()=>solid_component(props, set_portals), wrapper_element);
64
+ return dispose;
65
+ }, []);
66
+ react_render_handler?.(props);
67
+ return (0, $4GYXz$react.createElement)(wrapper_type, {
68
+ ref: wrapper_element_ref,
69
+ style: wrapper_style
70
+ }, portals);
71
+ }
72
+ function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[0]) {
73
+ return (...args)=>{
74
+ return (0, $4GYXz$solidjs.createComponent)((0, $4GYXz$solidjs.Show), {
75
+ get when () {
76
+ return is_set();
77
+ },
78
+ get children () {
79
+ return component(...args);
80
+ }
81
+ });
82
+ };
83
+ }
84
+ async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
85
+ const solid_container = document.createElement("div");
86
+ const react_has_rendered = new Promise((r)=>{
87
+ const m_o = new MutationObserver(()=>{
88
+ m_o.disconnect();
89
+ r();
90
+ });
91
+ m_o.observe(solid_container, {
92
+ childList: true
93
+ });
94
+ });
95
+ const is_placeholder = info.rendering_options.type === "placeholder";
96
+ const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(react_template, {
97
+ display: is_placeholder ? null : display
98
+ });
99
+ const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
100
+ component_portals.add(portal);
101
+ set_portals([
102
+ ...component_portals
103
+ ]);
104
+ (0, $4GYXz$solidjs.onCleanup)(()=>{
105
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
106
+ component_portals.delete(portal);
107
+ set_portals([
108
+ ...component_portals
109
+ ]);
110
+ });
111
+ 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
+ return [
113
+ solid_container
114
+ ];
115
+ }
116
+
117
+
118
+
119
+
120
+ function $03c714523ff406fc$export$4c0fa313cf50c4ad() {
121
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(()=>(0, $4GYXz$depictaiui.SearchField)({
122
+ depict_search: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search
123
+ })), {});
124
+ }
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ let $6319748b4f0426f0$var$set = false;
133
+ let $6319748b4f0426f0$var$padding_animation;
134
+ function $6319748b4f0426f0$export$6453cbc34515a94d(is_search_page) {
135
+ if ($6319748b4f0426f0$var$set) return; // Just being safe
136
+ $6319748b4f0426f0$var$set = true;
137
+ let should_use_old_scroll = false;
138
+ const old_scrollTo = window.scrollTo;
139
+ window.scrollTo = (...args)=>{
140
+ if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
141
+ else should_use_old_scroll = true;
142
+ };
143
+ addEventListener("popstate", (0, $4GYXz$depictaiutilishared.catchify)(()=>{
144
+ if (!is_search_page(location)) {
145
+ $6319748b4f0426f0$var$removeLotsOfPadding(); // Just making sure
146
+ return;
147
+ }
148
+ should_use_old_scroll = false;
149
+ $6319748b4f0426f0$var$addLotsOfPadding();
150
+ (0, $4GYXz$depictaiutilishared.observer).wait_for_element(".depict.plp .listing-page").then(()=>{
151
+ $6319748b4f0426f0$var$removeLotsOfPadding();
152
+ });
153
+ }));
154
+ (0, $4GYXz$depictaiutilishared.history_replacer)(()=>{
155
+ (0, $4GYXz$depictaiutilishared.queueMacroTask)(()=>{
156
+ $6319748b4f0426f0$var$removeLotsOfPadding();
157
+ });
158
+ }, false);
159
+ window?.next?.router?.events?.on("routeChangeStart", ()=>{
160
+ $6319748b4f0426f0$var$addLotsOfPadding();
161
+ });
162
+ }
163
+ /*
164
+ Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
165
+ 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.
166
+ */ function $6319748b4f0426f0$var$addLotsOfPadding() {
167
+ if ($6319748b4f0426f0$var$padding_animation) return; // We're already showing a bunch of padding
168
+ $6319748b4f0426f0$var$padding_animation = document.body.animate({
169
+ paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
170
+ offset: 0
171
+ }, 1);
172
+ $6319748b4f0426f0$var$padding_animation.pause();
173
+ }
174
+ function $6319748b4f0426f0$var$removeLotsOfPadding() {
175
+ if ($6319748b4f0426f0$var$padding_animation) {
176
+ $6319748b4f0426f0$var$padding_animation.play();
177
+ $6319748b4f0426f0$var$padding_animation = undefined;
178
+ }
179
+ }
180
+
181
+
182
+
183
+
184
+ const $bc389476eeb2b615$export$599d4515591ef232 = (href)=>{
185
+ const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
186
+ window.next.router.push(href, undefined, {
187
+ shallow: shallow,
188
+ scroll: true
189
+ });
190
+ };
191
+
192
+
193
+
194
+ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
195
+ const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
196
+ const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.en);
197
+ const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
198
+ if (!market || !merchant) {
199
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
200
+ return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
201
+ }
202
+ try {
203
+ const { search: search , category: category } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
204
+ const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
205
+ set_search_page_path(searchPagePath);
206
+ const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
207
+ if (navigateFunction) navigateFunction(new_href);
208
+ else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_href);
209
+ } : undefined;
210
+ if (!search) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
211
+ search_query_url_param_name: urlParamName,
212
+ market: market,
213
+ merchant: merchant,
214
+ enable_category_suggestions: enableCategorySuggestions ?? false,
215
+ // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
216
+ localization: usedLocale,
217
+ url_transformer: (url)=>url.pathname = (0, $4GYXz$solidjs.untrack)(get_search_page_path),
218
+ on_navigation: on_navigation
219
+ }));
220
+ else {
221
+ search.market = market;
222
+ search.merchant = merchant;
223
+ search.localization = usedLocale;
224
+ }
225
+ if (!category) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category = new (0, $4GYXz$depictaiui.DepictCategory)({
226
+ market: market,
227
+ merchant: merchant,
228
+ localization: usedLocale,
229
+ on_navigation: on_navigation
230
+ }));
231
+ else {
232
+ category.market = market;
233
+ category.merchant = merchant;
234
+ category.localization = usedLocale;
235
+ }
236
+ (0, $6319748b4f0426f0$export$6453cbc34515a94d)((0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d));
237
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](true);
238
+ } catch (e) {
239
+ // Make sure to not break the users app if we throw
240
+ queueMicrotask(()=>{
241
+ throw e;
242
+ });
243
+ }
244
+ return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
245
+ }
246
+
247
+
248
+
249
+ const $d96434e62e08087d$export$3f4580d6398c5027 = /*#__PURE__*/ (0, $4GYXz$react.forwardRef)((_, ref)=>{
250
+ return /*#__PURE__*/ (0, $4GYXz$react.createElement)("div", {
251
+ className: "depict aligner",
252
+ style: {
253
+ height: "100%"
254
+ },
255
+ ref: ref
256
+ });
257
+ });
258
+
259
+
260
+
261
+
262
+
263
+
264
+ function $7ad7a3d0011b7b1b$export$210723f5a54a7028(props) {
265
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($7ad7a3d0011b7b1b$var$SolidSearchPage), props);
266
+ }
267
+ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
268
+ const depict_search = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search;
269
+ if (!depict_search) throw Error("No depict_search instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
270
+ const search_query_updating_blocked_signal = (0, $4GYXz$depictaiui.get_search_query_updating_blocked_signal)(depict_search);
271
+ if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
272
+ const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
273
+ const update_updating_blocked_signal = ()=>{
274
+ set_search_query_updating_blocked_signal(!(0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(location));
275
+ };
276
+ // 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
277
+ (0, $b4d0d98857ed9934$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
278
+ (0, $4GYXz$solidjs.createComputed)(()=>{
279
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
280
+ update_updating_blocked_signal();
281
+ });
282
+ const component_portals = new Set();
283
+ return (0, $4GYXz$depictaiui.SearchPage)({
284
+ // Default config goes here
285
+ include_input_field: props.includeInputField ?? true,
286
+ cols_at_size: props.columnsAtSize ?? [
287
+ [
288
+ 4
289
+ ],
290
+ [
291
+ 3,
292
+ 1024
293
+ ],
294
+ [
295
+ 2,
296
+ 901
297
+ ]
298
+ ],
299
+ grid_spacing: props.gridSpacing ?? "2%",
300
+ // Todo: Do we need this?
301
+ get_product_id: ()=>"",
302
+ depict_search: depict_search,
303
+ product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
304
+ display: display,
305
+ info: info,
306
+ react_template: props.productCard,
307
+ component_portals: component_portals,
308
+ set_portals: set_portals
309
+ })
310
+ });
311
+ }
312
+
313
+
314
+
315
+
316
+
317
+
318
+ let $5aa5fcb9f8a2bebc$var$render_cb;
319
+ function $5aa5fcb9f8a2bebc$export$d87c61cecb2edf0d(props) {
320
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($5aa5fcb9f8a2bebc$var$SolidCategoryPage), props, "div", {}, (props)=>$5aa5fcb9f8a2bebc$var$render_cb?.(props));
321
+ }
322
+ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
323
+ const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
324
+ if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
325
+ const [category_state_set, set_category_state_set] = (0, $4GYXz$solidjs.createSignal)(false);
326
+ $5aa5fcb9f8a2bebc$var$render_cb = (props)=>{
327
+ depict_category.category_id = props.categoryId;
328
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category_path = location.pathname;
329
+ if (props.categoryId) set_category_state_set(true);
330
+ };
331
+ $5aa5fcb9f8a2bebc$var$render_cb(props);
332
+ const component_portals = new Set();
333
+ const category = ()=>(0, $4GYXz$depictaiui.CategoryPage)({
334
+ depict_category: depict_category,
335
+ cols_at_size: props.columnsAtSize ?? [
336
+ [
337
+ 4
338
+ ],
339
+ [
340
+ 3,
341
+ 1024
342
+ ],
343
+ [
344
+ 2,
345
+ 901
346
+ ]
347
+ ],
348
+ grid_spacing: props.gridSpacing ?? "2%",
349
+ get_product_id: ()=>"",
350
+ category_title: props.categoryTitlePlugin || (0, $4GYXz$depictaiui.CategoryTitle),
351
+ show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
352
+ show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
353
+ product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
354
+ display: display,
355
+ info: info,
356
+ react_template: props.productCard,
357
+ component_portals: component_portals,
358
+ set_portals: set_portals
359
+ })
360
+ });
361
+ return (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(category, category_state_set);
362
+ }
363
+
364
+
365
+
366
+
367
+
368
+ function $d88e98b11c182b8e$export$5646050d516e06bc() {
369
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($d88e98b11c182b8e$var$vanilla_breadcrumbs), {});
370
+ }
371
+ function $d88e98b11c182b8e$var$vanilla_breadcrumbs() {
372
+ const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
373
+ if (!depict_category) throw Error("No depict_category instance when rendering BreadCrumbs. Did you forget to wrap your app in DepictProvider?");
374
+ return (0, $4GYXz$depictaiui.BreadCrumbs)({
375
+ depict_category: depict_category
376
+ });
377
+ }
378
+
379
+
380
+
381
+
382
+
383
+ function $f16af0e861aff3d0$export$466cdc317043f6cb() {
384
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($f16af0e861aff3d0$var$vanilla_quick_links), {});
385
+ }
386
+ function $f16af0e861aff3d0$var$vanilla_quick_links() {
387
+ const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
388
+ if (!depict_category) throw Error("No depict_category instance when rendering QuickLinks. Did you forget to wrap your app in DepictProvider?");
389
+ return (0, $4GYXz$depictaiui.QuickLinks)({
390
+ depict_category: depict_category
391
+ });
392
+ }
393
+
394
+
395
+
396
+
397
+ const $df522c8a81ed5a01$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
398
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(()=>(0, $4GYXz$depictaiutilishared.ContainedPlaceholderImage)({
399
+ aspect_ratio: aspectRatio
400
+ }), {}, "div", {
401
+ "height": "100%"
402
+ });
403
+ };
404
+
405
+
406
+
407
+
408
+ const $7c8b440edc188ad5$export$89c6019e4baa40b1 = ({ width: width , height: height })=>{
409
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)(()=>(0, $4GYXz$depictaiutilishared.Placeholder)({
410
+ width: width,
411
+ height: height
412
+ }), {}, "div", {
413
+ "height": "100%"
414
+ });
415
+ };
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+ const $ef7db890e488d4f4$export$d69d8daa20eae175 = (createOpenModalParams)=>{
425
+ const { globalState: globalState , location: location , alignerRef: alignerRef } = createOpenModalParams;
426
+ const openModal = ()=>{
427
+ const headerAligner = alignerRef?.current;
428
+ if (!globalState.search) throw new Error("No active search in the app!");
429
+ if (!headerAligner && location === "aligned") throw new Error("No active search header aligner on the page!");
430
+ const alignment_height = headerAligner?.clientHeight;
431
+ if (location !== "aligned" || isNaN(alignment_height)) {
432
+ // Open centered modal
433
+ globalState.search.modal_open = true;
434
+ return;
435
+ }
436
+ const style_element = document.createElement("style");
437
+ document.head.append(style_element);
438
+ const resize_observer = new ResizeObserver((0, $4GYXz$depictaiutilishared.catchify)(()=>{
439
+ const styles = (0, $4GYXz$depictaiui.styles_to_valid_css_string)({
440
+ ".depict.plp .depict-search-modal .query-input": {
441
+ "height": `${headerAligner?.clientHeight}px`
442
+ }
443
+ });
444
+ style_element.replaceChildren(styles);
445
+ }));
446
+ resize_observer.observe(headerAligner);
447
+ let dispose_aligner;
448
+ /**
449
+ * Setting position to fixed is important to make the modal work with align_field.
450
+ */ const style_props_ = (0, $4GYXz$solidjs.createSignal)({
451
+ position: "fixed"
452
+ });
453
+ (0, $4GYXz$solidjs.createRoot)((dispose)=>{
454
+ dispose_aligner = ()=>{
455
+ resize_observer.disconnect();
456
+ style_element.remove();
457
+ dispose();
458
+ };
459
+ (0, $4GYXz$depictaiui.align_field)(style_props_, headerAligner, undefined, false, "top");
460
+ });
461
+ globalState.search.modal_open = [
462
+ {
463
+ style_props_: style_props_
464
+ },
465
+ dispose_aligner
466
+ ];
467
+ };
468
+ return openModal;
469
+ };
470
+
471
+
472
+ function $3647cad61d03b89c$export$cc1e9aaf280afdcb(params) {
473
+ const open = (0, $ef7db890e488d4f4$export$d69d8daa20eae175)({
474
+ globalState: $0b7cd4fb39fc3502$export$8e769ad4338a911e,
475
+ ...params
476
+ });
477
+ return {
478
+ open: open
479
+ };
480
+ }
481
+
482
+
483
+
484
+
485
+
486
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.59";
487
+
488
+
489
+
490
+
491
+ const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(href)=>{
492
+ const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
493
+ router.push(href, undefined, {
494
+ shallow: shallow,
495
+ scroll: true
496
+ });
497
+ };
498
+
499
+
500
+ /**
501
+ * Helper function that creates a function that can be used as the
502
+ * navigateFunction callback for DepictProvider when using react-router.
503
+ *
504
+ * React-router expect relative URLs, so this function will strip the
505
+ * protocol, hostname and port from the URL.
506
+ *
507
+ * @param navigateFunction what useNavigate() returns
508
+ * @returns a function that can be used as the navigateFunction callback for DepictProvider
509
+ */ const $201a023b63de7d2f$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
510
+ const url_object = new URL(href);
511
+ return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
512
+ };
513
+
514
+
515
+ const $b742053c966024b4$export$b8a61e5c71402559 = {
516
+ nextRouterNavigation: $e387bd534de10acd$export$804fac5697cfbe35,
517
+ reactRouterNavigation: $201a023b63de7d2f$export$d53481656a62aebe
518
+ };
519
+
520
+
521
+ const $b03e4eee8610ebbe$var$package_name = "@depict-ai/react-ui";
522
+ (0, $4GYXz$depictaiutilishared.dlog)($b03e4eee8610ebbe$var$package_name + " version", (0, $db7b67857900028b$export$83d89fbfd8236492));
523
+ (0, $4GYXz$depictaiui.add_to_version_info)({
524
+ [$b03e4eee8610ebbe$var$package_name]: (0, $db7b67857900028b$export$83d89fbfd8236492)
525
+ });
526
+
527
+
package/dist/module.js ADDED
@@ -0,0 +1,510 @@
1
+ import {dlog as $TZSbU$dlog, href_change_ipns as $TZSbU$href_change_ipns, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
2
+ import {add_to_version_info as $TZSbU$add_to_version_info, CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, SearchField as $TZSbU$SearchField, 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, styles_to_valid_css_string as $TZSbU$styles_to_valid_css_string, align_field as $TZSbU$align_field} from "@depict-ai/ui";
3
+ import {untrack as $TZSbU$untrack, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createSignal as $TZSbU$createSignal, createRoot as $TZSbU$createRoot, createComputed as $TZSbU$createComputed} from "solid-js";
4
+ import {render as $TZSbU$render} from "solid-js/web";
5
+ import {useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, forwardRef as $TZSbU$forwardRef} from "react";
6
+ import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
7
+ import {createPortal as $TZSbU$createPortal} from "react-dom";
8
+ import {en as $TZSbU$en} from "@depict-ai/ui/locales";
9
+
10
+ /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
11
+ // Note, if you add an export here, also add one in src-server/main.ts
12
+
13
+
14
+
15
+ const $42858f023ef23dab$export$8e769ad4338a911e = {
16
+ search: null,
17
+ category: null,
18
+ category_path: null,
19
+ search_page_path_: (0, $TZSbU$createSignal)(),
20
+ required_state_set_: (0, $TZSbU$createSignal)(false)
21
+ };
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ let $c83ba9ab79386687$var$run_on_href_change;
30
+ function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
31
+ $c83ba9ab79386687$var$run_on_href_change = cb;
32
+ }
33
+ (async ()=>{
34
+ for await (const href of (0, $TZSbU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
35
+ })();
36
+ 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
37
+ const $c83ba9ab79386687$export$92a8f8b3c630fa0d = (url)=>{
38
+ return $c83ba9ab79386687$export$775e6b3892b5ad52(url) || url.pathname === (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path;
39
+ };
40
+ function $c83ba9ab79386687$export$f6e64e17bd69eeef(solid_component, props, wrapper_type = "div", wrapper_style = {}, react_render_handler) {
41
+ const [portals, set_portals] = (0, $TZSbU$useState)([]);
42
+ const wrapper_element_ref = (0, $TZSbU$useRef)();
43
+ (0, $TZSbU$useEffect)(()=>{
44
+ const wrapper_element = wrapper_element_ref.current;
45
+ const dispose = (0, $TZSbU$render)(()=>solid_component(props, set_portals), wrapper_element);
46
+ return dispose;
47
+ }, []);
48
+ react_render_handler?.(props);
49
+ return (0, $TZSbU$createElement)(wrapper_type, {
50
+ ref: wrapper_element_ref,
51
+ style: wrapper_style
52
+ }, portals);
53
+ }
54
+ function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[0]) {
55
+ return (...args)=>{
56
+ return (0, $TZSbU$createComponent)((0, $TZSbU$Show), {
57
+ get when () {
58
+ return is_set();
59
+ },
60
+ get children () {
61
+ return component(...args);
62
+ }
63
+ });
64
+ };
65
+ }
66
+ async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
67
+ const solid_container = document.createElement("div");
68
+ const react_has_rendered = new Promise((r)=>{
69
+ const m_o = new MutationObserver(()=>{
70
+ m_o.disconnect();
71
+ r();
72
+ });
73
+ m_o.observe(solid_container, {
74
+ childList: true
75
+ });
76
+ });
77
+ const is_placeholder = info.rendering_options.type === "placeholder";
78
+ const reactProductCard = (0, $TZSbU$jsx)(react_template, {
79
+ display: is_placeholder ? null : display
80
+ });
81
+ const portal = $TZSbU$createPortal(reactProductCard, solid_container);
82
+ component_portals.add(portal);
83
+ set_portals([
84
+ ...component_portals
85
+ ]);
86
+ (0, $TZSbU$onCleanup)(()=>{
87
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
88
+ component_portals.delete(portal);
89
+ set_portals([
90
+ ...component_portals
91
+ ]);
92
+ });
93
+ 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
94
+ return [
95
+ solid_container
96
+ ];
97
+ }
98
+
99
+
100
+
101
+
102
+ function $02e2452814b6e7d6$export$4c0fa313cf50c4ad() {
103
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)(()=>(0, $TZSbU$SearchField)({
104
+ depict_search: (0, $42858f023ef23dab$export$8e769ad4338a911e).search
105
+ })), {});
106
+ }
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ let $8071251ee4e9ffa1$var$set = false;
115
+ let $8071251ee4e9ffa1$var$padding_animation;
116
+ function $8071251ee4e9ffa1$export$6453cbc34515a94d(is_search_page) {
117
+ if ($8071251ee4e9ffa1$var$set) return; // Just being safe
118
+ $8071251ee4e9ffa1$var$set = true;
119
+ let should_use_old_scroll = false;
120
+ const old_scrollTo = window.scrollTo;
121
+ window.scrollTo = (...args)=>{
122
+ if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
123
+ else should_use_old_scroll = true;
124
+ };
125
+ addEventListener("popstate", (0, $TZSbU$catchify)(()=>{
126
+ if (!is_search_page(location)) {
127
+ $8071251ee4e9ffa1$var$removeLotsOfPadding(); // Just making sure
128
+ return;
129
+ }
130
+ should_use_old_scroll = false;
131
+ $8071251ee4e9ffa1$var$addLotsOfPadding();
132
+ (0, $TZSbU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
133
+ $8071251ee4e9ffa1$var$removeLotsOfPadding();
134
+ });
135
+ }));
136
+ (0, $TZSbU$history_replacer)(()=>{
137
+ (0, $TZSbU$queueMacroTask)(()=>{
138
+ $8071251ee4e9ffa1$var$removeLotsOfPadding();
139
+ });
140
+ }, false);
141
+ window?.next?.router?.events?.on("routeChangeStart", ()=>{
142
+ $8071251ee4e9ffa1$var$addLotsOfPadding();
143
+ });
144
+ }
145
+ /*
146
+ Here we want to be able to add padding that *definitely* gets applied and then be able to revert precisely to what was before.
147
+ 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.
148
+ */ function $8071251ee4e9ffa1$var$addLotsOfPadding() {
149
+ if ($8071251ee4e9ffa1$var$padding_animation) return; // We're already showing a bunch of padding
150
+ $8071251ee4e9ffa1$var$padding_animation = document.body.animate({
151
+ paddingBottom: (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px",
152
+ offset: 0
153
+ }, 1);
154
+ $8071251ee4e9ffa1$var$padding_animation.pause();
155
+ }
156
+ function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
157
+ if ($8071251ee4e9ffa1$var$padding_animation) {
158
+ $8071251ee4e9ffa1$var$padding_animation.play();
159
+ $8071251ee4e9ffa1$var$padding_animation = undefined;
160
+ }
161
+ }
162
+
163
+
164
+
165
+
166
+ const $7216ca4c8308a0f9$export$599d4515591ef232 = (href)=>{
167
+ const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
168
+ window.next.router.push(href, undefined, {
169
+ shallow: shallow,
170
+ scroll: true
171
+ });
172
+ };
173
+
174
+
175
+
176
+ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
177
+ const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
178
+ const usedLocale = locale ?? (0, $TZSbU$en);
179
+ const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
180
+ if (!market || !merchant) {
181
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
182
+ return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
183
+ }
184
+ try {
185
+ const { search: search , category: category } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
186
+ const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
187
+ set_search_page_path(searchPagePath);
188
+ const on_navigation = typeof window?.next?.router !== "undefined" || navigateFunction ? (new_href)=>{
189
+ if (navigateFunction) navigateFunction(new_href);
190
+ else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_href);
191
+ } : undefined;
192
+ if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
193
+ search_query_url_param_name: urlParamName,
194
+ market: market,
195
+ merchant: merchant,
196
+ enable_category_suggestions: enableCategorySuggestions ?? false,
197
+ // default category suggestions to false for @depict-ai/react-ui (https://linear.app/depictai/issue/FRO-401/default-enablecategorysuggestions-to-false)
198
+ localization: usedLocale,
199
+ url_transformer: (url)=>url.pathname = (0, $TZSbU$untrack)(get_search_page_path),
200
+ on_navigation: on_navigation
201
+ }));
202
+ else {
203
+ search.market = market;
204
+ search.merchant = merchant;
205
+ search.localization = usedLocale;
206
+ }
207
+ if (!category) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).category = new (0, $TZSbU$DepictCategory)({
208
+ market: market,
209
+ merchant: merchant,
210
+ localization: usedLocale,
211
+ on_navigation: on_navigation
212
+ }));
213
+ else {
214
+ category.market = market;
215
+ category.merchant = merchant;
216
+ category.localization = usedLocale;
217
+ }
218
+ (0, $8071251ee4e9ffa1$export$6453cbc34515a94d)((0, $c83ba9ab79386687$export$92a8f8b3c630fa0d));
219
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](true);
220
+ } catch (e) {
221
+ // Make sure to not break the users app if we throw
222
+ queueMicrotask(()=>{
223
+ throw e;
224
+ });
225
+ }
226
+ return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
227
+ }
228
+
229
+
230
+
231
+ const $4db0e2f013fc5124$export$3f4580d6398c5027 = /*#__PURE__*/ (0, $TZSbU$forwardRef)((_, ref)=>{
232
+ return /*#__PURE__*/ (0, $TZSbU$createElement)("div", {
233
+ className: "depict aligner",
234
+ style: {
235
+ height: "100%"
236
+ },
237
+ ref: ref
238
+ });
239
+ });
240
+
241
+
242
+
243
+
244
+
245
+
246
+ function $4a678f0c87b12e78$export$210723f5a54a7028(props) {
247
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($4a678f0c87b12e78$var$SolidSearchPage), props);
248
+ }
249
+ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
250
+ const depict_search = (0, $42858f023ef23dab$export$8e769ad4338a911e).search;
251
+ if (!depict_search) throw Error("No depict_search instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
252
+ const search_query_updating_blocked_signal = (0, $TZSbU$get_search_query_updating_blocked_signal)(depict_search);
253
+ if (!search_query_updating_blocked_signal) throw Error("No search_query_updating_blocked_signal when rendering SearchPage");
254
+ const [, set_search_query_updating_blocked_signal] = search_query_updating_blocked_signal;
255
+ const update_updating_blocked_signal = ()=>{
256
+ set_search_query_updating_blocked_signal(!(0, $c83ba9ab79386687$export$775e6b3892b5ad52)(location));
257
+ };
258
+ // 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
259
+ (0, $c83ba9ab79386687$export$74f3924c5027fe1d)(update_updating_blocked_signal); // if we navigate, re-check
260
+ (0, $TZSbU$createComputed)(()=>{
261
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_[0](); // if react defined path changes, re-check
262
+ update_updating_blocked_signal();
263
+ });
264
+ const component_portals = new Set();
265
+ return (0, $TZSbU$SearchPage)({
266
+ // Default config goes here
267
+ include_input_field: props.includeInputField ?? true,
268
+ cols_at_size: props.columnsAtSize ?? [
269
+ [
270
+ 4
271
+ ],
272
+ [
273
+ 3,
274
+ 1024
275
+ ],
276
+ [
277
+ 2,
278
+ 901
279
+ ]
280
+ ],
281
+ grid_spacing: props.gridSpacing ?? "2%",
282
+ // Todo: Do we need this?
283
+ get_product_id: ()=>"",
284
+ depict_search: depict_search,
285
+ product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
286
+ display: display,
287
+ info: info,
288
+ react_template: props.productCard,
289
+ component_portals: component_portals,
290
+ set_portals: set_portals
291
+ })
292
+ });
293
+ }
294
+
295
+
296
+
297
+
298
+
299
+
300
+ let $48d7f568740a317d$var$render_cb;
301
+ function $48d7f568740a317d$export$d87c61cecb2edf0d(props) {
302
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($48d7f568740a317d$var$SolidCategoryPage), props, "div", {}, (props)=>$48d7f568740a317d$var$render_cb?.(props));
303
+ }
304
+ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
305
+ const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
306
+ if (!depict_category) throw Error("No depict_category instance when rendering SearchPage. Did you forget to wrap your app in DepictProvider?");
307
+ const [category_state_set, set_category_state_set] = (0, $TZSbU$createSignal)(false);
308
+ $48d7f568740a317d$var$render_cb = (props)=>{
309
+ depict_category.category_id = props.categoryId;
310
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).category_path = location.pathname;
311
+ if (props.categoryId) set_category_state_set(true);
312
+ };
313
+ $48d7f568740a317d$var$render_cb(props);
314
+ const component_portals = new Set();
315
+ const category = ()=>(0, $TZSbU$CategoryPage)({
316
+ depict_category: depict_category,
317
+ cols_at_size: props.columnsAtSize ?? [
318
+ [
319
+ 4
320
+ ],
321
+ [
322
+ 3,
323
+ 1024
324
+ ],
325
+ [
326
+ 2,
327
+ 901
328
+ ]
329
+ ],
330
+ grid_spacing: props.gridSpacing ?? "2%",
331
+ get_product_id: ()=>"",
332
+ category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
333
+ show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
334
+ show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
335
+ product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
336
+ display: display,
337
+ info: info,
338
+ react_template: props.productCard,
339
+ component_portals: component_portals,
340
+ set_portals: set_portals
341
+ })
342
+ });
343
+ return (0, $c83ba9ab79386687$export$e5139bbbb9a05035)(category, category_state_set);
344
+ }
345
+
346
+
347
+
348
+
349
+
350
+ function $f866f7ed9f751af4$export$5646050d516e06bc() {
351
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f866f7ed9f751af4$var$vanilla_breadcrumbs), {});
352
+ }
353
+ function $f866f7ed9f751af4$var$vanilla_breadcrumbs() {
354
+ const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
355
+ if (!depict_category) throw Error("No depict_category instance when rendering BreadCrumbs. Did you forget to wrap your app in DepictProvider?");
356
+ return (0, $TZSbU$BreadCrumbs)({
357
+ depict_category: depict_category
358
+ });
359
+ }
360
+
361
+
362
+
363
+
364
+
365
+ function $b68a14248b7ef667$export$466cdc317043f6cb() {
366
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($b68a14248b7ef667$var$vanilla_quick_links), {});
367
+ }
368
+ function $b68a14248b7ef667$var$vanilla_quick_links() {
369
+ const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
370
+ if (!depict_category) throw Error("No depict_category instance when rendering QuickLinks. Did you forget to wrap your app in DepictProvider?");
371
+ return (0, $TZSbU$QuickLinks)({
372
+ depict_category: depict_category
373
+ });
374
+ }
375
+
376
+
377
+
378
+
379
+ const $f446a84f85ba06f6$export$3f37af283f8fb843 = ({ aspectRatio: aspectRatio })=>{
380
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$ContainedPlaceholderImage)({
381
+ aspect_ratio: aspectRatio
382
+ }), {}, "div", {
383
+ "height": "100%"
384
+ });
385
+ };
386
+
387
+
388
+
389
+
390
+ const $cbd250061abf11cb$export$89c6019e4baa40b1 = ({ width: width , height: height })=>{
391
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)(()=>(0, $TZSbU$Placeholder)({
392
+ width: width,
393
+ height: height
394
+ }), {}, "div", {
395
+ "height": "100%"
396
+ });
397
+ };
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+ const $5e26376d86621891$export$d69d8daa20eae175 = (createOpenModalParams)=>{
407
+ const { globalState: globalState , location: location , alignerRef: alignerRef } = createOpenModalParams;
408
+ const openModal = ()=>{
409
+ const headerAligner = alignerRef?.current;
410
+ if (!globalState.search) throw new Error("No active search in the app!");
411
+ if (!headerAligner && location === "aligned") throw new Error("No active search header aligner on the page!");
412
+ const alignment_height = headerAligner?.clientHeight;
413
+ if (location !== "aligned" || isNaN(alignment_height)) {
414
+ // Open centered modal
415
+ globalState.search.modal_open = true;
416
+ return;
417
+ }
418
+ const style_element = document.createElement("style");
419
+ document.head.append(style_element);
420
+ const resize_observer = new ResizeObserver((0, $TZSbU$catchify)(()=>{
421
+ const styles = (0, $TZSbU$styles_to_valid_css_string)({
422
+ ".depict.plp .depict-search-modal .query-input": {
423
+ "height": `${headerAligner?.clientHeight}px`
424
+ }
425
+ });
426
+ style_element.replaceChildren(styles);
427
+ }));
428
+ resize_observer.observe(headerAligner);
429
+ let dispose_aligner;
430
+ /**
431
+ * Setting position to fixed is important to make the modal work with align_field.
432
+ */ const style_props_ = (0, $TZSbU$createSignal)({
433
+ position: "fixed"
434
+ });
435
+ (0, $TZSbU$createRoot)((dispose)=>{
436
+ dispose_aligner = ()=>{
437
+ resize_observer.disconnect();
438
+ style_element.remove();
439
+ dispose();
440
+ };
441
+ (0, $TZSbU$align_field)(style_props_, headerAligner, undefined, false, "top");
442
+ });
443
+ globalState.search.modal_open = [
444
+ {
445
+ style_props_: style_props_
446
+ },
447
+ dispose_aligner
448
+ ];
449
+ };
450
+ return openModal;
451
+ };
452
+
453
+
454
+ function $cfa72c75e6cf6901$export$cc1e9aaf280afdcb(params) {
455
+ const open = (0, $5e26376d86621891$export$d69d8daa20eae175)({
456
+ globalState: $42858f023ef23dab$export$8e769ad4338a911e,
457
+ ...params
458
+ });
459
+ return {
460
+ open: open
461
+ };
462
+ }
463
+
464
+
465
+
466
+
467
+
468
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.59";
469
+
470
+
471
+
472
+
473
+ const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(href)=>{
474
+ const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
475
+ router.push(href, undefined, {
476
+ shallow: shallow,
477
+ scroll: true
478
+ });
479
+ };
480
+
481
+
482
+ /**
483
+ * Helper function that creates a function that can be used as the
484
+ * navigateFunction callback for DepictProvider when using react-router.
485
+ *
486
+ * React-router expect relative URLs, so this function will strip the
487
+ * protocol, hostname and port from the URL.
488
+ *
489
+ * @param navigateFunction what useNavigate() returns
490
+ * @returns a function that can be used as the navigateFunction callback for DepictProvider
491
+ */ const $01e1970add53d62a$export$d53481656a62aebe = (navigateFunction)=>(href)=>{
492
+ const url_object = new URL(href);
493
+ return navigateFunction(url_object.pathname + url_object.search + url_object.hash);
494
+ };
495
+
496
+
497
+ const $97603d19204ec48d$export$b8a61e5c71402559 = {
498
+ nextRouterNavigation: $a92aa2beb560b8af$export$804fac5697cfbe35,
499
+ reactRouterNavigation: $01e1970add53d62a$export$d53481656a62aebe
500
+ };
501
+
502
+
503
+ const $43099132aad1ceb6$var$package_name = "@depict-ai/react-ui";
504
+ (0, $TZSbU$dlog)($43099132aad1ceb6$var$package_name + " version", (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492));
505
+ (0, $TZSbU$add_to_version_info)({
506
+ [$43099132aad1ceb6$var$package_name]: (0, $c9c4d066f9a5b51b$export$83d89fbfd8236492)
507
+ });
508
+
509
+
510
+ export {$b68a14248b7ef667$export$466cdc317043f6cb as QuickLinks, $f866f7ed9f751af4$export$5646050d516e06bc as BreadCrumbs, $4db0e2f013fc5124$export$3f4580d6398c5027 as DepictAligner, $5376eb2a386cd90d$export$9fac37a9c21c2f3b as DepictProvider, $48d7f568740a317d$export$d87c61cecb2edf0d as DepictCategoryPage, $4a678f0c87b12e78$export$210723f5a54a7028 as DepictSearchPage, $02e2452814b6e7d6$export$4c0fa313cf50c4ad as DepictSearchField, $f446a84f85ba06f6$export$3f37af283f8fb843 as ImagePlaceholder, $cbd250061abf11cb$export$89c6019e4baa40b1 as TextPlaceholder, $cfa72c75e6cf6901$export$cc1e9aaf280afdcb as useDepictSearchModal, $43099132aad1ceb6$re_export$CategoryTitle as CategoryTitle, $43099132aad1ceb6$re_export$EmbeddedNumProducts as EmbeddedNumProducts, $c9c4d066f9a5b51b$export$83d89fbfd8236492 as version, $97603d19204ec48d$export$b8a61e5c71402559 as Navigation};
package/latest/index.cjs CHANGED
@@ -38,7 +38,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
38
38
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
39
39
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
40
40
  // Note, if you add an export here, also add one in src-server/main.ts
41
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.12";
41
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.13";
42
42
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
43
43
  usedLocale: $2IzJs$solidjs.createSignal((0, $2IzJs$depictaiuilocales.defaultLocale)),
44
44
  search_instances: new Map(),
package/latest/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.1.12";
6
+ export const version = "2.1.13";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
package/latest/index.js CHANGED
@@ -14,7 +14,7 @@ import { renderToString as $2GFvs$renderToString } from "react-dom/server";
14
14
  // Note, if you add an export here, also add one in src-server/main.ts
15
15
  import { register_es_version } from "../multi_import_deduplicator.mjs";
16
16
  register_es_version("react-ui", "latest");
17
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.12";
17
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.13";
18
18
  const $42858f023ef23dab$export$8e769ad4338a911e = {
19
19
  usedLocale: $2GFvs$createSignal((0, $2GFvs$defaultLocale)),
20
20
  search_instances: new Map(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "types": "ES10/index.d.ts",
@@ -135,10 +135,10 @@
135
135
  "@babel/plugin-transform-typescript": "^7.22.9",
136
136
  "@babel/runtime": "latest",
137
137
  "@babel/runtime-corejs3": "latest",
138
- "@depict-ai/dpc": "^1.0.44",
138
+ "@depict-ai/dpc": "^1.0.45",
139
139
  "@depict-ai/plp-styling": "^1.2.14",
140
- "@depict-ai/ui": "^2.1.20",
141
- "@depict-ai/utilishared": "^1.0.50",
140
+ "@depict-ai/ui": "^2.1.22",
141
+ "@depict-ai/utilishared": "^1.0.51",
142
142
  "solid-js": "^1.8.1"
143
143
  },
144
144
  "peerDependencies": {
@@ -185,7 +185,7 @@ function $3b36cc844440a979$export$e46079a2793e9ec7(props, set_portals) {
185
185
  }
186
186
  });
187
187
  }
188
- const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.12";
188
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.13";
189
189
  function $202459d454907b31$export$9fac37a9c21c2f3b(props) {
190
190
  return props.children;
191
191
  }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/ES10";
4
4
  import { Locale } from "@depict-ai/ui/locales/ES10";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/ES10";
6
- export const version = "2.1.12";
6
+ export const version = "2.1.13";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -162,7 +162,7 @@ function $cd68097a7ee08669$export$e46079a2793e9ec7(props, set_portals) {
162
162
  }
163
163
  });
164
164
  }
165
- const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.12";
165
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.13";
166
166
  function $5c4add0a8fe94894$export$9fac37a9c21c2f3b(props) {
167
167
  return props.children;
168
168
  }
@@ -177,7 +177,7 @@ function $c6b960f2a07285c8$export$e46079a2793e9ec7(props, set_portals) {
177
177
  }
178
178
  });
179
179
  }
180
- const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.12";
180
+ const $db7b67857900028b$export$83d89fbfd8236492 = "2.1.13";
181
181
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
182
182
  return props.children;
183
183
  }
@@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode, FC, ReactPortal, ReactElement } fr
3
3
  import { BaseProviderConfig, BaseSearchProviderConfig, BaseCategoryProviderConfig, ModernDisplayWithPageUrl, BaseProductListingConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui/latest";
4
4
  import { Locale } from "@depict-ai/ui/locales/latest";
5
5
  import { Display, ModernDisplay } from "@depict-ai/utilishared/latest";
6
- export const version = "2.1.12";
6
+ export const version = "2.1.13";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -154,7 +154,7 @@ function $4d5c3f13a5ae62a7$export$e46079a2793e9ec7(props, set_portals) {
154
154
  }
155
155
  });
156
156
  }
157
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.12";
157
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "2.1.13";
158
158
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
159
159
  return props.children;
160
160
  }