@metamask-previews/subscription-controller 6.0.2-preview-74da211 → 6.0.2-preview-3047a7f

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,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * This file is auto generated by `@metamask/messenger/generate-action-types`.
3
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
4
4
  * Do not edit manually.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +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 by `@metamask/messenger/generate-action-types`.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController';\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\nexport type SubscriptionControllerStartShieldSubscriptionWithCardAction = {\n type: `SubscriptionController:startShieldSubscriptionWithCard`;\n handler: SubscriptionController['startShieldSubscriptionWithCard'];\n};\n\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Handles shield subscription crypto approval transactions.\n *\n * @param txMeta - The transaction metadata.\n * @param isSponsored - Whether the transaction is sponsored.\n * @param rewardAccountId - The account ID of the reward subscription to link to the shield subscription.\n * @returns void\n */\nexport type SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction =\n {\n type: `SubscriptionController:submitShieldSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitShieldSubscriptionCryptoApproval'];\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 product - The product to cache the payment method for.\n * @param paymentMethod - The payment method to cache.\n * @param paymentMethod.type - The type of the payment method.\n * @param paymentMethod.paymentTokenAddress - The payment token address.\n * @param paymentMethod.plan - The plan of the payment method.\n * @param paymentMethod.product - The product 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 otherwise\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\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 | SubscriptionControllerStartShieldSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction\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"]}
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 by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController';\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\nexport type SubscriptionControllerStartShieldSubscriptionWithCardAction = {\n type: `SubscriptionController:startShieldSubscriptionWithCard`;\n handler: SubscriptionController['startShieldSubscriptionWithCard'];\n};\n\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Handles shield subscription crypto approval transactions.\n *\n * @param txMeta - The transaction metadata.\n * @param isSponsored - Whether the transaction is sponsored.\n * @param rewardAccountId - The account ID of the reward subscription to link to the shield subscription.\n * @returns void\n */\nexport type SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction =\n {\n type: `SubscriptionController:submitShieldSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitShieldSubscriptionCryptoApproval'];\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 product - The product to cache the payment method for.\n * @param paymentMethod - The payment method to cache.\n * @param paymentMethod.type - The type of the payment method.\n * @param paymentMethod.paymentTokenAddress - The payment token address.\n * @param paymentMethod.plan - The plan of the payment method.\n * @param paymentMethod.product - The product 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 otherwise\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\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 | SubscriptionControllerStartShieldSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction\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"]}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file is auto generated by `@metamask/messenger/generate-action-types`.
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { SubscriptionController } from "./SubscriptionController.cjs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file is auto generated by `@metamask/messenger/generate-action-types`.
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { SubscriptionController } from "./SubscriptionController.mjs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file is auto generated by `@metamask/messenger/generate-action-types`.
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
@@ -1 +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 by `@metamask/messenger/generate-action-types`.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController';\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\nexport type SubscriptionControllerStartShieldSubscriptionWithCardAction = {\n type: `SubscriptionController:startShieldSubscriptionWithCard`;\n handler: SubscriptionController['startShieldSubscriptionWithCard'];\n};\n\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Handles shield subscription crypto approval transactions.\n *\n * @param txMeta - The transaction metadata.\n * @param isSponsored - Whether the transaction is sponsored.\n * @param rewardAccountId - The account ID of the reward subscription to link to the shield subscription.\n * @returns void\n */\nexport type SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction =\n {\n type: `SubscriptionController:submitShieldSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitShieldSubscriptionCryptoApproval'];\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 product - The product to cache the payment method for.\n * @param paymentMethod - The payment method to cache.\n * @param paymentMethod.type - The type of the payment method.\n * @param paymentMethod.paymentTokenAddress - The payment token address.\n * @param paymentMethod.plan - The plan of the payment method.\n * @param paymentMethod.product - The product 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 otherwise\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\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 | SubscriptionControllerStartShieldSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction\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"]}
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 by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { SubscriptionController } from './SubscriptionController';\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\nexport type SubscriptionControllerStartShieldSubscriptionWithCardAction = {\n type: `SubscriptionController:startShieldSubscriptionWithCard`;\n handler: SubscriptionController['startShieldSubscriptionWithCard'];\n};\n\nexport type SubscriptionControllerStartSubscriptionWithCryptoAction = {\n type: `SubscriptionController:startSubscriptionWithCrypto`;\n handler: SubscriptionController['startSubscriptionWithCrypto'];\n};\n\n/**\n * Handles shield subscription crypto approval transactions.\n *\n * @param txMeta - The transaction metadata.\n * @param isSponsored - Whether the transaction is sponsored.\n * @param rewardAccountId - The account ID of the reward subscription to link to the shield subscription.\n * @returns void\n */\nexport type SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction =\n {\n type: `SubscriptionController:submitShieldSubscriptionCryptoApproval`;\n handler: SubscriptionController['submitShieldSubscriptionCryptoApproval'];\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 product - The product to cache the payment method for.\n * @param paymentMethod - The payment method to cache.\n * @param paymentMethod.type - The type of the payment method.\n * @param paymentMethod.paymentTokenAddress - The payment token address.\n * @param paymentMethod.plan - The plan of the payment method.\n * @param paymentMethod.product - The product 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 otherwise\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\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 | SubscriptionControllerStartShieldSubscriptionWithCardAction\n | SubscriptionControllerStartSubscriptionWithCryptoAction\n | SubscriptionControllerSubmitShieldSubscriptionCryptoApprovalAction\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/subscription-controller",
3
- "version": "6.0.2-preview-74da211",
3
+ "version": "6.0.2-preview-3047a7f",
4
4
  "description": "Handle user subscription",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -40,7 +40,7 @@
40
40
  "build:docs": "typedoc",
41
41
  "changelog:update": "../../scripts/update-changelog.sh @metamask/subscription-controller",
42
42
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/subscription-controller",
43
- "generate-method-action-types": "tsx ../../packages/messenger/src/generate-action-types/cli.ts",
43
+ "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.ts",
44
44
  "since-latest-release": "../../scripts/since-latest-release.sh",
45
45
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
46
46
  "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",