@moonbase.sh/vue 0.2.20 → 0.2.21

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.
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.
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.21",
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.21"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.7",