@moonbase.sh/vue 0.2.20 → 0.2.22

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 CHANGED
@@ -62,7 +62,7 @@ var import_zod = require("zod");
62
62
  var closeEventSchema = import_zod.z.object({
63
63
  source: import_zod.z.literal("moonbase-checkout"),
64
64
  event: import_zod.z.literal("close"),
65
- next: import_zod.z.string().optional()
65
+ intent: import_zod.z.string().optional()
66
66
  });
67
67
  var completedEventSchema = import_zod.z.object({
68
68
  source: import_zod.z.literal("moonbase-checkout"),
@@ -91,13 +91,16 @@ function mountCheckout(endpoint) {
91
91
  iframe.height = "100%";
92
92
  iframe.width = "100%";
93
93
  document.body.append(iframe);
94
+ document.documentElement.style.overflow = "hidden";
94
95
  window.onmessage = function(e) {
95
96
  var _a;
96
97
  try {
97
98
  const evnt = eventSchema.parse(e.data);
98
99
  if (evnt.event === "close") {
99
- if (document.body.contains(iframe))
100
+ if (document.body.contains(iframe)) {
101
+ document.documentElement.style.removeProperty("overflow");
100
102
  document.body.removeChild(iframe);
103
+ }
101
104
  window.dispatchEvent(new CustomEvent("moonbase-checkout-closed", {
102
105
  detail: evnt
103
106
  }));
@@ -219,7 +222,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
219
222
  window.addEventListener("moonbase-checkout-completed", () => callback());
220
223
  }
221
224
  onCheckoutClosed(callback) {
222
- window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.next));
225
+ window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
223
226
  }
224
227
  install(app) {
225
228
  app.provide(storefrontKey, this);
package/dist/index.d.cts CHANGED
@@ -21,7 +21,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
21
21
  pushOrderContent: () => Promise<void>;
22
22
  resetOrder: () => void;
23
23
  onCheckoutCompleted: (callback: () => void) => void;
24
- onCheckoutClosed: (callback: (next: string | undefined) => void) => void;
24
+ onCheckoutClosed: (callback: (intent: string | undefined) => void) => void;
25
25
  /**
26
26
  * Called automatically by `app.use(storefront)`. Should not be called manually by
27
27
  * the user.
@@ -569,25 +569,6 @@ declare function useCart(context?: StorefrontContext): {
569
569
  productId: string;
570
570
  variationId: string;
571
571
  price?: Record<string, number> | undefined;
572
- variation?: {
573
- id: string;
574
- name: string;
575
- originalPrice: Record<string, number>;
576
- price: Record<string, number>;
577
- hasDiscount: boolean;
578
- discount?: {
579
- type: "PercentageOffDiscount";
580
- name: string;
581
- percentage: number;
582
- total: Record<string, number>;
583
- description?: string | undefined;
584
- } | {
585
- type: "FlatAmountOffDiscount";
586
- name: string;
587
- total: Record<string, number>;
588
- description?: string | undefined;
589
- } | undefined;
590
- } | undefined;
591
572
  product?: {
592
573
  type: "product";
593
574
  id: string;
@@ -643,6 +624,25 @@ declare function useCart(context?: StorefrontContext): {
643
624
  } | undefined;
644
625
  }[] | undefined;
645
626
  } | undefined;
627
+ variation?: {
628
+ id: string;
629
+ name: string;
630
+ originalPrice: Record<string, number>;
631
+ price: Record<string, number>;
632
+ hasDiscount: boolean;
633
+ discount?: {
634
+ type: "PercentageOffDiscount";
635
+ name: string;
636
+ percentage: number;
637
+ total: Record<string, number>;
638
+ description?: string | undefined;
639
+ } | {
640
+ type: "FlatAmountOffDiscount";
641
+ name: string;
642
+ total: Record<string, number>;
643
+ description?: string | undefined;
644
+ } | undefined;
645
+ } | undefined;
646
646
  appliedDiscount?: {
647
647
  type: "PercentageOffDiscount";
648
648
  name: string;
@@ -664,25 +664,6 @@ declare function useCart(context?: StorefrontContext): {
664
664
  variationId: string;
665
665
  bundleId: string;
666
666
  price?: Record<string, number> | undefined;
667
- variation?: {
668
- id: string;
669
- name: string;
670
- originalPrice: Record<string, number>;
671
- price: Record<string, number>;
672
- hasDiscount: boolean;
673
- discount?: {
674
- type: "PercentageOffDiscount";
675
- name: string;
676
- percentage: number;
677
- total: Record<string, number>;
678
- description?: string | undefined;
679
- } | {
680
- type: "FlatAmountOffDiscount";
681
- name: string;
682
- total: Record<string, number>;
683
- description?: string | undefined;
684
- } | undefined;
685
- } | undefined;
686
667
  bundle?: {
687
668
  type: "bundle";
688
669
  id: string;
@@ -787,6 +768,25 @@ declare function useCart(context?: StorefrontContext): {
787
768
  } | undefined;
788
769
  }[] | undefined;
789
770
  } | undefined;
771
+ variation?: {
772
+ id: string;
773
+ name: string;
774
+ originalPrice: Record<string, number>;
775
+ price: Record<string, number>;
776
+ hasDiscount: boolean;
777
+ discount?: {
778
+ type: "PercentageOffDiscount";
779
+ name: string;
780
+ percentage: number;
781
+ total: Record<string, number>;
782
+ description?: string | undefined;
783
+ } | {
784
+ type: "FlatAmountOffDiscount";
785
+ name: string;
786
+ total: Record<string, number>;
787
+ description?: string | undefined;
788
+ } | undefined;
789
+ } | undefined;
790
790
  appliedDiscount?: {
791
791
  type: "PercentageOffDiscount";
792
792
  name: string;
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
21
21
  pushOrderContent: () => Promise<void>;
22
22
  resetOrder: () => void;
23
23
  onCheckoutCompleted: (callback: () => void) => void;
24
- onCheckoutClosed: (callback: (next: string | undefined) => void) => void;
24
+ onCheckoutClosed: (callback: (intent: string | undefined) => void) => void;
25
25
  /**
26
26
  * Called automatically by `app.use(storefront)`. Should not be called manually by
27
27
  * the user.
@@ -569,25 +569,6 @@ declare function useCart(context?: StorefrontContext): {
569
569
  productId: string;
570
570
  variationId: string;
571
571
  price?: Record<string, number> | undefined;
572
- variation?: {
573
- id: string;
574
- name: string;
575
- originalPrice: Record<string, number>;
576
- price: Record<string, number>;
577
- hasDiscount: boolean;
578
- discount?: {
579
- type: "PercentageOffDiscount";
580
- name: string;
581
- percentage: number;
582
- total: Record<string, number>;
583
- description?: string | undefined;
584
- } | {
585
- type: "FlatAmountOffDiscount";
586
- name: string;
587
- total: Record<string, number>;
588
- description?: string | undefined;
589
- } | undefined;
590
- } | undefined;
591
572
  product?: {
592
573
  type: "product";
593
574
  id: string;
@@ -643,6 +624,25 @@ declare function useCart(context?: StorefrontContext): {
643
624
  } | undefined;
644
625
  }[] | undefined;
645
626
  } | undefined;
627
+ variation?: {
628
+ id: string;
629
+ name: string;
630
+ originalPrice: Record<string, number>;
631
+ price: Record<string, number>;
632
+ hasDiscount: boolean;
633
+ discount?: {
634
+ type: "PercentageOffDiscount";
635
+ name: string;
636
+ percentage: number;
637
+ total: Record<string, number>;
638
+ description?: string | undefined;
639
+ } | {
640
+ type: "FlatAmountOffDiscount";
641
+ name: string;
642
+ total: Record<string, number>;
643
+ description?: string | undefined;
644
+ } | undefined;
645
+ } | undefined;
646
646
  appliedDiscount?: {
647
647
  type: "PercentageOffDiscount";
648
648
  name: string;
@@ -664,25 +664,6 @@ declare function useCart(context?: StorefrontContext): {
664
664
  variationId: string;
665
665
  bundleId: string;
666
666
  price?: Record<string, number> | undefined;
667
- variation?: {
668
- id: string;
669
- name: string;
670
- originalPrice: Record<string, number>;
671
- price: Record<string, number>;
672
- hasDiscount: boolean;
673
- discount?: {
674
- type: "PercentageOffDiscount";
675
- name: string;
676
- percentage: number;
677
- total: Record<string, number>;
678
- description?: string | undefined;
679
- } | {
680
- type: "FlatAmountOffDiscount";
681
- name: string;
682
- total: Record<string, number>;
683
- description?: string | undefined;
684
- } | undefined;
685
- } | undefined;
686
667
  bundle?: {
687
668
  type: "bundle";
688
669
  id: string;
@@ -787,6 +768,25 @@ declare function useCart(context?: StorefrontContext): {
787
768
  } | undefined;
788
769
  }[] | undefined;
789
770
  } | undefined;
771
+ variation?: {
772
+ id: string;
773
+ name: string;
774
+ originalPrice: Record<string, number>;
775
+ price: Record<string, number>;
776
+ hasDiscount: boolean;
777
+ discount?: {
778
+ type: "PercentageOffDiscount";
779
+ name: string;
780
+ percentage: number;
781
+ total: Record<string, number>;
782
+ description?: string | undefined;
783
+ } | {
784
+ type: "FlatAmountOffDiscount";
785
+ name: string;
786
+ total: Record<string, number>;
787
+ description?: string | undefined;
788
+ } | undefined;
789
+ } | undefined;
790
790
  appliedDiscount?: {
791
791
  type: "PercentageOffDiscount";
792
792
  name: string;
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { z } from "zod";
27
27
  var closeEventSchema = z.object({
28
28
  source: z.literal("moonbase-checkout"),
29
29
  event: z.literal("close"),
30
- next: z.string().optional()
30
+ intent: z.string().optional()
31
31
  });
32
32
  var completedEventSchema = z.object({
33
33
  source: z.literal("moonbase-checkout"),
@@ -56,13 +56,16 @@ function mountCheckout(endpoint) {
56
56
  iframe.height = "100%";
57
57
  iframe.width = "100%";
58
58
  document.body.append(iframe);
59
+ document.documentElement.style.overflow = "hidden";
59
60
  window.onmessage = function(e) {
60
61
  var _a;
61
62
  try {
62
63
  const evnt = eventSchema.parse(e.data);
63
64
  if (evnt.event === "close") {
64
- if (document.body.contains(iframe))
65
+ if (document.body.contains(iframe)) {
66
+ document.documentElement.style.removeProperty("overflow");
65
67
  document.body.removeChild(iframe);
68
+ }
66
69
  window.dispatchEvent(new CustomEvent("moonbase-checkout-closed", {
67
70
  detail: evnt
68
71
  }));
@@ -184,7 +187,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
184
187
  window.addEventListener("moonbase-checkout-completed", () => callback());
185
188
  }
186
189
  onCheckoutClosed(callback) {
187
- window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.next));
190
+ window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
188
191
  }
189
192
  install(app) {
190
193
  app.provide(storefrontKey, this);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.2.20",
4
+ "version": "0.2.22",
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.20"
22
+ "@moonbase.sh/storefront-api": "0.2.22"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.7",