@notabene/javascript-sdk 2.8.0-next.2 → 2.8.0-next.4
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/cjs/notabene.d.ts +1645 -0
- package/dist/cjs/package.json +107 -0
- package/dist/esm/notabene.d.ts +1645 -0
- package/dist/esm/notabene.js +393 -0
- package/dist/esm/package.json +107 -0
- package/dist/notabene.d.ts +5 -5
- package/docs/_media/TransactionOptions.md +6 -6
- package/docs/ivms/types/enumerations/PayloadVersionCode.md +2 -2
- package/docs/ivms/types/interfaces/PayloadMetadata.md +2 -2
- package/docs/ivms/types/type-aliases/Address.md +1 -1
- package/docs/ivms/types/type-aliases/AddressTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/Beneficiary.md +1 -1
- package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +1 -1
- package/docs/ivms/types/type-aliases/ISOCountryCode.md +1 -1
- package/docs/ivms/types/type-aliases/ISODate.md +1 -1
- package/docs/ivms/types/type-aliases/IVMS101.md +1 -1
- package/docs/ivms/types/type-aliases/IntermediaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentification.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/OriginatingVASP.md +1 -1
- package/docs/ivms/types/type-aliases/Originator.md +1 -1
- package/docs/ivms/types/type-aliases/Person.md +1 -1
- package/docs/ivms/types/type-aliases/TransferPath.md +1 -1
- package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +1 -1
- package/docs/notabene/README.md +30 -0
- package/docs/notabene/classes/EmbeddedComponent.md +17 -17
- package/docs/notabene/classes/default.md +7 -7
- package/docs/notabene/functions/decodeFragmentToObject.md +1 -1
- package/docs/notabene/interfaces/NotabeneConfig.md +5 -5
- package/docs/notabene/type-aliases/MessageCallback.md +1 -1
- package/docs/types/README.md +2 -0
- package/docs/types/enumerations/AgentType.md +2 -2
- package/docs/types/enumerations/CMType.md +7 -7
- package/docs/types/enumerations/ErrorIdentifierCode.md +4 -4
- package/docs/types/enumerations/HMType.md +2 -2
- package/docs/types/enumerations/PersonType.md +3 -3
- package/docs/types/enumerations/ProofStatus.md +4 -4
- package/docs/types/enumerations/ProofTypes.md +36 -14
- package/docs/types/enumerations/Status.md +5 -5
- package/docs/types/enumerations/VASPSearchControl.md +2 -2
- package/docs/types/enumerations/ValidationSections.md +4 -4
- package/docs/types/interfaces/Agent.md +6 -6
- package/docs/types/interfaces/CallbackOptions.md +2 -2
- package/docs/types/interfaces/ComponentRequest.md +2 -2
- package/docs/types/interfaces/ComponentResponse.md +4 -4
- package/docs/types/interfaces/ConnectionRecord.md +7 -7
- package/docs/types/interfaces/ConnectionRequest.md +3 -3
- package/docs/types/interfaces/Counterparty.md +10 -10
- package/docs/types/interfaces/DeclarationProof.md +6 -6
- package/docs/types/interfaces/Deposit.md +25 -11
- package/docs/types/interfaces/DepositRequest.md +7 -7
- package/docs/types/interfaces/DepositRequestOptions.md +1 -1
- package/docs/types/interfaces/DepositTransaction.md +9 -9
- package/docs/types/interfaces/LegalPerson.md +13 -13
- package/docs/types/interfaces/MicroTransferProof.md +9 -9
- package/docs/types/interfaces/NaturalPerson.md +13 -13
- package/docs/types/interfaces/OwnershipProof.md +4 -4
- package/docs/types/interfaces/RefreshSource.md +27 -0
- package/docs/types/interfaces/Refreshable.md +22 -0
- package/docs/types/interfaces/ScreenshotProof.md +5 -5
- package/docs/types/interfaces/SignatureProof.md +23 -9
- package/docs/types/interfaces/ThresholdOptions.md +3 -3
- package/docs/types/interfaces/Transaction.md +8 -8
- package/docs/types/interfaces/TransactionOptions.md +6 -6
- package/docs/types/interfaces/TransactionResponse.md +9 -9
- package/docs/types/interfaces/VASP.md +9 -9
- package/docs/types/interfaces/Wallet.md +8 -8
- package/docs/types/interfaces/Withdrawal.md +24 -10
- package/docs/types/type-aliases/BlockchainAddress.md +1 -1
- package/docs/types/type-aliases/CAIP10.md +1 -1
- package/docs/types/type-aliases/CAIP19.md +1 -1
- package/docs/types/type-aliases/CAIP2.md +1 -1
- package/docs/types/type-aliases/CAIP220.md +1 -1
- package/docs/types/type-aliases/Cancel.md +1 -1
- package/docs/types/type-aliases/Completed.md +1 -1
- package/docs/types/type-aliases/ComponentMessage.md +1 -1
- package/docs/types/type-aliases/ConnectionOptions.md +1 -1
- package/docs/types/type-aliases/CryptoCredential.md +1 -1
- package/docs/types/type-aliases/DID.md +1 -1
- package/docs/types/type-aliases/DTI.md +1 -1
- package/docs/types/type-aliases/Destination.md +1 -1
- package/docs/types/type-aliases/Error.md +1 -1
- package/docs/types/type-aliases/FieldOptions.md +2 -2
- package/docs/types/type-aliases/FieldTypes.md +1 -1
- package/docs/types/type-aliases/HostMessage.md +1 -1
- package/docs/types/type-aliases/ISOCurrency.md +1 -1
- package/docs/types/type-aliases/InvalidValue.md +1 -1
- package/docs/types/type-aliases/LEI.md +1 -1
- package/docs/types/type-aliases/LegalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/LegalPersonFields.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFields.md +1 -1
- package/docs/types/type-aliases/NotabeneAsset.md +1 -1
- package/docs/types/type-aliases/Ready.md +1 -1
- package/docs/types/type-aliases/ResizeRequest.md +1 -1
- package/docs/types/type-aliases/Source.md +1 -1
- package/docs/types/type-aliases/Theme.md +1 -1
- package/docs/types/type-aliases/TransactionAsset.md +1 -1
- package/docs/types/type-aliases/TravelAddress.md +1 -1
- package/docs/types/type-aliases/URI.md +1 -1
- package/docs/types/type-aliases/UUID.md +1 -1
- package/docs/types/type-aliases/UpdateValue.md +1 -1
- package/docs/types/type-aliases/V1Asset.md +1 -1
- package/docs/types/type-aliases/V1Transaction.md +1 -1
- package/docs/types/type-aliases/VASPOptions.md +1 -1
- package/docs/types/type-aliases/ValidationError.md +1 -1
- package/package.json +23 -3
- package/src/notabene.ts +10 -0
- package/src/types.ts +1 -0
- /package/dist/{notabene.cjs → cjs/notabene.cjs} +0 -0
|
@@ -0,0 +1,393 @@
|
|
|
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 || {}), p = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(p || {}), f = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(f || {}), v = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(v || {}), 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 || {}), I = /* @__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))(I || {}), d = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(d || {}), L = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(L || {}), 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.BIP322 = "bip-322", e.BIP137_XPUB = "xpub", e.TIP191 = "tip-191", e.ED25519 = "ed25519", e.XRP_ED25519 = "xrp-ed25519", e.CIP8 = "cip-8", e.MicroTransfer = "microtransfer", e.Screenshot = "screenshot", e.Connect = "connect", e))(g || {});
|
|
5
|
+
class A {
|
|
6
|
+
constructor() {
|
|
7
|
+
o(this, "listeners", /* @__PURE__ */ new Map());
|
|
8
|
+
o(this, "port");
|
|
9
|
+
this.handleMessage = this.handleMessage.bind(this);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sets up the message port for communication.
|
|
13
|
+
*
|
|
14
|
+
* Initializes the MessagePort for receiving messages by setting up the message handler
|
|
15
|
+
* and starting the port.
|
|
16
|
+
*
|
|
17
|
+
* @param port - The MessagePort instance to use for communication
|
|
18
|
+
*/
|
|
19
|
+
setPort(t) {
|
|
20
|
+
this.port = t, this.port.onmessage = this.handleMessage, this.port.start();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Registers a callback for a specific message type.
|
|
24
|
+
*
|
|
25
|
+
* When messages of the specified type are received, the callback will be executed
|
|
26
|
+
* with the message data.
|
|
27
|
+
*
|
|
28
|
+
* @param messageType - The type of message to listen for
|
|
29
|
+
* @param callback - The callback function to execute when matching messages are received
|
|
30
|
+
|
|
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);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Removes a callback for a specific message type.
|
|
37
|
+
*
|
|
38
|
+
* If the callback is the last one registered for the message type,
|
|
39
|
+
* the message type entry will be removed entirely.
|
|
40
|
+
*
|
|
41
|
+
* @param messageType - The type of message to remove listener from
|
|
42
|
+
* @param callback - The callback function to remove
|
|
43
|
+
*/
|
|
44
|
+
off(t, r) {
|
|
45
|
+
const s = this.listeners.get(t);
|
|
46
|
+
s && (s.delete(r), s.size === 0 && this.listeners.delete(t));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Internal message handler for processing received messages.
|
|
50
|
+
*
|
|
51
|
+
* Validates incoming messages and dispatches them to registered callbacks
|
|
52
|
+
* based on the message type.
|
|
53
|
+
*
|
|
54
|
+
* @param event - The message event containing the component message
|
|
55
|
+
*/
|
|
56
|
+
handleMessage(t) {
|
|
57
|
+
const r = t.data;
|
|
58
|
+
if (typeof r == "object" && r !== null && "type" in r) {
|
|
59
|
+
const s = r.type, i = this.listeners.get(s);
|
|
60
|
+
i && i.forEach((n) => n(r));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Sends a message through the message port
|
|
65
|
+
* @param message The host message to send
|
|
66
|
+
*/
|
|
67
|
+
send(t) {
|
|
68
|
+
this.port && this.port.postMessage(t);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class N {
|
|
72
|
+
/**
|
|
73
|
+
* Creates an instance of EmbeddedComponent.
|
|
74
|
+
* @param url - The URL of the embedded component
|
|
75
|
+
* @param value - The initial transaction value
|
|
76
|
+
*/
|
|
77
|
+
constructor(t, r, s) {
|
|
78
|
+
o(this, "_url");
|
|
79
|
+
o(this, "_value");
|
|
80
|
+
o(this, "_options");
|
|
81
|
+
o(this, "_errors", []);
|
|
82
|
+
o(this, "iframe");
|
|
83
|
+
o(this, "eventManager");
|
|
84
|
+
o(this, "modal");
|
|
85
|
+
this._url = t, this._value = r, this._options = s, this.eventManager = new A(), this.on(h.INVALID, (i) => {
|
|
86
|
+
i.type === h.INVALID && (this._errors = i.errors, this._value = i.value);
|
|
87
|
+
}), this.on(h.RESIZE, (i) => {
|
|
88
|
+
i.type === h.RESIZE && this.iframe && (this.iframe.style.height = `${i.height}px`);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets the URL of the embedded component
|
|
93
|
+
* @returns The URL of the embedded component
|
|
94
|
+
*/
|
|
95
|
+
get url() {
|
|
96
|
+
return this._url;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Gets the current transaction value
|
|
100
|
+
* @returns The current transaction value
|
|
101
|
+
*/
|
|
102
|
+
get value() {
|
|
103
|
+
return this._value;
|
|
104
|
+
}
|
|
105
|
+
get options() {
|
|
106
|
+
return this._options;
|
|
107
|
+
}
|
|
108
|
+
get errors() {
|
|
109
|
+
return this._errors;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Opens the component URL in the current window
|
|
113
|
+
*/
|
|
114
|
+
open() {
|
|
115
|
+
document.location.href = this.url;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Mounts the component to a parent element
|
|
119
|
+
* @param parentId - The ID of the parent element
|
|
120
|
+
* @throws Will throw an error if the parent element is not found
|
|
121
|
+
*/
|
|
122
|
+
mount(t) {
|
|
123
|
+
const r = document.querySelector(t);
|
|
124
|
+
if (!r) throw new Error(`parentID ${t} not found`);
|
|
125
|
+
this.embed(r);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Embeds the component into a parent element
|
|
129
|
+
* @param parent - The parent element to embed the component into
|
|
130
|
+
*/
|
|
131
|
+
embed(t, r = !1) {
|
|
132
|
+
var s, 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", (n) => {
|
|
134
|
+
var a, l;
|
|
135
|
+
n.source === ((a = this.iframe) == null ? void 0 : a.contentWindow) && ((l = this.eventManager) == null || l.setPort(n.ports[0]));
|
|
136
|
+
}), (i = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || i.focus();
|
|
137
|
+
}
|
|
138
|
+
removeEmbed() {
|
|
139
|
+
this.iframe && this.iframe.remove();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Sends a message to the embedded component
|
|
143
|
+
* @param message - The message to send
|
|
144
|
+
*/
|
|
145
|
+
send(t) {
|
|
146
|
+
this.eventManager.send(t);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Adds an event listener for a specific message type
|
|
150
|
+
* @param messageType - The type of message to listen for
|
|
151
|
+
* @param callback - The callback function to execute when the message is received
|
|
152
|
+
*/
|
|
153
|
+
on(t, r) {
|
|
154
|
+
return this.eventManager.on(t, r);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Removes an event listener for a specific message type
|
|
158
|
+
* @param messageType - The type of message to stop listening for
|
|
159
|
+
* @param callback - The callback function to remove
|
|
160
|
+
*/
|
|
161
|
+
off(t, r) {
|
|
162
|
+
this.eventManager.off(t, r);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Updates the transaction value and sends an update message to the component
|
|
166
|
+
* @param value - The new transaction value
|
|
167
|
+
*/
|
|
168
|
+
update(t, r) {
|
|
169
|
+
this._value = t, r && (this._options = r), this.send({ type: d.UPDATE, value: t, options: this._options });
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Waits for the component to complete and returns the transaction response
|
|
173
|
+
* @returns A promise that resolves with the transaction response
|
|
174
|
+
*/
|
|
175
|
+
completion() {
|
|
176
|
+
return new Promise((t, r) => {
|
|
177
|
+
let s, i, n;
|
|
178
|
+
function a() {
|
|
179
|
+
s && s(), i && i(), n && n();
|
|
180
|
+
}
|
|
181
|
+
s = this.on(h.COMPLETE, (l) => {
|
|
182
|
+
t(l.response), a();
|
|
183
|
+
}), i = this.on(h.CANCEL, () => {
|
|
184
|
+
r(new Error("User cancelled")), a();
|
|
185
|
+
}), n = this.on("error", (l) => {
|
|
186
|
+
r(new Error(l.message)), a();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Opens the component in a modal dialog
|
|
192
|
+
*/
|
|
193
|
+
async openModal() {
|
|
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(h.CANCEL, () => {
|
|
196
|
+
this.closeModal();
|
|
197
|
+
}), r = this.on(h.COMPLETE, () => {
|
|
198
|
+
this.closeModal();
|
|
199
|
+
});
|
|
200
|
+
return this.modal.showModal(), this.modal.addEventListener("click", () => {
|
|
201
|
+
this.closeModal();
|
|
202
|
+
}), this.completion().finally(() => {
|
|
203
|
+
t(), r();
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Closes the modal dialog
|
|
208
|
+
*
|
|
209
|
+
*/
|
|
210
|
+
closeModal() {
|
|
211
|
+
var t;
|
|
212
|
+
this.modal && ((t = this.modal) == null || t.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
|
+
async popup() {
|
|
221
|
+
const t = window.open(
|
|
222
|
+
this.url,
|
|
223
|
+
"_blank",
|
|
224
|
+
"popup=true,width=600,height=600"
|
|
225
|
+
);
|
|
226
|
+
window.addEventListener("message", (i) => {
|
|
227
|
+
var n;
|
|
228
|
+
i.source === t && (console.log("received message from popup", i.data), (n = this.eventManager) == null || n.setPort(i.ports[0]));
|
|
229
|
+
});
|
|
230
|
+
const r = this.on(h.CANCEL, () => {
|
|
231
|
+
t == null || t.close();
|
|
232
|
+
}), s = this.on(h.COMPLETE, () => {
|
|
233
|
+
t == null || t.close();
|
|
234
|
+
});
|
|
235
|
+
return this.completion().finally(() => {
|
|
236
|
+
r(), s();
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function w(e) {
|
|
241
|
+
return Object.entries(e).map(([t, r]) => {
|
|
242
|
+
if (r == null) return;
|
|
243
|
+
const s = encodeURIComponent(t), i = encodeURIComponent(
|
|
244
|
+
typeof r == "object" ? JSON.stringify(r) : String(r)
|
|
245
|
+
// Use String() to handle all primitive types
|
|
246
|
+
);
|
|
247
|
+
return `${s}=${i}`;
|
|
248
|
+
}).filter((t) => t !== void 0).join("&");
|
|
249
|
+
}
|
|
250
|
+
function C(e) {
|
|
251
|
+
const t = e.slice(1);
|
|
252
|
+
return t ? t.split("&").filter(Boolean).reduce(
|
|
253
|
+
(s, i) => {
|
|
254
|
+
const [n, a] = i.split("=");
|
|
255
|
+
return n && (s[decodeURIComponent(n)] = a ? decodeURIComponent(a) : ""), s;
|
|
256
|
+
},
|
|
257
|
+
{}
|
|
258
|
+
) : {};
|
|
259
|
+
}
|
|
260
|
+
class U {
|
|
261
|
+
/**
|
|
262
|
+
* Creates a new instance of the Notabene SDK
|
|
263
|
+
*
|
|
264
|
+
* @param config - Configuration options for the Notabene SDK
|
|
265
|
+
*/
|
|
266
|
+
constructor(t) {
|
|
267
|
+
o(this, "nodeUrl");
|
|
268
|
+
o(this, "authToken");
|
|
269
|
+
o(this, "uxUrl");
|
|
270
|
+
o(this, "theme");
|
|
271
|
+
o(this, "locale");
|
|
272
|
+
this.uxUrl = t.uxUrl || "https://connect.notabene.id", this.nodeUrl = t.nodeUrl, this.authToken = t.authToken, this.theme = t.theme, this.locale = t.locale;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Generates a URL for a Notabene component
|
|
276
|
+
*
|
|
277
|
+
* @param path - The path of the component
|
|
278
|
+
* @param value - Transaction data
|
|
279
|
+
* @param configuration - Optional transaction configuration
|
|
280
|
+
* @param callbacks - Optional callback configuration
|
|
281
|
+
* @returns component URL
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
componentUrl(t, r, s, i) {
|
|
285
|
+
const n = new URL(this.uxUrl);
|
|
286
|
+
n.pathname = t;
|
|
287
|
+
const a = w({
|
|
288
|
+
authToken: this.authToken,
|
|
289
|
+
value: r,
|
|
290
|
+
configuration: s
|
|
291
|
+
});
|
|
292
|
+
return n.hash = a, this.nodeUrl && n.searchParams.set("nodeUrl", this.nodeUrl), this.theme && n.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && n.searchParams.set("locale", this.locale), i && (i.callback && n.searchParams.set("callback_url", i.callback), i.redirectUri && n.searchParams.set("redirect_uri", i.redirectUri)), n.toString();
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Creates a new embedded component
|
|
296
|
+
*
|
|
297
|
+
* @param path - The path of the component
|
|
298
|
+
* @param value - Transaction data
|
|
299
|
+
* @param options - Optional transaction options
|
|
300
|
+
* @param callbacks - Optional callback configuration
|
|
301
|
+
* @returns A new EmbeddedComponent instance
|
|
302
|
+
* @internal
|
|
303
|
+
*/
|
|
304
|
+
createComponent(t, r, s, i) {
|
|
305
|
+
return new N(
|
|
306
|
+
this.componentUrl(t, r, s, i),
|
|
307
|
+
r,
|
|
308
|
+
s
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Creates a withdrawal assist component
|
|
313
|
+
*
|
|
314
|
+
* @param value - Withdrawal transaction data
|
|
315
|
+
* @param options - Optional transaction options
|
|
316
|
+
* @param callbacks - Optional callback configuration
|
|
317
|
+
* @returns A new EmbeddedComponent instance for withdrawal assistance
|
|
318
|
+
*/
|
|
319
|
+
createWithdrawalAssist(t, r, s) {
|
|
320
|
+
return this.createComponent(
|
|
321
|
+
"withdrawal-assist",
|
|
322
|
+
t,
|
|
323
|
+
r,
|
|
324
|
+
s
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Creates a connect component
|
|
329
|
+
*
|
|
330
|
+
* @param value - Connection request data
|
|
331
|
+
* @param options - Optional transaction options
|
|
332
|
+
* @param callbacks - Optional callback configuration
|
|
333
|
+
* @returns A new EmbeddedComponent instance for connection
|
|
334
|
+
* @alpha
|
|
335
|
+
*/
|
|
336
|
+
createConnectWallet(t, r, s) {
|
|
337
|
+
return this.createComponent(
|
|
338
|
+
"connect",
|
|
339
|
+
t,
|
|
340
|
+
r,
|
|
341
|
+
s
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Creates a deposit request component
|
|
346
|
+
*
|
|
347
|
+
* @param value - Deposit request data
|
|
348
|
+
* @param options - Optional transaction options
|
|
349
|
+
* @param callbacks - Optional callback configuration
|
|
350
|
+
* @returns A new EmbeddedComponent instance for deposit requests
|
|
351
|
+
* @public
|
|
352
|
+
*/
|
|
353
|
+
createDepositRequest(t, r, s) {
|
|
354
|
+
return this.createComponent(
|
|
355
|
+
"deposit-request",
|
|
356
|
+
t,
|
|
357
|
+
r,
|
|
358
|
+
s
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Creates a deposit assist component
|
|
363
|
+
*
|
|
364
|
+
* @param value - Partial deposit transaction data
|
|
365
|
+
* @param options - Optional transaction options
|
|
366
|
+
* @param callbacks - Optional callback configuration
|
|
367
|
+
* @returns A new EmbeddedComponent instance for deposit assistance
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
createDepositAssist(t, r, s) {
|
|
371
|
+
return this.createComponent(
|
|
372
|
+
"deposit-assist",
|
|
373
|
+
t,
|
|
374
|
+
r,
|
|
375
|
+
s
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
export {
|
|
380
|
+
u as AgentType,
|
|
381
|
+
h as CMType,
|
|
382
|
+
N as EmbeddedComponent,
|
|
383
|
+
I as ErrorIdentifierCode,
|
|
384
|
+
d as HMType,
|
|
385
|
+
E as PersonType,
|
|
386
|
+
L as ProofStatus,
|
|
387
|
+
g as ProofTypes,
|
|
388
|
+
p as Status,
|
|
389
|
+
f as VASPSearchControl,
|
|
390
|
+
v as ValidationSections,
|
|
391
|
+
C as decodeFragmentToObject,
|
|
392
|
+
U as default
|
|
393
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@notabene/javascript-sdk",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "JavaScript SDK for Notabene",
|
|
5
|
+
"homepage": "https://gitlab.com/notabene/open-source/javascript-sdk",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://gitlab.com/notabene/open-source/javascript-sdk"
|
|
9
|
+
},
|
|
10
|
+
"author": "Notabene <developers@notabene.id>",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"packageManager": "yarn@4.5.1",
|
|
13
|
+
"version": "2.8.0-next.4",
|
|
14
|
+
"source": "src/notabene.ts",
|
|
15
|
+
"main": "dist/cjs/notabene.cjs",
|
|
16
|
+
"module": "dist/esm/notabene.js",
|
|
17
|
+
"types": "dist/notabene.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": {
|
|
21
|
+
"import": "./dist/esm/notabene.d.ts",
|
|
22
|
+
"require": "./dist/cjs/notabene.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"import": "./dist/esm/notabene.js",
|
|
25
|
+
"require": "./dist/cjs/notabene.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./src/types": {
|
|
28
|
+
"types": {
|
|
29
|
+
"import": "./dist/esm/notabene.d.ts",
|
|
30
|
+
"require": "./dist/cjs/notabene.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"import": "./dist/esm/notabene.js",
|
|
33
|
+
"require": "./dist/cjs/notabene.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./src/ivms/types": "./src/ivms/types.ts"
|
|
36
|
+
},
|
|
37
|
+
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"docs",
|
|
44
|
+
"src",
|
|
45
|
+
"package.json",
|
|
46
|
+
"README.md"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"docs": "typedoc --options typedoc.json",
|
|
50
|
+
"prepare": "husky",
|
|
51
|
+
"dev": "vite",
|
|
52
|
+
"preview": "vite preview",
|
|
53
|
+
"build:dev": "yarn build && yarn dev",
|
|
54
|
+
"build:clean": "rimraf dist ts-out coverage temp",
|
|
55
|
+
"build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
|
|
56
|
+
"lint": "eslint . --max-warnings 0",
|
|
57
|
+
"lint:fix": "yarn lint --fix --cache --no-warn-ignored",
|
|
58
|
+
"format": "prettier --write --cache .",
|
|
59
|
+
"format:check": "prettier --check .",
|
|
60
|
+
"test": "vitest",
|
|
61
|
+
"typecheck": "tsc --skipLibCheck",
|
|
62
|
+
"coverage": "vitest run --coverage --coverage.extension=.ts",
|
|
63
|
+
"release": "semantic-release"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@commitlint/cli": "^19.5.0",
|
|
67
|
+
"@commitlint/config-conventional": "^19.5.0",
|
|
68
|
+
"@eslint/js": "^9.13.0",
|
|
69
|
+
"@fast-check/vitest": "^0.1.4",
|
|
70
|
+
"@microsoft/api-extractor": "^7.48.1",
|
|
71
|
+
"@semantic-release/git": "^10.0.1",
|
|
72
|
+
"@semantic-release/gitlab": "^13.2.1",
|
|
73
|
+
"@semantic-release/npm": "^12.0.1",
|
|
74
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
75
|
+
"eslint": "^9.14.0",
|
|
76
|
+
"eslint-config-prettier": "^9.1.0",
|
|
77
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
78
|
+
"fast-check": "^3.23.1",
|
|
79
|
+
"globals": "^15.11.0",
|
|
80
|
+
"husky": "^9.1.6",
|
|
81
|
+
"jsdom": "^25.0.1",
|
|
82
|
+
"lint-staged": "^15.2.10",
|
|
83
|
+
"prettier": "^3.3.3",
|
|
84
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
85
|
+
"rimraf": "^6.0.1",
|
|
86
|
+
"semantic-release": "^24.2.0",
|
|
87
|
+
"typedoc": "^0.27.5",
|
|
88
|
+
"typedoc-plugin-markdown": "^4.2.10",
|
|
89
|
+
"typescript": "^5.7.2",
|
|
90
|
+
"typescript-eslint": "^8.12.2",
|
|
91
|
+
"vite": "^5.4.10",
|
|
92
|
+
"vitest": "^2.1.8"
|
|
93
|
+
},
|
|
94
|
+
"lint-staged": {
|
|
95
|
+
"*.ts": [
|
|
96
|
+
"yarn format:check",
|
|
97
|
+
"yarn lint:fix",
|
|
98
|
+
"yarn typecheck --noEmit",
|
|
99
|
+
"yarn test --run"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"commitlint": {
|
|
103
|
+
"extends": [
|
|
104
|
+
"@commitlint/config-conventional"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
package/dist/notabene.d.ts
CHANGED
|
@@ -573,7 +573,7 @@ export declare enum ErrorIdentifierCode {
|
|
|
573
573
|
* Field properties
|
|
574
574
|
* @public
|
|
575
575
|
*/
|
|
576
|
-
declare type FieldOptions = boolean | {
|
|
576
|
+
export declare type FieldOptions = boolean | string[] | {
|
|
577
577
|
optional: boolean;
|
|
578
578
|
transmit: boolean;
|
|
579
579
|
};
|
|
@@ -725,13 +725,13 @@ declare type LegalPerson_2 = {
|
|
|
725
725
|
countryOfRegistration?: ISOCountryCode;
|
|
726
726
|
};
|
|
727
727
|
|
|
728
|
-
declare type LegalPersonFieldName = 'name' | 'lei' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'countryOfRegistration';
|
|
728
|
+
export declare type LegalPersonFieldName = 'name' | 'lei' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'countryOfRegistration';
|
|
729
729
|
|
|
730
730
|
/**
|
|
731
731
|
* Field properties by field name
|
|
732
732
|
* @public
|
|
733
733
|
*/
|
|
734
|
-
declare type LegalPersonFields = {
|
|
734
|
+
export declare type LegalPersonFields = {
|
|
735
735
|
[name in LegalPersonFieldName]?: FieldOptions;
|
|
736
736
|
};
|
|
737
737
|
|
|
@@ -896,13 +896,13 @@ declare type NaturalPerson_2 = {
|
|
|
896
896
|
* Field names for NaturalPerson
|
|
897
897
|
* @public
|
|
898
898
|
*/
|
|
899
|
-
declare type NaturalPersonFieldName = 'name' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'dateOfBirth' | 'placeOfBirth' | 'countryOfResidence';
|
|
899
|
+
export declare type NaturalPersonFieldName = 'name' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'dateOfBirth' | 'placeOfBirth' | 'countryOfResidence';
|
|
900
900
|
|
|
901
901
|
/**
|
|
902
902
|
* Field properties by field name for Natural persons
|
|
903
903
|
* @public
|
|
904
904
|
*/
|
|
905
|
-
declare type NaturalPersonFields = {
|
|
905
|
+
export declare type NaturalPersonFields = {
|
|
906
906
|
[name in NaturalPersonFieldName]?: FieldOptions;
|
|
907
907
|
};
|
|
908
908
|
|
|
@@ -16,7 +16,7 @@ Configuration options for Transaction components
|
|
|
16
16
|
|
|
17
17
|
#### Defined in
|
|
18
18
|
|
|
19
|
-
[types.ts:
|
|
19
|
+
[types.ts:798](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L798)
|
|
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:
|
|
29
|
+
[types.ts:799](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L799)
|
|
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:
|
|
39
|
+
[types.ts:800](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L800)
|
|
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:
|
|
49
|
+
[types.ts:802](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L802)
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
@@ -84,7 +84,7 @@ Configuration options for Transaction components
|
|
|
84
84
|
|
|
85
85
|
#### Defined in
|
|
86
86
|
|
|
87
|
-
[types.ts:
|
|
87
|
+
[types.ts:788](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L788)
|
|
88
88
|
|
|
89
89
|
***
|
|
90
90
|
|
|
@@ -94,4 +94,4 @@ Configuration options for Transaction components
|
|
|
94
94
|
|
|
95
95
|
#### Defined in
|
|
96
96
|
|
|
97
|
-
[types.ts:
|
|
97
|
+
[types.ts:801](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/types.ts#L801)
|
|
@@ -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/
|
|
21
|
+
[ivms/types.ts:365](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
33
|
+
[ivms/types.ts:367](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
22
|
+
[ivms/types.ts:358](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
34
|
+
[ivms/types.ts:356](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
114
|
+
[ivms/types.ts:119](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
16
|
+
[ivms/types.ts:44](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
30
|
+
[ivms/types.ts:313](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
24
|
+
[ivms/types.ts:335](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
30
|
+
[ivms/types.ts:107](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
22
|
+
[ivms/types.ts:6](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/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/
|
|
23
|
+
[ivms/types.ts:14](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/80aada173fac6a9b5f05869abafa3c1c6cc56aa9/src/ivms/types.ts#L14)
|