@moonbase.sh/vue 0.1.39 → 0.1.41
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 +22 -11
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +22 -11
- package/package.json +5 -5
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);
|
|
@@ -309,11 +319,12 @@ function useAuth() {
|
|
|
309
319
|
const _ = storefront.updateStorefront();
|
|
310
320
|
return user;
|
|
311
321
|
},
|
|
312
|
-
signUp: async (name, email, password, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
|
|
322
|
+
signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
|
|
313
323
|
const user = await storefront.client.identity.signUp(
|
|
314
324
|
name,
|
|
315
325
|
email,
|
|
316
326
|
password,
|
|
327
|
+
address,
|
|
317
328
|
acceptedPrivacyPolicy,
|
|
318
329
|
acceptedTermsAndConditions
|
|
319
330
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontPr
|
|
|
2
2
|
export * from '@moonbase.sh/api-client';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import { Ref, App, InjectionKey } from 'vue';
|
|
5
|
+
import { Address } from '@moonbase.sh/api-client/src';
|
|
5
6
|
|
|
6
7
|
interface StorefrontContext {
|
|
7
8
|
storefront: Ref<Storefront>;
|
|
@@ -49,6 +50,14 @@ declare function useAuth(): {
|
|
|
49
50
|
email: string;
|
|
50
51
|
name: string;
|
|
51
52
|
tenantId: string;
|
|
53
|
+
address?: {
|
|
54
|
+
countryCode: string;
|
|
55
|
+
streetAddress1: string;
|
|
56
|
+
streetAddress2: string | null;
|
|
57
|
+
locality: string | null;
|
|
58
|
+
region: string | null;
|
|
59
|
+
postCode: string;
|
|
60
|
+
} | undefined;
|
|
52
61
|
} | null>;
|
|
53
62
|
loaded: vue.Ref<boolean>;
|
|
54
63
|
signIn: (email: string, password: string) => Promise<{
|
|
@@ -56,12 +65,28 @@ declare function useAuth(): {
|
|
|
56
65
|
email: string;
|
|
57
66
|
name: string;
|
|
58
67
|
tenantId: string;
|
|
68
|
+
address?: {
|
|
69
|
+
countryCode: string;
|
|
70
|
+
streetAddress1: string;
|
|
71
|
+
streetAddress2: string | null;
|
|
72
|
+
locality: string | null;
|
|
73
|
+
region: string | null;
|
|
74
|
+
postCode: string;
|
|
75
|
+
} | undefined;
|
|
59
76
|
}>;
|
|
60
|
-
signUp: (name: string, email: string, password: string, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
|
|
77
|
+
signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
|
|
61
78
|
id: string;
|
|
62
79
|
email: string;
|
|
63
80
|
name: string;
|
|
64
81
|
tenantId: string;
|
|
82
|
+
address?: {
|
|
83
|
+
countryCode: string;
|
|
84
|
+
streetAddress1: string;
|
|
85
|
+
streetAddress2: string | null;
|
|
86
|
+
locality: string | null;
|
|
87
|
+
region: string | null;
|
|
88
|
+
postCode: string;
|
|
89
|
+
} | undefined;
|
|
65
90
|
}>;
|
|
66
91
|
signOut: () => void;
|
|
67
92
|
update: (name: string, email: string, emailConfirmationToken?: string) => Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontPr
|
|
|
2
2
|
export * from '@moonbase.sh/api-client';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import { Ref, App, InjectionKey } from 'vue';
|
|
5
|
+
import { Address } from '@moonbase.sh/api-client/src';
|
|
5
6
|
|
|
6
7
|
interface StorefrontContext {
|
|
7
8
|
storefront: Ref<Storefront>;
|
|
@@ -49,6 +50,14 @@ declare function useAuth(): {
|
|
|
49
50
|
email: string;
|
|
50
51
|
name: string;
|
|
51
52
|
tenantId: string;
|
|
53
|
+
address?: {
|
|
54
|
+
countryCode: string;
|
|
55
|
+
streetAddress1: string;
|
|
56
|
+
streetAddress2: string | null;
|
|
57
|
+
locality: string | null;
|
|
58
|
+
region: string | null;
|
|
59
|
+
postCode: string;
|
|
60
|
+
} | undefined;
|
|
52
61
|
} | null>;
|
|
53
62
|
loaded: vue.Ref<boolean>;
|
|
54
63
|
signIn: (email: string, password: string) => Promise<{
|
|
@@ -56,12 +65,28 @@ declare function useAuth(): {
|
|
|
56
65
|
email: string;
|
|
57
66
|
name: string;
|
|
58
67
|
tenantId: string;
|
|
68
|
+
address?: {
|
|
69
|
+
countryCode: string;
|
|
70
|
+
streetAddress1: string;
|
|
71
|
+
streetAddress2: string | null;
|
|
72
|
+
locality: string | null;
|
|
73
|
+
region: string | null;
|
|
74
|
+
postCode: string;
|
|
75
|
+
} | undefined;
|
|
59
76
|
}>;
|
|
60
|
-
signUp: (name: string, email: string, password: string, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
|
|
77
|
+
signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
|
|
61
78
|
id: string;
|
|
62
79
|
email: string;
|
|
63
80
|
name: string;
|
|
64
81
|
tenantId: string;
|
|
82
|
+
address?: {
|
|
83
|
+
countryCode: string;
|
|
84
|
+
streetAddress1: string;
|
|
85
|
+
streetAddress2: string | null;
|
|
86
|
+
locality: string | null;
|
|
87
|
+
region: string | null;
|
|
88
|
+
postCode: string;
|
|
89
|
+
} | undefined;
|
|
65
90
|
}>;
|
|
66
91
|
signOut: () => void;
|
|
67
92
|
update: (name: string, email: string, emailConfirmationToken?: string) => Promise<{
|
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);
|
|
@@ -277,11 +287,12 @@ function useAuth() {
|
|
|
277
287
|
const _ = storefront.updateStorefront();
|
|
278
288
|
return user;
|
|
279
289
|
},
|
|
280
|
-
signUp: async (name, email, password, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
|
|
290
|
+
signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
|
|
281
291
|
const user = await storefront.client.identity.signUp(
|
|
282
292
|
name,
|
|
283
293
|
email,
|
|
284
294
|
password,
|
|
295
|
+
address,
|
|
285
296
|
acceptedPrivacyPolicy,
|
|
286
297
|
acceptedTermsAndConditions
|
|
287
298
|
);
|
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.41",
|
|
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",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/**"
|
|
14
14
|
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"vue": "^3.2.0"
|
|
17
|
+
},
|
|
15
18
|
"dependencies": {
|
|
16
19
|
"@vue/devtools-api": "^6.5.0",
|
|
17
20
|
"uuid": "^9.0.0",
|
|
18
|
-
"@moonbase.sh/api-client": "0.1.
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"vue": "^3.2.0"
|
|
21
|
+
"@moonbase.sh/api-client": "0.1.41"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/uuid": "^9.0.1",
|