@depict-ai/ui 0.0.5 → 0.0.7
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/dist/index.d.ts +13 -4
- package/dist/main.js +50 -17
- package/dist/module.js +50 -17
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Accessor, JSX, Setter, Signal } from "solid-js";
|
|
2
|
-
import { Display, Node_Array, Elem, Extended_RR_Options, LayoutOptions, TwoLetterMarket } from "@depict-ai/utilishared";
|
|
2
|
+
import { Display, Node_Array, Elem, Extended_RR_Options, LayoutOptions, TwoLetterMarket, RR_PostProcessor, RR_PreProcessor } from "@depict-ai/utilishared";
|
|
3
3
|
import { SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
4
4
|
import { SearchRequest, SearchFilter } from "@depict-ai/types/api/SearchRequest";
|
|
5
5
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
@@ -1236,6 +1236,9 @@ type _ConstructorOptions1 = {
|
|
|
1236
1236
|
on_navigation?: (href: string) => unknown;
|
|
1237
1237
|
url_transformer?: (url_object: URL) => unknown;
|
|
1238
1238
|
enable_category_suggestions?: boolean;
|
|
1239
|
+
disable_scrolling_during_modal?: boolean;
|
|
1240
|
+
api?: DepictAPI;
|
|
1241
|
+
bottom_distance_under_modal_?: Accessor<number | undefined>;
|
|
1239
1242
|
};
|
|
1240
1243
|
type OpenModalArguments = [
|
|
1241
1244
|
options_for_modal?: {
|
|
@@ -1252,7 +1255,7 @@ type SDKGridSpacing = string | {
|
|
|
1252
1255
|
export const get_search_query_updating_blocked_signal: (depict_search: DepictSearch) => Signal<boolean> | undefined;
|
|
1253
1256
|
export class DepictSearch {
|
|
1254
1257
|
#private;
|
|
1255
|
-
constructor({ search_query_url_param_name, url_transformer, on_navigation, enable_category_suggestions, ...props_on_class }: _ConstructorOptions1);
|
|
1258
|
+
constructor({ search_query_url_param_name, url_transformer, on_navigation, enable_category_suggestions, disable_scrolling_during_modal, api, bottom_distance_under_modal_, ...props_on_class }: _ConstructorOptions1);
|
|
1256
1259
|
get localization(): {
|
|
1257
1260
|
[K in keyof search_i18n]: ReturnType<search_i18n[K]>;
|
|
1258
1261
|
};
|
|
@@ -1266,7 +1269,7 @@ export class DepictSearch {
|
|
|
1266
1269
|
get market(): string;
|
|
1267
1270
|
set market(market: string);
|
|
1268
1271
|
}
|
|
1269
|
-
export function SearchPage({ depict_search, include_input_field, grid_spacing, cols_at_size, product_card_template, get_product_id, }: {
|
|
1272
|
+
export function SearchPage({ depict_search, include_input_field, grid_spacing, cols_at_size, product_card_template, get_product_id, extra_depict_options, }: {
|
|
1270
1273
|
depict_search: DepictSearch;
|
|
1271
1274
|
include_input_field?: boolean | {
|
|
1272
1275
|
on_open_?: VoidFunction;
|
|
@@ -1276,8 +1279,14 @@ export function SearchPage({ depict_search, include_input_field, grid_spacing, c
|
|
|
1276
1279
|
cols_at_size: SDKColsAtSize;
|
|
1277
1280
|
product_card_template: (display: Display, info: InfoForProcessing) => Promise<Node_Array> | Node_Array;
|
|
1278
1281
|
get_product_id: (url?: string) => string | Promise<string>;
|
|
1282
|
+
extra_depict_options?: {
|
|
1283
|
+
pre_processors?: RR_PreProcessor[];
|
|
1284
|
+
post_processors?: RR_PostProcessor[];
|
|
1285
|
+
recommendations_cols_at_size?: SDKColsAtSize;
|
|
1286
|
+
};
|
|
1279
1287
|
}): Node_Array;
|
|
1280
|
-
export function SearchField({ depict_search, modal_dispose_handler, }: {
|
|
1288
|
+
export function SearchField({ depict_search, modal_dispose_handler, click_handler, }: {
|
|
1281
1289
|
depict_search: DepictSearch;
|
|
1282
1290
|
modal_dispose_handler?: VoidFunction;
|
|
1291
|
+
click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
|
|
1283
1292
|
}): Node_Array;
|
package/dist/main.js
CHANGED
|
@@ -7301,7 +7301,7 @@ function $036d367ce3058351$export$3340fdd8259bd4fd({ get_search_field_value_: ge
|
|
|
7301
7301
|
}
|
|
7302
7302
|
|
|
7303
7303
|
|
|
7304
|
-
const $f40a47a30a358305$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $f40a47a30a358305$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2), $f40a47a30a358305$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $f40a47a30a358305$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
7304
|
+
const $f40a47a30a358305$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $f40a47a30a358305$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<b></b>`, 2), $f40a47a30a358305$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $f40a47a30a358305$var$_tmpl$4 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div id="depict-override" class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
7305
7305
|
function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $iBTHO$solidjs.createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ }) {
|
|
7306
7306
|
let on_enter_in_query_input_function;
|
|
7307
7307
|
const [input_field, set_input_field] = (0, $iBTHO$solidjs.createSignal)();
|
|
@@ -7957,8 +7957,15 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
|
|
|
7957
7957
|
|
|
7958
7958
|
|
|
7959
7959
|
|
|
7960
|
-
const $ad63d2a35e827266$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="orig price"></span>`, 2), $ad63d2a35e827266$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="
|
|
7961
|
-
function $ad63d2a35e827266$export$3b5becc25bbaed73(
|
|
7960
|
+
const $ad63d2a35e827266$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="orig price"></span>`, 2), $ad63d2a35e827266$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="title_brand_tagline"><span class="brand"></span><span class="title"></span></div><div class="price_container"><span class="price"></span></div></div></a>`, 16), $ad63d2a35e827266$var$_tmpl$3 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<div class="tagline"></div>`, 2);
|
|
7961
|
+
function $ad63d2a35e827266$export$3b5becc25bbaed73(display_or_variant_container, _index, get_fake_rendering_options, i18n_) {
|
|
7962
|
+
// Support for Spendrups displays, should probably be in the Spendrups script
|
|
7963
|
+
const display = (0, $iBTHO$solidjs.createMemo)(()=>{
|
|
7964
|
+
const display = display_or_variant_container();
|
|
7965
|
+
if (display.page_url) return display;
|
|
7966
|
+
if (!display?.variants?.length) return;
|
|
7967
|
+
return display.variants.filter((v)=>v.product_id == display.product_id)[0];
|
|
7968
|
+
});
|
|
7962
7969
|
const image_url = (0, $iBTHO$solidjs.createMemo)(()=>display().image_url);
|
|
7963
7970
|
const contained_image = (0, $iBTHO$solidjs.createMemo)(()=>(0, $iBTHO$depictaiutilishared.ContainedImage)({
|
|
7964
7971
|
aspect_ratio: 1,
|
|
@@ -7977,6 +7984,14 @@ function $ad63d2a35e827266$export$3b5becc25bbaed73(display, _index, get_fake_ren
|
|
|
7977
7984
|
(0, $iBTHO$solidjsweb.insert)(_el$2, contained_image);
|
|
7978
7985
|
(0, $iBTHO$solidjsweb.insert)(_el$5, ()=>display().brand);
|
|
7979
7986
|
(0, $iBTHO$solidjsweb.insert)(_el$6, ()=>display().title);
|
|
7987
|
+
(0, $iBTHO$solidjsweb.insert)(_el$4, ()=>display().sub_heading_1 || display().sub_heading_2 && (()=>{
|
|
7988
|
+
const _el$10 = $ad63d2a35e827266$var$_tmpl$3.cloneNode(true);
|
|
7989
|
+
(0, $iBTHO$solidjsweb.insert)(_el$10, ()=>[
|
|
7990
|
+
display().sub_heading_1,
|
|
7991
|
+
display().sub_heading_2
|
|
7992
|
+
].filter((v)=>v).join(" | "));
|
|
7993
|
+
return _el$10;
|
|
7994
|
+
})(), null);
|
|
7980
7995
|
(0, $iBTHO$solidjsweb.insert)(_el$7, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
|
|
7981
7996
|
get when () {
|
|
7982
7997
|
return is_sale();
|
|
@@ -7998,7 +8013,15 @@ function $ad63d2a35e827266$export$3b5becc25bbaed73(display, _index, get_fake_ren
|
|
|
7998
8013
|
price_formatting_: i18n_.price_formatting_
|
|
7999
8014
|
}), null);
|
|
8000
8015
|
(0, $iBTHO$solidjsweb.insert)(_el$9, ()=>i18n_.price_formatting_().post_, null);
|
|
8001
|
-
(0, $iBTHO$solidjsweb.effect)(()=>
|
|
8016
|
+
(0, $iBTHO$solidjsweb.effect)((_p$)=>{
|
|
8017
|
+
const _v$ = display().page_url, _v$2 = !!is_sale();
|
|
8018
|
+
_v$ !== _p$._v$ && (0, $iBTHO$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
|
|
8019
|
+
_v$2 !== _p$._v$2 && _el$9.classList.toggle("sales_price", _p$._v$2 = _v$2);
|
|
8020
|
+
return _p$;
|
|
8021
|
+
}, {
|
|
8022
|
+
_v$: undefined,
|
|
8023
|
+
_v$2: undefined
|
|
8024
|
+
});
|
|
8002
8025
|
return _el$;
|
|
8003
8026
|
})();
|
|
8004
8027
|
}
|
|
@@ -8102,7 +8125,8 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
|
|
|
8102
8125
|
#market_signal = (0, $iBTHO$solidjs.createSignal)();
|
|
8103
8126
|
#modal_open_signal = (0, $iBTHO$solidjs.createSignal)(false);
|
|
8104
8127
|
static #has_been_constructed = false;
|
|
8105
|
-
constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true ,
|
|
8128
|
+
constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8129
|
+
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , ...props_on_class }){
|
|
8106
8130
|
if ($fd2d5ef67fc09716$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
|
|
8107
8131
|
Object.assign(this, props_on_class);
|
|
8108
8132
|
const alternative_query_submitter_for_spas_ = on_navigation && ((search_param_name, new_search_query, url_transformer)=>{
|
|
@@ -8129,7 +8153,7 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
|
|
|
8129
8153
|
[search_query_url_param_name]: ""
|
|
8130
8154
|
});
|
|
8131
8155
|
const search_query_signal_ = (0, $iBTHO$solidjs.createSignal)((0, $iBTHO$solidjs.untrack)(raw_search_query_signal[0]));
|
|
8132
|
-
const depict_api_ = new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)();
|
|
8156
|
+
const depict_api_ = api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)();
|
|
8133
8157
|
const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(search_query_signal_);
|
|
8134
8158
|
const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
|
|
8135
8159
|
const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
@@ -8199,7 +8223,9 @@ class $fd2d5ef67fc09716$export$ac6237957a15b3f0 {
|
|
|
8199
8223
|
has_sort_or_filters_: (0, $iBTHO$solidjs.createMemo)(()=>!!(Object.keys(state_.search_selected_filters[0]())?.length || state_.search_sorting[0]()))
|
|
8200
8224
|
},
|
|
8201
8225
|
i18n_: i18n_,
|
|
8202
|
-
enable_category_suggestions_: enable_category_suggestions
|
|
8226
|
+
enable_category_suggestions_: enable_category_suggestions,
|
|
8227
|
+
disable_scrolling_: disable_scrolling_during_modal,
|
|
8228
|
+
bottom_distance_under_modal_: bottom_distance_under_modal_
|
|
8203
8229
|
});
|
|
8204
8230
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
8205
8231
|
// The default behaviour is to align the modal with the input field if possible
|
|
@@ -8297,8 +8323,14 @@ function $fd2d5ef67fc09716$var$get_shared_properties(depict_search) {
|
|
|
8297
8323
|
if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
|
|
8298
8324
|
return shared_properties;
|
|
8299
8325
|
}
|
|
8300
|
-
function $fd2d5ef67fc09716$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $iBTHO$depictaiutilishared.normal_get_product_id) }) {
|
|
8326
|
+
function $fd2d5ef67fc09716$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $iBTHO$depictaiutilishared.normal_get_product_id) , extra_depict_options: extra_depict_options }) {
|
|
8301
8327
|
const shared_properties = $fd2d5ef67fc09716$var$get_shared_properties(depict_search);
|
|
8328
|
+
const grid_spacing_override = typeof grid_spacing === "string" ? {
|
|
8329
|
+
grid_spacing: grid_spacing
|
|
8330
|
+
} : {
|
|
8331
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
8332
|
+
grid_spacing: grid_spacing.horizontal
|
|
8333
|
+
};
|
|
8302
8334
|
return $fd2d5ef67fc09716$var$run_in_root_or_auto_cleanup(()=>{
|
|
8303
8335
|
const { state_: state_ } = shared_properties;
|
|
8304
8336
|
(0, $iBTHO$solidjs.onCleanup)(shared_properties.reset_history_state_);
|
|
@@ -8348,25 +8380,26 @@ function $fd2d5ef67fc09716$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
8348
8380
|
include_input_field_: include_input_field,
|
|
8349
8381
|
layout_options_: {
|
|
8350
8382
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(cols_at_size),
|
|
8351
|
-
...
|
|
8352
|
-
grid_spacing: grid_spacing
|
|
8353
|
-
} : {
|
|
8354
|
-
override_vertical_spacing: grid_spacing.vertical,
|
|
8355
|
-
grid_spacing: grid_spacing.horizontal
|
|
8356
|
-
}
|
|
8383
|
+
...grid_spacing_override
|
|
8357
8384
|
},
|
|
8385
|
+
recommendations_layout_options_: extra_depict_options?.recommendations_cols_at_size ? {
|
|
8386
|
+
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(extra_depict_options.recommendations_cols_at_size),
|
|
8387
|
+
...grid_spacing_override
|
|
8388
|
+
} : undefined,
|
|
8358
8389
|
slider_arrow_button_: (0, $iBTHO$depictaiutilishared.GenericSliderArrowButton)({
|
|
8359
8390
|
height_: 12,
|
|
8360
8391
|
width_: 6.46
|
|
8361
8392
|
}),
|
|
8362
8393
|
rr_options_: {
|
|
8363
|
-
template: product_card_template
|
|
8394
|
+
template: product_card_template,
|
|
8395
|
+
pre_processors: extra_depict_options?.pre_processors,
|
|
8396
|
+
post_processors: extra_depict_options?.post_processors
|
|
8364
8397
|
},
|
|
8365
8398
|
get_product_id_: get_product_id
|
|
8366
8399
|
});
|
|
8367
8400
|
}, "Entire SearchPage failed");
|
|
8368
8401
|
}
|
|
8369
|
-
function $fd2d5ef67fc09716$export$b94867ecbd698f21({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler }) {
|
|
8402
|
+
function $fd2d5ef67fc09716$export$b94867ecbd698f21({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler , click_handler: click_handler }) {
|
|
8370
8403
|
const shared_properties = $fd2d5ef67fc09716$var$get_shared_properties(depict_search);
|
|
8371
8404
|
return $fd2d5ef67fc09716$var$run_in_root_or_auto_cleanup(()=>{
|
|
8372
8405
|
const input = (0, $iBTHO$solidjsweb.createComponent)((0, $2f8c7dc07090fca9$export$ff21851bb5d30e15), {
|
|
@@ -8387,7 +8420,7 @@ function $fd2d5ef67fc09716$export$b94867ecbd698f21({ depict_search: depict_searc
|
|
|
8387
8420
|
},
|
|
8388
8421
|
disabled_: true,
|
|
8389
8422
|
field_element_ref_: (field)=>{
|
|
8390
|
-
const handler = (0, $iBTHO$depictaiutilishared.catchify)(()=>{
|
|
8423
|
+
const handler = click_handler ?? (0, $iBTHO$depictaiutilishared.catchify)(()=>{
|
|
8391
8424
|
depict_search.modal_open = [
|
|
8392
8425
|
{
|
|
8393
8426
|
style_props_: style_props_
|
package/dist/module.js
CHANGED
|
@@ -7252,7 +7252,7 @@ function $c64d28ca12452b21$export$3340fdd8259bd4fd({ get_search_field_value_: ge
|
|
|
7252
7252
|
}
|
|
7253
7253
|
|
|
7254
7254
|
|
|
7255
|
-
const $fabfda1230351b1a$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $fabfda1230351b1a$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<b></b>`, 2), $fabfda1230351b1a$var$_tmpl$3 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $fabfda1230351b1a$var$_tmpl$4 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
7255
|
+
const $fabfda1230351b1a$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $fabfda1230351b1a$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<b></b>`, 2), $fabfda1230351b1a$var$_tmpl$3 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $fabfda1230351b1a$var$_tmpl$4 = /*#__PURE__*/ (0, $kyEB6$template)(`<div id="depict-override" class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
7256
7256
|
function $fabfda1230351b1a$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $kyEB6$createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ }) {
|
|
7257
7257
|
let on_enter_in_query_input_function;
|
|
7258
7258
|
const [input_field, set_input_field] = (0, $kyEB6$createSignal)();
|
|
@@ -7908,8 +7908,15 @@ function $7097477c78a89208$export$a54ec244c8863715(opts) {
|
|
|
7908
7908
|
|
|
7909
7909
|
|
|
7910
7910
|
|
|
7911
|
-
const $ba4105f38be0a8e0$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<span class="orig price"></span>`, 2), $ba4105f38be0a8e0$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="
|
|
7912
|
-
function $ba4105f38be0a8e0$export$3b5becc25bbaed73(
|
|
7911
|
+
const $ba4105f38be0a8e0$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<span class="orig price"></span>`, 2), $ba4105f38be0a8e0$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<a class="instant-card"><div class="img_part"></div><div class="right_part"><div class="title_brand_tagline"><span class="brand"></span><span class="title"></span></div><div class="price_container"><span class="price"></span></div></div></a>`, 16), $ba4105f38be0a8e0$var$_tmpl$3 = /*#__PURE__*/ (0, $kyEB6$template)(`<div class="tagline"></div>`, 2);
|
|
7912
|
+
function $ba4105f38be0a8e0$export$3b5becc25bbaed73(display_or_variant_container, _index, get_fake_rendering_options, i18n_) {
|
|
7913
|
+
// Support for Spendrups displays, should probably be in the Spendrups script
|
|
7914
|
+
const display = (0, $kyEB6$createMemo)(()=>{
|
|
7915
|
+
const display = display_or_variant_container();
|
|
7916
|
+
if (display.page_url) return display;
|
|
7917
|
+
if (!display?.variants?.length) return;
|
|
7918
|
+
return display.variants.filter((v)=>v.product_id == display.product_id)[0];
|
|
7919
|
+
});
|
|
7913
7920
|
const image_url = (0, $kyEB6$createMemo)(()=>display().image_url);
|
|
7914
7921
|
const contained_image = (0, $kyEB6$createMemo)(()=>(0, $kyEB6$ContainedImage)({
|
|
7915
7922
|
aspect_ratio: 1,
|
|
@@ -7928,6 +7935,14 @@ function $ba4105f38be0a8e0$export$3b5becc25bbaed73(display, _index, get_fake_ren
|
|
|
7928
7935
|
(0, $kyEB6$insert)(_el$2, contained_image);
|
|
7929
7936
|
(0, $kyEB6$insert)(_el$5, ()=>display().brand);
|
|
7930
7937
|
(0, $kyEB6$insert)(_el$6, ()=>display().title);
|
|
7938
|
+
(0, $kyEB6$insert)(_el$4, ()=>display().sub_heading_1 || display().sub_heading_2 && (()=>{
|
|
7939
|
+
const _el$10 = $ba4105f38be0a8e0$var$_tmpl$3.cloneNode(true);
|
|
7940
|
+
(0, $kyEB6$insert)(_el$10, ()=>[
|
|
7941
|
+
display().sub_heading_1,
|
|
7942
|
+
display().sub_heading_2
|
|
7943
|
+
].filter((v)=>v).join(" | "));
|
|
7944
|
+
return _el$10;
|
|
7945
|
+
})(), null);
|
|
7931
7946
|
(0, $kyEB6$insert)(_el$7, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
|
|
7932
7947
|
get when () {
|
|
7933
7948
|
return is_sale();
|
|
@@ -7949,7 +7964,15 @@ function $ba4105f38be0a8e0$export$3b5becc25bbaed73(display, _index, get_fake_ren
|
|
|
7949
7964
|
price_formatting_: i18n_.price_formatting_
|
|
7950
7965
|
}), null);
|
|
7951
7966
|
(0, $kyEB6$insert)(_el$9, ()=>i18n_.price_formatting_().post_, null);
|
|
7952
|
-
(0, $kyEB6$effect)(()=>
|
|
7967
|
+
(0, $kyEB6$effect)((_p$)=>{
|
|
7968
|
+
const _v$ = display().page_url, _v$2 = !!is_sale();
|
|
7969
|
+
_v$ !== _p$._v$ && (0, $kyEB6$setAttribute)(_el$, "href", _p$._v$ = _v$);
|
|
7970
|
+
_v$2 !== _p$._v$2 && _el$9.classList.toggle("sales_price", _p$._v$2 = _v$2);
|
|
7971
|
+
return _p$;
|
|
7972
|
+
}, {
|
|
7973
|
+
_v$: undefined,
|
|
7974
|
+
_v$2: undefined
|
|
7975
|
+
});
|
|
7953
7976
|
return _el$;
|
|
7954
7977
|
})();
|
|
7955
7978
|
}
|
|
@@ -8053,7 +8076,8 @@ class $59f48be661ca9195$export$ac6237957a15b3f0 {
|
|
|
8053
8076
|
#market_signal = (0, $kyEB6$createSignal)();
|
|
8054
8077
|
#modal_open_signal = (0, $kyEB6$createSignal)(false);
|
|
8055
8078
|
static #has_been_constructed = false;
|
|
8056
|
-
constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true ,
|
|
8079
|
+
constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8080
|
+
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , ...props_on_class }){
|
|
8057
8081
|
if ($59f48be661ca9195$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
|
|
8058
8082
|
Object.assign(this, props_on_class);
|
|
8059
8083
|
const alternative_query_submitter_for_spas_ = on_navigation && ((search_param_name, new_search_query, url_transformer)=>{
|
|
@@ -8080,7 +8104,7 @@ class $59f48be661ca9195$export$ac6237957a15b3f0 {
|
|
|
8080
8104
|
[search_query_url_param_name]: ""
|
|
8081
8105
|
});
|
|
8082
8106
|
const search_query_signal_ = (0, $kyEB6$createSignal)((0, $kyEB6$untrack)(raw_search_query_signal[0]));
|
|
8083
|
-
const depict_api_ = new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)();
|
|
8107
|
+
const depict_api_ = api ?? new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)();
|
|
8084
8108
|
const previous_searches = (0, $21f51c14cb3f586f$export$84bba84a7b837187)(search_query_signal_);
|
|
8085
8109
|
const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
|
|
8086
8110
|
const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $172e1b898d457050$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
@@ -8150,7 +8174,9 @@ class $59f48be661ca9195$export$ac6237957a15b3f0 {
|
|
|
8150
8174
|
has_sort_or_filters_: (0, $kyEB6$createMemo)(()=>!!(Object.keys(state_.search_selected_filters[0]())?.length || state_.search_sorting[0]()))
|
|
8151
8175
|
},
|
|
8152
8176
|
i18n_: i18n_,
|
|
8153
|
-
enable_category_suggestions_: enable_category_suggestions
|
|
8177
|
+
enable_category_suggestions_: enable_category_suggestions,
|
|
8178
|
+
disable_scrolling_: disable_scrolling_during_modal,
|
|
8179
|
+
bottom_distance_under_modal_: bottom_distance_under_modal_
|
|
8154
8180
|
});
|
|
8155
8181
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
8156
8182
|
// The default behaviour is to align the modal with the input field if possible
|
|
@@ -8248,8 +8274,14 @@ function $59f48be661ca9195$var$get_shared_properties(depict_search) {
|
|
|
8248
8274
|
if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
|
|
8249
8275
|
return shared_properties;
|
|
8250
8276
|
}
|
|
8251
|
-
function $59f48be661ca9195$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $kyEB6$normal_get_product_id) }) {
|
|
8277
|
+
function $59f48be661ca9195$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $kyEB6$normal_get_product_id) , extra_depict_options: extra_depict_options }) {
|
|
8252
8278
|
const shared_properties = $59f48be661ca9195$var$get_shared_properties(depict_search);
|
|
8279
|
+
const grid_spacing_override = typeof grid_spacing === "string" ? {
|
|
8280
|
+
grid_spacing: grid_spacing
|
|
8281
|
+
} : {
|
|
8282
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
8283
|
+
grid_spacing: grid_spacing.horizontal
|
|
8284
|
+
};
|
|
8253
8285
|
return $59f48be661ca9195$var$run_in_root_or_auto_cleanup(()=>{
|
|
8254
8286
|
const { state_: state_ } = shared_properties;
|
|
8255
8287
|
(0, $kyEB6$onCleanup)(shared_properties.reset_history_state_);
|
|
@@ -8299,25 +8331,26 @@ function $59f48be661ca9195$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
8299
8331
|
include_input_field_: include_input_field,
|
|
8300
8332
|
layout_options_: {
|
|
8301
8333
|
cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(cols_at_size),
|
|
8302
|
-
...
|
|
8303
|
-
grid_spacing: grid_spacing
|
|
8304
|
-
} : {
|
|
8305
|
-
override_vertical_spacing: grid_spacing.vertical,
|
|
8306
|
-
grid_spacing: grid_spacing.horizontal
|
|
8307
|
-
}
|
|
8334
|
+
...grid_spacing_override
|
|
8308
8335
|
},
|
|
8336
|
+
recommendations_layout_options_: extra_depict_options?.recommendations_cols_at_size ? {
|
|
8337
|
+
cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(extra_depict_options.recommendations_cols_at_size),
|
|
8338
|
+
...grid_spacing_override
|
|
8339
|
+
} : undefined,
|
|
8309
8340
|
slider_arrow_button_: (0, $kyEB6$GenericSliderArrowButton)({
|
|
8310
8341
|
height_: 12,
|
|
8311
8342
|
width_: 6.46
|
|
8312
8343
|
}),
|
|
8313
8344
|
rr_options_: {
|
|
8314
|
-
template: product_card_template
|
|
8345
|
+
template: product_card_template,
|
|
8346
|
+
pre_processors: extra_depict_options?.pre_processors,
|
|
8347
|
+
post_processors: extra_depict_options?.post_processors
|
|
8315
8348
|
},
|
|
8316
8349
|
get_product_id_: get_product_id
|
|
8317
8350
|
});
|
|
8318
8351
|
}, "Entire SearchPage failed");
|
|
8319
8352
|
}
|
|
8320
|
-
function $59f48be661ca9195$export$b94867ecbd698f21({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler }) {
|
|
8353
|
+
function $59f48be661ca9195$export$b94867ecbd698f21({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler , click_handler: click_handler }) {
|
|
8321
8354
|
const shared_properties = $59f48be661ca9195$var$get_shared_properties(depict_search);
|
|
8322
8355
|
return $59f48be661ca9195$var$run_in_root_or_auto_cleanup(()=>{
|
|
8323
8356
|
const input = (0, $kyEB6$createComponent)((0, $857105c41ea47bee$export$ff21851bb5d30e15), {
|
|
@@ -8338,7 +8371,7 @@ function $59f48be661ca9195$export$b94867ecbd698f21({ depict_search: depict_searc
|
|
|
8338
8371
|
},
|
|
8339
8372
|
disabled_: true,
|
|
8340
8373
|
field_element_ref_: (field)=>{
|
|
8341
|
-
const handler = (0, $kyEB6$catchify)(()=>{
|
|
8374
|
+
const handler = click_handler ?? (0, $kyEB6$catchify)(()=>{
|
|
8342
8375
|
depict_search.modal_open = [
|
|
8343
8376
|
{
|
|
8344
8377
|
style_props_: style_props_
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "./scripts/build",
|
|
12
15
|
"publish": "yarn build && yarn npm publish",
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@depict-ai/utilishared": "^0.0.
|
|
39
|
+
"@depict-ai/utilishared": "^0.0.7",
|
|
37
40
|
"solid-js": "^1.6.2"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|