@ramp-network/ramp-instant-sdk
Advanced tools
Comparing version 3.2.2-rc0 to 3.2.2-rc1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SEND_CRYPTO_SUPPORTED_VERSION = exports.baseWidgetUrl = void 0; | ||
exports.baseWidgetUrl = void 0; | ||
exports.baseWidgetUrl = 'https://buy.ramp.network/'; | ||
exports.SEND_CRYPTO_SUPPORTED_VERSION = 1; | ||
//# sourceMappingURL=consts.js.map |
@@ -41,3 +41,3 @@ "use strict"; | ||
if (value) { | ||
baseUrl.searchParams.append(key, Array.isArray(value) ? value.join(',') : value.toString()); | ||
baseUrl.searchParams.append(key, value); | ||
} | ||
@@ -134,3 +134,3 @@ }); | ||
} | ||
iframe.setAttribute('allow', 'microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.setAttribute('allow', 'payment; microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.classList.add('iframe'); | ||
@@ -137,0 +137,0 @@ return iframe; |
@@ -53,3 +53,2 @@ "use strict"; | ||
var init_helpers_1 = require("./init-helpers"); | ||
var consts_1 = require("./consts"); | ||
var init_helpers_2 = require("./init-helpers"); | ||
@@ -64,3 +63,2 @@ var types_1 = require("./types"); | ||
this._isVisible = false; | ||
this._onSendCryptoCallback = undefined; | ||
(0, init_helpers_2.importFonts)(); | ||
@@ -76,5 +74,5 @@ this.unsubscribe = this.unsubscribe.bind(this); | ||
this._subscribeToWidgetEvents = this._subscribeToWidgetEvents.bind(this); | ||
this._onSendCrypto = this._onSendCrypto.bind(this); | ||
this._rawNormalizedConfig = (0, utils_1.normalizeConfigAndLogErrorsOnInvalidFields)(__assign({ variant: 'desktop' }, config)); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), this._getHostConfigSdkParams(this._rawNormalizedConfig, config.useSendCryptoCallback)); | ||
var widgetVariant = (0, utils_1.determineWidgetVariant)(this._rawNormalizedConfig); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), { variant: widgetVariant, widgetInstanceId: (0, utils_1.getRandomIntString)() }); | ||
} | ||
@@ -142,6 +140,2 @@ RampInstantSDK.prototype.show = function () { | ||
}; | ||
RampInstantSDK.prototype.onSendCrypto = function (callback) { | ||
this._onSendCryptoCallback = callback; | ||
return this; | ||
}; | ||
RampInstantSDK.prototype.onRequestCryptoAccount = function (callback) { | ||
@@ -238,5 +232,2 @@ var _this = this; | ||
}; | ||
if (this._config.useSendCryptoCallbackVersion) { | ||
this.on(types_1.InternalEventTypes.SEND_CRYPTO, this._onSendCrypto); | ||
} | ||
this._on(types_1.WidgetEventTypes.WIDGET_CONFIG_DONE, onConfigEvent, true); | ||
@@ -295,54 +286,2 @@ this._on(types_1.WidgetEventTypes.WIDGET_CONFIG_FAILED, onConfigEvent, true); | ||
}; | ||
RampInstantSDK.prototype._onSendCrypto = function (event) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, e_2, errorMessage; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (event.eventVersion !== consts_1.SEND_CRYPTO_SUPPORTED_VERSION) { | ||
// tslint:disable-next-line:no-console | ||
console.warn("unsupported event version - '".concat(event, "'. This listener will have no effect.")); | ||
return [2 /*return*/]; | ||
} | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, ((_a = this._onSendCryptoCallback) === null || _a === void 0 ? void 0 : _a.call(this, event.payload.assetSymbol, event.payload.amount, event.payload.address))]; | ||
case 2: | ||
result = _b.sent(); | ||
if (!(result === null || result === void 0 ? void 0 : result.txHash)) { | ||
throw new Error('Missing txHash in the callback result'); | ||
} | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
errorMessage = void 0; | ||
if (typeof e_2 === 'string') { | ||
errorMessage = e_2; | ||
} | ||
else if (e_2 instanceof Error) { | ||
errorMessage = e_2.message; | ||
} | ||
this._sendEventToWidget({ | ||
eventVersion: consts_1.SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: types_1.InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
error: errorMessage, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
case 4: | ||
this._sendEventToWidget({ | ||
eventVersion: consts_1.SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: types_1.InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
txHash: result.txHash, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// Event subscriptions aren't cleared so that host can receive a PAYMENT_SUCCESSFUL event | ||
@@ -393,8 +332,2 @@ // even after the widget has been closed | ||
}; | ||
RampInstantSDK.prototype._getHostConfigSdkParams = function (config, useSendCryptoCallback) { | ||
var widgetVariant = (0, utils_1.determineWidgetVariant)(config); | ||
return __assign({ variant: widgetVariant, widgetInstanceId: (0, utils_1.getRandomIntString)() }, (useSendCryptoCallback | ||
? { useSendCryptoCallbackVersion: consts_1.SEND_CRYPTO_SUPPORTED_VERSION } | ||
: {})); | ||
}; | ||
return RampInstantSDK; | ||
@@ -401,0 +334,0 @@ }()); |
@@ -40,3 +40,2 @@ "use strict"; | ||
WidgetEventTypes["PURCHASE_CREATED"] = "PURCHASE_CREATED"; | ||
WidgetEventTypes["OFFRAMP_SALE_CREATED"] = "OFFRAMP_SALE_CREATED"; | ||
})(WidgetEventTypes = exports.WidgetEventTypes || (exports.WidgetEventTypes = {})); | ||
@@ -49,3 +48,2 @@ var InternalEventTypes; | ||
InternalEventTypes["REQUEST_CRYPTO_ACCOUNT"] = "REQUEST_CRYPTO_ACCOUNT"; | ||
InternalEventTypes["SEND_CRYPTO"] = "SEND_CRYPTO"; | ||
})(InternalEventTypes = exports.InternalEventTypes || (exports.InternalEventTypes = {})); | ||
@@ -55,4 +53,3 @@ var InternalSdkEventTypes; | ||
InternalSdkEventTypes["REQUEST_CRYPTO_ACCOUNT_RESULT"] = "REQUEST_CRYPTO_ACCOUNT_RESULT"; | ||
InternalSdkEventTypes["SEND_CRYPTO_RESULT"] = "SEND_CRYPTO_RESULT"; | ||
})(InternalSdkEventTypes = exports.InternalSdkEventTypes || (exports.InternalSdkEventTypes = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -67,5 +67,2 @@ "use strict"; | ||
} | ||
if (typeof config.useSendCryptoCallback !== 'undefined') { | ||
delete config.useSendCryptoCallback; | ||
} | ||
logErrors(errors); | ||
@@ -72,0 +69,0 @@ return configCopy; |
@@ -276,3 +276,2 @@ /*! ***************************************************************************** | ||
var baseWidgetUrl = 'https://buy.ramp.network/'; | ||
var SEND_CRYPTO_SUPPORTED_VERSION = 1; | ||
@@ -315,3 +314,2 @@ var PaymentMethodName; | ||
WidgetEventTypes["PURCHASE_CREATED"] = "PURCHASE_CREATED"; | ||
WidgetEventTypes["OFFRAMP_SALE_CREATED"] = "OFFRAMP_SALE_CREATED"; | ||
})(WidgetEventTypes || (WidgetEventTypes = {})); | ||
@@ -324,3 +322,2 @@ var InternalEventTypes; | ||
InternalEventTypes["REQUEST_CRYPTO_ACCOUNT"] = "REQUEST_CRYPTO_ACCOUNT"; | ||
InternalEventTypes["SEND_CRYPTO"] = "SEND_CRYPTO"; | ||
})(InternalEventTypes || (InternalEventTypes = {})); | ||
@@ -330,3 +327,2 @@ var InternalSdkEventTypes; | ||
InternalSdkEventTypes["REQUEST_CRYPTO_ACCOUNT_RESULT"] = "REQUEST_CRYPTO_ACCOUNT_RESULT"; | ||
InternalSdkEventTypes["SEND_CRYPTO_RESULT"] = "SEND_CRYPTO_RESULT"; | ||
})(InternalSdkEventTypes || (InternalSdkEventTypes = {})); | ||
@@ -375,5 +371,2 @@ | ||
} | ||
if (typeof config.useSendCryptoCallback !== 'undefined') { | ||
delete config.useSendCryptoCallback; | ||
} | ||
logErrors(errors); | ||
@@ -467,3 +460,3 @@ return configCopy; | ||
if (value) { | ||
baseUrl.searchParams.append(key, Array.isArray(value) ? value.join(',') : value.toString()); | ||
baseUrl.searchParams.append(key, value); | ||
} | ||
@@ -555,3 +548,3 @@ }); | ||
} | ||
iframe.setAttribute('allow', 'microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.setAttribute('allow', 'payment; microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.classList.add('iframe'); | ||
@@ -640,3 +633,2 @@ return iframe; | ||
this._isVisible = false; | ||
this._onSendCryptoCallback = undefined; | ||
importFonts(); | ||
@@ -652,5 +644,5 @@ this.unsubscribe = this.unsubscribe.bind(this); | ||
this._subscribeToWidgetEvents = this._subscribeToWidgetEvents.bind(this); | ||
this._onSendCrypto = this._onSendCrypto.bind(this); | ||
this._rawNormalizedConfig = normalizeConfigAndLogErrorsOnInvalidFields(__assign({ variant: 'desktop' }, config)); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), this._getHostConfigSdkParams(this._rawNormalizedConfig, config.useSendCryptoCallback)); | ||
var widgetVariant = determineWidgetVariant(this._rawNormalizedConfig); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), { variant: widgetVariant, widgetInstanceId: getRandomIntString() }); | ||
} | ||
@@ -718,6 +710,2 @@ RampInstantSDK.prototype.show = function () { | ||
}; | ||
RampInstantSDK.prototype.onSendCrypto = function (callback) { | ||
this._onSendCryptoCallback = callback; | ||
return this; | ||
}; | ||
RampInstantSDK.prototype.onRequestCryptoAccount = function (callback) { | ||
@@ -814,5 +802,2 @@ var _this = this; | ||
}; | ||
if (this._config.useSendCryptoCallbackVersion) { | ||
this.on(InternalEventTypes.SEND_CRYPTO, this._onSendCrypto); | ||
} | ||
this._on(WidgetEventTypes.WIDGET_CONFIG_DONE, onConfigEvent, true); | ||
@@ -871,54 +856,2 @@ this._on(WidgetEventTypes.WIDGET_CONFIG_FAILED, onConfigEvent, true); | ||
}; | ||
RampInstantSDK.prototype._onSendCrypto = function (event) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, e_2, errorMessage; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (event.eventVersion !== SEND_CRYPTO_SUPPORTED_VERSION) { | ||
// tslint:disable-next-line:no-console | ||
console.warn("unsupported event version - '".concat(event, "'. This listener will have no effect.")); | ||
return [2 /*return*/]; | ||
} | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, ((_a = this._onSendCryptoCallback) === null || _a === void 0 ? void 0 : _a.call(this, event.payload.assetSymbol, event.payload.amount, event.payload.address))]; | ||
case 2: | ||
result = _b.sent(); | ||
if (!(result === null || result === void 0 ? void 0 : result.txHash)) { | ||
throw new Error('Missing txHash in the callback result'); | ||
} | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
errorMessage = void 0; | ||
if (typeof e_2 === 'string') { | ||
errorMessage = e_2; | ||
} | ||
else if (e_2 instanceof Error) { | ||
errorMessage = e_2.message; | ||
} | ||
this._sendEventToWidget({ | ||
eventVersion: SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
error: errorMessage, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
case 4: | ||
this._sendEventToWidget({ | ||
eventVersion: SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
txHash: result.txHash, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// Event subscriptions aren't cleared so that host can receive a PAYMENT_SUCCESSFUL event | ||
@@ -969,8 +902,2 @@ // even after the widget has been closed | ||
}; | ||
RampInstantSDK.prototype._getHostConfigSdkParams = function (config, useSendCryptoCallback) { | ||
var widgetVariant = determineWidgetVariant(config); | ||
return __assign({ variant: widgetVariant, widgetInstanceId: getRandomIntString() }, (useSendCryptoCallback | ||
? { useSendCryptoCallbackVersion: SEND_CRYPTO_SUPPORTED_VERSION } | ||
: {})); | ||
}; | ||
return RampInstantSDK; | ||
@@ -977,0 +904,0 @@ }()); |
@@ -282,3 +282,2 @@ (function (global, factory) { | ||
var baseWidgetUrl = 'https://buy.ramp.network/'; | ||
var SEND_CRYPTO_SUPPORTED_VERSION = 1; | ||
@@ -321,3 +320,2 @@ var PaymentMethodName; | ||
WidgetEventTypes["PURCHASE_CREATED"] = "PURCHASE_CREATED"; | ||
WidgetEventTypes["OFFRAMP_SALE_CREATED"] = "OFFRAMP_SALE_CREATED"; | ||
})(exports.RampInstantEventTypes || (exports.RampInstantEventTypes = {})); | ||
@@ -330,3 +328,2 @@ var InternalEventTypes; | ||
InternalEventTypes["REQUEST_CRYPTO_ACCOUNT"] = "REQUEST_CRYPTO_ACCOUNT"; | ||
InternalEventTypes["SEND_CRYPTO"] = "SEND_CRYPTO"; | ||
})(InternalEventTypes || (InternalEventTypes = {})); | ||
@@ -336,3 +333,2 @@ var InternalSdkEventTypes; | ||
InternalSdkEventTypes["REQUEST_CRYPTO_ACCOUNT_RESULT"] = "REQUEST_CRYPTO_ACCOUNT_RESULT"; | ||
InternalSdkEventTypes["SEND_CRYPTO_RESULT"] = "SEND_CRYPTO_RESULT"; | ||
})(InternalSdkEventTypes || (InternalSdkEventTypes = {})); | ||
@@ -381,5 +377,2 @@ | ||
} | ||
if (typeof config.useSendCryptoCallback !== 'undefined') { | ||
delete config.useSendCryptoCallback; | ||
} | ||
logErrors(errors); | ||
@@ -473,3 +466,3 @@ return configCopy; | ||
if (value) { | ||
baseUrl.searchParams.append(key, Array.isArray(value) ? value.join(',') : value.toString()); | ||
baseUrl.searchParams.append(key, value); | ||
} | ||
@@ -561,3 +554,3 @@ }); | ||
} | ||
iframe.setAttribute('allow', 'microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.setAttribute('allow', 'payment; microphone; camera; clipboard-read; clipboard-write'); | ||
iframe.classList.add('iframe'); | ||
@@ -646,3 +639,2 @@ return iframe; | ||
this._isVisible = false; | ||
this._onSendCryptoCallback = undefined; | ||
importFonts(); | ||
@@ -658,5 +650,5 @@ this.unsubscribe = this.unsubscribe.bind(this); | ||
this._subscribeToWidgetEvents = this._subscribeToWidgetEvents.bind(this); | ||
this._onSendCrypto = this._onSendCrypto.bind(this); | ||
this._rawNormalizedConfig = normalizeConfigAndLogErrorsOnInvalidFields(__assign({ variant: 'desktop' }, config)); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), this._getHostConfigSdkParams(this._rawNormalizedConfig, config.useSendCryptoCallback)); | ||
var widgetVariant = determineWidgetVariant(this._rawNormalizedConfig); | ||
this._config = __assign(__assign({}, this._rawNormalizedConfig), { variant: widgetVariant, widgetInstanceId: getRandomIntString() }); | ||
} | ||
@@ -724,6 +716,2 @@ RampInstantSDK.prototype.show = function () { | ||
}; | ||
RampInstantSDK.prototype.onSendCrypto = function (callback) { | ||
this._onSendCryptoCallback = callback; | ||
return this; | ||
}; | ||
RampInstantSDK.prototype.onRequestCryptoAccount = function (callback) { | ||
@@ -820,5 +808,2 @@ var _this = this; | ||
}; | ||
if (this._config.useSendCryptoCallbackVersion) { | ||
this.on(InternalEventTypes.SEND_CRYPTO, this._onSendCrypto); | ||
} | ||
this._on(exports.RampInstantEventTypes.WIDGET_CONFIG_DONE, onConfigEvent, true); | ||
@@ -877,54 +862,2 @@ this._on(exports.RampInstantEventTypes.WIDGET_CONFIG_FAILED, onConfigEvent, true); | ||
}; | ||
RampInstantSDK.prototype._onSendCrypto = function (event) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, e_2, errorMessage; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (event.eventVersion !== SEND_CRYPTO_SUPPORTED_VERSION) { | ||
// tslint:disable-next-line:no-console | ||
console.warn("unsupported event version - '".concat(event, "'. This listener will have no effect.")); | ||
return [2 /*return*/]; | ||
} | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, ((_a = this._onSendCryptoCallback) === null || _a === void 0 ? void 0 : _a.call(this, event.payload.assetSymbol, event.payload.amount, event.payload.address))]; | ||
case 2: | ||
result = _b.sent(); | ||
if (!(result === null || result === void 0 ? void 0 : result.txHash)) { | ||
throw new Error('Missing txHash in the callback result'); | ||
} | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
errorMessage = void 0; | ||
if (typeof e_2 === 'string') { | ||
errorMessage = e_2; | ||
} | ||
else if (e_2 instanceof Error) { | ||
errorMessage = e_2.message; | ||
} | ||
this._sendEventToWidget({ | ||
eventVersion: SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
error: errorMessage, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
case 4: | ||
this._sendEventToWidget({ | ||
eventVersion: SEND_CRYPTO_SUPPORTED_VERSION, | ||
type: InternalSdkEventTypes.SEND_CRYPTO_RESULT, | ||
payload: { | ||
txHash: result.txHash, | ||
}, | ||
}); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// Event subscriptions aren't cleared so that host can receive a PAYMENT_SUCCESSFUL event | ||
@@ -975,8 +908,2 @@ // even after the widget has been closed | ||
}; | ||
RampInstantSDK.prototype._getHostConfigSdkParams = function (config, useSendCryptoCallback) { | ||
var widgetVariant = determineWidgetVariant(config); | ||
return __assign({ variant: widgetVariant, widgetInstanceId: getRandomIntString() }, (useSendCryptoCallback | ||
? { useSendCryptoCallbackVersion: SEND_CRYPTO_SUPPORTED_VERSION } | ||
: {})); | ||
}; | ||
return RampInstantSDK; | ||
@@ -983,0 +910,0 @@ }()); |
export declare const baseWidgetUrl = "https://buy.ramp.network/"; | ||
export declare const SEND_CRYPTO_SUPPORTED_VERSION: 1; |
@@ -1,6 +0,6 @@ | ||
import { IHostConfigWithSdkParams, TAllEvents } from './types'; | ||
export declare function getBaseUrl(config: IHostConfigWithSdkParams): URL; | ||
export declare function initWidgetIframeUrl(config: IHostConfigWithSdkParams): string; | ||
import { IHostConfigWithWidgetInstanceId, TAllEvents } from './types'; | ||
export declare function getBaseUrl(config: IHostConfigWithWidgetInstanceId): URL; | ||
export declare function initWidgetIframeUrl(config: IHostConfigWithWidgetInstanceId): string; | ||
export declare function hideWebsiteBelow(parent: Element | ShadowRoot, containerWidth?: number | undefined): void; | ||
export declare function initDOMNodeWithOverlay(url: string, dispatch: (event: TAllEvents) => void, config: IHostConfigWithSdkParams): { | ||
export declare function initDOMNodeWithOverlay(url: string, dispatch: (event: TAllEvents) => void, config: IHostConfigWithWidgetInstanceId): { | ||
body: HTMLBodyElement | null; | ||
@@ -12,3 +12,3 @@ iframe: HTMLIFrameElement; | ||
}; | ||
export declare function initDOMNodeWithoutOverlay(url: string, _dispatch: (event: TAllEvents) => void, config: IHostConfigWithSdkParams): { | ||
export declare function initDOMNodeWithoutOverlay(url: string, _dispatch: (event: TAllEvents) => void, config: IHostConfigWithWidgetInstanceId): { | ||
body: HTMLBodyElement | null; | ||
@@ -15,0 +15,0 @@ iframe: HTMLIFrameElement; |
@@ -1,2 +0,2 @@ | ||
import { IHostConfig, TAllEvents, TOnRequestCryptoAccountCallback, TOnSendCryptoCallback } from './types'; | ||
import { IHostConfig, TAllEvents, TOnRequestCryptoAccountCallback } from './types'; | ||
export { IWidgetCloseEvent as WidgetCloseEvent, IWidgetCloseRequestCancelledEvent as WidgetCloseRequestCancelledEvent, IWidgetCloseRequestConfirmedEvent as WidgetCloseRequestConfirmedEvent, IWidgetCloseRequestEvent as WidgetCloseRequestEvent, IWidgetConfigDoneEvent as WidgetConfigDoneEvent, IWidgetEvent as RampInstantEvent, TWidgetEvents as RampInstantEvents, WidgetEventTypes as RampInstantEventTypes, AllWidgetVariants as RampInstantWidgetVariantTypes, IPurchase as RampInstantPurchase, } from './types'; | ||
@@ -16,3 +16,2 @@ export declare class RampInstantSDK { | ||
private _isVisible; | ||
private _onSendCryptoCallback; | ||
constructor(config: IHostConfig); | ||
@@ -24,3 +23,2 @@ show(): RampInstantSDK; | ||
close(): RampInstantSDK; | ||
onSendCrypto(callback: TOnSendCryptoCallback): RampInstantSDK; | ||
onRequestCryptoAccount(callback: TOnRequestCryptoAccountCallback): RampInstantSDK; | ||
@@ -32,3 +30,2 @@ private _subscribeToWidgetEvents; | ||
private _handleEscapeClick; | ||
private _onSendCrypto; | ||
private _teardownEventSubscriptions; | ||
@@ -41,3 +38,2 @@ private _showUsingEmbeddedMode; | ||
private _isConfiguredAsEmbedded; | ||
private _getHostConfigSdkParams; | ||
} |
@@ -1,2 +0,1 @@ | ||
import { SEND_CRYPTO_SUPPORTED_VERSION } from './consts'; | ||
declare type TAsset = string; | ||
@@ -24,3 +23,2 @@ declare type TEthAddress = string; | ||
declare type TContainerNode = HTMLElement; | ||
declare type TFlow = 'ONRAMP' | 'OFFRAMP'; | ||
export declare enum PaymentMethodName { | ||
@@ -63,11 +61,6 @@ MANUAL_BANK_TRANSFER = "MANUAL_BANK_TRANSFER", | ||
defaultAsset?: TAsset; | ||
defaultFlow?: TFlow; | ||
enabledFlows?: TFlow[]; | ||
offrampWebhookV3Url?: TWebhookStatusUrl; | ||
useSendCryptoCallback?: boolean; | ||
} | ||
export interface IHostConfigWithSdkParams extends Omit<IHostConfig, 'useSendCryptoCallback'> { | ||
export interface IHostConfigWithWidgetInstanceId extends IHostConfig { | ||
widgetInstanceId: string; | ||
variant: AllWidgetVariants; | ||
useSendCryptoCallbackVersion?: typeof SEND_CRYPTO_SUPPORTED_VERSION; | ||
} | ||
@@ -99,21 +92,2 @@ export interface IAssetInfo { | ||
} | ||
export interface IOfframpSale { | ||
id: string; | ||
createdAt: string; | ||
crypto: { | ||
amount: string; | ||
assetInfo: { | ||
address: string | null; | ||
symbol: string; | ||
chain: string; | ||
type: string; | ||
name: string; | ||
decimals: number; | ||
}; | ||
}; | ||
fiat: { | ||
amount: number; | ||
currencySymbol: string; | ||
}; | ||
} | ||
export interface IAction { | ||
@@ -148,4 +122,3 @@ id: TActionID; | ||
WIDGET_CONFIG_FAILED = "WIDGET_CONFIG_FAILED", | ||
PURCHASE_CREATED = "PURCHASE_CREATED", | ||
OFFRAMP_SALE_CREATED = "OFFRAMP_SALE_CREATED" | ||
PURCHASE_CREATED = "PURCHASE_CREATED" | ||
} | ||
@@ -156,4 +129,3 @@ export declare enum InternalEventTypes { | ||
WIDGET_CLOSE_REQUEST_CONFIRMED = "WIDGET_CLOSE_REQUEST_CONFIRMED", | ||
REQUEST_CRYPTO_ACCOUNT = "REQUEST_CRYPTO_ACCOUNT", | ||
SEND_CRYPTO = "SEND_CRYPTO" | ||
REQUEST_CRYPTO_ACCOUNT = "REQUEST_CRYPTO_ACCOUNT" | ||
} | ||
@@ -177,12 +149,2 @@ export declare type TAllEventTypes = WidgetEventTypes | InternalEventTypes; | ||
} | ||
export interface IOfframpSaleCreatedEvent extends IWidgetEvent { | ||
type: WidgetEventTypes.OFFRAMP_SALE_CREATED; | ||
payload: { | ||
sale: IOfframpSale; | ||
saleViewToken: string; | ||
apiUrl: string; | ||
}; | ||
widgetInstanceId: string; | ||
internal?: false; | ||
} | ||
export interface IWidgetConfigDoneEvent extends IWidgetEvent { | ||
@@ -214,12 +176,2 @@ type: WidgetEventTypes.WIDGET_CONFIG_DONE; | ||
} | ||
export interface ISendCryptoEvent extends IWidgetEvent { | ||
eventVersion: typeof SEND_CRYPTO_SUPPORTED_VERSION; | ||
type: InternalEventTypes.SEND_CRYPTO; | ||
payload: { | ||
assetSymbol: string; | ||
amount: string; | ||
address: string; | ||
}; | ||
widgetInstanceId?: string; | ||
} | ||
export interface IWidgetCloseRequestCancelledEvent extends IWidgetEvent { | ||
@@ -235,7 +187,6 @@ type: InternalEventTypes.WIDGET_CLOSE_REQUEST_CANCELLED; | ||
} | ||
export declare type TWidgetEvents = IWidgetCloseEvent | IWidgetConfigDoneEvent | IWidgetConfigFailedEvent | IPurchaseCreatedEvent | IOfframpSaleCreatedEvent; | ||
export declare type TInternalEvents = IWidgetCloseRequestEvent | IWidgetCloseRequestCancelledEvent | IWidgetCloseRequestConfirmedEvent | IRequestCryptoAccountEvent | ISendCryptoEvent; | ||
export declare type TWidgetEvents = IWidgetCloseEvent | IWidgetConfigDoneEvent | IWidgetConfigFailedEvent | IPurchaseCreatedEvent; | ||
export declare type TInternalEvents = IWidgetCloseRequestEvent | IWidgetCloseRequestCancelledEvent | IWidgetCloseRequestConfirmedEvent | IRequestCryptoAccountEvent; | ||
export declare enum InternalSdkEventTypes { | ||
REQUEST_CRYPTO_ACCOUNT_RESULT = "REQUEST_CRYPTO_ACCOUNT_RESULT", | ||
SEND_CRYPTO_RESULT = "SEND_CRYPTO_RESULT" | ||
REQUEST_CRYPTO_ACCOUNT_RESULT = "REQUEST_CRYPTO_ACCOUNT_RESULT" | ||
} | ||
@@ -249,11 +200,3 @@ export interface IRequestCryptoAccountResultEvent extends IWidgetEvent { | ||
} | ||
export interface ISendCryptoResultEvent extends IWidgetEvent { | ||
eventVersion: typeof SEND_CRYPTO_SUPPORTED_VERSION; | ||
type: InternalSdkEventTypes.SEND_CRYPTO_RESULT; | ||
payload: IOnSendCryptoResult | { | ||
error: string | undefined; | ||
}; | ||
widgetInstanceId?: string; | ||
} | ||
export declare type TSdkEvents = IRequestCryptoAccountResultEvent | ISendCryptoResultEvent; | ||
export declare type TSdkEvents = IRequestCryptoAccountResultEvent; | ||
export declare type TAllEvents = TWidgetEvents | TInternalEvents; | ||
@@ -277,7 +220,3 @@ export declare type WidgetVariantTypes = 'desktop' | 'mobile' | 'hosted-desktop' | 'hosted-mobile'; | ||
} | ||
export interface IOnSendCryptoResult { | ||
txHash: string; | ||
} | ||
export declare type TOnRequestCryptoAccountCallback = (type: string, assetSymbol: string) => Promise<IOnRequestCryptoAccountResult>; | ||
export declare type TOnSendCryptoCallback = (assetSymbol: string, amount: string, address: string) => Promise<IOnSendCryptoResult>; | ||
export {}; |
{ | ||
"name": "@ramp-network/ramp-instant-sdk", | ||
"version": "3.2.2-rc0", | ||
"version": "3.2.2-rc1", | ||
"description": "SDK for Ramp Instant", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
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
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
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
320019
2806