@depict-ai/ui 2.0.22 → 2.0.24

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,9 @@ 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, "strip_encoded_filter_and_sort", () => $a68b73fd7ba0853f$export$916e6850778505f6);
20
+ $parcel$export(module.exports, "encode_filters", () => $a68b73fd7ba0853f$export$58aa3f171519b6d7);
21
+ $parcel$export(module.exports, "decode_filters", () => $a68b73fd7ba0853f$export$f934fa24c3a86811);
19
22
  $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $28535bb7671c63d1$export$d7b7ab832c20e2f4);
20
23
  $parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export$e68cff63f76bd15b);
21
24
  $parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
@@ -72,7 +75,185 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
72
75
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
73
76
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
74
77
  /*! Depict.ai search and product listing SDK */
75
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.22";
78
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.24";
79
+ const $a68b73fd7ba0853f$var$fallback_operator = "in";
80
+ const $a68b73fd7ba0853f$var$fallback_token = "";
81
+ const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
82
+ const $a68b73fd7ba0853f$var$operator_map = {
83
+ "eq": "≡",
84
+ "neq": "≠",
85
+ "in": "∈",
86
+ "nin": "∉",
87
+ "leq": "≤",
88
+ "geq": "≥",
89
+ "inrange": "\uD83D\uDD22"
90
+ };
91
+ const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
92
+ const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
93
+ const $a68b73fd7ba0853f$var$range_delimiter = "-";
94
+ const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
95
+ const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
96
+ const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
97
+ const $a68b73fd7ba0853f$var$op_to_token = op => {
98
+ if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
99
+ return $a68b73fd7ba0853f$var$operator_map[op];
100
+ };
101
+ /**
102
+ * 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.
103
+ * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
104
+ * No deep or mixed nesting levels are supported.
105
+ */
106
+ function $a68b73fd7ba0853f$var$array_is_serializable(array) {
107
+ let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
108
+ if (array.every(item => Array.isArray(item))) {
109
+ if (!is_root)
110
+ // Deeply nested arrays are not supported, but also don't exist as filters (yet)
111
+ return false;
112
+ return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
113
+ }
114
+ if (array.some(item => typeof item !== "string"))
115
+ // Numbers are not supported, since 1 and "1" would encode to the same thing
116
+ return false;
117
+ // Encoding reserved characters is not supported
118
+ return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
119
+ }
120
+ /**
121
+ * Human readable string[] or string[][] serialization for URLs.
122
+ * @param array
123
+ * @returns
124
+ */
125
+ function $a68b73fd7ba0853f$var$encode_array(array) {
126
+ const is_nested = array.every(item => Array.isArray(item));
127
+ 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
128
+ return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
129
+ }
130
+ function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
131
+ const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
132
+ if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
133
+ .map($a68b73fd7ba0853f$var$decode_array);
134
+ 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
135
+ .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
136
+ }
137
+ function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
138
+ if (data === "true")
139
+ // boolean encoding
140
+ return "1";
141
+ if (data === "false")
142
+ // boolean encoding
143
+ return "0";
144
+ const data_is_array = Array.isArray(data);
145
+ if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
146
+ // numeric range filter encoding
147
+ return data.join($a68b73fd7ba0853f$var$range_delimiter);
148
+ if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
149
+ const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
150
+ if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
151
+ // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
152
+ // In that case we add a delimiter suffix at the end
153
+ return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
154
+ return encoded_data;
155
+ }
156
+ // Fallback encoding
157
+ return $3hooq$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
158
+ }
159
+ function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
160
+ if (encoded_data === "1") return "true";
161
+ if (encoded_data === "0") return "false";
162
+ if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
163
+ if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
164
+ try {
165
+ return JSON.parse($3hooq$depictaiutilishared.base64_decode_unicode(encoded_data));
166
+ } catch (e) {
167
+ $3hooq$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
168
+ }
169
+ return null;
170
+ }
171
+ function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
172
+ for (const filter of filters) {
173
+ const {
174
+ field: field,
175
+ op: op,
176
+ data: data
177
+ } = filter;
178
+ const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
179
+ search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
180
+ }
181
+ }
182
+ function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
183
+ const found_filters = [];
184
+ for (const key of search_params.keys()) {
185
+ // Allow for backwards compatibility with the old filter query param prefix
186
+ let chosen_prefix = filter_query_param_prefix;
187
+ if (!key.startsWith(chosen_prefix)) {
188
+ chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
189
+ if (!key.startsWith(chosen_prefix)) continue;
190
+ }
191
+ const encoded_data = search_params.get(key);
192
+ if (!encoded_data) continue;
193
+ const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
194
+ let [, token] = _ref;
195
+ return key.endsWith(token);
196
+ }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
197
+ const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
198
+ if (!data) continue;
199
+ const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
200
+ found_filters.push({
201
+ field: field,
202
+ op: op,
203
+ data: data
204
+ });
205
+ }
206
+ return found_filters;
207
+ }
208
+ function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
209
+ if (!sorting) return;
210
+ const {
211
+ field: field,
212
+ order: order
213
+ } = sorting;
214
+ const ascending = order === "asc";
215
+ search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
216
+ }
217
+ function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
218
+ const encoded_sorting = search_params.get(sorting_query_param_);
219
+ if (!encoded_sorting) return;
220
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
221
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
222
+ order: "asc"
223
+ };
224
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
225
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
226
+ order: "desc"
227
+ };
228
+ $3hooq$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
229
+ return;
230
+ }
231
+ function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
232
+ // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
233
+ const keys = [...search_params.keys()];
234
+ 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);
235
+ }
236
+ const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
237
+ function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
238
+ let {
239
+ to_url_: to_url_,
240
+ set_clearing_flag_: set_clearing_flag_,
241
+ from_search_params_ = new URLSearchParams(location.search),
242
+ sorting_query_param_: sorting_query_param_,
243
+ filter_query_param_prefix_: filter_query_param_prefix_
244
+ } = _ref2;
245
+ if (!to_url_) return to_url_;
246
+ const was_url_object = to_url_ instanceof URL;
247
+ const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
248
+ const {
249
+ searchParams: searchParams
250
+ } = url_object;
251
+ if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
252
+ if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
253
+ for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
254
+ if (was_url_object) return url_object;
255
+ return url_object.href;
256
+ }
76
257
  const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
77
258
  function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
78
259
  const our_object = {};
@@ -4793,184 +4974,6 @@ function $b7cbae23560f11b9$var$ActualFloatingButtons(_ref2) {
4793
4974
  }));
4794
4975
  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
4976
  }
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
4977
  const $1c819dc9d820a149$var$_tmpl$ = ["<nav", ' class="crumbs"', ">", "</nav>"],
4975
4978
  $1c819dc9d820a149$var$_tmpl$2 = ["<a", ' class="crumb"', ">", "</a>"],
4976
4979
  $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,54 @@ 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.24";
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[];
50
+ /**
51
+ * Remove all Depict filter/sorting query parameters from the given URLSearchParams object.
52
+ * Used to reset the URLSearchParams object to a clean state, before adding new filters/sorting.
53
+ * @param search_params
54
+ * @param filter_query_param_prefix Prefix of the filter query parameters
55
+ * @param sorting_query_param
56
+ */
57
+ export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
11
58
  /**
12
59
  * Provider to wrap every listing (group of products) in
13
60
  * Used for example for deduplicating ResizeObservers for responsive images
@@ -84,37 +131,6 @@ export function SlidableItems({
84
131
  * Returns accessor with the size of the provided element, including padding and border (I think)
85
132
  */
86
133
  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
134
  export type SDKColsAtSize = [number, number?][];
119
135
  /**
120
136
  * Transform SDK ColsAtSize into valid Layout ColsAtSize