@depict-ai/ui 1.0.9 → 1.0.10
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 +3 -3
- package/dist/index.d.ts +562 -542
- package/dist/main.js +171 -84
- package/dist/module.js +171 -87
- package/locales/index.d.ts +89 -89
- package/locales/index.js +2 -2
- package/locales/require.js +2 -2
- package/package.json +48 -10
- package/styles.scss +1 -1
package/dist/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {add_to_version_info as $kyEB6$add_to_version_info, fetch_recs as $kyEB6$fetch_recs, snakeCasifyObject as $kyEB6$snakeCasifyObject, GenericSliderArrowButton as $kyEB6$GenericSliderArrowButton, catchify as $kyEB6$catchify, instant_exec_on_suspect_history_change as $kyEB6$instant_exec_on_suspect_history_change, base_url as $kyEB6$base_url, dlog as $kyEB6$dlog, get_depict_id as $kyEB6$get_depict_id, get_user_id as $kyEB6$get_user_id, get_session_id as $kyEB6$get_session_id, make_url_with_query_params as $kyEB6$make_url_with_query_params, fetch_retry as $kyEB6$fetch_retry, add_version_query_params as $kyEB6$add_version_query_params, sort_obj as $kyEB6$sort_obj,
|
|
2
|
-
import {template as $kyEB6$template, insert as $kyEB6$insert, effect as $kyEB6$effect, setAttribute as $kyEB6$setAttribute, createComponent as $kyEB6$createComponent, use as $kyEB6$use, memo as $kyEB6$memo, addEventListener as $kyEB6$addEventListener, delegateEvents as $kyEB6$delegateEvents, spread as $kyEB6$spread, classList as $kyEB6$classList, style as $kyEB6$style, Dynamic as $kyEB6$Dynamic,
|
|
1
|
+
import {add_to_version_info as $kyEB6$add_to_version_info, fetch_recs as $kyEB6$fetch_recs, snakeCasifyObject as $kyEB6$snakeCasifyObject, GenericSliderArrowButton as $kyEB6$GenericSliderArrowButton, catchify as $kyEB6$catchify, instant_exec_on_suspect_history_change as $kyEB6$instant_exec_on_suspect_history_change, base_url as $kyEB6$base_url, dlog as $kyEB6$dlog, get_depict_id as $kyEB6$get_depict_id, get_user_id as $kyEB6$get_user_id, get_session_id as $kyEB6$get_session_id, make_url_with_query_params as $kyEB6$make_url_with_query_params, fetch_retry as $kyEB6$fetch_retry, add_version_query_params as $kyEB6$add_version_query_params, sort_obj as $kyEB6$sort_obj, report as $kyEB6$report, javascript_media_query as $kyEB6$javascript_media_query, standard_price_format as $kyEB6$standard_price_format, observer as $kyEB6$observer, make_random_classname as $kyEB6$make_random_classname, n_col_styling_with_dist as $kyEB6$n_col_styling_with_dist, CrossIcon as $kyEB6$CrossIcon, useExpandingContainer as $kyEB6$useExpandingContainer, Amazing_Slider as $kyEB6$Amazing_Slider, slider_snap_css as $kyEB6$slider_snap_css, slider_fading_factory as $kyEB6$slider_fading_factory, MinusIcon as $kyEB6$MinusIcon, FilterIcon as $kyEB6$FilterIcon, SortIconAsc as $kyEB6$SortIconAsc, SortIconDesc as $kyEB6$SortIconDesc, PlusIcon as $kyEB6$PlusIcon, hsl_to_rgb as $kyEB6$hsl_to_rgb, relative_luminance_from_rgb as $kyEB6$relative_luminance_from_rgb, TickIcon as $kyEB6$TickIcon, ArrowUp as $kyEB6$ArrowUp, base64_encode_unicode as $kyEB6$base64_encode_unicode, base64_decode_unicode as $kyEB6$base64_decode_unicode, queueMacroTask as $kyEB6$queueMacroTask, is_debug as $kyEB6$is_debug, dwarn as $kyEB6$dwarn, BackIcon as $kyEB6$BackIcon, SearchIcon as $kyEB6$SearchIcon, Layout as $kyEB6$Layout, async_iterable_ipns as $kyEB6$async_iterable_ipns, make_asyncIterable_exiter as $kyEB6$make_asyncIterable_exiter, href_change_ipns as $kyEB6$href_change_ipns, ContainedImage as $kyEB6$ContainedImage, buildThresholdList as $kyEB6$buildThresholdList, deparallelize_no_drop as $kyEB6$deparallelize_no_drop, PreviousSearchIcon as $kyEB6$PreviousSearchIcon, insert_surfaces as $kyEB6$insert_surfaces} from "@depict-ai/utilishared";
|
|
2
|
+
import {template as $kyEB6$template, insert as $kyEB6$insert, effect as $kyEB6$effect, setAttribute as $kyEB6$setAttribute, createComponent as $kyEB6$createComponent, use as $kyEB6$use, memo as $kyEB6$memo, addEventListener as $kyEB6$addEventListener, delegateEvents as $kyEB6$delegateEvents, spread as $kyEB6$spread, classList as $kyEB6$classList, style as $kyEB6$style, Dynamic as $kyEB6$Dynamic, className as $kyEB6$className, mergeProps as $kyEB6$mergeProps} from "solid-js/web";
|
|
3
3
|
import {createSignal as $kyEB6$createSignal, getOwner as $kyEB6$getOwner, createRoot as $kyEB6$createRoot, runWithOwner as $kyEB6$runWithOwner, onCleanup as $kyEB6$onCleanup, createComputed as $kyEB6$createComputed, createRenderEffect as $kyEB6$createRenderEffect, createEffect as $kyEB6$createEffect, untrack as $kyEB6$untrack, batch as $kyEB6$batch, createResource as $kyEB6$createResource, createMemo as $kyEB6$createMemo, Show as $kyEB6$Show, createReaction as $kyEB6$createReaction, Suspense as $kyEB6$Suspense, on as $kyEB6$on, ErrorBoundary as $kyEB6$ErrorBoundary, For as $kyEB6$For, Index as $kyEB6$Index} from "solid-js";
|
|
4
4
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.0.
|
|
5
|
+
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.0.10";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -786,8 +786,8 @@ function $6e41f1fde994db72$export$f33414a4df0afd3f({ product_card_template_: pro
|
|
|
786
786
|
});
|
|
787
787
|
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
788
788
|
}
|
|
789
|
-
/**
|
|
790
|
-
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
789
|
+
/**
|
|
790
|
+
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
791
791
|
*/ function $6e41f1fde994db72$var$Placeholder({ product_card_template_: product_card_template_ }) {
|
|
792
792
|
const get_cloned_placeholders = (element_to_clone = $6e41f1fde994db72$var$cached_placeholder_element)=>Array.isArray(element_to_clone) ? element_to_clone.map((el)=>el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
|
|
793
793
|
if ($6e41f1fde994db72$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
@@ -832,8 +832,8 @@ function $6e41f1fde994db72$export$f33414a4df0afd3f({ product_card_template_: pro
|
|
|
832
832
|
}
|
|
833
833
|
|
|
834
834
|
|
|
835
|
-
/*
|
|
836
|
-
* Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
|
|
835
|
+
/*
|
|
836
|
+
* Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
|
|
837
837
|
*/ const $7747fe1a8c5652e3$export$6c9030e511152266 = 30;
|
|
838
838
|
|
|
839
839
|
|
|
@@ -925,8 +925,8 @@ function $0e0b96a8dc1ad492$export$63dd0350f8559dda({ displays_by_key_: displays_
|
|
|
925
925
|
|
|
926
926
|
|
|
927
927
|
|
|
928
|
-
/**
|
|
929
|
-
* Gets product_id (the thing we key the rendering on) from a display
|
|
928
|
+
/**
|
|
929
|
+
* Gets product_id (the thing we key the rendering on) from a display
|
|
930
930
|
*/ function $16351e4c87b90b3d$export$548d053aba053d79(display) {
|
|
931
931
|
if ("variant_index" in display) {
|
|
932
932
|
const actual_display = display.variant_displays[display.variant_index];
|
|
@@ -1227,9 +1227,9 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({ plp_results_: plp_results_
|
|
|
1227
1227
|
return _el$;
|
|
1228
1228
|
})();
|
|
1229
1229
|
}
|
|
1230
|
-
/**
|
|
1231
|
-
* Sets styling to styling generated by "Layout" (n_col_styling_with_dist) depending on if filters are open or not
|
|
1232
|
-
* This function is special to the actual PLPResults.
|
|
1230
|
+
/**
|
|
1231
|
+
* Sets styling to styling generated by "Layout" (n_col_styling_with_dist) depending on if filters are open or not
|
|
1232
|
+
* This function is special to the actual PLPResults.
|
|
1233
1233
|
*/ function $2d25e42846eac370$var$results_grid_styling_generator({ layout_options_: layout_options_ , sort_or_filter_open_: sort_or_filter_open_ , set_styling_: set_styling_ , selector_beginning_: selector_beginning_ }) {
|
|
1234
1234
|
(0, $kyEB6$createRenderEffect)(()=>{
|
|
1235
1235
|
// Add grid styling that changes when filters get opened/closed
|
|
@@ -3152,6 +3152,52 @@ function $84d6cd10bb7b1589$export$ab34afce88557c0e(props) {
|
|
|
3152
3152
|
|
|
3153
3153
|
|
|
3154
3154
|
|
|
3155
|
+
|
|
3156
|
+
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
|
|
3160
|
+
const $d20eff0aadc28983$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<span></span>`, 2);
|
|
3161
|
+
function $d20eff0aadc28983$export$acb3eaade4b23afd(props) {
|
|
3162
|
+
return (()=>{
|
|
3163
|
+
const _el$ = $d20eff0aadc28983$var$_tmpl$.cloneNode(true);
|
|
3164
|
+
(0, $kyEB6$effect)((_p$)=>{
|
|
3165
|
+
const _v$ = `depict-placeholder ${props.class || ""}`, _v$2 = props.style;
|
|
3166
|
+
_v$ !== _p$._v$ && (0, $kyEB6$className)(_el$, _p$._v$ = _v$);
|
|
3167
|
+
_p$._v$2 = (0, $kyEB6$style)(_el$, _v$2, _p$._v$2);
|
|
3168
|
+
return _p$;
|
|
3169
|
+
}, {
|
|
3170
|
+
_v$: undefined,
|
|
3171
|
+
_v$2: undefined
|
|
3172
|
+
});
|
|
3173
|
+
return _el$;
|
|
3174
|
+
})();
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
function $d134eae24341b4a1$export$89c6019e4baa40b1(props) {
|
|
3180
|
+
const style = (0, $kyEB6$createMemo)(()=>{
|
|
3181
|
+
const { style: style , height: height , width: width } = props;
|
|
3182
|
+
return {
|
|
3183
|
+
...style || {},
|
|
3184
|
+
height: height ?? "1em",
|
|
3185
|
+
...width && {
|
|
3186
|
+
width: width
|
|
3187
|
+
}
|
|
3188
|
+
};
|
|
3189
|
+
});
|
|
3190
|
+
return (0, $kyEB6$createComponent)((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
3191
|
+
get style () {
|
|
3192
|
+
return style();
|
|
3193
|
+
},
|
|
3194
|
+
get ["class"] () {
|
|
3195
|
+
return props.class;
|
|
3196
|
+
}
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
|
|
3155
3201
|
const $fab07f52c9861732$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="filter-collapsible"></div>`, 2), $fab07f52c9861732$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<button class="clear-group"><span></span></button>`, 4), $fab07f52c9861732$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="view-more-clear"></div>`, 2), $fab07f52c9861732$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="filter-collapsible-body"><div class="filter-part"></div></div>`, 4), $fab07f52c9861732$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<details class="filter-collapsible"></details>`, 2), $fab07f52c9861732$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<summary class="filter-group-summary"><div class="summary"><span></span><div class="selected-w-sign"></div></div></summary>`, 8), $fab07f52c9861732$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="ungrouped"></div>`, 2), $fab07f52c9861732$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<button class="clear-all-filters major"></button>`, 2);
|
|
3156
3202
|
function $fab07f52c9861732$export$3f1a388cc0d8fed7(props) {
|
|
3157
3203
|
// Split like this to make placeholder wrapping more visible & this component is exported and used in MobileModal
|
|
@@ -3164,7 +3210,7 @@ function $fab07f52c9861732$export$3f1a388cc0d8fed7(props) {
|
|
|
3164
3210
|
length: 5
|
|
3165
3211
|
}).map(()=>(()=>{
|
|
3166
3212
|
const _el$ = $fab07f52c9861732$var$_tmpl$.cloneNode(true);
|
|
3167
|
-
(0, $kyEB6$insert)(_el$, (0, $kyEB6$createComponent)((0, $
|
|
3213
|
+
(0, $kyEB6$insert)(_el$, (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
3168
3214
|
width: "100%",
|
|
3169
3215
|
height: "50px"
|
|
3170
3216
|
}));
|
|
@@ -3394,6 +3440,7 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
|
|
|
3394
3440
|
|
|
3395
3441
|
|
|
3396
3442
|
|
|
3443
|
+
|
|
3397
3444
|
const $68a258a92b88f02f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="sorting-attributes"></div>`, 2), $68a258a92b88f02f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="sorting-direction"></div>`, 2), $68a258a92b88f02f$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span></div></div>`, 7), $68a258a92b88f02f$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div><label class="input-row"><input type="radio"><span class="custom-indicator"></span></label></div>`, 7);
|
|
3398
3445
|
function $68a258a92b88f02f$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_: [get_current_sorting, set_current_sorting] , meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_ }) {
|
|
3399
3446
|
const title_radio_name = (0, $kyEB6$make_random_classname)();
|
|
@@ -3410,7 +3457,7 @@ function $68a258a92b88f02f$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3410
3457
|
}).map(()=>(()=>{
|
|
3411
3458
|
const _el$4 = $68a258a92b88f02f$var$_tmpl$3.cloneNode(true), _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling;
|
|
3412
3459
|
_el$6.disabled = true;
|
|
3413
|
-
(0, $kyEB6$insert)(_el$5, (0, $kyEB6$createComponent)((0, $
|
|
3460
|
+
(0, $kyEB6$insert)(_el$5, (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
3414
3461
|
height: "1.2em",
|
|
3415
3462
|
width: "100%"
|
|
3416
3463
|
}), null);
|
|
@@ -3919,9 +3966,9 @@ function $5efb5894079b220e$export$b288c38ae3fddb56({ available_filters_: availab
|
|
|
3919
3966
|
last_remote_state = available_filters_();
|
|
3920
3967
|
});
|
|
3921
3968
|
}
|
|
3922
|
-
/**
|
|
3923
|
-
* When a filter is only available locally due to being selected in a previous navigation, we want to make that clear and prevent further "invalid" choices.
|
|
3924
|
-
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
3969
|
+
/**
|
|
3970
|
+
* When a filter is only available locally due to being selected in a previous navigation, we want to make that clear and prevent further "invalid" choices.
|
|
3971
|
+
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
3925
3972
|
*/ function $5efb5894079b220e$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
3926
3973
|
const old_meta = local_filter_object.meta;
|
|
3927
3974
|
const selected_filter_data = selected_filter.data;
|
|
@@ -4361,10 +4408,10 @@ const $4147651646da990a$var$range_delimiter = "-";
|
|
|
4361
4408
|
const $4147651646da990a$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
|
|
4362
4409
|
const $4147651646da990a$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
|
|
4363
4410
|
const $4147651646da990a$var$empty_item_replacement = "0️⃣";
|
|
4364
|
-
/**
|
|
4365
|
-
* Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
|
|
4366
|
-
* The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
|
|
4367
|
-
* No deep or mixed nesting levels are supported.
|
|
4411
|
+
/**
|
|
4412
|
+
* Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
|
|
4413
|
+
* The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
|
|
4414
|
+
* No deep or mixed nesting levels are supported.
|
|
4368
4415
|
*/ function $4147651646da990a$var$array_is_serializable(array, is_root = true) {
|
|
4369
4416
|
if (array.every((item)=>Array.isArray(item))) {
|
|
4370
4417
|
if (!is_root) // Deeply nested arrays are not supported, but also don't exist as filters (yet)
|
|
@@ -4376,10 +4423,10 @@ const $4147651646da990a$var$empty_item_replacement = "0️⃣";
|
|
|
4376
4423
|
// Encoding reserved characters is not supported
|
|
4377
4424
|
return !array.some((item)=>item.includes($4147651646da990a$var$array_item_delimiter) || item.includes($4147651646da990a$var$string_item_delimiter) || item === $4147651646da990a$var$empty_item_replacement);
|
|
4378
4425
|
}
|
|
4379
|
-
/**
|
|
4380
|
-
* Human readable string[] or string[][] serialization for URLs.
|
|
4381
|
-
* @param array
|
|
4382
|
-
* @returns
|
|
4426
|
+
/**
|
|
4427
|
+
* Human readable string[] or string[][] serialization for URLs.
|
|
4428
|
+
* @param array
|
|
4429
|
+
* @returns
|
|
4383
4430
|
*/ function $4147651646da990a$var$encode_array(array) {
|
|
4384
4431
|
const is_nested = array.every((item)=>Array.isArray(item));
|
|
4385
4432
|
if (is_nested) return array.map($4147651646da990a$var$encode_array).join($4147651646da990a$var$array_item_delimiter) + $4147651646da990a$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
|
|
@@ -4491,6 +4538,7 @@ function $4147651646da990a$export$43cd1e747fecd42e(to_url, set_clearing_flag, fr
|
|
|
4491
4538
|
}
|
|
4492
4539
|
|
|
4493
4540
|
|
|
4541
|
+
|
|
4494
4542
|
const $dfa5b6f7c5e421df$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<nav class="crumbs"></nav>`, 2), $dfa5b6f7c5e421df$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<a class="crumb"></a>`, 2), $dfa5b6f7c5e421df$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<span class="separator"></span>`, 2);
|
|
4495
4543
|
function $dfa5b6f7c5e421df$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , router_: router_ , i18n_: i18n_ }) {
|
|
4496
4544
|
const placeholder_crumb_data = [
|
|
@@ -4516,7 +4564,7 @@ function $dfa5b6f7c5e421df$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4516
4564
|
return display_accessor();
|
|
4517
4565
|
},
|
|
4518
4566
|
get fallback () {
|
|
4519
|
-
return (0, $kyEB6$createComponent)((0, $
|
|
4567
|
+
return (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
4520
4568
|
height: "calc(1em + 1px)",
|
|
4521
4569
|
width: "10ch"
|
|
4522
4570
|
});
|
|
@@ -4569,6 +4617,7 @@ function $dfa5b6f7c5e421df$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4569
4617
|
|
|
4570
4618
|
|
|
4571
4619
|
|
|
4620
|
+
|
|
4572
4621
|
const $06edf3aec9073663$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<nav class="quicklinks"></nav>`, 2), $06edf3aec9073663$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div>QuickLinks failed</div>`, 2), $06edf3aec9073663$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<a class="quicklink"></a>`, 2);
|
|
4573
4622
|
function $06edf3aec9073663$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ , router_: router_ , current_query_id_: current_query_id_ , slider_arrow_button_: slider_arrow_button_ , breadcrumb_data_: breadcrumb_data_ , i18n_: i18n_ }) {
|
|
4574
4623
|
let scrolling_logic_ran_for_query_id = false;
|
|
@@ -4721,7 +4770,7 @@ function $06edf3aec9073663$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
4721
4770
|
category_query_id_: display_accessor()?.query_id
|
|
4722
4771
|
});
|
|
4723
4772
|
}), true);
|
|
4724
|
-
(0, $kyEB6$insert)(_el$3, ()=>display_accessor()?.title || (0, $kyEB6$createComponent)((0, $
|
|
4773
|
+
(0, $kyEB6$insert)(_el$3, ()=>display_accessor()?.title || (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
4725
4774
|
height: "1em",
|
|
4726
4775
|
width: "10ch"
|
|
4727
4776
|
}));
|
|
@@ -4941,14 +4990,14 @@ function $a1c4da51ff91dd01$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
4941
4990
|
|
|
4942
4991
|
|
|
4943
4992
|
|
|
4944
|
-
const $eb9ba2e49ab3dcc2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="statement">No category ID specified, this is probably unintentional. Make sure to
|
|
4993
|
+
const $eb9ba2e49ab3dcc2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="statement">No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.</div>`, 2), $eb9ba2e49ab3dcc2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="buttons"><button class="ok major"></button></div>`, 4);
|
|
4945
4994
|
function $eb9ba2e49ab3dcc2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
4946
4995
|
if (!(0, $kyEB6$is_debug)) return; // Just to make sure we don't show this in production
|
|
4947
4996
|
const owner = (0, $kyEB6$getOwner)();
|
|
4948
4997
|
const disconnect = (0, $kyEB6$observer).onexists(el, ({ element: element })=>(0, $kyEB6$runWithOwner)(owner, ()=>(0, $kyEB6$createEffect)(()=>{
|
|
4949
4998
|
if (!document.documentElement.contains(element)) return;
|
|
4950
4999
|
if (!query_id_()) {
|
|
4951
|
-
const warning = "No category ID specified, this is probably unintentional. Make sure to
|
|
5000
|
+
const warning = "No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.";
|
|
4952
5001
|
(0, $kyEB6$dwarn)(warning);
|
|
4953
5002
|
const { close_toast_: close_toast_ } = (0, $bf52d9f9eebd1938$export$5196e4c01fa56fcb)({
|
|
4954
5003
|
class: "warning",
|
|
@@ -4975,6 +5024,7 @@ function $eb9ba2e49ab3dcc2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
4975
5024
|
]);
|
|
4976
5025
|
|
|
4977
5026
|
|
|
5027
|
+
|
|
4978
5028
|
const $df5d81d0fe61ff21$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="product-count"> </div>`, 2), $df5d81d0fe61ff21$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div></div>`, 2), $df5d81d0fe61ff21$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="filter-results-for-one-row"></div>`, 2), $df5d81d0fe61ff21$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
|
|
4979
5029
|
function $df5d81d0fe61ff21$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_ }) {
|
|
4980
5030
|
let results_for;
|
|
@@ -5051,7 +5101,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5051
5101
|
get children () {
|
|
5052
5102
|
return [
|
|
5053
5103
|
" ",
|
|
5054
|
-
(0, $kyEB6$createComponent)((0, $
|
|
5104
|
+
(0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
5055
5105
|
height: "1em",
|
|
5056
5106
|
width: "3ch"
|
|
5057
5107
|
})
|
|
@@ -5474,8 +5524,8 @@ function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
|
5474
5524
|
}
|
|
5475
5525
|
};
|
|
5476
5526
|
}
|
|
5477
|
-
/**
|
|
5478
|
-
* Writes the sorting and filters to the URL query parameters when they change.
|
|
5527
|
+
/**
|
|
5528
|
+
* Writes the sorting and filters to the URL query parameters when they change.
|
|
5479
5529
|
*/ function $ccd5db07a3a069c5$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ , get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_ }) {
|
|
5480
5530
|
(0, $kyEB6$createEffect)((0, $kyEB6$on)([
|
|
5481
5531
|
get_sorting_,
|
|
@@ -5515,8 +5565,8 @@ function $ccd5db07a3a069c5$var$delete_sideways_param_flag(searchParams) {
|
|
|
5515
5565
|
|
|
5516
5566
|
|
|
5517
5567
|
class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
5518
|
-
/**
|
|
5519
|
-
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5568
|
+
/**
|
|
5569
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5520
5570
|
*/ #throwing_on_navigation(...args) {
|
|
5521
5571
|
const { on_navigation_: on_navigation_ } = this;
|
|
5522
5572
|
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
@@ -5529,14 +5579,14 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
|
5529
5579
|
});
|
|
5530
5580
|
}
|
|
5531
5581
|
}
|
|
5532
|
-
/**
|
|
5533
|
-
* Checks if this tab shouldn't navigate because user wants to open in new tab
|
|
5582
|
+
/**
|
|
5583
|
+
* Checks if this tab shouldn't navigate because user wants to open in new tab
|
|
5534
5584
|
*/ #dont_attempt_navigation(ev) {
|
|
5535
5585
|
return ev?.button || ev?.metaKey || ev?.ctrlKey;
|
|
5536
5586
|
}
|
|
5537
|
-
/**
|
|
5538
|
-
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5539
|
-
* This standardises waiting for all kinds of routers
|
|
5587
|
+
/**
|
|
5588
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5589
|
+
* This standardises waiting for all kinds of routers
|
|
5540
5590
|
*/ #get_navigation_happened_promise(is_replace) {
|
|
5541
5591
|
return new Promise((resolve)=>{
|
|
5542
5592
|
const handler = (what_happened)=>{
|
|
@@ -5549,19 +5599,19 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
|
5549
5599
|
});
|
|
5550
5600
|
}
|
|
5551
5601
|
navigate_ = {
|
|
5552
|
-
/**
|
|
5553
|
-
* Call this if you *just* want to replace the state object in history.state
|
|
5602
|
+
/**
|
|
5603
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
5554
5604
|
*/ replace_state_: (new_state)=>{
|
|
5555
5605
|
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
5556
5606
|
history.replaceState(new_state, "");
|
|
5557
5607
|
},
|
|
5558
|
-
/**
|
|
5559
|
-
* Call this to change the URL
|
|
5560
|
-
* @param new_url_ new URL to go to
|
|
5561
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5562
|
-
* @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
|
|
5563
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5564
|
-
* @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
|
|
5608
|
+
/**
|
|
5609
|
+
* Call this to change the URL
|
|
5610
|
+
* @param new_url_ new URL to go to
|
|
5611
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5612
|
+
* @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
|
|
5613
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5614
|
+
* @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
|
|
5565
5615
|
*/ go_to_: (0, $kyEB6$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_ })=>{
|
|
5566
5616
|
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5567
5617
|
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
@@ -5769,7 +5819,7 @@ const $e4615ecd1849548f$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
|
5769
5819
|
const actual_function = ({ category_title_: category_title_ , product_count_: product_count_ })=>{
|
|
5770
5820
|
return (()=>{
|
|
5771
5821
|
const _el$ = $e4615ecd1849548f$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild;
|
|
5772
|
-
(0, $kyEB6$insert)(_el$2, ()=>category_title_() || (0, $kyEB6$createComponent)((0, $
|
|
5822
|
+
(0, $kyEB6$insert)(_el$2, ()=>category_title_() || (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
5773
5823
|
height: "1em",
|
|
5774
5824
|
width: "10ch"
|
|
5775
5825
|
}));
|
|
@@ -5947,14 +5997,45 @@ async function $5c5f95951393e5d1$var$download_categories(tenant, market) {
|
|
|
5947
5997
|
|
|
5948
5998
|
|
|
5949
5999
|
|
|
6000
|
+
|
|
6001
|
+
|
|
6002
|
+
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
6003
|
+
const style = (0, $kyEB6$createMemo)(()=>{
|
|
6004
|
+
const { style: style , height: height , width: width , aspectRatio: aspectRatio } = props;
|
|
6005
|
+
const is_image = aspectRatio != undefined;
|
|
6006
|
+
const size_data = is_image ? {
|
|
6007
|
+
width: "100%",
|
|
6008
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
6009
|
+
} : {
|
|
6010
|
+
width: width,
|
|
6011
|
+
height: height
|
|
6012
|
+
};
|
|
6013
|
+
return {
|
|
6014
|
+
display: "block",
|
|
6015
|
+
...style || {},
|
|
6016
|
+
...size_data
|
|
6017
|
+
};
|
|
6018
|
+
});
|
|
6019
|
+
return (0, $kyEB6$createComponent)((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
6020
|
+
get style () {
|
|
6021
|
+
return style();
|
|
6022
|
+
},
|
|
6023
|
+
get ["class"] () {
|
|
6024
|
+
return props.class;
|
|
6025
|
+
}
|
|
6026
|
+
});
|
|
6027
|
+
}
|
|
6028
|
+
|
|
6029
|
+
|
|
6030
|
+
|
|
5950
6031
|
const $bb15dfb548a7666e$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="title"></span></div></div></div>`, 10);
|
|
5951
6032
|
function $bb15dfb548a7666e$export$ee1733d9a8495996() {
|
|
5952
6033
|
return (()=>{
|
|
5953
6034
|
const _el$ = $bb15dfb548a7666e$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild;
|
|
5954
|
-
(0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $
|
|
5955
|
-
|
|
6035
|
+
(0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
|
|
6036
|
+
aspectRatio: 1
|
|
5956
6037
|
}));
|
|
5957
|
-
(0, $kyEB6$insert)(_el$5, (0, $kyEB6$createComponent)((0, $
|
|
6038
|
+
(0, $kyEB6$insert)(_el$5, (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
5958
6039
|
width: "20ch",
|
|
5959
6040
|
height: "1em"
|
|
5960
6041
|
}));
|
|
@@ -6369,8 +6450,8 @@ async function $bfd908d13d90934c$export$e16630ecb9644a1c({ on_submit_with_unchan
|
|
|
6369
6450
|
|
|
6370
6451
|
|
|
6371
6452
|
|
|
6372
|
-
/**
|
|
6373
|
-
* Expand an object where every value in the top-level is an accessor into a normal object. Used for converting solid_i18n objects into external i18n typed objects.
|
|
6453
|
+
/**
|
|
6454
|
+
* Expand an object where every value in the top-level is an accessor into a normal object. Used for converting solid_i18n objects into external i18n typed objects.
|
|
6374
6455
|
*/ const $c97b1f0e44afb9d2$export$27b710c08412a7ad = (obj)=>{
|
|
6375
6456
|
return Object.fromEntries(Object.keys(obj).map((key)=>[
|
|
6376
6457
|
key,
|
|
@@ -7537,7 +7618,7 @@ function $793905995512612d$export$c05a196222ba1302({ suggestions_: suggestions_
|
|
|
7537
7618
|
get fallback () {
|
|
7538
7619
|
return (()=>{
|
|
7539
7620
|
const _el$2 = $793905995512612d$var$_tmpl$2.cloneNode(true);
|
|
7540
|
-
(0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $
|
|
7621
|
+
(0, $kyEB6$insert)(_el$2, (0, $kyEB6$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
7541
7622
|
height: "19px",
|
|
7542
7623
|
width: "133px"
|
|
7543
7624
|
}));
|
|
@@ -7911,8 +7992,8 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
|
|
|
7911
7992
|
|
|
7912
7993
|
|
|
7913
7994
|
const $806c97b931758897$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$kyEB6$template)(`<div class="depict plp search"></div>`, 2);
|
|
7914
|
-
/**
|
|
7915
|
-
* 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.
|
|
7995
|
+
/**
|
|
7996
|
+
* 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.
|
|
7916
7997
|
*/ const $806c97b931758897$var$privately_shared_properties = /*@__PURE__*/ new WeakMap();
|
|
7917
7998
|
const $806c97b931758897$var$min_products_to_fetch_ = 20;
|
|
7918
7999
|
const $806c97b931758897$export$bde3eb976dfded9 = (depict_search)=>$806c97b931758897$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
@@ -8113,7 +8194,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8113
8194
|
set market(market) {
|
|
8114
8195
|
this.#market_signal[1](market);
|
|
8115
8196
|
}
|
|
8116
|
-
async fetchSearchResults(query, filters, maxResults =
|
|
8197
|
+
async fetchSearchResults(query, filters, maxResults = 48) {
|
|
8117
8198
|
const { depict_api_: depict_api_ } = $806c97b931758897$var$privately_shared_properties.get(this);
|
|
8118
8199
|
const result = await depict_api_.query({
|
|
8119
8200
|
tenant: this.merchant,
|
|
@@ -8309,8 +8390,8 @@ const $6891c018a834cfdd$export$d86a33413558014e = (openModalParams)=>{
|
|
|
8309
8390
|
}
|
|
8310
8391
|
const { cleanup: cleanup } = (0, $4ca91518c9a35379$export$828dcdd425fd3231)(openModalParams.element);
|
|
8311
8392
|
let dispose_aligner;
|
|
8312
|
-
/**
|
|
8313
|
-
* Setting position to fixed is important to make the modal work with align_field.
|
|
8393
|
+
/**
|
|
8394
|
+
* Setting position to fixed is important to make the modal work with align_field.
|
|
8314
8395
|
*/ const style_props_ = (0, $kyEB6$createSignal)({
|
|
8315
8396
|
position: "fixed"
|
|
8316
8397
|
});
|
|
@@ -8390,6 +8471,9 @@ function $6936724b9e0b98d5$export$689e204eadb33baf(pr) {
|
|
|
8390
8471
|
|
|
8391
8472
|
|
|
8392
8473
|
|
|
8474
|
+
|
|
8475
|
+
|
|
8476
|
+
|
|
8393
8477
|
class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
|
|
8394
8478
|
#stop_listening;
|
|
8395
8479
|
#disconnect_observer;
|
|
@@ -8406,8 +8490,8 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8406
8490
|
})();
|
|
8407
8491
|
return new Set();
|
|
8408
8492
|
})();
|
|
8409
|
-
/**
|
|
8410
|
-
* Returns if the "replacement page" is currently open
|
|
8493
|
+
/**
|
|
8494
|
+
* Returns if the "replacement page" is currently open
|
|
8411
8495
|
*/ get open_() {
|
|
8412
8496
|
// make this "readonly" from the outside, the only way to open is by making the url change so that is_page_ returns true
|
|
8413
8497
|
return this.#is_open;
|
|
@@ -8492,26 +8576,26 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8492
8576
|
if (what_happened !== "popstate") return;
|
|
8493
8577
|
const cleaned_current_url = $753e9b2889a47c89$var$clean_url(location.href);
|
|
8494
8578
|
if (!$753e9b2889a47c89$export$3ccaa27d81dd8556.#visited_urls.has(cleaned_current_url)) {
|
|
8495
|
-
/*
|
|
8496
|
-
What does this check do? Well, there's a bug without it where people end up on a page that they shouldn't see (i.e. a somewhat blank page).
|
|
8497
|
-
The culprit of that bug is: the browser remembers where to make "hard"-navigations (i.e. a full document rebuild with a new `document` and `window` object) when going back and forwards in the history and where to just change the url. What it doesn't always correctly remember (observed in at least chrome and firefox), is *what document to hard-navigate to*. Therefore, we have to jump in and take care of that.
|
|
8498
|
-
The reproduction is this:
|
|
8499
|
-
Spendrups has set up a search page for us under /start/search. We don't want to hard-reload the page though to get there.
|
|
8500
|
-
1. Go to a product page like https://ehandel.spendrups.se/Product/1104201
|
|
8501
|
-
2. Make a search
|
|
8502
|
-
We use PageReplacer to just replace the current page (and the url in the address bar) with the search page. The thing is though, that when going back now the URL just updates but the browser doesn't actually navigate - that's fine, PageReplacer will just restore the old page contents
|
|
8503
|
-
3. Try going back just for fun
|
|
8504
|
-
Everything works as expected
|
|
8505
|
-
4. Go forwards again (just for fun, skip this if you skipped 3)
|
|
8506
|
-
Now the trouble comes when we introduce "hard" navigation.
|
|
8507
|
-
5. Click on a search result. The browser will now "hard" navigate to a new page.
|
|
8508
|
-
6. Click "back"
|
|
8509
|
-
What happens now, is that the browser hard-navigates to /start/search.
|
|
8510
|
-
7. Click "back" again
|
|
8511
|
-
What happens now, is that the browser "soft-navigates" (just changes the URL) to https://ehandel.spendrups.se/Product/1104201
|
|
8512
|
-
PageReplacer unload itself and reveals the original document - it is expected to be the one under https://ehandel.spendrups.se/Product/1104201, but actually it is the one under /start/search - a white page.
|
|
8513
|
-
|
|
8514
|
-
|
|
8579
|
+
/*
|
|
8580
|
+
What does this check do? Well, there's a bug without it where people end up on a page that they shouldn't see (i.e. a somewhat blank page).
|
|
8581
|
+
The culprit of that bug is: the browser remembers where to make "hard"-navigations (i.e. a full document rebuild with a new `document` and `window` object) when going back and forwards in the history and where to just change the url. What it doesn't always correctly remember (observed in at least chrome and firefox), is *what document to hard-navigate to*. Therefore, we have to jump in and take care of that.
|
|
8582
|
+
The reproduction is this:
|
|
8583
|
+
Spendrups has set up a search page for us under /start/search. We don't want to hard-reload the page though to get there.
|
|
8584
|
+
1. Go to a product page like https://ehandel.spendrups.se/Product/1104201
|
|
8585
|
+
2. Make a search
|
|
8586
|
+
We use PageReplacer to just replace the current page (and the url in the address bar) with the search page. The thing is though, that when going back now the URL just updates but the browser doesn't actually navigate - that's fine, PageReplacer will just restore the old page contents
|
|
8587
|
+
3. Try going back just for fun
|
|
8588
|
+
Everything works as expected
|
|
8589
|
+
4. Go forwards again (just for fun, skip this if you skipped 3)
|
|
8590
|
+
Now the trouble comes when we introduce "hard" navigation.
|
|
8591
|
+
5. Click on a search result. The browser will now "hard" navigate to a new page.
|
|
8592
|
+
6. Click "back"
|
|
8593
|
+
What happens now, is that the browser hard-navigates to /start/search.
|
|
8594
|
+
7. Click "back" again
|
|
8595
|
+
What happens now, is that the browser "soft-navigates" (just changes the URL) to https://ehandel.spendrups.se/Product/1104201
|
|
8596
|
+
PageReplacer unload itself and reveals the original document - it is expected to be the one under https://ehandel.spendrups.se/Product/1104201, but actually it is the one under /start/search - a white page.
|
|
8597
|
+
The fix: is to remember all pages that we have visited since the creation of `window` (we do that by having a static property on PageReplacer since we assume the PageReplacer source code will only exist once on the page and will be loaded at page load, the latter assumption might be wrong, but I hope not). If we get a "popstate" event (meaning back or forwards button, not new page being pushed) to an unknown page we reload.
|
|
8598
|
+
*/ (0, $kyEB6$dlog)("PageReplacer: ", cleaned_current_url, " hasn't been visited since document was created, reloading since we won't be able to show this page otherwise");
|
|
8515
8599
|
location.reload();
|
|
8516
8600
|
$753e9b2889a47c89$export$3ccaa27d81dd8556.#reverting_permitted = false; // Disallow any reverting since we can't - it would flash a white page until the reload has finished.
|
|
8517
8601
|
this.#unload(); // Call unload to "kill" the solid-js stuff quicker so that it stops updating - the user is expecting the next thing that happens to be a navigation to the actual page the URL says they're on.
|
|
@@ -8520,8 +8604,8 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8520
8604
|
(0, $kyEB6$instant_exec_on_suspect_history_change).add(on_maybe_popstate);
|
|
8521
8605
|
this.#revert_fns.push(()=>(0, $kyEB6$instant_exec_on_suspect_history_change).delete(on_maybe_popstate)); // Don't run the bugfixer if there isn't a PageReplacer page open since I assume the bug only happens when going back from a PageReplace'd page
|
|
8522
8606
|
}
|
|
8523
|
-
/**
|
|
8524
|
-
* Stops listening to URL changes and closes the page (if it is currently open)
|
|
8607
|
+
/**
|
|
8608
|
+
* Stops listening to URL changes and closes the page (if it is currently open)
|
|
8525
8609
|
*/ destroy_() {
|
|
8526
8610
|
this.#unload();
|
|
8527
8611
|
this.#stop_listening?.();
|
|
@@ -8536,8 +8620,8 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8536
8620
|
if (!is_spa_) (0, $6936724b9e0b98d5$export$689e204eadb33baf)(this); // Make so that clicking on links to the previous page work instantly
|
|
8537
8621
|
}
|
|
8538
8622
|
}
|
|
8539
|
-
/**
|
|
8540
|
-
* Remove hash from URL
|
|
8623
|
+
/**
|
|
8624
|
+
* Remove hash from URL
|
|
8541
8625
|
*/ function $753e9b2889a47c89$var$clean_url(url) {
|
|
8542
8626
|
// Would want to have this a static private function on PageReplacer, but that's not supported in MobileSafari yet
|
|
8543
8627
|
// remove hash, all other params *could* trigger a re-request
|
|
@@ -8568,4 +8652,4 @@ const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b
|
|
|
8568
8652
|
(0, $kyEB6$add_to_version_info)("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
|
|
8569
8653
|
|
|
8570
8654
|
|
|
8571
|
-
export {$c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version};
|
|
8655
|
+
export {$c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version};
|