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