@moonbase.sh/vue 0.1.76 → 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 +10 -10
- package/dist/index.d.cts +97 -45
- package/dist/index.d.ts +97 -45
- package/dist/index.js +3 -3
- package/package.json +2 -2
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
|
|
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:
|
|
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:
|
|
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
|
|
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 !==
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
441
|
+
...require("@moonbase.sh/storefront-api")
|
|
442
442
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
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<
|
|
38
|
-
status:
|
|
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;
|
|
@@ -43,46 +43,56 @@ declare function useInventory(): {
|
|
|
43
43
|
product?: {
|
|
44
44
|
id: string;
|
|
45
45
|
name: string;
|
|
46
|
+
tagline: string;
|
|
46
47
|
currentVersion: string | null;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
key: string;
|
|
50
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
51
|
-
}[] | null;
|
|
48
|
+
downloadsNeedsUser: boolean;
|
|
49
|
+
downloadsNeedsOwnership: boolean;
|
|
52
50
|
website?: string | undefined;
|
|
53
51
|
iconUrl?: string | undefined;
|
|
54
52
|
numberOfLicenses?: number | undefined;
|
|
55
53
|
numberOfTrials?: number | undefined;
|
|
56
54
|
currentActivations?: number | undefined;
|
|
57
55
|
maxActivations?: number | undefined;
|
|
56
|
+
downloads?: {
|
|
57
|
+
path: string | null;
|
|
58
|
+
name: string;
|
|
59
|
+
key: string;
|
|
60
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
61
|
+
size: number;
|
|
62
|
+
}[] | undefined;
|
|
58
63
|
} | undefined;
|
|
59
64
|
}>>;
|
|
60
|
-
getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<
|
|
61
|
-
status:
|
|
65
|
+
getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
66
|
+
status: _moonbase_sh_storefront_api.ActivationStatus;
|
|
62
67
|
id: string;
|
|
63
68
|
name: string;
|
|
64
69
|
licenseId: string;
|
|
65
|
-
activationMethod:
|
|
70
|
+
activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
|
|
66
71
|
lastValidatedAt: Date | null;
|
|
67
72
|
}>>;
|
|
68
|
-
getProducts: (nextUrl?: string) => Promise<
|
|
73
|
+
getProducts: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
69
74
|
id: string;
|
|
70
75
|
name: string;
|
|
76
|
+
tagline: string;
|
|
71
77
|
currentVersion: string | null;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
key: string;
|
|
75
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
76
|
-
}[] | null;
|
|
78
|
+
downloadsNeedsUser: boolean;
|
|
79
|
+
downloadsNeedsOwnership: boolean;
|
|
77
80
|
website?: string | undefined;
|
|
78
81
|
iconUrl?: string | undefined;
|
|
79
82
|
numberOfLicenses?: number | undefined;
|
|
80
83
|
numberOfTrials?: number | undefined;
|
|
81
84
|
currentActivations?: number | undefined;
|
|
82
85
|
maxActivations?: number | undefined;
|
|
86
|
+
downloads?: {
|
|
87
|
+
path: string | null;
|
|
88
|
+
name: string;
|
|
89
|
+
key: string;
|
|
90
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
91
|
+
size: number;
|
|
92
|
+
}[] | undefined;
|
|
83
93
|
}>>;
|
|
84
|
-
getProductLicenses: (productId: string, nextUrl?: string) => Promise<
|
|
85
|
-
status:
|
|
94
|
+
getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
95
|
+
status: _moonbase_sh_storefront_api.LicenseStatus;
|
|
86
96
|
id: string;
|
|
87
97
|
activeNumberOfActivations: number;
|
|
88
98
|
maxNumberOfActivations: number;
|
|
@@ -90,26 +100,31 @@ declare function useInventory(): {
|
|
|
90
100
|
product?: {
|
|
91
101
|
id: string;
|
|
92
102
|
name: string;
|
|
103
|
+
tagline: string;
|
|
93
104
|
currentVersion: string | null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
key: string;
|
|
97
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
98
|
-
}[] | null;
|
|
105
|
+
downloadsNeedsUser: boolean;
|
|
106
|
+
downloadsNeedsOwnership: boolean;
|
|
99
107
|
website?: string | undefined;
|
|
100
108
|
iconUrl?: string | undefined;
|
|
101
109
|
numberOfLicenses?: number | undefined;
|
|
102
110
|
numberOfTrials?: number | undefined;
|
|
103
111
|
currentActivations?: number | undefined;
|
|
104
112
|
maxActivations?: number | undefined;
|
|
113
|
+
downloads?: {
|
|
114
|
+
path: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
key: string;
|
|
117
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
118
|
+
size: number;
|
|
119
|
+
}[] | undefined;
|
|
105
120
|
} | undefined;
|
|
106
121
|
}>>;
|
|
107
|
-
getProductActivations: (productId: string, nextUrl?: string) => Promise<
|
|
108
|
-
status:
|
|
122
|
+
getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
123
|
+
status: _moonbase_sh_storefront_api.ActivationStatus;
|
|
109
124
|
id: string;
|
|
110
125
|
name: string;
|
|
111
126
|
licenseId: string;
|
|
112
|
-
activationMethod:
|
|
127
|
+
activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
|
|
113
128
|
lastValidatedAt: Date | null;
|
|
114
129
|
}>>;
|
|
115
130
|
revokeActivation: (activation: Activation) => Promise<void>;
|
|
@@ -127,8 +142,8 @@ declare function useVoucher(): {
|
|
|
127
142
|
type: "product";
|
|
128
143
|
id: string;
|
|
129
144
|
name: string;
|
|
130
|
-
iconUrl: string | null;
|
|
131
145
|
tagline: string;
|
|
146
|
+
iconUrl: string | null;
|
|
132
147
|
owned: boolean;
|
|
133
148
|
defaultVariation?: {
|
|
134
149
|
id: string;
|
|
@@ -176,16 +191,16 @@ declare function useVoucher(): {
|
|
|
176
191
|
type: "bundle";
|
|
177
192
|
id: string;
|
|
178
193
|
name: string;
|
|
179
|
-
iconUrl: string | null;
|
|
180
194
|
tagline: string;
|
|
195
|
+
iconUrl: string | null;
|
|
181
196
|
owned: boolean;
|
|
182
197
|
partial: boolean;
|
|
183
198
|
products: ({
|
|
184
199
|
type: "product";
|
|
185
200
|
id: string;
|
|
186
201
|
name: string;
|
|
187
|
-
iconUrl: string | null;
|
|
188
202
|
tagline: string;
|
|
203
|
+
iconUrl: string | null;
|
|
189
204
|
owned: boolean;
|
|
190
205
|
defaultVariation?: {
|
|
191
206
|
id: string;
|
|
@@ -281,8 +296,8 @@ declare function useVoucher(): {
|
|
|
281
296
|
type: "product";
|
|
282
297
|
id: string;
|
|
283
298
|
name: string;
|
|
284
|
-
iconUrl: string | null;
|
|
285
299
|
tagline: string;
|
|
300
|
+
iconUrl: string | null;
|
|
286
301
|
owned: boolean;
|
|
287
302
|
defaultVariation?: {
|
|
288
303
|
id: string;
|
|
@@ -330,16 +345,16 @@ declare function useVoucher(): {
|
|
|
330
345
|
type: "bundle";
|
|
331
346
|
id: string;
|
|
332
347
|
name: string;
|
|
333
|
-
iconUrl: string | null;
|
|
334
348
|
tagline: string;
|
|
349
|
+
iconUrl: string | null;
|
|
335
350
|
owned: boolean;
|
|
336
351
|
partial: boolean;
|
|
337
352
|
products: ({
|
|
338
353
|
type: "product";
|
|
339
354
|
id: string;
|
|
340
355
|
name: string;
|
|
341
|
-
iconUrl: string | null;
|
|
342
356
|
tagline: string;
|
|
357
|
+
iconUrl: string | null;
|
|
343
358
|
owned: boolean;
|
|
344
359
|
defaultVariation?: {
|
|
345
360
|
id: string;
|
|
@@ -430,15 +445,15 @@ declare function useCart(): {
|
|
|
430
445
|
items: vue.ComputedRef<({
|
|
431
446
|
type: "Product";
|
|
432
447
|
id: string;
|
|
433
|
-
productId: string;
|
|
434
448
|
quantity: number;
|
|
449
|
+
productId: string;
|
|
435
450
|
variationId: string;
|
|
436
451
|
price?: Record<string, number> | undefined;
|
|
437
452
|
variation?: {
|
|
438
453
|
id: string;
|
|
439
|
-
price: Record<string, number>;
|
|
440
454
|
name: string;
|
|
441
455
|
originalPrice: Record<string, number>;
|
|
456
|
+
price: Record<string, number>;
|
|
442
457
|
hasDiscount: boolean;
|
|
443
458
|
discount?: {
|
|
444
459
|
type: "PercentageOffDiscount";
|
|
@@ -462,9 +477,9 @@ declare function useCart(): {
|
|
|
462
477
|
owned: boolean;
|
|
463
478
|
defaultVariation?: {
|
|
464
479
|
id: string;
|
|
465
|
-
price: Record<string, number>;
|
|
466
480
|
name: string;
|
|
467
481
|
originalPrice: Record<string, number>;
|
|
482
|
+
price: Record<string, number>;
|
|
468
483
|
hasDiscount: boolean;
|
|
469
484
|
discount?: {
|
|
470
485
|
type: "PercentageOffDiscount";
|
|
@@ -481,9 +496,9 @@ declare function useCart(): {
|
|
|
481
496
|
} | undefined;
|
|
482
497
|
variations?: {
|
|
483
498
|
id: string;
|
|
484
|
-
price: Record<string, number>;
|
|
485
499
|
name: string;
|
|
486
500
|
originalPrice: Record<string, number>;
|
|
501
|
+
price: Record<string, number>;
|
|
487
502
|
hasDiscount: boolean;
|
|
488
503
|
discount?: {
|
|
489
504
|
type: "PercentageOffDiscount";
|
|
@@ -499,6 +514,20 @@ declare function useCart(): {
|
|
|
499
514
|
} | undefined;
|
|
500
515
|
}[] | undefined;
|
|
501
516
|
} | undefined;
|
|
517
|
+
appliedDiscount?: {
|
|
518
|
+
type: "PercentageOffDiscount";
|
|
519
|
+
name: string;
|
|
520
|
+
percentage: number;
|
|
521
|
+
isExclusive: boolean;
|
|
522
|
+
description?: string | undefined;
|
|
523
|
+
total?: Record<string, number> | undefined;
|
|
524
|
+
} | {
|
|
525
|
+
type: "FlatAmountOffDiscount";
|
|
526
|
+
name: string;
|
|
527
|
+
isExclusive: boolean;
|
|
528
|
+
description?: string | undefined;
|
|
529
|
+
total?: Record<string, number> | undefined;
|
|
530
|
+
} | undefined;
|
|
502
531
|
} | {
|
|
503
532
|
type: "Bundle";
|
|
504
533
|
id: string;
|
|
@@ -508,9 +537,9 @@ declare function useCart(): {
|
|
|
508
537
|
price?: Record<string, number> | undefined;
|
|
509
538
|
variation?: {
|
|
510
539
|
id: string;
|
|
511
|
-
price: Record<string, number>;
|
|
512
540
|
name: string;
|
|
513
541
|
originalPrice: Record<string, number>;
|
|
542
|
+
price: Record<string, number>;
|
|
514
543
|
hasDiscount: boolean;
|
|
515
544
|
discount?: {
|
|
516
545
|
type: "PercentageOffDiscount";
|
|
@@ -542,9 +571,9 @@ declare function useCart(): {
|
|
|
542
571
|
owned: boolean;
|
|
543
572
|
defaultVariation?: {
|
|
544
573
|
id: string;
|
|
545
|
-
price: Record<string, number>;
|
|
546
574
|
name: string;
|
|
547
575
|
originalPrice: Record<string, number>;
|
|
576
|
+
price: Record<string, number>;
|
|
548
577
|
hasDiscount: boolean;
|
|
549
578
|
discount?: {
|
|
550
579
|
type: "PercentageOffDiscount";
|
|
@@ -561,9 +590,9 @@ declare function useCart(): {
|
|
|
561
590
|
} | undefined;
|
|
562
591
|
variations?: {
|
|
563
592
|
id: string;
|
|
564
|
-
price: Record<string, number>;
|
|
565
593
|
name: string;
|
|
566
594
|
originalPrice: Record<string, number>;
|
|
595
|
+
price: Record<string, number>;
|
|
567
596
|
hasDiscount: boolean;
|
|
568
597
|
discount?: {
|
|
569
598
|
type: "PercentageOffDiscount";
|
|
@@ -583,9 +612,9 @@ declare function useCart(): {
|
|
|
583
612
|
})[];
|
|
584
613
|
defaultVariation?: {
|
|
585
614
|
id: string;
|
|
586
|
-
price: Record<string, number>;
|
|
587
615
|
name: string;
|
|
588
616
|
originalPrice: Record<string, number>;
|
|
617
|
+
price: Record<string, number>;
|
|
589
618
|
hasDiscount: boolean;
|
|
590
619
|
discount?: {
|
|
591
620
|
type: "PercentageOffDiscount";
|
|
@@ -602,9 +631,9 @@ declare function useCart(): {
|
|
|
602
631
|
} | undefined;
|
|
603
632
|
variations?: {
|
|
604
633
|
id: string;
|
|
605
|
-
price: Record<string, number>;
|
|
606
634
|
name: string;
|
|
607
635
|
originalPrice: Record<string, number>;
|
|
636
|
+
price: Record<string, number>;
|
|
608
637
|
hasDiscount: boolean;
|
|
609
638
|
discount?: {
|
|
610
639
|
type: "PercentageOffDiscount";
|
|
@@ -620,6 +649,20 @@ declare function useCart(): {
|
|
|
620
649
|
} | undefined;
|
|
621
650
|
}[] | undefined;
|
|
622
651
|
} | undefined;
|
|
652
|
+
appliedDiscount?: {
|
|
653
|
+
type: "PercentageOffDiscount";
|
|
654
|
+
name: string;
|
|
655
|
+
percentage: number;
|
|
656
|
+
isExclusive: boolean;
|
|
657
|
+
description?: string | undefined;
|
|
658
|
+
total?: Record<string, number> | undefined;
|
|
659
|
+
} | {
|
|
660
|
+
type: "FlatAmountOffDiscount";
|
|
661
|
+
name: string;
|
|
662
|
+
isExclusive: boolean;
|
|
663
|
+
description?: string | undefined;
|
|
664
|
+
total?: Record<string, number> | undefined;
|
|
665
|
+
} | undefined;
|
|
623
666
|
})[]>;
|
|
624
667
|
currency: vue.ComputedRef<string>;
|
|
625
668
|
total: vue.ComputedRef<{
|
|
@@ -638,6 +681,9 @@ declare function useAuth(): {
|
|
|
638
681
|
email: string;
|
|
639
682
|
name: string;
|
|
640
683
|
tenantId: string;
|
|
684
|
+
communicationPreferences: {
|
|
685
|
+
newsletterOptIn: boolean;
|
|
686
|
+
};
|
|
641
687
|
address?: {
|
|
642
688
|
countryCode: string;
|
|
643
689
|
streetAddress1: string;
|
|
@@ -653,6 +699,9 @@ declare function useAuth(): {
|
|
|
653
699
|
email: string;
|
|
654
700
|
name: string;
|
|
655
701
|
tenantId: string;
|
|
702
|
+
communicationPreferences: {
|
|
703
|
+
newsletterOptIn: boolean;
|
|
704
|
+
};
|
|
656
705
|
address?: {
|
|
657
706
|
countryCode: string;
|
|
658
707
|
streetAddress1: string;
|
|
@@ -667,6 +716,9 @@ declare function useAuth(): {
|
|
|
667
716
|
email: string;
|
|
668
717
|
name: string;
|
|
669
718
|
tenantId: string;
|
|
719
|
+
communicationPreferences: {
|
|
720
|
+
newsletterOptIn: boolean;
|
|
721
|
+
};
|
|
670
722
|
address?: {
|
|
671
723
|
countryCode: string;
|
|
672
724
|
streetAddress1: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
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<
|
|
38
|
-
status:
|
|
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;
|
|
@@ -43,46 +43,56 @@ declare function useInventory(): {
|
|
|
43
43
|
product?: {
|
|
44
44
|
id: string;
|
|
45
45
|
name: string;
|
|
46
|
+
tagline: string;
|
|
46
47
|
currentVersion: string | null;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
key: string;
|
|
50
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
51
|
-
}[] | null;
|
|
48
|
+
downloadsNeedsUser: boolean;
|
|
49
|
+
downloadsNeedsOwnership: boolean;
|
|
52
50
|
website?: string | undefined;
|
|
53
51
|
iconUrl?: string | undefined;
|
|
54
52
|
numberOfLicenses?: number | undefined;
|
|
55
53
|
numberOfTrials?: number | undefined;
|
|
56
54
|
currentActivations?: number | undefined;
|
|
57
55
|
maxActivations?: number | undefined;
|
|
56
|
+
downloads?: {
|
|
57
|
+
path: string | null;
|
|
58
|
+
name: string;
|
|
59
|
+
key: string;
|
|
60
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
61
|
+
size: number;
|
|
62
|
+
}[] | undefined;
|
|
58
63
|
} | undefined;
|
|
59
64
|
}>>;
|
|
60
|
-
getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<
|
|
61
|
-
status:
|
|
65
|
+
getLicenseActivations: (licenseId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
66
|
+
status: _moonbase_sh_storefront_api.ActivationStatus;
|
|
62
67
|
id: string;
|
|
63
68
|
name: string;
|
|
64
69
|
licenseId: string;
|
|
65
|
-
activationMethod:
|
|
70
|
+
activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
|
|
66
71
|
lastValidatedAt: Date | null;
|
|
67
72
|
}>>;
|
|
68
|
-
getProducts: (nextUrl?: string) => Promise<
|
|
73
|
+
getProducts: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
69
74
|
id: string;
|
|
70
75
|
name: string;
|
|
76
|
+
tagline: string;
|
|
71
77
|
currentVersion: string | null;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
key: string;
|
|
75
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
76
|
-
}[] | null;
|
|
78
|
+
downloadsNeedsUser: boolean;
|
|
79
|
+
downloadsNeedsOwnership: boolean;
|
|
77
80
|
website?: string | undefined;
|
|
78
81
|
iconUrl?: string | undefined;
|
|
79
82
|
numberOfLicenses?: number | undefined;
|
|
80
83
|
numberOfTrials?: number | undefined;
|
|
81
84
|
currentActivations?: number | undefined;
|
|
82
85
|
maxActivations?: number | undefined;
|
|
86
|
+
downloads?: {
|
|
87
|
+
path: string | null;
|
|
88
|
+
name: string;
|
|
89
|
+
key: string;
|
|
90
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
91
|
+
size: number;
|
|
92
|
+
}[] | undefined;
|
|
83
93
|
}>>;
|
|
84
|
-
getProductLicenses: (productId: string, nextUrl?: string) => Promise<
|
|
85
|
-
status:
|
|
94
|
+
getProductLicenses: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
95
|
+
status: _moonbase_sh_storefront_api.LicenseStatus;
|
|
86
96
|
id: string;
|
|
87
97
|
activeNumberOfActivations: number;
|
|
88
98
|
maxNumberOfActivations: number;
|
|
@@ -90,26 +100,31 @@ declare function useInventory(): {
|
|
|
90
100
|
product?: {
|
|
91
101
|
id: string;
|
|
92
102
|
name: string;
|
|
103
|
+
tagline: string;
|
|
93
104
|
currentVersion: string | null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
key: string;
|
|
97
|
-
platform: _moonbase_sh_api_client.Platform;
|
|
98
|
-
}[] | null;
|
|
105
|
+
downloadsNeedsUser: boolean;
|
|
106
|
+
downloadsNeedsOwnership: boolean;
|
|
99
107
|
website?: string | undefined;
|
|
100
108
|
iconUrl?: string | undefined;
|
|
101
109
|
numberOfLicenses?: number | undefined;
|
|
102
110
|
numberOfTrials?: number | undefined;
|
|
103
111
|
currentActivations?: number | undefined;
|
|
104
112
|
maxActivations?: number | undefined;
|
|
113
|
+
downloads?: {
|
|
114
|
+
path: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
key: string;
|
|
117
|
+
platform: _moonbase_sh_storefront_api.Platform;
|
|
118
|
+
size: number;
|
|
119
|
+
}[] | undefined;
|
|
105
120
|
} | undefined;
|
|
106
121
|
}>>;
|
|
107
|
-
getProductActivations: (productId: string, nextUrl?: string) => Promise<
|
|
108
|
-
status:
|
|
122
|
+
getProductActivations: (productId: string, nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
|
|
123
|
+
status: _moonbase_sh_storefront_api.ActivationStatus;
|
|
109
124
|
id: string;
|
|
110
125
|
name: string;
|
|
111
126
|
licenseId: string;
|
|
112
|
-
activationMethod:
|
|
127
|
+
activationMethod: _moonbase_sh_storefront_api.ActivationMethod;
|
|
113
128
|
lastValidatedAt: Date | null;
|
|
114
129
|
}>>;
|
|
115
130
|
revokeActivation: (activation: Activation) => Promise<void>;
|
|
@@ -127,8 +142,8 @@ declare function useVoucher(): {
|
|
|
127
142
|
type: "product";
|
|
128
143
|
id: string;
|
|
129
144
|
name: string;
|
|
130
|
-
iconUrl: string | null;
|
|
131
145
|
tagline: string;
|
|
146
|
+
iconUrl: string | null;
|
|
132
147
|
owned: boolean;
|
|
133
148
|
defaultVariation?: {
|
|
134
149
|
id: string;
|
|
@@ -176,16 +191,16 @@ declare function useVoucher(): {
|
|
|
176
191
|
type: "bundle";
|
|
177
192
|
id: string;
|
|
178
193
|
name: string;
|
|
179
|
-
iconUrl: string | null;
|
|
180
194
|
tagline: string;
|
|
195
|
+
iconUrl: string | null;
|
|
181
196
|
owned: boolean;
|
|
182
197
|
partial: boolean;
|
|
183
198
|
products: ({
|
|
184
199
|
type: "product";
|
|
185
200
|
id: string;
|
|
186
201
|
name: string;
|
|
187
|
-
iconUrl: string | null;
|
|
188
202
|
tagline: string;
|
|
203
|
+
iconUrl: string | null;
|
|
189
204
|
owned: boolean;
|
|
190
205
|
defaultVariation?: {
|
|
191
206
|
id: string;
|
|
@@ -281,8 +296,8 @@ declare function useVoucher(): {
|
|
|
281
296
|
type: "product";
|
|
282
297
|
id: string;
|
|
283
298
|
name: string;
|
|
284
|
-
iconUrl: string | null;
|
|
285
299
|
tagline: string;
|
|
300
|
+
iconUrl: string | null;
|
|
286
301
|
owned: boolean;
|
|
287
302
|
defaultVariation?: {
|
|
288
303
|
id: string;
|
|
@@ -330,16 +345,16 @@ declare function useVoucher(): {
|
|
|
330
345
|
type: "bundle";
|
|
331
346
|
id: string;
|
|
332
347
|
name: string;
|
|
333
|
-
iconUrl: string | null;
|
|
334
348
|
tagline: string;
|
|
349
|
+
iconUrl: string | null;
|
|
335
350
|
owned: boolean;
|
|
336
351
|
partial: boolean;
|
|
337
352
|
products: ({
|
|
338
353
|
type: "product";
|
|
339
354
|
id: string;
|
|
340
355
|
name: string;
|
|
341
|
-
iconUrl: string | null;
|
|
342
356
|
tagline: string;
|
|
357
|
+
iconUrl: string | null;
|
|
343
358
|
owned: boolean;
|
|
344
359
|
defaultVariation?: {
|
|
345
360
|
id: string;
|
|
@@ -430,15 +445,15 @@ declare function useCart(): {
|
|
|
430
445
|
items: vue.ComputedRef<({
|
|
431
446
|
type: "Product";
|
|
432
447
|
id: string;
|
|
433
|
-
productId: string;
|
|
434
448
|
quantity: number;
|
|
449
|
+
productId: string;
|
|
435
450
|
variationId: string;
|
|
436
451
|
price?: Record<string, number> | undefined;
|
|
437
452
|
variation?: {
|
|
438
453
|
id: string;
|
|
439
|
-
price: Record<string, number>;
|
|
440
454
|
name: string;
|
|
441
455
|
originalPrice: Record<string, number>;
|
|
456
|
+
price: Record<string, number>;
|
|
442
457
|
hasDiscount: boolean;
|
|
443
458
|
discount?: {
|
|
444
459
|
type: "PercentageOffDiscount";
|
|
@@ -462,9 +477,9 @@ declare function useCart(): {
|
|
|
462
477
|
owned: boolean;
|
|
463
478
|
defaultVariation?: {
|
|
464
479
|
id: string;
|
|
465
|
-
price: Record<string, number>;
|
|
466
480
|
name: string;
|
|
467
481
|
originalPrice: Record<string, number>;
|
|
482
|
+
price: Record<string, number>;
|
|
468
483
|
hasDiscount: boolean;
|
|
469
484
|
discount?: {
|
|
470
485
|
type: "PercentageOffDiscount";
|
|
@@ -481,9 +496,9 @@ declare function useCart(): {
|
|
|
481
496
|
} | undefined;
|
|
482
497
|
variations?: {
|
|
483
498
|
id: string;
|
|
484
|
-
price: Record<string, number>;
|
|
485
499
|
name: string;
|
|
486
500
|
originalPrice: Record<string, number>;
|
|
501
|
+
price: Record<string, number>;
|
|
487
502
|
hasDiscount: boolean;
|
|
488
503
|
discount?: {
|
|
489
504
|
type: "PercentageOffDiscount";
|
|
@@ -499,6 +514,20 @@ declare function useCart(): {
|
|
|
499
514
|
} | undefined;
|
|
500
515
|
}[] | undefined;
|
|
501
516
|
} | undefined;
|
|
517
|
+
appliedDiscount?: {
|
|
518
|
+
type: "PercentageOffDiscount";
|
|
519
|
+
name: string;
|
|
520
|
+
percentage: number;
|
|
521
|
+
isExclusive: boolean;
|
|
522
|
+
description?: string | undefined;
|
|
523
|
+
total?: Record<string, number> | undefined;
|
|
524
|
+
} | {
|
|
525
|
+
type: "FlatAmountOffDiscount";
|
|
526
|
+
name: string;
|
|
527
|
+
isExclusive: boolean;
|
|
528
|
+
description?: string | undefined;
|
|
529
|
+
total?: Record<string, number> | undefined;
|
|
530
|
+
} | undefined;
|
|
502
531
|
} | {
|
|
503
532
|
type: "Bundle";
|
|
504
533
|
id: string;
|
|
@@ -508,9 +537,9 @@ declare function useCart(): {
|
|
|
508
537
|
price?: Record<string, number> | undefined;
|
|
509
538
|
variation?: {
|
|
510
539
|
id: string;
|
|
511
|
-
price: Record<string, number>;
|
|
512
540
|
name: string;
|
|
513
541
|
originalPrice: Record<string, number>;
|
|
542
|
+
price: Record<string, number>;
|
|
514
543
|
hasDiscount: boolean;
|
|
515
544
|
discount?: {
|
|
516
545
|
type: "PercentageOffDiscount";
|
|
@@ -542,9 +571,9 @@ declare function useCart(): {
|
|
|
542
571
|
owned: boolean;
|
|
543
572
|
defaultVariation?: {
|
|
544
573
|
id: string;
|
|
545
|
-
price: Record<string, number>;
|
|
546
574
|
name: string;
|
|
547
575
|
originalPrice: Record<string, number>;
|
|
576
|
+
price: Record<string, number>;
|
|
548
577
|
hasDiscount: boolean;
|
|
549
578
|
discount?: {
|
|
550
579
|
type: "PercentageOffDiscount";
|
|
@@ -561,9 +590,9 @@ declare function useCart(): {
|
|
|
561
590
|
} | undefined;
|
|
562
591
|
variations?: {
|
|
563
592
|
id: string;
|
|
564
|
-
price: Record<string, number>;
|
|
565
593
|
name: string;
|
|
566
594
|
originalPrice: Record<string, number>;
|
|
595
|
+
price: Record<string, number>;
|
|
567
596
|
hasDiscount: boolean;
|
|
568
597
|
discount?: {
|
|
569
598
|
type: "PercentageOffDiscount";
|
|
@@ -583,9 +612,9 @@ declare function useCart(): {
|
|
|
583
612
|
})[];
|
|
584
613
|
defaultVariation?: {
|
|
585
614
|
id: string;
|
|
586
|
-
price: Record<string, number>;
|
|
587
615
|
name: string;
|
|
588
616
|
originalPrice: Record<string, number>;
|
|
617
|
+
price: Record<string, number>;
|
|
589
618
|
hasDiscount: boolean;
|
|
590
619
|
discount?: {
|
|
591
620
|
type: "PercentageOffDiscount";
|
|
@@ -602,9 +631,9 @@ declare function useCart(): {
|
|
|
602
631
|
} | undefined;
|
|
603
632
|
variations?: {
|
|
604
633
|
id: string;
|
|
605
|
-
price: Record<string, number>;
|
|
606
634
|
name: string;
|
|
607
635
|
originalPrice: Record<string, number>;
|
|
636
|
+
price: Record<string, number>;
|
|
608
637
|
hasDiscount: boolean;
|
|
609
638
|
discount?: {
|
|
610
639
|
type: "PercentageOffDiscount";
|
|
@@ -620,6 +649,20 @@ declare function useCart(): {
|
|
|
620
649
|
} | undefined;
|
|
621
650
|
}[] | undefined;
|
|
622
651
|
} | undefined;
|
|
652
|
+
appliedDiscount?: {
|
|
653
|
+
type: "PercentageOffDiscount";
|
|
654
|
+
name: string;
|
|
655
|
+
percentage: number;
|
|
656
|
+
isExclusive: boolean;
|
|
657
|
+
description?: string | undefined;
|
|
658
|
+
total?: Record<string, number> | undefined;
|
|
659
|
+
} | {
|
|
660
|
+
type: "FlatAmountOffDiscount";
|
|
661
|
+
name: string;
|
|
662
|
+
isExclusive: boolean;
|
|
663
|
+
description?: string | undefined;
|
|
664
|
+
total?: Record<string, number> | undefined;
|
|
665
|
+
} | undefined;
|
|
623
666
|
})[]>;
|
|
624
667
|
currency: vue.ComputedRef<string>;
|
|
625
668
|
total: vue.ComputedRef<{
|
|
@@ -638,6 +681,9 @@ declare function useAuth(): {
|
|
|
638
681
|
email: string;
|
|
639
682
|
name: string;
|
|
640
683
|
tenantId: string;
|
|
684
|
+
communicationPreferences: {
|
|
685
|
+
newsletterOptIn: boolean;
|
|
686
|
+
};
|
|
641
687
|
address?: {
|
|
642
688
|
countryCode: string;
|
|
643
689
|
streetAddress1: string;
|
|
@@ -653,6 +699,9 @@ declare function useAuth(): {
|
|
|
653
699
|
email: string;
|
|
654
700
|
name: string;
|
|
655
701
|
tenantId: string;
|
|
702
|
+
communicationPreferences: {
|
|
703
|
+
newsletterOptIn: boolean;
|
|
704
|
+
};
|
|
656
705
|
address?: {
|
|
657
706
|
countryCode: string;
|
|
658
707
|
streetAddress1: string;
|
|
@@ -667,6 +716,9 @@ declare function useAuth(): {
|
|
|
667
716
|
email: string;
|
|
668
717
|
name: string;
|
|
669
718
|
tenantId: string;
|
|
719
|
+
communicationPreferences: {
|
|
720
|
+
newsletterOptIn: boolean;
|
|
721
|
+
};
|
|
670
722
|
address?: {
|
|
671
723
|
countryCode: string;
|
|
672
724
|
streetAddress1: string;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { MoonbaseClient } from "@moonbase.sh/api
|
|
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
|
|
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.
|
|
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
|
|
21
|
+
"@moonbase.sh/storefront-api": "0.1.78"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/uuid": "^9.0.7",
|