@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/latest/index.cjs CHANGED
@@ -10,6 +10,8 @@ function $parcel$export(e, n, v, s) {
10
10
  configurable: true
11
11
  });
12
12
  }
13
+ $parcel$export(module.exports, "encode_filters", () => $1ab22f2cd39b3061$export$58aa3f171519b6d7);
14
+ $parcel$export(module.exports, "decode_filters", () => $1ab22f2cd39b3061$export$f934fa24c3a86811);
13
15
  $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
14
16
  $parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
15
17
  $parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
@@ -66,7 +68,180 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
66
68
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
67
69
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
68
70
  /*! Depict.ai search and product listing SDK */
69
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.22";
71
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.23";
72
+ const $1ab22f2cd39b3061$var$fallback_operator = "in";
73
+ const $1ab22f2cd39b3061$var$fallback_token = "";
74
+ const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
75
+ const $1ab22f2cd39b3061$var$operator_map = {
76
+ "eq": "≡",
77
+ "neq": "≠",
78
+ "in": "∈",
79
+ "nin": "∉",
80
+ "leq": "≤",
81
+ "geq": "≥",
82
+ "inrange": "\uD83D\uDD22"
83
+ };
84
+ const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
85
+ const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
86
+ const $1ab22f2cd39b3061$var$range_delimiter = "-";
87
+ const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
88
+ const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
89
+ const $1ab22f2cd39b3061$var$empty_item_replacement = "0️⃣";
90
+ const $1ab22f2cd39b3061$var$op_to_token = op => {
91
+ if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
92
+ return $1ab22f2cd39b3061$var$operator_map[op];
93
+ };
94
+ /**
95
+ * 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.
96
+ * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
97
+ * No deep or mixed nesting levels are supported.
98
+ */
99
+ function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
100
+ if (array.every(item => Array.isArray(item))) {
101
+ if (!is_root)
102
+ // Deeply nested arrays are not supported, but also don't exist as filters (yet)
103
+ return false;
104
+ return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
105
+ }
106
+ if (array.some(item => typeof item !== "string"))
107
+ // Numbers are not supported, since 1 and "1" would encode to the same thing
108
+ return false;
109
+ // Encoding reserved characters is not supported
110
+ return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
111
+ }
112
+ /**
113
+ * Human readable string[] or string[][] serialization for URLs.
114
+ * @param array
115
+ * @returns
116
+ */
117
+ function $1ab22f2cd39b3061$var$encode_array(array) {
118
+ const is_nested = array.every(item => Array.isArray(item));
119
+ if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
120
+ return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
121
+ }
122
+ function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
123
+ const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
124
+ if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
125
+ .map($1ab22f2cd39b3061$var$decode_array);
126
+ return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
127
+ .map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
128
+ }
129
+ function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
130
+ if (data === "true")
131
+ // boolean encoding
132
+ return "1";
133
+ if (data === "false")
134
+ // boolean encoding
135
+ return "0";
136
+ const data_is_array = Array.isArray(data);
137
+ if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
138
+ // numeric range filter encoding
139
+ return data.join($1ab22f2cd39b3061$var$range_delimiter);
140
+ if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
141
+ const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
142
+ if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
143
+ // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
144
+ // In that case we add a delimiter suffix at the end
145
+ return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
146
+ return encoded_data;
147
+ }
148
+ // Fallback encoding
149
+ return $gVhhF$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
150
+ }
151
+ function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
152
+ if (encoded_data === "1") return "true";
153
+ if (encoded_data === "0") return "false";
154
+ if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
155
+ if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
156
+ try {
157
+ return JSON.parse($gVhhF$depictaiutilishared.base64_decode_unicode(encoded_data));
158
+ } catch (e) {
159
+ $gVhhF$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
160
+ }
161
+ return null;
162
+ }
163
+ function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
164
+ for (const filter of filters) {
165
+ const {
166
+ field: field,
167
+ op: op,
168
+ data: data
169
+ } = filter;
170
+ const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
171
+ search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
172
+ }
173
+ }
174
+ function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
175
+ const found_filters = [];
176
+ for (const key of search_params.keys()) {
177
+ // Allow for backwards compatibility with the old filter query param prefix
178
+ let chosen_prefix = filter_query_param_prefix;
179
+ if (!key.startsWith(chosen_prefix)) {
180
+ chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
181
+ if (!key.startsWith(chosen_prefix)) continue;
182
+ }
183
+ const encoded_data = search_params.get(key);
184
+ if (!encoded_data) continue;
185
+ const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
186
+ const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
187
+ if (!data) continue;
188
+ const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
189
+ found_filters.push({
190
+ field: field,
191
+ op: op,
192
+ data: data
193
+ });
194
+ }
195
+ return found_filters;
196
+ }
197
+ function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
198
+ if (!sorting) return;
199
+ const {
200
+ field: field,
201
+ order: order
202
+ } = sorting;
203
+ const ascending = order === "asc";
204
+ search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
205
+ }
206
+ function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
207
+ const encoded_sorting = search_params.get(sorting_query_param_);
208
+ if (!encoded_sorting) return;
209
+ if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
210
+ field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
211
+ order: "asc"
212
+ };
213
+ if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
214
+ field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
215
+ order: "desc"
216
+ };
217
+ $gVhhF$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
218
+ return;
219
+ }
220
+ function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
221
+ // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
222
+ const keys = [...search_params.keys()];
223
+ for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
224
+ }
225
+ const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
226
+ function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
227
+ to_url_: to_url_,
228
+ set_clearing_flag_: set_clearing_flag_,
229
+ from_search_params_ = new URLSearchParams(location.search),
230
+ sorting_query_param_: sorting_query_param_,
231
+ filter_query_param_prefix_: filter_query_param_prefix_
232
+ }) {
233
+ if (!to_url_) return to_url_;
234
+ const was_url_object = to_url_ instanceof URL;
235
+ const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
236
+ const {
237
+ searchParams: searchParams
238
+ } = url_object;
239
+ if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
240
+ if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
241
+ for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
242
+ if (was_url_object) return url_object;
243
+ return url_object.href;
244
+ }
70
245
  const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
71
246
  function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
72
247
  const our_object = {};
@@ -5648,179 +5823,6 @@ function $2fb324fbcc7b4a7b$var$ActualFloatingButtons({
5648
5823
  })();
5649
5824
  }
5650
5825
  $gVhhF$solidjsweb.delegateEvents(["click"]);
5651
- const $1ab22f2cd39b3061$var$fallback_operator = "in";
5652
- const $1ab22f2cd39b3061$var$fallback_token = "";
5653
- const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
5654
- const $1ab22f2cd39b3061$var$operator_map = {
5655
- "eq": "≡",
5656
- "neq": "≠",
5657
- "in": "∈",
5658
- "nin": "∉",
5659
- "leq": "≤",
5660
- "geq": "≥",
5661
- "inrange": "\uD83D\uDD22"
5662
- };
5663
- const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
5664
- const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
5665
- const $1ab22f2cd39b3061$var$range_delimiter = "-";
5666
- const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
5667
- const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
5668
- const $1ab22f2cd39b3061$var$empty_item_replacement = "0️⃣";
5669
- const $1ab22f2cd39b3061$var$op_to_token = op => {
5670
- if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
5671
- return $1ab22f2cd39b3061$var$operator_map[op];
5672
- };
5673
- /**
5674
- * 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.
5675
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
5676
- * No deep or mixed nesting levels are supported.
5677
- */
5678
- function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
5679
- if (array.every(item => Array.isArray(item))) {
5680
- if (!is_root)
5681
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
5682
- return false;
5683
- return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
5684
- }
5685
- if (array.some(item => typeof item !== "string"))
5686
- // Numbers are not supported, since 1 and "1" would encode to the same thing
5687
- return false;
5688
- // Encoding reserved characters is not supported
5689
- return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
5690
- }
5691
- /**
5692
- * Human readable string[] or string[][] serialization for URLs.
5693
- * @param array
5694
- * @returns
5695
- */
5696
- function $1ab22f2cd39b3061$var$encode_array(array) {
5697
- const is_nested = array.every(item => Array.isArray(item));
5698
- if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
5699
- return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
5700
- }
5701
- function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
5702
- const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
5703
- if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
5704
- .map($1ab22f2cd39b3061$var$decode_array);
5705
- return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
5706
- .map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
5707
- }
5708
- function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
5709
- if (data === "true")
5710
- // boolean encoding
5711
- return "1";
5712
- if (data === "false")
5713
- // boolean encoding
5714
- return "0";
5715
- const data_is_array = Array.isArray(data);
5716
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
5717
- // numeric range filter encoding
5718
- return data.join($1ab22f2cd39b3061$var$range_delimiter);
5719
- if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
5720
- const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
5721
- if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
5722
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
5723
- // In that case we add a delimiter suffix at the end
5724
- return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
5725
- return encoded_data;
5726
- }
5727
- // Fallback encoding
5728
- return $gVhhF$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
5729
- }
5730
- function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
5731
- if (encoded_data === "1") return "true";
5732
- if (encoded_data === "0") return "false";
5733
- if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
5734
- if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
5735
- try {
5736
- return JSON.parse($gVhhF$depictaiutilishared.base64_decode_unicode(encoded_data));
5737
- } catch (e) {
5738
- $gVhhF$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
5739
- }
5740
- return null;
5741
- }
5742
- function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
5743
- for (const filter of filters) {
5744
- const {
5745
- field: field,
5746
- op: op,
5747
- data: data
5748
- } = filter;
5749
- const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
5750
- search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
5751
- }
5752
- }
5753
- function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
5754
- const found_filters = [];
5755
- for (const key of search_params.keys()) {
5756
- // Allow for backwards compatibility with the old filter query param prefix
5757
- let chosen_prefix = filter_query_param_prefix;
5758
- if (!key.startsWith(chosen_prefix)) {
5759
- chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
5760
- if (!key.startsWith(chosen_prefix)) continue;
5761
- }
5762
- const encoded_data = search_params.get(key);
5763
- if (!encoded_data) continue;
5764
- const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
5765
- const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
5766
- if (!data) continue;
5767
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
5768
- found_filters.push({
5769
- field: field,
5770
- op: op,
5771
- data: data
5772
- });
5773
- }
5774
- return found_filters;
5775
- }
5776
- function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
5777
- if (!sorting) return;
5778
- const {
5779
- field: field,
5780
- order: order
5781
- } = sorting;
5782
- const ascending = order === "asc";
5783
- search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
5784
- }
5785
- function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
5786
- const encoded_sorting = search_params.get(sorting_query_param_);
5787
- if (!encoded_sorting) return;
5788
- if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
5789
- field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
5790
- order: "asc"
5791
- };
5792
- if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
5793
- field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
5794
- order: "desc"
5795
- };
5796
- $gVhhF$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
5797
- return;
5798
- }
5799
- function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
5800
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
5801
- const keys = [...search_params.keys()];
5802
- for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
5803
- }
5804
- const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
5805
- function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
5806
- to_url_: to_url_,
5807
- set_clearing_flag_: set_clearing_flag_,
5808
- from_search_params_ = new URLSearchParams(location.search),
5809
- sorting_query_param_: sorting_query_param_,
5810
- filter_query_param_prefix_: filter_query_param_prefix_
5811
- }) {
5812
- if (!to_url_) return to_url_;
5813
- const was_url_object = to_url_ instanceof URL;
5814
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
5815
- const {
5816
- searchParams: searchParams
5817
- } = url_object;
5818
- if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
5819
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
5820
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
5821
- if (was_url_object) return url_object;
5822
- return url_object.href;
5823
- }
5824
5826
  const $e53b2e7e632ac4cb$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<nav class="crumbs"></nav>`, 2),
5825
5827
  $e53b2e7e632ac4cb$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a class="crumb"></a>`, 2),
5826
5828
  $e53b2e7e632ac4cb$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class="separator"></span>`, 2);
package/latest/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/latest";
2
+ import { Display, Amazing_Slider, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
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