@depict-ai/ui 3.0.12 → 3.0.14
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 +130 -50
- package/ES10/index.d.ts +9 -3
- package/ES10/index.js +130 -50
- package/latest/index.cjs +121 -46
- package/latest/index.d.ts +9 -3
- package/latest/index.js +121 -46
- package/package.json +2 -2
- package/server/ES10/index.cjs +130 -50
- package/server/ES10/index.d.ts +9 -3
- package/server/ES10/index.js +130 -50
- package/server/latest/index.cjs +121 -46
- package/server/latest/index.d.ts +9 -3
- package/server/latest/index.js +121 -46
package/ES10/index.cjs
CHANGED
|
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
83
83
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
84
84
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
85
85
|
/*! Depict.ai search and product listing SDK */
|
|
86
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.
|
|
86
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.14";
|
|
87
87
|
const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
|
|
88
88
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
89
89
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -820,7 +820,8 @@ const $33eed84f447aa0c0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
|
820
820
|
const $33eed84f447aa0c0$export$864d304a0bc46829 = "2%";
|
|
821
821
|
const $33eed84f447aa0c0$export$7bf543b9d9be2c22 = (0, $dc0bcefcc3486ebd$export$b91cec6bdc6b32a1);
|
|
822
822
|
function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
|
|
823
|
-
|
|
823
|
+
let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
|
|
824
|
+
const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
824
825
|
return (0, $52FdA$solidjsweb.isServer) ? {
|
|
825
826
|
t: "<!-- ".concat(text, " -->")
|
|
826
827
|
} : document.createComment(text);
|
|
@@ -6287,25 +6288,29 @@ function $068bde7fa83ac02c$export$92f2da32c6e7e7ee(_ref) {
|
|
|
6287
6288
|
}
|
|
6288
6289
|
function $1689794f03ba2554$export$205efb947c7ffd78(handler) {
|
|
6289
6290
|
let passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
6291
|
+
let override_element = arguments.length > 2 ? arguments[2] : undefined;
|
|
6290
6292
|
const catchified_handler = $52FdA$depictaiutilishared.catchify(handler);
|
|
6291
6293
|
const owner = $52FdA$solidjs.getOwner();
|
|
6292
6294
|
// Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
|
|
6293
6295
|
// Use observer in case that this gets called before body exists
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6296
|
+
if (!override_element) {
|
|
6297
|
+
const disconnect = (0, $52FdA$depictaiutilishared.observer).onexists("body", _ref => {
|
|
6298
|
+
let {
|
|
6299
|
+
element: element
|
|
6300
|
+
} = _ref;
|
|
6301
|
+
element.addEventListener("scroll", catchified_handler, {
|
|
6302
|
+
passive: passive
|
|
6303
|
+
});
|
|
6304
|
+
$52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
|
|
6300
6305
|
});
|
|
6301
|
-
$52FdA$solidjs.
|
|
6302
|
-
}
|
|
6303
|
-
$52FdA$solidjs.onCleanup(disconnect);
|
|
6306
|
+
$52FdA$solidjs.onCleanup(disconnect);
|
|
6307
|
+
}
|
|
6304
6308
|
for (const event of ["resize", "orientationchange", "scroll"]) {
|
|
6305
|
-
|
|
6309
|
+
const listen_on = override_element !== null && override_element !== void 0 ? override_element : window;
|
|
6310
|
+
listen_on.addEventListener(event, catchified_handler, {
|
|
6306
6311
|
passive: passive
|
|
6307
6312
|
});
|
|
6308
|
-
$52FdA$solidjs.onCleanup(() => removeEventListener(event, catchified_handler));
|
|
6313
|
+
$52FdA$solidjs.onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
|
|
6309
6314
|
}
|
|
6310
6315
|
}
|
|
6311
6316
|
const $e03dec587b6e91e3$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=scroll-status style=display:none><span class=text><b></b> \u{2013} <b></b> <!$><!/> <b>`);
|
|
@@ -6318,7 +6323,9 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
|
|
|
6318
6323
|
i18n_: {
|
|
6319
6324
|
price_formatting_: price_formatting_,
|
|
6320
6325
|
of_: of_
|
|
6321
|
-
}
|
|
6326
|
+
},
|
|
6327
|
+
get_scroll_position_ = () => scrollY,
|
|
6328
|
+
listen_to_scroll_on_: listen_to_scroll_on_
|
|
6322
6329
|
} = _ref;
|
|
6323
6330
|
if (0, $52FdA$solidjsweb.isServer) return; // won't show in initial render and need scroll position
|
|
6324
6331
|
const [first_to_show, set_first_to_show] = $52FdA$solidjs.createSignal(0);
|
|
@@ -6333,12 +6340,12 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
|
|
|
6333
6340
|
let element;
|
|
6334
6341
|
let animation;
|
|
6335
6342
|
let last_pos_time = +new Date();
|
|
6336
|
-
let last_pos =
|
|
6343
|
+
let last_pos = get_scroll_position_();
|
|
6337
6344
|
let unpermit_when_possible = false;
|
|
6338
6345
|
let times_too_fast = 0;
|
|
6339
6346
|
const handle_scrollpos_change = () => {
|
|
6340
6347
|
if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
|
|
6341
|
-
const distance_travelled = Math.abs(
|
|
6348
|
+
const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
|
|
6342
6349
|
const now = +new Date();
|
|
6343
6350
|
const age_of_distance = now - last_pos_time;
|
|
6344
6351
|
const velocity = distance_travelled / age_of_distance; // pixels per millisecond
|
|
@@ -6351,9 +6358,9 @@ function $e03dec587b6e91e3$export$83fd5de5504a7a67(_ref) {
|
|
|
6351
6358
|
unpermit_when_possible = false;
|
|
6352
6359
|
} else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
|
|
6353
6360
|
last_pos_time = now;
|
|
6354
|
-
last_pos =
|
|
6361
|
+
last_pos = get_scroll_position_();
|
|
6355
6362
|
};
|
|
6356
|
-
$1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change);
|
|
6363
|
+
$1689794f03ba2554$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
|
|
6357
6364
|
$52FdA$solidjs.createEffect(() => {
|
|
6358
6365
|
show_triggered();
|
|
6359
6366
|
const first = get_first_result_in_viewport();
|
|
@@ -7035,7 +7042,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
7035
7042
|
product_card_template_: product_card_template_,
|
|
7036
7043
|
layout_options_: layout_options_,
|
|
7037
7044
|
id_currently_querying_for_: id_currently_querying_for_,
|
|
7038
|
-
content_blocks_by_row_: content_blocks_by_row_
|
|
7045
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
7046
|
+
ConfiguredScrollStatus: ConfiguredScrollStatus
|
|
7039
7047
|
} = _ref;
|
|
7040
7048
|
// The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
|
|
7041
7049
|
const is_loading_ = $52FdA$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -7109,6 +7117,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
7109
7117
|
product_card_template_: product_card_template_,
|
|
7110
7118
|
num_placeholders_: num_placeholders_
|
|
7111
7119
|
}) : undefined);
|
|
7120
|
+
const layout = $52FdA$solidjs.createMemo(() => layout_options_().layout || "grid");
|
|
7112
7121
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $52FdA$solidjs.createSignal(false);
|
|
7113
7122
|
const block_suspense_if_needed = () => {
|
|
7114
7123
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -7180,7 +7189,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
7180
7189
|
},
|
|
7181
7190
|
children: product_cards_when_data
|
|
7182
7191
|
});
|
|
7183
|
-
return [$52FdA$solidjsweb.memo((
|
|
7192
|
+
return [$52FdA$solidjsweb.memo(() => $8edd3cf30d1fd8b4$export$a2cc176055f8f08(layout())), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
7184
7193
|
get when() {
|
|
7185
7194
|
return doesnt_have_content_blocks();
|
|
7186
7195
|
},
|
|
@@ -7203,22 +7212,79 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
7203
7212
|
});
|
|
7204
7213
|
},
|
|
7205
7214
|
get children() {
|
|
7206
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
7207
|
-
get
|
|
7208
|
-
return
|
|
7209
|
-
},
|
|
7210
|
-
get override_vertical_spacing() {
|
|
7211
|
-
return layout_options_().override_vertical_spacing;
|
|
7212
|
-
},
|
|
7213
|
-
get grid_spacing() {
|
|
7214
|
-
return layout_options_().grid_spacing;
|
|
7215
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
7216
|
+
get when() {
|
|
7217
|
+
return layout() === "grid";
|
|
7215
7218
|
},
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7219
|
+
get fallback() {
|
|
7220
|
+
return $52FdA$solidjsweb.createComponent((0, $ad8ec7729fffeb9c$export$6649caad96ef8870), {
|
|
7221
|
+
arrow_height_: 25,
|
|
7222
|
+
arrow_width_: 12.5,
|
|
7223
|
+
disable_fading_: true,
|
|
7224
|
+
slider_ref_: slider => {
|
|
7225
|
+
const {
|
|
7226
|
+
insert_here: insert_here,
|
|
7227
|
+
container: container
|
|
7228
|
+
} = slider;
|
|
7229
|
+
const Layout = props => $6c2c739b113a8ddf$export$445d8d3f5f706a40(props, insert_here, true);
|
|
7230
|
+
// Do like this, so we don't have to call mergeProps ourselves
|
|
7231
|
+
$52FdA$solidjsweb.createComponent(Layout, $52FdA$solidjsweb.mergeProps({
|
|
7232
|
+
rows: "all"
|
|
7233
|
+
}, layout_options_, {
|
|
7234
|
+
get cols_at_size() {
|
|
7235
|
+
return modified_cols_at_size();
|
|
7236
|
+
},
|
|
7237
|
+
get layout() {
|
|
7238
|
+
return layout();
|
|
7239
|
+
}
|
|
7240
|
+
}));
|
|
7241
|
+
insert_here.classList.add("generated-spacing");
|
|
7242
|
+
$52FdA$solidjs.createEffect(
|
|
7243
|
+
// @ts-ignore
|
|
7244
|
+
$52FdA$solidjs.on(query_base_, () => insert_here.scrollTo({
|
|
7245
|
+
left: 0,
|
|
7246
|
+
behavior: "instant"
|
|
7247
|
+
}), {
|
|
7248
|
+
defer: true
|
|
7249
|
+
})); // Scroll to the beginning if a filter or the query changes
|
|
7250
|
+
$52FdA$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
|
|
7251
|
+
if (ConfiguredScrollStatus) {
|
|
7252
|
+
// Put scroll status into slider container, so it's centered relatively to the products
|
|
7253
|
+
const rendered_scroll_status = ConfiguredScrollStatus({
|
|
7254
|
+
get_scroll_position_: () => insert_here.scrollLeft,
|
|
7255
|
+
listen_to_scroll_on_: insert_here
|
|
7256
|
+
});
|
|
7257
|
+
const {
|
|
7258
|
+
childNodes: childNodes
|
|
7259
|
+
} = container;
|
|
7260
|
+
// We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
|
|
7261
|
+
$52FdA$solidjsweb.insert(container, $52FdA$solidjs.createMemo(() => [...childNodes, rendered_scroll_status]));
|
|
7262
|
+
}
|
|
7263
|
+
},
|
|
7264
|
+
children: listing_contents
|
|
7265
|
+
});
|
|
7220
7266
|
},
|
|
7221
|
-
children
|
|
7267
|
+
get children() {
|
|
7268
|
+
return $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
7269
|
+
get cols_at_size() {
|
|
7270
|
+
return modified_cols_at_size();
|
|
7271
|
+
},
|
|
7272
|
+
get override_vertical_spacing() {
|
|
7273
|
+
return layout_options_().override_vertical_spacing;
|
|
7274
|
+
},
|
|
7275
|
+
get grid_spacing() {
|
|
7276
|
+
return layout_options_().grid_spacing;
|
|
7277
|
+
},
|
|
7278
|
+
rows: "all",
|
|
7279
|
+
get layout() {
|
|
7280
|
+
return layout();
|
|
7281
|
+
},
|
|
7282
|
+
element_attributes: {
|
|
7283
|
+
class: "cards"
|
|
7284
|
+
},
|
|
7285
|
+
children: listing_contents
|
|
7286
|
+
});
|
|
7287
|
+
}
|
|
7222
7288
|
});
|
|
7223
7289
|
}
|
|
7224
7290
|
})];
|
|
@@ -8946,6 +9012,26 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
8946
9012
|
// @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
|
|
8947
9013
|
const category_title_type = category_title_[(0, $905241549bde5bff$export$5c28802497c8a83c)];
|
|
8948
9014
|
const extra_sort_and_filter_args_ = {};
|
|
9015
|
+
const ConfiguredScrollStatus = function () {
|
|
9016
|
+
let extraProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9017
|
+
return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
9018
|
+
severity_: "error",
|
|
9019
|
+
message_: "Scroll status failed",
|
|
9020
|
+
get children() {
|
|
9021
|
+
return $e03dec587b6e91e3$export$83fd5de5504a7a67({
|
|
9022
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
9023
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
9024
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9025
|
+
i18n_: i18n_,
|
|
9026
|
+
number_of_results_: $52FdA$solidjs.createMemo(() => {
|
|
9027
|
+
var _plp_products_4;
|
|
9028
|
+
return (_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits;
|
|
9029
|
+
}),
|
|
9030
|
+
...extraProps
|
|
9031
|
+
});
|
|
9032
|
+
}
|
|
9033
|
+
});
|
|
9034
|
+
};
|
|
8949
9035
|
const make_product_count_ = () => (() => {
|
|
8950
9036
|
const _el$ = $52FdA$solidjsweb.getNextElement($ede6c70ecdca46fe$var$_tmpl$),
|
|
8951
9037
|
_el$3 = _el$.firstChild,
|
|
@@ -8967,8 +9053,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
8967
9053
|
}), _el$4, _co$);
|
|
8968
9054
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
8969
9055
|
get when() {
|
|
8970
|
-
var
|
|
8971
|
-
return ((
|
|
9056
|
+
var _plp_products_5;
|
|
9057
|
+
return ((_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits) === 1;
|
|
8972
9058
|
},
|
|
8973
9059
|
get fallback() {
|
|
8974
9060
|
return i18n_.products_();
|
|
@@ -9167,6 +9253,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
9167
9253
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
9168
9254
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
9169
9255
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
9256
|
+
ConfiguredScrollStatus: ConfiguredScrollStatus,
|
|
9170
9257
|
id_currently_querying_for_: id_to_query_for_,
|
|
9171
9258
|
no_results_options_: {
|
|
9172
9259
|
selected_filters_: selected_filters_,
|
|
@@ -9179,20 +9266,12 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
9179
9266
|
});
|
|
9180
9267
|
}
|
|
9181
9268
|
}), _el$26, _co$10);
|
|
9182
|
-
$52FdA$solidjsweb.insert(_el$13, $52FdA$solidjsweb.createComponent((0, $
|
|
9183
|
-
|
|
9184
|
-
|
|
9269
|
+
$52FdA$solidjsweb.insert(_el$13, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
9270
|
+
get when() {
|
|
9271
|
+
return layout_options_().layout === "grid";
|
|
9272
|
+
},
|
|
9185
9273
|
get children() {
|
|
9186
|
-
return $
|
|
9187
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
9188
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
9189
|
-
formatted_number_of_results_: formatted_number_of_results_,
|
|
9190
|
-
i18n_: i18n_,
|
|
9191
|
-
number_of_results_: $52FdA$solidjs.createMemo(() => {
|
|
9192
|
-
var _plp_products_5;
|
|
9193
|
-
return (_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits;
|
|
9194
|
-
})
|
|
9195
|
-
});
|
|
9274
|
+
return $52FdA$solidjsweb.createComponent(ConfiguredScrollStatus, {});
|
|
9196
9275
|
}
|
|
9197
9276
|
}), _el$28, _co$11);
|
|
9198
9277
|
$52FdA$solidjsweb.insert(_el$13, $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
@@ -9662,7 +9741,8 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
|
|
|
9662
9741
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
9663
9742
|
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
9664
9743
|
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
9665
|
-
...grid_spacing_override()
|
|
9744
|
+
...grid_spacing_override(),
|
|
9745
|
+
layout: props.layout || "grid"
|
|
9666
9746
|
})),
|
|
9667
9747
|
product_card_template_: product_card_template,
|
|
9668
9748
|
sorting_query_param_: sorting_query_param_,
|
package/ES10/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
|
|
|
10
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "3.0.
|
|
13
|
+
export const version = "3.0.14";
|
|
14
14
|
export type SDKColsAtSize = [number, number?][];
|
|
15
15
|
/**
|
|
16
16
|
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
@@ -182,6 +182,11 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
|
|
|
182
182
|
* @default true
|
|
183
183
|
*/
|
|
184
184
|
showQuicklinks?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Whether to show the listing in a grid or a slider.
|
|
187
|
+
* @default "grid"
|
|
188
|
+
*/
|
|
189
|
+
layout?: "grid" | "slider";
|
|
185
190
|
}
|
|
186
191
|
/**
|
|
187
192
|
* The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
|
|
@@ -965,7 +970,8 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
965
970
|
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
966
971
|
on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
|
|
967
972
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
968
|
-
|
|
973
|
+
layout?: "slider" | "grid";
|
|
974
|
+
}): import("@depict-ai/utilishared/latest").Node_Array;
|
|
969
975
|
export function BreadCrumbs<T extends Display>({
|
|
970
976
|
depict_category
|
|
971
977
|
}: {
|
|
@@ -1117,7 +1123,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1117
1123
|
* Open the modal with support for alignment.
|
|
1118
1124
|
* @returns {void}
|
|
1119
1125
|
*/
|
|
1120
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1126
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1121
1127
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1122
1128
|
export interface PageReplacer {
|
|
1123
1129
|
readonly render_: () => Node_Array;
|
package/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
|
|
|
10
10
|
/*! Depict.ai search and product listing SDK */
|
|
11
11
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
12
12
|
register_es_version("ui", "ES10");
|
|
13
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.14";
|
|
14
14
|
const $ca6ab5f08bd28bca$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
|
|
15
15
|
function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
|
|
16
16
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -747,7 +747,8 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
|
747
747
|
const $d399250dfa491636$export$864d304a0bc46829 = "2%";
|
|
748
748
|
const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
|
|
749
749
|
function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
|
|
750
|
-
|
|
750
|
+
let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
|
|
751
|
+
const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
751
752
|
return (0, $8tj43$isServer) ? {
|
|
752
753
|
t: "<!-- ".concat(text, " -->")
|
|
753
754
|
} : document.createComment(text);
|
|
@@ -6214,25 +6215,29 @@ function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
|
|
|
6214
6215
|
}
|
|
6215
6216
|
function $33e7d1906c93db7d$export$205efb947c7ffd78(handler) {
|
|
6216
6217
|
let passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
6218
|
+
let override_element = arguments.length > 2 ? arguments[2] : undefined;
|
|
6217
6219
|
const catchified_handler = $8tj43$catchify1(handler);
|
|
6218
6220
|
const owner = $8tj43$getOwner();
|
|
6219
6221
|
// Some customers (e.g. equestrian) have `height: 100%` and/or `overflow-x: hidden` on the body, which means that scroll events won't get dispatched on `window`. The pages who get it on <body> won't get it on `window` and vice-versa, so there shouldn't be a worry about duplicate calling of the handler.
|
|
6220
6222
|
// Use observer in case that this gets called before body exists
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6223
|
+
if (!override_element) {
|
|
6224
|
+
const disconnect = (0, $8tj43$observer).onexists("body", _ref => {
|
|
6225
|
+
let {
|
|
6226
|
+
element: element
|
|
6227
|
+
} = _ref;
|
|
6228
|
+
element.addEventListener("scroll", catchified_handler, {
|
|
6229
|
+
passive: passive
|
|
6230
|
+
});
|
|
6231
|
+
$8tj43$runWithOwner(owner, () => $8tj43$onCleanup(() => element.removeEventListener("scroll", catchified_handler)));
|
|
6227
6232
|
});
|
|
6228
|
-
$8tj43$
|
|
6229
|
-
}
|
|
6230
|
-
$8tj43$onCleanup(disconnect);
|
|
6233
|
+
$8tj43$onCleanup(disconnect);
|
|
6234
|
+
}
|
|
6231
6235
|
for (const event of ["resize", "orientationchange", "scroll"]) {
|
|
6232
|
-
|
|
6236
|
+
const listen_on = override_element !== null && override_element !== void 0 ? override_element : window;
|
|
6237
|
+
listen_on.addEventListener(event, catchified_handler, {
|
|
6233
6238
|
passive: passive
|
|
6234
6239
|
});
|
|
6235
|
-
$8tj43$onCleanup(() => removeEventListener(event, catchified_handler));
|
|
6240
|
+
$8tj43$onCleanup(() => listen_on.removeEventListener(event, catchified_handler));
|
|
6236
6241
|
}
|
|
6237
6242
|
}
|
|
6238
6243
|
const $b69740fc6de9f17e$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=scroll-status style=display:none><span class=text><b></b> \u{2013} <b></b> <!$><!/> <b>`);
|
|
@@ -6245,7 +6250,9 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
|
|
|
6245
6250
|
i18n_: {
|
|
6246
6251
|
price_formatting_: price_formatting_,
|
|
6247
6252
|
of_: of_
|
|
6248
|
-
}
|
|
6253
|
+
},
|
|
6254
|
+
get_scroll_position_ = () => scrollY,
|
|
6255
|
+
listen_to_scroll_on_: listen_to_scroll_on_
|
|
6249
6256
|
} = _ref;
|
|
6250
6257
|
if (0, $8tj43$isServer) return; // won't show in initial render and need scroll position
|
|
6251
6258
|
const [first_to_show, set_first_to_show] = $8tj43$createSignal(0);
|
|
@@ -6260,12 +6267,12 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
|
|
|
6260
6267
|
let element;
|
|
6261
6268
|
let animation;
|
|
6262
6269
|
let last_pos_time = +new Date();
|
|
6263
|
-
let last_pos =
|
|
6270
|
+
let last_pos = get_scroll_position_();
|
|
6264
6271
|
let unpermit_when_possible = false;
|
|
6265
6272
|
let times_too_fast = 0;
|
|
6266
6273
|
const handle_scrollpos_change = () => {
|
|
6267
6274
|
if (animation) set_show_triggered(prev => !prev); // make sure that once we've decided to show the indicator it doesn't disappear before we stop scrolling
|
|
6268
|
-
const distance_travelled = Math.abs(
|
|
6275
|
+
const distance_travelled = Math.abs(get_scroll_position_() - last_pos);
|
|
6269
6276
|
const now = +new Date();
|
|
6270
6277
|
const age_of_distance = now - last_pos_time;
|
|
6271
6278
|
const velocity = distance_travelled / age_of_distance; // pixels per millisecond
|
|
@@ -6278,9 +6285,9 @@ function $b69740fc6de9f17e$export$83fd5de5504a7a67(_ref) {
|
|
|
6278
6285
|
unpermit_when_possible = false;
|
|
6279
6286
|
} else if (animation) unpermit_when_possible = true;else set_permitted_to_show(false);
|
|
6280
6287
|
last_pos_time = now;
|
|
6281
|
-
last_pos =
|
|
6288
|
+
last_pos = get_scroll_position_();
|
|
6282
6289
|
};
|
|
6283
|
-
$33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change);
|
|
6290
|
+
$33e7d1906c93db7d$export$205efb947c7ffd78(handle_scrollpos_change, undefined, listen_to_scroll_on_);
|
|
6284
6291
|
$8tj43$createEffect(() => {
|
|
6285
6292
|
show_triggered();
|
|
6286
6293
|
const first = get_first_result_in_viewport();
|
|
@@ -6962,7 +6969,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
6962
6969
|
product_card_template_: product_card_template_,
|
|
6963
6970
|
layout_options_: layout_options_,
|
|
6964
6971
|
id_currently_querying_for_: id_currently_querying_for_,
|
|
6965
|
-
content_blocks_by_row_: content_blocks_by_row_
|
|
6972
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
6973
|
+
ConfiguredScrollStatus: ConfiguredScrollStatus
|
|
6966
6974
|
} = _ref;
|
|
6967
6975
|
// The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
|
|
6968
6976
|
const is_loading_ = $8tj43$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -7036,6 +7044,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
7036
7044
|
product_card_template_: product_card_template_,
|
|
7037
7045
|
num_placeholders_: num_placeholders_
|
|
7038
7046
|
}) : undefined);
|
|
7047
|
+
const layout = $8tj43$createMemo(() => layout_options_().layout || "grid");
|
|
7039
7048
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $8tj43$createSignal(false);
|
|
7040
7049
|
const block_suspense_if_needed = () => {
|
|
7041
7050
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -7107,7 +7116,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
7107
7116
|
},
|
|
7108
7117
|
children: product_cards_when_data
|
|
7109
7118
|
});
|
|
7110
|
-
return [$8tj43$memo((
|
|
7119
|
+
return [$8tj43$memo(() => $ca55612a53dbbdd2$export$a2cc176055f8f08(layout())), $8tj43$createComponent((0, $8tj43$Show), {
|
|
7111
7120
|
get when() {
|
|
7112
7121
|
return doesnt_have_content_blocks();
|
|
7113
7122
|
},
|
|
@@ -7130,22 +7139,79 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
7130
7139
|
});
|
|
7131
7140
|
},
|
|
7132
7141
|
get children() {
|
|
7133
|
-
return $8tj43$createComponent((0, $
|
|
7134
|
-
get
|
|
7135
|
-
return
|
|
7136
|
-
},
|
|
7137
|
-
get override_vertical_spacing() {
|
|
7138
|
-
return layout_options_().override_vertical_spacing;
|
|
7139
|
-
},
|
|
7140
|
-
get grid_spacing() {
|
|
7141
|
-
return layout_options_().grid_spacing;
|
|
7142
|
+
return $8tj43$createComponent((0, $8tj43$Show), {
|
|
7143
|
+
get when() {
|
|
7144
|
+
return layout() === "grid";
|
|
7142
7145
|
},
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7146
|
+
get fallback() {
|
|
7147
|
+
return $8tj43$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
|
|
7148
|
+
arrow_height_: 25,
|
|
7149
|
+
arrow_width_: 12.5,
|
|
7150
|
+
disable_fading_: true,
|
|
7151
|
+
slider_ref_: slider => {
|
|
7152
|
+
const {
|
|
7153
|
+
insert_here: insert_here,
|
|
7154
|
+
container: container
|
|
7155
|
+
} = slider;
|
|
7156
|
+
const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
|
|
7157
|
+
// Do like this, so we don't have to call mergeProps ourselves
|
|
7158
|
+
$8tj43$createComponent(Layout, $8tj43$mergeProps({
|
|
7159
|
+
rows: "all"
|
|
7160
|
+
}, layout_options_, {
|
|
7161
|
+
get cols_at_size() {
|
|
7162
|
+
return modified_cols_at_size();
|
|
7163
|
+
},
|
|
7164
|
+
get layout() {
|
|
7165
|
+
return layout();
|
|
7166
|
+
}
|
|
7167
|
+
}));
|
|
7168
|
+
insert_here.classList.add("generated-spacing");
|
|
7169
|
+
$8tj43$createEffect(
|
|
7170
|
+
// @ts-ignore
|
|
7171
|
+
$8tj43$on(query_base_, () => insert_here.scrollTo({
|
|
7172
|
+
left: 0,
|
|
7173
|
+
behavior: "instant"
|
|
7174
|
+
}), {
|
|
7175
|
+
defer: true
|
|
7176
|
+
})); // Scroll to the beginning if a filter or the query changes
|
|
7177
|
+
$8tj43$slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
|
|
7178
|
+
if (ConfiguredScrollStatus) {
|
|
7179
|
+
// Put scroll status into slider container, so it's centered relatively to the products
|
|
7180
|
+
const rendered_scroll_status = ConfiguredScrollStatus({
|
|
7181
|
+
get_scroll_position_: () => insert_here.scrollLeft,
|
|
7182
|
+
listen_to_scroll_on_: insert_here
|
|
7183
|
+
});
|
|
7184
|
+
const {
|
|
7185
|
+
childNodes: childNodes
|
|
7186
|
+
} = container;
|
|
7187
|
+
// We have to use `insert` over Element.append, because ConfiguredScrollStatus is in an ErrorBoundary and therefore returns a function. `insert` will wipe all children, therefore save them first and then tell insert that the element should contain these elements + whatever ScrollStatus returns
|
|
7188
|
+
$8tj43$insert(container, $8tj43$createMemo(() => [...childNodes, rendered_scroll_status]));
|
|
7189
|
+
}
|
|
7190
|
+
},
|
|
7191
|
+
children: listing_contents
|
|
7192
|
+
});
|
|
7147
7193
|
},
|
|
7148
|
-
children
|
|
7194
|
+
get children() {
|
|
7195
|
+
return $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
7196
|
+
get cols_at_size() {
|
|
7197
|
+
return modified_cols_at_size();
|
|
7198
|
+
},
|
|
7199
|
+
get override_vertical_spacing() {
|
|
7200
|
+
return layout_options_().override_vertical_spacing;
|
|
7201
|
+
},
|
|
7202
|
+
get grid_spacing() {
|
|
7203
|
+
return layout_options_().grid_spacing;
|
|
7204
|
+
},
|
|
7205
|
+
rows: "all",
|
|
7206
|
+
get layout() {
|
|
7207
|
+
return layout();
|
|
7208
|
+
},
|
|
7209
|
+
element_attributes: {
|
|
7210
|
+
class: "cards"
|
|
7211
|
+
},
|
|
7212
|
+
children: listing_contents
|
|
7213
|
+
});
|
|
7214
|
+
}
|
|
7149
7215
|
});
|
|
7150
7216
|
}
|
|
7151
7217
|
})];
|
|
@@ -8873,6 +8939,26 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
8873
8939
|
// @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
|
|
8874
8940
|
const category_title_type = category_title_[(0, $ec8a6e10026dcff9$export$5c28802497c8a83c)];
|
|
8875
8941
|
const extra_sort_and_filter_args_ = {};
|
|
8942
|
+
const ConfiguredScrollStatus = function () {
|
|
8943
|
+
let extraProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8944
|
+
return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
8945
|
+
severity_: "error",
|
|
8946
|
+
message_: "Scroll status failed",
|
|
8947
|
+
get children() {
|
|
8948
|
+
return $b69740fc6de9f17e$export$83fd5de5504a7a67({
|
|
8949
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
8950
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
8951
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
8952
|
+
i18n_: i18n_,
|
|
8953
|
+
number_of_results_: $8tj43$createMemo(() => {
|
|
8954
|
+
var _plp_products_4;
|
|
8955
|
+
return (_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits;
|
|
8956
|
+
}),
|
|
8957
|
+
...extraProps
|
|
8958
|
+
});
|
|
8959
|
+
}
|
|
8960
|
+
});
|
|
8961
|
+
};
|
|
8876
8962
|
const make_product_count_ = () => (() => {
|
|
8877
8963
|
const _el$ = $8tj43$getNextElement($4b4b262708b516ee$var$_tmpl$),
|
|
8878
8964
|
_el$3 = _el$.firstChild,
|
|
@@ -8894,8 +8980,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
8894
8980
|
}), _el$4, _co$);
|
|
8895
8981
|
$8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Show), {
|
|
8896
8982
|
get when() {
|
|
8897
|
-
var
|
|
8898
|
-
return ((
|
|
8983
|
+
var _plp_products_5;
|
|
8984
|
+
return ((_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits) === 1;
|
|
8899
8985
|
},
|
|
8900
8986
|
get fallback() {
|
|
8901
8987
|
return i18n_.products_();
|
|
@@ -9094,6 +9180,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
9094
9180
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
9095
9181
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
9096
9182
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
9183
|
+
ConfiguredScrollStatus: ConfiguredScrollStatus,
|
|
9097
9184
|
id_currently_querying_for_: id_to_query_for_,
|
|
9098
9185
|
no_results_options_: {
|
|
9099
9186
|
selected_filters_: selected_filters_,
|
|
@@ -9106,20 +9193,12 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
9106
9193
|
});
|
|
9107
9194
|
}
|
|
9108
9195
|
}), _el$26, _co$10);
|
|
9109
|
-
$8tj43$insert(_el$13, $8tj43$createComponent((0, $
|
|
9110
|
-
|
|
9111
|
-
|
|
9196
|
+
$8tj43$insert(_el$13, $8tj43$createComponent((0, $8tj43$Show), {
|
|
9197
|
+
get when() {
|
|
9198
|
+
return layout_options_().layout === "grid";
|
|
9199
|
+
},
|
|
9112
9200
|
get children() {
|
|
9113
|
-
return $
|
|
9114
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
9115
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
9116
|
-
formatted_number_of_results_: formatted_number_of_results_,
|
|
9117
|
-
i18n_: i18n_,
|
|
9118
|
-
number_of_results_: $8tj43$createMemo(() => {
|
|
9119
|
-
var _plp_products_5;
|
|
9120
|
-
return (_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits;
|
|
9121
|
-
})
|
|
9122
|
-
});
|
|
9201
|
+
return $8tj43$createComponent(ConfiguredScrollStatus, {});
|
|
9123
9202
|
}
|
|
9124
9203
|
}), _el$28, _co$11);
|
|
9125
9204
|
$8tj43$insert(_el$13, $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
@@ -9589,7 +9668,8 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
|
|
|
9589
9668
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
9590
9669
|
layout_options_: $8tj43$createMemo(() => ({
|
|
9591
9670
|
cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77(props.cols_at_size),
|
|
9592
|
-
...grid_spacing_override()
|
|
9671
|
+
...grid_spacing_override(),
|
|
9672
|
+
layout: props.layout || "grid"
|
|
9593
9673
|
})),
|
|
9594
9674
|
product_card_template_: product_card_template,
|
|
9595
9675
|
sorting_query_param_: sorting_query_param_,
|