@moonbase.sh/vue 0.2.22 → 0.2.24
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/index.cjs +9 -4
- package/dist/index.d.cts +80 -40
- package/dist/index.d.ts +80 -40
- package/dist/index.js +9 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -509,6 +509,7 @@ function useCart(context) {
|
|
|
509
509
|
throw new Error("No storefront configured");
|
|
510
510
|
return {
|
|
511
511
|
items: (0, import_vue9.computed)(() => storefront.currentOrder.value.items.map((item) => {
|
|
512
|
+
var _a, _b;
|
|
512
513
|
if (item.type === "Product") {
|
|
513
514
|
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
514
515
|
const variations = (product == null ? void 0 : product.variations) || [];
|
|
@@ -517,7 +518,8 @@ function useCart(context) {
|
|
|
517
518
|
...item,
|
|
518
519
|
product,
|
|
519
520
|
variation,
|
|
520
|
-
price: variation == null ? void 0 : variation.price
|
|
521
|
+
price: variation == null ? void 0 : variation.price,
|
|
522
|
+
appliedDiscount: (_a = variation == null ? void 0 : variation.discount) != null ? _a : item.appliedDiscount
|
|
521
523
|
};
|
|
522
524
|
} else {
|
|
523
525
|
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
@@ -527,7 +529,8 @@ function useCart(context) {
|
|
|
527
529
|
...item,
|
|
528
530
|
bundle,
|
|
529
531
|
variation,
|
|
530
|
-
price: variation == null ? void 0 : variation.price
|
|
532
|
+
price: variation == null ? void 0 : variation.price,
|
|
533
|
+
appliedDiscount: (_b = variation == null ? void 0 : variation.discount) != null ? _b : item.appliedDiscount
|
|
531
534
|
};
|
|
532
535
|
}
|
|
533
536
|
})),
|
|
@@ -569,7 +572,8 @@ function useCart(context) {
|
|
|
569
572
|
quantity: 1,
|
|
570
573
|
variation,
|
|
571
574
|
variationId: variation.id,
|
|
572
|
-
price: variation.price
|
|
575
|
+
price: variation.price,
|
|
576
|
+
appliedDiscount: variation.discount
|
|
573
577
|
};
|
|
574
578
|
storefront.currentOrder.value.items.push(lineItem);
|
|
575
579
|
} else if (item.type === "product") {
|
|
@@ -581,7 +585,8 @@ function useCart(context) {
|
|
|
581
585
|
quantity: 1,
|
|
582
586
|
variation,
|
|
583
587
|
variationId: variation.id,
|
|
584
|
-
price: variation.price
|
|
588
|
+
price: variation.price,
|
|
589
|
+
appliedDiscount: variation.discount
|
|
585
590
|
};
|
|
586
591
|
storefront.currentOrder.value.items.push(lineItem);
|
|
587
592
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -248,13 +248,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
248
248
|
type: "PercentageOffDiscount";
|
|
249
249
|
name: string;
|
|
250
250
|
percentage: number;
|
|
251
|
-
|
|
251
|
+
isExclusive: boolean;
|
|
252
252
|
description?: string | undefined;
|
|
253
|
+
total?: Record<string, number> | undefined;
|
|
253
254
|
} | {
|
|
254
255
|
type: "FlatAmountOffDiscount";
|
|
255
256
|
name: string;
|
|
256
|
-
|
|
257
|
+
isExclusive: boolean;
|
|
257
258
|
description?: string | undefined;
|
|
259
|
+
total?: Record<string, number> | undefined;
|
|
258
260
|
} | undefined;
|
|
259
261
|
} | undefined;
|
|
260
262
|
variations?: {
|
|
@@ -267,13 +269,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
267
269
|
type: "PercentageOffDiscount";
|
|
268
270
|
name: string;
|
|
269
271
|
percentage: number;
|
|
270
|
-
|
|
272
|
+
isExclusive: boolean;
|
|
271
273
|
description?: string | undefined;
|
|
274
|
+
total?: Record<string, number> | undefined;
|
|
272
275
|
} | {
|
|
273
276
|
type: "FlatAmountOffDiscount";
|
|
274
277
|
name: string;
|
|
275
|
-
|
|
278
|
+
isExclusive: boolean;
|
|
276
279
|
description?: string | undefined;
|
|
280
|
+
total?: Record<string, number> | undefined;
|
|
277
281
|
} | undefined;
|
|
278
282
|
}[] | undefined;
|
|
279
283
|
};
|
|
@@ -314,13 +318,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
314
318
|
type: "PercentageOffDiscount";
|
|
315
319
|
name: string;
|
|
316
320
|
percentage: number;
|
|
317
|
-
|
|
321
|
+
isExclusive: boolean;
|
|
318
322
|
description?: string | undefined;
|
|
323
|
+
total?: Record<string, number> | undefined;
|
|
319
324
|
} | {
|
|
320
325
|
type: "FlatAmountOffDiscount";
|
|
321
326
|
name: string;
|
|
322
|
-
|
|
327
|
+
isExclusive: boolean;
|
|
323
328
|
description?: string | undefined;
|
|
329
|
+
total?: Record<string, number> | undefined;
|
|
324
330
|
} | undefined;
|
|
325
331
|
} | undefined;
|
|
326
332
|
variations?: {
|
|
@@ -333,13 +339,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
333
339
|
type: "PercentageOffDiscount";
|
|
334
340
|
name: string;
|
|
335
341
|
percentage: number;
|
|
336
|
-
|
|
342
|
+
isExclusive: boolean;
|
|
337
343
|
description?: string | undefined;
|
|
344
|
+
total?: Record<string, number> | undefined;
|
|
338
345
|
} | {
|
|
339
346
|
type: "FlatAmountOffDiscount";
|
|
340
347
|
name: string;
|
|
341
|
-
|
|
348
|
+
isExclusive: boolean;
|
|
342
349
|
description?: string | undefined;
|
|
350
|
+
total?: Record<string, number> | undefined;
|
|
343
351
|
} | undefined;
|
|
344
352
|
}[] | undefined;
|
|
345
353
|
} & {
|
|
@@ -355,13 +363,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
355
363
|
type: "PercentageOffDiscount";
|
|
356
364
|
name: string;
|
|
357
365
|
percentage: number;
|
|
358
|
-
|
|
366
|
+
isExclusive: boolean;
|
|
359
367
|
description?: string | undefined;
|
|
368
|
+
total?: Record<string, number> | undefined;
|
|
360
369
|
} | {
|
|
361
370
|
type: "FlatAmountOffDiscount";
|
|
362
371
|
name: string;
|
|
363
|
-
|
|
372
|
+
isExclusive: boolean;
|
|
364
373
|
description?: string | undefined;
|
|
374
|
+
total?: Record<string, number> | undefined;
|
|
365
375
|
} | undefined;
|
|
366
376
|
} | undefined;
|
|
367
377
|
variations?: {
|
|
@@ -374,13 +384,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
374
384
|
type: "PercentageOffDiscount";
|
|
375
385
|
name: string;
|
|
376
386
|
percentage: number;
|
|
377
|
-
|
|
387
|
+
isExclusive: boolean;
|
|
378
388
|
description?: string | undefined;
|
|
389
|
+
total?: Record<string, number> | undefined;
|
|
379
390
|
} | {
|
|
380
391
|
type: "FlatAmountOffDiscount";
|
|
381
392
|
name: string;
|
|
382
|
-
|
|
393
|
+
isExclusive: boolean;
|
|
383
394
|
description?: string | undefined;
|
|
395
|
+
total?: Record<string, number> | undefined;
|
|
384
396
|
} | undefined;
|
|
385
397
|
}[] | undefined;
|
|
386
398
|
};
|
|
@@ -420,13 +432,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
420
432
|
type: "PercentageOffDiscount";
|
|
421
433
|
name: string;
|
|
422
434
|
percentage: number;
|
|
423
|
-
|
|
435
|
+
isExclusive: boolean;
|
|
424
436
|
description?: string | undefined;
|
|
437
|
+
total?: Record<string, number> | undefined;
|
|
425
438
|
} | {
|
|
426
439
|
type: "FlatAmountOffDiscount";
|
|
427
440
|
name: string;
|
|
428
|
-
|
|
441
|
+
isExclusive: boolean;
|
|
429
442
|
description?: string | undefined;
|
|
443
|
+
total?: Record<string, number> | undefined;
|
|
430
444
|
} | undefined;
|
|
431
445
|
} | undefined;
|
|
432
446
|
variations?: {
|
|
@@ -439,13 +453,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
439
453
|
type: "PercentageOffDiscount";
|
|
440
454
|
name: string;
|
|
441
455
|
percentage: number;
|
|
442
|
-
|
|
456
|
+
isExclusive: boolean;
|
|
443
457
|
description?: string | undefined;
|
|
458
|
+
total?: Record<string, number> | undefined;
|
|
444
459
|
} | {
|
|
445
460
|
type: "FlatAmountOffDiscount";
|
|
446
461
|
name: string;
|
|
447
|
-
|
|
462
|
+
isExclusive: boolean;
|
|
448
463
|
description?: string | undefined;
|
|
464
|
+
total?: Record<string, number> | undefined;
|
|
449
465
|
} | undefined;
|
|
450
466
|
}[] | undefined;
|
|
451
467
|
};
|
|
@@ -486,13 +502,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
486
502
|
type: "PercentageOffDiscount";
|
|
487
503
|
name: string;
|
|
488
504
|
percentage: number;
|
|
489
|
-
|
|
505
|
+
isExclusive: boolean;
|
|
490
506
|
description?: string | undefined;
|
|
507
|
+
total?: Record<string, number> | undefined;
|
|
491
508
|
} | {
|
|
492
509
|
type: "FlatAmountOffDiscount";
|
|
493
510
|
name: string;
|
|
494
|
-
|
|
511
|
+
isExclusive: boolean;
|
|
495
512
|
description?: string | undefined;
|
|
513
|
+
total?: Record<string, number> | undefined;
|
|
496
514
|
} | undefined;
|
|
497
515
|
} | undefined;
|
|
498
516
|
variations?: {
|
|
@@ -505,13 +523,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
505
523
|
type: "PercentageOffDiscount";
|
|
506
524
|
name: string;
|
|
507
525
|
percentage: number;
|
|
508
|
-
|
|
526
|
+
isExclusive: boolean;
|
|
509
527
|
description?: string | undefined;
|
|
528
|
+
total?: Record<string, number> | undefined;
|
|
510
529
|
} | {
|
|
511
530
|
type: "FlatAmountOffDiscount";
|
|
512
531
|
name: string;
|
|
513
|
-
|
|
532
|
+
isExclusive: boolean;
|
|
514
533
|
description?: string | undefined;
|
|
534
|
+
total?: Record<string, number> | undefined;
|
|
515
535
|
} | undefined;
|
|
516
536
|
}[] | undefined;
|
|
517
537
|
} & {
|
|
@@ -527,13 +547,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
527
547
|
type: "PercentageOffDiscount";
|
|
528
548
|
name: string;
|
|
529
549
|
percentage: number;
|
|
530
|
-
|
|
550
|
+
isExclusive: boolean;
|
|
531
551
|
description?: string | undefined;
|
|
552
|
+
total?: Record<string, number> | undefined;
|
|
532
553
|
} | {
|
|
533
554
|
type: "FlatAmountOffDiscount";
|
|
534
555
|
name: string;
|
|
535
|
-
|
|
556
|
+
isExclusive: boolean;
|
|
536
557
|
description?: string | undefined;
|
|
558
|
+
total?: Record<string, number> | undefined;
|
|
537
559
|
} | undefined;
|
|
538
560
|
} | undefined;
|
|
539
561
|
variations?: {
|
|
@@ -546,13 +568,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
546
568
|
type: "PercentageOffDiscount";
|
|
547
569
|
name: string;
|
|
548
570
|
percentage: number;
|
|
549
|
-
|
|
571
|
+
isExclusive: boolean;
|
|
550
572
|
description?: string | undefined;
|
|
573
|
+
total?: Record<string, number> | undefined;
|
|
551
574
|
} | {
|
|
552
575
|
type: "FlatAmountOffDiscount";
|
|
553
576
|
name: string;
|
|
554
|
-
|
|
577
|
+
isExclusive: boolean;
|
|
555
578
|
description?: string | undefined;
|
|
579
|
+
total?: Record<string, number> | undefined;
|
|
556
580
|
} | undefined;
|
|
557
581
|
}[] | undefined;
|
|
558
582
|
};
|
|
@@ -595,13 +619,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
595
619
|
type: "PercentageOffDiscount";
|
|
596
620
|
name: string;
|
|
597
621
|
percentage: number;
|
|
598
|
-
|
|
622
|
+
isExclusive: boolean;
|
|
599
623
|
description?: string | undefined;
|
|
624
|
+
total?: Record<string, number> | undefined;
|
|
600
625
|
} | {
|
|
601
626
|
type: "FlatAmountOffDiscount";
|
|
602
627
|
name: string;
|
|
603
|
-
|
|
628
|
+
isExclusive: boolean;
|
|
604
629
|
description?: string | undefined;
|
|
630
|
+
total?: Record<string, number> | undefined;
|
|
605
631
|
} | undefined;
|
|
606
632
|
} | undefined;
|
|
607
633
|
variations?: {
|
|
@@ -614,13 +640,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
614
640
|
type: "PercentageOffDiscount";
|
|
615
641
|
name: string;
|
|
616
642
|
percentage: number;
|
|
617
|
-
|
|
643
|
+
isExclusive: boolean;
|
|
618
644
|
description?: string | undefined;
|
|
645
|
+
total?: Record<string, number> | undefined;
|
|
619
646
|
} | {
|
|
620
647
|
type: "FlatAmountOffDiscount";
|
|
621
648
|
name: string;
|
|
622
|
-
|
|
649
|
+
isExclusive: boolean;
|
|
623
650
|
description?: string | undefined;
|
|
651
|
+
total?: Record<string, number> | undefined;
|
|
624
652
|
} | undefined;
|
|
625
653
|
}[] | undefined;
|
|
626
654
|
} | undefined;
|
|
@@ -634,13 +662,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
634
662
|
type: "PercentageOffDiscount";
|
|
635
663
|
name: string;
|
|
636
664
|
percentage: number;
|
|
637
|
-
|
|
665
|
+
isExclusive: boolean;
|
|
638
666
|
description?: string | undefined;
|
|
667
|
+
total?: Record<string, number> | undefined;
|
|
639
668
|
} | {
|
|
640
669
|
type: "FlatAmountOffDiscount";
|
|
641
670
|
name: string;
|
|
642
|
-
|
|
671
|
+
isExclusive: boolean;
|
|
643
672
|
description?: string | undefined;
|
|
673
|
+
total?: Record<string, number> | undefined;
|
|
644
674
|
} | undefined;
|
|
645
675
|
} | undefined;
|
|
646
676
|
appliedDiscount?: {
|
|
@@ -698,13 +728,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
698
728
|
type: "PercentageOffDiscount";
|
|
699
729
|
name: string;
|
|
700
730
|
percentage: number;
|
|
701
|
-
|
|
731
|
+
isExclusive: boolean;
|
|
702
732
|
description?: string | undefined;
|
|
733
|
+
total?: Record<string, number> | undefined;
|
|
703
734
|
} | {
|
|
704
735
|
type: "FlatAmountOffDiscount";
|
|
705
736
|
name: string;
|
|
706
|
-
|
|
737
|
+
isExclusive: boolean;
|
|
707
738
|
description?: string | undefined;
|
|
739
|
+
total?: Record<string, number> | undefined;
|
|
708
740
|
} | undefined;
|
|
709
741
|
} | undefined;
|
|
710
742
|
variations?: {
|
|
@@ -717,13 +749,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
717
749
|
type: "PercentageOffDiscount";
|
|
718
750
|
name: string;
|
|
719
751
|
percentage: number;
|
|
720
|
-
|
|
752
|
+
isExclusive: boolean;
|
|
721
753
|
description?: string | undefined;
|
|
754
|
+
total?: Record<string, number> | undefined;
|
|
722
755
|
} | {
|
|
723
756
|
type: "FlatAmountOffDiscount";
|
|
724
757
|
name: string;
|
|
725
|
-
|
|
758
|
+
isExclusive: boolean;
|
|
726
759
|
description?: string | undefined;
|
|
760
|
+
total?: Record<string, number> | undefined;
|
|
727
761
|
} | undefined;
|
|
728
762
|
}[] | undefined;
|
|
729
763
|
} & {
|
|
@@ -739,13 +773,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
739
773
|
type: "PercentageOffDiscount";
|
|
740
774
|
name: string;
|
|
741
775
|
percentage: number;
|
|
742
|
-
|
|
776
|
+
isExclusive: boolean;
|
|
743
777
|
description?: string | undefined;
|
|
778
|
+
total?: Record<string, number> | undefined;
|
|
744
779
|
} | {
|
|
745
780
|
type: "FlatAmountOffDiscount";
|
|
746
781
|
name: string;
|
|
747
|
-
|
|
782
|
+
isExclusive: boolean;
|
|
748
783
|
description?: string | undefined;
|
|
784
|
+
total?: Record<string, number> | undefined;
|
|
749
785
|
} | undefined;
|
|
750
786
|
} | undefined;
|
|
751
787
|
variations?: {
|
|
@@ -758,13 +794,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
758
794
|
type: "PercentageOffDiscount";
|
|
759
795
|
name: string;
|
|
760
796
|
percentage: number;
|
|
761
|
-
|
|
797
|
+
isExclusive: boolean;
|
|
762
798
|
description?: string | undefined;
|
|
799
|
+
total?: Record<string, number> | undefined;
|
|
763
800
|
} | {
|
|
764
801
|
type: "FlatAmountOffDiscount";
|
|
765
802
|
name: string;
|
|
766
|
-
|
|
803
|
+
isExclusive: boolean;
|
|
767
804
|
description?: string | undefined;
|
|
805
|
+
total?: Record<string, number> | undefined;
|
|
768
806
|
} | undefined;
|
|
769
807
|
}[] | undefined;
|
|
770
808
|
} | undefined;
|
|
@@ -778,13 +816,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
778
816
|
type: "PercentageOffDiscount";
|
|
779
817
|
name: string;
|
|
780
818
|
percentage: number;
|
|
781
|
-
|
|
819
|
+
isExclusive: boolean;
|
|
782
820
|
description?: string | undefined;
|
|
821
|
+
total?: Record<string, number> | undefined;
|
|
783
822
|
} | {
|
|
784
823
|
type: "FlatAmountOffDiscount";
|
|
785
824
|
name: string;
|
|
786
|
-
|
|
825
|
+
isExclusive: boolean;
|
|
787
826
|
description?: string | undefined;
|
|
827
|
+
total?: Record<string, number> | undefined;
|
|
788
828
|
} | undefined;
|
|
789
829
|
} | undefined;
|
|
790
830
|
appliedDiscount?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -248,13 +248,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
248
248
|
type: "PercentageOffDiscount";
|
|
249
249
|
name: string;
|
|
250
250
|
percentage: number;
|
|
251
|
-
|
|
251
|
+
isExclusive: boolean;
|
|
252
252
|
description?: string | undefined;
|
|
253
|
+
total?: Record<string, number> | undefined;
|
|
253
254
|
} | {
|
|
254
255
|
type: "FlatAmountOffDiscount";
|
|
255
256
|
name: string;
|
|
256
|
-
|
|
257
|
+
isExclusive: boolean;
|
|
257
258
|
description?: string | undefined;
|
|
259
|
+
total?: Record<string, number> | undefined;
|
|
258
260
|
} | undefined;
|
|
259
261
|
} | undefined;
|
|
260
262
|
variations?: {
|
|
@@ -267,13 +269,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
267
269
|
type: "PercentageOffDiscount";
|
|
268
270
|
name: string;
|
|
269
271
|
percentage: number;
|
|
270
|
-
|
|
272
|
+
isExclusive: boolean;
|
|
271
273
|
description?: string | undefined;
|
|
274
|
+
total?: Record<string, number> | undefined;
|
|
272
275
|
} | {
|
|
273
276
|
type: "FlatAmountOffDiscount";
|
|
274
277
|
name: string;
|
|
275
|
-
|
|
278
|
+
isExclusive: boolean;
|
|
276
279
|
description?: string | undefined;
|
|
280
|
+
total?: Record<string, number> | undefined;
|
|
277
281
|
} | undefined;
|
|
278
282
|
}[] | undefined;
|
|
279
283
|
};
|
|
@@ -314,13 +318,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
314
318
|
type: "PercentageOffDiscount";
|
|
315
319
|
name: string;
|
|
316
320
|
percentage: number;
|
|
317
|
-
|
|
321
|
+
isExclusive: boolean;
|
|
318
322
|
description?: string | undefined;
|
|
323
|
+
total?: Record<string, number> | undefined;
|
|
319
324
|
} | {
|
|
320
325
|
type: "FlatAmountOffDiscount";
|
|
321
326
|
name: string;
|
|
322
|
-
|
|
327
|
+
isExclusive: boolean;
|
|
323
328
|
description?: string | undefined;
|
|
329
|
+
total?: Record<string, number> | undefined;
|
|
324
330
|
} | undefined;
|
|
325
331
|
} | undefined;
|
|
326
332
|
variations?: {
|
|
@@ -333,13 +339,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
333
339
|
type: "PercentageOffDiscount";
|
|
334
340
|
name: string;
|
|
335
341
|
percentage: number;
|
|
336
|
-
|
|
342
|
+
isExclusive: boolean;
|
|
337
343
|
description?: string | undefined;
|
|
344
|
+
total?: Record<string, number> | undefined;
|
|
338
345
|
} | {
|
|
339
346
|
type: "FlatAmountOffDiscount";
|
|
340
347
|
name: string;
|
|
341
|
-
|
|
348
|
+
isExclusive: boolean;
|
|
342
349
|
description?: string | undefined;
|
|
350
|
+
total?: Record<string, number> | undefined;
|
|
343
351
|
} | undefined;
|
|
344
352
|
}[] | undefined;
|
|
345
353
|
} & {
|
|
@@ -355,13 +363,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
355
363
|
type: "PercentageOffDiscount";
|
|
356
364
|
name: string;
|
|
357
365
|
percentage: number;
|
|
358
|
-
|
|
366
|
+
isExclusive: boolean;
|
|
359
367
|
description?: string | undefined;
|
|
368
|
+
total?: Record<string, number> | undefined;
|
|
360
369
|
} | {
|
|
361
370
|
type: "FlatAmountOffDiscount";
|
|
362
371
|
name: string;
|
|
363
|
-
|
|
372
|
+
isExclusive: boolean;
|
|
364
373
|
description?: string | undefined;
|
|
374
|
+
total?: Record<string, number> | undefined;
|
|
365
375
|
} | undefined;
|
|
366
376
|
} | undefined;
|
|
367
377
|
variations?: {
|
|
@@ -374,13 +384,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
374
384
|
type: "PercentageOffDiscount";
|
|
375
385
|
name: string;
|
|
376
386
|
percentage: number;
|
|
377
|
-
|
|
387
|
+
isExclusive: boolean;
|
|
378
388
|
description?: string | undefined;
|
|
389
|
+
total?: Record<string, number> | undefined;
|
|
379
390
|
} | {
|
|
380
391
|
type: "FlatAmountOffDiscount";
|
|
381
392
|
name: string;
|
|
382
|
-
|
|
393
|
+
isExclusive: boolean;
|
|
383
394
|
description?: string | undefined;
|
|
395
|
+
total?: Record<string, number> | undefined;
|
|
384
396
|
} | undefined;
|
|
385
397
|
}[] | undefined;
|
|
386
398
|
};
|
|
@@ -420,13 +432,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
420
432
|
type: "PercentageOffDiscount";
|
|
421
433
|
name: string;
|
|
422
434
|
percentage: number;
|
|
423
|
-
|
|
435
|
+
isExclusive: boolean;
|
|
424
436
|
description?: string | undefined;
|
|
437
|
+
total?: Record<string, number> | undefined;
|
|
425
438
|
} | {
|
|
426
439
|
type: "FlatAmountOffDiscount";
|
|
427
440
|
name: string;
|
|
428
|
-
|
|
441
|
+
isExclusive: boolean;
|
|
429
442
|
description?: string | undefined;
|
|
443
|
+
total?: Record<string, number> | undefined;
|
|
430
444
|
} | undefined;
|
|
431
445
|
} | undefined;
|
|
432
446
|
variations?: {
|
|
@@ -439,13 +453,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
439
453
|
type: "PercentageOffDiscount";
|
|
440
454
|
name: string;
|
|
441
455
|
percentage: number;
|
|
442
|
-
|
|
456
|
+
isExclusive: boolean;
|
|
443
457
|
description?: string | undefined;
|
|
458
|
+
total?: Record<string, number> | undefined;
|
|
444
459
|
} | {
|
|
445
460
|
type: "FlatAmountOffDiscount";
|
|
446
461
|
name: string;
|
|
447
|
-
|
|
462
|
+
isExclusive: boolean;
|
|
448
463
|
description?: string | undefined;
|
|
464
|
+
total?: Record<string, number> | undefined;
|
|
449
465
|
} | undefined;
|
|
450
466
|
}[] | undefined;
|
|
451
467
|
};
|
|
@@ -486,13 +502,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
486
502
|
type: "PercentageOffDiscount";
|
|
487
503
|
name: string;
|
|
488
504
|
percentage: number;
|
|
489
|
-
|
|
505
|
+
isExclusive: boolean;
|
|
490
506
|
description?: string | undefined;
|
|
507
|
+
total?: Record<string, number> | undefined;
|
|
491
508
|
} | {
|
|
492
509
|
type: "FlatAmountOffDiscount";
|
|
493
510
|
name: string;
|
|
494
|
-
|
|
511
|
+
isExclusive: boolean;
|
|
495
512
|
description?: string | undefined;
|
|
513
|
+
total?: Record<string, number> | undefined;
|
|
496
514
|
} | undefined;
|
|
497
515
|
} | undefined;
|
|
498
516
|
variations?: {
|
|
@@ -505,13 +523,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
505
523
|
type: "PercentageOffDiscount";
|
|
506
524
|
name: string;
|
|
507
525
|
percentage: number;
|
|
508
|
-
|
|
526
|
+
isExclusive: boolean;
|
|
509
527
|
description?: string | undefined;
|
|
528
|
+
total?: Record<string, number> | undefined;
|
|
510
529
|
} | {
|
|
511
530
|
type: "FlatAmountOffDiscount";
|
|
512
531
|
name: string;
|
|
513
|
-
|
|
532
|
+
isExclusive: boolean;
|
|
514
533
|
description?: string | undefined;
|
|
534
|
+
total?: Record<string, number> | undefined;
|
|
515
535
|
} | undefined;
|
|
516
536
|
}[] | undefined;
|
|
517
537
|
} & {
|
|
@@ -527,13 +547,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
527
547
|
type: "PercentageOffDiscount";
|
|
528
548
|
name: string;
|
|
529
549
|
percentage: number;
|
|
530
|
-
|
|
550
|
+
isExclusive: boolean;
|
|
531
551
|
description?: string | undefined;
|
|
552
|
+
total?: Record<string, number> | undefined;
|
|
532
553
|
} | {
|
|
533
554
|
type: "FlatAmountOffDiscount";
|
|
534
555
|
name: string;
|
|
535
|
-
|
|
556
|
+
isExclusive: boolean;
|
|
536
557
|
description?: string | undefined;
|
|
558
|
+
total?: Record<string, number> | undefined;
|
|
537
559
|
} | undefined;
|
|
538
560
|
} | undefined;
|
|
539
561
|
variations?: {
|
|
@@ -546,13 +568,15 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
546
568
|
type: "PercentageOffDiscount";
|
|
547
569
|
name: string;
|
|
548
570
|
percentage: number;
|
|
549
|
-
|
|
571
|
+
isExclusive: boolean;
|
|
550
572
|
description?: string | undefined;
|
|
573
|
+
total?: Record<string, number> | undefined;
|
|
551
574
|
} | {
|
|
552
575
|
type: "FlatAmountOffDiscount";
|
|
553
576
|
name: string;
|
|
554
|
-
|
|
577
|
+
isExclusive: boolean;
|
|
555
578
|
description?: string | undefined;
|
|
579
|
+
total?: Record<string, number> | undefined;
|
|
556
580
|
} | undefined;
|
|
557
581
|
}[] | undefined;
|
|
558
582
|
};
|
|
@@ -595,13 +619,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
595
619
|
type: "PercentageOffDiscount";
|
|
596
620
|
name: string;
|
|
597
621
|
percentage: number;
|
|
598
|
-
|
|
622
|
+
isExclusive: boolean;
|
|
599
623
|
description?: string | undefined;
|
|
624
|
+
total?: Record<string, number> | undefined;
|
|
600
625
|
} | {
|
|
601
626
|
type: "FlatAmountOffDiscount";
|
|
602
627
|
name: string;
|
|
603
|
-
|
|
628
|
+
isExclusive: boolean;
|
|
604
629
|
description?: string | undefined;
|
|
630
|
+
total?: Record<string, number> | undefined;
|
|
605
631
|
} | undefined;
|
|
606
632
|
} | undefined;
|
|
607
633
|
variations?: {
|
|
@@ -614,13 +640,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
614
640
|
type: "PercentageOffDiscount";
|
|
615
641
|
name: string;
|
|
616
642
|
percentage: number;
|
|
617
|
-
|
|
643
|
+
isExclusive: boolean;
|
|
618
644
|
description?: string | undefined;
|
|
645
|
+
total?: Record<string, number> | undefined;
|
|
619
646
|
} | {
|
|
620
647
|
type: "FlatAmountOffDiscount";
|
|
621
648
|
name: string;
|
|
622
|
-
|
|
649
|
+
isExclusive: boolean;
|
|
623
650
|
description?: string | undefined;
|
|
651
|
+
total?: Record<string, number> | undefined;
|
|
624
652
|
} | undefined;
|
|
625
653
|
}[] | undefined;
|
|
626
654
|
} | undefined;
|
|
@@ -634,13 +662,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
634
662
|
type: "PercentageOffDiscount";
|
|
635
663
|
name: string;
|
|
636
664
|
percentage: number;
|
|
637
|
-
|
|
665
|
+
isExclusive: boolean;
|
|
638
666
|
description?: string | undefined;
|
|
667
|
+
total?: Record<string, number> | undefined;
|
|
639
668
|
} | {
|
|
640
669
|
type: "FlatAmountOffDiscount";
|
|
641
670
|
name: string;
|
|
642
|
-
|
|
671
|
+
isExclusive: boolean;
|
|
643
672
|
description?: string | undefined;
|
|
673
|
+
total?: Record<string, number> | undefined;
|
|
644
674
|
} | undefined;
|
|
645
675
|
} | undefined;
|
|
646
676
|
appliedDiscount?: {
|
|
@@ -698,13 +728,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
698
728
|
type: "PercentageOffDiscount";
|
|
699
729
|
name: string;
|
|
700
730
|
percentage: number;
|
|
701
|
-
|
|
731
|
+
isExclusive: boolean;
|
|
702
732
|
description?: string | undefined;
|
|
733
|
+
total?: Record<string, number> | undefined;
|
|
703
734
|
} | {
|
|
704
735
|
type: "FlatAmountOffDiscount";
|
|
705
736
|
name: string;
|
|
706
|
-
|
|
737
|
+
isExclusive: boolean;
|
|
707
738
|
description?: string | undefined;
|
|
739
|
+
total?: Record<string, number> | undefined;
|
|
708
740
|
} | undefined;
|
|
709
741
|
} | undefined;
|
|
710
742
|
variations?: {
|
|
@@ -717,13 +749,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
717
749
|
type: "PercentageOffDiscount";
|
|
718
750
|
name: string;
|
|
719
751
|
percentage: number;
|
|
720
|
-
|
|
752
|
+
isExclusive: boolean;
|
|
721
753
|
description?: string | undefined;
|
|
754
|
+
total?: Record<string, number> | undefined;
|
|
722
755
|
} | {
|
|
723
756
|
type: "FlatAmountOffDiscount";
|
|
724
757
|
name: string;
|
|
725
|
-
|
|
758
|
+
isExclusive: boolean;
|
|
726
759
|
description?: string | undefined;
|
|
760
|
+
total?: Record<string, number> | undefined;
|
|
727
761
|
} | undefined;
|
|
728
762
|
}[] | undefined;
|
|
729
763
|
} & {
|
|
@@ -739,13 +773,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
739
773
|
type: "PercentageOffDiscount";
|
|
740
774
|
name: string;
|
|
741
775
|
percentage: number;
|
|
742
|
-
|
|
776
|
+
isExclusive: boolean;
|
|
743
777
|
description?: string | undefined;
|
|
778
|
+
total?: Record<string, number> | undefined;
|
|
744
779
|
} | {
|
|
745
780
|
type: "FlatAmountOffDiscount";
|
|
746
781
|
name: string;
|
|
747
|
-
|
|
782
|
+
isExclusive: boolean;
|
|
748
783
|
description?: string | undefined;
|
|
784
|
+
total?: Record<string, number> | undefined;
|
|
749
785
|
} | undefined;
|
|
750
786
|
} | undefined;
|
|
751
787
|
variations?: {
|
|
@@ -758,13 +794,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
758
794
|
type: "PercentageOffDiscount";
|
|
759
795
|
name: string;
|
|
760
796
|
percentage: number;
|
|
761
|
-
|
|
797
|
+
isExclusive: boolean;
|
|
762
798
|
description?: string | undefined;
|
|
799
|
+
total?: Record<string, number> | undefined;
|
|
763
800
|
} | {
|
|
764
801
|
type: "FlatAmountOffDiscount";
|
|
765
802
|
name: string;
|
|
766
|
-
|
|
803
|
+
isExclusive: boolean;
|
|
767
804
|
description?: string | undefined;
|
|
805
|
+
total?: Record<string, number> | undefined;
|
|
768
806
|
} | undefined;
|
|
769
807
|
}[] | undefined;
|
|
770
808
|
} | undefined;
|
|
@@ -778,13 +816,15 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
778
816
|
type: "PercentageOffDiscount";
|
|
779
817
|
name: string;
|
|
780
818
|
percentage: number;
|
|
781
|
-
|
|
819
|
+
isExclusive: boolean;
|
|
782
820
|
description?: string | undefined;
|
|
821
|
+
total?: Record<string, number> | undefined;
|
|
783
822
|
} | {
|
|
784
823
|
type: "FlatAmountOffDiscount";
|
|
785
824
|
name: string;
|
|
786
|
-
|
|
825
|
+
isExclusive: boolean;
|
|
787
826
|
description?: string | undefined;
|
|
827
|
+
total?: Record<string, number> | undefined;
|
|
788
828
|
} | undefined;
|
|
789
829
|
} | undefined;
|
|
790
830
|
appliedDiscount?: {
|
package/dist/index.js
CHANGED
|
@@ -474,6 +474,7 @@ function useCart(context) {
|
|
|
474
474
|
throw new Error("No storefront configured");
|
|
475
475
|
return {
|
|
476
476
|
items: computed7(() => storefront.currentOrder.value.items.map((item) => {
|
|
477
|
+
var _a, _b;
|
|
477
478
|
if (item.type === "Product") {
|
|
478
479
|
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
479
480
|
const variations = (product == null ? void 0 : product.variations) || [];
|
|
@@ -482,7 +483,8 @@ function useCart(context) {
|
|
|
482
483
|
...item,
|
|
483
484
|
product,
|
|
484
485
|
variation,
|
|
485
|
-
price: variation == null ? void 0 : variation.price
|
|
486
|
+
price: variation == null ? void 0 : variation.price,
|
|
487
|
+
appliedDiscount: (_a = variation == null ? void 0 : variation.discount) != null ? _a : item.appliedDiscount
|
|
486
488
|
};
|
|
487
489
|
} else {
|
|
488
490
|
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
@@ -492,7 +494,8 @@ function useCart(context) {
|
|
|
492
494
|
...item,
|
|
493
495
|
bundle,
|
|
494
496
|
variation,
|
|
495
|
-
price: variation == null ? void 0 : variation.price
|
|
497
|
+
price: variation == null ? void 0 : variation.price,
|
|
498
|
+
appliedDiscount: (_b = variation == null ? void 0 : variation.discount) != null ? _b : item.appliedDiscount
|
|
496
499
|
};
|
|
497
500
|
}
|
|
498
501
|
})),
|
|
@@ -534,7 +537,8 @@ function useCart(context) {
|
|
|
534
537
|
quantity: 1,
|
|
535
538
|
variation,
|
|
536
539
|
variationId: variation.id,
|
|
537
|
-
price: variation.price
|
|
540
|
+
price: variation.price,
|
|
541
|
+
appliedDiscount: variation.discount
|
|
538
542
|
};
|
|
539
543
|
storefront.currentOrder.value.items.push(lineItem);
|
|
540
544
|
} else if (item.type === "product") {
|
|
@@ -546,7 +550,8 @@ function useCart(context) {
|
|
|
546
550
|
quantity: 1,
|
|
547
551
|
variation,
|
|
548
552
|
variationId: variation.id,
|
|
549
|
-
price: variation.price
|
|
553
|
+
price: variation.price,
|
|
554
|
+
appliedDiscount: variation.discount
|
|
550
555
|
};
|
|
551
556
|
storefront.currentOrder.value.items.push(lineItem);
|
|
552
557
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.24",
|
|
5
5
|
"description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@vue/devtools-api": "^6.5.1",
|
|
20
20
|
"uuid": "^9.0.1",
|
|
21
21
|
"zod": "^3.21.4",
|
|
22
|
-
"@moonbase.sh/storefront-api": "0.2.
|
|
22
|
+
"@moonbase.sh/storefront-api": "0.2.24"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.7",
|