@notabene/javascript-sdk 2.11.0 → 2.13.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/README.md CHANGED
@@ -206,6 +206,12 @@ To be notified of any validation errors use:
206
206
  withdrawal.on('error',error => ...)
207
207
  ```
208
208
 
209
+ To be notified of any errors that won't require remounting the instance use:
210
+
211
+ ```js
212
+ withdrawal.on('warning', error => ...)
213
+ ```
214
+
209
215
  To be notified when the component is Ready:
210
216
 
211
217
  ```js
@@ -344,7 +350,6 @@ const withdrawal = notabene.createWithdrawalAssist(
344
350
  microTransfer: {
345
351
  destination: '0x...',
346
352
  amountSubunits: '12344',
347
- timeout: 86440,
348
353
  },
349
354
  },
350
355
  },
@@ -714,7 +719,6 @@ const options: TransactionOptions = {
714
719
  microTransfer: {
715
720
  destination: '0x...',
716
721
  amountSubunits: '12344',
717
- timeout: 86440,
718
722
  },
719
723
  fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self-declaration']
720
724
  deminimis: {
@@ -786,7 +790,6 @@ withdrawal.update(
786
790
  microTransfer: {
787
791
  destination: '0x...',
788
792
  amountSubunits: '12344',
789
- timeout: 86440,
790
793
  },
791
794
  },
792
795
  },
@@ -867,7 +870,6 @@ const options: TransactionOptions = {
867
870
  microTransfer: {
868
871
  destination: '0x...',
869
872
  amountSubunits: '1234',
870
- timeout: 86440, // Optional timeout in seconds, which is displayed to the user
871
873
  },
872
874
  fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
873
875
  },
@@ -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||{}),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||{}),I=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(I||{}),C=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.SOL_SIWX="sol-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.CONCORDIUM="concordium",t))(C||{});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 b{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 O(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 S(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 x(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 D{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=O({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 b(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=D;exports.EmbeddedComponent=b;exports.ErrorIdentifierCode=y;exports.HMType=p;exports.PersonType=w;exports.ProofStatus=I;exports.ProofTypes=C;exports.Status=g;exports.VASPSearchControl=v;exports.ValidationSections=A;exports.decodeFragmentToObject=S;exports.default=M;exports.getRefreshResult=x;
1
+ "use strict";var O=Object.defineProperty;var S=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var a=(e,t,n)=>S(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var A=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(A||{}),f=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(f||{}),w=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(w||{}),L=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(L||{}),N=(e=>(e.SMS="sms",e.EMAIL="email",e))(N||{}),v=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(v||{}),I=(e=>(e.COINBASE="coinbase",e))(I||{}),g=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(g||{}),l=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(l||{}),_=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(_||{}),C=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(C||{}),m=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(m||{}),y=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(y||{}),D=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.BIP137_XPUB="xpub",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(D||{});class T{constructor(){a(this,"listeners",new Map);a(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&(r.delete(n),r.size===0&&this.listeners.delete(t))}handleMessage(t){const n=t.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,s=this.listeners.get(r);s&&s.forEach(o=>o(n))}}send(t){this.port&&this.port.postMessage(t)}}class R{constructor(t,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=t,this._value=n,this._options=r,this.eventManager=new T,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(t){const n=document.querySelector(t);if(!n)throw new Error(`parentID ${t} not found`);this.embed(n)}embed(t,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",t.appendChild(this.iframe),window.addEventListener("message",o=>{var i,c;o.source===((i=this.iframe)==null?void 0:i.contentWindow)&&((c=this.eventManager)==null||c.setPort(o.ports[0]))}),(s=(r=this.iframe)==null?void 0:r.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,n){return this.eventManager.on(t,n)}off(t,n){this.eventManager.off(t,n)}update(t,n){this._value=t,n&&(this._options=n),this.send({type:m.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,n)=>{let r,s,o;function i(){r&&r(),s&&s(),o&&o()}r=this.on(l.COMPLETE,c=>{t(c.response),i()}),s=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),i()}),o=this.on("error",c=>{n(new Error(c.message)),i()})})}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 t=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(()=>{t(),n()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var o;s.source===t&&(console.log("received message from popup",s.data),(o=this.eventManager)==null||o.setPort(s.ports[0]))});const n=this.on(l.CANCEL,()=>{t==null||t.close()}),r=this.on(l.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{n(),r()})}}function M(e){return Object.entries(e).map(([t,n])=>{if(n==null)return;const r=encodeURIComponent(t),s=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${s}`}).filter(t=>t!==void 0).join("&")}function x(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((r,s)=>{const[o,i]=s.split("=");return o&&(r[decodeURIComponent(o)]=i?decodeURIComponent(i):""),r},{}):{}}async function p(e,t){const n=JSON.stringify(e),r=new TextEncoder,s=t?E(t):crypto.getRandomValues(new Uint8Array(32)),o=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt"]),i=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,r.encode(n));return{ciphertext:`${u(i)}-${u(c)}`,key:u(s)}}async function U({ciphertext:e,key:t}){const[n,r]=e.split("-"),s=new Uint8Array(atob(t).split("").map(b=>b.charCodeAt(0))),o=E(n),i=E(r),c=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["decrypt"]),h=new TextDecoder,d=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(o)},c,i);return JSON.parse(h.decode(d))}function u(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function E(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}async function P(e){const t=await fetch(e.url,{method:"GET"});if(!t.ok)throw new Error(`Failed to get connection: ${await t.text()}`);const n=await t.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],o=await U({ciphertext:s,key:e.key});return n.status==="completed"?{...r,result:o.result}:{...r,tx:o.tx}}class B{constructor(t){a(this,"endpoint");this.endpoint=t}async create(t,n){const r=await p(t),s={metadata:n,sealed:r.ciphertext},o=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`Failed to create connection: ${await o.text()}`);const i=await o.json();return{id:i.id,version:i.version,status:i.status,metadata:n,data:t,key:r.key}}async update(t,n,r,s,o){const i=await p(n,o),c={sealed:i.ciphertext,version:r,status:s},h=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!h.ok)throw new Error(`Failed to update connection: ${await h.text()}`);const d=await h.json();return{id:d.id,metadata:d.metadata,version:d.version,status:d.status,data:n,key:i.key}}async get(t,n){const r=await fetch(`${this.endpoint}/${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const s=await r.json(),o=s.sealed[s.sealed.length-1],i=await U({ciphertext:o,key:n});return{id:s.id,status:s.status,version:s.version,metadata:s.metadata,data:i,key:n}}async close(t){const n=await fetch(`${this.endpoint}/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class k{constructor(t){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,n,r,s){const o=new URL(this.uxUrl);o.pathname=t;const i=M({authToken:this.authToken,value:n,configuration:r});return o.hash=i,this.nodeUrl&&o.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&o.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&o.searchParams.set("locale",this.locale),s&&(s.callback&&o.searchParams.set("callback_url",s.callback),s.redirectUri&&o.searchParams.set("redirect_uri",s.redirectUri)),o.toString()}createComponent(t,n,r,s){return new R(this.componentUrl(t,n,r,s),n,r)}createWithdrawalAssist(t,n,r){return this.createComponent("withdrawal-assist",t,n,r)}createConnectWallet(t,n,r){return this.createComponent("connect",t,n,r)}createDepositRequest(t,n,r){return this.createComponent("deposit-request",t,n,r)}createDepositAssist(t,n,r){return this.createComponent("deposit-assist",t,n,r)}}exports.AgentType=A;exports.CMType=l;exports.CodeVerificationStatus=v;exports.ConnectionManager=B;exports.EmbeddedComponent=R;exports.ErrorIdentifierCode=_;exports.HMType=m;exports.IdentityVerificationMethod=N;exports.OAuthProvider=I;exports.PersonType=f;exports.ProofStatus=y;exports.ProofTypes=D;exports.Status=w;exports.VASPSearchControl=L;exports.ValidationSections=g;exports.WarningIdentifierCode=C;exports.decodeFragmentToObject=x;exports.default=k;exports.getRefreshResult=P;
@@ -223,6 +223,19 @@ export declare enum CMType {
223
223
  INFO = "info"
224
224
  }
225
225
 
226
+ /**
227
+ * Status of a code verification
228
+ * @public
229
+ */
230
+ export declare enum CodeVerificationStatus {
231
+ PENDING = "pending",
232
+ APPROVED = "approved",
233
+ FAILED = "failed",
234
+ EXPIRED = "expired",
235
+ MAX_ATTEMPTS_REACHED = "max_attempts_reached",
236
+ UNREACHABLE = "unreachable"
237
+ }
238
+
226
239
  /**
227
240
  * Represents a completed component message
228
241
  * @typeParam T - The overall Value type being returned
@@ -312,6 +325,8 @@ export declare interface ConnectionData<T extends ComponentRequest> {
312
325
  readonly authToken?: string;
313
326
  readonly txOptions?: TransactionOptions;
314
327
  readonly result?: TransactionResponse<T>;
328
+ readonly phoneNumber?: string;
329
+ readonly email?: string;
315
330
  }
316
331
 
317
332
  /**
@@ -403,6 +418,19 @@ export declare type ConnectionResult<T extends ComponentRequest> = {
403
418
 
404
419
  export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
405
420
 
421
+ /**
422
+ * Metadata for Cosmos ownership proofs
423
+ * @remarks
424
+ * - Includes the public key
425
+ * @public
426
+ */
427
+ export declare interface CosmosMetadata {
428
+ pub_key: {
429
+ type: string;
430
+ value: string;
431
+ };
432
+ }
433
+
406
434
  /**
407
435
  * The counterparty of a transaction.
408
436
  * @public
@@ -452,6 +480,7 @@ export declare interface Counterparty {
452
480
  */
453
481
  export declare type CounterpartyAssistConfig = boolean | {
454
482
  counterpartyTypes: PersonType[];
483
+ identityVerification?: IdentityVerificationConfig;
455
484
  };
456
485
 
457
486
  /**
@@ -494,7 +523,7 @@ export declare function decodeFragmentToObject(fragment: string): Record<string,
494
523
  * An object representing a deposit transaction
495
524
  * @public
496
525
  */
497
- export declare interface Deposit extends OriginatorFields, DepositTransaction, Refreshable {
526
+ export declare interface Deposit extends OriginatorFields, Transaction, Refreshable {
498
527
  }
499
528
 
500
529
  /**
@@ -524,14 +553,6 @@ export declare interface DepositRequestOptions {
524
553
  showQrCode?: boolean;
525
554
  }
526
555
 
527
- /**
528
- * Extended transaction interface for deposits
529
- * @public
530
- */
531
- declare interface DepositTransaction extends Transaction {
532
- transactionId?: string;
533
- }
534
-
535
556
  /**
536
557
  * The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
537
558
  * @public
@@ -737,6 +758,26 @@ export declare enum HMType {
737
758
  */
738
759
  export declare type HostMessage<T, O> = UpdateValue<T, O>;
739
760
 
761
+ /**
762
+ * Configuration options for identity verification
763
+ * @public
764
+ */
765
+ declare type IdentityVerificationConfig = {
766
+ /** The required verification method. If not specified, none will be used */
767
+ requiredMethod?: IdentityVerificationMethod;
768
+ /** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */
769
+ oAuth?: OAuthProvider[] | OAuthProvider;
770
+ };
771
+
772
+ /**
773
+ * Available methods for identity verification
774
+ * @public
775
+ */
776
+ export declare enum IdentityVerificationMethod {
777
+ SMS = "sms",
778
+ EMAIL = "email"
779
+ }
780
+
740
781
  /**
741
782
  * Represents an info component message
742
783
  * @param message - Info message
@@ -1232,6 +1273,14 @@ export declare interface NotabeneConfig {
1232
1273
  locale?: string;
1233
1274
  }
1234
1275
 
1276
+ /**
1277
+ * Supported OAuth providers for authentication
1278
+ * @public
1279
+ */
1280
+ export declare enum OAuthProvider {
1281
+ COINBASE = "coinbase"
1282
+ }
1283
+
1235
1284
  /**
1236
1285
  * Originating VASP
1237
1286
  * Represents the VASP which initiates the VA transfer
@@ -1259,7 +1308,7 @@ declare type Originator = {
1259
1308
  * @public
1260
1309
  */
1261
1310
  declare type OriginatorFields = {
1262
- source?: Source;
1311
+ source?: Source | Source[];
1263
1312
  };
1264
1313
 
1265
1314
  /**
@@ -1413,6 +1462,7 @@ export declare enum ProofTypes {
1413
1462
  XRP_ED25519 = "xrp-ed25519",
1414
1463
  XLM_ED25519 = "xlm-ed25519",
1415
1464
  CIP8 = "cip-8",
1465
+ COSMOS = "cosmos-ecdsa",
1416
1466
  MicroTransfer = "microtransfer",
1417
1467
  Screenshot = "screenshot",
1418
1468
  Connect = "connect",
@@ -1474,14 +1524,14 @@ export declare interface ScreenshotProof extends OwnershipProof {
1474
1524
  * @public
1475
1525
  */
1476
1526
  export declare interface SignatureProof extends OwnershipProof {
1477
- type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519;
1527
+ type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
1478
1528
  proof: string;
1479
1529
  attestation: string;
1480
1530
  wallet_provider: string;
1481
1531
  xpub?: string;
1482
1532
  chainSpecificData?: {
1483
1533
  cardanoCoseKey?: string;
1484
- } | SolanaMetadata;
1534
+ } | SolanaMetadata | CosmosMetadata;
1485
1535
  }
1486
1536
 
1487
1537
  /**
@@ -1611,6 +1661,7 @@ export declare interface ThresholdOptions {
1611
1661
  * @public
1612
1662
  */
1613
1663
  export declare interface Transaction extends ComponentRequest {
1664
+ transactionId?: string;
1614
1665
  agent: Agent;
1615
1666
  counterparty: Counterparty;
1616
1667
  asset: TransactionAsset;
@@ -1639,7 +1690,6 @@ export declare interface TransactionOptions {
1639
1690
  microTransfer?: {
1640
1691
  destination: BlockchainAddress;
1641
1692
  amountSubunits: string;
1642
- timeout?: number;
1643
1693
  };
1644
1694
  fallbacks?: ProofTypes[];
1645
1695
  deminimis?: ThresholdOptions;
@@ -1864,14 +1914,28 @@ export declare interface Wallet extends Agent {
1864
1914
  * Represents a warning component message
1865
1915
  * @param message - Warning message
1866
1916
  * @param description - Description of the warning message
1917
+ * @param identifier - Identifier code of the warning message
1867
1918
  * @public
1868
1919
  */
1869
1920
  declare type Warning = {
1870
1921
  type: CMType.WARNING;
1871
1922
  message: string;
1872
1923
  description?: string;
1924
+ identifier?: WarningIdentifierCode;
1873
1925
  };
1874
1926
 
1927
+ /**
1928
+ * Identifier codes for warning messages
1929
+ * @public
1930
+ */
1931
+ export declare enum WarningIdentifierCode {
1932
+ WALLET_ADDRESS_NOT_CONNECTED = "WALLET_ADDRESS_NOT_CONNECTED",
1933
+ WALLET_LOCKED = "WALLET_LOCKED",
1934
+ WALLET_UNREACHABLE = "WALLET_UNREACHABLE",
1935
+ JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE = "JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",
1936
+ IDV_UNAVAILABLE = "IDV_UNAVAILABLE"
1937
+ }
1938
+
1875
1939
  /**
1876
1940
  * An object representing a withdrawal transaction
1877
1941
  * @public
@@ -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.11.0",
13
+ "version": "2.13.0-next.1",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -223,6 +223,19 @@ export declare enum CMType {
223
223
  INFO = "info"
224
224
  }
225
225
 
226
+ /**
227
+ * Status of a code verification
228
+ * @public
229
+ */
230
+ export declare enum CodeVerificationStatus {
231
+ PENDING = "pending",
232
+ APPROVED = "approved",
233
+ FAILED = "failed",
234
+ EXPIRED = "expired",
235
+ MAX_ATTEMPTS_REACHED = "max_attempts_reached",
236
+ UNREACHABLE = "unreachable"
237
+ }
238
+
226
239
  /**
227
240
  * Represents a completed component message
228
241
  * @typeParam T - The overall Value type being returned
@@ -312,6 +325,8 @@ export declare interface ConnectionData<T extends ComponentRequest> {
312
325
  readonly authToken?: string;
313
326
  readonly txOptions?: TransactionOptions;
314
327
  readonly result?: TransactionResponse<T>;
328
+ readonly phoneNumber?: string;
329
+ readonly email?: string;
315
330
  }
316
331
 
317
332
  /**
@@ -403,6 +418,19 @@ export declare type ConnectionResult<T extends ComponentRequest> = {
403
418
 
404
419
  export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
405
420
 
421
+ /**
422
+ * Metadata for Cosmos ownership proofs
423
+ * @remarks
424
+ * - Includes the public key
425
+ * @public
426
+ */
427
+ export declare interface CosmosMetadata {
428
+ pub_key: {
429
+ type: string;
430
+ value: string;
431
+ };
432
+ }
433
+
406
434
  /**
407
435
  * The counterparty of a transaction.
408
436
  * @public
@@ -452,6 +480,7 @@ export declare interface Counterparty {
452
480
  */
453
481
  export declare type CounterpartyAssistConfig = boolean | {
454
482
  counterpartyTypes: PersonType[];
483
+ identityVerification?: IdentityVerificationConfig;
455
484
  };
456
485
 
457
486
  /**
@@ -494,7 +523,7 @@ export declare function decodeFragmentToObject(fragment: string): Record<string,
494
523
  * An object representing a deposit transaction
495
524
  * @public
496
525
  */
497
- export declare interface Deposit extends OriginatorFields, DepositTransaction, Refreshable {
526
+ export declare interface Deposit extends OriginatorFields, Transaction, Refreshable {
498
527
  }
499
528
 
500
529
  /**
@@ -524,14 +553,6 @@ export declare interface DepositRequestOptions {
524
553
  showQrCode?: boolean;
525
554
  }
526
555
 
527
- /**
528
- * Extended transaction interface for deposits
529
- * @public
530
- */
531
- declare interface DepositTransaction extends Transaction {
532
- transactionId?: string;
533
- }
534
-
535
556
  /**
536
557
  * The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
537
558
  * @public
@@ -737,6 +758,26 @@ export declare enum HMType {
737
758
  */
738
759
  export declare type HostMessage<T, O> = UpdateValue<T, O>;
739
760
 
761
+ /**
762
+ * Configuration options for identity verification
763
+ * @public
764
+ */
765
+ declare type IdentityVerificationConfig = {
766
+ /** The required verification method. If not specified, none will be used */
767
+ requiredMethod?: IdentityVerificationMethod;
768
+ /** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */
769
+ oAuth?: OAuthProvider[] | OAuthProvider;
770
+ };
771
+
772
+ /**
773
+ * Available methods for identity verification
774
+ * @public
775
+ */
776
+ export declare enum IdentityVerificationMethod {
777
+ SMS = "sms",
778
+ EMAIL = "email"
779
+ }
780
+
740
781
  /**
741
782
  * Represents an info component message
742
783
  * @param message - Info message
@@ -1232,6 +1273,14 @@ export declare interface NotabeneConfig {
1232
1273
  locale?: string;
1233
1274
  }
1234
1275
 
1276
+ /**
1277
+ * Supported OAuth providers for authentication
1278
+ * @public
1279
+ */
1280
+ export declare enum OAuthProvider {
1281
+ COINBASE = "coinbase"
1282
+ }
1283
+
1235
1284
  /**
1236
1285
  * Originating VASP
1237
1286
  * Represents the VASP which initiates the VA transfer
@@ -1259,7 +1308,7 @@ declare type Originator = {
1259
1308
  * @public
1260
1309
  */
1261
1310
  declare type OriginatorFields = {
1262
- source?: Source;
1311
+ source?: Source | Source[];
1263
1312
  };
1264
1313
 
1265
1314
  /**
@@ -1413,6 +1462,7 @@ export declare enum ProofTypes {
1413
1462
  XRP_ED25519 = "xrp-ed25519",
1414
1463
  XLM_ED25519 = "xlm-ed25519",
1415
1464
  CIP8 = "cip-8",
1465
+ COSMOS = "cosmos-ecdsa",
1416
1466
  MicroTransfer = "microtransfer",
1417
1467
  Screenshot = "screenshot",
1418
1468
  Connect = "connect",
@@ -1474,14 +1524,14 @@ export declare interface ScreenshotProof extends OwnershipProof {
1474
1524
  * @public
1475
1525
  */
1476
1526
  export declare interface SignatureProof extends OwnershipProof {
1477
- type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519;
1527
+ type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
1478
1528
  proof: string;
1479
1529
  attestation: string;
1480
1530
  wallet_provider: string;
1481
1531
  xpub?: string;
1482
1532
  chainSpecificData?: {
1483
1533
  cardanoCoseKey?: string;
1484
- } | SolanaMetadata;
1534
+ } | SolanaMetadata | CosmosMetadata;
1485
1535
  }
1486
1536
 
1487
1537
  /**
@@ -1611,6 +1661,7 @@ export declare interface ThresholdOptions {
1611
1661
  * @public
1612
1662
  */
1613
1663
  export declare interface Transaction extends ComponentRequest {
1664
+ transactionId?: string;
1614
1665
  agent: Agent;
1615
1666
  counterparty: Counterparty;
1616
1667
  asset: TransactionAsset;
@@ -1639,7 +1690,6 @@ export declare interface TransactionOptions {
1639
1690
  microTransfer?: {
1640
1691
  destination: BlockchainAddress;
1641
1692
  amountSubunits: string;
1642
- timeout?: number;
1643
1693
  };
1644
1694
  fallbacks?: ProofTypes[];
1645
1695
  deminimis?: ThresholdOptions;
@@ -1864,14 +1914,28 @@ export declare interface Wallet extends Agent {
1864
1914
  * Represents a warning component message
1865
1915
  * @param message - Warning message
1866
1916
  * @param description - Description of the warning message
1917
+ * @param identifier - Identifier code of the warning message
1867
1918
  * @public
1868
1919
  */
1869
1920
  declare type Warning = {
1870
1921
  type: CMType.WARNING;
1871
1922
  message: string;
1872
1923
  description?: string;
1924
+ identifier?: WarningIdentifierCode;
1873
1925
  };
1874
1926
 
1927
+ /**
1928
+ * Identifier codes for warning messages
1929
+ * @public
1930
+ */
1931
+ export declare enum WarningIdentifierCode {
1932
+ WALLET_ADDRESS_NOT_CONNECTED = "WALLET_ADDRESS_NOT_CONNECTED",
1933
+ WALLET_LOCKED = "WALLET_LOCKED",
1934
+ WALLET_UNREACHABLE = "WALLET_UNREACHABLE",
1935
+ JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE = "JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",
1936
+ IDV_UNAVAILABLE = "IDV_UNAVAILABLE"
1937
+ }
1938
+
1875
1939
  /**
1876
1940
  * An object representing a withdrawal transaction
1877
1941
  * @public