@moonbase.sh/vue 0.2.112 → 0.2.114

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
@@ -40,6 +40,8 @@ var import_vue12 = require("vue");
40
40
 
41
41
  // src/context.ts
42
42
  var import_storefront_api2 = require("@moonbase.sh/storefront-api");
43
+ var import_schemas = require("@moonbase.sh/storefront-api/src/identity/schemas");
44
+ var import_tokenStore = require("@moonbase.sh/storefront-api/src/utils/tokenStore");
43
45
  var import_uuid = require("uuid");
44
46
  var import_vue = require("vue");
45
47
 
@@ -206,7 +208,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
206
208
  this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
207
209
  }
208
210
  if (this.client.tokenStore.hasAccessToken) {
209
- this.currentUser.value = this.client.tokenStore.user;
211
+ this.currentUser.value = import_schemas.userSchema.parse(this.client.tokenStore.user);
210
212
  }
211
213
  this.updateStorefront();
212
214
  this.updateUser();
@@ -305,6 +307,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
305
307
  case _StorefrontContextImpl.utmKey:
306
308
  this.utm.value = JSON.parse(event.newValue);
307
309
  break;
310
+ case import_tokenStore.TokenStore.storageKey:
311
+ if (!event.newValue) {
312
+ this.currentUser.value = null;
313
+ }
308
314
  }
309
315
  }
310
316
  async refreshOrder() {
package/dist/index.js CHANGED
@@ -4,6 +4,8 @@ import { ref as ref3 } from "vue";
4
4
 
5
5
  // src/context.ts
6
6
  import { NotAuthenticatedError, NotFoundError, OrderStatus } from "@moonbase.sh/storefront-api";
7
+ import { userSchema } from "@moonbase.sh/storefront-api/src/identity/schemas";
8
+ import { TokenStore } from "@moonbase.sh/storefront-api/src/utils/tokenStore";
7
9
  import { v4 as uuidv4 } from "uuid";
8
10
  import { ref, watch } from "vue";
9
11
 
@@ -170,7 +172,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
170
172
  this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
171
173
  }
172
174
  if (this.client.tokenStore.hasAccessToken) {
173
- this.currentUser.value = this.client.tokenStore.user;
175
+ this.currentUser.value = userSchema.parse(this.client.tokenStore.user);
174
176
  }
175
177
  this.updateStorefront();
176
178
  this.updateUser();
@@ -269,6 +271,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
269
271
  case _StorefrontContextImpl.utmKey:
270
272
  this.utm.value = JSON.parse(event.newValue);
271
273
  break;
274
+ case TokenStore.storageKey:
275
+ if (!event.newValue) {
276
+ this.currentUser.value = null;
277
+ }
272
278
  }
273
279
  }
274
280
  async refreshOrder() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.2.112",
4
+ "version": "0.2.114",
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.2.112"
22
+ "@moonbase.sh/storefront-api": "0.2.114"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",