@depict-ai/ui 1.0.18 → 1.1.0
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/README.md +5 -1
- package/dist/client/main.js +24 -2
- package/dist/client/module.js +24 -2
- package/dist/index.d.ts +115 -139
- package/dist/main.js +116 -72
- package/dist/module.js +116 -72
- package/dist/server/main.js +24 -2
- package/dist/server/module.js +24 -2
- package/package.json +27 -50
package/dist/main.js
CHANGED
|
@@ -37,7 +37,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
|
|
|
37
37
|
$parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
|
|
38
38
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
39
39
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
40
|
-
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.0
|
|
40
|
+
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.1.0";
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -179,10 +179,23 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
179
179
|
let resolve_in_progress;
|
|
180
180
|
cache_obj.in_progress_[body] = new Promise((r)=>resolve_in_progress = r);
|
|
181
181
|
try {
|
|
182
|
-
|
|
182
|
+
let search_results = await (0, $iBTHO$depictaiutilishared.fetch_retry)((0, $iBTHO$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
183
183
|
method: "POST",
|
|
184
184
|
body: body
|
|
185
185
|
});
|
|
186
|
+
if ("query_id" in request && request.type === "collection") // FIXME: Remove. Backwards compatibility layer
|
|
187
|
+
// This will retry the request without the collection type if the first request fails
|
|
188
|
+
{
|
|
189
|
+
if (!search_results || search_results?.status === 404) {
|
|
190
|
+
(0, $iBTHO$depictaiutilishared.dlog)("Fallback request for collections due to failure");
|
|
191
|
+
const fallback_body = JSON.parse(body);
|
|
192
|
+
delete fallback_body.type;
|
|
193
|
+
search_results = await (0, $iBTHO$depictaiutilishared.fetch_retry)((0, $iBTHO$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
194
|
+
method: "POST",
|
|
195
|
+
body: JSON.stringify(fallback_body)
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
186
199
|
if (!search_results || search_results.status !== 200) {
|
|
187
200
|
const retval = fallback_response(input_req);
|
|
188
201
|
resolve_in_progress(retval);
|
|
@@ -995,22 +1008,17 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({ displays_by_key_: displays_
|
|
|
995
1008
|
];
|
|
996
1009
|
},
|
|
997
1010
|
children: (product_id, index)=>{
|
|
998
|
-
// We're using `untrack` here since we don't want to react in here to displays_by_key changing
|
|
999
|
-
// As long as our key stays the same we assume that the display hasn't changed, so we don't want to rerender
|
|
1000
|
-
// If the key gets removed, <For> will remove us
|
|
1001
1011
|
const owner = (0, $iBTHO$solidjs.getOwner)();
|
|
1002
1012
|
const display_accessor = (0, $iBTHO$solidjs.createMemo)(()=>displays_by_key_().get(product_id));
|
|
1003
|
-
const [product_card_resource] = (0, $iBTHO$solidjs.createResource)(
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
]), // re-render when merchant or market changes
|
|
1007
|
-
([merchant, market])=>{
|
|
1013
|
+
const [product_card_resource] = (0, $iBTHO$solidjs.createResource)(display_accessor, // re-render when the reference to the display object changes
|
|
1014
|
+
// this should only be the case when the merchant or market changes and the new request has completed
|
|
1015
|
+
(display)=>{
|
|
1008
1016
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
1009
|
-
const display = (0, $iBTHO$solidjs.untrack)(display_accessor);
|
|
1010
1017
|
return product_card_template_(display, {
|
|
1011
1018
|
set_on_index_change: (fn)=>(0, $iBTHO$solidjs.runWithOwner)(owner, ()=>(0, $iBTHO$solidjs.createEffect)(()=>fn(index()))),
|
|
1012
|
-
merchant:
|
|
1013
|
-
market
|
|
1019
|
+
merchant: (0, $iBTHO$solidjs.untrack)(merchant_),
|
|
1020
|
+
// this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
|
|
1021
|
+
market: (0, $iBTHO$solidjs.untrack)(market_)
|
|
1014
1022
|
});
|
|
1015
1023
|
});
|
|
1016
1024
|
const node_accessor = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)(product_card_resource);
|
|
@@ -5011,7 +5019,7 @@ function $cafad5eca9f09cb5$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
5011
5019
|
|
|
5012
5020
|
|
|
5013
5021
|
const $840d88a04b2d22a7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="product-count"> </div>`, 2), $840d88a04b2d22a7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div></div>`, 2), $840d88a04b2d22a7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $840d88a04b2d22a7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
|
|
5014
|
-
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
|
|
5022
|
+
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , listing_type_: listing_type_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
|
|
5015
5023
|
let results_for;
|
|
5016
5024
|
let only_show_filters_opener_;
|
|
5017
5025
|
let middle_elements_;
|
|
@@ -5036,6 +5044,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5036
5044
|
tenant: tenant_(),
|
|
5037
5045
|
market: market_(),
|
|
5038
5046
|
query_id: query_id_(),
|
|
5047
|
+
type: listing_type_(),
|
|
5039
5048
|
...f.length ? {
|
|
5040
5049
|
filters: f
|
|
5041
5050
|
} : {},
|
|
@@ -5537,7 +5546,8 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
5537
5546
|
router_.navigate_.go_to_({
|
|
5538
5547
|
is_replace_: true,
|
|
5539
5548
|
new_url_: url_object.href,
|
|
5540
|
-
force_spa_navigation_: true
|
|
5549
|
+
force_spa_navigation_: true,
|
|
5550
|
+
scroll: false
|
|
5541
5551
|
});
|
|
5542
5552
|
}, {
|
|
5543
5553
|
defer: true
|
|
@@ -5597,7 +5607,7 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
5597
5607
|
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
5598
5608
|
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5599
5609
|
* @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
|
|
5600
|
-
*/ go_to_: (0, $iBTHO$depictaiutilishared.catchify)(async ({ new_url_: raw_new_url , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
|
|
5610
|
+
*/ go_to_: (0, $iBTHO$depictaiutilishared.catchify)(async ({ new_url_: raw_new_url , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ , scroll: scroll = true })=>{
|
|
5601
5611
|
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5602
5612
|
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5603
5613
|
if (this.#dont_attempt_navigation(event_)) return;
|
|
@@ -5619,7 +5629,8 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
5619
5629
|
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
5620
5630
|
} else this.#throwing_on_navigation.call(this, {
|
|
5621
5631
|
is_replace: is_replace_,
|
|
5622
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin)
|
|
5632
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
5633
|
+
scroll: scroll
|
|
5623
5634
|
});
|
|
5624
5635
|
await promise;
|
|
5625
5636
|
})
|
|
@@ -5645,6 +5656,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5645
5656
|
#merchant_signal = (0, $iBTHO$solidjs.createSignal)();
|
|
5646
5657
|
#market_signal = (0, $iBTHO$solidjs.createSignal)();
|
|
5647
5658
|
#query_id_signal = (0, $iBTHO$solidjs.createSignal)("");
|
|
5659
|
+
#listing_type_signal = (0, $iBTHO$solidjs.createSignal)();
|
|
5648
5660
|
static #has_been_constructed = false;
|
|
5649
5661
|
get localization() {
|
|
5650
5662
|
// allow reactive access
|
|
@@ -5671,6 +5683,12 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5671
5683
|
set market(market) {
|
|
5672
5684
|
this.#market_signal[1](market);
|
|
5673
5685
|
}
|
|
5686
|
+
get listing_type() {
|
|
5687
|
+
return this.#listing_type_signal[0]();
|
|
5688
|
+
}
|
|
5689
|
+
set listing_type(listing_type) {
|
|
5690
|
+
this.#listing_type_signal[1](listing_type);
|
|
5691
|
+
}
|
|
5674
5692
|
get on_navigation() {
|
|
5675
5693
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
5676
5694
|
return this.#router.on_navigation_;
|
|
@@ -5736,6 +5754,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
5736
5754
|
min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
|
|
5737
5755
|
local_filter_cache_: local_filter_cache_,
|
|
5738
5756
|
query_id_: ()=>depict_category.category_id,
|
|
5757
|
+
listing_type_: ()=>depict_category.listing_type,
|
|
5739
5758
|
i18n_: i18n_,
|
|
5740
5759
|
show_quicklinks_: show_quicklinks,
|
|
5741
5760
|
category_title_: category_title,
|
|
@@ -6457,7 +6476,8 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container,
|
|
|
6457
6476
|
sizes: "0px"
|
|
6458
6477
|
}));
|
|
6459
6478
|
const is_sale = (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
|
|
6460
|
-
|
|
6479
|
+
// localized_page_url currently only used by MayaDelorez, but potentially more. Convenience to avoid requireing full frontend URL transformation.
|
|
6480
|
+
const href = (0, $iBTHO$solidjs.createMemo)(()=>display().localized_page_url || display().page_url);
|
|
6461
6481
|
return (()=>{
|
|
6462
6482
|
const _el$ = $6ae613870d3380fc$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
|
|
6463
6483
|
(0, $iBTHO$solidjsweb.addEventListener)(_el$, "click", (0, $iBTHO$depictaiutilishared.catchify)((event_)=>router_.navigate_.go_to_({
|
|
@@ -7634,9 +7654,28 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({ get_search_query_: get_sear
|
|
|
7634
7654
|
|
|
7635
7655
|
|
|
7636
7656
|
|
|
7657
|
+
|
|
7658
|
+
|
|
7659
|
+
function $2005eec80e40088f$export$41b4894022a3580f({ style_props_: style_props_ = (0, $iBTHO$solidjs.createSignal)({}) } = {}) {
|
|
7660
|
+
const [, set_style_props] = style_props_;
|
|
7661
|
+
const supports_hover = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
|
|
7662
|
+
const desktop_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 790px)");
|
|
7663
|
+
const mobile_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 1000px)");
|
|
7664
|
+
const transform_y = (0, $iBTHO$solidjs.createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
|
|
7665
|
+
set_style_props({
|
|
7666
|
+
position: "fixed",
|
|
7667
|
+
top: "50%"
|
|
7668
|
+
});
|
|
7669
|
+
(0, $iBTHO$solidjs.createComputed)(()=>set_style_props((old_value)=>({
|
|
7670
|
+
...old_value,
|
|
7671
|
+
transform: transform_y() ? "translateY(-50%)" : "unset"
|
|
7672
|
+
})));
|
|
7673
|
+
return style_props_;
|
|
7674
|
+
}
|
|
7675
|
+
|
|
7676
|
+
|
|
7637
7677
|
const $f1d7cb69f839a526$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $f1d7cb69f839a526$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"></div></div>`, 4);
|
|
7638
|
-
function $f1d7cb69f839a526$export$a54ec244c8863715(
|
|
7639
|
-
const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , search_recs_view_more_: search_recs_view_more_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ } = opts;
|
|
7678
|
+
function $f1d7cb69f839a526$export$a54ec244c8863715({ depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , search_recs_view_more_: search_recs_view_more_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , modal_body_style_ref_: modal_body_style_ref_ }) {
|
|
7640
7679
|
const [get_sorting] = current_sorting_;
|
|
7641
7680
|
const all_products_loaded_ = (0, $iBTHO$solidjs.createSignal)(false);
|
|
7642
7681
|
const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
|
|
@@ -7689,42 +7728,8 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
|
|
|
7689
7728
|
})));
|
|
7690
7729
|
const available_filters_ = (0, $iBTHO$solidjs.createMemo)(()=>search_results_()?.filters);
|
|
7691
7730
|
const modal_body_style = (0, $iBTHO$solidjs.createSignal)({});
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
const SafeSearchField = (0, $iBTHO$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
7695
|
-
let input_element;
|
|
7696
|
-
let div_with_field_class;
|
|
7697
|
-
search_field = SafeSearchField({
|
|
7698
|
-
i18n_: i18n_,
|
|
7699
|
-
search_field_value_: search_field_value_,
|
|
7700
|
-
submit_query_: submit_query_,
|
|
7701
|
-
clear_filters_: clear_filters_on_next_submit_,
|
|
7702
|
-
input_field_ref_: (el)=>input_element = el,
|
|
7703
|
-
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7704
|
-
disabled_: true
|
|
7705
|
-
});
|
|
7706
|
-
if (search_field) {
|
|
7707
|
-
opts?.modal_body_style_ref_?.(modal_body_style);
|
|
7708
|
-
const align_position = (0, $iBTHO$depictaiutilishared.catchify)((0, $fd463ff0edb29915$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7709
|
-
div_with_field_class.addEventListener("click", (0, $iBTHO$depictaiutilishared.catchify)((e)=>{
|
|
7710
|
-
const target = e.target;
|
|
7711
|
-
const sel = ".submit";
|
|
7712
|
-
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7713
|
-
return;
|
|
7714
|
-
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7715
|
-
const selected_text_range_ = [
|
|
7716
|
-
input_element.selectionStart,
|
|
7717
|
-
input_element.selectionEnd
|
|
7718
|
-
];
|
|
7719
|
-
align_position?.();
|
|
7720
|
-
open_modal_({
|
|
7721
|
-
style_props_: modal_body_style,
|
|
7722
|
-
selected_text_range_: selected_text_range_
|
|
7723
|
-
}, ()=>include_input_field_?.on_close_?.());
|
|
7724
|
-
include_input_field_?.on_open_?.();
|
|
7725
|
-
}));
|
|
7726
|
-
}
|
|
7727
|
-
}
|
|
7731
|
+
const [get_search_field_elements, set_search_field_elements] = (0, $iBTHO$solidjs.createSignal)();
|
|
7732
|
+
const SafeSearchField = (0, $iBTHO$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
7728
7733
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $iBTHO$solidjs.createSignal)(false);
|
|
7729
7734
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $iBTHO$solidjs.createSignal)();
|
|
7730
7735
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
@@ -7788,11 +7793,60 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
|
|
|
7788
7793
|
get_search_query_();
|
|
7789
7794
|
(0, $341a019928b8b91e$export$c7e181728ad525f)(location);
|
|
7790
7795
|
});
|
|
7796
|
+
(0, $iBTHO$solidjs.createEffect)(()=>{
|
|
7797
|
+
// reactive include_input_field
|
|
7798
|
+
// this uses ~7 variables from outer scope which is why I didn't refactor it into a function
|
|
7799
|
+
add_input_field: {
|
|
7800
|
+
const input_field_accessor_value = include_input_field_?.() ?? true; // default to showing input field
|
|
7801
|
+
if (!input_field_accessor_value) break add_input_field;
|
|
7802
|
+
let input_element;
|
|
7803
|
+
let div_with_field_class;
|
|
7804
|
+
const search_field = SafeSearchField({
|
|
7805
|
+
i18n_: i18n_,
|
|
7806
|
+
search_field_value_: search_field_value_,
|
|
7807
|
+
submit_query_: submit_query_,
|
|
7808
|
+
clear_filters_: clear_filters_on_next_submit_,
|
|
7809
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7810
|
+
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7811
|
+
disabled_: true
|
|
7812
|
+
});
|
|
7813
|
+
if (!search_field) break add_input_field;
|
|
7814
|
+
modal_body_style[1]({});
|
|
7815
|
+
modal_body_style_ref_?.(modal_body_style);
|
|
7816
|
+
const align_position = (0, $iBTHO$depictaiutilishared.catchify)((0, $fd463ff0edb29915$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7817
|
+
div_with_field_class.addEventListener("click", (0, $iBTHO$depictaiutilishared.catchify)((e)=>{
|
|
7818
|
+
const target = e.target;
|
|
7819
|
+
const sel = ".submit";
|
|
7820
|
+
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7821
|
+
return;
|
|
7822
|
+
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7823
|
+
const selected_text_range_ = [
|
|
7824
|
+
input_element.selectionStart,
|
|
7825
|
+
input_element.selectionEnd
|
|
7826
|
+
];
|
|
7827
|
+
align_position?.();
|
|
7828
|
+
open_modal_({
|
|
7829
|
+
style_props_: modal_body_style,
|
|
7830
|
+
selected_text_range_: selected_text_range_
|
|
7831
|
+
}, ()=>input_field_accessor_value?.on_close_?.());
|
|
7832
|
+
input_field_accessor_value?.on_open_?.();
|
|
7833
|
+
}));
|
|
7834
|
+
set_search_field_elements(search_field);
|
|
7835
|
+
return;
|
|
7836
|
+
}
|
|
7837
|
+
// We bailed out of adding the input field
|
|
7838
|
+
set_search_field_elements();
|
|
7839
|
+
// There *might* still be a modal open, either from depict_search.modal_open = true or clicking the SearchField which existed here. Said modal now doesn't have anything to align to anymore - it will still try to align to the style_props_ which it got through the modal_body_style_ref_ which are now no longer updated.
|
|
7840
|
+
// In that case, we write what's needed to center the modal to the modal_body_style for the lifetime of this effect function call to make sure the modal is centered and the UI doesn't look "botched".
|
|
7841
|
+
(0, $2005eec80e40088f$export$41b4894022a3580f)({
|
|
7842
|
+
style_props_: modal_body_style
|
|
7843
|
+
});
|
|
7844
|
+
});
|
|
7791
7845
|
return [
|
|
7792
7846
|
document.createComment("Search page based on Depict SDK"),
|
|
7793
7847
|
(()=>{
|
|
7794
7848
|
const _el$2 = $f1d7cb69f839a526$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
|
|
7795
|
-
(0, $iBTHO$solidjsweb.insert)(_el$3,
|
|
7849
|
+
(0, $iBTHO$solidjsweb.insert)(_el$3, get_search_field_elements, null);
|
|
7796
7850
|
(0, $iBTHO$solidjsweb.insert)(_el$3, make_category_suggestion_card_ ? (0, $iBTHO$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
7797
7851
|
severity_: "error",
|
|
7798
7852
|
message_: "Category suggestions failed",
|
|
@@ -7920,7 +7974,6 @@ function $f1d7cb69f839a526$export$a54ec244c8863715(opts) {
|
|
|
7920
7974
|
|
|
7921
7975
|
|
|
7922
7976
|
|
|
7923
|
-
|
|
7924
7977
|
function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
7925
7978
|
const style_element = document.createElement("style");
|
|
7926
7979
|
document.head.append(style_element);
|
|
@@ -7945,6 +7998,7 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
7945
7998
|
|
|
7946
7999
|
|
|
7947
8000
|
|
|
8001
|
+
|
|
7948
8002
|
const $2c61e4cd8229c49a$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$iBTHO$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
|
|
7949
8003
|
/**
|
|
7950
8004
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -8087,18 +8141,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8087
8141
|
return;
|
|
8088
8142
|
}
|
|
8089
8143
|
// Open centered modal
|
|
8090
|
-
const
|
|
8091
|
-
const desktop_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 790px)");
|
|
8092
|
-
const mobile_short = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height: 1000px)");
|
|
8093
|
-
const transform_y = (0, $iBTHO$solidjs.createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
|
|
8094
|
-
const style_props_ = (0, $iBTHO$solidjs.createSignal)({
|
|
8095
|
-
position: "fixed",
|
|
8096
|
-
top: "50%"
|
|
8097
|
-
});
|
|
8098
|
-
(0, $iBTHO$solidjs.createComputed)(()=>style_props_[1]((old_value)=>({
|
|
8099
|
-
...old_value,
|
|
8100
|
-
transform: transform_y() ? "translateY(-50%)" : "unset"
|
|
8101
|
-
})));
|
|
8144
|
+
const style_props_ = (0, $2005eec80e40088f$export$41b4894022a3580f)();
|
|
8102
8145
|
if (signal_value_is_options) {
|
|
8103
8146
|
const [options_arg, ...rest] = open_signal_value;
|
|
8104
8147
|
open_modal_({
|
|
@@ -8166,7 +8209,8 @@ function $2c61e4cd8229c49a$var$get_shared_properties(depict_search) {
|
|
|
8166
8209
|
if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
|
|
8167
8210
|
return shared_properties;
|
|
8168
8211
|
}
|
|
8169
|
-
function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(
|
|
8212
|
+
function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
8213
|
+
const { depict_search: depict_search , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , extra_depict_options: extra_depict_options } = props;
|
|
8170
8214
|
const shared_properties = $2c61e4cd8229c49a$var$get_shared_properties(depict_search);
|
|
8171
8215
|
const grid_spacing_override = typeof grid_spacing === "string" ? {
|
|
8172
8216
|
grid_spacing: grid_spacing
|
|
@@ -8220,7 +8264,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
8220
8264
|
selected_filters_: shared_properties.selected_filters_,
|
|
8221
8265
|
showing_recommendation_rows_: state_.search_showing_recommendation_rows,
|
|
8222
8266
|
scroll_restoration_data_: state_.search_scroll_restoration_data,
|
|
8223
|
-
include_input_field_: include_input_field,
|
|
8267
|
+
include_input_field_: ()=>props.include_input_field,
|
|
8224
8268
|
layout_options_: {
|
|
8225
8269
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(cols_at_size),
|
|
8226
8270
|
...grid_spacing_override
|