@depict-ai/ui 2.0.22 → 2.0.23

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.
@@ -16,6 +16,8 @@ function $parcel$export(e, n, v, s) {
16
16
  function $parcel$interopDefault(a) {
17
17
  return a && a.__esModule ? a.default : a;
18
18
  }
19
+ $parcel$export(module.exports, "encode_filters", () => $a68b73fd7ba0853f$export$58aa3f171519b6d7);
20
+ $parcel$export(module.exports, "decode_filters", () => $a68b73fd7ba0853f$export$f934fa24c3a86811);
19
21
  $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $28535bb7671c63d1$export$d7b7ab832c20e2f4);
20
22
  $parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export$e68cff63f76bd15b);
21
23
  $parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
@@ -72,7 +74,185 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
72
74
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
73
75
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
74
76
  /*! Depict.ai search and product listing SDK */
75
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.22";
77
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.23";
78
+ const $a68b73fd7ba0853f$var$fallback_operator = "in";
79
+ const $a68b73fd7ba0853f$var$fallback_token = "";
80
+ const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
81
+ const $a68b73fd7ba0853f$var$operator_map = {
82
+ "eq": "≡",
83
+ "neq": "≠",
84
+ "in": "∈",
85
+ "nin": "∉",
86
+ "leq": "≤",
87
+ "geq": "≥",
88
+ "inrange": "\uD83D\uDD22"
89
+ };
90
+ const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
91
+ const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
92
+ const $a68b73fd7ba0853f$var$range_delimiter = "-";
93
+ const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
94
+ const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
95
+ const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
96
+ const $a68b73fd7ba0853f$var$op_to_token = op => {
97
+ if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
98
+ return $a68b73fd7ba0853f$var$operator_map[op];
99
+ };
100
+ /**
101
+ * Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
102
+ * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
103
+ * No deep or mixed nesting levels are supported.
104
+ */
105
+ function $a68b73fd7ba0853f$var$array_is_serializable(array) {
106
+ let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
107
+ if (array.every(item => Array.isArray(item))) {
108
+ if (!is_root)
109
+ // Deeply nested arrays are not supported, but also don't exist as filters (yet)
110
+ return false;
111
+ return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
112
+ }
113
+ if (array.some(item => typeof item !== "string"))
114
+ // Numbers are not supported, since 1 and "1" would encode to the same thing
115
+ return false;
116
+ // Encoding reserved characters is not supported
117
+ return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
118
+ }
119
+ /**
120
+ * Human readable string[] or string[][] serialization for URLs.
121
+ * @param array
122
+ * @returns
123
+ */
124
+ function $a68b73fd7ba0853f$var$encode_array(array) {
125
+ const is_nested = array.every(item => Array.isArray(item));
126
+ if (is_nested) return array.map($a68b73fd7ba0853f$var$encode_array).join($a68b73fd7ba0853f$var$array_item_delimiter) + $a68b73fd7ba0853f$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
127
+ return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
128
+ }
129
+ function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
130
+ const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
131
+ if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
132
+ .map($a68b73fd7ba0853f$var$decode_array);
133
+ return encoded_array.split($a68b73fd7ba0853f$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
134
+ .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
135
+ }
136
+ function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
137
+ if (data === "true")
138
+ // boolean encoding
139
+ return "1";
140
+ if (data === "false")
141
+ // boolean encoding
142
+ return "0";
143
+ const data_is_array = Array.isArray(data);
144
+ if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
145
+ // numeric range filter encoding
146
+ return data.join($a68b73fd7ba0853f$var$range_delimiter);
147
+ if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
148
+ const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
149
+ if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
150
+ // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
151
+ // In that case we add a delimiter suffix at the end
152
+ return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
153
+ return encoded_data;
154
+ }
155
+ // Fallback encoding
156
+ return $3hooq$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
157
+ }
158
+ function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
159
+ if (encoded_data === "1") return "true";
160
+ if (encoded_data === "0") return "false";
161
+ if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
162
+ if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
163
+ try {
164
+ return JSON.parse($3hooq$depictaiutilishared.base64_decode_unicode(encoded_data));
165
+ } catch (e) {
166
+ $3hooq$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
167
+ }
168
+ return null;
169
+ }
170
+ function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
171
+ for (const filter of filters) {
172
+ const {
173
+ field: field,
174
+ op: op,
175
+ data: data
176
+ } = filter;
177
+ const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
178
+ search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
179
+ }
180
+ }
181
+ function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
182
+ const found_filters = [];
183
+ for (const key of search_params.keys()) {
184
+ // Allow for backwards compatibility with the old filter query param prefix
185
+ let chosen_prefix = filter_query_param_prefix;
186
+ if (!key.startsWith(chosen_prefix)) {
187
+ chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
188
+ if (!key.startsWith(chosen_prefix)) continue;
189
+ }
190
+ const encoded_data = search_params.get(key);
191
+ if (!encoded_data) continue;
192
+ const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
193
+ let [, token] = _ref;
194
+ return key.endsWith(token);
195
+ }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
196
+ const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
197
+ if (!data) continue;
198
+ const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
199
+ found_filters.push({
200
+ field: field,
201
+ op: op,
202
+ data: data
203
+ });
204
+ }
205
+ return found_filters;
206
+ }
207
+ function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
208
+ if (!sorting) return;
209
+ const {
210
+ field: field,
211
+ order: order
212
+ } = sorting;
213
+ const ascending = order === "asc";
214
+ search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
215
+ }
216
+ function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
217
+ const encoded_sorting = search_params.get(sorting_query_param_);
218
+ if (!encoded_sorting) return;
219
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
220
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
221
+ order: "asc"
222
+ };
223
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
224
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
225
+ order: "desc"
226
+ };
227
+ $3hooq$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
228
+ return;
229
+ }
230
+ function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
231
+ // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
232
+ const keys = [...search_params.keys()];
233
+ for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($a68b73fd7ba0853f$var$legacy_filter_prefix)) search_params.delete(key);
234
+ }
235
+ const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
236
+ function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
237
+ let {
238
+ to_url_: to_url_,
239
+ set_clearing_flag_: set_clearing_flag_,
240
+ from_search_params_ = new URLSearchParams(location.search),
241
+ sorting_query_param_: sorting_query_param_,
242
+ filter_query_param_prefix_: filter_query_param_prefix_
243
+ } = _ref2;
244
+ if (!to_url_) return to_url_;
245
+ const was_url_object = to_url_ instanceof URL;
246
+ const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
247
+ const {
248
+ searchParams: searchParams
249
+ } = url_object;
250
+ if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
251
+ if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
252
+ for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
253
+ if (was_url_object) return url_object;
254
+ return url_object.href;
255
+ }
76
256
  const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
77
257
  function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
78
258
  const our_object = {};
@@ -4793,184 +4973,6 @@ function $b7cbae23560f11b9$var$ActualFloatingButtons(_ref2) {
4793
4973
  }));
4794
4974
  return $3hooq$solidjsweb.ssr($b7cbae23560f11b9$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "floating-buttons ".concat(is_scrolling_upwards() && modal_is_closed() && !regular_buttons_are_in_view() && !get_is_showing_toast() ? "show-them" : ""), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.filter_text_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9bde34303b3e9ace$export$28f6150e232898de), {})), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.sorting_text_(), true), false), ((_current_sorting_$ = current_sorting_[0]()) === null || _current_sorting_$ === void 0 ? void 0 : _current_sorting_$.order) === "asc" ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $0b45ba458cbff67a$export$da32f7add8a22e86), {})) : $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $549632402b57d811$export$d10e63059ddb9fd4), {})), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.scroll_to_top_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $31f4a789db864adb$export$2624c5890f1bbcf7), {})));
4795
4975
  }
4796
- const $a68b73fd7ba0853f$var$fallback_operator = "in";
4797
- const $a68b73fd7ba0853f$var$fallback_token = "";
4798
- const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
4799
- const $a68b73fd7ba0853f$var$operator_map = {
4800
- "eq": "≡",
4801
- "neq": "≠",
4802
- "in": "∈",
4803
- "nin": "∉",
4804
- "leq": "≤",
4805
- "geq": "≥",
4806
- "inrange": "\uD83D\uDD22"
4807
- };
4808
- const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
4809
- const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
4810
- const $a68b73fd7ba0853f$var$range_delimiter = "-";
4811
- const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
4812
- const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
4813
- const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
4814
- const $a68b73fd7ba0853f$var$op_to_token = op => {
4815
- if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
4816
- return $a68b73fd7ba0853f$var$operator_map[op];
4817
- };
4818
- /**
4819
- * Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
4820
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
4821
- * No deep or mixed nesting levels are supported.
4822
- */
4823
- function $a68b73fd7ba0853f$var$array_is_serializable(array) {
4824
- let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4825
- if (array.every(item => Array.isArray(item))) {
4826
- if (!is_root)
4827
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
4828
- return false;
4829
- return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
4830
- }
4831
- if (array.some(item => typeof item !== "string"))
4832
- // Numbers are not supported, since 1 and "1" would encode to the same thing
4833
- return false;
4834
- // Encoding reserved characters is not supported
4835
- return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
4836
- }
4837
- /**
4838
- * Human readable string[] or string[][] serialization for URLs.
4839
- * @param array
4840
- * @returns
4841
- */
4842
- function $a68b73fd7ba0853f$var$encode_array(array) {
4843
- const is_nested = array.every(item => Array.isArray(item));
4844
- if (is_nested) return array.map($a68b73fd7ba0853f$var$encode_array).join($a68b73fd7ba0853f$var$array_item_delimiter) + $a68b73fd7ba0853f$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
4845
- return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
4846
- }
4847
- function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
4848
- const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
4849
- if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
4850
- .map($a68b73fd7ba0853f$var$decode_array);
4851
- return encoded_array.split($a68b73fd7ba0853f$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
4852
- .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
4853
- }
4854
- function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
4855
- if (data === "true")
4856
- // boolean encoding
4857
- return "1";
4858
- if (data === "false")
4859
- // boolean encoding
4860
- return "0";
4861
- const data_is_array = Array.isArray(data);
4862
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
4863
- // numeric range filter encoding
4864
- return data.join($a68b73fd7ba0853f$var$range_delimiter);
4865
- if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
4866
- const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
4867
- if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
4868
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
4869
- // In that case we add a delimiter suffix at the end
4870
- return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
4871
- return encoded_data;
4872
- }
4873
- // Fallback encoding
4874
- return $3hooq$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
4875
- }
4876
- function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
4877
- if (encoded_data === "1") return "true";
4878
- if (encoded_data === "0") return "false";
4879
- if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
4880
- if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
4881
- try {
4882
- return JSON.parse($3hooq$depictaiutilishared.base64_decode_unicode(encoded_data));
4883
- } catch (e) {
4884
- $3hooq$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
4885
- }
4886
- return null;
4887
- }
4888
- function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
4889
- for (const filter of filters) {
4890
- const {
4891
- field: field,
4892
- op: op,
4893
- data: data
4894
- } = filter;
4895
- const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
4896
- search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
4897
- }
4898
- }
4899
- function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
4900
- const found_filters = [];
4901
- for (const key of search_params.keys()) {
4902
- // Allow for backwards compatibility with the old filter query param prefix
4903
- let chosen_prefix = filter_query_param_prefix;
4904
- if (!key.startsWith(chosen_prefix)) {
4905
- chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
4906
- if (!key.startsWith(chosen_prefix)) continue;
4907
- }
4908
- const encoded_data = search_params.get(key);
4909
- if (!encoded_data) continue;
4910
- const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
4911
- let [, token] = _ref;
4912
- return key.endsWith(token);
4913
- }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
4914
- const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
4915
- if (!data) continue;
4916
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
4917
- found_filters.push({
4918
- field: field,
4919
- op: op,
4920
- data: data
4921
- });
4922
- }
4923
- return found_filters;
4924
- }
4925
- function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
4926
- if (!sorting) return;
4927
- const {
4928
- field: field,
4929
- order: order
4930
- } = sorting;
4931
- const ascending = order === "asc";
4932
- search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
4933
- }
4934
- function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
4935
- const encoded_sorting = search_params.get(sorting_query_param_);
4936
- if (!encoded_sorting) return;
4937
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
4938
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
4939
- order: "asc"
4940
- };
4941
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
4942
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
4943
- order: "desc"
4944
- };
4945
- $3hooq$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
4946
- return;
4947
- }
4948
- function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
4949
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
4950
- const keys = [...search_params.keys()];
4951
- for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($a68b73fd7ba0853f$var$legacy_filter_prefix)) search_params.delete(key);
4952
- }
4953
- const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
4954
- function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
4955
- let {
4956
- to_url_: to_url_,
4957
- set_clearing_flag_: set_clearing_flag_,
4958
- from_search_params_ = new URLSearchParams(location.search),
4959
- sorting_query_param_: sorting_query_param_,
4960
- filter_query_param_prefix_: filter_query_param_prefix_
4961
- } = _ref2;
4962
- if (!to_url_) return to_url_;
4963
- const was_url_object = to_url_ instanceof URL;
4964
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
4965
- const {
4966
- searchParams: searchParams
4967
- } = url_object;
4968
- if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
4969
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
4970
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
4971
- if (was_url_object) return url_object;
4972
- return url_object.href;
4973
- }
4974
4976
  const $1c819dc9d820a149$var$_tmpl$ = ["<nav", ' class="crumbs"', ">", "</nav>"],
4975
4977
  $1c819dc9d820a149$var$_tmpl$2 = ["<a", ' class="crumb"', ">", "</a>"],
4976
4978
  $1c819dc9d820a149$var$_tmpl$3 = ["<span", ' class="separator">', "</span>"];
@@ -1,5 +1,5 @@
1
1
  import { JSX, Accessor, Signal, Setter } from "solid-js";
2
- import { Amazing_Slider, Display, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/ES10";
2
+ import { Display, Amazing_Slider, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/ES10";
3
3
  import { SearchFilter, SearchRequest } from "@depict-ai/types/api/SearchRequest";
4
4
  import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
5
5
  import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
@@ -7,7 +7,46 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.22";
10
+ export const version = "2.0.23";
11
+ export type SDKGridSpacing = string | {
12
+ horizontal: string;
13
+ vertical: string;
14
+ };
15
+ export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
16
+ type FilterWithData = WithRequired<SearchFilter, "data">;
17
+ export interface SDKRenderingInfo {
18
+ /**
19
+ * If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
20
+ */
21
+ set_on_index_change: (fn: (index: number) => void) => void;
22
+ merchant: string;
23
+ market: string;
24
+ }
25
+ export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
26
+ type WithoutMerchant<T> = T extends {
27
+ merchant: string;
28
+ } ? Omit<T, "merchant"> : T;
29
+ type WithoutMarket<T> = T extends {
30
+ market: string;
31
+ } ? Omit<T, "market"> : T;
32
+ export type ProductCardTemplateWithoutMerchantAndMarket<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: WithoutMerchant<WithoutMarket<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
33
+ /**
34
+ * Will be sent to backend to indicate whether the query_id_ is for a collection or category.
35
+ * Backend defaults to category if not specified.
36
+ */
37
+ export type ListingType = "collection" | "category";
38
+ type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
39
+ actual_field?: string;
40
+ })[] : never;
41
+ type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
42
+ /**
43
+ * Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
44
+ */
45
+ export function encode_filters(filters: FilterWithData[], search_params: URLSearchParams, filter_query_param_prefix: string): void;
46
+ /**
47
+ * Function that decodes the filters from the provided query parameters and returns them as an array of filter objects.
48
+ */
49
+ export function decode_filters(search_params: URLSearchParams, filter_query_param_prefix: string): FilterWithData[];
11
50
  /**
12
51
  * Provider to wrap every listing (group of products) in
13
52
  * Used for example for deduplicating ResizeObservers for responsive images
@@ -84,37 +123,6 @@ export function SlidableItems({
84
123
  * Returns accessor with the size of the provided element, including padding and border (I think)
85
124
  */
86
125
  export function make_accurate_size_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
87
- export type SDKGridSpacing = string | {
88
- horizontal: string;
89
- vertical: string;
90
- };
91
- export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
92
- type FilterWithData = WithRequired<SearchFilter, "data">;
93
- export interface SDKRenderingInfo {
94
- /**
95
- * If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
96
- */
97
- set_on_index_change: (fn: (index: number) => void) => void;
98
- merchant: string;
99
- market: string;
100
- }
101
- export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
102
- type WithoutMerchant<T> = T extends {
103
- merchant: string;
104
- } ? Omit<T, "merchant"> : T;
105
- type WithoutMarket<T> = T extends {
106
- market: string;
107
- } ? Omit<T, "market"> : T;
108
- export type ProductCardTemplateWithoutMerchantAndMarket<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: WithoutMerchant<WithoutMarket<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
109
- /**
110
- * Will be sent to backend to indicate whether the query_id_ is for a collection or category.
111
- * Backend defaults to category if not specified.
112
- */
113
- export type ListingType = "collection" | "category";
114
- type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
115
- actual_field?: string;
116
- })[] : never;
117
- type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
118
126
  export type SDKColsAtSize = [number, number?][];
119
127
  /**
120
128
  * Transform SDK ColsAtSize into valid Layout ColsAtSize