@moonbase.sh/storefront-api 0.1.83 → 0.1.85
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 +252 -193
- package/dist/index.d.cts +471 -1
- package/dist/index.d.ts +471 -1
- package/dist/index.js +251 -193
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,176 @@
|
|
|
1
|
+
// src/activationsRequests/endpoints.ts
|
|
2
|
+
import { z as z5 } from "zod";
|
|
3
|
+
|
|
4
|
+
// src/activationsRequests/schemas.ts
|
|
5
|
+
import { z as z4 } from "zod";
|
|
6
|
+
|
|
7
|
+
// src/storefront/schemas.ts
|
|
8
|
+
import { z as z3 } from "zod";
|
|
9
|
+
|
|
10
|
+
// src/globalSchemas.ts
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
var priceCollectionSchema = z.record(z.number());
|
|
13
|
+
var percentageOffDiscountSchema = z.object({
|
|
14
|
+
type: z.literal("PercentageOffDiscount"),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
description: z.string().optional(),
|
|
17
|
+
percentage: z.number(),
|
|
18
|
+
total: priceCollectionSchema
|
|
19
|
+
});
|
|
20
|
+
var flatAmountOffDiscountSchema = z.object({
|
|
21
|
+
type: z.literal("FlatAmountOffDiscount"),
|
|
22
|
+
name: z.string(),
|
|
23
|
+
description: z.string().optional(),
|
|
24
|
+
total: priceCollectionSchema
|
|
25
|
+
});
|
|
26
|
+
var discountSchema = z.discriminatedUnion("type", [
|
|
27
|
+
percentageOffDiscountSchema,
|
|
28
|
+
flatAmountOffDiscountSchema
|
|
29
|
+
]);
|
|
30
|
+
var pricingVariationSchema = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
originalPrice: priceCollectionSchema,
|
|
34
|
+
price: priceCollectionSchema,
|
|
35
|
+
hasDiscount: z.boolean(),
|
|
36
|
+
discount: discountSchema.optional()
|
|
37
|
+
});
|
|
38
|
+
function paged(itemSchema) {
|
|
39
|
+
return z.object({
|
|
40
|
+
items: z.array(itemSchema),
|
|
41
|
+
hasMore: z.boolean(),
|
|
42
|
+
next: z.string().nullable()
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function quantifiable(itemSchema) {
|
|
46
|
+
return z.object({
|
|
47
|
+
value: itemSchema,
|
|
48
|
+
quantity: z.number()
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/products/schemas.ts
|
|
53
|
+
import { z as z2 } from "zod";
|
|
54
|
+
|
|
55
|
+
// src/products/models.ts
|
|
56
|
+
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
57
|
+
Platform2["Universal"] = "Universal";
|
|
58
|
+
Platform2["Windows"] = "Windows";
|
|
59
|
+
Platform2["Linux"] = "Linux";
|
|
60
|
+
Platform2["Mac"] = "Mac";
|
|
61
|
+
return Platform2;
|
|
62
|
+
})(Platform || {});
|
|
63
|
+
|
|
64
|
+
// src/products/schemas.ts
|
|
65
|
+
var downloadSchema = z2.object({
|
|
66
|
+
name: z2.string(),
|
|
67
|
+
key: z2.string(),
|
|
68
|
+
platform: z2.nativeEnum(Platform),
|
|
69
|
+
size: z2.number(),
|
|
70
|
+
path: z2.string().nullable()
|
|
71
|
+
});
|
|
72
|
+
var productSummarySchema = z2.object({
|
|
73
|
+
id: z2.string(),
|
|
74
|
+
name: z2.string(),
|
|
75
|
+
tagline: z2.string(),
|
|
76
|
+
website: z2.string().optional(),
|
|
77
|
+
iconUrl: z2.string().optional(),
|
|
78
|
+
numberOfLicenses: z2.number().optional(),
|
|
79
|
+
numberOfTrials: z2.number().optional(),
|
|
80
|
+
currentActivations: z2.number().optional(),
|
|
81
|
+
maxActivations: z2.number().optional(),
|
|
82
|
+
currentVersion: z2.string().nullable(),
|
|
83
|
+
downloadsNeedsUser: z2.boolean(),
|
|
84
|
+
downloadsNeedsOwnership: z2.boolean(),
|
|
85
|
+
downloads: z2.array(downloadSchema).optional()
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// src/storefront/schemas.ts
|
|
89
|
+
var storefrontProductSchema = z3.object({
|
|
90
|
+
id: z3.string(),
|
|
91
|
+
name: z3.string(),
|
|
92
|
+
tagline: z3.string(),
|
|
93
|
+
iconUrl: z3.string().nullable(),
|
|
94
|
+
owned: z3.boolean(),
|
|
95
|
+
currentVersion: z3.string().optional(),
|
|
96
|
+
downloads: downloadSchema.array().optional(),
|
|
97
|
+
defaultVariation: pricingVariationSchema.optional(),
|
|
98
|
+
variations: pricingVariationSchema.array().optional(),
|
|
99
|
+
type: z3.void().transform(() => "product").pipe(z3.literal("product"))
|
|
100
|
+
});
|
|
101
|
+
var storefrontBundleSchema = z3.object({
|
|
102
|
+
id: z3.string(),
|
|
103
|
+
name: z3.string(),
|
|
104
|
+
tagline: z3.string(),
|
|
105
|
+
iconUrl: z3.string().nullable(),
|
|
106
|
+
owned: z3.boolean(),
|
|
107
|
+
partial: z3.boolean(),
|
|
108
|
+
products: storefrontProductSchema.and(z3.object({
|
|
109
|
+
included: z3.boolean()
|
|
110
|
+
})).array(),
|
|
111
|
+
defaultVariation: pricingVariationSchema.optional(),
|
|
112
|
+
variations: pricingVariationSchema.array().optional(),
|
|
113
|
+
type: z3.void().transform(() => "bundle").pipe(z3.literal("bundle"))
|
|
114
|
+
});
|
|
115
|
+
var storefrontSchema = z3.object({
|
|
116
|
+
suggestedCurrency: z3.string(),
|
|
117
|
+
products: storefrontProductSchema.array(),
|
|
118
|
+
bundles: storefrontBundleSchema.array()
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// src/activationsRequests/models.ts
|
|
122
|
+
var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
|
|
123
|
+
ActivationRequestStatus2["Requested"] = "Requested";
|
|
124
|
+
ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
|
|
125
|
+
ActivationRequestStatus2["Completed"] = "Completed";
|
|
126
|
+
return ActivationRequestStatus2;
|
|
127
|
+
})(ActivationRequestStatus || {});
|
|
128
|
+
|
|
129
|
+
// src/activationsRequests/schemas.ts
|
|
130
|
+
var activationRequestSchema = z4.object({
|
|
131
|
+
id: z4.string(),
|
|
132
|
+
status: z4.nativeEnum(ActivationRequestStatus),
|
|
133
|
+
product: storefrontProductSchema,
|
|
134
|
+
trialEligibility: z4.object({
|
|
135
|
+
eligible: z4.boolean(),
|
|
136
|
+
existing: z4.boolean(),
|
|
137
|
+
requiresAccount: z4.boolean(),
|
|
138
|
+
numberOfDaysPerProduct: z4.number(),
|
|
139
|
+
numberOfDaysRemaining: z4.number()
|
|
140
|
+
}).optional(),
|
|
141
|
+
licenseEligibility: z4.object({
|
|
142
|
+
eligible: z4.boolean()
|
|
143
|
+
}).optional()
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// src/activationsRequests/endpoints.ts
|
|
147
|
+
var ActivationRequestEndpoints = class {
|
|
148
|
+
constructor(api) {
|
|
149
|
+
this.api = api;
|
|
150
|
+
}
|
|
151
|
+
async get(requestId) {
|
|
152
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}`);
|
|
153
|
+
return activationRequestSchema.parse(response);
|
|
154
|
+
}
|
|
155
|
+
async isCompleted(requestId) {
|
|
156
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}/completed`);
|
|
157
|
+
return z5.boolean().parse(response.data);
|
|
158
|
+
}
|
|
159
|
+
async fulfillLicense(requestId) {
|
|
160
|
+
const response = await this.api.authenticatedFetch(`/api/customer/activations/${requestId}/license`, "POST");
|
|
161
|
+
return activationRequestSchema.parse(response.data);
|
|
162
|
+
}
|
|
163
|
+
async fulfillTrial(requestId) {
|
|
164
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}/trial`, "POST");
|
|
165
|
+
return activationRequestSchema.parse(response.data);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
1
169
|
// src/identity/endpoints.ts
|
|
2
170
|
import fetch from "cross-fetch";
|
|
3
171
|
|
|
4
172
|
// src/utils/problemHandler.ts
|
|
5
|
-
import { z } from "zod";
|
|
173
|
+
import { z as z6 } from "zod";
|
|
6
174
|
|
|
7
175
|
// src/utils/errors.ts
|
|
8
176
|
var NotAuthorizedError = class extends Error {
|
|
@@ -25,11 +193,11 @@ var NotFoundError = class extends Error {
|
|
|
25
193
|
};
|
|
26
194
|
|
|
27
195
|
// src/utils/problemHandler.ts
|
|
28
|
-
var problemDetailsSchema =
|
|
29
|
-
type:
|
|
30
|
-
title:
|
|
31
|
-
detail:
|
|
32
|
-
status:
|
|
196
|
+
var problemDetailsSchema = z6.object({
|
|
197
|
+
type: z6.string(),
|
|
198
|
+
title: z6.string(),
|
|
199
|
+
detail: z6.string().optional(),
|
|
200
|
+
status: z6.number()
|
|
33
201
|
});
|
|
34
202
|
async function handleResponseProblem(response) {
|
|
35
203
|
if (response.status === 404)
|
|
@@ -53,30 +221,30 @@ async function handleResponseProblem(response) {
|
|
|
53
221
|
}
|
|
54
222
|
|
|
55
223
|
// src/identity/schemas.ts
|
|
56
|
-
import { z as
|
|
57
|
-
var addressSchema =
|
|
58
|
-
countryCode:
|
|
59
|
-
streetAddress1:
|
|
60
|
-
streetAddress2:
|
|
61
|
-
locality:
|
|
62
|
-
region:
|
|
63
|
-
postCode:
|
|
224
|
+
import { z as z7 } from "zod";
|
|
225
|
+
var addressSchema = z7.object({
|
|
226
|
+
countryCode: z7.string(),
|
|
227
|
+
streetAddress1: z7.string(),
|
|
228
|
+
streetAddress2: z7.string().nullable(),
|
|
229
|
+
locality: z7.string().nullable(),
|
|
230
|
+
region: z7.string().nullable(),
|
|
231
|
+
postCode: z7.string()
|
|
64
232
|
});
|
|
65
|
-
var communicationPreferencesSchema =
|
|
66
|
-
newsletterOptIn:
|
|
233
|
+
var communicationPreferencesSchema = z7.object({
|
|
234
|
+
newsletterOptIn: z7.boolean()
|
|
67
235
|
// productUpdatesOptIn: z.boolean(), // TODO: Enable when relevant
|
|
68
236
|
});
|
|
69
|
-
var userSchema =
|
|
70
|
-
id:
|
|
71
|
-
email:
|
|
72
|
-
name:
|
|
73
|
-
tenantId:
|
|
237
|
+
var userSchema = z7.object({
|
|
238
|
+
id: z7.string(),
|
|
239
|
+
email: z7.string(),
|
|
240
|
+
name: z7.string(),
|
|
241
|
+
tenantId: z7.string(),
|
|
74
242
|
address: addressSchema.optional(),
|
|
75
243
|
communicationPreferences: communicationPreferencesSchema
|
|
76
244
|
});
|
|
77
|
-
var identityUserSchema = userSchema.and(
|
|
78
|
-
accessToken:
|
|
79
|
-
refreshToken:
|
|
245
|
+
var identityUserSchema = userSchema.and(z7.object({
|
|
246
|
+
accessToken: z7.string(),
|
|
247
|
+
refreshToken: z7.string()
|
|
80
248
|
}));
|
|
81
249
|
|
|
82
250
|
// src/identity/endpoints.ts
|
|
@@ -154,86 +322,8 @@ var IdentityEndpoints = class {
|
|
|
154
322
|
}
|
|
155
323
|
};
|
|
156
324
|
|
|
157
|
-
// src/globalSchemas.ts
|
|
158
|
-
import { z as z3 } from "zod";
|
|
159
|
-
var priceCollectionSchema = z3.record(z3.number());
|
|
160
|
-
var percentageOffDiscountSchema = z3.object({
|
|
161
|
-
type: z3.literal("PercentageOffDiscount"),
|
|
162
|
-
name: z3.string(),
|
|
163
|
-
description: z3.string().optional(),
|
|
164
|
-
percentage: z3.number(),
|
|
165
|
-
total: priceCollectionSchema
|
|
166
|
-
});
|
|
167
|
-
var flatAmountOffDiscountSchema = z3.object({
|
|
168
|
-
type: z3.literal("FlatAmountOffDiscount"),
|
|
169
|
-
name: z3.string(),
|
|
170
|
-
description: z3.string().optional(),
|
|
171
|
-
total: priceCollectionSchema
|
|
172
|
-
});
|
|
173
|
-
var discountSchema = z3.discriminatedUnion("type", [
|
|
174
|
-
percentageOffDiscountSchema,
|
|
175
|
-
flatAmountOffDiscountSchema
|
|
176
|
-
]);
|
|
177
|
-
var pricingVariationSchema = z3.object({
|
|
178
|
-
id: z3.string(),
|
|
179
|
-
name: z3.string(),
|
|
180
|
-
originalPrice: priceCollectionSchema,
|
|
181
|
-
price: priceCollectionSchema,
|
|
182
|
-
hasDiscount: z3.boolean(),
|
|
183
|
-
discount: discountSchema.optional()
|
|
184
|
-
});
|
|
185
|
-
function paged(itemSchema) {
|
|
186
|
-
return z3.object({
|
|
187
|
-
items: z3.array(itemSchema),
|
|
188
|
-
hasMore: z3.boolean(),
|
|
189
|
-
next: z3.string().nullable()
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function quantifiable(itemSchema) {
|
|
193
|
-
return z3.object({
|
|
194
|
-
value: itemSchema,
|
|
195
|
-
quantity: z3.number()
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
325
|
// src/licenses/schemas.ts
|
|
200
|
-
import { z as
|
|
201
|
-
|
|
202
|
-
// src/products/schemas.ts
|
|
203
|
-
import { z as z4 } from "zod";
|
|
204
|
-
|
|
205
|
-
// src/products/models.ts
|
|
206
|
-
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
207
|
-
Platform2["Universal"] = "Universal";
|
|
208
|
-
Platform2["Windows"] = "Windows";
|
|
209
|
-
Platform2["Linux"] = "Linux";
|
|
210
|
-
Platform2["Mac"] = "Mac";
|
|
211
|
-
return Platform2;
|
|
212
|
-
})(Platform || {});
|
|
213
|
-
|
|
214
|
-
// src/products/schemas.ts
|
|
215
|
-
var downloadSchema = z4.object({
|
|
216
|
-
name: z4.string(),
|
|
217
|
-
key: z4.string(),
|
|
218
|
-
platform: z4.nativeEnum(Platform),
|
|
219
|
-
size: z4.number(),
|
|
220
|
-
path: z4.string().nullable()
|
|
221
|
-
});
|
|
222
|
-
var productSummarySchema = z4.object({
|
|
223
|
-
id: z4.string(),
|
|
224
|
-
name: z4.string(),
|
|
225
|
-
tagline: z4.string(),
|
|
226
|
-
website: z4.string().optional(),
|
|
227
|
-
iconUrl: z4.string().optional(),
|
|
228
|
-
numberOfLicenses: z4.number().optional(),
|
|
229
|
-
numberOfTrials: z4.number().optional(),
|
|
230
|
-
currentActivations: z4.number().optional(),
|
|
231
|
-
maxActivations: z4.number().optional(),
|
|
232
|
-
currentVersion: z4.string().nullable(),
|
|
233
|
-
downloadsNeedsUser: z4.boolean(),
|
|
234
|
-
downloadsNeedsOwnership: z4.boolean(),
|
|
235
|
-
downloads: z4.array(downloadSchema).optional()
|
|
236
|
-
});
|
|
326
|
+
import { z as z8 } from "zod";
|
|
237
327
|
|
|
238
328
|
// src/licenses/models.ts
|
|
239
329
|
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
@@ -253,21 +343,21 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
|
253
343
|
})(ActivationMethod || {});
|
|
254
344
|
|
|
255
345
|
// src/licenses/schemas.ts
|
|
256
|
-
var licenseSchema =
|
|
257
|
-
id:
|
|
258
|
-
status:
|
|
346
|
+
var licenseSchema = z8.object({
|
|
347
|
+
id: z8.string(),
|
|
348
|
+
status: z8.nativeEnum(LicenseStatus),
|
|
259
349
|
product: productSummarySchema.optional(),
|
|
260
|
-
activeNumberOfActivations:
|
|
261
|
-
maxNumberOfActivations:
|
|
262
|
-
createdAt:
|
|
350
|
+
activeNumberOfActivations: z8.number(),
|
|
351
|
+
maxNumberOfActivations: z8.number(),
|
|
352
|
+
createdAt: z8.coerce.date()
|
|
263
353
|
});
|
|
264
|
-
var activationSchema =
|
|
265
|
-
id:
|
|
266
|
-
licenseId:
|
|
267
|
-
name:
|
|
268
|
-
status:
|
|
269
|
-
activationMethod:
|
|
270
|
-
lastValidatedAt:
|
|
354
|
+
var activationSchema = z8.object({
|
|
355
|
+
id: z8.string(),
|
|
356
|
+
licenseId: z8.string(),
|
|
357
|
+
name: z8.string(),
|
|
358
|
+
status: z8.nativeEnum(ActivationStatus),
|
|
359
|
+
activationMethod: z8.nativeEnum(ActivationMethod),
|
|
360
|
+
lastValidatedAt: z8.coerce.date().nullable()
|
|
271
361
|
});
|
|
272
362
|
|
|
273
363
|
// src/licenses/endpoints.ts
|
|
@@ -291,41 +381,7 @@ var LicenseEndpoints = class {
|
|
|
291
381
|
};
|
|
292
382
|
|
|
293
383
|
// src/orders/schemas.ts
|
|
294
|
-
import { z as
|
|
295
|
-
|
|
296
|
-
// src/storefront/schemas.ts
|
|
297
|
-
import { z as z6 } from "zod";
|
|
298
|
-
var storefrontProductSchema = z6.object({
|
|
299
|
-
id: z6.string(),
|
|
300
|
-
name: z6.string(),
|
|
301
|
-
tagline: z6.string(),
|
|
302
|
-
iconUrl: z6.string().nullable(),
|
|
303
|
-
owned: z6.boolean(),
|
|
304
|
-
currentVersion: z6.string().optional(),
|
|
305
|
-
downloads: downloadSchema.array().optional(),
|
|
306
|
-
defaultVariation: pricingVariationSchema.optional(),
|
|
307
|
-
variations: pricingVariationSchema.array().optional(),
|
|
308
|
-
type: z6.void().transform(() => "product").pipe(z6.literal("product"))
|
|
309
|
-
});
|
|
310
|
-
var storefrontBundleSchema = z6.object({
|
|
311
|
-
id: z6.string(),
|
|
312
|
-
name: z6.string(),
|
|
313
|
-
tagline: z6.string(),
|
|
314
|
-
iconUrl: z6.string().nullable(),
|
|
315
|
-
owned: z6.boolean(),
|
|
316
|
-
partial: z6.boolean(),
|
|
317
|
-
products: storefrontProductSchema.and(z6.object({
|
|
318
|
-
included: z6.boolean()
|
|
319
|
-
})).array(),
|
|
320
|
-
defaultVariation: pricingVariationSchema.optional(),
|
|
321
|
-
variations: pricingVariationSchema.array().optional(),
|
|
322
|
-
type: z6.void().transform(() => "bundle").pipe(z6.literal("bundle"))
|
|
323
|
-
});
|
|
324
|
-
var storefrontSchema = z6.object({
|
|
325
|
-
suggestedCurrency: z6.string(),
|
|
326
|
-
products: storefrontProductSchema.array(),
|
|
327
|
-
bundles: storefrontBundleSchema.array()
|
|
328
|
-
});
|
|
384
|
+
import { z as z9 } from "zod";
|
|
329
385
|
|
|
330
386
|
// src/orders/models.ts
|
|
331
387
|
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
@@ -339,65 +395,65 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
339
395
|
})(OrderStatus || {});
|
|
340
396
|
|
|
341
397
|
// src/orders/schemas.ts
|
|
342
|
-
var couponSchema =
|
|
343
|
-
code:
|
|
344
|
-
name:
|
|
345
|
-
description:
|
|
398
|
+
var couponSchema = z9.object({
|
|
399
|
+
code: z9.string(),
|
|
400
|
+
name: z9.string(),
|
|
401
|
+
description: z9.string()
|
|
346
402
|
});
|
|
347
|
-
var percentageOffDiscountSchema2 =
|
|
348
|
-
type:
|
|
349
|
-
name:
|
|
350
|
-
description:
|
|
351
|
-
percentage:
|
|
403
|
+
var percentageOffDiscountSchema2 = z9.object({
|
|
404
|
+
type: z9.literal("PercentageOffDiscount"),
|
|
405
|
+
name: z9.string(),
|
|
406
|
+
description: z9.string().optional(),
|
|
407
|
+
percentage: z9.number(),
|
|
352
408
|
total: priceCollectionSchema.optional(),
|
|
353
|
-
isExclusive:
|
|
409
|
+
isExclusive: z9.boolean()
|
|
354
410
|
});
|
|
355
|
-
var flatAmountOffDiscountSchema2 =
|
|
356
|
-
type:
|
|
357
|
-
name:
|
|
358
|
-
description:
|
|
411
|
+
var flatAmountOffDiscountSchema2 = z9.object({
|
|
412
|
+
type: z9.literal("FlatAmountOffDiscount"),
|
|
413
|
+
name: z9.string(),
|
|
414
|
+
description: z9.string().optional(),
|
|
359
415
|
total: priceCollectionSchema.optional(),
|
|
360
|
-
isExclusive:
|
|
416
|
+
isExclusive: z9.boolean()
|
|
361
417
|
});
|
|
362
|
-
var discountSchema2 =
|
|
418
|
+
var discountSchema2 = z9.discriminatedUnion("type", [
|
|
363
419
|
percentageOffDiscountSchema2,
|
|
364
420
|
flatAmountOffDiscountSchema2
|
|
365
421
|
]);
|
|
366
|
-
var openProductLineItem =
|
|
367
|
-
id:
|
|
368
|
-
type:
|
|
369
|
-
productId:
|
|
370
|
-
quantity:
|
|
371
|
-
variationId:
|
|
422
|
+
var openProductLineItem = z9.object({
|
|
423
|
+
id: z9.string(),
|
|
424
|
+
type: z9.literal("Product"),
|
|
425
|
+
productId: z9.string(),
|
|
426
|
+
quantity: z9.number(),
|
|
427
|
+
variationId: z9.string(),
|
|
372
428
|
price: priceCollectionSchema.optional(),
|
|
373
429
|
variation: pricingVariationSchema.optional(),
|
|
374
430
|
product: storefrontProductSchema.optional(),
|
|
375
431
|
appliedDiscount: discountSchema2.optional()
|
|
376
432
|
});
|
|
377
|
-
var openBundleLineItem =
|
|
378
|
-
id:
|
|
379
|
-
type:
|
|
380
|
-
bundleId:
|
|
381
|
-
quantity:
|
|
382
|
-
variationId:
|
|
433
|
+
var openBundleLineItem = z9.object({
|
|
434
|
+
id: z9.string(),
|
|
435
|
+
type: z9.literal("Bundle"),
|
|
436
|
+
bundleId: z9.string(),
|
|
437
|
+
quantity: z9.number(),
|
|
438
|
+
variationId: z9.string(),
|
|
383
439
|
price: priceCollectionSchema.optional(),
|
|
384
440
|
variation: pricingVariationSchema.optional(),
|
|
385
441
|
bundle: storefrontBundleSchema.optional(),
|
|
386
442
|
appliedDiscount: discountSchema2.optional()
|
|
387
443
|
});
|
|
388
|
-
var openOrderLineItem =
|
|
444
|
+
var openOrderLineItem = z9.discriminatedUnion("type", [
|
|
389
445
|
openProductLineItem,
|
|
390
446
|
openBundleLineItem
|
|
391
447
|
]);
|
|
392
|
-
var openOrderSchema =
|
|
393
|
-
id:
|
|
394
|
-
status:
|
|
395
|
-
currency:
|
|
448
|
+
var openOrderSchema = z9.object({
|
|
449
|
+
id: z9.string(),
|
|
450
|
+
status: z9.literal("Open" /* Open */),
|
|
451
|
+
currency: z9.string(),
|
|
396
452
|
items: openOrderLineItem.array(),
|
|
397
453
|
couponsApplied: couponSchema.array(),
|
|
398
|
-
checkoutUrl:
|
|
454
|
+
checkoutUrl: z9.string().optional()
|
|
399
455
|
});
|
|
400
|
-
var orderSchema =
|
|
456
|
+
var orderSchema = z9.discriminatedUnion("status", [
|
|
401
457
|
openOrderSchema
|
|
402
458
|
]);
|
|
403
459
|
|
|
@@ -585,13 +641,13 @@ _TokenStore.storageKey = "moonbase_auth";
|
|
|
585
641
|
var TokenStore = _TokenStore;
|
|
586
642
|
|
|
587
643
|
// src/vouchers/schemas.ts
|
|
588
|
-
import { z as
|
|
589
|
-
var voucherSchema =
|
|
590
|
-
id:
|
|
591
|
-
name:
|
|
592
|
-
description:
|
|
593
|
-
code:
|
|
594
|
-
redeemed:
|
|
644
|
+
import { z as z10 } from "zod";
|
|
645
|
+
var voucherSchema = z10.object({
|
|
646
|
+
id: z10.string(),
|
|
647
|
+
name: z10.string(),
|
|
648
|
+
description: z10.string(),
|
|
649
|
+
code: z10.string(),
|
|
650
|
+
redeemed: z10.boolean(),
|
|
595
651
|
redeemsProducts: quantifiable(storefrontProductSchema).array(),
|
|
596
652
|
redeemsBundles: quantifiable(storefrontBundleSchema).array()
|
|
597
653
|
});
|
|
@@ -626,11 +682,13 @@ var MoonbaseClient = class {
|
|
|
626
682
|
this.vouchers = new VoucherEndpoints(api);
|
|
627
683
|
this.orders = new OrderEndpoints(api);
|
|
628
684
|
this.licenses = new LicenseEndpoints(api);
|
|
685
|
+
this.activationRequests = new ActivationRequestEndpoints(api);
|
|
629
686
|
this.products = new ProductEndpoints(api);
|
|
630
687
|
}
|
|
631
688
|
};
|
|
632
689
|
export {
|
|
633
690
|
ActivationMethod,
|
|
691
|
+
ActivationRequestStatus,
|
|
634
692
|
ActivationStatus,
|
|
635
693
|
LicenseStatus,
|
|
636
694
|
MoonbaseClient,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/storefront-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.85",
|
|
5
5
|
"description": "Package to let you build storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|