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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +281 -231
  3. package/dist/js/notabene.js +1 -0
  4. package/dist/notabene.cjs +1 -1
  5. package/dist/notabene.d.ts +1052 -209
  6. package/dist/notabene.js +275 -105
  7. package/dist/tsdoc-metadata.json +1 -1
  8. package/package.json +36 -26
  9. package/src/__tests__/notabene.test.ts +43 -0
  10. package/src/components/EmbeddedComponent.ts +141 -22
  11. package/src/components/__tests__/EmbeddedComponent.test.ts +73 -20
  12. package/src/ivms/types.ts +230 -152
  13. package/src/locales.ts +47 -0
  14. package/src/notabene.ts +243 -90
  15. package/src/types.ts +723 -144
  16. package/src/utils/MessageEventManager.ts +70 -12
  17. package/src/utils/__tests__/MessageEventManager.test.ts +13 -5
  18. package/src/utils/arbitraries.ts +9 -4
  19. package/.editorconfig +0 -10
  20. package/.gitlab-ci.yml +0 -85
  21. package/.husky/commit-msg +0 -4
  22. package/.husky/pre-commit +0 -4
  23. package/.husky/pre-push +0 -4
  24. package/.prettierrc +0 -4
  25. package/.releaserc.json +0 -16
  26. package/.vscode/extensions.json +0 -3
  27. package/.vscode/settings.json +0 -11
  28. package/.yarn/releases/yarn-berry.cjs +0 -925
  29. package/.yarnrc.yml +0 -3
  30. package/CODEOWNERS +0 -1
  31. package/api-extractor.json +0 -434
  32. package/eslint.config.js +0 -24
  33. package/etc/javascript-sdk.api.md +0 -363
  34. package/index.html +0 -137
  35. package/temp/javascript-sdk.api.json +0 -3509
  36. package/temp/javascript-sdk.api.md +0 -363
  37. package/ts-out/src/__tests__/notabene.test.d.ts +0 -1
  38. package/ts-out/src/__tests__/notabene.test.js +0 -88
  39. package/ts-out/src/arbitraries.d.ts +0 -4
  40. package/ts-out/src/arbitraries.js +0 -8
  41. package/ts-out/src/components/EmbeddedComponent.d.ts +0 -25
  42. package/ts-out/src/components/EmbeddedComponent.js +0 -87
  43. package/ts-out/src/components/__tests__/EmbeddedComponent.test.d.ts +0 -1
  44. package/ts-out/src/components/__tests__/EmbeddedComponent.test.js +0 -132
  45. package/ts-out/src/ivms/types.d.ts +0 -252
  46. package/ts-out/src/ivms/types.js +0 -1
  47. package/ts-out/src/notabene.d.ts +0 -35
  48. package/ts-out/src/notabene.js +0 -59
  49. package/ts-out/src/types.d.ts +0 -357
  50. package/ts-out/src/types.js +0 -85
  51. package/ts-out/src/utils/MessageEventManager.d.ts +0 -12
  52. package/ts-out/src/utils/MessageEventManager.js +0 -45
  53. package/ts-out/src/utils/__tests__/MessageEventManager.test.d.ts +0 -1
  54. package/ts-out/src/utils/__tests__/MessageEventManager.test.js +0 -73
  55. package/ts-out/src/utils/arbitraries.d.ts +0 -6
  56. package/ts-out/src/utils/arbitraries.js +0 -7
  57. package/ts-out/src/utils/caip.d.ts +0 -13
  58. package/ts-out/src/utils/caip.js +0 -15
  59. package/ts-out/src/utils/urls.d.ts +0 -1
  60. package/ts-out/src/utils/urls.js +0 -14
  61. package/ts-out/tsconfig.tsbuildinfo +0 -1
  62. package/tsconfig.json +0 -22
  63. package/tsconfig.tsbuildinfo +0 -1
  64. package/vite.config.js +0 -13
@@ -1,363 +0,0 @@
1
- ## API Report File for "@notabene/javascript-sdk"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- // @public
8
- export interface Agent {
9
- // Warning: (ae-forgotten-export) The symbol "DID" needs to be exported by the entry point notabene.d.ts
10
- //
11
- // (undocumented)
12
- did: DID;
13
- // (undocumented)
14
- logo?: string;
15
- // (undocumented)
16
- name?: string;
17
- // (undocumented)
18
- type: AgentType;
19
- // (undocumented)
20
- url?: string;
21
- // (undocumented)
22
- verified?: boolean;
23
- }
24
-
25
- // @public
26
- export enum AgentType {
27
- // (undocumented)
28
- PRIVATE = "WALLET",
29
- // (undocumented)
30
- VASP = "VASP"
31
- }
32
-
33
- // Warning: (ae-internal-missing-underscore) The name "CMType" should be prefixed with an underscore because the declaration is marked as @internal
34
- //
35
- // @internal
36
- export const enum CMType {
37
- // (undocumented)
38
- CANCEL = "cancel",
39
- // (undocumented)
40
- CLOSE = "closeModal",
41
- // (undocumented)
42
- COMPLETE = "complete",
43
- // (undocumented)
44
- ERROR = "error",
45
- // (undocumented)
46
- INVALID = "invalid",
47
- // (undocumented)
48
- MODAL = "openModal",
49
- // (undocumented)
50
- READY = "ready",
51
- // (undocumented)
52
- RESIZE = "resize",
53
- // (undocumented)
54
- RESULT = "result"
55
- }
56
-
57
- // Warning: (ae-forgotten-export) The symbol "Completed" needs to be exported by the entry point notabene.d.ts
58
- // Warning: (ae-forgotten-export) The symbol "Cancel" needs to be exported by the entry point notabene.d.ts
59
- // Warning: (ae-forgotten-export) The symbol "Error_2" needs to be exported by the entry point notabene.d.ts
60
- // Warning: (ae-forgotten-export) The symbol "Result" needs to be exported by the entry point notabene.d.ts
61
- // Warning: (ae-forgotten-export) The symbol "Ready" needs to be exported by the entry point notabene.d.ts
62
- // Warning: (ae-forgotten-export) The symbol "ResizeRequest" needs to be exported by the entry point notabene.d.ts
63
- // Warning: (ae-forgotten-export) The symbol "ModalRequest" needs to be exported by the entry point notabene.d.ts
64
- // Warning: (ae-forgotten-export) The symbol "InvalidValue" needs to be exported by the entry point notabene.d.ts
65
- // Warning: (ae-forgotten-export) The symbol "CloseModal" needs to be exported by the entry point notabene.d.ts
66
- // Warning: (ae-internal-missing-underscore) The name "ComponentMessage" should be prefixed with an underscore because the declaration is marked as @internal
67
- //
68
- // @internal
69
- export type ComponentMessage = Completed | Cancel | Error_2 | Result | Ready | ResizeRequest | ModalRequest | InvalidValue | CloseModal;
70
-
71
- // @public
72
- export interface Counterparty {
73
- // (undocumented)
74
- accountNumber?: string;
75
- // (undocumented)
76
- did?: string;
77
- // (undocumented)
78
- geographicAddress?: string;
79
- // (undocumented)
80
- name?: string;
81
- // (undocumented)
82
- type?: PersonType;
83
- // (undocumented)
84
- verified?: boolean;
85
- }
86
-
87
- // @public
88
- export interface DeclarationProof extends OwnershipProof {
89
- // (undocumented)
90
- attestation: string;
91
- // (undocumented)
92
- confirmed: boolean;
93
- // (undocumented)
94
- type: ProofTypes.SelfDeclaration;
95
- }
96
-
97
- // Warning: (ae-forgotten-export) The symbol "BlockchainAddress" needs to be exported by the entry point notabene.d.ts
98
- // Warning: (ae-forgotten-export) The symbol "CAIP19" needs to be exported by the entry point notabene.d.ts
99
- // Warning: (ae-forgotten-export) The symbol "TravelAddress" needs to be exported by the entry point notabene.d.ts
100
- //
101
- // @public
102
- export type destination = BlockchainAddress | CAIP19 | TravelAddress;
103
-
104
- // @public
105
- export class EmbeddedComponent {
106
- constructor(url: string, value: Partial<Transaction>);
107
- // (undocumented)
108
- completion(): Promise<TransactionResponse>;
109
- // Warning: (ae-forgotten-export) The symbol "ValidationError" needs to be exported by the entry point notabene.d.ts
110
- //
111
- // (undocumented)
112
- get errors(): ValidationError[];
113
- // (undocumented)
114
- mount(parentId: string): void;
115
- // (undocumented)
116
- off(messageType: string, callback: MessageCallback): void;
117
- // Warning: (ae-forgotten-export) The symbol "MessageCallback" needs to be exported by the entry point notabene.d.ts
118
- //
119
- // (undocumented)
120
- on(messageType: string, callback: MessageCallback): void;
121
- // (undocumented)
122
- open(): void;
123
- // Warning: (ae-incompatible-release-tags) The symbol "send" is marked as @public, but its signature references "HostMessage" which is marked as @internal
124
- //
125
- // (undocumented)
126
- send(message: HostMessage): void;
127
- // (undocumented)
128
- update(value: Partial<Transaction>): void;
129
- // (undocumented)
130
- get url(): string;
131
- // (undocumented)
132
- get value(): Partial<Transaction>;
133
- }
134
-
135
- // Warning: (ae-forgotten-export) The symbol "UpdateValue" needs to be exported by the entry point notabene.d.ts
136
- // Warning: (ae-forgotten-export) The symbol "RequestResponse" needs to be exported by the entry point notabene.d.ts
137
- // Warning: (ae-internal-missing-underscore) The name "HostMessage" should be prefixed with an underscore because the declaration is marked as @internal
138
- //
139
- // @internal
140
- export type HostMessage = UpdateValue | RequestResponse;
141
-
142
- // @public
143
- export type IVMS101 = {
144
- originator?: Originator;
145
- beneficiary?: Beneficiary;
146
- originatingVASP?: OriginatingVASP;
147
- beneficiaryVASP?: BeneficiaryVASP;
148
- transferPath?: TransferPath;
149
- payloadMetadata?: PayloadMetadata;
150
- };
151
-
152
- // @public
153
- export interface MicroTransferProof extends OwnershipProof {
154
- // (undocumented)
155
- amount: number;
156
- // Warning: (ae-forgotten-export) The symbol "CAIP2" needs to be exported by the entry point notabene.d.ts
157
- //
158
- // (undocumented)
159
- chain: CAIP2;
160
- // (undocumented)
161
- txhash: string;
162
- // (undocumented)
163
- type: ProofTypes.MicroTransfer;
164
- }
165
-
166
- // @public
167
- class Notabene {
168
- constructor(config: NotabeneConfig);
169
- // Warning: (ae-forgotten-export) The symbol "CallbackOptions" needs to be exported by the entry point notabene.d.ts
170
- //
171
- // (undocumented)
172
- componentUrl(path: string, value: Partial<Transaction>, configuration?: any, callbacks?: CallbackOptions): string;
173
- // (undocumented)
174
- createComponent(path: string, value: Partial<Transaction>, options?: any, callbacks?: CallbackOptions): EmbeddedComponent;
175
- // (undocumented)
176
- createWithdrawalAssist(value: Partial<Withdrawal>, options?: any, callbacks?: CallbackOptions): EmbeddedComponent;
177
- // (undocumented)
178
- decodeFragmentToObject(fragment: string): Record<string, string>;
179
- }
180
- export { Notabene }
181
- export default Notabene;
182
-
183
- // @public
184
- export interface NotabeneConfig {
185
- // (undocumented)
186
- authToken: string;
187
- // (undocumented)
188
- dictionary?: {
189
- [key: string]: string;
190
- };
191
- // (undocumented)
192
- nodeUrl: string;
193
- // (undocumented)
194
- theme?: Theme;
195
- // (undocumented)
196
- uxUrl?: string;
197
- }
198
-
199
- // @public
200
- export interface OwnershipProof {
201
- // Warning: (ae-forgotten-export) The symbol "CAIP10" needs to be exported by the entry point notabene.d.ts
202
- //
203
- // (undocumented)
204
- address: CAIP10;
205
- // (undocumented)
206
- did: DID;
207
- // (undocumented)
208
- status: ProofStatus;
209
- // (undocumented)
210
- type: ProofTypes;
211
- }
212
-
213
- // @public
214
- export enum PersonType {
215
- // (undocumented)
216
- LEGAL = "legal",
217
- // (undocumented)
218
- NATURAL = "natural",
219
- // (undocumented)
220
- SELF = "self"
221
- }
222
-
223
- // @public
224
- export enum ProofStatus {
225
- // (undocumented)
226
- FAILED = "rejected",// Verification is pending
227
- // (undocumented)
228
- FLAGGED = "flagged",// Rejected
229
- // (undocumented)
230
- PENDING = "pending",// Flagged for manual review
231
- // (undocumented)
232
- VERIFIED = "verified"
233
- }
234
-
235
- // @public
236
- export enum ProofTypes {
237
- // (undocumented)
238
- MicroTransfer = "microtransfer",
239
- // (undocumented)
240
- PersonalSignBIP137 = "bip-137",
241
- // (undocumented)
242
- PersonalSignEIP191 = "eip-191",
243
- // (undocumented)
244
- PersonalSignEIP712 = "eip-712",
245
- // (undocumented)
246
- PersonalSignXPUB = "xpub",
247
- // (undocumented)
248
- Screenshot = "screenshot",
249
- // (undocumented)
250
- SelfDeclaration = "self-declaration"
251
- }
252
-
253
- // @public
254
- export interface ScreenshotProof extends OwnershipProof {
255
- // (undocumented)
256
- type: ProofTypes.Screenshot;
257
- // (undocumented)
258
- url: string;
259
- }
260
-
261
- // @public
262
- export interface SignatureProof extends OwnershipProof {
263
- // (undocumented)
264
- attestation: string;
265
- // (undocumented)
266
- proof: string;
267
- // (undocumented)
268
- type: ProofTypes.PersonalSignEIP191 | ProofTypes.PersonalSignEIP712 | ProofTypes.PersonalSignBIP137 | ProofTypes.PersonalSignXPUB;
269
- // (undocumented)
270
- wallet_provider: string;
271
- }
272
-
273
- // @public
274
- export enum Status {
275
- // (undocumented)
276
- BANNED = "banned",
277
- // (undocumented)
278
- EMPTY = "empty",
279
- // (undocumented)
280
- PENDING = "pending",
281
- // (undocumented)
282
- VERIFIED = "verified",
283
- // (undocumented)
284
- VERIFY = "verify"
285
- }
286
-
287
- // @public
288
- export type Theme = {
289
- primaryColor: string;
290
- secondaryColor: string;
291
- fontFamily: string;
292
- logo: string;
293
- };
294
-
295
- // @public
296
- export interface Transaction {
297
- // (undocumented)
298
- agent: Agent;
299
- // (undocumented)
300
- amountDecimal: number;
301
- // (undocumented)
302
- asset: TransactionAsset;
303
- // (undocumented)
304
- counterparty: Counterparty;
305
- // (undocumented)
306
- customAssetPrice?: {
307
- price: number;
308
- currency: string;
309
- };
310
- // (undocumented)
311
- customer?: Counterparty;
312
- }
313
-
314
- // Warning: (ae-forgotten-export) The symbol "NotabeneAsset" needs to be exported by the entry point notabene.d.ts
315
- // Warning: (ae-forgotten-export) The symbol "DTI" needs to be exported by the entry point notabene.d.ts
316
- //
317
- // @public
318
- export type TransactionAsset = NotabeneAsset | CAIP19 | DTI;
319
-
320
- // @public
321
- export type TransactionResponse = {
322
- value: Transaction;
323
- ivms: IVMS101;
324
- proof?: OwnershipProof;
325
- valid: boolean;
326
- status: Status;
327
- errors: ValidationError[];
328
- };
329
-
330
- // @public
331
- export interface VASP extends Agent {
332
- // (undocumented)
333
- name?: string;
334
- // (undocumented)
335
- url?: string;
336
- }
337
-
338
- // @public
339
- export interface Wallet extends Agent {
340
- // (undocumented)
341
- proof: OwnershipProof;
342
- // (undocumented)
343
- wallet_connect_id?: string;
344
- }
345
-
346
- // Warning: (ae-forgotten-export) The symbol "BeneficiaryFields" needs to be exported by the entry point notabene.d.ts
347
- //
348
- // @public
349
- export interface Withdrawal extends BeneficiaryFields, Transaction {
350
- }
351
-
352
- // Warnings were encountered during analysis:
353
- //
354
- // ts-out/src/ivms/types.d.ts:246:5 - (ae-forgotten-export) The symbol "Originator" needs to be exported by the entry point notabene.d.ts
355
- // ts-out/src/ivms/types.d.ts:247:5 - (ae-forgotten-export) The symbol "Beneficiary" needs to be exported by the entry point notabene.d.ts
356
- // ts-out/src/ivms/types.d.ts:248:5 - (ae-forgotten-export) The symbol "OriginatingVASP" needs to be exported by the entry point notabene.d.ts
357
- // ts-out/src/ivms/types.d.ts:249:5 - (ae-forgotten-export) The symbol "BeneficiaryVASP" needs to be exported by the entry point notabene.d.ts
358
- // ts-out/src/ivms/types.d.ts:250:5 - (ae-forgotten-export) The symbol "TransferPath" needs to be exported by the entry point notabene.d.ts
359
- // ts-out/src/ivms/types.d.ts:251:5 - (ae-forgotten-export) The symbol "PayloadMetadata" needs to be exported by the entry point notabene.d.ts
360
-
361
- // (No @packageDocumentation comment for this package)
362
-
363
- ```
package/index.html DELETED
@@ -1,137 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- ​
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <title>Notabene Widget Example</title>
9
- <script type="module">
10
- import Notabene from '/src/notabene.ts';
11
- const nb = new Notabene({
12
- nodeUrl: 'https://api-qa.eu.notabene.dev',
13
- uxUrl: 'http://localhost:8000',
14
- authToken:
15
- 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE3MjI5NDQ0NTcsImV4cCI6bnVsbCwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL2FwaS5ub3RhYmVuZS5pZC9zY2hlbWFzL3YxIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJBY2Nlc3NUb2tlbiJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJub25jZSI6IjNkNGUxMzVjLWUzZjgtNGVjOC1iZTY1LTZhYjI4ODZhM2U3NSIsImV4cGlyYXRpb25EYXRlIjoxNzIzMDMwODU3NjY1LCJzY29wZSI6ImN1c3RvbWVyIiwidmFzcF9kaWQiOiJkaWQ6ZXRocjoweGQyODUzNGY3N2VkYjUyODRjN2I3ODg2YmVjNjk5ODI2NWNhYTFiMDYifX0sInN1YiI6ImRpZDpldGhyOjB4YWFjYmM3MGQ1ZGEzYjg0Mzk4ZjM1NmVkYzVmNjU2ZmMzNDVlMDk2ZiIsImlzcyI6ImRpZDpldGhyOjB4ZDI4NTM0Zjc3ZWRiNTI4NGM3Yjc4ODZiZWM2OTk4MjY1Y2FhMWIwNiJ9.h0yG5ev6X3oFtMkFBEmIXK9_iZtE1vrW51XjZ0-Yw7gbNKAKKpue01V4z8AgM08-1aPoJhugpNeGHGlyGq3vlwE',
16
- theme: {
17
- // primaryColor: '#fff',
18
- // primaryFontColor: '#fff',
19
- // secondaryFontColor: '#fff',
20
- // backgroundColor: 'black',
21
- // mode: 'dark',
22
- },
23
- // transactionTypeAllowed: 'VASP_2_VASP_ONLY',
24
- // nonCustodialDeclarationType: 'DECLARATION',
25
- // optInFeatures: ['REUSE_ADDRESS_OWNERSHIP_PROOF'],
26
-
27
- // @deprecated
28
- // beneficiaryDetails: ['beneficiaryNationalIdentification'],
29
-
30
- // fieldsProps: {
31
- // nationalIdentification: {
32
- // forceDisplay: true,
33
- // },
34
- // dateAndPlaceOfBirth: {
35
- // forceDisplay: true,
36
- // },
37
- // geographicAddress: {
38
- // forceDisplay: true,
39
- // optional: true
40
- // },
41
- // counterparty: {
42
- // optional: true
43
- // }
44
- // }
45
- // fallbacks: [{flow: "WALLET_NOT_SUPPORTED", action: "REJECT"}]
46
- });
47
-
48
- const component = nb.createWithdrawalAssist({
49
- asset: 'ETH',
50
- customer: {
51
- name: 'John Doe',
52
- type: PersonType.NATURAL,
53
- },
54
- destination: '0x8e73ea19a72e89f20339f5a9e4cda8e4b230455c',
55
- amountDecimal: 40.1,
56
- });
57
- component.mount('#withdrawal-assist');
58
- component.on('error', console.error);
59
- component.on('complete', (result) => {
60
- console.log('result', result);
61
- document.getElementById('result').innerText = JSON.stringify(
62
- result,
63
- null,
64
- 2,
65
- );
66
- });
67
-
68
- const fullscreen = nb.createWithdrawalAssist(
69
- {
70
- asset: 'BTC',
71
- // originatorAccountNumber: '0xdc0fF33a148031FasdfD1DE1e18e23456b25E1d8',
72
- destination: '0x8e73ea19a72e89f20339f5a9e4cda8e4b230455c',
73
- amountDecimal: 40.1,
74
- },
75
- {},
76
- {
77
- redirectUri: document.location.href,
78
- },
79
- );
80
- document
81
- .getElementById('open-fullscreen')
82
- .addEventListener('click', () => {
83
- document.location.hash = undefined;
84
- fullscreen.open();
85
- });
86
- if (document.location.hash) {
87
- const response = nb.decodeFragmentToObject(document.location.hash);
88
- console.log(response);
89
- document.getElementById('result').innerText = JSON.stringify(
90
- JSON.parse(response['message']),
91
- null,
92
- 2,
93
- );
94
- }
95
- </script>
96
- <link
97
- rel="stylesheet"
98
- href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
99
- />
100
-
101
- <style>
102
- body {
103
- margin: 0;
104
- padding: 1em;
105
- max-width: 800px;
106
- }
107
- #container {
108
- max-width: 100vw;
109
- }
110
- pre {
111
- border: 1px solid #ccc;
112
- padding: 1em;
113
- font-family: monospace;
114
- }
115
- </style>
116
- </head>
117
- ​
118
- <body>
119
- <h1>Notabene Javascript SDK</h1>
120
- <section>
121
- <h2>Withdrawal Assist</h2>
122
- <section>
123
- <h3>Embedded</h3>
124
- <div id="withdrawal-assist"></div>
125
- </section>
126
- <section>
127
- <h3>Full Screen</h3>
128
- <button id="open-fullscreen">Open fullscreen</button>
129
- </section>
130
- <section>
131
- <h3>result</h3>
132
- <pre id="result"></pre>
133
- </section>
134
- </section>
135
- </body>
136
- ​
137
- </html>