@moonbase.sh/vue 0.1.39 → 0.1.40
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 +20 -10
- package/dist/index.js +20 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -61,11 +61,24 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
61
61
|
this.currentUser = (0, import_vue.ref)(null);
|
|
62
62
|
this.loadedUser = (0, import_vue.ref)(false);
|
|
63
63
|
this.debouncedPushOrderContent = debounce((order) => this.client.orders.pushContent(order), 500);
|
|
64
|
-
if (typeof window
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
if (typeof window === "undefined") {
|
|
65
|
+
this.currentOrder = (0, import_vue.ref)({
|
|
66
|
+
id: (0, import_uuid.v4)(),
|
|
67
|
+
status: import_api_client.OrderStatus.Open,
|
|
68
|
+
currency: "",
|
|
69
|
+
items: [],
|
|
70
|
+
couponsApplied: []
|
|
71
|
+
});
|
|
72
|
+
this.storefront = (0, import_vue.ref)({
|
|
73
|
+
suggestedCurrency: "",
|
|
74
|
+
bundles: [],
|
|
75
|
+
products: []
|
|
76
|
+
});
|
|
77
|
+
this.loadedStorefront = (0, import_vue.ref)(false);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
window.addEventListener("storage", (event) => this.handleStorageUpdate(event));
|
|
81
|
+
const cachedOrderJson = localStorage.getItem("moonbase_session");
|
|
69
82
|
if (cachedOrderJson) {
|
|
70
83
|
this.currentOrder = (0, import_vue.ref)(JSON.parse(cachedOrderJson));
|
|
71
84
|
const _1 = this.refreshOrder();
|
|
@@ -77,12 +90,9 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
77
90
|
items: [],
|
|
78
91
|
couponsApplied: []
|
|
79
92
|
});
|
|
80
|
-
|
|
81
|
-
localStorage.setItem(_StorefrontContextImpl.sessionKey, JSON.stringify(this.currentOrder.value));
|
|
93
|
+
localStorage.setItem(_StorefrontContextImpl.sessionKey, JSON.stringify(this.currentOrder.value));
|
|
82
94
|
}
|
|
83
|
-
|
|
84
|
-
if (typeof window !== "undefined")
|
|
85
|
-
cachedStorefrontJson = localStorage.getItem(_StorefrontContextImpl.storefrontKey);
|
|
95
|
+
const cachedStorefrontJson = localStorage.getItem(_StorefrontContextImpl.storefrontKey);
|
|
86
96
|
if (cachedStorefrontJson) {
|
|
87
97
|
this.storefront = (0, import_vue.ref)(JSON.parse(cachedStorefrontJson));
|
|
88
98
|
this.loadedStorefront = (0, import_vue.ref)(true);
|
package/dist/index.js
CHANGED
|
@@ -29,11 +29,24 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
29
29
|
this.currentUser = ref(null);
|
|
30
30
|
this.loadedUser = ref(false);
|
|
31
31
|
this.debouncedPushOrderContent = debounce((order) => this.client.orders.pushContent(order), 500);
|
|
32
|
-
if (typeof window
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
if (typeof window === "undefined") {
|
|
33
|
+
this.currentOrder = ref({
|
|
34
|
+
id: uuidv4(),
|
|
35
|
+
status: OrderStatus.Open,
|
|
36
|
+
currency: "",
|
|
37
|
+
items: [],
|
|
38
|
+
couponsApplied: []
|
|
39
|
+
});
|
|
40
|
+
this.storefront = ref({
|
|
41
|
+
suggestedCurrency: "",
|
|
42
|
+
bundles: [],
|
|
43
|
+
products: []
|
|
44
|
+
});
|
|
45
|
+
this.loadedStorefront = ref(false);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
window.addEventListener("storage", (event) => this.handleStorageUpdate(event));
|
|
49
|
+
const cachedOrderJson = localStorage.getItem("moonbase_session");
|
|
37
50
|
if (cachedOrderJson) {
|
|
38
51
|
this.currentOrder = ref(JSON.parse(cachedOrderJson));
|
|
39
52
|
const _1 = this.refreshOrder();
|
|
@@ -45,12 +58,9 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
45
58
|
items: [],
|
|
46
59
|
couponsApplied: []
|
|
47
60
|
});
|
|
48
|
-
|
|
49
|
-
localStorage.setItem(_StorefrontContextImpl.sessionKey, JSON.stringify(this.currentOrder.value));
|
|
61
|
+
localStorage.setItem(_StorefrontContextImpl.sessionKey, JSON.stringify(this.currentOrder.value));
|
|
50
62
|
}
|
|
51
|
-
|
|
52
|
-
if (typeof window !== "undefined")
|
|
53
|
-
cachedStorefrontJson = localStorage.getItem(_StorefrontContextImpl.storefrontKey);
|
|
63
|
+
const cachedStorefrontJson = localStorage.getItem(_StorefrontContextImpl.storefrontKey);
|
|
54
64
|
if (cachedStorefrontJson) {
|
|
55
65
|
this.storefront = ref(JSON.parse(cachedStorefrontJson));
|
|
56
66
|
this.loadedStorefront = ref(true);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.40",
|
|
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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@vue/devtools-api": "^6.5.0",
|
|
17
17
|
"uuid": "^9.0.0",
|
|
18
|
-
"@moonbase.sh/api-client": "0.1.
|
|
18
|
+
"@moonbase.sh/api-client": "0.1.40"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"vue": "^3.2.0"
|