@depict-ai/utilishared 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference path="../jsx.d.ts" />
2
- /// <reference path="../jsx.d.ts" />
3
2
  import { EUnavailabilityType } from "@depict-ai/types/api/TrackV2Request";
4
3
  /**
5
4
  * @deprecated this was a stupid idea, it's much easier to read if one just does a quick arrow function that provides the wanted arguments
@@ -1292,7 +1291,6 @@ export interface Pro_Slider_Options {
1292
1291
  * @deprecated please use RecommendationSlider instead
1293
1292
  */
1294
1293
  export function Pro_Slider(t: Tenant, rendering_options: Extended_RR_Options, options_for_us?: Pro_Slider_Options, slider_options?: Slider_Options): ReturnType<typeof Rec_Renderer>;
1295
- export const wpff: (dlog: any, error_log?: any[] | undefined) => (url: RequestInfo, body: BodyInit, headers?: HeadersInit | undefined, decode_json?: boolean | undefined, fetch_options?: RequestInit | undefined, attempt?: number | undefined) => any;
1296
1294
  /**
1297
1295
  * @deprecated Please use recommendation renderer instead
1298
1296
  */
@@ -1321,7 +1319,6 @@ interface TemplateToolOptions {
1321
1319
  min_items?: number;
1322
1320
  DNT?: boolean;
1323
1321
  debug?: boolean;
1324
- waitForSelectors?: string[];
1325
1322
  type?: string;
1326
1323
  product_id?: Function | ((url?: string) => string);
1327
1324
  sendGa?: boolean;
@@ -1395,6 +1392,7 @@ chunk_size_for_load_more, insertion_promise, }: {
1395
1392
  }): Promise<ChildNode[] | void>;
1396
1393
  export function default_pre_processor(_t: any, d: any, i: number, with_loadmore: boolean, with_slider: boolean, infinite_scroll: boolean): any;
1397
1394
  export function default_post_processor(_t: any, itms: HTMLCollection, d: any, slider: Deprecated_Amazing_Slider | null): HTMLCollection;
1395
+ export const wpff: (dlog: any, error_log?: any[] | undefined) => (url: RequestInfo, body: BodyInit, headers?: HeadersInit | undefined, decode_json?: boolean | undefined, fetch_options?: RequestInit | undefined, attempt?: number | undefined) => any;
1398
1396
  export const use_element: <E extends HTMLOrSVGElement = HTMLElement>(callback: (element: E) => void, element: E) => E;
1399
1397
  export const use_listener: <E extends HTMLElement = HTMLElement>(event: string, handler: EventListener, element: E) => E;
1400
1398
  export const classlist: (classes: (string | undefined)[]) => string;
package/dist/main.js CHANGED
@@ -3491,7 +3491,7 @@ async function $e5479d0db39d328b$export$c83d8da642b5104a(t, options, GWVM_opts)
3491
3491
  return rendering_results;
3492
3492
  }
3493
3493
  root.append(...rendered_elements);
3494
- const load_more_cont = (0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<div class="load_more_container"></div>`);
3494
+ const load_more_cont = (0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<div class="load-more-container"></div>`);
3495
3495
  const button_element = button instanceof Element ? button : (0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<button class="load_more">${button || "Visa mer"}</button>`);
3496
3496
  button_element.addEventListener("click", load_more);
3497
3497
  load_more_cont.append(button_element);
@@ -4183,7 +4183,7 @@ class $1da560af170fb839$export$3be7054c61590ee3 {
4183
4183
  constructor({ container: container , lazyfinder: lazyfinder , selector: selector = [
4184
4184
  `img`,
4185
4185
  `source`
4186
- ].map((t)=>`:not(.d_navbutton) > ${t}:not(.filler):not(.nolazy)`).join(", ") , wait_for_dominsertion: wait_for_dominsertion = true , only_load_intersecting: only_load_intersecting = false , ignore_data_urls: ignore_data_urls = false , verbose: verbose }){
4186
+ ].map((t)=>`:not(.d-navbutton) > ${t}:not(.filler):not(.nolazy)`).join(", ") , wait_for_dominsertion: wait_for_dominsertion = true , only_load_intersecting: only_load_intersecting = false , ignore_data_urls: ignore_data_urls = false , verbose: verbose }){
4187
4187
  // store options in class so class instances can be looked at and their options are transparent
4188
4188
  this.container = container;
4189
4189
  this.selector = selector;
@@ -4298,7 +4298,7 @@ const $107a74aa4ea5902d$export$ffb0004e005737fa = ({ children: children }, _unk
4298
4298
  class $1683d0164abd7c1d$export$692b27c28639e5b9 {
4299
4299
  // this is just here because it's often needed together with the slider
4300
4300
  container = (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
4301
- class: "depict_slider depict"
4301
+ class: "depict-slider depict"
4302
4302
  });
4303
4303
  #elements = {
4304
4304
  sliding_el_: (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
@@ -4306,12 +4306,12 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
4306
4306
  }),
4307
4307
  left_: (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("button", {
4308
4308
  "aria-label": "Scroll left",
4309
- class: "left d_navbutton",
4309
+ class: "left d-navbutton",
4310
4310
  type: "button"
4311
4311
  }),
4312
4312
  right_: (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("button", {
4313
4313
  "aria-label": "Scroll right",
4314
- class: "right d_navbutton",
4314
+ class: "right d-navbutton",
4315
4315
  type: "button"
4316
4316
  })
4317
4317
  };
@@ -4974,77 +4974,12 @@ $parcel$export($0b6a8303b64cced1$exports, "Depict", () => $0b6a8303b64cced1$expo
4974
4974
 
4975
4975
 
4976
4976
 
4977
-
4978
-
4979
-
4980
-
4981
- var /**
4982
- * @deprecated please use `fetch_retry()` instead
4983
- *
4984
- * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
4985
- * (Note: this thing really should be rewritten with exponential backoff and a better API)
4986
- * @param dlog logging function to use
4987
- * @param error_log an array to which errors will be pushed
4988
- * @return a windows proof fetch function
4989
- */ $c413c7798924612a$export$2e2bcd8739ae039 = (dlog, error_log)=>{
4990
- // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
4991
- // https://stackoverflow.com/a/52947884
4992
- const windows_proof_fetch = async function(url, body, headers, decode_json, fetch_options, attempt) {
4993
- attempt ||= 1;
4994
- decode_json ??= true;
4995
- const { stack: stack } = new Error();
4996
- const elog = (...args)=>{
4997
- if (Array.isArray(error_log)) error_log.push(args);
4998
- return dlog(...args);
4999
- };
5000
- return await fetch(url, {
5001
- ...body ? {
5002
- body: body
5003
- } : {},
5004
- "method": "POST",
5005
- ...fetch_options ? fetch_options : {},
5006
- ...headers ? {
5007
- headers: headers
5008
- } : {}
5009
- }).then(async (response)=>{
5010
- if (!response || !response.ok || response.status !== 200) {
5011
- if (response.status === 422) (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($c413c7798924612a$var$send_sentry_422)(response, body, stack);
5012
- elog("Response not ok", response);
5013
- return false;
5014
- } else return await response[decode_json ? "json" : "text"]().catch((e)=>elog("error while decoding json", e));
5015
- }).catch((e)=>{
5016
- elog("Error while fetching", e, url, body);
5017
- if ((e.name == "TypeError" || e.message == "Failed to fetch" || e.message == "Network request failed") && !e.message.includes("CORS") && !e.name.includes("CORS") && ++attempt < 10) return windows_proof_fetch(url, body, headers, decode_json, fetch_options, attempt);
5018
- return false;
5019
- });
5020
- };
5021
- return windows_proof_fetch;
5022
- };
5023
- async function $c413c7798924612a$var$send_sentry_422(response, body, stack) {
5024
- const msg = `Validation error: got 422 from API`;
5025
- const text = await response.text();
5026
- (0, $e6c6e7929ea385ae$export$de56f1198d121036)(msg, "body", body, "response", response, "text", text, "stack", stack);
5027
- (0, $61a34358bf0d3d8b$export$af2e17a20c2ea3c5).withScope(function(scope) {
5028
- scope.setExtra("stack", stack);
5029
- scope.setExtra("request_body", body);
5030
- scope.setExtra("response", response);
5031
- scope.setExtra("serialized_response", (0, $45e05ec4fd7f1ee7$export$39d526a1194b6499)(response));
5032
- scope.setExtra("response_text", text);
5033
- scope.setLevel("error");
5034
- this.captureException(new Error(msg));
5035
- });
5036
- }
5037
-
5038
-
5039
4977
  const $0b6a8303b64cced1$var$discountMatcher = /{DISCOUNT{([\s\S]+?)}}/g;
5040
4978
  const $0b6a8303b64cced1$var$noDiscountMatcher = /{NODISCOUNT{([\s\S]+?)}}/g;
5041
- const $0b6a8303b64cced1$var$APICreateEvent = (0, $4c6861fbcd3a0611$export$362abebb4b313340) + "/create-events";
5042
- const $0b6a8303b64cced1$var$APIRecommend = (0, $4c6861fbcd3a0611$export$362abebb4b313340) + "/recommend";
5043
- let $0b6a8303b64cced1$var$pageview_sent = false, $0b6a8303b64cced1$var$windows_proof_fetch;
4979
+ let $0b6a8303b64cced1$var$pageview_sent = false;
5044
4980
  class $0b6a8303b64cced1$export$1a8782481a9af507 {
5045
4981
  constructor(settings){
5046
4982
  this.settings = settings;
5047
- $0b6a8303b64cced1$var$windows_proof_fetch = (0, $c413c7798924612a$export$2e2bcd8739ae039)(settings.debug ? console.log.bind(console) : ()=>{});
5048
4983
  }
5049
4984
  #dispatched_recs_inserted = false;
5050
4985
  init(callback, existingDisplays) {
@@ -5056,17 +4991,16 @@ class $0b6a8303b64cced1$export$1a8782481a9af507 {
5056
4991
  }
5057
4992
  }
5058
4993
  loadRecommendations(callback) {
5059
- const { tenant: tenant , product_id: product_id , market: market , type: type , gaid: gaid } = this.settings;
5060
- $0b6a8303b64cced1$var$windows_proof_fetch($0b6a8303b64cced1$var$APIRecommend, JSON.stringify({
4994
+ const { tenant: tenant , product_id: product_id , type: type , market: market } = this.settings;
4995
+ (0, $94edfb6d9c42a288$export$1bc0df10745d5412)(// @ts-ignore - Quick workaround, as we don't have a tenant object here
4996
+ {
5061
4997
  tenant: tenant,
5062
- market: market,
5063
- product_id: product_id(),
5064
- dsid: (0, $e0a87646d12cb987$export$6399bdb2291895e0)(),
5065
- user_id: (0, $e0a87646d12cb987$export$6399bdb2291895e0)(),
5066
- type: type
5067
- })).then((data)=>{
5068
- this.data = data?.displays;
5069
- if (!this.data) this.data = [];
4998
+ market: market
4999
+ }, {
5000
+ type: type,
5001
+ product_id: product_id()
5002
+ }).then((recs)=>{
5003
+ this.data = recs;
5070
5004
  (0, $eee5951374097b61$export$8582cf3716962dc2)({
5071
5005
  ...this.settings,
5072
5006
  recs: this.data,
@@ -5074,25 +5008,7 @@ class $0b6a8303b64cced1$export$1a8782481a9af507 {
5074
5008
  });
5075
5009
  }).catch((e)=>{
5076
5010
  if (this.settings.debug) console.warn("template-tool: error fetching: ", e);
5077
- this.data = [];
5078
- }).finally(()=>{
5079
- if (this.settings.waitForSelectors !== undefined) {
5080
- const SLEEP_TIME_MS = 50;
5081
- let MAX_RETRY = Math.round(10000 / SLEEP_TIME_MS);
5082
- const tick = setInterval(()=>{
5083
- let allLoaded = true;
5084
- for (const selector of this.settings.waitForSelectors)if (document.querySelector(selector) == null) {
5085
- allLoaded = false;
5086
- break;
5087
- }
5088
- if (MAX_RETRY === 0 || allLoaded) {
5089
- clearInterval(tick);
5090
- callback();
5091
- }
5092
- MAX_RETRY--;
5093
- }, SLEEP_TIME_MS);
5094
- } else callback();
5095
- });
5011
+ }).finally(()=>callback());
5096
5012
  }
5097
5013
  trackGAEvent(action, index, product_id, ga_product_ids) {
5098
5014
  if (this.settings.sendGa === false) return;
@@ -5291,7 +5207,7 @@ $parcel$export($e090b20cef3f0516$exports, "Deprecated_Amazing_Slider", () => $e0
5291
5207
  $parcel$export($e090b20cef3f0516$exports, "insert_styling_into_slider", () => $e090b20cef3f0516$export$f1b8b9fd75ddcab1);
5292
5208
  // @ts-ignore
5293
5209
  var $7a8d2de82c53f514$exports = {};
5294
- $7a8d2de82c53f514$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict_slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict_slider {\n width: 100%;\n position: relative;\n}\n\n.depict_slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict_slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict_slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict_slider button.right {\n right: 0;\n}\n\n.depict_slider button.left, .depict_slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict_slider button.left.hidden, .depict_slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict_slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict_slider button.left img, .depict_slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict_slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
5210
+ $7a8d2de82c53f514$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict-slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict-slider button.right {\n right: 0;\n}\n\n.depict-slider button.left, .depict-slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict-slider button.left.hidden, .depict-slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict-slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict-slider button.left img, .depict-slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict-slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
5295
5211
 
5296
5212
 
5297
5213
 
@@ -5518,7 +5434,7 @@ function $765ddca135d7ab33$var$load_more_elements(root, chunk_size = 4) {
5518
5434
  return has_more;
5519
5435
  }
5520
5436
  function $765ddca135d7ab33$var$setup_load_more(t, root, chunk_size) {
5521
- const { catchify: catchify } = t, load_more_cont = (0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<div class="load_more_container"></div>`), load_button = load_more_cont.appendChild((0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<button class="load_more">Visa mer</button>`));
5437
+ const { catchify: catchify } = t, load_more_cont = (0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<div class="load-more-container"></div>`), load_button = load_more_cont.appendChild((0, $bf7f12fe044e41b2$export$d3e2a0560cbf4787)(`<button class="load_more">Visa mer</button>`));
5522
5438
  load_button.addEventListener("click", catchify(load_more_recs_and_hide_button_if_needed));
5523
5439
  root.after(load_more_cont);
5524
5440
  load_more_recs_and_hide_button_if_needed();
@@ -5554,6 +5470,67 @@ function $765ddca135d7ab33$export$c410ce1205e5118a(_t, itms, d, slider) {
5554
5470
 
5555
5471
 
5556
5472
 
5473
+ var /**
5474
+ * @deprecated please use `fetch_retry()` instead
5475
+ *
5476
+ * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
5477
+ * (Note: this thing really should be rewritten with exponential backoff and a better API)
5478
+ * @param dlog logging function to use
5479
+ * @param error_log an array to which errors will be pushed
5480
+ * @return a windows proof fetch function
5481
+ */ $c413c7798924612a$export$2e2bcd8739ae039 = (dlog, error_log)=>{
5482
+ // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
5483
+ // https://stackoverflow.com/a/52947884
5484
+ const windows_proof_fetch = async function(url, body, headers, decode_json, fetch_options, attempt) {
5485
+ attempt ||= 1;
5486
+ decode_json ??= true;
5487
+ const { stack: stack } = new Error();
5488
+ const elog = (...args)=>{
5489
+ if (Array.isArray(error_log)) error_log.push(args);
5490
+ return dlog(...args);
5491
+ };
5492
+ return await fetch(url, {
5493
+ ...body ? {
5494
+ body: body
5495
+ } : {},
5496
+ "method": "POST",
5497
+ ...fetch_options ? fetch_options : {},
5498
+ ...headers ? {
5499
+ headers: headers
5500
+ } : {}
5501
+ }).then(async (response)=>{
5502
+ if (!response || !response.ok || response.status !== 200) {
5503
+ if (response.status === 422) (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($c413c7798924612a$var$send_sentry_422)(response, body, stack);
5504
+ elog("Response not ok", response);
5505
+ return false;
5506
+ } else return await response[decode_json ? "json" : "text"]().catch((e)=>elog("error while decoding json", e));
5507
+ }).catch((e)=>{
5508
+ elog("Error while fetching", e, url, body);
5509
+ if ((e.name == "TypeError" || e.message == "Failed to fetch" || e.message == "Network request failed") && !e.message.includes("CORS") && !e.name.includes("CORS") && ++attempt < 10) return windows_proof_fetch(url, body, headers, decode_json, fetch_options, attempt);
5510
+ return false;
5511
+ });
5512
+ };
5513
+ return windows_proof_fetch;
5514
+ };
5515
+ async function $c413c7798924612a$var$send_sentry_422(response, body, stack) {
5516
+ const msg = `Validation error: got 422 from API`;
5517
+ const text = await response.text();
5518
+ (0, $e6c6e7929ea385ae$export$de56f1198d121036)(msg, "body", body, "response", response, "text", text, "stack", stack);
5519
+ (0, $61a34358bf0d3d8b$export$af2e17a20c2ea3c5).withScope(function(scope) {
5520
+ scope.setExtra("stack", stack);
5521
+ scope.setExtra("request_body", body);
5522
+ scope.setExtra("response", response);
5523
+ scope.setExtra("serialized_response", (0, $45e05ec4fd7f1ee7$export$39d526a1194b6499)(response));
5524
+ scope.setExtra("response_text", text);
5525
+ scope.setLevel("error");
5526
+ this.captureException(new Error(msg));
5527
+ });
5528
+ }
5529
+
5530
+
5531
+
5532
+
5533
+
5557
5534
 
5558
5535
 
5559
5536
 
@@ -5696,7 +5673,7 @@ async function $1cc2444a0f1b992e$export$c84671f46d6a1ca({ rows: rows , container
5696
5673
  if (button) {
5697
5674
  button_class = (0, $650b64c1b384c895$export$a6db784f019668ba)();
5698
5675
  const button_container = (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
5699
- class: "load_more_container " + button_class,
5676
+ class: "load-more-container " + button_class,
5700
5677
  children: (0, $90e0b983530610e7$export$f63fcc839cb0f734)("click", ()=>ipns(ipns.state + (rows_or_empty_object.rows_per_click ?? 1)), button)
5701
5678
  });
5702
5679
  container_element.after(button_container);
@@ -5926,7 +5903,7 @@ var $79804e8d76404ae4$exports = {};
5926
5903
  $parcel$export($79804e8d76404ae4$exports, "RecommendationSlider", () => $79804e8d76404ae4$export$82cfdc85a4d15688);
5927
5904
  // @ts-ignore
5928
5905
  var $98b42e2bc60f50eb$exports = {};
5929
- $98b42e2bc60f50eb$exports = ".depict_slider {\n width: 100%;\n position: relative;\n}\n\n.depict_slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict_slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict_slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
5906
+ $98b42e2bc60f50eb$exports = ".depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
5930
5907
 
5931
5908
 
5932
5909
 
@@ -8195,7 +8172,7 @@ function $dba3e72fb3e5c53d$export$4a3043e508dd72f0({ children: children , ...att
8195
8172
  type: "button",
8196
8173
  children: children
8197
8174
  });
8198
- button.classList.add("show_more");
8175
+ button.classList.add("show-more");
8199
8176
  return button;
8200
8177
  }
8201
8178
 
@@ -8644,7 +8621,7 @@ var $a312bccd722ac9e4$exports = {};
8644
8621
 
8645
8622
  $parcel$export($a312bccd722ac9e4$exports, "ContainedImage", () => $a312bccd722ac9e4$export$788756b42446dc2d);
8646
8623
  var $ff8966e9502eb828$exports = {};
8647
- $ff8966e9502eb828$exports = ".depict_img_cont {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.depict_img_filler {\n width: 100%;\n height: auto;\n display: inline-block;\n}\n\n.depict_img_comp {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.depict_img_mod {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: absolute;\n inset: 0;\n}\n\n";
8624
+ $ff8966e9502eb828$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.depict-img-filler {\n width: 100%;\n height: auto;\n display: inline-block;\n}\n\n.depict-img-comp {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.depict-img-mod {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: absolute;\n inset: 0;\n}\n\n";
8648
8625
 
8649
8626
 
8650
8627
  var $ff973b2032639b5f$exports = {};
@@ -8834,7 +8811,7 @@ function $a312bccd722ac9e4$var$Image({ aspect_ratio: aspect_ratio , alt: alt , r
8834
8811
  } : {},
8835
8812
  ...image_options,
8836
8813
  class: (0, $90e0b983530610e7$export$22a65337c1b43b1f)([
8837
- "depict_img_mod ",
8814
+ "depict-img-mod ",
8838
8815
  image_options.class,
8839
8816
  $a312bccd722ac9e4$var$add_nolazy_to_placeholder(rendering_options?.type)
8840
8817
  ])
@@ -8843,7 +8820,7 @@ function $a312bccd722ac9e4$var$Image({ aspect_ratio: aspect_ratio , alt: alt , r
8843
8820
  }
8844
8821
  function $a312bccd722ac9e4$var$CompatibleImage({ aspect_ratio: aspect_ratio , alt: alt , remove_on_error: remove_on_error , rendering_options: rendering_options , srcset_opts: srcset_opts , ...image_options }) {
8845
8822
  const canvas = (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("canvas", {
8846
- class: "depict_img_filler",
8823
+ class: "depict-img-filler",
8847
8824
  width: 3000 * aspect_ratio,
8848
8825
  height: 3000
8849
8826
  });
@@ -8853,7 +8830,7 @@ function $a312bccd722ac9e4$var$CompatibleImage({ aspect_ratio: aspect_ratio , al
8853
8830
  style: "position:relative",
8854
8831
  children: [
8855
8832
  (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
8856
- class: "depict_img_cont",
8833
+ class: "depict-img-cont",
8857
8834
  children: (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)(IMG_tag, {
8858
8835
  alt: alt,
8859
8836
  ...remove_on_error ? {
@@ -8861,7 +8838,7 @@ function $a312bccd722ac9e4$var$CompatibleImage({ aspect_ratio: aspect_ratio , al
8861
8838
  } : {},
8862
8839
  ...image_options,
8863
8840
  class: (0, $90e0b983530610e7$export$22a65337c1b43b1f)([
8864
- "depict_img_comp",
8841
+ "depict-img-comp",
8865
8842
  image_options.class,
8866
8843
  $a312bccd722ac9e4$var$add_nolazy_to_placeholder(rendering_options?.type)
8867
8844
  ])
@@ -8889,7 +8866,7 @@ function $a312bccd722ac9e4$var$srcset_comp_from_map_or_new(rendering_options, sr
8889
8866
 
8890
8867
 
8891
8868
  var $9e51291371c564f0$exports = {};
8892
- $9e51291371c564f0$exports = ".depict .images_container {\n position: relative;\n}\n\n.depict .second_image_container {\n width: 100%;\n opacity: 0;\n position: absolute;\n top: 0;\n}\n\n.depict .hovering .main_image_container {\n opacity: 0;\n}\n\n.depict .hovering .second_image_container {\n opacity: 1;\n}\n\n";
8869
+ $9e51291371c564f0$exports = ".depict .images-container {\n position: relative;\n}\n\n.depict .second-image-container {\n width: 100%;\n opacity: 0;\n position: absolute;\n top: 0;\n}\n\n.depict .hovering .main-image-container {\n opacity: 0;\n}\n\n.depict .hovering .second-image-container {\n opacity: 1;\n}\n\n";
8893
8870
 
8894
8871
 
8895
8872
 
@@ -8905,8 +8882,8 @@ const $a656daa2fa8c279a$var$TOUCHCANCEL = "touchcancel";
8905
8882
  const $a656daa2fa8c279a$var$MOUSEOVER = "mouseover";
8906
8883
  const $a656daa2fa8c279a$var$MOUSELEAVE = "mouseleave";
8907
8884
  const $a656daa2fa8c279a$var$HOVER_CLASS = "hovering";
8908
- /** This number represents how many elements are in front of div.images_container
8909
- * Here are the elements: img.depict_img_mod, div, img.depict_img_mod, div, div.second_image_container, div.main_image_container, div.images_container
8885
+ /** This number represents how many elements are in front of div.images-container
8886
+ * Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
8910
8887
  * This number is not very dynamic but much more performant than iterating
8911
8888
  */ const $a656daa2fa8c279a$var$HOVER_IMAGE_DEPTH = 7;
8912
8889
  const $a656daa2fa8c279a$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
@@ -9010,14 +8987,14 @@ const $a656daa2fa8c279a$export$2369f6fc1c911576 = ({ second_src: second_src , se
9010
8987
  });
9011
8988
  const no_second_img = !second_src && !second_srcset && !second_srcset_opts;
9012
8989
  const images_container = (0, $107a74aa4ea5902d$export$25062201e9e25d76)("div", {
9013
- class: "images_container",
8990
+ class: "images-container",
9014
8991
  children: [
9015
8992
  !no_second_img && (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
9016
- class: "second_image_container",
8993
+ class: "second-image-container",
9017
8994
  children: second_image
9018
8995
  }),
9019
8996
  (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("div", {
9020
- class: "main_image_container",
8997
+ class: "main-image-container",
9021
8998
  children: main_image
9022
8999
  })
9023
9000
  ]
package/dist/module.js CHANGED
@@ -3471,7 +3471,7 @@ async function $f1396aa84761fbe5$export$c83d8da642b5104a(t, options, GWVM_opts)
3471
3471
  return rendering_results;
3472
3472
  }
3473
3473
  root.append(...rendered_elements);
3474
- const load_more_cont = (0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<div class="load_more_container"></div>`);
3474
+ const load_more_cont = (0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<div class="load-more-container"></div>`);
3475
3475
  const button_element = button instanceof Element ? button : (0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<button class="load_more">${button || "Visa mer"}</button>`);
3476
3476
  button_element.addEventListener("click", load_more);
3477
3477
  load_more_cont.append(button_element);
@@ -4163,7 +4163,7 @@ class $b83068cbd26dcc41$export$3be7054c61590ee3 {
4163
4163
  constructor({ container: container , lazyfinder: lazyfinder , selector: selector = [
4164
4164
  `img`,
4165
4165
  `source`
4166
- ].map((t)=>`:not(.d_navbutton) > ${t}:not(.filler):not(.nolazy)`).join(", ") , wait_for_dominsertion: wait_for_dominsertion = true , only_load_intersecting: only_load_intersecting = false , ignore_data_urls: ignore_data_urls = false , verbose: verbose }){
4166
+ ].map((t)=>`:not(.d-navbutton) > ${t}:not(.filler):not(.nolazy)`).join(", ") , wait_for_dominsertion: wait_for_dominsertion = true , only_load_intersecting: only_load_intersecting = false , ignore_data_urls: ignore_data_urls = false , verbose: verbose }){
4167
4167
  // store options in class so class instances can be looked at and their options are transparent
4168
4168
  this.container = container;
4169
4169
  this.selector = selector;
@@ -4278,7 +4278,7 @@ const $63cbb5de51d11596$export$ffb0004e005737fa = ({ children: children }, _unk
4278
4278
  class $ef9394fafebd5eab$export$692b27c28639e5b9 {
4279
4279
  // this is just here because it's often needed together with the slider
4280
4280
  container = (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
4281
- class: "depict_slider depict"
4281
+ class: "depict-slider depict"
4282
4282
  });
4283
4283
  #elements = {
4284
4284
  sliding_el_: (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
@@ -4286,12 +4286,12 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
4286
4286
  }),
4287
4287
  left_: (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("button", {
4288
4288
  "aria-label": "Scroll left",
4289
- class: "left d_navbutton",
4289
+ class: "left d-navbutton",
4290
4290
  type: "button"
4291
4291
  }),
4292
4292
  right_: (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("button", {
4293
4293
  "aria-label": "Scroll right",
4294
- class: "right d_navbutton",
4294
+ class: "right d-navbutton",
4295
4295
  type: "button"
4296
4296
  })
4297
4297
  };
@@ -4954,77 +4954,12 @@ $parcel$export($366fff12da348e66$exports, "Depict", () => $366fff12da348e66$expo
4954
4954
 
4955
4955
 
4956
4956
 
4957
-
4958
-
4959
-
4960
-
4961
- var /**
4962
- * @deprecated please use `fetch_retry()` instead
4963
- *
4964
- * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
4965
- * (Note: this thing really should be rewritten with exponential backoff and a better API)
4966
- * @param dlog logging function to use
4967
- * @param error_log an array to which errors will be pushed
4968
- * @return a windows proof fetch function
4969
- */ $acf11540344875ed$export$2e2bcd8739ae039 = (dlog, error_log)=>{
4970
- // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
4971
- // https://stackoverflow.com/a/52947884
4972
- const windows_proof_fetch = async function(url, body, headers, decode_json, fetch_options, attempt) {
4973
- attempt ||= 1;
4974
- decode_json ??= true;
4975
- const { stack: stack } = new Error();
4976
- const elog = (...args)=>{
4977
- if (Array.isArray(error_log)) error_log.push(args);
4978
- return dlog(...args);
4979
- };
4980
- return await fetch(url, {
4981
- ...body ? {
4982
- body: body
4983
- } : {},
4984
- "method": "POST",
4985
- ...fetch_options ? fetch_options : {},
4986
- ...headers ? {
4987
- headers: headers
4988
- } : {}
4989
- }).then(async (response)=>{
4990
- if (!response || !response.ok || response.status !== 200) {
4991
- if (response.status === 422) (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($acf11540344875ed$var$send_sentry_422)(response, body, stack);
4992
- elog("Response not ok", response);
4993
- return false;
4994
- } else return await response[decode_json ? "json" : "text"]().catch((e)=>elog("error while decoding json", e));
4995
- }).catch((e)=>{
4996
- elog("Error while fetching", e, url, body);
4997
- if ((e.name == "TypeError" || e.message == "Failed to fetch" || e.message == "Network request failed") && !e.message.includes("CORS") && !e.name.includes("CORS") && ++attempt < 10) return windows_proof_fetch(url, body, headers, decode_json, fetch_options, attempt);
4998
- return false;
4999
- });
5000
- };
5001
- return windows_proof_fetch;
5002
- };
5003
- async function $acf11540344875ed$var$send_sentry_422(response, body, stack) {
5004
- const msg = `Validation error: got 422 from API`;
5005
- const text = await response.text();
5006
- (0, $649f456f663da9fc$export$de56f1198d121036)(msg, "body", body, "response", response, "text", text, "stack", stack);
5007
- (0, $eba382943196079c$export$af2e17a20c2ea3c5).withScope(function(scope) {
5008
- scope.setExtra("stack", stack);
5009
- scope.setExtra("request_body", body);
5010
- scope.setExtra("response", response);
5011
- scope.setExtra("serialized_response", (0, $5c4afc453f904a1f$export$39d526a1194b6499)(response));
5012
- scope.setExtra("response_text", text);
5013
- scope.setLevel("error");
5014
- this.captureException(new Error(msg));
5015
- });
5016
- }
5017
-
5018
-
5019
4957
  const $366fff12da348e66$var$discountMatcher = /{DISCOUNT{([\s\S]+?)}}/g;
5020
4958
  const $366fff12da348e66$var$noDiscountMatcher = /{NODISCOUNT{([\s\S]+?)}}/g;
5021
- const $366fff12da348e66$var$APICreateEvent = (0, $6c2b49f3f564b0d1$export$362abebb4b313340) + "/create-events";
5022
- const $366fff12da348e66$var$APIRecommend = (0, $6c2b49f3f564b0d1$export$362abebb4b313340) + "/recommend";
5023
- let $366fff12da348e66$var$pageview_sent = false, $366fff12da348e66$var$windows_proof_fetch;
4959
+ let $366fff12da348e66$var$pageview_sent = false;
5024
4960
  class $366fff12da348e66$export$1a8782481a9af507 {
5025
4961
  constructor(settings){
5026
4962
  this.settings = settings;
5027
- $366fff12da348e66$var$windows_proof_fetch = (0, $acf11540344875ed$export$2e2bcd8739ae039)(settings.debug ? console.log.bind(console) : ()=>{});
5028
4963
  }
5029
4964
  #dispatched_recs_inserted = false;
5030
4965
  init(callback, existingDisplays) {
@@ -5036,17 +4971,16 @@ class $366fff12da348e66$export$1a8782481a9af507 {
5036
4971
  }
5037
4972
  }
5038
4973
  loadRecommendations(callback) {
5039
- const { tenant: tenant , product_id: product_id , market: market , type: type , gaid: gaid } = this.settings;
5040
- $366fff12da348e66$var$windows_proof_fetch($366fff12da348e66$var$APIRecommend, JSON.stringify({
4974
+ const { tenant: tenant , product_id: product_id , type: type , market: market } = this.settings;
4975
+ (0, $2d47b009af5bc0a4$export$1bc0df10745d5412)(// @ts-ignore - Quick workaround, as we don't have a tenant object here
4976
+ {
5041
4977
  tenant: tenant,
5042
- market: market,
5043
- product_id: product_id(),
5044
- dsid: (0, $43683b1103edab15$export$6399bdb2291895e0)(),
5045
- user_id: (0, $43683b1103edab15$export$6399bdb2291895e0)(),
5046
- type: type
5047
- })).then((data)=>{
5048
- this.data = data?.displays;
5049
- if (!this.data) this.data = [];
4978
+ market: market
4979
+ }, {
4980
+ type: type,
4981
+ product_id: product_id()
4982
+ }).then((recs)=>{
4983
+ this.data = recs;
5050
4984
  (0, $66b898e9bfcef532$export$8582cf3716962dc2)({
5051
4985
  ...this.settings,
5052
4986
  recs: this.data,
@@ -5054,25 +4988,7 @@ class $366fff12da348e66$export$1a8782481a9af507 {
5054
4988
  });
5055
4989
  }).catch((e)=>{
5056
4990
  if (this.settings.debug) console.warn("template-tool: error fetching: ", e);
5057
- this.data = [];
5058
- }).finally(()=>{
5059
- if (this.settings.waitForSelectors !== undefined) {
5060
- const SLEEP_TIME_MS = 50;
5061
- let MAX_RETRY = Math.round(10000 / SLEEP_TIME_MS);
5062
- const tick = setInterval(()=>{
5063
- let allLoaded = true;
5064
- for (const selector of this.settings.waitForSelectors)if (document.querySelector(selector) == null) {
5065
- allLoaded = false;
5066
- break;
5067
- }
5068
- if (MAX_RETRY === 0 || allLoaded) {
5069
- clearInterval(tick);
5070
- callback();
5071
- }
5072
- MAX_RETRY--;
5073
- }, SLEEP_TIME_MS);
5074
- } else callback();
5075
- });
4991
+ }).finally(()=>callback());
5076
4992
  }
5077
4993
  trackGAEvent(action, index, product_id, ga_product_ids) {
5078
4994
  if (this.settings.sendGa === false) return;
@@ -5271,7 +5187,7 @@ $parcel$export($762a881271a51d1b$exports, "Deprecated_Amazing_Slider", () => $76
5271
5187
  $parcel$export($762a881271a51d1b$exports, "insert_styling_into_slider", () => $762a881271a51d1b$export$f1b8b9fd75ddcab1);
5272
5188
  // @ts-ignore
5273
5189
  var $ac3cf338239e4e17$exports = {};
5274
- $ac3cf338239e4e17$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict_slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict_slider {\n width: 100%;\n position: relative;\n}\n\n.depict_slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict_slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict_slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict_slider button.right {\n right: 0;\n}\n\n.depict_slider button.left, .depict_slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict_slider button.left.hidden, .depict_slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict_slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict_slider button.left img, .depict_slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict_slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
5190
+ $ac3cf338239e4e17$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict-slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict-slider button.right {\n right: 0;\n}\n\n.depict-slider button.left, .depict-slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict-slider button.left.hidden, .depict-slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict-slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict-slider button.left img, .depict-slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict-slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
5275
5191
 
5276
5192
 
5277
5193
 
@@ -5498,7 +5414,7 @@ function $f494377581cfb2b4$var$load_more_elements(root, chunk_size = 4) {
5498
5414
  return has_more;
5499
5415
  }
5500
5416
  function $f494377581cfb2b4$var$setup_load_more(t, root, chunk_size) {
5501
- const { catchify: catchify } = t, load_more_cont = (0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<div class="load_more_container"></div>`), load_button = load_more_cont.appendChild((0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<button class="load_more">Visa mer</button>`));
5417
+ const { catchify: catchify } = t, load_more_cont = (0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<div class="load-more-container"></div>`), load_button = load_more_cont.appendChild((0, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787)(`<button class="load_more">Visa mer</button>`));
5502
5418
  load_button.addEventListener("click", catchify(load_more_recs_and_hide_button_if_needed));
5503
5419
  root.after(load_more_cont);
5504
5420
  load_more_recs_and_hide_button_if_needed();
@@ -5534,6 +5450,67 @@ function $f494377581cfb2b4$export$c410ce1205e5118a(_t, itms, d, slider) {
5534
5450
 
5535
5451
 
5536
5452
 
5453
+ var /**
5454
+ * @deprecated please use `fetch_retry()` instead
5455
+ *
5456
+ * Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
5457
+ * (Note: this thing really should be rewritten with exponential backoff and a better API)
5458
+ * @param dlog logging function to use
5459
+ * @param error_log an array to which errors will be pushed
5460
+ * @return a windows proof fetch function
5461
+ */ $acf11540344875ed$export$2e2bcd8739ae039 = (dlog, error_log)=>{
5462
+ // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
5463
+ // https://stackoverflow.com/a/52947884
5464
+ const windows_proof_fetch = async function(url, body, headers, decode_json, fetch_options, attempt) {
5465
+ attempt ||= 1;
5466
+ decode_json ??= true;
5467
+ const { stack: stack } = new Error();
5468
+ const elog = (...args)=>{
5469
+ if (Array.isArray(error_log)) error_log.push(args);
5470
+ return dlog(...args);
5471
+ };
5472
+ return await fetch(url, {
5473
+ ...body ? {
5474
+ body: body
5475
+ } : {},
5476
+ "method": "POST",
5477
+ ...fetch_options ? fetch_options : {},
5478
+ ...headers ? {
5479
+ headers: headers
5480
+ } : {}
5481
+ }).then(async (response)=>{
5482
+ if (!response || !response.ok || response.status !== 200) {
5483
+ if (response.status === 422) (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($acf11540344875ed$var$send_sentry_422)(response, body, stack);
5484
+ elog("Response not ok", response);
5485
+ return false;
5486
+ } else return await response[decode_json ? "json" : "text"]().catch((e)=>elog("error while decoding json", e));
5487
+ }).catch((e)=>{
5488
+ elog("Error while fetching", e, url, body);
5489
+ if ((e.name == "TypeError" || e.message == "Failed to fetch" || e.message == "Network request failed") && !e.message.includes("CORS") && !e.name.includes("CORS") && ++attempt < 10) return windows_proof_fetch(url, body, headers, decode_json, fetch_options, attempt);
5490
+ return false;
5491
+ });
5492
+ };
5493
+ return windows_proof_fetch;
5494
+ };
5495
+ async function $acf11540344875ed$var$send_sentry_422(response, body, stack) {
5496
+ const msg = `Validation error: got 422 from API`;
5497
+ const text = await response.text();
5498
+ (0, $649f456f663da9fc$export$de56f1198d121036)(msg, "body", body, "response", response, "text", text, "stack", stack);
5499
+ (0, $eba382943196079c$export$af2e17a20c2ea3c5).withScope(function(scope) {
5500
+ scope.setExtra("stack", stack);
5501
+ scope.setExtra("request_body", body);
5502
+ scope.setExtra("response", response);
5503
+ scope.setExtra("serialized_response", (0, $5c4afc453f904a1f$export$39d526a1194b6499)(response));
5504
+ scope.setExtra("response_text", text);
5505
+ scope.setLevel("error");
5506
+ this.captureException(new Error(msg));
5507
+ });
5508
+ }
5509
+
5510
+
5511
+
5512
+
5513
+
5537
5514
 
5538
5515
 
5539
5516
 
@@ -5676,7 +5653,7 @@ async function $30e801eaa3dc319e$export$c84671f46d6a1ca({ rows: rows , container
5676
5653
  if (button) {
5677
5654
  button_class = (0, $460df8550f9d084d$export$a6db784f019668ba)();
5678
5655
  const button_container = (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
5679
- class: "load_more_container " + button_class,
5656
+ class: "load-more-container " + button_class,
5680
5657
  children: (0, $b9b0dba897847b2a$export$f63fcc839cb0f734)("click", ()=>ipns(ipns.state + (rows_or_empty_object.rows_per_click ?? 1)), button)
5681
5658
  });
5682
5659
  container_element.after(button_container);
@@ -5906,7 +5883,7 @@ var $30f78542ed78cd31$exports = {};
5906
5883
  $parcel$export($30f78542ed78cd31$exports, "RecommendationSlider", () => $30f78542ed78cd31$export$82cfdc85a4d15688);
5907
5884
  // @ts-ignore
5908
5885
  var $218c5c21f160bf78$exports = {};
5909
- $218c5c21f160bf78$exports = ".depict_slider {\n width: 100%;\n position: relative;\n}\n\n.depict_slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict_slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict_slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
5886
+ $218c5c21f160bf78$exports = ".depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
5910
5887
 
5911
5888
 
5912
5889
 
@@ -8175,7 +8152,7 @@ function $769ce417b39aa7d3$export$4a3043e508dd72f0({ children: children , ...att
8175
8152
  type: "button",
8176
8153
  children: children
8177
8154
  });
8178
- button.classList.add("show_more");
8155
+ button.classList.add("show-more");
8179
8156
  return button;
8180
8157
  }
8181
8158
 
@@ -8624,7 +8601,7 @@ var $914971fb43986a16$exports = {};
8624
8601
 
8625
8602
  $parcel$export($914971fb43986a16$exports, "ContainedImage", () => $914971fb43986a16$export$788756b42446dc2d);
8626
8603
  var $0f5d218f8055f715$exports = {};
8627
- $0f5d218f8055f715$exports = ".depict_img_cont {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.depict_img_filler {\n width: 100%;\n height: auto;\n display: inline-block;\n}\n\n.depict_img_comp {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.depict_img_mod {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: absolute;\n inset: 0;\n}\n\n";
8604
+ $0f5d218f8055f715$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.depict-img-filler {\n width: 100%;\n height: auto;\n display: inline-block;\n}\n\n.depict-img-comp {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.depict-img-mod {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: absolute;\n inset: 0;\n}\n\n";
8628
8605
 
8629
8606
 
8630
8607
  var $45af9e834781a9bc$exports = {};
@@ -8814,7 +8791,7 @@ function $914971fb43986a16$var$Image({ aspect_ratio: aspect_ratio , alt: alt , r
8814
8791
  } : {},
8815
8792
  ...image_options,
8816
8793
  class: (0, $b9b0dba897847b2a$export$22a65337c1b43b1f)([
8817
- "depict_img_mod ",
8794
+ "depict-img-mod ",
8818
8795
  image_options.class,
8819
8796
  $914971fb43986a16$var$add_nolazy_to_placeholder(rendering_options?.type)
8820
8797
  ])
@@ -8823,7 +8800,7 @@ function $914971fb43986a16$var$Image({ aspect_ratio: aspect_ratio , alt: alt , r
8823
8800
  }
8824
8801
  function $914971fb43986a16$var$CompatibleImage({ aspect_ratio: aspect_ratio , alt: alt , remove_on_error: remove_on_error , rendering_options: rendering_options , srcset_opts: srcset_opts , ...image_options }) {
8825
8802
  const canvas = (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("canvas", {
8826
- class: "depict_img_filler",
8803
+ class: "depict-img-filler",
8827
8804
  width: 3000 * aspect_ratio,
8828
8805
  height: 3000
8829
8806
  });
@@ -8833,7 +8810,7 @@ function $914971fb43986a16$var$CompatibleImage({ aspect_ratio: aspect_ratio , al
8833
8810
  style: "position:relative",
8834
8811
  children: [
8835
8812
  (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
8836
- class: "depict_img_cont",
8813
+ class: "depict-img-cont",
8837
8814
  children: (0, $63cbb5de51d11596$export$34b9dba7ce09269b)(IMG_tag, {
8838
8815
  alt: alt,
8839
8816
  ...remove_on_error ? {
@@ -8841,7 +8818,7 @@ function $914971fb43986a16$var$CompatibleImage({ aspect_ratio: aspect_ratio , al
8841
8818
  } : {},
8842
8819
  ...image_options,
8843
8820
  class: (0, $b9b0dba897847b2a$export$22a65337c1b43b1f)([
8844
- "depict_img_comp",
8821
+ "depict-img-comp",
8845
8822
  image_options.class,
8846
8823
  $914971fb43986a16$var$add_nolazy_to_placeholder(rendering_options?.type)
8847
8824
  ])
@@ -8869,7 +8846,7 @@ function $914971fb43986a16$var$srcset_comp_from_map_or_new(rendering_options, sr
8869
8846
 
8870
8847
 
8871
8848
  var $6261de93c2135467$exports = {};
8872
- $6261de93c2135467$exports = ".depict .images_container {\n position: relative;\n}\n\n.depict .second_image_container {\n width: 100%;\n opacity: 0;\n position: absolute;\n top: 0;\n}\n\n.depict .hovering .main_image_container {\n opacity: 0;\n}\n\n.depict .hovering .second_image_container {\n opacity: 1;\n}\n\n";
8849
+ $6261de93c2135467$exports = ".depict .images-container {\n position: relative;\n}\n\n.depict .second-image-container {\n width: 100%;\n opacity: 0;\n position: absolute;\n top: 0;\n}\n\n.depict .hovering .main-image-container {\n opacity: 0;\n}\n\n.depict .hovering .second-image-container {\n opacity: 1;\n}\n\n";
8873
8850
 
8874
8851
 
8875
8852
 
@@ -8885,8 +8862,8 @@ const $8483d1d9fcee52ec$var$TOUCHCANCEL = "touchcancel";
8885
8862
  const $8483d1d9fcee52ec$var$MOUSEOVER = "mouseover";
8886
8863
  const $8483d1d9fcee52ec$var$MOUSELEAVE = "mouseleave";
8887
8864
  const $8483d1d9fcee52ec$var$HOVER_CLASS = "hovering";
8888
- /** This number represents how many elements are in front of div.images_container
8889
- * Here are the elements: img.depict_img_mod, div, img.depict_img_mod, div, div.second_image_container, div.main_image_container, div.images_container
8865
+ /** This number represents how many elements are in front of div.images-container
8866
+ * Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
8890
8867
  * This number is not very dynamic but much more performant than iterating
8891
8868
  */ const $8483d1d9fcee52ec$var$HOVER_IMAGE_DEPTH = 7;
8892
8869
  const $8483d1d9fcee52ec$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
@@ -8990,14 +8967,14 @@ const $8483d1d9fcee52ec$export$2369f6fc1c911576 = ({ second_src: second_src , se
8990
8967
  });
8991
8968
  const no_second_img = !second_src && !second_srcset && !second_srcset_opts;
8992
8969
  const images_container = (0, $63cbb5de51d11596$export$25062201e9e25d76)("div", {
8993
- class: "images_container",
8970
+ class: "images-container",
8994
8971
  children: [
8995
8972
  !no_second_img && (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
8996
- class: "second_image_container",
8973
+ class: "second-image-container",
8997
8974
  children: second_image
8998
8975
  }),
8999
8976
  (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("div", {
9000
- class: "main_image_container",
8977
+ class: "main-image-container",
9001
8978
  children: main_image
9002
8979
  })
9003
8980
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/utilishared",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",