@kachingappz/bundles-js 1.1.0 → 1.1.1

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.
@@ -1,61 +1,61 @@
1
- const U = (t, e) => {
2
- const s = [], l = t.filter(
3
- (i) => i.blockVisibility === "selected-products"
1
+ const F = (e, t) => {
2
+ const a = [], s = e.filter(
3
+ (r) => r.blockVisibility === "selected-products"
4
4
  );
5
- for (const i of l)
6
- i.selectedProductIds.map(Number).includes(e.id) && s.push(i);
7
- const n = t.filter(
8
- (i) => i.blockVisibility === "selected-collections"
5
+ for (const r of s)
6
+ r.selectedProductIds.map(Number).includes(t.id) && a.push(r);
7
+ const n = e.filter(
8
+ (r) => r.blockVisibility === "selected-collections"
9
9
  );
10
- for (const i of n)
11
- e.collectionIds.some(
12
- (m) => i.selectedCollectionIds.map(Number).includes(m)
13
- ) && s.push(i);
14
- const r = t.filter(
15
- (i) => i.blockVisibility === "excluded-products"
10
+ for (const r of n)
11
+ t.collectionIds.some(
12
+ (m) => r.selectedCollectionIds.map(Number).includes(m)
13
+ ) && a.push(r);
14
+ const i = e.filter(
15
+ (r) => r.blockVisibility === "excluded-products"
16
16
  );
17
- for (const i of r)
18
- !i.excludedProductIds.map(Number).includes(e.id) && !(i.excludedCollectionIds || []).some(
19
- (m) => e.collectionIds.includes(m)
20
- ) && s.push(i);
21
- const o = t.filter(
22
- (i) => i.blockVisibility === "all-products"
17
+ for (const r of i)
18
+ !r.excludedProductIds.map(Number).includes(t.id) && !(r.excludedCollectionIds || []).some(
19
+ (m) => t.collectionIds.includes(m)
20
+ ) && a.push(r);
21
+ const o = e.filter(
22
+ (r) => r.blockVisibility === "all-products"
23
23
  );
24
- for (const i of o)
25
- s.push(i);
26
- return s;
27
- }, L = (t, { language: e, country: s }) => {
28
- var y, h;
29
- const l = V(e, s), n = new Intl.NumberFormat(l, {
24
+ for (const r of o)
25
+ a.push(r);
26
+ return a;
27
+ }, z = (e, { language: t, country: a }) => {
28
+ var h, g;
29
+ const s = R(t, a), n = new Intl.NumberFormat(s, {
30
30
  style: "currency",
31
- currency: t,
31
+ currency: e,
32
32
  currencyDisplay: "narrowSymbol"
33
- }).formatToParts(123456789e-2), r = (y = n.find((f) => f.type === "decimal")) == null ? void 0 : y.value, o = F(
34
- (h = n.find((f) => f.type === "group")) == null ? void 0 : h.value
35
- ), i = n.some((f) => f.type === "fraction"), m = R(
33
+ }).formatToParts(123456789e-2), i = (h = n.find((f) => f.type === "decimal")) == null ? void 0 : h.value, o = Q(
34
+ (g = n.find((f) => f.type === "group")) == null ? void 0 : g.value
35
+ ), r = n.some((f) => f.type === "fraction"), m = J(
36
36
  o,
37
- r,
38
- i
39
- ), d = n.findIndex(C), u = n.findLastIndex(C);
37
+ i,
38
+ r
39
+ ), c = n.findIndex(C), u = n.findLastIndex(C);
40
40
  return [
41
- ...n.slice(0, d).map(x),
41
+ ...n.slice(0, c).map(x),
42
42
  m,
43
43
  ...n.slice(u + 1).map(x)
44
44
  ].join("");
45
- }, x = (t) => O(t.value), O = (t) => t.replace(/\s/g, " "), C = (t) => t.type === "integer" || t.type === "group" || t.type === "decimal" || t.type === "fraction", V = (t, e) => t && e ? `${t}-${e.toUpperCase()}` : t || (e ? e.toUpperCase() : "en"), F = (t) => t === void 0 ? void 0 : O(t).replace(/’/g, "'"), R = (t, e, s) => e === "," && t === "." ? s ? "{{amount_with_comma_separator}}" : "{{amount_no_decimals_with_comma_separator}}" : e === "," && t === " " ? s ? "{{amount_with_space_separator}}" : "{{amount_no_decimals_with_space_separator}}" : e === "." && t === " " ? "{{amount_with_period_and_space_separator}}" : e === "." && t === "'" ? "{{amount_with_apostrophe_separator}}" : s ? "{{amount}}" : "{{amount_no_decimals}}", w = ({
46
- country: t,
47
- language: e
45
+ }, x = (e) => L(e.value), L = (e) => e.replace(/\s/g, " "), C = (e) => e.type === "integer" || e.type === "group" || e.type === "decimal" || e.type === "fraction", R = (e, t) => e && t ? `${e}-${t.toUpperCase()}` : e || (t ? t.toUpperCase() : "en"), Q = (e) => e === void 0 ? void 0 : L(e).replace(/’/g, "'"), J = (e, t, a) => t === "," && e === "." ? a ? "{{amount_with_comma_separator}}" : "{{amount_no_decimals_with_comma_separator}}" : t === "," && e === " " ? a ? "{{amount_with_space_separator}}" : "{{amount_no_decimals_with_space_separator}}" : t === "." && e === " " ? "{{amount_with_period_and_space_separator}}" : t === "." && e === "'" ? "{{amount_with_apostrophe_separator}}" : a ? "{{amount}}" : "{{amount_no_decimals}}", w = ({
46
+ country: e,
47
+ language: t
48
48
  }) => {
49
- const s = [];
50
- return t && s.push(`country: ${t}`), e && s.push(`language: ${e}`), s.length > 0 ? `@inContext(${s.join(", ")})` : "";
51
- }, z = async (t, {
52
- useExternalMetafieldNamespace: e,
53
- useMetaobjects: s
54
- }) => s ? J(
55
- t
56
- ) : Q(t), Q = async (t, e) => {
57
- var l;
58
- const s = (l = (await t.query(
49
+ const a = [];
50
+ return e && a.push(`country: ${e}`), t && a.push(`language: ${t}`), a.length > 0 ? `@inContext(${a.join(", ")})` : "";
51
+ }, H = async (e, {
52
+ useExternalMetafieldNamespace: t,
53
+ useMetaobjects: a
54
+ }) => a ? W(
55
+ e
56
+ ) : X(e), X = async (e, t) => {
57
+ var s;
58
+ const a = (s = (await e.query(
59
59
  `
60
60
  query FetchDealBlocks($metafieldNamespace: String!) {
61
61
  shop {
@@ -70,13 +70,13 @@ const U = (t, e) => {
70
70
  metafieldNamespace: "app--2935586817--kaching_bundles"
71
71
  }
72
72
  }
73
- )).shop.metafield) == null ? void 0 : l.value;
74
- return s ? JSON.parse(s) : [];
75
- }, J = async (t, e) => {
76
- const s = "app--2935586817--deal_block", l = [];
73
+ )).shop.metafield) == null ? void 0 : s.value;
74
+ return a ? JSON.parse(a) : [];
75
+ }, W = async (e, t) => {
76
+ const a = "app--2935586817--deal_block", s = [];
77
77
  let n = null;
78
78
  for (; ; ) {
79
- const r = await t.query(
79
+ const i = await e.query(
80
80
  `
81
81
  query FetchDealBlockMetaobjects($type: String!, $cursor: String) {
82
82
  metaobjects(type: $type, first: 250, after: $cursor) {
@@ -95,40 +95,40 @@ const U = (t, e) => {
95
95
  `,
96
96
  {
97
97
  variables: {
98
- type: s,
98
+ type: a,
99
99
  cursor: n
100
100
  }
101
101
  }
102
102
  );
103
- for (const o of r.metaobjects.nodes) {
104
- const i = o.fields.find(
103
+ for (const o of i.metaobjects.nodes) {
104
+ const r = o.fields.find(
105
105
  (m) => m.key === "settings"
106
106
  );
107
- i != null && i.value && l.push(JSON.parse(i.value));
107
+ r != null && r.value && s.push(JSON.parse(r.value));
108
108
  }
109
- if (!r.metaobjects.pageInfo.hasNextPage)
109
+ if (!i.metaobjects.pageInfo.hasNextPage)
110
110
  break;
111
- n = r.metaobjects.pageInfo.endCursor;
111
+ n = i.metaobjects.pageInfo.endCursor;
112
112
  }
113
- return l;
114
- }, N = async (t, {
115
- country: e,
116
- language: s,
117
- blockVisibility: l,
113
+ return s;
114
+ }, N = async (e, {
115
+ country: t,
116
+ language: a,
117
+ blockVisibility: s,
118
118
  excludedProductGIDs: n,
119
- selectedProductGIDs: r,
119
+ selectedProductGIDs: i,
120
120
  selectedCollectionGIDs: o,
121
- limit: i = 1e3
121
+ limit: r = 1e3
122
122
  }) => {
123
- switch (l) {
123
+ switch (s) {
124
124
  case "selected-products":
125
- return r.slice(0, i);
125
+ return i.slice(0, r);
126
126
  case "all-products":
127
127
  case "excluded-products": {
128
- const m = w({ country: e, language: s });
129
- let d = [], u = null;
130
- for (; d.length < i; ) {
131
- const y = Math.min(i - d.length, 250), h = await t.query(
128
+ const m = w({ country: t, language: a });
129
+ let c = [], u = null;
130
+ for (; c.length < r; ) {
131
+ const h = Math.min(r - c.length, 250), g = await e.query(
132
132
  `
133
133
  query FetchProductGIDs($limit: Int!, $cursor: String) ${m} {
134
134
  products(first: $limit, after: $cursor) {
@@ -144,22 +144,22 @@ const U = (t, e) => {
144
144
  `,
145
145
  {
146
146
  variables: {
147
- limit: y,
147
+ limit: h,
148
148
  cursor: u
149
149
  }
150
150
  }
151
151
  );
152
- if (d.push(...h.products.nodes.map((f) => f.id)), !h.products.pageInfo.hasNextPage) break;
153
- u = h.products.pageInfo.endCursor;
152
+ if (c.push(...g.products.nodes.map((f) => f.id)), !g.products.pageInfo.hasNextPage) break;
153
+ u = g.products.pageInfo.endCursor;
154
154
  }
155
- if (l === "excluded-products") {
156
- const y = new Set(n);
157
- d = d.filter((h) => !y.has(h));
155
+ if (s === "excluded-products") {
156
+ const h = new Set(n);
157
+ c = c.filter((g) => !h.has(g));
158
158
  }
159
- return d;
159
+ return c;
160
160
  }
161
161
  case "selected-collections": {
162
- const m = w({ country: e, language: s }), d = (await t.query(
162
+ const m = w({ country: t, language: a }), c = (await e.query(
163
163
  `
164
164
  query FetchCollectionProductGIDs($collectionGIDs: [ID!]!, $limit: Int!) ${m} {
165
165
  nodes(ids: $collectionGIDs) {
@@ -176,16 +176,16 @@ const U = (t, e) => {
176
176
  {
177
177
  variables: {
178
178
  collectionGIDs: o,
179
- limit: Math.min(i, 250)
179
+ limit: Math.min(r, 250)
180
180
  }
181
181
  }
182
182
  )).nodes.filter((u) => u !== null).flatMap(
183
- (u) => u.products.nodes.map((y) => y.id)
183
+ (u) => u.products.nodes.map((h) => h.id)
184
184
  );
185
- return Array.from(new Set(d)).slice(0, i);
185
+ return Array.from(new Set(c)).slice(0, r);
186
186
  }
187
187
  }
188
- }, j = `
188
+ }, U = `
189
189
  id
190
190
  availableForSale
191
191
  price {
@@ -200,7 +200,7 @@ const U = (t, e) => {
200
200
  }
201
201
  image {
202
202
  id
203
- url(transform: { maxWidth: 200, maxHeight: 200 })
203
+ url(transform: $variantImageTransform)
204
204
  }
205
205
  unitPriceMeasurement {
206
206
  quantityUnit
@@ -228,20 +228,21 @@ const U = (t, e) => {
228
228
  }
229
229
  }
230
230
  quantityAvailable @include(if: $includeAvailableQuantity)
231
- `, D = async (t, {
232
- country: e,
233
- language: s,
234
- productIds: l,
231
+ `, $ = async (e, {
232
+ country: t,
233
+ language: a,
234
+ productIds: s,
235
235
  includeSellingPlans: n = !0,
236
- includeAvailableQuantity: r = !0,
236
+ includeAvailableQuantity: i = !0,
237
237
  useExternalMetafieldNamespace: o = !1,
238
- batchSize: i = 250,
239
- onBatchError: m
238
+ batchSize: r = 250,
239
+ onBatchError: m,
240
+ variantImageTransform: c = { maxWidth: 200, maxHeight: 200 }
240
241
  }) => {
241
- if (!l.length)
242
+ if (!s.length)
242
243
  return [];
243
- const d = l.map((c) => typeof c == "string" && c.startsWith("gid://") ? c : `gid://shopify/Product/${c}`), u = w({ country: e, language: s }), y = `
244
- query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $metafieldNamespace: String!) ${u} {
244
+ const u = s.map((p) => typeof p == "string" && p.startsWith("gid://") ? p : `gid://shopify/Product/${p}`), h = w({ country: t, language: a }), g = `
245
+ query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${h} {
245
246
  shop {
246
247
  currencyRateConstant: metafield(namespace: $metafieldNamespace, key: "currency_rate_constant") {
247
248
  value
@@ -275,7 +276,7 @@ const U = (t, e) => {
275
276
  }
276
277
  variants(first: 250) {
277
278
  nodes {
278
- ${j}
279
+ ${U}
279
280
  }
280
281
  }
281
282
  collections(first: 50) {
@@ -327,84 +328,90 @@ const U = (t, e) => {
327
328
  }
328
329
  }
329
330
  }
330
- `, h = o ? "app--2935586817--kaching_bundles" : "$app:kaching_bundles", f = [], v = Math.min(i, 250);
331
- for (let c = 0; c < d.length; c += v)
332
- f.push(d.slice(c, c + v));
333
- let a = 1;
334
- const p = async (c) => {
335
- const b = await t.query(y, {
331
+ `, f = o ? "app--2935586817--kaching_bundles" : "$app:kaching_bundles", v = [], l = Math.min(r, 250);
332
+ for (let p = 0; p < u.length; p += l)
333
+ v.push(u.slice(p, p + l));
334
+ let d = 1;
335
+ const y = async (p) => {
336
+ const b = await e.query(g, {
336
337
  variables: {
337
- productGIDs: c,
338
+ productGIDs: p,
338
339
  includeSellingPlans: n,
339
- includeAvailableQuantity: r,
340
- metafieldNamespace: h
340
+ includeAvailableQuantity: i,
341
+ metafieldNamespace: f,
342
+ variantImageTransform: c
341
343
  }
342
344
  });
343
- return b.shop.currencyRateConstant && (a = JSON.parse(b.shop.currencyRateConstant.value).amount / 1e6), b;
345
+ return b.shop.currencyRateConstant && (d = JSON.parse(b.shop.currencyRateConstant.value).amount / 1e6), b;
344
346
  };
345
- let g;
347
+ let _;
346
348
  if (m) {
347
- const c = await Promise.allSettled(f.map(p));
348
- for (const b of c)
349
+ const p = await Promise.allSettled(v.map(y));
350
+ for (const b of p)
349
351
  b.status === "rejected" && m(
350
352
  b.reason instanceof Error ? b.reason : new Error(String(b.reason))
351
353
  );
352
- g = c.filter(
354
+ _ = p.filter(
353
355
  (b) => b.status === "fulfilled"
354
356
  ).flatMap((b) => b.value.nodes);
355
357
  } else
356
- g = (await Promise.all(f.map(p))).flatMap((c) => c.nodes);
357
- const _ = g.filter((c) => c != null);
358
+ _ = (await Promise.all(v.map(y))).flatMap((p) => p.nodes);
359
+ const I = _.filter((p) => p != null);
358
360
  if (m) {
359
- const c = await Promise.allSettled(
360
- _.map(async (I) => {
361
- const P = await G(
362
- t,
363
- I,
364
- { includeSellingPlans: n, includeAvailableQuantity: r },
365
- u
366
- );
367
- return B(
361
+ const p = await Promise.allSettled(
362
+ I.map(async (P) => {
363
+ const V = await G(
364
+ e,
368
365
  P,
369
- t.shopifyDomain,
370
- a
366
+ {
367
+ includeSellingPlans: n,
368
+ includeAvailableQuantity: i,
369
+ variantImageTransform: c
370
+ },
371
+ h
372
+ );
373
+ return T(
374
+ V,
375
+ e.shopifyDomain,
376
+ d
371
377
  );
372
378
  })
373
379
  ), b = [];
374
- for (const I of c)
375
- I.status === "fulfilled" ? b.push(I.value) : m(
376
- I.reason instanceof Error ? I.reason : new Error(String(I.reason))
380
+ for (const P of p)
381
+ P.status === "fulfilled" ? b.push(P.value) : m(
382
+ P.reason instanceof Error ? P.reason : new Error(String(P.reason))
377
383
  );
378
384
  return b;
379
385
  }
380
386
  return (await Promise.all(
381
- _.map(
382
- (c) => G(
383
- t,
384
- c,
387
+ I.map(
388
+ (p) => G(
389
+ e,
390
+ p,
385
391
  {
386
392
  includeSellingPlans: n,
387
- includeAvailableQuantity: r
393
+ includeAvailableQuantity: i,
394
+ variantImageTransform: c
388
395
  },
389
- u
396
+ h
390
397
  )
391
398
  )
392
399
  )).map(
393
- (c) => B(c, t.shopifyDomain, a)
400
+ (p) => T(p, e.shopifyDomain, d)
394
401
  );
395
- }, G = async (t, e, s, l = "") => {
396
- if (e.variants.nodes.length < 250)
397
- return e;
398
- const n = /* @__PURE__ */ new Set(), r = [], o = [], i = async (m) => {
399
- let d = !0, u = null;
400
- for (; d; ) {
401
- const y = await t.query(
402
+ }, G = async (e, t, a, s = "") => {
403
+ if (t.variants.nodes.length < 250)
404
+ return t;
405
+ const n = /* @__PURE__ */ new Set(), i = [], o = [], r = async (m) => {
406
+ let c = !0, u = null;
407
+ for (; c; ) {
408
+ const h = await e.query(
402
409
  `
403
- query($productGID: ID!, $cursor: String, $reverse: Boolean, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!) ${l} {
410
+ query($productGID: ID!, $cursor: String, $reverse: Boolean, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $variantImageTransform: ImageTransformInput) ${s} {
404
411
  product(id: $productGID) {
405
412
  variants(first: 250, after: $cursor, reverse: $reverse) {
406
413
  nodes {
407
- ${j}
414
+ ${U}
408
415
  }
409
416
  pageInfo {
410
417
  endCursor
@@ -416,164 +423,164 @@ const U = (t, e) => {
416
423
  `,
417
424
  {
418
425
  variables: {
419
- productGID: e.id,
426
+ productGID: t.id,
420
427
  cursor: u,
421
428
  reverse: m,
422
- ...s
429
+ ...a
423
430
  }
424
431
  }
425
- ), { nodes: h, pageInfo: f } = y.product.variants;
426
- for (const v of h) {
432
+ ), { nodes: g, pageInfo: f } = h.product.variants;
433
+ for (const v of g) {
427
434
  if (n.has(v.id)) {
428
- d = !1;
435
+ c = !1;
429
436
  break;
430
437
  }
431
- n.add(v.id), m ? o.push(v) : r.push(v);
438
+ n.add(v.id), m ? o.push(v) : i.push(v);
432
439
  }
433
- f.hasNextPage || (d = !1), u = f.endCursor;
440
+ f.hasNextPage || (c = !1), u = f.endCursor;
434
441
  }
435
442
  };
436
443
  return await Promise.all([
437
- i(!1),
438
- i(!0)
439
- ]), e.variants.nodes = [...r, ...o.reverse()], e;
440
- }, B = (t, e, s) => {
441
- var d, u, y, h, f, v;
442
- const l = t.variants.nodes.map(
443
- ({ unitPriceMeasurement: a, ...p }) => {
444
- var g, _;
444
+ r(!1),
445
+ r(!0)
446
+ ]), t.variants.nodes = [...i, ...o.reverse()], t;
447
+ }, T = (e, t, a) => {
448
+ var c, u, h, g, f, v;
449
+ const s = e.variants.nodes.map(
450
+ ({ unitPriceMeasurement: l, ...d }) => {
451
+ var y, _;
445
452
  return {
446
- id: Number(p.id.split("/").pop()),
447
- availableForSale: p.availableForSale,
448
- price: Math.round(Number(p.price.amount) * 100),
449
- compareAtPrice: p.compareAtPrice ? Math.round(Number(p.compareAtPrice.amount) * 100) : null,
450
- options: p.selectedOptions.map((c) => c.value),
451
- imageId: p.image ? Number(p.image.id.split("/").pop()) : null,
452
- image: ((g = p.image) == null ? void 0 : g.url) || null,
453
- sellingPlans: ((_ = p.sellingPlanAllocations) == null ? void 0 : _.nodes.map((c) => ({
454
- id: Number(c.sellingPlan.id.split("/").pop()),
455
- price: c.priceAdjustments.length > 0 ? Math.round(Number(c.priceAdjustments[0].price.amount) * 100) : Math.round(Number(p.price.amount) * 100),
456
- compareAtPrice: c.priceAdjustments.length > 0 ? Math.round(
457
- Number(c.priceAdjustments[0].compareAtPrice.amount) * 100
458
- ) : Math.round(Number(p.price.amount) * 100),
459
- perDeliveryPrice: c.priceAdjustments.length > 0 ? Math.round(
460
- Number(c.priceAdjustments[0].perDeliveryPrice.amount) * 100
461
- ) : Math.round(Number(p.price.amount) * 100)
453
+ id: Number(d.id.split("/").pop()),
454
+ availableForSale: d.availableForSale,
455
+ price: Math.round(Number(d.price.amount) * 100),
456
+ compareAtPrice: d.compareAtPrice ? Math.round(Number(d.compareAtPrice.amount) * 100) : null,
457
+ options: d.selectedOptions.map((I) => I.value),
458
+ imageId: d.image ? Number(d.image.id.split("/").pop()) : null,
459
+ image: ((y = d.image) == null ? void 0 : y.url) || null,
460
+ sellingPlans: ((_ = d.sellingPlanAllocations) == null ? void 0 : _.nodes.map((I) => ({
461
+ id: Number(I.sellingPlan.id.split("/").pop()),
462
+ price: I.priceAdjustments.length > 0 ? Math.round(Number(I.priceAdjustments[0].price.amount) * 100) : Math.round(Number(d.price.amount) * 100),
463
+ compareAtPrice: I.priceAdjustments.length > 0 ? Math.round(
464
+ Number(I.priceAdjustments[0].compareAtPrice.amount) * 100
465
+ ) : Math.round(Number(d.price.amount) * 100),
466
+ perDeliveryPrice: I.priceAdjustments.length > 0 ? Math.round(
467
+ Number(I.priceAdjustments[0].perDeliveryPrice.amount) * 100
468
+ ) : Math.round(Number(d.price.amount) * 100)
462
469
  }))) || [],
463
470
  inventoryManagement: null,
464
471
  // Storefront API does not return inventory management, only available in liquid
465
472
  inventoryPolicy: null,
466
473
  // Storefront API does not return inventory policy, only available in liquid
467
- inventoryQuantity: p.quantityAvailable ?? null,
468
- unitPriceMeasurement: a != null && a.quantityUnit && (a != null && a.referenceUnit) ? {
469
- quantityValue: a.quantityValue,
470
- quantityUnit: a.quantityUnit.toLowerCase(),
471
- referenceValue: a.referenceValue,
472
- referenceUnit: a.referenceUnit.toLowerCase()
474
+ inventoryQuantity: d.quantityAvailable ?? null,
475
+ unitPriceMeasurement: l != null && l.quantityUnit && (l != null && l.referenceUnit) ? {
476
+ quantityValue: l.quantityValue,
477
+ quantityUnit: l.quantityUnit.toLowerCase(),
478
+ referenceValue: l.referenceValue,
479
+ referenceUnit: l.referenceUnit.toLowerCase()
473
480
  } : null
474
481
  };
475
482
  }
476
- ), n = t.options.map((a, p) => {
477
- const g = a.optionValues.map((_) => {
478
- var c, b, I, P;
483
+ ), n = e.options.map((l, d) => {
484
+ const y = l.optionValues.map((_) => {
485
+ var I, p, b, P;
479
486
  return {
480
487
  id: Number(_.id.split("/").pop()),
481
488
  defaultName: _.name,
482
489
  name: _.name,
483
490
  swatch: {
484
- color: ((c = _.swatch) == null ? void 0 : c.color) || null,
485
- image: ((P = (I = (b = _.swatch) == null ? void 0 : b.image) == null ? void 0 : I.previewImage) == null ? void 0 : P.url) || null
491
+ color: ((I = _.swatch) == null ? void 0 : I.color) || null,
492
+ image: ((P = (b = (p = _.swatch) == null ? void 0 : p.image) == null ? void 0 : b.previewImage) == null ? void 0 : P.url) || null
486
493
  }
487
494
  };
488
495
  });
489
496
  return {
490
- defaultName: a.name,
491
- name: a.name,
492
- position: p + 1,
493
- optionValues: H(g, p, l)
497
+ defaultName: l.name,
498
+ name: l.name,
499
+ position: d + 1,
500
+ optionValues: K(y, d, s)
494
501
  };
495
- }), r = (a) => {
496
- const p = a.priceAdjustments[0];
497
- if (!p)
502
+ }), i = (l) => {
503
+ const d = l.priceAdjustments[0];
504
+ if (!d)
498
505
  return null;
499
- const g = p.adjustmentValue;
500
- switch (g.__typename) {
506
+ const y = d.adjustmentValue;
507
+ switch (y.__typename) {
501
508
  case "SellingPlanPercentagePriceAdjustment":
502
509
  return {
503
510
  type: "percentage",
504
- value: g.adjustmentPercentage
511
+ value: y.adjustmentPercentage
505
512
  };
506
513
  case "SellingPlanFixedAmountPriceAdjustment":
507
514
  return {
508
515
  type: "fixed_amount",
509
- value: o(g.adjustmentAmount.amount)
516
+ value: o(y.adjustmentAmount.amount)
510
517
  };
511
518
  case "SellingPlanFixedPriceAdjustment":
512
519
  return {
513
520
  type: "price",
514
- value: o(g.price.amount)
521
+ value: o(y.price.amount)
515
522
  };
516
523
  default:
517
524
  throw new Error(
518
- `Unknown price adjustment type: ${g.__typename}`
525
+ `Unknown price adjustment type: ${y.__typename}`
519
526
  );
520
527
  }
521
- }, o = (a) => s === 1 ? Number(a) * 100 : Math.round(Number(a) * 100 * s), i = ((d = t.sellingPlanGroups) == null ? void 0 : d.nodes.flatMap(
522
- (a) => a.sellingPlans.nodes.map((p) => ({
523
- id: Number(p.id.split("/").pop()),
524
- name: p.name,
525
- priceAdjustment: r(p)
528
+ }, o = (l) => a === 1 ? Number(l) * 100 : Math.round(Number(l) * 100 * a), r = ((c = e.sellingPlanGroups) == null ? void 0 : c.nodes.flatMap(
529
+ (l) => l.sellingPlans.nodes.map((d) => ({
530
+ id: Number(d.id.split("/").pop()),
531
+ name: d.name,
532
+ priceAdjustment: i(d)
526
533
  }))
527
- )) || [], m = t.variants.nodes.some(
528
- (a) => a.requiresComponents
534
+ )) || [], m = e.variants.nodes.some(
535
+ (l) => l.requiresComponents
529
536
  );
530
537
  return {
531
- id: Number(t.id.split("/").pop()),
532
- handle: t.handle,
533
- url: t.onlineStoreUrl || `https://${e}/products/${t.handle}`,
534
- availableForSale: t.availableForSale,
535
- createdAt: t.createdAt,
536
- title: t.title,
537
- image: ((u = t.featuredImage) == null ? void 0 : u.url) || null,
538
- collectionIds: t.collections.nodes.map(
539
- (a) => Number(a.id.split("/").pop())
538
+ id: Number(e.id.split("/").pop()),
539
+ handle: e.handle,
540
+ url: e.onlineStoreUrl || `https://${t}/products/${e.handle}`,
541
+ availableForSale: e.availableForSale,
542
+ createdAt: e.createdAt,
543
+ title: e.title,
544
+ image: ((u = e.featuredImage) == null ? void 0 : u.url) || null,
545
+ collectionIds: e.collections.nodes.map(
546
+ (l) => Number(l.id.split("/").pop())
540
547
  ),
541
548
  options: n,
542
549
  selectedVariantId: Number(
543
- t.variants.nodes[0].id.split("/").pop()
550
+ e.variants.nodes[0].id.split("/").pop()
544
551
  ),
545
- variants: l,
546
- requiresSellingPlan: t.requiresSellingPlan,
547
- sellingPlans: i,
552
+ variants: s,
553
+ requiresSellingPlan: e.requiresSellingPlan,
554
+ sellingPlans: r,
548
555
  isNativeBundle: m,
549
556
  metafields: {
550
- text: ((y = t.metafield) == null ? void 0 : y.value) || null,
551
- text2: ((h = t.metafield2) == null ? void 0 : h.value) || null,
552
- text3: ((f = t.metafield3) == null ? void 0 : f.value) || null,
553
- text4: ((v = t.metafield4) == null ? void 0 : v.value) || null
557
+ text: ((h = e.metafield) == null ? void 0 : h.value) || null,
558
+ text2: ((g = e.metafield2) == null ? void 0 : g.value) || null,
559
+ text3: ((f = e.metafield3) == null ? void 0 : f.value) || null,
560
+ text4: ((v = e.metafield4) == null ? void 0 : v.value) || null
554
561
  }
555
562
  };
556
- }, H = (t, e, s) => t.filter((l) => s.filter(
557
- (n) => n.options[e] === l.name
558
- ).length > 0), T = "app--2935586817", X = async (t, {
559
- language: e,
560
- country: s,
561
- useExternalMetafieldNamespace: l
563
+ }, K = (e, t, a) => e.filter((s) => a.filter(
564
+ (n) => n.options[t] === s.name
565
+ ).length > 0), B = "app--2935586817", Y = async (e, {
566
+ language: t,
567
+ country: a,
568
+ useExternalMetafieldNamespace: s
562
569
  }) => {
563
- const n = `${T}--kaching_bundles`, r = T, o = w({ country: s }), {
570
+ const n = `${B}--kaching_bundles`, i = B, o = w({ country: a }), {
564
571
  localization: {
565
572
  country: {
566
- currency: { isoCode: i }
573
+ currency: { isoCode: r }
567
574
  }
568
575
  },
569
576
  shop: {
570
577
  moneyFormat: m,
571
- paymentSettings: { currencyCode: d },
578
+ paymentSettings: { currencyCode: c },
572
579
  currencyRateConstant: u,
573
- primaryDomain: y,
574
- settingsMetafield: h
580
+ primaryDomain: h,
581
+ settingsMetafield: g
575
582
  }
576
- } = await t.query(
583
+ } = await e.query(
577
584
  `
578
585
  query config($metafieldNamespace: String!, $settingsNamespace: String!) ${o} {
579
586
  localization {
@@ -603,29 +610,29 @@ const U = (t, e) => {
603
610
  {
604
611
  variables: {
605
612
  metafieldNamespace: n,
606
- settingsNamespace: r
613
+ settingsNamespace: i
607
614
  }
608
615
  }
609
- ), f = i === d ? m : L(i, { language: e, country: s }), v = u ? W(u.value) : 1, a = h ? JSON.parse(h.value) : null, p = (a == null ? void 0 : a.feature_flags) ?? {}, g = (a == null ? void 0 : a.custom_selectors) ?? {};
616
+ ), f = r === c ? m : z(r, { language: t, country: a }), v = u ? Z(u.value) : 1, l = g ? JSON.parse(g.value) : null, d = (l == null ? void 0 : l.feature_flags) ?? {}, y = (l == null ? void 0 : l.custom_selectors) ?? {};
610
617
  return {
611
- shopifyDomain: y.host,
618
+ shopifyDomain: h.host,
612
619
  moneyFormat: f,
613
- locale: (e == null ? void 0 : e.toLowerCase()) || "en",
614
- liquidLocale: (e == null ? void 0 : e.toLowerCase()) || "en",
615
- country: s ?? "US",
620
+ locale: (t == null ? void 0 : t.toLowerCase()) || "en",
621
+ liquidLocale: (t == null ? void 0 : t.toLowerCase()) || "en",
622
+ country: a ?? "US",
616
623
  currencyRate: v,
617
624
  marketId: 0,
618
625
  productId: null,
619
- storefrontAccessToken: (a == null ? void 0 : a.storefront_access_token) ?? null,
620
- includeSellingPlans: (a == null ? void 0 : a.include_selling_plans) ?? !1,
621
- includeAvailableQuantity: (a == null ? void 0 : a.include_available_quantity) ?? !1,
622
- customApiHost: (a == null ? void 0 : a.custom_api_host) ?? null,
623
- keepQuantityInput: (a == null ? void 0 : a.keep_quantity_input) ?? !1,
624
- ignoreDeselect: (a == null ? void 0 : a.ignore_deselect) ?? !1,
625
- ignoreUnitPrice: (a == null ? void 0 : a.ignore_unit_price) ?? !1,
626
- requireCustomerLogin: (a == null ? void 0 : a.require_customer_login) ?? !1,
627
- abTestsRunning: (a == null ? void 0 : a.ab_tests_running) ?? !1,
628
- webPixel: (a == null ? void 0 : a.web_pixel) ?? !1,
626
+ storefrontAccessToken: (l == null ? void 0 : l.storefront_access_token) ?? null,
627
+ includeSellingPlans: (l == null ? void 0 : l.include_selling_plans) ?? !1,
628
+ includeAvailableQuantity: (l == null ? void 0 : l.include_available_quantity) ?? !1,
629
+ customApiHost: (l == null ? void 0 : l.custom_api_host) ?? null,
630
+ keepQuantityInput: (l == null ? void 0 : l.keep_quantity_input) ?? !1,
631
+ ignoreDeselect: (l == null ? void 0 : l.ignore_deselect) ?? !1,
632
+ ignoreUnitPrice: (l == null ? void 0 : l.ignore_unit_price) ?? !1,
633
+ requireCustomerLogin: (l == null ? void 0 : l.require_customer_login) ?? !1,
634
+ abTestsRunning: (l == null ? void 0 : l.ab_tests_running) ?? !1,
635
+ webPixel: (l == null ? void 0 : l.web_pixel) ?? !1,
629
636
  b2bCustomer: !1,
630
637
  isLoggedIn: !1,
631
638
  preview: !1,
@@ -657,304 +664,376 @@ const U = (t, e) => {
657
664
  "system.numbers_only": "Only numbers are allowed."
658
665
  },
659
666
  customSelectors: {
660
- quantity: g.quantity ?? null,
661
- addToCartButton: g.add_to_cart_button ?? null,
662
- variantPicker: g.variant_picker ?? null,
663
- price: g.price ?? null,
664
- priceCompare: g.price_compare ?? null
667
+ quantity: y.quantity ?? null,
668
+ addToCartButton: y.add_to_cart_button ?? null,
669
+ variantPicker: y.variant_picker ?? null,
670
+ price: y.price ?? null,
671
+ priceCompare: y.price_compare ?? null
665
672
  },
666
- shopCustomStyles: (a == null ? void 0 : a.shop_custom_styles) ?? "",
667
- featureFlags: p,
668
- brandColors: (a == null ? void 0 : a.brand_colors) ?? null
673
+ shopCustomStyles: (l == null ? void 0 : l.shop_custom_styles) ?? "",
674
+ featureFlags: d,
675
+ brandColors: (l == null ? void 0 : l.brand_colors) ?? null
669
676
  };
670
- }, W = (t) => JSON.parse(t).amount / 1e6, K = async (t, e, s = 200) => (e = e.filter(Boolean).filter((l) => !l.startsWith("placeholder")), e.length === 0 ? [] : (await t.query(
671
- `
672
- query FetchMediaImages($mediaImageIds: [ID!]!, $size: Int!) {
673
- nodes(ids: $mediaImageIds) {
674
- ... on MediaImage {
675
- id
676
- image {
677
- url(transform: { maxWidth: $size, maxHeight: $size })
677
+ }, Z = (e) => JSON.parse(e).amount / 1e6, ee = async (e, t, a = 200) => {
678
+ const s = [
679
+ ...new Set(
680
+ t.filter(Boolean).filter((i) => !i.startsWith("placeholder"))
681
+ )
682
+ ];
683
+ if (s.length === 0) return [];
684
+ const n = [];
685
+ for (let i = 0; i < s.length; i += 250)
686
+ n.push(s.slice(i, i + 250));
687
+ return (await Promise.all(
688
+ n.map(
689
+ (i) => e.query(
690
+ `
691
+ query FetchMediaImages($mediaImageIds: [ID!]!, $size: Int!) {
692
+ nodes(ids: $mediaImageIds) {
693
+ ... on MediaImage {
694
+ id
695
+ image {
696
+ url(transform: { maxWidth: $size, maxHeight: $size })
697
+ }
698
+ }
678
699
  }
679
700
  }
701
+ `,
702
+ {
703
+ variables: {
704
+ mediaImageIds: i,
705
+ size: a
706
+ }
680
707
  }
681
- }
682
- `,
683
- {
684
- variables: {
685
- mediaImageIds: e,
686
- size: s
687
- }
688
- }
689
- )).nodes.filter(Boolean).map((l) => ({
690
- gid: l.id,
691
- url: l.image.url
692
- })));
693
- var S = /* @__PURE__ */ ((t) => (t.QuantityBreak = "quantity-break", t.Bxgy = "bxgy", t.Bundle = "bundle", t.MixAndMatch = "mix-and-match", t.Sku = "sku", t))(S || {});
694
- const Y = (t) => [
695
- ...Z(t),
696
- ...ee(t),
697
- ...te(t),
698
- ...se(t),
699
- ...ae(t),
700
- ...ne(t),
701
- ...le(t),
702
- ...ie(t),
703
- ...re(t),
704
- ...oe(t),
705
- ...ce(t),
706
- ...ue(t),
707
- ...de(t)
708
- ].filter((e) => e != null && !e.includes("placeholder")), Z = (t) => t.dealBars.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), ee = (t) => t.dealBars.flatMap(
709
- (e) => e.dealBarType === S.Bundle ? e.bundleProducts.map(
710
- (s) => s.mediaImageGID
708
+ )
709
+ )
710
+ )).flatMap((i) => i.nodes).filter(Boolean).map((i) => ({
711
+ gid: i.id,
712
+ url: i.image.url
713
+ }));
714
+ };
715
+ var S = /* @__PURE__ */ ((e) => (e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e))(S || {});
716
+ const te = (e) => [
717
+ ...ae(e),
718
+ ...se(e),
719
+ ...ne(e),
720
+ ...le(e),
721
+ ...re(e),
722
+ ...ie(e),
723
+ ...oe(e),
724
+ ...ce(e),
725
+ ...ue(e),
726
+ ...de(e),
727
+ ...me(e),
728
+ ...pe(e),
729
+ ...fe(e)
730
+ ].filter((t) => t != null && !t.includes("placeholder")), ae = (e) => e.dealBars.flatMap((t) => [t.mediaImageGID, t.badgeImageGID]).filter((t) => t != null), se = (e) => e.dealBars.flatMap(
731
+ (t) => t.dealBarType === S.Bundle ? t.bundleProducts.map(
732
+ (a) => a.mediaImageGID
711
733
  ) : []
712
- ).filter((e) => e != null), te = (t) => t.dealBars.map(
713
- ({ freeGifts: e }) => (e || []).map((s) => s.mediaImageGID)
714
- ).reduce((e, s) => e.concat(s), []).filter((e) => e != null), se = (t) => t.dealBars.flatMap(
715
- ({ multipleGiftsSelectors: e }) => (e || []).map((s) => s.mediaImageGID)
716
- ).filter((e) => e != null), ae = (t) => t.dealBars.map(({ upsells: e }) => (e || []).map((s) => s.mediaImageGID)).reduce((e, s) => e.concat(s), []).filter((e) => e != null), ne = (t) => t.swatchOptions ? t.swatchOptions.reduce((e, s) => {
717
- const l = s.images.map((n) => n.mediaImageGID).filter((n) => n != null);
718
- return [...e, ...l];
719
- }, []) : [], le = (t) => {
720
- if (!t.collectionBreaksEnabled || !t.collectionBreaks)
734
+ ).filter((t) => t != null), ne = (e) => e.dealBars.map(
735
+ ({ freeGifts: t }) => (t || []).map((a) => a.mediaImageGID)
736
+ ).reduce((t, a) => t.concat(a), []).filter((t) => t != null), le = (e) => e.dealBars.flatMap(
737
+ ({ multipleGiftsSelectors: t }) => (t || []).map((a) => a.mediaImageGID)
738
+ ).filter((t) => t != null), re = (e) => e.dealBars.map(({ upsells: t }) => (t || []).map((a) => a.mediaImageGID)).reduce((t, a) => t.concat(a), []).filter((t) => t != null), ie = (e) => e.swatchOptions ? e.swatchOptions.reduce((t, a) => {
739
+ const s = a.images.map((n) => n.mediaImageGID).filter((n) => n != null);
740
+ return [...t, ...s];
741
+ }, []) : [], oe = (e) => {
742
+ if (!e.collectionBreaksEnabled || !e.collectionBreaks)
721
743
  return [];
722
- const e = t.collectionBreaks.mediaImageGID;
723
- return e ? [e] : [];
724
- }, ie = (t) => {
725
- var e, s, l;
726
- return t.progressiveGifts ? [
727
- ...((e = t.progressiveGifts.gifts) == null ? void 0 : e.map((n) => n.mediaImageGID)) || [],
728
- (s = t.progressiveGifts.style) == null ? void 0 : s.lockedMediaImageGID,
729
- (l = t.progressiveGifts.dealBarStyle) == null ? void 0 : l.lockedMediaImageGID
744
+ const t = e.collectionBreaks.mediaImageGID;
745
+ return t ? [t] : [];
746
+ }, ce = (e) => {
747
+ var t, a, s;
748
+ return e.progressiveGifts ? [
749
+ ...((t = e.progressiveGifts.gifts) == null ? void 0 : t.map((n) => n.mediaImageGID)) || [],
750
+ (a = e.progressiveGifts.style) == null ? void 0 : a.lockedMediaImageGID,
751
+ (s = e.progressiveGifts.dealBarStyle) == null ? void 0 : s.lockedMediaImageGID
730
752
  ].filter((n) => n != null) : [];
731
- }, re = (t) => !t.checkboxUpsellsEnabled || !t.checkboxUpsells ? [] : t.checkboxUpsells.upsells.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), oe = (t) => t.dealBars.map((e) => {
732
- var s;
733
- return (s = e.productPersonalisation) == null ? void 0 : s.mediaImageGID;
734
- }).filter((e) => e != null), ce = (t) => {
735
- var l, n;
736
- const e = t.dealBars.map((r) => {
753
+ }, ue = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.flatMap((t) => [t.mediaImageGID, t.badgeImageGID]).filter((t) => t != null), de = (e) => e.dealBars.map((t) => {
754
+ var a;
755
+ return (a = t.productPersonalisation) == null ? void 0 : a.mediaImageGID;
756
+ }).filter((t) => t != null), me = (e) => {
757
+ var s, n;
758
+ const t = e.dealBars.map((i) => {
737
759
  var o;
738
- return (o = r.highlights) == null ? void 0 : o.customIconGID;
739
- }).filter((r) => r != null), s = (n = (l = t.subscriptions) == null ? void 0 : l.highlights) == null ? void 0 : n.customIconGID;
740
- return s ? [...e, s] : e;
741
- }, ue = (t) => (t.badges || []).flatMap(
742
- (e) => e.badgeType === "custom" && e.imageGID ? [e.imageGID] : []
743
- ), de = (t) => !t.savingsSummaryEnabled || !t.savingsSummary ? [] : t.savingsSummary.customIconGID ? [t.savingsSummary.customIconGID] : [], me = (t) => {
744
- const e = [
745
- ...pe(t),
746
- ...fe(t),
747
- ...he(t),
748
- ...ge(t),
749
- ...ye(t),
750
- ...be(t),
751
- ...ve(t),
752
- ..._e(t)
760
+ return (o = i.highlights) == null ? void 0 : o.customIconGID;
761
+ }).filter((i) => i != null), a = (n = (s = e.subscriptions) == null ? void 0 : s.highlights) == null ? void 0 : n.customIconGID;
762
+ return a ? [...t, a] : t;
763
+ }, pe = (e) => (e.badges || []).flatMap(
764
+ (t) => t.badgeType === "custom" && t.imageGID ? [t.imageGID] : []
765
+ ), fe = (e) => !e.savingsSummaryEnabled || !e.savingsSummary ? [] : e.savingsSummary.customIconGID ? [e.savingsSummary.customIconGID] : [], he = (e) => {
766
+ const t = [
767
+ ...ge(e),
768
+ ...ye(e),
769
+ ...be(e),
770
+ ...ve(e),
771
+ ...Ie(e),
772
+ ..._e(e),
773
+ ...Pe(e),
774
+ ...Se(e)
753
775
  ];
754
- return Array.from(new Set(e.filter((s) => s != null)));
755
- }, pe = (t) => t.dealBars.flatMap(
756
- ({ freeGifts: e }) => e ? e.map((s) => s.productGID) : []
757
- ).filter((e) => e != null), fe = (t) => t.dealBars.flatMap(
758
- ({ multipleGiftsSelectors: e }) => e ? e.flatMap(
759
- (s) => s.products ? s.products.map((l) => l.id) : []
776
+ return Array.from(new Set(t.filter((a) => a != null)));
777
+ }, ge = (e) => e.dealBars.flatMap(
778
+ ({ freeGifts: t }) => t ? t.map((a) => a.productGID) : []
779
+ ).filter((t) => t != null), ye = (e) => e.dealBars.flatMap(
780
+ ({ multipleGiftsSelectors: t }) => t ? t.flatMap(
781
+ (a) => a.products ? a.products.map((s) => s.id) : []
760
782
  ) : []
761
- ).filter((e) => e != null), he = (t) => {
762
- var e;
763
- return t.progressiveGiftsEnabled ? ((e = t.progressiveGifts) == null ? void 0 : e.gifts.map((s) => s.productGID).filter((s) => s != null)) || [] : [];
764
- }, ge = (t) => t.dealBars.flatMap(({ upsells: e }) => e ? e.map((s) => s.productGID) : []).filter((e) => e != null), ye = (t) => t.dealBars.filter((e) => e.dealBarType === S.Bundle).flatMap(
765
- ({ bundleProducts: e }) => e ? e.map((s) => s.productGID) : []
766
- ).filter((e) => e != null).filter((e) => e !== "default"), be = (t) => t.dealBars.filter((e) => e.dealBarType === S.MixAndMatch).flatMap(
767
- ({ bundleProducts: e }) => e ? e.flatMap((s) => {
768
- var l;
783
+ ).filter((t) => t != null), be = (e) => {
784
+ var t;
785
+ return e.progressiveGiftsEnabled ? ((t = e.progressiveGifts) == null ? void 0 : t.gifts.map((a) => a.productGID).filter((a) => a != null)) || [] : [];
786
+ }, ve = (e) => e.dealBars.flatMap(({ upsells: t }) => t ? t.map((a) => a.productGID) : []).filter((t) => t != null), Ie = (e) => e.dealBars.filter((t) => t.dealBarType === S.Bundle).flatMap(
787
+ ({ bundleProducts: t }) => t ? t.map((a) => a.productGID) : []
788
+ ).filter((t) => t != null).filter((t) => t !== "default"), _e = (e) => e.dealBars.filter((t) => t.dealBarType === S.MixAndMatch).flatMap(
789
+ ({ bundleProducts: t }) => t ? t.flatMap((a) => {
790
+ var s;
769
791
  return [
770
- s.productGID,
771
- ...((l = s.selectedProducts) == null ? void 0 : l.map((n) => n.id)) ?? []
792
+ a.productGID,
793
+ ...((s = a.selectedProducts) == null ? void 0 : s.map((n) => n.id)) ?? []
772
794
  ];
773
795
  }) : []
774
- ).filter((e) => e != null).filter((e) => e !== "default"), ve = (t) => !t.checkboxUpsellsEnabled || !t.checkboxUpsells ? [] : t.checkboxUpsells.upsells.map((e) => e.productGID).filter((e) => e != null), _e = (t) => t.dealBars.filter((e) => e.dealBarType === S.Sku).flatMap(({ productGID: e }) => e ? [e] : []);
775
- class Ie {
776
- constructor(e, s) {
777
- this.storefrontApiVersion = "2026-07", this.storefrontAccessToken = s, this.shopifyDomain = e;
796
+ ).filter((t) => t != null).filter((t) => t !== "default"), Pe = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.map((t) => t.productGID).filter((t) => t != null), Se = (e) => e.dealBars.filter((t) => t.dealBarType === S.Sku).flatMap(({ productGID: t }) => t ? [t] : []);
797
+ class M extends Error {
798
+ constructor({
799
+ status: t,
800
+ operationName: a,
801
+ graphqlErrors: s
802
+ }) {
803
+ const n = s.length ? `: ${s.join("; ")}` : "";
804
+ super(
805
+ `Storefront API ${a ?? "query"} failed (HTTP ${t})${n}`
806
+ ), this.name = "StorefrontApiError", this.status = t, this.operationName = a, this.graphqlErrors = s;
807
+ }
808
+ }
809
+ const ke = async (e, t) => {
810
+ const a = await e.text();
811
+ if (!a)
812
+ throw new Error("Empty graphql response");
813
+ let s;
814
+ try {
815
+ s = JSON.parse(a);
816
+ } catch (n) {
817
+ throw e.ok ? n : new M({
818
+ status: e.status,
819
+ operationName: t,
820
+ graphqlErrors: []
821
+ });
822
+ }
823
+ if (!e.ok || s.data === null || s.data === void 0)
824
+ throw new M({
825
+ status: e.status,
826
+ operationName: t,
827
+ graphqlErrors: (s.errors ?? []).map(({ message: n }) => n).filter(Boolean)
828
+ });
829
+ return s.data;
830
+ };
831
+ class we {
832
+ constructor(t, a) {
833
+ this.storefrontApiVersion = "2026-07", this.storefrontAccessToken = a, this.shopifyDomain = t;
778
834
  }
779
- async query(e, s) {
780
- var i;
781
- const l = (s == null ? void 0 : s.variables) ?? {};
835
+ async query(t, a) {
836
+ var r;
837
+ const s = (a == null ? void 0 : a.variables) ?? {};
782
838
  let n = `https://${this.shopifyDomain}/api/${this.storefrontApiVersion}/graphql.json`;
783
- const r = (i = e.match(/query\s+(\w+)/)) == null ? void 0 : i[1];
784
- r && (n += `?operation_name=${r}`);
785
- const o = await (await fetch(n, {
839
+ const i = (r = t.match(/query\s+(\w+)/)) == null ? void 0 : r[1];
840
+ i && (n += `?operation_name=${i}`);
841
+ const o = await fetch(n, {
786
842
  method: "POST",
787
843
  headers: {
788
844
  "Content-Type": "application/json",
789
845
  "X-Shopify-Storefront-Access-Token": this.storefrontAccessToken
790
846
  },
791
847
  body: JSON.stringify({
792
- query: e,
793
- variables: l
848
+ query: t,
849
+ variables: s
794
850
  })
795
- })).text();
796
- if (!o)
797
- throw new Error("Empty graphql response");
798
- return JSON.parse(o).data;
851
+ });
852
+ return ke(o, i);
799
853
  }
800
854
  }
801
- const Pe = async (t, e, { country: s, language: l }) => {
802
- const n = e.collectionBreaks;
803
- if (!e.collectionBreaksEnabled || !n) return;
804
- let r;
805
- n.visibility === "deal-products" ? r = await N(t, {
806
- country: s,
807
- language: l,
808
- blockVisibility: e.blockVisibility,
809
- excludedProductGIDs: (e.excludedProductIds || []).map(
810
- (i) => `gid://shopify/Product/${i}`
855
+ const Ee = async (e, t, { country: a, language: s }) => {
856
+ const n = t.collectionBreaks;
857
+ if (!t.collectionBreaksEnabled || !n) return;
858
+ let i;
859
+ n.visibility === "deal-products" ? i = await N(e, {
860
+ country: a,
861
+ language: s,
862
+ blockVisibility: t.blockVisibility,
863
+ excludedProductGIDs: (t.excludedProductIds || []).map(
864
+ (r) => `gid://shopify/Product/${r}`
811
865
  ),
812
- selectedProductGIDs: (e.selectedProductIds || []).map(
813
- (i) => `gid://shopify/Product/${i}`
866
+ selectedProductGIDs: (t.selectedProductIds || []).map(
867
+ (r) => `gid://shopify/Product/${r}`
814
868
  ),
815
- selectedCollectionGIDs: (e.selectedCollectionIds || []).map(
816
- (i) => `gid://shopify/Collection/${i}`
869
+ selectedCollectionGIDs: (t.selectedCollectionIds || []).map(
870
+ (r) => `gid://shopify/Collection/${r}`
817
871
  )
818
- }) : r = await N(t, {
819
- country: s,
820
- language: l,
872
+ }) : i = await N(e, {
873
+ country: a,
874
+ language: s,
821
875
  blockVisibility: n.visibility,
822
876
  excludedProductGIDs: (n.excludedProducts || []).map(
823
- ({ id: i }) => i
877
+ ({ id: r }) => r
824
878
  ),
825
879
  selectedProductGIDs: (n.selectedProducts || []).map(
826
- ({ id: i }) => i
880
+ ({ id: r }) => r
827
881
  ),
828
882
  selectedCollectionGIDs: (n.selectedCollections || []).map(
829
- ({ id: i }) => i
883
+ ({ id: r }) => r
830
884
  )
831
885
  });
832
- let o = await D(t, {
833
- country: s,
834
- language: l,
835
- productIds: r.map((i) => Number(i.split("/").pop())),
886
+ let o = await $(e, {
887
+ country: a,
888
+ language: s,
889
+ productIds: i.map((r) => Number(r.split("/").pop())),
836
890
  useExternalMetafieldNamespace: !0
837
891
  });
838
892
  return o = o.filter(
839
- (i) => i.availableForSale
893
+ (r) => r.availableForSale
840
894
  ), o;
841
- }, Se = () => ({
842
- "system.out_of_stock": "There's not enough items in our stock, please select smaller bundle.",
843
- "system.invalid_variant": "Sorry, this is not currently available.",
844
- "system.unavailable_option_value": "Unavailable",
845
- "system.confirm": "Confirm",
846
- "system.cancel": "Cancel",
847
- "system.free": "FREE",
848
- "system.search": "Search",
849
- "system.quantity": "Quantity",
850
- "system.subscription_plan": "Subscription plan",
851
- "system.remove": "Remove",
852
- "system.sort_by": "Sort by",
853
- "system.sort_relevance": "Relevance",
854
- "system.sort_newest_first": "Newest first",
855
- "system.sort_price_low_to_high": "Price: Low → High",
856
- "system.sort_price_high_to_low": "Price: High → Low",
857
- "system.no_results_found": "No results found",
858
- "system.no_results_description": "We can't find any item matching your search.",
859
- "system.clear_search": "Clear search",
860
- "system.no_products_available": "No products available",
861
- "system.original_price": "Original price:",
862
- "system.price": "Price:",
863
- "system.letters_only": "Only letters are allowed.",
864
- "system.numbers_only": "Only numbers are allowed.",
865
- "system.personalisation_required_alert": "Please add personalisation for every item to continue."
866
- }), ke = "2026-07", we = async (t, {
867
- productId: e,
868
- dealBlockId: s,
869
- country: l = void 0,
895
+ }, Ae = ({
896
+ language: e,
897
+ dealBlockId: t
898
+ }) => {
899
+ const a = {
900
+ "system.out_of_stock": "There's not enough items in our stock, please select smaller bundle.",
901
+ "system.invalid_variant": "Sorry, this is not currently available.",
902
+ "system.unavailable_option_value": "Unavailable",
903
+ "system.confirm": "Confirm",
904
+ "system.cancel": "Cancel",
905
+ "system.free": "FREE",
906
+ "system.search": "Search",
907
+ "system.quantity": "Quantity",
908
+ "system.subscription_plan": "Subscription plan",
909
+ "system.remove": "Remove",
910
+ "system.sort_by": "Sort by",
911
+ "system.sort_relevance": "Relevance",
912
+ "system.sort_newest_first": "Newest first",
913
+ "system.sort_price_low_to_high": "Price: Low → High",
914
+ "system.sort_price_high_to_low": "Price: High → Low",
915
+ "system.no_results_found": "No results found",
916
+ "system.no_results_description": "We can't find any item matching your search.",
917
+ "system.clear_search": "Clear search",
918
+ "system.no_products_available": "No products available",
919
+ "system.original_price": "Original price:",
920
+ "system.price": "Price:",
921
+ "system.letters_only": "Only letters are allowed.",
922
+ "system.numbers_only": "Only numbers are allowed.",
923
+ "system.personalisation_required_alert": "Please add personalisation for every item to continue."
924
+ }, s = e ? $e(e) : void 0;
925
+ return {
926
+ ...a,
927
+ ...s == null ? void 0 : s.system,
928
+ ...s == null ? void 0 : s.dealBlocks[t]
929
+ };
930
+ }, $e = (e) => {
931
+ var n;
932
+ if (typeof document > "u") return;
933
+ const t = document.querySelector("script#kaching-bundles-translations");
934
+ if (!(t != null && t.textContent)) return;
935
+ let a;
936
+ try {
937
+ a = JSON.parse(t.textContent);
938
+ } catch {
939
+ return;
940
+ }
941
+ const s = q(e);
942
+ return (n = a.find(
943
+ (i) => q(i.locale) === s
944
+ )) == null ? void 0 : n.translations;
945
+ }, q = (e) => e.toLowerCase().replace(/_/g, "-"), De = "2026-07", xe = async (e, {
946
+ productId: t,
947
+ dealBlockId: a,
948
+ country: s = void 0,
870
949
  language: n = void 0
871
950
  }) => {
872
- var r, o;
951
+ var i, o;
873
952
  try {
874
- const i = [Number(e.split("/").pop())], m = new Ee(t);
875
- l = l || ((r = m.i18n) == null ? void 0 : r.country), n = n || ((o = m.i18n) == null ? void 0 : o.language);
876
- const d = await X(m, {
953
+ const r = [Number(t.split("/").pop())], m = new Ce(e);
954
+ s = s || ((i = m.i18n) == null ? void 0 : i.country), n = n || ((o = m.i18n) == null ? void 0 : o.language);
955
+ const c = await Y(m, {
877
956
  language: n,
878
- country: l,
957
+ country: s,
879
958
  useExternalMetafieldNamespace: !0
880
959
  });
881
- m.shopifyDomain = d.shopifyDomain;
882
- const u = d.storefrontAccessToken ? new Ie(
883
- d.shopifyDomain,
884
- d.storefrontAccessToken
885
- ) : m, [y, h] = await Promise.all([
886
- D(u, {
887
- country: l,
960
+ m.shopifyDomain = c.shopifyDomain;
961
+ const u = c.storefrontAccessToken ? new we(
962
+ c.shopifyDomain,
963
+ c.storefrontAccessToken
964
+ ) : m, [h, g] = await Promise.all([
965
+ $(u, {
966
+ country: s,
888
967
  language: n,
889
- productIds: i,
968
+ productIds: r,
890
969
  useExternalMetafieldNamespace: !0
891
970
  }),
892
- z(u, {
971
+ H(u, {
893
972
  useExternalMetafieldNamespace: !0,
894
- useMetaobjects: d.featureFlags.storefront_metaobjects
973
+ useMetaobjects: c.featureFlags.storefront_metaobjects
895
974
  })
896
- ]), f = y[0];
975
+ ]), f = h[0];
897
976
  if (!f)
898
977
  return null;
899
- const v = U(h, f);
900
- let a;
901
- if (s ? (a = v.find(
902
- (P) => P.id === s || P.nanoId === s
903
- ), a || (a = v[0])) : a = v[0], !a)
978
+ const v = F(g, f);
979
+ let l;
980
+ if (a ? (l = v.find(
981
+ (P) => P.id === a || P.nanoId === a
982
+ ), l || (l = v[0])) : l = v[0], !l)
904
983
  return null;
905
- const p = Y(a), g = me(a), [_, c, b, I] = await Promise.all([
906
- D(u, {
907
- country: l,
984
+ const d = te(l), y = he(l), [_, I, p, b] = await Promise.all([
985
+ $(u, {
986
+ country: s,
908
987
  language: n,
909
- productIds: g,
988
+ productIds: y,
910
989
  useExternalMetafieldNamespace: !0
911
990
  }),
912
- K(u, p, 300),
913
- Pe(u, a, {
914
- country: l,
991
+ ee(u, d, 300),
992
+ Ee(u, l, {
993
+ country: s,
915
994
  language: n
916
995
  }),
917
- Se()
996
+ Ae({ language: n, dealBlockId: l.id })
918
997
  ]);
919
998
  return {
920
999
  product: f,
921
- dealBlock: a,
922
- config: d,
1000
+ dealBlock: l,
1001
+ config: c,
923
1002
  otherProducts: _,
924
- mediaImages: c,
925
- collectionBreaksProducts: b ?? [],
926
- translations: I
1003
+ mediaImages: I,
1004
+ collectionBreaksProducts: p ?? [],
1005
+ translations: b
927
1006
  };
928
- } catch (i) {
929
- return console.error(i), null;
1007
+ } catch (r) {
1008
+ return console.error(r), null;
930
1009
  }
931
1010
  };
932
- class Ee {
933
- constructor(e) {
934
- this.storefront = e, this.shopifyDomain = "";
1011
+ class Ce {
1012
+ constructor(t) {
1013
+ this.storefront = t, this.shopifyDomain = "";
935
1014
  }
936
- async query(e, s) {
937
- var l;
1015
+ async query(t, a) {
1016
+ var s;
938
1017
  if ("query" in this.storefront && "i18n" in this.storefront)
939
- return await this.storefront.query(e, s);
1018
+ return await this.storefront.query(t, a);
940
1019
  if ("graphql" in this.storefront) {
941
- const n = await this.storefront.graphql(e, s);
942
- if ((l = n.errors) != null && l.length)
1020
+ const n = await this.storefront.graphql(t, a);
1021
+ if ((s = n.errors) != null && s.length)
943
1022
  throw new Error(
944
- n.errors.map((r) => r.message).join(`
1023
+ n.errors.map((i) => i.message).join(`
945
1024
  `)
946
1025
  );
947
1026
  return n.data;
948
1027
  }
949
1028
  if ("request" in this.storefront)
950
- return (await this.storefront.request(e, s)).data;
1029
+ return (await this.storefront.request(t, a)).data;
951
1030
  if ("shopifyDomain" in this.storefront && "storefrontAccessToken" in this.storefront) {
952
1031
  const n = await fetch(
953
- `https://${this.storefront.shopifyDomain}/api/${ke}/graphql.json`,
1032
+ `https://${this.storefront.shopifyDomain}/api/${De}/graphql.json`,
954
1033
  {
955
1034
  body: JSON.stringify({
956
- query: e,
957
- variables: s == null ? void 0 : s.variables
1035
+ query: t,
1036
+ variables: a == null ? void 0 : a.variables
958
1037
  }),
959
1038
  headers: {
960
1039
  "Content-Type": "application/json",
@@ -969,8 +1048,8 @@ class Ee {
969
1048
  } else {
970
1049
  const n = await fetch(this.storefront.getStorefrontApiUrl(), {
971
1050
  body: JSON.stringify({
972
- query: e,
973
- variables: s == null ? void 0 : s.variables
1051
+ query: t,
1052
+ variables: a == null ? void 0 : a.variables
974
1053
  }),
975
1054
  headers: this.storefront.getPublicTokenHeaders(),
976
1055
  method: "POST"
@@ -985,52 +1064,52 @@ class Ee {
985
1064
  return this.storefront.i18n;
986
1065
  }
987
1066
  }
988
- const E = "kaching-bundles-block", M = 1e4, Ae = "https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js", De = "https://bundles-integrations.kachingappz.app/kaching-bundles-block.js", A = /* @__PURE__ */ new WeakSet(), q = async (t) => {
989
- const e = t.document;
990
- if (!t.customElements.get(E)) {
991
- if (A.has(e))
992
- return $(t, E);
993
- A.add(e);
1067
+ const E = "kaching-bundles-block", O = 1e4, Ne = "https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js", Ge = "https://bundles-integrations.kachingappz.app/kaching-bundles-block.js", A = /* @__PURE__ */ new WeakSet(), j = async (e) => {
1068
+ const t = e.document;
1069
+ if (!e.customElements.get(E)) {
1070
+ if (A.has(t))
1071
+ return D(e, E);
1072
+ A.add(t);
994
1073
  try {
995
- await Ce(t);
996
- } catch (s) {
997
- throw A.delete(e), s;
1074
+ await Me(e);
1075
+ } catch (a) {
1076
+ throw A.delete(t), a;
998
1077
  }
999
1078
  }
1000
- }, $e = () => typeof window < "u" && typeof window.__KACHING_DEV__ < "u", xe = () => $e() ? Ae : De, Ce = (t) => {
1001
- const e = t.document;
1002
- return new Promise((s, l) => {
1003
- const n = xe();
1004
- if (e.querySelector(
1079
+ }, Te = () => typeof window < "u" && typeof window.__KACHING_DEV__ < "u", Be = () => Te() ? Ne : Ge, Me = (e) => {
1080
+ const t = e.document;
1081
+ return new Promise((a, s) => {
1082
+ const n = Be();
1083
+ if (t.querySelector(
1005
1084
  `script[src="${n}"]`
1006
1085
  )) {
1007
- $(t, E).then(s).catch(l);
1086
+ D(e, E).then(a).catch(s);
1008
1087
  return;
1009
1088
  }
1010
- const o = e.createElement("script");
1011
- o.src = n, o.onload = () => $(t, E).then(s).catch(l), o.onerror = () => l(new Error("Failed to load script")), e.head.appendChild(o);
1089
+ const o = t.createElement("script");
1090
+ o.src = n, o.onload = () => D(e, E).then(a).catch(s), o.onerror = () => s(new Error("Failed to load script")), t.head.appendChild(o);
1012
1091
  });
1013
- }, $ = (t, e) => new Promise((s, l) => {
1014
- if (t.customElements.get(e)) {
1015
- s();
1092
+ }, D = (e, t) => new Promise((a, s) => {
1093
+ if (e.customElements.get(t)) {
1094
+ a();
1016
1095
  return;
1017
1096
  }
1018
1097
  Promise.race([
1019
- t.customElements.whenDefined(e),
1098
+ e.customElements.whenDefined(t),
1020
1099
  new Promise(
1021
- (n, r) => setTimeout(
1022
- () => r(
1100
+ (n, i) => setTimeout(
1101
+ () => i(
1023
1102
  new Error(
1024
- `Custom element "${e}" failed to register within ${M}ms`
1103
+ `Custom element "${t}" failed to register within ${O}ms`
1025
1104
  )
1026
1105
  ),
1027
- M
1106
+ O
1028
1107
  )
1029
1108
  )
1030
- ]).then(() => s()).catch(l);
1109
+ ]).then(() => a()).catch(s);
1031
1110
  });
1032
- var k = /* @__PURE__ */ ((t) => (t.QuantityBreak = "quantity-break", t.Bxgy = "bxgy", t.Bundle = "bundle", t.MixAndMatch = "mix-and-match", t.Sku = "sku", t))(k || {});
1033
- const Ne = {
1111
+ var k = /* @__PURE__ */ ((e) => (e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e))(k || {});
1112
+ const qe = {
1034
1113
  id: 1,
1035
1114
  handle: "example-product",
1036
1115
  url: null,
@@ -1060,7 +1139,7 @@ const Ne = {
1060
1139
  requiresSellingPlan: !1,
1061
1140
  sellingPlans: [],
1062
1141
  isNativeBundle: !1
1063
- }, Ge = {
1142
+ }, Oe = {
1064
1143
  id: "example",
1065
1144
  nanoId: "example",
1066
1145
  blockName: "Bundle",
@@ -1236,7 +1315,7 @@ const Ne = {
1236
1315
  customStyles: "",
1237
1316
  lowStockAlertEnabled: !1,
1238
1317
  lowStockAlert: null
1239
- }, Be = {
1318
+ }, je = {
1240
1319
  shopifyDomain: "",
1241
1320
  moneyFormat: "${{amount}}",
1242
1321
  locale: "en",
@@ -1293,16 +1372,16 @@ const Ne = {
1293
1372
  },
1294
1373
  featureFlags: {},
1295
1374
  shopCustomStyles: ""
1296
- }, Te = {
1297
- config: Be,
1298
- dealBlock: Ge,
1299
- product: Ne,
1375
+ }, Le = {
1376
+ config: je,
1377
+ dealBlock: Oe,
1378
+ product: qe,
1300
1379
  otherProducts: [],
1301
1380
  mediaImages: [],
1302
1381
  collectionBreaksProducts: [],
1303
1382
  translations: {}
1304
1383
  };
1305
- class Me extends HTMLElement {
1384
+ class Ue extends HTMLElement {
1306
1385
  constructor() {
1307
1386
  super(...arguments), this.innerElement = null, this.handleItemsChanged = null, this.initializeId = 0;
1308
1387
  }
@@ -1313,63 +1392,63 @@ class Me extends HTMLElement {
1313
1392
  await this.initialize();
1314
1393
  }
1315
1394
  async initialize() {
1316
- var o, i;
1317
- const e = ++this.initializeId;
1395
+ var o, r;
1396
+ const t = ++this.initializeId;
1318
1397
  if (this.cleanup(), this.hasAttribute("demo")) {
1319
- if (await q(window), e !== this.initializeId) return;
1320
- this.renderInnerElement(Te);
1398
+ if (await j(window), t !== this.initializeId) return;
1399
+ this.renderInnerElement(Le);
1321
1400
  return;
1322
1401
  }
1323
- const s = this.getAttribute("shop-domain"), l = this.getAttribute("storefront-token"), n = this.getAttribute("product-id");
1324
- if (!s || !l || !n) return;
1325
- const [r] = await Promise.all([
1326
- we(
1402
+ const a = this.getAttribute("shop-domain"), s = this.getAttribute("storefront-token"), n = this.getAttribute("product-id");
1403
+ if (!a || !s || !n) return;
1404
+ const [i] = await Promise.all([
1405
+ xe(
1327
1406
  {
1328
- shopifyDomain: s,
1329
- storefrontAccessToken: l
1407
+ shopifyDomain: a,
1408
+ storefrontAccessToken: s
1330
1409
  },
1331
1410
  {
1332
1411
  productId: n,
1333
1412
  dealBlockId: this.getAttribute("deal-block-id") ?? void 0,
1334
1413
  country: ((o = this.getAttribute("country")) == null ? void 0 : o.toUpperCase()) ?? void 0,
1335
- language: ((i = this.getAttribute("language")) == null ? void 0 : i.toUpperCase()) ?? void 0
1414
+ language: ((r = this.getAttribute("language")) == null ? void 0 : r.toUpperCase()) ?? void 0
1336
1415
  }
1337
1416
  ),
1338
- q(window)
1417
+ j(window)
1339
1418
  ]);
1340
- !r || e !== this.initializeId || this.renderInnerElement(r);
1419
+ !i || t !== this.initializeId || this.renderInnerElement(i);
1341
1420
  }
1342
- renderInnerElement(e) {
1421
+ renderInnerElement(t) {
1343
1422
  const {
1344
- config: s,
1345
- dealBlock: l,
1423
+ config: a,
1424
+ dealBlock: s,
1346
1425
  product: n,
1347
- otherProducts: r,
1426
+ otherProducts: i,
1348
1427
  mediaImages: o,
1349
- collectionBreaksProducts: i,
1428
+ collectionBreaksProducts: r,
1350
1429
  translations: m
1351
- } = e;
1430
+ } = t;
1352
1431
  this.innerElement = document.createElement(
1353
1432
  "kaching-bundles-block"
1354
- ), this.innerElement.setAttribute("deal-block-id", l.id), this.innerElement.setAttribute("config", JSON.stringify(s)), this.innerElement.setAttribute("deal-block", JSON.stringify(l)), this.innerElement.setAttribute(
1433
+ ), this.innerElement.setAttribute("deal-block-id", s.id), this.innerElement.setAttribute("config", JSON.stringify(a)), this.innerElement.setAttribute("deal-block", JSON.stringify(s)), this.innerElement.setAttribute(
1355
1434
  "media-images",
1356
1435
  JSON.stringify(o ?? [])
1357
1436
  ), this.innerElement.setAttribute("product", JSON.stringify(n)), this.innerElement.setAttribute(
1358
1437
  "other-products",
1359
- JSON.stringify(r ?? [])
1438
+ JSON.stringify(i ?? [])
1360
1439
  ), this.innerElement.setAttribute(
1361
1440
  "collection-breaks-products",
1362
- JSON.stringify(i ?? [])
1441
+ JSON.stringify(r ?? [])
1363
1442
  ), this.innerElement.setAttribute(
1364
1443
  "translations",
1365
1444
  JSON.stringify(m ?? {})
1366
1445
  );
1367
- const d = this.getAttribute("selected-variant-id");
1446
+ const c = this.getAttribute("selected-variant-id");
1368
1447
  this.innerElement.setAttribute(
1369
1448
  "current-variant-id",
1370
- String(d ? d.split("/").pop() : n.variants[0].id)
1449
+ String(c ? c.split("/").pop() : n.variants[0].id)
1371
1450
  ), this.hasAttribute("compact") && this.innerElement.setAttribute("compact", "");
1372
- const u = this.innerElement, y = () => {
1451
+ const u = this.innerElement, h = () => {
1373
1452
  if (this.innerElement !== u) return;
1374
1453
  const f = u.items();
1375
1454
  f && this.dispatchEvent(
@@ -1380,13 +1459,13 @@ class Me extends HTMLElement {
1380
1459
  );
1381
1460
  };
1382
1461
  this.handleItemsChanged = (f) => {
1383
- f.stopPropagation(), y();
1462
+ f.stopPropagation(), h();
1384
1463
  };
1385
- const h = this.handleItemsChanged;
1464
+ const g = this.handleItemsChanged;
1386
1465
  u.addEventListener(
1387
1466
  "kaching-bundles-block-loaded",
1388
1467
  () => {
1389
- this.innerElement === u && (u.addEventListener("items-changed", h), this.dispatchEvent(new CustomEvent("loaded", { bubbles: !0 })));
1468
+ this.innerElement === u && (u.addEventListener("items-changed", g), this.dispatchEvent(new CustomEvent("loaded", { bubbles: !0 })));
1390
1469
  },
1391
1470
  { once: !0 }
1392
1471
  ), this.appendChild(this.innerElement);
@@ -1397,10 +1476,10 @@ class Me extends HTMLElement {
1397
1476
  this.handleItemsChanged
1398
1477
  ), this.handleItemsChanged = null), this.innerElement && (this.innerElement.remove(), this.innerElement = null);
1399
1478
  }
1400
- attributeChangedCallback(e, s, l) {
1401
- s !== l && this.isConnected && (e === "product-id" || e === "country" || e === "language" ? this.initialize() : e === "selected-variant-id" && this.innerElement && l && this.innerElement.setAttribute(
1479
+ attributeChangedCallback(t, a, s) {
1480
+ a !== s && this.isConnected && (t === "product-id" || t === "country" || t === "language" ? this.initialize() : t === "selected-variant-id" && this.innerElement && s && this.innerElement.setAttribute(
1402
1481
  "current-variant-id",
1403
- l.includes("/") ? String(l.split("/").pop()) : l
1482
+ s.includes("/") ? String(s.split("/").pop()) : s
1404
1483
  ));
1405
1484
  }
1406
1485
  items() {
@@ -1410,7 +1489,7 @@ class Me extends HTMLElement {
1410
1489
  this.cleanup(), this.initializeId++;
1411
1490
  }
1412
1491
  }
1413
- customElements.define("kaching-bundle-component", Me);
1492
+ customElements.define("kaching-bundle-component", Ue);
1414
1493
  export {
1415
- we as fetchKachingBundlesData
1494
+ xe as fetchKachingBundlesData
1416
1495
  };