@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.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ActivationMethod: () => ActivationMethod,
|
|
34
|
+
ActivationRequestStatus: () => ActivationRequestStatus,
|
|
34
35
|
ActivationStatus: () => ActivationStatus,
|
|
35
36
|
LicenseStatus: () => LicenseStatus,
|
|
36
37
|
MoonbaseClient: () => MoonbaseClient,
|
|
@@ -42,11 +43,179 @@ __export(src_exports, {
|
|
|
42
43
|
});
|
|
43
44
|
module.exports = __toCommonJS(src_exports);
|
|
44
45
|
|
|
46
|
+
// src/activationsRequests/endpoints.ts
|
|
47
|
+
var import_zod5 = require("zod");
|
|
48
|
+
|
|
49
|
+
// src/activationsRequests/schemas.ts
|
|
50
|
+
var import_zod4 = require("zod");
|
|
51
|
+
|
|
52
|
+
// src/storefront/schemas.ts
|
|
53
|
+
var import_zod3 = require("zod");
|
|
54
|
+
|
|
55
|
+
// src/globalSchemas.ts
|
|
56
|
+
var import_zod = require("zod");
|
|
57
|
+
var priceCollectionSchema = import_zod.z.record(import_zod.z.number());
|
|
58
|
+
var percentageOffDiscountSchema = import_zod.z.object({
|
|
59
|
+
type: import_zod.z.literal("PercentageOffDiscount"),
|
|
60
|
+
name: import_zod.z.string(),
|
|
61
|
+
description: import_zod.z.string().optional(),
|
|
62
|
+
percentage: import_zod.z.number(),
|
|
63
|
+
total: priceCollectionSchema
|
|
64
|
+
});
|
|
65
|
+
var flatAmountOffDiscountSchema = import_zod.z.object({
|
|
66
|
+
type: import_zod.z.literal("FlatAmountOffDiscount"),
|
|
67
|
+
name: import_zod.z.string(),
|
|
68
|
+
description: import_zod.z.string().optional(),
|
|
69
|
+
total: priceCollectionSchema
|
|
70
|
+
});
|
|
71
|
+
var discountSchema = import_zod.z.discriminatedUnion("type", [
|
|
72
|
+
percentageOffDiscountSchema,
|
|
73
|
+
flatAmountOffDiscountSchema
|
|
74
|
+
]);
|
|
75
|
+
var pricingVariationSchema = import_zod.z.object({
|
|
76
|
+
id: import_zod.z.string(),
|
|
77
|
+
name: import_zod.z.string(),
|
|
78
|
+
originalPrice: priceCollectionSchema,
|
|
79
|
+
price: priceCollectionSchema,
|
|
80
|
+
hasDiscount: import_zod.z.boolean(),
|
|
81
|
+
discount: discountSchema.optional()
|
|
82
|
+
});
|
|
83
|
+
function paged(itemSchema) {
|
|
84
|
+
return import_zod.z.object({
|
|
85
|
+
items: import_zod.z.array(itemSchema),
|
|
86
|
+
hasMore: import_zod.z.boolean(),
|
|
87
|
+
next: import_zod.z.string().nullable()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function quantifiable(itemSchema) {
|
|
91
|
+
return import_zod.z.object({
|
|
92
|
+
value: itemSchema,
|
|
93
|
+
quantity: import_zod.z.number()
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/products/schemas.ts
|
|
98
|
+
var import_zod2 = require("zod");
|
|
99
|
+
|
|
100
|
+
// src/products/models.ts
|
|
101
|
+
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
102
|
+
Platform2["Universal"] = "Universal";
|
|
103
|
+
Platform2["Windows"] = "Windows";
|
|
104
|
+
Platform2["Linux"] = "Linux";
|
|
105
|
+
Platform2["Mac"] = "Mac";
|
|
106
|
+
return Platform2;
|
|
107
|
+
})(Platform || {});
|
|
108
|
+
|
|
109
|
+
// src/products/schemas.ts
|
|
110
|
+
var downloadSchema = import_zod2.z.object({
|
|
111
|
+
name: import_zod2.z.string(),
|
|
112
|
+
key: import_zod2.z.string(),
|
|
113
|
+
platform: import_zod2.z.nativeEnum(Platform),
|
|
114
|
+
size: import_zod2.z.number(),
|
|
115
|
+
path: import_zod2.z.string().nullable()
|
|
116
|
+
});
|
|
117
|
+
var productSummarySchema = import_zod2.z.object({
|
|
118
|
+
id: import_zod2.z.string(),
|
|
119
|
+
name: import_zod2.z.string(),
|
|
120
|
+
tagline: import_zod2.z.string(),
|
|
121
|
+
website: import_zod2.z.string().optional(),
|
|
122
|
+
iconUrl: import_zod2.z.string().optional(),
|
|
123
|
+
numberOfLicenses: import_zod2.z.number().optional(),
|
|
124
|
+
numberOfTrials: import_zod2.z.number().optional(),
|
|
125
|
+
currentActivations: import_zod2.z.number().optional(),
|
|
126
|
+
maxActivations: import_zod2.z.number().optional(),
|
|
127
|
+
currentVersion: import_zod2.z.string().nullable(),
|
|
128
|
+
downloadsNeedsUser: import_zod2.z.boolean(),
|
|
129
|
+
downloadsNeedsOwnership: import_zod2.z.boolean(),
|
|
130
|
+
downloads: import_zod2.z.array(downloadSchema).optional()
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/storefront/schemas.ts
|
|
134
|
+
var storefrontProductSchema = import_zod3.z.object({
|
|
135
|
+
id: import_zod3.z.string(),
|
|
136
|
+
name: import_zod3.z.string(),
|
|
137
|
+
tagline: import_zod3.z.string(),
|
|
138
|
+
iconUrl: import_zod3.z.string().nullable(),
|
|
139
|
+
owned: import_zod3.z.boolean(),
|
|
140
|
+
currentVersion: import_zod3.z.string().optional(),
|
|
141
|
+
downloads: downloadSchema.array().optional(),
|
|
142
|
+
defaultVariation: pricingVariationSchema.optional(),
|
|
143
|
+
variations: pricingVariationSchema.array().optional(),
|
|
144
|
+
type: import_zod3.z.void().transform(() => "product").pipe(import_zod3.z.literal("product"))
|
|
145
|
+
});
|
|
146
|
+
var storefrontBundleSchema = import_zod3.z.object({
|
|
147
|
+
id: import_zod3.z.string(),
|
|
148
|
+
name: import_zod3.z.string(),
|
|
149
|
+
tagline: import_zod3.z.string(),
|
|
150
|
+
iconUrl: import_zod3.z.string().nullable(),
|
|
151
|
+
owned: import_zod3.z.boolean(),
|
|
152
|
+
partial: import_zod3.z.boolean(),
|
|
153
|
+
products: storefrontProductSchema.and(import_zod3.z.object({
|
|
154
|
+
included: import_zod3.z.boolean()
|
|
155
|
+
})).array(),
|
|
156
|
+
defaultVariation: pricingVariationSchema.optional(),
|
|
157
|
+
variations: pricingVariationSchema.array().optional(),
|
|
158
|
+
type: import_zod3.z.void().transform(() => "bundle").pipe(import_zod3.z.literal("bundle"))
|
|
159
|
+
});
|
|
160
|
+
var storefrontSchema = import_zod3.z.object({
|
|
161
|
+
suggestedCurrency: import_zod3.z.string(),
|
|
162
|
+
products: storefrontProductSchema.array(),
|
|
163
|
+
bundles: storefrontBundleSchema.array()
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// src/activationsRequests/models.ts
|
|
167
|
+
var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
|
|
168
|
+
ActivationRequestStatus2["Requested"] = "Requested";
|
|
169
|
+
ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
|
|
170
|
+
ActivationRequestStatus2["Completed"] = "Completed";
|
|
171
|
+
return ActivationRequestStatus2;
|
|
172
|
+
})(ActivationRequestStatus || {});
|
|
173
|
+
|
|
174
|
+
// src/activationsRequests/schemas.ts
|
|
175
|
+
var activationRequestSchema = import_zod4.z.object({
|
|
176
|
+
id: import_zod4.z.string(),
|
|
177
|
+
status: import_zod4.z.nativeEnum(ActivationRequestStatus),
|
|
178
|
+
product: storefrontProductSchema,
|
|
179
|
+
trialEligibility: import_zod4.z.object({
|
|
180
|
+
eligible: import_zod4.z.boolean(),
|
|
181
|
+
existing: import_zod4.z.boolean(),
|
|
182
|
+
requiresAccount: import_zod4.z.boolean(),
|
|
183
|
+
numberOfDaysPerProduct: import_zod4.z.number(),
|
|
184
|
+
numberOfDaysRemaining: import_zod4.z.number()
|
|
185
|
+
}).optional(),
|
|
186
|
+
licenseEligibility: import_zod4.z.object({
|
|
187
|
+
eligible: import_zod4.z.boolean()
|
|
188
|
+
}).optional()
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// src/activationsRequests/endpoints.ts
|
|
192
|
+
var ActivationRequestEndpoints = class {
|
|
193
|
+
constructor(api) {
|
|
194
|
+
this.api = api;
|
|
195
|
+
}
|
|
196
|
+
async get(requestId) {
|
|
197
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}`);
|
|
198
|
+
return activationRequestSchema.parse(response);
|
|
199
|
+
}
|
|
200
|
+
async isCompleted(requestId) {
|
|
201
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}/completed`);
|
|
202
|
+
return import_zod5.z.boolean().parse(response.data);
|
|
203
|
+
}
|
|
204
|
+
async fulfillLicense(requestId) {
|
|
205
|
+
const response = await this.api.authenticatedFetch(`/api/customer/activations/${requestId}/license`, "POST");
|
|
206
|
+
return activationRequestSchema.parse(response.data);
|
|
207
|
+
}
|
|
208
|
+
async fulfillTrial(requestId) {
|
|
209
|
+
const response = await this.api.fetch(`/api/customer/activations/${requestId}/trial`, "POST");
|
|
210
|
+
return activationRequestSchema.parse(response.data);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
45
214
|
// src/identity/endpoints.ts
|
|
46
215
|
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
47
216
|
|
|
48
217
|
// src/utils/problemHandler.ts
|
|
49
|
-
var
|
|
218
|
+
var import_zod6 = require("zod");
|
|
50
219
|
|
|
51
220
|
// src/utils/errors.ts
|
|
52
221
|
var NotAuthorizedError = class extends Error {
|
|
@@ -69,11 +238,11 @@ var NotFoundError = class extends Error {
|
|
|
69
238
|
};
|
|
70
239
|
|
|
71
240
|
// src/utils/problemHandler.ts
|
|
72
|
-
var problemDetailsSchema =
|
|
73
|
-
type:
|
|
74
|
-
title:
|
|
75
|
-
detail:
|
|
76
|
-
status:
|
|
241
|
+
var problemDetailsSchema = import_zod6.z.object({
|
|
242
|
+
type: import_zod6.z.string(),
|
|
243
|
+
title: import_zod6.z.string(),
|
|
244
|
+
detail: import_zod6.z.string().optional(),
|
|
245
|
+
status: import_zod6.z.number()
|
|
77
246
|
});
|
|
78
247
|
async function handleResponseProblem(response) {
|
|
79
248
|
if (response.status === 404)
|
|
@@ -97,30 +266,30 @@ async function handleResponseProblem(response) {
|
|
|
97
266
|
}
|
|
98
267
|
|
|
99
268
|
// src/identity/schemas.ts
|
|
100
|
-
var
|
|
101
|
-
var addressSchema =
|
|
102
|
-
countryCode:
|
|
103
|
-
streetAddress1:
|
|
104
|
-
streetAddress2:
|
|
105
|
-
locality:
|
|
106
|
-
region:
|
|
107
|
-
postCode:
|
|
269
|
+
var import_zod7 = require("zod");
|
|
270
|
+
var addressSchema = import_zod7.z.object({
|
|
271
|
+
countryCode: import_zod7.z.string(),
|
|
272
|
+
streetAddress1: import_zod7.z.string(),
|
|
273
|
+
streetAddress2: import_zod7.z.string().nullable(),
|
|
274
|
+
locality: import_zod7.z.string().nullable(),
|
|
275
|
+
region: import_zod7.z.string().nullable(),
|
|
276
|
+
postCode: import_zod7.z.string()
|
|
108
277
|
});
|
|
109
|
-
var communicationPreferencesSchema =
|
|
110
|
-
newsletterOptIn:
|
|
278
|
+
var communicationPreferencesSchema = import_zod7.z.object({
|
|
279
|
+
newsletterOptIn: import_zod7.z.boolean()
|
|
111
280
|
// productUpdatesOptIn: z.boolean(), // TODO: Enable when relevant
|
|
112
281
|
});
|
|
113
|
-
var userSchema =
|
|
114
|
-
id:
|
|
115
|
-
email:
|
|
116
|
-
name:
|
|
117
|
-
tenantId:
|
|
282
|
+
var userSchema = import_zod7.z.object({
|
|
283
|
+
id: import_zod7.z.string(),
|
|
284
|
+
email: import_zod7.z.string(),
|
|
285
|
+
name: import_zod7.z.string(),
|
|
286
|
+
tenantId: import_zod7.z.string(),
|
|
118
287
|
address: addressSchema.optional(),
|
|
119
288
|
communicationPreferences: communicationPreferencesSchema
|
|
120
289
|
});
|
|
121
|
-
var identityUserSchema = userSchema.and(
|
|
122
|
-
accessToken:
|
|
123
|
-
refreshToken:
|
|
290
|
+
var identityUserSchema = userSchema.and(import_zod7.z.object({
|
|
291
|
+
accessToken: import_zod7.z.string(),
|
|
292
|
+
refreshToken: import_zod7.z.string()
|
|
124
293
|
}));
|
|
125
294
|
|
|
126
295
|
// src/identity/endpoints.ts
|
|
@@ -198,86 +367,8 @@ var IdentityEndpoints = class {
|
|
|
198
367
|
}
|
|
199
368
|
};
|
|
200
369
|
|
|
201
|
-
// src/globalSchemas.ts
|
|
202
|
-
var import_zod3 = require("zod");
|
|
203
|
-
var priceCollectionSchema = import_zod3.z.record(import_zod3.z.number());
|
|
204
|
-
var percentageOffDiscountSchema = import_zod3.z.object({
|
|
205
|
-
type: import_zod3.z.literal("PercentageOffDiscount"),
|
|
206
|
-
name: import_zod3.z.string(),
|
|
207
|
-
description: import_zod3.z.string().optional(),
|
|
208
|
-
percentage: import_zod3.z.number(),
|
|
209
|
-
total: priceCollectionSchema
|
|
210
|
-
});
|
|
211
|
-
var flatAmountOffDiscountSchema = import_zod3.z.object({
|
|
212
|
-
type: import_zod3.z.literal("FlatAmountOffDiscount"),
|
|
213
|
-
name: import_zod3.z.string(),
|
|
214
|
-
description: import_zod3.z.string().optional(),
|
|
215
|
-
total: priceCollectionSchema
|
|
216
|
-
});
|
|
217
|
-
var discountSchema = import_zod3.z.discriminatedUnion("type", [
|
|
218
|
-
percentageOffDiscountSchema,
|
|
219
|
-
flatAmountOffDiscountSchema
|
|
220
|
-
]);
|
|
221
|
-
var pricingVariationSchema = import_zod3.z.object({
|
|
222
|
-
id: import_zod3.z.string(),
|
|
223
|
-
name: import_zod3.z.string(),
|
|
224
|
-
originalPrice: priceCollectionSchema,
|
|
225
|
-
price: priceCollectionSchema,
|
|
226
|
-
hasDiscount: import_zod3.z.boolean(),
|
|
227
|
-
discount: discountSchema.optional()
|
|
228
|
-
});
|
|
229
|
-
function paged(itemSchema) {
|
|
230
|
-
return import_zod3.z.object({
|
|
231
|
-
items: import_zod3.z.array(itemSchema),
|
|
232
|
-
hasMore: import_zod3.z.boolean(),
|
|
233
|
-
next: import_zod3.z.string().nullable()
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function quantifiable(itemSchema) {
|
|
237
|
-
return import_zod3.z.object({
|
|
238
|
-
value: itemSchema,
|
|
239
|
-
quantity: import_zod3.z.number()
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
|
|
243
370
|
// src/licenses/schemas.ts
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
// src/products/schemas.ts
|
|
247
|
-
var import_zod4 = require("zod");
|
|
248
|
-
|
|
249
|
-
// src/products/models.ts
|
|
250
|
-
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
251
|
-
Platform2["Universal"] = "Universal";
|
|
252
|
-
Platform2["Windows"] = "Windows";
|
|
253
|
-
Platform2["Linux"] = "Linux";
|
|
254
|
-
Platform2["Mac"] = "Mac";
|
|
255
|
-
return Platform2;
|
|
256
|
-
})(Platform || {});
|
|
257
|
-
|
|
258
|
-
// src/products/schemas.ts
|
|
259
|
-
var downloadSchema = import_zod4.z.object({
|
|
260
|
-
name: import_zod4.z.string(),
|
|
261
|
-
key: import_zod4.z.string(),
|
|
262
|
-
platform: import_zod4.z.nativeEnum(Platform),
|
|
263
|
-
size: import_zod4.z.number(),
|
|
264
|
-
path: import_zod4.z.string().nullable()
|
|
265
|
-
});
|
|
266
|
-
var productSummarySchema = import_zod4.z.object({
|
|
267
|
-
id: import_zod4.z.string(),
|
|
268
|
-
name: import_zod4.z.string(),
|
|
269
|
-
tagline: import_zod4.z.string(),
|
|
270
|
-
website: import_zod4.z.string().optional(),
|
|
271
|
-
iconUrl: import_zod4.z.string().optional(),
|
|
272
|
-
numberOfLicenses: import_zod4.z.number().optional(),
|
|
273
|
-
numberOfTrials: import_zod4.z.number().optional(),
|
|
274
|
-
currentActivations: import_zod4.z.number().optional(),
|
|
275
|
-
maxActivations: import_zod4.z.number().optional(),
|
|
276
|
-
currentVersion: import_zod4.z.string().nullable(),
|
|
277
|
-
downloadsNeedsUser: import_zod4.z.boolean(),
|
|
278
|
-
downloadsNeedsOwnership: import_zod4.z.boolean(),
|
|
279
|
-
downloads: import_zod4.z.array(downloadSchema).optional()
|
|
280
|
-
});
|
|
371
|
+
var import_zod8 = require("zod");
|
|
281
372
|
|
|
282
373
|
// src/licenses/models.ts
|
|
283
374
|
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
@@ -297,21 +388,21 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
|
297
388
|
})(ActivationMethod || {});
|
|
298
389
|
|
|
299
390
|
// src/licenses/schemas.ts
|
|
300
|
-
var licenseSchema =
|
|
301
|
-
id:
|
|
302
|
-
status:
|
|
391
|
+
var licenseSchema = import_zod8.z.object({
|
|
392
|
+
id: import_zod8.z.string(),
|
|
393
|
+
status: import_zod8.z.nativeEnum(LicenseStatus),
|
|
303
394
|
product: productSummarySchema.optional(),
|
|
304
|
-
activeNumberOfActivations:
|
|
305
|
-
maxNumberOfActivations:
|
|
306
|
-
createdAt:
|
|
395
|
+
activeNumberOfActivations: import_zod8.z.number(),
|
|
396
|
+
maxNumberOfActivations: import_zod8.z.number(),
|
|
397
|
+
createdAt: import_zod8.z.coerce.date()
|
|
307
398
|
});
|
|
308
|
-
var activationSchema =
|
|
309
|
-
id:
|
|
310
|
-
licenseId:
|
|
311
|
-
name:
|
|
312
|
-
status:
|
|
313
|
-
activationMethod:
|
|
314
|
-
lastValidatedAt:
|
|
399
|
+
var activationSchema = import_zod8.z.object({
|
|
400
|
+
id: import_zod8.z.string(),
|
|
401
|
+
licenseId: import_zod8.z.string(),
|
|
402
|
+
name: import_zod8.z.string(),
|
|
403
|
+
status: import_zod8.z.nativeEnum(ActivationStatus),
|
|
404
|
+
activationMethod: import_zod8.z.nativeEnum(ActivationMethod),
|
|
405
|
+
lastValidatedAt: import_zod8.z.coerce.date().nullable()
|
|
315
406
|
});
|
|
316
407
|
|
|
317
408
|
// src/licenses/endpoints.ts
|
|
@@ -335,41 +426,7 @@ var LicenseEndpoints = class {
|
|
|
335
426
|
};
|
|
336
427
|
|
|
337
428
|
// src/orders/schemas.ts
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
// src/storefront/schemas.ts
|
|
341
|
-
var import_zod6 = require("zod");
|
|
342
|
-
var storefrontProductSchema = import_zod6.z.object({
|
|
343
|
-
id: import_zod6.z.string(),
|
|
344
|
-
name: import_zod6.z.string(),
|
|
345
|
-
tagline: import_zod6.z.string(),
|
|
346
|
-
iconUrl: import_zod6.z.string().nullable(),
|
|
347
|
-
owned: import_zod6.z.boolean(),
|
|
348
|
-
currentVersion: import_zod6.z.string().optional(),
|
|
349
|
-
downloads: downloadSchema.array().optional(),
|
|
350
|
-
defaultVariation: pricingVariationSchema.optional(),
|
|
351
|
-
variations: pricingVariationSchema.array().optional(),
|
|
352
|
-
type: import_zod6.z.void().transform(() => "product").pipe(import_zod6.z.literal("product"))
|
|
353
|
-
});
|
|
354
|
-
var storefrontBundleSchema = import_zod6.z.object({
|
|
355
|
-
id: import_zod6.z.string(),
|
|
356
|
-
name: import_zod6.z.string(),
|
|
357
|
-
tagline: import_zod6.z.string(),
|
|
358
|
-
iconUrl: import_zod6.z.string().nullable(),
|
|
359
|
-
owned: import_zod6.z.boolean(),
|
|
360
|
-
partial: import_zod6.z.boolean(),
|
|
361
|
-
products: storefrontProductSchema.and(import_zod6.z.object({
|
|
362
|
-
included: import_zod6.z.boolean()
|
|
363
|
-
})).array(),
|
|
364
|
-
defaultVariation: pricingVariationSchema.optional(),
|
|
365
|
-
variations: pricingVariationSchema.array().optional(),
|
|
366
|
-
type: import_zod6.z.void().transform(() => "bundle").pipe(import_zod6.z.literal("bundle"))
|
|
367
|
-
});
|
|
368
|
-
var storefrontSchema = import_zod6.z.object({
|
|
369
|
-
suggestedCurrency: import_zod6.z.string(),
|
|
370
|
-
products: storefrontProductSchema.array(),
|
|
371
|
-
bundles: storefrontBundleSchema.array()
|
|
372
|
-
});
|
|
429
|
+
var import_zod9 = require("zod");
|
|
373
430
|
|
|
374
431
|
// src/orders/models.ts
|
|
375
432
|
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
@@ -383,65 +440,65 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
383
440
|
})(OrderStatus || {});
|
|
384
441
|
|
|
385
442
|
// src/orders/schemas.ts
|
|
386
|
-
var couponSchema =
|
|
387
|
-
code:
|
|
388
|
-
name:
|
|
389
|
-
description:
|
|
443
|
+
var couponSchema = import_zod9.z.object({
|
|
444
|
+
code: import_zod9.z.string(),
|
|
445
|
+
name: import_zod9.z.string(),
|
|
446
|
+
description: import_zod9.z.string()
|
|
390
447
|
});
|
|
391
|
-
var percentageOffDiscountSchema2 =
|
|
392
|
-
type:
|
|
393
|
-
name:
|
|
394
|
-
description:
|
|
395
|
-
percentage:
|
|
448
|
+
var percentageOffDiscountSchema2 = import_zod9.z.object({
|
|
449
|
+
type: import_zod9.z.literal("PercentageOffDiscount"),
|
|
450
|
+
name: import_zod9.z.string(),
|
|
451
|
+
description: import_zod9.z.string().optional(),
|
|
452
|
+
percentage: import_zod9.z.number(),
|
|
396
453
|
total: priceCollectionSchema.optional(),
|
|
397
|
-
isExclusive:
|
|
454
|
+
isExclusive: import_zod9.z.boolean()
|
|
398
455
|
});
|
|
399
|
-
var flatAmountOffDiscountSchema2 =
|
|
400
|
-
type:
|
|
401
|
-
name:
|
|
402
|
-
description:
|
|
456
|
+
var flatAmountOffDiscountSchema2 = import_zod9.z.object({
|
|
457
|
+
type: import_zod9.z.literal("FlatAmountOffDiscount"),
|
|
458
|
+
name: import_zod9.z.string(),
|
|
459
|
+
description: import_zod9.z.string().optional(),
|
|
403
460
|
total: priceCollectionSchema.optional(),
|
|
404
|
-
isExclusive:
|
|
461
|
+
isExclusive: import_zod9.z.boolean()
|
|
405
462
|
});
|
|
406
|
-
var discountSchema2 =
|
|
463
|
+
var discountSchema2 = import_zod9.z.discriminatedUnion("type", [
|
|
407
464
|
percentageOffDiscountSchema2,
|
|
408
465
|
flatAmountOffDiscountSchema2
|
|
409
466
|
]);
|
|
410
|
-
var openProductLineItem =
|
|
411
|
-
id:
|
|
412
|
-
type:
|
|
413
|
-
productId:
|
|
414
|
-
quantity:
|
|
415
|
-
variationId:
|
|
467
|
+
var openProductLineItem = import_zod9.z.object({
|
|
468
|
+
id: import_zod9.z.string(),
|
|
469
|
+
type: import_zod9.z.literal("Product"),
|
|
470
|
+
productId: import_zod9.z.string(),
|
|
471
|
+
quantity: import_zod9.z.number(),
|
|
472
|
+
variationId: import_zod9.z.string(),
|
|
416
473
|
price: priceCollectionSchema.optional(),
|
|
417
474
|
variation: pricingVariationSchema.optional(),
|
|
418
475
|
product: storefrontProductSchema.optional(),
|
|
419
476
|
appliedDiscount: discountSchema2.optional()
|
|
420
477
|
});
|
|
421
|
-
var openBundleLineItem =
|
|
422
|
-
id:
|
|
423
|
-
type:
|
|
424
|
-
bundleId:
|
|
425
|
-
quantity:
|
|
426
|
-
variationId:
|
|
478
|
+
var openBundleLineItem = import_zod9.z.object({
|
|
479
|
+
id: import_zod9.z.string(),
|
|
480
|
+
type: import_zod9.z.literal("Bundle"),
|
|
481
|
+
bundleId: import_zod9.z.string(),
|
|
482
|
+
quantity: import_zod9.z.number(),
|
|
483
|
+
variationId: import_zod9.z.string(),
|
|
427
484
|
price: priceCollectionSchema.optional(),
|
|
428
485
|
variation: pricingVariationSchema.optional(),
|
|
429
486
|
bundle: storefrontBundleSchema.optional(),
|
|
430
487
|
appliedDiscount: discountSchema2.optional()
|
|
431
488
|
});
|
|
432
|
-
var openOrderLineItem =
|
|
489
|
+
var openOrderLineItem = import_zod9.z.discriminatedUnion("type", [
|
|
433
490
|
openProductLineItem,
|
|
434
491
|
openBundleLineItem
|
|
435
492
|
]);
|
|
436
|
-
var openOrderSchema =
|
|
437
|
-
id:
|
|
438
|
-
status:
|
|
439
|
-
currency:
|
|
493
|
+
var openOrderSchema = import_zod9.z.object({
|
|
494
|
+
id: import_zod9.z.string(),
|
|
495
|
+
status: import_zod9.z.literal("Open" /* Open */),
|
|
496
|
+
currency: import_zod9.z.string(),
|
|
440
497
|
items: openOrderLineItem.array(),
|
|
441
498
|
couponsApplied: couponSchema.array(),
|
|
442
|
-
checkoutUrl:
|
|
499
|
+
checkoutUrl: import_zod9.z.string().optional()
|
|
443
500
|
});
|
|
444
|
-
var orderSchema =
|
|
501
|
+
var orderSchema = import_zod9.z.discriminatedUnion("status", [
|
|
445
502
|
openOrderSchema
|
|
446
503
|
]);
|
|
447
504
|
|
|
@@ -629,13 +686,13 @@ _TokenStore.storageKey = "moonbase_auth";
|
|
|
629
686
|
var TokenStore = _TokenStore;
|
|
630
687
|
|
|
631
688
|
// src/vouchers/schemas.ts
|
|
632
|
-
var
|
|
633
|
-
var voucherSchema =
|
|
634
|
-
id:
|
|
635
|
-
name:
|
|
636
|
-
description:
|
|
637
|
-
code:
|
|
638
|
-
redeemed:
|
|
689
|
+
var import_zod10 = require("zod");
|
|
690
|
+
var voucherSchema = import_zod10.z.object({
|
|
691
|
+
id: import_zod10.z.string(),
|
|
692
|
+
name: import_zod10.z.string(),
|
|
693
|
+
description: import_zod10.z.string(),
|
|
694
|
+
code: import_zod10.z.string(),
|
|
695
|
+
redeemed: import_zod10.z.boolean(),
|
|
639
696
|
redeemsProducts: quantifiable(storefrontProductSchema).array(),
|
|
640
697
|
redeemsBundles: quantifiable(storefrontBundleSchema).array()
|
|
641
698
|
});
|
|
@@ -670,12 +727,14 @@ var MoonbaseClient = class {
|
|
|
670
727
|
this.vouchers = new VoucherEndpoints(api);
|
|
671
728
|
this.orders = new OrderEndpoints(api);
|
|
672
729
|
this.licenses = new LicenseEndpoints(api);
|
|
730
|
+
this.activationRequests = new ActivationRequestEndpoints(api);
|
|
673
731
|
this.products = new ProductEndpoints(api);
|
|
674
732
|
}
|
|
675
733
|
};
|
|
676
734
|
// Annotate the CommonJS export names for ESM import in node:
|
|
677
735
|
0 && (module.exports = {
|
|
678
736
|
ActivationMethod,
|
|
737
|
+
ActivationRequestStatus,
|
|
679
738
|
ActivationStatus,
|
|
680
739
|
LicenseStatus,
|
|
681
740
|
MoonbaseClient,
|