@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.
package/ES10/index.cjs CHANGED
@@ -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 $52FdA$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($52FdA$depictaiutilishared.base64_decode_unicode(encoded_data));
165
+ } catch (e) {
166
+ $52FdA$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
+ $52FdA$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__*/$52FdA$solidjs.createContext();
77
257
  function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
78
258
  const our_object = {};
@@ -6049,184 +6229,6 @@ function $b7cbae23560f11b9$var$ActualFloatingButtons(_ref2) {
6049
6229
  })();
6050
6230
  }
6051
6231
  $52FdA$solidjsweb.delegateEvents(["click"]);
6052
- const $a68b73fd7ba0853f$var$fallback_operator = "in";
6053
- const $a68b73fd7ba0853f$var$fallback_token = "";
6054
- const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
6055
- const $a68b73fd7ba0853f$var$operator_map = {
6056
- "eq": "≡",
6057
- "neq": "≠",
6058
- "in": "∈",
6059
- "nin": "∉",
6060
- "leq": "≤",
6061
- "geq": "≥",
6062
- "inrange": "\uD83D\uDD22"
6063
- };
6064
- const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
6065
- const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
6066
- const $a68b73fd7ba0853f$var$range_delimiter = "-";
6067
- const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
6068
- const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
6069
- const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
6070
- const $a68b73fd7ba0853f$var$op_to_token = op => {
6071
- if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
6072
- return $a68b73fd7ba0853f$var$operator_map[op];
6073
- };
6074
- /**
6075
- * 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.
6076
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
6077
- * No deep or mixed nesting levels are supported.
6078
- */
6079
- function $a68b73fd7ba0853f$var$array_is_serializable(array) {
6080
- let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6081
- if (array.every(item => Array.isArray(item))) {
6082
- if (!is_root)
6083
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
6084
- return false;
6085
- return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
6086
- }
6087
- if (array.some(item => typeof item !== "string"))
6088
- // Numbers are not supported, since 1 and "1" would encode to the same thing
6089
- return false;
6090
- // Encoding reserved characters is not supported
6091
- return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
6092
- }
6093
- /**
6094
- * Human readable string[] or string[][] serialization for URLs.
6095
- * @param array
6096
- * @returns
6097
- */
6098
- function $a68b73fd7ba0853f$var$encode_array(array) {
6099
- const is_nested = array.every(item => Array.isArray(item));
6100
- 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
6101
- return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
6102
- }
6103
- function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
6104
- const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
6105
- if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
6106
- .map($a68b73fd7ba0853f$var$decode_array);
6107
- 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
6108
- .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
6109
- }
6110
- function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
6111
- if (data === "true")
6112
- // boolean encoding
6113
- return "1";
6114
- if (data === "false")
6115
- // boolean encoding
6116
- return "0";
6117
- const data_is_array = Array.isArray(data);
6118
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
6119
- // numeric range filter encoding
6120
- return data.join($a68b73fd7ba0853f$var$range_delimiter);
6121
- if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
6122
- const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
6123
- if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
6124
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
6125
- // In that case we add a delimiter suffix at the end
6126
- return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
6127
- return encoded_data;
6128
- }
6129
- // Fallback encoding
6130
- return $52FdA$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
6131
- }
6132
- function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
6133
- if (encoded_data === "1") return "true";
6134
- if (encoded_data === "0") return "false";
6135
- if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
6136
- if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
6137
- try {
6138
- return JSON.parse($52FdA$depictaiutilishared.base64_decode_unicode(encoded_data));
6139
- } catch (e) {
6140
- $52FdA$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
6141
- }
6142
- return null;
6143
- }
6144
- function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
6145
- for (const filter of filters) {
6146
- const {
6147
- field: field,
6148
- op: op,
6149
- data: data
6150
- } = filter;
6151
- const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
6152
- search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
6153
- }
6154
- }
6155
- function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
6156
- const found_filters = [];
6157
- for (const key of search_params.keys()) {
6158
- // Allow for backwards compatibility with the old filter query param prefix
6159
- let chosen_prefix = filter_query_param_prefix;
6160
- if (!key.startsWith(chosen_prefix)) {
6161
- chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
6162
- if (!key.startsWith(chosen_prefix)) continue;
6163
- }
6164
- const encoded_data = search_params.get(key);
6165
- if (!encoded_data) continue;
6166
- const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
6167
- let [, token] = _ref;
6168
- return key.endsWith(token);
6169
- }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
6170
- const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
6171
- if (!data) continue;
6172
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
6173
- found_filters.push({
6174
- field: field,
6175
- op: op,
6176
- data: data
6177
- });
6178
- }
6179
- return found_filters;
6180
- }
6181
- function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
6182
- if (!sorting) return;
6183
- const {
6184
- field: field,
6185
- order: order
6186
- } = sorting;
6187
- const ascending = order === "asc";
6188
- search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
6189
- }
6190
- function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
6191
- const encoded_sorting = search_params.get(sorting_query_param_);
6192
- if (!encoded_sorting) return;
6193
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
6194
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
6195
- order: "asc"
6196
- };
6197
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
6198
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
6199
- order: "desc"
6200
- };
6201
- $52FdA$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
6202
- return;
6203
- }
6204
- function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
6205
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
6206
- const keys = [...search_params.keys()];
6207
- 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);
6208
- }
6209
- const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
6210
- function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
6211
- let {
6212
- to_url_: to_url_,
6213
- set_clearing_flag_: set_clearing_flag_,
6214
- from_search_params_ = new URLSearchParams(location.search),
6215
- sorting_query_param_: sorting_query_param_,
6216
- filter_query_param_prefix_: filter_query_param_prefix_
6217
- } = _ref2;
6218
- if (!to_url_) return to_url_;
6219
- const was_url_object = to_url_ instanceof URL;
6220
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
6221
- const {
6222
- searchParams: searchParams
6223
- } = url_object;
6224
- if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
6225
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
6226
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
6227
- if (was_url_object) return url_object;
6228
- return url_object.href;
6229
- }
6230
6232
  const $1c819dc9d820a149$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<nav class="crumbs"></nav>`, 2),
6231
6233
  $1c819dc9d820a149$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<a class="crumb"></a>`, 2),
6232
6234
  $1c819dc9d820a149$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class="separator"></span>`, 2);
package/ES10/index.d.ts CHANGED
@@ -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