@shware/purchase 0.1.9 → 0.1.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/subscription/index.ts"],"sourcesContent":["export enum Platform {\n APPLE = 'APPLE',\n GOOGLE = 'GOOGLE',\n STRIPE = 'STRIPE',\n}\n\nexport const ALL_PLATFORMS = [Platform.APPLE, Platform.GOOGLE, Platform.STRIPE] as const;\n\n/**\n * [Stripe Subscription Status](https://stripe.com/docs/api/subscriptions/object#subscription_object-status)\n * [Stripe Subscription Lifecycle](https://docs.stripe.com/billing/subscriptions/overview)\n *\n * provision product for customer when Status = TRIALING, ACTIVE, IN_GRACE_PERIOD\n */\nexport enum SubscriptionStatus {\n /**\n * The subscription is currently in a trial period and it’s safe to provision your product for\n * your customer. The subscription transitions automatically to active when the first payment\n * is made.\n *\n * Google: play(LineItems[0].OfferDetails.OfferId == 'xx')\n *\n * Platform: Apple, Google, Stripe\n * */\n TRIALING = 'TRIALING',\n\n /**\n * The subscription is in good standing and the most recent payment is successful. It’s safe to\n * provision your product for your customer.\n *\n * Platform: Apple, Google, Stripe\n * */\n ACTIVE = 'ACTIVE',\n\n /**\n * Apple: The subscription enters the billing retry period. If the subtype is GRACE_PERIOD,\n * continue to provide service through the grace period. If the subtype is empty, the\n * subscription isn’t in a grace period and you can stop providing the subscription service.\n *\n * Google: Subscription is in grace period. The state is only available when the subscription\n * is an auto renewing plan. In this state, all items are in grace period.\n *\n * Platform: Apple, Google\n * */\n IN_GRACE_PERIOD = 'IN_GRACE_PERIOD',\n\n /**\n * A successful payment needs to be made within 23 hours to activate the subscription. Or the\n * payment requires action, like customer authentication. Subscriptions can also be incomplete\n * if there’s a pending payment and the PaymentIntent status would be processing.\n *\n * Platform: Stripe\n * */\n INCOMPLETE = 'INCOMPLETE',\n\n /**\n * The initial payment on the subscription failed and no successful payment was made within 23\n * hours of creating the subscription. These subscriptions don’t bill customers. This status\n * exists so you can track customers that failed to activate their subscriptions.\n *\n * Platform: Stripe\n * */\n INCOMPLETE_EXPIRED = 'INCOMPLETE_EXPIRED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n *\n * Platform: Google\n * */\n PENDING = 'PENDING',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an\n * existing subscription, use linkedPurchaseToken to get the current state of that subscription.\n *\n * Platform: Google\n * */\n PENDING_PURCHASE_CANCELED = 'PENDING_PURCHASE_CANCELED',\n\n /**\n * Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription\n * continues to create invoices. Your subscription settings determine the subscription’s next\n * state. If the invoice is still unpaid after all Smart Retries have been attempted, you can\n * configure the subscription to move to canceled, unpaid, or leave it as past_due. To move the\n * subscription to active, pay the most recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n PAST_DUE = 'PAST_DUE',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold. Grace period ends or Active period\n * ends but not grace period\n *\n * Platform: Google\n * */\n ON_HOLD = 'ON_HOLD',\n\n /**\n * The subscription has been canceled. During cancellation, automatic collection for all unpaid\n * invoices is disabled (auto_advance=false). This is a terminal state that can’t be updated.\n *\n * Platform: Apple, Google, Stripe\n * */\n CANCELED = 'CANCELED',\n\n /**\n * The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice\n * remains open and invoices continue to be generated but payments aren’t attempted. You should\n * revoke access to your product when the subscription is unpaid since payments were already\n * attempted and retried when it was past_due. To move the subscription to active, pay the most\n * recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n UNPAID = 'UNPAID',\n\n /**\n * Google: Subscription is paused. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in paused state.\n *\n * Stripe: The subscription has ended its trial period without a default payment method and the\n * trial_settings.end_behavior.missing_payment_method is set to pause. Invoices will no longer\n * be created for the subscription. After a default payment method has been attached to the\n * customer, you can resume the subscription.\n *\n * Platform: Google, Stripe\n * */\n PAUSED = 'PAUSED',\n\n /**\n * For example, a user buys a subscription and receives a purchase token A. The\n * linkedPurchaseToken field will not be set in the API response because the purchase token\n * belongs to a brand new subscription.\n *\n * If the user upgrades their subscription, a new purchase token B will be generated. Since the\n * upgrade is replacing the subscription from purchase token A, the linkedPurchaseToken field\n * for token B will be set to point to token A. Notice it points backwards in time to the\n * original purchase token.\n *\n * +---------------------------+ +------------------------+ +------------------------+\n * | Step 1 first purchase | | Step 2 upgrades | | Step 3 downgrades |\n * | purchaseToken: A |->| purchaseToken: B |->| purchaseToken: C |\n * | linkedPurchaseToken: null | | linkedPurchaseToken: A | | linkedPurchaseToken: B |\n * +---------------------------+ +------------------------+ +------------------------+\n *\n * Platform: Google\n * */\n REPLACED = 'REPLACED',\n\n /**\n * Google: \tSubscription is expired. All items have expiryTime in the past.\n *\n * Platform: Apple, Google\n * */\n EXPIRED = 'EXPIRED',\n}\n\nexport const AVAILABLE_STATUS = [\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.IN_GRACE_PERIOD,\n];\n\nexport const ALL_SUBSCRIPTION_STATUS = [\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.IN_GRACE_PERIOD,\n SubscriptionStatus.INCOMPLETE,\n SubscriptionStatus.INCOMPLETE_EXPIRED,\n SubscriptionStatus.PENDING,\n SubscriptionStatus.PENDING_PURCHASE_CANCELED,\n SubscriptionStatus.PAST_DUE,\n SubscriptionStatus.ON_HOLD,\n SubscriptionStatus.CANCELED,\n SubscriptionStatus.UNPAID,\n SubscriptionStatus.PAUSED,\n SubscriptionStatus.REPLACED,\n SubscriptionStatus.EXPIRED,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,WAAQ;AACR,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAM,gBAAgB,CAAC,qBAAgB,uBAAiB,qBAAe;AAQvE,IAAK,qBAAL,kBAAKC,wBAAL;AAUL,EAAAA,oBAAA,cAAW;AAQX,EAAAA,oBAAA,YAAS;AAYT,EAAAA,oBAAA,qBAAkB;AASlB,EAAAA,oBAAA,gBAAa;AASb,EAAAA,oBAAA,wBAAqB;AAQrB,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,+BAA4B;AAW5B,EAAAA,oBAAA,cAAW;AASX,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,cAAW;AAWX,EAAAA,oBAAA,YAAS;AAaT,EAAAA,oBAAA,YAAS;AAoBT,EAAAA,oBAAA,cAAW;AAOX,EAAAA,oBAAA,aAAU;AA/IA,SAAAA;AAAA,GAAA;AAkJL,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Platform","SubscriptionStatus"]}
|
|
1
|
+
{"version":3,"sources":["../../src/subscription/index.ts"],"sourcesContent":["export enum Platform {\n APPLE = 'APPLE',\n GOOGLE = 'GOOGLE',\n STRIPE = 'STRIPE',\n}\n\nexport const ALL_PLATFORMS = [Platform.APPLE, Platform.GOOGLE, Platform.STRIPE] as const;\n\n/**\n * [Stripe Subscription Status](https://stripe.com/docs/api/subscriptions/object#subscription_object-status)\n * [Stripe Subscription Lifecycle](https://docs.stripe.com/billing/subscriptions/overview)\n *\n * provision product for customer when Status = TRIALING, ACTIVE, IN_GRACE_PERIOD\n */\nexport enum SubscriptionStatus {\n /**\n * The subscription is currently in a trial period and it’s safe to provision your product for\n * your customer. The subscription transitions automatically to active when the first payment\n * is made.\n *\n * Google: play(LineItems[0].OfferDetails.OfferId == 'xx')\n *\n * Platform: Apple, Google, Stripe\n * */\n TRIALING = 'TRIALING',\n\n /**\n * The subscription is in good standing and the most recent payment is successful. It’s safe to\n * provision your product for your customer.\n *\n * Platform: Apple, Google, Stripe\n * */\n ACTIVE = 'ACTIVE',\n\n /**\n * Apple: The subscription enters the billing retry period. If the subtype is GRACE_PERIOD,\n * continue to provide service through the grace period. If the subtype is empty, the\n * subscription isn’t in a grace period and you can stop providing the subscription service.\n *\n * Google: Subscription is in grace period. The state is only available when the subscription\n * is an auto renewing plan. In this state, all items are in grace period.\n *\n * Platform: Apple, Google\n * */\n IN_GRACE_PERIOD = 'IN_GRACE_PERIOD',\n\n /**\n * A successful payment needs to be made within 23 hours to activate the subscription. Or the\n * payment requires action, like customer authentication. Subscriptions can also be incomplete\n * if there’s a pending payment and the PaymentIntent status would be processing.\n *\n * Platform: Stripe\n * */\n INCOMPLETE = 'INCOMPLETE',\n\n /**\n * The initial payment on the subscription failed and no successful payment was made within 23\n * hours of creating the subscription. These subscriptions don’t bill customers. This status\n * exists so you can track customers that failed to activate their subscriptions.\n *\n * Platform: Stripe\n * */\n INCOMPLETE_EXPIRED = 'INCOMPLETE_EXPIRED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n *\n * Platform: Google\n * */\n PENDING = 'PENDING',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an\n * existing subscription, use linkedPurchaseToken to get the current state of that subscription.\n *\n * Platform: Google\n * */\n PENDING_PURCHASE_CANCELED = 'PENDING_PURCHASE_CANCELED',\n\n /**\n * Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription\n * continues to create invoices. Your subscription settings determine the subscription’s next\n * state. If the invoice is still unpaid after all Smart Retries have been attempted, you can\n * configure the subscription to move to canceled, unpaid, or leave it as past_due. To move the\n * subscription to active, pay the most recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n PAST_DUE = 'PAST_DUE',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold. Grace period ends or Active period\n * ends but not grace period\n *\n * Platform: Google\n * */\n ON_HOLD = 'ON_HOLD',\n\n /**\n * The subscription has been canceled. During cancellation, automatic collection for all unpaid\n * invoices is disabled (auto_advance=false). This is a terminal state that can’t be updated.\n *\n * Platform: Apple, Google, Stripe\n * */\n CANCELED = 'CANCELED',\n\n /**\n * The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice\n * remains open and invoices continue to be generated but payments aren’t attempted. You should\n * revoke access to your product when the subscription is unpaid since payments were already\n * attempted and retried when it was past_due. To move the subscription to active, pay the most\n * recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n UNPAID = 'UNPAID',\n\n /**\n * Google: Subscription is paused. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in paused state.\n *\n * Stripe: The subscription has ended its trial period without a default payment method and the\n * trial_settings.end_behavior.missing_payment_method is set to pause. Invoices will no longer\n * be created for the subscription. After a default payment method has been attached to the\n * customer, you can resume the subscription.\n *\n * Platform: Google, Stripe\n * */\n PAUSED = 'PAUSED',\n\n /**\n * For example, a user buys a subscription and receives a purchase token A. The\n * linkedPurchaseToken field will not be set in the API response because the purchase token\n * belongs to a brand new subscription.\n *\n * If the user upgrades their subscription, a new purchase token B will be generated. Since the\n * upgrade is replacing the subscription from purchase token A, the linkedPurchaseToken field\n * for token B will be set to point to token A. Notice it points backwards in time to the\n * original purchase token.\n *\n * +---------------------------+ +------------------------+ +------------------------+\n * | Step 1 first purchase | | Step 2 upgrades | | Step 3 downgrades |\n * | purchaseToken: A |->| purchaseToken: B |->| purchaseToken: C |\n * | linkedPurchaseToken: null | | linkedPurchaseToken: A | | linkedPurchaseToken: B |\n * +---------------------------+ +------------------------+ +------------------------+\n *\n * Platform: Google\n * */\n REPLACED = 'REPLACED',\n\n /**\n * Google: \tSubscription is expired. All items have expiryTime in the past.\n *\n * Platform: Apple, Google\n * */\n EXPIRED = 'EXPIRED',\n}\n\nexport const AVAILABLE_STATUS = [\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.IN_GRACE_PERIOD,\n];\n\nexport const ALL_SUBSCRIPTION_STATUS = [\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.IN_GRACE_PERIOD,\n SubscriptionStatus.INCOMPLETE,\n SubscriptionStatus.INCOMPLETE_EXPIRED,\n SubscriptionStatus.PENDING,\n SubscriptionStatus.PENDING_PURCHASE_CANCELED,\n SubscriptionStatus.PAST_DUE,\n SubscriptionStatus.ON_HOLD,\n SubscriptionStatus.CANCELED,\n SubscriptionStatus.UNPAID,\n SubscriptionStatus.PAUSED,\n SubscriptionStatus.REPLACED,\n SubscriptionStatus.EXPIRED,\n] as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,WAAQ;AACR,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAM,gBAAgB,CAAC,qBAAgB,uBAAiB,qBAAe;AAQvE,IAAK,qBAAL,kBAAKC,wBAAL;AAUL,EAAAA,oBAAA,cAAW;AAQX,EAAAA,oBAAA,YAAS;AAYT,EAAAA,oBAAA,qBAAkB;AASlB,EAAAA,oBAAA,gBAAa;AASb,EAAAA,oBAAA,wBAAqB;AAQrB,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,+BAA4B;AAW5B,EAAAA,oBAAA,cAAW;AASX,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,cAAW;AAWX,EAAAA,oBAAA,YAAS;AAaT,EAAAA,oBAAA,YAAS;AAoBT,EAAAA,oBAAA,cAAW;AAOX,EAAAA,oBAAA,aAAU;AA/IA,SAAAA;AAAA,GAAA;AAkJL,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Platform","SubscriptionStatus"]}
|
|
@@ -143,6 +143,6 @@ declare enum SubscriptionStatus {
|
|
|
143
143
|
EXPIRED = "EXPIRED"
|
|
144
144
|
}
|
|
145
145
|
declare const AVAILABLE_STATUS: SubscriptionStatus[];
|
|
146
|
-
declare const ALL_SUBSCRIPTION_STATUS: SubscriptionStatus
|
|
146
|
+
declare const ALL_SUBSCRIPTION_STATUS: readonly [SubscriptionStatus.TRIALING, SubscriptionStatus.ACTIVE, SubscriptionStatus.IN_GRACE_PERIOD, SubscriptionStatus.INCOMPLETE, SubscriptionStatus.INCOMPLETE_EXPIRED, SubscriptionStatus.PENDING, SubscriptionStatus.PENDING_PURCHASE_CANCELED, SubscriptionStatus.PAST_DUE, SubscriptionStatus.ON_HOLD, SubscriptionStatus.CANCELED, SubscriptionStatus.UNPAID, SubscriptionStatus.PAUSED, SubscriptionStatus.REPLACED, SubscriptionStatus.EXPIRED];
|
|
147
147
|
|
|
148
148
|
export { ALL_PLATFORMS, ALL_SUBSCRIPTION_STATUS, AVAILABLE_STATUS, Platform, SubscriptionStatus };
|
|
@@ -143,6 +143,6 @@ declare enum SubscriptionStatus {
|
|
|
143
143
|
EXPIRED = "EXPIRED"
|
|
144
144
|
}
|
|
145
145
|
declare const AVAILABLE_STATUS: SubscriptionStatus[];
|
|
146
|
-
declare const ALL_SUBSCRIPTION_STATUS: SubscriptionStatus
|
|
146
|
+
declare const ALL_SUBSCRIPTION_STATUS: readonly [SubscriptionStatus.TRIALING, SubscriptionStatus.ACTIVE, SubscriptionStatus.IN_GRACE_PERIOD, SubscriptionStatus.INCOMPLETE, SubscriptionStatus.INCOMPLETE_EXPIRED, SubscriptionStatus.PENDING, SubscriptionStatus.PENDING_PURCHASE_CANCELED, SubscriptionStatus.PAST_DUE, SubscriptionStatus.ON_HOLD, SubscriptionStatus.CANCELED, SubscriptionStatus.UNPAID, SubscriptionStatus.PAUSED, SubscriptionStatus.REPLACED, SubscriptionStatus.EXPIRED];
|
|
147
147
|
|
|
148
148
|
export { ALL_PLATFORMS, ALL_SUBSCRIPTION_STATUS, AVAILABLE_STATUS, Platform, SubscriptionStatus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/subscription/index.ts"],"sourcesContent":["export enum Platform {\n APPLE = 'APPLE',\n GOOGLE = 'GOOGLE',\n STRIPE = 'STRIPE',\n}\n\nexport const ALL_PLATFORMS = [Platform.APPLE, Platform.GOOGLE, Platform.STRIPE] as const;\n\n/**\n * [Stripe Subscription Status](https://stripe.com/docs/api/subscriptions/object#subscription_object-status)\n * [Stripe Subscription Lifecycle](https://docs.stripe.com/billing/subscriptions/overview)\n *\n * provision product for customer when Status = TRIALING, ACTIVE, IN_GRACE_PERIOD\n */\nexport enum SubscriptionStatus {\n /**\n * The subscription is currently in a trial period and it’s safe to provision your product for\n * your customer. The subscription transitions automatically to active when the first payment\n * is made.\n *\n * Google: play(LineItems[0].OfferDetails.OfferId == 'xx')\n *\n * Platform: Apple, Google, Stripe\n * */\n TRIALING = 'TRIALING',\n\n /**\n * The subscription is in good standing and the most recent payment is successful. It’s safe to\n * provision your product for your customer.\n *\n * Platform: Apple, Google, Stripe\n * */\n ACTIVE = 'ACTIVE',\n\n /**\n * Apple: The subscription enters the billing retry period. If the subtype is GRACE_PERIOD,\n * continue to provide service through the grace period. If the subtype is empty, the\n * subscription isn’t in a grace period and you can stop providing the subscription service.\n *\n * Google: Subscription is in grace period. The state is only available when the subscription\n * is an auto renewing plan. In this state, all items are in grace period.\n *\n * Platform: Apple, Google\n * */\n IN_GRACE_PERIOD = 'IN_GRACE_PERIOD',\n\n /**\n * A successful payment needs to be made within 23 hours to activate the subscription. Or the\n * payment requires action, like customer authentication. Subscriptions can also be incomplete\n * if there’s a pending payment and the PaymentIntent status would be processing.\n *\n * Platform: Stripe\n * */\n INCOMPLETE = 'INCOMPLETE',\n\n /**\n * The initial payment on the subscription failed and no successful payment was made within 23\n * hours of creating the subscription. These subscriptions don’t bill customers. This status\n * exists so you can track customers that failed to activate their subscriptions.\n *\n * Platform: Stripe\n * */\n INCOMPLETE_EXPIRED = 'INCOMPLETE_EXPIRED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n *\n * Platform: Google\n * */\n PENDING = 'PENDING',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an\n * existing subscription, use linkedPurchaseToken to get the current state of that subscription.\n *\n * Platform: Google\n * */\n PENDING_PURCHASE_CANCELED = 'PENDING_PURCHASE_CANCELED',\n\n /**\n * Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription\n * continues to create invoices. Your subscription settings determine the subscription’s next\n * state. If the invoice is still unpaid after all Smart Retries have been attempted, you can\n * configure the subscription to move to canceled, unpaid, or leave it as past_due. To move the\n * subscription to active, pay the most recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n PAST_DUE = 'PAST_DUE',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold. Grace period ends or Active period\n * ends but not grace period\n *\n * Platform: Google\n * */\n ON_HOLD = 'ON_HOLD',\n\n /**\n * The subscription has been canceled. During cancellation, automatic collection for all unpaid\n * invoices is disabled (auto_advance=false). This is a terminal state that can’t be updated.\n *\n * Platform: Apple, Google, Stripe\n * */\n CANCELED = 'CANCELED',\n\n /**\n * The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice\n * remains open and invoices continue to be generated but payments aren’t attempted. You should\n * revoke access to your product when the subscription is unpaid since payments were already\n * attempted and retried when it was past_due. To move the subscription to active, pay the most\n * recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n UNPAID = 'UNPAID',\n\n /**\n * Google: Subscription is paused. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in paused state.\n *\n * Stripe: The subscription has ended its trial period without a default payment method and the\n * trial_settings.end_behavior.missing_payment_method is set to pause. Invoices will no longer\n * be created for the subscription. After a default payment method has been attached to the\n * customer, you can resume the subscription.\n *\n * Platform: Google, Stripe\n * */\n PAUSED = 'PAUSED',\n\n /**\n * For example, a user buys a subscription and receives a purchase token A. The\n * linkedPurchaseToken field will not be set in the API response because the purchase token\n * belongs to a brand new subscription.\n *\n * If the user upgrades their subscription, a new purchase token B will be generated. Since the\n * upgrade is replacing the subscription from purchase token A, the linkedPurchaseToken field\n * for token B will be set to point to token A. Notice it points backwards in time to the\n * original purchase token.\n *\n * +---------------------------+ +------------------------+ +------------------------+\n * | Step 1 first purchase | | Step 2 upgrades | | Step 3 downgrades |\n * | purchaseToken: A |->| purchaseToken: B |->| purchaseToken: C |\n * | linkedPurchaseToken: null | | linkedPurchaseToken: A | | linkedPurchaseToken: B |\n * +---------------------------+ +------------------------+ +------------------------+\n *\n * Platform: Google\n * */\n REPLACED = 'REPLACED',\n\n /**\n * Google: \tSubscription is expired. All items have expiryTime in the past.\n *\n * Platform: Apple, Google\n * */\n EXPIRED = 'EXPIRED',\n}\n\nexport const AVAILABLE_STATUS = [\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.IN_GRACE_PERIOD,\n];\n\nexport const ALL_SUBSCRIPTION_STATUS = [\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.IN_GRACE_PERIOD,\n SubscriptionStatus.INCOMPLETE,\n SubscriptionStatus.INCOMPLETE_EXPIRED,\n SubscriptionStatus.PENDING,\n SubscriptionStatus.PENDING_PURCHASE_CANCELED,\n SubscriptionStatus.PAST_DUE,\n SubscriptionStatus.ON_HOLD,\n SubscriptionStatus.CANCELED,\n SubscriptionStatus.UNPAID,\n SubscriptionStatus.PAUSED,\n SubscriptionStatus.REPLACED,\n SubscriptionStatus.EXPIRED,\n];\n"],"mappings":";AAAO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,WAAQ;AACR,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAM,gBAAgB,CAAC,qBAAgB,uBAAiB,qBAAe;AAQvE,IAAK,qBAAL,kBAAKC,wBAAL;AAUL,EAAAA,oBAAA,cAAW;AAQX,EAAAA,oBAAA,YAAS;AAYT,EAAAA,oBAAA,qBAAkB;AASlB,EAAAA,oBAAA,gBAAa;AASb,EAAAA,oBAAA,wBAAqB;AAQrB,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,+BAA4B;AAW5B,EAAAA,oBAAA,cAAW;AASX,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,cAAW;AAWX,EAAAA,oBAAA,YAAS;AAaT,EAAAA,oBAAA,YAAS;AAoBT,EAAAA,oBAAA,cAAW;AAOX,EAAAA,oBAAA,aAAU;AA/IA,SAAAA;AAAA,GAAA;AAkJL,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Platform","SubscriptionStatus"]}
|
|
1
|
+
{"version":3,"sources":["../../src/subscription/index.ts"],"sourcesContent":["export enum Platform {\n APPLE = 'APPLE',\n GOOGLE = 'GOOGLE',\n STRIPE = 'STRIPE',\n}\n\nexport const ALL_PLATFORMS = [Platform.APPLE, Platform.GOOGLE, Platform.STRIPE] as const;\n\n/**\n * [Stripe Subscription Status](https://stripe.com/docs/api/subscriptions/object#subscription_object-status)\n * [Stripe Subscription Lifecycle](https://docs.stripe.com/billing/subscriptions/overview)\n *\n * provision product for customer when Status = TRIALING, ACTIVE, IN_GRACE_PERIOD\n */\nexport enum SubscriptionStatus {\n /**\n * The subscription is currently in a trial period and it’s safe to provision your product for\n * your customer. The subscription transitions automatically to active when the first payment\n * is made.\n *\n * Google: play(LineItems[0].OfferDetails.OfferId == 'xx')\n *\n * Platform: Apple, Google, Stripe\n * */\n TRIALING = 'TRIALING',\n\n /**\n * The subscription is in good standing and the most recent payment is successful. It’s safe to\n * provision your product for your customer.\n *\n * Platform: Apple, Google, Stripe\n * */\n ACTIVE = 'ACTIVE',\n\n /**\n * Apple: The subscription enters the billing retry period. If the subtype is GRACE_PERIOD,\n * continue to provide service through the grace period. If the subtype is empty, the\n * subscription isn’t in a grace period and you can stop providing the subscription service.\n *\n * Google: Subscription is in grace period. The state is only available when the subscription\n * is an auto renewing plan. In this state, all items are in grace period.\n *\n * Platform: Apple, Google\n * */\n IN_GRACE_PERIOD = 'IN_GRACE_PERIOD',\n\n /**\n * A successful payment needs to be made within 23 hours to activate the subscription. Or the\n * payment requires action, like customer authentication. Subscriptions can also be incomplete\n * if there’s a pending payment and the PaymentIntent status would be processing.\n *\n * Platform: Stripe\n * */\n INCOMPLETE = 'INCOMPLETE',\n\n /**\n * The initial payment on the subscription failed and no successful payment was made within 23\n * hours of creating the subscription. These subscriptions don’t bill customers. This status\n * exists so you can track customers that failed to activate their subscriptions.\n *\n * Platform: Stripe\n * */\n INCOMPLETE_EXPIRED = 'INCOMPLETE_EXPIRED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n *\n * Platform: Google\n * */\n PENDING = 'PENDING',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an\n * existing subscription, use linkedPurchaseToken to get the current state of that subscription.\n *\n * Platform: Google\n * */\n PENDING_PURCHASE_CANCELED = 'PENDING_PURCHASE_CANCELED',\n\n /**\n * Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription\n * continues to create invoices. Your subscription settings determine the subscription’s next\n * state. If the invoice is still unpaid after all Smart Retries have been attempted, you can\n * configure the subscription to move to canceled, unpaid, or leave it as past_due. To move the\n * subscription to active, pay the most recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n PAST_DUE = 'PAST_DUE',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold. Grace period ends or Active period\n * ends but not grace period\n *\n * Platform: Google\n * */\n ON_HOLD = 'ON_HOLD',\n\n /**\n * The subscription has been canceled. During cancellation, automatic collection for all unpaid\n * invoices is disabled (auto_advance=false). This is a terminal state that can’t be updated.\n *\n * Platform: Apple, Google, Stripe\n * */\n CANCELED = 'CANCELED',\n\n /**\n * The latest invoice hasn’t been paid but the subscription remains in place. The latest invoice\n * remains open and invoices continue to be generated but payments aren’t attempted. You should\n * revoke access to your product when the subscription is unpaid since payments were already\n * attempted and retried when it was past_due. To move the subscription to active, pay the most\n * recent invoice before its due date.\n *\n * Platform: Stripe\n * */\n UNPAID = 'UNPAID',\n\n /**\n * Google: Subscription is paused. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in paused state.\n *\n * Stripe: The subscription has ended its trial period without a default payment method and the\n * trial_settings.end_behavior.missing_payment_method is set to pause. Invoices will no longer\n * be created for the subscription. After a default payment method has been attached to the\n * customer, you can resume the subscription.\n *\n * Platform: Google, Stripe\n * */\n PAUSED = 'PAUSED',\n\n /**\n * For example, a user buys a subscription and receives a purchase token A. The\n * linkedPurchaseToken field will not be set in the API response because the purchase token\n * belongs to a brand new subscription.\n *\n * If the user upgrades their subscription, a new purchase token B will be generated. Since the\n * upgrade is replacing the subscription from purchase token A, the linkedPurchaseToken field\n * for token B will be set to point to token A. Notice it points backwards in time to the\n * original purchase token.\n *\n * +---------------------------+ +------------------------+ +------------------------+\n * | Step 1 first purchase | | Step 2 upgrades | | Step 3 downgrades |\n * | purchaseToken: A |->| purchaseToken: B |->| purchaseToken: C |\n * | linkedPurchaseToken: null | | linkedPurchaseToken: A | | linkedPurchaseToken: B |\n * +---------------------------+ +------------------------+ +------------------------+\n *\n * Platform: Google\n * */\n REPLACED = 'REPLACED',\n\n /**\n * Google: \tSubscription is expired. All items have expiryTime in the past.\n *\n * Platform: Apple, Google\n * */\n EXPIRED = 'EXPIRED',\n}\n\nexport const AVAILABLE_STATUS = [\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.IN_GRACE_PERIOD,\n];\n\nexport const ALL_SUBSCRIPTION_STATUS = [\n SubscriptionStatus.TRIALING,\n SubscriptionStatus.ACTIVE,\n SubscriptionStatus.IN_GRACE_PERIOD,\n SubscriptionStatus.INCOMPLETE,\n SubscriptionStatus.INCOMPLETE_EXPIRED,\n SubscriptionStatus.PENDING,\n SubscriptionStatus.PENDING_PURCHASE_CANCELED,\n SubscriptionStatus.PAST_DUE,\n SubscriptionStatus.ON_HOLD,\n SubscriptionStatus.CANCELED,\n SubscriptionStatus.UNPAID,\n SubscriptionStatus.PAUSED,\n SubscriptionStatus.REPLACED,\n SubscriptionStatus.EXPIRED,\n] as const;\n"],"mappings":";AAAO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,UAAA,WAAQ;AACR,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AAML,IAAM,gBAAgB,CAAC,qBAAgB,uBAAiB,qBAAe;AAQvE,IAAK,qBAAL,kBAAKC,wBAAL;AAUL,EAAAA,oBAAA,cAAW;AAQX,EAAAA,oBAAA,YAAS;AAYT,EAAAA,oBAAA,qBAAkB;AASlB,EAAAA,oBAAA,gBAAa;AASb,EAAAA,oBAAA,wBAAqB;AAQrB,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,+BAA4B;AAW5B,EAAAA,oBAAA,cAAW;AASX,EAAAA,oBAAA,aAAU;AAQV,EAAAA,oBAAA,cAAW;AAWX,EAAAA,oBAAA,YAAS;AAaT,EAAAA,oBAAA,YAAS;AAoBT,EAAAA,oBAAA,cAAW;AAOX,EAAAA,oBAAA,aAAU;AA/IA,SAAAA;AAAA,GAAA;AAkJL,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["Platform","SubscriptionStatus"]}
|