@moonbase.sh/vue 0.3.25 → 0.3.28

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
@@ -245,7 +245,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
245
245
  });
246
246
  }
247
247
  get hasUtm() {
248
- return !!this.utm.value && Object.values(this.utm.value).some((v) => !!v);
248
+ return !!this.utm.value && !!(this.utm.value.source || this.utm.value.medium || this.utm.value.campaign || this.utm.value.term || this.utm.value.content);
249
249
  }
250
250
  get loadedUserPromise() {
251
251
  return new Promise((resolve) => {
@@ -545,16 +545,14 @@ function useAuth(context) {
545
545
  return user;
546
546
  },
547
547
  signOut: async () => {
548
- storefront.client.tokenStore.setUser(null);
548
+ storefront.client.tokenStore.clear();
549
549
  await Promise.all([storefront.updateStorefront(), storefront.surrenderOrder()]);
550
550
  storefront.currentUser.value = null;
551
551
  },
552
552
  update: async (name, email, emailConfirmationToken, communicationPreferences) => {
553
553
  const result = await storefront.client.identity.update(name, email, emailConfirmationToken, communicationPreferences);
554
554
  if (storefront.currentUser.value) {
555
- storefront.currentUser.value.name = name;
556
- if (communicationPreferences)
557
- storefront.currentUser.value.communicationPreferences = communicationPreferences;
555
+ storefront.currentUser.value = result.user;
558
556
  }
559
557
  return result;
560
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
@@ -215,7 +215,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
215
215
  });
216
216
  }
217
217
  get hasUtm() {
218
- return !!this.utm.value && Object.values(this.utm.value).some((v) => !!v);
218
+ return !!this.utm.value && !!(this.utm.value.source || this.utm.value.medium || this.utm.value.campaign || this.utm.value.term || this.utm.value.content);
219
219
  }
220
220
  get loadedUserPromise() {
221
221
  return new Promise((resolve) => {
@@ -515,16 +515,14 @@ function useAuth(context) {
515
515
  return user;
516
516
  },
517
517
  signOut: async () => {
518
- storefront.client.tokenStore.setUser(null);
518
+ storefront.client.tokenStore.clear();
519
519
  await Promise.all([storefront.updateStorefront(), storefront.surrenderOrder()]);
520
520
  storefront.currentUser.value = null;
521
521
  },
522
522
  update: async (name, email, emailConfirmationToken, communicationPreferences) => {
523
523
  const result = await storefront.client.identity.update(name, email, emailConfirmationToken, communicationPreferences);
524
524
  if (storefront.currentUser.value) {
525
- storefront.currentUser.value.name = name;
526
- if (communicationPreferences)
527
- storefront.currentUser.value.communicationPreferences = communicationPreferences;
525
+ storefront.currentUser.value = result.user;
528
526
  }
529
527
  return result;
530
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.25",
4
+ "version": "0.3.28",
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.25"
22
+ "@moonbase.sh/storefront-api": "0.3.28"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",