@depict-ai/ui 3.0.4 → 3.0.5

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
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
83
83
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
84
84
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
85
85
  /*! Depict.ai search and product listing SDK */
86
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.4";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.5";
87
87
  const $9d19451330d04c3c$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
88
88
  function $9d19451330d04c3c$export$8be2714ec7f169ee() {
89
89
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -1039,27 +1039,31 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
1039
1039
  });
1040
1040
  }
1041
1041
  // source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
1042
+ // deeply diffs two objects
1043
+ // Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
1044
+ // Modified futher to bias towards saying objects are equal non-primitive objects differ
1042
1045
  function $76012c4468a53d1f$var$deep_equal(obj1, obj2) {
1043
- if (obj1 === obj2) return true;
1044
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
1045
- if (obj1.length !== obj2.length) return false;
1046
- return obj1.every((elem, index) => {
1047
- return $76012c4468a53d1f$var$deep_equal(elem, obj2[index]);
1048
- });
1049
- }
1050
- if (typeof obj1 === "object" && typeof obj2 === "object" && obj1 !== null && obj2 !== null) {
1051
- if (Array.isArray(obj1) || Array.isArray(obj2)) return false;
1052
- const keys1 = Object.keys(obj1);
1053
- const keys2 = Object.keys(obj2);
1054
- if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
1055
- for (const key in obj1) {
1056
- if ($76012c4468a53d1f$var$result_ids.includes(key)) continue; // ignore keys changing with every request
1057
- const isEqual = $76012c4468a53d1f$var$deep_equal(obj1[key], obj2[key]);
1058
- if (!isEqual) return false;
1059
- }
1060
- return true;
1046
+ const stack = [[obj1, obj2]];
1047
+ while (stack.length > 0) {
1048
+ const [currentObj1, currentObj2] = stack.pop();
1049
+ if (currentObj1 === currentObj2) continue;
1050
+ if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
1051
+ if (currentObj1.length !== currentObj2.length) return false;
1052
+ for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
1053
+ } else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
1054
+ if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
1055
+ const keys1 = Object.keys(currentObj1);
1056
+ const keys2 = Object.keys(currentObj2);
1057
+ if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
1058
+ for (let key in currentObj1) {
1059
+ if ($76012c4468a53d1f$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
1060
+ stack.push([currentObj1[key], currentObj2[key]]);
1061
+ }
1062
+ } else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
1063
+ // Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
1064
+ return false;
1061
1065
  }
1062
- return false;
1066
+ return true;
1063
1067
  }
1064
1068
  const $6c2c739b113a8ddf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
1065
1069
  $6c2c739b113a8ddf$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type=text/css>`);
@@ -5830,6 +5834,9 @@ function $b3dc12c672c9df24$export$967e966fca9515e(api_response) {
5830
5834
  }
5831
5835
  return api_response;
5832
5836
  }
5837
+
5838
+ // Minifiable and tree-shakable enum
5839
+ // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
5833
5840
  const $c3739e86187f2054$export$74ee7529ce0f8a00 = "listingId";
5834
5841
  const $c3739e86187f2054$export$5aae649db1b959fc = "externalId";
5835
5842
  function $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(obj, privateSet) {
@@ -8663,7 +8670,7 @@ function $8b366fdb0c76194d$var$clear_if_opened_new_tab_with_sideways_url_params_
8663
8670
  });
8664
8671
  tracking_function_for_plp_results(plp_results_);
8665
8672
  }
8666
- const $c3a7faae6f2b93c9$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.`),
8673
+ const $c3a7faae6f2b93c9$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No \`id\` specified in \`listingQuery\`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.`),
8667
8674
  $c3a7faae6f2b93c9$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=buttons><button class="ok major">`);
8668
8675
  function $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8669
8676
  if (!(0, $52FdA$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
@@ -8675,7 +8682,7 @@ function $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8675
8682
  return $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => {
8676
8683
  if (!document.documentElement.contains(element)) return;
8677
8684
  if (!listing_id()) {
8678
- const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.";
8685
+ const warning = "No `id` specified in `listingQuery`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.";
8679
8686
  $52FdA$depictaiutilishared.dwarn(warning);
8680
8687
  const {
8681
8688
  close_toast_: close_toast_
@@ -9514,7 +9521,7 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
9514
9521
  category_title: category_title
9515
9522
  } = props;
9516
9523
  const shared_properties = $9cbefc32b9dab36d$var$get_shared_properties(depict_category);
9517
- const diffableListingQuery = $52FdA$solidjs.createMemo(() => Object.values(depict_category.listing_query).join(""));
9524
+ const diffableListingQuery = $52FdA$solidjs.createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
9518
9525
  return $d05611ff6b8c8357$export$23fca46f3143581f(() => {
9519
9526
  $52FdA$solidjs.createEffect(prev => {
9520
9527
  // this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
@@ -9565,7 +9572,10 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
9565
9572
  min_products_to_fetch_: $9cbefc32b9dab36d$var$min_products_to_fetch_,
9566
9573
  local_filter_cache_: local_filter_cache_,
9567
9574
  id_to_query_for_: $52FdA$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
9568
- id_type_: $52FdA$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $c3739e86187f2054$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
9575
+ id_type_: $52FdA$solidjs.createMemo(() => {
9576
+ if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $c3739e86187f2054$export$74ee7529ce0f8a00;
9577
+ return depict_category.listing_query.type;
9578
+ }),
9569
9579
  i18n_: i18n_,
9570
9580
  show_quicklinks_: $52FdA$solidjs.createMemo(() => {
9571
9581
  var _props$show_quicklink;
package/ES10/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.4";
13
+ export const version = "3.0.5";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.4";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.5";
14
14
  const $ca6ab5f08bd28bca$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
15
15
  function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
16
16
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -966,27 +966,31 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
966
966
  });
967
967
  }
968
968
  // source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
969
+ // deeply diffs two objects
970
+ // Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
971
+ // Modified futher to bias towards saying objects are equal non-primitive objects differ
969
972
  function $2d7bad8684bc7f44$var$deep_equal(obj1, obj2) {
970
- if (obj1 === obj2) return true;
971
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
972
- if (obj1.length !== obj2.length) return false;
973
- return obj1.every((elem, index) => {
974
- return $2d7bad8684bc7f44$var$deep_equal(elem, obj2[index]);
975
- });
976
- }
977
- if (typeof obj1 === "object" && typeof obj2 === "object" && obj1 !== null && obj2 !== null) {
978
- if (Array.isArray(obj1) || Array.isArray(obj2)) return false;
979
- const keys1 = Object.keys(obj1);
980
- const keys2 = Object.keys(obj2);
981
- if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
982
- for (const key in obj1) {
983
- if ($2d7bad8684bc7f44$var$result_ids.includes(key)) continue; // ignore keys changing with every request
984
- const isEqual = $2d7bad8684bc7f44$var$deep_equal(obj1[key], obj2[key]);
985
- if (!isEqual) return false;
986
- }
987
- return true;
973
+ const stack = [[obj1, obj2]];
974
+ while (stack.length > 0) {
975
+ const [currentObj1, currentObj2] = stack.pop();
976
+ if (currentObj1 === currentObj2) continue;
977
+ if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
978
+ if (currentObj1.length !== currentObj2.length) return false;
979
+ for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
980
+ } else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
981
+ if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
982
+ const keys1 = Object.keys(currentObj1);
983
+ const keys2 = Object.keys(currentObj2);
984
+ if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
985
+ for (let key in currentObj1) {
986
+ if ($2d7bad8684bc7f44$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
987
+ stack.push([currentObj1[key], currentObj2[key]]);
988
+ }
989
+ } else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
990
+ // Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
991
+ return false;
988
992
  }
989
- return false;
993
+ return true;
990
994
  }
991
995
  const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div>`),
992
996
  $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type=text/css>`);
@@ -5757,6 +5761,9 @@ function $ed0fefda39a0f15d$export$967e966fca9515e(api_response) {
5757
5761
  }
5758
5762
  return api_response;
5759
5763
  }
5764
+
5765
+ // Minifiable and tree-shakable enum
5766
+ // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
5760
5767
  const $397620a4d7958ed1$export$74ee7529ce0f8a00 = "listingId";
5761
5768
  const $397620a4d7958ed1$export$5aae649db1b959fc = "externalId";
5762
5769
  function $284849364a6ef73a$var$_classPrivateMethodInitSpec(obj, privateSet) {
@@ -8590,7 +8597,7 @@ function $a4777acaffa35a82$var$clear_if_opened_new_tab_with_sideways_url_params_
8590
8597
  });
8591
8598
  tracking_function_for_plp_results(plp_results_);
8592
8599
  }
8593
- const $1145661fd3ca5519$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.`),
8600
+ const $1145661fd3ca5519$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=statement style=white-space:pre-wrap>No \`id\` specified in \`listingQuery\`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.`),
8594
8601
  $1145661fd3ca5519$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=buttons><button class="ok major">`);
8595
8602
  function $1145661fd3ca5519$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8596
8603
  if (!(0, $8tj43$is_debug)) return; // Just to make sure we don't show this in production
@@ -8602,7 +8609,7 @@ function $1145661fd3ca5519$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8602
8609
  return $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => {
8603
8610
  if (!document.documentElement.contains(element)) return;
8604
8611
  if (!listing_id()) {
8605
- const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.";
8612
+ const warning = "No `id` specified in `listingQuery`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.";
8606
8613
  $8tj43$dwarn(warning);
8607
8614
  const {
8608
8615
  close_toast_: close_toast_
@@ -9441,7 +9448,7 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
9441
9448
  category_title: category_title
9442
9449
  } = props;
9443
9450
  const shared_properties = $f5f54892fd0c7d9f$var$get_shared_properties(depict_category);
9444
- const diffableListingQuery = $8tj43$createMemo(() => Object.values(depict_category.listing_query).join(""));
9451
+ const diffableListingQuery = $8tj43$createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
9445
9452
  return $83e8cf2c0b87a58a$export$23fca46f3143581f(() => {
9446
9453
  $8tj43$createEffect(prev => {
9447
9454
  // this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
@@ -9492,7 +9499,10 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
9492
9499
  min_products_to_fetch_: $f5f54892fd0c7d9f$var$min_products_to_fetch_,
9493
9500
  local_filter_cache_: local_filter_cache_,
9494
9501
  id_to_query_for_: $8tj43$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
9495
- id_type_: $8tj43$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $397620a4d7958ed1$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
9502
+ id_type_: $8tj43$createMemo(() => {
9503
+ if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $397620a4d7958ed1$export$74ee7529ce0f8a00;
9504
+ return depict_category.listing_query.type;
9505
+ }),
9496
9506
  i18n_: i18n_,
9497
9507
  show_quicklinks_: $8tj43$createMemo(() => {
9498
9508
  var _props$show_quicklink;
package/latest/index.cjs CHANGED
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
77
77
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
78
78
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
79
79
  /*! Depict.ai search and product listing SDK */
80
- const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.4";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.5";
81
81
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return (() => {
@@ -980,27 +980,31 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
980
980
  });
981
981
  }
982
982
  // source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
983
+ // deeply diffs two objects
984
+ // Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
985
+ // Modified futher to bias towards saying objects are equal non-primitive objects differ
983
986
  function $a73063cc642f3e5f$var$deep_equal(obj1, obj2) {
984
- if (obj1 === obj2) return true;
985
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
986
- if (obj1.length !== obj2.length) return false;
987
- return obj1.every((elem, index) => {
988
- return $a73063cc642f3e5f$var$deep_equal(elem, obj2[index]);
989
- });
990
- }
991
- if (typeof obj1 === "object" && typeof obj2 === "object" && obj1 !== null && obj2 !== null) {
992
- if (Array.isArray(obj1) || Array.isArray(obj2)) return false;
993
- const keys1 = Object.keys(obj1);
994
- const keys2 = Object.keys(obj2);
995
- if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
996
- for (const key in obj1) {
997
- if ($a73063cc642f3e5f$var$result_ids.includes(key)) continue; // ignore keys changing with every request
998
- const isEqual = $a73063cc642f3e5f$var$deep_equal(obj1[key], obj2[key]);
999
- if (!isEqual) return false;
1000
- }
1001
- return true;
987
+ const stack = [[obj1, obj2]];
988
+ while (stack.length > 0) {
989
+ const [currentObj1, currentObj2] = stack.pop();
990
+ if (currentObj1 === currentObj2) continue;
991
+ if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
992
+ if (currentObj1.length !== currentObj2.length) return false;
993
+ for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
994
+ } else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
995
+ if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
996
+ const keys1 = Object.keys(currentObj1);
997
+ const keys2 = Object.keys(currentObj2);
998
+ if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
999
+ for (let key in currentObj1) {
1000
+ if ($a73063cc642f3e5f$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
1001
+ stack.push([currentObj1[key], currentObj2[key]]);
1002
+ }
1003
+ } else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
1004
+ // Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
1005
+ return false;
1002
1006
  }
1003
- return false;
1007
+ return true;
1004
1008
  }
1005
1009
  const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
1006
1010
  $f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type=text/css>`);
@@ -5492,6 +5496,9 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
5492
5496
  }
5493
5497
  return api_response;
5494
5498
  }
5499
+
5500
+ // Minifiable and tree-shakable enum
5501
+ // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
5495
5502
  const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
5496
5503
  const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
5497
5504
  const $e1d6c0f3d89d531c$var$v3_base_url = (0, $gVhhF$depictaiutilishared.base_url) + "/v3/";
@@ -8133,7 +8140,7 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
8133
8140
  });
8134
8141
  tracking_function_for_plp_results(plp_results_);
8135
8142
  }
8136
- const $bb9760b7a8acdc18$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.`),
8143
+ const $bb9760b7a8acdc18$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No \`id\` specified in \`listingQuery\`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.`),
8137
8144
  $bb9760b7a8acdc18$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=buttons><button class="ok major">`);
8138
8145
  function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8139
8146
  if (!(0, $gVhhF$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
@@ -8143,7 +8150,7 @@ function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8143
8150
  }) => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => {
8144
8151
  if (!document.documentElement.contains(element)) return;
8145
8152
  if (!listing_id()) {
8146
- const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.";
8153
+ const warning = "No `id` specified in `listingQuery`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.";
8147
8154
  $gVhhF$depictaiutilishared.dwarn(warning);
8148
8155
  const {
8149
8156
  close_toast_: close_toast_
@@ -8881,7 +8888,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
8881
8888
  category_title: category_title
8882
8889
  } = props;
8883
8890
  const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
8884
- const diffableListingQuery = $gVhhF$solidjs.createMemo(() => Object.values(depict_category.listing_query).join(""));
8891
+ const diffableListingQuery = $gVhhF$solidjs.createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
8885
8892
  return $95837413165cc2df$export$23fca46f3143581f(() => {
8886
8893
  $gVhhF$solidjs.createEffect(prev => {
8887
8894
  // this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
@@ -8932,7 +8939,10 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
8932
8939
  min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
8933
8940
  local_filter_cache_: local_filter_cache_,
8934
8941
  id_to_query_for_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
8935
- id_type_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $779741d0f266ea8c$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
8942
+ id_type_: $gVhhF$solidjs.createMemo(() => {
8943
+ if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $779741d0f266ea8c$export$74ee7529ce0f8a00;
8944
+ return depict_category.listing_query.type;
8945
+ }),
8936
8946
  i18n_: i18n_,
8937
8947
  show_quicklinks_: $gVhhF$solidjs.createMemo(() => props.show_quicklinks ?? true),
8938
8948
  category_title_: category_title,
package/latest/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.4";
13
+ export const version = "3.0.5";
14
14
  export type SDKColsAtSize = [number, number?][];
15
15
  /**
16
16
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.4";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.5";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return (() => {
@@ -910,27 +910,31 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
910
910
  });
911
911
  }
912
912
  // source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
913
+ // deeply diffs two objects
914
+ // Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
915
+ // Modified futher to bias towards saying objects are equal non-primitive objects differ
913
916
  function $29ec7cddbe1d3484$var$deep_equal(obj1, obj2) {
914
- if (obj1 === obj2) return true;
915
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
916
- if (obj1.length !== obj2.length) return false;
917
- return obj1.every((elem, index) => {
918
- return $29ec7cddbe1d3484$var$deep_equal(elem, obj2[index]);
919
- });
920
- }
921
- if (typeof obj1 === "object" && typeof obj2 === "object" && obj1 !== null && obj2 !== null) {
922
- if (Array.isArray(obj1) || Array.isArray(obj2)) return false;
923
- const keys1 = Object.keys(obj1);
924
- const keys2 = Object.keys(obj2);
925
- if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
926
- for (const key in obj1) {
927
- if ($29ec7cddbe1d3484$var$result_ids.includes(key)) continue; // ignore keys changing with every request
928
- const isEqual = $29ec7cddbe1d3484$var$deep_equal(obj1[key], obj2[key]);
929
- if (!isEqual) return false;
930
- }
931
- return true;
917
+ const stack = [[obj1, obj2]];
918
+ while (stack.length > 0) {
919
+ const [currentObj1, currentObj2] = stack.pop();
920
+ if (currentObj1 === currentObj2) continue;
921
+ if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
922
+ if (currentObj1.length !== currentObj2.length) return false;
923
+ for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
924
+ } else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
925
+ if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
926
+ const keys1 = Object.keys(currentObj1);
927
+ const keys2 = Object.keys(currentObj2);
928
+ if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
929
+ for (let key in currentObj1) {
930
+ if ($29ec7cddbe1d3484$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
931
+ stack.push([currentObj1[key], currentObj2[key]]);
932
+ }
933
+ } else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
934
+ // Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
935
+ return false;
932
936
  }
933
- return false;
937
+ return true;
934
938
  }
935
939
  const $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div>`),
936
940
  $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type=text/css>`);
@@ -5422,6 +5426,9 @@ function $e5014ccd0b76d9f4$export$967e966fca9515e(api_response) {
5422
5426
  }
5423
5427
  return api_response;
5424
5428
  }
5429
+
5430
+ // Minifiable and tree-shakable enum
5431
+ // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
5425
5432
  const $c20599a0d81d953a$export$74ee7529ce0f8a00 = "listingId";
5426
5433
  const $c20599a0d81d953a$export$5aae649db1b959fc = "externalId";
5427
5434
  const $7fa23e2a0079eca4$var$v3_base_url = (0, $9HbP8$base_url) + "/v3/";
@@ -8063,7 +8070,7 @@ function $e7fce80abe608e01$var$clear_if_opened_new_tab_with_sideways_url_params_
8063
8070
  });
8064
8071
  tracking_function_for_plp_results(plp_results_);
8065
8072
  }
8066
- const $cc6f5b69378cd164$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.`),
8073
+ const $cc6f5b69378cd164$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=statement style=white-space:pre-wrap>No \`id\` specified in \`listingQuery\`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.`),
8067
8074
  $cc6f5b69378cd164$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class=buttons><button class="ok major">`);
8068
8075
  function $cc6f5b69378cd164$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8069
8076
  if (!(0, $9HbP8$is_debug)) return; // Just to make sure we don't show this in production
@@ -8073,7 +8080,7 @@ function $cc6f5b69378cd164$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8073
8080
  }) => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => {
8074
8081
  if (!document.documentElement.contains(element)) return;
8075
8082
  if (!listing_id()) {
8076
- const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.";
8083
+ const warning = "No `id` specified in `listingQuery`, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingQuery.";
8077
8084
  $9HbP8$dwarn(warning);
8078
8085
  const {
8079
8086
  close_toast_: close_toast_
@@ -8811,7 +8818,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
8811
8818
  category_title: category_title
8812
8819
  } = props;
8813
8820
  const shared_properties = $961b5c64bef4662f$var$get_shared_properties(depict_category);
8814
- const diffableListingQuery = $9HbP8$createMemo(() => Object.values(depict_category.listing_query).join(""));
8821
+ const diffableListingQuery = $9HbP8$createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
8815
8822
  return $16b52438165aafe2$export$23fca46f3143581f(() => {
8816
8823
  $9HbP8$createEffect(prev => {
8817
8824
  // this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
@@ -8862,7 +8869,10 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
8862
8869
  min_products_to_fetch_: $961b5c64bef4662f$var$min_products_to_fetch_,
8863
8870
  local_filter_cache_: local_filter_cache_,
8864
8871
  id_to_query_for_: $9HbP8$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
8865
- id_type_: $9HbP8$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $c20599a0d81d953a$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
8872
+ id_type_: $9HbP8$createMemo(() => {
8873
+ if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $c20599a0d81d953a$export$74ee7529ce0f8a00;
8874
+ return depict_category.listing_query.type;
8875
+ }),
8866
8876
  i18n_: i18n_,
8867
8877
  show_quicklinks_: $9HbP8$createMemo(() => props.show_quicklinks ?? true),
8868
8878
  category_title_: category_title,