@moonbase.sh/vue 0.1.77 → 0.1.78

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
@@ -33,13 +33,13 @@ __export(src_exports, {
33
33
  useVoucher: () => useVoucher
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
- var import_api_client2 = require("@moonbase.sh/api-client");
36
+ var import_storefront_api2 = require("@moonbase.sh/storefront-api");
37
37
  var import_vue10 = require("vue");
38
38
 
39
39
  // src/context.ts
40
- var import_api_client = require("@moonbase.sh/api-client");
41
40
  var import_uuid = require("uuid");
42
41
  var import_vue = require("vue");
42
+ var import_storefront_api = require("@moonbase.sh/storefront-api");
43
43
 
44
44
  // src/symbols.ts
45
45
  var storefrontKey = Symbol("storefront");
@@ -68,7 +68,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
68
68
  if (typeof window === "undefined") {
69
69
  this.currentOrder = (0, import_vue.ref)({
70
70
  id: (0, import_uuid.v4)(),
71
- status: import_api_client.OrderStatus.Open,
71
+ status: import_storefront_api.OrderStatus.Open,
72
72
  currency: "",
73
73
  items: [],
74
74
  couponsApplied: []
@@ -89,7 +89,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
89
89
  } else {
90
90
  this.currentOrder = (0, import_vue.ref)({
91
91
  id: (0, import_uuid.v4)(),
92
- status: import_api_client.OrderStatus.Open,
92
+ status: import_storefront_api.OrderStatus.Open,
93
93
  currency: "",
94
94
  items: [],
95
95
  couponsApplied: []
@@ -119,7 +119,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
119
119
  try {
120
120
  this.currentUser.value = await this.client.identity.get();
121
121
  } catch (err) {
122
- if (!(err instanceof import_api_client.NotAuthenticatedError))
122
+ if (!(err instanceof import_storefront_api.NotAuthenticatedError))
123
123
  console.error("Could not load user", err);
124
124
  } finally {
125
125
  this.loadedUser.value = true;
@@ -157,7 +157,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
157
157
  try {
158
158
  const latestOrder = await this.client.orders.get(this.currentOrder.value.id);
159
159
  if (latestOrder) {
160
- if (latestOrder.status !== import_api_client.OrderStatus.Open) {
160
+ if (latestOrder.status !== import_storefront_api.OrderStatus.Open) {
161
161
  this.resetOrder();
162
162
  } else {
163
163
  if (typeof window !== "undefined")
@@ -175,7 +175,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
175
175
  this.currentOrder.value = {
176
176
  id: (0, import_uuid.v4)(),
177
177
  currency: ((_a = this.storefront.value) == null ? void 0 : _a.suggestedCurrency) || "",
178
- status: import_api_client.OrderStatus.Open,
178
+ status: import_storefront_api.OrderStatus.Open,
179
179
  items: [],
180
180
  couponsApplied: []
181
181
  };
@@ -189,7 +189,7 @@ _StorefrontContextImpl.storefrontKey = "moonbase_storefront";
189
189
  var StorefrontContextImpl = _StorefrontContextImpl;
190
190
 
191
191
  // src/index.ts
192
- __reExport(src_exports, require("@moonbase.sh/api-client"), module.exports);
192
+ __reExport(src_exports, require("@moonbase.sh/storefront-api"), module.exports);
193
193
 
194
194
  // src/composables/useBundle.ts
195
195
  var import_vue2 = require("vue");
@@ -421,7 +421,7 @@ function createStorefront(endpoint, stateFactory) {
421
421
  };
422
422
  return new StorefrontContextImpl(
423
423
  configuration,
424
- new import_api_client2.MoonbaseClient(configuration),
424
+ new import_storefront_api2.MoonbaseClient(configuration),
425
425
  // Default to vue refs but allow stuff like Nuxt useState wrappers
426
426
  stateFactory || ((_, state) => (0, import_vue10.ref)(state))
427
427
  );
@@ -438,5 +438,5 @@ function createStorefront(endpoint, stateFactory) {
438
438
  useProduct,
439
439
  useProducts,
440
440
  useVoucher,
441
- ...require("@moonbase.sh/api-client")
441
+ ...require("@moonbase.sh/storefront-api")
442
442
  });
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { Address, LineItem } from '@moonbase.sh/api-client/src';
2
- import * as _moonbase_sh_api_client from '@moonbase.sh/api-client';
3
- import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation } from '@moonbase.sh/api-client';
4
- export * from '@moonbase.sh/api-client';
1
+ import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
+ import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
3
+ export * from '@moonbase.sh/storefront-api';
5
4
  import * as vue from 'vue';
6
5
  import { Plugin, Ref, App, InjectionKey } from 'vue';
6
+ import { Address } from '@moonbase.sh/storefront-api/src';
7
7
 
8
8
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
9
9
  storefront: Ref<Storefront>;
@@ -34,8 +34,8 @@ declare function useProduct(productId: string): Ref<StorefrontProduct | null>;
34
34
  declare function useProducts(): Ref<StorefrontProduct[]>;
35
35
 
36
36
  declare function useInventory(): {
37
- getLicenses: (nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
38
- status: _moonbase_sh_api_client.LicenseStatus;
37
+ getLicenses: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
38
+ status: _moonbase_sh_storefront_api.LicenseStatus;
39
39
  id: string;
40
40
  activeNumberOfActivations: number;
41
41
  maxNumberOfActivations: number;
@@ -57,20 +57,20 @@ declare function useInventory(): {
57
57
  path: string | null;
58
58
  name: string;
59
59
  key: string;
60
- platform: _moonbase_sh_api_client.Platform;
60
+ platform: _moonbase_sh_storefront_api.Platform;
61
61
  size: number;
62
62
  }[] | undefined;
63
63
  } | undefined;
64
64
  }>>;
65
- getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
66
- status: _moonbase_sh_api_client.ActivationStatus;
65
+ getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
66
+ status: _moonbase_sh_storefront_api.ActivationStatus;
67
67
  id: string;
68
68
  name: string;
69
69
  licenseId: string;
70
- activationMethod: _moonbase_sh_api_client.ActivationMethod;
70
+ activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
71
71
  lastValidatedAt: Date | null;
72
72
  }>>;
73
- getProducts: (nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
73
+ getProducts: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
74
74
  id: string;
75
75
  name: string;
76
76
  tagline: string;
@@ -87,12 +87,12 @@ declare function useInventory(): {
87
87
  path: string | null;
88
88
  name: string;
89
89
  key: string;
90
- platform: _moonbase_sh_api_client.Platform;
90
+ platform: _moonbase_sh_storefront_api.Platform;
91
91
  size: number;
92
92
  }[] | undefined;
93
93
  }>>;
94
- getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
95
- status: _moonbase_sh_api_client.LicenseStatus;
94
+ getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
95
+ status: _moonbase_sh_storefront_api.LicenseStatus;
96
96
  id: string;
97
97
  activeNumberOfActivations: number;
98
98
  maxNumberOfActivations: number;
@@ -114,17 +114,17 @@ declare function useInventory(): {
114
114
  path: string | null;
115
115
  name: string;
116
116
  key: string;
117
- platform: _moonbase_sh_api_client.Platform;
117
+ platform: _moonbase_sh_storefront_api.Platform;
118
118
  size: number;
119
119
  }[] | undefined;
120
120
  } | undefined;
121
121
  }>>;
122
- getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
123
- status: _moonbase_sh_api_client.ActivationStatus;
122
+ getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
123
+ status: _moonbase_sh_storefront_api.ActivationStatus;
124
124
  id: string;
125
125
  name: string;
126
126
  licenseId: string;
127
- activationMethod: _moonbase_sh_api_client.ActivationMethod;
127
+ activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
128
128
  lastValidatedAt: Date | null;
129
129
  }>>;
130
130
  revokeActivation: (activation: Activation) => Promise<void>;
@@ -445,15 +445,15 @@ declare function useCart(): {
445
445
  items: vue.ComputedRef<({
446
446
  type: "Product";
447
447
  id: string;
448
- productId: string;
449
448
  quantity: number;
449
+ productId: string;
450
450
  variationId: string;
451
451
  price?: Record<string, number> | undefined;
452
452
  variation?: {
453
453
  id: string;
454
- price: Record<string, number>;
455
454
  name: string;
456
455
  originalPrice: Record<string, number>;
456
+ price: Record<string, number>;
457
457
  hasDiscount: boolean;
458
458
  discount?: {
459
459
  type: "PercentageOffDiscount";
@@ -477,9 +477,9 @@ declare function useCart(): {
477
477
  owned: boolean;
478
478
  defaultVariation?: {
479
479
  id: string;
480
- price: Record<string, number>;
481
480
  name: string;
482
481
  originalPrice: Record<string, number>;
482
+ price: Record<string, number>;
483
483
  hasDiscount: boolean;
484
484
  discount?: {
485
485
  type: "PercentageOffDiscount";
@@ -496,9 +496,9 @@ declare function useCart(): {
496
496
  } | undefined;
497
497
  variations?: {
498
498
  id: string;
499
- price: Record<string, number>;
500
499
  name: string;
501
500
  originalPrice: Record<string, number>;
501
+ price: Record<string, number>;
502
502
  hasDiscount: boolean;
503
503
  discount?: {
504
504
  type: "PercentageOffDiscount";
@@ -537,9 +537,9 @@ declare function useCart(): {
537
537
  price?: Record<string, number> | undefined;
538
538
  variation?: {
539
539
  id: string;
540
- price: Record<string, number>;
541
540
  name: string;
542
541
  originalPrice: Record<string, number>;
542
+ price: Record<string, number>;
543
543
  hasDiscount: boolean;
544
544
  discount?: {
545
545
  type: "PercentageOffDiscount";
@@ -571,9 +571,9 @@ declare function useCart(): {
571
571
  owned: boolean;
572
572
  defaultVariation?: {
573
573
  id: string;
574
- price: Record<string, number>;
575
574
  name: string;
576
575
  originalPrice: Record<string, number>;
576
+ price: Record<string, number>;
577
577
  hasDiscount: boolean;
578
578
  discount?: {
579
579
  type: "PercentageOffDiscount";
@@ -590,9 +590,9 @@ declare function useCart(): {
590
590
  } | undefined;
591
591
  variations?: {
592
592
  id: string;
593
- price: Record<string, number>;
594
593
  name: string;
595
594
  originalPrice: Record<string, number>;
595
+ price: Record<string, number>;
596
596
  hasDiscount: boolean;
597
597
  discount?: {
598
598
  type: "PercentageOffDiscount";
@@ -612,9 +612,9 @@ declare function useCart(): {
612
612
  })[];
613
613
  defaultVariation?: {
614
614
  id: string;
615
- price: Record<string, number>;
616
615
  name: string;
617
616
  originalPrice: Record<string, number>;
617
+ price: Record<string, number>;
618
618
  hasDiscount: boolean;
619
619
  discount?: {
620
620
  type: "PercentageOffDiscount";
@@ -631,9 +631,9 @@ declare function useCart(): {
631
631
  } | undefined;
632
632
  variations?: {
633
633
  id: string;
634
- price: Record<string, number>;
635
634
  name: string;
636
635
  originalPrice: Record<string, number>;
636
+ price: Record<string, number>;
637
637
  hasDiscount: boolean;
638
638
  discount?: {
639
639
  type: "PercentageOffDiscount";
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Address, LineItem } from '@moonbase.sh/api-client/src';
2
- import * as _moonbase_sh_api_client from '@moonbase.sh/api-client';
3
- import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation } from '@moonbase.sh/api-client';
4
- export * from '@moonbase.sh/api-client';
1
+ import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
+ import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
3
+ export * from '@moonbase.sh/storefront-api';
5
4
  import * as vue from 'vue';
6
5
  import { Plugin, Ref, App, InjectionKey } from 'vue';
6
+ import { Address } from '@moonbase.sh/storefront-api/src';
7
7
 
8
8
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
9
9
  storefront: Ref<Storefront>;
@@ -34,8 +34,8 @@ declare function useProduct(productId: string): Ref<StorefrontProduct | null>;
34
34
  declare function useProducts(): Ref<StorefrontProduct[]>;
35
35
 
36
36
  declare function useInventory(): {
37
- getLicenses: (nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
38
- status: _moonbase_sh_api_client.LicenseStatus;
37
+ getLicenses: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
38
+ status: _moonbase_sh_storefront_api.LicenseStatus;
39
39
  id: string;
40
40
  activeNumberOfActivations: number;
41
41
  maxNumberOfActivations: number;
@@ -57,20 +57,20 @@ declare function useInventory(): {
57
57
  path: string | null;
58
58
  name: string;
59
59
  key: string;
60
- platform: _moonbase_sh_api_client.Platform;
60
+ platform: _moonbase_sh_storefront_api.Platform;
61
61
  size: number;
62
62
  }[] | undefined;
63
63
  } | undefined;
64
64
  }>>;
65
- getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
66
- status: _moonbase_sh_api_client.ActivationStatus;
65
+ getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
66
+ status: _moonbase_sh_storefront_api.ActivationStatus;
67
67
  id: string;
68
68
  name: string;
69
69
  licenseId: string;
70
- activationMethod: _moonbase_sh_api_client.ActivationMethod;
70
+ activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
71
71
  lastValidatedAt: Date | null;
72
72
  }>>;
73
- getProducts: (nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
73
+ getProducts: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
74
74
  id: string;
75
75
  name: string;
76
76
  tagline: string;
@@ -87,12 +87,12 @@ declare function useInventory(): {
87
87
  path: string | null;
88
88
  name: string;
89
89
  key: string;
90
- platform: _moonbase_sh_api_client.Platform;
90
+ platform: _moonbase_sh_storefront_api.Platform;
91
91
  size: number;
92
92
  }[] | undefined;
93
93
  }>>;
94
- getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
95
- status: _moonbase_sh_api_client.LicenseStatus;
94
+ getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
95
+ status: _moonbase_sh_storefront_api.LicenseStatus;
96
96
  id: string;
97
97
  activeNumberOfActivations: number;
98
98
  maxNumberOfActivations: number;
@@ -114,17 +114,17 @@ declare function useInventory(): {
114
114
  path: string | null;
115
115
  name: string;
116
116
  key: string;
117
- platform: _moonbase_sh_api_client.Platform;
117
+ platform: _moonbase_sh_storefront_api.Platform;
118
118
  size: number;
119
119
  }[] | undefined;
120
120
  } | undefined;
121
121
  }>>;
122
- getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_api_client.Page<{
123
- status: _moonbase_sh_api_client.ActivationStatus;
122
+ getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
123
+ status: _moonbase_sh_storefront_api.ActivationStatus;
124
124
  id: string;
125
125
  name: string;
126
126
  licenseId: string;
127
- activationMethod: _moonbase_sh_api_client.ActivationMethod;
127
+ activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
128
128
  lastValidatedAt: Date | null;
129
129
  }>>;
130
130
  revokeActivation: (activation: Activation) => Promise<void>;
@@ -445,15 +445,15 @@ declare function useCart(): {
445
445
  items: vue.ComputedRef<({
446
446
  type: "Product";
447
447
  id: string;
448
- productId: string;
449
448
  quantity: number;
449
+ productId: string;
450
450
  variationId: string;
451
451
  price?: Record<string, number> | undefined;
452
452
  variation?: {
453
453
  id: string;
454
- price: Record<string, number>;
455
454
  name: string;
456
455
  originalPrice: Record<string, number>;
456
+ price: Record<string, number>;
457
457
  hasDiscount: boolean;
458
458
  discount?: {
459
459
  type: "PercentageOffDiscount";
@@ -477,9 +477,9 @@ declare function useCart(): {
477
477
  owned: boolean;
478
478
  defaultVariation?: {
479
479
  id: string;
480
- price: Record<string, number>;
481
480
  name: string;
482
481
  originalPrice: Record<string, number>;
482
+ price: Record<string, number>;
483
483
  hasDiscount: boolean;
484
484
  discount?: {
485
485
  type: "PercentageOffDiscount";
@@ -496,9 +496,9 @@ declare function useCart(): {
496
496
  } | undefined;
497
497
  variations?: {
498
498
  id: string;
499
- price: Record<string, number>;
500
499
  name: string;
501
500
  originalPrice: Record<string, number>;
501
+ price: Record<string, number>;
502
502
  hasDiscount: boolean;
503
503
  discount?: {
504
504
  type: "PercentageOffDiscount";
@@ -537,9 +537,9 @@ declare function useCart(): {
537
537
  price?: Record<string, number> | undefined;
538
538
  variation?: {
539
539
  id: string;
540
- price: Record<string, number>;
541
540
  name: string;
542
541
  originalPrice: Record<string, number>;
542
+ price: Record<string, number>;
543
543
  hasDiscount: boolean;
544
544
  discount?: {
545
545
  type: "PercentageOffDiscount";
@@ -571,9 +571,9 @@ declare function useCart(): {
571
571
  owned: boolean;
572
572
  defaultVariation?: {
573
573
  id: string;
574
- price: Record<string, number>;
575
574
  name: string;
576
575
  originalPrice: Record<string, number>;
576
+ price: Record<string, number>;
577
577
  hasDiscount: boolean;
578
578
  discount?: {
579
579
  type: "PercentageOffDiscount";
@@ -590,9 +590,9 @@ declare function useCart(): {
590
590
  } | undefined;
591
591
  variations?: {
592
592
  id: string;
593
- price: Record<string, number>;
594
593
  name: string;
595
594
  originalPrice: Record<string, number>;
595
+ price: Record<string, number>;
596
596
  hasDiscount: boolean;
597
597
  discount?: {
598
598
  type: "PercentageOffDiscount";
@@ -612,9 +612,9 @@ declare function useCart(): {
612
612
  })[];
613
613
  defaultVariation?: {
614
614
  id: string;
615
- price: Record<string, number>;
616
615
  name: string;
617
616
  originalPrice: Record<string, number>;
617
+ price: Record<string, number>;
618
618
  hasDiscount: boolean;
619
619
  discount?: {
620
620
  type: "PercentageOffDiscount";
@@ -631,9 +631,9 @@ declare function useCart(): {
631
631
  } | undefined;
632
632
  variations?: {
633
633
  id: string;
634
- price: Record<string, number>;
635
634
  name: string;
636
635
  originalPrice: Record<string, number>;
636
+ price: Record<string, number>;
637
637
  hasDiscount: boolean;
638
638
  discount?: {
639
639
  type: "PercentageOffDiscount";
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // src/index.ts
2
- import { MoonbaseClient } from "@moonbase.sh/api-client";
2
+ import { MoonbaseClient } from "@moonbase.sh/storefront-api";
3
3
  import { ref as ref2 } from "vue";
4
4
 
5
5
  // src/context.ts
6
- import { NotAuthenticatedError, OrderStatus } from "@moonbase.sh/api-client";
7
6
  import { v4 as uuidv4 } from "uuid";
8
7
  import { ref } from "vue";
8
+ import { NotAuthenticatedError, OrderStatus } from "@moonbase.sh/storefront-api";
9
9
 
10
10
  // src/symbols.ts
11
11
  var storefrontKey = Symbol("storefront");
@@ -155,7 +155,7 @@ _StorefrontContextImpl.storefrontKey = "moonbase_storefront";
155
155
  var StorefrontContextImpl = _StorefrontContextImpl;
156
156
 
157
157
  // src/index.ts
158
- export * from "@moonbase.sh/api-client";
158
+ export * from "@moonbase.sh/storefront-api";
159
159
 
160
160
  // src/composables/useBundle.ts
161
161
  import { computed, inject } from "vue";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.1.77",
4
+ "version": "0.1.78",
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/api-client": "0.1.77"
21
+ "@moonbase.sh/storefront-api": "0.1.78"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/uuid": "^9.0.7",