@depict-ai/ui 4.0.24 → 4.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -18,6 +18,9 @@ function $parcel$export(e, n, v, s) {
18
18
  function $parcel$interopDefault(a) {
19
19
  return a && a.__esModule ? a.default : a;
20
20
  }
21
+ $parcel$export(module.exports, "preserve_items_in_history_dot_state", () => $cfcd56242923775d$export$5162a71f252e6122);
22
+ $parcel$export(module.exports, "prefixes_to_preserve_in_history_dot_state", () => $cfcd56242923775d$export$3064e1e8c6513da3);
23
+ $parcel$export(module.exports, "allowNativeNavigation", () => $9ca08bcacbc598ce$export$29d28dadc2d6b631);
21
24
  $parcel$export(module.exports, "modalVersionSymbol", () => $072ab198d82c3eb7$export$1ea76ea778b880dd);
22
25
  $parcel$export(module.exports, "createDeparallelizedNoDropResource", () => $a28000bc10de28ad$export$e417c49320921907);
23
26
  $parcel$export(module.exports, "throw_globally", () => $bdea39a75c454f4f$export$f50b88e2a00918b5);
@@ -95,7 +98,56 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
95
98
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
96
99
  $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
97
100
  /*! Depict.ai search and product listing SDK */
98
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.24";
101
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.26";
102
+ const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
103
+ let $cfcd56242923775d$var$has_ran = false;
104
+ function $cfcd56242923775d$export$5162a71f252e6122() {
105
+ if ($cfcd56242923775d$var$has_ran || typeof history !== "object") return;
106
+ $cfcd56242923775d$var$has_ran = true;
107
+ for (const function_name of ["replaceState", "pushState"]) {
108
+ if (Object.getOwnPropertyNames(history).includes(function_name)) $cfcd56242923775d$var$proxy_push_state(function_name, history);
109
+ $cfcd56242923775d$var$proxy_push_state(function_name, History.prototype);
110
+ }
111
+ }
112
+ function $cfcd56242923775d$var$proxy_push_state(function_name, thing) {
113
+ thing[function_name] = new Proxy(thing[function_name], {
114
+ apply(target, this_arg, arg_list) {
115
+ try {
116
+ const old_state = history.state;
117
+ if (typeof old_state == "object" && old_state !== null) {
118
+ var _arg_list$;
119
+ // This effectively disallows the user from passing in a string, number, null or undefined
120
+ const intended_new_value_as_obj = typeof arg_list[0] === "object" ? (_arg_list$ = arg_list[0]) !== null && _arg_list$ !== void 0 ? _arg_list$ : {} : {};
121
+ const cloned_object = {
122
+ ...intended_new_value_as_obj
123
+ };
124
+ for (const key in old_state) {
125
+ if (!$cfcd56242923775d$var$starts_with_any_prefix(key)) continue;
126
+ if (!(key in cloned_object)) cloned_object[key] = old_state[key];
127
+ }
128
+ arg_list[0] = cloned_object;
129
+ }
130
+ } catch (e) {
131
+ $52FdA$depictaiutilishared.report([e, "Failed to preserve items in history.state"], "error");
132
+ }
133
+ return Reflect.apply(target, this_arg, arg_list);
134
+ }
135
+ });
136
+ }
137
+ function $cfcd56242923775d$var$starts_with_any_prefix(key) {
138
+ for (const prefix of $cfcd56242923775d$export$3064e1e8c6513da3) {
139
+ if (key.startsWith(prefix)) return true;
140
+ }
141
+ }
142
+
143
+ /**
144
+ * This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
145
+ * @param clickEvent The click event that triggered the navigation
146
+ */
147
+ function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
148
+ return (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.button) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.metaKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.ctrlKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.shiftKey // if true, shift button on windows, linux or macOS which opens in a new window
149
+ );
150
+ }
99
151
 
100
152
  /**
101
153
  * Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
@@ -898,7 +950,7 @@ function $ca262da429af47ea$export$a146ac6fa8346a25(_ref) {
898
950
  $52FdA$solidjsweb.use(element => element.addEventListener(
899
951
  // Viskan's Oscar Jacobson site requires us to add the event listener normally here. They do too much when this element is clicked. We work around it by blocking the event and just dispatching it non-bubbling on this element.
900
952
  "click", $52FdA$depictaiutilishared.catchify(ev => {
901
- if (ev.button || ev.metaKey || ev.ctrlKey)
953
+ if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(ev))
902
954
  // not button 0 or cmd/ctrl click
903
955
  return;
904
956
  ev.preventDefault();
@@ -1104,7 +1156,7 @@ function $210882b9ebe2b1d8$export$e872e2339fb04a7f(_ref) {
1104
1156
  $52FdA$solidjsweb.use(element => element.addEventListener("click", $52FdA$depictaiutilishared.catchify(ev => {
1105
1157
  // Viskan's Oscar Jacobson site requires us to add the event listener normally here. They do too much when this element is clicked. We work around it by blocking the event and just dispatching it non-bubbling on this element.
1106
1158
  if (is_query()) {
1107
- if (ev.button || ev.metaKey || ev.ctrlKey)
1159
+ if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(ev))
1108
1160
  // not button 0 or cmd/ctrl click
1109
1161
  return;
1110
1162
  const input = input_obj();
@@ -1320,8 +1372,8 @@ function $210882b9ebe2b1d8$export$e872e2339fb04a7f(_ref) {
1320
1372
  }
1321
1373
  var $1730e5b4d47679a3$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<a target=_blank>`);
1322
1374
  function $1730e5b4d47679a3$export$1efe1013da60d0e4(e, href) {
1323
- if (e.metaKey || e.ctrlKey) {
1324
- // Open link in a new tab with cmd/ctrl + enter.
1375
+ if (e.metaKey || e.ctrlKey || e.shiftKey) {
1376
+ // Open link in a new tab/window with cmd/ctrl + enter.
1325
1377
  const link = (() => {
1326
1378
  var _el$ = $52FdA$solidjsweb.getNextElement($1730e5b4d47679a3$var$_tmpl$);
1327
1379
  $52FdA$solidjsweb.setAttribute(_el$, "href", href);
@@ -3386,7 +3438,7 @@ function $79a8fa74cb5cdfb9$export$d4994a86c6235f72(_ref) {
3386
3438
  });
3387
3439
  return;
3388
3440
  }
3389
- if (ev.button || ev.metaKey || ev.ctrlKey) return; // not button 0 or cmd/ctrl click
3441
+ if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(ev)) return; // not button 0 or cmd/ctrl click
3390
3442
  ev.preventDefault();
3391
3443
  submit_query_(itemContents.title_);
3392
3444
  }));
@@ -4321,46 +4373,6 @@ function $367b536a2a94d24e$var$history_state_change(signals, entries, state) {
4321
4373
  }
4322
4374
  });
4323
4375
  }
4324
- const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
4325
- let $cfcd56242923775d$var$has_ran = false;
4326
- function $cfcd56242923775d$export$5162a71f252e6122() {
4327
- if ($cfcd56242923775d$var$has_ran || typeof history !== "object") return;
4328
- $cfcd56242923775d$var$has_ran = true;
4329
- for (const function_name of ["replaceState", "pushState"]) {
4330
- if (Object.getOwnPropertyNames(history).includes(function_name)) $cfcd56242923775d$var$proxy_push_state(function_name, history);
4331
- $cfcd56242923775d$var$proxy_push_state(function_name, History.prototype);
4332
- }
4333
- }
4334
- function $cfcd56242923775d$var$proxy_push_state(function_name, thing) {
4335
- thing[function_name] = new Proxy(thing[function_name], {
4336
- apply(target, this_arg, arg_list) {
4337
- try {
4338
- const old_state = history.state;
4339
- if (typeof old_state == "object" && old_state !== null) {
4340
- var _arg_list$;
4341
- // This effectively disallows the user from passing in a string, number, null or undefined
4342
- const intended_new_value_as_obj = typeof arg_list[0] === "object" ? (_arg_list$ = arg_list[0]) !== null && _arg_list$ !== void 0 ? _arg_list$ : {} : {};
4343
- const cloned_object = {
4344
- ...intended_new_value_as_obj
4345
- };
4346
- for (const key in old_state) {
4347
- if (!$cfcd56242923775d$var$starts_with_any_prefix(key)) continue;
4348
- if (!(key in cloned_object)) cloned_object[key] = old_state[key];
4349
- }
4350
- arg_list[0] = cloned_object;
4351
- }
4352
- } catch (e) {
4353
- $52FdA$depictaiutilishared.report([e, "Failed to preserve items in history.state"], "error");
4354
- }
4355
- return Reflect.apply(target, this_arg, arg_list);
4356
- }
4357
- });
4358
- }
4359
- function $cfcd56242923775d$var$starts_with_any_prefix(key) {
4360
- for (const prefix of $cfcd56242923775d$export$3064e1e8c6513da3) {
4361
- if (key.startsWith(prefix)) return true;
4362
- }
4363
- }
4364
4376
  function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
4365
4377
  $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
4366
4378
  privateSet.add(obj);
@@ -4373,7 +4385,6 @@ function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn)
4373
4385
  return fn;
4374
4386
  }
4375
4387
  var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
4376
- var $73014ff36186a4dd$var$_dont_attempt_navigation = /*#__PURE__*/new WeakSet();
4377
4388
  var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
4378
4389
  class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
4379
4390
  /**
@@ -4381,14 +4392,11 @@ class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
4381
4392
  */ /**
4382
4393
  * We store listing_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
4383
4394
  */ /**
4384
- * Checks if this tab shouldn't navigate because user wants to open in new tab
4385
- */ /**
4386
- * Vue has async router that needs to be awaited (it navigates after a microtask)
4387
- * This standardises waiting for all kinds of routers
4388
- */
4395
+ * Vue has async router that needs to be awaited (it navigates after a microtask)
4396
+ * This standardises waiting for all kinds of routers
4397
+ */
4389
4398
  constructor(on_navigation, listing_query_state_key) {
4390
4399
  $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
4391
- $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_dont_attempt_navigation);
4392
4400
  $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
4393
4401
  $parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
4394
4402
  $parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
@@ -4420,7 +4428,7 @@ class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
4420
4428
  } = _ref;
4421
4429
  const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
4422
4430
  const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
4423
- if ($73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_dont_attempt_navigation, $73014ff36186a4dd$var$_dont_attempt_navigation2).call(this, event_)) return;
4431
+ if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
4424
4432
  const different_origin = new_url_.origin !== location.origin;
4425
4433
  if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
4426
4434
  if (force_spa_navigation_ && different_origin)
@@ -4468,9 +4476,6 @@ function $73014ff36186a4dd$var$_throwing_on_navigation2() {
4468
4476
  });
4469
4477
  }
4470
4478
  }
4471
- function $73014ff36186a4dd$var$_dont_attempt_navigation2(ev) {
4472
- return (ev === null || ev === void 0 ? void 0 : ev.button) || (ev === null || ev === void 0 ? void 0 : ev.metaKey) || (ev === null || ev === void 0 ? void 0 : ev.ctrlKey);
4473
- }
4474
4479
  function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
4475
4480
  return new Promise(resolve => {
4476
4481
  const handler = what_happened => {
@@ -9799,7 +9804,7 @@ function $c749e60bca5000cb$export$cb5808ba002cdeed(_ref) {
9799
9804
  }) : when_filters_closed_cols;
9800
9805
  });
9801
9806
  }
9802
- function $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_) {
9807
+ function $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_) {
9803
9808
  const size_active = $52FdA$solidjs.createMemo(() => cols_at_size_().map(_ref => {
9804
9809
  let [n_cols, min_width, max_width] = _ref;
9805
9810
  const media_query = $52FdA$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
@@ -9829,7 +9834,7 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
9829
9834
  } = _ref;
9830
9835
  // these are by row
9831
9836
  const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
9832
- const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
9837
+ const n_cols_currently_showing_ = $478e5a09664da64c$export$a79e666719b3647c(cols_at_size_);
9833
9838
  $52FdA$solidjs.createEffect(() => {
9834
9839
  const incoming_value = incoming_content_blocks();
9835
9840
  if (!incoming_value) {
@@ -10830,9 +10835,13 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
10830
10835
  });
10831
10836
  const meta_of_currently_selected_sorting_ = $52FdA$solidjs.createMemo(() => {
10832
10837
  var _available_sortings_, _available_sortings_$, _available_sortings_$2;
10833
- return (_available_sortings_ = available_sortings_()) === null || _available_sortings_ === void 0 ? void 0 : (_available_sortings_$ = _available_sortings_.find) === null || _available_sortings_$ === void 0 ? void 0 : (_available_sortings_$2 = _available_sortings_$.call(_available_sortings_, sorting => {
10834
- var _get_current_sorting_;
10835
- return sorting.field === ((_get_current_sorting_ = get_current_sorting_()) === null || _get_current_sorting_ === void 0 ? void 0 : _get_current_sorting_.field);
10838
+ return (_available_sortings_ = available_sortings_()) === null || _available_sortings_ === void 0 ? void 0 : (_available_sortings_$ = _available_sortings_.find) === null || _available_sortings_$ === void 0 ? void 0 : (_available_sortings_$2 = _available_sortings_$.call(_available_sortings_, _ref2 => {
10839
+ let {
10840
+ field: field,
10841
+ order: order
10842
+ } = _ref2;
10843
+ const current = get_current_sorting_();
10844
+ return (current === null || current === void 0 ? void 0 : current.field) === field && (current === null || current === void 0 ? void 0 : current.order) === order;
10836
10845
  })) === null || _available_sortings_$2 === void 0 ? void 0 : _available_sortings_$2.meta;
10837
10846
  });
10838
10847
  const filter_options = {
@@ -10944,10 +10953,10 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
10944
10953
  }));
10945
10954
  const {
10946
10955
  remove: remove
10947
- } = $52FdA$depictaiutilishared.javascript_media_query("(max-width:651px)", _ref2 => {
10956
+ } = $52FdA$depictaiutilishared.javascript_media_query("(max-width:651px)", _ref3 => {
10948
10957
  let {
10949
10958
  matches: matches
10950
- } = _ref2;
10959
+ } = _ref3;
10951
10960
  return set_is_small(matches);
10952
10961
  });
10953
10962
  cleanup_promise.then(remove);
@@ -10992,7 +11001,7 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
10992
11001
  }
10993
11002
  });
10994
11003
  }
10995
- function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
11004
+ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref4) {
10996
11005
  let {
10997
11006
  i18n_: i18n_,
10998
11007
  search_filters_open_: search_filters_open_,
@@ -11001,7 +11010,7 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
11001
11010
  tabindex_: tabindex_,
11002
11011
  number_of_rendered_selected_filters_items_: [num_selected_filters],
11003
11012
  hide_button_: hide_button_
11004
- } = _ref3;
11013
+ } = _ref4;
11005
11014
  const filters_closed = $52FdA$solidjs.createMemo(() => !search_filters_open_[0]());
11006
11015
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
11007
11016
  return (() => {
@@ -11072,7 +11081,7 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
11072
11081
  return _el$14;
11073
11082
  })();
11074
11083
  }
11075
- function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
11084
+ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref5) {
11076
11085
  let {
11077
11086
  i18n_: i18n_,
11078
11087
  get_current_sorting_: get_current_sorting_,
@@ -11082,7 +11091,7 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
11082
11091
  sort_button_width_: sort_button_width_,
11083
11092
  tabindex_: tabindex_,
11084
11093
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
11085
- } = _ref4;
11094
+ } = _ref5;
11086
11095
  const sorting_closed = $52FdA$solidjs.createMemo(() => !search_sorting_open_[0]());
11087
11096
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
11088
11097
  return (() => {
@@ -11120,8 +11129,8 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
11120
11129
  },
11121
11130
  get children() {
11122
11131
  return $52FdA$solidjsweb.memo(() => {
11123
- var _get_current_sorting_2;
11124
- return ((_get_current_sorting_2 = get_current_sorting_()) === null || _get_current_sorting_2 === void 0 ? void 0 : _get_current_sorting_2.order) === "asc";
11132
+ var _get_current_sorting_;
11133
+ return ((_get_current_sorting_ = get_current_sorting_()) === null || _get_current_sorting_ === void 0 ? void 0 : _get_current_sorting_.order) === "asc";
11125
11134
  })() ? $52FdA$solidjsweb.createComponent((0, $0b45ba458cbff67a$export$da32f7add8a22e86), {}) : $52FdA$solidjsweb.createComponent((0, $549632402b57d811$export$d10e63059ddb9fd4), {});
11126
11135
  }
11127
11136
  }), _el$25, _co$6);
@@ -11474,9 +11483,9 @@ function $21a004c2e7bd4c16$export$466cdc317043f6cb(_ref) {
11474
11483
  var _el$3 = $52FdA$solidjsweb.getNextElement($21a004c2e7bd4c16$var$_tmpl$3);
11475
11484
  $52FdA$solidjsweb.addEventListener(_el$3, "click", $52FdA$depictaiutilishared.catchify(ev => {
11476
11485
  const url = href();
11477
- if (is_selected() && !ev.metaKey && !ev.ctrlKey && !ev.button || !url)
11486
+ if (is_selected() && !$9ca08bcacbc598ce$export$29d28dadc2d6b631(ev) || !url)
11478
11487
  // allow open currently selected one in new tab but otherwise prevent clicks
11479
- ev.preventDefault();else if (href()) router_.navigate_.go_to_({
11488
+ ev.preventDefault();else if (url) router_.navigate_.go_to_({
11480
11489
  new_url_: url,
11481
11490
  is_replace_: false,
11482
11491
  event_: ev,
package/ES10/index.d.ts CHANGED
@@ -10,7 +10,17 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.24";
13
+ export const version = "4.0.26";
14
+ export const prefixes_to_preserve_in_history_dot_state: Set<string>;
15
+ /**
16
+ * Prevent, usually SPAs, from deleting our stuff from history.state when they call history.pushState with a new object they have constructed. This will only run once no matter how often it's called.
17
+ */
18
+ export function preserve_items_in_history_dot_state(): void;
19
+ /**
20
+ * This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
21
+ * @param clickEvent The click event that triggered the navigation
22
+ */
23
+ export function allowNativeNavigation(clickEvent?: MouseEvent): number | boolean | undefined;
14
24
  /**
15
25
  * Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
16
26
  */