@depict-ai/ui 1.3.3 → 1.3.5

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.
@@ -1,11 +1,12 @@
1
1
  var $diwD4$depictaiutilishared = require("@depict-ai/utilishared");
2
- var $diwD4$solidjs = require("solid-js");
3
2
  var $diwD4$solidjsweb = require("solid-js/web");
3
+ var $diwD4$solidjs = require("solid-js");
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
6
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
7
  }
8
8
 
9
+ $parcel$export(module.exports, "SolidLayout", () => $f48d0fbb00835aaa$export$d21e32dfedac04be);
9
10
  $parcel$export(module.exports, "general_modal_abstraction", () => $9abb0a35d4b60ed3$export$79b1565500412d9b);
10
11
  $parcel$export(module.exports, "CrossIcon", () => $c77c68e559a1506c$export$3b621d86b1566b2);
11
12
  $parcel$export(module.exports, "GenericSliderArrowButton", () => $0f313083912e447a$export$8be2714ec7f169ee);
@@ -43,8 +44,176 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
43
44
  $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
44
45
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
45
46
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
46
- /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.3";
47
+ /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.5";
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+ function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
60
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
61
+ return (0, $diwD4$solidjs.createMemo)(()=>$5f7d55c710fd1bc2$var$unwrapping_helper(elements));
62
+ }
63
+ function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
64
+ const result = [];
65
+ if (Array.isArray(elements)) for(let i = 0; i < elements.length; i++){
66
+ const element = elements[i];
67
+ result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
68
+ }
69
+ else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));
70
+ else if (elements != undefined && typeof elements != "boolean") result.push(elements);
71
+ return result;
72
+ }
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
82
+ class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {
83
+ }
84
+ class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
85
+ constructor(templateError){
86
+ super("Uncaught error in product card template", {
87
+ cause: templateError
88
+ });
89
+ }
90
+ }
91
+
47
92
 
93
+ const $edafe91daf3091d7$var$_tmpl$ = [
94
+ "<div",
95
+ ' class="',
96
+ '">',
97
+ "</div>"
98
+ ];
99
+ function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
100
+ return (0, $diwD4$solidjs.ErrorBoundary)({
101
+ fallback (err, retry) {
102
+ const { message_: message_ , severity_: severity_ } = props;
103
+ let message = message_;
104
+ if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
105
+ console.error(err.cause);
106
+ message = `${message}: ${err.message}`;
107
+ } else (0, $diwD4$depictaiutilishared.report)([
108
+ err,
109
+ message_
110
+ ], severity_);
111
+ props.on_error_?.(retry);
112
+ return (0, $diwD4$solidjsweb.ssr)($edafe91daf3091d7$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), (0, $diwD4$solidjsweb.ssrClassList)(Object.fromEntries(props.class_list_?.map((c)=>[
113
+ c,
114
+ true
115
+ ]) || [])), (0, $diwD4$solidjsweb.escape)(message));
116
+ },
117
+ get children () {
118
+ return props.children;
119
+ }
120
+ });
121
+ }
122
+
123
+
124
+ const $f48d0fbb00835aaa$var$_tmpl$ = [
125
+ "<div",
126
+ ' class="',
127
+ '">',
128
+ "</div>"
129
+ ], $f48d0fbb00835aaa$var$_tmpl$2 = [
130
+ "<style",
131
+ ' type="text/css">',
132
+ "</style>"
133
+ ];
134
+ function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
135
+ return (0, $diwD4$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
136
+ get message_ () {
137
+ return "Failed calculating " + props.layout + " layout";
138
+ },
139
+ severity_: "error",
140
+ get children () {
141
+ return $f48d0fbb00835aaa$var$ActualSolidLayout(props);
142
+ }
143
+ });
144
+ }
145
+ function $f48d0fbb00835aaa$var$ActualSolidLayout(props) {
146
+ // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
147
+ const show_all_rows = (0, $diwD4$solidjs.createMemo)(()=>props.rows === "all");
148
+ const rows_or_empty_object = (0, $diwD4$solidjs.createMemo)(()=>show_all_rows() ? {} : props.rows);
149
+ const button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $diwD4$solidjs.createMemo)(()=>rows_or_empty_object().button));
150
+ const have_a_button = (0, $diwD4$solidjs.createMemo)(()=>{
151
+ const button = button_elements();
152
+ return !(!button || Array.isArray(button) && !button.length);
153
+ });
154
+ const [get_styling, set_styling] = (0, $diwD4$solidjs.createSignal)();
155
+ const container_class = (0, $diwD4$depictaiutilishared.make_random_classname)();
156
+ const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
157
+ const container_element = (0, $diwD4$solidjsweb.ssrElement)("div", props.element_attributes, ()=>(0, $diwD4$solidjsweb.escape)(props.children), true);
158
+ const [get_children_count, set_children_count] = (0, $diwD4$solidjs.createSignal)(0);
159
+ const update_children_count = ()=>set_children_count(container_element.children.length);
160
+ const col_styling = (0, $diwD4$solidjs.createMemo)(()=>(0, $diwD4$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
161
+ const default_currently_visible_signal = (0, $diwD4$solidjs.createSignal)(0); // Keep this signal here so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
162
+ const rows_visible_signal = (0, $diwD4$solidjs.createMemo)(()=>rows_or_empty_object().currently_visible || default_currently_visible_signal);
163
+ const get_rows_visible = (0, $diwD4$solidjs.createMemo)(()=>rows_visible_signal()[0]());
164
+ const set_rows_visible = (0, $diwD4$solidjs.createMemo)(()=>rows_visible_signal()[1]);
165
+ const button_class = (0, $diwD4$depictaiutilishared.make_random_classname)();
166
+ const button_container = (0, $diwD4$solidjs.createMemo)(()=>have_a_button() && (0, $diwD4$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), "load-more-container " + (0, $diwD4$solidjsweb.escape)(button_class, true), (0, $diwD4$solidjsweb.escape)(rows_or_empty_object().button)));
167
+ container_element.classList.add(container_class);
168
+ (0, $diwD4$solidjs.createComputed)(()=>{
169
+ // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
170
+ const rows_visible = get_rows_visible();
171
+ const max_rows = rows_or_empty_object().max_rows;
172
+ if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
173
+ });
174
+ (0, $diwD4$solidjs.createRenderEffect)(()=>{
175
+ // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
176
+ if (show_all_rows()) {
177
+ // no view more functionality requested
178
+ set_styling(()=>col_styling);
179
+ return;
180
+ }
181
+ (0, $diwD4$solidjs.untrack)(()=>set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
182
+ update_children_count();
183
+ const mutation_observer = new MutationObserver((0, $diwD4$depictaiutilishared.catchify)(update_children_count));
184
+ mutation_observer.observe(container_element, {
185
+ childList: true
186
+ });
187
+ (0, $diwD4$solidjs.onCleanup)(()=>mutation_observer.disconnect());
188
+ set_styling(// this is needed because solid will think that the memo-accessor is a setter function otherwise
189
+ ()=>(0, $diwD4$solidjs.createMemo)(()=>{
190
+ const { rows_per_click: rows_per_click , max_rows: max_rows = -1 } = rows_or_empty_object();
191
+ const rows_visible = get_rows_visible();
192
+ const children_count = get_children_count();
193
+ return col_styling() + props.cols_at_size.map((options)=>{
194
+ const [, min, max] = options;
195
+ let should_hide_button;
196
+ let visible_recs;
197
+ if (props.disable_partial_rows) {
198
+ visible_recs = (0, $diwD4$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
199
+ const visible_recs_next_show_more = (0, $diwD4$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0), // Should this really be zero when we default rows_per_click to 1?
200
+ children_count, options);
201
+ should_hide_button = visible_recs === visible_recs_next_show_more;
202
+ } else {
203
+ visible_recs = (0, $diwD4$depictaiutilishared.layout_get_total_rec_amount_for_row)(rows_visible, options);
204
+ should_hide_button = visible_recs >= children_count;
205
+ }
206
+ const should_hide_button_final = button_class && (should_hide_button || max_rows !== -1 && rows_visible >= max_rows);
207
+ return `${(0, $diwD4$depictaiutilishared.layout_media_query_header)(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${button_class}{display:none!important}` : ``}}`;
208
+ }).join("");
209
+ }));
210
+ });
211
+ return [
212
+ container_element,
213
+ button_container(),
214
+ (0, $diwD4$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$2, (0, $diwD4$solidjsweb.ssrHydrationKey)(), get_styling)
215
+ ];
216
+ }
48
217
 
49
218
 
50
219
 
@@ -705,70 +874,6 @@ function $fc23d7668ae0011d$export$a2cc176055f8f08() {
705
874
 
706
875
 
707
876
 
708
-
709
-
710
- // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
711
- class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {
712
- }
713
- class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
714
- constructor(templateError){
715
- super("Uncaught error in product card template", {
716
- cause: templateError
717
- });
718
- }
719
- }
720
-
721
-
722
- const $edafe91daf3091d7$var$_tmpl$ = [
723
- "<div",
724
- ' class="',
725
- '">',
726
- "</div>"
727
- ];
728
- function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
729
- return (0, $diwD4$solidjs.ErrorBoundary)({
730
- fallback (err, retry) {
731
- const { message_: message_ , severity_: severity_ } = props;
732
- let message = message_;
733
- if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
734
- console.error(err.cause);
735
- message = `${message}: ${err.message}`;
736
- } else (0, $diwD4$depictaiutilishared.report)([
737
- err,
738
- message_
739
- ], severity_);
740
- props.on_error_?.(retry);
741
- return (0, $diwD4$solidjsweb.ssr)($edafe91daf3091d7$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), (0, $diwD4$solidjsweb.ssrClassList)(Object.fromEntries(props.class_list_?.map((c)=>[
742
- c,
743
- true
744
- ]) || [])), (0, $diwD4$solidjsweb.escape)(message));
745
- },
746
- get children () {
747
- return props.children;
748
- }
749
- });
750
- }
751
-
752
-
753
-
754
-
755
- function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
756
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
757
- return (0, $diwD4$solidjs.createMemo)(()=>$5f7d55c710fd1bc2$var$unwrapping_helper(elements));
758
- }
759
- function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
760
- const result = [];
761
- if (Array.isArray(elements)) for(let i = 0; i < elements.length; i++){
762
- const element = elements[i];
763
- result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
764
- }
765
- else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));
766
- else if (elements != undefined && typeof elements != "boolean") result.push(elements);
767
- return result;
768
- }
769
-
770
-
771
-
772
877
  let $0caf87eaa19079da$var$cached_placeholder_element;
773
878
  let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
774
879
  function $0caf87eaa19079da$export$f33414a4df0afd3f({ product_card_template_: product_card_template_ , num_placeholders_: num_placeholders_ }) {
@@ -1083,100 +1188,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({ plp_results_: plp_results_
1083
1188
 
1084
1189
 
1085
1190
 
1086
-
1087
-
1088
-
1089
-
1090
-
1091
-
1092
-
1093
-
1094
- const $f48d0fbb00835aaa$var$_tmpl$ = [
1095
- "<div",
1096
- ' class="',
1097
- '">',
1098
- "</div>"
1099
- ], $f48d0fbb00835aaa$var$_tmpl$2 = [
1100
- "<style",
1101
- ' type="text/css">',
1102
- "</style>"
1103
- ];
1104
- function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
1105
- return (0, $diwD4$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
1106
- get message_ () {
1107
- return "Failed calculating " + props.layout + " layout";
1108
- },
1109
- severity_: "error",
1110
- get children () {
1111
- return $f48d0fbb00835aaa$var$ActualSolidLayout(props);
1112
- }
1113
- });
1114
- }
1115
- function $f48d0fbb00835aaa$var$ActualSolidLayout(props) {
1116
- // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
1117
- const show_all_rows = (0, $diwD4$solidjs.createMemo)(()=>props.rows === "all");
1118
- const rows_or_empty_object = (0, $diwD4$solidjs.createMemo)(()=>show_all_rows() ? {} : props.rows);
1119
- const button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $diwD4$solidjs.createMemo)(()=>rows_or_empty_object().button));
1120
- const have_a_button = (0, $diwD4$solidjs.createMemo)(()=>{
1121
- const button = button_elements();
1122
- return !(!button || Array.isArray(button) && !button.length);
1123
- });
1124
- const [get_styling, set_styling] = (0, $diwD4$solidjs.createSignal)();
1125
- const container_class = (0, $diwD4$depictaiutilishared.make_random_classname)();
1126
- const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
1127
- const container_element = (0, $diwD4$solidjsweb.ssrElement)("div", props.element_attributes, ()=>(0, $diwD4$solidjsweb.escape)(props.children), true);
1128
- const [get_children_count, set_children_count] = (0, $diwD4$solidjs.createSignal)(0);
1129
- const update_children_count = ()=>set_children_count(container_element.children.length);
1130
- const col_styling = (0, $diwD4$solidjs.createMemo)(()=>(0, $diwD4$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
1131
- const rows_visible_signal = (0, $diwD4$solidjs.createMemo)(()=>rows_or_empty_object().currently_visible || (0, $diwD4$solidjs.createSignal)(0));
1132
- const get_rows_visible = (0, $diwD4$solidjs.createMemo)(()=>rows_visible_signal()[0]());
1133
- const set_rows_visible = (0, $diwD4$solidjs.createMemo)(()=>rows_visible_signal()[1]);
1134
- const button_class = (0, $diwD4$depictaiutilishared.make_random_classname)();
1135
- const button_container = (0, $diwD4$solidjs.createMemo)(()=>have_a_button() && (0, $diwD4$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), "load-more-container " + (0, $diwD4$solidjsweb.escape)(button_class, true), (0, $diwD4$solidjsweb.escape)(rows_or_empty_object().button)));
1136
- container_element.classList.add(container_class);
1137
- (0, $diwD4$solidjs.createRenderEffect)(()=>{
1138
- // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
1139
- if (show_all_rows()) {
1140
- // no view more functionality requested
1141
- set_styling(()=>col_styling);
1142
- return;
1143
- }
1144
- (0, $diwD4$solidjs.untrack)(()=>set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
1145
- update_children_count();
1146
- const mutation_observer = new MutationObserver((0, $diwD4$depictaiutilishared.catchify)(update_children_count));
1147
- mutation_observer.observe(container_element, {
1148
- childList: true
1149
- });
1150
- (0, $diwD4$solidjs.onCleanup)(()=>mutation_observer.disconnect());
1151
- set_styling(// this is needed because solid will think that the memo-accessor is a setter function otherwise
1152
- ()=>(0, $diwD4$solidjs.createMemo)(()=>{
1153
- const { rows_per_click: rows_per_click , max_rows: max_rows = -1 } = rows_or_empty_object();
1154
- return col_styling() + props.cols_at_size.map((options)=>{
1155
- const [, min, max] = options;
1156
- let should_hide_button;
1157
- let visible_recs;
1158
- if (props.disable_partial_rows) {
1159
- visible_recs = (0, $diwD4$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(get_rows_visible(), get_children_count(), options);
1160
- const visible_recs_next_show_more = (0, $diwD4$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(get_rows_visible() + (rows_per_click || 0), // Should this really be zero when we default rows_per_click to 1?
1161
- get_children_count(), options);
1162
- should_hide_button = visible_recs === visible_recs_next_show_more;
1163
- } else {
1164
- visible_recs = (0, $diwD4$depictaiutilishared.layout_get_total_rec_amount_for_row)(get_rows_visible(), options);
1165
- should_hide_button = visible_recs >= get_children_count();
1166
- }
1167
- const should_hide_button_final = button_class && (should_hide_button || max_rows !== -1 && get_rows_visible() >= max_rows);
1168
- return `${(0, $diwD4$depictaiutilishared.layout_media_query_header)(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${button_class}{display:none!important}` : ``}}`;
1169
- }).join("");
1170
- }));
1171
- });
1172
- return [
1173
- container_element,
1174
- button_container(),
1175
- (0, $diwD4$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$2, (0, $diwD4$solidjsweb.ssrHydrationKey)(), get_styling)
1176
- ];
1177
- }
1178
-
1179
-
1180
1191
  const $fe76fb463cc60b89$var$_tmpl$ = [
1181
1192
  "<div",
1182
1193
  ' class="',
@@ -4960,7 +4971,9 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
4960
4971
  return [
4961
4972
  (0, $diwD4$solidjsweb.isServer) ? "<!-- Category page based on Depict SDK -->" : document.createComment("Category page based on Depict SDK"),
4962
4973
  (0, $diwD4$solidjsweb.ssr)($840d88a04b2d22a7$var$_tmpl$4, (0, $diwD4$solidjsweb.ssrHydrationKey)() + (0, $diwD4$solidjsweb.ssrAttribute)("id", (0, $diwD4$solidjsweb.escape)((0, $0b6e2070a98de347$export$44dad306455dddf).PLP_CATEGORY, true), false), (0, $diwD4$solidjsweb.escape)((0, $diwD4$solidjsweb.createComponent)((0, $diwD4$solidjs.Show), {
4963
- when: show_breadcrumbs_,
4974
+ get when () {
4975
+ return show_breadcrumbs_();
4976
+ },
4964
4977
  get children () {
4965
4978
  return (0, $diwD4$solidjsweb.createComponent)((0, $e53b2e7e632ac4cb$export$5646050d516e06bc), {
4966
4979
  crumb_data_: crumb_data_,
@@ -4969,7 +4982,9 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
4969
4982
  });
4970
4983
  }
4971
4984
  })), (0, $diwD4$solidjsweb.escape)((0, $diwD4$solidjsweb.createComponent)((0, $diwD4$solidjs.Show), {
4972
- when: show_quicklinks_,
4985
+ get when () {
4986
+ return show_quicklinks_();
4987
+ },
4973
4988
  get children () {
4974
4989
  return (0, $diwD4$solidjsweb.createComponent)((0, $8cceb1d3a967f369$export$466cdc317043f6cb), {
4975
4990
  quicklinks_data_: quicklinks_data_,