@notabene/javascript-sdk 2.0.3 → 2.0.4-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.
Files changed (119) hide show
  1. package/README.md +28 -0
  2. package/dist/js/notabene.js +1 -0
  3. package/dist/notabene.cjs +1 -1
  4. package/dist/notabene.d.ts +30 -17
  5. package/dist/notabene.js +102 -70
  6. package/docs/README.md +28 -0
  7. package/docs/_media/TransactionOptions.md +6 -6
  8. package/docs/ivms/types/enumerations/PayloadVersionCode.md +2 -2
  9. package/docs/ivms/types/interfaces/PayloadMetadata.md +2 -2
  10. package/docs/ivms/types/type-aliases/Address.md +1 -1
  11. package/docs/ivms/types/type-aliases/AddressTypeCode.md +1 -1
  12. package/docs/ivms/types/type-aliases/Beneficiary.md +1 -1
  13. package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +1 -1
  14. package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +1 -1
  15. package/docs/ivms/types/type-aliases/ISOCountryCode.md +1 -1
  16. package/docs/ivms/types/type-aliases/ISODate.md +1 -1
  17. package/docs/ivms/types/type-aliases/IVMS101.md +1 -1
  18. package/docs/ivms/types/type-aliases/IntermediaryVASP.md +1 -1
  19. package/docs/ivms/types/type-aliases/LegalPerson.md +1 -1
  20. package/docs/ivms/types/type-aliases/LegalPersonName.md +1 -1
  21. package/docs/ivms/types/type-aliases/LegalPersonNameID.md +1 -1
  22. package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +1 -1
  23. package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +1 -1
  24. package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +1 -1
  25. package/docs/ivms/types/type-aliases/NationalIdentification.md +1 -1
  26. package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +1 -1
  27. package/docs/ivms/types/type-aliases/NaturalPerson.md +1 -1
  28. package/docs/ivms/types/type-aliases/NaturalPersonName.md +1 -1
  29. package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +1 -1
  30. package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +1 -1
  31. package/docs/ivms/types/type-aliases/OriginatingVASP.md +1 -1
  32. package/docs/ivms/types/type-aliases/Originator.md +1 -1
  33. package/docs/ivms/types/type-aliases/Person.md +1 -1
  34. package/docs/ivms/types/type-aliases/TransferPath.md +1 -1
  35. package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +1 -1
  36. package/docs/notabene/README.md +6 -6
  37. package/docs/notabene/classes/EmbeddedComponent.md +39 -16
  38. package/docs/notabene/classes/default.md +6 -6
  39. package/docs/notabene/functions/decodeFragmentToObject.md +1 -1
  40. package/docs/notabene/interfaces/NotabeneConfig.md +5 -5
  41. package/docs/notabene/type-aliases/MessageCallback.md +1 -1
  42. package/docs/types/README.md +1 -1
  43. package/docs/types/enumerations/AgentType.md +2 -2
  44. package/docs/types/enumerations/CMType.md +6 -17
  45. package/docs/types/enumerations/HMType.md +2 -2
  46. package/docs/types/enumerations/PersonType.md +3 -3
  47. package/docs/types/enumerations/ProofStatus.md +4 -4
  48. package/docs/types/enumerations/ProofTypes.md +12 -12
  49. package/docs/types/enumerations/Status.md +5 -5
  50. package/docs/types/enumerations/VASPSearchControl.md +34 -0
  51. package/docs/types/enumerations/ValidationSections.md +4 -4
  52. package/docs/types/interfaces/Agent.md +6 -6
  53. package/docs/types/interfaces/CallbackOptions.md +2 -2
  54. package/docs/types/interfaces/ComponentRequest.md +2 -2
  55. package/docs/types/interfaces/ComponentResponse.md +4 -4
  56. package/docs/types/interfaces/ConnectionRecord.md +7 -7
  57. package/docs/types/interfaces/ConnectionRequest.md +3 -3
  58. package/docs/types/interfaces/Counterparty.md +10 -10
  59. package/docs/types/interfaces/DeclarationProof.md +6 -6
  60. package/docs/types/interfaces/Deposit.md +9 -9
  61. package/docs/types/interfaces/DepositRequest.md +7 -7
  62. package/docs/types/interfaces/DepositRequestOptions.md +1 -1
  63. package/docs/types/interfaces/LegalPerson.md +13 -13
  64. package/docs/types/interfaces/MicroTransferProof.md +9 -9
  65. package/docs/types/interfaces/NaturalPerson.md +13 -13
  66. package/docs/types/interfaces/OwnershipProof.md +4 -4
  67. package/docs/types/interfaces/ScreenshotProof.md +5 -5
  68. package/docs/types/interfaces/SignatureProof.md +7 -7
  69. package/docs/types/interfaces/ThresholdOptions.md +3 -3
  70. package/docs/types/interfaces/Transaction.md +8 -8
  71. package/docs/types/interfaces/TransactionOptions.md +6 -6
  72. package/docs/types/interfaces/TransactionResponse.md +8 -8
  73. package/docs/types/interfaces/VASP.md +9 -9
  74. package/docs/types/interfaces/Wallet.md +8 -8
  75. package/docs/types/interfaces/Withdrawal.md +9 -9
  76. package/docs/types/type-aliases/BlockchainAddress.md +1 -1
  77. package/docs/types/type-aliases/CAIP10.md +1 -1
  78. package/docs/types/type-aliases/CAIP19.md +1 -1
  79. package/docs/types/type-aliases/CAIP2.md +1 -1
  80. package/docs/types/type-aliases/CAIP220.md +1 -1
  81. package/docs/types/type-aliases/Cancel.md +1 -1
  82. package/docs/types/type-aliases/Completed.md +1 -1
  83. package/docs/types/type-aliases/ComponentMessage.md +2 -4
  84. package/docs/types/type-aliases/ConnectionOptions.md +1 -1
  85. package/docs/types/type-aliases/CryptoCredential.md +1 -1
  86. package/docs/types/type-aliases/DID.md +1 -1
  87. package/docs/types/type-aliases/DTI.md +1 -1
  88. package/docs/types/type-aliases/Destination.md +1 -1
  89. package/docs/types/type-aliases/Error.md +17 -1
  90. package/docs/types/type-aliases/FieldOptions.md +1 -1
  91. package/docs/types/type-aliases/FieldTypes.md +1 -1
  92. package/docs/types/type-aliases/HostMessage.md +1 -1
  93. package/docs/types/type-aliases/ISOCurrency.md +1 -1
  94. package/docs/types/type-aliases/InvalidValue.md +1 -1
  95. package/docs/types/type-aliases/LEI.md +1 -1
  96. package/docs/types/type-aliases/LegalPersonFieldName.md +1 -1
  97. package/docs/types/type-aliases/LegalPersonFields.md +1 -1
  98. package/docs/types/type-aliases/NaturalPersonFieldName.md +1 -1
  99. package/docs/types/type-aliases/NaturalPersonFields.md +1 -1
  100. package/docs/types/type-aliases/NotabeneAsset.md +1 -1
  101. package/docs/types/type-aliases/ResizeRequest.md +1 -1
  102. package/docs/types/type-aliases/Source.md +1 -1
  103. package/docs/types/type-aliases/Theme.md +9 -9
  104. package/docs/types/type-aliases/TransactionAsset.md +1 -1
  105. package/docs/types/type-aliases/TravelAddress.md +1 -1
  106. package/docs/types/type-aliases/URI.md +1 -1
  107. package/docs/types/type-aliases/UUID.md +1 -1
  108. package/docs/types/type-aliases/UpdateValue.md +1 -1
  109. package/docs/types/type-aliases/V1Asset.md +1 -1
  110. package/docs/types/type-aliases/V1Transaction.md +1 -1
  111. package/docs/types/type-aliases/VASPOptions.md +5 -1
  112. package/docs/types/type-aliases/ValidationError.md +1 -1
  113. package/package.json +4 -5
  114. package/src/components/EmbeddedComponent.ts +48 -4
  115. package/src/notabene.ts +2 -2
  116. package/src/types.ts +22 -17
  117. package/src/utils/__tests__/MessageEventManager.test.ts +7 -7
  118. package/docs/types/type-aliases/Ready.md +0 -21
  119. package/src/components/__tests__/EmbeddedComponent.test.ts +0 -530
package/dist/notabene.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var c = Object.defineProperty;
2
- var m = (e, t, r) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var o = (e, t, r) => m(e, typeof t != "symbol" ? t + "" : t, r);
4
- var u = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(u || {}), E = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(E || {}), f = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(f || {}), p = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(p || {}), h = /* @__PURE__ */ ((e) => (e.COMPLETE = "complete", e.RESIZE = "resize", e.RESULT = "result", e.READY = "ready", e.INVALID = "invalid", e.ERROR = "error", e.CANCEL = "cancel", e))(h || {}), d = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(d || {}), v = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(v || {}), g = /* @__PURE__ */ ((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))(g || {});
2
+ var m = (t, e, r) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var o = (t, e, r) => m(t, typeof e != "symbol" ? e + "" : e, r);
4
+ var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), E = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(E || {}), f = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(f || {}), p = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(p || {}), v = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(v || {}), h = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t))(h || {}), d = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), g = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(g || {}), w = /* @__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.BIP137_XPUB = "xpub", t.ED25519 = "ed25519", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t.Connect = "connect", t))(w || {});
5
5
  class I {
6
6
  constructor() {
7
7
  o(this, "listeners", /* @__PURE__ */ new Map());
@@ -16,8 +16,8 @@ class I {
16
16
  *
17
17
  * @param port - The MessagePort instance to use for communication
18
18
  */
19
- setPort(t) {
20
- this.port = t, this.port.onmessage = this.handleMessage, this.port.start();
19
+ setPort(e) {
20
+ this.port = e, this.port.onmessage = this.handleMessage, this.port.start();
21
21
  }
22
22
  /**
23
23
  * Registers a callback for a specific message type.
@@ -29,8 +29,8 @@ class I {
29
29
  * @param callback - The callback function to execute when matching messages are received
30
30
 
31
31
  */
32
- on(t, r) {
33
- return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(r), () => this.off(t, r);
32
+ on(e, r) {
33
+ return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(r), () => this.off(e, r);
34
34
  }
35
35
  /**
36
36
  * Removes a callback for a specific message type.
@@ -41,9 +41,9 @@ class I {
41
41
  * @param messageType - The type of message to remove listener from
42
42
  * @param callback - The callback function to remove
43
43
  */
44
- off(t, r) {
45
- const i = this.listeners.get(t);
46
- i && (i.delete(r), i.size === 0 && this.listeners.delete(t));
44
+ off(e, r) {
45
+ const i = this.listeners.get(e);
46
+ i && (i.delete(r), i.size === 0 && this.listeners.delete(e));
47
47
  }
48
48
  /**
49
49
  * Internal message handler for processing received messages.
@@ -53,8 +53,8 @@ class I {
53
53
  *
54
54
  * @param event - The message event containing the component message
55
55
  */
56
- handleMessage(t) {
57
- const r = t.data;
56
+ handleMessage(e) {
57
+ const r = e.data;
58
58
  if (typeof r == "object" && r !== null && "type" in r) {
59
59
  const i = r.type, s = this.listeners.get(i);
60
60
  s && s.forEach((n) => n(r));
@@ -64,17 +64,17 @@ class I {
64
64
  * Sends a message through the message port
65
65
  * @param message The host message to send
66
66
  */
67
- send(t) {
68
- this.port && this.port.postMessage(t);
67
+ send(e) {
68
+ this.port && this.port.postMessage(e);
69
69
  }
70
70
  }
71
- class w {
71
+ class C {
72
72
  /**
73
73
  * Creates an instance of EmbeddedComponent.
74
74
  * @param url - The URL of the embedded component
75
75
  * @param value - The initial transaction value
76
76
  */
77
- constructor(t, r, i) {
77
+ constructor(e, r, i) {
78
78
  o(this, "_url");
79
79
  o(this, "_value");
80
80
  o(this, "_options");
@@ -82,7 +82,7 @@ class w {
82
82
  o(this, "iframe");
83
83
  o(this, "eventManager");
84
84
  o(this, "modal");
85
- this._url = t, this._value = r, this._options = i, this.eventManager = new I(), this.on(h.INVALID, (s) => {
85
+ this._url = e, this._value = r, this._options = i, this.eventManager = new I(), this.on(h.INVALID, (s) => {
86
86
  s.type === h.INVALID && (this._errors = s.errors, this._value = s.value);
87
87
  }), this.on(h.RESIZE, (s) => {
88
88
  s.type === h.RESIZE && this.iframe && (this.iframe.style.height = `${s.height}px`);
@@ -119,18 +119,18 @@ class w {
119
119
  * @param parentId - The ID of the parent element
120
120
  * @throws Will throw an error if the parent element is not found
121
121
  */
122
- mount(t) {
123
- const r = document.querySelector(t);
124
- if (!r) throw new Error(`parentID ${t} not found`);
122
+ mount(e) {
123
+ const r = document.querySelector(e);
124
+ if (!r) throw new Error(`parentID ${e} not found`);
125
125
  this.embed(r);
126
126
  }
127
127
  /**
128
128
  * Embeds the component into a parent element
129
129
  * @param parent - The parent element to embed the component into
130
130
  */
131
- embed(t, r = !1) {
131
+ embed(e, r = !1) {
132
132
  var i, s;
133
- 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) => {
133
+ this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (r ? "" : "&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", (n) => {
134
134
  var a, l;
135
135
  n.source === ((a = this.iframe) == null ? void 0 : a.contentWindow) && ((l = this.eventManager) == null || l.setPort(n.ports[0]));
136
136
  }), (s = (i = this.iframe) == null ? void 0 : i.contentWindow) == null || s.focus();
@@ -142,46 +142,48 @@ class w {
142
142
  * Sends a message to the embedded component
143
143
  * @param message - The message to send
144
144
  */
145
- send(t) {
146
- this.eventManager.send(t);
145
+ send(e) {
146
+ this.eventManager.send(e);
147
147
  }
148
148
  /**
149
149
  * Adds an event listener for a specific message type
150
150
  * @param messageType - The type of message to listen for
151
151
  * @param callback - The callback function to execute when the message is received
152
152
  */
153
- on(t, r) {
154
- return this.eventManager.on(t, r);
153
+ on(e, r) {
154
+ return this.eventManager.on(e, r);
155
155
  }
156
156
  /**
157
157
  * Removes an event listener for a specific message type
158
158
  * @param messageType - The type of message to stop listening for
159
159
  * @param callback - The callback function to remove
160
160
  */
161
- off(t, r) {
162
- this.eventManager.off(t, r);
161
+ off(e, r) {
162
+ this.eventManager.off(e, r);
163
163
  }
164
164
  /**
165
165
  * Updates the transaction value and sends an update message to the component
166
166
  * @param value - The new transaction value
167
167
  */
168
- update(t, r) {
169
- this._value = t, r && (this._options = r), this.send({ type: d.UPDATE, value: t, options: this._options });
168
+ update(e, r) {
169
+ this._value = e, r && (this._options = r), this.send({ type: d.UPDATE, value: e, options: this._options });
170
170
  }
171
171
  /**
172
172
  * Waits for the component to complete and returns the transaction response
173
173
  * @returns A promise that resolves with the transaction response
174
174
  */
175
175
  completion() {
176
- return new Promise((t, r) => {
177
- let i, s;
178
- function n() {
179
- i && i(), s && s();
176
+ return new Promise((e, r) => {
177
+ let i, s, n;
178
+ function a() {
179
+ i && i(), s && s(), n && n();
180
180
  }
181
- i = this.on(h.COMPLETE, (a) => {
182
- t(a.response), n();
183
- }), s = this.on("error", (a) => {
184
- r(new Error(a.message)), n();
181
+ i = this.on(h.COMPLETE, (l) => {
182
+ e(l.response), a();
183
+ }), s = this.on(h.CANCEL, () => {
184
+ r(new Error("User cancelled")), a();
185
+ }), n = this.on("error", (l) => {
186
+ r(new Error(l.message)), a();
185
187
  });
186
188
  });
187
189
  }
@@ -189,36 +191,65 @@ class w {
189
191
  * Opens the component in a modal dialog
190
192
  */
191
193
  openModal() {
192
- 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, () => {
194
+ 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);
195
+ const e = this.on(h.CANCEL, () => {
193
196
  this.closeModal();
194
- }), this.on(h.COMPLETE, () => {
197
+ }), r = this.on(h.COMPLETE, () => {
195
198
  this.closeModal();
196
- }), this.modal.showModal(), this.modal.addEventListener("click", () => {
199
+ });
200
+ return this.modal.showModal(), this.modal.addEventListener("click", () => {
197
201
  this.closeModal();
198
- }), this.completion();
202
+ }), this.completion().finally(() => {
203
+ e(), r();
204
+ });
199
205
  }
200
206
  /**
201
207
  * Closes the modal dialog
202
208
  *
203
209
  */
204
210
  closeModal() {
205
- var t;
206
- this.modal && ((t = this.modal) == null || t.close(), this.modal.remove(), this.modal = void 0);
211
+ var e;
212
+ this.modal && ((e = this.modal) == null || e.close(), this.modal.remove(), this.modal = void 0);
213
+ }
214
+ /**
215
+ * Opens the component in a popup window. This may be needed to support many self-hosted wallets
216
+ * @returns A promise that resolves with the transaction response
217
+ * @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#restrictions)
218
+ * @see [Cross-Origin-Opener-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy)
219
+ */
220
+ popup() {
221
+ const e = window.open(
222
+ this.url,
223
+ "_blank",
224
+ "popup=true,width=600,height=600"
225
+ );
226
+ window.addEventListener("message", (s) => {
227
+ var n;
228
+ s.source === e && (console.log("received message from popup", s.data), (n = this.eventManager) == null || n.setPort(s.ports[0]));
229
+ });
230
+ const r = this.on(h.CANCEL, () => {
231
+ e == null || e.close();
232
+ }), i = this.on(h.COMPLETE, () => {
233
+ e == null || e.close();
234
+ });
235
+ return this.completion().finally(() => {
236
+ r(), i();
237
+ });
207
238
  }
208
239
  }
209
- function U(e) {
210
- return Object.entries(e).map(([t, r]) => {
240
+ function U(t) {
241
+ return Object.entries(t).map(([e, r]) => {
211
242
  if (r == null) return;
212
- const i = encodeURIComponent(t), s = encodeURIComponent(
243
+ const i = encodeURIComponent(e), s = encodeURIComponent(
213
244
  typeof r == "object" ? JSON.stringify(r) : String(r)
214
245
  // Use String() to handle all primitive types
215
246
  );
216
247
  return `${i}=${s}`;
217
- }).filter((t) => t !== void 0).join("&");
248
+ }).filter((e) => e !== void 0).join("&");
218
249
  }
219
- function b(e) {
220
- const t = e.slice(1);
221
- return t ? t.split("&").filter(Boolean).reduce(
250
+ function b(t) {
251
+ const e = t.slice(1);
252
+ return e ? e.split("&").filter(Boolean).reduce(
222
253
  (i, s) => {
223
254
  const [n, a] = s.split("=");
224
255
  return n && (i[decodeURIComponent(n)] = a ? decodeURIComponent(a) : ""), i;
@@ -226,19 +257,19 @@ function b(e) {
226
257
  {}
227
258
  ) : {};
228
259
  }
229
- class A {
260
+ class N {
230
261
  /**
231
262
  * Creates a new instance of the Notabene SDK
232
263
  *
233
264
  * @param config - Configuration options for the Notabene SDK
234
265
  */
235
- constructor(t) {
266
+ constructor(e) {
236
267
  o(this, "nodeUrl");
237
268
  o(this, "authToken");
238
269
  o(this, "uxUrl");
239
270
  o(this, "theme");
240
271
  o(this, "locale");
241
- this.uxUrl = t.uxUrl || "https://connect.notabene.id", this.nodeUrl = t.nodeUrl, this.authToken = t.authToken, this.theme = t.theme, this.locale = t.locale;
272
+ this.uxUrl = e.uxUrl || "https://connect.notabene.id", this.nodeUrl = e.nodeUrl, this.authToken = e.authToken, this.theme = e.theme, this.locale = e.locale;
242
273
  }
243
274
  /**
244
275
  * Generates a URL for a Notabene component
@@ -250,9 +281,9 @@ class A {
250
281
  * @returns component URL
251
282
  * @internal
252
283
  */
253
- componentUrl(t, r, i, s) {
284
+ componentUrl(e, r, i, s) {
254
285
  const n = new URL(this.uxUrl);
255
- n.pathname = t;
286
+ n.pathname = e;
256
287
  const a = U({
257
288
  authToken: this.authToken,
258
289
  value: r,
@@ -270,9 +301,9 @@ class A {
270
301
  * @returns A new EmbeddedComponent instance
271
302
  * @internal
272
303
  */
273
- createComponent(t, r, i, s) {
274
- return new w(
275
- this.componentUrl(t, r, i, s),
304
+ createComponent(e, r, i, s) {
305
+ return new C(
306
+ this.componentUrl(e, r, i, s),
276
307
  r,
277
308
  i
278
309
  );
@@ -285,10 +316,10 @@ class A {
285
316
  * @param callbacks - Optional callback configuration
286
317
  * @returns A new EmbeddedComponent instance for withdrawal assistance
287
318
  */
288
- createWithdrawalAssist(t, r, i) {
319
+ createWithdrawalAssist(e, r, i) {
289
320
  return this.createComponent(
290
321
  "withdrawal-assist",
291
- t,
322
+ e,
292
323
  r,
293
324
  i
294
325
  );
@@ -302,10 +333,10 @@ class A {
302
333
  * @returns A new EmbeddedComponent instance for connection
303
334
  * @alpha
304
335
  */
305
- createConnectWallet(t, r, i) {
336
+ createConnectWallet(e, r, i) {
306
337
  return this.createComponent(
307
338
  "connect",
308
- t,
339
+ e,
309
340
  r,
310
341
  i
311
342
  );
@@ -319,10 +350,10 @@ class A {
319
350
  * @returns A new EmbeddedComponent instance for deposit requests
320
351
  * @public
321
352
  */
322
- createDepositRequest(t, r, i) {
353
+ createDepositRequest(e, r, i) {
323
354
  return this.createComponent(
324
355
  "deposit-request",
325
- t,
356
+ e,
326
357
  r,
327
358
  i
328
359
  );
@@ -331,13 +362,14 @@ class A {
331
362
  export {
332
363
  u as AgentType,
333
364
  h as CMType,
334
- w as EmbeddedComponent,
365
+ C as EmbeddedComponent,
335
366
  d as HMType,
336
367
  E as PersonType,
337
- v as ProofStatus,
338
- g as ProofTypes,
368
+ g as ProofStatus,
369
+ w as ProofTypes,
339
370
  f as Status,
340
- p as ValidationSections,
371
+ p as VASPSearchControl,
372
+ v as ValidationSections,
341
373
  b as decodeFragmentToObject,
342
- A as default
374
+ N as default
343
375
  };
package/docs/README.md CHANGED
@@ -211,6 +211,30 @@ try {
211
211
  }
212
212
  ```
213
213
 
214
+ ### Popup
215
+
216
+ All components support being opened in a popup window using `popup()`, which returns a promise.
217
+
218
+ Many embedded wallets refuse to work in an iframe. In this case it is better to use a popup window.
219
+
220
+ Unfortunately there are also some restrictions on popup windows:
221
+
222
+ - [Popup window Restrictions](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#restrictions)
223
+
224
+ * [Cross-Origin-Opener-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy)
225
+
226
+ ```js
227
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
228
+ try {
229
+ const { valid, value, txCreate, ivms101, proof } = await withdrawal.popup();
230
+ if (valid) {
231
+ // Submit result to your backend
232
+ }
233
+ } catch (e) {
234
+ console.error(e);
235
+ }
236
+ ```
237
+
214
238
  ### Linked Component
215
239
 
216
240
  In some cases, in particular institutional or mobile apps you may prefer to link your customers to the component through an email or redirect the user to it in a mobile app.
@@ -457,6 +481,10 @@ const options: TransactionOptions = {
457
481
  vasps: {
458
482
  addUnknown: true, // Allow users to add a missing VASP - Defaults to false
459
483
  onlyActive: true, // Only list active VASPs - Default false
484
+ searchable: [
485
+ VASPSearchControl.ALLOWED, // JS: 'allowed'
486
+ VASPSearchControl.PENDING // JS: 'pending'
487
+ ] // Control searches for VASPs - Defaults to undefined
460
488
  },
461
489
  hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
462
490
  },
@@ -16,7 +16,7 @@ Configuration options for Transaction components
16
16
 
17
17
  #### Defined in
18
18
 
19
- [types.ts:754](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L754)
19
+ [types.ts:768](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L768)
20
20
 
21
21
  ***
22
22
 
@@ -26,7 +26,7 @@ Configuration options for Transaction components
26
26
 
27
27
  #### Defined in
28
28
 
29
- [types.ts:755](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L755)
29
+ [types.ts:769](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L769)
30
30
 
31
31
  ***
32
32
 
@@ -36,7 +36,7 @@ Configuration options for Transaction components
36
36
 
37
37
  #### Defined in
38
38
 
39
- [types.ts:756](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L756)
39
+ [types.ts:770](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L770)
40
40
 
41
41
  ***
42
42
 
@@ -46,7 +46,7 @@ Configuration options for Transaction components
46
46
 
47
47
  #### Defined in
48
48
 
49
- [types.ts:758](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L758)
49
+ [types.ts:772](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L772)
50
50
 
51
51
  ***
52
52
 
@@ -80,7 +80,7 @@ Configuration options for Transaction components
80
80
 
81
81
  #### Defined in
82
82
 
83
- [types.ts:745](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L745)
83
+ [types.ts:759](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L759)
84
84
 
85
85
  ***
86
86
 
@@ -90,4 +90,4 @@ Configuration options for Transaction components
90
90
 
91
91
  #### Defined in
92
92
 
93
- [types.ts:757](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/types.ts#L757)
93
+ [types.ts:771](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/types.ts#L771)
@@ -18,7 +18,7 @@ Published May 2020
18
18
 
19
19
  #### Defined in
20
20
 
21
- [ivms/types.ts:365](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L365)
21
+ [ivms/types.ts:365](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L365)
22
22
 
23
23
  ***
24
24
 
@@ -30,4 +30,4 @@ Published August 2023
30
30
 
31
31
  #### Defined in
32
32
 
33
- [ivms/types.ts:367](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L367)
33
+ [ivms/types.ts:367](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L367)
@@ -19,7 +19,7 @@ The version of IVMS 101 to which the payload complies.
19
19
 
20
20
  #### Defined in
21
21
 
22
- [ivms/types.ts:358](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L358)
22
+ [ivms/types.ts:358](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L358)
23
23
 
24
24
  ***
25
25
 
@@ -31,4 +31,4 @@ The method used to map from a national system of writing to Latin script.
31
31
 
32
32
  #### Defined in
33
33
 
34
- [ivms/types.ts:356](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L356)
34
+ [ivms/types.ts:356](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L356)
@@ -111,4 +111,4 @@ Name of a built-up area, with defined boundaries, and a local government.
111
111
 
112
112
  ## Defined in
113
113
 
114
- [ivms/types.ts:119](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L119)
114
+ [ivms/types.ts:119](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L119)
@@ -13,4 +13,4 @@ Specifies the type of address
13
13
 
14
14
  ## Defined in
15
15
 
16
- [ivms/types.ts:44](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L44)
16
+ [ivms/types.ts:44](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L44)
@@ -27,4 +27,4 @@ Array of persons associated with the beneficiary
27
27
 
28
28
  ## Defined in
29
29
 
30
- [ivms/types.ts:313](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L313)
30
+ [ivms/types.ts:313](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L313)
@@ -21,4 +21,4 @@ The beneficiary VASP information
21
21
 
22
22
  ## Defined in
23
23
 
24
- [ivms/types.ts:335](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L335)
24
+ [ivms/types.ts:335](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L335)
@@ -27,4 +27,4 @@ Place of birth (max 70 characters)
27
27
 
28
28
  ## Defined in
29
29
 
30
- [ivms/types.ts:107](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L107)
30
+ [ivms/types.ts:107](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L107)
@@ -19,4 +19,4 @@ ISO-3166 Alpha-2 country code
19
19
 
20
20
  ## Defined in
21
21
 
22
- [ivms/types.ts:6](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L6)
22
+ [ivms/types.ts:6](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L6)
@@ -20,4 +20,4 @@ Format: YYYY-MM-DD
20
20
 
21
21
  ## Defined in
22
22
 
23
- [ivms/types.ts:14](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L14)
23
+ [ivms/types.ts:14](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L14)
@@ -38,4 +38,4 @@ IVMS101 definition
38
38
 
39
39
  ## Defined in
40
40
 
41
- [ivms/types.ts:375](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L375)
41
+ [ivms/types.ts:375](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L375)
@@ -27,4 +27,4 @@ The sequence number of this VASP in the transfer path
27
27
 
28
28
  ## Defined in
29
29
 
30
- [ivms/types.ts:289](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L289)
30
+ [ivms/types.ts:289](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L289)
@@ -45,4 +45,4 @@ A distinct identifier used by governments to uniquely identify a legal person
45
45
 
46
46
  ## Defined in
47
47
 
48
- [ivms/types.ts:259](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L259)
48
+ [ivms/types.ts:259](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L259)
@@ -33,4 +33,4 @@ Array of phonetic name identifiers
33
33
 
34
34
  ## Defined in
35
35
 
36
- [ivms/types.ts:245](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L245)
36
+ [ivms/types.ts:245](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L245)
@@ -27,4 +27,4 @@ The nature of the name specified
27
27
 
28
28
  ## Defined in
29
29
 
30
- [ivms/types.ts:233](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L233)
30
+ [ivms/types.ts:233](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L233)
@@ -13,4 +13,4 @@ Specifies the type of name for a legal person
13
13
 
14
14
  ## Defined in
15
15
 
16
- [ivms/types.ts:34](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L34)
16
+ [ivms/types.ts:34](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L34)
@@ -27,4 +27,4 @@ Type of legal person name identifier
27
27
 
28
28
  ## Defined in
29
29
 
30
- [ivms/types.ts:221](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L221)
30
+ [ivms/types.ts:221](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L221)
@@ -33,4 +33,4 @@ Secondary identifier, maximum 100 characters in local format
33
33
 
34
34
  ## Defined in
35
35
 
36
- [ivms/types.ts:159](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L159)
36
+ [ivms/types.ts:159](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L159)
@@ -39,4 +39,4 @@ Registration authority (format: RA followed by 6 digits)
39
39
 
40
40
  ## Defined in
41
41
 
42
- [ivms/types.ts:91](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L91)
42
+ [ivms/types.ts:91](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L91)
@@ -13,4 +13,4 @@ Specifies the type of national identifier
13
13
 
14
14
  ## Defined in
15
15
 
16
- [ivms/types.ts:54](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L54)
16
+ [ivms/types.ts:54](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L54)
@@ -51,4 +51,4 @@ A distinct identifier used by governments to uniquely identify a natural person
51
51
 
52
52
  ## Defined in
53
53
 
54
- [ivms/types.ts:201](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L201)
54
+ [ivms/types.ts:201](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L201)
@@ -33,4 +33,4 @@ Array of phonetic name identifiers
33
33
 
34
34
  ## Defined in
35
35
 
36
- [ivms/types.ts:187](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L187)
36
+ [ivms/types.ts:187](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L187)
@@ -33,4 +33,4 @@ Secondary identifier, maximum 100 characters
33
33
 
34
34
  ## Defined in
35
35
 
36
- [ivms/types.ts:173](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/675e0bac9f2136d1cf47e6f5980760f80d3d1995/src/ivms/types.ts#L173)
36
+ [ivms/types.ts:173](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/f4e73b4e984837ed8a53f91590a8d1276a1aa25a/src/ivms/types.ts#L173)