@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
@@ -0,0 +1,84 @@
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
@@ -0,0 +1 @@
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,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAXD,0CAWC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,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;AAxBD,8DAwBC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,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;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"]}
@@ -0,0 +1,56 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorNormalization.d.cts","sourceRoot":"","sources":["../src/errorNormalization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,IAAI,SAAS,MAAM,IAAI;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,MAAM,EAC3D,KAAK,EAAE,OAAO,EACd,EACE,WAAW,EACX,cAAyB,GAC1B,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GACA,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAe9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,SAAS,MAAM,EACvD,KAAK,EAAE,OAAO,EACd,EACE,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC;IAC/C,YAAY,EAAE,IAAI,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GACA,UAAU,CAAC,IAAI,CAAC,CAOlB"}
@@ -0,0 +1,56 @@
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.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorNormalization.d.mts","sourceRoot":"","sources":["../src/errorNormalization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,IAAI,SAAS,MAAM,IAAI;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAYF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,MAAM,EAC3D,KAAK,EAAE,OAAO,EACd,EACE,WAAW,EACX,cAAyB,GAC1B,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GACA,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAe9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,SAAS,MAAM,EACvD,KAAK,EAAE,OAAO,EACd,EACE,WAAW,EACX,YAAY,EACZ,cAAc,GACf,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC;IAC/C,YAAY,EAAE,IAAI,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GACA,UAAU,CAAC,IAAI,CAAC,CAOlB"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Type guard for a non-null object.
3
+ *
4
+ * @param value - The value to test.
5
+ * @returns Whether the value is a record.
6
+ */
7
+ function isRecord(value) {
8
+ return typeof value === 'object' && value !== null;
9
+ }
10
+ /**
11
+ * Best-effort human-readable message from an arbitrary thrown/native value.
12
+ *
13
+ * @param error - The caught value.
14
+ * @returns The message, or `undefined` when none can be derived.
15
+ */
16
+ export function getErrorMessage(error) {
17
+ if (error instanceof Error) {
18
+ return error.message;
19
+ }
20
+ if (isRecord(error) && typeof error.message === 'string') {
21
+ return error.message;
22
+ }
23
+ if (typeof error === 'string') {
24
+ return error;
25
+ }
26
+ return undefined;
27
+ }
28
+ /**
29
+ * Extracts a caller-recognised typed error from an arbitrary thrown/native
30
+ * value, when the value carries an explicit, valid code on one of the given
31
+ * properties. Pure: performs no side effects and applies no fallback, so
32
+ * callers keep full control over precedence (e.g. domain-specific special
33
+ * cases) and the fallback code.
34
+ *
35
+ * @param error - The caught value.
36
+ * @param options - The options.
37
+ * @param options.isValidCode - Type guard identifying a recognised code.
38
+ * @param options.codeProperties - Property names to read a code from, in
39
+ * precedence order. Defaults to `['code']`.
40
+ * @returns The typed error when an explicit valid code is present, else
41
+ * `undefined`.
42
+ */
43
+ export function extractExplicitTypedError(error, { isValidCode, codeProperties = ['code'], }) {
44
+ if (!isRecord(error)) {
45
+ return undefined;
46
+ }
47
+ for (const property of codeProperties) {
48
+ const candidate = error[property];
49
+ if (isValidCode(candidate)) {
50
+ return {
51
+ code: candidate,
52
+ message: getErrorMessage(error),
53
+ details: isRecord(error.details) ? error.details : undefined,
54
+ };
55
+ }
56
+ }
57
+ return undefined;
58
+ }
59
+ /**
60
+ * Normalises an arbitrary thrown/native value into a {@link TypedError}, using
61
+ * the caller's recognised codes and falling back to `fallbackCode` when no
62
+ * explicit valid code is present. Pure.
63
+ *
64
+ * @param error - The caught value.
65
+ * @param options - The options.
66
+ * @param options.isValidCode - Type guard identifying a recognised code.
67
+ * @param options.fallbackCode - Code used when no explicit valid code is found.
68
+ * @param options.codeProperties - Property names to read a code from, in
69
+ * precedence order. Defaults to `['code']`.
70
+ * @returns The typed error.
71
+ */
72
+ export function normalizeToTypedError(error, { isValidCode, fallbackCode, codeProperties, }) {
73
+ return (extractExplicitTypedError(error, { isValidCode, codeProperties }) ?? {
74
+ code: fallbackCode,
75
+ message: getErrorMessage(error),
76
+ });
77
+ }
78
+ //# sourceMappingURL=errorNormalization.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorNormalization.mjs","sourceRoot":"","sources":["../src/errorNormalization.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,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"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isHeadlessAllProvidersEnabled = exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = void 0;
4
+ /**
5
+ * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers
6
+ * expansion. A boolean flag: `true` widens the headless fiat quote path to
7
+ * every provider class (native, in-app WebView aggregator, and
8
+ * external-browser / custom-action); `false` or missing keeps the native-only
9
+ * default. Exported so the flag registry and every consumer stay in sync on
10
+ * the exact key string.
11
+ */
12
+ exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = 'moneyHeadlessAllProviders';
13
+ /**
14
+ * Whether the Headless Buy all-providers feature flag is enabled.
15
+ *
16
+ * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
17
+ * so the controller's quote widening and UI availability gates resolve the
18
+ * flag identically. `localOverrides` (written by dev-only override screens)
19
+ * are merged over `remoteFeatureFlags`, because not every published
20
+ * `RemoteFeatureFlagController` version folds overrides into
21
+ * `remoteFeatureFlags` state; when a version already does, the merge is a
22
+ * no-op. Coerces defensively: only the literal boolean `true` enables, and
23
+ * any other value (missing, string, object) resolves to `false`.
24
+ *
25
+ * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
26
+ * relevant subset of it). May be `null`/`undefined` before the controller is
27
+ * initialized.
28
+ * @returns Whether all provider classes are enabled for the headless fiat
29
+ * quote path.
30
+ */
31
+ function isHeadlessAllProvidersEnabled(remoteFeatureFlagState) {
32
+ const flags = {
33
+ ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),
34
+ ...(remoteFeatureFlagState?.localOverrides ?? {}),
35
+ };
36
+ return flags[exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY] === true;
37
+ }
38
+ exports.isHeadlessAllProvidersEnabled = isHeadlessAllProvidersEnabled;
39
+ //# sourceMappingURL=featureFlags.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureFlags.cjs","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACU,QAAA,qCAAqC,GAChD,2BAA2B,CAAC;AAa9B;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,6BAA6B,CAC3C,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,KAAK,IAAI,CAAC;AAC/D,CAAC;AARD,sEAQC","sourcesContent":["import type { FeatureFlags } from '@metamask/remote-feature-flag-controller';\n\n/**\n * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers\n * expansion. A boolean flag: `true` widens the headless fiat quote path to\n * every provider class (native, in-app WebView aggregator, and\n * external-browser / custom-action); `false` or missing keeps the native-only\n * default. Exported so the flag registry and every consumer stay in sync on\n * the exact key string.\n */\nexport const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY =\n 'moneyHeadlessAllProviders';\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 * 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` (written by dev-only override screens)\n * are 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. Coerces defensively: only the literal boolean `true` enables, and\n * any other value (missing, string, object) 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 flags: FeatureFlags = {\n ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),\n ...(remoteFeatureFlagState?.localOverrides ?? {}),\n };\n return flags[MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY] === true;\n}\n"]}
@@ -0,0 +1,40 @@
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. A boolean flag: `true` widens the headless fiat quote path to
5
+ * every provider class (native, in-app WebView aggregator, and
6
+ * external-browser / custom-action); `false` or missing keeps the native-only
7
+ * default. Exported so the flag registry and every consumer stay in sync on
8
+ * the exact key string.
9
+ */
10
+ export declare const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = "moneyHeadlessAllProviders";
11
+ /**
12
+ * The subset of `RemoteFeatureFlagController` state that
13
+ * {@link isHeadlessAllProvidersEnabled} reads. Structural so consumers can
14
+ * pass the whole controller state (or `undefined` before initialization)
15
+ * without depending on a specific controller version.
16
+ */
17
+ export type HeadlessFeatureFlagsLookup = {
18
+ remoteFeatureFlags?: FeatureFlags;
19
+ localOverrides?: FeatureFlags;
20
+ };
21
+ /**
22
+ * Whether the Headless Buy all-providers feature flag is enabled.
23
+ *
24
+ * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
25
+ * so the controller's quote widening and UI availability gates resolve the
26
+ * flag identically. `localOverrides` (written by dev-only override screens)
27
+ * are merged over `remoteFeatureFlags`, because not every published
28
+ * `RemoteFeatureFlagController` version folds overrides into
29
+ * `remoteFeatureFlags` state; when a version already does, the merge is a
30
+ * no-op. Coerces defensively: only the literal boolean `true` enables, and
31
+ * any other value (missing, string, object) resolves to `false`.
32
+ *
33
+ * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
34
+ * relevant subset of it). May be `null`/`undefined` before the controller is
35
+ * initialized.
36
+ * @returns Whether all provider classes are enabled for the headless fiat
37
+ * quote path.
38
+ */
39
+ export declare function isHeadlessAllProvidersEnabled(remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined): boolean;
40
+ //# sourceMappingURL=featureFlags.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureFlags.d.cts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iDAAiD;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,8BACrB,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,CAC3C,sBAAsB,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACpE,OAAO,CAMT"}
@@ -0,0 +1,40 @@
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. A boolean flag: `true` widens the headless fiat quote path to
5
+ * every provider class (native, in-app WebView aggregator, and
6
+ * external-browser / custom-action); `false` or missing keeps the native-only
7
+ * default. Exported so the flag registry and every consumer stay in sync on
8
+ * the exact key string.
9
+ */
10
+ export declare const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = "moneyHeadlessAllProviders";
11
+ /**
12
+ * The subset of `RemoteFeatureFlagController` state that
13
+ * {@link isHeadlessAllProvidersEnabled} reads. Structural so consumers can
14
+ * pass the whole controller state (or `undefined` before initialization)
15
+ * without depending on a specific controller version.
16
+ */
17
+ export type HeadlessFeatureFlagsLookup = {
18
+ remoteFeatureFlags?: FeatureFlags;
19
+ localOverrides?: FeatureFlags;
20
+ };
21
+ /**
22
+ * Whether the Headless Buy all-providers feature flag is enabled.
23
+ *
24
+ * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
25
+ * so the controller's quote widening and UI availability gates resolve the
26
+ * flag identically. `localOverrides` (written by dev-only override screens)
27
+ * are merged over `remoteFeatureFlags`, because not every published
28
+ * `RemoteFeatureFlagController` version folds overrides into
29
+ * `remoteFeatureFlags` state; when a version already does, the merge is a
30
+ * no-op. Coerces defensively: only the literal boolean `true` enables, and
31
+ * any other value (missing, string, object) resolves to `false`.
32
+ *
33
+ * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
34
+ * relevant subset of it). May be `null`/`undefined` before the controller is
35
+ * initialized.
36
+ * @returns Whether all provider classes are enabled for the headless fiat
37
+ * quote path.
38
+ */
39
+ export declare function isHeadlessAllProvidersEnabled(remoteFeatureFlagState: HeadlessFeatureFlagsLookup | null | undefined): boolean;
40
+ //# sourceMappingURL=featureFlags.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureFlags.d.mts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iDAAiD;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,8BACrB,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,CAC3C,sBAAsB,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACpE,OAAO,CAMT"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers
3
+ * expansion. A boolean flag: `true` widens the headless fiat quote path to
4
+ * every provider class (native, in-app WebView aggregator, and
5
+ * external-browser / custom-action); `false` or missing keeps the native-only
6
+ * default. Exported so the flag registry and every consumer stay in sync on
7
+ * the exact key string.
8
+ */
9
+ export const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = 'moneyHeadlessAllProviders';
10
+ /**
11
+ * Whether the Headless Buy all-providers feature flag is enabled.
12
+ *
13
+ * Owns the key lookup and coercion for {@link MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY}
14
+ * so the controller's quote widening and UI availability gates resolve the
15
+ * flag identically. `localOverrides` (written by dev-only override screens)
16
+ * are merged over `remoteFeatureFlags`, because not every published
17
+ * `RemoteFeatureFlagController` version folds overrides into
18
+ * `remoteFeatureFlags` state; when a version already does, the merge is a
19
+ * no-op. Coerces defensively: only the literal boolean `true` enables, and
20
+ * any other value (missing, string, object) resolves to `false`.
21
+ *
22
+ * @param remoteFeatureFlagState - `RemoteFeatureFlagController` state (or the
23
+ * relevant subset of it). May be `null`/`undefined` before the controller is
24
+ * initialized.
25
+ * @returns Whether all provider classes are enabled for the headless fiat
26
+ * quote path.
27
+ */
28
+ export function isHeadlessAllProvidersEnabled(remoteFeatureFlagState) {
29
+ const flags = {
30
+ ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),
31
+ ...(remoteFeatureFlagState?.localOverrides ?? {}),
32
+ };
33
+ return flags[MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY] === true;
34
+ }
35
+ //# sourceMappingURL=featureFlags.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featureFlags.mjs","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAChD,2BAA2B,CAAC;AAa9B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,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,qCAAqC,CAAC,KAAK,IAAI,CAAC;AAC/D,CAAC","sourcesContent":["import type { FeatureFlags } from '@metamask/remote-feature-flag-controller';\n\n/**\n * Remote (LaunchDarkly) feature flag key for the Headless Buy all-providers\n * expansion. A boolean flag: `true` widens the headless fiat quote path to\n * every provider class (native, in-app WebView aggregator, and\n * external-browser / custom-action); `false` or missing keeps the native-only\n * default. Exported so the flag registry and every consumer stay in sync on\n * the exact key string.\n */\nexport const MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY =\n 'moneyHeadlessAllProviders';\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 * 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` (written by dev-only override screens)\n * are 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. Coerces defensively: only the literal boolean `true` enables, and\n * any other value (missing, string, object) 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 flags: FeatureFlags = {\n ...(remoteFeatureFlagState?.remoteFeatureFlags ?? {}),\n ...(remoteFeatureFlagState?.localOverrides ?? {}),\n };\n return flags[MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY] === true;\n}\n"]}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTransakPhoneRegisteredError = exports.getTransakApiMessage = exports.TransakOrderIdTransformer = exports.TransakEnvironment = exports.TransakService = exports.TransakApiError = 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_SDK_VERSION = exports.RampsOrderStatus = exports.RampsApiService = exports.RampsEnvironment = exports.RampsService = exports.RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS = exports.getInternalOrderCode = exports.getDefaultRampsControllerState = exports.RampsController = void 0;
3
+ exports.isTransakPhoneRegisteredError = exports.getTransakApiMessage = exports.TransakOrderIdTransformer = exports.TransakEnvironment = exports.TransakService = exports.TransakApiError = exports.normalizeToTypedError = exports.extractExplicitTypedError = exports.getErrorMessage = exports.isInAppOnlyQuote = exports.isCustomActionQuote = exports.isExternalBrowserQuote = exports.isFiatDepositAvailable = exports.regionHasProviderForAsset = exports.getProvidersServingAsset = exports.providerServesAsset = exports.isHeadlessAllProvidersEnabled = exports.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY = 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_SDK_VERSION = exports.RampsOrderStatus = exports.RampsApiService = exports.RampsEnvironment = exports.RampsService = exports.RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS = exports.getInternalOrderCode = exports.getDefaultRampsControllerState = exports.RampsController = void 0;
4
4
  var RampsController_1 = require("./RampsController.cjs");
5
5
  Object.defineProperty(exports, "RampsController", { enumerable: true, get: function () { return RampsController_1.RampsController; } });
6
6
  Object.defineProperty(exports, "getDefaultRampsControllerState", { enumerable: true, get: function () { return RampsController_1.getDefaultRampsControllerState; } });
@@ -25,6 +25,22 @@ var rampsErrorCodes_1 = require("./rampsErrorCodes.cjs");
25
25
  Object.defineProperty(exports, "RAMPS_ERROR_CODES", { enumerable: true, get: function () { return rampsErrorCodes_1.RAMPS_ERROR_CODES; } });
26
26
  var selectors_1 = require("./selectors.cjs");
27
27
  Object.defineProperty(exports, "createRequestSelector", { enumerable: true, get: function () { return selectors_1.createRequestSelector; } });
28
+ var featureFlags_1 = require("./featureFlags.cjs");
29
+ Object.defineProperty(exports, "MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY", { enumerable: true, get: function () { return featureFlags_1.MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY; } });
30
+ Object.defineProperty(exports, "isHeadlessAllProvidersEnabled", { enumerable: true, get: function () { return featureFlags_1.isHeadlessAllProvidersEnabled; } });
31
+ var providerAvailability_1 = require("./providerAvailability.cjs");
32
+ Object.defineProperty(exports, "providerServesAsset", { enumerable: true, get: function () { return providerAvailability_1.providerServesAsset; } });
33
+ Object.defineProperty(exports, "getProvidersServingAsset", { enumerable: true, get: function () { return providerAvailability_1.getProvidersServingAsset; } });
34
+ Object.defineProperty(exports, "regionHasProviderForAsset", { enumerable: true, get: function () { return providerAvailability_1.regionHasProviderForAsset; } });
35
+ Object.defineProperty(exports, "isFiatDepositAvailable", { enumerable: true, get: function () { return providerAvailability_1.isFiatDepositAvailable; } });
36
+ var quoteClassification_1 = require("./quoteClassification.cjs");
37
+ Object.defineProperty(exports, "isExternalBrowserQuote", { enumerable: true, get: function () { return quoteClassification_1.isExternalBrowserQuote; } });
38
+ Object.defineProperty(exports, "isCustomActionQuote", { enumerable: true, get: function () { return quoteClassification_1.isCustomActionQuote; } });
39
+ Object.defineProperty(exports, "isInAppOnlyQuote", { enumerable: true, get: function () { return quoteClassification_1.isInAppOnlyQuote; } });
40
+ var errorNormalization_1 = require("./errorNormalization.cjs");
41
+ Object.defineProperty(exports, "getErrorMessage", { enumerable: true, get: function () { return errorNormalization_1.getErrorMessage; } });
42
+ Object.defineProperty(exports, "extractExplicitTypedError", { enumerable: true, get: function () { return errorNormalization_1.extractExplicitTypedError; } });
43
+ Object.defineProperty(exports, "normalizeToTypedError", { enumerable: true, get: function () { return errorNormalization_1.normalizeToTypedError; } });
28
44
  var TransakService_1 = require("./TransakService.cjs");
29
45
  Object.defineProperty(exports, "TransakApiError", { enumerable: true, get: function () { return TransakService_1.TransakApiError; } });
30
46
  Object.defineProperty(exports, "TransakService", { enumerable: true, get: function () { return TransakService_1.TransakService; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAgEA,yDAK2B;AAJzB,kHAAA,eAAe,OAAA;AACf,iIAAA,8BAA8B,OAAA;AAC9B,uHAAA,oBAAoB,OAAA;AACpB,4IAAA,yCAAyC,OAAA;AAsC3C,mDAMwB;AALtB,4GAAA,YAAY,OAAA;AACZ,gHAAA,gBAAgB,OAAA;AAChB,+GAAA,eAAe,OAAA;AACf,gHAAA,gBAAgB,OAAA;AAChB,iHAAA,iBAAiB,OAAA;AAmBnB,mDASwB;AARtB,6GAAA,aAAa,OAAA;AACb,yHAAA,yBAAyB,OAAA;AACzB,8HAAA,8BAA8B,OAAA;AAC9B,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,kHAAA,kBAAkB,OAAA;AAClB,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAElB,yDAAsD;AAA7C,oHAAA,iBAAiB,OAAA;AAE1B,6CAAoD;AAA3C,kHAAA,qBAAqB,OAAA;AA2B9B,uDAK0B;AAJxB,iHAAA,eAAe,OAAA;AACf,gHAAA,cAAc,OAAA;AACd,oHAAA,kBAAkB,OAAA;AAClB,2HAAA,yBAAyB,OAAA;AAE3B,mEAGgC;AAF9B,4HAAA,oBAAoB,OAAA;AACpB,qIAAA,6BAA6B,OAAA","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.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;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StateAction,\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"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export type { RampsControllerActions, RampsControllerEvents, RampsControllerGetStateAction, RampsControllerMessenger, RampsControllerState, RampsControllerStateChangeEvent, RampsControllerOrderStatusChangedEvent, RampsControllerOptions, ProviderScope, UserRegion, ResourceState, TransakState, NativeProvidersState, } from "./RampsController.cjs";
1
+ export type { RampsControllerActions, RampsControllerEvents, RampsControllerGetStateAction, RampsControllerMessenger, RampsControllerState, RampsControllerStateChangeEvent, RampsControllerOrderStatusChangedEvent, RampsControllerOptions, UserRegion, ResourceState, TransakState, NativeProvidersState, } from "./RampsController.cjs";
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.cjs";
3
3
  export { RampsController, getDefaultRampsControllerState, getInternalOrderCode, RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS, } from "./RampsController.cjs";
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.cjs";
@@ -10,6 +10,12 @@ export { RequestStatus, DEFAULT_REQUEST_CACHE_TTL, DEFAULT_REQUEST_CACHE_MAX_SIZ
10
10
  export { RAMPS_ERROR_CODES } from "./rampsErrorCodes.cjs";
11
11
  export type { RequestSelectorResult } from "./selectors.cjs";
12
12
  export { createRequestSelector } from "./selectors.cjs";
13
+ export type { HeadlessFeatureFlagsLookup } from "./featureFlags.cjs";
14
+ export { MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY, isHeadlessAllProvidersEnabled, } from "./featureFlags.cjs";
15
+ export { providerServesAsset, getProvidersServingAsset, regionHasProviderForAsset, isFiatDepositAvailable, } from "./providerAvailability.cjs";
16
+ export { isExternalBrowserQuote, isCustomActionQuote, isInAppOnlyQuote, } from "./quoteClassification.cjs";
17
+ export type { TypedError } from "./errorNormalization.cjs";
18
+ export { getErrorMessage, extractExplicitTypedError, normalizeToTypedError, } from "./errorNormalization.cjs";
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.cjs";
14
20
  export { TransakApiError, TransakService, TransakEnvironment, TransakOrderIdTransformer, } from "./TransakService.cjs";
15
21
  export { getTransakApiMessage, isTransakPhoneRegisteredError, } from "./transakApiErrorUtils.cjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,GACrB,8BAA0B;AAC3B,YAAY,EACV,mCAAmC,EACnC,iCAAiC,EACjC,oCAAoC,EACpC,kCAAkC,EAClC,wCAAwC,EACxC,yBAAyB,EACzB,iCAAiC,EACjC,8BAA8B,EAC9B,qCAAqC,EACrC,iCAAiC,EACjC,sCAAsC,EACtC,6CAA6C,EAC7C,8BAA8B,EAC9B,6BAA6B,EAC7B,gCAAgC,EAChC,sCAAsC,EACtC,qCAAqC,EACrC,qCAAqC,EACrC,uCAAuC,EACvC,6BAA6B,EAC7B,yCAAyC,EACzC,qCAAqC,EACrC,0CAA0C,EAC1C,4CAA4C,EAC5C,4CAA4C,EAC5C,sCAAsC,EACtC,uCAAuC,EACvC,yC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EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,2BAAuB;AACxB,OAAO,EAAE,iBAAiB,EAAE,8BAA0B;AACtD,YAAY,EAAE,qBAAqB,EAAE,wBAAoB;AACzD,OAAO,EAAE,qBAAqB,EAAE,wBAAoB;AACpD,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,qCAAqC,EACrC,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,IAAI,2BAA2B,GACpD,6BAAyB;AAC1B,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,yBAAyB,GAC1B,6BAAyB;AAC1B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,GAC9B,mCAA+B;AAChC,YAAY,EACV,2BAA2B,EAC3B,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,qCAAqC,EACrC,+BAA+B,EAC/B,4BAA4B,EAC5B,8BAA8B,EAC9B,4CAA4C,GAC7C,iDAA6C"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,GACrB,8BAA0B;AAC3B,YAAY,EACV,mCAAmC,EACnC,iCAAiC,EACjC,oCAAoC,EACpC,kCAAkC,EA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