@kachingappz/bundles-js 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles-js.iife.js +14 -11
- package/dist/index.d.ts +58 -9
- package/dist/index.js +86 -79
- package/dist/kaching-bundle-component/index.d.ts +58 -9
- package/dist/kaching-bundle-component/index.js +160 -138
- package/dist/react/index.cjs +14 -11
- package/dist/react/index.d.ts +58 -9
- package/dist/react/index.js +157 -135
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -31,7 +31,23 @@ var e = (e, { language: n, country: s }) => {
|
|
|
31
31
|
i = t.metaobjects.pageInfo.endCursor;
|
|
32
32
|
}
|
|
33
33
|
return r;
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
|
+
[
|
|
36
|
+
"primaryBackground",
|
|
37
|
+
"secondaryBackground",
|
|
38
|
+
"primaryText",
|
|
39
|
+
"secondaryText",
|
|
40
|
+
"border",
|
|
41
|
+
"overlay",
|
|
42
|
+
"primaryAccent",
|
|
43
|
+
"primaryAccentText",
|
|
44
|
+
"badgeBackground",
|
|
45
|
+
"badgeText",
|
|
46
|
+
"error"
|
|
47
|
+
].map((e) => `brand_${e}`);
|
|
48
|
+
var d = /* @__PURE__ */ function(e) {
|
|
49
|
+
return e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e;
|
|
50
|
+
}({}), f = async (e, { country: t, language: n, blockVisibility: r, excludedProductGIDs: i, selectedProductGIDs: a, selectedCollectionGIDs: o, limit: c = 1e3 }) => {
|
|
35
51
|
switch (r) {
|
|
36
52
|
case "selected-products": return a.slice(0, c);
|
|
37
53
|
case "all-products":
|
|
@@ -89,16 +105,16 @@ var e = (e, { language: n, country: s }) => {
|
|
|
89
105
|
return Array.from(new Set(i)).slice(0, c);
|
|
90
106
|
}
|
|
91
107
|
}
|
|
92
|
-
},
|
|
108
|
+
}, p = "\n id\n availableForSale\n price {\n amount\n }\n compareAtPrice {\n amount\n }\n selectedOptions {\n name\n value\n }\n image {\n id\n url(transform: $variantImageTransform)\n }\n unitPriceMeasurement {\n quantityUnit\n quantityValue\n referenceUnit\n referenceValue\n }\n requiresComponents\n sellingPlanAllocations(first: 100) @include(if: $includeSellingPlans) {\n nodes {\n sellingPlan {\n id\n }\n priceAdjustments {\n price {\n amount\n }\n compareAtPrice {\n amount\n }\n perDeliveryPrice {\n amount\n }\n }\n }\n }\n quantityAvailable @include(if: $includeAvailableQuantity)\n", m = async (e, { country: t, language: n, productIds: r, includeSellingPlans: i = !0, includeAvailableQuantity: a = !0, includeProductRating: o = !1, includeProductSubtitle: c = !1, productSubtitleMetafield: l = "descriptors.subtitle", useExternalMetafieldNamespace: u = !1, batchSize: d = 250, onBatchError: f, variantImageTransform: m = {
|
|
93
109
|
maxWidth: 200,
|
|
94
110
|
maxHeight: 200
|
|
95
111
|
} }) => {
|
|
96
112
|
if (!r.length) return [];
|
|
97
|
-
let
|
|
113
|
+
let _ = r.map((e) => typeof e == "string" && e.startsWith("gid://") ? e : `gid://shopify/Product/${e}`), v = s({
|
|
98
114
|
country: t,
|
|
99
115
|
language: n
|
|
100
|
-
}),
|
|
101
|
-
query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $includeProductRating: Boolean!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${
|
|
116
|
+
}), y = `
|
|
117
|
+
query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $includeProductRating: Boolean!, $includeProductSubtitle: Boolean!, $subtitleNamespace: String!, $subtitleKey: String!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${v} {
|
|
102
118
|
shop {
|
|
103
119
|
currencyRateConstant: metafield(namespace: $metafieldNamespace, key: "currency_rate_constant") {
|
|
104
120
|
value
|
|
@@ -132,7 +148,7 @@ var e = (e, { language: n, country: s }) => {
|
|
|
132
148
|
}
|
|
133
149
|
variants(first: 250) {
|
|
134
150
|
nodes {
|
|
135
|
-
${
|
|
151
|
+
${p}
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
154
|
collections(first: 50) {
|
|
@@ -158,6 +174,9 @@ var e = (e, { language: n, country: s }) => {
|
|
|
158
174
|
reviewsRatingCount: metafield(namespace: "reviews", key: "rating_count") @include(if: $includeProductRating) {
|
|
159
175
|
value
|
|
160
176
|
}
|
|
177
|
+
subtitle: metafield(namespace: $subtitleNamespace, key: $subtitleKey) @include(if: $includeProductSubtitle) {
|
|
178
|
+
value
|
|
179
|
+
}
|
|
161
180
|
requiresSellingPlan
|
|
162
181
|
sellingPlanGroups(first: 100) @include(if: $includeSellingPlans) {
|
|
163
182
|
nodes {
|
|
@@ -190,40 +209,43 @@ var e = (e, { language: n, country: s }) => {
|
|
|
190
209
|
}
|
|
191
210
|
}
|
|
192
211
|
}
|
|
193
|
-
`,
|
|
194
|
-
for (let e = 0; e <
|
|
195
|
-
let
|
|
196
|
-
let n = await e.query(
|
|
212
|
+
`, b = u ? "app--2935586817--kaching_bundles" : "$app:kaching_bundles", x = l.indexOf("."), S = l.slice(0, x), C = l.slice(x + 1), w = [], T = Math.min(d, 250);
|
|
213
|
+
for (let e = 0; e < _.length; e += T) w.push(_.slice(e, e + T));
|
|
214
|
+
let E = 1, D = async (t) => {
|
|
215
|
+
let n = await e.query(y, { variables: {
|
|
197
216
|
productGIDs: t,
|
|
198
217
|
includeSellingPlans: i,
|
|
199
218
|
includeAvailableQuantity: a,
|
|
200
219
|
includeProductRating: o,
|
|
201
|
-
|
|
202
|
-
|
|
220
|
+
includeProductSubtitle: c,
|
|
221
|
+
subtitleNamespace: S,
|
|
222
|
+
subtitleKey: C,
|
|
223
|
+
metafieldNamespace: b,
|
|
224
|
+
variantImageTransform: m
|
|
203
225
|
} });
|
|
204
|
-
return n.shop.currencyRateConstant && (
|
|
205
|
-
},
|
|
206
|
-
if (
|
|
207
|
-
let e = await Promise.allSettled(
|
|
208
|
-
for (let t of e) t.status === "rejected" &&
|
|
209
|
-
|
|
210
|
-
} else
|
|
211
|
-
let
|
|
212
|
-
if (
|
|
213
|
-
let t = await Promise.allSettled(
|
|
226
|
+
return n.shop.currencyRateConstant && (E = JSON.parse(n.shop.currencyRateConstant.value).amount / 1e6), n;
|
|
227
|
+
}, O;
|
|
228
|
+
if (f) {
|
|
229
|
+
let e = await Promise.allSettled(w.map(D));
|
|
230
|
+
for (let t of e) t.status === "rejected" && f(t.reason instanceof Error ? t.reason : Error(String(t.reason)));
|
|
231
|
+
O = e.filter((e) => e.status === "fulfilled").flatMap((e) => e.value.nodes);
|
|
232
|
+
} else O = (await Promise.all(w.map(D))).flatMap((e) => e.nodes);
|
|
233
|
+
let k = O.filter((e) => e != null);
|
|
234
|
+
if (f) {
|
|
235
|
+
let t = await Promise.allSettled(k.map(async (t) => g(await h(e, t, {
|
|
214
236
|
includeSellingPlans: i,
|
|
215
237
|
includeAvailableQuantity: a,
|
|
216
|
-
variantImageTransform:
|
|
217
|
-
},
|
|
218
|
-
for (let e of t) e.status === "fulfilled" ? n.push(e.value) :
|
|
238
|
+
variantImageTransform: m
|
|
239
|
+
}, v), e.shopifyDomain, E))), n = [];
|
|
240
|
+
for (let e of t) e.status === "fulfilled" ? n.push(e.value) : f(e.reason instanceof Error ? e.reason : Error(String(e.reason)));
|
|
219
241
|
return n;
|
|
220
242
|
}
|
|
221
|
-
return (await Promise.all(
|
|
243
|
+
return (await Promise.all(k.map((t) => h(e, t, {
|
|
222
244
|
includeSellingPlans: i,
|
|
223
245
|
includeAvailableQuantity: a,
|
|
224
|
-
variantImageTransform:
|
|
225
|
-
},
|
|
226
|
-
},
|
|
246
|
+
variantImageTransform: m
|
|
247
|
+
}, v)))).map((t) => g(t, e.shopifyDomain, E));
|
|
248
|
+
}, h = async (e, t, n, r = "") => {
|
|
227
249
|
if (t.variants.nodes.length < 250) return t;
|
|
228
250
|
let i = /* @__PURE__ */ new Set(), a = [], o = [], s = async (s) => {
|
|
229
251
|
let c = !0, l = null;
|
|
@@ -233,7 +255,7 @@ var e = (e, { language: n, country: s }) => {
|
|
|
233
255
|
product(id: $productGID) {
|
|
234
256
|
variants(first: 250, after: $cursor, reverse: $reverse) {
|
|
235
257
|
nodes {
|
|
236
|
-
${
|
|
258
|
+
${p}
|
|
237
259
|
}
|
|
238
260
|
pageInfo {
|
|
239
261
|
endCursor
|
|
@@ -259,7 +281,7 @@ var e = (e, { language: n, country: s }) => {
|
|
|
259
281
|
}
|
|
260
282
|
};
|
|
261
283
|
return await Promise.all([s(!1), s(!0)]), t.variants.nodes = [...a, ...o.reverse()], t;
|
|
262
|
-
},
|
|
284
|
+
}, g = (e, t, n) => {
|
|
263
285
|
let r = e.variants.nodes.map(({ unitPriceMeasurement: e, ...t }) => ({
|
|
264
286
|
id: Number(t.id.split("/").pop()),
|
|
265
287
|
availableForSale: t.availableForSale,
|
|
@@ -297,7 +319,7 @@ var e = (e, { language: n, country: s }) => {
|
|
|
297
319
|
defaultName: e.name,
|
|
298
320
|
name: e.name,
|
|
299
321
|
position: t + 1,
|
|
300
|
-
optionValues:
|
|
322
|
+
optionValues: y(n, t, r)
|
|
301
323
|
};
|
|
302
324
|
}), a = (e) => {
|
|
303
325
|
let t = e.priceAdjustments[0];
|
|
@@ -344,26 +366,27 @@ var e = (e, { language: n, country: s }) => {
|
|
|
344
366
|
text3: e.metafield3?.value || null,
|
|
345
367
|
text4: e.metafield4?.value || null
|
|
346
368
|
},
|
|
347
|
-
rating:
|
|
369
|
+
rating: _(e.reviewsRating, e.reviewsRatingCount),
|
|
370
|
+
subtitle: e.subtitle?.value || null
|
|
348
371
|
};
|
|
349
|
-
},
|
|
372
|
+
}, _ = (e, t) => {
|
|
350
373
|
if (!e) return null;
|
|
351
|
-
let n =
|
|
374
|
+
let n = v(e.value);
|
|
352
375
|
if (n === null) return null;
|
|
353
376
|
let r = Number(t?.value);
|
|
354
377
|
return {
|
|
355
378
|
value: n,
|
|
356
379
|
count: Number.isInteger(r) && r > 0 ? r : null
|
|
357
380
|
};
|
|
358
|
-
},
|
|
381
|
+
}, v = (e) => {
|
|
359
382
|
try {
|
|
360
383
|
let { value: t, scale_max: n } = JSON.parse(e), r = Number(t) / Number(n) * 5;
|
|
361
384
|
return Number.isFinite(r) && r > 0 ? Math.min(5, r) : null;
|
|
362
385
|
} catch {
|
|
363
386
|
return null;
|
|
364
387
|
}
|
|
365
|
-
},
|
|
366
|
-
let a = i ? `${
|
|
388
|
+
}, y = (e, t, n) => e.filter((e) => n.filter((n) => n.options[t] === e.name).length > 0), b = "app--2935586817", x = async (t, { language: n, country: r, useExternalMetafieldNamespace: i }) => {
|
|
389
|
+
let a = i ? `${b}--kaching_bundles` : "$app:kaching_bundles", o = i ? b : "$app", c = s({ country: r }), { localization: { country: { currency: { isoCode: l } } }, shop: { moneyFormat: u, paymentSettings: { currencyCode: d }, currencyRateConstant: f, primaryDomain: p, settingsMetafield: m } } = await t.query(`
|
|
367
390
|
query config($metafieldNamespace: String!, $settingsNamespace: String!) ${c} {
|
|
368
391
|
localization {
|
|
369
392
|
country {
|
|
@@ -394,7 +417,7 @@ var e = (e, { language: n, country: s }) => {
|
|
|
394
417
|
} }), h = l === d ? u : e(l, {
|
|
395
418
|
language: n,
|
|
396
419
|
country: r
|
|
397
|
-
}), g = f ?
|
|
420
|
+
}), g = f ? S(f.value) : 1, _ = m ? JSON.parse(m.value) : null, v = _?.feature_flags ?? {}, y = _?.custom_selectors ?? {};
|
|
398
421
|
return {
|
|
399
422
|
shopifyDomain: p.host,
|
|
400
423
|
moneyFormat: h,
|
|
@@ -445,17 +468,17 @@ var e = (e, { language: n, country: s }) => {
|
|
|
445
468
|
"system.numbers_only": "Only numbers are allowed."
|
|
446
469
|
},
|
|
447
470
|
customSelectors: {
|
|
448
|
-
quantity:
|
|
449
|
-
addToCartButton:
|
|
450
|
-
variantPicker:
|
|
451
|
-
price:
|
|
452
|
-
priceCompare:
|
|
471
|
+
quantity: y.quantity ?? null,
|
|
472
|
+
addToCartButton: y.add_to_cart_button ?? null,
|
|
473
|
+
variantPicker: y.variant_picker ?? null,
|
|
474
|
+
price: y.price ?? null,
|
|
475
|
+
priceCompare: y.price_compare ?? null
|
|
453
476
|
},
|
|
454
477
|
shopCustomStyles: _?.shop_custom_styles ?? "",
|
|
455
478
|
featureFlags: v,
|
|
456
479
|
brandColors: _?.brand_colors ?? null
|
|
457
480
|
};
|
|
458
|
-
},
|
|
481
|
+
}, S = (e) => JSON.parse(e).amount / 1e6, C = async (e, t, n = 200) => {
|
|
459
482
|
let r = [...new Set(t.filter(Boolean).filter((e) => !e.startsWith("placeholder")))];
|
|
460
483
|
if (r.length === 0) return [];
|
|
461
484
|
let i = [];
|
|
@@ -467,44 +490,28 @@ var e = (e, { language: n, country: s }) => {
|
|
|
467
490
|
gid: e.id,
|
|
468
491
|
url: e.image.url
|
|
469
492
|
}] : []);
|
|
470
|
-
}
|
|
471
|
-
[
|
|
472
|
-
"primaryBackground",
|
|
473
|
-
"secondaryBackground",
|
|
474
|
-
"primaryText",
|
|
475
|
-
"secondaryText",
|
|
476
|
-
"border",
|
|
477
|
-
"overlay",
|
|
478
|
-
"primaryAccent",
|
|
479
|
-
"primaryAccentText",
|
|
480
|
-
"badgeBackground",
|
|
481
|
-
"badgeText",
|
|
482
|
-
"error"
|
|
483
|
-
].map((e) => `brand_${e}`);
|
|
484
|
-
var C = /* @__PURE__ */ function(e) {
|
|
485
|
-
return e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e;
|
|
486
|
-
}({}), w = (e) => [
|
|
493
|
+
}, w = (e) => [
|
|
487
494
|
...T(e),
|
|
488
495
|
...E(e),
|
|
489
|
-
...ee(e),
|
|
490
496
|
...D(e),
|
|
491
497
|
...O(e),
|
|
492
498
|
...k(e),
|
|
493
499
|
...A(e),
|
|
494
500
|
...j(e),
|
|
501
|
+
...ee(e),
|
|
495
502
|
...M(e),
|
|
496
503
|
...N(e),
|
|
497
504
|
...P(e),
|
|
498
505
|
...F(e),
|
|
499
506
|
...I(e)
|
|
500
|
-
].filter((e) => e != null && !e.includes("placeholder")), T = (e) => e.dealBars.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), E = (e) => e.dealBars.flatMap((e) => e.dealBarType ===
|
|
507
|
+
].filter((e) => e != null && !e.includes("placeholder")), T = (e) => e.dealBars.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), E = (e) => e.dealBars.flatMap((e) => e.dealBarType === d.Bundle ? e.bundleProducts.map((e) => e.mediaImageGID) : []).filter((e) => e != null), D = (e) => e.dealBars.map(({ freeGifts: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), O = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => (e || []).map((e) => e.mediaImageGID)).filter((e) => e != null), k = (e) => e.dealBars.map(({ upsells: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), A = (e) => e.swatchOptions ? e.swatchOptions.reduce((e, t) => {
|
|
501
508
|
let n = t.images.map((e) => e.mediaImageGID).filter((e) => e != null);
|
|
502
509
|
return [...e, ...n];
|
|
503
|
-
}, []) : [],
|
|
510
|
+
}, []) : [], j = (e) => {
|
|
504
511
|
if (!e.collectionBreaksEnabled || !e.collectionBreaks) return [];
|
|
505
512
|
let t = e.collectionBreaks.mediaImageGID;
|
|
506
513
|
return t ? [t] : [];
|
|
507
|
-
},
|
|
514
|
+
}, ee = (e) => e.progressiveGifts ? [
|
|
508
515
|
...e.progressiveGifts.gifts?.map((e) => e.mediaImageGID) || [],
|
|
509
516
|
e.progressiveGifts.style?.lockedMediaImageGID,
|
|
510
517
|
e.progressiveGifts.dealBarStyle?.lockedMediaImageGID
|
|
@@ -523,7 +530,7 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
523
530
|
...G(e)
|
|
524
531
|
];
|
|
525
532
|
return Array.from(new Set(t.filter((e) => e != null)));
|
|
526
|
-
}, R = (e) => e.dealBars.flatMap(({ freeGifts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), z = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => e ? e.flatMap((e) => e.products ? e.products.map((e) => e.id) : []) : []).filter((e) => e != null), B = (e) => e.progressiveGiftsEnabled && e.progressiveGifts?.gifts.map((e) => e.productGID).filter((e) => e != null) || [], V = (e) => e.dealBars.flatMap(({ upsells: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), H = (e) => e.dealBars.filter((e) => e.dealBarType ===
|
|
533
|
+
}, R = (e) => e.dealBars.flatMap(({ freeGifts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), z = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => e ? e.flatMap((e) => e.products ? e.products.map((e) => e.id) : []) : []).filter((e) => e != null), B = (e) => e.progressiveGiftsEnabled && e.progressiveGifts?.gifts.map((e) => e.productGID).filter((e) => e != null) || [], V = (e) => e.dealBars.flatMap(({ upsells: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), H = (e) => e.dealBars.filter((e) => e.dealBarType === d.Bundle).flatMap(({ bundleProducts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null).filter((e) => e !== "default"), U = (e) => e.dealBars.filter((e) => e.dealBarType === d.MixAndMatch).flatMap(({ bundleProducts: e }) => e ? e.flatMap((e) => [e.productGID, ...e.selectedProducts?.map((e) => e.id) ?? []]) : []).filter((e) => e != null).filter((e) => e !== "default"), W = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.map((e) => e.productGID).filter((e) => e != null), G = (e) => e.dealBars.filter((e) => e.dealBarType === d.Sku).flatMap(({ productGID: e }) => e ? [e] : []), K = class extends Error {
|
|
527
534
|
constructor({ status: e, operationName: t, graphqlErrors: n }) {
|
|
528
535
|
let r = n.length ? `: ${n.join("; ")}` : "";
|
|
529
536
|
super(`Storefront API ${t ?? "query"} failed (HTTP ${e})${r}`), this.name = "StorefrontApiError", this.status = e, this.operationName = t, this.graphqlErrors = n;
|
|
@@ -579,14 +586,14 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
579
586
|
let i = t.collectionBreaks;
|
|
580
587
|
if (!t.collectionBreaksEnabled || !i) return;
|
|
581
588
|
let a;
|
|
582
|
-
a = i.visibility === "deal-products" ? await
|
|
589
|
+
a = i.visibility === "deal-products" ? await f(e, {
|
|
583
590
|
country: n,
|
|
584
591
|
language: r,
|
|
585
592
|
blockVisibility: t.blockVisibility,
|
|
586
593
|
excludedProductGIDs: (t.excludedProductIds || []).map((e) => `gid://shopify/Product/${e}`),
|
|
587
594
|
selectedProductGIDs: (t.selectedProductIds || []).map((e) => `gid://shopify/Product/${e}`),
|
|
588
595
|
selectedCollectionGIDs: (t.selectedCollectionIds || []).map((e) => `gid://shopify/Collection/${e}`)
|
|
589
|
-
}) : await
|
|
596
|
+
}) : await f(e, {
|
|
590
597
|
country: n,
|
|
591
598
|
language: r,
|
|
592
599
|
blockVisibility: i.visibility,
|
|
@@ -594,7 +601,7 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
594
601
|
selectedProductGIDs: (i.selectedProducts || []).map(({ id: e }) => e),
|
|
595
602
|
selectedCollectionGIDs: (i.selectedCollections || []).map(({ id: e }) => e)
|
|
596
603
|
});
|
|
597
|
-
let o = await
|
|
604
|
+
let o = await m(e, {
|
|
598
605
|
country: n,
|
|
599
606
|
language: r,
|
|
600
607
|
productIds: a.map((e) => Number(e.split("/").pop())),
|
|
@@ -649,13 +656,13 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
649
656
|
try {
|
|
650
657
|
let a = [Number(t.split("/").pop())], o = new re(e);
|
|
651
658
|
r ||= o.i18n?.country, i ||= o.i18n?.language;
|
|
652
|
-
let s = await
|
|
659
|
+
let s = await x(o, {
|
|
653
660
|
language: i,
|
|
654
661
|
country: r,
|
|
655
662
|
useExternalMetafieldNamespace: !0
|
|
656
663
|
});
|
|
657
664
|
o.shopifyDomain = s.shopifyDomain;
|
|
658
|
-
let l = s.storefrontAccessToken ? new J(s.shopifyDomain, s.storefrontAccessToken) : o, [u, d] = await Promise.all([
|
|
665
|
+
let l = s.storefrontAccessToken ? new J(s.shopifyDomain, s.storefrontAccessToken) : o, [u, d] = await Promise.all([m(l, {
|
|
659
666
|
country: r,
|
|
660
667
|
language: i,
|
|
661
668
|
productIds: a,
|
|
@@ -665,16 +672,16 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
665
672
|
useMetaobjects: s.featureFlags.storefront_metaobjects
|
|
666
673
|
})]), f = u[0];
|
|
667
674
|
if (!f) return null;
|
|
668
|
-
let
|
|
669
|
-
if (n ? (h =
|
|
670
|
-
let g = w(h), _ = L(h), [v, y,
|
|
671
|
-
|
|
675
|
+
let p = Y(d, f), h;
|
|
676
|
+
if (n ? (h = p.find((e) => e.id === n || e.nanoId === n), h ||= p[0]) : h = p[0], !h) return null;
|
|
677
|
+
let g = w(h), _ = L(h), [v, y, b, S] = await Promise.all([
|
|
678
|
+
m(l, {
|
|
672
679
|
country: r,
|
|
673
680
|
language: i,
|
|
674
681
|
productIds: _,
|
|
675
682
|
useExternalMetafieldNamespace: !0
|
|
676
683
|
}),
|
|
677
|
-
|
|
684
|
+
C(l, g, 300),
|
|
678
685
|
X(l, h, {
|
|
679
686
|
country: r,
|
|
680
687
|
language: i
|
|
@@ -690,8 +697,8 @@ var C = /* @__PURE__ */ function(e) {
|
|
|
690
697
|
config: s,
|
|
691
698
|
otherProducts: v,
|
|
692
699
|
mediaImages: y,
|
|
693
|
-
collectionBreaksProducts:
|
|
694
|
-
translations:
|
|
700
|
+
collectionBreaksProducts: b ?? [],
|
|
701
|
+
translations: S
|
|
695
702
|
};
|
|
696
703
|
} catch (e) {
|
|
697
704
|
return console.error(e), null;
|
|
@@ -64,6 +64,7 @@ declare interface BaseDealBar {
|
|
|
64
64
|
freeGiftsSummary?: FreeGiftsSummary | null;
|
|
65
65
|
multipleGiftsSelectors?: MultipleGiftsSelector[];
|
|
66
66
|
upsells: Upsell[];
|
|
67
|
+
sectionsOrder?: DealBarSection[];
|
|
67
68
|
productPersonalisation: ProductPersonalisation | null;
|
|
68
69
|
highlights?: Highlights | null;
|
|
69
70
|
sellingPlanEnabled?: boolean;
|
|
@@ -96,7 +97,7 @@ declare type BrandColorKey = (typeof BRAND_COLOR_KEYS)[number];
|
|
|
96
97
|
|
|
97
98
|
declare type BrandColors = Record<BrandColorKey, string>;
|
|
98
99
|
|
|
99
|
-
declare interface BundleDealBar extends BaseDealBar, ShowAsSoldOutFeature
|
|
100
|
+
declare interface BundleDealBar extends BaseDealBar, ShowAsSoldOutFeature {
|
|
100
101
|
dealBarType: DealBarType.Bundle;
|
|
101
102
|
layout?: "horizontal" | "vertical";
|
|
102
103
|
quantitySelector: boolean;
|
|
@@ -117,7 +118,7 @@ declare interface BundleProduct {
|
|
|
117
118
|
hidePrice?: boolean;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
declare interface BxgyDealBar extends BaseDealBar, ShowAsSoldOutFeature
|
|
121
|
+
declare interface BxgyDealBar extends BaseDealBar, ShowAsSoldOutFeature {
|
|
121
122
|
dealBarType: DealBarType.Bxgy;
|
|
122
123
|
buyQuantity: number;
|
|
123
124
|
buyDiscountType?: DiscountType;
|
|
@@ -258,6 +259,8 @@ declare type DealBarProgressiveGiftStyle = {
|
|
|
258
259
|
lockedMediaImageGID: string | null;
|
|
259
260
|
};
|
|
260
261
|
|
|
262
|
+
declare type DealBarSection = (typeof DEFAULT_DEAL_BAR_SECTIONS_ORDER)[number];
|
|
263
|
+
|
|
261
264
|
declare enum DealBarType {
|
|
262
265
|
QuantityBreak = "quantity-break",
|
|
263
266
|
Bxgy = "bxgy",
|
|
@@ -295,6 +298,7 @@ declare type DealBlock = {
|
|
|
295
298
|
startTimestamp: number;
|
|
296
299
|
endTimestamp: number | null;
|
|
297
300
|
differentVariantsEnabled: boolean;
|
|
301
|
+
requireVariantSelectionEnabled?: boolean;
|
|
298
302
|
hideVariantPicker: boolean;
|
|
299
303
|
disableVariantOptionSync?: boolean;
|
|
300
304
|
hideUnavailableOptions?: boolean;
|
|
@@ -402,6 +406,8 @@ declare type DealBlock = {
|
|
|
402
406
|
lowStockAlert: LowStockAlert | null;
|
|
403
407
|
};
|
|
404
408
|
|
|
409
|
+
declare const DEFAULT_DEAL_BAR_SECTIONS_ORDER: readonly ["upsells", "freeGifts", "multipleGiftsSelectors"];
|
|
410
|
+
|
|
405
411
|
declare type DefaultSortOption = "relevance" | "newest-first" | "price-low-to-high" | "price-high-to-low";
|
|
406
412
|
|
|
407
413
|
declare type DiscountType = "default" | "percentage" | "amount" | "specific";
|
|
@@ -429,6 +435,7 @@ declare type FreeGift = {
|
|
|
429
435
|
text: string;
|
|
430
436
|
imageSize: number;
|
|
431
437
|
quantity: number;
|
|
438
|
+
matchQuantityWithDealBar?: boolean;
|
|
432
439
|
showPrice: boolean;
|
|
433
440
|
includeInCompareAt?: boolean;
|
|
434
441
|
applyOnlyForSubscriptions: boolean;
|
|
@@ -462,6 +469,7 @@ declare interface GlobalConfig {
|
|
|
462
469
|
ignoreUnitPrice: boolean;
|
|
463
470
|
requireCustomerLogin: boolean;
|
|
464
471
|
abTestsRunning: boolean;
|
|
472
|
+
cartKachingSessionId?: string | null;
|
|
465
473
|
webPixel: boolean;
|
|
466
474
|
b2bCustomer: boolean;
|
|
467
475
|
isLoggedIn: boolean;
|
|
@@ -577,6 +585,47 @@ declare interface GlobalConfig {
|
|
|
577
585
|
"system.deal_page_rating_count_other"?: string;
|
|
578
586
|
"system.deal_page_rating_count_few"?: string;
|
|
579
587
|
"system.deal_page_rating_count_many"?: string;
|
|
588
|
+
"system.deal_page_gift_badge_shipping"?: string;
|
|
589
|
+
"system.deal_page_gift_badge_one"?: string;
|
|
590
|
+
"system.deal_page_gift_badge_other"?: string;
|
|
591
|
+
"system.deal_page_gift_badge_few"?: string;
|
|
592
|
+
"system.deal_page_gift_badge_many"?: string;
|
|
593
|
+
"system.deal_page_gifts_title"?: string;
|
|
594
|
+
"system.deal_page_your_gifts_title"?: string;
|
|
595
|
+
"system.deal_page_free_shipping"?: string;
|
|
596
|
+
"system.deal_page_gift_unlocks_at_one"?: string;
|
|
597
|
+
"system.deal_page_gift_unlocks_at_other"?: string;
|
|
598
|
+
"system.deal_page_gift_unlocks_at_few"?: string;
|
|
599
|
+
"system.deal_page_gift_unlocks_at_many"?: string;
|
|
600
|
+
"system.deal_page_choose_option"?: string;
|
|
601
|
+
"system.deal_page_change"?: string;
|
|
602
|
+
"system.deal_page_choose_gift_option"?: string;
|
|
603
|
+
"system.deal_page_your_gifts_row_one"?: string;
|
|
604
|
+
"system.deal_page_your_gifts_row_other"?: string;
|
|
605
|
+
"system.deal_page_your_gifts_row_few"?: string;
|
|
606
|
+
"system.deal_page_your_gifts_row_many"?: string;
|
|
607
|
+
"system.deal_page_free"?: string;
|
|
608
|
+
"system.deal_page_gift_count_one"?: string;
|
|
609
|
+
"system.deal_page_gift_count_other"?: string;
|
|
610
|
+
"system.deal_page_gift_count_few"?: string;
|
|
611
|
+
"system.deal_page_gift_count_many"?: string;
|
|
612
|
+
"system.deal_page_percentage_gifts_unlocked"?: string;
|
|
613
|
+
"system.deal_page_box_of_gifts"?: string;
|
|
614
|
+
"system.deal_page_gifts_unlocked"?: string;
|
|
615
|
+
"system.deal_page_gift_phrase_shipping"?: string;
|
|
616
|
+
"system.deal_page_gift_phrase_one"?: string;
|
|
617
|
+
"system.deal_page_gift_phrase_other"?: string;
|
|
618
|
+
"system.deal_page_gift_phrase_few"?: string;
|
|
619
|
+
"system.deal_page_gift_phrase_many"?: string;
|
|
620
|
+
"system.deal_page_nudge_start_offer_one"?: string;
|
|
621
|
+
"system.deal_page_nudge_start_offer_other"?: string;
|
|
622
|
+
"system.deal_page_nudge_start_offer_few"?: string;
|
|
623
|
+
"system.deal_page_nudge_start_offer_many"?: string;
|
|
624
|
+
"system.deal_page_nudge_more_offer_one"?: string;
|
|
625
|
+
"system.deal_page_nudge_more_offer_other"?: string;
|
|
626
|
+
"system.deal_page_nudge_more_offer_few"?: string;
|
|
627
|
+
"system.deal_page_nudge_more_offer_many"?: string;
|
|
628
|
+
"system.deal_page_offer_with_gifts"?: string;
|
|
580
629
|
"system.deal_page_promotion_percentage"?: string;
|
|
581
630
|
};
|
|
582
631
|
customSelectors: {
|
|
@@ -588,12 +637,13 @@ declare interface GlobalConfig {
|
|
|
588
637
|
label?: string | null;
|
|
589
638
|
};
|
|
590
639
|
featureFlags: {
|
|
640
|
+
analytics_tracking_disabled?: boolean;
|
|
591
641
|
atc_total_price?: boolean;
|
|
592
642
|
cart_change_response_rewrite?: boolean;
|
|
593
643
|
cart_interceptor_dedupe_disabled?: boolean;
|
|
594
644
|
debug_cart_add?: boolean;
|
|
595
645
|
disable_nested_cart_lines?: boolean;
|
|
596
|
-
|
|
646
|
+
early_xhr_wrapper?: boolean;
|
|
597
647
|
hide_missing_variants?: boolean;
|
|
598
648
|
initialize_with_form_variant?: boolean;
|
|
599
649
|
intercept_cart_request?: boolean;
|
|
@@ -695,7 +745,7 @@ declare interface MixAndMatchChooseProductModal {
|
|
|
695
745
|
buttonText: string;
|
|
696
746
|
}
|
|
697
747
|
|
|
698
|
-
declare interface MixAndMatchDealBar extends BaseDealBar, ShowAsSoldOutFeature
|
|
748
|
+
declare interface MixAndMatchDealBar extends BaseDealBar, ShowAsSoldOutFeature {
|
|
699
749
|
dealBarType: DealBarType.MixAndMatch;
|
|
700
750
|
discountType: DiscountType;
|
|
701
751
|
discountValue: string | number;
|
|
@@ -762,6 +812,7 @@ declare interface Product {
|
|
|
762
812
|
text4: string | null;
|
|
763
813
|
};
|
|
764
814
|
rating?: ProductRating | null;
|
|
815
|
+
subtitle?: string | null;
|
|
765
816
|
}
|
|
766
817
|
|
|
767
818
|
declare interface ProductOption {
|
|
@@ -807,6 +858,8 @@ declare type ProgressiveGift = {
|
|
|
807
858
|
mediaImageGID: string | null;
|
|
808
859
|
unlockAtBar: number;
|
|
809
860
|
unlockAtBarOnly?: boolean;
|
|
861
|
+
unlockAtScope?: "and-higher" | "only" | "custom";
|
|
862
|
+
unlockDealBarIds?: string[];
|
|
810
863
|
label: string;
|
|
811
864
|
labelCrossedOut: string;
|
|
812
865
|
title: string;
|
|
@@ -858,7 +911,7 @@ declare type ProgressiveGiftsStyle = {
|
|
|
858
911
|
lockedMediaImageGID: string | null;
|
|
859
912
|
};
|
|
860
913
|
|
|
861
|
-
declare interface QuantityBreakDealBar extends BaseDealBar, ShowAsSoldOutFeature
|
|
914
|
+
declare interface QuantityBreakDealBar extends BaseDealBar, ShowAsSoldOutFeature {
|
|
862
915
|
dealBarType?: DealBarType.QuantityBreak;
|
|
863
916
|
quantity: number | string;
|
|
864
917
|
discountType: DiscountType;
|
|
@@ -877,10 +930,6 @@ declare type RequireItemSelectionAlert = {
|
|
|
877
930
|
backgroundColor: Color;
|
|
878
931
|
};
|
|
879
932
|
|
|
880
|
-
declare interface RequireVariantSelectionFeature {
|
|
881
|
-
requireVariantSelectionEnabled?: boolean;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
933
|
declare type SavingsSummary = {
|
|
885
934
|
title: string;
|
|
886
935
|
backgroundColor: Color;
|