@metamask/ramps-controller 20.3.0 → 21.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.
- package/CHANGELOG.md +17 -1
- package/dist/{NeoBankService-method-action-types.d.mts → NeoBankService-method-action-types.d.ts} +2 -2
- package/dist/NeoBankService-method-action-types.d.ts.map +1 -0
- package/dist/{NeoBankService-method-action-types.mjs → NeoBankService-method-action-types.js} +1 -1
- package/dist/NeoBankService-method-action-types.js.map +1 -0
- package/dist/{NeoBankService.d.cts → NeoBankService.d.ts} +8 -8
- package/dist/NeoBankService.d.ts.map +1 -0
- package/dist/NeoBankService.js +380 -0
- package/dist/NeoBankService.js.map +1 -0
- package/dist/{RampsController-method-action-types.d.mts → RampsController-method-action-types.d.ts} +2 -2
- package/dist/RampsController-method-action-types.d.ts.map +1 -0
- package/dist/{TransakService-method-action-types.mjs → RampsController-method-action-types.js} +1 -1
- package/dist/RampsController-method-action-types.js.map +1 -0
- package/dist/{RampsController.d.cts → RampsController.d.ts} +19 -19
- package/dist/RampsController.d.ts.map +1 -0
- package/dist/{RampsController.mjs → RampsController.js} +725 -613
- package/dist/RampsController.js.map +1 -0
- package/dist/{RampsService-method-action-types.d.cts → RampsService-method-action-types.d.ts} +2 -2
- package/dist/RampsService-method-action-types.d.ts.map +1 -0
- package/dist/{RampsService-method-action-types.mjs → RampsService-method-action-types.js} +1 -1
- package/dist/RampsService-method-action-types.js.map +1 -0
- package/dist/{RampsService.d.mts → RampsService.d.ts} +5 -5
- package/dist/RampsService.d.ts.map +1 -0
- package/dist/{RampsService.mjs → RampsService.js} +159 -147
- package/dist/RampsService.js.map +1 -0
- package/dist/{RequestCache.d.mts → RequestCache.d.ts} +3 -3
- package/dist/RequestCache.d.ts.map +1 -0
- package/dist/{RequestCache.mjs → RequestCache.js} +1 -1
- package/dist/RequestCache.js.map +1 -0
- package/dist/{TransakService-method-action-types.d.cts → TransakService-method-action-types.d.ts} +2 -2
- package/dist/TransakService-method-action-types.d.ts.map +1 -0
- package/dist/{RampsController-method-action-types.mjs → TransakService-method-action-types.js} +1 -1
- package/dist/TransakService-method-action-types.js.map +1 -0
- package/dist/{TransakService.d.cts → TransakService.d.ts} +6 -6
- package/dist/TransakService.d.ts.map +1 -0
- package/dist/TransakService.js +746 -0
- package/dist/TransakService.js.map +1 -0
- package/dist/{autoramp-types.d.cts → autoramp-types.d.ts} +1 -1
- package/dist/autoramp-types.d.ts.map +1 -0
- package/dist/autoramp-types.js +2 -0
- package/dist/autoramp-types.js.map +1 -0
- package/dist/{autorampAccount.d.mts → autorampAccount.d.ts} +3 -3
- package/dist/autorampAccount.d.ts.map +1 -0
- package/dist/{autorampAccount.mjs → autorampAccount.js} +1 -1
- package/dist/autorampAccount.js.map +1 -0
- package/dist/{client-identity.d.mts → client-identity.d.ts} +1 -1
- package/dist/client-identity.d.ts.map +1 -0
- package/dist/{client-identity.mjs → client-identity.js} +1 -1
- package/dist/client-identity.js.map +1 -0
- package/dist/{errorNormalization.d.mts → errorNormalization.d.ts} +1 -1
- package/dist/errorNormalization.d.ts.map +1 -0
- package/dist/{errorNormalization.mjs → errorNormalization.js} +1 -1
- package/dist/errorNormalization.js.map +1 -0
- package/dist/{featureFlags.d.mts → featureFlags.d.ts} +2 -2
- package/dist/featureFlags.d.ts.map +1 -0
- package/dist/{featureFlags.mjs → featureFlags.js} +1 -1
- package/dist/featureFlags.js.map +1 -0
- package/dist/{index.d.mts → index.d.ts} +35 -35
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/{orderStatus.d.mts → orderStatus.d.ts} +2 -2
- package/dist/orderStatus.d.ts.map +1 -0
- package/dist/{orderStatus.mjs → orderStatus.js} +2 -2
- package/dist/orderStatus.js.map +1 -0
- package/dist/{ownership-message.d.cts → ownership-message.d.ts} +1 -1
- package/dist/ownership-message.d.ts.map +1 -0
- package/dist/{ownership-message.mjs → ownership-message.js} +1 -1
- package/dist/ownership-message.js.map +1 -0
- package/dist/{paymentMethodMerge.d.cts → paymentMethodMerge.d.ts} +2 -2
- package/dist/paymentMethodMerge.d.ts.map +1 -0
- package/dist/{paymentMethodMerge.mjs → paymentMethodMerge.js} +1 -1
- package/dist/paymentMethodMerge.js.map +1 -0
- package/dist/{providerAvailability.d.cts → providerAvailability.d.ts} +2 -2
- package/dist/providerAvailability.d.ts.map +1 -0
- package/dist/{providerAvailability.mjs → providerAvailability.js} +1 -1
- package/dist/providerAvailability.js.map +1 -0
- package/dist/{quoteClassification.d.cts → quoteClassification.d.ts} +2 -2
- package/dist/quoteClassification.d.ts.map +1 -0
- package/dist/{quoteClassification.mjs → quoteClassification.js} +1 -1
- package/dist/quoteClassification.js.map +1 -0
- package/dist/{rampsErrorCodes.d.cts → rampsErrorCodes.d.ts} +2 -2
- package/dist/rampsErrorCodes.d.ts.map +1 -0
- package/dist/{rampsErrorCodes.mjs → rampsErrorCodes.js} +1 -1
- package/dist/rampsErrorCodes.js.map +1 -0
- package/dist/{selectors.d.mts → selectors.d.ts} +3 -3
- package/dist/selectors.d.ts.map +1 -0
- package/dist/{selectors.mjs → selectors.js} +2 -2
- package/dist/selectors.js.map +1 -0
- package/dist/{transakApiErrorUtils.d.cts → transakApiErrorUtils.d.ts} +1 -1
- package/dist/transakApiErrorUtils.d.ts.map +1 -0
- package/dist/{transakApiErrorUtils.mjs → transakApiErrorUtils.js} +3 -3
- package/dist/transakApiErrorUtils.js.map +1 -0
- package/dist/{transakErrorCodes.d.cts → transakErrorCodes.d.ts} +3 -3
- package/dist/transakErrorCodes.d.ts.map +1 -0
- package/dist/{transakErrorCodes.mjs → transakErrorCodes.js} +1 -1
- package/dist/transakErrorCodes.js.map +1 -0
- package/dist/{wallet-registration-machine.d.cts → wallet-registration-machine.d.ts} +1 -1
- package/dist/wallet-registration-machine.d.ts.map +1 -0
- package/dist/{wallet-registration-machine.mjs → wallet-registration-machine.js} +1 -1
- package/dist/wallet-registration-machine.js.map +1 -0
- package/dist/{wallet-registration-service.d.cts → wallet-registration-service.d.ts} +1 -1
- package/dist/wallet-registration-service.d.ts.map +1 -0
- package/dist/{wallet-registration-service.mjs → wallet-registration-service.js} +60 -69
- package/dist/wallet-registration-service.js.map +1 -0
- package/package.json +17 -21
- package/dist/NeoBankService-method-action-types.cjs +0 -7
- package/dist/NeoBankService-method-action-types.cjs.map +0 -1
- package/dist/NeoBankService-method-action-types.d.cts +0 -126
- package/dist/NeoBankService-method-action-types.d.cts.map +0 -1
- package/dist/NeoBankService-method-action-types.d.mts.map +0 -1
- package/dist/NeoBankService-method-action-types.mjs.map +0 -1
- package/dist/NeoBankService.cjs +0 -387
- package/dist/NeoBankService.cjs.map +0 -1
- package/dist/NeoBankService.d.cts.map +0 -1
- package/dist/NeoBankService.d.mts +0 -191
- package/dist/NeoBankService.d.mts.map +0 -1
- package/dist/NeoBankService.mjs +0 -379
- package/dist/NeoBankService.mjs.map +0 -1
- package/dist/RampsController-method-action-types.cjs +0 -7
- package/dist/RampsController-method-action-types.cjs.map +0 -1
- package/dist/RampsController-method-action-types.d.cts +0 -758
- package/dist/RampsController-method-action-types.d.cts.map +0 -1
- package/dist/RampsController-method-action-types.d.mts.map +0 -1
- package/dist/RampsController-method-action-types.mjs.map +0 -1
- package/dist/RampsController.cjs +0 -2799
- package/dist/RampsController.cjs.map +0 -1
- package/dist/RampsController.d.cts.map +0 -1
- package/dist/RampsController.d.mts +0 -968
- package/dist/RampsController.d.mts.map +0 -1
- package/dist/RampsController.mjs.map +0 -1
- package/dist/RampsService-method-action-types.cjs +0 -7
- package/dist/RampsService-method-action-types.cjs.map +0 -1
- package/dist/RampsService-method-action-types.d.cts.map +0 -1
- package/dist/RampsService-method-action-types.d.mts +0 -171
- package/dist/RampsService-method-action-types.d.mts.map +0 -1
- package/dist/RampsService-method-action-types.mjs.map +0 -1
- package/dist/RampsService.cjs +0 -708
- package/dist/RampsService.cjs.map +0 -1
- package/dist/RampsService.d.cts +0 -944
- package/dist/RampsService.d.cts.map +0 -1
- package/dist/RampsService.d.mts.map +0 -1
- package/dist/RampsService.mjs.map +0 -1
- package/dist/RequestCache.cjs +0 -103
- package/dist/RequestCache.cjs.map +0 -1
- package/dist/RequestCache.d.cts +0 -110
- package/dist/RequestCache.d.cts.map +0 -1
- package/dist/RequestCache.d.mts.map +0 -1
- package/dist/RequestCache.mjs.map +0 -1
- package/dist/TransakService-method-action-types.cjs +0 -7
- package/dist/TransakService-method-action-types.cjs.map +0 -1
- package/dist/TransakService-method-action-types.d.cts.map +0 -1
- package/dist/TransakService-method-action-types.d.mts +0 -140
- package/dist/TransakService-method-action-types.d.mts.map +0 -1
- package/dist/TransakService-method-action-types.mjs.map +0 -1
- package/dist/TransakService.cjs +0 -743
- package/dist/TransakService.cjs.map +0 -1
- package/dist/TransakService.d.cts.map +0 -1
- package/dist/TransakService.d.mts +0 -370
- package/dist/TransakService.d.mts.map +0 -1
- package/dist/TransakService.mjs +0 -734
- package/dist/TransakService.mjs.map +0 -1
- package/dist/autoramp-types.cjs +0 -3
- package/dist/autoramp-types.cjs.map +0 -1
- package/dist/autoramp-types.d.cts.map +0 -1
- package/dist/autoramp-types.d.mts +0 -22
- package/dist/autoramp-types.d.mts.map +0 -1
- package/dist/autoramp-types.mjs +0 -2
- package/dist/autoramp-types.mjs.map +0 -1
- package/dist/autorampAccount.cjs +0 -155
- package/dist/autorampAccount.cjs.map +0 -1
- package/dist/autorampAccount.d.cts +0 -126
- package/dist/autorampAccount.d.cts.map +0 -1
- package/dist/autorampAccount.d.mts.map +0 -1
- package/dist/autorampAccount.mjs.map +0 -1
- package/dist/client-identity.cjs +0 -28
- package/dist/client-identity.cjs.map +0 -1
- package/dist/client-identity.d.cts +0 -24
- package/dist/client-identity.d.cts.map +0 -1
- package/dist/client-identity.d.mts.map +0 -1
- package/dist/client-identity.mjs.map +0 -1
- package/dist/errorNormalization.cjs +0 -84
- package/dist/errorNormalization.cjs.map +0 -1
- package/dist/errorNormalization.d.cts +0 -56
- package/dist/errorNormalization.d.cts.map +0 -1
- package/dist/errorNormalization.d.mts.map +0 -1
- package/dist/errorNormalization.mjs.map +0 -1
- package/dist/featureFlags.cjs +0 -144
- package/dist/featureFlags.cjs.map +0 -1
- package/dist/featureFlags.d.cts +0 -82
- package/dist/featureFlags.d.cts.map +0 -1
- package/dist/featureFlags.d.mts.map +0 -1
- package/dist/featureFlags.mjs.map +0 -1
- package/dist/index.cjs +0 -82
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -35
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -18
- package/dist/index.mjs.map +0 -1
- package/dist/orderStatus.cjs +0 -34
- package/dist/orderStatus.cjs.map +0 -1
- package/dist/orderStatus.d.cts +0 -18
- package/dist/orderStatus.d.cts.map +0 -1
- package/dist/orderStatus.d.mts.map +0 -1
- package/dist/orderStatus.mjs.map +0 -1
- package/dist/ownership-message.cjs +0 -26
- package/dist/ownership-message.cjs.map +0 -1
- package/dist/ownership-message.d.cts.map +0 -1
- package/dist/ownership-message.d.mts +0 -22
- package/dist/ownership-message.d.mts.map +0 -1
- package/dist/ownership-message.mjs.map +0 -1
- package/dist/paymentMethodMerge.cjs +0 -51
- package/dist/paymentMethodMerge.cjs.map +0 -1
- package/dist/paymentMethodMerge.d.cts.map +0 -1
- package/dist/paymentMethodMerge.d.mts +0 -26
- package/dist/paymentMethodMerge.d.mts.map +0 -1
- package/dist/paymentMethodMerge.mjs.map +0 -1
- package/dist/providerAvailability.cjs +0 -134
- package/dist/providerAvailability.cjs.map +0 -1
- package/dist/providerAvailability.d.cts.map +0 -1
- package/dist/providerAvailability.d.mts +0 -101
- package/dist/providerAvailability.d.mts.map +0 -1
- package/dist/providerAvailability.mjs.map +0 -1
- package/dist/quoteClassification.cjs +0 -44
- package/dist/quoteClassification.cjs.map +0 -1
- package/dist/quoteClassification.d.cts.map +0 -1
- package/dist/quoteClassification.d.mts +0 -33
- package/dist/quoteClassification.d.mts.map +0 -1
- package/dist/quoteClassification.mjs.map +0 -1
- package/dist/rampsErrorCodes.cjs +0 -11
- package/dist/rampsErrorCodes.cjs.map +0 -1
- package/dist/rampsErrorCodes.d.cts.map +0 -1
- package/dist/rampsErrorCodes.d.mts +0 -9
- package/dist/rampsErrorCodes.d.mts.map +0 -1
- package/dist/rampsErrorCodes.mjs.map +0 -1
- package/dist/selectors.cjs +0 -85
- package/dist/selectors.cjs.map +0 -1
- package/dist/selectors.d.cts +0 -78
- package/dist/selectors.d.cts.map +0 -1
- package/dist/selectors.d.mts.map +0 -1
- package/dist/selectors.mjs.map +0 -1
- package/dist/transakApiErrorUtils.cjs +0 -15
- package/dist/transakApiErrorUtils.cjs.map +0 -1
- package/dist/transakApiErrorUtils.d.cts.map +0 -1
- package/dist/transakApiErrorUtils.d.mts +0 -3
- package/dist/transakApiErrorUtils.d.mts.map +0 -1
- package/dist/transakApiErrorUtils.mjs.map +0 -1
- package/dist/transakErrorCodes.cjs +0 -14
- package/dist/transakErrorCodes.cjs.map +0 -1
- package/dist/transakErrorCodes.d.cts.map +0 -1
- package/dist/transakErrorCodes.d.mts +0 -12
- package/dist/transakErrorCodes.d.mts.map +0 -1
- package/dist/transakErrorCodes.mjs.map +0 -1
- package/dist/wallet-registration-machine.cjs +0 -144
- package/dist/wallet-registration-machine.cjs.map +0 -1
- package/dist/wallet-registration-machine.d.cts.map +0 -1
- package/dist/wallet-registration-machine.d.mts +0 -81
- package/dist/wallet-registration-machine.d.mts.map +0 -1
- package/dist/wallet-registration-machine.mjs.map +0 -1
- package/dist/wallet-registration-service.cjs +0 -351
- package/dist/wallet-registration-service.cjs.map +0 -1
- package/dist/wallet-registration-service.d.cts.map +0 -1
- package/dist/wallet-registration-service.d.mts +0 -144
- package/dist/wallet-registration-service.d.mts.map +0 -1
- package/dist/wallet-registration-service.mjs.map +0 -1
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeToTypedError = exports.extractExplicitTypedError = exports.getErrorMessage = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Type guard for a non-null object.
|
|
6
|
-
*
|
|
7
|
-
* @param value - The value to test.
|
|
8
|
-
* @returns Whether the value is a record.
|
|
9
|
-
*/
|
|
10
|
-
function isRecord(value) {
|
|
11
|
-
return typeof value === 'object' && value !== null;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Best-effort human-readable message from an arbitrary thrown/native value.
|
|
15
|
-
*
|
|
16
|
-
* @param error - The caught value.
|
|
17
|
-
* @returns The message, or `undefined` when none can be derived.
|
|
18
|
-
*/
|
|
19
|
-
function getErrorMessage(error) {
|
|
20
|
-
if (error instanceof Error) {
|
|
21
|
-
return error.message;
|
|
22
|
-
}
|
|
23
|
-
if (isRecord(error) && typeof error.message === 'string') {
|
|
24
|
-
return error.message;
|
|
25
|
-
}
|
|
26
|
-
if (typeof error === 'string') {
|
|
27
|
-
return error;
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
exports.getErrorMessage = getErrorMessage;
|
|
32
|
-
/**
|
|
33
|
-
* Extracts a caller-recognised typed error from an arbitrary thrown/native
|
|
34
|
-
* value, when the value carries an explicit, valid code on one of the given
|
|
35
|
-
* properties. Pure: performs no side effects and applies no fallback, so
|
|
36
|
-
* callers keep full control over precedence (e.g. domain-specific special
|
|
37
|
-
* cases) and the fallback code.
|
|
38
|
-
*
|
|
39
|
-
* @param error - The caught value.
|
|
40
|
-
* @param options - The options.
|
|
41
|
-
* @param options.isValidCode - Type guard identifying a recognised code.
|
|
42
|
-
* @param options.codeProperties - Property names to read a code from, in
|
|
43
|
-
* precedence order. Defaults to `['code']`.
|
|
44
|
-
* @returns The typed error when an explicit valid code is present, else
|
|
45
|
-
* `undefined`.
|
|
46
|
-
*/
|
|
47
|
-
function extractExplicitTypedError(error, { isValidCode, codeProperties = ['code'], }) {
|
|
48
|
-
if (!isRecord(error)) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
for (const property of codeProperties) {
|
|
52
|
-
const candidate = error[property];
|
|
53
|
-
if (isValidCode(candidate)) {
|
|
54
|
-
return {
|
|
55
|
-
code: candidate,
|
|
56
|
-
message: getErrorMessage(error),
|
|
57
|
-
details: isRecord(error.details) ? error.details : undefined,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
exports.extractExplicitTypedError = extractExplicitTypedError;
|
|
64
|
-
/**
|
|
65
|
-
* Normalises an arbitrary thrown/native value into a {@link TypedError}, using
|
|
66
|
-
* the caller's recognised codes and falling back to `fallbackCode` when no
|
|
67
|
-
* explicit valid code is present. Pure.
|
|
68
|
-
*
|
|
69
|
-
* @param error - The caught value.
|
|
70
|
-
* @param options - The options.
|
|
71
|
-
* @param options.isValidCode - Type guard identifying a recognised code.
|
|
72
|
-
* @param options.fallbackCode - Code used when no explicit valid code is found.
|
|
73
|
-
* @param options.codeProperties - Property names to read a code from, in
|
|
74
|
-
* precedence order. Defaults to `['code']`.
|
|
75
|
-
* @returns The typed error.
|
|
76
|
-
*/
|
|
77
|
-
function normalizeToTypedError(error, { isValidCode, fallbackCode, codeProperties, }) {
|
|
78
|
-
return (extractExplicitTypedError(error, { isValidCode, codeProperties }) ?? {
|
|
79
|
-
code: fallbackCode,
|
|
80
|
-
message: getErrorMessage(error),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
exports.normalizeToTypedError = normalizeToTypedError;
|
|
84
|
-
//# sourceMappingURL=errorNormalization.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorNormalization.cjs","sourceRoot":"","sources":["../src/errorNormalization.ts"],"names":[],"mappings":";;;AAYA;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK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,WAAW,EAAE,cAAc,EAAE,CAAC,IAAI;QACnE,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;KAChC,CACF,CAAC;AACJ,CAAC;AAlBD,sDAkBC","sourcesContent":["/**\n * A typed error surface: a stable code plus an optional human message and\n * structured details. Consumers parameterise `Code` with their own error-code\n * union (e.g. headless-buy codes) so the taxonomy stays with the consumer while\n * the pure extraction below is shared.\n */\nexport type TypedError<Code extends string> = {\n code: Code;\n message?: string;\n details?: Record<string, unknown>;\n};\n\n/**\n * Type guard for a non-null object.\n *\n * @param value - The value to test.\n * @returns Whether the value is a record.\n */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Best-effort human-readable message from an arbitrary thrown/native value.\n *\n * @param error - The caught value.\n * @returns The message, or `undefined` when none can be derived.\n */\nexport function getErrorMessage(error: unknown): string | undefined {\n if (error instanceof Error) {\n return error.message;\n }\n if (isRecord(error) && typeof error.message === 'string') {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n return undefined;\n}\n\n/**\n * Extracts a caller-recognised typed error from an arbitrary thrown/native\n * value, when the value carries an explicit, valid code on one of the given\n * properties. Pure: performs no side effects and applies no fallback, so\n * callers keep full control over precedence (e.g. domain-specific special\n * cases) and the fallback code.\n *\n * @param error - The caught value.\n * @param options - The options.\n * @param options.isValidCode - Type guard identifying a recognised code.\n * @param options.codeProperties - Property names to read a code from, in\n * precedence order. Defaults to `['code']`.\n * @returns The typed error when an explicit valid code is present, else\n * `undefined`.\n */\nexport function extractExplicitTypedError<Code extends string>(\n error: unknown,\n {\n isValidCode,\n codeProperties = ['code'],\n }: {\n isValidCode: (value: unknown) => value is Code;\n codeProperties?: string[];\n },\n): TypedError<Code> | undefined {\n if (!isRecord(error)) {\n return undefined;\n }\n for (const property of codeProperties) {\n const candidate = error[property];\n if (isValidCode(candidate)) {\n return {\n code: candidate,\n message: getErrorMessage(error),\n details: isRecord(error.details) ? error.details : undefined,\n };\n }\n }\n return undefined;\n}\n\n/**\n * Normalises an arbitrary thrown/native value into a {@link TypedError}, using\n * the caller's recognised codes and falling back to `fallbackCode` when no\n * explicit valid code is present. Pure.\n *\n * @param error - The caught value.\n * @param options - The options.\n * @param options.isValidCode - Type guard identifying a recognised code.\n * @param options.fallbackCode - Code used when no explicit valid code is found.\n * @param options.codeProperties - Property names to read a code from, in\n * precedence order. Defaults to `['code']`.\n * @returns The typed error.\n */\nexport function normalizeToTypedError<Code extends string>(\n error: unknown,\n {\n isValidCode,\n fallbackCode,\n codeProperties,\n }: {\n isValidCode: (value: unknown) => value is Code;\n fallbackCode: Code;\n codeProperties?: string[];\n },\n): TypedError<Code> {\n return (\n extractExplicitTypedError(error, { isValidCode, codeProperties }) ?? {\n code: fallbackCode,\n message: getErrorMessage(error),\n }\n );\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A typed error surface: a stable code plus an optional human message and
|
|
3
|
-
* structured details. Consumers parameterise `Code` with their own error-code
|
|
4
|
-
* union (e.g. headless-buy codes) so the taxonomy stays with the consumer while
|
|
5
|
-
* the pure extraction below is shared.
|
|
6
|
-
*/
|
|
7
|
-
export type TypedError<Code extends string> = {
|
|
8
|
-
code: Code;
|
|
9
|
-
message?: string;
|
|
10
|
-
details?: Record<string, unknown>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Best-effort human-readable message from an arbitrary thrown/native value.
|
|
14
|
-
*
|
|
15
|
-
* @param error - The caught value.
|
|
16
|
-
* @returns The message, or `undefined` when none can be derived.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getErrorMessage(error: unknown): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Extracts a caller-recognised typed error from an arbitrary thrown/native
|
|
21
|
-
* value, when the value carries an explicit, valid code on one of the given
|
|
22
|
-
* properties. Pure: performs no side effects and applies no fallback, so
|
|
23
|
-
* callers keep full control over precedence (e.g. domain-specific special
|
|
24
|
-
* cases) and the fallback code.
|
|
25
|
-
*
|
|
26
|
-
* @param error - The caught value.
|
|
27
|
-
* @param options - The options.
|
|
28
|
-
* @param options.isValidCode - Type guard identifying a recognised code.
|
|
29
|
-
* @param options.codeProperties - Property names to read a code from, in
|
|
30
|
-
* precedence order. Defaults to `['code']`.
|
|
31
|
-
* @returns The typed error when an explicit valid code is present, else
|
|
32
|
-
* `undefined`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function extractExplicitTypedError<Code extends string>(error: unknown, { isValidCode, codeProperties, }: {
|
|
35
|
-
isValidCode: (value: unknown) => value is Code;
|
|
36
|
-
codeProperties?: string[];
|
|
37
|
-
}): TypedError<Code> | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Normalises an arbitrary thrown/native value into a {@link TypedError}, using
|
|
40
|
-
* the caller's recognised codes and falling back to `fallbackCode` when no
|
|
41
|
-
* explicit valid code is present. Pure.
|
|
42
|
-
*
|
|
43
|
-
* @param error - The caught value.
|
|
44
|
-
* @param options - The options.
|
|
45
|
-
* @param options.isValidCode - Type guard identifying a recognised code.
|
|
46
|
-
* @param options.fallbackCode - Code used when no explicit valid code is found.
|
|
47
|
-
* @param options.codeProperties - Property names to read a code from, in
|
|
48
|
-
* precedence order. Defaults to `['code']`.
|
|
49
|
-
* @returns The typed error.
|
|
50
|
-
*/
|
|
51
|
-
export declare function normalizeToTypedError<Code extends string>(error: unknown, { isValidCode, fallbackCode, codeProperties, }: {
|
|
52
|
-
isValidCode: (value: unknown) => value is Code;
|
|
53
|
-
fallbackCode: Code;
|
|
54
|
-
codeProperties?: string[];
|
|
55
|
-
}): TypedError<Code>;
|
|
56
|
-
//# sourceMappingURL=errorNormalization.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorNormalization.d.cts","sourceRoot":"","sources":["../src/errorNormalization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,IAA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CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAc,EACd,EACE,WAAW,EACX,cAAc,GAAG,CAAC,MAAM,CAAC,GAI1B;IAED,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;gBAC/B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAC7D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,EACE,WAAW,EACX,YAAY,EACZ,cAAc,GAKf;IAED,OAAO,CACL,yBAAyB,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,IAAI;QACnE,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;KAChC,CACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * A typed error surface: a stable code plus an optional human message and\n * structured details. Consumers parameterise `Code` with their own error-code\n * union (e.g. headless-buy codes) so the taxonomy stays with the consumer while\n * the pure extraction below is shared.\n */\nexport type TypedError<Code extends string> = {\n code: Code;\n message?: string;\n details?: Record<string, unknown>;\n};\n\n/**\n * Type guard for a non-null object.\n *\n * @param value - The value to test.\n * @returns Whether the value is a record.\n */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Best-effort human-readable message from an arbitrary thrown/native value.\n *\n * @param error - The caught value.\n * @returns The message, or `undefined` when none can be derived.\n */\nexport function getErrorMessage(error: unknown): string | undefined {\n if (error instanceof Error) {\n return error.message;\n }\n if (isRecord(error) && typeof error.message === 'string') {\n return error.message;\n }\n if (typeof error === 'string') {\n return error;\n }\n return undefined;\n}\n\n/**\n * Extracts a caller-recognised typed error from an arbitrary thrown/native\n * value, when the value carries an explicit, valid code on one of the given\n * properties. Pure: performs no side effects and applies no fallback, so\n * callers keep full control over precedence (e.g. domain-specific special\n * cases) and the fallback code.\n *\n * @param error - The caught value.\n * @param options - The options.\n * @param options.isValidCode - Type guard identifying a recognised code.\n * @param options.codeProperties - Property names to read a code from, in\n * precedence order. Defaults to `['code']`.\n * @returns The typed error when an explicit valid code is present, else\n * `undefined`.\n */\nexport function extractExplicitTypedError<Code extends string>(\n error: unknown,\n {\n isValidCode,\n codeProperties = ['code'],\n }: {\n isValidCode: (value: unknown) => value is Code;\n codeProperties?: string[];\n },\n): TypedError<Code> | undefined {\n if (!isRecord(error)) {\n return undefined;\n }\n for (const property of codeProperties) {\n const candidate = error[property];\n if (isValidCode(candidate)) {\n return {\n code: candidate,\n message: getErrorMessage(error),\n details: isRecord(error.details) ? error.details : undefined,\n };\n }\n }\n return undefined;\n}\n\n/**\n * Normalises an arbitrary thrown/native value into a {@link TypedError}, using\n * the caller's recognised codes and falling back to `fallbackCode` when no\n * explicit valid code is present. Pure.\n *\n * @param error - The caught value.\n * @param options - The options.\n * @param options.isValidCode - Type guard identifying a recognised code.\n * @param options.fallbackCode - Code used when no explicit valid code is found.\n * @param options.codeProperties - Property names to read a code from, in\n * precedence order. Defaults to `['code']`.\n * @returns The typed error.\n */\nexport function normalizeToTypedError<Code extends string>(\n error: unknown,\n {\n isValidCode,\n fallbackCode,\n codeProperties,\n }: {\n isValidCode: (value: unknown) => value is Code;\n fallbackCode: Code;\n codeProperties?: string[];\n },\n): TypedError<Code> {\n return (\n extractExplicitTypedError(error, { isValidCode, codeProperties }) ?? {\n code: fallbackCode,\n message: getErrorMessage(error),\n }\n );\n}\n"]}
|
package/dist/featureFlags.cjs
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeHeadlessProviderId = exports.getHeadlessProviderAllowlist = exports.isHeadlessAllProvidersEnabled = exports.HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers
|
|
6
|
-
* expansion. Accepts two value forms:
|
|
7
|
-
*
|
|
8
|
-
* - The literal boolean `true` widens the headless fiat quote path to every
|
|
9
|
-
* provider class (native, in-app WebView aggregator, and external-browser /
|
|
10
|
-
* custom-action) with no provider restriction.
|
|
11
|
-
* - An object payload `{ enabled: true, featureVersion: "1", providerIds?: string[] }`
|
|
12
|
-
* widens the same way, and additionally restricts the widened quote pick to
|
|
13
|
-
* the listed provider ids (see {@link getHeadlessProviderAllowlist}).
|
|
14
|
-
*
|
|
15
|
-
* `false`, a missing flag, or any other value keeps the native-only default.
|
|
16
|
-
* Clients that only understand the boolean form coerce the object payload to
|
|
17
|
-
* "disabled" (native-only), so serving the object form can never turn the
|
|
18
|
-
* feature on for a client that cannot parse it. Exported so the flag registry
|
|
19
|
-
* and every consumer stay in sync on the exact key string.
|
|
20
|
-
*/
|
|
21
|
-
exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = 'moneyHeadlessAllProviders';
|
|
22
|
-
/**
|
|
23
|
-
* Contract version of the object payload. An enabled payload whose
|
|
24
|
-
* `featureVersion` differs (or is absent) fails closed, so the payload's
|
|
25
|
-
* meaning can change in a future client without old clients misreading it.
|
|
26
|
-
* Mirrors the platform pattern used by `assetsUnifyState`.
|
|
27
|
-
*/
|
|
28
|
-
exports.HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = '1';
|
|
29
|
-
/**
|
|
30
|
-
* Resolves the flag value with `localOverrides` (written by dev-only override
|
|
31
|
-
* screens) merged over `remoteFeatureFlags`, because not every published
|
|
32
|
-
* `RemoteFeatureFlagController` version folds overrides into
|
|
33
|
-
* `remoteFeatureFlags` state; when a version already does, the merge is a
|
|
34
|
-
* no-op.
|
|
35
|
-
*
|
|
36
|
-
* @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
|
|
37
|
-
* relevant subset of it).
|
|
38
|
-
* @returns The merged flag value, or `undefined` when absent.
|
|
39
|
-
*/
|
|
40
|
-
function resolveFlagValue(remoteFeatureFlagState) {
|
|
41
|
-
const flags = {
|
|
42
|
-
...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),
|
|
43
|
-
...(remoteFeatureFlagState?.localOverrides ?? {}),
|
|
44
|
-
};
|
|
45
|
-
return flags[exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Whether a flag value is the object payload form: a plain object (not an
|
|
49
|
-
* array) whose `enabled` is the literal boolean `true`. Anything else,
|
|
50
|
-
* including `{ enabled: false }` and objects without `enabled`, is not an
|
|
51
|
-
* enabled payload, so the flag fails closed.
|
|
52
|
-
*
|
|
53
|
-
* @param value - The merged flag value.
|
|
54
|
-
* @returns Whether the value is an enabled object payload.
|
|
55
|
-
*/
|
|
56
|
-
function isEnabledPayload(value) {
|
|
57
|
-
return (typeof value === 'object' &&
|
|
58
|
-
value !== null &&
|
|
59
|
-
!Array.isArray(value) &&
|
|
60
|
-
value.enabled === true &&
|
|
61
|
-
value.featureVersion === exports.HEADLESS_ALL_PROVIDERS_FEATURE_VERSION);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Coerces a payload field into a provider-id list: keeps only string entries,
|
|
65
|
-
* trims them, and drops empties. An empty or malformed level is treated as
|
|
66
|
-
* "not provided" so resolution falls through to the next level rather than
|
|
67
|
-
* restricting to nothing; to force "nothing eligible" list a nonexistent id.
|
|
68
|
-
*
|
|
69
|
-
* @param value - The candidate `providerIds` / surface entry value.
|
|
70
|
-
* @returns The non-empty coerced list, or `undefined`.
|
|
71
|
-
*/
|
|
72
|
-
function coerceProviderIdList(value) {
|
|
73
|
-
if (!Array.isArray(value)) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
const ids = value
|
|
77
|
-
.filter((entry) => typeof entry === 'string')
|
|
78
|
-
.map((entry) => entry.trim())
|
|
79
|
-
.filter((entry) => entry !== '');
|
|
80
|
-
return ids.length > 0 ? ids : undefined;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Whether the Headless Buy all-providers feature flag is enabled.
|
|
84
|
-
*
|
|
85
|
-
* Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
|
|
86
|
-
* so the controller's quote widening and UI availability gates resolve the
|
|
87
|
-
* flag identically. `localOverrides` are merged over `remoteFeatureFlags`
|
|
88
|
-
* (see {@link resolveFlagValue}). Coerces defensively: only the literal
|
|
89
|
-
* boolean `true` or an object payload whose `enabled` is the literal `true`
|
|
90
|
-
* enables; any other value (missing, string, number, array, `{ enabled:
|
|
91
|
-
* false }`) resolves to `false`.
|
|
92
|
-
*
|
|
93
|
-
* @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
|
|
94
|
-
* relevant subset of it). May be `null`/`undefined` before the controller is
|
|
95
|
-
* initialized.
|
|
96
|
-
* @returns Whether all provider classes are enabled for the headless fiat
|
|
97
|
-
* quote path.
|
|
98
|
-
*/
|
|
99
|
-
function isHeadlessAllProvidersEnabled(remoteFeatureFlagState) {
|
|
100
|
-
const value = resolveFlagValue(remoteFeatureFlagState);
|
|
101
|
-
return value === true || isEnabledPayload(value);
|
|
102
|
-
}
|
|
103
|
-
exports.isHeadlessAllProvidersEnabled = isHeadlessAllProvidersEnabled;
|
|
104
|
-
/**
|
|
105
|
-
* The provider-id allowlist carried by the flag's object payload, or
|
|
106
|
-
* `undefined` when the widened pick should not be restricted.
|
|
107
|
-
*
|
|
108
|
-
* Returns the payload's top-level `providerIds` when non-empty and valid, or
|
|
109
|
-
* `undefined` (no restriction). The boolean `true` form, a disabled or
|
|
110
|
-
* malformed payload, and empty or all-invalid lists all resolve to
|
|
111
|
-
* `undefined`; unknown keys and non-string entries are ignored.
|
|
112
|
-
*
|
|
113
|
-
* @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
|
|
114
|
-
* relevant subset of it). May be `null`/`undefined` before the controller is
|
|
115
|
-
* initialized.
|
|
116
|
-
* @returns The provider ids the widened pick is restricted to, or `undefined`
|
|
117
|
-
* for no restriction.
|
|
118
|
-
*/
|
|
119
|
-
function getHeadlessProviderAllowlist(remoteFeatureFlagState) {
|
|
120
|
-
const value = resolveFlagValue(remoteFeatureFlagState);
|
|
121
|
-
if (!isEnabledPayload(value)) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
return coerceProviderIdList(value.providerIds);
|
|
125
|
-
}
|
|
126
|
-
exports.getHeadlessProviderAllowlist = getHeadlessProviderAllowlist;
|
|
127
|
-
/**
|
|
128
|
-
* Normalizes a provider id for allowlist matching only: trims, strips the
|
|
129
|
-
* canonical `/providers/` path prefix, and lowercases, so `/providers/moonpay`
|
|
130
|
-
* and `moonpay` match each other. Quote and catalog provider ids are matched
|
|
131
|
-
* as-is everywhere else; this exists solely so LaunchDarkly payload authors
|
|
132
|
-
* can use either id form. Not exported from the package index.
|
|
133
|
-
*
|
|
134
|
-
* @param id - A provider id in either the prefixed or bare form.
|
|
135
|
-
* @returns The normalized id used for allowlist comparison.
|
|
136
|
-
*/
|
|
137
|
-
function normalizeHeadlessProviderId(id) {
|
|
138
|
-
return id
|
|
139
|
-
.trim()
|
|
140
|
-
.replace(/^\/providers\//u, '')
|
|
141
|
-
.toLowerCase();
|
|
142
|
-
}
|
|
143
|
-
exports.normalizeHeadlessProviderId = normalizeHeadlessProviderId;
|
|
144
|
-
//# sourceMappingURL=featureFlags.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"featureFlags.cjs","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,qCAAqC,GAChD,2BAA2B,CAAC;AAE9B;;;;;GAKG;AACU,QAAA,sCAAsC,GAAG,GAAG,CAAC;AAa1D;;;;;;;;;;GAUG;AACH,SAAS,gBAAgB,CACvB,sBAAqE;IAErE,MAAM,KAAK,GAAiB;QAC1B,GAAG,CAAC,sBAAsB,EAAE,kBAAkB,IAAI,EAAE,CAAC;QACrD,GAAG,CAAC,sBAAsB,EAAE,cAAc,IAAI,EAAE,CAAC;KAClD,CAAC;IACF,OAAO,KAAK,CAAC,6CAAqC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAC,KAAuB;IAG/C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,KAAK,CAAC,OAAO,KAAK,IAAI;QACtB,KAAK,CAAC,cAAc,KAAK,8CAAsC,CAChE,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,oBAAoB,CAAC,KAAuB;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,GAAG,GAAG,KAAK;SACd,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SAC7D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,6BAA6B,CAC3C,sBAAqE;IAErE,MAAM,KAAK,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACvD,OAAO,KAAK,KAAK,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AALD,sEAKC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,4BAA4B,CAC1C,sBAAqE;IAErE,MAAM,KAAK,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACvD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,oBAAoB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AARD,oEAQC;AAED;;;;;;;;;GASG;AACH,SAAgB,2BAA2B,CAAC,EAAU;IACpD,OAAO,EAAE;SACN,IAAI,EAAE;SACN,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;SAC9B,WAAW,EAAE,CAAC;AACnB,CAAC;AALD,kEAKC","sourcesContent":["import type { FeatureFlags } from '@metamask/remote-feature-flag-controller';\nimport type { Json } from '@metamask/utils';\n\n/**\n * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers\n * expansion. Accepts two value forms:\n *\n * - The literal boolean `true` widens the headless fiat quote path to every\n * provider class (native, in-app WebView aggregator, and external-browser /\n * custom-action) with no provider restriction.\n * - An object payload `{ enabled: true, featureVersion: \"1\", providerIds?: string[] }`\n * widens the same way, and additionally restricts the widened quote pick to\n * the listed provider ids (see {@link getHeadlessProviderAllowlist}).\n *\n * `false`, a missing flag, or any other value keeps the native-only default.\n * Clients that only understand the boolean form coerce the object payload to\n * \"disabled\" (native-only), so serving the object form can never turn the\n * feature on for a client that cannot parse it. Exported so the flag registry\n * and every consumer stay in sync on the exact key string.\n */\nexport const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY =\n 'moneyHeadlessAllProviders';\n\n/**\n * Contract version of the object payload. An enabled payload whose\n * `featureVersion` differs (or is absent) fails closed, so the payload's\n * meaning can change in a future client without old clients misreading it.\n * Mirrors the platform pattern used by `assetsUnifyState`.\n */\nexport const HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = '1';\n\n/**\n * The subset of `RemoteFeatureFlagController` state that\n * {@link isHeadlessAllProvidersEnabled} reads. Structural so consumers can\n * pass the whole controller state (or `undefined` before initialization)\n * without depending on a specific controller version.\n */\nexport type HeadlessFeatureFlagsLookup = {\n remoteFeatureFlags?: FeatureFlags;\n localOverrides?: FeatureFlags;\n};\n\n/**\n * Resolves the flag value with `localOverrides` (written by dev-only override\n * screens) merged over `remoteFeatureFlags`, because not every published\n * `RemoteFeatureFlagController` version folds overrides into\n * `remoteFeatureFlags` state; when a version already does, the merge is a\n * no-op.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it).\n * @returns The merged flag value, or `undefined` when absent.\n */\nfunction resolveFlagValue(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): Json | undefined {\n const flags: FeatureFlags = {\n ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),\n ...(remoteFeatureFlagState?.localOverrides ?? {}),\n };\n return flags[MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY];\n}\n\n/**\n * Whether a flag value is the object payload form: a plain object (not an\n * array) whose `enabled` is the literal boolean `true`. Anything else,\n * including `{ enabled: false }` and objects without `enabled`, is not an\n * enabled payload, so the flag fails closed.\n *\n * @param value - The merged flag value.\n * @returns Whether the value is an enabled object payload.\n */\nfunction isEnabledPayload(value: Json | undefined): value is {\n [key: string]: Json;\n} {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n value.enabled === true &&\n value.featureVersion === HEADLESS_ALL_PROVIDERS_FEATURE_VERSION\n );\n}\n\n/**\n * Coerces a payload field into a provider-id list: keeps only string entries,\n * trims them, and drops empties. An empty or malformed level is treated as\n * \"not provided\" so resolution falls through to the next level rather than\n * restricting to nothing; to force \"nothing eligible\" list a nonexistent id.\n *\n * @param value - The candidate `providerIds` / surface entry value.\n * @returns The non-empty coerced list, or `undefined`.\n */\nfunction coerceProviderIdList(value: Json | undefined): string[] | undefined {\n if (!Array.isArray(value)) {\n return undefined;\n }\n const ids = value\n .filter((entry): entry is string => typeof entry === 'string')\n .map((entry) => entry.trim())\n .filter((entry) => entry !== '');\n return ids.length > 0 ? ids : undefined;\n}\n\n/**\n * Whether the Headless Buy all-providers feature flag is enabled.\n *\n * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}\n * so the controller's quote widening and UI availability gates resolve the\n * flag identically. `localOverrides` are merged over `remoteFeatureFlags`\n * (see {@link resolveFlagValue}). Coerces defensively: only the literal\n * boolean `true` or an object payload whose `enabled` is the literal `true`\n * enables; any other value (missing, string, number, array, `{ enabled:\n * false }`) resolves to `false`.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it). May be `null`/`undefined` before the controller is\n * initialized.\n * @returns Whether all provider classes are enabled for the headless fiat\n * quote path.\n */\nexport function isHeadlessAllProvidersEnabled(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): boolean {\n const value = resolveFlagValue(remoteFeatureFlagState);\n return value === true || isEnabledPayload(value);\n}\n\n/**\n * The provider-id allowlist carried by the flag's object payload, or\n * `undefined` when the widened pick should not be restricted.\n *\n * Returns the payload's top-level `providerIds` when non-empty and valid, or\n * `undefined` (no restriction). The boolean `true` form, a disabled or\n * malformed payload, and empty or all-invalid lists all resolve to\n * `undefined`; unknown keys and non-string entries are ignored.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it). May be `null`/`undefined` before the controller is\n * initialized.\n * @returns The provider ids the widened pick is restricted to, or `undefined`\n * for no restriction.\n */\nexport function getHeadlessProviderAllowlist(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): string[] | undefined {\n const value = resolveFlagValue(remoteFeatureFlagState);\n if (!isEnabledPayload(value)) {\n return undefined;\n }\n return coerceProviderIdList(value.providerIds);\n}\n\n/**\n * Normalizes a provider id for allowlist matching only: trims, strips the\n * canonical `/providers/` path prefix, and lowercases, so `/providers/moonpay`\n * and `moonpay` match each other. Quote and catalog provider ids are matched\n * as-is everywhere else; this exists solely so LaunchDarkly payload authors\n * can use either id form. Not exported from the package index.\n *\n * @param id - A provider id in either the prefixed or bare form.\n * @returns The normalized id used for allowlist comparison.\n */\nexport function normalizeHeadlessProviderId(id: string): string {\n return id\n .trim()\n .replace(/^\\/providers\\//u, '')\n .toLowerCase();\n}\n"]}
|
package/dist/featureFlags.d.cts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { FeatureFlags } from "@metamask/remote-feature-flag-controller";
|
|
2
|
-
/**
|
|
3
|
-
* Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers
|
|
4
|
-
* expansion. Accepts two value forms:
|
|
5
|
-
*
|
|
6
|
-
* - The literal boolean `true` widens the headless fiat quote path to every
|
|
7
|
-
* provider class (native, in-app WebView aggregator, and external-browser /
|
|
8
|
-
* custom-action) with no provider restriction.
|
|
9
|
-
* - An object payload `{ enabled: true, featureVersion: "1", providerIds?: string[] }`
|
|
10
|
-
* widens the same way, and additionally restricts the widened quote pick to
|
|
11
|
-
* the listed provider ids (see {@link getHeadlessProviderAllowlist}).
|
|
12
|
-
*
|
|
13
|
-
* `false`, a missing flag, or any other value keeps the native-only default.
|
|
14
|
-
* Clients that only understand the boolean form coerce the object payload to
|
|
15
|
-
* "disabled" (native-only), so serving the object form can never turn the
|
|
16
|
-
* feature on for a client that cannot parse it. Exported so the flag registry
|
|
17
|
-
* and every consumer stay in sync on the exact key string.
|
|
18
|
-
*/
|
|
19
|
-
export declare const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = "moneyHeadlessAllProviders";
|
|
20
|
-
/**
|
|
21
|
-
* Contract version of the object payload. An enabled payload whose
|
|
22
|
-
* `featureVersion` differs (or is absent) fails closed, so the payload's
|
|
23
|
-
* meaning can change in a future client without old clients misreading it.
|
|
24
|
-
* Mirrors the platform pattern used by `assetsUnifyState`.
|
|
25
|
-
*/
|
|
26
|
-
export declare const HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = "1";
|
|
27
|
-
/**
|
|
28
|
-
* The subset of `RemoteFeatureFlagController` state that
|
|
29
|
-
* {@link isHeadlessAllProvidersEnabled} reads. Structural so consumers can
|
|
30
|
-
* pass the whole controller state (or `undefined` before initialization)
|
|
31
|
-
* without depending on a specific controller version.
|
|
32
|
-
*/
|
|
33
|
-
export type HeadlessFeatureFlagsLookup = {
|
|
34
|
-
remoteFeatureFlags?: FeatureFlags;
|
|
35
|
-
localOverrides?: FeatureFlags;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Whether the Headless Buy all-providers feature flag is enabled.
|
|
39
|
-
*
|
|
40
|
-
* Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
|
|
41
|
-
* so the controller's quote widening and UI availability gates resolve the
|
|
42
|
-
* flag identically. `localOverrides` are merged over `remoteFeatureFlags`
|
|
43
|
-
* (see {@link resolveFlagValue}). Coerces defensively: only the literal
|
|
44
|
-
* boolean `true` or an object payload whose `enabled` is the literal `true`
|
|
45
|
-
* enables; any other value (missing, string, number, array, `{ enabled:
|
|
46
|
-
* false }`) resolves to `false`.
|
|
47
|
-
*
|
|
48
|
-
* @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
|
|
49
|
-
* relevant subset of it). May be `null`/`undefined` before the controller is
|
|
50
|
-
* initialized.
|
|
51
|
-
* @returns Whether all provider classes are enabled for the headless fiat
|
|
52
|
-
* quote path.
|
|
53
|
-
*/
|
|
54
|
-
export declare function isHeadlessAllProvidersEnabled(remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* The provider-id allowlist carried by the flag's object payload, or
|
|
57
|
-
* `undefined` when the widened pick should not be restricted.
|
|
58
|
-
*
|
|
59
|
-
* Returns the payload's top-level `providerIds` when non-empty and valid, or
|
|
60
|
-
* `undefined` (no restriction). The boolean `true` form, a disabled or
|
|
61
|
-
* malformed payload, and empty or all-invalid lists all resolve to
|
|
62
|
-
* `undefined`; unknown keys and non-string entries are ignored.
|
|
63
|
-
*
|
|
64
|
-
* @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
|
|
65
|
-
* relevant subset of it). May be `null`/`undefined` before the controller is
|
|
66
|
-
* initialized.
|
|
67
|
-
* @returns The provider ids the widened pick is restricted to, or `undefined`
|
|
68
|
-
* for no restriction.
|
|
69
|
-
*/
|
|
70
|
-
export declare function getHeadlessProviderAllowlist(remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined): string[] | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* Normalizes a provider id for allowlist matching only: trims, strips the
|
|
73
|
-
* canonical `/providers/` path prefix, and lowercases, so `/providers/moonpay`
|
|
74
|
-
* and `moonpay` match each other. Quote and catalog provider ids are matched
|
|
75
|
-
* as-is everywhere else; this exists solely so LaunchDarkly payload authors
|
|
76
|
-
* can use either id form. Not exported from the package index.
|
|
77
|
-
*
|
|
78
|
-
* @param id - A provider id in either the prefixed or bare form.
|
|
79
|
-
* @returns The normalized id used for allowlist comparison.
|
|
80
|
-
*/
|
|
81
|
-
export declare function normalizeHeadlessProviderId(id: string): string;
|
|
82
|
-
//# sourceMappingURL=featureFlags.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"featureFlags.d.cts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iDAAiD;AAG7E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qCAAqC,8BACrB,CAAC;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAgEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC3C,sBAAsB,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACpE,OAAO,CAGT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,sBAAsB,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACpE,MAAM,EAAE,GAAG,SAAS,CAMtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAK9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"featureFlags.d.mts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iDAAiD;AAG7E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qCAAqC,8BACrB,CAAC;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,MAAM,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CA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AAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,GAAG,GAAG,KAAK;SACd,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;SAC7D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,sBAAqE;IAErE,MAAM,KAAK,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACvD,OAAO,KAAK,KAAK,IAAI,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,4BAA4B,CAC1C,sBAAqE;IAErE,MAAM,KAAK,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACvD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,oBAAoB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAAU;IACpD,OAAO,EAAE;SACN,IAAI,EAAE;SACN,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;SAC9B,WAAW,EAAE,CAAC;AACnB,CAAC","sourcesContent":["import type { FeatureFlags } from '@metamask/remote-feature-flag-controller';\nimport type { Json } from '@metamask/utils';\n\n/**\n * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers\n * expansion. Accepts two value forms:\n *\n * - The literal boolean `true` widens the headless fiat quote path to every\n * provider class (native, in-app WebView aggregator, and external-browser /\n * custom-action) with no provider restriction.\n * - An object payload `{ enabled: true, featureVersion: \"1\", providerIds?: string[] }`\n * widens the same way, and additionally restricts the widened quote pick to\n * the listed provider ids (see {@link getHeadlessProviderAllowlist}).\n *\n * `false`, a missing flag, or any other value keeps the native-only default.\n * Clients that only understand the boolean form coerce the object payload to\n * \"disabled\" (native-only), so serving the object form can never turn the\n * feature on for a client that cannot parse it. Exported so the flag registry\n * and every consumer stay in sync on the exact key string.\n */\nexport const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY =\n 'moneyHeadlessAllProviders';\n\n/**\n * Contract version of the object payload. An enabled payload whose\n * `featureVersion` differs (or is absent) fails closed, so the payload's\n * meaning can change in a future client without old clients misreading it.\n * Mirrors the platform pattern used by `assetsUnifyState`.\n */\nexport const HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = '1';\n\n/**\n * The subset of `RemoteFeatureFlagController` state that\n * {@link isHeadlessAllProvidersEnabled} reads. Structural so consumers can\n * pass the whole controller state (or `undefined` before initialization)\n * without depending on a specific controller version.\n */\nexport type HeadlessFeatureFlagsLookup = {\n remoteFeatureFlags?: FeatureFlags;\n localOverrides?: FeatureFlags;\n};\n\n/**\n * Resolves the flag value with `localOverrides` (written by dev-only override\n * screens) merged over `remoteFeatureFlags`, because not every published\n * `RemoteFeatureFlagController` version folds overrides into\n * `remoteFeatureFlags` state; when a version already does, the merge is a\n * no-op.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it).\n * @returns The merged flag value, or `undefined` when absent.\n */\nfunction resolveFlagValue(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): Json | undefined {\n const flags: FeatureFlags = {\n ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),\n ...(remoteFeatureFlagState?.localOverrides ?? {}),\n };\n return flags[MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY];\n}\n\n/**\n * Whether a flag value is the object payload form: a plain object (not an\n * array) whose `enabled` is the literal boolean `true`. Anything else,\n * including `{ enabled: false }` and objects without `enabled`, is not an\n * enabled payload, so the flag fails closed.\n *\n * @param value - The merged flag value.\n * @returns Whether the value is an enabled object payload.\n */\nfunction isEnabledPayload(value: Json | undefined): value is {\n [key: string]: Json;\n} {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n value.enabled === true &&\n value.featureVersion === HEADLESS_ALL_PROVIDERS_FEATURE_VERSION\n );\n}\n\n/**\n * Coerces a payload field into a provider-id list: keeps only string entries,\n * trims them, and drops empties. An empty or malformed level is treated as\n * \"not provided\" so resolution falls through to the next level rather than\n * restricting to nothing; to force \"nothing eligible\" list a nonexistent id.\n *\n * @param value - The candidate `providerIds` / surface entry value.\n * @returns The non-empty coerced list, or `undefined`.\n */\nfunction coerceProviderIdList(value: Json | undefined): string[] | undefined {\n if (!Array.isArray(value)) {\n return undefined;\n }\n const ids = value\n .filter((entry): entry is string => typeof entry === 'string')\n .map((entry) => entry.trim())\n .filter((entry) => entry !== '');\n return ids.length > 0 ? ids : undefined;\n}\n\n/**\n * Whether the Headless Buy all-providers feature flag is enabled.\n *\n * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}\n * so the controller's quote widening and UI availability gates resolve the\n * flag identically. `localOverrides` are merged over `remoteFeatureFlags`\n * (see {@link resolveFlagValue}). Coerces defensively: only the literal\n * boolean `true` or an object payload whose `enabled` is the literal `true`\n * enables; any other value (missing, string, number, array, `{ enabled:\n * false }`) resolves to `false`.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it). May be `null`/`undefined` before the controller is\n * initialized.\n * @returns Whether all provider classes are enabled for the headless fiat\n * quote path.\n */\nexport function isHeadlessAllProvidersEnabled(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): boolean {\n const value = resolveFlagValue(remoteFeatureFlagState);\n return value === true || isEnabledPayload(value);\n}\n\n/**\n * The provider-id allowlist carried by the flag's object payload, or\n * `undefined` when the widened pick should not be restricted.\n *\n * Returns the payload's top-level `providerIds` when non-empty and valid, or\n * `undefined` (no restriction). The boolean `true` form, a disabled or\n * malformed payload, and empty or all-invalid lists all resolve to\n * `undefined`; unknown keys and non-string entries are ignored.\n *\n * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the\n * relevant subset of it). May be `null`/`undefined` before the controller is\n * initialized.\n * @returns The provider ids the widened pick is restricted to, or `undefined`\n * for no restriction.\n */\nexport function getHeadlessProviderAllowlist(\n remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined,\n): string[] | undefined {\n const value = resolveFlagValue(remoteFeatureFlagState);\n if (!isEnabledPayload(value)) {\n return undefined;\n }\n return coerceProviderIdList(value.providerIds);\n}\n\n/**\n * Normalizes a provider id for allowlist matching only: trims, strips the\n * canonical `/providers/` path prefix, and lowercases, so `/providers/moonpay`\n * and `moonpay` match each other. Quote and catalog provider ids are matched\n * as-is everywhere else; this exists solely so LaunchDarkly payload authors\n * can use either id form. Not exported from the package index.\n *\n * @param id - A provider id in either the prefixed or bare form.\n * @returns The normalized id used for allowlist comparison.\n */\nexport function normalizeHeadlessProviderId(id: string): string {\n return id\n .trim()\n .replace(/^\\/providers\\//u, '')\n .toLowerCase();\n}\n"]}
|
package/dist/index.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NOTABLE_AUTORAMP_STATUSES = exports.TERMINAL_AUTORAMP_STATUSES = exports.AutorampStatus = exports.isTransakPhoneRegisteredError = exports.getTransakApiMessage = exports.TransakOrderIdTransformer = exports.TransakEnvironment = exports.TransakService = exports.TransakApiError = exports.normalizeToTypedError = exports.extractExplicitTypedError = exports.getErrorMessage = exports.isTerminalOrderStatus = exports.TERMINAL_ORDER_STATUSES = exports.isInAppOnlyQuote = exports.isCustomActionQuote = exports.isExternalBrowserQuote = exports.isFiatDepositAvailable = exports.regionHasProviderForAsset = exports.getProvidersServingAsset = exports.providerServesAsset = exports.normalizeRampsAssetId = exports.isHeadlessAllProvidersEnabled = exports.getHeadlessProviderAllowlist = exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = exports.HEADLESS_ALL_PROVIDERS_FEATURE_VERSION = exports.createRequestSelector = exports.RAMPS_ERROR_CODES = exports.createErrorState = exports.createSuccessState = exports.createLoadingState = exports.isCacheExpired = exports.createCacheKey = exports.DEFAULT_REQUEST_CACHE_MAX_SIZE = exports.DEFAULT_REQUEST_CACHE_TTL = exports.RequestStatus = exports.RAMPS_CLIENT_VERSION_PARAM = exports.RAMPS_CLIENT_PRODUCT_PARAM = exports.addRampsClientIdentityParams = exports.getDefaultRedirectCallbackUrl = exports.RAMPS_SDK_VERSION = exports.RampsOrderStatus = exports.RampsApiService = exports.RampsEnvironment = exports.RampsService = exports.RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS = exports.RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS = exports.getInternalOrderCode = exports.getDefaultRampsControllerState = exports.RampsController = void 0;
|
|
4
|
-
exports.WalletRegistrationError = exports.mapNeoBankAutorampToRemoteSnapshot = exports.neoBankServiceName = exports.NeoBankService = exports.buildOwnershipMessage = exports.markAutorampNotified = exports.applyAutorampRemoteStatus = exports.createAutorampAccount = exports.normalizeAutorampStatus = exports.isTerminalAutorampStatus = void 0;
|
|
5
|
-
var RampsController_js_1 = require("./RampsController.cjs");
|
|
6
|
-
Object.defineProperty(exports, "RampsController", { enumerable: true, get: function () { return RampsController_js_1.RampsController; } });
|
|
7
|
-
Object.defineProperty(exports, "getDefaultRampsControllerState", { enumerable: true, get: function () { return RampsController_js_1.getDefaultRampsControllerState; } });
|
|
8
|
-
Object.defineProperty(exports, "getInternalOrderCode", { enumerable: true, get: function () { return RampsController_js_1.getInternalOrderCode; } });
|
|
9
|
-
Object.defineProperty(exports, "RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS", { enumerable: true, get: function () { return RampsController_js_1.RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS; } });
|
|
10
|
-
Object.defineProperty(exports, "RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS", { enumerable: true, get: function () { return RampsController_js_1.RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS; } });
|
|
11
|
-
var RampsService_js_1 = require("./RampsService.cjs");
|
|
12
|
-
Object.defineProperty(exports, "RampsService", { enumerable: true, get: function () { return RampsService_js_1.RampsService; } });
|
|
13
|
-
Object.defineProperty(exports, "RampsEnvironment", { enumerable: true, get: function () { return RampsService_js_1.RampsEnvironment; } });
|
|
14
|
-
Object.defineProperty(exports, "RampsApiService", { enumerable: true, get: function () { return RampsService_js_1.RampsApiService; } });
|
|
15
|
-
Object.defineProperty(exports, "RampsOrderStatus", { enumerable: true, get: function () { return RampsService_js_1.RampsOrderStatus; } });
|
|
16
|
-
Object.defineProperty(exports, "RAMPS_SDK_VERSION", { enumerable: true, get: function () { return RampsService_js_1.RAMPS_SDK_VERSION; } });
|
|
17
|
-
Object.defineProperty(exports, "getDefaultRedirectCallbackUrl", { enumerable: true, get: function () { return RampsService_js_1.getDefaultRedirectCallbackUrl; } });
|
|
18
|
-
var client_identity_js_1 = require("./client-identity.cjs");
|
|
19
|
-
Object.defineProperty(exports, "addRampsClientIdentityParams", { enumerable: true, get: function () { return client_identity_js_1.addRampsClientIdentityParams; } });
|
|
20
|
-
Object.defineProperty(exports, "RAMPS_CLIENT_PRODUCT_PARAM", { enumerable: true, get: function () { return client_identity_js_1.RAMPS_CLIENT_PRODUCT_PARAM; } });
|
|
21
|
-
Object.defineProperty(exports, "RAMPS_CLIENT_VERSION_PARAM", { enumerable: true, get: function () { return client_identity_js_1.RAMPS_CLIENT_VERSION_PARAM; } });
|
|
22
|
-
var RequestCache_js_1 = require("./RequestCache.cjs");
|
|
23
|
-
Object.defineProperty(exports, "RequestStatus", { enumerable: true, get: function () { return RequestCache_js_1.RequestStatus; } });
|
|
24
|
-
Object.defineProperty(exports, "DEFAULT_REQUEST_CACHE_TTL", { enumerable: true, get: function () { return RequestCache_js_1.DEFAULT_REQUEST_CACHE_TTL; } });
|
|
25
|
-
Object.defineProperty(exports, "DEFAULT_REQUEST_CACHE_MAX_SIZE", { enumerable: true, get: function () { return RequestCache_js_1.DEFAULT_REQUEST_CACHE_MAX_SIZE; } });
|
|
26
|
-
Object.defineProperty(exports, "createCacheKey", { enumerable: true, get: function () { return RequestCache_js_1.createCacheKey; } });
|
|
27
|
-
Object.defineProperty(exports, "isCacheExpired", { enumerable: true, get: function () { return RequestCache_js_1.isCacheExpired; } });
|
|
28
|
-
Object.defineProperty(exports, "createLoadingState", { enumerable: true, get: function () { return RequestCache_js_1.createLoadingState; } });
|
|
29
|
-
Object.defineProperty(exports, "createSuccessState", { enumerable: true, get: function () { return RequestCache_js_1.createSuccessState; } });
|
|
30
|
-
Object.defineProperty(exports, "createErrorState", { enumerable: true, get: function () { return RequestCache_js_1.createErrorState; } });
|
|
31
|
-
var rampsErrorCodes_js_1 = require("./rampsErrorCodes.cjs");
|
|
32
|
-
Object.defineProperty(exports, "RAMPS_ERROR_CODES", { enumerable: true, get: function () { return rampsErrorCodes_js_1.RAMPS_ERROR_CODES; } });
|
|
33
|
-
var selectors_js_1 = require("./selectors.cjs");
|
|
34
|
-
Object.defineProperty(exports, "createRequestSelector", { enumerable: true, get: function () { return selectors_js_1.createRequestSelector; } });
|
|
35
|
-
var featureFlags_js_1 = require("./featureFlags.cjs");
|
|
36
|
-
Object.defineProperty(exports, "HEADLESS_ALL_PROVIDERS_FEATURE_VERSION", { enumerable: true, get: function () { return featureFlags_js_1.HEADLESS_ALL_PROVIDERS_FEATURE_VERSION; } });
|
|
37
|
-
Object.defineProperty(exports, "MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY", { enumerable: true, get: function () { return featureFlags_js_1.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY; } });
|
|
38
|
-
Object.defineProperty(exports, "getHeadlessProviderAllowlist", { enumerable: true, get: function () { return featureFlags_js_1.getHeadlessProviderAllowlist; } });
|
|
39
|
-
Object.defineProperty(exports, "isHeadlessAllProvidersEnabled", { enumerable: true, get: function () { return featureFlags_js_1.isHeadlessAllProvidersEnabled; } });
|
|
40
|
-
var providerAvailability_js_1 = require("./providerAvailability.cjs");
|
|
41
|
-
Object.defineProperty(exports, "normalizeRampsAssetId", { enumerable: true, get: function () { return providerAvailability_js_1.normalizeRampsAssetId; } });
|
|
42
|
-
Object.defineProperty(exports, "providerServesAsset", { enumerable: true, get: function () { return providerAvailability_js_1.providerServesAsset; } });
|
|
43
|
-
Object.defineProperty(exports, "getProvidersServingAsset", { enumerable: true, get: function () { return providerAvailability_js_1.getProvidersServingAsset; } });
|
|
44
|
-
Object.defineProperty(exports, "regionHasProviderForAsset", { enumerable: true, get: function () { return providerAvailability_js_1.regionHasProviderForAsset; } });
|
|
45
|
-
Object.defineProperty(exports, "isFiatDepositAvailable", { enumerable: true, get: function () { return providerAvailability_js_1.isFiatDepositAvailable; } });
|
|
46
|
-
var quoteClassification_js_1 = require("./quoteClassification.cjs");
|
|
47
|
-
Object.defineProperty(exports, "isExternalBrowserQuote", { enumerable: true, get: function () { return quoteClassification_js_1.isExternalBrowserQuote; } });
|
|
48
|
-
Object.defineProperty(exports, "isCustomActionQuote", { enumerable: true, get: function () { return quoteClassification_js_1.isCustomActionQuote; } });
|
|
49
|
-
Object.defineProperty(exports, "isInAppOnlyQuote", { enumerable: true, get: function () { return quoteClassification_js_1.isInAppOnlyQuote; } });
|
|
50
|
-
var orderStatus_js_1 = require("./orderStatus.cjs");
|
|
51
|
-
Object.defineProperty(exports, "TERMINAL_ORDER_STATUSES", { enumerable: true, get: function () { return orderStatus_js_1.TERMINAL_ORDER_STATUSES; } });
|
|
52
|
-
Object.defineProperty(exports, "isTerminalOrderStatus", { enumerable: true, get: function () { return orderStatus_js_1.isTerminalOrderStatus; } });
|
|
53
|
-
var errorNormalization_js_1 = require("./errorNormalization.cjs");
|
|
54
|
-
Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return errorNormalization_js_1.getErrorMessage; } });
|
|
55
|
-
Object.defineProperty(exports, "extractExplicitTypedError", { enumerable: true, get: function () { return errorNormalization_js_1.extractExplicitTypedError; } });
|
|
56
|
-
Object.defineProperty(exports, "normalizeToTypedError", { enumerable: true, get: function () { return errorNormalization_js_1.normalizeToTypedError; } });
|
|
57
|
-
var TransakService_js_1 = require("./TransakService.cjs");
|
|
58
|
-
Object.defineProperty(exports, "TransakApiError", { enumerable: true, get: function () { return TransakService_js_1.TransakApiError; } });
|
|
59
|
-
Object.defineProperty(exports, "TransakService", { enumerable: true, get: function () { return TransakService_js_1.TransakService; } });
|
|
60
|
-
Object.defineProperty(exports, "TransakEnvironment", { enumerable: true, get: function () { return TransakService_js_1.TransakEnvironment; } });
|
|
61
|
-
Object.defineProperty(exports, "TransakOrderIdTransformer", { enumerable: true, get: function () { return TransakService_js_1.TransakOrderIdTransformer; } });
|
|
62
|
-
var transakApiErrorUtils_js_1 = require("./transakApiErrorUtils.cjs");
|
|
63
|
-
Object.defineProperty(exports, "getTransakApiMessage", { enumerable: true, get: function () { return transakApiErrorUtils_js_1.getTransakApiMessage; } });
|
|
64
|
-
Object.defineProperty(exports, "isTransakPhoneRegisteredError", { enumerable: true, get: function () { return transakApiErrorUtils_js_1.isTransakPhoneRegisteredError; } });
|
|
65
|
-
var autorampAccount_js_1 = require("./autorampAccount.cjs");
|
|
66
|
-
Object.defineProperty(exports, "AutorampStatus", { enumerable: true, get: function () { return autorampAccount_js_1.AutorampStatus; } });
|
|
67
|
-
Object.defineProperty(exports, "TERMINAL_AUTORAMP_STATUSES", { enumerable: true, get: function () { return autorampAccount_js_1.TERMINAL_AUTORAMP_STATUSES; } });
|
|
68
|
-
Object.defineProperty(exports, "NOTABLE_AUTORAMP_STATUSES", { enumerable: true, get: function () { return autorampAccount_js_1.NOTABLE_AUTORAMP_STATUSES; } });
|
|
69
|
-
Object.defineProperty(exports, "isTerminalAutorampStatus", { enumerable: true, get: function () { return autorampAccount_js_1.isTerminalAutorampStatus; } });
|
|
70
|
-
Object.defineProperty(exports, "normalizeAutorampStatus", { enumerable: true, get: function () { return autorampAccount_js_1.normalizeAutorampStatus; } });
|
|
71
|
-
Object.defineProperty(exports, "createAutorampAccount", { enumerable: true, get: function () { return autorampAccount_js_1.createAutorampAccount; } });
|
|
72
|
-
Object.defineProperty(exports, "applyAutorampRemoteStatus", { enumerable: true, get: function () { return autorampAccount_js_1.applyAutorampRemoteStatus; } });
|
|
73
|
-
Object.defineProperty(exports, "markAutorampNotified", { enumerable: true, get: function () { return autorampAccount_js_1.markAutorampNotified; } });
|
|
74
|
-
var ownership_message_js_1 = require("./ownership-message.cjs");
|
|
75
|
-
Object.defineProperty(exports, "buildOwnershipMessage", { enumerable: true, get: function () { return ownership_message_js_1.buildOwnershipMessage; } });
|
|
76
|
-
var NeoBankService_js_1 = require("./NeoBankService.cjs");
|
|
77
|
-
Object.defineProperty(exports, "NeoBankService", { enumerable: true, get: function () { return NeoBankService_js_1.NeoBankService; } });
|
|
78
|
-
Object.defineProperty(exports, "neoBankServiceName", { enumerable: true, get: function () { return NeoBankService_js_1.serviceName; } });
|
|
79
|
-
Object.defineProperty(exports, "mapNeoBankAutorampToRemoteSnapshot", { enumerable: true, get: function () { return NeoBankService_js_1.mapNeoBankAutorampToRemoteSnapshot; } });
|
|
80
|
-
var wallet_registration_service_js_1 = require("./wallet-registration-service.cjs");
|
|
81
|
-
Object.defineProperty(exports, "WalletRegistrationError", { enumerable: true, get: function () { return wallet_registration_service_js_1.WalletRegistrationError; } });
|
|
82
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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;AACvB,uHAAA,qBAAqB,OAAA;AAGvB,kEAIiC;AAH/B,wHAAA,eAAe,OAAA;AACf,kIAAA,yBAAyB,OAAA;AACzB,8HAAA,qBAAqB,OAAA;AA4BvB,0DAK6B;AAJ3B,oHAAA,eAAe,OAAA;AACf,mHAAA,cAAc,OAAA;AACd,uHAAA,kBAAkB,OAAA;AAClB,8HAAA,yBAAyB,OAAA;AAE3B,sEAGmC;AAFjC,+HAAA,oBAAoB,OAAA;AACpB,wIAAA,6BAA6B,OAAA;AAoB/B,4DAS8B;AAR5B,oHAAA,cAAc,OAAA;AACd,gIAAA,0BAA0B,OAAA;AAC1B,+HAAA,yBAAyB,OAAA;AACzB,8HAAA,wBAAwB,OAAA;AACxB,6HAAA,uBAAuB,OAAA;AACvB,2HAAA,qBAAqB,OAAA;AACrB,+HAAA,yBAAyB,OAAA;AACzB,0HAAA,oBAAoB,OAAA;AAEtB,gEAA+D;AAAtD,6HAAA,qBAAqB,OAAA;AA2B9B,0DAI6B;AAH3B,mHAAA,cAAc,OAAA;AACd,uHAAA,WAAW,OAAsB;AACjC,uIAAA,kCAAkC,OAAA;AASpC,oFAA2E;AAAlE,yIAAA,uBAAuB,OAAA","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerAutorampStatusChangedEvent,\n RampsControllerOptions,\n PaymentMethodsForContextResponse,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n MoneyAccountWalletRegistrationResult,\n KeyringControllerSignPersonalMessageAction,\n} from './RampsController.js';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerSetSelectedProviderForAssetAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerGetPaymentMethodsForContextAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerAddAutorampAction,\n RampsControllerCreateAutorampAction,\n RampsControllerRemoveAutorampAction,\n RampsControllerRegisterMoneyAccountWalletAction,\n RampsControllerMarkAutorampAsNotifiedAction,\n RampsControllerApplyAutorampStatusFromPushAction,\n RampsControllerRefreshAutorampAction,\n RampsControllerRefreshAutorampsAction,\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.js';\nexport {\n RampsController,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,\n} from './RampsController.js';\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 ProviderSortOrder,\n ProvidersResponse,\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.js';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n getDefaultRedirectCallbackUrl,\n} from './RampsService.js';\nexport type { RampsClientIdentity } from './client-identity.js';\nexport {\n addRampsClientIdentityParams,\n RAMPS_CLIENT_PRODUCT_PARAM,\n RAMPS_CLIENT_VERSION_PARAM,\n} from './client-identity.js';\nexport type {\n RampsServiceGetDefaultRedirectCallbackUrlAction,\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types.js';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache.js';\nexport type { RampsErrorCode } from './rampsErrorCodes.js';\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.js';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes.js';\nexport type { RequestSelectorResult } from './selectors.js';\nexport { createRequestSelector } from './selectors.js';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags.js';\nexport {\n HEADLESS_ALL_PROVIDERS_FEATURE_VERSION,\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n getHeadlessProviderAllowlist,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags.js';\nexport {\n normalizeRampsAssetId,\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability.js';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n} from './quoteClassification.js';\nexport {\n TERMINAL_ORDER_STATUSES,\n isTerminalOrderStatus,\n} from './orderStatus.js';\nexport type { TypedError } from './errorNormalization.js';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization.js';\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.js';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService.js';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils.js';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n TransakServiceCreateWidgetUrlAction,\n} from './TransakService-method-action-types.js';\nexport type {\n AutorampAccount,\n ApplyAutorampRemoteStatusResult,\n CreateAutorampRequest,\n} from './autorampAccount.js';\nexport {\n AutorampStatus,\n TERMINAL_AUTORAMP_STATUSES,\n NOTABLE_AUTORAMP_STATUSES,\n isTerminalAutorampStatus,\n normalizeAutorampStatus,\n createAutorampAccount,\n applyAutorampRemoteStatus,\n markAutorampNotified,\n} from './autorampAccount.js';\nexport { buildOwnershipMessage } from './ownership-message.js';\nexport type {\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n} from './autoramp-types.js';\nexport type {\n NeoBankServiceActions,\n NeoBankServiceEvents,\n NeoBankServiceMessenger,\n NeoBankAutorampResponse,\n NeoBankRequestOptions,\n NeoBankQueryParams,\n GetWalletRegistrationStatusParams,\n RegisterSelfHostedWalletParams,\n} from './NeoBankService.js';\nexport type {\n NeoBankServiceGetAutorampAction,\n NeoBankServiceRegisterPixAddressAction,\n NeoBankServiceGetAutorampQuoteAction,\n NeoBankServiceCreateAutorampAction,\n NeoBankServiceGetAutorampQuoteForAutorampAction,\n NeoBankServiceAttachAutorampQuoteAction,\n NeoBankServiceGetCustomerByExternalIdAction,\n NeoBankServiceGetMoonpayCustomerIdAction,\n NeoBankServiceGetWalletRegistrationStatusAction,\n NeoBankServiceRegisterSelfHostedWalletAction,\n} from './NeoBankService-method-action-types.js';\nexport {\n NeoBankService,\n serviceName as neoBankServiceName,\n mapNeoBankAutorampToRemoteSnapshot,\n} from './NeoBankService.js';\nexport type {\n Blockchain,\n RegistrationOutcome,\n RegistrationStatus,\n SelfHostedRegistration,\n WalletRegistrationErrorKind,\n} from './wallet-registration-service.js';\nexport { WalletRegistrationError } from './wallet-registration-service.js';\n"]}
|