@moonbase.sh/vue 0.2.18 → 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 +7 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/package.json +2 -2
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
|
-
|
|
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"),
|
|
@@ -82,6 +82,7 @@ function mountCheckout(endpoint) {
|
|
|
82
82
|
iframe.style.left = "0px";
|
|
83
83
|
iframe.style.right = "0px";
|
|
84
84
|
iframe.style.border = "none";
|
|
85
|
+
iframe.style.colorScheme = "normal";
|
|
85
86
|
iframe.style.backgroundColor = "transparent";
|
|
86
87
|
iframe.style.zIndex = Number.MAX_SAFE_INTEGER.toString();
|
|
87
88
|
iframe.setAttribute("background", "transparent");
|
|
@@ -90,13 +91,16 @@ function mountCheckout(endpoint) {
|
|
|
90
91
|
iframe.height = "100%";
|
|
91
92
|
iframe.width = "100%";
|
|
92
93
|
document.body.append(iframe);
|
|
94
|
+
document.documentElement.style.overflow = "hidden";
|
|
93
95
|
window.onmessage = function(e) {
|
|
94
96
|
var _a;
|
|
95
97
|
try {
|
|
96
98
|
const evnt = eventSchema.parse(e.data);
|
|
97
99
|
if (evnt.event === "close") {
|
|
98
|
-
if (document.body.contains(iframe))
|
|
100
|
+
if (document.body.contains(iframe)) {
|
|
101
|
+
document.documentElement.style.removeProperty("overflow");
|
|
99
102
|
document.body.removeChild(iframe);
|
|
103
|
+
}
|
|
100
104
|
window.dispatchEvent(new CustomEvent("moonbase-checkout-closed", {
|
|
101
105
|
detail: evnt
|
|
102
106
|
}));
|
|
@@ -218,7 +222,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
218
222
|
window.addEventListener("moonbase-checkout-completed", () => callback());
|
|
219
223
|
}
|
|
220
224
|
onCheckoutClosed(callback) {
|
|
221
|
-
window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.
|
|
225
|
+
window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
|
|
222
226
|
}
|
|
223
227
|
install(app) {
|
|
224
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: (
|
|
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: (
|
|
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
|
-
|
|
30
|
+
intent: z.string().optional()
|
|
31
31
|
});
|
|
32
32
|
var completedEventSchema = z.object({
|
|
33
33
|
source: z.literal("moonbase-checkout"),
|
|
@@ -47,6 +47,7 @@ function mountCheckout(endpoint) {
|
|
|
47
47
|
iframe.style.left = "0px";
|
|
48
48
|
iframe.style.right = "0px";
|
|
49
49
|
iframe.style.border = "none";
|
|
50
|
+
iframe.style.colorScheme = "normal";
|
|
50
51
|
iframe.style.backgroundColor = "transparent";
|
|
51
52
|
iframe.style.zIndex = Number.MAX_SAFE_INTEGER.toString();
|
|
52
53
|
iframe.setAttribute("background", "transparent");
|
|
@@ -55,13 +56,16 @@ function mountCheckout(endpoint) {
|
|
|
55
56
|
iframe.height = "100%";
|
|
56
57
|
iframe.width = "100%";
|
|
57
58
|
document.body.append(iframe);
|
|
59
|
+
document.documentElement.style.overflow = "hidden";
|
|
58
60
|
window.onmessage = function(e) {
|
|
59
61
|
var _a;
|
|
60
62
|
try {
|
|
61
63
|
const evnt = eventSchema.parse(e.data);
|
|
62
64
|
if (evnt.event === "close") {
|
|
63
|
-
if (document.body.contains(iframe))
|
|
65
|
+
if (document.body.contains(iframe)) {
|
|
66
|
+
document.documentElement.style.removeProperty("overflow");
|
|
64
67
|
document.body.removeChild(iframe);
|
|
68
|
+
}
|
|
65
69
|
window.dispatchEvent(new CustomEvent("moonbase-checkout-closed", {
|
|
66
70
|
detail: evnt
|
|
67
71
|
}));
|
|
@@ -183,7 +187,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
183
187
|
window.addEventListener("moonbase-checkout-completed", () => callback());
|
|
184
188
|
}
|
|
185
189
|
onCheckoutClosed(callback) {
|
|
186
|
-
window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.
|
|
190
|
+
window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
|
|
187
191
|
}
|
|
188
192
|
install(app) {
|
|
189
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.
|
|
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.
|
|
22
|
+
"@moonbase.sh/storefront-api": "0.2.21"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.7",
|