@notabene/javascript-sdk 2.0.0-next.19 → 2.0.0-next.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/notabene.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var v=(t,e,s)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>v(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(c||{}),m=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(m||{}),u=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(u||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(a||{}),l=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(l||{}),p=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(p||{}),f=(t=>(t.SelfDeclaration="self-declaration",t.PersonalSignEIP191="eip-191",t.SIWE="siwe",t.PersonalSignEIP712="eip-712",t.PersonalSignBIP137="bip-137",t.PersonalSignXPUB="xpub",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t))(f||{});class b{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,s){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s)}off(e,s){const r=this.listeners.get(e);r&&(r.delete(s),r.size===0&&this.listeners.delete(e))}handleMessage(e){const s=e.data;if(typeof s=="object"&&s!==null&&"type"in s){const r=s.type,i=this.listeners.get(r);i&&i.forEach(n=>n(s))}}send(e){this.port&&this.port.postMessage(e)}}class E{constructor(e,s,r){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=s,this._options=r,this.eventManager=new b,this.on(a.INVALID,i=>{i.type===a.INVALID&&(this._errors=i.errors,this._value=i.value)}),this.on(a.RESIZE,i=>{i.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${i.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 s=document.querySelector(e);if(!s)throw new Error(`parentID ${e} not found`);this.embed(s)}embed(e,s=!1){var r,i;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(s?"":"&embedded=true"),this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",e.appendChild(this.iframe),window.addEventListener("message",n=>{var h,d;n.source===((h=this.iframe)==null?void 0:h.contentWindow)&&((d=this.eventManager)==null||d.setPort(n.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,s){this.eventManager.on(e,s)}off(e,s){this.eventManager.off(e,s)}update(e,s){this._value=e,s&&(this._options=s),this.send({type:l.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,s)=>{this.on(a.COMPLETE,r=>{e(r.response)}),this.on("error",r=>{s(new Error(r.message))})})}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(a.CANCEL,()=>{this.closeModal()}),this.on(a.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}}function w(t){return Object.entries(t).map(([e,s])=>{if(!(e&&s))return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof s=="object"?JSON.stringify(s):s);return`${r}=${i}`}).filter(e=>!!e).join("&")}class I{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(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,s,r,i){const n=new URL(this.uxUrl);n.pathname=e;const h=w({authToken:this.authToken,value:s,configuration:r});return n.hash=h,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),i&&(i.callback&&n.searchParams.set("callback_url",i.callback),i.redirectUri&&n.searchParams.set("redirect_uri",i.redirectUri)),n.toString()}createComponent(e,s,r,i){return new E(this.componentUrl(e,s,r,i),s,r)}createWithdrawalAssist(e,s,r){return this.createComponent("withdrawal-assist",e,s,r)}createWalletAssist(e,s,r){return this.createComponent("wallet-assist",e,s,r)}createDepositAssist(e,s,r){return this.createComponent("deposit-assist",e,s,r)}createConnectWallet(e,s,r){return this.createComponent("connect",e,s,r)}createDepositRequest(e,s,r){return this.createComponent("deposit-request",e,s,r)}decodeFragmentToObject(e){return e.slice(1).split("&").reduce((r,i)=>{const[n,h]=i.split("=");return r[decodeURIComponent(n)]=decodeURIComponent(h),r},{})}}exports.AgentType=c;exports.CMType=a;exports.EmbeddedComponent=E;exports.HMType=l;exports.PersonType=m;exports.ProofStatus=p;exports.ProofTypes=f;exports.Status=u;exports.default=I;
1
+ "use strict";var g=Object.defineProperty;var v=(t,e,s)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>v(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(c||{}),m=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(m||{}),u=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(u||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(a||{}),l=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(l||{}),p=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(p||{}),f=(t=>(t.SelfDeclaration="self-declaration",t.PersonalSignEIP191="eip-191",t.SIWE="siwe",t.PersonalSignEIP712="eip-712",t.PersonalSignBIP137="bip-137",t.PersonalSignXPUB="xpub",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t))(f||{});class b{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,s){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s)}off(e,s){const r=this.listeners.get(e);r&&(r.delete(s),r.size===0&&this.listeners.delete(e))}handleMessage(e){const s=e.data;if(typeof s=="object"&&s!==null&&"type"in s){const r=s.type,i=this.listeners.get(r);i&&i.forEach(n=>n(s))}}send(e){this.port&&this.port.postMessage(e)}}class E{constructor(e,s,r){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=s,this._options=r,this.eventManager=new b,this.on(a.INVALID,i=>{i.type===a.INVALID&&(this._errors=i.errors,this._value=i.value)}),this.on(a.RESIZE,i=>{i.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${i.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 s=document.querySelector(e);if(!s)throw new Error(`parentID ${e} not found`);this.embed(s)}embed(e,s=!1){var r,i;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(s?"":"&embedded=true"),this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",e.appendChild(this.iframe),window.addEventListener("message",n=>{var h,d;n.source===((h=this.iframe)==null?void 0:h.contentWindow)&&((d=this.eventManager)==null||d.setPort(n.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,s){this.eventManager.on(e,s)}off(e,s){this.eventManager.off(e,s)}update(e,s){this._value=e,s&&(this._options=s),this.send({type:l.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,s)=>{this.on(a.COMPLETE,r=>{e(r.response)}),this.on("error",r=>{s(new Error(r.message))})})}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(a.CANCEL,()=>{this.closeModal()}),this.on(a.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}}function I(t){return Object.entries(t).map(([e,s])=>{if(!(e&&s))return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof s=="object"?JSON.stringify(s):s);return`${r}=${i}`}).filter(e=>!!e).join("&")}class w{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(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,s,r,i){const n=new URL(this.uxUrl);n.pathname=e;const h=I({authToken:this.authToken,value:s,configuration:r});return n.hash=h,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),i&&(i.callback&&n.searchParams.set("callback_url",i.callback),i.redirectUri&&n.searchParams.set("redirect_uri",i.redirectUri)),n.toString()}createComponent(e,s,r,i){return new E(this.componentUrl(e,s,r,i),s,r)}createWithdrawalAssist(e,s,r){return this.createComponent("withdrawal-assist",e,s,r)}createDepositAssist(e,s,r){return this.createComponent("deposit-assist",e,s,r)}createConnectWallet(e,s,r){return this.createComponent("connect",e,s,r)}createDepositRequest(e,s,r){return this.createComponent("deposit-request",e,s,r)}decodeFragmentToObject(e){return e.slice(1).split("&").reduce((r,i)=>{const[n,h]=i.split("=");return r[decodeURIComponent(n)]=decodeURIComponent(h),r},{})}}exports.AgentType=c;exports.CMType=a;exports.EmbeddedComponent=E;exports.HMType=l;exports.PersonType=m;exports.ProofStatus=p;exports.ProofTypes=f;exports.Status=u;exports.default=w;
@@ -940,16 +940,6 @@ declare class Notabene {
940
940
  * @returns A new EmbeddedComponent instance for withdrawal assistance
941
941
  */
942
942
  createWithdrawalAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Withdrawal, TransactionOptions>;
943
- /**
944
- * Creates a wallet assist component
945
- *
946
- * @param value - Withdrawal transaction data
947
- * @param options - Optional transaction options
948
- * @param callbacks - Optional callback configuration
949
- * @returns A new EmbeddedComponent instance for withdrawal assistance
950
- * @alpha
951
- */
952
- createWalletAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Withdrawal, TransactionOptions>;
953
943
  /**
954
944
  * Creates a deposit assist component
955
945
  *
@@ -1478,8 +1468,8 @@ export declare type V1Transaction = {
1478
1468
  originatorEqualsBeneficiary?: boolean;
1479
1469
  originatorVASPdid: DID;
1480
1470
  beneficiaryVASPdid: DID;
1481
- beneficiaryProof: OwnershipProof;
1482
- originator: Originator;
1471
+ beneficiaryProof?: OwnershipProof;
1472
+ originator?: Originator;
1483
1473
  beneficiary: Beneficiary;
1484
1474
  };
1485
1475
 
package/dist/notabene.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var c = Object.defineProperty;
2
2
  var m = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
3
  var o = (t, e, s) => m(t, typeof e != "symbol" ? e + "" : e, s);
4
- var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), f = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(f || {}), p = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(p || {}), a = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t))(a || {}), d = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), E = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(E || {}), g = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.SIWE = "siwe", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(g || {});
4
+ var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), f = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(f || {}), E = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(E || {}), a = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t))(a || {}), d = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), p = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(p || {}), g = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.SIWE = "siwe", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(g || {});
5
5
  class v {
6
6
  constructor() {
7
7
  o(this, "listeners", /* @__PURE__ */ new Map());
@@ -67,7 +67,7 @@ class v {
67
67
  this.port && this.port.postMessage(e);
68
68
  }
69
69
  }
70
- class w {
70
+ class I {
71
71
  /**
72
72
  * Creates an instance of EmbeddedComponent.
73
73
  * @param url - The URL of the embedded component
@@ -201,7 +201,7 @@ class w {
201
201
  this.modal && ((e = this.modal) == null || e.close(), this.modal.remove(), this.modal = void 0);
202
202
  }
203
203
  }
204
- function I(t) {
204
+ function w(t) {
205
205
  return Object.entries(t).map(([e, s]) => {
206
206
  if (!(e && s)) return;
207
207
  const r = encodeURIComponent(e), i = encodeURIComponent(
@@ -237,7 +237,7 @@ class b {
237
237
  componentUrl(e, s, r, i) {
238
238
  const n = new URL(this.uxUrl);
239
239
  n.pathname = e;
240
- const h = I({
240
+ const h = w({
241
241
  authToken: this.authToken,
242
242
  value: s,
243
243
  configuration: r
@@ -255,7 +255,7 @@ class b {
255
255
  * @internal
256
256
  */
257
257
  createComponent(e, s, r, i) {
258
- return new w(
258
+ return new I(
259
259
  this.componentUrl(e, s, r, i),
260
260
  s,
261
261
  r
@@ -277,23 +277,6 @@ class b {
277
277
  r
278
278
  );
279
279
  }
280
- /**
281
- * Creates a wallet assist component
282
- *
283
- * @param value - Withdrawal transaction data
284
- * @param options - Optional transaction options
285
- * @param callbacks - Optional callback configuration
286
- * @returns A new EmbeddedComponent instance for withdrawal assistance
287
- * @alpha
288
- */
289
- createWalletAssist(e, s, r) {
290
- return this.createComponent(
291
- "wallet-assist",
292
- e,
293
- s,
294
- r
295
- );
296
- }
297
280
  /**
298
281
  * Creates a deposit assist component
299
282
  *
@@ -364,11 +347,11 @@ class b {
364
347
  export {
365
348
  u as AgentType,
366
349
  a as CMType,
367
- w as EmbeddedComponent,
350
+ I as EmbeddedComponent,
368
351
  d as HMType,
369
352
  f as PersonType,
370
- E as ProofStatus,
353
+ p as ProofStatus,
371
354
  g as ProofTypes,
372
- p as Status,
355
+ E as Status,
373
356
  b as default
374
357
  };
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "author": "Notabene <developers@notabene.id>",
11
11
  "license": "MIT",
12
- "version": "2.0.0-next.19",
12
+ "version": "2.0.0-next.20",
13
13
  "source": "src/notabene.ts",
14
14
  "main": "dist/notabene.js",
15
15
  "types": "dist/notabene.d.ts",
package/src/notabene.ts CHANGED
@@ -269,28 +269,6 @@ export default class Notabene {
269
269
  );
270
270
  }
271
271
 
272
- /**
273
- * Creates a wallet assist component
274
- *
275
- * @param value - Withdrawal transaction data
276
- * @param options - Optional transaction options
277
- * @param callbacks - Optional callback configuration
278
- * @returns A new EmbeddedComponent instance for withdrawal assistance
279
- * @alpha
280
- */
281
- public createWalletAssist(
282
- value: Partial<Withdrawal>,
283
- options?: TransactionOptions,
284
- callbacks?: CallbackOptions,
285
- ) {
286
- return this.createComponent<Withdrawal, TransactionOptions>(
287
- 'wallet-assist',
288
- value,
289
- options,
290
- callbacks,
291
- );
292
- }
293
-
294
272
  /**
295
273
  * Creates a deposit assist component
296
274
  *
package/src/types.ts CHANGED
@@ -592,8 +592,8 @@ export type V1Transaction = {
592
592
  originatorEqualsBeneficiary?: boolean;
593
593
  originatorVASPdid: DID;
594
594
  beneficiaryVASPdid: DID;
595
- beneficiaryProof: OwnershipProof;
596
- originator: Originator;
595
+ beneficiaryProof?: OwnershipProof;
596
+ originator?: Originator;
597
597
  beneficiary: Beneficiary;
598
598
  };
599
599