@moonbase.sh/storefront-api 3.9.0 → 3.10.0

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
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  OrderStatus: () => OrderStatus,
49
49
  PasswordSetupRequiredError: () => PasswordSetupRequiredError,
50
50
  Platform: () => Platform,
51
+ ReleaseNotCoveredError: () => ReleaseNotCoveredError,
51
52
  StoreClosedError: () => StoreClosedError,
52
53
  SubscriptionCancellationReason: () => SubscriptionCancellationReason,
53
54
  SubscriptionStatus: () => SubscriptionStatus,
@@ -85,6 +86,7 @@ __export(schemas_exports2, {
85
86
  offerConditionSchema: () => offerConditionSchema,
86
87
  offerScopeSchema: () => offerScopeSchema,
87
88
  storefrontBundleSchema: () => storefrontBundleSchema,
89
+ storefrontLicenseUpgradeSchema: () => storefrontLicenseUpgradeSchema,
88
90
  storefrontOfferSchema: () => storefrontOfferSchema,
89
91
  storefrontOfferTargetSchema: () => storefrontOfferTargetSchema,
90
92
  storefrontProductSchema: () => storefrontProductSchema,
@@ -219,6 +221,7 @@ var schemas_exports = {};
219
221
  __export(schemas_exports, {
220
222
  downloadSchema: () => downloadSchema,
221
223
  manifestSchema: () => manifestSchema,
224
+ productReleaseAccessSchema: () => productReleaseAccessSchema,
222
225
  productReleaseSchema: () => productReleaseSchema,
223
226
  productSummarySchema: () => productSummarySchema
224
227
  });
@@ -261,6 +264,21 @@ var downloadSchema = import_zod2.z.object({
261
264
  path: import_zod2.z.string().nullable(),
262
265
  manifest: manifestSchema.optional()
263
266
  });
267
+ var productReleaseAccessSchema = import_zod2.z.object({
268
+ // Releases published until then are covered, and every version while it has not passed.
269
+ updatesUntil: import_zod2.z.coerce.date().nullish().catch(void 0),
270
+ // Every version whose major is at most this is covered.
271
+ upToMajor: import_zod2.z.number().nullish().catch(void 0),
272
+ // Once updates have ended, the last version published before they did.
273
+ upToVersion: import_zod2.z.string().nullish().catch(void 0),
274
+ // Whether the release this was resolved for (the one shown) is covered. Read as covered when
275
+ // unreadable, so a garbled answer never locks a download the API would hand out.
276
+ coversRelease: import_zod2.z.boolean().catch(true),
277
+ // The newest published version the customer may download, when the shown one is not covered.
278
+ latestCoveredVersion: import_zod2.z.string().nullish().catch(void 0),
279
+ // Where to buy the upgrade or renewal, while the product sells one.
280
+ upgradeUrl: import_zod2.z.string().nullish().catch(void 0)
281
+ });
264
282
  var productSummarySchema = import_zod2.z.object({
265
283
  id: import_zod2.z.string(),
266
284
  name: import_zod2.z.string(),
@@ -284,7 +302,10 @@ var productSummarySchema = import_zod2.z.object({
284
302
  // Whether this caller clears every requirement above, including the group membership the client
285
303
  // can't see for itself. False with none of them set means the merchant closed the release to everyone.
286
304
  downloadsAllowed: import_zod2.z.boolean(),
287
- downloads: import_zod2.z.array(downloadSchema).optional()
305
+ downloads: import_zod2.z.array(downloadSchema).optional(),
306
+ // Set only when the customer's licenses do not cover every release. `downloadsAllowed` already
307
+ // accounts for it; this says why a download is locked and where to upgrade.
308
+ releaseAccess: productReleaseAccessSchema.nullish().catch(void 0)
288
309
  });
289
310
  var productReleaseSchema = import_zod2.z.object({
290
311
  version: import_zod2.z.string(),
@@ -294,10 +315,33 @@ var productReleaseSchema = import_zod2.z.object({
294
315
  // merchant can keep past releases to owners while the current one is open to anyone.
295
316
  downloadsAllowed: import_zod2.z.boolean(),
296
317
  downloads: import_zod2.z.array(downloadSchema),
297
- properties: import_zod2.z.record(rawPropertyValueSchema).nullish()
318
+ properties: import_zod2.z.record(rawPropertyValueSchema).nullish(),
319
+ // True when the caller owns the product but none of their licenses covers this release, so it
320
+ // takes an upgrade rather than a sign-in to unlock. Absent otherwise.
321
+ releaseNotCovered: import_zod2.z.boolean().nullish().catch(void 0)
298
322
  });
299
323
 
300
324
  // src/storefront/schemas.ts
325
+ var storefrontLicenseUpgradeSchema = import_zod3.z.object({
326
+ // The customer's licenses this entry prices. An entry without them is no use and is left out.
327
+ licenseIds: import_zod3.z.string().array(),
328
+ // What those licenses cover now, which is how a cart tells the customer which of their licenses an
329
+ // upgrade is for. Read leniently, field by field: a backend that predates it leaves it out, and one
330
+ // this version cannot read reads as absent rather than costing the entry.
331
+ releaseAccess: import_zod3.z.object({
332
+ // Releases published until then are covered, and every version while it has not passed.
333
+ updatesUntil: import_zod3.z.coerce.date().nullish().catch(void 0),
334
+ // Every version whose major is at most this is covered.
335
+ upToMajor: import_zod3.z.number().nullish().catch(void 0),
336
+ // Once updates have ended, the last version published before they did.
337
+ upToVersion: import_zod3.z.string().nullish().catch(void 0)
338
+ }).nullish().catch(void 0),
339
+ variations: pricingVariationSchema.array()
340
+ });
341
+ var storefrontLicenseUpgradesSchema = import_zod3.z.array(import_zod3.z.unknown()).transform((upgrades) => upgrades.flatMap((upgrade) => {
342
+ const parsed = storefrontLicenseUpgradeSchema.safeParse(upgrade);
343
+ return parsed.success ? [parsed.data] : [];
344
+ }));
301
345
  var storefrontProductSchema = import_zod3.z.object({
302
346
  id: import_zod3.z.string(),
303
347
  name: import_zod3.z.string(),
@@ -311,7 +355,13 @@ var storefrontProductSchema = import_zod3.z.object({
311
355
  defaultVariation: pricingVariationSchema.optional(),
312
356
  variations: pricingVariationSchema.array().optional(),
313
357
  properties: import_zod3.z.record(rawPropertyValueSchema).nullish(),
314
- type: import_zod3.z.string().optional().default("Product").pipe(import_zod3.z.literal("Product"))
358
+ type: import_zod3.z.string().optional().default("Product").pipe(import_zod3.z.literal("Product")),
359
+ // What upgrading or renewing the signed-in customer's licenses of the product that cover only
360
+ // some releases costs, one entry per group of licenses that cover the same, furthest behind first.
361
+ // Capped, so a customer with a great many licenses may find one in none of them. Absent for anyone
362
+ // else, and from a backend that predates per-license prices. A cart line naming one of these
363
+ // licenses (`targetLicenseId`) is priced from here: see `CartUtils.licenseUpgrade`.
364
+ licenseUpgrades: storefrontLicenseUpgradesSchema.nullish().catch(void 0)
315
365
  });
316
366
  var storefrontBundleSchema = import_zod3.z.object({
317
367
  id: import_zod3.z.string(),
@@ -485,7 +535,17 @@ var activationRequestSchema = import_zod4.z.object({
485
535
  endless: import_zod4.z.boolean().default(false)
486
536
  }).optional(),
487
537
  licenseEligibility: import_zod4.z.object({
488
- eligible: import_zod4.z.boolean()
538
+ eligible: import_zod4.z.boolean(),
539
+ // Set when the customer's licenses would take the device but none of them covers the version
540
+ // the app runs (`eligible` is then false), so the app's version needs an upgrade. Absent from
541
+ // a backend that predates release access, and read leniently so it can never fail the request.
542
+ releaseNotCovered: import_zod4.z.object({
543
+ appVersion: import_zod4.z.string().nullish().catch(void 0),
544
+ updatesUntil: import_zod4.z.coerce.date().nullish().catch(void 0),
545
+ upToMajor: import_zod4.z.number().nullish().catch(void 0),
546
+ upToVersion: import_zod4.z.string().nullish().catch(void 0),
547
+ upgradeUrl: import_zod4.z.string().nullish().catch(void 0)
548
+ }).nullish().catch(void 0)
489
549
  }).optional()
490
550
  });
491
551
 
@@ -564,7 +624,8 @@ var CommunicationsEndpoints = class {
564
624
  newsletter: (_b = input.newsletter) != null ? _b : true,
565
625
  productUpdates: (_c = input.productUpdates) != null ? _c : true,
566
626
  groupIds: normalizeGroupIds(input.groupIds)
567
- }
627
+ },
628
+ headers: input.captchaToken ? { "X-MB-CAPTCHA": input.captchaToken } : void 0
568
629
  });
569
630
  return response.data;
570
631
  }
@@ -644,6 +705,15 @@ var NotAuthorizedError = class extends Error {
644
705
  this.message = "Not allowed";
645
706
  }
646
707
  };
708
+ var ReleaseNotCoveredError = class extends NotAuthorizedError {
709
+ constructor(releaseAccess, upgradeUrl, detail) {
710
+ super();
711
+ this.releaseAccess = releaseAccess;
712
+ this.upgradeUrl = upgradeUrl;
713
+ this.name = "ReleaseNotCoveredError";
714
+ this.message = detail != null ? detail : "Your license doesn't cover this version";
715
+ }
716
+ };
647
717
  var NotAuthenticatedError = class extends Error {
648
718
  constructor() {
649
719
  super();
@@ -693,6 +763,9 @@ var PasswordSetupRequiredError = class extends MoonbaseError {
693
763
  }
694
764
  };
695
765
 
766
+ // src/utils/problemHandler.ts
767
+ var import_zod8 = require("zod");
768
+
696
769
  // src/utils/problemDetails.ts
697
770
  var import_zod7 = require("zod");
698
771
  var problemDetailsSchema = import_zod7.z.object({
@@ -706,6 +779,28 @@ var problemDetailsSchema = import_zod7.z.object({
706
779
  });
707
780
 
708
781
  // src/utils/problemHandler.ts
782
+ var releaseNotCoveredProblemSchema = import_zod8.z.object({
783
+ errorType: import_zod8.z.literal("ReleaseNotCovered"),
784
+ detail: import_zod8.z.string().nullish().catch(void 0),
785
+ releaseAccess: productReleaseAccessSchema.nullish().catch(void 0),
786
+ upgradeUrl: import_zod8.z.string().nullish().catch(void 0)
787
+ });
788
+ async function forbiddenError(response) {
789
+ var _a;
790
+ try {
791
+ const problem = releaseNotCoveredProblemSchema.safeParse(JSON.parse(await response.text()));
792
+ if (problem.success) {
793
+ const { releaseAccess, upgradeUrl, detail } = problem.data;
794
+ return new ReleaseNotCoveredError(
795
+ releaseAccess != null ? releaseAccess : void 0,
796
+ (_a = upgradeUrl != null ? upgradeUrl : releaseAccess == null ? void 0 : releaseAccess.upgradeUrl) != null ? _a : void 0,
797
+ detail != null ? detail : void 0
798
+ );
799
+ }
800
+ } catch (e) {
801
+ }
802
+ return new NotAuthorizedError();
803
+ }
709
804
  function camelCase(str) {
710
805
  return str.split(".").map((word, index) => {
711
806
  let [firstLetter, ...restOfLetters] = word;
@@ -722,7 +817,7 @@ async function handleResponseProblem(response, logger) {
722
817
  throw new NotAuthenticatedError();
723
818
  }
724
819
  if (response.status === 403) {
725
- throw new NotAuthorizedError();
820
+ throw await forbiddenError(response);
726
821
  }
727
822
  let problemDetails;
728
823
  const body = await response.text();
@@ -762,7 +857,7 @@ __export(schemas_exports5, {
762
857
  userAccountConfirmedStatusSchema: () => userAccountConfirmedStatusSchema,
763
858
  userSchema: () => userSchema
764
859
  });
765
- var import_zod8 = require("zod");
860
+ var import_zod9 = require("zod");
766
861
 
767
862
  // src/identity/models.ts
768
863
  var ConnectableAccountProvider = /* @__PURE__ */ ((ConnectableAccountProvider2) => {
@@ -771,69 +866,69 @@ var ConnectableAccountProvider = /* @__PURE__ */ ((ConnectableAccountProvider2)
771
866
  })(ConnectableAccountProvider || {});
772
867
 
773
868
  // src/identity/schemas.ts
774
- var addressSchema = import_zod8.z.object({
775
- countryCode: import_zod8.z.string(),
776
- streetAddress1: import_zod8.z.string(),
777
- streetAddress2: import_zod8.z.string().nullable(),
778
- locality: import_zod8.z.string().nullable(),
779
- region: import_zod8.z.string().nullable(),
780
- postCode: import_zod8.z.string().nullable()
781
- });
782
- var communicationPreferencesSchema = import_zod8.z.object({
783
- newsletterOptIn: import_zod8.z.boolean(),
869
+ var addressSchema = import_zod9.z.object({
870
+ countryCode: import_zod9.z.string(),
871
+ streetAddress1: import_zod9.z.string(),
872
+ streetAddress2: import_zod9.z.string().nullable(),
873
+ locality: import_zod9.z.string().nullable(),
874
+ region: import_zod9.z.string().nullable(),
875
+ postCode: import_zod9.z.string().nullable()
876
+ });
877
+ var communicationPreferencesSchema = import_zod9.z.object({
878
+ newsletterOptIn: import_zod9.z.boolean(),
784
879
  // Default keeps older persisted identities (pre productUpdatesOptIn) parseable
785
880
  // during boot. The server-side value is hydrated by updateUser() right after.
786
- productUpdatesOptIn: import_zod8.z.boolean().default(false)
881
+ productUpdatesOptIn: import_zod9.z.boolean().default(false)
787
882
  });
788
- var ilokConnectedAccountSchema = import_zod8.z.object({
789
- provider: import_zod8.z.literal("iLok" /* iLok */),
790
- isConnected: import_zod8.z.boolean(),
791
- pendingLicenseFulfillments: import_zod8.z.boolean(),
792
- accountId: import_zod8.z.string().nullish()
883
+ var ilokConnectedAccountSchema = import_zod9.z.object({
884
+ provider: import_zod9.z.literal("iLok" /* iLok */),
885
+ isConnected: import_zod9.z.boolean(),
886
+ pendingLicenseFulfillments: import_zod9.z.boolean(),
887
+ accountId: import_zod9.z.string().nullish()
793
888
  });
794
- var connectedAccountSchema = import_zod8.z.discriminatedUnion("provider", [
889
+ var connectedAccountSchema = import_zod9.z.discriminatedUnion("provider", [
795
890
  ilokConnectedAccountSchema
796
891
  ]);
797
- var connectionUrlSchema = import_zod8.z.object({
798
- url: import_zod8.z.string()
892
+ var connectionUrlSchema = import_zod9.z.object({
893
+ url: import_zod9.z.string()
799
894
  });
800
- var userSchema = import_zod8.z.object({
801
- id: import_zod8.z.string(),
802
- email: import_zod8.z.string(),
895
+ var userSchema = import_zod9.z.object({
896
+ id: import_zod9.z.string(),
897
+ email: import_zod9.z.string(),
803
898
  // Nullable: customers created via import may have no name.
804
- name: import_zod8.z.string().nullable(),
805
- tenantId: import_zod8.z.string(),
899
+ name: import_zod9.z.string().nullable(),
900
+ tenantId: import_zod9.z.string(),
806
901
  address: addressSchema.optional(),
807
- phone: import_zod8.z.string().optional(),
902
+ phone: import_zod9.z.string().optional(),
808
903
  communicationPreferences: communicationPreferencesSchema,
809
- ownedProducts: import_zod8.z.string().array().optional(),
810
- subscribedProducts: import_zod8.z.string().array().optional(),
811
- confirmedAccount: import_zod8.z.boolean().optional(),
812
- hasProducts: import_zod8.z.boolean().nullish(),
813
- hasSubscriptions: import_zod8.z.boolean().nullish(),
814
- connectedAccounts: import_zod8.z.array(connectedAccountSchema).default([])
815
- });
816
- var identitySchema = userSchema.and(import_zod8.z.object({
817
- accessToken: import_zod8.z.string(),
818
- refreshToken: import_zod8.z.string()
904
+ ownedProducts: import_zod9.z.string().array().optional(),
905
+ subscribedProducts: import_zod9.z.string().array().optional(),
906
+ confirmedAccount: import_zod9.z.boolean().optional(),
907
+ hasProducts: import_zod9.z.boolean().nullish(),
908
+ hasSubscriptions: import_zod9.z.boolean().nullish(),
909
+ connectedAccounts: import_zod9.z.array(connectedAccountSchema).default([])
910
+ });
911
+ var identitySchema = userSchema.and(import_zod9.z.object({
912
+ accessToken: import_zod9.z.string(),
913
+ refreshToken: import_zod9.z.string()
819
914
  }));
820
- var userAccountConfirmedStatusSchema = import_zod8.z.enum([
915
+ var userAccountConfirmedStatusSchema = import_zod9.z.enum([
821
916
  "PasswordSetupRequired",
822
917
  "SignedIn"
823
918
  ]);
824
- var userAccountConfirmedSchema = userSchema.and(import_zod8.z.object({
919
+ var userAccountConfirmedSchema = userSchema.and(import_zod9.z.object({
825
920
  status: userAccountConfirmedStatusSchema,
826
- resetPasswordToken: import_zod8.z.string().nullish(),
827
- accessToken: import_zod8.z.string().nullish(),
828
- refreshToken: import_zod8.z.string().nullish()
921
+ resetPasswordToken: import_zod9.z.string().nullish(),
922
+ accessToken: import_zod9.z.string().nullish(),
923
+ refreshToken: import_zod9.z.string().nullish()
829
924
  }));
830
- var pendingActivationSchema = import_zod8.z.object({
831
- status: import_zod8.z.literal("activation_pending"),
832
- email: import_zod8.z.string()
925
+ var pendingActivationSchema = import_zod9.z.object({
926
+ status: import_zod9.z.literal("activation_pending"),
927
+ email: import_zod9.z.string()
833
928
  });
834
- var pendingPasswordProblemSchema = import_zod8.z.object({
835
- errorType: import_zod8.z.literal("PasswordSetupRequired"),
836
- pendingPasswordToken: import_zod8.z.string()
929
+ var pendingPasswordProblemSchema = import_zod9.z.object({
930
+ errorType: import_zod9.z.literal("PasswordSetupRequired"),
931
+ pendingPasswordToken: import_zod9.z.string()
837
932
  });
838
933
 
839
934
  // src/identity/endpoints.ts
@@ -1029,16 +1124,17 @@ var IdentityEndpoints = class {
1029
1124
  };
1030
1125
 
1031
1126
  // src/inventory/activation/endpoints.ts
1032
- var import_zod10 = require("zod");
1127
+ var import_zod11 = require("zod");
1033
1128
 
1034
1129
  // src/inventory/licenses/schemas.ts
1035
1130
  var schemas_exports6 = {};
1036
1131
  __export(schemas_exports6, {
1037
1132
  activationSchema: () => activationSchema,
1038
1133
  externalLicenseContent: () => externalLicenseContent,
1134
+ licenseReleaseAccessSchema: () => licenseReleaseAccessSchema,
1039
1135
  licenseSchema: () => licenseSchema
1040
1136
  });
1041
- var import_zod9 = require("zod");
1137
+ var import_zod10 = require("zod");
1042
1138
 
1043
1139
  // src/inventory/licenses/models.ts
1044
1140
  var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
@@ -1059,43 +1155,57 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
1059
1155
  })(ActivationMethod || {});
1060
1156
 
1061
1157
  // src/inventory/licenses/schemas.ts
1062
- var externalLicenseFileContent = import_zod9.z.object({
1063
- type: import_zod9.z.literal("file"),
1064
- fileName: import_zod9.z.string(),
1065
- contentType: import_zod9.z.string(),
1066
- data: import_zod9.z.string()
1067
- });
1068
- var externalLicenseILokContent = import_zod9.z.object({
1069
- type: import_zod9.z.literal("iLok")
1070
- });
1071
- var externalLicenseContent = import_zod9.z.union([
1072
- import_zod9.z.string(),
1073
- import_zod9.z.discriminatedUnion("type", [
1158
+ var externalLicenseFileContent = import_zod10.z.object({
1159
+ type: import_zod10.z.literal("file"),
1160
+ fileName: import_zod10.z.string(),
1161
+ contentType: import_zod10.z.string(),
1162
+ data: import_zod10.z.string()
1163
+ });
1164
+ var externalLicenseILokContent = import_zod10.z.object({
1165
+ type: import_zod10.z.literal("iLok")
1166
+ });
1167
+ var externalLicenseContent = import_zod10.z.union([
1168
+ import_zod10.z.string(),
1169
+ import_zod10.z.discriminatedUnion("type", [
1074
1170
  externalLicenseFileContent,
1075
1171
  externalLicenseILokContent
1076
1172
  ])
1077
1173
  ]);
1078
- var licenseSchema = import_zod9.z.object({
1079
- id: import_zod9.z.string(),
1080
- status: import_zod9.z.nativeEnum(LicenseStatus),
1174
+ var licenseReleaseAccessSchema = import_zod10.z.object({
1175
+ // Releases published until then are covered, and every version while it has not passed.
1176
+ updatesUntil: import_zod10.z.coerce.date().nullish().catch(void 0),
1177
+ // Every version whose major is at most this is covered.
1178
+ upToMajor: import_zod10.z.number().nullish().catch(void 0),
1179
+ // Once updates have ended, the last version published before they did.
1180
+ upToVersion: import_zod10.z.string().nullish().catch(void 0),
1181
+ // Whether the product's current release is covered, so whether to offer an upgrade. Read as
1182
+ // covered when unreadable, so a garbled answer never pushes an upgrade nobody needs.
1183
+ coversCurrentRelease: import_zod10.z.boolean().catch(true),
1184
+ // Where to buy the upgrade or renewal for this license, while the product sells one.
1185
+ upgradeUrl: import_zod10.z.string().nullish().catch(void 0)
1186
+ });
1187
+ var licenseSchema = import_zod10.z.object({
1188
+ id: import_zod10.z.string(),
1189
+ status: import_zod10.z.nativeEnum(LicenseStatus),
1081
1190
  product: productSummarySchema,
1082
- activeNumberOfActivations: import_zod9.z.number(),
1083
- maxNumberOfActivations: import_zod9.z.number(),
1191
+ activeNumberOfActivations: import_zod10.z.number(),
1192
+ maxNumberOfActivations: import_zod10.z.number(),
1084
1193
  externalFulfillment: externalLicenseContent.optional(),
1085
- requiredConnectedAccount: import_zod9.z.nativeEnum(ConnectableAccountProvider).nullish(),
1086
- fulfillmentMessage: import_zod9.z.string().optional(),
1087
- properties: import_zod9.z.record(rawPropertyValueSchema).nullish(),
1088
- expiresAt: import_zod9.z.coerce.date().optional(),
1089
- createdAt: import_zod9.z.coerce.date()
1090
- });
1091
- var activationSchema = import_zod9.z.object({
1092
- id: import_zod9.z.string(),
1093
- licenseId: import_zod9.z.string(),
1094
- name: import_zod9.z.string(),
1095
- status: import_zod9.z.nativeEnum(ActivationStatus),
1096
- activationMethod: import_zod9.z.nativeEnum(ActivationMethod),
1097
- firstValidatedAt: import_zod9.z.coerce.date(),
1098
- lastValidatedAt: import_zod9.z.coerce.date().nullable()
1194
+ requiredConnectedAccount: import_zod10.z.nativeEnum(ConnectableAccountProvider).nullish(),
1195
+ fulfillmentMessage: import_zod10.z.string().optional(),
1196
+ properties: import_zod10.z.record(rawPropertyValueSchema).nullish(),
1197
+ expiresAt: import_zod10.z.coerce.date().optional(),
1198
+ createdAt: import_zod10.z.coerce.date(),
1199
+ releaseAccess: licenseReleaseAccessSchema.nullish().catch(void 0)
1200
+ });
1201
+ var activationSchema = import_zod10.z.object({
1202
+ id: import_zod10.z.string(),
1203
+ licenseId: import_zod10.z.string(),
1204
+ name: import_zod10.z.string(),
1205
+ status: import_zod10.z.nativeEnum(ActivationStatus),
1206
+ activationMethod: import_zod10.z.nativeEnum(ActivationMethod),
1207
+ firstValidatedAt: import_zod10.z.coerce.date(),
1208
+ lastValidatedAt: import_zod10.z.coerce.date().nullable()
1099
1209
  });
1100
1210
 
1101
1211
  // src/inventory/activation/endpoints.ts
@@ -1112,7 +1222,7 @@ var ActivationEndpoints = class {
1112
1222
  });
1113
1223
  return {
1114
1224
  license: response.data,
1115
- url: import_zod10.z.string().parse(response.headers.location)
1225
+ url: import_zod11.z.string().parse(response.headers.location)
1116
1226
  };
1117
1227
  }
1118
1228
  };
@@ -1140,7 +1250,7 @@ var LicenseEndpoints = class {
1140
1250
  };
1141
1251
 
1142
1252
  // src/inventory/products/endpoints.ts
1143
- var import_zod11 = require("zod");
1253
+ var import_zod12 = require("zod");
1144
1254
  var ProductEndpoints = class {
1145
1255
  constructor(api, configuration) {
1146
1256
  this.api = api;
@@ -1174,18 +1284,18 @@ var ProductEndpoints = class {
1174
1284
  async getDownloadUrl(path) {
1175
1285
  const url = new URL(path);
1176
1286
  url.searchParams.append("redirect", "false");
1177
- const response = await this.api.fetch(url.pathname + url.search, import_zod11.z.object({
1178
- location: import_zod11.z.string()
1287
+ const response = await this.api.fetch(url.pathname + url.search, import_zod12.z.object({
1288
+ location: import_zod12.z.string()
1179
1289
  }));
1180
1290
  return response.data.location;
1181
1291
  }
1182
1292
  };
1183
1293
 
1184
1294
  // src/inventory/subscriptions/endpoints.ts
1185
- var import_zod14 = require("zod");
1295
+ var import_zod15 = require("zod");
1186
1296
 
1187
1297
  // package.json
1188
- var version = "3.9.0";
1298
+ var version = "3.10.0";
1189
1299
 
1190
1300
  // src/utils/client.ts
1191
1301
  function buildClientHeader(sdk) {
@@ -1232,7 +1342,8 @@ var MoonbaseApi = class {
1232
1342
  ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},
1233
1343
  // Force CORS on all calls
1234
1344
  "x-mb-cors": "1",
1235
- "x-mb-client": this.clientHeader
1345
+ "x-mb-client": this.clientHeader,
1346
+ ...options == null ? void 0 : options.headers
1236
1347
  },
1237
1348
  body: (options == null ? void 0 : options.body) ? contentType !== "application/json" ? options.body : JSON.stringify(options.body) : void 0,
1238
1349
  signal: options == null ? void 0 : options.abort,
@@ -1342,7 +1453,7 @@ __export(schemas_exports8, {
1342
1453
  milestoneProgressSchema: () => milestoneProgressSchema,
1343
1454
  subscriptionSchema: () => subscriptionSchema
1344
1455
  });
1345
- var import_zod13 = require("zod");
1456
+ var import_zod14 = require("zod");
1346
1457
 
1347
1458
  // src/orders/schemas.ts
1348
1459
  var schemas_exports7 = {};
@@ -1356,7 +1467,7 @@ __export(schemas_exports7, {
1356
1467
  orderSchema: () => orderSchema,
1357
1468
  orderTotalSchema: () => orderTotalSchema
1358
1469
  });
1359
- var import_zod12 = require("zod");
1470
+ var import_zod13 = require("zod");
1360
1471
 
1361
1472
  // src/orders/models.ts
1362
1473
  var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
@@ -1369,18 +1480,18 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
1369
1480
  })(OrderStatus || {});
1370
1481
 
1371
1482
  // src/orders/schemas.ts
1372
- var couponSchema = import_zod12.z.object({
1373
- code: import_zod12.z.string(),
1374
- name: import_zod12.z.string(),
1375
- description: import_zod12.z.string()
1376
- });
1377
- var lineItemProductSchema = import_zod12.z.object({
1378
- id: import_zod12.z.string(),
1379
- name: import_zod12.z.string(),
1380
- tagline: import_zod12.z.string().nullish(),
1381
- iconUrl: import_zod12.z.string().nullable()
1382
- });
1383
- var lineItemTotalSchema = import_zod12.z.object({
1483
+ var couponSchema = import_zod13.z.object({
1484
+ code: import_zod13.z.string(),
1485
+ name: import_zod13.z.string(),
1486
+ description: import_zod13.z.string()
1487
+ });
1488
+ var lineItemProductSchema = import_zod13.z.object({
1489
+ id: import_zod13.z.string(),
1490
+ name: import_zod13.z.string(),
1491
+ tagline: import_zod13.z.string().nullish(),
1492
+ iconUrl: import_zod13.z.string().nullable()
1493
+ });
1494
+ var lineItemTotalSchema = import_zod13.z.object({
1384
1495
  original: moneySchema,
1385
1496
  discount: moneySchema,
1386
1497
  subtotal: moneySchema,
@@ -1389,52 +1500,59 @@ var lineItemTotalSchema = import_zod12.z.object({
1389
1500
  // for this item. Both are part of `discount`. Absent on orders priced before cart offers existed.
1390
1501
  cartOfferDiscount: moneySchema.optional()
1391
1502
  });
1392
- var openProductLineItem = import_zod12.z.object({
1393
- id: import_zod12.z.string(),
1394
- type: import_zod12.z.literal("Product"),
1395
- productId: import_zod12.z.string(),
1396
- quantity: import_zod12.z.number(),
1397
- variationId: import_zod12.z.string(),
1398
- offerId: import_zod12.z.string().optional(),
1399
- isDefaultVariation: import_zod12.z.boolean().nullish(),
1400
- isSubcriptionPayment: import_zod12.z.boolean().nullish(),
1503
+ var openProductLineItem = import_zod13.z.object({
1504
+ id: import_zod13.z.string(),
1505
+ type: import_zod13.z.literal("Product"),
1506
+ productId: import_zod13.z.string(),
1507
+ quantity: import_zod13.z.number(),
1508
+ variationId: import_zod13.z.string(),
1509
+ offerId: import_zod13.z.string().optional(),
1510
+ isDefaultVariation: import_zod13.z.boolean().nullish(),
1511
+ isSubcriptionPayment: import_zod13.z.boolean().nullish(),
1401
1512
  price: priceCollectionSchema.optional(),
1402
1513
  variation: pricingVariationSchema.optional(),
1403
1514
  total: lineItemTotalSchema.nullish(),
1404
1515
  product: lineItemProductSchema.optional(),
1405
- appliedDiscount: discountSchema.optional()
1406
- });
1407
- var lineItemBundleSchema = import_zod12.z.object({
1408
- id: import_zod12.z.string(),
1409
- name: import_zod12.z.string(),
1410
- tagline: import_zod12.z.string().nullish(),
1411
- iconUrl: import_zod12.z.string().nullable(),
1412
- products: lineItemProductSchema.and(import_zod12.z.object({
1413
- included: import_zod12.z.boolean().optional()
1516
+ appliedDiscount: discountSchema.optional(),
1517
+ // The customer's license this line upgrades or renews, as the cart named it. Such a line is one
1518
+ // license, so its quantity is always 1, and the line's `id` names the license too
1519
+ // (`p/<productId>/<variationId>/<licenseId>`): upgrading two licenses takes two lines. A line
1520
+ // without one issues new licenses. Part of the cart payload like `offerId`, so a push that leaves
1521
+ // it out forgets it. Echoed on completed orders too. Absent from a backend that predates release
1522
+ // access.
1523
+ targetLicenseId: import_zod13.z.string().nullish().catch(void 0)
1524
+ });
1525
+ var lineItemBundleSchema = import_zod13.z.object({
1526
+ id: import_zod13.z.string(),
1527
+ name: import_zod13.z.string(),
1528
+ tagline: import_zod13.z.string().nullish(),
1529
+ iconUrl: import_zod13.z.string().nullable(),
1530
+ products: lineItemProductSchema.and(import_zod13.z.object({
1531
+ included: import_zod13.z.boolean().optional()
1414
1532
  })).array()
1415
1533
  });
1416
- var openBundleLineItem = import_zod12.z.object({
1417
- id: import_zod12.z.string(),
1418
- type: import_zod12.z.literal("Bundle"),
1419
- bundleId: import_zod12.z.string(),
1420
- quantity: import_zod12.z.number(),
1421
- variationId: import_zod12.z.string(),
1422
- offerId: import_zod12.z.string().optional(),
1423
- partial: import_zod12.z.boolean().optional(),
1424
- replaced: import_zod12.z.string().array().optional(),
1425
- isDefaultVariation: import_zod12.z.boolean().nullish(),
1426
- isSubcriptionPayment: import_zod12.z.boolean().nullish(),
1534
+ var openBundleLineItem = import_zod13.z.object({
1535
+ id: import_zod13.z.string(),
1536
+ type: import_zod13.z.literal("Bundle"),
1537
+ bundleId: import_zod13.z.string(),
1538
+ quantity: import_zod13.z.number(),
1539
+ variationId: import_zod13.z.string(),
1540
+ offerId: import_zod13.z.string().optional(),
1541
+ partial: import_zod13.z.boolean().optional(),
1542
+ replaced: import_zod13.z.string().array().optional(),
1543
+ isDefaultVariation: import_zod13.z.boolean().nullish(),
1544
+ isSubcriptionPayment: import_zod13.z.boolean().nullish(),
1427
1545
  price: priceCollectionSchema.optional(),
1428
1546
  variation: pricingVariationSchema.optional(),
1429
1547
  total: lineItemTotalSchema.nullish(),
1430
1548
  bundle: lineItemBundleSchema.optional(),
1431
1549
  appliedDiscount: discountSchema.optional()
1432
1550
  });
1433
- var openOrderLineItem = import_zod12.z.discriminatedUnion("type", [
1551
+ var openOrderLineItem = import_zod13.z.discriminatedUnion("type", [
1434
1552
  openProductLineItem,
1435
1553
  openBundleLineItem
1436
1554
  ]);
1437
- var orderTotalSchema = import_zod12.z.object({
1555
+ var orderTotalSchema = import_zod13.z.object({
1438
1556
  original: moneySchema,
1439
1557
  discount: moneySchema,
1440
1558
  subtotal: moneySchema,
@@ -1444,52 +1562,52 @@ var orderTotalSchema = import_zod12.z.object({
1444
1562
  // rather than a share on every line. Absent when no cart offer applied.
1445
1563
  cartOfferDiscount: moneySchema.optional()
1446
1564
  });
1447
- var openOrderSchema = import_zod12.z.object({
1448
- id: import_zod12.z.string(),
1449
- currency: import_zod12.z.string(),
1565
+ var openOrderSchema = import_zod13.z.object({
1566
+ id: import_zod13.z.string(),
1567
+ currency: import_zod13.z.string(),
1450
1568
  total: orderTotalSchema.nullish(),
1451
1569
  items: openOrderLineItem.array(),
1452
1570
  couponsApplied: couponSchema.array(),
1453
1571
  // The cart offer on the order as a whole: the buyer's intent. It is part of the cart payload, so
1454
1572
  // a content push that leaves it out clears it. The API echoes it back even while the cart sits
1455
1573
  // below the offer's threshold.
1456
- offerId: import_zod12.z.string().optional(),
1574
+ offerId: import_zod13.z.string().optional(),
1457
1575
  // The cart offer as actually applied: the result. Absent while the offer's condition doesn't hold.
1458
1576
  appliedOffer: discountSchema.optional(),
1459
- checkoutUrl: import_zod12.z.string().optional(),
1460
- hostedCheckoutUrl: import_zod12.z.string().optional(),
1461
- embeddedCheckoutUrl: import_zod12.z.string().optional()
1462
- });
1463
- var customerSnapshotSchema = import_zod12.z.object({
1464
- name: import_zod12.z.string().nullable(),
1465
- businessName: import_zod12.z.string().nullable(),
1466
- taxId: import_zod12.z.string().nullable(),
1467
- email: import_zod12.z.string().nullable(),
1468
- phone: import_zod12.z.string().nullable(),
1577
+ checkoutUrl: import_zod13.z.string().optional(),
1578
+ hostedCheckoutUrl: import_zod13.z.string().optional(),
1579
+ embeddedCheckoutUrl: import_zod13.z.string().optional()
1580
+ });
1581
+ var customerSnapshotSchema = import_zod13.z.object({
1582
+ name: import_zod13.z.string().nullable(),
1583
+ businessName: import_zod13.z.string().nullable(),
1584
+ taxId: import_zod13.z.string().nullable(),
1585
+ email: import_zod13.z.string().nullable(),
1586
+ phone: import_zod13.z.string().nullable(),
1469
1587
  address: addressSchema.nullable()
1470
1588
  });
1471
- var completedOrderSchema = import_zod12.z.object({
1472
- id: import_zod12.z.string(),
1473
- status: import_zod12.z.literal("Completed" /* Completed */),
1474
- currency: import_zod12.z.string(),
1589
+ var completedOrderSchema = import_zod13.z.object({
1590
+ id: import_zod13.z.string(),
1591
+ status: import_zod13.z.literal("Completed" /* Completed */),
1592
+ currency: import_zod13.z.string(),
1475
1593
  customer: customerSnapshotSchema,
1476
1594
  total: orderTotalSchema,
1477
1595
  items: openOrderLineItem.array(),
1478
1596
  couponsApplied: couponSchema.array(),
1479
1597
  appliedOffer: discountSchema.optional()
1480
1598
  });
1481
- var orderSchema = import_zod12.z.discriminatedUnion("status", [
1599
+ var orderSchema = import_zod13.z.discriminatedUnion("status", [
1482
1600
  openOrderSchema.extend({
1483
- status: import_zod12.z.literal("Open" /* Open */)
1601
+ status: import_zod13.z.literal("Open" /* Open */)
1484
1602
  }),
1485
1603
  openOrderSchema.extend({
1486
- status: import_zod12.z.literal("PaymentProcessing" /* PaymentProcessing */)
1604
+ status: import_zod13.z.literal("PaymentProcessing" /* PaymentProcessing */)
1487
1605
  }),
1488
1606
  openOrderSchema.extend({
1489
- status: import_zod12.z.literal("Paid" /* Paid */)
1607
+ status: import_zod13.z.literal("Paid" /* Paid */)
1490
1608
  }),
1491
1609
  openOrderSchema.extend({
1492
- status: import_zod12.z.literal("Failed" /* Failed */)
1610
+ status: import_zod13.z.literal("Failed" /* Failed */)
1493
1611
  }),
1494
1612
  completedOrderSchema
1495
1613
  ]);
@@ -1513,58 +1631,58 @@ var SubscriptionCancellationReason = /* @__PURE__ */ ((SubscriptionCancellationR
1513
1631
  })(SubscriptionCancellationReason || {});
1514
1632
 
1515
1633
  // src/inventory/subscriptions/schemas.ts
1516
- var baseMilestoneProgressEventSchema = import_zod13.z.object({
1517
- milestoneId: import_zod13.z.string(),
1518
- fulfilled: import_zod13.z.boolean(),
1519
- afterCycleNumber: import_zod13.z.number(),
1520
- afterNormalizedCycleNumber: import_zod13.z.number(),
1521
- message: import_zod13.z.string().optional()
1522
- });
1523
- var milestoneProgressEventSchema = import_zod13.z.discriminatedUnion("type", [
1634
+ var baseMilestoneProgressEventSchema = import_zod14.z.object({
1635
+ milestoneId: import_zod14.z.string(),
1636
+ fulfilled: import_zod14.z.boolean(),
1637
+ afterCycleNumber: import_zod14.z.number(),
1638
+ afterNormalizedCycleNumber: import_zod14.z.number(),
1639
+ message: import_zod14.z.string().optional()
1640
+ });
1641
+ var milestoneProgressEventSchema = import_zod14.z.discriminatedUnion("type", [
1524
1642
  baseMilestoneProgressEventSchema.extend({
1525
- type: import_zod13.z.literal("CouponCodeMilestone"),
1526
- code: import_zod13.z.string().optional(),
1527
- redeemed: import_zod13.z.boolean().optional()
1643
+ type: import_zod14.z.literal("CouponCodeMilestone"),
1644
+ code: import_zod14.z.string().optional(),
1645
+ redeemed: import_zod14.z.boolean().optional()
1528
1646
  }),
1529
1647
  baseMilestoneProgressEventSchema.extend({
1530
- type: import_zod13.z.literal("PerpetualLicenseConversionMilestone")
1648
+ type: import_zod14.z.literal("PerpetualLicenseConversionMilestone")
1531
1649
  })
1532
1650
  ]);
1533
- var milestoneProgressSchema = import_zod13.z.object({
1534
- title: import_zod13.z.string(),
1535
- description: import_zod13.z.string().nullish(),
1536
- currentCycleNumber: import_zod13.z.number(),
1537
- currentNormalizedCycleNumber: import_zod13.z.number(),
1538
- currentCycleIsCompleted: import_zod13.z.boolean(),
1539
- fromCycleNumber: import_zod13.z.number(),
1540
- fromNormalizedCycleNumber: import_zod13.z.number(),
1541
- toCycleNumber: import_zod13.z.number(),
1542
- toNormalizedCycleNumber: import_zod13.z.number(),
1543
- events: import_zod13.z.record(import_zod13.z.coerce.number(), milestoneProgressEventSchema.array())
1544
- });
1545
- var subscriptionSchema = import_zod13.z.object({
1546
- id: import_zod13.z.string(),
1547
- status: import_zod13.z.nativeEnum(SubscriptionStatus),
1548
- hasPaymentMethod: import_zod13.z.boolean(),
1549
- cancellable: import_zod13.z.boolean(),
1550
- expiresAt: import_zod13.z.coerce.date(),
1551
- renewedAt: import_zod13.z.coerce.date().nullable(),
1552
- nextPaymentScheduledAt: import_zod13.z.coerce.date().nullable(),
1553
- startedAt: import_zod13.z.coerce.date(),
1651
+ var milestoneProgressSchema = import_zod14.z.object({
1652
+ title: import_zod14.z.string(),
1653
+ description: import_zod14.z.string().nullish(),
1654
+ currentCycleNumber: import_zod14.z.number(),
1655
+ currentNormalizedCycleNumber: import_zod14.z.number(),
1656
+ currentCycleIsCompleted: import_zod14.z.boolean(),
1657
+ fromCycleNumber: import_zod14.z.number(),
1658
+ fromNormalizedCycleNumber: import_zod14.z.number(),
1659
+ toCycleNumber: import_zod14.z.number(),
1660
+ toNormalizedCycleNumber: import_zod14.z.number(),
1661
+ events: import_zod14.z.record(import_zod14.z.coerce.number(), milestoneProgressEventSchema.array())
1662
+ });
1663
+ var subscriptionSchema = import_zod14.z.object({
1664
+ id: import_zod14.z.string(),
1665
+ status: import_zod14.z.nativeEnum(SubscriptionStatus),
1666
+ hasPaymentMethod: import_zod14.z.boolean(),
1667
+ cancellable: import_zod14.z.boolean(),
1668
+ expiresAt: import_zod14.z.coerce.date(),
1669
+ renewedAt: import_zod14.z.coerce.date().nullable(),
1670
+ nextPaymentScheduledAt: import_zod14.z.coerce.date().nullable(),
1671
+ startedAt: import_zod14.z.coerce.date(),
1554
1672
  total: orderTotalSchema,
1555
- cycleLength: import_zod13.z.nativeEnum(CycleLength),
1556
- paymentMethod: import_zod13.z.string().optional(),
1673
+ cycleLength: import_zod14.z.nativeEnum(CycleLength),
1674
+ paymentMethod: import_zod14.z.string().optional(),
1557
1675
  milestoneProgress: milestoneProgressSchema.nullish(),
1558
- embeddedUpdatePaymentUrl: import_zod13.z.string().optional(),
1559
- content: import_zod13.z.discriminatedUnion("type", [
1560
- import_zod13.z.object({
1561
- type: import_zod13.z.literal("Product"),
1562
- quantity: import_zod13.z.number(),
1676
+ embeddedUpdatePaymentUrl: import_zod14.z.string().optional(),
1677
+ content: import_zod14.z.discriminatedUnion("type", [
1678
+ import_zod14.z.object({
1679
+ type: import_zod14.z.literal("Product"),
1680
+ quantity: import_zod14.z.number(),
1563
1681
  product: storefrontProductSchema
1564
1682
  }),
1565
- import_zod13.z.object({
1566
- type: import_zod13.z.literal("Bundle"),
1567
- quantity: import_zod13.z.number(),
1683
+ import_zod14.z.object({
1684
+ type: import_zod14.z.literal("Bundle"),
1685
+ quantity: import_zod14.z.number(),
1568
1686
  bundle: storefrontBundleSchema
1569
1687
  })
1570
1688
  ])
@@ -1600,8 +1718,8 @@ var SubscriptionEndpoints = class {
1600
1718
  return response.data;
1601
1719
  }
1602
1720
  async renew(subscriptionId, returnUrl, embedded) {
1603
- const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}/renew?redirect=false&return=${returnUrl}&embedded=${embedded ? "true" : "false"}`, import_zod14.z.object({
1604
- location: import_zod14.z.string()
1721
+ const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}/renew?redirect=false&return=${returnUrl}&embedded=${embedded ? "true" : "false"}`, import_zod15.z.object({
1722
+ location: import_zod15.z.string()
1605
1723
  }), { method: "POST" });
1606
1724
  return response.data;
1607
1725
  }
@@ -2170,21 +2288,21 @@ __export(schemas_exports9, {
2170
2288
  vendorFeaturesSchema: () => vendorFeaturesSchema,
2171
2289
  vendorSchema: () => vendorSchema
2172
2290
  });
2173
- var import_zod15 = require("zod");
2174
- var vendorCaptchaSchema = import_zod15.z.object({
2175
- url: import_zod15.z.string()
2291
+ var import_zod16 = require("zod");
2292
+ var vendorCaptchaSchema = import_zod16.z.object({
2293
+ url: import_zod16.z.string()
2176
2294
  });
2177
- var vendorFeaturesSchema = import_zod15.z.object({
2178
- customerPortal: import_zod15.z.boolean().optional(),
2179
- phoneNumber: import_zod15.z.boolean().optional(),
2180
- marketingConsent: import_zod15.z.nativeEnum(MarketingConsentType).optional().catch(void 0),
2295
+ var vendorFeaturesSchema = import_zod16.z.object({
2296
+ customerPortal: import_zod16.z.boolean().optional(),
2297
+ phoneNumber: import_zod16.z.boolean().optional(),
2298
+ marketingConsent: import_zod16.z.nativeEnum(MarketingConsentType).optional().catch(void 0),
2181
2299
  // Absent on backends from before captchas, which never ask for one.
2182
2300
  captcha: vendorCaptchaSchema.nullish()
2183
2301
  });
2184
- var vendorSchema = import_zod15.z.object({
2185
- id: import_zod15.z.string(),
2186
- name: import_zod15.z.string(),
2187
- logoUrl: import_zod15.z.string().nullable(),
2302
+ var vendorSchema = import_zod16.z.object({
2303
+ id: import_zod16.z.string(),
2304
+ name: import_zod16.z.string(),
2305
+ logoUrl: import_zod16.z.string().nullable(),
2188
2306
  features: vendorFeaturesSchema.optional()
2189
2307
  });
2190
2308
 
@@ -2204,16 +2322,16 @@ var schemas_exports10 = {};
2204
2322
  __export(schemas_exports10, {
2205
2323
  voucherSchema: () => voucherSchema
2206
2324
  });
2207
- var import_zod16 = require("zod");
2208
- var voucherSchema = import_zod16.z.object({
2209
- id: import_zod16.z.string(),
2210
- name: import_zod16.z.string(),
2211
- description: import_zod16.z.string(),
2212
- code: import_zod16.z.string(),
2213
- redeemed: import_zod16.z.boolean(),
2325
+ var import_zod17 = require("zod");
2326
+ var voucherSchema = import_zod17.z.object({
2327
+ id: import_zod17.z.string(),
2328
+ name: import_zod17.z.string(),
2329
+ description: import_zod17.z.string(),
2330
+ code: import_zod17.z.string(),
2331
+ redeemed: import_zod17.z.boolean(),
2214
2332
  redeemsProducts: quantifiable(storefrontProductSchema).array(),
2215
2333
  redeemsBundles: quantifiable(storefrontBundleSchema).array(),
2216
- properties: import_zod16.z.record(rawPropertyValueSchema).nullish()
2334
+ properties: import_zod17.z.record(rawPropertyValueSchema).nullish()
2217
2335
  });
2218
2336
 
2219
2337
  // src/vouchers/endpoints.ts
@@ -2414,11 +2532,48 @@ var OfferUtils = class _OfferUtils {
2414
2532
  // src/utils/cart.ts
2415
2533
  var _CartUtils = class _CartUtils {
2416
2534
  // The pricing variation a line item points at, falling back to the item's default variation when
2417
- // the variation id doesn't resolve, which is what the cart has always displayed.
2535
+ // the variation id doesn't resolve, which is what the cart has always displayed. A line upgrading
2536
+ // one of the customer's licenses is priced for that license, as the API prices it.
2418
2537
  static resolveVariation(catalog, item) {
2419
- var _a, _b;
2420
- const source = item.type === "Product" ? catalog.products.find((p) => p.id === item.productId) : catalog.bundles.find((b) => b.id === item.bundleId);
2421
- return (_b = (_a = source == null ? void 0 : source.variations) == null ? void 0 : _a.find((v) => v.id === item.variationId)) != null ? _b : source == null ? void 0 : source.defaultVariation;
2538
+ var _a, _b, _c;
2539
+ if (item.type === "Product") {
2540
+ const product = catalog.products.find((p) => p.id === item.productId);
2541
+ return (_a = _CartUtils.productLineVariation(product, item.variationId, item.targetLicenseId)) != null ? _a : product == null ? void 0 : product.defaultVariation;
2542
+ }
2543
+ const bundle = catalog.bundles.find((b) => b.id === item.bundleId);
2544
+ return (_c = (_b = bundle == null ? void 0 : bundle.variations) == null ? void 0 : _b.find((v) => v.id === item.variationId)) != null ? _c : bundle == null ? void 0 : bundle.defaultVariation;
2545
+ }
2546
+ /**
2547
+ * The storefront's entry for upgrading or renewing one of the signed-in customer's licenses of a
2548
+ * product: what it covers now, and the variations that would upgrade it, priced for it. Licenses
2549
+ * that cover the same share an entry. `undefined` when the storefront has none for it (the license
2550
+ * is not theirs, covers every release, is past the cap on entries, or the customer is not signed in).
2551
+ */
2552
+ static licenseUpgrade(product, licenseId) {
2553
+ var _a;
2554
+ if (!product || !licenseId)
2555
+ return void 0;
2556
+ const wanted = licenseId.toLowerCase();
2557
+ return (_a = product.licenseUpgrades) == null ? void 0 : _a.find((u) => u.licenseIds.some((id) => id.toLowerCase() === wanted));
2558
+ }
2559
+ /**
2560
+ * The variations that would upgrade or renew one of the signed-in customer's licenses of a
2561
+ * product, priced for that license, or `undefined` when the storefront has no price for it.
2562
+ */
2563
+ static licenseUpgradeVariations(product, licenseId) {
2564
+ var _a;
2565
+ return (_a = _CartUtils.licenseUpgrade(product, licenseId)) == null ? void 0 : _a.variations;
2566
+ }
2567
+ /**
2568
+ * The variation a product line is priced at. A line naming one of the customer's licenses
2569
+ * (`targetLicenseId`) upgrades that license, and an upgrade discount is judged per license, so its
2570
+ * price comes from the product's `licenseUpgrades` for that license. Every other line, and an
2571
+ * upgrade line the storefront has no price for, takes the product's own variation, which is what
2572
+ * a new license costs.
2573
+ */
2574
+ static productLineVariation(product, variationId, targetLicenseId) {
2575
+ var _a, _b, _c;
2576
+ return (_c = (_a = _CartUtils.licenseUpgradeVariations(product, targetLicenseId)) == null ? void 0 : _a.find((v) => v.id === variationId)) != null ? _c : (_b = product == null ? void 0 : product.variations) == null ? void 0 : _b.find((v) => v.id === variationId);
2422
2577
  }
2423
2578
  // A line's unit price after its product discount and any pricing tier, and *before* any offer.
2424
2579
  // This is the basis the API measures cart total conditions on, which is why it reads the catalog
@@ -2905,6 +3060,7 @@ var MoonbaseClient = class {
2905
3060
  OrderStatus,
2906
3061
  PasswordSetupRequiredError,
2907
3062
  Platform,
3063
+ ReleaseNotCoveredError,
2908
3064
  StoreClosedError,
2909
3065
  SubscriptionCancellationReason,
2910
3066
  SubscriptionStatus,