@kachingappz/bundles-js 1.1.2 → 1.1.3
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 +24 -18
- package/dist/index.d.ts +16 -1
- package/dist/index.js +603 -928
- package/dist/kaching-bundle-component/index.d.ts +16 -1
- package/dist/kaching-bundle-component/index.js +1110 -1356
- package/dist/react/index.cjs +23 -17
- package/dist/react/index.d.ts +16 -1
- package/dist/react/index.js +1078 -1431
- package/package.json +6 -11
|
@@ -1,136 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
country: e,
|
|
47
|
-
language: t
|
|
48
|
-
}) => {
|
|
49
|
-
const s = [];
|
|
50
|
-
return e && s.push(`country: ${e}`), t && s.push(`language: ${t}`), s.length > 0 ? `@inContext(${s.join(", ")})` : "";
|
|
51
|
-
}, H = async (e, {
|
|
52
|
-
useExternalMetafieldNamespace: t,
|
|
53
|
-
useMetaobjects: s
|
|
54
|
-
}) => s ? W(
|
|
55
|
-
e
|
|
56
|
-
) : X(e), X = async (e, t) => {
|
|
57
|
-
var a;
|
|
58
|
-
const s = (a = (await e.query(
|
|
59
|
-
`
|
|
60
|
-
query FetchDealBlocks($metafieldNamespace: String!) {
|
|
61
|
-
shop {
|
|
62
|
-
metafield(namespace: $metafieldNamespace, key: "deal_blocks") {
|
|
63
|
-
value
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`,
|
|
68
|
-
{
|
|
69
|
-
variables: {
|
|
70
|
-
metafieldNamespace: "app--2935586817--kaching_bundles"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
)).shop.metafield) == null ? void 0 : a.value;
|
|
74
|
-
return s ? JSON.parse(s) : [];
|
|
75
|
-
}, W = async (e, t) => {
|
|
76
|
-
const s = "app--2935586817--deal_block", a = [];
|
|
77
|
-
let n = null;
|
|
78
|
-
for (; ; ) {
|
|
79
|
-
const i = await e.query(
|
|
80
|
-
`
|
|
81
|
-
query FetchDealBlockMetaobjects($type: String!, $cursor: String) {
|
|
82
|
-
metaobjects(type: $type, first: 250, after: $cursor) {
|
|
83
|
-
nodes {
|
|
84
|
-
fields {
|
|
85
|
-
key
|
|
86
|
-
value
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
pageInfo {
|
|
90
|
-
hasNextPage
|
|
91
|
-
endCursor
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
`,
|
|
96
|
-
{
|
|
97
|
-
variables: {
|
|
98
|
-
type: s,
|
|
99
|
-
cursor: n
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
for (const o of i.metaobjects.nodes) {
|
|
104
|
-
const r = o.fields.find(
|
|
105
|
-
(m) => m.key === "settings"
|
|
106
|
-
);
|
|
107
|
-
r != null && r.value && a.push(JSON.parse(r.value));
|
|
108
|
-
}
|
|
109
|
-
if (!i.metaobjects.pageInfo.hasNextPage)
|
|
110
|
-
break;
|
|
111
|
-
n = i.metaobjects.pageInfo.endCursor;
|
|
112
|
-
}
|
|
113
|
-
return a;
|
|
114
|
-
}, N = async (e, {
|
|
115
|
-
country: t,
|
|
116
|
-
language: s,
|
|
117
|
-
blockVisibility: a,
|
|
118
|
-
excludedProductGIDs: n,
|
|
119
|
-
selectedProductGIDs: i,
|
|
120
|
-
selectedCollectionGIDs: o,
|
|
121
|
-
limit: r = 1e3
|
|
122
|
-
}) => {
|
|
123
|
-
switch (a) {
|
|
124
|
-
case "selected-products":
|
|
125
|
-
return i.slice(0, r);
|
|
126
|
-
case "all-products":
|
|
127
|
-
case "excluded-products": {
|
|
128
|
-
const m = w({ country: t, language: s });
|
|
129
|
-
let c = [], u = null;
|
|
130
|
-
for (; c.length < r; ) {
|
|
131
|
-
const h = Math.min(r - c.length, 250), g = await e.query(
|
|
132
|
-
`
|
|
133
|
-
query FetchProductGIDs($limit: Int!, $cursor: String) ${m} {
|
|
1
|
+
// ../bundles-storefront-api/dist/buildMarketMoneyFormat.js
|
|
2
|
+
var e = (e, { language: n, country: s }) => {
|
|
3
|
+
let c = i(n, s), l = new Intl.NumberFormat(c, {
|
|
4
|
+
style: "currency",
|
|
5
|
+
currency: e,
|
|
6
|
+
currencyDisplay: "narrowSymbol"
|
|
7
|
+
}).formatToParts(1234567.89), u = l.find((e) => e.type === "decimal")?.value, d = o(a(l.find((e) => e.type === "group")?.value), u, l.some((e) => e.type === "fraction")), f = l.findIndex(r), p = l.findLastIndex(r);
|
|
8
|
+
return [
|
|
9
|
+
...l.slice(0, f).map(t),
|
|
10
|
+
d,
|
|
11
|
+
...l.slice(p + 1).map(t)
|
|
12
|
+
].join("");
|
|
13
|
+
}, t = (e) => n(e.value), n = (e) => e.replace(/\s/g, " "), r = (e) => e.type === "integer" || e.type === "group" || e.type === "decimal" || e.type === "fraction", i = (e, t) => e && t ? `${e}-${t.toUpperCase()}` : e || (t ? t.toUpperCase() : "en"), a = (e) => e === void 0 ? void 0 : n(e).replace(/’/g, "'"), o = (e, t, n) => t === "," && e === "." ? n ? "{{amount_with_comma_separator}}" : "{{amount_no_decimals_with_comma_separator}}" : t === "," && e === " " ? n ? "{{amount_with_space_separator}}" : "{{amount_no_decimals_with_space_separator}}" : t === "." && e === " " ? "{{amount_with_period_and_space_separator}}" : t === "." && e === "'" ? "{{amount_with_apostrophe_separator}}" : n ? "{{amount}}" : "{{amount_no_decimals}}", s = ({ country: e, language: t }) => {
|
|
14
|
+
let n = [];
|
|
15
|
+
return e && n.push(`country: ${e}`), t && n.push(`language: ${t}`), n.length > 0 ? `@inContext(${n.join(", ")})` : "";
|
|
16
|
+
}, c = async (e, { useExternalMetafieldNamespace: t, useMetaobjects: n }) => n ? u(e, t) : l(e, t), l = async (e, t) => {
|
|
17
|
+
let n = (await e.query("\n query FetchDealBlocks($metafieldNamespace: String!) {\n shop {\n metafield(namespace: $metafieldNamespace, key: \"deal_blocks\") {\n value\n }\n }\n }\n ", { variables: { metafieldNamespace: t ? "app--2935586817--kaching_bundles" : "$app:kaching_bundles" } })).shop.metafield?.value;
|
|
18
|
+
return n ? JSON.parse(n) : [];
|
|
19
|
+
}, u = async (e, t) => {
|
|
20
|
+
let n = t ? "app--2935586817--deal_block" : "$app:deal_block", r = [], i = null;
|
|
21
|
+
for (;;) {
|
|
22
|
+
let t = await e.query("\n query FetchDealBlockMetaobjects($type: String!, $cursor: String) {\n metaobjects(type: $type, first: 250, after: $cursor) {\n nodes {\n fields {\n key\n value\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n ", { variables: {
|
|
23
|
+
type: n,
|
|
24
|
+
cursor: i
|
|
25
|
+
} });
|
|
26
|
+
for (let e of t.metaobjects.nodes) {
|
|
27
|
+
let t = e.fields.find((e) => e.key === "settings");
|
|
28
|
+
t?.value && r.push(JSON.parse(t.value));
|
|
29
|
+
}
|
|
30
|
+
if (!t.metaobjects.pageInfo.hasNextPage) break;
|
|
31
|
+
i = t.metaobjects.pageInfo.endCursor;
|
|
32
|
+
}
|
|
33
|
+
return r;
|
|
34
|
+
}, d = async (e, { country: t, language: n, blockVisibility: r, excludedProductGIDs: i, selectedProductGIDs: a, selectedCollectionGIDs: o, limit: c = 1e3 }) => {
|
|
35
|
+
switch (r) {
|
|
36
|
+
case "selected-products": return a.slice(0, c);
|
|
37
|
+
case "all-products":
|
|
38
|
+
case "excluded-products": {
|
|
39
|
+
let a = s({
|
|
40
|
+
country: t,
|
|
41
|
+
language: n
|
|
42
|
+
}), o = [], l = null;
|
|
43
|
+
for (; o.length < c;) {
|
|
44
|
+
let t = Math.min(c - o.length, 250), n = await e.query(`
|
|
45
|
+
query FetchProductGIDs($limit: Int!, $cursor: String) ${a} {
|
|
134
46
|
products(first: $limit, after: $cursor) {
|
|
135
47
|
nodes {
|
|
136
48
|
id
|
|
@@ -141,27 +53,25 @@ const F = (e, t) => {
|
|
|
141
53
|
}
|
|
142
54
|
}
|
|
143
55
|
}
|
|
144
|
-
`,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
`
|
|
164
|
-
query FetchCollectionProductGIDs($collectionGIDs: [ID!]!, $limit: Int!) ${m} {
|
|
56
|
+
`, { variables: {
|
|
57
|
+
limit: t,
|
|
58
|
+
cursor: l
|
|
59
|
+
} });
|
|
60
|
+
if (o.push(...n.products.nodes.map((e) => e.id)), !n.products.pageInfo.hasNextPage) break;
|
|
61
|
+
l = n.products.pageInfo.endCursor;
|
|
62
|
+
}
|
|
63
|
+
if (r === "excluded-products") {
|
|
64
|
+
let e = new Set(i);
|
|
65
|
+
o = o.filter((t) => !e.has(t));
|
|
66
|
+
}
|
|
67
|
+
return o;
|
|
68
|
+
}
|
|
69
|
+
case "selected-collections": {
|
|
70
|
+
let r = s({
|
|
71
|
+
country: t,
|
|
72
|
+
language: n
|
|
73
|
+
}), i = (await e.query(`
|
|
74
|
+
query FetchCollectionProductGIDs($collectionGIDs: [ID!]!, $limit: Int!) ${r} {
|
|
165
75
|
nodes(ids: $collectionGIDs) {
|
|
166
76
|
... on Collection {
|
|
167
77
|
products(first: $limit) {
|
|
@@ -172,77 +82,23 @@ const F = (e, t) => {
|
|
|
172
82
|
}
|
|
173
83
|
}
|
|
174
84
|
}
|
|
175
|
-
`,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
amount
|
|
193
|
-
}
|
|
194
|
-
compareAtPrice {
|
|
195
|
-
amount
|
|
196
|
-
}
|
|
197
|
-
selectedOptions {
|
|
198
|
-
name
|
|
199
|
-
value
|
|
200
|
-
}
|
|
201
|
-
image {
|
|
202
|
-
id
|
|
203
|
-
url(transform: $variantImageTransform)
|
|
204
|
-
}
|
|
205
|
-
unitPriceMeasurement {
|
|
206
|
-
quantityUnit
|
|
207
|
-
quantityValue
|
|
208
|
-
referenceUnit
|
|
209
|
-
referenceValue
|
|
210
|
-
}
|
|
211
|
-
requiresComponents
|
|
212
|
-
sellingPlanAllocations(first: 100) @include(if: $includeSellingPlans) {
|
|
213
|
-
nodes {
|
|
214
|
-
sellingPlan {
|
|
215
|
-
id
|
|
216
|
-
}
|
|
217
|
-
priceAdjustments {
|
|
218
|
-
price {
|
|
219
|
-
amount
|
|
220
|
-
}
|
|
221
|
-
compareAtPrice {
|
|
222
|
-
amount
|
|
223
|
-
}
|
|
224
|
-
perDeliveryPrice {
|
|
225
|
-
amount
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
quantityAvailable @include(if: $includeAvailableQuantity)
|
|
231
|
-
`, $ = async (e, {
|
|
232
|
-
country: t,
|
|
233
|
-
language: s,
|
|
234
|
-
productIds: a,
|
|
235
|
-
includeSellingPlans: n = !0,
|
|
236
|
-
includeAvailableQuantity: i = !0,
|
|
237
|
-
useExternalMetafieldNamespace: o = !1,
|
|
238
|
-
batchSize: r = 250,
|
|
239
|
-
onBatchError: m,
|
|
240
|
-
variantImageTransform: c = { maxWidth: 200, maxHeight: 200 }
|
|
241
|
-
}) => {
|
|
242
|
-
if (!a.length)
|
|
243
|
-
return [];
|
|
244
|
-
const u = a.map((p) => typeof p == "string" && p.startsWith("gid://") ? p : `gid://shopify/Product/${p}`), h = w({ country: t, language: s }), g = `
|
|
245
|
-
query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${h} {
|
|
85
|
+
`, { variables: {
|
|
86
|
+
collectionGIDs: o,
|
|
87
|
+
limit: Math.min(c, 250)
|
|
88
|
+
} })).nodes.filter((e) => e !== null).flatMap((e) => e.products.nodes.map((e) => e.id));
|
|
89
|
+
return Array.from(new Set(i)).slice(0, c);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, f = "\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", p = async (e, { country: t, language: n, productIds: r, includeSellingPlans: i = !0, includeAvailableQuantity: a = !0, includeProductRating: o = !1, useExternalMetafieldNamespace: c = !1, batchSize: l = 250, onBatchError: u, variantImageTransform: d = {
|
|
93
|
+
maxWidth: 200,
|
|
94
|
+
maxHeight: 200
|
|
95
|
+
} }) => {
|
|
96
|
+
if (!r.length) return [];
|
|
97
|
+
let p = r.map((e) => typeof e == "string" && e.startsWith("gid://") ? e : `gid://shopify/Product/${e}`), g = s({
|
|
98
|
+
country: t,
|
|
99
|
+
language: n
|
|
100
|
+
}), _ = `
|
|
101
|
+
query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $includeProductRating: Boolean!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${g} {
|
|
246
102
|
shop {
|
|
247
103
|
currencyRateConstant: metafield(namespace: $metafieldNamespace, key: "currency_rate_constant") {
|
|
248
104
|
value
|
|
@@ -276,7 +132,7 @@ const F = (e, t) => {
|
|
|
276
132
|
}
|
|
277
133
|
variants(first: 250) {
|
|
278
134
|
nodes {
|
|
279
|
-
${
|
|
135
|
+
${f}
|
|
280
136
|
}
|
|
281
137
|
}
|
|
282
138
|
collections(first: 50) {
|
|
@@ -296,6 +152,12 @@ const F = (e, t) => {
|
|
|
296
152
|
metafield4: metafield(namespace: $metafieldNamespace, key: "text4") {
|
|
297
153
|
value
|
|
298
154
|
}
|
|
155
|
+
reviewsRating: metafield(namespace: "reviews", key: "rating") @include(if: $includeProductRating) {
|
|
156
|
+
value
|
|
157
|
+
}
|
|
158
|
+
reviewsRatingCount: metafield(namespace: "reviews", key: "rating_count") @include(if: $includeProductRating) {
|
|
159
|
+
value
|
|
160
|
+
}
|
|
299
161
|
requiresSellingPlan
|
|
300
162
|
sellingPlanGroups(first: 100) @include(if: $includeSellingPlans) {
|
|
301
163
|
nodes {
|
|
@@ -328,90 +190,50 @@ const F = (e, t) => {
|
|
|
328
190
|
}
|
|
329
191
|
}
|
|
330
192
|
}
|
|
331
|
-
`,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
h
|
|
372
|
-
);
|
|
373
|
-
return T(
|
|
374
|
-
V,
|
|
375
|
-
e.shopifyDomain,
|
|
376
|
-
d
|
|
377
|
-
);
|
|
378
|
-
})
|
|
379
|
-
), b = [];
|
|
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))
|
|
383
|
-
);
|
|
384
|
-
return b;
|
|
385
|
-
}
|
|
386
|
-
return (await Promise.all(
|
|
387
|
-
I.map(
|
|
388
|
-
(p) => G(
|
|
389
|
-
e,
|
|
390
|
-
p,
|
|
391
|
-
{
|
|
392
|
-
includeSellingPlans: n,
|
|
393
|
-
includeAvailableQuantity: i,
|
|
394
|
-
variantImageTransform: c
|
|
395
|
-
},
|
|
396
|
-
h
|
|
397
|
-
)
|
|
398
|
-
)
|
|
399
|
-
)).map(
|
|
400
|
-
(p) => T(p, e.shopifyDomain, d)
|
|
401
|
-
);
|
|
402
|
-
}, G = async (e, t, s, a = "") => {
|
|
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(
|
|
409
|
-
`
|
|
410
|
-
query($productGID: ID!, $cursor: String, $reverse: Boolean, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $variantImageTransform: ImageTransformInput) ${a} {
|
|
193
|
+
`, v = c ? "app--2935586817--kaching_bundles" : "$app:kaching_bundles", y = [], b = Math.min(l, 250);
|
|
194
|
+
for (let e = 0; e < p.length; e += b) y.push(p.slice(e, e + b));
|
|
195
|
+
let x = 1, S = async (t) => {
|
|
196
|
+
let n = await e.query(_, { variables: {
|
|
197
|
+
productGIDs: t,
|
|
198
|
+
includeSellingPlans: i,
|
|
199
|
+
includeAvailableQuantity: a,
|
|
200
|
+
includeProductRating: o,
|
|
201
|
+
metafieldNamespace: v,
|
|
202
|
+
variantImageTransform: d
|
|
203
|
+
} });
|
|
204
|
+
return n.shop.currencyRateConstant && (x = JSON.parse(n.shop.currencyRateConstant.value).amount / 1e6), n;
|
|
205
|
+
}, C;
|
|
206
|
+
if (u) {
|
|
207
|
+
let e = await Promise.allSettled(y.map(S));
|
|
208
|
+
for (let t of e) t.status === "rejected" && u(t.reason instanceof Error ? t.reason : Error(String(t.reason)));
|
|
209
|
+
C = e.filter((e) => e.status === "fulfilled").flatMap((e) => e.value.nodes);
|
|
210
|
+
} else C = (await Promise.all(y.map(S))).flatMap((e) => e.nodes);
|
|
211
|
+
let w = C.filter((e) => e != null);
|
|
212
|
+
if (u) {
|
|
213
|
+
let t = await Promise.allSettled(w.map(async (t) => h(await m(e, t, {
|
|
214
|
+
includeSellingPlans: i,
|
|
215
|
+
includeAvailableQuantity: a,
|
|
216
|
+
variantImageTransform: d
|
|
217
|
+
}, g), e.shopifyDomain, x))), n = [];
|
|
218
|
+
for (let e of t) e.status === "fulfilled" ? n.push(e.value) : u(e.reason instanceof Error ? e.reason : Error(String(e.reason)));
|
|
219
|
+
return n;
|
|
220
|
+
}
|
|
221
|
+
return (await Promise.all(w.map((t) => m(e, t, {
|
|
222
|
+
includeSellingPlans: i,
|
|
223
|
+
includeAvailableQuantity: a,
|
|
224
|
+
variantImageTransform: d
|
|
225
|
+
}, g)))).map((t) => h(t, e.shopifyDomain, x));
|
|
226
|
+
}, m = async (e, t, n, r = "") => {
|
|
227
|
+
if (t.variants.nodes.length < 250) return t;
|
|
228
|
+
let i = /* @__PURE__ */ new Set(), a = [], o = [], s = async (s) => {
|
|
229
|
+
let c = !0, l = null;
|
|
230
|
+
for (; c;) {
|
|
231
|
+
let { nodes: u, pageInfo: d } = (await e.query(`
|
|
232
|
+
query($productGID: ID!, $cursor: String, $reverse: Boolean, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $variantImageTransform: ImageTransformInput) ${r} {
|
|
411
233
|
product(id: $productGID) {
|
|
412
234
|
variants(first: 250, after: $cursor, reverse: $reverse) {
|
|
413
235
|
nodes {
|
|
414
|
-
${
|
|
236
|
+
${f}
|
|
415
237
|
}
|
|
416
238
|
pageInfo {
|
|
417
239
|
endCursor
|
|
@@ -420,169 +242,129 @@ const F = (e, t) => {
|
|
|
420
242
|
}
|
|
421
243
|
}
|
|
422
244
|
}
|
|
423
|
-
`,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
(l) => Number(l.id.split("/").pop())
|
|
547
|
-
),
|
|
548
|
-
options: n,
|
|
549
|
-
selectedVariantId: Number(
|
|
550
|
-
e.variants.nodes[0].id.split("/").pop()
|
|
551
|
-
),
|
|
552
|
-
variants: a,
|
|
553
|
-
requiresSellingPlan: e.requiresSellingPlan,
|
|
554
|
-
sellingPlans: r,
|
|
555
|
-
isNativeBundle: m,
|
|
556
|
-
metafields: {
|
|
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
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
}, K = (e, t, s) => e.filter((a) => s.filter(
|
|
564
|
-
(n) => n.options[t] === a.name
|
|
565
|
-
).length > 0), B = "app--2935586817", Y = async (e, {
|
|
566
|
-
language: t,
|
|
567
|
-
country: s,
|
|
568
|
-
useExternalMetafieldNamespace: a
|
|
569
|
-
}) => {
|
|
570
|
-
const n = `${B}--kaching_bundles`, i = B, o = w({ country: s }), {
|
|
571
|
-
localization: {
|
|
572
|
-
country: {
|
|
573
|
-
currency: { isoCode: r }
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
shop: {
|
|
577
|
-
moneyFormat: m,
|
|
578
|
-
paymentSettings: { currencyCode: c },
|
|
579
|
-
currencyRateConstant: u,
|
|
580
|
-
primaryDomain: h,
|
|
581
|
-
settingsMetafield: g
|
|
582
|
-
}
|
|
583
|
-
} = await e.query(
|
|
584
|
-
`
|
|
585
|
-
query config($metafieldNamespace: String!, $settingsNamespace: String!) ${o} {
|
|
245
|
+
`, { variables: {
|
|
246
|
+
productGID: t.id,
|
|
247
|
+
cursor: l,
|
|
248
|
+
reverse: s,
|
|
249
|
+
...n
|
|
250
|
+
} })).product.variants;
|
|
251
|
+
for (let e of u) {
|
|
252
|
+
if (i.has(e.id)) {
|
|
253
|
+
c = !1;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
i.add(e.id), s ? o.push(e) : a.push(e);
|
|
257
|
+
}
|
|
258
|
+
d.hasNextPage || (c = !1), l = d.endCursor;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
return await Promise.all([s(!1), s(!0)]), t.variants.nodes = [...a, ...o.reverse()], t;
|
|
262
|
+
}, h = (e, t, n) => {
|
|
263
|
+
let r = e.variants.nodes.map(({ unitPriceMeasurement: e, ...t }) => ({
|
|
264
|
+
id: Number(t.id.split("/").pop()),
|
|
265
|
+
availableForSale: t.availableForSale,
|
|
266
|
+
price: Math.round(Number(t.price.amount) * 100),
|
|
267
|
+
compareAtPrice: t.compareAtPrice ? Math.round(Number(t.compareAtPrice.amount) * 100) : null,
|
|
268
|
+
options: t.selectedOptions.map((e) => e.value),
|
|
269
|
+
imageId: t.image ? Number(t.image.id.split("/").pop()) : null,
|
|
270
|
+
image: t.image?.url || null,
|
|
271
|
+
sellingPlans: t.sellingPlanAllocations?.nodes.map((e) => ({
|
|
272
|
+
id: Number(e.sellingPlan.id.split("/").pop()),
|
|
273
|
+
price: e.priceAdjustments.length > 0 ? Math.round(Number(e.priceAdjustments[0].price.amount) * 100) : Math.round(Number(t.price.amount) * 100),
|
|
274
|
+
compareAtPrice: e.priceAdjustments.length > 0 ? Math.round(Number(e.priceAdjustments[0].compareAtPrice.amount) * 100) : Math.round(Number(t.price.amount) * 100),
|
|
275
|
+
perDeliveryPrice: e.priceAdjustments.length > 0 ? Math.round(Number(e.priceAdjustments[0].perDeliveryPrice.amount) * 100) : Math.round(Number(t.price.amount) * 100)
|
|
276
|
+
})) || [],
|
|
277
|
+
inventoryManagement: null,
|
|
278
|
+
inventoryPolicy: null,
|
|
279
|
+
inventoryQuantity: t.quantityAvailable ?? null,
|
|
280
|
+
unitPriceMeasurement: e?.quantityUnit && e?.referenceUnit ? {
|
|
281
|
+
quantityValue: e.quantityValue,
|
|
282
|
+
quantityUnit: e.quantityUnit.toLowerCase(),
|
|
283
|
+
referenceValue: e.referenceValue,
|
|
284
|
+
referenceUnit: e.referenceUnit.toLowerCase()
|
|
285
|
+
} : null
|
|
286
|
+
})), i = e.options.map((e, t) => {
|
|
287
|
+
let n = e.optionValues.map((e) => ({
|
|
288
|
+
id: Number(e.id.split("/").pop()),
|
|
289
|
+
defaultName: e.name,
|
|
290
|
+
name: e.name,
|
|
291
|
+
swatch: {
|
|
292
|
+
color: e.swatch?.color || null,
|
|
293
|
+
image: e.swatch?.image?.previewImage?.url || null
|
|
294
|
+
}
|
|
295
|
+
}));
|
|
296
|
+
return {
|
|
297
|
+
defaultName: e.name,
|
|
298
|
+
name: e.name,
|
|
299
|
+
position: t + 1,
|
|
300
|
+
optionValues: v(n, t, r)
|
|
301
|
+
};
|
|
302
|
+
}), a = (e) => {
|
|
303
|
+
let t = e.priceAdjustments[0];
|
|
304
|
+
if (!t) return null;
|
|
305
|
+
let n = t.adjustmentValue;
|
|
306
|
+
switch (n.__typename) {
|
|
307
|
+
case "SellingPlanPercentagePriceAdjustment": return {
|
|
308
|
+
type: "percentage",
|
|
309
|
+
value: n.adjustmentPercentage
|
|
310
|
+
};
|
|
311
|
+
case "SellingPlanFixedAmountPriceAdjustment": return {
|
|
312
|
+
type: "fixed_amount",
|
|
313
|
+
value: o(n.adjustmentAmount.amount)
|
|
314
|
+
};
|
|
315
|
+
case "SellingPlanFixedPriceAdjustment": return {
|
|
316
|
+
type: "price",
|
|
317
|
+
value: o(n.price.amount)
|
|
318
|
+
};
|
|
319
|
+
default: throw Error(`Unknown price adjustment type: ${n.__typename}`);
|
|
320
|
+
}
|
|
321
|
+
}, o = (e) => n === 1 ? Number(e) * 100 : Math.round(Number(e) * 100 * n), s = e.sellingPlanGroups?.nodes.flatMap((e) => e.sellingPlans.nodes.map((e) => ({
|
|
322
|
+
id: Number(e.id.split("/").pop()),
|
|
323
|
+
name: e.name,
|
|
324
|
+
priceAdjustment: a(e)
|
|
325
|
+
}))) || [], c = e.variants.nodes.some((e) => e.requiresComponents);
|
|
326
|
+
return {
|
|
327
|
+
id: Number(e.id.split("/").pop()),
|
|
328
|
+
handle: e.handle,
|
|
329
|
+
url: e.onlineStoreUrl || `https://${t}/products/${e.handle}`,
|
|
330
|
+
availableForSale: e.availableForSale,
|
|
331
|
+
createdAt: e.createdAt,
|
|
332
|
+
title: e.title,
|
|
333
|
+
image: e.featuredImage?.url || null,
|
|
334
|
+
collectionIds: e.collections.nodes.map((e) => Number(e.id.split("/").pop())),
|
|
335
|
+
options: i,
|
|
336
|
+
selectedVariantId: Number(e.variants.nodes[0].id.split("/").pop()),
|
|
337
|
+
variants: r,
|
|
338
|
+
requiresSellingPlan: e.requiresSellingPlan,
|
|
339
|
+
sellingPlans: s,
|
|
340
|
+
isNativeBundle: c,
|
|
341
|
+
metafields: {
|
|
342
|
+
text: e.metafield?.value || null,
|
|
343
|
+
text2: e.metafield2?.value || null,
|
|
344
|
+
text3: e.metafield3?.value || null,
|
|
345
|
+
text4: e.metafield4?.value || null
|
|
346
|
+
},
|
|
347
|
+
rating: g(e.reviewsRating, e.reviewsRatingCount)
|
|
348
|
+
};
|
|
349
|
+
}, g = (e, t) => {
|
|
350
|
+
if (!e) return null;
|
|
351
|
+
let n = _(e.value);
|
|
352
|
+
if (n === null) return null;
|
|
353
|
+
let r = Number(t?.value);
|
|
354
|
+
return {
|
|
355
|
+
value: n,
|
|
356
|
+
count: Number.isInteger(r) && r > 0 ? r : null
|
|
357
|
+
};
|
|
358
|
+
}, _ = (e) => {
|
|
359
|
+
try {
|
|
360
|
+
let { value: t, scale_max: n } = JSON.parse(e), r = Number(t) / Number(n) * 5;
|
|
361
|
+
return Number.isFinite(r) && r > 0 ? Math.min(5, r) : null;
|
|
362
|
+
} catch {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
}, v = (e, t, n) => e.filter((e) => n.filter((n) => n.options[t] === e.name).length > 0), y = "app--2935586817", b = async (t, { language: n, country: r, useExternalMetafieldNamespace: i }) => {
|
|
366
|
+
let a = i ? `${y}--kaching_bundles` : "$app:kaching_bundles", o = i ? y : "$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
|
+
query config($metafieldNamespace: String!, $settingsNamespace: String!) ${c} {
|
|
586
368
|
localization {
|
|
587
369
|
country {
|
|
588
370
|
currency {
|
|
@@ -606,892 +388,864 @@ const F = (e, t) => {
|
|
|
606
388
|
}
|
|
607
389
|
}
|
|
608
390
|
}
|
|
609
|
-
`,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
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
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
`,
|
|
702
|
-
{
|
|
703
|
-
variables: {
|
|
704
|
-
mediaImageIds: i,
|
|
705
|
-
size: s
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
)
|
|
709
|
-
)
|
|
710
|
-
)).flatMap((i) => i.nodes).flatMap(
|
|
711
|
-
(i) => i != null && i.image ? [{ gid: i.id, url: i.image.url }] : []
|
|
712
|
-
);
|
|
713
|
-
};
|
|
714
|
-
var S = /* @__PURE__ */ ((e) => (e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e))(S || {});
|
|
715
|
-
const te = (e) => [
|
|
716
|
-
...se(e),
|
|
717
|
-
...ae(e),
|
|
718
|
-
...ne(e),
|
|
719
|
-
...le(e),
|
|
720
|
-
...re(e),
|
|
721
|
-
...ie(e),
|
|
722
|
-
...oe(e),
|
|
723
|
-
...ce(e),
|
|
724
|
-
...ue(e),
|
|
725
|
-
...de(e),
|
|
726
|
-
...me(e),
|
|
727
|
-
...pe(e),
|
|
728
|
-
...fe(e)
|
|
729
|
-
].filter((t) => t != null && !t.includes("placeholder")), se = (e) => e.dealBars.flatMap((t) => [t.mediaImageGID, t.badgeImageGID]).filter((t) => t != null), ae = (e) => e.dealBars.flatMap(
|
|
730
|
-
(t) => t.dealBarType === S.Bundle ? t.bundleProducts.map(
|
|
731
|
-
(s) => s.mediaImageGID
|
|
732
|
-
) : []
|
|
733
|
-
).filter((t) => t != null), ne = (e) => e.dealBars.map(
|
|
734
|
-
({ freeGifts: t }) => (t || []).map((s) => s.mediaImageGID)
|
|
735
|
-
).reduce((t, s) => t.concat(s), []).filter((t) => t != null), le = (e) => e.dealBars.flatMap(
|
|
736
|
-
({ multipleGiftsSelectors: t }) => (t || []).map((s) => s.mediaImageGID)
|
|
737
|
-
).filter((t) => t != null), re = (e) => e.dealBars.map(({ upsells: t }) => (t || []).map((s) => s.mediaImageGID)).reduce((t, s) => t.concat(s), []).filter((t) => t != null), ie = (e) => e.swatchOptions ? e.swatchOptions.reduce((t, s) => {
|
|
738
|
-
const a = s.images.map((n) => n.mediaImageGID).filter((n) => n != null);
|
|
739
|
-
return [...t, ...a];
|
|
740
|
-
}, []) : [], oe = (e) => {
|
|
741
|
-
if (!e.collectionBreaksEnabled || !e.collectionBreaks)
|
|
742
|
-
return [];
|
|
743
|
-
const t = e.collectionBreaks.mediaImageGID;
|
|
744
|
-
return t ? [t] : [];
|
|
745
|
-
}, ce = (e) => {
|
|
746
|
-
var t, s, a;
|
|
747
|
-
return e.progressiveGifts ? [
|
|
748
|
-
...((t = e.progressiveGifts.gifts) == null ? void 0 : t.map((n) => n.mediaImageGID)) || [],
|
|
749
|
-
(s = e.progressiveGifts.style) == null ? void 0 : s.lockedMediaImageGID,
|
|
750
|
-
(a = e.progressiveGifts.dealBarStyle) == null ? void 0 : a.lockedMediaImageGID
|
|
751
|
-
].filter((n) => n != null) : [];
|
|
752
|
-
}, 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) => {
|
|
753
|
-
var s;
|
|
754
|
-
return (s = t.productPersonalisation) == null ? void 0 : s.mediaImageGID;
|
|
755
|
-
}).filter((t) => t != null), me = (e) => {
|
|
756
|
-
var a, n;
|
|
757
|
-
const t = e.dealBars.map((i) => {
|
|
758
|
-
var o;
|
|
759
|
-
return (o = i.highlights) == null ? void 0 : o.customIconGID;
|
|
760
|
-
}).filter((i) => i != null), s = (n = (a = e.subscriptions) == null ? void 0 : a.highlights) == null ? void 0 : n.customIconGID;
|
|
761
|
-
return s ? [...t, s] : t;
|
|
762
|
-
}, pe = (e) => (e.badges || []).flatMap(
|
|
763
|
-
(t) => t.badgeType === "custom" && t.imageGID ? [t.imageGID] : []
|
|
764
|
-
), fe = (e) => !e.savingsSummaryEnabled || !e.savingsSummary ? [] : e.savingsSummary.customIconGID ? [e.savingsSummary.customIconGID] : [], he = (e) => {
|
|
765
|
-
const t = [
|
|
766
|
-
...ge(e),
|
|
767
|
-
...ye(e),
|
|
768
|
-
...be(e),
|
|
769
|
-
...ve(e),
|
|
770
|
-
...Ie(e),
|
|
771
|
-
..._e(e),
|
|
772
|
-
...Pe(e),
|
|
773
|
-
...Se(e)
|
|
774
|
-
];
|
|
775
|
-
return Array.from(new Set(t.filter((s) => s != null)));
|
|
776
|
-
}, ge = (e) => e.dealBars.flatMap(
|
|
777
|
-
({ freeGifts: t }) => t ? t.map((s) => s.productGID) : []
|
|
778
|
-
).filter((t) => t != null), ye = (e) => e.dealBars.flatMap(
|
|
779
|
-
({ multipleGiftsSelectors: t }) => t ? t.flatMap(
|
|
780
|
-
(s) => s.products ? s.products.map((a) => a.id) : []
|
|
781
|
-
) : []
|
|
782
|
-
).filter((t) => t != null), be = (e) => {
|
|
783
|
-
var t;
|
|
784
|
-
return e.progressiveGiftsEnabled ? ((t = e.progressiveGifts) == null ? void 0 : t.gifts.map((s) => s.productGID).filter((s) => s != null)) || [] : [];
|
|
785
|
-
}, ve = (e) => e.dealBars.flatMap(({ upsells: t }) => t ? t.map((s) => s.productGID) : []).filter((t) => t != null), Ie = (e) => e.dealBars.filter((t) => t.dealBarType === S.Bundle).flatMap(
|
|
786
|
-
({ bundleProducts: t }) => t ? t.map((s) => s.productGID) : []
|
|
787
|
-
).filter((t) => t != null).filter((t) => t !== "default"), _e = (e) => e.dealBars.filter((t) => t.dealBarType === S.MixAndMatch).flatMap(
|
|
788
|
-
({ bundleProducts: t }) => t ? t.flatMap((s) => {
|
|
789
|
-
var a;
|
|
790
|
-
return [
|
|
791
|
-
s.productGID,
|
|
792
|
-
...((a = s.selectedProducts) == null ? void 0 : a.map((n) => n.id)) ?? []
|
|
793
|
-
];
|
|
794
|
-
}) : []
|
|
795
|
-
).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] : []);
|
|
796
|
-
class M extends Error {
|
|
797
|
-
constructor({
|
|
798
|
-
status: t,
|
|
799
|
-
operationName: s,
|
|
800
|
-
graphqlErrors: a
|
|
801
|
-
}) {
|
|
802
|
-
const n = a.length ? `: ${a.join("; ")}` : "";
|
|
803
|
-
super(
|
|
804
|
-
`Storefront API ${s ?? "query"} failed (HTTP ${t})${n}`
|
|
805
|
-
), this.name = "StorefrontApiError", this.status = t, this.operationName = s, this.graphqlErrors = a;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
const ke = async (e, t) => {
|
|
809
|
-
const s = await e.text();
|
|
810
|
-
if (!s)
|
|
811
|
-
throw new Error("Empty graphql response");
|
|
812
|
-
let a;
|
|
813
|
-
try {
|
|
814
|
-
a = JSON.parse(s);
|
|
815
|
-
} catch (n) {
|
|
816
|
-
throw e.ok ? n : new M({
|
|
817
|
-
status: e.status,
|
|
818
|
-
operationName: t,
|
|
819
|
-
graphqlErrors: []
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
if (!e.ok || a.data === null || a.data === void 0)
|
|
823
|
-
throw new M({
|
|
824
|
-
status: e.status,
|
|
825
|
-
operationName: t,
|
|
826
|
-
graphqlErrors: (a.errors ?? []).map(({ message: n }) => n).filter(Boolean)
|
|
827
|
-
});
|
|
828
|
-
return a.data;
|
|
391
|
+
`, { variables: {
|
|
392
|
+
metafieldNamespace: a,
|
|
393
|
+
settingsNamespace: o
|
|
394
|
+
} }), h = l === d ? u : e(l, {
|
|
395
|
+
language: n,
|
|
396
|
+
country: r
|
|
397
|
+
}), g = f ? x(f.value) : 1, _ = m ? JSON.parse(m.value) : null, v = _?.feature_flags ?? {}, b = _?.custom_selectors ?? {};
|
|
398
|
+
return {
|
|
399
|
+
shopifyDomain: p.host,
|
|
400
|
+
moneyFormat: h,
|
|
401
|
+
locale: n?.toLowerCase() || "en",
|
|
402
|
+
liquidLocale: n?.toLowerCase() || "en",
|
|
403
|
+
country: r ?? "US",
|
|
404
|
+
currencyRate: g,
|
|
405
|
+
marketId: 0,
|
|
406
|
+
productId: null,
|
|
407
|
+
storefrontAccessToken: _?.storefront_access_token ?? null,
|
|
408
|
+
includeSellingPlans: _?.include_selling_plans ?? !1,
|
|
409
|
+
includeAvailableQuantity: _?.include_available_quantity ?? !1,
|
|
410
|
+
customApiHost: _?.custom_api_host ?? null,
|
|
411
|
+
keepQuantityInput: _?.keep_quantity_input ?? !1,
|
|
412
|
+
ignoreDeselect: _?.ignore_deselect ?? !1,
|
|
413
|
+
ignoreUnitPrice: _?.ignore_unit_price ?? !1,
|
|
414
|
+
requireCustomerLogin: _?.require_customer_login ?? !1,
|
|
415
|
+
abTestsRunning: _?.ab_tests_running ?? !1,
|
|
416
|
+
webPixel: _?.web_pixel ?? !1,
|
|
417
|
+
b2bCustomer: !1,
|
|
418
|
+
isLoggedIn: !1,
|
|
419
|
+
preview: !1,
|
|
420
|
+
previewAlerts: !1,
|
|
421
|
+
previewScratchOff: !1,
|
|
422
|
+
defaultTranslations: {
|
|
423
|
+
"system.out_of_stock": "Out of stock",
|
|
424
|
+
"system.invalid_variant": "Invalid variant",
|
|
425
|
+
"system.unavailable_option_value": "Unavailable option value",
|
|
426
|
+
"system.confirm": "Confirm",
|
|
427
|
+
"system.cancel": "Cancel",
|
|
428
|
+
"system.free": "FREE",
|
|
429
|
+
"system.search": "Search",
|
|
430
|
+
"system.quantity": "Quantity",
|
|
431
|
+
"system.subscription_plan": "Subscription plan",
|
|
432
|
+
"system.remove": "Remove",
|
|
433
|
+
"system.sort_by": "Sort by",
|
|
434
|
+
"system.sort_relevance": "Relevance",
|
|
435
|
+
"system.sort_newest_first": "Newest first",
|
|
436
|
+
"system.sort_price_low_to_high": "Price: Low → High",
|
|
437
|
+
"system.sort_price_high_to_low": "Price: High → Low",
|
|
438
|
+
"system.no_results_found": "No results found",
|
|
439
|
+
"system.no_results_description": "We can't find any item matching your search.",
|
|
440
|
+
"system.clear_search": "Clear search",
|
|
441
|
+
"system.no_products_available": "No products available",
|
|
442
|
+
"system.original_price": "Original price:",
|
|
443
|
+
"system.price": "Price:",
|
|
444
|
+
"system.letters_only": "Only letters are allowed.",
|
|
445
|
+
"system.numbers_only": "Only numbers are allowed."
|
|
446
|
+
},
|
|
447
|
+
customSelectors: {
|
|
448
|
+
quantity: b.quantity ?? null,
|
|
449
|
+
addToCartButton: b.add_to_cart_button ?? null,
|
|
450
|
+
variantPicker: b.variant_picker ?? null,
|
|
451
|
+
price: b.price ?? null,
|
|
452
|
+
priceCompare: b.price_compare ?? null
|
|
453
|
+
},
|
|
454
|
+
shopCustomStyles: _?.shop_custom_styles ?? "",
|
|
455
|
+
featureFlags: v,
|
|
456
|
+
brandColors: _?.brand_colors ?? null
|
|
457
|
+
};
|
|
458
|
+
}, x = (e) => JSON.parse(e).amount / 1e6, S = async (e, t, n = 200) => {
|
|
459
|
+
let r = [...new Set(t.filter(Boolean).filter((e) => !e.startsWith("placeholder")))];
|
|
460
|
+
if (r.length === 0) return [];
|
|
461
|
+
let i = [];
|
|
462
|
+
for (let e = 0; e < r.length; e += 250) i.push(r.slice(e, e + 250));
|
|
463
|
+
return (await Promise.all(i.map((t) => e.query("\n query FetchMediaImages($mediaImageIds: [ID!]!, $size: Int!) {\n nodes(ids: $mediaImageIds) {\n ... on MediaImage {\n id\n image {\n url(transform: { maxWidth: $size, maxHeight: $size })\n }\n }\n }\n }\n ", { variables: {
|
|
464
|
+
mediaImageIds: t,
|
|
465
|
+
size: n
|
|
466
|
+
} })))).flatMap((e) => e.nodes).flatMap((e) => e?.image ? [{
|
|
467
|
+
gid: e.id,
|
|
468
|
+
url: e.image.url
|
|
469
|
+
}] : []);
|
|
829
470
|
};
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
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) => [
|
|
487
|
+
...ee(e),
|
|
488
|
+
...te(e),
|
|
489
|
+
...ne(e),
|
|
490
|
+
...re(e),
|
|
491
|
+
...ie(e),
|
|
492
|
+
...T(e),
|
|
493
|
+
...E(e),
|
|
494
|
+
...D(e),
|
|
495
|
+
...O(e),
|
|
496
|
+
...ae(e),
|
|
497
|
+
...oe(e),
|
|
498
|
+
...k(e),
|
|
499
|
+
...A(e)
|
|
500
|
+
].filter((e) => e != null && !e.includes("placeholder")), ee = (e) => e.dealBars.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), te = (e) => e.dealBars.flatMap((e) => e.dealBarType === C.Bundle ? e.bundleProducts.map((e) => e.mediaImageGID) : []).filter((e) => e != null), ne = (e) => e.dealBars.map(({ freeGifts: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), re = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => (e || []).map((e) => e.mediaImageGID)).filter((e) => e != null), ie = (e) => e.dealBars.map(({ upsells: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), T = (e) => e.swatchOptions ? e.swatchOptions.reduce((e, t) => {
|
|
501
|
+
let n = t.images.map((e) => e.mediaImageGID).filter((e) => e != null);
|
|
502
|
+
return [...e, ...n];
|
|
503
|
+
}, []) : [], E = (e) => {
|
|
504
|
+
if (!e.collectionBreaksEnabled || !e.collectionBreaks) return [];
|
|
505
|
+
let t = e.collectionBreaks.mediaImageGID;
|
|
506
|
+
return t ? [t] : [];
|
|
507
|
+
}, D = (e) => e.progressiveGifts ? [
|
|
508
|
+
...e.progressiveGifts.gifts?.map((e) => e.mediaImageGID) || [],
|
|
509
|
+
e.progressiveGifts.style?.lockedMediaImageGID,
|
|
510
|
+
e.progressiveGifts.dealBarStyle?.lockedMediaImageGID
|
|
511
|
+
].filter((e) => e != null) : [], O = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), ae = (e) => e.dealBars.map((e) => e.productPersonalisation?.mediaImageGID).filter((e) => e != null), oe = (e) => {
|
|
512
|
+
let t = e.dealBars.map((e) => e.highlights?.customIconGID).filter((e) => e != null), n = e.subscriptions?.highlights?.customIconGID;
|
|
513
|
+
return n ? [...t, n] : t;
|
|
514
|
+
}, k = (e) => (e.badges || []).flatMap((e) => e.badgeType === "custom" && e.imageGID ? [e.imageGID] : []), A = (e) => !e.savingsSummaryEnabled || !e.savingsSummary ? [] : e.savingsSummary.customIconGID ? [e.savingsSummary.customIconGID] : [], j = (e) => {
|
|
515
|
+
let t = [
|
|
516
|
+
...M(e),
|
|
517
|
+
...N(e),
|
|
518
|
+
...P(e),
|
|
519
|
+
...F(e),
|
|
520
|
+
...I(e),
|
|
521
|
+
...L(e),
|
|
522
|
+
...R(e),
|
|
523
|
+
...z(e)
|
|
524
|
+
];
|
|
525
|
+
return Array.from(new Set(t.filter((e) => e != null)));
|
|
526
|
+
}, M = (e) => e.dealBars.flatMap(({ freeGifts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), N = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => e ? e.flatMap((e) => e.products ? e.products.map((e) => e.id) : []) : []).filter((e) => e != null), P = (e) => e.progressiveGiftsEnabled && e.progressiveGifts?.gifts.map((e) => e.productGID).filter((e) => e != null) || [], F = (e) => e.dealBars.flatMap(({ upsells: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), I = (e) => e.dealBars.filter((e) => e.dealBarType === C.Bundle).flatMap(({ bundleProducts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null).filter((e) => e !== "default"), L = (e) => e.dealBars.filter((e) => e.dealBarType === C.MixAndMatch).flatMap(({ bundleProducts: e }) => e ? e.flatMap((e) => [e.productGID, ...e.selectedProducts?.map((e) => e.id) ?? []]) : []).filter((e) => e != null).filter((e) => e !== "default"), R = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.map((e) => e.productGID).filter((e) => e != null), z = (e) => e.dealBars.filter((e) => e.dealBarType === C.Sku).flatMap(({ productGID: e }) => e ? [e] : []), B = class extends Error {
|
|
527
|
+
constructor({ status: e, operationName: t, graphqlErrors: n }) {
|
|
528
|
+
let r = n.length ? `: ${n.join("; ")}` : "";
|
|
529
|
+
super(`Storefront API ${t ?? "query"} failed (HTTP ${e})${r}`), this.name = "StorefrontApiError", this.status = e, this.operationName = t, this.graphqlErrors = n;
|
|
530
|
+
}
|
|
531
|
+
}, V = async (e, t) => {
|
|
532
|
+
let n = await e.text();
|
|
533
|
+
if (!n) throw Error("Empty graphql response");
|
|
534
|
+
let r;
|
|
535
|
+
try {
|
|
536
|
+
r = JSON.parse(n);
|
|
537
|
+
} catch (n) {
|
|
538
|
+
throw e.ok ? n : new B({
|
|
539
|
+
status: e.status,
|
|
540
|
+
operationName: t,
|
|
541
|
+
graphqlErrors: []
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
if (!e.ok || r.data === null || r.data === void 0) throw new B({
|
|
545
|
+
status: e.status,
|
|
546
|
+
operationName: t,
|
|
547
|
+
graphqlErrors: (r.errors ?? []).map(({ message: e }) => e).filter(Boolean)
|
|
548
|
+
});
|
|
549
|
+
return r.data;
|
|
550
|
+
}, H = class {
|
|
551
|
+
constructor(e, t) {
|
|
552
|
+
this.storefrontApiVersion = "2026-07", this.storefrontAccessToken = t, this.shopifyDomain = e;
|
|
553
|
+
}
|
|
554
|
+
async query(e, t) {
|
|
555
|
+
let n = t?.variables ?? {}, r = `https://${this.shopifyDomain}/api/${this.storefrontApiVersion}/graphql.json`, i = e.match(/query\s+(\w+)/)?.[1];
|
|
556
|
+
return i && (r += `?operation_name=${i}`), V(await fetch(r, {
|
|
557
|
+
method: "POST",
|
|
558
|
+
headers: {
|
|
559
|
+
"Content-Type": "application/json",
|
|
560
|
+
"X-Shopify-Storefront-Access-Token": this.storefrontAccessToken
|
|
561
|
+
},
|
|
562
|
+
body: JSON.stringify({
|
|
563
|
+
query: e,
|
|
564
|
+
variables: n
|
|
565
|
+
})
|
|
566
|
+
}), i);
|
|
567
|
+
}
|
|
568
|
+
}, U = (e, t) => {
|
|
569
|
+
let n = [], r = e.filter((e) => e.blockVisibility === "selected-products");
|
|
570
|
+
for (let e of r) e.selectedProductIds.map(Number).includes(t.id) && n.push(e);
|
|
571
|
+
let i = e.filter((e) => e.blockVisibility === "selected-collections");
|
|
572
|
+
for (let e of i) t.collectionIds.some((t) => e.selectedCollectionIds.map(Number).includes(t)) && n.push(e);
|
|
573
|
+
let a = e.filter((e) => e.blockVisibility === "excluded-products");
|
|
574
|
+
for (let e of a) !e.excludedProductIds.map(Number).includes(t.id) && !(e.excludedCollectionIds || []).some((e) => t.collectionIds.includes(e)) && n.push(e);
|
|
575
|
+
let o = e.filter((e) => e.blockVisibility === "all-products");
|
|
576
|
+
for (let e of o) n.push(e);
|
|
577
|
+
return n;
|
|
578
|
+
}, se = async (e, t, { country: n, language: r }) => {
|
|
579
|
+
let i = t.collectionBreaks;
|
|
580
|
+
if (!t.collectionBreaksEnabled || !i) return;
|
|
581
|
+
let a;
|
|
582
|
+
a = i.visibility === "deal-products" ? await d(e, {
|
|
583
|
+
country: n,
|
|
584
|
+
language: r,
|
|
585
|
+
blockVisibility: t.blockVisibility,
|
|
586
|
+
excludedProductGIDs: (t.excludedProductIds || []).map((e) => `gid://shopify/Product/${e}`),
|
|
587
|
+
selectedProductGIDs: (t.selectedProductIds || []).map((e) => `gid://shopify/Product/${e}`),
|
|
588
|
+
selectedCollectionGIDs: (t.selectedCollectionIds || []).map((e) => `gid://shopify/Collection/${e}`)
|
|
589
|
+
}) : await d(e, {
|
|
590
|
+
country: n,
|
|
591
|
+
language: r,
|
|
592
|
+
blockVisibility: i.visibility,
|
|
593
|
+
excludedProductGIDs: (i.excludedProducts || []).map(({ id: e }) => e),
|
|
594
|
+
selectedProductGIDs: (i.selectedProducts || []).map(({ id: e }) => e),
|
|
595
|
+
selectedCollectionGIDs: (i.selectedCollections || []).map(({ id: e }) => e)
|
|
596
|
+
});
|
|
597
|
+
let o = await p(e, {
|
|
598
|
+
country: n,
|
|
599
|
+
language: r,
|
|
600
|
+
productIds: a.map((e) => Number(e.split("/").pop())),
|
|
601
|
+
useExternalMetafieldNamespace: !0
|
|
602
|
+
});
|
|
603
|
+
return o = o.filter((e) => e.availableForSale), o;
|
|
604
|
+
}, W = ({ language: e, dealBlockId: t }) => {
|
|
605
|
+
let n = {
|
|
606
|
+
"system.out_of_stock": "There's not enough items in our stock, please select smaller bundle.",
|
|
607
|
+
"system.invalid_variant": "Sorry, this is not currently available.",
|
|
608
|
+
"system.unavailable_option_value": "Unavailable",
|
|
609
|
+
"system.confirm": "Confirm",
|
|
610
|
+
"system.cancel": "Cancel",
|
|
611
|
+
"system.free": "FREE",
|
|
612
|
+
"system.search": "Search",
|
|
613
|
+
"system.quantity": "Quantity",
|
|
614
|
+
"system.subscription_plan": "Subscription plan",
|
|
615
|
+
"system.remove": "Remove",
|
|
616
|
+
"system.sort_by": "Sort by",
|
|
617
|
+
"system.sort_relevance": "Relevance",
|
|
618
|
+
"system.sort_newest_first": "Newest first",
|
|
619
|
+
"system.sort_price_low_to_high": "Price: Low → High",
|
|
620
|
+
"system.sort_price_high_to_low": "Price: High → Low",
|
|
621
|
+
"system.no_results_found": "No results found",
|
|
622
|
+
"system.no_results_description": "We can't find any item matching your search.",
|
|
623
|
+
"system.clear_search": "Clear search",
|
|
624
|
+
"system.no_products_available": "No products available",
|
|
625
|
+
"system.original_price": "Original price:",
|
|
626
|
+
"system.price": "Price:",
|
|
627
|
+
"system.letters_only": "Only letters are allowed.",
|
|
628
|
+
"system.numbers_only": "Only numbers are allowed.",
|
|
629
|
+
"system.personalisation_required_alert": "Please add personalisation for every item to continue."
|
|
630
|
+
}, r = e ? G(e) : void 0;
|
|
631
|
+
return {
|
|
632
|
+
...n,
|
|
633
|
+
...r?.system,
|
|
634
|
+
...r?.dealBlocks[t]
|
|
635
|
+
};
|
|
636
|
+
}, G = (e) => {
|
|
637
|
+
if (typeof document > "u") return;
|
|
638
|
+
let t = document.querySelector("script#kaching-bundles-translations");
|
|
639
|
+
if (!t?.textContent) return;
|
|
640
|
+
let n;
|
|
641
|
+
try {
|
|
642
|
+
n = JSON.parse(t.textContent);
|
|
643
|
+
} catch {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
let r = K(e);
|
|
647
|
+
return n.find((e) => K(e.locale) === r)?.translations;
|
|
648
|
+
}, K = (e) => e.toLowerCase().replace(/_/g, "-"), ce = "2026-07", q = async (e, { productId: t, dealBlockId: n, country: r = void 0, language: i = void 0 }) => {
|
|
649
|
+
try {
|
|
650
|
+
let a = [Number(t.split("/").pop())], o = new le(e);
|
|
651
|
+
r ||= o.i18n?.country, i ||= o.i18n?.language;
|
|
652
|
+
let s = await b(o, {
|
|
653
|
+
language: i,
|
|
654
|
+
country: r,
|
|
655
|
+
useExternalMetafieldNamespace: !0
|
|
656
|
+
});
|
|
657
|
+
o.shopifyDomain = s.shopifyDomain;
|
|
658
|
+
let l = s.storefrontAccessToken ? new H(s.shopifyDomain, s.storefrontAccessToken) : o, [u, d] = await Promise.all([p(l, {
|
|
659
|
+
country: r,
|
|
660
|
+
language: i,
|
|
661
|
+
productIds: a,
|
|
662
|
+
useExternalMetafieldNamespace: !0
|
|
663
|
+
}), c(l, {
|
|
664
|
+
useExternalMetafieldNamespace: !0,
|
|
665
|
+
useMetaobjects: s.featureFlags.storefront_metaobjects
|
|
666
|
+
})]), f = u[0];
|
|
667
|
+
if (!f) return null;
|
|
668
|
+
let m = U(d, f), h;
|
|
669
|
+
if (n ? (h = m.find((e) => e.id === n || e.nanoId === n), h ||= m[0]) : h = m[0], !h) return null;
|
|
670
|
+
let g = w(h), _ = j(h), [v, y, x, C] = await Promise.all([
|
|
671
|
+
p(l, {
|
|
672
|
+
country: r,
|
|
673
|
+
language: i,
|
|
674
|
+
productIds: _,
|
|
675
|
+
useExternalMetafieldNamespace: !0
|
|
676
|
+
}),
|
|
677
|
+
S(l, g, 300),
|
|
678
|
+
se(l, h, {
|
|
679
|
+
country: r,
|
|
680
|
+
language: i
|
|
681
|
+
}),
|
|
682
|
+
W({
|
|
683
|
+
language: i,
|
|
684
|
+
dealBlockId: h.id
|
|
685
|
+
})
|
|
686
|
+
]);
|
|
687
|
+
return {
|
|
688
|
+
product: f,
|
|
689
|
+
dealBlock: h,
|
|
690
|
+
config: s,
|
|
691
|
+
otherProducts: v,
|
|
692
|
+
mediaImages: y,
|
|
693
|
+
collectionBreaksProducts: x ?? [],
|
|
694
|
+
translations: C
|
|
695
|
+
};
|
|
696
|
+
} catch (e) {
|
|
697
|
+
return console.error(e), null;
|
|
698
|
+
}
|
|
699
|
+
}, le = class {
|
|
700
|
+
constructor(e) {
|
|
701
|
+
this.storefront = e, this.shopifyDomain = "";
|
|
702
|
+
}
|
|
703
|
+
async query(e, t) {
|
|
704
|
+
if ("query" in this.storefront && "i18n" in this.storefront) return await this.storefront.query(e, t);
|
|
705
|
+
if ("graphql" in this.storefront) {
|
|
706
|
+
let n = await this.storefront.graphql(e, t);
|
|
707
|
+
if (n.errors?.length) throw Error(n.errors.map((e) => e.message).join("\n"));
|
|
708
|
+
return n.data;
|
|
709
|
+
}
|
|
710
|
+
if ("request" in this.storefront) return (await this.storefront.request(e, t)).data;
|
|
711
|
+
if ("shopifyDomain" in this.storefront && "storefrontAccessToken" in this.storefront) {
|
|
712
|
+
let n = await fetch(`https://${this.storefront.shopifyDomain}/api/${ce}/graphql.json`, {
|
|
713
|
+
body: JSON.stringify({
|
|
714
|
+
query: e,
|
|
715
|
+
variables: t?.variables
|
|
716
|
+
}),
|
|
717
|
+
headers: {
|
|
718
|
+
"Content-Type": "application/json",
|
|
719
|
+
"X-Shopify-Storefront-Access-Token": this.storefront.storefrontAccessToken
|
|
720
|
+
},
|
|
721
|
+
method: "POST"
|
|
722
|
+
});
|
|
723
|
+
if (!n.ok) throw Error(n.statusText);
|
|
724
|
+
return (await n.json()).data;
|
|
725
|
+
}
|
|
726
|
+
{
|
|
727
|
+
let n = await fetch(this.storefront.getStorefrontApiUrl(), {
|
|
728
|
+
body: JSON.stringify({
|
|
729
|
+
query: e,
|
|
730
|
+
variables: t?.variables
|
|
731
|
+
}),
|
|
732
|
+
headers: this.storefront.getPublicTokenHeaders(),
|
|
733
|
+
method: "POST"
|
|
734
|
+
});
|
|
735
|
+
if (!n.ok) throw Error(n.statusText);
|
|
736
|
+
return (await n.json()).data;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
get i18n() {
|
|
740
|
+
if ("i18n" in this.storefront) return this.storefront.i18n;
|
|
741
|
+
}
|
|
742
|
+
}, J = "kaching-bundles-block", Y = 1e4, ue = "https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js", de = "https://bundles-integrations.kachingappz.app/kaching-bundles-block.js", X = /* @__PURE__ */ new WeakSet(), Z = async (e) => {
|
|
743
|
+
let t = e.document;
|
|
744
|
+
if (!e.customElements.get(J)) {
|
|
745
|
+
if (X.has(t)) return Q(e, J);
|
|
746
|
+
X.add(t);
|
|
747
|
+
try {
|
|
748
|
+
await me(e);
|
|
749
|
+
} catch (e) {
|
|
750
|
+
throw X.delete(t), e;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}, fe = () => typeof window < "u" && window.__KACHING_DEV__ !== void 0, pe = () => fe() ? ue : de, me = (e) => {
|
|
754
|
+
let t = e.document;
|
|
755
|
+
return new Promise((n, r) => {
|
|
756
|
+
let i = pe();
|
|
757
|
+
if (t.querySelector(`script[src="${i}"]`)) {
|
|
758
|
+
Q(e, J).then(n).catch(r);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
let a = t.createElement("script");
|
|
762
|
+
a.src = i, a.onload = () => Q(e, J).then(n).catch(r), a.onerror = () => r(/* @__PURE__ */ Error("Failed to load script")), t.head.appendChild(a);
|
|
763
|
+
});
|
|
764
|
+
}, Q = (e, t) => new Promise((n, r) => {
|
|
765
|
+
e.customElements.get(t) ? n() : Promise.race([e.customElements.whenDefined(t), new Promise((e, n) => setTimeout(() => n(/* @__PURE__ */ Error(`Custom element "${t}" failed to register within ${Y}ms`)), Y))]).then(() => n()).catch(r);
|
|
1109
766
|
});
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
767
|
+
[
|
|
768
|
+
"primaryBackground",
|
|
769
|
+
"secondaryBackground",
|
|
770
|
+
"primaryText",
|
|
771
|
+
"secondaryText",
|
|
772
|
+
"border",
|
|
773
|
+
"overlay",
|
|
774
|
+
"primaryAccent",
|
|
775
|
+
"primaryAccentText",
|
|
776
|
+
"badgeBackground",
|
|
777
|
+
"badgeText",
|
|
778
|
+
"error"
|
|
779
|
+
].map((e) => `brand_${e}`);
|
|
780
|
+
var $ = /* @__PURE__ */ function(e) {
|
|
781
|
+
return e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e;
|
|
782
|
+
}({}), he = {
|
|
783
|
+
config: {
|
|
784
|
+
shopifyDomain: "",
|
|
785
|
+
moneyFormat: "${{amount}}",
|
|
786
|
+
locale: "en",
|
|
787
|
+
country: "US",
|
|
788
|
+
currencyRate: 1,
|
|
789
|
+
marketId: 0,
|
|
790
|
+
productId: null,
|
|
791
|
+
storefrontAccessToken: null,
|
|
792
|
+
includeSellingPlans: !1,
|
|
793
|
+
includeAvailableQuantity: !1,
|
|
794
|
+
customApiHost: null,
|
|
795
|
+
keepQuantityInput: !1,
|
|
796
|
+
ignoreDeselect: !1,
|
|
797
|
+
ignoreUnitPrice: !1,
|
|
798
|
+
requireCustomerLogin: !1,
|
|
799
|
+
abTestsRunning: !1,
|
|
800
|
+
webPixel: !1,
|
|
801
|
+
b2bCustomer: !1,
|
|
802
|
+
isLoggedIn: !1,
|
|
803
|
+
preview: !0,
|
|
804
|
+
previewAlerts: !1,
|
|
805
|
+
previewScratchOff: !1,
|
|
806
|
+
defaultTranslations: {
|
|
807
|
+
"system.out_of_stock": "There's not enough items in our stock, please select smaller bundle.",
|
|
808
|
+
"system.invalid_variant": "Sorry, this is not currently available.",
|
|
809
|
+
"system.unavailable_option_value": "Unavailable",
|
|
810
|
+
"system.confirm": "Confirm",
|
|
811
|
+
"system.cancel": "Cancel",
|
|
812
|
+
"system.free": "FREE",
|
|
813
|
+
"system.search": "Search",
|
|
814
|
+
"system.quantity": "Quantity",
|
|
815
|
+
"system.subscription_plan": "Subscription plan",
|
|
816
|
+
"system.remove": "Remove",
|
|
817
|
+
"system.sort_by": "Sort by",
|
|
818
|
+
"system.sort_relevance": "Relevance",
|
|
819
|
+
"system.sort_newest_first": "Newest first",
|
|
820
|
+
"system.sort_price_low_to_high": "Price: Low → High",
|
|
821
|
+
"system.sort_price_high_to_low": "Price: High → Low",
|
|
822
|
+
"system.no_results_found": "No results found",
|
|
823
|
+
"system.no_results_description": "We can't find any item matching your search.",
|
|
824
|
+
"system.clear_search": "Clear search",
|
|
825
|
+
"system.no_products_available": "No products available",
|
|
826
|
+
"system.original_price": "Original price:",
|
|
827
|
+
"system.price": "Price:",
|
|
828
|
+
"system.letters_only": "Only letters are allowed.",
|
|
829
|
+
"system.numbers_only": "Only numbers are allowed."
|
|
830
|
+
},
|
|
831
|
+
customSelectors: {
|
|
832
|
+
quantity: null,
|
|
833
|
+
addToCartButton: null,
|
|
834
|
+
variantPicker: null,
|
|
835
|
+
price: null,
|
|
836
|
+
priceCompare: null
|
|
837
|
+
},
|
|
838
|
+
featureFlags: {},
|
|
839
|
+
shopCustomStyles: ""
|
|
840
|
+
},
|
|
841
|
+
dealBlock: {
|
|
842
|
+
id: "example",
|
|
843
|
+
nanoId: "example",
|
|
844
|
+
blockName: "Bundle",
|
|
845
|
+
discountName: "",
|
|
846
|
+
blockTitle: "BUNDLE & SAVE",
|
|
847
|
+
blockLayout: "vertical",
|
|
848
|
+
blockVisibility: "all-products",
|
|
849
|
+
marketId: null,
|
|
850
|
+
currency: null,
|
|
851
|
+
excludeB2bCustomers: !1,
|
|
852
|
+
excludePos: !1,
|
|
853
|
+
startTimestamp: 0,
|
|
854
|
+
endTimestamp: null,
|
|
855
|
+
differentVariantsEnabled: !0,
|
|
856
|
+
hideVariantPicker: !0,
|
|
857
|
+
disableVariantOptionSync: !1,
|
|
858
|
+
hideUnavailableOptions: !1,
|
|
859
|
+
showPricesPerItem: !1,
|
|
860
|
+
showBothPrices: !1,
|
|
861
|
+
unitLabel: "",
|
|
862
|
+
useProductCompareAtPrice: !0,
|
|
863
|
+
showPricesWithoutDecimals: !1,
|
|
864
|
+
priceRounding: !1,
|
|
865
|
+
priceRoundingPrecision: ".00",
|
|
866
|
+
updateNativePrice: !1,
|
|
867
|
+
updateNativePriceType: "item",
|
|
868
|
+
skipCart: !1,
|
|
869
|
+
showVariantsForSingleQuantity: !1,
|
|
870
|
+
preselectedDealBarId: "duo",
|
|
871
|
+
cornerRadius: 16,
|
|
872
|
+
spacing: 1,
|
|
873
|
+
selectedProductIds: [],
|
|
874
|
+
selectedCollectionIds: [],
|
|
875
|
+
excludedProductIds: [],
|
|
876
|
+
excludedCollectionIds: [],
|
|
877
|
+
colors: {
|
|
878
|
+
background: {
|
|
879
|
+
red: 245,
|
|
880
|
+
green: 245,
|
|
881
|
+
blue: 245,
|
|
882
|
+
alpha: 1
|
|
883
|
+
},
|
|
884
|
+
selectedBackground: {
|
|
885
|
+
red: 255,
|
|
886
|
+
green: 255,
|
|
887
|
+
blue: 255,
|
|
888
|
+
alpha: 1
|
|
889
|
+
},
|
|
890
|
+
border: {
|
|
891
|
+
red: 0,
|
|
892
|
+
green: 0,
|
|
893
|
+
blue: 0,
|
|
894
|
+
alpha: 1
|
|
895
|
+
},
|
|
896
|
+
blockTitle: {
|
|
897
|
+
red: 0,
|
|
898
|
+
green: 0,
|
|
899
|
+
blue: 0,
|
|
900
|
+
alpha: 1
|
|
901
|
+
},
|
|
902
|
+
title: {
|
|
903
|
+
red: 0,
|
|
904
|
+
green: 0,
|
|
905
|
+
blue: 0,
|
|
906
|
+
alpha: 1
|
|
907
|
+
},
|
|
908
|
+
subtitle: {
|
|
909
|
+
red: 85,
|
|
910
|
+
green: 85,
|
|
911
|
+
blue: 85,
|
|
912
|
+
alpha: 1
|
|
913
|
+
},
|
|
914
|
+
price: {
|
|
915
|
+
red: 0,
|
|
916
|
+
green: 0,
|
|
917
|
+
blue: 0,
|
|
918
|
+
alpha: 1
|
|
919
|
+
},
|
|
920
|
+
fullPrice: {
|
|
921
|
+
red: 85,
|
|
922
|
+
green: 85,
|
|
923
|
+
blue: 85,
|
|
924
|
+
alpha: 1
|
|
925
|
+
},
|
|
926
|
+
labelBackground: {
|
|
927
|
+
red: 171,
|
|
928
|
+
green: 239,
|
|
929
|
+
blue: 198,
|
|
930
|
+
alpha: 1
|
|
931
|
+
},
|
|
932
|
+
label: {
|
|
933
|
+
red: 0,
|
|
934
|
+
green: 0,
|
|
935
|
+
blue: 0,
|
|
936
|
+
alpha: 1
|
|
937
|
+
},
|
|
938
|
+
badgeBackground: {
|
|
939
|
+
red: 0,
|
|
940
|
+
green: 0,
|
|
941
|
+
blue: 0,
|
|
942
|
+
alpha: 1
|
|
943
|
+
},
|
|
944
|
+
badgeText: {
|
|
945
|
+
red: 255,
|
|
946
|
+
green: 255,
|
|
947
|
+
blue: 255,
|
|
948
|
+
alpha: 1
|
|
949
|
+
},
|
|
950
|
+
freeGiftBackground: {
|
|
951
|
+
red: 0,
|
|
952
|
+
green: 0,
|
|
953
|
+
blue: 0,
|
|
954
|
+
alpha: .3
|
|
955
|
+
},
|
|
956
|
+
freeGiftText: {
|
|
957
|
+
red: 0,
|
|
958
|
+
green: 0,
|
|
959
|
+
blue: 0,
|
|
960
|
+
alpha: 1
|
|
961
|
+
},
|
|
962
|
+
freeGiftSelectedBackground: {
|
|
963
|
+
red: 0,
|
|
964
|
+
green: 0,
|
|
965
|
+
blue: 0,
|
|
966
|
+
alpha: 1
|
|
967
|
+
},
|
|
968
|
+
freeGiftSelectedText: {
|
|
969
|
+
red: 255,
|
|
970
|
+
green: 255,
|
|
971
|
+
blue: 255,
|
|
972
|
+
alpha: 1
|
|
973
|
+
},
|
|
974
|
+
upsellBackground: {
|
|
975
|
+
red: 0,
|
|
976
|
+
green: 0,
|
|
977
|
+
blue: 0,
|
|
978
|
+
alpha: .2
|
|
979
|
+
},
|
|
980
|
+
upsellText: {
|
|
981
|
+
red: 0,
|
|
982
|
+
green: 0,
|
|
983
|
+
blue: 0,
|
|
984
|
+
alpha: 1
|
|
985
|
+
},
|
|
986
|
+
upsellSelectedBackground: {
|
|
987
|
+
red: 0,
|
|
988
|
+
green: 0,
|
|
989
|
+
blue: 0,
|
|
990
|
+
alpha: .2
|
|
991
|
+
},
|
|
992
|
+
upsellSelectedText: {
|
|
993
|
+
red: 0,
|
|
994
|
+
green: 0,
|
|
995
|
+
blue: 0,
|
|
996
|
+
alpha: 1
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
fonts: {
|
|
1000
|
+
blockTitle: {
|
|
1001
|
+
size: "14",
|
|
1002
|
+
style: "bold"
|
|
1003
|
+
},
|
|
1004
|
+
title: {
|
|
1005
|
+
size: "20",
|
|
1006
|
+
style: "bold"
|
|
1007
|
+
},
|
|
1008
|
+
subtitle: {
|
|
1009
|
+
size: "14",
|
|
1010
|
+
style: "regular"
|
|
1011
|
+
},
|
|
1012
|
+
label: {
|
|
1013
|
+
size: "12",
|
|
1014
|
+
style: "bold"
|
|
1015
|
+
},
|
|
1016
|
+
freeGift: {
|
|
1017
|
+
size: "13",
|
|
1018
|
+
style: "bold"
|
|
1019
|
+
},
|
|
1020
|
+
upsell: {
|
|
1021
|
+
size: "13",
|
|
1022
|
+
style: "bold"
|
|
1023
|
+
},
|
|
1024
|
+
unitLabel: {
|
|
1025
|
+
size: "14",
|
|
1026
|
+
style: "regular"
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
dealBars: [
|
|
1030
|
+
{
|
|
1031
|
+
id: "single",
|
|
1032
|
+
dealBarType: $.QuantityBreak,
|
|
1033
|
+
quantitySelector: !1,
|
|
1034
|
+
title: "Single",
|
|
1035
|
+
subtitle: "Standard price",
|
|
1036
|
+
label: "",
|
|
1037
|
+
quantity: 1,
|
|
1038
|
+
discountType: "default",
|
|
1039
|
+
discountValue: "",
|
|
1040
|
+
badgeStyle: "simple",
|
|
1041
|
+
badgeText: "",
|
|
1042
|
+
badgeImageGID: null,
|
|
1043
|
+
mediaImageGID: null,
|
|
1044
|
+
freeGifts: [],
|
|
1045
|
+
multipleGiftsSelectors: [],
|
|
1046
|
+
upsells: [],
|
|
1047
|
+
showAsSoldOutEnabled: !1,
|
|
1048
|
+
showAsSoldOut: null,
|
|
1049
|
+
productPersonalisation: null,
|
|
1050
|
+
highlights: null,
|
|
1051
|
+
sellingPlanEnabled: !1,
|
|
1052
|
+
sellingPlanGid: null,
|
|
1053
|
+
subscriptionMode: "customer-choice"
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
id: "duo",
|
|
1057
|
+
dealBarType: $.QuantityBreak,
|
|
1058
|
+
quantitySelector: !1,
|
|
1059
|
+
title: "Duo",
|
|
1060
|
+
subtitle: "You save 20%",
|
|
1061
|
+
label: "SAVE $32",
|
|
1062
|
+
quantity: 2,
|
|
1063
|
+
discountType: "percentage",
|
|
1064
|
+
discountValue: "20",
|
|
1065
|
+
badgeStyle: "most-popular",
|
|
1066
|
+
badgeText: "",
|
|
1067
|
+
badgeImageGID: null,
|
|
1068
|
+
mediaImageGID: null,
|
|
1069
|
+
freeGifts: [],
|
|
1070
|
+
multipleGiftsSelectors: [],
|
|
1071
|
+
upsells: [],
|
|
1072
|
+
showAsSoldOutEnabled: !1,
|
|
1073
|
+
showAsSoldOut: null,
|
|
1074
|
+
productPersonalisation: null,
|
|
1075
|
+
highlights: null,
|
|
1076
|
+
sellingPlanEnabled: !1,
|
|
1077
|
+
sellingPlanGid: null,
|
|
1078
|
+
subscriptionMode: "customer-choice"
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
id: "trio",
|
|
1082
|
+
dealBarType: $.QuantityBreak,
|
|
1083
|
+
quantitySelector: !1,
|
|
1084
|
+
title: "Trio",
|
|
1085
|
+
subtitle: "You save 25%",
|
|
1086
|
+
label: "SAVE $60",
|
|
1087
|
+
quantity: 3,
|
|
1088
|
+
discountType: "percentage",
|
|
1089
|
+
discountValue: "25",
|
|
1090
|
+
badgeStyle: "simple",
|
|
1091
|
+
badgeText: "",
|
|
1092
|
+
badgeImageGID: null,
|
|
1093
|
+
mediaImageGID: null,
|
|
1094
|
+
freeGifts: [],
|
|
1095
|
+
multipleGiftsSelectors: [],
|
|
1096
|
+
upsells: [],
|
|
1097
|
+
showAsSoldOutEnabled: !1,
|
|
1098
|
+
showAsSoldOut: null,
|
|
1099
|
+
productPersonalisation: null,
|
|
1100
|
+
highlights: null,
|
|
1101
|
+
sellingPlanEnabled: !1,
|
|
1102
|
+
sellingPlanGid: null,
|
|
1103
|
+
subscriptionMode: "customer-choice"
|
|
1104
|
+
}
|
|
1105
|
+
],
|
|
1106
|
+
badgesEnabled: !0,
|
|
1107
|
+
badges: [{
|
|
1108
|
+
id: "bdg1",
|
|
1109
|
+
attachedTo: {
|
|
1110
|
+
type: "dealBar",
|
|
1111
|
+
dealBarId: "duo"
|
|
1112
|
+
},
|
|
1113
|
+
text: "MOST POPULAR",
|
|
1114
|
+
colors: null,
|
|
1115
|
+
badgeType: "most-popular",
|
|
1116
|
+
size: 90
|
|
1117
|
+
}],
|
|
1118
|
+
swatchOptions: [],
|
|
1119
|
+
swatchSize: 18,
|
|
1120
|
+
swatchShape: "circle",
|
|
1121
|
+
imageSize: 48,
|
|
1122
|
+
imageCornerRadius: 6,
|
|
1123
|
+
defaultVariantsV2: [],
|
|
1124
|
+
collectionBreaksEnabled: !1,
|
|
1125
|
+
collectionBreaks: null,
|
|
1126
|
+
chooseProductModal: null,
|
|
1127
|
+
timerEnabled: !1,
|
|
1128
|
+
timer: null,
|
|
1129
|
+
subscriptionsEnabled: !1,
|
|
1130
|
+
subscriptions: null,
|
|
1131
|
+
stickyAtcEnabled: !1,
|
|
1132
|
+
stickyAtc: null,
|
|
1133
|
+
progressiveGiftsEnabled: !1,
|
|
1134
|
+
progressiveGifts: null,
|
|
1135
|
+
checkboxUpsellsEnabled: !1,
|
|
1136
|
+
checkboxUpsells: null,
|
|
1137
|
+
customStylesEnabled: !1,
|
|
1138
|
+
shopCustomStyles: "",
|
|
1139
|
+
customStyles: "",
|
|
1140
|
+
lowStockAlertEnabled: !1,
|
|
1141
|
+
lowStockAlert: null
|
|
1142
|
+
},
|
|
1143
|
+
product: {
|
|
1144
|
+
id: 1,
|
|
1145
|
+
handle: "example-product",
|
|
1146
|
+
url: null,
|
|
1147
|
+
availableForSale: !0,
|
|
1148
|
+
title: "Example product",
|
|
1149
|
+
image: null,
|
|
1150
|
+
collectionIds: [],
|
|
1151
|
+
options: [],
|
|
1152
|
+
selectedVariantId: 1,
|
|
1153
|
+
variants: [{
|
|
1154
|
+
id: 1,
|
|
1155
|
+
availableForSale: !0,
|
|
1156
|
+
price: 8e3,
|
|
1157
|
+
compareAtPrice: null,
|
|
1158
|
+
options: ["Default Title"],
|
|
1159
|
+
imageId: null,
|
|
1160
|
+
image: null,
|
|
1161
|
+
unitPriceMeasurement: null,
|
|
1162
|
+
sellingPlans: [],
|
|
1163
|
+
inventoryManagement: null,
|
|
1164
|
+
inventoryPolicy: null,
|
|
1165
|
+
inventoryQuantity: 50
|
|
1166
|
+
}],
|
|
1167
|
+
metafields: {
|
|
1168
|
+
text: null,
|
|
1169
|
+
text2: null,
|
|
1170
|
+
text3: null,
|
|
1171
|
+
text4: null
|
|
1172
|
+
},
|
|
1173
|
+
requiresSellingPlan: !1,
|
|
1174
|
+
sellingPlans: [],
|
|
1175
|
+
isNativeBundle: !1
|
|
1176
|
+
},
|
|
1177
|
+
otherProducts: [],
|
|
1178
|
+
mediaImages: [],
|
|
1179
|
+
collectionBreaksProducts: [],
|
|
1180
|
+
translations: {}
|
|
1181
|
+
}, ge = class extends HTMLElement {
|
|
1182
|
+
constructor(...e) {
|
|
1183
|
+
super(...e), this.innerElement = null, this.handleItemsChanged = null, this.initializeId = 0;
|
|
1184
|
+
}
|
|
1185
|
+
static get observedAttributes() {
|
|
1186
|
+
return [
|
|
1187
|
+
"selected-variant-id",
|
|
1188
|
+
"product-id",
|
|
1189
|
+
"country",
|
|
1190
|
+
"language"
|
|
1191
|
+
];
|
|
1192
|
+
}
|
|
1193
|
+
async connectedCallback() {
|
|
1194
|
+
await this.initialize();
|
|
1195
|
+
}
|
|
1196
|
+
async initialize() {
|
|
1197
|
+
let e = ++this.initializeId;
|
|
1198
|
+
if (this.cleanup(), this.hasAttribute("demo")) {
|
|
1199
|
+
if (await Z(window), e !== this.initializeId) return;
|
|
1200
|
+
this.renderInnerElement(he);
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
let t = this.getAttribute("shop-domain"), n = this.getAttribute("storefront-token"), r = this.getAttribute("product-id");
|
|
1204
|
+
if (!t || !n || !r) return;
|
|
1205
|
+
let [i] = await Promise.all([q({
|
|
1206
|
+
shopifyDomain: t,
|
|
1207
|
+
storefrontAccessToken: n
|
|
1208
|
+
}, {
|
|
1209
|
+
productId: r,
|
|
1210
|
+
dealBlockId: this.getAttribute("deal-block-id") ?? void 0,
|
|
1211
|
+
country: this.getAttribute("country")?.toUpperCase() ?? void 0,
|
|
1212
|
+
language: this.getAttribute("language")?.toUpperCase() ?? void 0
|
|
1213
|
+
}), Z(window)]);
|
|
1214
|
+
i && e === this.initializeId && this.renderInnerElement(i);
|
|
1215
|
+
}
|
|
1216
|
+
renderInnerElement(e) {
|
|
1217
|
+
let { config: t, dealBlock: n, product: r, otherProducts: i, mediaImages: a, collectionBreaksProducts: o, translations: s } = e;
|
|
1218
|
+
this.innerElement = document.createElement("kaching-bundles-block"), this.innerElement.setAttribute("deal-block-id", n.id), this.innerElement.setAttribute("config", JSON.stringify(t)), this.innerElement.setAttribute("deal-block", JSON.stringify(n)), this.innerElement.setAttribute("media-images", JSON.stringify(a ?? [])), this.innerElement.setAttribute("product", JSON.stringify(r)), this.innerElement.setAttribute("other-products", JSON.stringify(i ?? [])), this.innerElement.setAttribute("collection-breaks-products", JSON.stringify(o ?? [])), this.innerElement.setAttribute("translations", JSON.stringify(s ?? {}));
|
|
1219
|
+
let c = this.getAttribute("selected-variant-id");
|
|
1220
|
+
this.innerElement.setAttribute("current-variant-id", String(c ? c.split("/").pop() : r.variants[0].id)), this.hasAttribute("compact") && this.innerElement.setAttribute("compact", "");
|
|
1221
|
+
let l = this.innerElement, u = () => {
|
|
1222
|
+
if (this.innerElement !== l) return;
|
|
1223
|
+
let e = l.items();
|
|
1224
|
+
e && this.dispatchEvent(new CustomEvent("items-changed", {
|
|
1225
|
+
detail: { items: e },
|
|
1226
|
+
bubbles: !0
|
|
1227
|
+
}));
|
|
1228
|
+
};
|
|
1229
|
+
this.handleItemsChanged = (e) => {
|
|
1230
|
+
e.stopPropagation(), u();
|
|
1231
|
+
};
|
|
1232
|
+
let d = this.handleItemsChanged;
|
|
1233
|
+
l.addEventListener("kaching-bundles-block-loaded", () => {
|
|
1234
|
+
this.innerElement === l && (l.addEventListener("items-changed", d), this.dispatchEvent(new CustomEvent("loaded", { bubbles: !0 })));
|
|
1235
|
+
}, { once: !0 }), this.appendChild(this.innerElement);
|
|
1236
|
+
}
|
|
1237
|
+
cleanup() {
|
|
1238
|
+
this.handleItemsChanged && this.innerElement && (this.innerElement.removeEventListener("items-changed", this.handleItemsChanged), this.handleItemsChanged = null), this.innerElement &&= (this.innerElement.remove(), null);
|
|
1239
|
+
}
|
|
1240
|
+
attributeChangedCallback(e, t, n) {
|
|
1241
|
+
t !== n && this.isConnected && (e === "product-id" || e === "country" || e === "language" ? this.initialize() : e === "selected-variant-id" && this.innerElement && n && this.innerElement.setAttribute("current-variant-id", n.includes("/") ? String(n.split("/").pop()) : n));
|
|
1242
|
+
}
|
|
1243
|
+
items() {
|
|
1244
|
+
return this.innerElement ? this.innerElement.items() : [];
|
|
1245
|
+
}
|
|
1246
|
+
disconnectedCallback() {
|
|
1247
|
+
this.cleanup(), this.initializeId++;
|
|
1248
|
+
}
|
|
1497
1249
|
};
|
|
1250
|
+
customElements.define("kaching-bundle-component", ge);
|
|
1251
|
+
export { q as fetchKachingBundlesData };
|