@moonbase.sh/vue 0.1.105 → 0.1.107

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
@@ -124,6 +124,14 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
124
124
  const _2 = this.updateStorefront();
125
125
  const _3 = this.updateUser();
126
126
  }
127
+ get loadedUserPromise() {
128
+ return new Promise((resolve) => {
129
+ (0, import_vue.watch)(this.loadedUser, (isLoaded) => {
130
+ if (isLoaded)
131
+ resolve();
132
+ });
133
+ });
134
+ }
127
135
  install(app) {
128
136
  app.provide(storefrontKey, this);
129
137
  console.log("Moonbase.sh storefront installed, learn more at https://moonbase.sh/docs");
@@ -490,20 +498,22 @@ function useAuth() {
490
498
  return {
491
499
  user: storefront.currentUser,
492
500
  loaded: storefront.loadedUser,
501
+ loadedPromise: storefront.loadedUserPromise,
493
502
  signIn: async (email, password) => {
494
503
  const user = await storefront.client.identity.signIn(email, password);
495
504
  storefront.currentUser.value = user;
496
505
  const _ = storefront.updateStorefront();
497
506
  return user;
498
507
  },
499
- signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
508
+ signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions, communicationOptIn) => {
500
509
  const user = await storefront.client.identity.signUp(
501
510
  name,
502
511
  email,
503
512
  password,
504
513
  address,
505
514
  acceptedPrivacyPolicy,
506
- acceptedTermsAndConditions
515
+ acceptedTermsAndConditions,
516
+ communicationOptIn
507
517
  );
508
518
  storefront.currentUser.value = user;
509
519
  const _ = storefront.updateStorefront();
package/dist/index.d.cts CHANGED
@@ -14,6 +14,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
14
14
  currentOrder: Ref<Order>;
15
15
  currentUser: Ref<User | null>;
16
16
  loadedUser: Ref<boolean>;
17
+ loadedUserPromise: Promise<void>;
17
18
  client: MoonbaseClient;
18
19
  updateStorefront(): Promise<void>;
19
20
  pushOrderContent(): Promise<void>;
@@ -925,6 +926,7 @@ declare function useAuth(): {
925
926
  } | undefined;
926
927
  } | null>;
927
928
  loaded: vue.Ref<boolean>;
929
+ loadedPromise: Promise<void>;
928
930
  signIn: (email: string, password: string) => Promise<{
929
931
  id: string;
930
932
  email: string;
@@ -942,7 +944,7 @@ declare function useAuth(): {
942
944
  postCode: string;
943
945
  } | undefined;
944
946
  }>;
945
- signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
947
+ signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean) => Promise<{
946
948
  id: string;
947
949
  email: string;
948
950
  name: string;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
14
14
  currentOrder: Ref<Order>;
15
15
  currentUser: Ref<User | null>;
16
16
  loadedUser: Ref<boolean>;
17
+ loadedUserPromise: Promise<void>;
17
18
  client: MoonbaseClient;
18
19
  updateStorefront(): Promise<void>;
19
20
  pushOrderContent(): Promise<void>;
@@ -925,6 +926,7 @@ declare function useAuth(): {
925
926
  } | undefined;
926
927
  } | null>;
927
928
  loaded: vue.Ref<boolean>;
929
+ loadedPromise: Promise<void>;
928
930
  signIn: (email: string, password: string) => Promise<{
929
931
  id: string;
930
932
  email: string;
@@ -942,7 +944,7 @@ declare function useAuth(): {
942
944
  postCode: string;
943
945
  } | undefined;
944
946
  }>;
945
- signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean) => Promise<{
947
+ signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean) => Promise<{
946
948
  id: string;
947
949
  email: string;
948
950
  name: string;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { ref as ref2 } from "vue";
4
4
 
5
5
  // src/context.ts
6
6
  import { v4 as uuidv4 } from "uuid";
7
- import { computed, ref } from "vue";
7
+ import { computed, ref, watch } from "vue";
8
8
  import { NotAuthenticatedError, OrderStatus } from "@moonbase.sh/storefront-api";
9
9
 
10
10
  // src/symbols.ts
@@ -89,6 +89,14 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
89
89
  const _2 = this.updateStorefront();
90
90
  const _3 = this.updateUser();
91
91
  }
92
+ get loadedUserPromise() {
93
+ return new Promise((resolve) => {
94
+ watch(this.loadedUser, (isLoaded) => {
95
+ if (isLoaded)
96
+ resolve();
97
+ });
98
+ });
99
+ }
92
100
  install(app) {
93
101
  app.provide(storefrontKey, this);
94
102
  console.log("Moonbase.sh storefront installed, learn more at https://moonbase.sh/docs");
@@ -243,7 +251,7 @@ function useInventory() {
243
251
 
244
252
  // src/composables/useActivationRequest.ts
245
253
  import { ActivationRequestStatus } from "@moonbase.sh/storefront-api";
246
- import { computed as computed6, inject as inject6, onBeforeUnmount, watch } from "vue";
254
+ import { computed as computed6, inject as inject6, onBeforeUnmount, watch as watch2 } from "vue";
247
255
  function useActivationRequest(requestId) {
248
256
  const storefront = inject6(storefrontKey);
249
257
  if (!storefront)
@@ -263,7 +271,7 @@ function useActivationRequest(requestId) {
263
271
  if (completionTimeout.value)
264
272
  clearTimeout(completionTimeout.value);
265
273
  });
266
- watch(storefront.currentUser, async () => {
274
+ watch2(storefront.currentUser, async () => {
267
275
  loading.value = true;
268
276
  try {
269
277
  activationRequest.value = await storefront.client.activationRequests.get(requestId);
@@ -455,20 +463,22 @@ function useAuth() {
455
463
  return {
456
464
  user: storefront.currentUser,
457
465
  loaded: storefront.loadedUser,
466
+ loadedPromise: storefront.loadedUserPromise,
458
467
  signIn: async (email, password) => {
459
468
  const user = await storefront.client.identity.signIn(email, password);
460
469
  storefront.currentUser.value = user;
461
470
  const _ = storefront.updateStorefront();
462
471
  return user;
463
472
  },
464
- signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions) => {
473
+ signUp: async (name, email, password, address, acceptedPrivacyPolicy, acceptedTermsAndConditions, communicationOptIn) => {
465
474
  const user = await storefront.client.identity.signUp(
466
475
  name,
467
476
  email,
468
477
  password,
469
478
  address,
470
479
  acceptedPrivacyPolicy,
471
- acceptedTermsAndConditions
480
+ acceptedTermsAndConditions,
481
+ communicationOptIn
472
482
  );
473
483
  storefront.currentUser.value = user;
474
484
  const _ = storefront.updateStorefront();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.1.105",
4
+ "version": "0.1.107",
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",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@vue/devtools-api": "^6.5.1",
20
20
  "uuid": "^9.0.1",
21
- "@moonbase.sh/storefront-api": "0.1.105"
21
+ "@moonbase.sh/storefront-api": "0.1.107"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/uuid": "^9.0.7",