@notabene/javascript-sdk 2.14.0-next.4 → 2.14.1-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.
@@ -1,8 +1,8 @@
1
- var C = Object.defineProperty;
2
- var R = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var c = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n);
4
- var S = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(S || {}), g = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(g || {}), _ = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(_ || {}), O = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(O || {}), T = /* @__PURE__ */ ((e) => (e.SMS = "sms", e.EMAIL = "email", e))(T || {}), D = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.APPROVED = "approved", e.FAILED = "failed", e.EXPIRED = "expired", e.MAX_ATTEMPTS_REACHED = "max_attempts_reached", e.UNREACHABLE = "unreachable", e))(D || {}), U = /* @__PURE__ */ ((e) => (e.COINBASE = "coinbase", e))(U || {}), x = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(x || {}), l = /* @__PURE__ */ ((e) => (e.COMPLETE = "complete", e.RESIZE = "resize", e.RESULT = "result", e.READY = "ready", e.INVALID = "invalid", e.ERROR = "error", e.CANCEL = "cancel", e.WARNING = "warning", e.INFO = "info", e))(l || {}), M = /* @__PURE__ */ ((e) => (e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", e.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", e.TOKEN_INVALID = "TOKEN_INVALID", e))(M || {}), V = /* @__PURE__ */ ((e) => (e.WALLET_ADDRESS_NOT_CONNECTED = "WALLET_ADDRESS_NOT_CONNECTED", e.WALLET_LOCKED = "WALLET_LOCKED", e.WALLET_UNREACHABLE = "WALLET_UNREACHABLE", e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE = "JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE", e.IDV_UNAVAILABLE = "IDV_UNAVAILABLE", e))(V || {}), y = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(y || {}), B = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(B || {}), W = /* @__PURE__ */ ((e) => (e.SelfDeclaration = "self-declaration", e.SIWE = "siwe", e.SIWX = "siwx", e.SOL_SIWX = "sol-siwx", e.EIP191 = "eip-191", e.EIP712 = "eip-712", e.EIP1271 = "eip-1271", e.BIP137 = "bip-137", e.BIP322 = "bip-322", e.BIP137_XPUB = "xpub", e.TIP191 = "tip-191", e.ED25519 = "ed25519", e.XRP_ED25519 = "xrp-ed25519", e.XLM_ED25519 = "xlm-ed25519", e.CIP8 = "cip-8", e.COSMOS = "cosmos-ecdsa", e.MicroTransfer = "microtransfer", e.Screenshot = "screenshot", e.Connect = "connect", e.CONCORDIUM = "concordium", e))(W || {});
5
- class k {
1
+ var D = Object.defineProperty;
2
+ var U = (e, t, r) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var c = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
4
+ var x = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(x || {}), p = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(p || {}), M = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(M || {}), V = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(V || {}), W = /* @__PURE__ */ ((e) => (e.SMS = "sms", e.EMAIL = "email", e))(W || {}), k = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.APPROVED = "approved", e.FAILED = "failed", e.EXPIRED = "expired", e.MAX_ATTEMPTS_REACHED = "max_attempts_reached", e.UNREACHABLE = "unreachable", e))(k || {}), B = /* @__PURE__ */ ((e) => (e.COINBASE = "coinbase", e))(B || {}), F = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(F || {}), u = /* @__PURE__ */ ((e) => (e.COMPLETE = "complete", e.RESIZE = "resize", e.RESULT = "result", e.READY = "ready", e.INVALID = "invalid", e.ERROR = "error", e.CANCEL = "cancel", e.WARNING = "warning", e.INFO = "info", e))(u || {}), J = /* @__PURE__ */ ((e) => (e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", e.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", e.TOKEN_INVALID = "TOKEN_INVALID", e))(J || {}), $ = /* @__PURE__ */ ((e) => (e.WALLET_ADDRESS_NOT_CONNECTED = "WALLET_ADDRESS_NOT_CONNECTED", e.WALLET_LOCKED = "WALLET_LOCKED", e.WALLET_UNREACHABLE = "WALLET_UNREACHABLE", e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE = "JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE", e.IDV_UNAVAILABLE = "IDV_UNAVAILABLE", e))($ || {}), S = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(S || {}), j = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(j || {}), G = /* @__PURE__ */ ((e) => (e.SelfDeclaration = "self-declaration", e.SIWE = "siwe", e.SIWX = "siwx", e.SOL_SIWX = "sol-siwx", e.EIP191 = "eip-191", e.EIP712 = "eip-712", e.EIP1271 = "eip-1271", e.BIP137 = "bip-137", e.BIP322 = "bip-322", e.TIP191 = "tip-191", e.ED25519 = "ed25519", e.XRP_ED25519 = "xrp-ed25519", e.XLM_ED25519 = "xlm-ed25519", e.CIP8 = "cip-8", e.COSMOS = "cosmos-ecdsa", e.MicroTransfer = "microtransfer", e.Screenshot = "screenshot", e.Connect = "connect", e.CONCORDIUM = "concordium", e))(G || {});
5
+ class q {
6
6
  constructor() {
7
7
  c(this, "listeners", /* @__PURE__ */ new Map());
8
8
  c(this, "port");
@@ -29,8 +29,8 @@ class k {
29
29
  * @param callback - The callback function to execute when matching messages are received
30
30
 
31
31
  */
32
- on(t, n) {
33
- return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(n), () => this.off(t, n);
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);
34
34
  }
35
35
  /**
36
36
  * Removes a callback for a specific message type.
@@ -41,9 +41,9 @@ class k {
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, n) {
45
- const r = this.listeners.get(t);
46
- r && (r.delete(n), r.size === 0 && this.listeners.delete(t));
44
+ off(t, r) {
45
+ const n = this.listeners.get(t);
46
+ n && (n.delete(r), n.size === 0 && this.listeners.delete(t));
47
47
  }
48
48
  /**
49
49
  * Internal message handler for processing received messages.
@@ -54,10 +54,10 @@ class k {
54
54
  * @param event - The message event containing the component message
55
55
  */
56
56
  handleMessage(t) {
57
- const n = t.data;
58
- if (typeof n == "object" && n !== null && "type" in n) {
59
- const r = n.type, o = this.listeners.get(r);
60
- o && o.forEach((i) => i(n));
57
+ const r = t.data;
58
+ if (typeof r == "object" && r !== null && "type" in r) {
59
+ const n = r.type, i = this.listeners.get(n);
60
+ i && i.forEach((o) => o(r));
61
61
  }
62
62
  }
63
63
  /**
@@ -68,13 +68,13 @@ class k {
68
68
  this.port && this.port.postMessage(t);
69
69
  }
70
70
  }
71
- class J {
71
+ class K {
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, n, r) {
77
+ constructor(t, r, n) {
78
78
  c(this, "_url");
79
79
  c(this, "_value");
80
80
  c(this, "_options");
@@ -82,10 +82,10 @@ class J {
82
82
  c(this, "iframe");
83
83
  c(this, "eventManager");
84
84
  c(this, "modal");
85
- this._url = t, this._value = n, this._options = r, this.eventManager = new k(), this.on(l.INVALID, (o) => {
86
- o.type === l.INVALID && (this._errors = o.errors, this._value = o.value);
87
- }), this.on(l.RESIZE, (o) => {
88
- o.type === l.RESIZE && this.iframe && (this.iframe.style.height = `${o.height}px`);
85
+ this._url = t, this._value = r, this._options = n, this.eventManager = new q(), this.on(u.INVALID, (i) => {
86
+ i.type === u.INVALID && (this._errors = i.errors, this._value = i.value);
87
+ }), this.on(u.RESIZE, (i) => {
88
+ i.type === u.RESIZE && this.iframe && (this.iframe.style.height = `${i.height}px`);
89
89
  });
90
90
  }
91
91
  /**
@@ -120,20 +120,20 @@ class J {
120
120
  * @throws Will throw an error if the parent element is not found
121
121
  */
122
122
  mount(t) {
123
- const n = document.querySelector(t);
124
- if (!n) throw new Error(`parentID ${t} not found`);
125
- this.embed(n);
123
+ const r = document.querySelector(t);
124
+ if (!r) throw new Error(`parentID ${t} not found`);
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, n = !1) {
132
- var r, o;
133
- this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (n ? "" : "&embedded=true"), this.iframe.allow = "web-share; clipboard-write; hid; bluetooth;", this.iframe.style.width = "100%", this.iframe.style.height = "0px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", this.iframe.scrolling = "no", t.appendChild(this.iframe), window.addEventListener("message", (i) => {
131
+ embed(t, r = !1) {
132
+ var n, i;
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", t.appendChild(this.iframe), window.addEventListener("message", (o) => {
134
134
  var s, a;
135
- i.source === ((s = this.iframe) == null ? void 0 : s.contentWindow) && ((a = this.eventManager) == null || a.setPort(i.ports[0]));
136
- }), (o = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || o.focus();
135
+ o.source === ((s = this.iframe) == null ? void 0 : s.contentWindow) && ((a = this.eventManager) == null || a.setPort(o.ports[0]));
136
+ }), (i = (n = this.iframe) == null ? void 0 : n.contentWindow) == null || i.focus();
137
137
  }
138
138
  removeEmbed() {
139
139
  this.iframe && this.iframe.remove();
@@ -150,40 +150,40 @@ class J {
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, n) {
154
- return this.eventManager.on(t, n);
153
+ on(t, r) {
154
+ return this.eventManager.on(t, 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, n) {
162
- this.eventManager.off(t, n);
161
+ off(t, r) {
162
+ this.eventManager.off(t, 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, n) {
169
- this._value = t, n && (this._options = n), this.send({ type: y.UPDATE, value: t, options: this._options });
168
+ update(t, r) {
169
+ this._value = t, r && (this._options = r), this.send({ type: S.UPDATE, value: t, 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, n) => {
177
- let r, o, i;
176
+ return new Promise((t, r) => {
177
+ let n, i, o;
178
178
  function s() {
179
- r && r(), o && o(), i && i();
179
+ n && n(), i && i(), o && o();
180
180
  }
181
- r = this.on(l.COMPLETE, (a) => {
181
+ n = this.on(u.COMPLETE, (a) => {
182
182
  t(a.response), s();
183
- }), o = this.on(l.CANCEL, () => {
184
- n(new Error("User cancelled")), s();
185
- }), i = this.on("error", (a) => {
186
- n(new Error(a.message)), s();
183
+ }), i = this.on(u.CANCEL, () => {
184
+ r(new Error("User cancelled")), s();
185
+ }), o = this.on("error", (a) => {
186
+ r(new Error(a.message)), s();
187
187
  });
188
188
  });
189
189
  }
@@ -192,15 +192,15 @@ class J {
192
192
  */
193
193
  async openModal() {
194
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 t = this.on(l.CANCEL, () => {
195
+ const t = this.on(u.CANCEL, () => {
196
196
  this.closeModal();
197
- }), n = this.on(l.COMPLETE, () => {
197
+ }), r = this.on(u.COMPLETE, () => {
198
198
  this.closeModal();
199
199
  });
200
200
  return this.modal.showModal(), this.modal.addEventListener("click", () => {
201
201
  this.closeModal();
202
202
  }), this.completion().finally(() => {
203
- t(), n();
203
+ t(), r();
204
204
  });
205
205
  }
206
206
  /**
@@ -223,84 +223,84 @@ class J {
223
223
  "_blank",
224
224
  "popup=true,width=600,height=600"
225
225
  );
226
- window.addEventListener("message", (o) => {
227
- var i;
228
- o.source === t && (console.log("received message from popup", o.data), (i = this.eventManager) == null || i.setPort(o.ports[0]));
226
+ window.addEventListener("message", (i) => {
227
+ var o;
228
+ i.source === t && (console.log("received message from popup", i.data), (o = this.eventManager) == null || o.setPort(i.ports[0]));
229
229
  });
230
- const n = this.on(l.CANCEL, () => {
230
+ const r = this.on(u.CANCEL, () => {
231
231
  t == null || t.close();
232
- }), r = this.on(l.COMPLETE, () => {
232
+ }), n = this.on(u.COMPLETE, () => {
233
233
  t == null || t.close();
234
234
  });
235
235
  return this.completion().finally(() => {
236
- n(), r();
236
+ r(), n();
237
237
  });
238
238
  }
239
239
  }
240
- function F(e) {
241
- return Object.entries(e).map(([t, n]) => {
242
- if (n == null) return;
243
- const r = encodeURIComponent(t), o = encodeURIComponent(
244
- typeof n == "object" ? JSON.stringify(n) : String(n)
240
+ function H(e) {
241
+ return Object.entries(e).map(([t, r]) => {
242
+ if (r == null) return;
243
+ const n = encodeURIComponent(t), i = encodeURIComponent(
244
+ typeof r == "object" ? JSON.stringify(r) : String(r)
245
245
  // Use String() to handle all primitive types
246
246
  );
247
- return `${r}=${o}`;
247
+ return `${n}=${i}`;
248
248
  }).filter((t) => t !== void 0).join("&");
249
249
  }
250
- function oe(e) {
250
+ function de(e) {
251
251
  const t = e.slice(1);
252
252
  return t ? t.split("&").filter(Boolean).reduce(
253
- (r, o) => {
254
- const [i, s] = o.split("=");
255
- return i && (r[decodeURIComponent(i)] = s ? decodeURIComponent(s) : ""), r;
253
+ (n, i) => {
254
+ const [o, s] = i.split("=");
255
+ return o && (n[decodeURIComponent(o)] = s ? decodeURIComponent(s) : ""), n;
256
256
  },
257
257
  {}
258
258
  ) : {};
259
259
  }
260
260
  new TextEncoder();
261
- const f = new TextDecoder();
262
- function j(e) {
261
+ const b = new TextDecoder();
262
+ function X(e) {
263
263
  if (Uint8Array.fromBase64)
264
264
  return Uint8Array.fromBase64(e);
265
- const t = atob(e), n = new Uint8Array(t.length);
266
- for (let r = 0; r < t.length; r++)
267
- n[r] = t.charCodeAt(r);
268
- return n;
265
+ const t = atob(e), r = new Uint8Array(t.length);
266
+ for (let n = 0; n < t.length; n++)
267
+ r[n] = t.charCodeAt(n);
268
+ return r;
269
269
  }
270
- function G(e) {
270
+ function z(e) {
271
271
  if (Uint8Array.fromBase64)
272
- return Uint8Array.fromBase64(typeof e == "string" ? e : f.decode(e), {
272
+ return Uint8Array.fromBase64(typeof e == "string" ? e : b.decode(e), {
273
273
  alphabet: "base64url"
274
274
  });
275
275
  let t = e;
276
- t instanceof Uint8Array && (t = f.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
276
+ t instanceof Uint8Array && (t = b.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
277
277
  try {
278
- return j(t);
278
+ return X(t);
279
279
  } catch {
280
280
  throw new TypeError("The input to be decoded is not correctly encoded.");
281
281
  }
282
282
  }
283
- class N extends Error {
284
- constructor(n, r) {
285
- var o;
286
- super(n, r);
283
+ class R extends Error {
284
+ constructor(r, n) {
285
+ var i;
286
+ super(r, n);
287
287
  c(this, "code", "ERR_JOSE_GENERIC");
288
- this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
288
+ this.name = this.constructor.name, (i = Error.captureStackTrace) == null || i.call(Error, this, this.constructor);
289
289
  }
290
290
  }
291
- c(N, "code", "ERR_JOSE_GENERIC");
292
- class u extends N {
291
+ c(R, "code", "ERR_JOSE_GENERIC");
292
+ class h extends R {
293
293
  constructor() {
294
294
  super(...arguments);
295
295
  c(this, "code", "ERR_JWT_INVALID");
296
296
  }
297
297
  }
298
- c(u, "code", "ERR_JWT_INVALID");
299
- function $(e) {
298
+ c(h, "code", "ERR_JWT_INVALID");
299
+ function Y(e) {
300
300
  return typeof e == "object" && e !== null;
301
301
  }
302
- const q = (e) => {
303
- if (!$(e) || Object.prototype.toString.call(e) !== "[object Object]")
302
+ const Q = (e) => {
303
+ if (!Y(e) || Object.prototype.toString.call(e) !== "[object Object]")
304
304
  return !1;
305
305
  if (Object.getPrototypeOf(e) === null)
306
306
  return !0;
@@ -309,33 +309,39 @@ const q = (e) => {
309
309
  t = Object.getPrototypeOf(t);
310
310
  return Object.getPrototypeOf(e) === t;
311
311
  };
312
- function K(e) {
312
+ function Z(e) {
313
313
  if (typeof e != "string")
314
- throw new u("JWTs must use Compact JWS serialization, JWT must be a string");
315
- const { 1: t, length: n } = e.split(".");
316
- if (n === 5)
317
- throw new u("Only JWTs using Compact JWS serialization can be decoded");
318
- if (n !== 3)
319
- throw new u("Invalid JWT");
314
+ throw new h("JWTs must use Compact JWS serialization, JWT must be a string");
315
+ const { 1: t, length: r } = e.split(".");
316
+ if (r === 5)
317
+ throw new h("Only JWTs using Compact JWS serialization can be decoded");
318
+ if (r !== 3)
319
+ throw new h("Invalid JWT");
320
320
  if (!t)
321
- throw new u("JWTs must contain a payload");
322
- let r;
321
+ throw new h("JWTs must contain a payload");
322
+ let n;
323
323
  try {
324
- r = G(t);
324
+ n = z(t);
325
325
  } catch {
326
- throw new u("Failed to base64url decode the payload");
326
+ throw new h("Failed to base64url decode the payload");
327
327
  }
328
- let o;
328
+ let i;
329
329
  try {
330
- o = JSON.parse(f.decode(r));
330
+ i = JSON.parse(b.decode(n));
331
331
  } catch {
332
- throw new u("Failed to parse the decoded payload as JSON");
332
+ throw new h("Failed to parse the decoded payload as JSON");
333
333
  }
334
- if (!q(o))
335
- throw new u("Invalid JWT Claims Set");
336
- return o;
334
+ if (!Q(i))
335
+ throw new h("Invalid JWT Claims Set");
336
+ return i;
337
+ }
338
+ function N(e) {
339
+ return "source" in e && e.source !== void 0;
337
340
  }
338
- function E(e, t) {
341
+ function E(e) {
342
+ return !N(e);
343
+ }
344
+ function g(e, t) {
339
345
  if (t != null && t.email)
340
346
  return `did:email:${t.email}`;
341
347
  if (t != null && t.name)
@@ -344,27 +350,27 @@ function E(e, t) {
344
350
  `Unable to generate ${e} ID: missing required ${e} information`
345
351
  );
346
352
  }
347
- function H(e) {
348
- const { nameIdentifier: t, ...n } = e;
353
+ function ee(e) {
354
+ const { nameIdentifier: t, ...r } = e;
349
355
  return {
350
- ...n,
351
- nameIdentifier: t == null ? void 0 : t.map(({ nameIdentifierType: r, ...o }) => ({
352
- ...o,
353
- naturalPersonNameIdentifierType: r
356
+ ...r,
357
+ nameIdentifier: t == null ? void 0 : t.map(({ nameIdentifierType: n, ...i }) => ({
358
+ ...i,
359
+ naturalPersonNameIdentifierType: n
354
360
  }))
355
361
  };
356
362
  }
357
- function X(e, t) {
363
+ function L(e, t) {
358
364
  return {
359
365
  naturalPerson: e.naturalPerson ? {
360
366
  ...e.naturalPerson,
361
- name: H(e.naturalPerson.name)
367
+ name: ee(e.naturalPerson.name)
362
368
  } : void 0,
363
369
  legalPerson: e.legalPerson,
364
370
  accountNumber: [t]
365
371
  };
366
372
  }
367
- const p = [
373
+ const I = [
368
374
  {
369
375
  addressType: "GEOG",
370
376
  addressLine: ["1234 Main Street"],
@@ -372,62 +378,62 @@ const p = [
372
378
  country: "US"
373
379
  }
374
380
  ];
375
- function z(e) {
381
+ function te(e) {
376
382
  const t = e.trim();
377
383
  if (!t)
378
384
  return { primaryIdentifier: "", secondaryIdentifier: "" };
379
- const n = t.split(/\s+/), r = n[n.length - 1], o = n.slice(0, -1), i = o.length > 0 ? o.join(" ") : r;
380
- return { primaryIdentifier: r, secondaryIdentifier: i };
381
- }
382
- function Y(e, t, n = ["1234567890"]) {
383
- const r = t == null ? void 0 : t.map((o) => {
384
- const i = { ...o };
385
- return i.naturalPerson && (i.naturalPerson = {
386
- ...i.naturalPerson,
387
- geographicAddress: p
388
- }), i.legalPerson && (i.legalPerson = {
389
- ...i.legalPerson,
390
- geographicAddress: p
391
- }), i;
385
+ const r = t.split(/\s+/), n = r[r.length - 1], i = r.slice(0, -1), o = i.length > 0 ? i.join(" ") : n;
386
+ return { primaryIdentifier: n, secondaryIdentifier: o };
387
+ }
388
+ function re(e, t, r = ["1234567890"]) {
389
+ const n = t == null ? void 0 : t.map((i) => {
390
+ const o = { ...i };
391
+ return o.naturalPerson && (o.naturalPerson = {
392
+ ...o.naturalPerson,
393
+ geographicAddress: I
394
+ }), o.legalPerson && (o.legalPerson = {
395
+ ...o.legalPerson,
396
+ geographicAddress: I
397
+ }), o;
392
398
  });
393
- return e === "originator" ? { originatorPersons: r, accountNumber: n } : { beneficiaryPersons: r, accountNumber: n };
399
+ return e === "originator" ? { originatorPersons: n, accountNumber: r } : { beneficiaryPersons: n, accountNumber: r };
394
400
  }
395
- function Q(e, t = "John Doe") {
396
- const { primaryIdentifier: n, secondaryIdentifier: r } = z(t), o = {
401
+ function ne(e, t = "John Doe") {
402
+ const { primaryIdentifier: r, secondaryIdentifier: n } = te(t), i = {
397
403
  naturalPerson: {
398
404
  name: [
399
405
  {
400
406
  nameIdentifier: [
401
407
  {
402
- primaryIdentifier: n,
403
- ...r ? { secondaryIdentifier: r } : {},
408
+ primaryIdentifier: r,
409
+ ...n ? { secondaryIdentifier: n } : {},
404
410
  nameIdentifierType: "LEGL"
405
411
  }
406
412
  ]
407
413
  }
408
414
  ],
409
- geographicAddress: p
415
+ geographicAddress: I
410
416
  }
411
417
  };
412
- return e === "originator" ? { originatorPersons: [o], accountNumber: ["1234567890"] } : { beneficiaryPersons: [o], accountNumber: ["1234567890"] };
418
+ return e === "originator" ? { originatorPersons: [i], accountNumber: ["1234567890"] } : { beneficiaryPersons: [i], accountNumber: ["1234567890"] };
413
419
  }
414
- const Z = (e) => ({
420
+ const ie = (e) => ({
415
421
  ...e,
416
422
  // @ts-expect-error Preserving the original logic
417
423
  name: e.name ? [e.name] : void 0
418
- }), ee = (e) => ({
424
+ }), oe = (e) => ({
419
425
  ...e,
420
- naturalPerson: e.naturalPerson ? Z(e.naturalPerson) : void 0
421
- }), te = ({ beneficiary: e, originator: t }, n, r, o, i) => {
426
+ naturalPerson: e.naturalPerson ? ie(e.naturalPerson) : void 0
427
+ }), se = ({ beneficiary: e, originator: t }, r, n, i, o) => {
422
428
  var s;
423
429
  {
424
430
  const a = e && {
425
431
  ...e,
426
- ...o && { accountNumber: [o] },
427
- beneficiaryPersons: (s = e.beneficiaryPersons) == null ? void 0 : s.map(ee)
432
+ ...i && { accountNumber: [i] },
433
+ beneficiaryPersons: (s = e.beneficiaryPersons) == null ? void 0 : s.map(oe)
428
434
  };
429
- if (r && (a != null && a.beneficiaryPersons)) {
430
- const d = Y(
435
+ if (n && (a != null && a.beneficiaryPersons)) {
436
+ const d = re(
431
437
  "originator",
432
438
  a == null ? void 0 : a.beneficiaryPersons
433
439
  );
@@ -441,15 +447,15 @@ const Z = (e) => ({
441
447
  }
442
448
  return {
443
449
  beneficiary: a,
444
- originator: Q("originator", n)
450
+ originator: ne("originator", r)
445
451
  };
446
452
  }
447
453
  };
448
- function ne(e, t, n) {
449
- var i, s;
450
- const { beneficiary: r, originator: o } = te(
451
- n,
452
- (i = e.customer) == null ? void 0 : i.name,
454
+ function ae(e, t, r) {
455
+ var o, s;
456
+ const { beneficiary: n, originator: i } = se(
457
+ r,
458
+ (o = e.customer) == null ? void 0 : o.name,
453
459
  t.originatorEqualsBeneficiary,
454
460
  e.destination
455
461
  );
@@ -460,193 +466,215 @@ function ne(e, t, n) {
460
466
  originatorVASPdid: t.originatorVASPdid,
461
467
  ...t.beneficiaryVASPdid && !t.beneficiaryProof ? { beneficiaryVASPdid: t.beneficiaryVASPdid } : {},
462
468
  transactionBlockchainInfo: {
463
- ...(o == null ? void 0 : o.accountNumber) && { origin: o.accountNumber[0] },
469
+ ...(i == null ? void 0 : i.accountNumber) && { origin: i.accountNumber[0] },
464
470
  ...e.destination && { destination: e.destination }
465
471
  },
466
472
  ...t.beneficiaryProof && {
467
473
  beneficiaryProof: t.beneficiaryProof
468
474
  },
469
- ...r && { beneficiary: r },
470
- ...o && { originator: o },
475
+ ...n && { beneficiary: n },
476
+ ...i && { originator: i },
471
477
  ...t.originatorEqualsBeneficiary && {
472
478
  originatorEqualsBeneficiary: t.originatorEqualsBeneficiary
473
479
  }
474
480
  };
475
481
  }
476
- function w(e, t, n = {}) {
477
- var a, d;
478
- const r = (n == null ? void 0 : n.originatorId) || E("originator", e.customer), o = (n == null ? void 0 : n.beneficiaryId) || E("beneficiary", e.counterparty), i = (n == null ? void 0 : n.referenceId) || Math.random().toString(36).substring(2, 15), s = [];
479
- return t.originatorVASPdid && s.push({
482
+ function C(e, t, r = {}) {
483
+ var m, f, A;
484
+ const n = E(e), i = n ? e.customer : e.counterparty, o = n ? e.counterparty : e.customer, s = (r == null ? void 0 : r.originatorId) || g("originator", i), a = (r == null ? void 0 : r.beneficiaryId) || g("beneficiary", o), d = (r == null ? void 0 : r.referenceId) || t.transactionId || Math.random().toString(36).substring(2, 15), l = [];
485
+ return t.originatorVASPdid && l.push({
480
486
  "@id": t.originatorVASPdid,
481
- for: r,
487
+ for: s,
482
488
  role: "VASP"
483
- }), t.beneficiaryVASPdid && s.push({
489
+ }), t.beneficiaryVASPdid && l.push({
484
490
  "@id": t.beneficiaryVASPdid,
485
- for: o,
491
+ for: a,
486
492
  role: "VASP"
487
- }), e.destination && ((a = e == null ? void 0 : e.account) != null && a.did) && s.push({
493
+ }), E(e) && e.destination && ((m = e == null ? void 0 : e.account) != null && m.did) && l.push({
488
494
  "@id": e.account.did,
489
- for: t.beneficiaryVASPdid || o,
495
+ for: t.beneficiaryVASPdid || a,
490
496
  role: "SettlementAddress"
497
+ }), N(e) && e.source && ((f = e.agent) != null && f.did) && l.push({
498
+ "@id": e.agent.did,
499
+ for: t.originatorVASPdid || s,
500
+ role: "SourceAddress"
491
501
  }), {
492
- originator: { "@id": r },
493
- beneficiary: { "@id": o },
502
+ originator: { "@id": s },
503
+ beneficiary: { "@id": a },
494
504
  asset: e.asset,
495
- amount: ((d = e.amountDecimal) == null ? void 0 : d.toString()) || t.transactionAmount,
496
- agents: s,
497
- ref: i
505
+ amount: ((A = e.amountDecimal) == null ? void 0 : A.toString()) || t.transactionAmount,
506
+ agents: l,
507
+ ref: d
498
508
  };
499
509
  }
500
- function L(e, t, n = {}) {
501
- var i, s, a;
502
- const r = n.beneficiaryId || E("beneficiary", e.counterparty), o = (
503
- // If counterparty type is SELF, reuse originator data for beneficiary
504
- ((i = e.counterparty) == null ? void 0 : i.type) === g.SELF && n.originator ? n.originator.originatorPerson : (
505
- // Convert all beneficiary persons from V1 to V2 format
506
- ((a = (s = t.beneficiary) == null ? void 0 : s.beneficiaryPersons) == null ? void 0 : a.map(
507
- (d) => X(d, r)
508
- )) || []
509
- )
510
- );
510
+ function T(e, t, r = {}) {
511
+ var o, s, a, d, l, m;
512
+ if (E(e)) {
513
+ const f = r.beneficiaryId || g("beneficiary", e.counterparty), A = (
514
+ // If counterparty type is SELF, reuse originator data for beneficiary
515
+ ((o = e.counterparty) == null ? void 0 : o.type) === p.SELF && r.originator ? r.originator.originatorPerson : (
516
+ // Convert all beneficiary persons from V1 to V2 format
517
+ ((a = (s = t.beneficiary) == null ? void 0 : s.beneficiaryPersons) == null ? void 0 : a.map(
518
+ (O) => L(O, f)
519
+ )) || []
520
+ )
521
+ );
522
+ return {
523
+ ivms101: {
524
+ originator: r.originator,
525
+ beneficiary: {
526
+ beneficiaryPerson: A
527
+ }
528
+ }
529
+ };
530
+ }
531
+ const n = r.originatorId || g("originator", e.counterparty);
511
532
  return {
512
533
  ivms101: {
513
- originator: n.originator,
514
- beneficiary: {
515
- beneficiaryPerson: o
516
- }
534
+ originator: {
535
+ originatorPerson: ((d = e.counterparty) == null ? void 0 : d.type) === p.SELF && r.beneficiary ? r.beneficiary.beneficiaryPerson : (
536
+ // Convert all originator persons from V1 to V2 format
537
+ ((m = (l = t.originator) == null ? void 0 : l.originatorPersons) == null ? void 0 : m.map(
538
+ (f) => L(f, n)
539
+ )) || []
540
+ )
541
+ },
542
+ beneficiary: r.beneficiary
517
543
  }
518
544
  };
519
545
  }
520
- function b(e, t, n) {
521
- var o;
522
- const r = { ...e };
523
- if (!r.originatorId)
524
- try {
525
- const i = K(t);
526
- i != null && i.sub && (r.originatorId = i.sub);
527
- } catch {
528
- }
529
- return r.beneficiaryId || (((o = n.counterparty) == null ? void 0 : o.type) === g.SELF ? r.beneficiaryId = r.originatorId : n.destination && (r.beneficiaryId = `did:key:${n.destination}`)), r;
546
+ function P(e, t, r) {
547
+ var o, s;
548
+ const n = { ...e };
549
+ let i;
550
+ try {
551
+ const a = Z(t);
552
+ i = a == null ? void 0 : a.sub;
553
+ } catch {
554
+ }
555
+ return E(r) ? (!n.originatorId && i && (n.originatorId = i), n.beneficiaryId || (((o = r.counterparty) == null ? void 0 : o.type) === p.SELF ? n.beneficiaryId = n.originatorId : r.destination && (n.beneficiaryId = `did:key:${r.destination}`))) : N(r) && (!n.beneficiaryId && i && (n.beneficiaryId = i), n.originatorId || (((s = r.counterparty) == null ? void 0 : s.type) === p.SELF ? n.originatorId = n.beneficiaryId : r.source && (n.originatorId = `did:key:${r.source}`))), n;
530
556
  }
531
- function ie(e) {
557
+ function le(e) {
532
558
  var s;
533
559
  if (!e.txCreate || !e.ivms101)
534
560
  throw new Error(
535
561
  "Invalid response: missing required txCreate or ivms101 data"
536
562
  );
537
- const { value: t, ivms101: n, proof: r, txCreate: o } = e, i = {
563
+ const { value: t, ivms101: r, proof: n, txCreate: i } = e, o = {
538
564
  destination: (t == null ? void 0 : t.destination) || "",
539
565
  counterparty: (t == null ? void 0 : t.counterparty) || {},
540
566
  agent: t == null ? void 0 : t.agent,
541
567
  account: t == null ? void 0 : t.account,
542
- proof: r,
543
- asset: (t == null ? void 0 : t.asset) || (typeof o.transactionAsset == "string" ? o.transactionAsset : (s = o.transactionAsset) == null ? void 0 : s.caip19) || "",
544
- amountDecimal: (t == null ? void 0 : t.amountDecimal) || (o.transactionAmount ? parseFloat(o.transactionAmount) : 0),
568
+ proof: n,
569
+ asset: (t == null ? void 0 : t.asset) || (typeof i.transactionAsset == "string" ? i.transactionAsset : (s = i.transactionAsset) == null ? void 0 : s.caip19) || "",
570
+ amountDecimal: (t == null ? void 0 : t.amountDecimal) || (i.transactionAmount ? parseFloat(i.transactionAmount) : 0),
545
571
  customer: t == null ? void 0 : t.customer
546
572
  };
547
- return ne(i, o, n);
573
+ return ae(o, i, r);
548
574
  }
549
- function se(e, t, n = {}) {
550
- if (!e.txCreate || !e.ivms101)
575
+ function ue(e, t, r = {}) {
576
+ const { value: n, txCreate: i, txUpdate: o, ivms101: s, proof: a } = e, d = E(n) ? i : o;
577
+ if (!d || !s)
551
578
  throw new Error(
552
- "Invalid response: missing required txCreate or ivms101 data"
579
+ "Invalid response: missing required txCreate/txUpdate or ivms101 data"
553
580
  );
554
- const { value: r, txCreate: o, ivms101: i, proof: s } = e, a = b(n, t, r);
581
+ const l = P(r, t, n);
555
582
  return {
556
- createTx: w(r, o, a),
557
- ivms101: L(r, i, a),
558
- ...s && { confirmRelationship: { proof: s } }
583
+ createTx: C(n, d, l),
584
+ ivms101: T(n, s, l),
585
+ ...a && { confirmRelationship: { proof: a } }
559
586
  };
560
587
  }
561
- function ae(e, t, n = {}) {
562
- if (!e.txCreate || !e.ivms101)
588
+ function he(e, t, r = {}) {
589
+ const { value: n, txCreate: i, txUpdate: o } = e, s = E(n) ? i : o;
590
+ if (!s || !e.ivms101)
563
591
  throw new Error(
564
- "Invalid response: missing required txCreate or ivms101 data"
592
+ "Invalid response: missing required txCreate/txUpdate or ivms101 data"
565
593
  );
566
- const { value: r, txCreate: o } = e, i = b(n, t, r);
567
- return w(r, o, i);
594
+ const a = P(r, t, n);
595
+ return C(n, s, a);
568
596
  }
569
- function ce(e, t, n = {}) {
597
+ function me(e, t, r = {}) {
570
598
  if (!e.ivms101)
571
599
  throw new Error("Invalid response: missing required ivms101 data");
572
- const { value: r, ivms101: o } = e, i = b(n, t, r);
573
- return L(r, o, i);
600
+ const { value: n, ivms101: i } = e, o = P(r, t, n);
601
+ return T(n, i, o);
574
602
  }
575
- async function I(e, t) {
576
- const n = JSON.stringify(e), r = new TextEncoder(), o = t ? A(t) : crypto.getRandomValues(new Uint8Array(32)), i = await crypto.subtle.importKey(
603
+ async function v(e, t) {
604
+ const r = JSON.stringify(e), n = new TextEncoder(), i = t ? w(t) : crypto.getRandomValues(new Uint8Array(32)), o = await crypto.subtle.importKey(
577
605
  "raw",
578
- o,
606
+ i,
579
607
  { name: "AES-GCM" },
580
608
  !1,
581
609
  ["encrypt"]
582
610
  ), s = crypto.getRandomValues(new Uint8Array(12)), a = await crypto.subtle.encrypt(
583
611
  { name: "AES-GCM", iv: s },
584
- i,
585
- r.encode(n)
612
+ o,
613
+ n.encode(r)
586
614
  );
587
615
  return {
588
- ciphertext: `${m(s)}-${m(a)}`,
589
- key: m(o)
616
+ ciphertext: `${y(s)}-${y(a)}`,
617
+ key: y(i)
590
618
  };
591
619
  }
592
- async function P({ ciphertext: e, key: t }) {
593
- const [n, r] = e.split("-"), o = new Uint8Array(
594
- atob(t).split("").map((v) => v.charCodeAt(0))
595
- ), i = A(n), s = A(r), a = await crypto.subtle.importKey(
620
+ async function _({ ciphertext: e, key: t }) {
621
+ const [r, n] = e.split("-"), i = new Uint8Array(
622
+ atob(t).split("").map((m) => m.charCodeAt(0))
623
+ ), o = w(r), s = w(n), a = await crypto.subtle.importKey(
596
624
  "raw",
597
- o,
625
+ i,
598
626
  { name: "AES-GCM" },
599
627
  !1,
600
628
  ["decrypt"]
601
- ), d = new TextDecoder(), h = await crypto.subtle.decrypt(
602
- { name: "AES-GCM", iv: new Uint8Array(i) },
629
+ ), d = new TextDecoder(), l = await crypto.subtle.decrypt(
630
+ { name: "AES-GCM", iv: new Uint8Array(o) },
603
631
  a,
604
632
  s
605
633
  );
606
- return JSON.parse(d.decode(h));
634
+ return JSON.parse(d.decode(l));
607
635
  }
608
- function m(e) {
636
+ function y(e) {
609
637
  const t = new Uint8Array(e);
610
- let n = "";
611
- for (let r = 0; r < t.length; r++)
612
- n += String.fromCharCode(t[r]);
613
- return btoa(n);
614
- }
615
- function A(e) {
616
- const t = atob(e), n = new Uint8Array(t.length);
617
- for (let r = 0; r < t.length; r++)
618
- n[r] = t.charCodeAt(r);
619
- return n;
620
- }
621
- async function de(e) {
638
+ let r = "";
639
+ for (let n = 0; n < t.length; n++)
640
+ r += String.fromCharCode(t[n]);
641
+ return btoa(r);
642
+ }
643
+ function w(e) {
644
+ const t = atob(e), r = new Uint8Array(t.length);
645
+ for (let n = 0; n < t.length; n++)
646
+ r[n] = t.charCodeAt(n);
647
+ return r;
648
+ }
649
+ async function fe(e) {
622
650
  const t = await fetch(e.url, {
623
651
  method: "GET"
624
652
  });
625
653
  if (!t.ok)
626
654
  throw new Error(`Failed to get connection: ${await t.text()}`);
627
- const n = await t.json();
628
- if (!n.id || !n.metadata || !n.status || !n.sealed)
655
+ const r = await t.json();
656
+ if (!r.id || !r.metadata || !r.status || !r.sealed)
629
657
  throw new Error("Data missing from server response");
630
- const r = {
631
- id: n.id,
632
- metadata: n.metadata,
633
- status: n.status
658
+ const n = {
659
+ id: r.id,
660
+ metadata: r.metadata,
661
+ status: r.status
634
662
  };
635
- if (n.status === "closed")
636
- return r;
637
- const o = n.sealed[n.sealed.length - 1], i = await P({
638
- ciphertext: o,
663
+ if (r.status === "closed")
664
+ return n;
665
+ const i = r.sealed[r.sealed.length - 1], o = await _({
666
+ ciphertext: i,
639
667
  key: e.key
640
668
  });
641
- return n.status === "completed" ? {
642
- ...r,
643
- result: i.result
669
+ return r.status === "completed" ? {
670
+ ...n,
671
+ result: o.result
644
672
  } : {
645
- ...r,
646
- tx: i.tx
673
+ ...n,
674
+ tx: o.tx
647
675
  };
648
676
  }
649
- class le {
677
+ class Ee {
650
678
  constructor(t) {
651
679
  c(this, "endpoint");
652
680
  this.endpoint = t;
@@ -658,27 +686,27 @@ class le {
658
686
  * @param metadata Connection metadata including participants and transaction type
659
687
  * @returns Promise resolving to connection details including ID, version, and encryption key
660
688
  */
661
- async create(t, n) {
662
- const r = await I(t), o = {
663
- metadata: n,
664
- sealed: r.ciphertext
665
- }, i = await fetch(this.endpoint, {
689
+ async create(t, r) {
690
+ const n = await v(t), i = {
691
+ metadata: r,
692
+ sealed: n.ciphertext
693
+ }, o = await fetch(this.endpoint, {
666
694
  method: "POST",
667
695
  headers: {
668
696
  "Content-Type": "application/json"
669
697
  },
670
- body: JSON.stringify(o)
698
+ body: JSON.stringify(i)
671
699
  });
672
- if (!i.ok)
673
- throw new Error(`Failed to create connection: ${await i.text()}`);
674
- const s = await i.json();
700
+ if (!o.ok)
701
+ throw new Error(`Failed to create connection: ${await o.text()}`);
702
+ const s = await o.json();
675
703
  return {
676
704
  id: s.id,
677
705
  version: s.version,
678
706
  status: s.status,
679
- metadata: n,
707
+ metadata: r,
680
708
  data: t,
681
- key: r.key
709
+ key: n.key
682
710
  };
683
711
  }
684
712
  /**
@@ -691,11 +719,11 @@ class le {
691
719
  * @param key Current encryption key
692
720
  * @returns Promise resolving to updated connection details including new encryption key
693
721
  */
694
- async update(t, n, r, o, i) {
695
- const s = await I(n, i), a = {
722
+ async update(t, r, n, i, o) {
723
+ const s = await v(r, o), a = {
696
724
  sealed: s.ciphertext,
697
- version: r,
698
- status: o
725
+ version: n,
726
+ status: i
699
727
  }, d = await fetch(`${this.endpoint}/${t}`, {
700
728
  method: "PATCH",
701
729
  headers: {
@@ -705,13 +733,13 @@ class le {
705
733
  });
706
734
  if (!d.ok)
707
735
  throw new Error(`Failed to update connection: ${await d.text()}`);
708
- const h = await d.json();
736
+ const l = await d.json();
709
737
  return {
710
- id: h.id,
711
- metadata: h.metadata,
712
- version: h.version,
713
- status: h.status,
714
- data: n,
738
+ id: l.id,
739
+ metadata: l.metadata,
740
+ version: l.version,
741
+ status: l.status,
742
+ data: r,
715
743
  key: s.key
716
744
  };
717
745
  }
@@ -722,23 +750,23 @@ class le {
722
750
  * @param key Encryption key from previous create/update operation
723
751
  * @returns Promise resolving to connection details including decrypted data
724
752
  */
725
- async get(t, n) {
726
- const r = await fetch(`${this.endpoint}/${t}`, {
753
+ async get(t, r) {
754
+ const n = await fetch(`${this.endpoint}/${t}`, {
727
755
  method: "GET"
728
756
  });
729
- if (!r.ok)
730
- throw new Error(`Failed to get connection: ${await r.text()}`);
731
- const o = await r.json(), i = o.sealed[o.sealed.length - 1], s = await P({
732
- ciphertext: i,
733
- key: n
757
+ if (!n.ok)
758
+ throw new Error(`Failed to get connection: ${await n.text()}`);
759
+ const i = await n.json(), o = i.sealed[i.sealed.length - 1], s = await _({
760
+ ciphertext: o,
761
+ key: r
734
762
  });
735
763
  return {
736
- id: o.id,
737
- status: o.status,
738
- version: o.version,
739
- metadata: o.metadata,
764
+ id: i.id,
765
+ status: i.status,
766
+ version: i.version,
767
+ metadata: i.metadata,
740
768
  data: s,
741
- key: n
769
+ key: r
742
770
  };
743
771
  }
744
772
  /**
@@ -747,14 +775,14 @@ class le {
747
775
  * @returns Promise resolving when the connection is closed
748
776
  */
749
777
  async close(t) {
750
- const n = await fetch(`${this.endpoint}/${t}`, {
778
+ const r = await fetch(`${this.endpoint}/${t}`, {
751
779
  method: "DELETE"
752
780
  });
753
- if (!n.ok)
754
- throw new Error(`Failed to close connection: ${await n.text()}`);
781
+ if (!r.ok)
782
+ throw new Error(`Failed to close connection: ${await r.text()}`);
755
783
  }
756
784
  }
757
- class ue {
785
+ class pe {
758
786
  /**
759
787
  * Creates a new instance of the Notabene SDK
760
788
  *
@@ -778,15 +806,15 @@ class ue {
778
806
  * @returns component URL
779
807
  * @internal
780
808
  */
781
- componentUrl(t, n, r, o) {
782
- const i = new URL(this.uxUrl);
783
- i.pathname = t;
784
- const s = F({
809
+ componentUrl(t, r, n, i) {
810
+ const o = new URL(this.uxUrl);
811
+ o.pathname = t;
812
+ const s = H({
785
813
  authToken: this.authToken,
786
- value: n,
787
- configuration: r
814
+ value: r,
815
+ configuration: n
788
816
  });
789
- return i.hash = s, 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), o && (o.callback && i.searchParams.set("callback_url", o.callback), o.redirectUri && i.searchParams.set("redirect_uri", o.redirectUri)), i.toString();
817
+ return o.hash = s, this.nodeUrl && o.searchParams.set("nodeUrl", this.nodeUrl), this.theme && o.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && o.searchParams.set("locale", this.locale), i && (i.callback && o.searchParams.set("callback_url", i.callback), i.redirectUri && o.searchParams.set("redirect_uri", i.redirectUri)), o.toString();
790
818
  }
791
819
  /**
792
820
  * Creates a new embedded component
@@ -798,11 +826,11 @@ class ue {
798
826
  * @returns A new EmbeddedComponent instance
799
827
  * @internal
800
828
  */
801
- createComponent(t, n, r, o) {
802
- return new J(
803
- this.componentUrl(t, n, r, o),
804
- n,
805
- r
829
+ createComponent(t, r, n, i) {
830
+ return new K(
831
+ this.componentUrl(t, r, n, i),
832
+ r,
833
+ n
806
834
  );
807
835
  }
808
836
  /**
@@ -813,12 +841,12 @@ class ue {
813
841
  * @param callbacks - Optional callback configuration
814
842
  * @returns A new EmbeddedComponent instance for withdrawal assistance
815
843
  */
816
- createWithdrawalAssist(t, n, r) {
844
+ createWithdrawalAssist(t, r, n) {
817
845
  return this.createComponent(
818
846
  "withdrawal-assist",
819
847
  t,
820
- n,
821
- r
848
+ r,
849
+ n
822
850
  );
823
851
  }
824
852
  /**
@@ -830,12 +858,12 @@ class ue {
830
858
  * @returns A new EmbeddedComponent instance for connection
831
859
  * @alpha
832
860
  */
833
- createConnectWallet(t, n, r) {
861
+ createConnectWallet(t, r, n) {
834
862
  return this.createComponent(
835
863
  "connect",
836
864
  t,
837
- n,
838
- r
865
+ r,
866
+ n
839
867
  );
840
868
  }
841
869
  /**
@@ -847,12 +875,12 @@ class ue {
847
875
  * @returns A new EmbeddedComponent instance for deposit requests
848
876
  * @public
849
877
  */
850
- createDepositRequest(t, n, r) {
878
+ createDepositRequest(t, r, n) {
851
879
  return this.createComponent(
852
880
  "deposit-request",
853
881
  t,
854
- n,
855
- r
882
+ r,
883
+ n
856
884
  );
857
885
  }
858
886
  /**
@@ -864,37 +892,37 @@ class ue {
864
892
  * @returns A new EmbeddedComponent instance for deposit assistance
865
893
  * @public
866
894
  */
867
- createDepositAssist(t, n, r) {
895
+ createDepositAssist(t, r, n) {
868
896
  return this.createComponent(
869
897
  "deposit-assist",
870
898
  t,
871
- n,
872
- r
899
+ r,
900
+ n
873
901
  );
874
902
  }
875
903
  }
876
904
  export {
877
- S as AgentType,
878
- l as CMType,
879
- D as CodeVerificationStatus,
880
- le as ConnectionManager,
881
- J as EmbeddedComponent,
882
- M as ErrorIdentifierCode,
883
- y as HMType,
884
- T as IdentityVerificationMethod,
885
- U as OAuthProvider,
886
- g as PersonType,
887
- B as ProofStatus,
888
- W as ProofTypes,
889
- _ as Status,
890
- O as VASPSearchControl,
891
- x as ValidationSections,
892
- V as WarningIdentifierCode,
893
- ce as componentResponseToIVMS101,
894
- ae as componentResponseToTxCreateRequest,
895
- se as componentResponseToTxRequests,
896
- ie as componentResponseToV1TxCreateRequest,
897
- oe as decodeFragmentToObject,
898
- ue as default,
899
- de as getRefreshResult
905
+ x as AgentType,
906
+ u as CMType,
907
+ k as CodeVerificationStatus,
908
+ Ee as ConnectionManager,
909
+ K as EmbeddedComponent,
910
+ J as ErrorIdentifierCode,
911
+ S as HMType,
912
+ W as IdentityVerificationMethod,
913
+ B as OAuthProvider,
914
+ p as PersonType,
915
+ j as ProofStatus,
916
+ G as ProofTypes,
917
+ M as Status,
918
+ V as VASPSearchControl,
919
+ F as ValidationSections,
920
+ $ as WarningIdentifierCode,
921
+ me as componentResponseToIVMS101,
922
+ he as componentResponseToTxCreateRequest,
923
+ ue as componentResponseToTxRequests,
924
+ le as componentResponseToV1TxCreateRequest,
925
+ de as decodeFragmentToObject,
926
+ pe as default,
927
+ fe as getRefreshResult
900
928
  };