@metamask-previews/subscription-controller 8.0.1-preview-3866c0ff1 → 8.0.1-preview-e3275932a
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/CHANGELOG.md +0 -1
- package/dist/SubscriptionController-method-action-types.cjs +7 -0
- package/dist/SubscriptionController-method-action-types.cjs.map +1 -0
- package/dist/{SubscriptionController-method-action-types.d.ts → SubscriptionController-method-action-types.d.cts} +2 -2
- package/dist/SubscriptionController-method-action-types.d.cts.map +1 -0
- package/dist/SubscriptionController-method-action-types.d.mts +250 -0
- package/dist/SubscriptionController-method-action-types.d.mts.map +1 -0
- package/dist/{SubscriptionController-method-action-types.js → SubscriptionController-method-action-types.mjs} +1 -1
- package/dist/SubscriptionController-method-action-types.mjs.map +1 -0
- package/dist/SubscriptionController.cjs +744 -0
- package/dist/SubscriptionController.cjs.map +1 -0
- package/dist/{SubscriptionController.d.ts → SubscriptionController.d.cts} +18 -18
- package/dist/SubscriptionController.d.cts.map +1 -0
- package/dist/SubscriptionController.d.mts +258 -0
- package/dist/SubscriptionController.d.mts.map +1 -0
- package/dist/{SubscriptionController.js → SubscriptionController.mjs} +180 -262
- package/dist/SubscriptionController.mjs.map +1 -0
- package/dist/SubscriptionService-method-action-types.cjs +7 -0
- package/dist/SubscriptionService-method-action-types.cjs.map +1 -0
- package/dist/{SubscriptionService-method-action-types.d.ts → SubscriptionService-method-action-types.d.cts} +2 -2
- package/dist/SubscriptionService-method-action-types.d.cts.map +1 -0
- package/dist/SubscriptionService-method-action-types.d.mts +155 -0
- package/dist/SubscriptionService-method-action-types.d.mts.map +1 -0
- package/dist/{SubscriptionService-method-action-types.js → SubscriptionService-method-action-types.mjs} +1 -1
- package/dist/SubscriptionService-method-action-types.mjs.map +1 -0
- package/dist/SubscriptionService-structs.cjs +158 -0
- package/dist/SubscriptionService-structs.cjs.map +1 -0
- package/dist/{SubscriptionService-structs.d.ts → SubscriptionService-structs.d.cts} +134 -134
- package/dist/SubscriptionService-structs.d.cts.map +1 -0
- package/dist/SubscriptionService-structs.d.mts +721 -0
- package/dist/SubscriptionService-structs.d.mts.map +1 -0
- package/dist/{SubscriptionService-structs.js → SubscriptionService-structs.mjs} +4 -4
- package/dist/SubscriptionService-structs.mjs.map +1 -0
- package/dist/SubscriptionService.cjs +477 -0
- package/dist/SubscriptionService.cjs.map +1 -0
- package/dist/{SubscriptionService.d.ts → SubscriptionService.d.cts} +10 -10
- package/dist/SubscriptionService.d.cts.map +1 -0
- package/dist/SubscriptionService.d.mts +149 -0
- package/dist/SubscriptionService.d.mts.map +1 -0
- package/dist/{SubscriptionService.js → SubscriptionService.mjs} +141 -139
- package/dist/SubscriptionService.mjs.map +1 -0
- package/dist/constants.cjs +73 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/{constants.d.ts → constants.d.cts} +1 -1
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +49 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/{constants.js → constants.mjs} +3 -3
- package/dist/constants.mjs.map +1 -0
- package/dist/errors.cjs +72 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{errors.d.ts → errors.d.cts} +2 -2
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +34 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/{errors.js → errors.mjs} +1 -5
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +11 -11
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +6 -6
- package/dist/index.mjs.map +1 -0
- package/dist/logger.cjs +8 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +5 -0
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +5 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +5 -0
- package/dist/logger.mjs.map +1 -0
- package/dist/types.cjs +90 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +41 -41
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +574 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/{types.js → types.mjs} +1 -1
- package/dist/types.mjs.map +1 -0
- package/package.json +16 -12
- package/dist/SubscriptionController-method-action-types.d.ts.map +0 -1
- package/dist/SubscriptionController-method-action-types.js.map +0 -1
- package/dist/SubscriptionController.d.ts.map +0 -1
- package/dist/SubscriptionController.js.map +0 -1
- package/dist/SubscriptionService-method-action-types.d.ts.map +0 -1
- package/dist/SubscriptionService-method-action-types.js.map +0 -1
- package/dist/SubscriptionService-structs.d.ts.map +0 -1
- package/dist/SubscriptionService-structs.js.map +0 -1
- package/dist/SubscriptionService.d.ts.map +0 -1
- package/dist/SubscriptionService.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -4
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -5
- package/dist/logger.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
### Changed
|
|
13
13
|
|
|
14
|
-
- **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
|
|
15
14
|
- Bump `@tanstack/query-core` from `^4.43.0` to `^5.62.16` ([#9712](https://github.com/MetaMask/core/pull/9712))
|
|
16
15
|
- Bump `@metamask/transaction-controller` from `^69.5.2` to `^69.6.1` ([#9960](https://github.com/MetaMask/core/pull/9960), [#9969](https://github.com/MetaMask/core/pull/9969))
|
|
17
16
|
- Bump `@metamask/base-data-service` from `^0.1.3` to `^1.0.0` ([#9972](https://github.com/MetaMask/core/pull/9972))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionController-method-action-types.cjs","sourceRoot":"","sources":["../src/SubscriptionController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController.js';\n\n/**\n * Gets the pricing information from the subscription service.\n *\n * @returns The pricing information.\n */\nexport type SubscriptionControllerGetPricingAction = {\n type: `SubscriptionController:getPricing`;\n handler: SubscriptionController['getPricing'];\n};\n\nexport type SubscriptionControllerGetSubscriptionsAction = {\n type: `SubscriptionController:getSubscriptions`;\n handler: SubscriptionController['getSubscriptions'];\n};\n\n/**\n * Get the subscription by product.\n *\n * @param productType - The product type.\n * @returns The subscription.\n */\nexport type SubscriptionControllerGetSubscriptionByProductAction = {\n type: `SubscriptionController:getSubscriptionByProduct`;\n handler: SubscriptionController['getSubscriptionByProduct'];\n};\n\n/**\n * Get the subscriptions eligibilities.\n *\n * @param request - Optional request object containing user balance to check cohort eligibility.\n * @returns The subscriptions eligibilities.\n */\nexport type SubscriptionControllerGetSubscriptionsEligibilitiesAction = {\n type: `SubscriptionController:getSubscriptionsEligibilities`;\n handler: SubscriptionController['getSubscriptionsEligibilities'];\n};\n\nexport type SubscriptionControllerCancelSubscriptionAction = {\n type: `SubscriptionController:cancelSubscription`;\n handler: SubscriptionController['cancelSubscription'];\n};\n\nexport type SubscriptionControllerUnCancelSubscriptionAction = {\n type: `SubscriptionController:unCancelSubscription`;\n handler: SubscriptionController['unCancelSubscription'];\n};\n\n/**\n * Starts a card-paid subscription checkout session for the requested products\n * (e.g. Shield or Money Account Plus).\n *\n * `isTrialRequested` on the request is ignored and overwritten from pricing\n * (`trialPeriodDays > 0`) and `trialedProducts`.\n *\n * @param request - The start subscription request.\n * @returns The checkout session response.\n */\nexport type SubscriptionControllerStartSubscriptionWithCardAction = {\n type: `SubscriptionController:startSubscriptionWithCard`;\n handler: SubscriptionController['startSubscriptionWithCard'];\n};\n\n/**\n * Starts a crypto-paid subscription for the requested products\n * (e.g. Shield or Money Account Plus). Unlike card checkout, this\n * creates the subscription immediately, so local state is refreshed\n * afterwards.\n *\n * `isTrialRequested` on the request is ignored and overwritten from pricing\n * (`trialPeriodDays > 0`) and `trialedProducts`.\n *\n * @param request - The start crypto subscription request.\n * @returns The start crypto subscription response.\n * @throws If `products` is empty.\n */\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Submits a Shield ERC-20 crypto approval transaction to start or update a\n * crypto subscription.\n *\n * This handler is Shield / `TransactionType.shieldSubscriptionApprove` only.\n * Delegation-based products (e.g. Money Account) must call\n * `startSubscriptionWithCrypto` instead.\n *\n * @param request - The crypto approval request.\n * @param request.productType - The subscription product. Typed as\n * `typeof PRODUCT_TYPES.SHIELD` only at the moment (future might support more\n * product).\n * @param request.txMeta - The transaction metadata. Must have type\n * `TransactionType.shieldSubscriptionApprove`.\n * @param request.isSponsored - Whether the transaction is sponsored.\n * @param request.rewardAccountId - The account ID of the reward subscription\n * to link.\n * @throws If `productType` is not Shield or `txMeta.type` is not\n * `shieldSubscriptionApprove`.\n * @returns void\n */\nexport type SubscriptionControllerSubmitSubscriptionCryptoApprovalAction = {\n type: `SubscriptionController:submitSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitSubscriptionCryptoApproval'];\n};\n\n/**\n * Get transaction params to create crypto approve transaction for subscription payment\n *\n * @param request - The request object\n * @param request.chainId - The chain ID\n * @param request.tokenAddress - The address of the token\n * @param request.productType - The product type\n * @param request.interval - The interval\n * @returns The crypto approve transaction params\n */\nexport type SubscriptionControllerGetCryptoApproveTransactionParamsAction = {\n type: `SubscriptionController:getCryptoApproveTransactionParams`;\n handler: SubscriptionController['getCryptoApproveTransactionParams'];\n};\n\nexport type SubscriptionControllerUpdatePaymentMethodAction = {\n type: `SubscriptionController:updatePaymentMethod`;\n handler: SubscriptionController['updatePaymentMethod'];\n};\n\n/**\n * Gets the billing portal URL.\n *\n * @returns The billing portal URL\n */\nexport type SubscriptionControllerGetBillingPortalUrlAction = {\n type: `SubscriptionController:getBillingPortalUrl`;\n handler: SubscriptionController['getBillingPortalUrl'];\n};\n\n/**\n * Cache the last selected payment method for a specific product.\n *\n * @param request - The request object.\n * @param request.product - The product to cache the payment method for.\n * @param request.paymentMethod - The payment method to cache.\n * @param request.paymentMethod.type - The type of the payment method.\n * @param request.paymentMethod.paymentTokenAddress - The payment token address.\n * @param request.paymentMethod.plan - The plan of the payment method.\n */\nexport type SubscriptionControllerCacheLastSelectedPaymentMethodAction = {\n type: `SubscriptionController:cacheLastSelectedPaymentMethod`;\n handler: SubscriptionController['cacheLastSelectedPaymentMethod'];\n};\n\n/**\n * Clear the last selected payment method for a specific product.\n *\n * @param product - The product to clear the payment method for.\n */\nexport type SubscriptionControllerClearLastSelectedPaymentMethodAction = {\n type: `SubscriptionController:clearLastSelectedPaymentMethod`;\n handler: SubscriptionController['clearLastSelectedPaymentMethod'];\n};\n\n/**\n * Submit sponsorship intents to the Subscription Service backend.\n *\n * This is intended to be used together with the crypto subscription flow.\n * When the user has enabled the smart transaction feature, we will sponsor the gas fees for the subscription approval transaction.\n *\n * @param request - Request object containing the address and products.\n * @example {\n * address: '0x1234567890123456789012345678901234567890',\n * products: [ProductType.Shield],\n * recurringInterval: RecurringInterval.Month,\n * billingCycles: 1,\n * }\n * @returns resolves to true if the sponsorship is supported and intents were submitted successfully, false if the chain does not support sponsorship or the user has already trialed\n * @throws If the crypto payment method or chain is missing from pricing\n */\nexport type SubscriptionControllerSubmitSponsorshipIntentsAction = {\n type: `SubscriptionController:submitSponsorshipIntents`;\n handler: SubscriptionController['submitSponsorshipIntents'];\n};\n\n/**\n * Submit a user event from the UI. (e.g. shield modal viewed)\n *\n * @param request - Request object containing the event to submit.\n * @example { event: SubscriptionUserEvent.ShieldEntryModalViewed, cohort: 'post_tx' }\n */\nexport type SubscriptionControllerSubmitUserEventAction = {\n type: `SubscriptionController:submitUserEvent`;\n handler: SubscriptionController['submitUserEvent'];\n};\n\n/**\n * Assign user to a cohort.\n *\n * @param request - Request object containing the cohort to assign the user to.\n * @example { cohort: 'post_tx' }\n */\nexport type SubscriptionControllerAssignUserToCohortAction = {\n type: `SubscriptionController:assignUserToCohort`;\n handler: SubscriptionController['assignUserToCohort'];\n};\n\n/**\n * Link rewards to a subscription.\n *\n * @param request - Request object containing the reward subscription ID.\n * @param request.subscriptionId - The ID of the subscription to link rewards to.\n * @param request.rewardAccountId - The account ID of the reward subscription to link to the subscription.\n * @example { subscriptionId: '1234567890', rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890' }\n * @returns Resolves when the rewards are linked successfully.\n */\nexport type SubscriptionControllerLinkRewardsAction = {\n type: `SubscriptionController:linkRewards`;\n handler: SubscriptionController['linkRewards'];\n};\n\n/**\n * Calculate token approve amount from price info\n *\n * @param price - The price info\n * @param tokenPaymentInfo - The token price info\n * @returns The token approve amount\n */\nexport type SubscriptionControllerGetTokenApproveAmountAction = {\n type: `SubscriptionController:getTokenApproveAmount`;\n handler: SubscriptionController['getTokenApproveAmount'];\n};\n\n/**\n * Calculate token minimum balance amount from price info\n *\n * @param price - The price info\n * @param tokenPaymentInfo - The token price info\n * @returns The token balance amount\n */\nexport type SubscriptionControllerGetTokenMinimumBalanceAmountAction = {\n type: `SubscriptionController:getTokenMinimumBalanceAmount`;\n handler: SubscriptionController['getTokenMinimumBalanceAmount'];\n};\n\n/**\n * Clears the subscription state and resets to default values.\n */\nexport type SubscriptionControllerClearStateAction = {\n type: `SubscriptionController:clearState`;\n handler: SubscriptionController['clearState'];\n};\n\n/**\n * Triggers an access token refresh.\n */\nexport type SubscriptionControllerTriggerAccessTokenRefreshAction = {\n type: `SubscriptionController:triggerAccessTokenRefresh`;\n handler: SubscriptionController['triggerAccessTokenRefresh'];\n};\n\nexport type SubscriptionControllerStopAllPollingAction = {\n type: `SubscriptionController:stopAllPolling`;\n handler: SubscriptionController['stopAllPolling'];\n};\n\n/**\n * Union of all SubscriptionController action types.\n */\nexport type SubscriptionControllerMethodActions =\n | SubscriptionControllerGetPricingAction\n | SubscriptionControllerGetSubscriptionsAction\n | SubscriptionControllerGetSubscriptionByProductAction\n | SubscriptionControllerGetSubscriptionsEligibilitiesAction\n | SubscriptionControllerCancelSubscriptionAction\n | SubscriptionControllerUnCancelSubscriptionAction\n | SubscriptionControllerStartSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitSubscriptionCryptoApprovalAction\n | SubscriptionControllerGetCryptoApproveTransactionParamsAction\n | SubscriptionControllerUpdatePaymentMethodAction\n | SubscriptionControllerGetBillingPortalUrlAction\n | SubscriptionControllerCacheLastSelectedPaymentMethodAction\n | SubscriptionControllerClearLastSelectedPaymentMethodAction\n | SubscriptionControllerSubmitSponsorshipIntentsAction\n | SubscriptionControllerSubmitUserEventAction\n | SubscriptionControllerAssignUserToCohortAction\n | SubscriptionControllerLinkRewardsAction\n | SubscriptionControllerGetTokenApproveAmountAction\n | SubscriptionControllerGetTokenMinimumBalanceAmountAction\n | SubscriptionControllerClearStateAction\n | SubscriptionControllerTriggerAccessTokenRefreshAction\n | SubscriptionControllerStopAllPollingAction;\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { SubscriptionController } from
|
|
5
|
+
import type { SubscriptionController } from "./SubscriptionController.cjs";
|
|
6
6
|
/**
|
|
7
7
|
* Gets the pricing information from the subscription service.
|
|
8
8
|
*
|
|
@@ -247,4 +247,4 @@ export type SubscriptionControllerStopAllPollingAction = {
|
|
|
247
247
|
* Union of all SubscriptionController action types.
|
|
248
248
|
*/
|
|
249
249
|
export type SubscriptionControllerMethodActions = SubscriptionControllerGetPricingAction | SubscriptionControllerGetSubscriptionsAction | SubscriptionControllerGetSubscriptionByProductAction | SubscriptionControllerGetSubscriptionsEligibilitiesAction | SubscriptionControllerCancelSubscriptionAction | SubscriptionControllerUnCancelSubscriptionAction | SubscriptionControllerStartSubscriptionWithCardAction | SubscriptionControllerStartSubscriptionWithCryptoAction | SubscriptionControllerSubmitSubscriptionCryptoApprovalAction | SubscriptionControllerGetCryptoApproveTransactionParamsAction | SubscriptionControllerUpdatePaymentMethodAction | SubscriptionControllerGetBillingPortalUrlAction | SubscriptionControllerCacheLastSelectedPaymentMethodAction | SubscriptionControllerClearLastSelectedPaymentMethodAction | SubscriptionControllerSubmitSponsorshipIntentsAction | SubscriptionControllerSubmitUserEventAction | SubscriptionControllerAssignUserToCohortAction | SubscriptionControllerLinkRewardsAction | SubscriptionControllerGetTokenApproveAmountAction | SubscriptionControllerGetTokenMinimumBalanceAmountAction | SubscriptionControllerClearStateAction | SubscriptionControllerTriggerAccessTokenRefreshAction | SubscriptionControllerStopAllPollingAction;
|
|
250
|
-
//# sourceMappingURL=SubscriptionController-method-action-types.d.
|
|
250
|
+
//# sourceMappingURL=SubscriptionController-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionController-method-action-types.d.cts","sourceRoot":"","sources":["../src/SubscriptionController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,qCAAoC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,sBAAsB,CAAC,kB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ACrD,OAAO,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;CACjE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,sBAAsB,CAAC,2BAA2B,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,sCAAsC,GACtC,4CAA4C,GAC5C,oDAAoD,GACpD,yDAAyD,GACzD,8CAA8C,GAC9C,gDAAgD,GAChD,qDAAqD,GACrD,uDAAuD,GACvD,4DAA4D,GAC5D,6DAA6D,GAC7D,+CAA+C,GAC/C,+CAA+C,GAC/C,0DAA0D,GAC1D,0DAA0D,GAC1D,oDAAoD,GACpD,2CAA2C,GAC3C,8CAA8C,GAC9C,uCAAuC,GACvC,iDAAiD,GACjD,wDAAwD,GACxD,sCAAsC,GACtC,qDAAqD,GACrD,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { SubscriptionController } from "./SubscriptionController.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Gets the pricing information from the subscription service.
|
|
8
|
+
*
|
|
9
|
+
* @returns The pricing information.
|
|
10
|
+
*/
|
|
11
|
+
export type SubscriptionControllerGetPricingAction = {
|
|
12
|
+
type: `SubscriptionController:getPricing`;
|
|
13
|
+
handler: SubscriptionController['getPricing'];
|
|
14
|
+
};
|
|
15
|
+
export type SubscriptionControllerGetSubscriptionsAction = {
|
|
16
|
+
type: `SubscriptionController:getSubscriptions`;
|
|
17
|
+
handler: SubscriptionController['getSubscriptions'];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Get the subscription by product.
|
|
21
|
+
*
|
|
22
|
+
* @param productType - The product type.
|
|
23
|
+
* @returns The subscription.
|
|
24
|
+
*/
|
|
25
|
+
export type SubscriptionControllerGetSubscriptionByProductAction = {
|
|
26
|
+
type: `SubscriptionController:getSubscriptionByProduct`;
|
|
27
|
+
handler: SubscriptionController['getSubscriptionByProduct'];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get the subscriptions eligibilities.
|
|
31
|
+
*
|
|
32
|
+
* @param request - Optional request object containing user balance to check cohort eligibility.
|
|
33
|
+
* @returns The subscriptions eligibilities.
|
|
34
|
+
*/
|
|
35
|
+
export type SubscriptionControllerGetSubscriptionsEligibilitiesAction = {
|
|
36
|
+
type: `SubscriptionController:getSubscriptionsEligibilities`;
|
|
37
|
+
handler: SubscriptionController['getSubscriptionsEligibilities'];
|
|
38
|
+
};
|
|
39
|
+
export type SubscriptionControllerCancelSubscriptionAction = {
|
|
40
|
+
type: `SubscriptionController:cancelSubscription`;
|
|
41
|
+
handler: SubscriptionController['cancelSubscription'];
|
|
42
|
+
};
|
|
43
|
+
export type SubscriptionControllerUnCancelSubscriptionAction = {
|
|
44
|
+
type: `SubscriptionController:unCancelSubscription`;
|
|
45
|
+
handler: SubscriptionController['unCancelSubscription'];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Starts a card-paid subscription checkout session for the requested products
|
|
49
|
+
* (e.g. Shield or Money Account Plus).
|
|
50
|
+
*
|
|
51
|
+
* `isTrialRequested` on the request is ignored and overwritten from pricing
|
|
52
|
+
* (`trialPeriodDays > 0`) and `trialedProducts`.
|
|
53
|
+
*
|
|
54
|
+
* @param request - The start subscription request.
|
|
55
|
+
* @returns The checkout session response.
|
|
56
|
+
*/
|
|
57
|
+
export type SubscriptionControllerStartSubscriptionWithCardAction = {
|
|
58
|
+
type: `SubscriptionController:startSubscriptionWithCard`;
|
|
59
|
+
handler: SubscriptionController['startSubscriptionWithCard'];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Starts a crypto-paid subscription for the requested products
|
|
63
|
+
* (e.g. Shield or Money Account Plus). Unlike card checkout, this
|
|
64
|
+
* creates the subscription immediately, so local state is refreshed
|
|
65
|
+
* afterwards.
|
|
66
|
+
*
|
|
67
|
+
* `isTrialRequested` on the request is ignored and overwritten from pricing
|
|
68
|
+
* (`trialPeriodDays > 0`) and `trialedProducts`.
|
|
69
|
+
*
|
|
70
|
+
* @param request - The start crypto subscription request.
|
|
71
|
+
* @returns The start crypto subscription response.
|
|
72
|
+
* @throws If `products` is empty.
|
|
73
|
+
*/
|
|
74
|
+
export type SubscriptionControllerStartSubscriptionWithCryptoAction = {
|
|
75
|
+
type: `SubscriptionController:startSubscriptionWithCrypto`;
|
|
76
|
+
handler: SubscriptionController['startSubscriptionWithCrypto'];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Submits a Shield ERC-20 crypto approval transaction to start or update a
|
|
80
|
+
* crypto subscription.
|
|
81
|
+
*
|
|
82
|
+
* This handler is Shield / `TransactionType.shieldSubscriptionApprove` only.
|
|
83
|
+
* Delegation-based products (e.g. Money Account) must call
|
|
84
|
+
* `startSubscriptionWithCrypto` instead.
|
|
85
|
+
*
|
|
86
|
+
* @param request - The crypto approval request.
|
|
87
|
+
* @param request.productType - The subscription product. Typed as
|
|
88
|
+
* `typeof PRODUCT_TYPES.SHIELD` only at the moment (future might support more
|
|
89
|
+
* product).
|
|
90
|
+
* @param request.txMeta - The transaction metadata. Must have type
|
|
91
|
+
* `TransactionType.shieldSubscriptionApprove`.
|
|
92
|
+
* @param request.isSponsored - Whether the transaction is sponsored.
|
|
93
|
+
* @param request.rewardAccountId - The account ID of the reward subscription
|
|
94
|
+
* to link.
|
|
95
|
+
* @throws If `productType` is not Shield or `txMeta.type` is not
|
|
96
|
+
* `shieldSubscriptionApprove`.
|
|
97
|
+
* @returns void
|
|
98
|
+
*/
|
|
99
|
+
export type SubscriptionControllerSubmitSubscriptionCryptoApprovalAction = {
|
|
100
|
+
type: `SubscriptionController:submitSubscriptionCryptoApproval`;
|
|
101
|
+
handler: SubscriptionController['submitSubscriptionCryptoApproval'];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Get transaction params to create crypto approve transaction for subscription payment
|
|
105
|
+
*
|
|
106
|
+
* @param request - The request object
|
|
107
|
+
* @param request.chainId - The chain ID
|
|
108
|
+
* @param request.tokenAddress - The address of the token
|
|
109
|
+
* @param request.productType - The product type
|
|
110
|
+
* @param request.interval - The interval
|
|
111
|
+
* @returns The crypto approve transaction params
|
|
112
|
+
*/
|
|
113
|
+
export type SubscriptionControllerGetCryptoApproveTransactionParamsAction = {
|
|
114
|
+
type: `SubscriptionController:getCryptoApproveTransactionParams`;
|
|
115
|
+
handler: SubscriptionController['getCryptoApproveTransactionParams'];
|
|
116
|
+
};
|
|
117
|
+
export type SubscriptionControllerUpdatePaymentMethodAction = {
|
|
118
|
+
type: `SubscriptionController:updatePaymentMethod`;
|
|
119
|
+
handler: SubscriptionController['updatePaymentMethod'];
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Gets the billing portal URL.
|
|
123
|
+
*
|
|
124
|
+
* @returns The billing portal URL
|
|
125
|
+
*/
|
|
126
|
+
export type SubscriptionControllerGetBillingPortalUrlAction = {
|
|
127
|
+
type: `SubscriptionController:getBillingPortalUrl`;
|
|
128
|
+
handler: SubscriptionController['getBillingPortalUrl'];
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Cache the last selected payment method for a specific product.
|
|
132
|
+
*
|
|
133
|
+
* @param request - The request object.
|
|
134
|
+
* @param request.product - The product to cache the payment method for.
|
|
135
|
+
* @param request.paymentMethod - The payment method to cache.
|
|
136
|
+
* @param request.paymentMethod.type - The type of the payment method.
|
|
137
|
+
* @param request.paymentMethod.paymentTokenAddress - The payment token address.
|
|
138
|
+
* @param request.paymentMethod.plan - The plan of the payment method.
|
|
139
|
+
*/
|
|
140
|
+
export type SubscriptionControllerCacheLastSelectedPaymentMethodAction = {
|
|
141
|
+
type: `SubscriptionController:cacheLastSelectedPaymentMethod`;
|
|
142
|
+
handler: SubscriptionController['cacheLastSelectedPaymentMethod'];
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Clear the last selected payment method for a specific product.
|
|
146
|
+
*
|
|
147
|
+
* @param product - The product to clear the payment method for.
|
|
148
|
+
*/
|
|
149
|
+
export type SubscriptionControllerClearLastSelectedPaymentMethodAction = {
|
|
150
|
+
type: `SubscriptionController:clearLastSelectedPaymentMethod`;
|
|
151
|
+
handler: SubscriptionController['clearLastSelectedPaymentMethod'];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Submit sponsorship intents to the Subscription Service backend.
|
|
155
|
+
*
|
|
156
|
+
* This is intended to be used together with the crypto subscription flow.
|
|
157
|
+
* When the user has enabled the smart transaction feature, we will sponsor the gas fees for the subscription approval transaction.
|
|
158
|
+
*
|
|
159
|
+
* @param request - Request object containing the address and products.
|
|
160
|
+
* @example {
|
|
161
|
+
* address: '0x1234567890123456789012345678901234567890',
|
|
162
|
+
* products: [ProductType.Shield],
|
|
163
|
+
* recurringInterval: RecurringInterval.Month,
|
|
164
|
+
* billingCycles: 1,
|
|
165
|
+
* }
|
|
166
|
+
* @returns resolves to true if the sponsorship is supported and intents were submitted successfully, false if the chain does not support sponsorship or the user has already trialed
|
|
167
|
+
* @throws If the crypto payment method or chain is missing from pricing
|
|
168
|
+
*/
|
|
169
|
+
export type SubscriptionControllerSubmitSponsorshipIntentsAction = {
|
|
170
|
+
type: `SubscriptionController:submitSponsorshipIntents`;
|
|
171
|
+
handler: SubscriptionController['submitSponsorshipIntents'];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Submit a user event from the UI. (e.g. shield modal viewed)
|
|
175
|
+
*
|
|
176
|
+
* @param request - Request object containing the event to submit.
|
|
177
|
+
* @example { event: SubscriptionUserEvent.ShieldEntryModalViewed, cohort: 'post_tx' }
|
|
178
|
+
*/
|
|
179
|
+
export type SubscriptionControllerSubmitUserEventAction = {
|
|
180
|
+
type: `SubscriptionController:submitUserEvent`;
|
|
181
|
+
handler: SubscriptionController['submitUserEvent'];
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Assign user to a cohort.
|
|
185
|
+
*
|
|
186
|
+
* @param request - Request object containing the cohort to assign the user to.
|
|
187
|
+
* @example { cohort: 'post_tx' }
|
|
188
|
+
*/
|
|
189
|
+
export type SubscriptionControllerAssignUserToCohortAction = {
|
|
190
|
+
type: `SubscriptionController:assignUserToCohort`;
|
|
191
|
+
handler: SubscriptionController['assignUserToCohort'];
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Link rewards to a subscription.
|
|
195
|
+
*
|
|
196
|
+
* @param request - Request object containing the reward subscription ID.
|
|
197
|
+
* @param request.subscriptionId - The ID of the subscription to link rewards to.
|
|
198
|
+
* @param request.rewardAccountId - The account ID of the reward subscription to link to the subscription.
|
|
199
|
+
* @example { subscriptionId: '1234567890', rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890' }
|
|
200
|
+
* @returns Resolves when the rewards are linked successfully.
|
|
201
|
+
*/
|
|
202
|
+
export type SubscriptionControllerLinkRewardsAction = {
|
|
203
|
+
type: `SubscriptionController:linkRewards`;
|
|
204
|
+
handler: SubscriptionController['linkRewards'];
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Calculate token approve amount from price info
|
|
208
|
+
*
|
|
209
|
+
* @param price - The price info
|
|
210
|
+
* @param tokenPaymentInfo - The token price info
|
|
211
|
+
* @returns The token approve amount
|
|
212
|
+
*/
|
|
213
|
+
export type SubscriptionControllerGetTokenApproveAmountAction = {
|
|
214
|
+
type: `SubscriptionController:getTokenApproveAmount`;
|
|
215
|
+
handler: SubscriptionController['getTokenApproveAmount'];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Calculate token minimum balance amount from price info
|
|
219
|
+
*
|
|
220
|
+
* @param price - The price info
|
|
221
|
+
* @param tokenPaymentInfo - The token price info
|
|
222
|
+
* @returns The token balance amount
|
|
223
|
+
*/
|
|
224
|
+
export type SubscriptionControllerGetTokenMinimumBalanceAmountAction = {
|
|
225
|
+
type: `SubscriptionController:getTokenMinimumBalanceAmount`;
|
|
226
|
+
handler: SubscriptionController['getTokenMinimumBalanceAmount'];
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Clears the subscription state and resets to default values.
|
|
230
|
+
*/
|
|
231
|
+
export type SubscriptionControllerClearStateAction = {
|
|
232
|
+
type: `SubscriptionController:clearState`;
|
|
233
|
+
handler: SubscriptionController['clearState'];
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Triggers an access token refresh.
|
|
237
|
+
*/
|
|
238
|
+
export type SubscriptionControllerTriggerAccessTokenRefreshAction = {
|
|
239
|
+
type: `SubscriptionController:triggerAccessTokenRefresh`;
|
|
240
|
+
handler: SubscriptionController['triggerAccessTokenRefresh'];
|
|
241
|
+
};
|
|
242
|
+
export type SubscriptionControllerStopAllPollingAction = {
|
|
243
|
+
type: `SubscriptionController:stopAllPolling`;
|
|
244
|
+
handler: SubscriptionController['stopAllPolling'];
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Union of all SubscriptionController action types.
|
|
248
|
+
*/
|
|
249
|
+
export type SubscriptionControllerMethodActions = SubscriptionControllerGetPricingAction | SubscriptionControllerGetSubscriptionsAction | SubscriptionControllerGetSubscriptionByProductAction | SubscriptionControllerGetSubscriptionsEligibilitiesAction | SubscriptionControllerCancelSubscriptionAction | SubscriptionControllerUnCancelSubscriptionAction | SubscriptionControllerStartSubscriptionWithCardAction | SubscriptionControllerStartSubscriptionWithCryptoAction | SubscriptionControllerSubmitSubscriptionCryptoApprovalAction | SubscriptionControllerGetCryptoApproveTransactionParamsAction | SubscriptionControllerUpdatePaymentMethodAction | SubscriptionControllerGetBillingPortalUrlAction | SubscriptionControllerCacheLastSelectedPaymentMethodAction | SubscriptionControllerClearLastSelectedPaymentMethodAction | SubscriptionControllerSubmitSponsorshipIntentsAction | SubscriptionControllerSubmitUserEventAction | SubscriptionControllerAssignUserToCohortAction | SubscriptionControllerLinkRewardsAction | SubscriptionControllerGetTokenApproveAmountAction | SubscriptionControllerGetTokenMinimumBalanceAmountAction | SubscriptionControllerClearStateAction | SubscriptionControllerTriggerAccessTokenRefreshAction | SubscriptionControllerStopAllPollingAction;
|
|
250
|
+
//# sourceMappingURL=SubscriptionController-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionController-method-action-types.d.mts","sourceRoot":"","sources":["../src/SubscriptionController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,qCAAoC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,sBAAsB,C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D,CAAC;IAC5D,OAAO,EAAE,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;CACjE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,sBAAsB,CAAC,2BAA2B,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,sCAAsC,GACtC,4CAA4C,GAC5C,oDAAoD,GACpD,yDAAyD,GACzD,8CAA8C,GAC9C,gDAAgD,GAChD,qDAAqD,GACrD,uDAAuD,GACvD,4DAA4D,GAC5D,6DAA6D,GAC7D,+CAA+C,GAC/C,+CAA+C,GAC/C,0DAA0D,GAC1D,0DAA0D,GAC1D,oDAAoD,GACpD,2CAA2C,GAC3C,8CAA8C,GAC9C,uCAAuC,GACvC,iDAAiD,GACjD,wDAAwD,GACxD,sCAAsC,GACtC,qDAAqD,GACrD,0CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionController-method-action-types.mjs","sourceRoot":"","sources":["../src/SubscriptionController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController.js';\n\n/**\n * Gets the pricing information from the subscription service.\n *\n * @returns The pricing information.\n */\nexport type SubscriptionControllerGetPricingAction = {\n type: `SubscriptionController:getPricing`;\n handler: SubscriptionController['getPricing'];\n};\n\nexport type SubscriptionControllerGetSubscriptionsAction = {\n type: `SubscriptionController:getSubscriptions`;\n handler: SubscriptionController['getSubscriptions'];\n};\n\n/**\n * Get the subscription by product.\n *\n * @param productType - The product type.\n * @returns The subscription.\n */\nexport type SubscriptionControllerGetSubscriptionByProductAction = {\n type: `SubscriptionController:getSubscriptionByProduct`;\n handler: SubscriptionController['getSubscriptionByProduct'];\n};\n\n/**\n * Get the subscriptions eligibilities.\n *\n * @param request - Optional request object containing user balance to check cohort eligibility.\n * @returns The subscriptions eligibilities.\n */\nexport type SubscriptionControllerGetSubscriptionsEligibilitiesAction = {\n type: `SubscriptionController:getSubscriptionsEligibilities`;\n handler: SubscriptionController['getSubscriptionsEligibilities'];\n};\n\nexport type SubscriptionControllerCancelSubscriptionAction = {\n type: `SubscriptionController:cancelSubscription`;\n handler: SubscriptionController['cancelSubscription'];\n};\n\nexport type SubscriptionControllerUnCancelSubscriptionAction = {\n type: `SubscriptionController:unCancelSubscription`;\n handler: SubscriptionController['unCancelSubscription'];\n};\n\n/**\n * Starts a card-paid subscription checkout session for the requested products\n * (e.g. Shield or Money Account Plus).\n *\n * `isTrialRequested` on the request is ignored and overwritten from pricing\n * (`trialPeriodDays > 0`) and `trialedProducts`.\n *\n * @param request - The start subscription request.\n * @returns The checkout session response.\n */\nexport type SubscriptionControllerStartSubscriptionWithCardAction = {\n type: `SubscriptionController:startSubscriptionWithCard`;\n handler: SubscriptionController['startSubscriptionWithCard'];\n};\n\n/**\n * Starts a crypto-paid subscription for the requested products\n * (e.g. Shield or Money Account Plus). Unlike card checkout, this\n * creates the subscription immediately, so local state is refreshed\n * afterwards.\n *\n * `isTrialRequested` on the request is ignored and overwritten from pricing\n * (`trialPeriodDays > 0`) and `trialedProducts`.\n *\n * @param request - The start crypto subscription request.\n * @returns The start crypto subscription response.\n * @throws If `products` is empty.\n */\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Submits a Shield ERC-20 crypto approval transaction to start or update a\n * crypto subscription.\n *\n * This handler is Shield / `TransactionType.shieldSubscriptionApprove` only.\n * Delegation-based products (e.g. Money Account) must call\n * `startSubscriptionWithCrypto` instead.\n *\n * @param request - The crypto approval request.\n * @param request.productType - The subscription product. Typed as\n * `typeof PRODUCT_TYPES.SHIELD` only at the moment (future might support more\n * product).\n * @param request.txMeta - The transaction metadata. Must have type\n * `TransactionType.shieldSubscriptionApprove`.\n * @param request.isSponsored - Whether the transaction is sponsored.\n * @param request.rewardAccountId - The account ID of the reward subscription\n * to link.\n * @throws If `productType` is not Shield or `txMeta.type` is not\n * `shieldSubscriptionApprove`.\n * @returns void\n */\nexport type SubscriptionControllerSubmitSubscriptionCryptoApprovalAction = {\n type: `SubscriptionController:submitSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitSubscriptionCryptoApproval'];\n};\n\n/**\n * Get transaction params to create crypto approve transaction for subscription payment\n *\n * @param request - The request object\n * @param request.chainId - The chain ID\n * @param request.tokenAddress - The address of the token\n * @param request.productType - The product type\n * @param request.interval - The interval\n * @returns The crypto approve transaction params\n */\nexport type SubscriptionControllerGetCryptoApproveTransactionParamsAction = {\n type: `SubscriptionController:getCryptoApproveTransactionParams`;\n handler: SubscriptionController['getCryptoApproveTransactionParams'];\n};\n\nexport type SubscriptionControllerUpdatePaymentMethodAction = {\n type: `SubscriptionController:updatePaymentMethod`;\n handler: SubscriptionController['updatePaymentMethod'];\n};\n\n/**\n * Gets the billing portal URL.\n *\n * @returns The billing portal URL\n */\nexport type SubscriptionControllerGetBillingPortalUrlAction = {\n type: `SubscriptionController:getBillingPortalUrl`;\n handler: SubscriptionController['getBillingPortalUrl'];\n};\n\n/**\n * Cache the last selected payment method for a specific product.\n *\n * @param request - The request object.\n * @param request.product - The product to cache the payment method for.\n * @param request.paymentMethod - The payment method to cache.\n * @param request.paymentMethod.type - The type of the payment method.\n * @param request.paymentMethod.paymentTokenAddress - The payment token address.\n * @param request.paymentMethod.plan - The plan of the payment method.\n */\nexport type SubscriptionControllerCacheLastSelectedPaymentMethodAction = {\n type: `SubscriptionController:cacheLastSelectedPaymentMethod`;\n handler: SubscriptionController['cacheLastSelectedPaymentMethod'];\n};\n\n/**\n * Clear the last selected payment method for a specific product.\n *\n * @param product - The product to clear the payment method for.\n */\nexport type SubscriptionControllerClearLastSelectedPaymentMethodAction = {\n type: `SubscriptionController:clearLastSelectedPaymentMethod`;\n handler: SubscriptionController['clearLastSelectedPaymentMethod'];\n};\n\n/**\n * Submit sponsorship intents to the Subscription Service backend.\n *\n * This is intended to be used together with the crypto subscription flow.\n * When the user has enabled the smart transaction feature, we will sponsor the gas fees for the subscription approval transaction.\n *\n * @param request - Request object containing the address and products.\n * @example {\n * address: '0x1234567890123456789012345678901234567890',\n * products: [ProductType.Shield],\n * recurringInterval: RecurringInterval.Month,\n * billingCycles: 1,\n * }\n * @returns resolves to true if the sponsorship is supported and intents were submitted successfully, false if the chain does not support sponsorship or the user has already trialed\n * @throws If the crypto payment method or chain is missing from pricing\n */\nexport type SubscriptionControllerSubmitSponsorshipIntentsAction = {\n type: `SubscriptionController:submitSponsorshipIntents`;\n handler: SubscriptionController['submitSponsorshipIntents'];\n};\n\n/**\n * Submit a user event from the UI. (e.g. shield modal viewed)\n *\n * @param request - Request object containing the event to submit.\n * @example { event: SubscriptionUserEvent.ShieldEntryModalViewed, cohort: 'post_tx' }\n */\nexport type SubscriptionControllerSubmitUserEventAction = {\n type: `SubscriptionController:submitUserEvent`;\n handler: SubscriptionController['submitUserEvent'];\n};\n\n/**\n * Assign user to a cohort.\n *\n * @param request - Request object containing the cohort to assign the user to.\n * @example { cohort: 'post_tx' }\n */\nexport type SubscriptionControllerAssignUserToCohortAction = {\n type: `SubscriptionController:assignUserToCohort`;\n handler: SubscriptionController['assignUserToCohort'];\n};\n\n/**\n * Link rewards to a subscription.\n *\n * @param request - Request object containing the reward subscription ID.\n * @param request.subscriptionId - The ID of the subscription to link rewards to.\n * @param request.rewardAccountId - The account ID of the reward subscription to link to the subscription.\n * @example { subscriptionId: '1234567890', rewardAccountId: 'eip155:1:0x1234567890123456789012345678901234567890' }\n * @returns Resolves when the rewards are linked successfully.\n */\nexport type SubscriptionControllerLinkRewardsAction = {\n type: `SubscriptionController:linkRewards`;\n handler: SubscriptionController['linkRewards'];\n};\n\n/**\n * Calculate token approve amount from price info\n *\n * @param price - The price info\n * @param tokenPaymentInfo - The token price info\n * @returns The token approve amount\n */\nexport type SubscriptionControllerGetTokenApproveAmountAction = {\n type: `SubscriptionController:getTokenApproveAmount`;\n handler: SubscriptionController['getTokenApproveAmount'];\n};\n\n/**\n * Calculate token minimum balance amount from price info\n *\n * @param price - The price info\n * @param tokenPaymentInfo - The token price info\n * @returns The token balance amount\n */\nexport type SubscriptionControllerGetTokenMinimumBalanceAmountAction = {\n type: `SubscriptionController:getTokenMinimumBalanceAmount`;\n handler: SubscriptionController['getTokenMinimumBalanceAmount'];\n};\n\n/**\n * Clears the subscription state and resets to default values.\n */\nexport type SubscriptionControllerClearStateAction = {\n type: `SubscriptionController:clearState`;\n handler: SubscriptionController['clearState'];\n};\n\n/**\n * Triggers an access token refresh.\n */\nexport type SubscriptionControllerTriggerAccessTokenRefreshAction = {\n type: `SubscriptionController:triggerAccessTokenRefresh`;\n handler: SubscriptionController['triggerAccessTokenRefresh'];\n};\n\nexport type SubscriptionControllerStopAllPollingAction = {\n type: `SubscriptionController:stopAllPolling`;\n handler: SubscriptionController['stopAllPolling'];\n};\n\n/**\n * Union of all SubscriptionController action types.\n */\nexport type SubscriptionControllerMethodActions =\n | SubscriptionControllerGetPricingAction\n | SubscriptionControllerGetSubscriptionsAction\n | SubscriptionControllerGetSubscriptionByProductAction\n | SubscriptionControllerGetSubscriptionsEligibilitiesAction\n | SubscriptionControllerCancelSubscriptionAction\n | SubscriptionControllerUnCancelSubscriptionAction\n | SubscriptionControllerStartSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitSubscriptionCryptoApprovalAction\n | SubscriptionControllerGetCryptoApproveTransactionParamsAction\n | SubscriptionControllerUpdatePaymentMethodAction\n | SubscriptionControllerGetBillingPortalUrlAction\n | SubscriptionControllerCacheLastSelectedPaymentMethodAction\n | SubscriptionControllerClearLastSelectedPaymentMethodAction\n | SubscriptionControllerSubmitSponsorshipIntentsAction\n | SubscriptionControllerSubmitUserEventAction\n | SubscriptionControllerAssignUserToCohortAction\n | SubscriptionControllerLinkRewardsAction\n | SubscriptionControllerGetTokenApproveAmountAction\n | SubscriptionControllerGetTokenMinimumBalanceAmountAction\n | SubscriptionControllerClearStateAction\n | SubscriptionControllerTriggerAccessTokenRefreshAction\n | SubscriptionControllerStopAllPollingAction;\n"]}
|