@notabene/javascript-sdk 2.9.3-next.3 → 2.10.0-next.1
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.
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +31 -2
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +31 -2
- package/dist/esm/notabene.js +11 -11
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +31 -2
- package/dist/notabene.js +11 -11
- package/package.json +1 -1
- package/src/types.ts +32 -1
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var _=(t,e,n)=>e in t?U(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(f||{}),w=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(w||{}),g=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(g||{}),v=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(v||{}),
|
|
1
|
+
"use strict";var U=Object.defineProperty;var _=(t,e,n)=>e in t?U(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(f||{}),w=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(w||{}),g=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(g||{}),v=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(v||{}),A=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(A||{}),l=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t.WARNING="warning",t.INFO="info",t))(l||{}),y=(t=>(t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",t.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",t.TOKEN_INVALID="TOKEN_INVALID",t))(y||{}),p=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(p||{}),b=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(b||{}),I=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.EIP191="eip-191",t.EIP712="eip-712",t.EIP1271="eip-1271",t.BIP137="bip-137",t.BIP322="bip-322",t.BIP137_XPUB="xpub",t.TIP191="tip-191",t.ED25519="ed25519",t.XRP_ED25519="xrp-ed25519",t.XLM_ED25519="xlm-ed25519",t.CIP8="cip-8",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t))(I||{});class R{constructor(){a(this,"listeners",new Map);a(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>this.off(e,n)}off(e,n){const r=this.listeners.get(e);r&&(r.delete(n),r.size===0&&this.listeners.delete(e))}handleMessage(e){const n=e.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,s=this.listeners.get(r);s&&s.forEach(i=>i(n))}}send(e){this.port&&this.port.postMessage(e)}}class C{constructor(e,n,r){a(this,"_url");a(this,"_value");a(this,"_options");a(this,"_errors",[]);a(this,"iframe");a(this,"eventManager");a(this,"modal");this._url=e,this._value=n,this._options=r,this.eventManager=new R,this.on(l.INVALID,s=>{s.type===l.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(l.RESIZE,s=>{s.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const n=document.querySelector(e);if(!n)throw new Error(`parentID ${e} not found`);this.embed(n)}embed(e,n=!1){var r,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(n?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",e.appendChild(this.iframe),window.addEventListener("message",i=>{var o,c;i.source===((o=this.iframe)==null?void 0:o.contentWindow)&&((c=this.eventManager)==null||c.setPort(i.ports[0]))}),(s=(r=this.iframe)==null?void 0:r.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,n){return this.eventManager.on(e,n)}off(e,n){this.eventManager.off(e,n)}update(e,n){this._value=e,n&&(this._options=n),this.send({type:p.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,n)=>{let r,s,i;function o(){r&&r(),s&&s(),i&&i()}r=this.on(l.COMPLETE,c=>{e(c.response),o()}),s=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),o()}),i=this.on("error",c=>{n(new Error(c.message)),o()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const e=this.on(l.CANCEL,()=>{this.closeModal()}),n=this.on(l.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{e(),n()})}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}async popup(){const e=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var i;s.source===e&&(console.log("received message from popup",s.data),(i=this.eventManager)==null||i.setPort(s.ports[0]))});const n=this.on(l.CANCEL,()=>{e==null||e.close()}),r=this.on(l.COMPLETE,()=>{e==null||e.close()});return this.completion().finally(()=>{n(),r()})}}function x(t){return Object.entries(t).map(([e,n])=>{if(n==null)return;const r=encodeURIComponent(e),s=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${s}`}).filter(e=>e!==void 0).join("&")}function D(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((r,s)=>{const[i,o]=s.split("=");return i&&(r[decodeURIComponent(i)]=o?decodeURIComponent(o):""),r},{}):{}}async function E(t,e){const n=JSON.stringify(t),r=new TextEncoder,s=e?m(e):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt"]),o=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},i,r.encode(n));return{ciphertext:`${u(o)}-${u(c)}`,key:u(s)}}async function N({ciphertext:t,key:e}){const[n,r]=t.split("-"),s=new Uint8Array(atob(e).split("").map(L=>L.charCodeAt(0))),i=m(n),o=m(r),c=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,h=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},c,o);return JSON.parse(d.decode(h))}function u(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function m(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}async function O(t){const e=await fetch(t.url,{method:"GET"});if(!e.ok)throw new Error(`Failed to get connection: ${await e.text()}`);const n=await e.json();if(!n.id||!n.metadata||!n.status||!n.sealed)throw new Error("Data missing from server response");const r={id:n.id,metadata:n.metadata,status:n.status};if(n.status==="closed")return r;const s=n.sealed[n.sealed.length-1],i=await N({ciphertext:s,key:t.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class S{constructor(e){a(this,"endpoint");this.endpoint=e}async create(e,n){const r=await E(e),s={metadata:n,sealed:r.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const o=await i.json();return{id:o.id,version:o.version,status:o.status,metadata:n,data:e,key:r.key}}async update(e,n,r,s,i){const o=await E(n,i),c={sealed:o.ciphertext,version:r,status:s},d=await fetch(`${this.endpoint}/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw new Error(`Failed to update connection: ${await d.text()}`);const h=await d.json();return{id:h.id,metadata:h.metadata,version:h.version,status:h.status,data:n,key:o.key}}async get(e,n){const r=await fetch(`${this.endpoint}/${e}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const s=await r.json(),i=s.sealed[s.sealed.length-1],o=await N({ciphertext:i,key:n});return{id:s.id,status:s.status,version:s.version,metadata:s.metadata,data:o,key:n}}async close(e){const n=await fetch(`${this.endpoint}/${e}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class M{constructor(e){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,n,r,s){const i=new URL(this.uxUrl);i.pathname=e;const o=x({authToken:this.authToken,value:n,configuration:r});return i.hash=o,this.nodeUrl&&i.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&i.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&i.searchParams.set("locale",this.locale),s&&(s.callback&&i.searchParams.set("callback_url",s.callback),s.redirectUri&&i.searchParams.set("redirect_uri",s.redirectUri)),i.toString()}createComponent(e,n,r,s){return new C(this.componentUrl(e,n,r,s),n,r)}createWithdrawalAssist(e,n,r){return this.createComponent("withdrawal-assist",e,n,r)}createConnectWallet(e,n,r){return this.createComponent("connect",e,n,r)}createDepositRequest(e,n,r){return this.createComponent("deposit-request",e,n,r)}createDepositAssist(e,n,r){return this.createComponent("deposit-assist",e,n,r)}}exports.AgentType=f;exports.CMType=l;exports.ConnectionManager=S;exports.EmbeddedComponent=C;exports.ErrorIdentifierCode=y;exports.HMType=p;exports.PersonType=w;exports.ProofStatus=b;exports.ProofTypes=I;exports.Status=g;exports.VASPSearchControl=v;exports.ValidationSections=A;exports.decodeFragmentToObject=D;exports.default=M;exports.getRefreshResult=O;
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -218,7 +218,9 @@ export declare enum CMType {
|
|
|
218
218
|
READY = "ready",
|
|
219
219
|
INVALID = "invalid",
|
|
220
220
|
ERROR = "error",
|
|
221
|
-
CANCEL = "cancel"
|
|
221
|
+
CANCEL = "cancel",
|
|
222
|
+
WARNING = "warning",
|
|
223
|
+
INFO = "info"
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
/**
|
|
@@ -249,11 +251,14 @@ export declare type Completed<T> = {
|
|
|
249
251
|
* @see {@link Completed} For successful completion message format
|
|
250
252
|
* @see {@link Cancel} For cancellation message format
|
|
251
253
|
* @see {@link Error} For error message format
|
|
254
|
+
* @see {@link Ready} For ready message format
|
|
252
255
|
* @see {@link ResizeRequest} For resize message format
|
|
253
256
|
* @see {@link InvalidValue} For validation failure message format
|
|
257
|
+
* @see {@link Warning} For warning message format
|
|
258
|
+
* @see {@link Info} For info message format
|
|
254
259
|
* @public
|
|
255
260
|
*/
|
|
256
|
-
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T
|
|
261
|
+
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T> | Warning | Info;
|
|
257
262
|
|
|
258
263
|
/**
|
|
259
264
|
* Base interface for requests sent to SDK components
|
|
@@ -731,6 +736,18 @@ export declare enum HMType {
|
|
|
731
736
|
*/
|
|
732
737
|
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
733
738
|
|
|
739
|
+
/**
|
|
740
|
+
* Represents an info component message
|
|
741
|
+
* @param message - Info message
|
|
742
|
+
* @param description - Description of the info message
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
declare type Info = {
|
|
746
|
+
type: CMType.INFO;
|
|
747
|
+
message: string;
|
|
748
|
+
description?: string;
|
|
749
|
+
};
|
|
750
|
+
|
|
734
751
|
/**
|
|
735
752
|
* Intermediary VASP
|
|
736
753
|
* Represents an intermediary Virtual Asset Service Provider
|
|
@@ -1782,6 +1799,18 @@ export declare interface Wallet extends Agent {
|
|
|
1782
1799
|
wallet_connect_id?: string;
|
|
1783
1800
|
}
|
|
1784
1801
|
|
|
1802
|
+
/**
|
|
1803
|
+
* Represents a warning component message
|
|
1804
|
+
* @param message - Warning message
|
|
1805
|
+
* @param description - Description of the warning message
|
|
1806
|
+
* @public
|
|
1807
|
+
*/
|
|
1808
|
+
declare type Warning = {
|
|
1809
|
+
type: CMType.WARNING;
|
|
1810
|
+
message: string;
|
|
1811
|
+
description?: string;
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1785
1814
|
/**
|
|
1786
1815
|
* An object representing a withdrawal transaction
|
|
1787
1816
|
* @public
|
package/dist/cjs/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.10.0-next.1",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/esm/notabene.d.ts
CHANGED
|
@@ -218,7 +218,9 @@ export declare enum CMType {
|
|
|
218
218
|
READY = "ready",
|
|
219
219
|
INVALID = "invalid",
|
|
220
220
|
ERROR = "error",
|
|
221
|
-
CANCEL = "cancel"
|
|
221
|
+
CANCEL = "cancel",
|
|
222
|
+
WARNING = "warning",
|
|
223
|
+
INFO = "info"
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
/**
|
|
@@ -249,11 +251,14 @@ export declare type Completed<T> = {
|
|
|
249
251
|
* @see {@link Completed} For successful completion message format
|
|
250
252
|
* @see {@link Cancel} For cancellation message format
|
|
251
253
|
* @see {@link Error} For error message format
|
|
254
|
+
* @see {@link Ready} For ready message format
|
|
252
255
|
* @see {@link ResizeRequest} For resize message format
|
|
253
256
|
* @see {@link InvalidValue} For validation failure message format
|
|
257
|
+
* @see {@link Warning} For warning message format
|
|
258
|
+
* @see {@link Info} For info message format
|
|
254
259
|
* @public
|
|
255
260
|
*/
|
|
256
|
-
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T
|
|
261
|
+
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T> | Warning | Info;
|
|
257
262
|
|
|
258
263
|
/**
|
|
259
264
|
* Base interface for requests sent to SDK components
|
|
@@ -731,6 +736,18 @@ export declare enum HMType {
|
|
|
731
736
|
*/
|
|
732
737
|
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
733
738
|
|
|
739
|
+
/**
|
|
740
|
+
* Represents an info component message
|
|
741
|
+
* @param message - Info message
|
|
742
|
+
* @param description - Description of the info message
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
declare type Info = {
|
|
746
|
+
type: CMType.INFO;
|
|
747
|
+
message: string;
|
|
748
|
+
description?: string;
|
|
749
|
+
};
|
|
750
|
+
|
|
734
751
|
/**
|
|
735
752
|
* Intermediary VASP
|
|
736
753
|
* Represents an intermediary Virtual Asset Service Provider
|
|
@@ -1782,6 +1799,18 @@ export declare interface Wallet extends Agent {
|
|
|
1782
1799
|
wallet_connect_id?: string;
|
|
1783
1800
|
}
|
|
1784
1801
|
|
|
1802
|
+
/**
|
|
1803
|
+
* Represents a warning component message
|
|
1804
|
+
* @param message - Warning message
|
|
1805
|
+
* @param description - Description of the warning message
|
|
1806
|
+
* @public
|
|
1807
|
+
*/
|
|
1808
|
+
declare type Warning = {
|
|
1809
|
+
type: CMType.WARNING;
|
|
1810
|
+
message: string;
|
|
1811
|
+
description?: string;
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1785
1814
|
/**
|
|
1786
1815
|
* An object representing a withdrawal transaction
|
|
1787
1816
|
* @public
|
package/dist/esm/notabene.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
2
|
var g = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), y = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(y || {}), I = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(I || {}),
|
|
4
|
+
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), y = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(y || {}), I = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(I || {}), N = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(N || {}), L = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(L || {}), l = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t.WARNING = "warning", t.INFO = "info", t))(l || {}), b = /* @__PURE__ */ ((t) => (t.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", t.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", t.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", t.TOKEN_INVALID = "TOKEN_INVALID", t))(b || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), C = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(C || {}), U = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.SIWE = "siwe", t.SIWX = "siwx", t.EIP191 = "eip-191", t.EIP712 = "eip-712", t.EIP1271 = "eip-1271", t.BIP137 = "bip-137", t.BIP322 = "bip-322", t.BIP137_XPUB = "xpub", t.TIP191 = "tip-191", t.ED25519 = "ed25519", t.XRP_ED25519 = "xrp-ed25519", t.XLM_ED25519 = "xlm-ed25519", t.CIP8 = "cip-8", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t.Connect = "connect", t))(U || {});
|
|
5
5
|
class _ {
|
|
6
6
|
constructor() {
|
|
7
7
|
a(this, "listeners", /* @__PURE__ */ new Map());
|
|
@@ -237,7 +237,7 @@ class x {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function R(t) {
|
|
241
241
|
return Object.entries(t).map(([e, n]) => {
|
|
242
242
|
if (n == null) return;
|
|
243
243
|
const s = encodeURIComponent(e), r = encodeURIComponent(
|
|
@@ -303,7 +303,7 @@ function m(t) {
|
|
|
303
303
|
n[s] = e.charCodeAt(s);
|
|
304
304
|
return n;
|
|
305
305
|
}
|
|
306
|
-
async function
|
|
306
|
+
async function S(t) {
|
|
307
307
|
const e = await fetch(t.url, {
|
|
308
308
|
method: "GET"
|
|
309
309
|
});
|
|
@@ -331,7 +331,7 @@ async function M(t) {
|
|
|
331
331
|
tx: i.tx
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
class
|
|
334
|
+
class M {
|
|
335
335
|
constructor(e) {
|
|
336
336
|
a(this, "endpoint");
|
|
337
337
|
this.endpoint = e;
|
|
@@ -466,7 +466,7 @@ class k {
|
|
|
466
466
|
componentUrl(e, n, s, r) {
|
|
467
467
|
const i = new URL(this.uxUrl);
|
|
468
468
|
i.pathname = e;
|
|
469
|
-
const o =
|
|
469
|
+
const o = R({
|
|
470
470
|
authToken: this.authToken,
|
|
471
471
|
value: n,
|
|
472
472
|
configuration: s
|
|
@@ -561,17 +561,17 @@ class k {
|
|
|
561
561
|
export {
|
|
562
562
|
A as AgentType,
|
|
563
563
|
l as CMType,
|
|
564
|
-
|
|
564
|
+
M as ConnectionManager,
|
|
565
565
|
x as EmbeddedComponent,
|
|
566
|
-
|
|
566
|
+
b as ErrorIdentifierCode,
|
|
567
567
|
E as HMType,
|
|
568
568
|
y as PersonType,
|
|
569
|
-
|
|
569
|
+
C as ProofStatus,
|
|
570
570
|
U as ProofTypes,
|
|
571
571
|
I as Status,
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
N as VASPSearchControl,
|
|
573
|
+
L as ValidationSections,
|
|
574
574
|
O as decodeFragmentToObject,
|
|
575
575
|
k as default,
|
|
576
|
-
|
|
576
|
+
S as getRefreshResult
|
|
577
577
|
};
|
package/dist/esm/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.10.0-next.1",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/notabene.d.ts
CHANGED
|
@@ -218,7 +218,9 @@ export declare enum CMType {
|
|
|
218
218
|
READY = "ready",
|
|
219
219
|
INVALID = "invalid",
|
|
220
220
|
ERROR = "error",
|
|
221
|
-
CANCEL = "cancel"
|
|
221
|
+
CANCEL = "cancel",
|
|
222
|
+
WARNING = "warning",
|
|
223
|
+
INFO = "info"
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
/**
|
|
@@ -249,11 +251,14 @@ export declare type Completed<T> = {
|
|
|
249
251
|
* @see {@link Completed} For successful completion message format
|
|
250
252
|
* @see {@link Cancel} For cancellation message format
|
|
251
253
|
* @see {@link Error} For error message format
|
|
254
|
+
* @see {@link Ready} For ready message format
|
|
252
255
|
* @see {@link ResizeRequest} For resize message format
|
|
253
256
|
* @see {@link InvalidValue} For validation failure message format
|
|
257
|
+
* @see {@link Warning} For warning message format
|
|
258
|
+
* @see {@link Info} For info message format
|
|
254
259
|
* @public
|
|
255
260
|
*/
|
|
256
|
-
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T
|
|
261
|
+
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T> | Warning | Info;
|
|
257
262
|
|
|
258
263
|
/**
|
|
259
264
|
* Base interface for requests sent to SDK components
|
|
@@ -731,6 +736,18 @@ export declare enum HMType {
|
|
|
731
736
|
*/
|
|
732
737
|
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
733
738
|
|
|
739
|
+
/**
|
|
740
|
+
* Represents an info component message
|
|
741
|
+
* @param message - Info message
|
|
742
|
+
* @param description - Description of the info message
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
declare type Info = {
|
|
746
|
+
type: CMType.INFO;
|
|
747
|
+
message: string;
|
|
748
|
+
description?: string;
|
|
749
|
+
};
|
|
750
|
+
|
|
734
751
|
/**
|
|
735
752
|
* Intermediary VASP
|
|
736
753
|
* Represents an intermediary Virtual Asset Service Provider
|
|
@@ -1782,6 +1799,18 @@ export declare interface Wallet extends Agent {
|
|
|
1782
1799
|
wallet_connect_id?: string;
|
|
1783
1800
|
}
|
|
1784
1801
|
|
|
1802
|
+
/**
|
|
1803
|
+
* Represents a warning component message
|
|
1804
|
+
* @param message - Warning message
|
|
1805
|
+
* @param description - Description of the warning message
|
|
1806
|
+
* @public
|
|
1807
|
+
*/
|
|
1808
|
+
declare type Warning = {
|
|
1809
|
+
type: CMType.WARNING;
|
|
1810
|
+
message: string;
|
|
1811
|
+
description?: string;
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1785
1814
|
/**
|
|
1786
1815
|
* An object representing a withdrawal transaction
|
|
1787
1816
|
* @public
|
package/dist/notabene.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
2
|
var g = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), y = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(y || {}), I = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(I || {}),
|
|
4
|
+
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), y = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(y || {}), I = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(I || {}), N = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(N || {}), L = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(L || {}), l = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t.WARNING = "warning", t.INFO = "info", t))(l || {}), b = /* @__PURE__ */ ((t) => (t.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", t.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", t.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", t.TOKEN_INVALID = "TOKEN_INVALID", t))(b || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), C = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(C || {}), U = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.SIWE = "siwe", t.SIWX = "siwx", t.EIP191 = "eip-191", t.EIP712 = "eip-712", t.EIP1271 = "eip-1271", t.BIP137 = "bip-137", t.BIP322 = "bip-322", t.BIP137_XPUB = "xpub", t.TIP191 = "tip-191", t.ED25519 = "ed25519", t.XRP_ED25519 = "xrp-ed25519", t.XLM_ED25519 = "xlm-ed25519", t.CIP8 = "cip-8", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t.Connect = "connect", t))(U || {});
|
|
5
5
|
class _ {
|
|
6
6
|
constructor() {
|
|
7
7
|
a(this, "listeners", /* @__PURE__ */ new Map());
|
|
@@ -237,7 +237,7 @@ class x {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function R(t) {
|
|
241
241
|
return Object.entries(t).map(([e, n]) => {
|
|
242
242
|
if (n == null) return;
|
|
243
243
|
const s = encodeURIComponent(e), r = encodeURIComponent(
|
|
@@ -303,7 +303,7 @@ function m(t) {
|
|
|
303
303
|
n[s] = e.charCodeAt(s);
|
|
304
304
|
return n;
|
|
305
305
|
}
|
|
306
|
-
async function
|
|
306
|
+
async function S(t) {
|
|
307
307
|
const e = await fetch(t.url, {
|
|
308
308
|
method: "GET"
|
|
309
309
|
});
|
|
@@ -331,7 +331,7 @@ async function M(t) {
|
|
|
331
331
|
tx: i.tx
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
class
|
|
334
|
+
class M {
|
|
335
335
|
constructor(e) {
|
|
336
336
|
a(this, "endpoint");
|
|
337
337
|
this.endpoint = e;
|
|
@@ -466,7 +466,7 @@ class k {
|
|
|
466
466
|
componentUrl(e, n, s, r) {
|
|
467
467
|
const i = new URL(this.uxUrl);
|
|
468
468
|
i.pathname = e;
|
|
469
|
-
const o =
|
|
469
|
+
const o = R({
|
|
470
470
|
authToken: this.authToken,
|
|
471
471
|
value: n,
|
|
472
472
|
configuration: s
|
|
@@ -561,17 +561,17 @@ class k {
|
|
|
561
561
|
export {
|
|
562
562
|
A as AgentType,
|
|
563
563
|
l as CMType,
|
|
564
|
-
|
|
564
|
+
M as ConnectionManager,
|
|
565
565
|
x as EmbeddedComponent,
|
|
566
|
-
|
|
566
|
+
b as ErrorIdentifierCode,
|
|
567
567
|
E as HMType,
|
|
568
568
|
y as PersonType,
|
|
569
|
-
|
|
569
|
+
C as ProofStatus,
|
|
570
570
|
U as ProofTypes,
|
|
571
571
|
I as Status,
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
N as VASPSearchControl,
|
|
573
|
+
L as ValidationSections,
|
|
574
574
|
O as decodeFragmentToObject,
|
|
575
575
|
k as default,
|
|
576
|
-
|
|
576
|
+
S as getRefreshResult
|
|
577
577
|
};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.10.0-next.1",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/src/types.ts
CHANGED
|
@@ -880,6 +880,8 @@ export enum CMType {
|
|
|
880
880
|
INVALID = 'invalid',
|
|
881
881
|
ERROR = 'error',
|
|
882
882
|
CANCEL = 'cancel',
|
|
883
|
+
WARNING = 'warning',
|
|
884
|
+
INFO = 'info',
|
|
883
885
|
}
|
|
884
886
|
|
|
885
887
|
/**
|
|
@@ -956,6 +958,30 @@ export type InvalidValue<T> = {
|
|
|
956
958
|
errors: ValidationError[];
|
|
957
959
|
};
|
|
958
960
|
|
|
961
|
+
/**
|
|
962
|
+
* Represents a warning component message
|
|
963
|
+
* @param message - Warning message
|
|
964
|
+
* @param description - Description of the warning message
|
|
965
|
+
* @public
|
|
966
|
+
*/
|
|
967
|
+
export type Warning = {
|
|
968
|
+
type: CMType.WARNING;
|
|
969
|
+
message: string;
|
|
970
|
+
description?: string;
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Represents an info component message
|
|
975
|
+
* @param message - Info message
|
|
976
|
+
* @param description - Description of the info message
|
|
977
|
+
* @public
|
|
978
|
+
*/
|
|
979
|
+
export type Info = {
|
|
980
|
+
type: CMType.INFO;
|
|
981
|
+
message: string;
|
|
982
|
+
description?: string;
|
|
983
|
+
};
|
|
984
|
+
|
|
959
985
|
/**
|
|
960
986
|
* Union type representing all possible messages that can be sent from a component
|
|
961
987
|
*
|
|
@@ -973,8 +999,11 @@ export type InvalidValue<T> = {
|
|
|
973
999
|
* @see {@link Completed} For successful completion message format
|
|
974
1000
|
* @see {@link Cancel} For cancellation message format
|
|
975
1001
|
* @see {@link Error} For error message format
|
|
1002
|
+
* @see {@link Ready} For ready message format
|
|
976
1003
|
* @see {@link ResizeRequest} For resize message format
|
|
977
1004
|
* @see {@link InvalidValue} For validation failure message format
|
|
1005
|
+
* @see {@link Warning} For warning message format
|
|
1006
|
+
* @see {@link Info} For info message format
|
|
978
1007
|
* @public
|
|
979
1008
|
*/
|
|
980
1009
|
export type ComponentMessage<T> =
|
|
@@ -983,7 +1012,9 @@ export type ComponentMessage<T> =
|
|
|
983
1012
|
| Error
|
|
984
1013
|
| Ready
|
|
985
1014
|
| ResizeRequest
|
|
986
|
-
| InvalidValue<T
|
|
1015
|
+
| InvalidValue<T>
|
|
1016
|
+
| Warning
|
|
1017
|
+
| Info;
|
|
987
1018
|
|
|
988
1019
|
/**
|
|
989
1020
|
* Host Message Type enum representing different message types that can be sent
|