@notabene/javascript-sdk
Advanced tools
Comparing version 2.0.0-next.14 to 2.0.0-next.15
@@ -230,2 +230,3 @@ /** | ||
phone?: string; | ||
email?: string; | ||
} | ||
@@ -345,3 +346,3 @@ | ||
*/ | ||
embed(parent: Element): void; | ||
embed(parent: Element, modal?: boolean): void; | ||
/** | ||
@@ -736,2 +737,12 @@ * Sends a message to the embedded component | ||
/** | ||
* Creates a wallet assist component | ||
* | ||
* @param value - Withdrawal transaction data | ||
* @param options - Optional transaction options | ||
* @param callbacks - Optional callback configuration | ||
* @returns A new EmbeddedComponent instance for withdrawal assistance | ||
* @alpha | ||
*/ | ||
createWalletAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Partial<Withdrawal>, TransactionResponse<Withdrawal>>; | ||
/** | ||
* Creates a deposit assist component | ||
@@ -753,2 +764,3 @@ * | ||
* @returns A new EmbeddedComponent instance for connection | ||
* @alpha | ||
*/ | ||
@@ -763,3 +775,3 @@ createConnectWallet(value: ConnectionRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<ConnectionRequest, ConnectionResponse>; | ||
* @returns A new EmbeddedComponent instance for deposit requests | ||
* @alpha | ||
* @public | ||
*/ | ||
@@ -766,0 +778,0 @@ createDepositRequest(value: DepositRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<DepositRequest, TransactionResponse<DepositRequest>>; |
@@ -1,6 +0,6 @@ | ||
var d = Object.defineProperty; | ||
var c = (t, e, s) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; | ||
var o = (t, e, s) => c(t, typeof e != "symbol" ? e + "" : e, s); | ||
var m = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(m || {}), u = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(u || {}), E = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(E || {}), a = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.MODAL = "openModal", t.ERROR = "error", t.CLOSE = "closeModal", t.CANCEL = "cancel", t))(a || {}), h = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(h || {}), f = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(f || {}), p = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(p || {}); | ||
class g { | ||
var c = Object.defineProperty; | ||
var m = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; | ||
var o = (t, e, s) => m(t, typeof e != "symbol" ? e + "" : e, s); | ||
var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), f = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(f || {}), E = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(E || {}), a = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.MODAL = "openModal", t.ERROR = "error", t.CLOSE = "closeModal", t.CANCEL = "cancel", t))(a || {}), d = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), p = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(p || {}), g = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(g || {}); | ||
class v { | ||
constructor() { | ||
@@ -34,3 +34,3 @@ o(this, "listeners", /* @__PURE__ */ new Map()); | ||
} | ||
class v { | ||
class I { | ||
/** | ||
@@ -48,3 +48,3 @@ * Creates an instance of EmbeddedComponent. | ||
o(this, "modal"); | ||
this._url = e, this._value = s, this.eventManager = new g(), this.on(a.INVALID, (r) => { | ||
this._url = e, this._value = s, this.eventManager = new v(), this.on(a.INVALID, (r) => { | ||
r.type === a.INVALID && (this._errors = r.errors, this._value = r.value); | ||
@@ -92,8 +92,8 @@ }), this.on(a.RESIZE, (r) => { | ||
*/ | ||
embed(e) { | ||
var s, r; | ||
this.iframe = document.createElement("iframe"), this.iframe.src = this.url, this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (i) => { | ||
var n, l; | ||
i.source === ((n = this.iframe) == null ? void 0 : n.contentWindow) && (console.log("received message from iframe", i.data), (l = this.eventManager) == null || l.setPort(i.ports[0])); | ||
}), (r = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || r.focus(); | ||
embed(e, s = !1) { | ||
var r, i; | ||
console.log(this.url), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (s ? "" : "&embedded=true"), this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (n) => { | ||
var l, h; | ||
n.source === ((l = this.iframe) == null ? void 0 : l.contentWindow) && (console.log("received message from iframe", n.data), (h = this.eventManager) == null || h.setPort(n.ports[0])); | ||
}), (i = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || i.focus(); | ||
} | ||
@@ -128,3 +128,3 @@ /** | ||
update(e) { | ||
this._value = e, this.send({ type: h.UPDATE, value: e }); | ||
this._value = e, this.send({ type: d.UPDATE, value: e }); | ||
} | ||
@@ -148,3 +148,3 @@ /** | ||
openModal() { | ||
return this.modal && this.closeModal(), this.modal = document.createElement("dialog"), this.modal.style.border = "none", this.modal.style.backgroundColor = "transparent", this.modal.style.maxWidth = "100vw", this.modal.style.maxHeight = "100vh", this.modal.style.width = "600px", this.modal.style.height = "800px", document.body.appendChild(this.modal), this.embed(this.modal), this.on(a.CANCEL, () => { | ||
return this.modal && this.closeModal(), this.modal = document.createElement("dialog"), this.modal.style.border = "none", this.modal.style.backgroundColor = "transparent", this.modal.style.maxWidth = "100vw", this.modal.style.maxHeight = "100vh", this.modal.style.width = "600px", this.modal.style.height = "800px", document.body.appendChild(this.modal), this.embed(this.modal, !0), this.on(a.CANCEL, () => { | ||
this.closeModal(); | ||
@@ -168,3 +168,3 @@ }), this.on(a.CLOSE, () => { | ||
} | ||
function I(t) { | ||
function U(t) { | ||
return Object.entries(t).map(([e, s]) => { | ||
@@ -178,3 +178,3 @@ if (!(e && s)) return; | ||
} | ||
class w { | ||
class L { | ||
/** | ||
@@ -206,3 +206,3 @@ * Creates a new instance of the Notabene SDK | ||
n.pathname = e; | ||
const l = I({ | ||
const l = U({ | ||
authToken: this.authToken, | ||
@@ -225,3 +225,3 @@ value: s, | ||
createComponent(e, s, r, i) { | ||
return new v( | ||
return new I( | ||
this.componentUrl(e, s, r, i), | ||
@@ -243,2 +243,14 @@ s | ||
/** | ||
* Creates a wallet assist component | ||
* | ||
* @param value - Withdrawal transaction data | ||
* @param options - Optional transaction options | ||
* @param callbacks - Optional callback configuration | ||
* @returns A new EmbeddedComponent instance for withdrawal assistance | ||
* @alpha | ||
*/ | ||
createWalletAssist(e, s, r) { | ||
return this.createComponent("wallet-assist", e, s, r); | ||
} | ||
/** | ||
* Creates a deposit assist component | ||
@@ -267,2 +279,3 @@ * | ||
* @returns A new EmbeddedComponent instance for connection | ||
* @alpha | ||
*/ | ||
@@ -284,3 +297,3 @@ createConnectWallet(e, s, r) { | ||
* @returns A new EmbeddedComponent instance for deposit requests | ||
* @alpha | ||
* @public | ||
*/ | ||
@@ -307,9 +320,9 @@ createDepositRequest(e, s, r) { | ||
export { | ||
m as AgentType, | ||
u as AgentType, | ||
a as CMType, | ||
u as PersonType, | ||
f as ProofStatus, | ||
p as ProofTypes, | ||
f as PersonType, | ||
p as ProofStatus, | ||
g as ProofTypes, | ||
E as Status, | ||
w as default | ||
L as default | ||
}; |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "2.0.0-next.14", | ||
"version": "2.0.0-next.15", | ||
"source": "src/notabene.ts", | ||
@@ -15,0 +15,0 @@ "main": "dist/notabene.js", |
@@ -116,3 +116,3 @@ <div align="center"> | ||
try { | ||
const {valid, ivms101} = await withdrawal.completion() | ||
const { valid, value, txCreate, ivms101, proof } = await withdrawal.completion() | ||
if (valid) { | ||
@@ -141,3 +141,3 @@ // Submit result to your backend | ||
```js | ||
withdrawal.on('complete', {valid, txCreate } => ...) | ||
withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...) | ||
``` | ||
@@ -229,3 +229,3 @@ | ||
const connect = notabene.createConnectWallet({asset:'ETH'}, options); | ||
const {valid, ivms101, proof } = await connect.openModal(); | ||
const { valid, value, txCreate, ivms101, proof } = await connect.openModal(); | ||
``` | ||
@@ -273,7 +273,7 @@ | ||
```ts | ||
import { | ||
import Notabene, { | ||
AgentType, | ||
PersonType, | ||
ProofTypes, | ||
} from '@notabene/javascript-sdk/src/types'; | ||
} from '@notabene/javascript-sdk'; | ||
@@ -280,0 +280,0 @@ const options: TransactionOptions = { |
@@ -94,5 +94,6 @@ import { | ||
embed(parent: Element) { | ||
embed(parent: Element, modal: boolean = false) { | ||
console.log(this.url); | ||
this.iframe = document.createElement('iframe'); | ||
this.iframe.src = this.url; | ||
this.iframe.src = this.url + (!modal ? '&embedded=true' : ''); | ||
this.iframe.allow = 'web-share'; | ||
@@ -188,3 +189,3 @@ this.iframe.style.width = '100%'; | ||
document.body.appendChild(this.modal); | ||
this.embed(this.modal); | ||
this.embed(this.modal, true); | ||
this.on(CMType.CANCEL, () => { | ||
@@ -191,0 +192,0 @@ this.closeModal(); |
@@ -217,2 +217,22 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
/** | ||
* Creates a wallet assist component | ||
* | ||
* @param value - Withdrawal transaction data | ||
* @param options - Optional transaction options | ||
* @param callbacks - Optional callback configuration | ||
* @returns A new EmbeddedComponent instance for withdrawal assistance | ||
* @alpha | ||
*/ | ||
public createWalletAssist( | ||
value: Partial<Withdrawal>, | ||
options?: TransactionOptions, | ||
callbacks?: CallbackOptions, | ||
) { | ||
return this.createComponent< | ||
Partial<Withdrawal>, | ||
TransactionResponse<Withdrawal> | ||
>('wallet-assist', value, options, callbacks); | ||
} | ||
/** | ||
* Creates a deposit assist component | ||
@@ -246,2 +266,3 @@ * | ||
* @returns A new EmbeddedComponent instance for connection | ||
* @alpha | ||
*/ | ||
@@ -268,3 +289,3 @@ public createConnectWallet( | ||
* @returns A new EmbeddedComponent instance for deposit requests | ||
* @alpha | ||
* @public | ||
*/ | ||
@@ -271,0 +292,0 @@ public createDepositRequest( |
@@ -209,2 +209,3 @@ import { | ||
phone?: string; | ||
email?: string; | ||
} | ||
@@ -211,0 +212,0 @@ |
Sorry, the diff of this file is not supported yet
232132
19
3342