@notabene/javascript-sdk 2.9.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/README.md CHANGED
@@ -303,6 +303,10 @@ const withdrawal = notabene.createWithdrawalAssist({
303
303
  currency: 'USD', // ISO currency code
304
304
  price: 1700.12, // Asset price
305
305
  },
306
+ customer: {
307
+ name: 'John Smith',
308
+ email: "john.smith@domain.com",
309
+ },
306
310
  });
307
311
  ```
308
312
 
@@ -312,6 +316,7 @@ const withdrawal = notabene.createWithdrawalAssist({
312
316
  - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
313
317
  - `amountDecimal`: The amount to transfer in decimal format. See [Transaction Amount](#transaction-amount)
314
318
  - `assetPrice`: Optional price information in a fiat currency. See [Asset Price](#asset-price)
319
+ - `customer`: Optional Customer object containing their name and email
315
320
 
316
321
  If any of the required parameters are missing the component will just show the Notabene badge.
317
322
 
@@ -329,6 +334,10 @@ const withdrawal = notabene.createWithdrawalAssist(
329
334
  currency: 'USD', // ISO currency code
330
335
  price: 1700.12, // Asset price
331
336
  },
337
+ customer: {
338
+ name: 'John Smith',
339
+ email: "john.smith@domain.com",
340
+ },
332
341
  },
333
342
  {
334
343
  proofs: {
@@ -348,6 +357,10 @@ See [Transaction Options](#transaction-options)
348
357
 
349
358
  The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
350
359
 
360
+ ### Parameters
361
+
362
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
363
+
351
364
  ```js
352
365
  const connect = notabene.createConnectWallet({
353
366
  asset: 'ETH',
@@ -356,31 +369,6 @@ const connect = notabene.createConnectWallet({
356
369
  const { proof, txCreate } = await connect.openModal();
357
370
  ```
358
371
 
359
- ### Parameters
360
-
361
- - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
362
-
363
- ### Configuration Options
364
-
365
- Include configuration Options as a second optional parameter:
366
-
367
- ```js
368
- const connect = notabene.createConnectWallet(
369
- {
370
- asset: 'ETH',
371
- },
372
- {
373
- proofs: {
374
- microTransfer: {
375
- destination: '0x...',
376
- amountSubunits: '12344',
377
- timeout: 86440,
378
- },
379
- },
380
- },
381
- );
382
- ```
383
-
384
372
  ## Deposit Request
385
373
 
386
374
  The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
@@ -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||{}),y=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(y||{}),l=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(l||{}),A=(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))(A||{}),p=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(p||{}),C=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(C||{}),b=(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))(b||{});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 I{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 L({ciphertext:t,key:e}){const[n,r]=t.split("-"),s=new Uint8Array(atob(e).split("").map(N=>N.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 S(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 L({ciphertext:s,key:t.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class M{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 L({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 O{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 I(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=M;exports.EmbeddedComponent=I;exports.ErrorIdentifierCode=A;exports.HMType=p;exports.PersonType=w;exports.ProofStatus=C;exports.ProofTypes=b;exports.Status=g;exports.VASPSearchControl=v;exports.ValidationSections=y;exports.decodeFragmentToObject=D;exports.default=O;exports.getRefreshResult=S;
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;
@@ -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
@@ -303,10 +308,10 @@ export declare interface ComponentResponse {
303
308
  }
304
309
 
305
310
  export declare interface ConnectionData<T extends ComponentRequest> {
306
- tx: T;
307
- authToken?: string;
308
- txOptions?: TransactionOptions;
309
- result?: TransactionResponse<T>;
311
+ readonly tx: T;
312
+ readonly authToken?: string;
313
+ readonly txOptions?: TransactionOptions;
314
+ readonly result?: TransactionResponse<T>;
310
315
  }
311
316
 
312
317
  /**
@@ -317,21 +322,26 @@ export declare class ConnectionManager {
317
322
  constructor(endpoint: string);
318
323
  /**
319
324
  * Creates a new encrypted connection
325
+ * @template T Type of component request
320
326
  * @param data The component request data to encrypt and store
321
- * @param participants Array of participant identifiers
327
+ * @param metadata Connection metadata including participants and transaction type
322
328
  * @returns Promise resolving to connection details including ID, version, and encryption key
323
329
  */
324
330
  create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
325
331
  /**
326
332
  * Updates an existing connection with new encrypted data
333
+ * @template T Type of component request
327
334
  * @param id Connection ID
328
335
  * @param data New data to encrypt and store
329
336
  * @param version Current version number
337
+ * @param status New connection status
338
+ * @param key Current encryption key
330
339
  * @returns Promise resolving to updated connection details including new encryption key
331
340
  */
332
341
  update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
333
342
  /**
334
343
  * Retrieves and decrypts connection data
344
+ * @template T Type of component request
335
345
  * @param id Connection ID
336
346
  * @param key Encryption key from previous create/update operation
337
347
  * @returns Promise resolving to connection details including decrypted data
@@ -340,14 +350,15 @@ export declare class ConnectionManager {
340
350
  /**
341
351
  * Closes a connection
342
352
  * @param id Connection ID
353
+ * @returns Promise resolving when the connection is closed
343
354
  */
344
355
  close(id: UUID): Promise<void>;
345
356
  }
346
357
 
347
358
  export declare interface ConnectionMetadata {
348
- nodeUrl?: string;
349
- participants: string[];
350
- transactionType: TransactionType;
359
+ readonly nodeUrl?: string;
360
+ readonly participants: readonly string[];
361
+ readonly transactionType: TransactionType;
351
362
  }
352
363
 
353
364
  /**
@@ -365,21 +376,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
365
376
  }
366
377
 
367
378
  export declare interface ConnectionResponse<T extends ComponentRequest> {
368
- id: UUID;
369
- version: number;
370
- status: ConnectionStatus;
371
- metadata: ConnectionMetadata;
372
- data: ConnectionData<T>;
373
- key: string;
379
+ readonly id: UUID;
380
+ readonly version: number;
381
+ readonly status: ConnectionStatus;
382
+ readonly metadata: ConnectionMetadata;
383
+ readonly data: ConnectionData<T>;
384
+ readonly key: string;
374
385
  }
375
386
 
376
- export declare interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
382
- }
387
+ export declare type ConnectionResult<T extends ComponentRequest> = {
388
+ readonly id: UUID;
389
+ readonly metadata: ConnectionMetadata;
390
+ readonly status: 'closed';
391
+ } | {
392
+ readonly id: UUID;
393
+ readonly metadata: ConnectionMetadata;
394
+ readonly status: 'completed';
395
+ readonly result: TransactionResponse<T>;
396
+ } | {
397
+ readonly id: UUID;
398
+ readonly metadata: ConnectionMetadata;
399
+ readonly status: 'active';
400
+ readonly tx: T;
401
+ };
383
402
 
384
403
  export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
385
404
 
@@ -666,7 +685,6 @@ export declare enum ErrorIdentifierCode {
666
685
  */
667
686
  export declare type FieldOptions = boolean | string[] | {
668
687
  optional: boolean;
669
- transmit: boolean;
670
688
  };
671
689
 
672
690
  /**
@@ -678,6 +696,12 @@ export declare type FieldTypes = {
678
696
  legalPerson?: LegalPersonFields;
679
697
  };
680
698
 
699
+ /**
700
+ * Retrieves and processes connection refresh data
701
+ * @template T Type of component request
702
+ * @param refreshSource Source information for the refresh operation
703
+ * @returns Promise resolving to connection result with decrypted data
704
+ */
681
705
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
682
706
 
683
707
  /**
@@ -712,6 +736,18 @@ export declare enum HMType {
712
736
  */
713
737
  export declare type HostMessage<T, O> = UpdateValue<T, O>;
714
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
+
715
751
  /**
716
752
  * Intermediary VASP
717
753
  * Represents an intermediary Virtual Asset Service Provider
@@ -1547,6 +1583,7 @@ export declare interface TransactionOptions {
1547
1583
  fallbacks?: ProofTypes[];
1548
1584
  deminimis?: ThresholdOptions;
1549
1585
  };
1586
+ jurisdiction?: string;
1550
1587
  allowedAgentTypes?: AgentType[];
1551
1588
  allowedCounterpartyTypes?: PersonType[];
1552
1589
  fields?: FieldTypes;
@@ -1727,6 +1764,7 @@ export declare interface VASP extends Agent {
1727
1764
  logo?: URI;
1728
1765
  website?: URI;
1729
1766
  countryOfRegistration?: ISOCountryCode;
1767
+ jurisdictions?: string;
1730
1768
  }
1731
1769
 
1732
1770
  /**
@@ -1761,6 +1799,18 @@ export declare interface Wallet extends Agent {
1761
1799
  wallet_connect_id?: string;
1762
1800
  }
1763
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
+
1764
1814
  /**
1765
1815
  * An object representing a withdrawal transaction
1766
1816
  * @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.9.3",
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",
@@ -53,6 +53,7 @@
53
53
  "build:dev": "yarn build && yarn dev",
54
54
  "build:clean": "rimraf dist ts-out coverage temp",
55
55
  "build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
56
+ "build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
56
57
  "lint": "eslint . --max-warnings 0",
57
58
  "lint:fix": "yarn lint --fix --cache --no-warn-ignored",
58
59
  "format": "prettier --write --cache .",
@@ -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
@@ -303,10 +308,10 @@ export declare interface ComponentResponse {
303
308
  }
304
309
 
305
310
  export declare interface ConnectionData<T extends ComponentRequest> {
306
- tx: T;
307
- authToken?: string;
308
- txOptions?: TransactionOptions;
309
- result?: TransactionResponse<T>;
311
+ readonly tx: T;
312
+ readonly authToken?: string;
313
+ readonly txOptions?: TransactionOptions;
314
+ readonly result?: TransactionResponse<T>;
310
315
  }
311
316
 
312
317
  /**
@@ -317,21 +322,26 @@ export declare class ConnectionManager {
317
322
  constructor(endpoint: string);
318
323
  /**
319
324
  * Creates a new encrypted connection
325
+ * @template T Type of component request
320
326
  * @param data The component request data to encrypt and store
321
- * @param participants Array of participant identifiers
327
+ * @param metadata Connection metadata including participants and transaction type
322
328
  * @returns Promise resolving to connection details including ID, version, and encryption key
323
329
  */
324
330
  create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
325
331
  /**
326
332
  * Updates an existing connection with new encrypted data
333
+ * @template T Type of component request
327
334
  * @param id Connection ID
328
335
  * @param data New data to encrypt and store
329
336
  * @param version Current version number
337
+ * @param status New connection status
338
+ * @param key Current encryption key
330
339
  * @returns Promise resolving to updated connection details including new encryption key
331
340
  */
332
341
  update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
333
342
  /**
334
343
  * Retrieves and decrypts connection data
344
+ * @template T Type of component request
335
345
  * @param id Connection ID
336
346
  * @param key Encryption key from previous create/update operation
337
347
  * @returns Promise resolving to connection details including decrypted data
@@ -340,14 +350,15 @@ export declare class ConnectionManager {
340
350
  /**
341
351
  * Closes a connection
342
352
  * @param id Connection ID
353
+ * @returns Promise resolving when the connection is closed
343
354
  */
344
355
  close(id: UUID): Promise<void>;
345
356
  }
346
357
 
347
358
  export declare interface ConnectionMetadata {
348
- nodeUrl?: string;
349
- participants: string[];
350
- transactionType: TransactionType;
359
+ readonly nodeUrl?: string;
360
+ readonly participants: readonly string[];
361
+ readonly transactionType: TransactionType;
351
362
  }
352
363
 
353
364
  /**
@@ -365,21 +376,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
365
376
  }
366
377
 
367
378
  export declare interface ConnectionResponse<T extends ComponentRequest> {
368
- id: UUID;
369
- version: number;
370
- status: ConnectionStatus;
371
- metadata: ConnectionMetadata;
372
- data: ConnectionData<T>;
373
- key: string;
379
+ readonly id: UUID;
380
+ readonly version: number;
381
+ readonly status: ConnectionStatus;
382
+ readonly metadata: ConnectionMetadata;
383
+ readonly data: ConnectionData<T>;
384
+ readonly key: string;
374
385
  }
375
386
 
376
- export declare interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
382
- }
387
+ export declare type ConnectionResult<T extends ComponentRequest> = {
388
+ readonly id: UUID;
389
+ readonly metadata: ConnectionMetadata;
390
+ readonly status: 'closed';
391
+ } | {
392
+ readonly id: UUID;
393
+ readonly metadata: ConnectionMetadata;
394
+ readonly status: 'completed';
395
+ readonly result: TransactionResponse<T>;
396
+ } | {
397
+ readonly id: UUID;
398
+ readonly metadata: ConnectionMetadata;
399
+ readonly status: 'active';
400
+ readonly tx: T;
401
+ };
383
402
 
384
403
  export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
385
404
 
@@ -666,7 +685,6 @@ export declare enum ErrorIdentifierCode {
666
685
  */
667
686
  export declare type FieldOptions = boolean | string[] | {
668
687
  optional: boolean;
669
- transmit: boolean;
670
688
  };
671
689
 
672
690
  /**
@@ -678,6 +696,12 @@ export declare type FieldTypes = {
678
696
  legalPerson?: LegalPersonFields;
679
697
  };
680
698
 
699
+ /**
700
+ * Retrieves and processes connection refresh data
701
+ * @template T Type of component request
702
+ * @param refreshSource Source information for the refresh operation
703
+ * @returns Promise resolving to connection result with decrypted data
704
+ */
681
705
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
682
706
 
683
707
  /**
@@ -712,6 +736,18 @@ export declare enum HMType {
712
736
  */
713
737
  export declare type HostMessage<T, O> = UpdateValue<T, O>;
714
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
+
715
751
  /**
716
752
  * Intermediary VASP
717
753
  * Represents an intermediary Virtual Asset Service Provider
@@ -1547,6 +1583,7 @@ export declare interface TransactionOptions {
1547
1583
  fallbacks?: ProofTypes[];
1548
1584
  deminimis?: ThresholdOptions;
1549
1585
  };
1586
+ jurisdiction?: string;
1550
1587
  allowedAgentTypes?: AgentType[];
1551
1588
  allowedCounterpartyTypes?: PersonType[];
1552
1589
  fields?: FieldTypes;
@@ -1727,6 +1764,7 @@ export declare interface VASP extends Agent {
1727
1764
  logo?: URI;
1728
1765
  website?: URI;
1729
1766
  countryOfRegistration?: ISOCountryCode;
1767
+ jurisdictions?: string;
1730
1768
  }
1731
1769
 
1732
1770
  /**
@@ -1761,6 +1799,18 @@ export declare interface Wallet extends Agent {
1761
1799
  wallet_connect_id?: string;
1762
1800
  }
1763
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
+
1764
1814
  /**
1765
1815
  * An object representing a withdrawal transaction
1766
1816
  * @public
@@ -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 || {}), L = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(L || {}), b = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(b || {}), 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))(l || {}), C = /* @__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))(C || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), N = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(N || {}), 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 || {});
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 D(t) {
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 M(t) {
306
+ async function S(t) {
307
307
  const e = await fetch(t.url, {
308
308
  method: "GET"
309
309
  });
@@ -331,15 +331,16 @@ async function M(t) {
331
331
  tx: i.tx
332
332
  };
333
333
  }
334
- class S {
334
+ class M {
335
335
  constructor(e) {
336
336
  a(this, "endpoint");
337
337
  this.endpoint = e;
338
338
  }
339
339
  /**
340
340
  * Creates a new encrypted connection
341
+ * @template T Type of component request
341
342
  * @param data The component request data to encrypt and store
342
- * @param participants Array of participant identifiers
343
+ * @param metadata Connection metadata including participants and transaction type
343
344
  * @returns Promise resolving to connection details including ID, version, and encryption key
344
345
  */
345
346
  async create(e, n) {
@@ -367,9 +368,12 @@ class S {
367
368
  }
368
369
  /**
369
370
  * Updates an existing connection with new encrypted data
371
+ * @template T Type of component request
370
372
  * @param id Connection ID
371
373
  * @param data New data to encrypt and store
372
374
  * @param version Current version number
375
+ * @param status New connection status
376
+ * @param key Current encryption key
373
377
  * @returns Promise resolving to updated connection details including new encryption key
374
378
  */
375
379
  async update(e, n, s, r, i) {
@@ -398,6 +402,7 @@ class S {
398
402
  }
399
403
  /**
400
404
  * Retrieves and decrypts connection data
405
+ * @template T Type of component request
401
406
  * @param id Connection ID
402
407
  * @param key Encryption key from previous create/update operation
403
408
  * @returns Promise resolving to connection details including decrypted data
@@ -424,6 +429,7 @@ class S {
424
429
  /**
425
430
  * Closes a connection
426
431
  * @param id Connection ID
432
+ * @returns Promise resolving when the connection is closed
427
433
  */
428
434
  async close(e) {
429
435
  const n = await fetch(`${this.endpoint}/${e}`, {
@@ -460,7 +466,7 @@ class k {
460
466
  componentUrl(e, n, s, r) {
461
467
  const i = new URL(this.uxUrl);
462
468
  i.pathname = e;
463
- const o = D({
469
+ const o = R({
464
470
  authToken: this.authToken,
465
471
  value: n,
466
472
  configuration: s
@@ -555,17 +561,17 @@ class k {
555
561
  export {
556
562
  A as AgentType,
557
563
  l as CMType,
558
- S as ConnectionManager,
564
+ M as ConnectionManager,
559
565
  x as EmbeddedComponent,
560
- C as ErrorIdentifierCode,
566
+ b as ErrorIdentifierCode,
561
567
  E as HMType,
562
568
  y as PersonType,
563
- N as ProofStatus,
569
+ C as ProofStatus,
564
570
  U as ProofTypes,
565
571
  I as Status,
566
- L as VASPSearchControl,
567
- b as ValidationSections,
572
+ N as VASPSearchControl,
573
+ L as ValidationSections,
568
574
  O as decodeFragmentToObject,
569
575
  k as default,
570
- M as getRefreshResult
576
+ S as getRefreshResult
571
577
  };
@@ -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.9.3",
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",
@@ -53,6 +53,7 @@
53
53
  "build:dev": "yarn build && yarn dev",
54
54
  "build:clean": "rimraf dist ts-out coverage temp",
55
55
  "build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
56
+ "build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
56
57
  "lint": "eslint . --max-warnings 0",
57
58
  "lint:fix": "yarn lint --fix --cache --no-warn-ignored",
58
59
  "format": "prettier --write --cache .",
@@ -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
@@ -303,10 +308,10 @@ export declare interface ComponentResponse {
303
308
  }
304
309
 
305
310
  export declare interface ConnectionData<T extends ComponentRequest> {
306
- tx: T;
307
- authToken?: string;
308
- txOptions?: TransactionOptions;
309
- result?: TransactionResponse<T>;
311
+ readonly tx: T;
312
+ readonly authToken?: string;
313
+ readonly txOptions?: TransactionOptions;
314
+ readonly result?: TransactionResponse<T>;
310
315
  }
311
316
 
312
317
  /**
@@ -317,21 +322,26 @@ export declare class ConnectionManager {
317
322
  constructor(endpoint: string);
318
323
  /**
319
324
  * Creates a new encrypted connection
325
+ * @template T Type of component request
320
326
  * @param data The component request data to encrypt and store
321
- * @param participants Array of participant identifiers
327
+ * @param metadata Connection metadata including participants and transaction type
322
328
  * @returns Promise resolving to connection details including ID, version, and encryption key
323
329
  */
324
330
  create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
325
331
  /**
326
332
  * Updates an existing connection with new encrypted data
333
+ * @template T Type of component request
327
334
  * @param id Connection ID
328
335
  * @param data New data to encrypt and store
329
336
  * @param version Current version number
337
+ * @param status New connection status
338
+ * @param key Current encryption key
330
339
  * @returns Promise resolving to updated connection details including new encryption key
331
340
  */
332
341
  update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
333
342
  /**
334
343
  * Retrieves and decrypts connection data
344
+ * @template T Type of component request
335
345
  * @param id Connection ID
336
346
  * @param key Encryption key from previous create/update operation
337
347
  * @returns Promise resolving to connection details including decrypted data
@@ -340,14 +350,15 @@ export declare class ConnectionManager {
340
350
  /**
341
351
  * Closes a connection
342
352
  * @param id Connection ID
353
+ * @returns Promise resolving when the connection is closed
343
354
  */
344
355
  close(id: UUID): Promise<void>;
345
356
  }
346
357
 
347
358
  export declare interface ConnectionMetadata {
348
- nodeUrl?: string;
349
- participants: string[];
350
- transactionType: TransactionType;
359
+ readonly nodeUrl?: string;
360
+ readonly participants: readonly string[];
361
+ readonly transactionType: TransactionType;
351
362
  }
352
363
 
353
364
  /**
@@ -365,21 +376,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
365
376
  }
366
377
 
367
378
  export declare interface ConnectionResponse<T extends ComponentRequest> {
368
- id: UUID;
369
- version: number;
370
- status: ConnectionStatus;
371
- metadata: ConnectionMetadata;
372
- data: ConnectionData<T>;
373
- key: string;
379
+ readonly id: UUID;
380
+ readonly version: number;
381
+ readonly status: ConnectionStatus;
382
+ readonly metadata: ConnectionMetadata;
383
+ readonly data: ConnectionData<T>;
384
+ readonly key: string;
374
385
  }
375
386
 
376
- export declare interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
382
- }
387
+ export declare type ConnectionResult<T extends ComponentRequest> = {
388
+ readonly id: UUID;
389
+ readonly metadata: ConnectionMetadata;
390
+ readonly status: 'closed';
391
+ } | {
392
+ readonly id: UUID;
393
+ readonly metadata: ConnectionMetadata;
394
+ readonly status: 'completed';
395
+ readonly result: TransactionResponse<T>;
396
+ } | {
397
+ readonly id: UUID;
398
+ readonly metadata: ConnectionMetadata;
399
+ readonly status: 'active';
400
+ readonly tx: T;
401
+ };
383
402
 
384
403
  export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
385
404
 
@@ -666,7 +685,6 @@ export declare enum ErrorIdentifierCode {
666
685
  */
667
686
  export declare type FieldOptions = boolean | string[] | {
668
687
  optional: boolean;
669
- transmit: boolean;
670
688
  };
671
689
 
672
690
  /**
@@ -678,6 +696,12 @@ export declare type FieldTypes = {
678
696
  legalPerson?: LegalPersonFields;
679
697
  };
680
698
 
699
+ /**
700
+ * Retrieves and processes connection refresh data
701
+ * @template T Type of component request
702
+ * @param refreshSource Source information for the refresh operation
703
+ * @returns Promise resolving to connection result with decrypted data
704
+ */
681
705
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
682
706
 
683
707
  /**
@@ -712,6 +736,18 @@ export declare enum HMType {
712
736
  */
713
737
  export declare type HostMessage<T, O> = UpdateValue<T, O>;
714
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
+
715
751
  /**
716
752
  * Intermediary VASP
717
753
  * Represents an intermediary Virtual Asset Service Provider
@@ -1547,6 +1583,7 @@ export declare interface TransactionOptions {
1547
1583
  fallbacks?: ProofTypes[];
1548
1584
  deminimis?: ThresholdOptions;
1549
1585
  };
1586
+ jurisdiction?: string;
1550
1587
  allowedAgentTypes?: AgentType[];
1551
1588
  allowedCounterpartyTypes?: PersonType[];
1552
1589
  fields?: FieldTypes;
@@ -1727,6 +1764,7 @@ export declare interface VASP extends Agent {
1727
1764
  logo?: URI;
1728
1765
  website?: URI;
1729
1766
  countryOfRegistration?: ISOCountryCode;
1767
+ jurisdictions?: string;
1730
1768
  }
1731
1769
 
1732
1770
  /**
@@ -1761,6 +1799,18 @@ export declare interface Wallet extends Agent {
1761
1799
  wallet_connect_id?: string;
1762
1800
  }
1763
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
+
1764
1814
  /**
1765
1815
  * An object representing a withdrawal transaction
1766
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 || {}), L = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(L || {}), b = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(b || {}), 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))(l || {}), C = /* @__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))(C || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), N = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(N || {}), 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 || {});
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 D(t) {
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 M(t) {
306
+ async function S(t) {
307
307
  const e = await fetch(t.url, {
308
308
  method: "GET"
309
309
  });
@@ -331,15 +331,16 @@ async function M(t) {
331
331
  tx: i.tx
332
332
  };
333
333
  }
334
- class S {
334
+ class M {
335
335
  constructor(e) {
336
336
  a(this, "endpoint");
337
337
  this.endpoint = e;
338
338
  }
339
339
  /**
340
340
  * Creates a new encrypted connection
341
+ * @template T Type of component request
341
342
  * @param data The component request data to encrypt and store
342
- * @param participants Array of participant identifiers
343
+ * @param metadata Connection metadata including participants and transaction type
343
344
  * @returns Promise resolving to connection details including ID, version, and encryption key
344
345
  */
345
346
  async create(e, n) {
@@ -367,9 +368,12 @@ class S {
367
368
  }
368
369
  /**
369
370
  * Updates an existing connection with new encrypted data
371
+ * @template T Type of component request
370
372
  * @param id Connection ID
371
373
  * @param data New data to encrypt and store
372
374
  * @param version Current version number
375
+ * @param status New connection status
376
+ * @param key Current encryption key
373
377
  * @returns Promise resolving to updated connection details including new encryption key
374
378
  */
375
379
  async update(e, n, s, r, i) {
@@ -398,6 +402,7 @@ class S {
398
402
  }
399
403
  /**
400
404
  * Retrieves and decrypts connection data
405
+ * @template T Type of component request
401
406
  * @param id Connection ID
402
407
  * @param key Encryption key from previous create/update operation
403
408
  * @returns Promise resolving to connection details including decrypted data
@@ -424,6 +429,7 @@ class S {
424
429
  /**
425
430
  * Closes a connection
426
431
  * @param id Connection ID
432
+ * @returns Promise resolving when the connection is closed
427
433
  */
428
434
  async close(e) {
429
435
  const n = await fetch(`${this.endpoint}/${e}`, {
@@ -460,7 +466,7 @@ class k {
460
466
  componentUrl(e, n, s, r) {
461
467
  const i = new URL(this.uxUrl);
462
468
  i.pathname = e;
463
- const o = D({
469
+ const o = R({
464
470
  authToken: this.authToken,
465
471
  value: n,
466
472
  configuration: s
@@ -555,17 +561,17 @@ class k {
555
561
  export {
556
562
  A as AgentType,
557
563
  l as CMType,
558
- S as ConnectionManager,
564
+ M as ConnectionManager,
559
565
  x as EmbeddedComponent,
560
- C as ErrorIdentifierCode,
566
+ b as ErrorIdentifierCode,
561
567
  E as HMType,
562
568
  y as PersonType,
563
- N as ProofStatus,
569
+ C as ProofStatus,
564
570
  U as ProofTypes,
565
571
  I as Status,
566
- L as VASPSearchControl,
567
- b as ValidationSections,
572
+ N as VASPSearchControl,
573
+ L as ValidationSections,
568
574
  O as decodeFragmentToObject,
569
575
  k as default,
570
- M as getRefreshResult
576
+ S as getRefreshResult
571
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.9.3",
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",
@@ -53,6 +53,7 @@
53
53
  "build:dev": "yarn build && yarn dev",
54
54
  "build:clean": "rimraf dist ts-out coverage temp",
55
55
  "build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
56
+ "build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
56
57
  "lint": "eslint . --max-warnings 0",
57
58
  "lint:fix": "yarn lint --fix --cache --no-warn-ignored",
58
59
  "format": "prettier --write --cache .",
package/src/types.ts CHANGED
@@ -301,6 +301,7 @@ export interface VASP extends Agent {
301
301
  logo?: URI;
302
302
  website?: URI;
303
303
  countryOfRegistration?: ISOCountryCode;
304
+ jurisdictions?: string;
304
305
  }
305
306
 
306
307
  /**
@@ -757,7 +758,6 @@ export type FieldOptions =
757
758
  | string[] // fields to show
758
759
  | {
759
760
  optional: boolean; // Shown but optional
760
- transmit: boolean; // Transmit as part of IVMS 101 to counterparty
761
761
  };
762
762
 
763
763
  /**
@@ -850,6 +850,7 @@ export interface TransactionOptions {
850
850
  fallbacks?: ProofTypes[];
851
851
  deminimis?: ThresholdOptions;
852
852
  };
853
+ jurisdiction?: string;
853
854
  allowedAgentTypes?: AgentType[]; // Defaults to All
854
855
  allowedCounterpartyTypes?: PersonType[]; // Defaults to All
855
856
  fields?: FieldTypes;
@@ -879,6 +880,8 @@ export enum CMType {
879
880
  INVALID = 'invalid',
880
881
  ERROR = 'error',
881
882
  CANCEL = 'cancel',
883
+ WARNING = 'warning',
884
+ INFO = 'info',
882
885
  }
883
886
 
884
887
  /**
@@ -955,6 +958,30 @@ export type InvalidValue<T> = {
955
958
  errors: ValidationError[];
956
959
  };
957
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
+
958
985
  /**
959
986
  * Union type representing all possible messages that can be sent from a component
960
987
  *
@@ -972,8 +999,11 @@ export type InvalidValue<T> = {
972
999
  * @see {@link Completed} For successful completion message format
973
1000
  * @see {@link Cancel} For cancellation message format
974
1001
  * @see {@link Error} For error message format
1002
+ * @see {@link Ready} For ready message format
975
1003
  * @see {@link ResizeRequest} For resize message format
976
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
977
1007
  * @public
978
1008
  */
979
1009
  export type ComponentMessage<T> =
@@ -982,7 +1012,9 @@ export type ComponentMessage<T> =
982
1012
  | Error
983
1013
  | Ready
984
1014
  | ResizeRequest
985
- | InvalidValue<T>;
1015
+ | InvalidValue<T>
1016
+ | Warning
1017
+ | Info;
986
1018
 
987
1019
  /**
988
1020
  * Host Message Type enum representing different message types that can be sent
@@ -9,35 +9,54 @@ import { seal, unseal } from './encryption';
9
9
 
10
10
  export type TransactionType = 'withdraw' | 'deposit';
11
11
  export type ConnectionStatus = 'active' | 'completed' | 'closed';
12
+
12
13
  export interface ConnectionData<T extends ComponentRequest> {
13
- tx: T;
14
- authToken?: string;
15
- txOptions?: TransactionOptions;
16
- result?: TransactionResponse<T>;
14
+ readonly tx: T;
15
+ readonly authToken?: string;
16
+ readonly txOptions?: TransactionOptions;
17
+ readonly result?: TransactionResponse<T>;
17
18
  }
18
19
 
19
20
  export interface ConnectionMetadata {
20
- nodeUrl?: string;
21
- participants: string[];
22
- transactionType: TransactionType;
21
+ readonly nodeUrl?: string;
22
+ readonly participants: readonly string[];
23
+ readonly transactionType: TransactionType;
23
24
  }
25
+
24
26
  export interface ConnectionResponse<T extends ComponentRequest> {
25
- id: UUID;
26
- version: number;
27
- status: ConnectionStatus;
28
- metadata: ConnectionMetadata;
29
- data: ConnectionData<T>;
30
- key: string;
27
+ readonly id: UUID;
28
+ readonly version: number;
29
+ readonly status: ConnectionStatus;
30
+ readonly metadata: ConnectionMetadata;
31
+ readonly data: ConnectionData<T>;
32
+ readonly key: string;
31
33
  }
32
34
 
33
- export interface ConnectionResult<T extends ComponentRequest> {
34
- id: UUID;
35
- metadata: ConnectionMetadata;
36
- status: ConnectionStatus;
37
- tx?: T;
38
- result?: TransactionResponse<T>;
39
- }
35
+ export type ConnectionResult<T extends ComponentRequest> =
36
+ | {
37
+ readonly id: UUID;
38
+ readonly metadata: ConnectionMetadata;
39
+ readonly status: 'closed';
40
+ }
41
+ | {
42
+ readonly id: UUID;
43
+ readonly metadata: ConnectionMetadata;
44
+ readonly status: 'completed';
45
+ readonly result: TransactionResponse<T>;
46
+ }
47
+ | {
48
+ readonly id: UUID;
49
+ readonly metadata: ConnectionMetadata;
50
+ readonly status: 'active';
51
+ readonly tx: T;
52
+ };
40
53
 
54
+ /**
55
+ * Retrieves and processes connection refresh data
56
+ * @template T Type of component request
57
+ * @param refreshSource Source information for the refresh operation
58
+ * @returns Promise resolving to connection result with decrypted data
59
+ */
41
60
  export async function getRefreshResult<T extends ComponentRequest>(
42
61
  refreshSource: RefreshSource,
43
62
  ): Promise<ConnectionResult<T>> {
@@ -99,8 +118,9 @@ export class ConnectionManager {
99
118
 
100
119
  /**
101
120
  * Creates a new encrypted connection
121
+ * @template T Type of component request
102
122
  * @param data The component request data to encrypt and store
103
- * @param participants Array of participant identifiers
123
+ * @param metadata Connection metadata including participants and transaction type
104
124
  * @returns Promise resolving to connection details including ID, version, and encryption key
105
125
  */
106
126
  async create<T extends ComponentRequest>(
@@ -143,9 +163,12 @@ export class ConnectionManager {
143
163
 
144
164
  /**
145
165
  * Updates an existing connection with new encrypted data
166
+ * @template T Type of component request
146
167
  * @param id Connection ID
147
168
  * @param data New data to encrypt and store
148
169
  * @param version Current version number
170
+ * @param status New connection status
171
+ * @param key Current encryption key
149
172
  * @returns Promise resolving to updated connection details including new encryption key
150
173
  */
151
174
  async update<T extends ComponentRequest>(
@@ -192,6 +215,7 @@ export class ConnectionManager {
192
215
 
193
216
  /**
194
217
  * Retrieves and decrypts connection data
218
+ * @template T Type of component request
195
219
  * @param id Connection ID
196
220
  * @param key Encryption key from previous create/update operation
197
221
  * @returns Promise resolving to connection details including decrypted data
@@ -233,6 +257,7 @@ export class ConnectionManager {
233
257
  /**
234
258
  * Closes a connection
235
259
  * @param id Connection ID
260
+ * @returns Promise resolving when the connection is closed
236
261
  */
237
262
  async close(id: UUID): Promise<void> {
238
263
  const response = await fetch(`${this.endpoint}/${id}`, {
@@ -3,15 +3,16 @@
3
3
  */
4
4
  export interface Sealed {
5
5
  /** Base64-encoded ciphertext combined with initialization vector (IV) */
6
- ciphertext: string;
6
+ readonly ciphertext: string;
7
7
  /** Base64-encoded encryption key */
8
- key: string;
8
+ readonly key: string;
9
9
  }
10
10
 
11
11
  /**
12
12
  * Encrypts an object using AES-GCM encryption.
13
13
  * @template T Type of data to encrypt
14
14
  * @param data Data to encrypt
15
+ * @param existingKey Optional existing key to use for encryption
15
16
  * @returns Promise resolving to a Sealed object containing ciphertext and key
16
17
  */
17
18
  export async function seal<T>(data: T, existingKey?: string): Promise<Sealed> {
@@ -56,7 +57,6 @@ export async function seal<T>(data: T, existingKey?: string): Promise<Sealed> {
56
57
  * @param sealed Sealed object containing ciphertext and key
57
58
  * @returns Promise resolving to the original decrypted data
58
59
  */
59
-
60
60
  export async function unseal<T>({ ciphertext, key }: Sealed): Promise<T> {
61
61
  // Split the IV and the ciphertext
62
62
  const [ivBase64, ciphertextBase64] = ciphertext.split('-');
@@ -91,7 +91,11 @@ export async function unseal<T>({ ciphertext, key }: Sealed): Promise<T> {
91
91
  return JSON.parse(decoder.decode(plaintextBuffer));
92
92
  }
93
93
 
94
- // Utility function to convert ArrayBuffer to Base64
94
+ /**
95
+ * Converts an ArrayBuffer to a Base64 string
96
+ * @param buffer The ArrayBuffer to convert
97
+ * @returns Base64 encoded string
98
+ */
95
99
  function arrayBufferToBase64(buffer: ArrayBuffer): string {
96
100
  const uint8Array = new Uint8Array(buffer);
97
101
  let binary = '';
@@ -101,8 +105,11 @@ function arrayBufferToBase64(buffer: ArrayBuffer): string {
101
105
  return btoa(binary);
102
106
  }
103
107
 
104
- // Utility function to convert Base64 to ArrayBuffer
105
-
108
+ /**
109
+ * Converts a Base64 string to a Uint8Array
110
+ * @param base64 The Base64 string to convert
111
+ * @returns Uint8Array containing the decoded data
112
+ */
106
113
  function base64ToUint8Array(base64: string): Uint8Array {
107
114
  const binary = atob(base64);
108
115
  const buffer = new Uint8Array(binary.length);