@depict-ai/react-ui 2.1.6 → 2.1.8

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.
Files changed (48) hide show
  1. package/ES10/index.cjs +14 -1
  2. package/ES10/index.d.ts +2 -2
  3. package/ES10/index.js +15 -2
  4. package/dist/main.js +527 -0
  5. package/dist/module.js +510 -0
  6. package/dist/styles/components/PLP/Buttons.scss +181 -0
  7. package/dist/styles/components/PLP/MorphingSign.scss +30 -0
  8. package/dist/styles/components/PLP/PLPResults.scss +26 -0
  9. package/dist/styles/components/PLP/ProductListingPage.scss +168 -0
  10. package/dist/styles/components/PLP/ScrollStatus.scss +31 -0
  11. package/dist/styles/components/PLP/SelectedFilters.scss +82 -0
  12. package/dist/styles/components/PLP/SlidableItems.scss +121 -0
  13. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +84 -0
  14. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +800 -0
  15. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +158 -0
  16. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +152 -0
  17. package/dist/styles/components/PLP/Toast.scss +59 -0
  18. package/dist/styles/components/PLP/index.scss +51 -0
  19. package/dist/styles/components/category/BreadCrumbs.scss +32 -0
  20. package/dist/styles/components/category/CategoryTitle.scss +40 -0
  21. package/dist/styles/components/category/QuickLinks.scss +80 -0
  22. package/dist/styles/components/category/index.scss +23 -0
  23. package/dist/styles/components/search/Autocomplete.scss +197 -0
  24. package/dist/styles/components/search/CategorySuggestions.scss +82 -0
  25. package/dist/styles/components/search/InstantCard.scss +122 -0
  26. package/dist/styles/components/search/InstantResults.scss +12 -0
  27. package/dist/styles/components/search/PreviousSearches.scss +90 -0
  28. package/dist/styles/components/search/QueryInput.scss +189 -0
  29. package/dist/styles/components/search/SearchModal.scss +101 -0
  30. package/dist/styles/components/search/SearchRecommendations.scss +28 -0
  31. package/dist/styles/components/search/ShowingResultsFor.scss +13 -0
  32. package/dist/styles/components/search/index.scss +40 -0
  33. package/dist/styles/default.css +1 -0
  34. package/dist/styles/helpers/custom_input.scss +194 -0
  35. package/dist/styles/helpers/supports-hover.scss +7 -0
  36. package/dist/styles/helpers/utils.scss +90 -0
  37. package/dist/styles/plain-css-fallback-styling.css +1 -1
  38. package/dist/styles/variables.scss +61 -0
  39. package/latest/index.cjs +13 -1
  40. package/latest/index.d.ts +2 -2
  41. package/latest/index.js +14 -2
  42. package/package.json +5 -5
  43. package/server/ES10/index.cjs +17 -3
  44. package/server/ES10/index.d.ts +2 -2
  45. package/server/ES10/index.js +18 -4
  46. package/server/latest/index.cjs +16 -3
  47. package/server/latest/index.d.ts +2 -2
  48. package/server/latest/index.js +17 -4
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.6";
41
+ const $efbdd2dab4314170$export$83d89fbfd8236492 = "2.1.8";
42
42
  const $ef516b1f92253963$export$8e769ad4338a911e = {
43
43
  usedLocale: $2kiy7$solidjs.createSignal((0, $2kiy7$depictaiuilocales.defaultLocale)),
44
44
  search_instances: new Map(),
@@ -810,7 +810,19 @@ const $07e1b96355935829$export$89c6019e4baa40b1 = raw_react_props => {
810
810
  }
811
811
  });
812
812
  };
813
+
814
+ // Triggered by synsam trying to put null here and typescript somehow not complaining
815
+
816
+ function $6e5ce22b65512b0a$export$4daadad26e48a2c7(props) {
817
+ var _props$recommendation;
818
+ const us = "RecommendationSlider/RecommendationGrid:";
819
+ if (typeof (props === null || props === void 0 ? void 0 : (_props$recommendation = props.recommendations) === null || _props$recommendation === void 0 ? void 0 : _props$recommendation.then) !== "function") {
820
+ $2kiy7$depictaiutilishared.dwarn(us, "Got", props.recommendations, "which is not thenable");
821
+ throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
822
+ }
823
+ }
813
824
  function $745b83c12baac3c0$export$82cfdc85a4d15688(props) {
825
+ $6e5ce22b65512b0a$export$4daadad26e48a2c7(props);
814
826
  return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
815
827
  solid_component: $745b83c12baac3c0$export$5abb40edfde2a843,
816
828
  props: props
@@ -887,6 +899,7 @@ function $27d583018ba6e604$export$bd8acc07a8bae229(props, set_portals) {
887
899
  });
888
900
  }
889
901
  function $8f89f8a832210d6b$export$b0a773486c1c2312(props) {
902
+ $6e5ce22b65512b0a$export$4daadad26e48a2c7(props);
890
903
  return $e7ba61a7074c02d3$export$f6e64e17bd69eeef({
891
904
  solid_component: (0, $27d583018ba6e604$export$bd8acc07a8bae229),
892
905
  props: props,
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.6";
6
+ export const version = "2.1.8";
7
7
  interface UsePerformanceClientReturn {
8
8
  dpc: DPC;
9
9
  }
@@ -607,7 +607,7 @@ export function useFetchRecommendations<T extends Display>(): UseFetchRecommenda
607
607
  * Helper function to navigate to a new page depending on the navigation library used.
608
608
  */
609
609
  export const Navigation: {
610
- nextRouterNavigation: (router: import("next/router").NextRouter) => import("ui/components/DepictProvider").NavigateFunction;
610
+ nextRouterNavigation: (router: import("next/router").NextRouter) => import("src/ui/components/DepictProvider").NavigateFunction;
611
611
  };
612
612
  export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
613
613
  export type { PageURLCreator, DisplayTransformers } from "@depict-ai/ui";
package/ES10/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { add_to_version_info as $jb2Oo$add_to_version_info, catchify as $jb2Oo$catchify, queueMacroTask as $jb2Oo$queueMacroTask, instant_exec_on_suspect_history_change as $jb2Oo$instant_exec_on_suspect_history_change, derror as $jb2Oo$derror } from "@depict-ai/utilishared/ES10";
1
+ import { add_to_version_info as $jb2Oo$add_to_version_info, catchify as $jb2Oo$catchify, queueMacroTask as $jb2Oo$queueMacroTask, instant_exec_on_suspect_history_change as $jb2Oo$instant_exec_on_suspect_history_change, derror as $jb2Oo$derror, dwarn as $jb2Oo$dwarn } from "@depict-ai/utilishared/ES10";
2
2
  import { CategoryTitle as $383b6fd56bf151bd$re_export$CategoryTitle, embedded_num_products as $383b6fd56bf151bd$re_export$EmbeddedNumProducts, DepictAPI as $jb2Oo$DepictAPI, DepictSearch as $jb2Oo$DepictSearch, DepictCategory as $jb2Oo$DepictCategory, get_search_query_updating_blocked_signal as $jb2Oo$get_search_query_updating_blocked_signal, SearchPage as $jb2Oo$SearchPage, defaultColsAtSize as $jb2Oo$defaultColsAtSize, defaultGridSpacing as $jb2Oo$defaultGridSpacing, ProductCardError as $jb2Oo$ProductCardError, CategoryPage as $jb2Oo$CategoryPage, defaultCategoryTitlePlugin as $jb2Oo$defaultCategoryTitlePlugin, BreadCrumbs as $jb2Oo$BreadCrumbs, QuickLinks as $jb2Oo$QuickLinks, ImagePlaceholder as $jb2Oo$ImagePlaceholder, TextPlaceholder as $jb2Oo$TextPlaceholder, RecommendationSlider as $jb2Oo$RecommendationSlider, RecommendationGrid as $jb2Oo$RecommendationGrid, open_modal_with_alignment as $jb2Oo$open_modal_with_alignment, SearchField as $jb2Oo$SearchField, fetchDepictRecommendations as $jb2Oo$fetchDepictRecommendations } from "@depict-ai/ui/ES10";
3
3
  import { untrack as $jb2Oo$untrack, createRoot as $jb2Oo$createRoot, createEffect as $jb2Oo$createEffect, createMemo as $jb2Oo$createMemo, createComponent as $jb2Oo$createComponent, Show as $jb2Oo$Show, createSignal as $jb2Oo$createSignal, createComputed as $jb2Oo$createComputed, onCleanup as $jb2Oo$onCleanup, getOwner as $jb2Oo$getOwner, runWithOwner as $jb2Oo$runWithOwner, on as $jb2Oo$on, mapArray as $jb2Oo$mapArray } from "solid-js";
4
4
  import { createElement as $jb2Oo$createElement, Fragment as $jb2Oo$Fragment, useEffect as $jb2Oo$useEffect, useState as $jb2Oo$useState, useRef as $jb2Oo$useRef, forwardRef as $jb2Oo$forwardRef, Component as $jb2Oo$Component, useCallback as $jb2Oo$useCallback } from "react";
@@ -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.6";
17
+ const $9bd9bb8700ab2ada$export$83d89fbfd8236492 = "2.1.8";
18
18
  const $8c691d7f86317052$export$8e769ad4338a911e = {
19
19
  usedLocale: $jb2Oo$createSignal((0, $jb2Oo$defaultLocale)),
20
20
  search_instances: new Map(),
@@ -786,7 +786,19 @@ const $2c7738b65cbcac1c$export$89c6019e4baa40b1 = raw_react_props => {
786
786
  }
787
787
  });
788
788
  };
789
+
790
+ // Triggered by synsam trying to put null here and typescript somehow not complaining
791
+
792
+ function $758339150fbfe9d5$export$4daadad26e48a2c7(props) {
793
+ var _props$recommendation;
794
+ const us = "RecommendationSlider/RecommendationGrid:";
795
+ if (typeof (props === null || props === void 0 ? void 0 : (_props$recommendation = props.recommendations) === null || _props$recommendation === void 0 ? void 0 : _props$recommendation.then) !== "function") {
796
+ $jb2Oo$dwarn(us, "Got", props.recommendations, "which is not thenable");
797
+ throw new Error(us + " props.recommendations needs to be a promise that is either unresolved (`new Promise(() => {})`) so we can show placeholders, or resolved (`Promise.resolve(recommendation_array)`) to the recommendations to show");
798
+ }
799
+ }
789
800
  function $c02e9fd51f31a1bd$export$82cfdc85a4d15688(props) {
801
+ $758339150fbfe9d5$export$4daadad26e48a2c7(props);
790
802
  return $0dd9d9a9c7da4c1d$export$f6e64e17bd69eeef({
791
803
  solid_component: $c02e9fd51f31a1bd$export$5abb40edfde2a843,
792
804
  props: props
@@ -863,6 +875,7 @@ function $48b0916cc674770c$export$bd8acc07a8bae229(props, set_portals) {
863
875
  });
864
876
  }
865
877
  function $31abef71c0a2d3fc$export$b0a773486c1c2312(props) {
878
+ $758339150fbfe9d5$export$4daadad26e48a2c7(props);
866
879
  return $0dd9d9a9c7da4c1d$export$f6e64e17bd69eeef({
867
880
  solid_component: (0, $48b0916cc674770c$export$bd8acc07a8bae229),
868
881
  props: props,
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
+