@notabene/javascript-sdk 2.17.0 → 2.18.0
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/README.md +102 -0
- package/dist/cjs/notabene.cjs +5 -5
- package/dist/cjs/notabene.d.ts +38 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +38 -1
- package/dist/esm/notabene.js +480 -479
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +38 -1
- package/dist/notabene.js +480 -479
- package/package.json +2 -2
- package/src/notabene.ts +4 -0
- package/src/types.ts +39 -1
- package/src/utils/arbitraries.ts +30 -0
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.18.0",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
|
@@ -107,4 +107,4 @@
|
|
|
107
107
|
"@commitlint/config-conventional"
|
|
108
108
|
]
|
|
109
109
|
}
|
|
110
|
-
}
|
|
110
|
+
}
|
package/src/notabene.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
ComponentResponse,
|
|
15
15
|
ConnectionOptions,
|
|
16
16
|
ConnectionRequest,
|
|
17
|
+
ContactSupportConfig,
|
|
17
18
|
CosmosMetadata,
|
|
18
19
|
Counterparty,
|
|
19
20
|
CounterpartyAssistConfig,
|
|
@@ -74,6 +75,7 @@ import {
|
|
|
74
75
|
ErrorIdentifierCode,
|
|
75
76
|
HMType,
|
|
76
77
|
IdentityVerificationMethod,
|
|
78
|
+
InfoIdentifierCode,
|
|
77
79
|
PersonType,
|
|
78
80
|
ProofStatus,
|
|
79
81
|
ProofTypes,
|
|
@@ -117,6 +119,7 @@ export {
|
|
|
117
119
|
ErrorIdentifierCode,
|
|
118
120
|
HMType,
|
|
119
121
|
IdentityVerificationMethod,
|
|
122
|
+
InfoIdentifierCode,
|
|
120
123
|
PersonType,
|
|
121
124
|
ProofStatus,
|
|
122
125
|
ProofTypes,
|
|
@@ -140,6 +143,7 @@ export type {
|
|
|
140
143
|
ComponentResponse,
|
|
141
144
|
ConnectionOptions,
|
|
142
145
|
ConnectionRequest,
|
|
146
|
+
ContactSupportConfig,
|
|
143
147
|
CosmosMetadata,
|
|
144
148
|
Counterparty,
|
|
145
149
|
CounterpartyAssistConfig,
|
package/src/types.ts
CHANGED
|
@@ -922,6 +922,7 @@ export interface ThresholdOptions {
|
|
|
922
922
|
* - `'signature'` — wallet connection for ownership proof via signature
|
|
923
923
|
* - `'manual-signing'` — ownership proof via manual message signing
|
|
924
924
|
* - `'add-vasp'` — manually add an unlisted exchange/VASP (hosted flow)
|
|
925
|
+
* - `'contact-support'` — show a contact support button
|
|
925
926
|
*
|
|
926
927
|
* Options are automatically filtered by flow (e.g. `add-vasp` is ignored in self-hosted).
|
|
927
928
|
* Including an option implicitly enables that capability.
|
|
@@ -934,7 +935,28 @@ export type SectionOption =
|
|
|
934
935
|
| 'microtransfer' // ProofTypes.MicroTransfer
|
|
935
936
|
| 'signature'
|
|
936
937
|
| 'manual-signing'
|
|
937
|
-
| 'add-vasp'
|
|
938
|
+
| 'add-vasp'
|
|
939
|
+
| 'contact-support';
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Configuration for the contact support action.
|
|
943
|
+
*
|
|
944
|
+
* @remarks
|
|
945
|
+
* Contact support is **enabled** by including `'contact-support'` in
|
|
946
|
+
* `agentSections.main` or `agentSections.fallback`. This object only
|
|
947
|
+
* configures the behaviour when the feature is enabled.
|
|
948
|
+
*
|
|
949
|
+
* - With `contactSupport: { supportUrl: "..." }` — clicking sends an info
|
|
950
|
+
* message to the host **and** attempts to open the URL as a fallback.
|
|
951
|
+
* - Without `contactSupport` — clicking only sends an info message; the
|
|
952
|
+
* host decides what to do.
|
|
953
|
+
*
|
|
954
|
+
* @public
|
|
955
|
+
*/
|
|
956
|
+
export interface ContactSupportConfig {
|
|
957
|
+
/** URL to open when the user clicks the support button */
|
|
958
|
+
supportUrl: string;
|
|
959
|
+
}
|
|
938
960
|
|
|
939
961
|
/**
|
|
940
962
|
* Explicit layout configuration for the agent selection step.
|
|
@@ -983,6 +1005,12 @@ export interface TransactionOptions {
|
|
|
983
1005
|
vasps?: VASPOptions;
|
|
984
1006
|
hide?: ValidationSections[]; // You can hide a specific section of the component by listing it here
|
|
985
1007
|
counterpartyAssist?: CounterpartyAssistConfig;
|
|
1008
|
+
/**
|
|
1009
|
+
* Configuration for the contact support button.
|
|
1010
|
+
* Enablement is controlled via `agentSections` — include `'contact-support'`
|
|
1011
|
+
* in `main` or `fallback` to show the button.
|
|
1012
|
+
*/
|
|
1013
|
+
contactSupport?: ContactSupportConfig;
|
|
986
1014
|
autoSubmit?: boolean; // Defaults to false
|
|
987
1015
|
}
|
|
988
1016
|
/**
|
|
@@ -1111,16 +1139,26 @@ export type Warning = {
|
|
|
1111
1139
|
identifier?: WarningIdentifierCode;
|
|
1112
1140
|
};
|
|
1113
1141
|
|
|
1142
|
+
/**
|
|
1143
|
+
* Identifier codes for info messages
|
|
1144
|
+
* @public
|
|
1145
|
+
*/
|
|
1146
|
+
export enum InfoIdentifierCode {
|
|
1147
|
+
CONTACT_SUPPORT = 'CONTACT_SUPPORT',
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1114
1150
|
/**
|
|
1115
1151
|
* Represents an info component message
|
|
1116
1152
|
* @param message - Info message
|
|
1117
1153
|
* @param description - Description of the info message
|
|
1154
|
+
* @param identifier - Identifier code of the info message
|
|
1118
1155
|
* @public
|
|
1119
1156
|
*/
|
|
1120
1157
|
export type Info = {
|
|
1121
1158
|
type: CMType.INFO;
|
|
1122
1159
|
message: string;
|
|
1123
1160
|
description?: string;
|
|
1161
|
+
identifier?: InfoIdentifierCode;
|
|
1124
1162
|
};
|
|
1125
1163
|
|
|
1126
1164
|
/**
|
package/src/utils/arbitraries.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fc from 'fast-check';
|
|
2
2
|
import type {
|
|
3
3
|
Agent,
|
|
4
|
+
AgentSections,
|
|
4
5
|
BlockchainAddress,
|
|
5
6
|
CAIP10,
|
|
6
7
|
CAIP19,
|
|
@@ -9,6 +10,7 @@ import type {
|
|
|
9
10
|
CallbackOptions,
|
|
10
11
|
ConnectionOptions,
|
|
11
12
|
ConnectionRequest,
|
|
13
|
+
ContactSupportConfig,
|
|
12
14
|
Counterparty,
|
|
13
15
|
CryptoCredential,
|
|
14
16
|
Deposit,
|
|
@@ -19,6 +21,7 @@ import type {
|
|
|
19
21
|
ISOCurrency,
|
|
20
22
|
ISODate,
|
|
21
23
|
NaturalPerson,
|
|
24
|
+
SectionOption,
|
|
22
25
|
ThresholdOptions,
|
|
23
26
|
TransactionAsset,
|
|
24
27
|
TransactionOptions,
|
|
@@ -236,9 +239,35 @@ export const arbitraryVASPOptions = (): fc.Arbitrary<VASPOptions> =>
|
|
|
236
239
|
}),
|
|
237
240
|
);
|
|
238
241
|
|
|
242
|
+
const SECTION_OPTIONS: SectionOption[] = [
|
|
243
|
+
'self-declaration',
|
|
244
|
+
'screenshot',
|
|
245
|
+
'microtransfer',
|
|
246
|
+
'signature',
|
|
247
|
+
'manual-signing',
|
|
248
|
+
'add-vasp',
|
|
249
|
+
'contact-support',
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
export const arbitrarySectionOption = (): fc.Arbitrary<SectionOption> =>
|
|
253
|
+
fc.constantFrom(...SECTION_OPTIONS);
|
|
254
|
+
|
|
255
|
+
export const arbitraryAgentSections = (): fc.Arbitrary<AgentSections> =>
|
|
256
|
+
fc.record({
|
|
257
|
+
main: fc.option(fc.array(arbitrarySectionOption())),
|
|
258
|
+
fallback: fc.option(fc.array(arbitrarySectionOption())),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
export const arbitraryContactSupportConfig =
|
|
262
|
+
(): fc.Arbitrary<ContactSupportConfig> =>
|
|
263
|
+
fc.record({
|
|
264
|
+
supportUrl: fc.webUrl(),
|
|
265
|
+
});
|
|
266
|
+
|
|
239
267
|
export const arbitraryTransactionOptions =
|
|
240
268
|
(): fc.Arbitrary<TransactionOptions> =>
|
|
241
269
|
fc.record({
|
|
270
|
+
agentSections: fc.option(arbitraryAgentSections()),
|
|
242
271
|
proofs: fc.option(
|
|
243
272
|
fc.record({
|
|
244
273
|
microTransfer: fc.option(
|
|
@@ -265,6 +294,7 @@ export const arbitraryTransactionOptions =
|
|
|
265
294
|
hide: fc.option(
|
|
266
295
|
fc.array(fc.constantFrom(...Object.values(ValidationSections))),
|
|
267
296
|
),
|
|
297
|
+
contactSupport: fc.option(arbitraryContactSupportConfig()),
|
|
268
298
|
});
|
|
269
299
|
|
|
270
300
|
export const arbitraryDepositRequestOptions =
|