@soltech/fluid-common 0.5.0 → 0.6.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/.editorconfig +21 -0
- package/.eslintignore +2 -0
- package/.eslintrc +11 -0
- package/.husky/pre-commit +4 -0
- package/lib/index.d.ts +23 -8
- package/lib/index.js +8 -7
- package/package.json +33 -19
- package/src/index.ts +76 -60
package/.editorconfig
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
# Unix-style newlines with a newline ending every file
|
|
7
|
+
[*]
|
|
8
|
+
charset = utf-8
|
|
9
|
+
indent_style = tab
|
|
10
|
+
indent_size = 4
|
|
11
|
+
end_of_line = lf
|
|
12
|
+
max_line_length = 140
|
|
13
|
+
insert_final_newline = true
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
|
|
16
|
+
[*.md]
|
|
17
|
+
trim_trailing_whitespace = false
|
|
18
|
+
max_line_length = off
|
|
19
|
+
|
|
20
|
+
[{package.json,package-lock.json}]
|
|
21
|
+
max_line_length = off
|
package/.eslintignore
ADDED
package/.eslintrc
ADDED
package/lib/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export interface WalletInitParams {
|
|
|
31
31
|
export interface WalletConfig {
|
|
32
32
|
contentText: Record<string, string>;
|
|
33
33
|
defaultDepositAmount: number;
|
|
34
|
-
defaultWithdrawalAmount: number;
|
|
35
34
|
integration: Integration;
|
|
36
35
|
logo: string;
|
|
37
36
|
suggestedDepositAmounts: number[];
|
|
@@ -63,6 +62,12 @@ export interface PaymentMethod {
|
|
|
63
62
|
providerType: string;
|
|
64
63
|
inputFields?: InputField[];
|
|
65
64
|
bonusCodes?: string[];
|
|
65
|
+
instructions?: string;
|
|
66
|
+
fees: PaymentMethodFees;
|
|
67
|
+
}
|
|
68
|
+
export interface PaymentMethodFees {
|
|
69
|
+
fixedAmount?: string;
|
|
70
|
+
percentage?: string;
|
|
66
71
|
}
|
|
67
72
|
export interface PaymentMethodLogo {
|
|
68
73
|
height: number;
|
|
@@ -129,6 +134,7 @@ export interface CryptoTransactionParams extends TransactionParams {
|
|
|
129
134
|
export interface EWalletTransactionParams extends TransactionParams {
|
|
130
135
|
customerNumber?: string;
|
|
131
136
|
email?: string;
|
|
137
|
+
mobile?: string;
|
|
132
138
|
phoneNumber?: string;
|
|
133
139
|
service?: string;
|
|
134
140
|
}
|
|
@@ -159,14 +165,16 @@ export declare enum TransactionState {
|
|
|
159
165
|
}
|
|
160
166
|
export interface ProviderTransactionError {
|
|
161
167
|
code: string;
|
|
168
|
+
textTitle: string;
|
|
162
169
|
text: string;
|
|
163
|
-
action:
|
|
170
|
+
action: Action;
|
|
164
171
|
}
|
|
165
|
-
export declare enum
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
export declare enum Action {
|
|
173
|
+
RESTART_PRESERVING_DETAILS = "RESTART_PRESERVING_DETAILS",
|
|
174
|
+
RESTART_CLEARING_DETAILS = "RESTART_CLEARING_DETAILS",
|
|
175
|
+
SHOW_DETAILS_STEP_PRESERVING_DETAILS = "SHOW_DETAILS_STEP_PRESERVING_DETAILS",
|
|
176
|
+
SHOW_DETAILS_STEP_CLEARING_DETAILS = "SHOW_DETAILS_STEP_CLEARING_DETAILS",
|
|
177
|
+
SHOW_CVC_EDIT = "SHOW_CVC_EDIT"
|
|
170
178
|
}
|
|
171
179
|
export interface PendingWithdrawal {
|
|
172
180
|
amount: string;
|
|
@@ -181,9 +189,16 @@ export declare enum WithdrawalState {
|
|
|
181
189
|
}
|
|
182
190
|
export interface AvailableBonusWithPaymentMethods {
|
|
183
191
|
code: string;
|
|
184
|
-
paymentMethodFilter?:
|
|
192
|
+
paymentMethodFilter?: {
|
|
193
|
+
applyTo?: BonusPaymentMethod[];
|
|
194
|
+
excludeFrom?: BonusPaymentMethod[];
|
|
195
|
+
};
|
|
185
196
|
}
|
|
186
197
|
export interface BonusPaymentMethod {
|
|
187
198
|
providerType: string;
|
|
188
199
|
service?: string;
|
|
189
200
|
}
|
|
201
|
+
export interface TrackingEvent {
|
|
202
|
+
eventId: string;
|
|
203
|
+
data: object;
|
|
204
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -30,13 +30,14 @@ export var TransactionState;
|
|
|
30
30
|
TransactionState["WAITING_APPROVAL"] = "WAITING_APPROVAL";
|
|
31
31
|
TransactionState["WAITING_INPUT"] = "WAITING_INPUT";
|
|
32
32
|
})(TransactionState || (TransactionState = {}));
|
|
33
|
-
export var
|
|
34
|
-
(function (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
export var Action;
|
|
34
|
+
(function (Action) {
|
|
35
|
+
Action["RESTART_PRESERVING_DETAILS"] = "RESTART_PRESERVING_DETAILS";
|
|
36
|
+
Action["RESTART_CLEARING_DETAILS"] = "RESTART_CLEARING_DETAILS";
|
|
37
|
+
Action["SHOW_DETAILS_STEP_PRESERVING_DETAILS"] = "SHOW_DETAILS_STEP_PRESERVING_DETAILS";
|
|
38
|
+
Action["SHOW_DETAILS_STEP_CLEARING_DETAILS"] = "SHOW_DETAILS_STEP_CLEARING_DETAILS";
|
|
39
|
+
Action["SHOW_CVC_EDIT"] = "SHOW_CVC_EDIT";
|
|
40
|
+
})(Action || (Action = {}));
|
|
40
41
|
export var WithdrawalState;
|
|
41
42
|
(function (WithdrawalState) {
|
|
42
43
|
WithdrawalState["REQUESTED"] = "REQUESTED";
|
package/package.json
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"name": "@soltech/fluid-common",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Fluid frontend and API commons",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types:": "lib/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"pub": "npm run build && npm publish && git push",
|
|
11
|
+
"lint": "npx eslint .",
|
|
12
|
+
"lint:fix": "npx eslint . --fix",
|
|
13
|
+
"prepare": "husky"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/soltechno/cashin-common.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Sol Technologies",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@soltech/eslint-config": "^0.2.0",
|
|
23
|
+
"@stylistic/eslint-plugin": "^1.6.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
25
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
26
|
+
"eslint": ">=7.0.0",
|
|
27
|
+
"eslint-plugin-smarter-tabs": "^1.2.0",
|
|
28
|
+
"husky": "^9.0.10",
|
|
29
|
+
"lint-staged": "^15.2.2",
|
|
30
|
+
"typescript": "^5.3.3"
|
|
31
|
+
},
|
|
32
|
+
"lint-staged": {
|
|
33
|
+
"*.{ts}": "eslint --fix"
|
|
34
|
+
}
|
|
21
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
export enum Integration {
|
|
3
2
|
LEFT = 'LEFT',
|
|
4
3
|
RIGHT = 'RIGHT',
|
|
@@ -17,10 +16,10 @@ export enum TraitType {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export enum PaymentType {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
BANK_TRANSFER = 'BankTransfer',
|
|
20
|
+
CREDIT_CARD = 'CreditCard',
|
|
21
|
+
CRYPTO = 'Crypto',
|
|
22
|
+
EWALLET = 'EWallet'
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export interface WalletRequestBody {
|
|
@@ -38,10 +37,9 @@ export interface WalletInitParams {
|
|
|
38
37
|
export interface WalletConfig {
|
|
39
38
|
contentText: Record<string, string>;
|
|
40
39
|
defaultDepositAmount: number;
|
|
41
|
-
defaultWithdrawalAmount: number;
|
|
42
40
|
integration: Integration;
|
|
43
41
|
logo: string;
|
|
44
|
-
|
|
42
|
+
suggestedDepositAmounts: number[];
|
|
45
43
|
theme: Record<string, string>;
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -70,31 +68,38 @@ export interface PaymentMethod {
|
|
|
70
68
|
minAmount: number;
|
|
71
69
|
maxAmount: number;
|
|
72
70
|
info: string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
paymentType: PaymentType;
|
|
72
|
+
providerType: string;
|
|
73
|
+
inputFields?: InputField[];
|
|
74
|
+
bonusCodes?: string[];
|
|
75
|
+
instructions?: string;
|
|
76
|
+
fees: PaymentMethodFees;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PaymentMethodFees {
|
|
80
|
+
fixedAmount?: string;
|
|
81
|
+
percentage?: string;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
export interface PaymentMethodLogo {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
height: number;
|
|
86
|
+
url: string;
|
|
87
|
+
width: number;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
export interface InputField {
|
|
86
91
|
paramName: string;
|
|
87
92
|
format: string;
|
|
88
93
|
text: string;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
placeholderText: string;
|
|
95
|
+
errorText: string;
|
|
96
|
+
options: InputFieldOption[];
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
export interface InputFieldOption {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
label: string;
|
|
101
|
+
code: string;
|
|
102
|
+
logo?: PaymentMethodLogo;
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
export interface RecentMethod extends PaymentMethod {
|
|
@@ -119,37 +124,38 @@ export interface CreditcardTransactionParams extends TransactionParams {
|
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
export interface BankTransferTransactionParams extends TransactionParams {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
127
|
+
accountName?: string;
|
|
128
|
+
accountNumber?: string;
|
|
129
|
+
accountType?: string;
|
|
130
|
+
bankCode?: string;
|
|
131
|
+
bankName?: string;
|
|
132
|
+
beneficiaryCity?: string;
|
|
133
|
+
beneficiaryCountry?: string;
|
|
134
|
+
beneficiaryName?: string;
|
|
135
|
+
beneficiaryState?: string;
|
|
136
|
+
beneficiaryStreet?: string;
|
|
137
|
+
beneficiaryZip?: string;
|
|
138
|
+
bic?: string;
|
|
139
|
+
branchAddress?: string;
|
|
140
|
+
branchCode?: string;
|
|
141
|
+
branchName?: string;
|
|
142
|
+
clearingNumber?: string;
|
|
143
|
+
countryCode?: string;
|
|
144
|
+
iban?: string;
|
|
145
|
+
nationalId?: string;
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
export interface CryptoTransactionParams extends TransactionParams {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
cryptoCurrency?: string;
|
|
150
|
+
destinationTag?: string;
|
|
151
|
+
walletAddress?: string;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
export interface EWalletTransactionParams extends TransactionParams {
|
|
150
|
-
|
|
155
|
+
customerNumber?: string;
|
|
151
156
|
email?: string;
|
|
152
|
-
|
|
157
|
+
mobile?: string;
|
|
158
|
+
phoneNumber?: string;
|
|
153
159
|
service?: string;
|
|
154
160
|
}
|
|
155
161
|
|
|
@@ -159,7 +165,7 @@ export interface TransactionOptions {
|
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
export interface TransactionResult {
|
|
162
|
-
|
|
168
|
+
error?: ProviderTransactionError;
|
|
163
169
|
redirectOutput?: RedirectOutput;
|
|
164
170
|
state: TransactionState;
|
|
165
171
|
statusCode: string;
|
|
@@ -177,43 +183,53 @@ export interface RedirectOutput {
|
|
|
177
183
|
export enum TransactionState {
|
|
178
184
|
SUCCESS = 'SUCCESS',
|
|
179
185
|
FAIL = 'FAIL',
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
PROCESSING = 'PROCESSING',
|
|
187
|
+
WAITING_APPROVAL = 'WAITING_APPROVAL',
|
|
182
188
|
WAITING_INPUT = 'WAITING_INPUT'
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
export interface ProviderTransactionError {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
code: string;
|
|
193
|
+
textTitle: string;
|
|
194
|
+
text: string;
|
|
195
|
+
action: Action;
|
|
189
196
|
}
|
|
190
197
|
|
|
191
|
-
export enum
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
export enum Action {
|
|
199
|
+
RESTART_PRESERVING_DETAILS = 'RESTART_PRESERVING_DETAILS',
|
|
200
|
+
RESTART_CLEARING_DETAILS = 'RESTART_CLEARING_DETAILS',
|
|
201
|
+
SHOW_DETAILS_STEP_PRESERVING_DETAILS = 'SHOW_DETAILS_STEP_PRESERVING_DETAILS',
|
|
202
|
+
SHOW_DETAILS_STEP_CLEARING_DETAILS = 'SHOW_DETAILS_STEP_CLEARING_DETAILS',
|
|
203
|
+
SHOW_CVC_EDIT = 'SHOW_CVC_EDIT'
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
export interface PendingWithdrawal {
|
|
199
207
|
amount: string;
|
|
200
|
-
|
|
208
|
+
creationDate: string;
|
|
201
209
|
providerType: string;
|
|
202
210
|
state: WithdrawalState;
|
|
203
211
|
transactionId: string;
|
|
204
212
|
}
|
|
205
213
|
|
|
206
214
|
export enum WithdrawalState {
|
|
207
|
-
|
|
208
|
-
|
|
215
|
+
REQUESTED = 'REQUESTED',
|
|
216
|
+
PROCESSING = 'PROCESSING'
|
|
209
217
|
}
|
|
210
218
|
|
|
211
219
|
export interface AvailableBonusWithPaymentMethods {
|
|
212
220
|
code: string;
|
|
213
|
-
|
|
221
|
+
paymentMethodFilter?: {
|
|
222
|
+
applyTo?: BonusPaymentMethod[];
|
|
223
|
+
excludeFrom?: BonusPaymentMethod[];
|
|
224
|
+
}
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
export interface BonusPaymentMethod {
|
|
217
228
|
providerType: string;
|
|
218
229
|
service?: string;
|
|
219
|
-
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface TrackingEvent {
|
|
233
|
+
eventId: string;
|
|
234
|
+
data: object;
|
|
235
|
+
}
|