@soltech/fluid-common 0.5.1 → 0.6.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.
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
@@ -0,0 +1,2 @@
1
+ lib
2
+ node_modules
package/.eslintrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "root": true,
3
+ "extends": [
4
+ "@soltech"
5
+ ],
6
+ "parserOptions": {
7
+ "project": "./tsconfig.json",
8
+ "ecmaVersion": 2020,
9
+ "sourceType": "module"
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
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[];
@@ -42,7 +41,7 @@ export interface WalletConfigParams {
42
41
  theme: Record<string, TraitType>;
43
42
  }
44
43
  export interface AllPaymentMethods {
45
- storedPaymentMethods: StoredMethod[];
44
+ recentPaymentMethods: RecentMethod[];
46
45
  paymentMethods: PaymentMethod[];
47
46
  }
48
47
  export interface AllPaymentMethodsByTransactionType {
@@ -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?: number;
70
+ percentage?: number;
66
71
  }
67
72
  export interface PaymentMethodLogo {
68
73
  height: number;
@@ -82,7 +87,7 @@ export interface InputFieldOption {
82
87
  code: string;
83
88
  logo?: PaymentMethodLogo;
84
89
  }
85
- export interface StoredMethod extends PaymentMethod {
90
+ export interface RecentMethod extends PaymentMethod {
86
91
  accountId: string;
87
92
  maskedAccount: string;
88
93
  lastSuccess: string;
@@ -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: ErrorAction;
170
+ action: Action;
164
171
  }
165
- export declare enum ErrorAction {
166
- RETURN_STEP1 = "RETURN_STEP1",
167
- RETURN_STEP1_FORCE_NEW_METHOD = "RETURN_STEP1_FORCE_NEW_METHOD",
168
- RETURN_STEP2 = "RETURN_STEP2",
169
- BLOCK_DEPOSITS = "BLOCK_DEPOSITS"
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?: BonusPaymentMethod[];
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 ErrorAction;
34
- (function (ErrorAction) {
35
- ErrorAction["RETURN_STEP1"] = "RETURN_STEP1";
36
- ErrorAction["RETURN_STEP1_FORCE_NEW_METHOD"] = "RETURN_STEP1_FORCE_NEW_METHOD";
37
- ErrorAction["RETURN_STEP2"] = "RETURN_STEP2";
38
- ErrorAction["BLOCK_DEPOSITS"] = "BLOCK_DEPOSITS";
39
- })(ErrorAction || (ErrorAction = {}));
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
- "name": "@soltech/fluid-common",
3
- "version": "0.5.1",
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
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/soltechno/cashin-common.git"
15
- },
16
- "author": "Sol Technologies",
17
- "license": "ISC",
18
- "devDependencies": {
19
- "typescript": "^5.0.4"
20
- }
2
+ "name": "@soltech/fluid-common",
3
+ "version": "0.6.1",
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
- BANK_TRANSFER = 'BankTransfer',
21
- CREDIT_CARD = 'CreditCard',
22
- CRYPTO = 'Crypto',
23
- EWALLET = 'EWallet'
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
- suggestedDepositAmounts: number[];
42
+ suggestedDepositAmounts: number[];
45
43
  theme: Record<string, string>;
46
44
  }
47
45
 
@@ -51,7 +49,7 @@ export interface WalletConfigParams {
51
49
  }
52
50
 
53
51
  export interface AllPaymentMethods {
54
- storedPaymentMethods: StoredMethod[];
52
+ recentPaymentMethods: RecentMethod[];
55
53
  paymentMethods: PaymentMethod[];
56
54
  }
57
55
 
@@ -70,34 +68,41 @@ export interface PaymentMethod {
70
68
  minAmount: number;
71
69
  maxAmount: number;
72
70
  info: string;
73
- paymentType: PaymentType;
74
- providerType: string;
75
- inputFields?: InputField[];
76
- bonusCodes?: string[];
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?: number;
81
+ percentage?: number;
77
82
  }
78
83
 
79
84
  export interface PaymentMethodLogo {
80
- height: number;
81
- url: string;
82
- width: number;
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
- placeholderText: string;
90
- errorText: string;
91
- options: InputFieldOption[];
94
+ placeholderText: string;
95
+ errorText: string;
96
+ options: InputFieldOption[];
92
97
  }
93
98
 
94
99
  export interface InputFieldOption {
95
- label: string;
96
- code: string;
97
- logo?: PaymentMethodLogo;
100
+ label: string;
101
+ code: string;
102
+ logo?: PaymentMethodLogo;
98
103
  }
99
104
 
100
- export interface StoredMethod extends PaymentMethod {
105
+ export interface RecentMethod extends PaymentMethod {
101
106
  accountId: string;
102
107
  maskedAccount: string;
103
108
  lastSuccess: string;
@@ -119,37 +124,38 @@ export interface CreditcardTransactionParams extends TransactionParams {
119
124
  }
120
125
 
121
126
  export interface BankTransferTransactionParams extends TransactionParams {
122
- accountName?: string;
123
- accountNumber?: string;
124
- accountType?: string;
125
- bankCode?: string;
126
- bankName?: string;
127
- beneficiaryCity?: string;
128
- beneficiaryCountry?: string;
129
- beneficiaryName?: string;
130
- beneficiaryState?: string;
131
- beneficiaryStreet?: string;
132
- beneficiaryZip?: string;
133
- bic?: string;
134
- branchAddress?: string;
135
- branchCode?: string;
136
- branchName?: string;
137
- clearingNumber?: string;
138
- countryCode?: string;
139
- iban?: string;
140
- nationalId?: string;
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
- cryptoCurrency?: string;
145
- destinationTag?: string;
146
- walletAddress?: string;
149
+ cryptoCurrency?: string;
150
+ destinationTag?: string;
151
+ walletAddress?: string;
147
152
  }
148
153
 
149
154
  export interface EWalletTransactionParams extends TransactionParams {
150
- customerNumber?: string;
155
+ customerNumber?: string;
151
156
  email?: string;
152
- phoneNumber?: string;
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
- error?: ProviderTransactionError;
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
- PROCESSING = 'PROCESSING',
181
- WAITING_APPROVAL = 'WAITING_APPROVAL',
186
+ PROCESSING = 'PROCESSING',
187
+ WAITING_APPROVAL = 'WAITING_APPROVAL',
182
188
  WAITING_INPUT = 'WAITING_INPUT'
183
189
  }
184
190
 
185
191
  export interface ProviderTransactionError {
186
- code: string;
187
- text: string;
188
- action: ErrorAction;
192
+ code: string;
193
+ textTitle: string;
194
+ text: string;
195
+ action: Action;
189
196
  }
190
197
 
191
- export enum ErrorAction {
192
- RETURN_STEP1 = 'RETURN_STEP1',
193
- RETURN_STEP1_FORCE_NEW_METHOD = 'RETURN_STEP1_FORCE_NEW_METHOD',
194
- RETURN_STEP2 = 'RETURN_STEP2',
195
- BLOCK_DEPOSITS = 'BLOCK_DEPOSITS'
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
- creationDate: string;
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
- REQUESTED = 'REQUESTED',
208
- PROCESSING = 'PROCESSING'
215
+ REQUESTED = 'REQUESTED',
216
+ PROCESSING = 'PROCESSING'
209
217
  }
210
218
 
211
219
  export interface AvailableBonusWithPaymentMethods {
212
220
  code: string;
213
- paymentMethodFilter?: BonusPaymentMethod[];
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
+ }