@metamask/ramps-controller 16.0.0 → 17.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 (50) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/RampsController.cjs +42 -70
  3. package/dist/RampsController.cjs.map +1 -1
  4. package/dist/RampsController.d.cts +9 -26
  5. package/dist/RampsController.d.cts.map +1 -1
  6. package/dist/RampsController.d.mts +9 -26
  7. package/dist/RampsController.d.mts.map +1 -1
  8. package/dist/RampsController.mjs +42 -70
  9. package/dist/RampsController.mjs.map +1 -1
  10. package/dist/errorNormalization.cjs +84 -0
  11. package/dist/errorNormalization.cjs.map +1 -0
  12. package/dist/errorNormalization.d.cts +56 -0
  13. package/dist/errorNormalization.d.cts.map +1 -0
  14. package/dist/errorNormalization.d.mts +56 -0
  15. package/dist/errorNormalization.d.mts.map +1 -0
  16. package/dist/errorNormalization.mjs +78 -0
  17. package/dist/errorNormalization.mjs.map +1 -0
  18. package/dist/featureFlags.cjs +39 -0
  19. package/dist/featureFlags.cjs.map +1 -0
  20. package/dist/featureFlags.d.cts +40 -0
  21. package/dist/featureFlags.d.cts.map +1 -0
  22. package/dist/featureFlags.d.mts +40 -0
  23. package/dist/featureFlags.d.mts.map +1 -0
  24. package/dist/featureFlags.mjs +35 -0
  25. package/dist/featureFlags.mjs.map +1 -0
  26. package/dist/index.cjs +17 -1
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +7 -1
  29. package/dist/index.d.cts.map +1 -1
  30. package/dist/index.d.mts +7 -1
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +4 -0
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/providerAvailability.cjs +103 -0
  35. package/dist/providerAvailability.cjs.map +1 -0
  36. package/dist/providerAvailability.d.cts +76 -0
  37. package/dist/providerAvailability.d.cts.map +1 -0
  38. package/dist/providerAvailability.d.mts +76 -0
  39. package/dist/providerAvailability.d.mts.map +1 -0
  40. package/dist/providerAvailability.mjs +96 -0
  41. package/dist/providerAvailability.mjs.map +1 -0
  42. package/dist/quoteClassification.cjs +44 -0
  43. package/dist/quoteClassification.cjs.map +1 -0
  44. package/dist/quoteClassification.d.cts +33 -0
  45. package/dist/quoteClassification.d.cts.map +1 -0
  46. package/dist/quoteClassification.d.mts +33 -0
  47. package/dist/quoteClassification.d.mts.map +1 -0
  48. package/dist/quoteClassification.mjs +38 -0
  49. package/dist/quoteClassification.mjs.map +1 -0
  50. package/package.json +3 -2
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export type { RampsControllerActions, RampsControllerEvents, RampsControllerGetStateAction, RampsControllerMessenger, RampsControllerState, RampsControllerStateChangeEvent, RampsControllerOrderStatusChangedEvent, RampsControllerOptions, ProviderScope, UserRegion, ResourceState, TransakState, NativeProvidersState, } from "./RampsController.mjs";
1
+ export type { RampsControllerActions, RampsControllerEvents, RampsControllerGetStateAction, RampsControllerMessenger, RampsControllerState, RampsControllerStateChangeEvent, RampsControllerOrderStatusChangedEvent, RampsControllerOptions, UserRegion, ResourceState, TransakState, NativeProvidersState, } from "./RampsController.mjs";
2
2
  export type { RampsControllerExecuteRequestAction, RampsControllerAbortRequestAction, RampsControllerGetRequestStateAction, RampsControllerSetUserRegionAction, RampsControllerSetSelectedProviderAction, RampsControllerInitAction, RampsControllerGetCountriesAction, RampsControllerGetTokensAction, RampsControllerSetSelectedTokenAction, RampsControllerGetProvidersAction, RampsControllerGetPaymentMethodsAction, RampsControllerSetSelectedPaymentMethodAction, RampsControllerGetQuotesAction, RampsControllerAddOrderAction, RampsControllerRemoveOrderAction, RampsControllerStartOrderPollingAction, RampsControllerStopOrderPollingAction, RampsControllerGetBuyWidgetDataAction, RampsControllerAddPrecreatedOrderAction, RampsControllerGetOrderAction, RampsControllerGetOrderFromCallbackAction, RampsControllerTransakSetApiKeyAction, RampsControllerTransakSetAccessTokenAction, RampsControllerTransakClearAccessTokenAction, RampsControllerTransakSetAuthenticatedAction, RampsControllerTransakResetStateAction, RampsControllerTransakSendUserOtpAction, RampsControllerTransakVerifyUserOtpAction, RampsControllerTransakLogoutAction, RampsControllerTransakGetUserDetailsAction, RampsControllerTransakGetBuyQuoteAction, RampsControllerTransakGetKycRequirementAction, RampsControllerTransakGetAdditionalRequirementsAction, RampsControllerTransakCreateOrderAction, RampsControllerTransakGetOrderAction, RampsControllerTransakGetUserLimitsAction, RampsControllerTransakRequestOttAction, RampsControllerTransakGeneratePaymentWidgetUrlAction, RampsControllerTransakSubmitPurposeOfUsageFormAction, RampsControllerTransakPatchUserAction, RampsControllerTransakSubmitSsnDetailsAction, RampsControllerTransakConfirmPaymentAction, RampsControllerTransakGetTranslationAction, RampsControllerTransakGetIdProofStatusAction, RampsControllerTransakCancelOrderAction, RampsControllerTransakCancelAllActiveOrdersAction, RampsControllerTransakGetActiveOrdersAction, } from "./RampsController-method-action-types.mjs";
3
3
  export { RampsController, getDefaultRampsControllerState, getInternalOrderCode, RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS, } from "./RampsController.mjs";
4
4
  export type { RampsServiceActions, RampsServiceEvents, RampsServiceMessenger, Country, State, SupportedActions, CountryPhone, Provider, ProviderLink, ProviderLogos, ProviderBrowserType, ProviderLimit, ProviderFiatLimits, ProviderLimits, RampAction, PaymentMethod, PaymentMethodsResponse, Quote, QuoteError, QuoteSortBy, QuoteSortOrder, QuoteCryptoTranslation, QuoteCustomAction, QuotesResponse, GetQuotesParams, RampsToken, TokensResponse, BuyWidget, RampsOrder, RampsOrderNetwork, RampsOrderCryptoCurrency, RampsOrderFiatCurrency, RampsOrderPaymentMethod, OrderPaymentDetail, } from "./RampsService.mjs";
@@ -10,6 +10,12 @@ export { RequestStatus, DEFAULT_REQUEST_CACHE_TTL, DEFAULT_REQUEST_CACHE_MAX_SIZ
10
10
  export { RAMPS_ERROR_CODES } from "./rampsErrorCodes.mjs";
11
11
  export type { RequestSelectorResult } from "./selectors.mjs";
12
12
  export { createRequestSelector } from "./selectors.mjs";
13
+ export type { HeadlessFeatureFlagsLookup } from "./featureFlags.mjs";
14
+ export { MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY, isHeadlessAllProvidersEnabled, } from "./featureFlags.mjs";
15
+ export { providerServesAsset, getProvidersServingAsset, regionHasProviderForAsset, isFiatDepositAvailable, } from "./providerAvailability.mjs";
16
+ export { isExternalBrowserQuote, isCustomActionQuote, isInAppOnlyQuote, } from "./quoteClassification.mjs";
17
+ export type { TypedError } from "./errorNormalization.mjs";
18
+ export { getErrorMessage, extractExplicitTypedError, normalizeToTypedError, } from "./errorNormalization.mjs";
13
19
  export type { TransakServiceActions, TransakServiceEvents, TransakServiceMessenger, TransakAccessToken, TransakUserDetails, TransakUserDetailsAddress, TransakUserDetailsKycDetails, TransakBuyQuote, TransakKycRequirement, TransakAdditionalRequirement, TransakAdditionalRequirementsResponse, TransakOttResponse, TransakOrderPaymentMethod, TransakDepositOrder, TransakDepositNetwork, TransakDepositCryptoCurrency, TransakDepositPaymentMethod, TransakDepositRegion, TransakOrder, TransakQuoteTranslation, TransakTranslationRequest, TransakUserLimits, TransakIdProofStatus, PatchUserRequestBody as TransakPatchUserRequestBody, } from "./TransakService.mjs";
14
20
  export { TransakApiError, TransakService, TransakEnvironment, TransakOrderIdTransformer, } from "./TransakService.mjs";
15
21
  export { getTransakApiMessage, isTransakPhoneRegisteredError, } from "./transakApiErrorUtils.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/index.mjs CHANGED
@@ -3,6 +3,10 @@ export { RampsService, RampsEnvironment, RampsApiService, RampsOrderStatus, RAMP
3
3
  export { RequestStatus, DEFAULT_REQUEST_CACHE_TTL, DEFAULT_REQUEST_CACHE_MAX_SIZE, createCacheKey, isCacheExpired, createLoadingState, createSuccessState, createErrorState } from "./RequestCache.mjs";
4
4
  export { RAMPS_ERROR_CODES } from "./rampsErrorCodes.mjs";
5
5
  export { createRequestSelector } from "./selectors.mjs";
6
+ export { MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY, isHeadlessAllProvidersEnabled } from "./featureFlags.mjs";
7
+ export { providerServesAsset, getProvidersServingAsset, regionHasProviderForAsset, isFiatDepositAvailable } from "./providerAvailability.mjs";
8
+ export { isExternalBrowserQuote, isCustomActionQuote, isInAppOnlyQuote } from "./quoteClassification.mjs";
9
+ export { getErrorMessage, extractExplicitTypedError, normalizeToTypedError } from "./errorNormalization.mjs";
6
10
  export { TransakApiError, TransakService, TransakEnvironment, TransakOrderIdTransformer } from "./TransakService.mjs";
7
11
  export { getTransakApiMessage, isTransakPhoneRegisteredError } from "./transakApiErrorUtils.mjs";
8
12
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgEA,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EAC1C,8BAA0B;AAqC3B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,2BAAuB;AAkBxB,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,2BAAuB;AACxB,OAAO,EAAE,iBAAiB,EAAE,8BAA0B;AAEtD,OAAO,EAAE,qBAAqB,EAAE,wBAAoB;AA2BpD,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EAC1B,6BAAyB;AAC1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC9B,mCAA+B","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerOptions,\n ProviderScope,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n} from './RampsController';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n} from './RampsController-method-action-types';\nexport {\n RampsController,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n} from './RampsController';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n} from './RampsService';\nexport type {\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache';\nexport type { RampsErrorCode } from './rampsErrorCodes';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes';\nexport type { RequestSelectorResult } from './selectors';\nexport { createRequestSelector } from './selectors';\nexport type {\n TransakServiceActions,\n TransakServiceEvents,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n} from './TransakService-method-action-types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+DA,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EAC1C,8BAA0B;AAqC3B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,2BAAuB;AAkBxB,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,2BAAuB;AACxB,OAAO,EAAE,iBAAiB,EAAE,8BAA0B;AAEtD,OAAO,EAAE,qBAAqB,EAAE,wBAAoB;AAEpD,OAAO,EACL,qCAAqC,EACrC,6BAA6B,EAC9B,2BAAuB;AACxB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACvB,mCAA+B;AAChC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EACjB,kCAA8B;AAE/B,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACtB,iCAA6B;AA2B9B,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EAC1B,6BAAyB;AAC1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC9B,mCAA+B","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerOptions,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n} from './RampsController';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n} from './RampsController-method-action-types';\nexport {\n RampsController,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n} from './RampsController';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n} from './RampsService';\nexport type {\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache';\nexport type { RampsErrorCode } from './rampsErrorCodes';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes';\nexport type { RequestSelectorResult } from './selectors';\nexport { createRequestSelector } from './selectors';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags';\nexport {\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags';\nexport {\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n} from './quoteClassification';\nexport type { TypedError } from './errorNormalization';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization';\nexport type {\n TransakServiceActions,\n TransakServiceEvents,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n} from './TransakService-method-action-types';\n"]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFiatDepositAvailable = exports.regionHasProviderForAsset = exports.getProvidersServingAsset = exports.providerServesAsset = void 0;
4
+ /**
5
+ * Whether a provider serves the given deposit asset.
6
+ *
7
+ * Mirrors the region-provider matching the controller performs internally: a
8
+ * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by
9
+ * CAIP-19 asset id) contains the asset id, compared case-insensitively on both
10
+ * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the
11
+ * providers API returns both forms, so only the lowercased forms are compared.
12
+ * A provider without a `supportedCryptoCurrencies` map is treated as not
13
+ * serving the asset.
14
+ *
15
+ * @param provider - The provider to test.
16
+ * @param assetId - CAIP-19 asset id of the deposit asset.
17
+ * @returns Whether the provider serves the asset.
18
+ */
19
+ function providerServesAsset(provider, assetId) {
20
+ const map = provider?.supportedCryptoCurrencies;
21
+ if (!map) {
22
+ return false;
23
+ }
24
+ const target = assetId.toLowerCase();
25
+ return Object.keys(map).some((key) => key.toLowerCase() === target);
26
+ }
27
+ exports.providerServesAsset = providerServesAsset;
28
+ /**
29
+ * Filters a provider list down to those serving the given deposit asset.
30
+ *
31
+ * @param providers - The providers to filter.
32
+ * @param assetId - CAIP-19 asset id of the deposit asset.
33
+ * @returns The subset of providers serving the asset.
34
+ */
35
+ function getProvidersServingAsset(providers, assetId) {
36
+ return providers.filter((provider) => providerServesAsset(provider, assetId));
37
+ }
38
+ exports.getProvidersServingAsset = getProvidersServingAsset;
39
+ /**
40
+ * Whether a region offers a usable on-ramp provider that serves the given
41
+ * deposit asset, under the all-providers feature flag. This is the pure,
42
+ * asset-aware region gate shared between the controller and headless-buy
43
+ * consumers so the two never disagree about eligibility.
44
+ *
45
+ * With `allProvidersEnabled` false the gate is native-only: the region must
46
+ * offer a native provider (e.g. Transak Native) that serves the asset. With
47
+ * `allProvidersEnabled` true the region is supported when any provider
48
+ * (native or aggregator) serves the asset; the controller's flag-aware
49
+ * `getQuotes` performs the precise provider selection at quote time. Fails
50
+ * closed: an empty or missing `assetId` returns `false`.
51
+ *
52
+ * @param options - The options.
53
+ * @param options.providers - The region's providers (native and aggregator).
54
+ * @param options.assetId - CAIP-19 asset id of the deposit asset.
55
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
56
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
57
+ * @returns Whether the region has a provider serving the asset.
58
+ */
59
+ function regionHasProviderForAsset({ providers, assetId, allProvidersEnabled, }) {
60
+ if (!assetId) {
61
+ return false;
62
+ }
63
+ const serving = getProvidersServingAsset(providers, assetId);
64
+ if (serving.some((provider) => provider.type === 'native')) {
65
+ return true;
66
+ }
67
+ if (!allProvidersEnabled) {
68
+ return false;
69
+ }
70
+ return serving.length > 0;
71
+ }
72
+ exports.regionHasProviderForAsset = regionHasProviderForAsset;
73
+ /**
74
+ * Whether headless fiat deposit is available for the current region, under
75
+ * the all-providers feature flag. Flag-aware and independent of which single
76
+ * provider is currently selected once widened, so the availability gate
77
+ * cannot disagree with the controller's own flag-aware provider pick.
78
+ *
79
+ * With `allProvidersEnabled` false the check keeps the native-only behaviour:
80
+ * a native provider must be the currently selected (preferred) one, since the
81
+ * controller resolves the selected provider first and an aggregator preferred
82
+ * provider would otherwise run a non-native deposit. With
83
+ * `allProvidersEnabled` true the flow is available whenever the region has
84
+ * any provider.
85
+ *
86
+ * @param options - The options.
87
+ * @param options.providers - The region's providers.
88
+ * @param options.selectedProvider - The currently selected provider, if any.
89
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
90
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
91
+ * @returns Whether headless fiat deposit is available.
92
+ */
93
+ function isFiatDepositAvailable({ providers, selectedProvider, allProvidersEnabled, }) {
94
+ if (selectedProvider?.type === 'native') {
95
+ return true;
96
+ }
97
+ if (!allProvidersEnabled) {
98
+ return false;
99
+ }
100
+ return providers.length > 0;
101
+ }
102
+ exports.isFiatDepositAvailable = isFiatDepositAvailable;
103
+ //# sourceMappingURL=providerAvailability.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerAvailability.cjs","sourceRoot":"","sources":["../src/providerAvailability.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;GAcG;AACH,SAAgB,mBAAmB,CACjC,QAAkB,EAClB,OAAe;IAEf,MAAM,GAAG,GAAG,QAAQ,EAAE,yBAAyB,CAAC;IAChD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AACtE,CAAC;AAVD,kDAUC;AAED;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,SAAqB,EACrB,OAAe;IAEf,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAChF,CAAC;AALD,4DAKC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,OAAO,EACP,mBAAmB,GAKpB;IACC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5B,CAAC;AApBD,8DAoBC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GAKpB;IACC,IAAI,gBAAgB,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9B,CAAC;AAhBD,wDAgBC","sourcesContent":["import type { Provider } from './RampsService';\n\n/**\n * Whether a provider serves the given deposit asset.\n *\n * Mirrors the region-provider matching the controller performs internally: a\n * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by\n * CAIP-19 asset id) contains the asset id, compared case-insensitively on both\n * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the\n * providers API returns both forms, so only the lowercased forms are compared.\n * A provider without a `supportedCryptoCurrencies` map is treated as not\n * serving the asset.\n *\n * @param provider - The provider to test.\n * @param assetId - CAIP-19 asset id of the deposit asset.\n * @returns Whether the provider serves the asset.\n */\nexport function providerServesAsset(\n provider: Provider,\n assetId: string,\n): boolean {\n const map = provider?.supportedCryptoCurrencies;\n if (!map) {\n return false;\n }\n const target = assetId.toLowerCase();\n return Object.keys(map).some((key) => key.toLowerCase() === target);\n}\n\n/**\n * Filters a provider list down to those serving the given deposit asset.\n *\n * @param providers - The providers to filter.\n * @param assetId - CAIP-19 asset id of the deposit asset.\n * @returns The subset of providers serving the asset.\n */\nexport function getProvidersServingAsset(\n providers: Provider[],\n assetId: string,\n): Provider[] {\n return providers.filter((provider) => providerServesAsset(provider, assetId));\n}\n\n/**\n * Whether a region offers a usable on-ramp provider that serves the given\n * deposit asset, under the all-providers feature flag. This is the pure,\n * asset-aware region gate shared between the controller and headless-buy\n * consumers so the two never disagree about eligibility.\n *\n * With `allProvidersEnabled` false the gate is native-only: the region must\n * offer a native provider (e.g. Transak Native) that serves the asset. With\n * `allProvidersEnabled` true the region is supported when any provider\n * (native or aggregator) serves the asset; the controller's flag-aware\n * `getQuotes` performs the precise provider selection at quote time. Fails\n * closed: an empty or missing `assetId` returns `false`.\n *\n * @param options - The options.\n * @param options.providers - The region's providers (native and aggregator).\n * @param options.assetId - CAIP-19 asset id of the deposit asset.\n * @param options.allProvidersEnabled - Whether the all-providers feature flag\n * is enabled (see `isHeadlessAllProvidersEnabled`).\n * @returns Whether the region has a provider serving the asset.\n */\nexport function regionHasProviderForAsset({\n providers,\n assetId,\n allProvidersEnabled,\n}: {\n providers: Provider[];\n assetId: string;\n allProvidersEnabled: boolean;\n}): boolean {\n if (!assetId) {\n return false;\n }\n const serving = getProvidersServingAsset(providers, assetId);\n if (serving.some((provider) => provider.type === 'native')) {\n return true;\n }\n if (!allProvidersEnabled) {\n return false;\n }\n return serving.length > 0;\n}\n\n/**\n * Whether headless fiat deposit is available for the current region, under\n * the all-providers feature flag. Flag-aware and independent of which single\n * provider is currently selected once widened, so the availability gate\n * cannot disagree with the controller's own flag-aware provider pick.\n *\n * With `allProvidersEnabled` false the check keeps the native-only behaviour:\n * a native provider must be the currently selected (preferred) one, since the\n * controller resolves the selected provider first and an aggregator preferred\n * provider would otherwise run a non-native deposit. With\n * `allProvidersEnabled` true the flow is available whenever the region has\n * any provider.\n *\n * @param options - The options.\n * @param options.providers - The region's providers.\n * @param options.selectedProvider - The currently selected provider, if any.\n * @param options.allProvidersEnabled - Whether the all-providers feature flag\n * is enabled (see `isHeadlessAllProvidersEnabled`).\n * @returns Whether headless fiat deposit is available.\n */\nexport function isFiatDepositAvailable({\n providers,\n selectedProvider,\n allProvidersEnabled,\n}: {\n providers: Provider[];\n selectedProvider?: Provider | null;\n allProvidersEnabled: boolean;\n}): boolean {\n if (selectedProvider?.type === 'native') {\n return true;\n }\n if (!allProvidersEnabled) {\n return false;\n }\n return providers.length > 0;\n}\n"]}
@@ -0,0 +1,76 @@
1
+ import type { Provider } from "./RampsService.cjs";
2
+ /**
3
+ * Whether a provider serves the given deposit asset.
4
+ *
5
+ * Mirrors the region-provider matching the controller performs internally: a
6
+ * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by
7
+ * CAIP-19 asset id) contains the asset id, compared case-insensitively on both
8
+ * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the
9
+ * providers API returns both forms, so only the lowercased forms are compared.
10
+ * A provider without a `supportedCryptoCurrencies` map is treated as not
11
+ * serving the asset.
12
+ *
13
+ * @param provider - The provider to test.
14
+ * @param assetId - CAIP-19 asset id of the deposit asset.
15
+ * @returns Whether the provider serves the asset.
16
+ */
17
+ export declare function providerServesAsset(provider: Provider, assetId: string): boolean;
18
+ /**
19
+ * Filters a provider list down to those serving the given deposit asset.
20
+ *
21
+ * @param providers - The providers to filter.
22
+ * @param assetId - CAIP-19 asset id of the deposit asset.
23
+ * @returns The subset of providers serving the asset.
24
+ */
25
+ export declare function getProvidersServingAsset(providers: Provider[], assetId: string): Provider[];
26
+ /**
27
+ * Whether a region offers a usable on-ramp provider that serves the given
28
+ * deposit asset, under the all-providers feature flag. This is the pure,
29
+ * asset-aware region gate shared between the controller and headless-buy
30
+ * consumers so the two never disagree about eligibility.
31
+ *
32
+ * With `allProvidersEnabled` false the gate is native-only: the region must
33
+ * offer a native provider (e.g. Transak Native) that serves the asset. With
34
+ * `allProvidersEnabled` true the region is supported when any provider
35
+ * (native or aggregator) serves the asset; the controller's flag-aware
36
+ * `getQuotes` performs the precise provider selection at quote time. Fails
37
+ * closed: an empty or missing `assetId` returns `false`.
38
+ *
39
+ * @param options - The options.
40
+ * @param options.providers - The region's providers (native and aggregator).
41
+ * @param options.assetId - CAIP-19 asset id of the deposit asset.
42
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
43
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
44
+ * @returns Whether the region has a provider serving the asset.
45
+ */
46
+ export declare function regionHasProviderForAsset({ providers, assetId, allProvidersEnabled, }: {
47
+ providers: Provider[];
48
+ assetId: string;
49
+ allProvidersEnabled: boolean;
50
+ }): boolean;
51
+ /**
52
+ * Whether headless fiat deposit is available for the current region, under
53
+ * the all-providers feature flag. Flag-aware and independent of which single
54
+ * provider is currently selected once widened, so the availability gate
55
+ * cannot disagree with the controller's own flag-aware provider pick.
56
+ *
57
+ * With `allProvidersEnabled` false the check keeps the native-only behaviour:
58
+ * a native provider must be the currently selected (preferred) one, since the
59
+ * controller resolves the selected provider first and an aggregator preferred
60
+ * provider would otherwise run a non-native deposit. With
61
+ * `allProvidersEnabled` true the flow is available whenever the region has
62
+ * any provider.
63
+ *
64
+ * @param options - The options.
65
+ * @param options.providers - The region's providers.
66
+ * @param options.selectedProvider - The currently selected provider, if any.
67
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
68
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
69
+ * @returns Whether headless fiat deposit is available.
70
+ */
71
+ export declare function isFiatDepositAvailable({ providers, selectedProvider, allProvidersEnabled, }: {
72
+ providers: Provider[];
73
+ selectedProvider?: Provider | null;
74
+ allProvidersEnabled: boolean;
75
+ }): boolean;
76
+ //# sourceMappingURL=providerAvailability.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerAvailability.d.cts","sourceRoot":"","sources":["../src/providerAvailability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,2BAAuB;AAE/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAOT;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,GACd,QAAQ,EAAE,CAEZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,OAAO,EACP,mBAAmB,GACpB,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAYV;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GACpB,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAQV"}
@@ -0,0 +1,76 @@
1
+ import type { Provider } from "./RampsService.mjs";
2
+ /**
3
+ * Whether a provider serves the given deposit asset.
4
+ *
5
+ * Mirrors the region-provider matching the controller performs internally: a
6
+ * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by
7
+ * CAIP-19 asset id) contains the asset id, compared case-insensitively on both
8
+ * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the
9
+ * providers API returns both forms, so only the lowercased forms are compared.
10
+ * A provider without a `supportedCryptoCurrencies` map is treated as not
11
+ * serving the asset.
12
+ *
13
+ * @param provider - The provider to test.
14
+ * @param assetId - CAIP-19 asset id of the deposit asset.
15
+ * @returns Whether the provider serves the asset.
16
+ */
17
+ export declare function providerServesAsset(provider: Provider, assetId: string): boolean;
18
+ /**
19
+ * Filters a provider list down to those serving the given deposit asset.
20
+ *
21
+ * @param providers - The providers to filter.
22
+ * @param assetId - CAIP-19 asset id of the deposit asset.
23
+ * @returns The subset of providers serving the asset.
24
+ */
25
+ export declare function getProvidersServingAsset(providers: Provider[], assetId: string): Provider[];
26
+ /**
27
+ * Whether a region offers a usable on-ramp provider that serves the given
28
+ * deposit asset, under the all-providers feature flag. This is the pure,
29
+ * asset-aware region gate shared between the controller and headless-buy
30
+ * consumers so the two never disagree about eligibility.
31
+ *
32
+ * With `allProvidersEnabled` false the gate is native-only: the region must
33
+ * offer a native provider (e.g. Transak Native) that serves the asset. With
34
+ * `allProvidersEnabled` true the region is supported when any provider
35
+ * (native or aggregator) serves the asset; the controller's flag-aware
36
+ * `getQuotes` performs the precise provider selection at quote time. Fails
37
+ * closed: an empty or missing `assetId` returns `false`.
38
+ *
39
+ * @param options - The options.
40
+ * @param options.providers - The region's providers (native and aggregator).
41
+ * @param options.assetId - CAIP-19 asset id of the deposit asset.
42
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
43
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
44
+ * @returns Whether the region has a provider serving the asset.
45
+ */
46
+ export declare function regionHasProviderForAsset({ providers, assetId, allProvidersEnabled, }: {
47
+ providers: Provider[];
48
+ assetId: string;
49
+ allProvidersEnabled: boolean;
50
+ }): boolean;
51
+ /**
52
+ * Whether headless fiat deposit is available for the current region, under
53
+ * the all-providers feature flag. Flag-aware and independent of which single
54
+ * provider is currently selected once widened, so the availability gate
55
+ * cannot disagree with the controller's own flag-aware provider pick.
56
+ *
57
+ * With `allProvidersEnabled` false the check keeps the native-only behaviour:
58
+ * a native provider must be the currently selected (preferred) one, since the
59
+ * controller resolves the selected provider first and an aggregator preferred
60
+ * provider would otherwise run a non-native deposit. With
61
+ * `allProvidersEnabled` true the flow is available whenever the region has
62
+ * any provider.
63
+ *
64
+ * @param options - The options.
65
+ * @param options.providers - The region's providers.
66
+ * @param options.selectedProvider - The currently selected provider, if any.
67
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
68
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
69
+ * @returns Whether headless fiat deposit is available.
70
+ */
71
+ export declare function isFiatDepositAvailable({ providers, selectedProvider, allProvidersEnabled, }: {
72
+ providers: Provider[];
73
+ selectedProvider?: Provider | null;
74
+ allProvidersEnabled: boolean;
75
+ }): boolean;
76
+ //# sourceMappingURL=providerAvailability.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerAvailability.d.mts","sourceRoot":"","sources":["../src/providerAvailability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,2BAAuB;AAE/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAOT;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,GACd,QAAQ,EAAE,CAEZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,OAAO,EACP,mBAAmB,GACpB,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAYV;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GACpB,EAAE;IACD,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAQV"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Whether a provider serves the given deposit asset.
3
+ *
4
+ * Mirrors the region-provider matching the controller performs internally: a
5
+ * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by
6
+ * CAIP-19 asset id) contains the asset id, compared case-insensitively on both
7
+ * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the
8
+ * providers API returns both forms, so only the lowercased forms are compared.
9
+ * A provider without a `supportedCryptoCurrencies` map is treated as not
10
+ * serving the asset.
11
+ *
12
+ * @param provider - The provider to test.
13
+ * @param assetId - CAIP-19 asset id of the deposit asset.
14
+ * @returns Whether the provider serves the asset.
15
+ */
16
+ export function providerServesAsset(provider, assetId) {
17
+ const map = provider?.supportedCryptoCurrencies;
18
+ if (!map) {
19
+ return false;
20
+ }
21
+ const target = assetId.toLowerCase();
22
+ return Object.keys(map).some((key) => key.toLowerCase() === target);
23
+ }
24
+ /**
25
+ * Filters a provider list down to those serving the given deposit asset.
26
+ *
27
+ * @param providers - The providers to filter.
28
+ * @param assetId - CAIP-19 asset id of the deposit asset.
29
+ * @returns The subset of providers serving the asset.
30
+ */
31
+ export function getProvidersServingAsset(providers, assetId) {
32
+ return providers.filter((provider) => providerServesAsset(provider, assetId));
33
+ }
34
+ /**
35
+ * Whether a region offers a usable on-ramp provider that serves the given
36
+ * deposit asset, under the all-providers feature flag. This is the pure,
37
+ * asset-aware region gate shared between the controller and headless-buy
38
+ * consumers so the two never disagree about eligibility.
39
+ *
40
+ * With `allProvidersEnabled` false the gate is native-only: the region must
41
+ * offer a native provider (e.g. Transak Native) that serves the asset. With
42
+ * `allProvidersEnabled` true the region is supported when any provider
43
+ * (native or aggregator) serves the asset; the controller's flag-aware
44
+ * `getQuotes` performs the precise provider selection at quote time. Fails
45
+ * closed: an empty or missing `assetId` returns `false`.
46
+ *
47
+ * @param options - The options.
48
+ * @param options.providers - The region's providers (native and aggregator).
49
+ * @param options.assetId - CAIP-19 asset id of the deposit asset.
50
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
51
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
52
+ * @returns Whether the region has a provider serving the asset.
53
+ */
54
+ export function regionHasProviderForAsset({ providers, assetId, allProvidersEnabled, }) {
55
+ if (!assetId) {
56
+ return false;
57
+ }
58
+ const serving = getProvidersServingAsset(providers, assetId);
59
+ if (serving.some((provider) => provider.type === 'native')) {
60
+ return true;
61
+ }
62
+ if (!allProvidersEnabled) {
63
+ return false;
64
+ }
65
+ return serving.length > 0;
66
+ }
67
+ /**
68
+ * Whether headless fiat deposit is available for the current region, under
69
+ * the all-providers feature flag. Flag-aware and independent of which single
70
+ * provider is currently selected once widened, so the availability gate
71
+ * cannot disagree with the controller's own flag-aware provider pick.
72
+ *
73
+ * With `allProvidersEnabled` false the check keeps the native-only behaviour:
74
+ * a native provider must be the currently selected (preferred) one, since the
75
+ * controller resolves the selected provider first and an aggregator preferred
76
+ * provider would otherwise run a non-native deposit. With
77
+ * `allProvidersEnabled` true the flow is available whenever the region has
78
+ * any provider.
79
+ *
80
+ * @param options - The options.
81
+ * @param options.providers - The region's providers.
82
+ * @param options.selectedProvider - The currently selected provider, if any.
83
+ * @param options.allProvidersEnabled - Whether the all-providers feature flag
84
+ * is enabled (see `isHeadlessAllProvidersEnabled`).
85
+ * @returns Whether headless fiat deposit is available.
86
+ */
87
+ export function isFiatDepositAvailable({ providers, selectedProvider, allProvidersEnabled, }) {
88
+ if (selectedProvider?.type === 'native') {
89
+ return true;
90
+ }
91
+ if (!allProvidersEnabled) {
92
+ return false;
93
+ }
94
+ return providers.length > 0;
95
+ }
96
+ //# sourceMappingURL=providerAvailability.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerAvailability.mjs","sourceRoot":"","sources":["../src/providerAvailability.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAkB,EAClB,OAAe;IAEf,MAAM,GAAG,GAAG,QAAQ,EAAE,yBAAyB,CAAC;IAChD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAqB,EACrB,OAAe;IAEf,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,yBAAyB,CAAC,EACxC,SAAS,EACT,OAAO,EACP,mBAAmB,GAKpB;IACC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GAKpB;IACC,IAAI,gBAAgB,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { Provider } from './RampsService';\n\n/**\n * Whether a provider serves the given deposit asset.\n *\n * Mirrors the region-provider matching the controller performs internally: a\n * provider serves the asset when its `supportedCryptoCurrencies` map (keyed by\n * CAIP-19 asset id) contains the asset id, compared case-insensitively on both\n * sides. EVM CAIP-19 asset ids may arrive checksummed or lowercased and the\n * providers API returns both forms, so only the lowercased forms are compared.\n * A provider without a `supportedCryptoCurrencies` map is treated as not\n * serving the asset.\n *\n * @param provider - The provider to test.\n * @param assetId - CAIP-19 asset id of the deposit asset.\n * @returns Whether the provider serves the asset.\n */\nexport function providerServesAsset(\n provider: Provider,\n assetId: string,\n): boolean {\n const map = provider?.supportedCryptoCurrencies;\n if (!map) {\n return false;\n }\n const target = assetId.toLowerCase();\n return Object.keys(map).some((key) => key.toLowerCase() === target);\n}\n\n/**\n * Filters a provider list down to those serving the given deposit asset.\n *\n * @param providers - The providers to filter.\n * @param assetId - CAIP-19 asset id of the deposit asset.\n * @returns The subset of providers serving the asset.\n */\nexport function getProvidersServingAsset(\n providers: Provider[],\n assetId: string,\n): Provider[] {\n return providers.filter((provider) => providerServesAsset(provider, assetId));\n}\n\n/**\n * Whether a region offers a usable on-ramp provider that serves the given\n * deposit asset, under the all-providers feature flag. This is the pure,\n * asset-aware region gate shared between the controller and headless-buy\n * consumers so the two never disagree about eligibility.\n *\n * With `allProvidersEnabled` false the gate is native-only: the region must\n * offer a native provider (e.g. Transak Native) that serves the asset. With\n * `allProvidersEnabled` true the region is supported when any provider\n * (native or aggregator) serves the asset; the controller's flag-aware\n * `getQuotes` performs the precise provider selection at quote time. Fails\n * closed: an empty or missing `assetId` returns `false`.\n *\n * @param options - The options.\n * @param options.providers - The region's providers (native and aggregator).\n * @param options.assetId - CAIP-19 asset id of the deposit asset.\n * @param options.allProvidersEnabled - Whether the all-providers feature flag\n * is enabled (see `isHeadlessAllProvidersEnabled`).\n * @returns Whether the region has a provider serving the asset.\n */\nexport function regionHasProviderForAsset({\n providers,\n assetId,\n allProvidersEnabled,\n}: {\n providers: Provider[];\n assetId: string;\n allProvidersEnabled: boolean;\n}): boolean {\n if (!assetId) {\n return false;\n }\n const serving = getProvidersServingAsset(providers, assetId);\n if (serving.some((provider) => provider.type === 'native')) {\n return true;\n }\n if (!allProvidersEnabled) {\n return false;\n }\n return serving.length > 0;\n}\n\n/**\n * Whether headless fiat deposit is available for the current region, under\n * the all-providers feature flag. Flag-aware and independent of which single\n * provider is currently selected once widened, so the availability gate\n * cannot disagree with the controller's own flag-aware provider pick.\n *\n * With `allProvidersEnabled` false the check keeps the native-only behaviour:\n * a native provider must be the currently selected (preferred) one, since the\n * controller resolves the selected provider first and an aggregator preferred\n * provider would otherwise run a non-native deposit. With\n * `allProvidersEnabled` true the flow is available whenever the region has\n * any provider.\n *\n * @param options - The options.\n * @param options.providers - The region's providers.\n * @param options.selectedProvider - The currently selected provider, if any.\n * @param options.allProvidersEnabled - Whether the all-providers feature flag\n * is enabled (see `isHeadlessAllProvidersEnabled`).\n * @returns Whether headless fiat deposit is available.\n */\nexport function isFiatDepositAvailable({\n providers,\n selectedProvider,\n allProvidersEnabled,\n}: {\n providers: Provider[];\n selectedProvider?: Provider | null;\n allProvidersEnabled: boolean;\n}): boolean {\n if (selectedProvider?.type === 'native') {\n return true;\n }\n if (!allProvidersEnabled) {\n return false;\n }\n return providers.length > 0;\n}\n"]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInAppOnlyQuote = exports.isCustomActionQuote = exports.isExternalBrowserQuote = void 0;
4
+ /**
5
+ * Whether a quote's checkout runs in an external / system browser rather than
6
+ * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the
7
+ * quotes API. When the hint is absent the quote is treated as in-app (the
8
+ * caller is responsible for the in-app WebView fail-safe).
9
+ *
10
+ * This is the pure classification only: it deliberately knows nothing about
11
+ * host redirect URLs or deeplink schemes, which stay in the consuming client.
12
+ *
13
+ * @param quote - The quote to classify.
14
+ * @returns Whether the quote uses an external browser.
15
+ */
16
+ function isExternalBrowserQuote(quote) {
17
+ return quote.quote?.buyWidget?.browser === 'IN_APP_OS_BROWSER';
18
+ }
19
+ exports.isExternalBrowserQuote = isExternalBrowserQuote;
20
+ /**
21
+ * Whether a quote is a custom-action ("checkout outside of MetaMask") quote,
22
+ * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the
23
+ * wire may carry even though it is absent from the published `Quote` type.
24
+ *
25
+ * @param quote - The quote to classify.
26
+ * @returns Whether the quote is a custom-action quote.
27
+ */
28
+ function isCustomActionQuote(quote) {
29
+ return quote.quote?.isCustomAction === true;
30
+ }
31
+ exports.isCustomActionQuote = isCustomActionQuote;
32
+ /**
33
+ * Whether a quote continues inside an in-app WebView, i.e. it is neither a
34
+ * custom-action quote nor an external-browser quote. This is the Phase 1
35
+ * in-app-only inclusion test.
36
+ *
37
+ * @param quote - The quote to classify.
38
+ * @returns Whether the quote is an in-app WebView quote.
39
+ */
40
+ function isInAppOnlyQuote(quote) {
41
+ return !isCustomActionQuote(quote) && !isExternalBrowserQuote(quote);
42
+ }
43
+ exports.isInAppOnlyQuote = isInAppOnlyQuote;
44
+ //# sourceMappingURL=quoteClassification.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoteClassification.cjs","sourceRoot":"","sources":["../src/quoteClassification.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;GAWG;AACH,SAAgB,sBAAsB,CAAC,KAAY;IACjD,OAAO,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,KAAK,mBAAmB,CAAC;AACjE,CAAC;AAFD,wDAEC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,KAAY;IAC9C,OAAQ,KAAK,CAAC,KAAsC,EAAE,cAAc,KAAK,IAAI,CAAC;AAChF,CAAC;AAFD,kDAEC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,KAAY;IAC3C,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAFD,4CAEC","sourcesContent":["import type { Quote } from './RampsService';\n\n/**\n * Whether a quote's checkout runs in an external / system browser rather than\n * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the\n * quotes API. When the hint is absent the quote is treated as in-app (the\n * caller is responsible for the in-app WebView fail-safe).\n *\n * This is the pure classification only: it deliberately knows nothing about\n * host redirect URLs or deeplink schemes, which stay in the consuming client.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote uses an external browser.\n */\nexport function isExternalBrowserQuote(quote: Quote): boolean {\n return quote.quote?.buyWidget?.browser === 'IN_APP_OS_BROWSER';\n}\n\n/**\n * Whether a quote is a custom-action (\"checkout outside of MetaMask\") quote,\n * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the\n * wire may carry even though it is absent from the published `Quote` type.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote is a custom-action quote.\n */\nexport function isCustomActionQuote(quote: Quote): boolean {\n return (quote.quote as { isCustomAction?: boolean })?.isCustomAction === true;\n}\n\n/**\n * Whether a quote continues inside an in-app WebView, i.e. it is neither a\n * custom-action quote nor an external-browser quote. This is the Phase 1\n * in-app-only inclusion test.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote is an in-app WebView quote.\n */\nexport function isInAppOnlyQuote(quote: Quote): boolean {\n return !isCustomActionQuote(quote) && !isExternalBrowserQuote(quote);\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import type { Quote } from "./RampsService.cjs";
2
+ /**
3
+ * Whether a quote's checkout runs in an external / system browser rather than
4
+ * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the
5
+ * quotes API. When the hint is absent the quote is treated as in-app (the
6
+ * caller is responsible for the in-app WebView fail-safe).
7
+ *
8
+ * This is the pure classification only: it deliberately knows nothing about
9
+ * host redirect URLs or deeplink schemes, which stay in the consuming client.
10
+ *
11
+ * @param quote - The quote to classify.
12
+ * @returns Whether the quote uses an external browser.
13
+ */
14
+ export declare function isExternalBrowserQuote(quote: Quote): boolean;
15
+ /**
16
+ * Whether a quote is a custom-action ("checkout outside of MetaMask") quote,
17
+ * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the
18
+ * wire may carry even though it is absent from the published `Quote` type.
19
+ *
20
+ * @param quote - The quote to classify.
21
+ * @returns Whether the quote is a custom-action quote.
22
+ */
23
+ export declare function isCustomActionQuote(quote: Quote): boolean;
24
+ /**
25
+ * Whether a quote continues inside an in-app WebView, i.e. it is neither a
26
+ * custom-action quote nor an external-browser quote. This is the Phase 1
27
+ * in-app-only inclusion test.
28
+ *
29
+ * @param quote - The quote to classify.
30
+ * @returns Whether the quote is an in-app WebView quote.
31
+ */
32
+ export declare function isInAppOnlyQuote(quote: Quote): boolean;
33
+ //# sourceMappingURL=quoteClassification.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoteClassification.d.cts","sourceRoot":"","sources":["../src/quoteClassification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,2BAAuB;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,33 @@
1
+ import type { Quote } from "./RampsService.mjs";
2
+ /**
3
+ * Whether a quote's checkout runs in an external / system browser rather than
4
+ * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the
5
+ * quotes API. When the hint is absent the quote is treated as in-app (the
6
+ * caller is responsible for the in-app WebView fail-safe).
7
+ *
8
+ * This is the pure classification only: it deliberately knows nothing about
9
+ * host redirect URLs or deeplink schemes, which stay in the consuming client.
10
+ *
11
+ * @param quote - The quote to classify.
12
+ * @returns Whether the quote uses an external browser.
13
+ */
14
+ export declare function isExternalBrowserQuote(quote: Quote): boolean;
15
+ /**
16
+ * Whether a quote is a custom-action ("checkout outside of MetaMask") quote,
17
+ * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the
18
+ * wire may carry even though it is absent from the published `Quote` type.
19
+ *
20
+ * @param quote - The quote to classify.
21
+ * @returns Whether the quote is a custom-action quote.
22
+ */
23
+ export declare function isCustomActionQuote(quote: Quote): boolean;
24
+ /**
25
+ * Whether a quote continues inside an in-app WebView, i.e. it is neither a
26
+ * custom-action quote nor an external-browser quote. This is the Phase 1
27
+ * in-app-only inclusion test.
28
+ *
29
+ * @param quote - The quote to classify.
30
+ * @returns Whether the quote is an in-app WebView quote.
31
+ */
32
+ export declare function isInAppOnlyQuote(quote: Quote): boolean;
33
+ //# sourceMappingURL=quoteClassification.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoteClassification.d.mts","sourceRoot":"","sources":["../src/quoteClassification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,2BAAuB;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEtD"}