@moonbase.sh/storefront-api 3.3.0 → 3.4.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 +24 -2
- package/dist/index.d.cts +51 -26
- package/dist/index.d.ts +51 -26
- package/dist/index.js +23 -2
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
OfferUtils: () => OfferUtils,
|
|
47
47
|
OrderStatus: () => OrderStatus,
|
|
48
48
|
Platform: () => Platform,
|
|
49
|
+
SubscriptionCancellationReason: () => SubscriptionCancellationReason,
|
|
49
50
|
SubscriptionStatus: () => SubscriptionStatus,
|
|
50
51
|
TokenStore: () => TokenStore,
|
|
51
52
|
imageWidths: () => imageWidths,
|
|
@@ -1382,6 +1383,15 @@ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
|
1382
1383
|
SubscriptionStatus2["Completed"] = "Completed";
|
|
1383
1384
|
return SubscriptionStatus2;
|
|
1384
1385
|
})(SubscriptionStatus || {});
|
|
1386
|
+
var SubscriptionCancellationReason = /* @__PURE__ */ ((SubscriptionCancellationReason2) => {
|
|
1387
|
+
SubscriptionCancellationReason2["TooExpensive"] = "TooExpensive";
|
|
1388
|
+
SubscriptionCancellationReason2["Unused"] = "Unused";
|
|
1389
|
+
SubscriptionCancellationReason2["MissingFeatures"] = "MissingFeatures";
|
|
1390
|
+
SubscriptionCancellationReason2["TechnicalIssues"] = "TechnicalIssues";
|
|
1391
|
+
SubscriptionCancellationReason2["SwitchedService"] = "SwitchedService";
|
|
1392
|
+
SubscriptionCancellationReason2["Other"] = "Other";
|
|
1393
|
+
return SubscriptionCancellationReason2;
|
|
1394
|
+
})(SubscriptionCancellationReason || {});
|
|
1385
1395
|
|
|
1386
1396
|
// src/inventory/subscriptions/schemas.ts
|
|
1387
1397
|
var baseMilestoneProgressEventSchema = import_zod13.z.object({
|
|
@@ -1455,8 +1465,19 @@ var SubscriptionEndpoints = class {
|
|
|
1455
1465
|
const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}?${objectToQuery(options)}`, subscriptionSchema);
|
|
1456
1466
|
return response.data;
|
|
1457
1467
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1468
|
+
/**
|
|
1469
|
+
* Turns off auto-renew. The customer keeps access until the subscription's current
|
|
1470
|
+
* period ends. Pass `feedback` to record why they are cancelling.
|
|
1471
|
+
*/
|
|
1472
|
+
async cancel(subscriptionId, feedback) {
|
|
1473
|
+
var _a, _b;
|
|
1474
|
+
const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}/cancel`, subscriptionSchema, {
|
|
1475
|
+
method: "POST",
|
|
1476
|
+
body: {
|
|
1477
|
+
reason: (_a = feedback == null ? void 0 : feedback.reason) != null ? _a : void 0,
|
|
1478
|
+
comment: ((_b = feedback == null ? void 0 : feedback.comment) == null ? void 0 : _b.trim()) || void 0
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1460
1481
|
return response.data;
|
|
1461
1482
|
}
|
|
1462
1483
|
async renew(subscriptionId, returnUrl, embedded) {
|
|
@@ -2586,6 +2607,7 @@ var MoonbaseClient = class {
|
|
|
2586
2607
|
OfferUtils,
|
|
2587
2608
|
OrderStatus,
|
|
2588
2609
|
Platform,
|
|
2610
|
+
SubscriptionCancellationReason,
|
|
2589
2611
|
SubscriptionStatus,
|
|
2590
2612
|
TokenStore,
|
|
2591
2613
|
imageWidths,
|
package/dist/index.d.cts
CHANGED
|
@@ -2733,17 +2733,17 @@ declare const milestoneProgressSchema: z.ZodObject<{
|
|
|
2733
2733
|
fromNormalizedCycleNumber: z.ZodNumber;
|
|
2734
2734
|
toCycleNumber: z.ZodNumber;
|
|
2735
2735
|
toNormalizedCycleNumber: z.ZodNumber;
|
|
2736
|
-
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
2736
|
+
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2737
2737
|
milestoneId: z.ZodString;
|
|
2738
2738
|
fulfilled: z.ZodBoolean;
|
|
2739
2739
|
afterCycleNumber: z.ZodNumber;
|
|
2740
2740
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2741
2741
|
message: z.ZodOptional<z.ZodString>;
|
|
2742
|
-
}
|
|
2742
|
+
} & {
|
|
2743
2743
|
type: z.ZodLiteral<"CouponCodeMilestone">;
|
|
2744
2744
|
code: z.ZodOptional<z.ZodString>;
|
|
2745
2745
|
redeemed: z.ZodOptional<z.ZodBoolean>;
|
|
2746
|
-
}
|
|
2746
|
+
}, "strip", z.ZodTypeAny, {
|
|
2747
2747
|
type: "CouponCodeMilestone";
|
|
2748
2748
|
milestoneId: string;
|
|
2749
2749
|
fulfilled: boolean;
|
|
@@ -2761,15 +2761,15 @@ declare const milestoneProgressSchema: z.ZodObject<{
|
|
|
2761
2761
|
code?: string | undefined;
|
|
2762
2762
|
message?: string | undefined;
|
|
2763
2763
|
redeemed?: boolean | undefined;
|
|
2764
|
-
}>, z.ZodObject<
|
|
2764
|
+
}>, z.ZodObject<{
|
|
2765
2765
|
milestoneId: z.ZodString;
|
|
2766
2766
|
fulfilled: z.ZodBoolean;
|
|
2767
2767
|
afterCycleNumber: z.ZodNumber;
|
|
2768
2768
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2769
2769
|
message: z.ZodOptional<z.ZodString>;
|
|
2770
|
-
}
|
|
2770
|
+
} & {
|
|
2771
2771
|
type: z.ZodLiteral<"PerpetualLicenseConversionMilestone">;
|
|
2772
|
-
}
|
|
2772
|
+
}, "strip", z.ZodTypeAny, {
|
|
2773
2773
|
type: "PerpetualLicenseConversionMilestone";
|
|
2774
2774
|
milestoneId: string;
|
|
2775
2775
|
fulfilled: boolean;
|
|
@@ -2972,17 +2972,17 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
2972
2972
|
fromNormalizedCycleNumber: z.ZodNumber;
|
|
2973
2973
|
toCycleNumber: z.ZodNumber;
|
|
2974
2974
|
toNormalizedCycleNumber: z.ZodNumber;
|
|
2975
|
-
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
2975
|
+
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2976
2976
|
milestoneId: z.ZodString;
|
|
2977
2977
|
fulfilled: z.ZodBoolean;
|
|
2978
2978
|
afterCycleNumber: z.ZodNumber;
|
|
2979
2979
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2980
2980
|
message: z.ZodOptional<z.ZodString>;
|
|
2981
|
-
}
|
|
2981
|
+
} & {
|
|
2982
2982
|
type: z.ZodLiteral<"CouponCodeMilestone">;
|
|
2983
2983
|
code: z.ZodOptional<z.ZodString>;
|
|
2984
2984
|
redeemed: z.ZodOptional<z.ZodBoolean>;
|
|
2985
|
-
}
|
|
2985
|
+
}, "strip", z.ZodTypeAny, {
|
|
2986
2986
|
type: "CouponCodeMilestone";
|
|
2987
2987
|
milestoneId: string;
|
|
2988
2988
|
fulfilled: boolean;
|
|
@@ -3000,15 +3000,15 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
3000
3000
|
code?: string | undefined;
|
|
3001
3001
|
message?: string | undefined;
|
|
3002
3002
|
redeemed?: boolean | undefined;
|
|
3003
|
-
}>, z.ZodObject<
|
|
3003
|
+
}>, z.ZodObject<{
|
|
3004
3004
|
milestoneId: z.ZodString;
|
|
3005
3005
|
fulfilled: z.ZodBoolean;
|
|
3006
3006
|
afterCycleNumber: z.ZodNumber;
|
|
3007
3007
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
3008
3008
|
message: z.ZodOptional<z.ZodString>;
|
|
3009
|
-
}
|
|
3009
|
+
} & {
|
|
3010
3010
|
type: z.ZodLiteral<"PerpetualLicenseConversionMilestone">;
|
|
3011
|
-
}
|
|
3011
|
+
}, "strip", z.ZodTypeAny, {
|
|
3012
3012
|
type: "PerpetualLicenseConversionMilestone";
|
|
3013
3013
|
milestoneId: string;
|
|
3014
3014
|
fulfilled: boolean;
|
|
@@ -6539,6 +6539,27 @@ declare enum SubscriptionStatus {
|
|
|
6539
6539
|
Cancelled = "Cancelled",
|
|
6540
6540
|
Completed = "Completed"
|
|
6541
6541
|
}
|
|
6542
|
+
/**
|
|
6543
|
+
* Why a customer is cancelling a subscription, as they would pick it from a list. The
|
|
6544
|
+
* merchant has two further reasons of its own that a customer cannot give.
|
|
6545
|
+
*/
|
|
6546
|
+
declare enum SubscriptionCancellationReason {
|
|
6547
|
+
TooExpensive = "TooExpensive",
|
|
6548
|
+
Unused = "Unused",
|
|
6549
|
+
MissingFeatures = "MissingFeatures",
|
|
6550
|
+
TechnicalIssues = "TechnicalIssues",
|
|
6551
|
+
SwitchedService = "SwitchedService",
|
|
6552
|
+
Other = "Other"
|
|
6553
|
+
}
|
|
6554
|
+
/**
|
|
6555
|
+
* What a customer said about why they are cancelling. Both parts are optional, and
|
|
6556
|
+
* the merchant sees them alongside the cancellation.
|
|
6557
|
+
*/
|
|
6558
|
+
interface SubscriptionCancellationFeedback {
|
|
6559
|
+
reason?: SubscriptionCancellationReason | null;
|
|
6560
|
+
/** Free text, at most 1000 characters. */
|
|
6561
|
+
comment?: string | null;
|
|
6562
|
+
}
|
|
6542
6563
|
type Subscription = z.infer<typeof subscriptionSchema>;
|
|
6543
6564
|
type MilestoneProgress = z.infer<typeof milestoneProgressSchema>;
|
|
6544
6565
|
|
|
@@ -6551,7 +6572,11 @@ declare class SubscriptionEndpoints {
|
|
|
6551
6572
|
toUpdatePaymentMethod?: boolean;
|
|
6552
6573
|
returnUrl?: string;
|
|
6553
6574
|
}): Promise<Subscription>;
|
|
6554
|
-
|
|
6575
|
+
/**
|
|
6576
|
+
* Turns off auto-renew. The customer keeps access until the subscription's current
|
|
6577
|
+
* period ends. Pass `feedback` to record why they are cancelling.
|
|
6578
|
+
*/
|
|
6579
|
+
cancel(subscriptionId: string, feedback?: SubscriptionCancellationFeedback): Promise<Subscription>;
|
|
6555
6580
|
renew(subscriptionId: string, returnUrl: string, embedded: boolean): Promise<{
|
|
6556
6581
|
location: string;
|
|
6557
6582
|
}>;
|
|
@@ -13068,7 +13093,7 @@ declare const completedOrderSchema: z.ZodObject<{
|
|
|
13068
13093
|
validUntil?: string | undefined;
|
|
13069
13094
|
} | undefined;
|
|
13070
13095
|
}>;
|
|
13071
|
-
declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<
|
|
13096
|
+
declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
13072
13097
|
id: z.ZodString;
|
|
13073
13098
|
currency: z.ZodString;
|
|
13074
13099
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -14449,9 +14474,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
14449
14474
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
14450
14475
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
14451
14476
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
14452
|
-
}
|
|
14477
|
+
} & {
|
|
14453
14478
|
status: z.ZodLiteral<OrderStatus.Open>;
|
|
14454
|
-
}
|
|
14479
|
+
}, "strip", z.ZodTypeAny, {
|
|
14455
14480
|
id: string;
|
|
14456
14481
|
status: OrderStatus.Open;
|
|
14457
14482
|
currency: string;
|
|
@@ -14995,7 +15020,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
14995
15020
|
checkoutUrl?: string | undefined;
|
|
14996
15021
|
hostedCheckoutUrl?: string | undefined;
|
|
14997
15022
|
embeddedCheckoutUrl?: string | undefined;
|
|
14998
|
-
}>, z.ZodObject<
|
|
15023
|
+
}>, z.ZodObject<{
|
|
14999
15024
|
id: z.ZodString;
|
|
15000
15025
|
currency: z.ZodString;
|
|
15001
15026
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -16376,9 +16401,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
16376
16401
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
16377
16402
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
16378
16403
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
16379
|
-
}
|
|
16404
|
+
} & {
|
|
16380
16405
|
status: z.ZodLiteral<OrderStatus.PaymentProcessing>;
|
|
16381
|
-
}
|
|
16406
|
+
}, "strip", z.ZodTypeAny, {
|
|
16382
16407
|
id: string;
|
|
16383
16408
|
status: OrderStatus.PaymentProcessing;
|
|
16384
16409
|
currency: string;
|
|
@@ -16922,7 +16947,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
16922
16947
|
checkoutUrl?: string | undefined;
|
|
16923
16948
|
hostedCheckoutUrl?: string | undefined;
|
|
16924
16949
|
embeddedCheckoutUrl?: string | undefined;
|
|
16925
|
-
}>, z.ZodObject<
|
|
16950
|
+
}>, z.ZodObject<{
|
|
16926
16951
|
id: z.ZodString;
|
|
16927
16952
|
currency: z.ZodString;
|
|
16928
16953
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -18303,9 +18328,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
18303
18328
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
18304
18329
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
18305
18330
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
18306
|
-
}
|
|
18331
|
+
} & {
|
|
18307
18332
|
status: z.ZodLiteral<OrderStatus.Paid>;
|
|
18308
|
-
}
|
|
18333
|
+
}, "strip", z.ZodTypeAny, {
|
|
18309
18334
|
id: string;
|
|
18310
18335
|
status: OrderStatus.Paid;
|
|
18311
18336
|
currency: string;
|
|
@@ -18849,7 +18874,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
18849
18874
|
checkoutUrl?: string | undefined;
|
|
18850
18875
|
hostedCheckoutUrl?: string | undefined;
|
|
18851
18876
|
embeddedCheckoutUrl?: string | undefined;
|
|
18852
|
-
}>, z.ZodObject<
|
|
18877
|
+
}>, z.ZodObject<{
|
|
18853
18878
|
id: z.ZodString;
|
|
18854
18879
|
currency: z.ZodString;
|
|
18855
18880
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -20230,9 +20255,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
20230
20255
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
20231
20256
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
20232
20257
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
20233
|
-
}
|
|
20258
|
+
} & {
|
|
20234
20259
|
status: z.ZodLiteral<OrderStatus.Failed>;
|
|
20235
|
-
}
|
|
20260
|
+
}, "strip", z.ZodTypeAny, {
|
|
20236
20261
|
id: string;
|
|
20237
20262
|
status: OrderStatus.Failed;
|
|
20238
20263
|
currency: string;
|
|
@@ -47157,4 +47182,4 @@ declare class MoonbaseClient {
|
|
|
47157
47182
|
orders: OrderEndpoints;
|
|
47158
47183
|
}
|
|
47159
47184
|
|
|
47160
|
-
export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, Architecture, type BundleLineItem, type CartCatalog, type CartOrder, type CartTotal, type CartTotalCondition, CartUtils, type CommunicationPreferences, type CommunicationPreferencesInput, type CommunicationPreferencesView, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, type ImageFit, type ImageFormat, type ImageTransform, ImageUtils, InMemoryStore, type License, LicenseStatus, type LineItem, type LineItemTotal, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, type OfferConditionContext, type OfferProgress, type OfferScope, OfferUtils, type OpenOrder, type Order, OrderStatus, type OrderTotal, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type PromotionDisplay, type Quantifiable, type RawPropertyArray, type RawPropertyObject, type RawPropertyValue, type SignUpOptions, type SignUpResult, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontOfferTarget, type StorefrontProduct, type StorefrontPromotion, type StorefrontPromotionCta, type StorefrontPromotionTarget, type SubscribeInput, type SubscribeResponse, type Subscription, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type UserAccountConfirmedStatus, type Vendor, type Voucher, imageWidths, isLocalStorageAvailable, isPromotionDisplay, isTransformableImageUrl, maxImageDimension, normalizeGroupIds, objectToQuery, parseOffSiteReferrer, problemDetailsSchema, promotionDisplays, resolveUtm, schemas, utmToObject };
|
|
47185
|
+
export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, Architecture, type BundleLineItem, type CartCatalog, type CartOrder, type CartTotal, type CartTotalCondition, CartUtils, type CommunicationPreferences, type CommunicationPreferencesInput, type CommunicationPreferencesView, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, type ImageFit, type ImageFormat, type ImageTransform, ImageUtils, InMemoryStore, type License, LicenseStatus, type LineItem, type LineItemTotal, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, type OfferConditionContext, type OfferProgress, type OfferScope, OfferUtils, type OpenOrder, type Order, OrderStatus, type OrderTotal, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type PromotionDisplay, type Quantifiable, type RawPropertyArray, type RawPropertyObject, type RawPropertyValue, type SignUpOptions, type SignUpResult, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontOfferTarget, type StorefrontProduct, type StorefrontPromotion, type StorefrontPromotionCta, type StorefrontPromotionTarget, type SubscribeInput, type SubscribeResponse, type Subscription, type SubscriptionCancellationFeedback, SubscriptionCancellationReason, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type UserAccountConfirmedStatus, type Vendor, type Voucher, imageWidths, isLocalStorageAvailable, isPromotionDisplay, isTransformableImageUrl, maxImageDimension, normalizeGroupIds, objectToQuery, parseOffSiteReferrer, problemDetailsSchema, promotionDisplays, resolveUtm, schemas, utmToObject };
|
package/dist/index.d.ts
CHANGED
|
@@ -2733,17 +2733,17 @@ declare const milestoneProgressSchema: z.ZodObject<{
|
|
|
2733
2733
|
fromNormalizedCycleNumber: z.ZodNumber;
|
|
2734
2734
|
toCycleNumber: z.ZodNumber;
|
|
2735
2735
|
toNormalizedCycleNumber: z.ZodNumber;
|
|
2736
|
-
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
2736
|
+
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2737
2737
|
milestoneId: z.ZodString;
|
|
2738
2738
|
fulfilled: z.ZodBoolean;
|
|
2739
2739
|
afterCycleNumber: z.ZodNumber;
|
|
2740
2740
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2741
2741
|
message: z.ZodOptional<z.ZodString>;
|
|
2742
|
-
}
|
|
2742
|
+
} & {
|
|
2743
2743
|
type: z.ZodLiteral<"CouponCodeMilestone">;
|
|
2744
2744
|
code: z.ZodOptional<z.ZodString>;
|
|
2745
2745
|
redeemed: z.ZodOptional<z.ZodBoolean>;
|
|
2746
|
-
}
|
|
2746
|
+
}, "strip", z.ZodTypeAny, {
|
|
2747
2747
|
type: "CouponCodeMilestone";
|
|
2748
2748
|
milestoneId: string;
|
|
2749
2749
|
fulfilled: boolean;
|
|
@@ -2761,15 +2761,15 @@ declare const milestoneProgressSchema: z.ZodObject<{
|
|
|
2761
2761
|
code?: string | undefined;
|
|
2762
2762
|
message?: string | undefined;
|
|
2763
2763
|
redeemed?: boolean | undefined;
|
|
2764
|
-
}>, z.ZodObject<
|
|
2764
|
+
}>, z.ZodObject<{
|
|
2765
2765
|
milestoneId: z.ZodString;
|
|
2766
2766
|
fulfilled: z.ZodBoolean;
|
|
2767
2767
|
afterCycleNumber: z.ZodNumber;
|
|
2768
2768
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2769
2769
|
message: z.ZodOptional<z.ZodString>;
|
|
2770
|
-
}
|
|
2770
|
+
} & {
|
|
2771
2771
|
type: z.ZodLiteral<"PerpetualLicenseConversionMilestone">;
|
|
2772
|
-
}
|
|
2772
|
+
}, "strip", z.ZodTypeAny, {
|
|
2773
2773
|
type: "PerpetualLicenseConversionMilestone";
|
|
2774
2774
|
milestoneId: string;
|
|
2775
2775
|
fulfilled: boolean;
|
|
@@ -2972,17 +2972,17 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
2972
2972
|
fromNormalizedCycleNumber: z.ZodNumber;
|
|
2973
2973
|
toCycleNumber: z.ZodNumber;
|
|
2974
2974
|
toNormalizedCycleNumber: z.ZodNumber;
|
|
2975
|
-
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
2975
|
+
events: z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2976
2976
|
milestoneId: z.ZodString;
|
|
2977
2977
|
fulfilled: z.ZodBoolean;
|
|
2978
2978
|
afterCycleNumber: z.ZodNumber;
|
|
2979
2979
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
2980
2980
|
message: z.ZodOptional<z.ZodString>;
|
|
2981
|
-
}
|
|
2981
|
+
} & {
|
|
2982
2982
|
type: z.ZodLiteral<"CouponCodeMilestone">;
|
|
2983
2983
|
code: z.ZodOptional<z.ZodString>;
|
|
2984
2984
|
redeemed: z.ZodOptional<z.ZodBoolean>;
|
|
2985
|
-
}
|
|
2985
|
+
}, "strip", z.ZodTypeAny, {
|
|
2986
2986
|
type: "CouponCodeMilestone";
|
|
2987
2987
|
milestoneId: string;
|
|
2988
2988
|
fulfilled: boolean;
|
|
@@ -3000,15 +3000,15 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
3000
3000
|
code?: string | undefined;
|
|
3001
3001
|
message?: string | undefined;
|
|
3002
3002
|
redeemed?: boolean | undefined;
|
|
3003
|
-
}>, z.ZodObject<
|
|
3003
|
+
}>, z.ZodObject<{
|
|
3004
3004
|
milestoneId: z.ZodString;
|
|
3005
3005
|
fulfilled: z.ZodBoolean;
|
|
3006
3006
|
afterCycleNumber: z.ZodNumber;
|
|
3007
3007
|
afterNormalizedCycleNumber: z.ZodNumber;
|
|
3008
3008
|
message: z.ZodOptional<z.ZodString>;
|
|
3009
|
-
}
|
|
3009
|
+
} & {
|
|
3010
3010
|
type: z.ZodLiteral<"PerpetualLicenseConversionMilestone">;
|
|
3011
|
-
}
|
|
3011
|
+
}, "strip", z.ZodTypeAny, {
|
|
3012
3012
|
type: "PerpetualLicenseConversionMilestone";
|
|
3013
3013
|
milestoneId: string;
|
|
3014
3014
|
fulfilled: boolean;
|
|
@@ -6539,6 +6539,27 @@ declare enum SubscriptionStatus {
|
|
|
6539
6539
|
Cancelled = "Cancelled",
|
|
6540
6540
|
Completed = "Completed"
|
|
6541
6541
|
}
|
|
6542
|
+
/**
|
|
6543
|
+
* Why a customer is cancelling a subscription, as they would pick it from a list. The
|
|
6544
|
+
* merchant has two further reasons of its own that a customer cannot give.
|
|
6545
|
+
*/
|
|
6546
|
+
declare enum SubscriptionCancellationReason {
|
|
6547
|
+
TooExpensive = "TooExpensive",
|
|
6548
|
+
Unused = "Unused",
|
|
6549
|
+
MissingFeatures = "MissingFeatures",
|
|
6550
|
+
TechnicalIssues = "TechnicalIssues",
|
|
6551
|
+
SwitchedService = "SwitchedService",
|
|
6552
|
+
Other = "Other"
|
|
6553
|
+
}
|
|
6554
|
+
/**
|
|
6555
|
+
* What a customer said about why they are cancelling. Both parts are optional, and
|
|
6556
|
+
* the merchant sees them alongside the cancellation.
|
|
6557
|
+
*/
|
|
6558
|
+
interface SubscriptionCancellationFeedback {
|
|
6559
|
+
reason?: SubscriptionCancellationReason | null;
|
|
6560
|
+
/** Free text, at most 1000 characters. */
|
|
6561
|
+
comment?: string | null;
|
|
6562
|
+
}
|
|
6542
6563
|
type Subscription = z.infer<typeof subscriptionSchema>;
|
|
6543
6564
|
type MilestoneProgress = z.infer<typeof milestoneProgressSchema>;
|
|
6544
6565
|
|
|
@@ -6551,7 +6572,11 @@ declare class SubscriptionEndpoints {
|
|
|
6551
6572
|
toUpdatePaymentMethod?: boolean;
|
|
6552
6573
|
returnUrl?: string;
|
|
6553
6574
|
}): Promise<Subscription>;
|
|
6554
|
-
|
|
6575
|
+
/**
|
|
6576
|
+
* Turns off auto-renew. The customer keeps access until the subscription's current
|
|
6577
|
+
* period ends. Pass `feedback` to record why they are cancelling.
|
|
6578
|
+
*/
|
|
6579
|
+
cancel(subscriptionId: string, feedback?: SubscriptionCancellationFeedback): Promise<Subscription>;
|
|
6555
6580
|
renew(subscriptionId: string, returnUrl: string, embedded: boolean): Promise<{
|
|
6556
6581
|
location: string;
|
|
6557
6582
|
}>;
|
|
@@ -13068,7 +13093,7 @@ declare const completedOrderSchema: z.ZodObject<{
|
|
|
13068
13093
|
validUntil?: string | undefined;
|
|
13069
13094
|
} | undefined;
|
|
13070
13095
|
}>;
|
|
13071
|
-
declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<
|
|
13096
|
+
declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
13072
13097
|
id: z.ZodString;
|
|
13073
13098
|
currency: z.ZodString;
|
|
13074
13099
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -14449,9 +14474,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
14449
14474
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
14450
14475
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
14451
14476
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
14452
|
-
}
|
|
14477
|
+
} & {
|
|
14453
14478
|
status: z.ZodLiteral<OrderStatus.Open>;
|
|
14454
|
-
}
|
|
14479
|
+
}, "strip", z.ZodTypeAny, {
|
|
14455
14480
|
id: string;
|
|
14456
14481
|
status: OrderStatus.Open;
|
|
14457
14482
|
currency: string;
|
|
@@ -14995,7 +15020,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
14995
15020
|
checkoutUrl?: string | undefined;
|
|
14996
15021
|
hostedCheckoutUrl?: string | undefined;
|
|
14997
15022
|
embeddedCheckoutUrl?: string | undefined;
|
|
14998
|
-
}>, z.ZodObject<
|
|
15023
|
+
}>, z.ZodObject<{
|
|
14999
15024
|
id: z.ZodString;
|
|
15000
15025
|
currency: z.ZodString;
|
|
15001
15026
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -16376,9 +16401,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
16376
16401
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
16377
16402
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
16378
16403
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
16379
|
-
}
|
|
16404
|
+
} & {
|
|
16380
16405
|
status: z.ZodLiteral<OrderStatus.PaymentProcessing>;
|
|
16381
|
-
}
|
|
16406
|
+
}, "strip", z.ZodTypeAny, {
|
|
16382
16407
|
id: string;
|
|
16383
16408
|
status: OrderStatus.PaymentProcessing;
|
|
16384
16409
|
currency: string;
|
|
@@ -16922,7 +16947,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
16922
16947
|
checkoutUrl?: string | undefined;
|
|
16923
16948
|
hostedCheckoutUrl?: string | undefined;
|
|
16924
16949
|
embeddedCheckoutUrl?: string | undefined;
|
|
16925
|
-
}>, z.ZodObject<
|
|
16950
|
+
}>, z.ZodObject<{
|
|
16926
16951
|
id: z.ZodString;
|
|
16927
16952
|
currency: z.ZodString;
|
|
16928
16953
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -18303,9 +18328,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
18303
18328
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
18304
18329
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
18305
18330
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
18306
|
-
}
|
|
18331
|
+
} & {
|
|
18307
18332
|
status: z.ZodLiteral<OrderStatus.Paid>;
|
|
18308
|
-
}
|
|
18333
|
+
}, "strip", z.ZodTypeAny, {
|
|
18309
18334
|
id: string;
|
|
18310
18335
|
status: OrderStatus.Paid;
|
|
18311
18336
|
currency: string;
|
|
@@ -18849,7 +18874,7 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
18849
18874
|
checkoutUrl?: string | undefined;
|
|
18850
18875
|
hostedCheckoutUrl?: string | undefined;
|
|
18851
18876
|
embeddedCheckoutUrl?: string | undefined;
|
|
18852
|
-
}>, z.ZodObject<
|
|
18877
|
+
}>, z.ZodObject<{
|
|
18853
18878
|
id: z.ZodString;
|
|
18854
18879
|
currency: z.ZodString;
|
|
18855
18880
|
total: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -20230,9 +20255,9 @@ declare const orderSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<z.obje
|
|
|
20230
20255
|
checkoutUrl: z.ZodOptional<z.ZodString>;
|
|
20231
20256
|
hostedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
20232
20257
|
embeddedCheckoutUrl: z.ZodOptional<z.ZodString>;
|
|
20233
|
-
}
|
|
20258
|
+
} & {
|
|
20234
20259
|
status: z.ZodLiteral<OrderStatus.Failed>;
|
|
20235
|
-
}
|
|
20260
|
+
}, "strip", z.ZodTypeAny, {
|
|
20236
20261
|
id: string;
|
|
20237
20262
|
status: OrderStatus.Failed;
|
|
20238
20263
|
currency: string;
|
|
@@ -47157,4 +47182,4 @@ declare class MoonbaseClient {
|
|
|
47157
47182
|
orders: OrderEndpoints;
|
|
47158
47183
|
}
|
|
47159
47184
|
|
|
47160
|
-
export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, Architecture, type BundleLineItem, type CartCatalog, type CartOrder, type CartTotal, type CartTotalCondition, CartUtils, type CommunicationPreferences, type CommunicationPreferencesInput, type CommunicationPreferencesView, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, type ImageFit, type ImageFormat, type ImageTransform, ImageUtils, InMemoryStore, type License, LicenseStatus, type LineItem, type LineItemTotal, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, type OfferConditionContext, type OfferProgress, type OfferScope, OfferUtils, type OpenOrder, type Order, OrderStatus, type OrderTotal, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type PromotionDisplay, type Quantifiable, type RawPropertyArray, type RawPropertyObject, type RawPropertyValue, type SignUpOptions, type SignUpResult, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontOfferTarget, type StorefrontProduct, type StorefrontPromotion, type StorefrontPromotionCta, type StorefrontPromotionTarget, type SubscribeInput, type SubscribeResponse, type Subscription, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type UserAccountConfirmedStatus, type Vendor, type Voucher, imageWidths, isLocalStorageAvailable, isPromotionDisplay, isTransformableImageUrl, maxImageDimension, normalizeGroupIds, objectToQuery, parseOffSiteReferrer, problemDetailsSchema, promotionDisplays, resolveUtm, schemas, utmToObject };
|
|
47185
|
+
export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, Architecture, type BundleLineItem, type CartCatalog, type CartOrder, type CartTotal, type CartTotalCondition, CartUtils, type CommunicationPreferences, type CommunicationPreferencesInput, type CommunicationPreferencesView, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, type ImageFit, type ImageFormat, type ImageTransform, ImageUtils, InMemoryStore, type License, LicenseStatus, type LineItem, type LineItemTotal, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, type OfferConditionContext, type OfferProgress, type OfferScope, OfferUtils, type OpenOrder, type Order, OrderStatus, type OrderTotal, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type PromotionDisplay, type Quantifiable, type RawPropertyArray, type RawPropertyObject, type RawPropertyValue, type SignUpOptions, type SignUpResult, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontOfferTarget, type StorefrontProduct, type StorefrontPromotion, type StorefrontPromotionCta, type StorefrontPromotionTarget, type SubscribeInput, type SubscribeResponse, type Subscription, type SubscriptionCancellationFeedback, SubscriptionCancellationReason, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type UserAccountConfirmedStatus, type Vendor, type Voucher, imageWidths, isLocalStorageAvailable, isPromotionDisplay, isTransformableImageUrl, maxImageDimension, normalizeGroupIds, objectToQuery, parseOffSiteReferrer, problemDetailsSchema, promotionDisplays, resolveUtm, schemas, utmToObject };
|
package/dist/index.js
CHANGED
|
@@ -1322,6 +1322,15 @@ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
|
|
|
1322
1322
|
SubscriptionStatus2["Completed"] = "Completed";
|
|
1323
1323
|
return SubscriptionStatus2;
|
|
1324
1324
|
})(SubscriptionStatus || {});
|
|
1325
|
+
var SubscriptionCancellationReason = /* @__PURE__ */ ((SubscriptionCancellationReason2) => {
|
|
1326
|
+
SubscriptionCancellationReason2["TooExpensive"] = "TooExpensive";
|
|
1327
|
+
SubscriptionCancellationReason2["Unused"] = "Unused";
|
|
1328
|
+
SubscriptionCancellationReason2["MissingFeatures"] = "MissingFeatures";
|
|
1329
|
+
SubscriptionCancellationReason2["TechnicalIssues"] = "TechnicalIssues";
|
|
1330
|
+
SubscriptionCancellationReason2["SwitchedService"] = "SwitchedService";
|
|
1331
|
+
SubscriptionCancellationReason2["Other"] = "Other";
|
|
1332
|
+
return SubscriptionCancellationReason2;
|
|
1333
|
+
})(SubscriptionCancellationReason || {});
|
|
1325
1334
|
|
|
1326
1335
|
// src/inventory/subscriptions/schemas.ts
|
|
1327
1336
|
var baseMilestoneProgressEventSchema = z13.object({
|
|
@@ -1395,8 +1404,19 @@ var SubscriptionEndpoints = class {
|
|
|
1395
1404
|
const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}?${objectToQuery(options)}`, subscriptionSchema);
|
|
1396
1405
|
return response.data;
|
|
1397
1406
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1407
|
+
/**
|
|
1408
|
+
* Turns off auto-renew. The customer keeps access until the subscription's current
|
|
1409
|
+
* period ends. Pass `feedback` to record why they are cancelling.
|
|
1410
|
+
*/
|
|
1411
|
+
async cancel(subscriptionId, feedback) {
|
|
1412
|
+
var _a, _b;
|
|
1413
|
+
const response = await this.api.authenticatedFetch(`/api/customer/inventory/subscriptions/${subscriptionId}/cancel`, subscriptionSchema, {
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
body: {
|
|
1416
|
+
reason: (_a = feedback == null ? void 0 : feedback.reason) != null ? _a : void 0,
|
|
1417
|
+
comment: ((_b = feedback == null ? void 0 : feedback.comment) == null ? void 0 : _b.trim()) || void 0
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1400
1420
|
return response.data;
|
|
1401
1421
|
}
|
|
1402
1422
|
async renew(subscriptionId, returnUrl, embedded) {
|
|
@@ -2525,6 +2545,7 @@ export {
|
|
|
2525
2545
|
OfferUtils,
|
|
2526
2546
|
OrderStatus,
|
|
2527
2547
|
Platform,
|
|
2548
|
+
SubscriptionCancellationReason,
|
|
2528
2549
|
SubscriptionStatus,
|
|
2529
2550
|
TokenStore,
|
|
2530
2551
|
imageWidths,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/storefront-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
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",
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
28
28
|
"version": "npm version",
|
|
29
29
|
"type-check": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
30
|
+
"lint": "eslint . --cache --cache-location node_modules/.cache/eslint/ --cache-strategy content",
|
|
31
|
+
"lint:fix": "eslint . --cache --cache-location node_modules/.cache/eslint/ --cache-strategy content --fix",
|
|
30
32
|
"test": "vitest run",
|
|
31
33
|
"test:watch": "vitest",
|
|
32
34
|
"test:integration": "TEST_INTEGRATION=true vitest run"
|