@moonbase.sh/vue 0.3.1 → 0.3.4

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
@@ -41,8 +41,6 @@ var import_vue13 = require("vue");
41
41
 
42
42
  // src/context.ts
43
43
  var import_storefront_api2 = require("@moonbase.sh/storefront-api");
44
- var import_schemas = require("@moonbase.sh/storefront-api/src/identity/schemas");
45
- var import_tokenStore = require("@moonbase.sh/storefront-api/src/utils/tokenStore");
46
44
  var import_uuid = require("uuid");
47
45
  var import_vue = require("vue");
48
46
 
@@ -210,7 +208,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
210
208
  this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
211
209
  }
212
210
  if (this.client.tokenStore.hasAccessToken) {
213
- this.currentUser.value = import_schemas.userSchema.parse(this.client.tokenStore.user);
211
+ this.currentUser.value = import_storefront_api2.schemas.identity.userSchema.parse(this.client.tokenStore.user);
214
212
  }
215
213
  this.updateStorefront();
216
214
  this.updateUser();
@@ -273,8 +271,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
273
271
  try {
274
272
  this.currentUser.value = await this.client.identity.get();
275
273
  } catch (err) {
276
- if (!(err instanceof import_storefront_api2.NotAuthenticatedError))
274
+ if (!(err instanceof import_storefront_api2.NotAuthenticatedError)) {
277
275
  console.error("Could not load user", err);
276
+ }
277
+ this.currentUser.value = null;
278
278
  } finally {
279
279
  this.loadedUser.value = true;
280
280
  }
@@ -318,9 +318,12 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
318
318
  case _StorefrontContextImpl.utmKey:
319
319
  this.utm.value = JSON.parse(event.newValue);
320
320
  break;
321
- case import_tokenStore.TokenStore.storageKey:
321
+ case import_storefront_api2.TokenStore.storageKey:
322
322
  if (!event.newValue) {
323
323
  this.currentUser.value = null;
324
+ console.warn("User was removed");
325
+ } else {
326
+ console.warn("User was updated", event.newValue);
324
327
  }
325
328
  }
326
329
  }
package/dist/index.d.cts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { MoonbaseConfiguration, Storefront, Order, User, UrchinTrackingModule, MoonbaseClient, OpenOrder, CompletedOrder, ActivationRequest, CommunicationPreferences, StorefrontBundle, StorefrontProduct, PricingVariation, ActivationMethod, Activation, Download, Vendor, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, UrchinTrackingModule, MoonbaseClient, OpenOrder, CompletedOrder, ActivationRequest, Address, CommunicationPreferences, StorefrontBundle, StorefrontProduct, PricingVariation, ActivationMethod, Activation, Download, Vendor, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
5
  import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
6
- import { Address } from '@moonbase.sh/storefront-api/src';
7
6
 
8
7
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
9
8
  configuration: MoonbaseConfiguration;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { MoonbaseConfiguration, Storefront, Order, User, UrchinTrackingModule, MoonbaseClient, OpenOrder, CompletedOrder, ActivationRequest, CommunicationPreferences, StorefrontBundle, StorefrontProduct, PricingVariation, ActivationMethod, Activation, Download, Vendor, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, UrchinTrackingModule, MoonbaseClient, OpenOrder, CompletedOrder, ActivationRequest, Address, CommunicationPreferences, StorefrontBundle, StorefrontProduct, PricingVariation, ActivationMethod, Activation, Download, Vendor, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
5
  import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
6
- import { Address } from '@moonbase.sh/storefront-api/src';
7
6
 
8
7
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
9
8
  configuration: MoonbaseConfiguration;
package/dist/index.js CHANGED
@@ -7,10 +7,10 @@ import {
7
7
  NotAuthenticatedError,
8
8
  NotAuthorizedError,
9
9
  NotFoundError,
10
- OrderStatus
10
+ OrderStatus,
11
+ schemas as schemas2,
12
+ TokenStore
11
13
  } from "@moonbase.sh/storefront-api";
12
- import { userSchema } from "@moonbase.sh/storefront-api/src/identity/schemas";
13
- import { TokenStore } from "@moonbase.sh/storefront-api/src/utils/tokenStore";
14
14
  import { v4 as uuidv4 } from "uuid";
15
15
  import { ref, watch } from "vue";
16
16
 
@@ -178,7 +178,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
178
178
  this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
179
179
  }
180
180
  if (this.client.tokenStore.hasAccessToken) {
181
- this.currentUser.value = userSchema.parse(this.client.tokenStore.user);
181
+ this.currentUser.value = schemas2.identity.userSchema.parse(this.client.tokenStore.user);
182
182
  }
183
183
  this.updateStorefront();
184
184
  this.updateUser();
@@ -241,8 +241,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
241
241
  try {
242
242
  this.currentUser.value = await this.client.identity.get();
243
243
  } catch (err) {
244
- if (!(err instanceof NotAuthenticatedError))
244
+ if (!(err instanceof NotAuthenticatedError)) {
245
245
  console.error("Could not load user", err);
246
+ }
247
+ this.currentUser.value = null;
246
248
  } finally {
247
249
  this.loadedUser.value = true;
248
250
  }
@@ -289,6 +291,9 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
289
291
  case TokenStore.storageKey:
290
292
  if (!event.newValue) {
291
293
  this.currentUser.value = null;
294
+ console.warn("User was removed");
295
+ } else {
296
+ console.warn("User was updated", event.newValue);
292
297
  }
293
298
  }
294
299
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.4",
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.1"
22
+ "@moonbase.sh/storefront-api": "0.3.4"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",