@notabene/javascript-sdk 2.0.1 → 2.0.3

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.
Files changed (120) hide show
  1. package/dist/notabene.cjs +1 -1
  2. package/dist/notabene.d.ts +1565 -0
  3. package/dist/notabene.js +1 -1
  4. package/dist/tsdoc-metadata.json +11 -0
  5. package/docs/README.md +656 -0
  6. package/docs/_media/LICENSE.md +21 -0
  7. package/docs/_media/TransactionOptions.md +93 -0
  8. package/docs/_media/locales.ts +48 -0
  9. package/docs/ivms/types/README.md +46 -0
  10. package/docs/ivms/types/enumerations/PayloadVersionCode.md +33 -0
  11. package/docs/ivms/types/interfaces/PayloadMetadata.md +34 -0
  12. package/docs/ivms/types/type-aliases/Address.md +114 -0
  13. package/docs/ivms/types/type-aliases/AddressTypeCode.md +16 -0
  14. package/docs/ivms/types/type-aliases/Beneficiary.md +30 -0
  15. package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +24 -0
  16. package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +30 -0
  17. package/docs/ivms/types/type-aliases/ISOCountryCode.md +22 -0
  18. package/docs/ivms/types/type-aliases/ISODate.md +23 -0
  19. package/docs/ivms/types/type-aliases/IVMS101.md +41 -0
  20. package/docs/ivms/types/type-aliases/IntermediaryVASP.md +30 -0
  21. package/docs/ivms/types/type-aliases/LegalPerson.md +48 -0
  22. package/docs/ivms/types/type-aliases/LegalPersonName.md +36 -0
  23. package/docs/ivms/types/type-aliases/LegalPersonNameID.md +30 -0
  24. package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +16 -0
  25. package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +30 -0
  26. package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +36 -0
  27. package/docs/ivms/types/type-aliases/NationalIdentification.md +42 -0
  28. package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +16 -0
  29. package/docs/ivms/types/type-aliases/NaturalPerson.md +54 -0
  30. package/docs/ivms/types/type-aliases/NaturalPersonName.md +36 -0
  31. package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +36 -0
  32. package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +16 -0
  33. package/docs/ivms/types/type-aliases/OriginatingVASP.md +24 -0
  34. package/docs/ivms/types/type-aliases/Originator.md +30 -0
  35. package/docs/ivms/types/type-aliases/Person.md +30 -0
  36. package/docs/ivms/types/type-aliases/TransferPath.md +24 -0
  37. package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +16 -0
  38. package/docs/modules.md +11 -0
  39. package/docs/notabene/README.md +368 -0
  40. package/docs/notabene/classes/EmbeddedComponent.md +347 -0
  41. package/docs/notabene/classes/default.md +221 -0
  42. package/docs/notabene/functions/decodeFragmentToObject.md +27 -0
  43. package/docs/notabene/interfaces/NotabeneConfig.md +69 -0
  44. package/docs/notabene/type-aliases/MessageCallback.md +31 -0
  45. package/docs/types/README.md +154 -0
  46. package/docs/types/enumerations/AgentType.md +29 -0
  47. package/docs/types/enumerations/CMType.md +90 -0
  48. package/docs/types/enumerations/HMType.md +35 -0
  49. package/docs/types/enumerations/PersonType.md +55 -0
  50. package/docs/types/enumerations/ProofStatus.md +57 -0
  51. package/docs/types/enumerations/ProofTypes.md +148 -0
  52. package/docs/types/enumerations/Status.md +59 -0
  53. package/docs/types/enumerations/ValidationSections.md +59 -0
  54. package/docs/types/interfaces/Agent.md +74 -0
  55. package/docs/types/interfaces/CallbackOptions.md +29 -0
  56. package/docs/types/interfaces/ComponentRequest.md +50 -0
  57. package/docs/types/interfaces/ComponentResponse.md +71 -0
  58. package/docs/types/interfaces/ConnectionRecord.md +111 -0
  59. package/docs/types/interfaces/ConnectionRequest.md +51 -0
  60. package/docs/types/interfaces/Counterparty.md +135 -0
  61. package/docs/types/interfaces/DeclarationProof.md +89 -0
  62. package/docs/types/interfaces/Deposit.md +147 -0
  63. package/docs/types/interfaces/DepositRequest.md +111 -0
  64. package/docs/types/interfaces/DepositRequestOptions.md +19 -0
  65. package/docs/types/interfaces/LegalPerson.md +202 -0
  66. package/docs/types/interfaces/MicroTransferProof.md +119 -0
  67. package/docs/types/interfaces/NaturalPerson.md +201 -0
  68. package/docs/types/interfaces/OwnershipProof.md +77 -0
  69. package/docs/types/interfaces/ScreenshotProof.md +79 -0
  70. package/docs/types/interfaces/SignatureProof.md +115 -0
  71. package/docs/types/interfaces/ThresholdOptions.md +47 -0
  72. package/docs/types/interfaces/Transaction.md +136 -0
  73. package/docs/types/interfaces/TransactionOptions.md +93 -0
  74. package/docs/types/interfaces/TransactionResponse.md +130 -0
  75. package/docs/types/interfaces/VASP.md +127 -0
  76. package/docs/types/interfaces/Wallet.md +117 -0
  77. package/docs/types/interfaces/Withdrawal.md +147 -0
  78. package/docs/types/type-aliases/BlockchainAddress.md +36 -0
  79. package/docs/types/type-aliases/CAIP10.md +39 -0
  80. package/docs/types/type-aliases/CAIP19.md +40 -0
  81. package/docs/types/type-aliases/CAIP2.md +39 -0
  82. package/docs/types/type-aliases/CAIP220.md +15 -0
  83. package/docs/types/type-aliases/Cancel.md +23 -0
  84. package/docs/types/type-aliases/Completed.md +35 -0
  85. package/docs/types/type-aliases/ComponentMessage.md +41 -0
  86. package/docs/types/type-aliases/ConnectionOptions.md +15 -0
  87. package/docs/types/type-aliases/CryptoCredential.md +15 -0
  88. package/docs/types/type-aliases/DID.md +15 -0
  89. package/docs/types/type-aliases/DTI.md +38 -0
  90. package/docs/types/type-aliases/Destination.md +15 -0
  91. package/docs/types/type-aliases/Error.md +29 -0
  92. package/docs/types/type-aliases/FieldOptions.md +15 -0
  93. package/docs/types/type-aliases/FieldTypes.md +25 -0
  94. package/docs/types/type-aliases/HostMessage.md +37 -0
  95. package/docs/types/type-aliases/ISOCurrency.md +15 -0
  96. package/docs/types/type-aliases/InvalidValue.md +45 -0
  97. package/docs/types/type-aliases/LEI.md +15 -0
  98. package/docs/types/type-aliases/LegalPersonFieldName.md +13 -0
  99. package/docs/types/type-aliases/LegalPersonFields.md +15 -0
  100. package/docs/types/type-aliases/NaturalPersonFieldName.md +15 -0
  101. package/docs/types/type-aliases/NaturalPersonFields.md +15 -0
  102. package/docs/types/type-aliases/NotabeneAsset.md +36 -0
  103. package/docs/types/type-aliases/Ready.md +21 -0
  104. package/docs/types/type-aliases/ResizeRequest.md +27 -0
  105. package/docs/types/type-aliases/Source.md +15 -0
  106. package/docs/types/type-aliases/Theme.md +33 -0
  107. package/docs/types/type-aliases/TransactionAsset.md +15 -0
  108. package/docs/types/type-aliases/TravelAddress.md +37 -0
  109. package/docs/types/type-aliases/URI.md +15 -0
  110. package/docs/types/type-aliases/UUID.md +27 -0
  111. package/docs/types/type-aliases/UpdateValue.md +54 -0
  112. package/docs/types/type-aliases/V1Asset.md +36 -0
  113. package/docs/types/type-aliases/V1Transaction.md +49 -0
  114. package/docs/types/type-aliases/VASPOptions.md +25 -0
  115. package/docs/types/type-aliases/ValidationError.md +25 -0
  116. package/package.json +16 -14
  117. package/src/components/EmbeddedComponent.ts +1 -0
  118. package/src/notabene.ts +21 -21
  119. package/src/types.ts +1 -1
  120. package/dist/js/notabene.js +0 -1
package/dist/notabene.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var I=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>I(e,typeof t!="symbol"?t+"":t,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(c||{}),m=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(m||{}),u=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(u||{}),f=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(f||{}),h=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e))(h||{}),l=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(l||{}),E=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(E||{}),p=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP137_XPUB="xpub",e.ED25519="ed25519",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e))(p||{});class w{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const i=this.listeners.get(t);i&&(i.delete(r),i.size===0&&this.listeners.delete(t))}handleMessage(t){const r=t.data;if(typeof r=="object"&&r!==null&&"type"in r){const i=r.type,s=this.listeners.get(i);s&&s.forEach(n=>n(r))}}send(t){this.port&&this.port.postMessage(t)}}class v{constructor(t,r,i){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=t,this._value=r,this._options=i,this.eventManager=new w,this.on(h.INVALID,s=>{s.type===h.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(h.RESIZE,s=>{s.type===h.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 r=document.querySelector(t);if(!r)throw new Error(`parentID ${t} not found`);this.embed(r)}embed(t,r=!1){var i,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&embedded=true"),this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",t.appendChild(this.iframe),window.addEventListener("message",n=>{var a,d;n.source===((a=this.iframe)==null?void 0:a.contentWindow)&&((d=this.eventManager)==null||d.setPort(n.ports[0]))}),(s=(i=this.iframe)==null?void 0:i.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,r){return this.eventManager.on(t,r)}off(t,r){this.eventManager.off(t,r)}update(t,r){this._value=t,r&&(this._options=r),this.send({type:l.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,r)=>{let i,s;function n(){i&&i(),s&&s()}i=this.on(h.COMPLETE,a=>{t(a.response),n()}),s=this.on("error",a=>{r(new Error(a.message)),n()})})}openModal(){return 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),this.on(h.CANCEL,()=>{this.closeModal()}),this.on(h.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}}function b(e){return Object.entries(e).map(([t,r])=>{if(r==null)return;const i=encodeURIComponent(t),s=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${i}=${s}`}).filter(t=>t!==void 0).join("&")}function U(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((i,s)=>{const[n,a]=s.split("=");return n&&(i[decodeURIComponent(n)]=a?decodeURIComponent(a):""),i},{}):{}}class R{constructor(t){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(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,r,i,s){const n=new URL(this.uxUrl);n.pathname=t;const a=b({authToken:this.authToken,value:r,configuration:i});return n.hash=a,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),s&&(s.callback&&n.searchParams.set("callback_url",s.callback),s.redirectUri&&n.searchParams.set("redirect_uri",s.redirectUri)),n.toString()}createComponent(t,r,i,s){return new v(this.componentUrl(t,r,i,s),r,i)}createWithdrawalAssist(t,r,i){return this.createComponent("withdrawal-assist",t,r,i)}createConnectWallet(t,r,i){return this.createComponent("connect",t,r,i)}createDepositRequest(t,r,i){return this.createComponent("deposit-request",t,r,i)}}exports.AgentType=c;exports.CMType=h;exports.EmbeddedComponent=v;exports.HMType=l;exports.PersonType=m;exports.ProofStatus=E;exports.ProofTypes=p;exports.Status=u;exports.ValidationSections=f;exports.decodeFragmentToObject=U;exports.default=R;
1
+ "use strict";var g=Object.defineProperty;var I=(e,t,r)=>t in e?g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>I(e,typeof t!="symbol"?t+"":t,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(c||{}),m=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(m||{}),u=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(u||{}),f=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(f||{}),h=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e))(h||{}),l=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(l||{}),E=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(E||{}),p=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP137_XPUB="xpub",e.ED25519="ed25519",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e))(p||{});class w{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const i=this.listeners.get(t);i&&(i.delete(r),i.size===0&&this.listeners.delete(t))}handleMessage(t){const r=t.data;if(typeof r=="object"&&r!==null&&"type"in r){const i=r.type,s=this.listeners.get(i);s&&s.forEach(n=>n(r))}}send(t){this.port&&this.port.postMessage(t)}}class v{constructor(t,r,i){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=t,this._value=r,this._options=i,this.eventManager=new w,this.on(h.INVALID,s=>{s.type===h.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(h.RESIZE,s=>{s.type===h.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 r=document.querySelector(t);if(!r)throw new Error(`parentID ${t} not found`);this.embed(r)}embed(t,r=!1){var i,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write",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",n=>{var a,d;n.source===((a=this.iframe)==null?void 0:a.contentWindow)&&((d=this.eventManager)==null||d.setPort(n.ports[0]))}),(s=(i=this.iframe)==null?void 0:i.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,r){return this.eventManager.on(t,r)}off(t,r){this.eventManager.off(t,r)}update(t,r){this._value=t,r&&(this._options=r),this.send({type:l.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,r)=>{let i,s;function n(){i&&i(),s&&s()}i=this.on(h.COMPLETE,a=>{t(a.response),n()}),s=this.on("error",a=>{r(new Error(a.message)),n()})})}openModal(){return 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),this.on(h.CANCEL,()=>{this.closeModal()}),this.on(h.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}}function b(e){return Object.entries(e).map(([t,r])=>{if(r==null)return;const i=encodeURIComponent(t),s=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${i}=${s}`}).filter(t=>t!==void 0).join("&")}function U(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((i,s)=>{const[n,a]=s.split("=");return n&&(i[decodeURIComponent(n)]=a?decodeURIComponent(a):""),i},{}):{}}class R{constructor(t){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(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,r,i,s){const n=new URL(this.uxUrl);n.pathname=t;const a=b({authToken:this.authToken,value:r,configuration:i});return n.hash=a,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),s&&(s.callback&&n.searchParams.set("callback_url",s.callback),s.redirectUri&&n.searchParams.set("redirect_uri",s.redirectUri)),n.toString()}createComponent(t,r,i,s){return new v(this.componentUrl(t,r,i,s),r,i)}createWithdrawalAssist(t,r,i){return this.createComponent("withdrawal-assist",t,r,i)}createConnectWallet(t,r,i){return this.createComponent("connect",t,r,i)}createDepositRequest(t,r,i){return this.createComponent("deposit-request",t,r,i)}}exports.AgentType=c;exports.CMType=h;exports.EmbeddedComponent=v;exports.HMType=l;exports.PersonType=m;exports.ProofStatus=E;exports.ProofTypes=p;exports.Status=u;exports.ValidationSections=f;exports.decodeFragmentToObject=U;exports.default=R;