@metamask/subscription-controller 12.0.1 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/dist/SubscriptionController-method-action-types.d.ts +14 -4
  3. package/dist/SubscriptionController-method-action-types.d.ts.map +1 -1
  4. package/dist/SubscriptionController-method-action-types.js.map +1 -1
  5. package/dist/SubscriptionController.d.ts +16 -5
  6. package/dist/SubscriptionController.d.ts.map +1 -1
  7. package/dist/SubscriptionController.js +61 -16
  8. package/dist/SubscriptionController.js.map +1 -1
  9. package/dist/SubscriptionService-structs.d.ts +36 -36
  10. package/dist/SubscriptionService-structs.js +4 -4
  11. package/dist/SubscriptionService-structs.js.map +1 -1
  12. package/dist/constants.d.ts +6 -2
  13. package/dist/constants.d.ts.map +1 -1
  14. package/dist/constants.js +39 -2
  15. package/dist/constants.js.map +1 -1
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts +9 -14
  21. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts.map +1 -1
  22. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.js.map +1 -1
  23. package/dist/subscription-delegation/SubscriptionDelegationService.d.ts +11 -17
  24. package/dist/subscription-delegation/SubscriptionDelegationService.d.ts.map +1 -1
  25. package/dist/subscription-delegation/SubscriptionDelegationService.js +35 -107
  26. package/dist/subscription-delegation/SubscriptionDelegationService.js.map +1 -1
  27. package/dist/subscription-delegation/types.d.ts +0 -21
  28. package/dist/subscription-delegation/types.d.ts.map +1 -1
  29. package/dist/subscription-delegation/types.js +0 -1
  30. package/dist/subscription-delegation/types.js.map +1 -1
  31. package/dist/types.d.ts +18 -4
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/types.js.map +1 -1
  34. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionService-structs.js","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9D,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACzE,MAAM,wBAAwB,GAAG,IAAI,CAAC;IACpC,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;IACtC,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE;CAC3C,CAAC,CAAC;AACH,MAAM,8BAA8B,GAAG,IAAI,CAAC;IAC1C,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE;IAC9C,CAAC,mBAAmB,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE;IAC/C,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE;IAC9C,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE;CAC5C,CAAC,CAAC;AACH,MAAM,yBAAyB,GAAG,IAAI,CAAC;IACrC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,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AAC,YAAY,CAAC,CAAC;IACtC,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC9B,wBAAwB,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,CACrD,6BAA6B,CAC9B,CAAC","sourcesContent":["import {\n array,\n boolean,\n enums,\n lazy,\n never,\n nullable,\n number,\n optional,\n string,\n type,\n union,\n} from '@metamask/superstruct';\nimport type { Struct } from '@metamask/superstruct';\nimport { StrictHexStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport {\n CANCEL_TYPES,\n CRYPTO_AUTH_METHODS,\n CRYPTO_PAYMENT_ERRORS,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n PAYMENT_TYPES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n MoneyAccountFeature,\n ShieldFeature,\n SUBSCRIPTION_STATUSES,\n} from './types.js';\nimport type { TokenPaymentInfo } from './types.js';\n\nconst ProductTypeStruct = enums(Object.values(PRODUCT_TYPES));\nconst CryptoAuthMethodStruct = enums(Object.values(CRYPTO_AUTH_METHODS));\nconst ShieldEntitlementsStruct = type({\n [ShieldFeature.ShieldClaim]: boolean(),\n [ShieldFeature.PrioritySupport]: boolean(),\n});\nconst MoneyAccountEntitlementsStruct = type({\n [MoneyAccountFeature.SwapFeeWaiver]: boolean(),\n [MoneyAccountFeature.PerpsFeeWaiver]: boolean(),\n [MoneyAccountFeature.PredictFreeTx]: boolean(),\n [MoneyAccountFeature.PremiumApy]: boolean(),\n});\nconst ProductEntitlementsStruct = type({\n [PRODUCT_TYPES.SHIELD]: optional(\n type({\n entitlements: ShieldEntitlementsStruct,\n }),\n ),\n [PRODUCT_TYPES.MONEY_ACCOUNT_PLUS]: optional(\n type({\n plan: string(),\n entitlements: MoneyAccountEntitlementsStruct,\n }),\n ),\n});\nconst RecurringIntervalStruct = enums(Object.values(RECURRING_INTERVALS));\nconst SubscriptionStatusStruct = enums(Object.values(SUBSCRIPTION_STATUSES));\nconst InvoicePaymentStatusStruct = enums(\n Object.values(INVOICE_PAYMENT_STATUSES),\n);\nconst CancelTypeStruct = enums(Object.values(CANCEL_TYPES));\nconst CryptoPaymentMethodErrorStruct = enums(\n Object.values(CRYPTO_PAYMENT_METHOD_ERRORS),\n);\nconst CryptoPaymentErrorStruct = enums(Object.values(CRYPTO_PAYMENT_ERRORS));\n\nconst ProductStruct = type({\n name: ProductTypeStruct,\n currency: enums(['usd']),\n unitAmount: number(),\n unitDecimals: number(),\n});\n\nconst SubscriptionCardPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCard]),\n card: type({\n brand: string(),\n displayBrand: optional(string()),\n last4: string(),\n }),\n});\n\nconst SubscriptionCryptoPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n crypto: type({\n payerAddress: StrictHexStruct,\n chainId: StrictHexStruct,\n tokenSymbol: string(),\n error: optional(CryptoPaymentMethodErrorStruct),\n }),\n});\n\nconst SubscriptionPaymentMethodStruct = union([\n SubscriptionCardPaymentMethodStruct,\n SubscriptionCryptoPaymentMethodStruct,\n]);\n\nexport const SubscriptionStruct = type({\n id: string(),\n products: array(ProductStruct),\n currentPeriodStart: optional(string()),\n currentPeriodEnd: optional(string()),\n cancelAtPeriodEnd: optional(boolean()),\n status: SubscriptionStatusStruct,\n interval: RecurringIntervalStruct,\n paymentMethod: SubscriptionPaymentMethodStruct,\n trialPeriodDays: optional(number()),\n trialStart: optional(string()),\n trialEnd: optional(string()),\n endDate: optional(string()),\n canceledAt: optional(string()),\n cancelType: optional(CancelTypeStruct),\n inactiveAt: optional(string()),\n isEligibleForSupport: optional(boolean()),\n billingCycles: optional(number()),\n lastInvoice: optional(\n type({\n id: string(),\n status: InvoicePaymentStatusStruct,\n errorCode: optional(CryptoPaymentErrorStruct),\n updatedAt: optional(string()),\n }),\n ),\n});\n\nexport const GetSubscriptionsResponseStruct = type({\n customerId: optional(string()),\n subscriptions: array(SubscriptionStruct),\n trialedProducts: array(ProductTypeStruct),\n productEntitlements: optional(ProductEntitlementsStruct),\n lastSubscription: optional(SubscriptionStruct),\n rewardAccountId: optional(CaipAccountIdStruct),\n});\n\nconst SwapsBenefitUsageStruct = type({\n feeBips: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PerpsBenefitUsageStruct = type({\n builderFeeBips: nullable(string()),\n builderCode: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PredictBenefitUsageStruct = type({\n builderCode: nullable(string()),\n capTxCount: optional(number()),\n consumedTxCount: optional(number()),\n remainingTxCount: nullable(number()),\n exhausted: boolean(),\n});\n\nexport const SubscriptionBenefitsResponseStruct = type({\n eligible: boolean(),\n billingPeriodId: nullable(string()),\n products: type({\n swaps: SwapsBenefitUsageStruct,\n perps: PerpsBenefitUsageStruct,\n predict: PredictBenefitUsageStruct,\n }),\n});\n\nexport const StartSubscriptionResponseStruct = type({\n checkoutSessionUrl: string(),\n});\n\nexport const UpdatePaymentMethodCardResponseStruct = type({\n redirectUrl: string(),\n});\n\nexport const BillingPortalResponseStruct = type({\n url: string(),\n});\n\nexport const SubscriptionApiGeneralResponseStruct = type({\n success: boolean(),\n message: optional(string()),\n});\n\nconst ProductPriceStruct = type({\n interval: RecurringIntervalStruct,\n unitAmount: number(),\n unitDecimals: number(),\n currency: enums(['usd']),\n trialPeriodDays: number(),\n minBillingCycles: number(),\n minBillingCyclesForBalance: number(),\n});\n\nconst ProductPricingStruct = type({\n name: ProductTypeStruct,\n prices: array(ProductPriceStruct),\n});\n\nconst TokenPaymentInfoConversionRateStruct = type({\n usd: string(),\n});\n\n/**\n * A settlement token, discriminated by the presence of `accountantAddress`.\n *\n * Both variants use `type` rather than `object` so that fields the API adds\n * later pass through instead of failing the whole union — an exact struct here\n * turns any additive pricing change into a hard `getPricing` failure. The\n * mutually exclusive fields are still pinned with `optional(never())` on the\n * spot variant, so a vault share cannot silently validate as a spot token and\n * get valued at face value.\n *\n * `type` infers an index signature rather than a concrete shape, so the\n * inferred struct type has to be widened through `unknown` before it can be\n * pinned to `TokenPaymentInfo`. The declared type is the contract; the runtime\n * checks above are what enforce it.\n */\nconst TokenPaymentInfoStruct: Struct<TokenPaymentInfo> = lazy(() =>\n union([\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: StrictHexStruct,\n vault: optional(string()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: optional(never()),\n vault: optional(never()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n ]),\n);\n\nconst ChainPaymentInfoStruct = type({\n chainId: StrictHexStruct,\n paymentAddress: StrictHexStruct,\n delegateAddress: optional(StrictHexStruct),\n tokens: array(TokenPaymentInfoStruct),\n isSponsorshipSupported: optional(boolean()),\n});\n\n/**\n * A pricing payment-method row, discriminated by `type`.\n *\n * `type` rather than `object` for the same reason as\n * {@link TokenPaymentInfoStruct}: new fields on a row must not fail the union.\n * The crypto-only fields stay pinned with `optional(never())` on the card\n * variant so a card row carrying `chains` is still rejected.\n */\nconst PricingPaymentMethodStruct = union([\n type({\n type: enums([PAYMENT_TYPES.byCard]),\n products: optional(array(ProductTypeStruct)),\n cryptoAuthMethod: optional(never()),\n chains: optional(never()),\n }),\n type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n cryptoAuthMethod: optional(CryptoAuthMethodStruct),\n products: optional(array(ProductTypeStruct)),\n chains: optional(array(ChainPaymentInfoStruct)),\n }),\n]);\n\nexport const PricingResponseStruct = type({\n products: array(ProductPricingStruct),\n paymentMethods: array(PricingPaymentMethodStruct),\n});\n\nconst CohortStruct = type({\n cohort: string(),\n eligibilityRate: number(),\n priority: number(),\n eligible: boolean(),\n});\n\nexport const SubscriptionEligibilityStruct = type({\n product: ProductTypeStruct,\n canSubscribe: optional(boolean()),\n canViewEntryModal: optional(boolean()),\n modalType: optional(enums(['A', 'B'])),\n cohorts: optional(array(CohortStruct)),\n assignedCohort: optional(nullable(string())),\n assignedAt: optional(string()),\n hasAssignedCohortExpired: optional(boolean()),\n});\n\nexport const SubscriptionEligibilityArrayStruct = array(\n SubscriptionEligibilityStruct,\n);\n"]}
1
+ {"version":3,"file":"SubscriptionService-structs.js","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9D,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACzE,MAAM,wBAAwB,GAAG,IAAI,CAAC;IACpC,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;IACtC,CAAC,aAAa,CAAC,e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Q,EAAE,OAAO,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;IAChD,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACjC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACtC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACtC,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC9B,wBAAwB,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,CACrD,6BAA6B,CAC9B,CAAC","sourcesContent":["import {\n array,\n boolean,\n enums,\n lazy,\n never,\n nullable,\n number,\n optional,\n string,\n type,\n union,\n} from '@metamask/superstruct';\nimport type { Struct } from '@metamask/superstruct';\nimport { StrictHexStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport {\n CANCEL_TYPES,\n CRYPTO_AUTH_METHODS,\n CRYPTO_PAYMENT_ERRORS,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n PAYMENT_TYPES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n MoneyAccountFeature,\n ShieldFeature,\n SUBSCRIPTION_STATUSES,\n} from './types.js';\nimport type { TokenPaymentInfo } from './types.js';\n\nconst ProductTypeStruct = enums(Object.values(PRODUCT_TYPES));\nconst CryptoAuthMethodStruct = enums(Object.values(CRYPTO_AUTH_METHODS));\nconst ShieldEntitlementsStruct = type({\n [ShieldFeature.ShieldClaim]: boolean(),\n [ShieldFeature.PrioritySupport]: boolean(),\n});\nconst MoneyAccountEntitlementsStruct = type({\n [MoneyAccountFeature.SwapFeeWaiver]: boolean(),\n [MoneyAccountFeature.PerpsFeeWaiver]: boolean(),\n [MoneyAccountFeature.PredictFreeTx]: boolean(),\n [MoneyAccountFeature.PremiumApy]: boolean(),\n});\nconst ProductEntitlementsStruct = type({\n [PRODUCT_TYPES.SHIELD]: optional(\n type({\n entitlements: ShieldEntitlementsStruct,\n }),\n ),\n [PRODUCT_TYPES.MONEY_ACCOUNT_PLUS]: optional(\n type({\n plan: string(),\n entitlements: MoneyAccountEntitlementsStruct,\n }),\n ),\n});\nconst RecurringIntervalStruct = enums(Object.values(RECURRING_INTERVALS));\nconst SubscriptionStatusStruct = enums(Object.values(SUBSCRIPTION_STATUSES));\nconst InvoicePaymentStatusStruct = enums(\n Object.values(INVOICE_PAYMENT_STATUSES),\n);\nconst CancelTypeStruct = enums(Object.values(CANCEL_TYPES));\nconst CryptoPaymentMethodErrorStruct = enums(\n Object.values(CRYPTO_PAYMENT_METHOD_ERRORS),\n);\nconst CryptoPaymentErrorStruct = enums(Object.values(CRYPTO_PAYMENT_ERRORS));\n\nconst ProductStruct = type({\n name: ProductTypeStruct,\n currency: enums(['usd']),\n unitAmount: number(),\n unitDecimals: number(),\n});\n\nconst SubscriptionCardPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCard]),\n card: type({\n brand: string(),\n displayBrand: optional(string()),\n last4: string(),\n }),\n});\n\nconst SubscriptionCryptoPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n crypto: type({\n payerAddress: StrictHexStruct,\n chainId: StrictHexStruct,\n tokenSymbol: string(),\n error: optional(CryptoPaymentMethodErrorStruct),\n }),\n});\n\nconst SubscriptionPaymentMethodStruct = union([\n SubscriptionCardPaymentMethodStruct,\n SubscriptionCryptoPaymentMethodStruct,\n]);\n\nexport const SubscriptionStruct = type({\n id: string(),\n products: array(ProductStruct),\n currentPeriodStart: string(),\n currentPeriodEnd: string(),\n cancelAtPeriodEnd: optional(boolean()),\n status: SubscriptionStatusStruct,\n interval: RecurringIntervalStruct,\n paymentMethod: SubscriptionPaymentMethodStruct,\n trialPeriodDays: optional(number()),\n trialStart: optional(string()),\n trialEnd: optional(string()),\n endDate: optional(string()),\n canceledAt: optional(string()),\n cancelType: CancelTypeStruct,\n inactiveAt: optional(string()),\n isEligibleForSupport: boolean(),\n billingCycles: optional(number()),\n lastInvoice: optional(\n type({\n id: string(),\n status: InvoicePaymentStatusStruct,\n errorCode: optional(CryptoPaymentErrorStruct),\n updatedAt: optional(string()),\n }),\n ),\n});\n\nexport const GetSubscriptionsResponseStruct = type({\n customerId: optional(string()),\n subscriptions: array(SubscriptionStruct),\n trialedProducts: array(ProductTypeStruct),\n productEntitlements: optional(ProductEntitlementsStruct),\n lastSubscription: optional(SubscriptionStruct),\n rewardAccountId: optional(CaipAccountIdStruct),\n});\n\nconst SwapsBenefitUsageStruct = type({\n feeBips: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PerpsBenefitUsageStruct = type({\n builderFeeBips: nullable(string()),\n builderCode: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PredictBenefitUsageStruct = type({\n builderCode: nullable(string()),\n capTxCount: optional(number()),\n consumedTxCount: optional(number()),\n remainingTxCount: nullable(number()),\n exhausted: boolean(),\n});\n\nexport const SubscriptionBenefitsResponseStruct = type({\n eligible: boolean(),\n billingPeriodId: nullable(string()),\n products: type({\n swaps: SwapsBenefitUsageStruct,\n perps: PerpsBenefitUsageStruct,\n predict: PredictBenefitUsageStruct,\n }),\n});\n\nexport const StartSubscriptionResponseStruct = type({\n checkoutSessionUrl: string(),\n});\n\nexport const UpdatePaymentMethodCardResponseStruct = type({\n redirectUrl: string(),\n});\n\nexport const BillingPortalResponseStruct = type({\n url: string(),\n});\n\nexport const SubscriptionApiGeneralResponseStruct = type({\n success: boolean(),\n message: optional(string()),\n});\n\nconst ProductPriceStruct = type({\n interval: RecurringIntervalStruct,\n unitAmount: number(),\n unitDecimals: number(),\n currency: enums(['usd']),\n trialPeriodDays: number(),\n minBillingCycles: number(),\n minBillingCyclesForBalance: number(),\n});\n\nconst ProductPricingStruct = type({\n name: ProductTypeStruct,\n prices: array(ProductPriceStruct),\n});\n\nconst TokenPaymentInfoConversionRateStruct = type({\n usd: string(),\n});\n\n/**\n * A settlement token, discriminated by the presence of `accountantAddress`.\n *\n * Both variants use `type` rather than `object` so that fields the API adds\n * later pass through instead of failing the whole union — an exact struct here\n * turns any additive pricing change into a hard `getPricing` failure. The\n * mutually exclusive fields are still pinned with `optional(never())` on the\n * spot variant, so a vault share cannot silently validate as a spot token and\n * get valued at face value.\n *\n * `type` infers an index signature rather than a concrete shape, so the\n * inferred struct type has to be widened through `unknown` before it can be\n * pinned to `TokenPaymentInfo`. The declared type is the contract; the runtime\n * checks above are what enforce it.\n */\nconst TokenPaymentInfoStruct: Struct<TokenPaymentInfo> = lazy(() =>\n union([\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: StrictHexStruct,\n vault: optional(string()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: optional(never()),\n vault: optional(never()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n ]),\n);\n\nconst ChainPaymentInfoStruct = type({\n chainId: StrictHexStruct,\n paymentAddress: StrictHexStruct,\n delegateAddress: optional(StrictHexStruct),\n tokens: array(TokenPaymentInfoStruct),\n isSponsorshipSupported: optional(boolean()),\n});\n\n/**\n * A pricing payment-method row, discriminated by `type`.\n *\n * `type` rather than `object` for the same reason as\n * {@link TokenPaymentInfoStruct}: new fields on a row must not fail the union.\n * The crypto-only fields stay pinned with `optional(never())` on the card\n * variant so a card row carrying `chains` is still rejected.\n */\nconst PricingPaymentMethodStruct = union([\n type({\n type: enums([PAYMENT_TYPES.byCard]),\n products: optional(array(ProductTypeStruct)),\n cryptoAuthMethod: optional(never()),\n chains: optional(never()),\n }),\n type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n cryptoAuthMethod: optional(CryptoAuthMethodStruct),\n products: optional(array(ProductTypeStruct)),\n chains: optional(array(ChainPaymentInfoStruct)),\n }),\n]);\n\nexport const PricingResponseStruct = type({\n products: array(ProductPricingStruct),\n paymentMethods: array(PricingPaymentMethodStruct),\n});\n\nconst CohortStruct = type({\n cohort: string(),\n eligibilityRate: number(),\n priority: number(),\n eligible: boolean(),\n});\n\nexport const SubscriptionEligibilityStruct = type({\n product: ProductTypeStruct,\n canSubscribe: optional(boolean()),\n canViewEntryModal: optional(boolean()),\n modalType: optional(enums(['A', 'B'])),\n cohorts: optional(array(CohortStruct)),\n assignedCohort: optional(nullable(string())),\n assignedAt: optional(string()),\n hasAssignedCohortExpired: optional(boolean()),\n});\n\nexport const SubscriptionEligibilityArrayStruct = array(\n SubscriptionEligibilityStruct,\n);\n"]}
@@ -72,13 +72,17 @@ export declare enum SubscriptionDelegationServiceErrorMessage {
72
72
  ChompMissingDelegationHash = "CHOMP verify response did not include a delegation hash",
73
73
  ChompDelegationHashMismatch = "CHOMP verify response delegation hash does not match the locally computed hash",
74
74
  ChainMismatch = "Subscription delegation chain does not match the Money Account chain",
75
- ApprovalResultMissing = "Subscription delegation approval result is missing",
76
- InvalidFundingTransactionHash = "Subscription funding transaction hash is invalid",
77
75
  ReusableDelegationInvalid = "Reusable subscription delegation is missing or invalid",
78
76
  TrialEligibilityChanged = "Subscription trial eligibility changed after authorization",
79
77
  ChompIntentNotActive = "CHOMP subscription intent is not active"
80
78
  }
81
79
  export declare const DEFAULT_POLLING_INTERVAL: number;
82
80
  export declare const ACTIVE_SUBSCRIPTION_STATUSES: string[];
81
+ /**
82
+ * ISO 3166-1 alpha-2 country codes eligible for refund (EU 27 + EEA).
83
+ *
84
+ * Used to set `isEligibleForRefund` when starting a subscription.
85
+ */
86
+ export declare const REFUND_ELIGIBLE_COUNTRIES: ReadonlySet<string>;
83
87
  export {};
84
88
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,oBAAoB;aAE/B,aAAa,EAAE,eAAe;aAE9B,kBAAkB,EAAE,oBAAoB;aAExC,wBAAwB,EAAE,0BAA0B;aAEpD,sBAAsB,EAAE,wBAAwB;aAEhD,oBAAoB,EAAE,sBAAsB;aAE5C,KAAK,EAAE,OAAO;CACN,CAAC;AAEX,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,KAAK,YAAY,GAAG;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAcF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAKjD;AAED,oBAAY,kCAAkC;IAC5C,qBAAqB,wDAAmD;IACxE,iBAAiB,oDAA+C;IAChE,yBAAyB,yEAAoE;IAC7F,6CAA6C,8FAAyF;IACtI,sBAAsB,0DAAqD;IAC3E,oBAAoB,qDAAgD;IACpE,qCAAqC,2EAAsE;IAC3G,mCAAmC,sGAAiG;IACpI,iBAAiB,oDAA+C;CACjE;AAED,oBAAY,+BAA+B;IACzC,wBAAwB,gCAAgC;IACxD,mBAAmB,2BAA2B;IAC9C,0BAA0B,kCAAkC;IAC5D,4BAA4B,oCAAoC;IAChE,iCAAiC,2CAA2C;IAC5E,mCAAmC,6CAA6C;IAChF,sBAAsB,+GAA+G;IACrI,+BAA+B,y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O,MAAM,wBAAwB,QAAiB,CAAC;AAEvD,eAAO,MAAM,4BAA4B,EAIpC,MAAM,EAAE,CAAC;AAEd;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAiCxD,CAAC"}
package/dist/constants.js CHANGED
@@ -96,8 +96,6 @@ export var SubscriptionDelegationServiceErrorMessage;
96
96
  SubscriptionDelegationServiceErrorMessage["ChompMissingDelegationHash"] = "CHOMP verify response did not include a delegation hash";
97
97
  SubscriptionDelegationServiceErrorMessage["ChompDelegationHashMismatch"] = "CHOMP verify response delegation hash does not match the locally computed hash";
98
98
  SubscriptionDelegationServiceErrorMessage["ChainMismatch"] = "Subscription delegation chain does not match the Money Account chain";
99
- SubscriptionDelegationServiceErrorMessage["ApprovalResultMissing"] = "Subscription delegation approval result is missing";
100
- SubscriptionDelegationServiceErrorMessage["InvalidFundingTransactionHash"] = "Subscription funding transaction hash is invalid";
101
99
  SubscriptionDelegationServiceErrorMessage["ReusableDelegationInvalid"] = "Reusable subscription delegation is missing or invalid";
102
100
  SubscriptionDelegationServiceErrorMessage["TrialEligibilityChanged"] = "Subscription trial eligibility changed after authorization";
103
101
  SubscriptionDelegationServiceErrorMessage["ChompIntentNotActive"] = "CHOMP subscription intent is not active";
@@ -108,4 +106,43 @@ export const ACTIVE_SUBSCRIPTION_STATUSES = [
108
106
  SUBSCRIPTION_STATUSES.trialing,
109
107
  SUBSCRIPTION_STATUSES.provisional,
110
108
  ];
109
+ /**
110
+ * ISO 3166-1 alpha-2 country codes eligible for refund (EU 27 + EEA).
111
+ *
112
+ * Used to set `isEligibleForRefund` when starting a subscription.
113
+ */
114
+ export const REFUND_ELIGIBLE_COUNTRIES = new Set([
115
+ // EU 27
116
+ 'AT',
117
+ 'BE',
118
+ 'BG',
119
+ 'HR',
120
+ 'CY',
121
+ 'CZ',
122
+ 'DK',
123
+ 'EE',
124
+ 'FI',
125
+ 'FR',
126
+ 'DE',
127
+ 'GR',
128
+ 'HU',
129
+ 'IE',
130
+ 'IT',
131
+ 'LV',
132
+ 'LT',
133
+ 'LU',
134
+ 'MT',
135
+ 'NL',
136
+ 'PL',
137
+ 'PT',
138
+ 'RO',
139
+ 'SK',
140
+ 'SI',
141
+ 'ES',
142
+ 'SE',
143
+ // EEA (non-EU)
144
+ 'IS',
145
+ 'LI',
146
+ 'NO',
147
+ ]);
111
148
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,6BAA6B;IAC7B,aAAa,EAAE,eAAe;IAC9B,8BAA8B;IAC9B,kBAAkB,EAAE,oBAAoB;IACxC,uCAAuC;IACvC,wBAAwB,EAAE,0BAA0B;IACpD,wBAAwB;IACxB,sBAAsB,EAAE,wBAAwB;IAChD,uBAAuB;IACvB,oBAAoB,EAAE,sBAAsB;IAC5C,QAAQ;IACR,KAAK,EAAE,OAAO;CACN,CAAC;AAEX,MAAM,CAAN,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,KAAH,GAAG,QAId;AAMD,MAAM,QAAQ,GAA8B;IAC1C,GAAG,EAAE;QACH,kBAAkB,EAAE,6CAA6C;KAClE;IACD,GAAG,EAAE;QACH,kBAAkB,EAAE,6CAA6C;KAClE;IACD,GAAG,EAAE;QACH,kBAAkB,EAAE,yCAAyC;KAC9D;CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,mC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AkF,CAAA;IAClF,iIAAoF,CAAA;IACpF,mIAAsF,CAAA;IACtF,6GAAgE,CAAA;AAClE,CAAC,EAtBW,yCAAyC,KAAzC,yCAAyC,QAsBpD;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,YAAY;AAEpE,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,qBAAqB,CAAC,MAAM;IAC5B,qBAAqB,CAAC,QAAQ;IAC9B,qBAAqB,CAAC,WAAW;CACtB,CAAC","sourcesContent":["import { SUBSCRIPTION_STATUSES } from './types.js';\n\nexport const controllerName = 'SubscriptionController';\n\n/**\n * API cancellation reason values and their client-facing text.\n */\nexport const CANCELLATION_REASONS = {\n // Costs more than it's worth\n TOO_EXPENSIVE: 'too_expensive',\n // I wasn't using the benefits\n NOT_USING_BENEFITS: 'not_using_benefits',\n // The benefits weren't what I expected\n BENEFITS_NOT_AS_EXPECTED: 'benefits_not_as_expected',\n // Something didn't work\n SOMETHING_DID_NOT_WORK: 'something_did_not_work',\n // Unhappy with support\n UNHAPPY_WITH_SUPPORT: 'unhappy_with_support',\n // Other\n OTHER: 'other',\n} as const;\n\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\ntype EnvUrlsEntry = {\n subscriptionApiUrl: string;\n};\n\nconst ENV_URLS: Record<Env, EnvUrlsEntry> = {\n dev: {\n subscriptionApiUrl: 'https://subscription.dev-api.cx.metamask.io',\n },\n uat: {\n subscriptionApiUrl: 'https://subscription.uat-api.cx.metamask.io',\n },\n prd: {\n subscriptionApiUrl: 'https://subscription.api.cx.metamask.io',\n },\n};\n\n/**\n * Validates and returns correct environment endpoints\n *\n * @param env - environment field\n * @returns the correct environment url\n * @throws on invalid environment passed\n */\nexport function getEnvUrls(env: Env): EnvUrlsEntry {\n if (!ENV_URLS[env]) {\n throw new Error('invalid environment configuration');\n }\n return ENV_URLS[env];\n}\n\nexport enum SubscriptionControllerErrorMessage {\n UserAlreadySubscribed = `${controllerName} - User is already subscribed`,\n UserNotSubscribed = `${controllerName} - User is not subscribed`,\n SubscriptionProductsEmpty = `${controllerName} - Subscription products array cannot be empty`,\n PaymentTokenAddressAndSymbolRequiredForCrypto = `${controllerName} - Payment token address and symbol are required for crypto payment`,\n PaymentMethodNotCrypto = `${controllerName} - Payment method is not crypto`,\n ProductPriceNotFound = `${controllerName} - Product price not found`,\n SubscriptionNotValidForCryptoApproval = `${controllerName} - Subscription is not valid for crypto approval`,\n CryptoApprovalRequiresShieldApprove = `${controllerName} - Crypto approval is only supported for Shield ERC-20 approve transactions`,\n LinkRewardsFailed = `${controllerName} - Failed to link rewards`,\n}\n\nexport enum SubscriptionServiceErrorMessage {\n FailedToGetSubscriptions = 'Failed to get subscriptions',\n FailedToGetBenefits = 'Failed to get benefits',\n FailedToCancelSubscription = 'Failed to cancel subscription',\n FailedToUncancelSubscription = 'Failed to uncancel subscription',\n FailedToStartSubscriptionWithCard = 'Failed to start subscription with card',\n FailedToStartSubscriptionWithCrypto = 'Failed to start subscription with crypto',\n InvalidCryptoAuthCombo = 'Crypto subscription requires exactly one of rawTransaction (erc20_approval) or delegationHash (delegation)',\n FailedToUpdatePaymentMethodCard = 'Failed to update payment method card',\n FailedToUpdatePaymentMethodCrypto = 'Failed to update payment method crypto',\n FailedToGetSubscriptionsEligibilities = 'Failed to get subscriptions eligibilities',\n FailedToSubmitUserEvent = 'Failed to submit user event',\n FailedToAssignUserToCohort = 'Failed to assign user to cohort',\n FailedToSubmitSponsorshipIntents = 'Failed to submit sponsorship intents',\n FailedToLinkRewards = 'Failed to link rewards',\n FailedToGetPricing = 'Failed to get pricing',\n FailedToGetBillingPortalUrl = 'Failed to get billing portal url',\n}\n\nexport enum SubscriptionDelegationServiceErrorMessage {\n InvalidAmount = 'Subscription delegation amount must be a non-negative integer',\n InvalidDecimals = 'Subscription delegation decimals must be a non-negative integer',\n InvalidTrialPeriodDays = 'Subscription delegation trial period days must be a non-negative integer',\n InvalidMinimumFundingCycles = 'Subscription delegation minimum funding cycles must be a positive integer',\n LossyAmountScale = 'Subscription delegation amount cannot be scaled to token decimals without remainder',\n UnsupportedRecurringInterval = 'Unsupported subscription recurring interval',\n UnsupportedProduct = 'Subscription delegation is only supported for Money Account',\n MissingMoneyAccountVaultConfig = 'Money Account vault configuration is missing or invalid',\n DelegationContractsNotFound = 'Subscription delegation contracts were not found for the configured chain',\n PricingConfigurationNotFound = 'Subscription delegation pricing configuration was not found',\n InvalidRecipientAddress = 'Subscription delegation recipient must be a valid 20-byte address',\n InsufficientBalance = 'Money Account balance is insufficient for the subscription funding requirement',\n ChompRejectedDelegation = 'CHOMP rejected the subscription delegation',\n ChompMissingDelegationHash = 'CHOMP verify response did not include a delegation hash',\n ChompDelegationHashMismatch = 'CHOMP verify response delegation hash does not match the locally computed hash',\n ChainMismatch = 'Subscription delegation chain does not match the Money Account chain',\n ApprovalResultMissing = 'Subscription delegation approval result is missing',\n InvalidFundingTransactionHash = 'Subscription funding transaction hash is invalid',\n ReusableDelegationInvalid = 'Reusable subscription delegation is missing or invalid',\n TrialEligibilityChanged = 'Subscription trial eligibility changed after authorization',\n ChompIntentNotActive = 'CHOMP subscription intent is not active',\n}\n\nexport const DEFAULT_POLLING_INTERVAL = 5 * 60 * 1_000; // 5 minutes\n\nexport const ACTIVE_SUBSCRIPTION_STATUSES = [\n SUBSCRIPTION_STATUSES.active,\n SUBSCRIPTION_STATUSES.trialing,\n SUBSCRIPTION_STATUSES.provisional,\n] as string[];\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,6BAA6B;IAC7B,aAAa,EAAE,eAAe;IAC9B,8BAA8B;I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AAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,eAAe;IACf,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC,CAAC","sourcesContent":["import { SUBSCRIPTION_STATUSES } from './types.js';\n\nexport const controllerName = 'SubscriptionController';\n\n/**\n * API cancellation reason values and their client-facing text.\n */\nexport const CANCELLATION_REASONS = {\n // Costs more than it's worth\n TOO_EXPENSIVE: 'too_expensive',\n // I wasn't using the benefits\n NOT_USING_BENEFITS: 'not_using_benefits',\n // The benefits weren't what I expected\n BENEFITS_NOT_AS_EXPECTED: 'benefits_not_as_expected',\n // Something didn't work\n SOMETHING_DID_NOT_WORK: 'something_did_not_work',\n // Unhappy with support\n UNHAPPY_WITH_SUPPORT: 'unhappy_with_support',\n // Other\n OTHER: 'other',\n} as const;\n\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\ntype EnvUrlsEntry = {\n subscriptionApiUrl: string;\n};\n\nconst ENV_URLS: Record<Env, EnvUrlsEntry> = {\n dev: {\n subscriptionApiUrl: 'https://subscription.dev-api.cx.metamask.io',\n },\n uat: {\n subscriptionApiUrl: 'https://subscription.uat-api.cx.metamask.io',\n },\n prd: {\n subscriptionApiUrl: 'https://subscription.api.cx.metamask.io',\n },\n};\n\n/**\n * Validates and returns correct environment endpoints\n *\n * @param env - environment field\n * @returns the correct environment url\n * @throws on invalid environment passed\n */\nexport function getEnvUrls(env: Env): EnvUrlsEntry {\n if (!ENV_URLS[env]) {\n throw new Error('invalid environment configuration');\n }\n return ENV_URLS[env];\n}\n\nexport enum SubscriptionControllerErrorMessage {\n UserAlreadySubscribed = `${controllerName} - User is already subscribed`,\n UserNotSubscribed = `${controllerName} - User is not subscribed`,\n SubscriptionProductsEmpty = `${controllerName} - Subscription products array cannot be empty`,\n PaymentTokenAddressAndSymbolRequiredForCrypto = `${controllerName} - Payment token address and symbol are required for crypto payment`,\n PaymentMethodNotCrypto = `${controllerName} - Payment method is not crypto`,\n ProductPriceNotFound = `${controllerName} - Product price not found`,\n SubscriptionNotValidForCryptoApproval = `${controllerName} - Subscription is not valid for crypto approval`,\n CryptoApprovalRequiresShieldApprove = `${controllerName} - Crypto approval is only supported for Shield ERC-20 approve transactions`,\n LinkRewardsFailed = `${controllerName} - Failed to link rewards`,\n}\n\nexport enum SubscriptionServiceErrorMessage {\n FailedToGetSubscriptions = 'Failed to get subscriptions',\n FailedToGetBenefits = 'Failed to get benefits',\n FailedToCancelSubscription = 'Failed to cancel subscription',\n FailedToUncancelSubscription = 'Failed to uncancel subscription',\n FailedToStartSubscriptionWithCard = 'Failed to start subscription with card',\n FailedToStartSubscriptionWithCrypto = 'Failed to start subscription with crypto',\n InvalidCryptoAuthCombo = 'Crypto subscription requires exactly one of rawTransaction (erc20_approval) or delegationHash (delegation)',\n FailedToUpdatePaymentMethodCard = 'Failed to update payment method card',\n FailedToUpdatePaymentMethodCrypto = 'Failed to update payment method crypto',\n FailedToGetSubscriptionsEligibilities = 'Failed to get subscriptions eligibilities',\n FailedToSubmitUserEvent = 'Failed to submit user event',\n FailedToAssignUserToCohort = 'Failed to assign user to cohort',\n FailedToSubmitSponsorshipIntents = 'Failed to submit sponsorship intents',\n FailedToLinkRewards = 'Failed to link rewards',\n FailedToGetPricing = 'Failed to get pricing',\n FailedToGetBillingPortalUrl = 'Failed to get billing portal url',\n}\n\nexport enum SubscriptionDelegationServiceErrorMessage {\n InvalidAmount = 'Subscription delegation amount must be a non-negative integer',\n InvalidDecimals = 'Subscription delegation decimals must be a non-negative integer',\n InvalidTrialPeriodDays = 'Subscription delegation trial period days must be a non-negative integer',\n InvalidMinimumFundingCycles = 'Subscription delegation minimum funding cycles must be a positive integer',\n LossyAmountScale = 'Subscription delegation amount cannot be scaled to token decimals without remainder',\n UnsupportedRecurringInterval = 'Unsupported subscription recurring interval',\n UnsupportedProduct = 'Subscription delegation is only supported for Money Account',\n MissingMoneyAccountVaultConfig = 'Money Account vault configuration is missing or invalid',\n DelegationContractsNotFound = 'Subscription delegation contracts were not found for the configured chain',\n PricingConfigurationNotFound = 'Subscription delegation pricing configuration was not found',\n InvalidRecipientAddress = 'Subscription delegation recipient must be a valid 20-byte address',\n InsufficientBalance = 'Money Account balance is insufficient for the subscription funding requirement',\n ChompRejectedDelegation = 'CHOMP rejected the subscription delegation',\n ChompMissingDelegationHash = 'CHOMP verify response did not include a delegation hash',\n ChompDelegationHashMismatch = 'CHOMP verify response delegation hash does not match the locally computed hash',\n ChainMismatch = 'Subscription delegation chain does not match the Money Account chain',\n ReusableDelegationInvalid = 'Reusable subscription delegation is missing or invalid',\n TrialEligibilityChanged = 'Subscription trial eligibility changed after authorization',\n ChompIntentNotActive = 'CHOMP subscription intent is not active',\n}\n\nexport const DEFAULT_POLLING_INTERVAL = 5 * 60 * 1_000; // 5 minutes\n\nexport const ACTIVE_SUBSCRIPTION_STATUSES = [\n SUBSCRIPTION_STATUSES.active,\n SUBSCRIPTION_STATUSES.trialing,\n SUBSCRIPTION_STATUSES.provisional,\n] as string[];\n\n/**\n * ISO 3166-1 alpha-2 country codes eligible for refund (EU 27 + EEA).\n *\n * Used to set `isEligibleForRefund` when starting a subscription.\n */\nexport const REFUND_ELIGIBLE_COUNTRIES: ReadonlySet<string> = new Set([\n // EU 27\n 'AT',\n 'BE',\n 'BG',\n 'HR',\n 'CY',\n 'CZ',\n 'DK',\n 'EE',\n 'FI',\n 'FR',\n 'DE',\n 'GR',\n 'HU',\n 'IE',\n 'IT',\n 'LV',\n 'LT',\n 'LU',\n 'MT',\n 'NL',\n 'PL',\n 'PT',\n 'RO',\n 'SK',\n 'SI',\n 'ES',\n 'SE',\n // EEA (non-EU)\n 'IS',\n 'LI',\n 'NO',\n]);\n"]}
package/dist/index.d.ts CHANGED
@@ -15,6 +15,6 @@ export { SubscriptionDelegationService, serviceName as subscriptionDelegationSer
15
15
  export type { SubscriptionDelegationServicePrepareDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';
16
16
  export type { SubscriptionDelegationServiceCheckMoneyAccountBalanceAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';
17
17
  export type { SubscriptionDelegationServiceStartSubscriptionWithDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';
18
- export type { ChompIntentType, CommitAuthorizationBundleRequest, CommitAuthorizationBundleResult, DecodedPermission, MoneyAccountAuthorizationReason, MoneyAccountBalanceCheckRequest, MoneyAccountBalanceCheckResult, PrepareSubscriptionDelegationRequest, PrepareAuthorizationBundleResult, PreparedSubscriptionDelegation, PreparedSubscriptionDelegationBundle, PreparedSubscriptionPermission, SignedSubscriptionDelegation, StartSubscriptionWithDelegationRequest, StartSubscriptionWithDelegationResult, SubscriptionDelegationApprovalResult, SubscriptionDelegationTypedData, SubscriptionFundingRequest, SubscriptionPermissionId, UnsignedSubscriptionDelegation, } from './subscription-delegation/types.js';
19
- export { CASH_SUBSCRIPTION_DELEGATION_TYPE, SUBSCRIPTION_DELEGATION_APPROVAL_TYPE, SUBSCRIPTION_DELEGATION_POLICY_VERSION, } from './subscription-delegation/types.js';
18
+ export type { ChompIntentType, CommitAuthorizationBundleRequest, CommitAuthorizationBundleResult, DecodedPermission, MoneyAccountAuthorizationReason, MoneyAccountBalanceCheckRequest, MoneyAccountBalanceCheckResult, PrepareSubscriptionDelegationRequest, PrepareAuthorizationBundleResult, PreparedSubscriptionDelegation, PreparedSubscriptionDelegationBundle, PreparedSubscriptionPermission, SignedSubscriptionDelegation, StartSubscriptionWithDelegationRequest, StartSubscriptionWithDelegationResult, SubscriptionDelegationTypedData, SubscriptionPermissionId, UnsignedSubscriptionDelegation, } from './subscription-delegation/types.js';
19
+ export { CASH_SUBSCRIPTION_DELEGATION_TYPE, SUBSCRIPTION_DELEGATION_POLICY_VERSION, } from './subscription-delegation/types.js';
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,+BAA+B,EAC/B,6BAA6B,EAC7B,sCAAsC,GACvC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,sCAAsC,EACtC,4CAA4C,EAC5C,uCAAuC,EACvC,oDAAoD,EACpD,kDAAkD,EAClD,yDAAyD,EACzD,8CAA8C,EAC9C,gDAAgD,EAChD,qDAAqD,EACrD,uDAAuD,EACvD,4DAA4D,EAC5D,6DAA6D,EAC7D,+CAA+C,EAC/C,+CAA+C,EAC/C,0DAA0D,EAC1D,0DAA0D,EAC1D,oDAAoD,EACpD,2CAA2C,EAC3C,8CAA8C,EAC9C,uCAAuC,EACvC,iDAAiD,EACjD,wDAAwD,EACxD,sCAAsC,EACtC,qDAAqD,EACrD,0CAA0C,GAC3C,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,SAAS,EACT,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,8BAA8B,EAC9B,wCAAwC,EACxC,mCAAmC,EACnC,+BAA+B,EAC/B,wBAAwB,EACxB,yBAAyB,EACzB,kCAAkC,EAClC,mCAAmC,EACnC,uCAAuC,EACvC,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,WA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ACV,yCAAyC,EACzC,oCAAoC,EACpC,2CAA2C,EAC3C,6CAA6C,EAC7C,kDAAkD,EAClD,oDAAoD,EACpD,gDAAgD,EAChD,kDAAkD,EAClD,sDAAsD,EACtD,wCAAwC,EACxC,2CAA2C,EAC3C,iDAAiD,EACjD,oCAAoC,EACpC,mCAAmC,EACnC,4CAA4C,GAC7C,MAAM,8CAA8C,CAAC;AAEtD,YAAY,EACV,oCAAoC,EACpC,mCAAmC,EACnC,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,4DAA4D,CAAC;AACpE,OAAO,EACL,6BAA6B,EAC7B,WAAW,IAAI,iCAAiC,GACjD,MAAM,4DAA4D,CAAC;AACpE,YAAY,EAAE,oDAAoD,EAAE,MAAM,gFAAgF,CAAC;AAC3J,YAAY,EAAE,2DAA2D,EAAE,MAAM,gFAAgF,CAAC;AAClK,YAAY,EAAE,kEAAkE,EAAE,MAAM,gFAAgF,CAAC;AACzK,YAAY,EACV,eAAe,EACf,gCAAgC,EAChC,+BAA+B,EAC/B,iBAAiB,EACjB,+BAA+B,EAC/B,+BAA+B,EAC/B,8BAA8B,EAC9B,oCAAoC,EACpC,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,8BAA8B,EAC9B,4BAA4B,EAC5B,sCAAsC,EACtC,qCAAqC,EACrC,+BAA+B,EAC/B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iCAAiC,EACjC,sCAAsC,GACvC,MAAM,oCAAoC,CAAC"}
package/dist/index.js CHANGED
@@ -6,5 +6,5 @@ export { SubscriptionServiceError } from './errors.js';
6
6
  export { Env, SubscriptionControllerErrorMessage, SubscriptionServiceErrorMessage, SubscriptionDelegationServiceErrorMessage, } from './constants.js';
7
7
  export { SubscriptionService, serviceName as subscriptionServiceName, SUBSCRIPTION_URL, } from './SubscriptionService.js';
8
8
  export { SubscriptionDelegationService, serviceName as subscriptionDelegationServiceName, } from './subscription-delegation/SubscriptionDelegationService.js';
9
- export { CASH_SUBSCRIPTION_DELEGATION_TYPE, SUBSCRIPTION_DELEGATION_APPROVAL_TYPE, SUBSCRIPTION_DELEGATION_POLICY_VERSION, } from './subscription-delegation/types.js';
9
+ export { CASH_SUBSCRIPTION_DELEGATION_TYPE, SUBSCRIPTION_DELEGATION_POLICY_VERSION, } from './subscription-delegation/types.js';
10
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoCA,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,MAAM,6BAA6B,CAAC;AA0ErC,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,GAAG,EACH,kCAAkC,EAClC,+BAA+B,EAC/B,yCAAyC,GAC1C,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EACL,mBAAmB,EACnB,WAAW,IAAI,uBAAuB,EACtC,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAyBlC,OAAO,EACL,6BAA6B,EAC7B,WAAW,IAAI,iCAAiC,GACjD,MAAM,4DAA4D,CAAC;AA0BpE,OAAO,EACL,iCAAiC,EACjC,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,oCAAoC,CAAC","sourcesContent":["export type {\n SubscriptionControllerActions,\n SubscriptionControllerState,\n SubscriptionControllerEvents,\n SubscriptionControllerGetStateAction,\n SubscriptionControllerMessenger,\n SubscriptionControllerOptions,\n SubscriptionControllerStateChangeEvent,\n} from './SubscriptionController.js';\nexport type {\n SubscriptionControllerGetPricingAction,\n SubscriptionControllerGetSubscriptionsAction,\n SubscriptionControllerGetBenefitsAction,\n SubscriptionControllerGetSubscriptionByProductAction,\n SubscriptionControllerIsUserEligibleForTrialAction,\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} from './SubscriptionController-method-action-types.js';\nexport {\n SubscriptionController,\n getDefaultSubscriptionControllerState,\n} from './SubscriptionController.js';\nexport type {\n SubscriptionApiError,\n Subscription,\n PerpsBenefitUsage,\n PredictBenefitUsage,\n SubscriptionBenefitsResponse,\n SubscriptionBenefitsState,\n SwapsBenefitUsage,\n AuthUtils,\n CancelSubscriptionRequest,\n CancelType,\n CancellationReasonCode,\n ISubscriptionService,\n StartCryptoSubscriptionRequest,\n StartDelegationCryptoSubscriptionRequest,\n StartErc20CryptoSubscriptionRequest,\n StartCryptoSubscriptionResponse,\n StartSubscriptionRequest,\n StartSubscriptionResponse,\n GetCryptoApproveTransactionRequest,\n GetCryptoApproveTransactionResponse,\n SubmitSubscriptionCryptoApprovalRequest,\n SubscriptionCardPaymentMethod,\n SubscriptionCryptoPaymentMethod,\n SubscriptionPaymentMethod,\n SubscriptionInvoice,\n InvoicePaymentStatus,\n SubmitUserEventRequest,\n SubmitSponsorshipIntentsRequest,\n SubscriptionEligibility,\n SubscriptionUserEventType,\n RecurringInterval,\n SubscriptionStatus,\n PaymentType,\n Product,\n ProductType,\n ProductPrice,\n ProductPricing,\n TokenPaymentInfo,\n SpotTokenPaymentInfo,\n VaultTokenPaymentInfo,\n VaultName,\n ChainPaymentInfo,\n Currency,\n CryptoAuthMethod,\n PricingPaymentMethod,\n PricingCardPaymentMethod,\n PricingCryptoPaymentMethod,\n PricingResponse,\n UpdatePaymentMethodOpts,\n BillingPortalResponse,\n CryptoPaymentMethodError,\n CryptoPaymentError,\n UpdateErc20PaymentMethodCryptoRequest,\n UpdateDelegationPaymentMethodCryptoRequest,\n UpdatePaymentMethodCryptoRequest,\n UpdatePaymentMethodCardRequest,\n UpdatePaymentMethodCardResponse,\n CachedLastSelectedPaymentMethod,\n CacheLastSelectedPaymentMethodRequest,\n SubmitSponsorshipIntentsMethodParams,\n Cohort,\n CohortName,\n BalanceCategory,\n AssignCohortRequest,\n GetSubscriptionsEligibilitiesRequest,\n ModalType,\n MoneyAccountEntitlements,\n MoneyAccountPlusClaim,\n ProductEntitlementFeatureMap,\n ProductEntitlements,\n ShieldEntitlements,\n} from './types.js';\nexport {\n CANCEL_TYPES,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n CRYPTO_PAYMENT_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n SUBSCRIPTION_STATUSES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n PAYMENT_TYPES,\n CRYPTO_AUTH_METHODS,\n VAULT_NAMES,\n isVaultShareToken,\n SubscriptionUserEvent,\n COHORT_NAMES,\n BALANCE_CATEGORIES,\n MODAL_TYPE,\n MoneyAccountFeature,\n ShieldFeature,\n} from './types.js';\nexport { CANCELLATION_REASONS } from './constants.js';\nexport {\n selectHasEntitlement,\n selectIsActiveSubscriber,\n selectIsUsageAvailable,\n selectIsPaymentFailed,\n selectPaymentFailureReason,\n selectIsRenewalNeeded,\n selectIsDelegationExhausted,\n} from './selectors.js';\nexport { SubscriptionServiceError } from './errors.js';\nexport {\n Env,\n SubscriptionControllerErrorMessage,\n SubscriptionServiceErrorMessage,\n SubscriptionDelegationServiceErrorMessage,\n} from './constants.js';\nexport type {\n SubscriptionServiceOptions,\n SubscriptionServiceMessenger,\n SubscriptionServiceActions,\n SubscriptionServiceEvents,\n SubscriptionServiceCacheUpdatedEvent,\n SubscriptionServiceGranularCacheUpdatedEvent,\n SubscriptionServiceInvalidateQueriesAction,\n} from './SubscriptionService.js';\nexport {\n SubscriptionService,\n serviceName as subscriptionServiceName,\n SUBSCRIPTION_URL,\n} from './SubscriptionService.js';\nexport type {\n SubscriptionServiceGetSubscriptionsAction,\n SubscriptionServiceGetBenefitsAction,\n SubscriptionServiceCancelSubscriptionAction,\n SubscriptionServiceUnCancelSubscriptionAction,\n SubscriptionServiceStartSubscriptionWithCardAction,\n SubscriptionServiceStartSubscriptionWithCryptoAction,\n SubscriptionServiceUpdatePaymentMethodCardAction,\n SubscriptionServiceUpdatePaymentMethodCryptoAction,\n SubscriptionServiceGetSubscriptionsEligibilitiesAction,\n SubscriptionServiceSubmitUserEventAction,\n SubscriptionServiceAssignUserToCohortAction,\n SubscriptionServiceSubmitSponsorshipIntentsAction,\n SubscriptionServiceLinkRewardsAction,\n SubscriptionServiceGetPricingAction,\n SubscriptionServiceGetBillingPortalUrlAction,\n} from './SubscriptionService-method-action-types.js';\n\nexport type {\n SubscriptionDelegationServiceActions,\n SubscriptionDelegationServiceEvents,\n SubscriptionDelegationServiceMessenger,\n SubscriptionDelegationServiceOptions,\n} from './subscription-delegation/SubscriptionDelegationService.js';\nexport {\n SubscriptionDelegationService,\n serviceName as subscriptionDelegationServiceName,\n} from './subscription-delegation/SubscriptionDelegationService.js';\nexport type { SubscriptionDelegationServicePrepareDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type { SubscriptionDelegationServiceCheckMoneyAccountBalanceAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type { SubscriptionDelegationServiceStartSubscriptionWithDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type {\n ChompIntentType,\n CommitAuthorizationBundleRequest,\n CommitAuthorizationBundleResult,\n DecodedPermission,\n MoneyAccountAuthorizationReason,\n MoneyAccountBalanceCheckRequest,\n MoneyAccountBalanceCheckResult,\n PrepareSubscriptionDelegationRequest,\n PrepareAuthorizationBundleResult,\n PreparedSubscriptionDelegation,\n PreparedSubscriptionDelegationBundle,\n PreparedSubscriptionPermission,\n SignedSubscriptionDelegation,\n StartSubscriptionWithDelegationRequest,\n StartSubscriptionWithDelegationResult,\n SubscriptionDelegationApprovalResult,\n SubscriptionDelegationTypedData,\n SubscriptionFundingRequest,\n SubscriptionPermissionId,\n UnsignedSubscriptionDelegation,\n} from './subscription-delegation/types.js';\nexport {\n CASH_SUBSCRIPTION_DELEGATION_TYPE,\n SUBSCRIPTION_DELEGATION_APPROVAL_TYPE,\n SUBSCRIPTION_DELEGATION_POLICY_VERSION,\n} from './subscription-delegation/types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoCA,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,MAAM,6BAA6B,CAAC;AA0ErC,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACL,GAAG,EACH,kCAAkC,EAClC,+BAA+B,EAC/B,yCAAyC,GAC1C,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EACL,mBAAmB,EACnB,WAAW,IAAI,uBAAuB,EACtC,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAyBlC,OAAO,EACL,6BAA6B,EAC7B,WAAW,IAAI,iCAAiC,GACjD,MAAM,4DAA4D,CAAC;AAwBpE,OAAO,EACL,iCAAiC,EACjC,sCAAsC,GACvC,MAAM,oCAAoC,CAAC","sourcesContent":["export type {\n SubscriptionControllerActions,\n SubscriptionControllerState,\n SubscriptionControllerEvents,\n SubscriptionControllerGetStateAction,\n SubscriptionControllerMessenger,\n SubscriptionControllerOptions,\n SubscriptionControllerStateChangeEvent,\n} from './SubscriptionController.js';\nexport type {\n SubscriptionControllerGetPricingAction,\n SubscriptionControllerGetSubscriptionsAction,\n SubscriptionControllerGetBenefitsAction,\n SubscriptionControllerGetSubscriptionByProductAction,\n SubscriptionControllerIsUserEligibleForTrialAction,\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} from './SubscriptionController-method-action-types.js';\nexport {\n SubscriptionController,\n getDefaultSubscriptionControllerState,\n} from './SubscriptionController.js';\nexport type {\n SubscriptionApiError,\n Subscription,\n PerpsBenefitUsage,\n PredictBenefitUsage,\n SubscriptionBenefitsResponse,\n SubscriptionBenefitsState,\n SwapsBenefitUsage,\n AuthUtils,\n CancelSubscriptionRequest,\n CancelType,\n CancellationReasonCode,\n ISubscriptionService,\n StartCryptoSubscriptionRequest,\n StartDelegationCryptoSubscriptionRequest,\n StartErc20CryptoSubscriptionRequest,\n StartCryptoSubscriptionResponse,\n StartSubscriptionRequest,\n StartSubscriptionResponse,\n GetCryptoApproveTransactionRequest,\n GetCryptoApproveTransactionResponse,\n SubmitSubscriptionCryptoApprovalRequest,\n SubscriptionCardPaymentMethod,\n SubscriptionCryptoPaymentMethod,\n SubscriptionPaymentMethod,\n SubscriptionInvoice,\n InvoicePaymentStatus,\n SubmitUserEventRequest,\n SubmitSponsorshipIntentsRequest,\n SubscriptionEligibility,\n SubscriptionUserEventType,\n RecurringInterval,\n SubscriptionStatus,\n PaymentType,\n Product,\n ProductType,\n ProductPrice,\n ProductPricing,\n TokenPaymentInfo,\n SpotTokenPaymentInfo,\n VaultTokenPaymentInfo,\n VaultName,\n ChainPaymentInfo,\n Currency,\n CryptoAuthMethod,\n PricingPaymentMethod,\n PricingCardPaymentMethod,\n PricingCryptoPaymentMethod,\n PricingResponse,\n UpdatePaymentMethodOpts,\n BillingPortalResponse,\n CryptoPaymentMethodError,\n CryptoPaymentError,\n UpdateErc20PaymentMethodCryptoRequest,\n UpdateDelegationPaymentMethodCryptoRequest,\n UpdatePaymentMethodCryptoRequest,\n UpdatePaymentMethodCardRequest,\n UpdatePaymentMethodCardResponse,\n CachedLastSelectedPaymentMethod,\n CacheLastSelectedPaymentMethodRequest,\n SubmitSponsorshipIntentsMethodParams,\n Cohort,\n CohortName,\n BalanceCategory,\n AssignCohortRequest,\n GetSubscriptionsEligibilitiesRequest,\n ModalType,\n MoneyAccountEntitlements,\n MoneyAccountPlusClaim,\n ProductEntitlementFeatureMap,\n ProductEntitlements,\n ShieldEntitlements,\n} from './types.js';\nexport {\n CANCEL_TYPES,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n CRYPTO_PAYMENT_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n SUBSCRIPTION_STATUSES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n PAYMENT_TYPES,\n CRYPTO_AUTH_METHODS,\n VAULT_NAMES,\n isVaultShareToken,\n SubscriptionUserEvent,\n COHORT_NAMES,\n BALANCE_CATEGORIES,\n MODAL_TYPE,\n MoneyAccountFeature,\n ShieldFeature,\n} from './types.js';\nexport { CANCELLATION_REASONS } from './constants.js';\nexport {\n selectHasEntitlement,\n selectIsActiveSubscriber,\n selectIsUsageAvailable,\n selectIsPaymentFailed,\n selectPaymentFailureReason,\n selectIsRenewalNeeded,\n selectIsDelegationExhausted,\n} from './selectors.js';\nexport { SubscriptionServiceError } from './errors.js';\nexport {\n Env,\n SubscriptionControllerErrorMessage,\n SubscriptionServiceErrorMessage,\n SubscriptionDelegationServiceErrorMessage,\n} from './constants.js';\nexport type {\n SubscriptionServiceOptions,\n SubscriptionServiceMessenger,\n SubscriptionServiceActions,\n SubscriptionServiceEvents,\n SubscriptionServiceCacheUpdatedEvent,\n SubscriptionServiceGranularCacheUpdatedEvent,\n SubscriptionServiceInvalidateQueriesAction,\n} from './SubscriptionService.js';\nexport {\n SubscriptionService,\n serviceName as subscriptionServiceName,\n SUBSCRIPTION_URL,\n} from './SubscriptionService.js';\nexport type {\n SubscriptionServiceGetSubscriptionsAction,\n SubscriptionServiceGetBenefitsAction,\n SubscriptionServiceCancelSubscriptionAction,\n SubscriptionServiceUnCancelSubscriptionAction,\n SubscriptionServiceStartSubscriptionWithCardAction,\n SubscriptionServiceStartSubscriptionWithCryptoAction,\n SubscriptionServiceUpdatePaymentMethodCardAction,\n SubscriptionServiceUpdatePaymentMethodCryptoAction,\n SubscriptionServiceGetSubscriptionsEligibilitiesAction,\n SubscriptionServiceSubmitUserEventAction,\n SubscriptionServiceAssignUserToCohortAction,\n SubscriptionServiceSubmitSponsorshipIntentsAction,\n SubscriptionServiceLinkRewardsAction,\n SubscriptionServiceGetPricingAction,\n SubscriptionServiceGetBillingPortalUrlAction,\n} from './SubscriptionService-method-action-types.js';\n\nexport type {\n SubscriptionDelegationServiceActions,\n SubscriptionDelegationServiceEvents,\n SubscriptionDelegationServiceMessenger,\n SubscriptionDelegationServiceOptions,\n} from './subscription-delegation/SubscriptionDelegationService.js';\nexport {\n SubscriptionDelegationService,\n serviceName as subscriptionDelegationServiceName,\n} from './subscription-delegation/SubscriptionDelegationService.js';\nexport type { SubscriptionDelegationServicePrepareDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type { SubscriptionDelegationServiceCheckMoneyAccountBalanceAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type { SubscriptionDelegationServiceStartSubscriptionWithDelegationAction } from './subscription-delegation/SubscriptionDelegationService-method-action-types.js';\nexport type {\n ChompIntentType,\n CommitAuthorizationBundleRequest,\n CommitAuthorizationBundleResult,\n DecodedPermission,\n MoneyAccountAuthorizationReason,\n MoneyAccountBalanceCheckRequest,\n MoneyAccountBalanceCheckResult,\n PrepareSubscriptionDelegationRequest,\n PrepareAuthorizationBundleResult,\n PreparedSubscriptionDelegation,\n PreparedSubscriptionDelegationBundle,\n PreparedSubscriptionPermission,\n SignedSubscriptionDelegation,\n StartSubscriptionWithDelegationRequest,\n StartSubscriptionWithDelegationResult,\n SubscriptionDelegationTypedData,\n SubscriptionPermissionId,\n UnsignedSubscriptionDelegation,\n} from './subscription-delegation/types.js';\nexport {\n CASH_SUBSCRIPTION_DELEGATION_TYPE,\n SUBSCRIPTION_DELEGATION_POLICY_VERSION,\n} from './subscription-delegation/types.js';\n"]}
@@ -18,22 +18,17 @@ export type SubscriptionDelegationServiceCheckMoneyAccountBalanceAction = {
18
18
  * Runs the complete Money Account subscription checkout authorization flow.
19
19
  *
20
20
  * Subscriptions are refreshed first. An active subscription for the product
21
- * is rejected before Money Account upgrade, approval, delegation signing,
22
- * persistence, or CHOMP registration.
21
+ * is rejected before Money Account upgrade, delegation signing, persistence,
22
+ * or CHOMP registration.
23
23
  *
24
- * Before the approval, `MoneyAccountUpgradeController` is asked to ensure
25
- * the Money Account vault delegations and CHOMP intents exist; the
26
- * Subscription API validates them server-side. The custom approval is the
27
- * sole consent and funding boundary for the payment permission. No payment
28
- * delegation signing, persistence, or intent mutation occurs before it
29
- * returns a funding transaction hash.
24
+ * The caller must obtain user consent and initiate funding before calling.
25
+ * `MoneyAccountUpgradeController` ensures the Money Account vault
26
+ * delegations and CHOMP intents exist. The Subscription API validates those
27
+ * delegations and the Money Account balance server-side. No payment
28
+ * delegation signing, persistence, or intent mutation occurs before the
29
+ * account is upgraded.
30
30
  *
31
- * When `request.skipApproval` is `true`, the approval request and its
32
- * result validation are skipped and the flow proceeds directly to signing.
33
- * The caller is then responsible for consent and funding.
34
- *
35
- * @param request - Product selection, Money Account identity, and optional
36
- * `skipApproval` flag.
31
+ * @param request - Product selection and Money Account identity.
37
32
  * @returns The result from `SubscriptionController:startSubscriptionWithCrypto`.
38
33
  */
39
34
  export type SubscriptionDelegationServiceStartSubscriptionWithDelegationAction = {
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionDelegationService-method-action-types.d.ts","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,6BAA6B,CAAC,0BAA0B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,6BAA6B,CAAC,iCAAiC,CAAC,CAAC;CAC3E,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,6BAA6B,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAClD,2DAA2D,GAC3D,kEAAkE,GAClE,oDAAoD,CAAC"}
1
+ {"version":3,"file":"SubscriptionDelegationService-method-action-types.d.ts","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,6BAA6B,CAAC,0BAA0B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,6BAA6B,CAAC,iCAAiC,CAAC,CAAC;CAC3E,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,6BAA6B,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAClD,2DAA2D,GAC3D,kEAAkE,GAClE,oDAAoD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionDelegationService-method-action-types.js","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SubscriptionDelegationService } from './SubscriptionDelegationService.js';\n\n/**\n * Checks whether the Money Account holds enough convertible mUSD value to\n * cover pricing `unitAmount × minBillingCyclesForBalance`.\n *\n * @param request - Payer address and pricing amount fields.\n * @returns Balance comparison in mUSD base units (6 decimals).\n */\nexport type SubscriptionDelegationServiceCheckMoneyAccountBalanceAction = {\n type: `SubscriptionDelegationService:checkMoneyAccountBalance`;\n handler: SubscriptionDelegationService['checkMoneyAccountBalance'];\n};\n\n/**\n * Runs the complete Money Account subscription checkout authorization flow.\n *\n * Subscriptions are refreshed first. An active subscription for the product\n * is rejected before Money Account upgrade, approval, delegation signing,\n * persistence, or CHOMP registration.\n *\n * Before the approval, `MoneyAccountUpgradeController` is asked to ensure\n * the Money Account vault delegations and CHOMP intents exist; the\n * Subscription API validates them server-side. The custom approval is the\n * sole consent and funding boundary for the payment permission. No payment\n * delegation signing, persistence, or intent mutation occurs before it\n * returns a funding transaction hash.\n *\n * When `request.skipApproval` is `true`, the approval request and its\n * result validation are skipped and the flow proceeds directly to signing.\n * The caller is then responsible for consent and funding.\n *\n * @param request - Product selection, Money Account identity, and optional\n * `skipApproval` flag.\n * @returns The result from `SubscriptionController:startSubscriptionWithCrypto`.\n */\nexport type SubscriptionDelegationServiceStartSubscriptionWithDelegationAction =\n {\n type: `SubscriptionDelegationService:startSubscriptionWithDelegation`;\n handler: SubscriptionDelegationService['startSubscriptionWithDelegation'];\n };\n\n/**\n * Prepares a cash-subscription delegation and returns its hash.\n *\n * Reuses a stored AUS delegation that matches the semantic fingerprint when\n * one exists (ensuring a CHOMP intent is active for its hash, unless\n * `skipChompInteractions` is true). Reuse classifies period `startDate` as\n * trial-deferred (`> now`) vs immediately redeemable, matching creation.\n * When several records match, the latest period `startDate` is reused\n * so a `forceNew` replacement is preferred over an older equivalent\n * permission.\n * If there is no match, builds, signs, optionally verifies with CHOMP,\n * persists, and optionally registers a new delegation.\n *\n * When `skipChompInteractions` is true, CHOMP verify and intent calls are\n * skipped; the returned hash is computed locally.\n *\n * @param request - Authoritative pricing and payer details for the delegation.\n * @param forceNew - Whether to create a replacement instead of reusing a\n * matching stored delegation.\n * @returns The delegation hash (CHOMP-verified unless skipped) and whether it\n * was created or reused.\n */\nexport type SubscriptionDelegationServicePrepareDelegationAction = {\n type: `SubscriptionDelegationService:prepareDelegation`;\n handler: SubscriptionDelegationService['prepareDelegation'];\n};\n\n/**\n * Union of all SubscriptionDelegationService action types.\n */\nexport type SubscriptionDelegationServiceMethodActions =\n | SubscriptionDelegationServiceCheckMoneyAccountBalanceAction\n | SubscriptionDelegationServiceStartSubscriptionWithDelegationAction\n | SubscriptionDelegationServicePrepareDelegationAction;\n"]}
1
+ {"version":3,"file":"SubscriptionDelegationService-method-action-types.js","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SubscriptionDelegationService } from './SubscriptionDelegationService.js';\n\n/**\n * Checks whether the Money Account holds enough convertible mUSD value to\n * cover pricing `unitAmount × minBillingCyclesForBalance`.\n *\n * @param request - Payer address and pricing amount fields.\n * @returns Balance comparison in mUSD base units (6 decimals).\n */\nexport type SubscriptionDelegationServiceCheckMoneyAccountBalanceAction = {\n type: `SubscriptionDelegationService:checkMoneyAccountBalance`;\n handler: SubscriptionDelegationService['checkMoneyAccountBalance'];\n};\n\n/**\n * Runs the complete Money Account subscription checkout authorization flow.\n *\n * Subscriptions are refreshed first. An active subscription for the product\n * is rejected before Money Account upgrade, delegation signing, persistence,\n * or CHOMP registration.\n *\n * The caller must obtain user consent and initiate funding before calling.\n * `MoneyAccountUpgradeController` ensures the Money Account vault\n * delegations and CHOMP intents exist. The Subscription API validates those\n * delegations and the Money Account balance server-side. No payment\n * delegation signing, persistence, or intent mutation occurs before the\n * account is upgraded.\n *\n * @param request - Product selection and Money Account identity.\n * @returns The result from `SubscriptionController:startSubscriptionWithCrypto`.\n */\nexport type SubscriptionDelegationServiceStartSubscriptionWithDelegationAction =\n {\n type: `SubscriptionDelegationService:startSubscriptionWithDelegation`;\n handler: SubscriptionDelegationService['startSubscriptionWithDelegation'];\n };\n\n/**\n * Prepares a cash-subscription delegation and returns its hash.\n *\n * Reuses a stored AUS delegation that matches the semantic fingerprint when\n * one exists (ensuring a CHOMP intent is active for its hash, unless\n * `skipChompInteractions` is true). Reuse classifies period `startDate` as\n * trial-deferred (`> now`) vs immediately redeemable, matching creation.\n * When several records match, the latest period `startDate` is reused\n * so a `forceNew` replacement is preferred over an older equivalent\n * permission.\n * If there is no match, builds, signs, optionally verifies with CHOMP,\n * persists, and optionally registers a new delegation.\n *\n * When `skipChompInteractions` is true, CHOMP verify and intent calls are\n * skipped; the returned hash is computed locally.\n *\n * @param request - Authoritative pricing and payer details for the delegation.\n * @param forceNew - Whether to create a replacement instead of reusing a\n * matching stored delegation.\n * @returns The delegation hash (CHOMP-verified unless skipped) and whether it\n * was created or reused.\n */\nexport type SubscriptionDelegationServicePrepareDelegationAction = {\n type: `SubscriptionDelegationService:prepareDelegation`;\n handler: SubscriptionDelegationService['prepareDelegation'];\n};\n\n/**\n * Union of all SubscriptionDelegationService action types.\n */\nexport type SubscriptionDelegationServiceMethodActions =\n | SubscriptionDelegationServiceCheckMoneyAccountBalanceAction\n | SubscriptionDelegationServiceStartSubscriptionWithDelegationAction\n | SubscriptionDelegationServicePrepareDelegationAction;\n"]}
@@ -1,4 +1,3 @@
1
- import type { ApprovalControllerAddRequestAction } from '@metamask/approval-controller';
2
1
  import type { AuthenticatedUserStorageServiceCreateDelegationAction, AuthenticatedUserStorageServiceListDelegationsAction } from '@metamask/authenticated-user-storage';
3
2
  import type { ChompApiServiceCreateIntentsAction, ChompApiServiceGetIntentsByAddressAction, ChompApiServiceVerifyDelegationAction } from '@metamask/chomp-api-service';
4
3
  import type { DelegationControllerSignDelegationAction } from '@metamask/delegation-controller';
@@ -6,7 +5,7 @@ import type { Messenger } from '@metamask/messenger';
6
5
  import type { MoneyAccountBalanceServiceFetchBalanceWithFallbackAction } from '@metamask/money-account-balance-service';
7
6
  import type { MoneyAccountUpgradeControllerForceUpgradeAccountAction } from '@metamask/money-account-upgrade-controller';
8
7
  import type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';
9
- import type { SubscriptionControllerGetPricingAction, SubscriptionControllerGetSubscriptionsAction, SubscriptionControllerStartSubscriptionWithCryptoAction } from '../SubscriptionController-method-action-types.js';
8
+ import type { SubscriptionControllerGetPricingAction, SubscriptionControllerGetSubscriptionsAction, SubscriptionControllerIsUserEligibleForTrialAction, SubscriptionControllerStartSubscriptionWithCryptoAction } from '../SubscriptionController-method-action-types.js';
10
9
  import type { SubscriptionControllerGetStateAction } from '../SubscriptionController.js';
11
10
  import type { SubscriptionDelegationServiceMethodActions } from './SubscriptionDelegationService-method-action-types.js';
12
11
  import type { MoneyAccountBalanceCheckRequest, MoneyAccountBalanceCheckResult, PrepareSubscriptionDelegationRequest, PreparedSubscriptionDelegation, StartSubscriptionWithDelegationRequest, StartSubscriptionWithDelegationResult } from './types.js';
@@ -22,7 +21,7 @@ export type SubscriptionDelegationServiceActions = SubscriptionDelegationService
22
21
  /**
23
22
  * Actions from other messengers that {@link SubscriptionDelegationServiceMessenger} calls.
24
23
  */
25
- type AllowedActions = AuthenticatedUserStorageServiceListDelegationsAction | AuthenticatedUserStorageServiceCreateDelegationAction | ChompApiServiceVerifyDelegationAction | ChompApiServiceCreateIntentsAction | ChompApiServiceGetIntentsByAddressAction | DelegationControllerSignDelegationAction | ApprovalControllerAddRequestAction | MoneyAccountUpgradeControllerForceUpgradeAccountAction | MoneyAccountBalanceServiceFetchBalanceWithFallbackAction | RemoteFeatureFlagControllerGetStateAction | SubscriptionControllerGetStateAction | SubscriptionControllerGetPricingAction | SubscriptionControllerGetSubscriptionsAction | SubscriptionControllerStartSubscriptionWithCryptoAction;
24
+ type AllowedActions = AuthenticatedUserStorageServiceListDelegationsAction | AuthenticatedUserStorageServiceCreateDelegationAction | ChompApiServiceVerifyDelegationAction | ChompApiServiceCreateIntentsAction | ChompApiServiceGetIntentsByAddressAction | DelegationControllerSignDelegationAction | MoneyAccountUpgradeControllerForceUpgradeAccountAction | MoneyAccountBalanceServiceFetchBalanceWithFallbackAction | RemoteFeatureFlagControllerGetStateAction | SubscriptionControllerGetStateAction | SubscriptionControllerGetPricingAction | SubscriptionControllerGetSubscriptionsAction | SubscriptionControllerIsUserEligibleForTrialAction | SubscriptionControllerStartSubscriptionWithCryptoAction;
26
25
  /**
27
26
  * Events that {@link SubscriptionDelegationService} exposes to other consumers.
28
27
  */
@@ -72,22 +71,17 @@ export declare class SubscriptionDelegationService {
72
71
  * Runs the complete Money Account subscription checkout authorization flow.
73
72
  *
74
73
  * Subscriptions are refreshed first. An active subscription for the product
75
- * is rejected before Money Account upgrade, approval, delegation signing,
76
- * persistence, or CHOMP registration.
74
+ * is rejected before Money Account upgrade, delegation signing, persistence,
75
+ * or CHOMP registration.
77
76
  *
78
- * Before the approval, `MoneyAccountUpgradeController` is asked to ensure
79
- * the Money Account vault delegations and CHOMP intents exist; the
80
- * Subscription API validates them server-side. The custom approval is the
81
- * sole consent and funding boundary for the payment permission. No payment
82
- * delegation signing, persistence, or intent mutation occurs before it
83
- * returns a funding transaction hash.
77
+ * The caller must obtain user consent and initiate funding before calling.
78
+ * `MoneyAccountUpgradeController` ensures the Money Account vault
79
+ * delegations and CHOMP intents exist. The Subscription API validates those
80
+ * delegations and the Money Account balance server-side. No payment
81
+ * delegation signing, persistence, or intent mutation occurs before the
82
+ * account is upgraded.
84
83
  *
85
- * When `request.skipApproval` is `true`, the approval request and its
86
- * result validation are skipped and the flow proceeds directly to signing.
87
- * The caller is then responsible for consent and funding.
88
- *
89
- * @param request - Product selection, Money Account identity, and optional
90
- * `skipApproval` flag.
84
+ * @param request - Product selection and Money Account identity.
91
85
  * @returns The result from `SubscriptionController:startSubscriptionWithCrypto`.
92
86
  */
93
87
  startSubscriptionWithDelegation(request: StartSubscriptionWithDelegationRequest): Promise<StartSubscriptionWithDelegationResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionDelegationService.d.ts","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kCAAkC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAEV,qDAAqD,EACrD,oDAAoD,EACrD,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,kCAAkC,EAClC,wCAAwC,EACxC,qCAAqC,EACtC,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,iCAAiC,CAAC;AAGhG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wDAAwD,EAAE,MAAM,yCAAyC,CAAC;AACxH,OAAO,KAAK,EAAE,sDAAsD,EAAE,MAAM,4CAA4C,CAAC;AAMzH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AAS1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C,8BAA8B,CAAC,CAMzC;IA+BD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,+BAA+B,CACnC,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,qCAAqC,CAAC,CAyFhD;IA4TD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,iBAAiB,CACrB,OAAO,EAAE,oCAAoC,EAC7C,QAAQ,UAAQ,GACf,OAAO,CAAC,8BAA8B,CAAC,CAoKzC;CAkJF"}
1
+ {"version":3,"file":"SubscriptionDelegationService.d.ts","sourceRoot":"","sources":["../../src/subscription-delegation/SubscriptionDelegationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,qDAAqD,EACrD,oDAAoD,EACrD,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,kCAAkC,EAClC,wCAAwC,EACxC,qCAAqC,EACtC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,iCAAiC,CAAC;AAGhG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wDAAwD,EAAE,MAAM,yCAAyC,CAAC;AACxH,OAAO,KAAK,EAAE,sDAAsD,EAAE,MAAM,4CAA4C,CAAC;AAKzH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AAS1G,OAAO,KAAK,EACV,sCAAsC,EACtC,4CAA4C,EAC5C,kDAAkD,EAClD,uDAAuD,EACxD,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAC;AAsBzF,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,wDAAwD,CAAC;AAKzH,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC9B,oCAAoC,EAEpC,8BAA8B,EAE9B,sCAAsC,EACtC,qCAAqC,EAGtC,MAAM,YAAY,CAAC;AAGpB;;;GAGG;AACH,eA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