@moonbase.sh/storefront-api 0.2.108 → 0.2.112

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
@@ -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
+ ActivationRequestFulfillmentType: () => ActivationRequestFulfillmentType,
34
35
  ActivationRequestStatus: () => ActivationRequestStatus,
35
36
  ActivationStatus: () => ActivationStatus,
36
37
  LicenseStatus: () => LicenseStatus,
@@ -184,6 +185,11 @@ var storefrontSchema = import_zod3.z.object({
184
185
  });
185
186
 
186
187
  // src/activationRequests/models.ts
188
+ var ActivationRequestFulfillmentType = /* @__PURE__ */ ((ActivationRequestFulfillmentType2) => {
189
+ ActivationRequestFulfillmentType2["License"] = "License";
190
+ ActivationRequestFulfillmentType2["Trial"] = "Trial";
191
+ return ActivationRequestFulfillmentType2;
192
+ })(ActivationRequestFulfillmentType || {});
187
193
  var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
188
194
  ActivationRequestStatus2["Requested"] = "Requested";
189
195
  ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
@@ -197,6 +203,7 @@ var activationRequestSchema = import_zod4.z.object({
197
203
  id: import_zod4.z.string(),
198
204
  status: import_zod4.z.nativeEnum(ActivationRequestStatus),
199
205
  product: storefrontProductSchema,
206
+ fulfillmentType: import_zod4.z.nativeEnum(ActivationRequestFulfillmentType).optional(),
200
207
  trialEligibility: import_zod4.z.object({
201
208
  eligible: import_zod4.z.boolean(),
202
209
  existing: import_zod4.z.boolean(),
@@ -239,9 +246,6 @@ var ActivationRequestEndpoints = class {
239
246
  // src/identity/endpoints.ts
240
247
  var import_cross_fetch = __toESM(require("cross-fetch"), 1);
241
248
 
242
- // src/utils/problemHandler.ts
243
- var import_zod6 = require("zod");
244
-
245
249
  // src/utils/errors.ts
246
250
  var NotAuthorizedError = class extends Error {
247
251
  constructor() {
@@ -281,6 +285,7 @@ var MoonbaseError = class extends Error {
281
285
  };
282
286
 
283
287
  // src/utils/problemHandler.ts
288
+ var import_zod6 = require("zod");
284
289
  var problemDetailsSchema = import_zod6.z.object({
285
290
  type: import_zod6.z.string(),
286
291
  title: import_zod6.z.string(),
@@ -381,7 +386,7 @@ var IdentityEndpoints = class {
381
386
  const data = await response.json();
382
387
  const user = identityUserSchema.parse(data);
383
388
  this.tokenStore.setUser(user);
384
- return user;
389
+ return userSchema.parse(user);
385
390
  } catch (err) {
386
391
  console.warn("Could not sign in user", { email, response, err });
387
392
  throw new MoonbaseError("Bad response", "Could not sign in user", response.status);
@@ -400,7 +405,7 @@ var IdentityEndpoints = class {
400
405
  }
401
406
  });
402
407
  this.tokenStore.setUser(response.data);
403
- return response.data;
408
+ return userSchema.parse(response.data);
404
409
  }
405
410
  async update(name, email, emailConfirmationToken, communicationPreferences) {
406
411
  const response = await this.api.authenticatedFetch("/api/customer/identity", null, {
@@ -991,6 +996,7 @@ var MoonbaseClient = class {
991
996
  // Annotate the CommonJS export names for ESM import in node:
992
997
  0 && (module.exports = {
993
998
  ActivationMethod,
999
+ ActivationRequestFulfillmentType,
994
1000
  ActivationRequestStatus,
995
1001
  ActivationStatus,
996
1002
  LicenseStatus,
package/dist/index.d.cts CHANGED
@@ -612,6 +612,7 @@ declare const activationRequestSchema: z.ZodObject<{
612
612
  } | undefined;
613
613
  }[] | undefined;
614
614
  }>;
615
+ fulfillmentType: z.ZodOptional<z.ZodNativeEnum<typeof ActivationRequestFulfillmentType>>;
615
616
  trialEligibility: z.ZodOptional<z.ZodObject<{
616
617
  eligible: z.ZodBoolean;
617
618
  existing: z.ZodBoolean;
@@ -708,6 +709,7 @@ declare const activationRequestSchema: z.ZodObject<{
708
709
  } | undefined;
709
710
  }[] | undefined;
710
711
  };
712
+ fulfillmentType?: ActivationRequestFulfillmentType | undefined;
711
713
  trialEligibility?: {
712
714
  eligible: boolean;
713
715
  existing: boolean;
@@ -788,6 +790,7 @@ declare const activationRequestSchema: z.ZodObject<{
788
790
  } | undefined;
789
791
  }[] | undefined;
790
792
  };
793
+ fulfillmentType?: ActivationRequestFulfillmentType | undefined;
791
794
  trialEligibility?: {
792
795
  eligible: boolean;
793
796
  existing: boolean;
@@ -800,6 +803,10 @@ declare const activationRequestSchema: z.ZodObject<{
800
803
  } | undefined;
801
804
  }>;
802
805
 
806
+ declare enum ActivationRequestFulfillmentType {
807
+ License = "License",
808
+ Trial = "Trial"
809
+ }
803
810
  declare enum ActivationRequestStatus {
804
811
  Requested = "Requested",
805
812
  Fulfilled = "Fulfilled",
@@ -11557,4 +11564,4 @@ declare class MoonbaseClient {
11557
11564
  orders: OrderEndpoints;
11558
11565
  }
11559
11566
 
11560
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, type Discount, type Download, type DownloadManifest, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, schemas, utmToObject };
11567
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, type Discount, type Download, type DownloadManifest, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, schemas, utmToObject };
package/dist/index.d.ts CHANGED
@@ -612,6 +612,7 @@ declare const activationRequestSchema: z.ZodObject<{
612
612
  } | undefined;
613
613
  }[] | undefined;
614
614
  }>;
615
+ fulfillmentType: z.ZodOptional<z.ZodNativeEnum<typeof ActivationRequestFulfillmentType>>;
615
616
  trialEligibility: z.ZodOptional<z.ZodObject<{
616
617
  eligible: z.ZodBoolean;
617
618
  existing: z.ZodBoolean;
@@ -708,6 +709,7 @@ declare const activationRequestSchema: z.ZodObject<{
708
709
  } | undefined;
709
710
  }[] | undefined;
710
711
  };
712
+ fulfillmentType?: ActivationRequestFulfillmentType | undefined;
711
713
  trialEligibility?: {
712
714
  eligible: boolean;
713
715
  existing: boolean;
@@ -788,6 +790,7 @@ declare const activationRequestSchema: z.ZodObject<{
788
790
  } | undefined;
789
791
  }[] | undefined;
790
792
  };
793
+ fulfillmentType?: ActivationRequestFulfillmentType | undefined;
791
794
  trialEligibility?: {
792
795
  eligible: boolean;
793
796
  existing: boolean;
@@ -800,6 +803,10 @@ declare const activationRequestSchema: z.ZodObject<{
800
803
  } | undefined;
801
804
  }>;
802
805
 
806
+ declare enum ActivationRequestFulfillmentType {
807
+ License = "License",
808
+ Trial = "Trial"
809
+ }
803
810
  declare enum ActivationRequestStatus {
804
811
  Requested = "Requested",
805
812
  Fulfilled = "Fulfilled",
@@ -11557,4 +11564,4 @@ declare class MoonbaseClient {
11557
11564
  orders: OrderEndpoints;
11558
11565
  }
11559
11566
 
11560
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, type Discount, type Download, type DownloadManifest, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, schemas, utmToObject };
11567
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, type Discount, type Download, type DownloadManifest, type License, LicenseStatus, type LineItem, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingVariation, type ProductLineItem, type Quantifiable, type Storefront, type StorefrontBundle, type StorefrontProduct, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, schemas, utmToObject };
package/dist/index.js CHANGED
@@ -142,6 +142,11 @@ var storefrontSchema = z3.object({
142
142
  });
143
143
 
144
144
  // src/activationRequests/models.ts
145
+ var ActivationRequestFulfillmentType = /* @__PURE__ */ ((ActivationRequestFulfillmentType2) => {
146
+ ActivationRequestFulfillmentType2["License"] = "License";
147
+ ActivationRequestFulfillmentType2["Trial"] = "Trial";
148
+ return ActivationRequestFulfillmentType2;
149
+ })(ActivationRequestFulfillmentType || {});
145
150
  var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
146
151
  ActivationRequestStatus2["Requested"] = "Requested";
147
152
  ActivationRequestStatus2["Fulfilled"] = "Fulfilled";
@@ -155,6 +160,7 @@ var activationRequestSchema = z4.object({
155
160
  id: z4.string(),
156
161
  status: z4.nativeEnum(ActivationRequestStatus),
157
162
  product: storefrontProductSchema,
163
+ fulfillmentType: z4.nativeEnum(ActivationRequestFulfillmentType).optional(),
158
164
  trialEligibility: z4.object({
159
165
  eligible: z4.boolean(),
160
166
  existing: z4.boolean(),
@@ -197,9 +203,6 @@ var ActivationRequestEndpoints = class {
197
203
  // src/identity/endpoints.ts
198
204
  import fetch from "cross-fetch";
199
205
 
200
- // src/utils/problemHandler.ts
201
- import { z as z6 } from "zod";
202
-
203
206
  // src/utils/errors.ts
204
207
  var NotAuthorizedError = class extends Error {
205
208
  constructor() {
@@ -239,6 +242,7 @@ var MoonbaseError = class extends Error {
239
242
  };
240
243
 
241
244
  // src/utils/problemHandler.ts
245
+ import { z as z6 } from "zod";
242
246
  var problemDetailsSchema = z6.object({
243
247
  type: z6.string(),
244
248
  title: z6.string(),
@@ -339,7 +343,7 @@ var IdentityEndpoints = class {
339
343
  const data = await response.json();
340
344
  const user = identityUserSchema.parse(data);
341
345
  this.tokenStore.setUser(user);
342
- return user;
346
+ return userSchema.parse(user);
343
347
  } catch (err) {
344
348
  console.warn("Could not sign in user", { email, response, err });
345
349
  throw new MoonbaseError("Bad response", "Could not sign in user", response.status);
@@ -358,7 +362,7 @@ var IdentityEndpoints = class {
358
362
  }
359
363
  });
360
364
  this.tokenStore.setUser(response.data);
361
- return response.data;
365
+ return userSchema.parse(response.data);
362
366
  }
363
367
  async update(name, email, emailConfirmationToken, communicationPreferences) {
364
368
  const response = await this.api.authenticatedFetch("/api/customer/identity", null, {
@@ -948,6 +952,7 @@ var MoonbaseClient = class {
948
952
  };
949
953
  export {
950
954
  ActivationMethod,
955
+ ActivationRequestFulfillmentType,
951
956
  ActivationRequestStatus,
952
957
  ActivationStatus,
953
958
  LicenseStatus,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "0.2.108",
4
+ "version": "0.2.112",
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",