@brytdesigns/shopify-ajax-cart-components 1.0.9 → 1.1.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/dist/esm/index.js +258 -83
- package/dist/esm/index.js.map +1 -1
- package/dist/main/components/cart-context.js +13 -7
- package/dist/main/components/cart-context.js.map +1 -1
- package/dist/main/components/cart-data-array-injection.js +84 -0
- package/dist/main/components/cart-data-array-injection.js.map +1 -0
- package/dist/main/components/cart-data-array-item.js +4 -3
- package/dist/main/components/cart-data-array-item.js.map +1 -1
- package/dist/main/components/cart-data-array.js +7 -11
- package/dist/main/components/cart-data-array.js.map +1 -1
- package/dist/main/components/cart-data-conditions.js +10 -4
- package/dist/main/components/cart-data-conditions.js.map +1 -1
- package/dist/main/components/cart-data-injection.js +11 -13
- package/dist/main/components/cart-data-injection.js.map +1 -1
- package/dist/main/components/cart-data-listener-status.js +4 -6
- package/dist/main/components/cart-data-listener-status.js.map +1 -1
- package/dist/main/components/cart-data-listener.js +5 -7
- package/dist/main/components/cart-data-listener.js.map +1 -1
- package/dist/main/components/cart-data.js +4 -5
- package/dist/main/components/cart-data.js.map +1 -1
- package/dist/main/components/cart-loading-state.js +3 -2
- package/dist/main/components/cart-loading-state.js.map +1 -1
- package/dist/main/components/index.js +20 -9
- package/dist/main/index.js +29 -19
- package/dist/main/index.js.map +1 -1
- package/dist/main/utils/index.js +1 -0
- package/dist/main/utils/traverseObject.js +19 -0
- package/dist/main/utils/traverseObject.js.map +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { customShadowlessElement, correctElementType } from '@brytdesigns/web-component-utils';
|
|
2
|
-
import { splitProps, createEffect, on, Show, For,
|
|
2
|
+
import { splitProps, createEffect, on, createMemo, Show, For, mapArray, onCleanup, createUniqueId } from 'solid-js';
|
|
3
3
|
import AjaxCart from '@brytdesigns/shopify-ajax-cart';
|
|
4
4
|
import { createContext, provide, consume } from 'component-register';
|
|
5
5
|
import html2 from 'solid-js/html';
|
|
6
6
|
import debounce from 'lodash.debounce';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/components/cart-context.ts
|
|
15
|
+
var cart_context_exports = {};
|
|
16
|
+
__export(cart_context_exports, {
|
|
17
|
+
Component: () => Component,
|
|
18
|
+
Name: () => Name
|
|
19
|
+
});
|
|
9
20
|
var AjaxCartContext = createContext(() => () => AjaxCart.data);
|
|
10
21
|
var provideAjaxCartContext = (element) => {
|
|
11
22
|
return provide(AjaxCartContext, {}, element);
|
|
@@ -23,23 +34,6 @@ var useAjaxCart = (element) => {
|
|
|
23
34
|
return useAjaxCartContext(context);
|
|
24
35
|
};
|
|
25
36
|
|
|
26
|
-
// src/components/cart-context.ts
|
|
27
|
-
var CartContext = (props, { element }) => {
|
|
28
|
-
const cart = provideAjaxCartContext(element);
|
|
29
|
-
createEffect(
|
|
30
|
-
on(
|
|
31
|
-
() => ({
|
|
32
|
-
cart: cart(),
|
|
33
|
-
debug: props.debug
|
|
34
|
-
}),
|
|
35
|
-
({ cart: cart2, debug }) => {
|
|
36
|
-
if (!debug) return;
|
|
37
|
-
console.log("Cart updated:", cart2);
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
37
|
// src/utils/getValueFromPath.ts
|
|
44
38
|
function getValueFromPath(obj, path) {
|
|
45
39
|
return path.split(".").reduce((acc, key) => {
|
|
@@ -121,6 +115,51 @@ function parseNestedObject(data) {
|
|
|
121
115
|
}
|
|
122
116
|
return result;
|
|
123
117
|
}
|
|
118
|
+
|
|
119
|
+
// src/utils/traverseObject.ts
|
|
120
|
+
function traverseObject(obj, callback, path = []) {
|
|
121
|
+
if (typeof obj !== "object" || obj === null) return;
|
|
122
|
+
if (Array.isArray(obj)) {
|
|
123
|
+
obj.forEach((item, index) => {
|
|
124
|
+
traverseObject(item, callback, [...path, index.toString()]);
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
for (const key of Object.keys(obj)) {
|
|
128
|
+
const value = obj[key];
|
|
129
|
+
const currentPath = [...path, key];
|
|
130
|
+
traverseObject(value, callback, currentPath);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/components/cart-context.ts
|
|
136
|
+
var Name = "cart-context";
|
|
137
|
+
var Component = (props, { element }) => {
|
|
138
|
+
const cart = provideAjaxCartContext(element);
|
|
139
|
+
createEffect(
|
|
140
|
+
on(
|
|
141
|
+
() => {
|
|
142
|
+
const c = cart();
|
|
143
|
+
traverseObject(c);
|
|
144
|
+
return {
|
|
145
|
+
cart: c,
|
|
146
|
+
debug: props.debug
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
({ cart: cart2, debug }) => {
|
|
150
|
+
if (!debug) return;
|
|
151
|
+
console.log(`${Name}:updated!`, cart2);
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/components/cart-data.ts
|
|
158
|
+
var cart_data_exports = {};
|
|
159
|
+
__export(cart_data_exports, {
|
|
160
|
+
Component: () => Component2,
|
|
161
|
+
Name: () => Name2
|
|
162
|
+
});
|
|
124
163
|
function createFullPathPropertyContext(options) {
|
|
125
164
|
return options.path;
|
|
126
165
|
}
|
|
@@ -204,11 +243,10 @@ var useListenerStatus = (element) => {
|
|
|
204
243
|
}
|
|
205
244
|
return useListenerStatusContext(context);
|
|
206
245
|
};
|
|
207
|
-
var
|
|
246
|
+
var Name2 = "cart-data";
|
|
247
|
+
var Component2 = (props, { element }) => {
|
|
208
248
|
if (!props.propertyName)
|
|
209
|
-
return console.warn(
|
|
210
|
-
"No property-name attribute provided for cart-data component."
|
|
211
|
-
);
|
|
249
|
+
return console.warn(`${Name2}: No property-name attribute provided.`);
|
|
212
250
|
const fullPath = useFullPropertyPath({
|
|
213
251
|
element,
|
|
214
252
|
path: () => props.propertyName
|
|
@@ -224,6 +262,13 @@ var CartData = (props, { element }) => {
|
|
|
224
262
|
<${Show} when=${() => formattedValue() !== null}> ${formattedValue} <//>
|
|
225
263
|
`;
|
|
226
264
|
};
|
|
265
|
+
|
|
266
|
+
// src/components/cart-data-conditions.ts
|
|
267
|
+
var cart_data_conditions_exports = {};
|
|
268
|
+
__export(cart_data_conditions_exports, {
|
|
269
|
+
Component: () => Component3,
|
|
270
|
+
Name: () => Name3
|
|
271
|
+
});
|
|
227
272
|
function getValue(data, value) {
|
|
228
273
|
if (typeof value === "undefined" || !data) return void 0;
|
|
229
274
|
if (value.type === "primitive") {
|
|
@@ -247,6 +292,11 @@ function validateConditions(conditions, data) {
|
|
|
247
292
|
if (condition.type === "typeof") {
|
|
248
293
|
result2 = typeof valueA === valueB;
|
|
249
294
|
}
|
|
295
|
+
if (condition.type === "includes") {
|
|
296
|
+
result2 = formatValue(condition.format || "", valueA).includes(
|
|
297
|
+
formatValue(condition.format || "", valueB)
|
|
298
|
+
);
|
|
299
|
+
}
|
|
250
300
|
if (condition.type === "includes_property") {
|
|
251
301
|
result2 = valueA.some(
|
|
252
302
|
(v) => v[condition.valueA?.property_name || ""] === valueB
|
|
@@ -274,19 +324,20 @@ function validateConditions(conditions, data) {
|
|
|
274
324
|
});
|
|
275
325
|
return result;
|
|
276
326
|
}
|
|
277
|
-
var
|
|
327
|
+
var Name3 = "cart-data-conditions";
|
|
328
|
+
var Component3 = (_, { element }) => {
|
|
278
329
|
const conditionTemplates = Array.from(element.children).filter(
|
|
279
330
|
(child) => child.tagName === "TEMPLATE" && child.hasAttribute("conditions")
|
|
280
331
|
);
|
|
281
332
|
if (!conditionTemplates.length)
|
|
282
333
|
return console.error(
|
|
283
|
-
|
|
334
|
+
`${Name3}: no templates found with any conditions attribute!`
|
|
284
335
|
);
|
|
285
336
|
const allConditions = createMemo(
|
|
286
337
|
() => conditionTemplates.map((tmpl) => {
|
|
287
338
|
const conditions = tmpl.getAttribute("conditions");
|
|
288
339
|
if (!conditions)
|
|
289
|
-
console.warn(
|
|
340
|
+
console.warn(`${Name3}: conditions attribute is required!`);
|
|
290
341
|
try {
|
|
291
342
|
return JSON.parse(conditions);
|
|
292
343
|
} catch (e) {
|
|
@@ -313,14 +364,21 @@ var CartDataConditions = (_, { element }) => {
|
|
|
313
364
|
<//>
|
|
314
365
|
`;
|
|
315
366
|
};
|
|
316
|
-
|
|
367
|
+
|
|
368
|
+
// src/components/cart-data-array.ts
|
|
369
|
+
var cart_data_array_exports = {};
|
|
370
|
+
__export(cart_data_array_exports, {
|
|
371
|
+
Component: () => Component4,
|
|
372
|
+
Name: () => Name4
|
|
373
|
+
});
|
|
374
|
+
var Name4 = "cart-data-array";
|
|
375
|
+
var Component4 = (props, { element }) => {
|
|
317
376
|
const itemTemplate = getTemplateContent(element, "item");
|
|
318
377
|
if (!itemTemplate)
|
|
319
378
|
return console.warn(
|
|
320
|
-
|
|
379
|
+
`${Name4}: No template found with a property of 'item'.`
|
|
321
380
|
);
|
|
322
|
-
if (!props.arrayPath)
|
|
323
|
-
return console.warn("cart-data-array: No array path provided.");
|
|
381
|
+
if (!props.arrayPath) return console.warn(`${Name4}: No array path provided.`);
|
|
324
382
|
const mergedProps = {
|
|
325
383
|
element,
|
|
326
384
|
path: () => props.arrayPath
|
|
@@ -337,15 +395,11 @@ var CartDataArray = (props, { element }) => {
|
|
|
337
395
|
const arrayValue = () => {
|
|
338
396
|
const v = value();
|
|
339
397
|
if (!v) {
|
|
340
|
-
console.warn(
|
|
341
|
-
`cart-data-array: value is null or undefined at path ${fullPath()}`
|
|
342
|
-
);
|
|
398
|
+
console.warn(`${Name4}: value is null or undefined at path ${fullPath()}`);
|
|
343
399
|
return null;
|
|
344
400
|
}
|
|
345
401
|
if (!Array.isArray(v)) {
|
|
346
|
-
console.warn(
|
|
347
|
-
`cart-data-array: value is not an array at path ${fullPath()}`
|
|
348
|
-
);
|
|
402
|
+
console.warn(`${Name4}: value is not an array at path ${fullPath()}`);
|
|
349
403
|
return null;
|
|
350
404
|
}
|
|
351
405
|
return v;
|
|
@@ -364,10 +418,98 @@ var CartDataArray = (props, { element }) => {
|
|
|
364
418
|
`;
|
|
365
419
|
};
|
|
366
420
|
|
|
421
|
+
// src/components/cart-data-array-injection.ts
|
|
422
|
+
var cart_data_array_injection_exports = {};
|
|
423
|
+
__export(cart_data_array_injection_exports, {
|
|
424
|
+
Component: () => Component5,
|
|
425
|
+
Name: () => Name5
|
|
426
|
+
});
|
|
427
|
+
var Name5 = "cart-data-array-injection";
|
|
428
|
+
var Component5 = (props, { element }) => {
|
|
429
|
+
const itemTemplate = getTemplateContent(element, "item");
|
|
430
|
+
if (!itemTemplate)
|
|
431
|
+
return console.warn(
|
|
432
|
+
`${Name5}: No template found with a property of 'item'.`
|
|
433
|
+
);
|
|
434
|
+
if (!props.arrayPath) return console.warn(`${Name5}: No array path provided.`);
|
|
435
|
+
const mergedProps = {
|
|
436
|
+
element,
|
|
437
|
+
path: () => props.arrayPath
|
|
438
|
+
};
|
|
439
|
+
const fullPath = useFullPropertyPath(mergedProps);
|
|
440
|
+
provideFullPropertyPathContext({
|
|
441
|
+
element,
|
|
442
|
+
path: fullPath
|
|
443
|
+
});
|
|
444
|
+
const value = useCartValue({
|
|
445
|
+
element,
|
|
446
|
+
path: fullPath
|
|
447
|
+
});
|
|
448
|
+
const arrayValue = () => {
|
|
449
|
+
const v = value();
|
|
450
|
+
if (!v) {
|
|
451
|
+
console.warn(`${Name5}: value is null or undefined at path ${fullPath()}`);
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
if (!Array.isArray(v)) {
|
|
455
|
+
console.warn(`${Name5}: value is not an array at path ${fullPath()}`);
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
return v;
|
|
459
|
+
};
|
|
460
|
+
const children = createMemo(
|
|
461
|
+
mapArray(arrayValue, (item, idx) => {
|
|
462
|
+
const itemNode = itemTemplate.cloneNode(true);
|
|
463
|
+
if (props.wrapInnerChild) {
|
|
464
|
+
const firstItem = itemNode.firstChild;
|
|
465
|
+
if (!firstItem) return null;
|
|
466
|
+
const children2 = Array.from(firstItem.childNodes);
|
|
467
|
+
const wrapper = html2`
|
|
468
|
+
<cart-data-array-item item-index=${() => `${idx()}`}>
|
|
469
|
+
${() => Array.from(children2)}
|
|
470
|
+
</cart-data-array-item>
|
|
471
|
+
`;
|
|
472
|
+
for (const node of children2) {
|
|
473
|
+
firstItem.replaceChild(
|
|
474
|
+
node,
|
|
475
|
+
Array.isArray(wrapper) ? wrapper.at(0) : wrapper
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
return firstItem;
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
);
|
|
482
|
+
element.replaceChildren(...[]);
|
|
483
|
+
createEffect(
|
|
484
|
+
on(
|
|
485
|
+
() => {
|
|
486
|
+
const rootElement = element;
|
|
487
|
+
return {
|
|
488
|
+
target: getTargetElement(rootElement, props.target),
|
|
489
|
+
children: children()
|
|
490
|
+
};
|
|
491
|
+
},
|
|
492
|
+
({ children: children2, target }) => {
|
|
493
|
+
if (!target) return;
|
|
494
|
+
const filteredChildren = children2.filter(
|
|
495
|
+
(v) => v !== null && v !== void 0
|
|
496
|
+
);
|
|
497
|
+
target.replaceChildren(...filteredChildren);
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
);
|
|
501
|
+
};
|
|
502
|
+
|
|
367
503
|
// src/components/cart-data-array-item.ts
|
|
368
|
-
var
|
|
504
|
+
var cart_data_array_item_exports = {};
|
|
505
|
+
__export(cart_data_array_item_exports, {
|
|
506
|
+
Component: () => Component6,
|
|
507
|
+
Name: () => Name6
|
|
508
|
+
});
|
|
509
|
+
var Name6 = "cart-data-array-item";
|
|
510
|
+
var Component6 = (props, { element }) => {
|
|
369
511
|
if (!props.itemIndex)
|
|
370
|
-
return console.warn(
|
|
512
|
+
return console.warn(`${Name6}: No path attribute provided.`);
|
|
371
513
|
const mergedProps = {
|
|
372
514
|
element,
|
|
373
515
|
path: () => props.itemIndex
|
|
@@ -378,7 +520,15 @@ var CartDataArrayItem = (props, { element }) => {
|
|
|
378
520
|
path: fullPath
|
|
379
521
|
});
|
|
380
522
|
};
|
|
381
|
-
|
|
523
|
+
|
|
524
|
+
// src/components/cart-data-listener.ts
|
|
525
|
+
var cart_data_listener_exports = {};
|
|
526
|
+
__export(cart_data_listener_exports, {
|
|
527
|
+
Component: () => Component7,
|
|
528
|
+
Name: () => Name7
|
|
529
|
+
});
|
|
530
|
+
var Name7 = "cart-data-listener";
|
|
531
|
+
var Component7 = (props, { element }) => {
|
|
382
532
|
const [_, setStatus] = provideListenerStatusContext({
|
|
383
533
|
element,
|
|
384
534
|
get status() {
|
|
@@ -406,7 +556,7 @@ var CartDataListener = (props, { element }) => {
|
|
|
406
556
|
}),
|
|
407
557
|
({
|
|
408
558
|
method,
|
|
409
|
-
on:
|
|
559
|
+
on: on5,
|
|
410
560
|
preventDefault,
|
|
411
561
|
data: data2,
|
|
412
562
|
debounceDelay,
|
|
@@ -414,11 +564,8 @@ var CartDataListener = (props, { element }) => {
|
|
|
414
564
|
resetStatusDelay
|
|
415
565
|
}) => {
|
|
416
566
|
if (!method)
|
|
417
|
-
return console.error(
|
|
418
|
-
|
|
419
|
-
);
|
|
420
|
-
if (!on4)
|
|
421
|
-
return console.error("cart-item-listener: on property is required!");
|
|
567
|
+
return console.error(`${Name7}: method property is required!`);
|
|
568
|
+
if (!on5) return console.error(`${Name7}: on property is required!`);
|
|
422
569
|
let resetStatusId = null, tempEventId = null;
|
|
423
570
|
function onEvent(e) {
|
|
424
571
|
const cart = AjaxCart;
|
|
@@ -443,7 +590,7 @@ var CartDataListener = (props, { element }) => {
|
|
|
443
590
|
}
|
|
444
591
|
});
|
|
445
592
|
}
|
|
446
|
-
if (
|
|
593
|
+
if (on5 === "submit") {
|
|
447
594
|
let reset2 = function() {
|
|
448
595
|
if (resetForm) form.reset();
|
|
449
596
|
};
|
|
@@ -515,7 +662,7 @@ var CartDataListener = (props, { element }) => {
|
|
|
515
662
|
}
|
|
516
663
|
const handleEvent = debounce(onEvent, debounceDelay), controller = new AbortController();
|
|
517
664
|
element.addEventListener(
|
|
518
|
-
|
|
665
|
+
on5,
|
|
519
666
|
(e) => {
|
|
520
667
|
if (preventDefault) e.preventDefault();
|
|
521
668
|
handleEvent(e);
|
|
@@ -531,12 +678,17 @@ var CartDataListener = (props, { element }) => {
|
|
|
531
678
|
)
|
|
532
679
|
);
|
|
533
680
|
};
|
|
534
|
-
|
|
681
|
+
|
|
682
|
+
// src/components/cart-data-listener-status.ts
|
|
683
|
+
var cart_data_listener_status_exports = {};
|
|
684
|
+
__export(cart_data_listener_status_exports, {
|
|
685
|
+
Component: () => Component8,
|
|
686
|
+
Name: () => Name8
|
|
687
|
+
});
|
|
688
|
+
var Name8 = "cart-data-listener-status";
|
|
689
|
+
var Component8 = (_, { element }) => {
|
|
535
690
|
const [status] = useListenerStatus(element);
|
|
536
|
-
if (!status)
|
|
537
|
-
return console.error(
|
|
538
|
-
"cart-data-listener-status: no listener context provided!"
|
|
539
|
-
);
|
|
691
|
+
if (!status) return console.error(`${Name8}: no listener context provided!`);
|
|
540
692
|
const templates = {
|
|
541
693
|
default: getTemplateContent(element, "default"),
|
|
542
694
|
loading: getTemplateContent(element, "loading"),
|
|
@@ -559,20 +711,23 @@ var CartDataListenerStatus = (_, { element }) => {
|
|
|
559
711
|
return Array.from(template.cloneNode(true).childNodes);
|
|
560
712
|
});
|
|
561
713
|
};
|
|
714
|
+
|
|
715
|
+
// src/components/cart-data-injection.ts
|
|
716
|
+
var cart_data_injection_exports = {};
|
|
717
|
+
__export(cart_data_injection_exports, {
|
|
718
|
+
Component: () => Component9,
|
|
719
|
+
Name: () => Name9
|
|
720
|
+
});
|
|
562
721
|
var VALID_INJECTION_TYPES = ["attribute", "property", "template"];
|
|
563
|
-
var
|
|
722
|
+
var Name9 = "cart-data-injection";
|
|
723
|
+
var Component9 = (props, { element }) => {
|
|
564
724
|
if (!props.propertyName)
|
|
565
|
-
return console.warn(
|
|
566
|
-
if (!props.target)
|
|
567
|
-
return console.warn("cart-data-injection: No target attribute found!");
|
|
725
|
+
return console.warn(`${Name9}: No path attribute provided.`);
|
|
726
|
+
if (!props.target) return console.warn(`${Name9}: No target attribute found!`);
|
|
568
727
|
if (!props.attributeName)
|
|
569
|
-
return console.warn(
|
|
570
|
-
"cart-data-injection: No attribute-name attribute found!"
|
|
571
|
-
);
|
|
728
|
+
return console.warn(`${Name9}: No attribute-name attribute found!`);
|
|
572
729
|
if (!props.injectionType || props.injectionType && !VALID_INJECTION_TYPES.includes(props.injectionType))
|
|
573
|
-
return console.warn(
|
|
574
|
-
"cart-data-injection: Invalid injection-type attribute provided."
|
|
575
|
-
);
|
|
730
|
+
return console.warn(`${Name9}: Invalid injection-type attribute provided.`);
|
|
576
731
|
const mergedProps = {
|
|
577
732
|
element,
|
|
578
733
|
path: () => props.propertyName
|
|
@@ -599,7 +754,7 @@ var CartDataInjection = (props, { element }) => {
|
|
|
599
754
|
({ target, value: value2, attributeName, injectionType, propertyName }) => {
|
|
600
755
|
if (!target)
|
|
601
756
|
return console.warn(
|
|
602
|
-
|
|
757
|
+
`${Name9}: Unable to find element with selector of: ${props.target}`
|
|
603
758
|
);
|
|
604
759
|
if (injectionType === "attribute" && value2 !== null && value2 !== void 0) {
|
|
605
760
|
target.setAttribute(attributeName, value2);
|
|
@@ -625,7 +780,9 @@ var CartDataInjection = (props, { element }) => {
|
|
|
625
780
|
}
|
|
626
781
|
const tmpValue = target.getAttribute(attributeName);
|
|
627
782
|
if (!tmpValue || !value2)
|
|
628
|
-
return console.warn(
|
|
783
|
+
return console.warn(
|
|
784
|
+
`${Name9}: Unable to inject value into template`
|
|
785
|
+
);
|
|
629
786
|
setTimeout(() => {
|
|
630
787
|
target.setAttribute(
|
|
631
788
|
attributeName,
|
|
@@ -640,7 +797,15 @@ var CartDataInjection = (props, { element }) => {
|
|
|
640
797
|
)
|
|
641
798
|
);
|
|
642
799
|
};
|
|
643
|
-
|
|
800
|
+
|
|
801
|
+
// src/components/cart-loading-state.ts
|
|
802
|
+
var cart_loading_state_exports = {};
|
|
803
|
+
__export(cart_loading_state_exports, {
|
|
804
|
+
Component: () => Component10,
|
|
805
|
+
Name: () => Name10
|
|
806
|
+
});
|
|
807
|
+
var Name10 = "cart-loading-state";
|
|
808
|
+
var Component10 = (props, { element }) => {
|
|
644
809
|
const cart = AjaxCart;
|
|
645
810
|
const templates = {
|
|
646
811
|
pending: getTemplateContent(element, "pending"),
|
|
@@ -673,39 +838,49 @@ var CartLoadingState = (props, { element }) => {
|
|
|
673
838
|
|
|
674
839
|
// src/index.ts
|
|
675
840
|
customShadowlessElement(
|
|
676
|
-
|
|
841
|
+
cart_context_exports.Name,
|
|
677
842
|
{ debug: false },
|
|
678
|
-
correctElementType(
|
|
843
|
+
correctElementType(cart_context_exports.Component)
|
|
679
844
|
);
|
|
680
845
|
customShadowlessElement(
|
|
681
|
-
|
|
846
|
+
cart_data_array_item_exports.Name,
|
|
682
847
|
//@ts-ignore
|
|
683
848
|
{ itemIndex: "0" },
|
|
684
|
-
correctElementType(
|
|
849
|
+
correctElementType(cart_data_array_item_exports.Component)
|
|
685
850
|
);
|
|
686
851
|
customShadowlessElement(
|
|
687
|
-
|
|
852
|
+
cart_data_array_exports.Name,
|
|
688
853
|
{
|
|
689
854
|
format: "",
|
|
690
855
|
arrayPath: "items"
|
|
691
856
|
},
|
|
692
|
-
correctElementType(
|
|
857
|
+
correctElementType(cart_data_array_exports.Component)
|
|
858
|
+
);
|
|
859
|
+
customShadowlessElement(
|
|
860
|
+
cart_data_array_injection_exports.Name,
|
|
861
|
+
{
|
|
862
|
+
format: "",
|
|
863
|
+
arrayPath: "items",
|
|
864
|
+
target: "",
|
|
865
|
+
wrapInnerChild: true
|
|
866
|
+
},
|
|
867
|
+
correctElementType(cart_data_array_injection_exports.Component)
|
|
693
868
|
);
|
|
694
869
|
customShadowlessElement(
|
|
695
|
-
|
|
870
|
+
cart_data_exports.Name,
|
|
696
871
|
{
|
|
697
872
|
format: "",
|
|
698
873
|
propertyName: "item_count"
|
|
699
874
|
},
|
|
700
|
-
correctElementType(
|
|
875
|
+
correctElementType(cart_data_exports.Component)
|
|
701
876
|
);
|
|
702
877
|
customShadowlessElement(
|
|
703
|
-
|
|
878
|
+
cart_data_conditions_exports.Name,
|
|
704
879
|
{},
|
|
705
|
-
correctElementType(
|
|
880
|
+
correctElementType(cart_data_conditions_exports.Component)
|
|
706
881
|
);
|
|
707
882
|
customShadowlessElement(
|
|
708
|
-
|
|
883
|
+
cart_data_injection_exports.Name,
|
|
709
884
|
{
|
|
710
885
|
propertyName: "item_count",
|
|
711
886
|
attributeName: "data-item-count",
|
|
@@ -713,10 +888,10 @@ customShadowlessElement(
|
|
|
713
888
|
target: "",
|
|
714
889
|
format: ""
|
|
715
890
|
},
|
|
716
|
-
correctElementType(
|
|
891
|
+
correctElementType(cart_data_injection_exports.Component)
|
|
717
892
|
);
|
|
718
893
|
customShadowlessElement(
|
|
719
|
-
|
|
894
|
+
cart_data_listener_exports.Name,
|
|
720
895
|
{
|
|
721
896
|
status: "default",
|
|
722
897
|
on: "submit",
|
|
@@ -726,17 +901,17 @@ customShadowlessElement(
|
|
|
726
901
|
resetStatusDelay: 0,
|
|
727
902
|
preventDefault: true
|
|
728
903
|
},
|
|
729
|
-
correctElementType(
|
|
904
|
+
correctElementType(cart_data_listener_exports.Component)
|
|
730
905
|
);
|
|
731
906
|
customShadowlessElement(
|
|
732
|
-
|
|
907
|
+
cart_data_listener_status_exports.Name,
|
|
733
908
|
{},
|
|
734
|
-
correctElementType(
|
|
909
|
+
correctElementType(cart_data_listener_status_exports.Component)
|
|
735
910
|
);
|
|
736
911
|
customShadowlessElement(
|
|
737
|
-
|
|
912
|
+
cart_loading_state_exports.Name,
|
|
738
913
|
{ ignoredStates: [] },
|
|
739
|
-
correctElementType(
|
|
914
|
+
correctElementType(cart_loading_state_exports.Component)
|
|
740
915
|
);
|
|
741
916
|
|
|
742
917
|
export { provideAjaxCartContext, provideFullPropertyPathContext, provideListenerStatusContext, useAjaxCart, useAjaxCartContext, useCartValue, useFormattedValue, useFullPropertyPath, useFullPropertyPathContext, useListenerStatus, useListenerStatusContext };
|