@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,38 @@
1
+ /**
2
+ * Whether a quote's checkout runs in an external / system browser rather than
3
+ * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the
4
+ * quotes API. When the hint is absent the quote is treated as in-app (the
5
+ * caller is responsible for the in-app WebView fail-safe).
6
+ *
7
+ * This is the pure classification only: it deliberately knows nothing about
8
+ * host redirect URLs or deeplink schemes, which stay in the consuming client.
9
+ *
10
+ * @param quote - The quote to classify.
11
+ * @returns Whether the quote uses an external browser.
12
+ */
13
+ export function isExternalBrowserQuote(quote) {
14
+ return quote.quote?.buyWidget?.browser === 'IN_APP_OS_BROWSER';
15
+ }
16
+ /**
17
+ * Whether a quote is a custom-action ("checkout outside of MetaMask") quote,
18
+ * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the
19
+ * wire may carry even though it is absent from the published `Quote` type.
20
+ *
21
+ * @param quote - The quote to classify.
22
+ * @returns Whether the quote is a custom-action quote.
23
+ */
24
+ export function isCustomActionQuote(quote) {
25
+ return quote.quote?.isCustomAction === true;
26
+ }
27
+ /**
28
+ * Whether a quote continues inside an in-app WebView, i.e. it is neither a
29
+ * custom-action quote nor an external-browser quote. This is the Phase 1
30
+ * in-app-only inclusion test.
31
+ *
32
+ * @param quote - The quote to classify.
33
+ * @returns Whether the quote is an in-app WebView quote.
34
+ */
35
+ export function isInAppOnlyQuote(quote) {
36
+ return !isCustomActionQuote(quote) && !isExternalBrowserQuote(quote);
37
+ }
38
+ //# sourceMappingURL=quoteClassification.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quoteClassification.mjs","sourceRoot":"","sources":["../src/quoteClassification.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAY;IACjD,OAAO,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,KAAK,mBAAmB,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,OAAQ,KAAK,CAAC,KAAsC,EAAE,cAAc,KAAK,IAAI,CAAC;AAChF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Quote } from './RampsService';\n\n/**\n * Whether a quote's checkout runs in an external / system browser rather than\n * an in-app WebView. Decided by the per-quote `buyWidget.browser` hint from the\n * quotes API. When the hint is absent the quote is treated as in-app (the\n * caller is responsible for the in-app WebView fail-safe).\n *\n * This is the pure classification only: it deliberately knows nothing about\n * host redirect URLs or deeplink schemes, which stay in the consuming client.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote uses an external browser.\n */\nexport function isExternalBrowserQuote(quote: Quote): boolean {\n return quote.quote?.buyWidget?.browser === 'IN_APP_OS_BROWSER';\n}\n\n/**\n * Whether a quote is a custom-action (\"checkout outside of MetaMask\") quote,\n * e.g. PayPal or Robinhood. Reads the inline `isCustomAction` flag, which the\n * wire may carry even though it is absent from the published `Quote` type.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote is a custom-action quote.\n */\nexport function isCustomActionQuote(quote: Quote): boolean {\n return (quote.quote as { isCustomAction?: boolean })?.isCustomAction === true;\n}\n\n/**\n * Whether a quote continues inside an in-app WebView, i.e. it is neither a\n * custom-action quote nor an external-browser quote. This is the Phase 1\n * in-app-only inclusion test.\n *\n * @param quote - The quote to classify.\n * @returns Whether the quote is an in-app WebView quote.\n */\nexport function isInAppOnlyQuote(quote: Quote): boolean {\n return !isCustomActionQuote(quote) && !isExternalBrowserQuote(quote);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/ramps-controller",
3
- "version": "16.0.0",
3
+ "version": "17.0.0",
4
4
  "description": "A controller for managing cryptocurrency on/off ramps functionality",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -57,7 +57,8 @@
57
57
  "@metamask/base-controller": "^9.1.0",
58
58
  "@metamask/controller-utils": "^12.3.0",
59
59
  "@metamask/messenger": "^2.0.0",
60
- "@metamask/profile-sync-controller": "^28.3.0"
60
+ "@metamask/profile-sync-controller": "^28.3.0",
61
+ "@metamask/remote-feature-flag-controller": "^4.2.2"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@metamask/auto-changelog": "^6.1.0",