@moonbase.sh/vue 0.3.24 → 0.3.26

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
@@ -86,6 +86,8 @@ function mountCheckout(endpoint) {
86
86
  console.warn("Can not mount checkout server side");
87
87
  return;
88
88
  }
89
+ if (document.getElementById("moonbase-checkout"))
90
+ return;
89
91
  const iframe = document.createElement("iframe");
90
92
  iframe.id = "moonbase-checkout";
91
93
  iframe.src = endpoint;
@@ -543,16 +545,14 @@ function useAuth(context) {
543
545
  return user;
544
546
  },
545
547
  signOut: async () => {
546
- storefront.client.tokenStore.setUser(null);
548
+ storefront.client.tokenStore.clear();
547
549
  await Promise.all([storefront.updateStorefront(), storefront.surrenderOrder()]);
548
550
  storefront.currentUser.value = null;
549
551
  },
550
552
  update: async (name, email, emailConfirmationToken, communicationPreferences) => {
551
553
  const result = await storefront.client.identity.update(name, email, emailConfirmationToken, communicationPreferences);
552
554
  if (storefront.currentUser.value) {
553
- storefront.currentUser.value.name = name;
554
- if (communicationPreferences)
555
- storefront.currentUser.value.communicationPreferences = communicationPreferences;
555
+ storefront.currentUser.value = result.user;
556
556
  }
557
557
  return result;
558
558
  },
package/dist/index.d.cts CHANGED
@@ -140,6 +140,27 @@ declare function useAuth(context?: StorefrontContext): {
140
140
  signOut: () => Promise<void>;
141
141
  update: (name: string, email: string, emailConfirmationToken?: string, communicationPreferences?: CommunicationPreferences) => Promise<{
142
142
  needsEmailConfirmationToken: boolean;
143
+ user: {
144
+ id: string;
145
+ email: string;
146
+ name: string;
147
+ tenantId: string;
148
+ communicationPreferences: {
149
+ newsletterOptIn: boolean;
150
+ };
151
+ address?: {
152
+ countryCode: string;
153
+ streetAddress1: string;
154
+ streetAddress2: string | null;
155
+ locality: string | null;
156
+ region: string | null;
157
+ postCode: string;
158
+ } | undefined;
159
+ ownedProducts?: string[] | undefined;
160
+ subscribedProducts?: string[] | undefined;
161
+ hasProducts?: boolean | null | undefined;
162
+ hasSubscriptions?: boolean | null | undefined;
163
+ };
143
164
  }>;
144
165
  setPassword: (currentPassword: string, newPassword: string) => Promise<void>;
145
166
  forgotPassword: (email: string) => Promise<void>;
package/dist/index.d.ts CHANGED
@@ -140,6 +140,27 @@ declare function useAuth(context?: StorefrontContext): {
140
140
  signOut: () => Promise<void>;
141
141
  update: (name: string, email: string, emailConfirmationToken?: string, communicationPreferences?: CommunicationPreferences) => Promise<{
142
142
  needsEmailConfirmationToken: boolean;
143
+ user: {
144
+ id: string;
145
+ email: string;
146
+ name: string;
147
+ tenantId: string;
148
+ communicationPreferences: {
149
+ newsletterOptIn: boolean;
150
+ };
151
+ address?: {
152
+ countryCode: string;
153
+ streetAddress1: string;
154
+ streetAddress2: string | null;
155
+ locality: string | null;
156
+ region: string | null;
157
+ postCode: string;
158
+ } | undefined;
159
+ ownedProducts?: string[] | undefined;
160
+ subscribedProducts?: string[] | undefined;
161
+ hasProducts?: boolean | null | undefined;
162
+ hasSubscriptions?: boolean | null | undefined;
163
+ };
143
164
  }>;
144
165
  setPassword: (currentPassword: string, newPassword: string) => Promise<void>;
145
166
  forgotPassword: (email: string) => Promise<void>;
package/dist/index.js CHANGED
@@ -56,6 +56,8 @@ function mountCheckout(endpoint) {
56
56
  console.warn("Can not mount checkout server side");
57
57
  return;
58
58
  }
59
+ if (document.getElementById("moonbase-checkout"))
60
+ return;
59
61
  const iframe = document.createElement("iframe");
60
62
  iframe.id = "moonbase-checkout";
61
63
  iframe.src = endpoint;
@@ -513,16 +515,14 @@ function useAuth(context) {
513
515
  return user;
514
516
  },
515
517
  signOut: async () => {
516
- storefront.client.tokenStore.setUser(null);
518
+ storefront.client.tokenStore.clear();
517
519
  await Promise.all([storefront.updateStorefront(), storefront.surrenderOrder()]);
518
520
  storefront.currentUser.value = null;
519
521
  },
520
522
  update: async (name, email, emailConfirmationToken, communicationPreferences) => {
521
523
  const result = await storefront.client.identity.update(name, email, emailConfirmationToken, communicationPreferences);
522
524
  if (storefront.currentUser.value) {
523
- storefront.currentUser.value.name = name;
524
- if (communicationPreferences)
525
- storefront.currentUser.value.communicationPreferences = communicationPreferences;
525
+ storefront.currentUser.value = result.user;
526
526
  }
527
527
  return result;
528
528
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.3.24",
4
+ "version": "0.3.26",
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.6.3",
20
20
  "uuid": "^9.0.1",
21
21
  "zod": "^3.23.8",
22
- "@moonbase.sh/storefront-api": "0.3.24"
22
+ "@moonbase.sh/storefront-api": "0.3.26"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",