@coinbase/cbpay-js
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -5,2 +5,5 @@ # Changelog | ||
## [2.3.0] - 2024-10-21 | ||
- Add Offramp support with `generateOffRampURL` and `initOffRamp` functions | ||
## [2.2.1] - 2024-08-01 | ||
@@ -7,0 +10,0 @@ - Added `redirectUrl` widget parameter |
@@ -129,3 +129,3 @@ type DestinationWallet = { | ||
type WidgetType = 'buy' | 'checkout'; | ||
type WidgetType = 'buy' | 'checkout' | 'sell'; | ||
/** | ||
@@ -132,0 +132,0 @@ * Note: Two factor authentication does not work in an iframe, so the embedded experience should not be used. It will |
@@ -459,2 +459,26 @@ "use strict"; | ||
}, "formatPostMessage"); | ||
// src/offramp/generateOffRampURL.ts | ||
var generateOffRampURL = /* @__PURE__ */ __name(function(_param) { | ||
var _param_host = _param.host, host = _param_host === void 0 ? DEFAULT_HOST : _param_host, props = _object_without_properties(_param, [ | ||
"host" | ||
]); | ||
var url = new URL(host); | ||
url.pathname = "/v3/sell/input"; | ||
Object.keys(props).forEach(function(key) { | ||
var value = props[key]; | ||
if (value !== void 0) { | ||
if ([ | ||
"string", | ||
"number", | ||
"boolean" | ||
].includes(typeof value === "undefined" ? "undefined" : _type_of(value))) { | ||
url.searchParams.append(key, value.toString()); | ||
} else { | ||
url.searchParams.append(key, JSON.stringify(value)); | ||
} | ||
} | ||
}); | ||
url.searchParams.sort(); | ||
return url.toString(); | ||
}, "generateOffRampURL"); | ||
// src/utils/CoinbasePixel.ts | ||
@@ -489,9 +513,20 @@ var PopupSizes = { | ||
var experience = experienceLoggedOut || experienceLoggedIn; | ||
var url = generateOnRampURL(_object_spread({ | ||
appId: _this.appId, | ||
host: _this.host, | ||
theme: _nullishCoalesce(_this.theme, function() { | ||
return void 0; | ||
}) | ||
}, _this.appParams)); | ||
var url = ""; | ||
if (options.path === "/v3/sell") { | ||
url = generateOffRampURL(_object_spread({ | ||
appId: _this.appId, | ||
host: _this.host, | ||
theme: _nullishCoalesce(_this.theme, function() { | ||
return void 0; | ||
}) | ||
}, _this.appParams)); | ||
} else { | ||
url = generateOnRampURL(_object_spread({ | ||
appId: _this.appId, | ||
host: _this.host, | ||
theme: _nullishCoalesce(_this.theme, function() { | ||
return void 0; | ||
}) | ||
}, _this.appParams)); | ||
} | ||
_this.log("Opening experience", { | ||
@@ -819,3 +854,4 @@ experience: experience | ||
buy: "/buy", | ||
checkout: "/checkout" | ||
checkout: "/checkout", | ||
sell: "/v3/sell" | ||
}; | ||
@@ -822,0 +858,0 @@ var CBPayInstance = function CBPayInstance(options) { |
{ | ||
"name": "@coinbase/cbpay-js", | ||
"repository": "https://github.com/coinbase/cbpay-js", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126139
1590