@tap-payments/auth-jsconnect 2.11.5-sandbox → 2.11.6-development
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/build/@types/terminal.d.ts +32 -44
- package/build/api/auth.d.ts +7 -1
- package/build/api/index.d.ts +2 -2
- package/build/api/terminal.d.ts +2 -2
- package/build/api/terminal.js +21 -11
- package/build/assets/locales/ar.json +0 -4
- package/build/assets/locales/en.json +0 -4
- package/build/components/DeviceCard/DeviceCard.js +1 -1
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +2 -3
- package/build/constants/app.js +32 -22
- package/build/constants/flows.d.ts +1 -1
- package/build/constants/flows.js +1 -1
- package/build/features/app/terminal/terminalStore.d.ts +7 -7
- package/build/features/app/terminal/terminalStore.js +50 -46
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +2 -17
- package/build/features/featuresScreens.js +3 -3
- package/build/features/terminal/Terminal.js +2 -2
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +8 -9
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +5 -6
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +9 -9
- package/build/features/terminal/screens/{TerminalListPage/TerminalListPage.js → POSDeviceListPage/POSDeviceListPage.js} +9 -9
- package/build/features/terminal/screens/POSDeviceListPage/index.d.ts +2 -0
- package/build/features/terminal/screens/POSDeviceListPage/index.js +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +3 -3
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +1 -1
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +15 -15
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +5 -7
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +12 -11
- package/build/features/terminal/screens/shared/POSDeviceList.d.ts +11 -0
- package/build/features/terminal/screens/shared/POSDeviceList.js +28 -0
- package/build/features/terminal/screens/shared/index.d.ts +2 -2
- package/build/features/terminal/screens/shared/index.js +2 -2
- package/build/features/terminal/screens/shared/styles.d.ts +1 -1
- package/build/features/terminal/screens/shared/styles.js +1 -1
- package/build/features/terminal/screens/shared/utils.d.ts +4 -4
- package/build/features/terminal/screens/shared/utils.js +8 -9
- package/build/utils/common.js +3 -3
- package/package.json +2 -2
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
- package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
- package/build/features/terminal/screens/shared/TerminalList.js +0 -25
- /package/build/features/terminal/screens/{TerminalListPage/TerminalListPage.d.ts → POSDeviceListPage/POSDeviceListPage.d.ts} +0 -0
|
@@ -49,7 +49,7 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import { handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION,
|
|
52
|
+
import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION, SELECTED_POS_DEFAULT_INFO, SELECTED_TERMINAL_DEFAULT_INFO, TERMINAL_PUSH_NOTIFICATION_DURATION, TERMINAL_PUSH_NOTIFICATION_FAILED, TERMINAL_STEP_NAMES } from '../../../constants';
|
|
53
53
|
import API from '../../../api';
|
|
54
54
|
import { isNetworkError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (_a, thunkApi) {
|
|
@@ -79,10 +79,10 @@ export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (
|
|
|
79
79
|
if (step_name === TERMINAL_STEP_NAMES.PHONE_AUTH) {
|
|
80
80
|
return [2, { data: data, token: token, nextScreen: CONNECT_FLOWS.terminal.verify }];
|
|
81
81
|
}
|
|
82
|
-
return [4, API.terminalService.
|
|
82
|
+
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
83
83
|
case 2:
|
|
84
84
|
terminalData = _d.sent();
|
|
85
|
-
nextScreen = ((_c = terminalData === null || terminalData === void 0 ? void 0 : terminalData.
|
|
85
|
+
nextScreen = ((_c = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _c === void 0 ? void 0 : _c.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
86
86
|
return [2, {
|
|
87
87
|
data: data,
|
|
88
88
|
token: token,
|
|
@@ -135,27 +135,28 @@ export var verifyTokenOTP = createAsyncThunk('terminal/verifyOtp', function (par
|
|
|
135
135
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
136
136
|
if (countryIso2)
|
|
137
137
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
138
|
-
return [4, API.terminalService.
|
|
138
|
+
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
139
139
|
case 2:
|
|
140
140
|
terminalData = _g.sent();
|
|
141
|
-
nextScreen = ((_d = terminalData === null || terminalData === void 0 ? void 0 : terminalData.
|
|
141
|
+
nextScreen = ((_d = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _d === void 0 ? void 0 : _d.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
142
142
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
143
143
|
return [2, { data: data, terminalData: terminalData, formData: params, nextScreen: nextScreen }];
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
}); });
|
|
147
147
|
export var linkNewTerminal = createAsyncThunk('terminal/linkNewTerminal', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
-
var _a,
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
148
|
+
var _a, _b, selectedPOS, responseData, _c, language, businessCountry, scope, authData, payload, data;
|
|
149
|
+
return __generator(this, function (_d) {
|
|
150
|
+
switch (_d.label) {
|
|
151
151
|
case 0:
|
|
152
|
-
_a = thunkApi.getState(),
|
|
153
|
-
|
|
152
|
+
_a = thunkApi.getState(), _b = _a.terminal.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData, _c = _a.settings.data, language = _c.language, businessCountry = _c.businessCountry, scope = _c.appConfig.scope;
|
|
153
|
+
authData = (responseData || {}).authData;
|
|
154
154
|
payload = {
|
|
155
155
|
user_credentail: {
|
|
156
|
-
|
|
157
|
-
id:
|
|
158
|
-
}
|
|
156
|
+
merchant: {
|
|
157
|
+
id: authData === null || authData === void 0 ? void 0 : authData.merchant_id
|
|
158
|
+
},
|
|
159
|
+
device: { id: selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id }
|
|
159
160
|
},
|
|
160
161
|
country: businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2,
|
|
161
162
|
scope: scope,
|
|
@@ -167,12 +168,12 @@ export var linkNewTerminal = createAsyncThunk('terminal/linkNewTerminal', functi
|
|
|
167
168
|
};
|
|
168
169
|
return [4, API.authService.createAuth(payload)];
|
|
169
170
|
case 1:
|
|
170
|
-
data =
|
|
171
|
+
data = _d.sent();
|
|
171
172
|
return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.terminalLinkNew }];
|
|
172
173
|
}
|
|
173
174
|
});
|
|
174
175
|
}); });
|
|
175
|
-
export var
|
|
176
|
+
export var retrievePOSDevices = createAsyncThunk('terminal/retrievePOSDevices', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
177
|
var terminal, merchant_id, data;
|
|
177
178
|
var _a;
|
|
178
179
|
return __generator(this, function (_b) {
|
|
@@ -180,7 +181,7 @@ export var retrieveTerminalList = createAsyncThunk('terminal/retrieveTerminalLis
|
|
|
180
181
|
case 0:
|
|
181
182
|
terminal = thunkApi.getState().terminal;
|
|
182
183
|
merchant_id = (((_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).merchant_id;
|
|
183
|
-
return [4, API.terminalService.
|
|
184
|
+
return [4, API.terminalService.retrievePOSDevices([merchant_id])];
|
|
184
185
|
case 1:
|
|
185
186
|
data = _b.sent();
|
|
186
187
|
return [2, { data: data }];
|
|
@@ -247,17 +248,17 @@ export var pushNotificationLinkNewTerminal = createAsyncThunk('terminal/pushNoti
|
|
|
247
248
|
});
|
|
248
249
|
});
|
|
249
250
|
export var unlinkTerminalDevice = createAsyncThunk('terminal/unlinkTerminalDevice', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
250
|
-
var terminal, _a, id,
|
|
251
|
+
var terminal, _a, id, terminal_device, merchant, payload, data;
|
|
251
252
|
return __generator(this, function (_b) {
|
|
252
253
|
switch (_b.label) {
|
|
253
254
|
case 0:
|
|
254
255
|
terminal = thunkApi.getState().terminal;
|
|
255
|
-
_a = terminal.data.terminalInfo.
|
|
256
|
+
_a = terminal.data.terminalInfo.selectedTerminal, id = _a.id, terminal_device = _a.terminal_device, merchant = _a.merchant;
|
|
256
257
|
payload = {
|
|
257
258
|
deviceId: id,
|
|
258
259
|
initiator: 'connect',
|
|
259
260
|
terminal: {
|
|
260
|
-
id:
|
|
261
|
+
id: terminal_device.id
|
|
261
262
|
},
|
|
262
263
|
merchant: {
|
|
263
264
|
id: (merchant === null || merchant === void 0 ? void 0 : merchant.id) || ''
|
|
@@ -271,18 +272,21 @@ export var unlinkTerminalDevice = createAsyncThunk('terminal/unlinkTerminalDevic
|
|
|
271
272
|
});
|
|
272
273
|
}); });
|
|
273
274
|
export var linkTerminalDevice = createAsyncThunk('terminal/linkTerminalDevice', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
-
var _a, _b,
|
|
275
|
-
return __generator(this, function (
|
|
276
|
-
switch (
|
|
275
|
+
var _a, _b, posId, _c, id, terminal_device, _d, businessCountry, language, scope, payload, data;
|
|
276
|
+
return __generator(this, function (_e) {
|
|
277
|
+
switch (_e.label) {
|
|
277
278
|
case 0:
|
|
278
|
-
_a = thunkApi.getState(), _b = _a.terminal.data.terminalInfo,
|
|
279
|
+
_a = thunkApi.getState(), _b = _a.terminal.data.terminalInfo, posId = _b.selectedPOS.id, _c = _b.selectedTerminal, id = _c.id, terminal_device = _c.terminal_device, _d = _a.settings.data, businessCountry = _d.businessCountry, language = _d.language, scope = _d.appConfig.scope;
|
|
279
280
|
payload = {
|
|
280
281
|
user_credentail: {
|
|
281
282
|
terminal: {
|
|
282
|
-
id:
|
|
283
|
+
id: id,
|
|
283
284
|
terminal_device: {
|
|
284
|
-
id:
|
|
285
|
+
id: terminal_device.id
|
|
285
286
|
}
|
|
287
|
+
},
|
|
288
|
+
device: {
|
|
289
|
+
id: posId
|
|
286
290
|
}
|
|
287
291
|
},
|
|
288
292
|
country: businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2,
|
|
@@ -295,7 +299,7 @@ export var linkTerminalDevice = createAsyncThunk('terminal/linkTerminalDevice',
|
|
|
295
299
|
};
|
|
296
300
|
return [4, API.authService.createAuth(payload)];
|
|
297
301
|
case 1:
|
|
298
|
-
data =
|
|
302
|
+
data = _e.sent();
|
|
299
303
|
return [2, { data: data }];
|
|
300
304
|
}
|
|
301
305
|
});
|
|
@@ -342,7 +346,7 @@ export var retrieveBoardStatus = createAsyncThunk('terminal/retrieveBoardStatus'
|
|
|
342
346
|
});
|
|
343
347
|
});
|
|
344
348
|
});
|
|
345
|
-
export var
|
|
349
|
+
export var retrieveTerminalList = createAsyncThunk('terminal/retrieveTerminalList', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
346
350
|
var terminal, merchant_id, data;
|
|
347
351
|
var _a;
|
|
348
352
|
return __generator(this, function (_b) {
|
|
@@ -350,7 +354,7 @@ export var retrieveTerminalDeviceList = createAsyncThunk('terminal/retrieveTermi
|
|
|
350
354
|
case 0:
|
|
351
355
|
terminal = thunkApi.getState().terminal;
|
|
352
356
|
merchant_id = (((_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).merchant_id;
|
|
353
|
-
return [4, API.terminalService.
|
|
357
|
+
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
354
358
|
case 1:
|
|
355
359
|
data = _b.sent();
|
|
356
360
|
return [2, { data: data }];
|
|
@@ -434,7 +438,7 @@ var initialState = {
|
|
|
434
438
|
error: null,
|
|
435
439
|
loading: false,
|
|
436
440
|
customLoading: false,
|
|
437
|
-
|
|
441
|
+
posDevicesLoading: false,
|
|
438
442
|
data: {
|
|
439
443
|
flowName: FlowsTypes.TERMINAL,
|
|
440
444
|
verify: {
|
|
@@ -444,8 +448,8 @@ var initialState = {
|
|
|
444
448
|
otp: ''
|
|
445
449
|
},
|
|
446
450
|
terminalInfo: {
|
|
447
|
-
|
|
448
|
-
|
|
451
|
+
selectedTerminal: SELECTED_TERMINAL_DEFAULT_INFO,
|
|
452
|
+
selectedPOS: SELECTED_POS_DEFAULT_INFO
|
|
449
453
|
}
|
|
450
454
|
}
|
|
451
455
|
};
|
|
@@ -465,12 +469,12 @@ export var terminalSlice = createSlice({
|
|
|
465
469
|
resetOTPScreen: function (state) {
|
|
466
470
|
state.data.otpData.otp = '';
|
|
467
471
|
},
|
|
468
|
-
storeSelectedTerminalDevice: function (state, action) {
|
|
469
|
-
state.data.terminalInfo.selectedTerminalDevice = action.payload;
|
|
470
|
-
},
|
|
471
472
|
storeSelectedTerminal: function (state, action) {
|
|
472
473
|
state.data.terminalInfo.selectedTerminal = action.payload;
|
|
473
474
|
},
|
|
475
|
+
storeSelectedPOS: function (state, action) {
|
|
476
|
+
state.data.terminalInfo.selectedPOS = action.payload;
|
|
477
|
+
},
|
|
474
478
|
resetTerminalLinkResponse: function (state) {
|
|
475
479
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { linkTerminalDeviceData: undefined, pushNotificationLinkedNewTerminalData: undefined, linkNewTerminalData: undefined });
|
|
476
480
|
}
|
|
@@ -532,32 +536,32 @@ export var terminalSlice = createSlice({
|
|
|
532
536
|
state.loading = false;
|
|
533
537
|
state.error = action.error.message;
|
|
534
538
|
})
|
|
535
|
-
.addCase(
|
|
539
|
+
.addCase(retrievePOSDevices.fulfilled, function (state, action) {
|
|
536
540
|
var _a, _b;
|
|
537
|
-
state.
|
|
541
|
+
state.posDevicesLoading = false;
|
|
538
542
|
state.error = null;
|
|
539
543
|
var data = action.payload.data;
|
|
540
544
|
if ((_a = data === null || data === void 0 ? void 0 : data.list) === null || _a === void 0 ? void 0 : _a.length)
|
|
541
|
-
state.data.terminalInfo.
|
|
542
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), {
|
|
545
|
+
state.data.terminalInfo.selectedPOS = data.list[0];
|
|
546
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { posDevices: (_b = data === null || data === void 0 ? void 0 : data.list) !== null && _b !== void 0 ? _b : [] });
|
|
543
547
|
})
|
|
544
|
-
.addCase(
|
|
545
|
-
state.
|
|
548
|
+
.addCase(retrievePOSDevices.rejected, function (state, action) {
|
|
549
|
+
state.posDevicesLoading = false;
|
|
546
550
|
state.error = action.error.message;
|
|
547
551
|
})
|
|
548
|
-
.addCase(
|
|
549
|
-
state.
|
|
552
|
+
.addCase(retrievePOSDevices.pending, function (state) {
|
|
553
|
+
state.posDevicesLoading = true;
|
|
550
554
|
state.error = null;
|
|
551
555
|
})
|
|
552
|
-
.addCase(
|
|
556
|
+
.addCase(retrieveTerminalList.pending, function (state) {
|
|
553
557
|
state.error = null;
|
|
554
558
|
})
|
|
555
|
-
.addCase(
|
|
559
|
+
.addCase(retrieveTerminalList.fulfilled, function (state, action) {
|
|
556
560
|
state.error = null;
|
|
557
561
|
var data = action.payload.data;
|
|
558
562
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { terminalData: data });
|
|
559
563
|
})
|
|
560
|
-
.addCase(
|
|
564
|
+
.addCase(retrieveTerminalList.rejected, function (state, action) {
|
|
561
565
|
state.error = action.error.message;
|
|
562
566
|
})
|
|
563
567
|
.addCase(pushNotificationLinkNewTerminal.pending, function (state) {
|
|
@@ -671,6 +675,6 @@ export var terminalSlice = createSlice({
|
|
|
671
675
|
});
|
|
672
676
|
}
|
|
673
677
|
});
|
|
674
|
-
export var clearError = (_a = terminalSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen,
|
|
678
|
+
export var clearError = (_a = terminalSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeSelectedTerminal = _a.storeSelectedTerminal, storeSelectedPOS = _a.storeSelectedPOS, resetTerminalLinkResponse = _a.resetTerminalLinkResponse;
|
|
675
679
|
export default terminalSlice.reducer;
|
|
676
680
|
export var terminalSelector = function (state) { return state.terminal; };
|
|
@@ -3,7 +3,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
3
3
|
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
4
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
5
|
entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
-
licenseNumber:
|
|
6
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
7
7
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
8
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
9
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -13,7 +13,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
13
13
|
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
14
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
15
15
|
entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
16
|
-
licenseNumber:
|
|
16
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
17
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
18
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
19
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -23,7 +23,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
23
23
|
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
24
24
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
25
|
entityType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
|
-
licenseNumber:
|
|
26
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
27
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
28
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
29
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { BusinessType } from '../../../../@types';
|
|
3
|
-
import { KW_MIN_LICENSE_LENGTH,
|
|
3
|
+
import { KW_MIN_LICENSE_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
4
4
|
export var EntityNameValidationSchema = function () {
|
|
5
5
|
return yup.object().shape({
|
|
6
6
|
legalName: yup
|
|
@@ -16,22 +16,7 @@ export var EntityNameValidationSchema = function () {
|
|
|
16
16
|
}),
|
|
17
17
|
licenseType: yup.string().optional(),
|
|
18
18
|
entityType: yup.string().required('entity_type_required'),
|
|
19
|
-
licenseNumber: yup
|
|
20
|
-
.string()
|
|
21
|
-
.test({
|
|
22
|
-
test: function (value) {
|
|
23
|
-
var type = this.parent.licenseType;
|
|
24
|
-
var isCR = type === BusinessType.CR;
|
|
25
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
26
|
-
if (length === 0)
|
|
27
|
-
return true;
|
|
28
|
-
if (isCR) {
|
|
29
|
-
return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
30
|
-
}
|
|
31
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
.required(''),
|
|
19
|
+
licenseNumber: yup.string().optional(),
|
|
35
20
|
unifiedNumber: yup.string().test({
|
|
36
21
|
name: 'unifiedNumber',
|
|
37
22
|
message: '',
|
|
@@ -146,7 +146,7 @@ import TerminalOperatorErrorPage from './terminal/screens/OperatorError';
|
|
|
146
146
|
import TerminalVerifyPage from './terminal/screens/Verify';
|
|
147
147
|
import NoTerminalDeviceLinkedPage from './terminal/screens/NoTerminalDeviceLinked';
|
|
148
148
|
import TerminalDeviceListPage from './terminal/screens/TerminalDeviceList';
|
|
149
|
-
import
|
|
149
|
+
import POSDeviceListPage from '../features/terminal/screens/POSDeviceListPage';
|
|
150
150
|
import LinkNewTerminalPage from './terminal/screens/LinkNewTerminal';
|
|
151
151
|
import LinkedTerminalInfoPage from './terminal/screens/LinkedTerminalInfo';
|
|
152
152
|
import UnlinkedTerminalInfoPage from './terminal/screens/UnlinkedTerminalInfo';
|
|
@@ -744,8 +744,8 @@ export var terminalFeatureScreens = [
|
|
|
744
744
|
element: LinkNewTerminalPage
|
|
745
745
|
},
|
|
746
746
|
{
|
|
747
|
-
name: CONNECT_FLOWS.terminal.
|
|
748
|
-
element:
|
|
747
|
+
name: CONNECT_FLOWS.terminal.posDeviceList,
|
|
748
|
+
element: POSDeviceListPage
|
|
749
749
|
},
|
|
750
750
|
{
|
|
751
751
|
name: CONNECT_FLOWS.terminal.linkedTerminalInfo,
|
|
@@ -41,7 +41,7 @@ var Terminal = memo(function (_a) {
|
|
|
41
41
|
var theme = useAppTheme().theme;
|
|
42
42
|
var dispatch = useAppDispatch();
|
|
43
43
|
var _d = useAppSelector(settingsSelector), data = _d.data, error = _d.error, settingLoading = _d.loading;
|
|
44
|
-
var _e = useAppSelector(terminalSelector), customLoading = _e.customLoading, terminalError = _e.error, loading = _e.loading,
|
|
44
|
+
var _e = useAppSelector(terminalSelector), customLoading = _e.customLoading, terminalError = _e.error, loading = _e.loading, posDevicesLoading = _e.posDevicesLoading;
|
|
45
45
|
useAppConfig(__assign(__assign({ navigation: TERMINAL_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }));
|
|
46
46
|
useErrorListener(terminalError || error);
|
|
47
47
|
useStepStartedListener();
|
|
@@ -77,7 +77,7 @@ var Terminal = memo(function (_a) {
|
|
|
77
77
|
});
|
|
78
78
|
}, []);
|
|
79
79
|
var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
|
|
80
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ||
|
|
80
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading || posDevicesLoading ? 'none' : 'auto', isTapOrigin: isTapOrigin, animationDirection: animationDirection, open: open, error: error, loading: initialLoading, loaderColor: loaderColor, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: appConfig.features }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: terminalFeatureScreens.map(function (_a, index) {
|
|
81
81
|
var Element = _a.element, name = _a.name;
|
|
82
82
|
var isActive = activeScreen.name === name;
|
|
83
83
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -27,17 +27,15 @@ var LinkNewTerminal = function () {
|
|
|
27
27
|
var _a, _b, _c, _d;
|
|
28
28
|
var t = useTranslation().t;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var _h = responseData || {}, terminalData = _h.terminalData, linkNewTerminalData = _h.linkNewTerminalData;
|
|
36
|
-
var terminal_devices = (terminalData || {}).terminal_devices;
|
|
30
|
+
var _e = useAppSelector(terminalSelector).data, terminal_device = _e.terminalInfo.selectedTerminal.terminal_device, responseData = _e.responseData;
|
|
31
|
+
var _f = React.useState(false), isReady = _f[0], setIsReady = _f[1];
|
|
32
|
+
var _g = React.useState(false), success = _g[0], setSuccess = _g[1];
|
|
33
|
+
var _h = React.useState(false), failed = _h[0], setFailed = _h[1];
|
|
34
|
+
var _j = responseData || {}, terminalData = _j.terminalData, linkNewTerminalData = _j.linkNewTerminalData;
|
|
37
35
|
var qrCode = "data:image/png;base64,".concat((_a = linkNewTerminalData === null || linkNewTerminalData === void 0 ? void 0 : linkNewTerminalData.linking) === null || _a === void 0 ? void 0 : _a.qr);
|
|
38
36
|
var code = (_b = linkNewTerminalData === null || linkNewTerminalData === void 0 ? void 0 : linkNewTerminalData.linking) === null || _b === void 0 ? void 0 : _b.code;
|
|
39
37
|
var expiry = TERMINAL_PUSH_NOTIFICATION_DURATION;
|
|
40
|
-
var deviceName = ((_d = (_c =
|
|
38
|
+
var deviceName = ((_d = (_c = terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.model) === null || _c === void 0 ? void 0 : _c.name[0]) === null || _d === void 0 ? void 0 : _d.text) || '';
|
|
41
39
|
var newTerminal = true;
|
|
42
40
|
React.useEffect(function () {
|
|
43
41
|
if (linkNewTerminalData && !isReady) {
|
|
@@ -61,7 +59,8 @@ var LinkNewTerminal = function () {
|
|
|
61
59
|
};
|
|
62
60
|
}, [isReady]);
|
|
63
61
|
var handleOnBack = function () {
|
|
64
|
-
var
|
|
62
|
+
var _a;
|
|
63
|
+
var previousScreen = ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.posDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
65
64
|
dispatch(handlePrevScreenStep(previousScreen));
|
|
66
65
|
};
|
|
67
66
|
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: deviceName }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(LinkNewTerminalContainer, { children: [_jsx(LinkTerminalText, { children: t('terminal_link_terminal') }), _jsx(QRCodeDescription, { children: t('terminal_qr_code_description') }), _jsx(QRCodeImage, { src: qrCode }), code && (_jsxs(_Fragment, { children: [_jsx(LinkTerminalText, { children: t('terminal_or_use_code') }), _jsx(CodeDescription, { children: formatCode(code) })] }))] }) })), _jsx(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: handleOnBack, variant: 'text' }, { children: t('back') })) }))] })));
|
|
@@ -15,22 +15,21 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import Box from '@mui/material/Box';
|
|
16
16
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
17
|
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
18
|
-
import { retrieveBoardDetails, retrieveBoardStatus,
|
|
18
|
+
import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
19
19
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
20
20
|
import Button from '../../../shared/Button';
|
|
21
|
-
import {
|
|
21
|
+
import { SuccessContainerStyled } from '../shared';
|
|
22
22
|
import { CONNECT_FLOWS } from '../../../../constants';
|
|
23
23
|
var LinkedSuccess = function () {
|
|
24
24
|
var t = useTranslation().t;
|
|
25
25
|
var isAr = useLanguage().isAr;
|
|
26
26
|
var dispatch = useAppDispatch();
|
|
27
|
-
var _a = useAppSelector(terminalSelector), error = _a.error, loading = _a.loading, _b = _a.data,
|
|
27
|
+
var _a = useAppSelector(terminalSelector), error = _a.error, loading = _a.loading, _b = _a.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData;
|
|
28
28
|
var _c = responseData || {}, boardData = _c.boardData, authData = _c.authData;
|
|
29
|
-
var deviceName = getTerminalName(selectedTerminal);
|
|
30
29
|
var handleGoToBoard = function () {
|
|
31
30
|
var board_id = (boardData || {}).id;
|
|
32
31
|
var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
|
|
33
|
-
dispatch(
|
|
32
|
+
dispatch(retrieveTerminalList());
|
|
34
33
|
dispatch(retrieveBoardStatus({ boardId: board_id }))
|
|
35
34
|
.unwrap()
|
|
36
35
|
.then(function () {
|
|
@@ -46,6 +45,6 @@ var LinkedSuccess = function () {
|
|
|
46
45
|
var handleOnBack = function () {
|
|
47
46
|
dispatch(handlePrevScreenStep());
|
|
48
47
|
};
|
|
49
|
-
return (_jsxs(SuccessContainerStyled, { children: [_jsx(SuccessScreen, { sx: { minHeight: 'unset', ml: 2.5, mr: 2.5 }, title: t('terminal_linked_success', { device:
|
|
48
|
+
return (_jsxs(SuccessContainerStyled, { children: [_jsx(SuccessScreen, { sx: { minHeight: 'unset', ml: 2.5, mr: 2.5 }, title: t('terminal_linked_success', { device: selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.display_name }), successTitle: t('terminal_go_to_board'), loading: loading, error: error || '' }), _jsx(Box, __assign({ sx: { width: '100%' } }, { children: _jsx(Button, __assign({ loading: loading, disableBack: true, onBackClicked: handleOnBack, onClick: handleGoToBoard, isAr: isAr }, { children: t('terminal_go_to_board') })) }))] }));
|
|
50
49
|
};
|
|
51
50
|
export default React.memo(LinkedSuccess);
|
|
@@ -23,17 +23,17 @@ import Button from '../../../shared/Button';
|
|
|
23
23
|
import { clearError, terminalSelector, unlinkTerminalDevice } from '../../../app/terminal/terminalStore';
|
|
24
24
|
import { Container, getId, getIdLabel, getPairedWith, LinkWithText } from '../shared';
|
|
25
25
|
var LinkedTerminalInfo = function () {
|
|
26
|
-
var _a
|
|
26
|
+
var _a;
|
|
27
27
|
var t = useTranslation().t;
|
|
28
|
-
var
|
|
28
|
+
var _b = useTheme(), spacing = _b.spacing, palette = _b.palette;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var isAr = useLanguage().isAr;
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var deviceName = (
|
|
35
|
-
var deviceImage = (
|
|
36
|
-
var deviceId = (
|
|
31
|
+
var _c = useAppSelector(terminalSelector), error = _c.error, selectedTerminal = _c.data.terminalInfo.selectedTerminal, loading = _c.loading;
|
|
32
|
+
var terminal_device = selectedTerminal.terminal_device, linked = selectedTerminal.linked, device = selectedTerminal.device;
|
|
33
|
+
var _d = (terminal_device.model || {}).image_url, image_url = _d === void 0 ? ICONS_NAMES.device_image : _d;
|
|
34
|
+
var deviceName = (device === null || device === void 0 ? void 0 : device.display_name) || '';
|
|
35
|
+
var deviceImage = (device === null || device === void 0 ? void 0 : device.logo) || ICONS_NAMES.platform_image;
|
|
36
|
+
var deviceId = (device === null || device === void 0 ? void 0 : device.reference) || (device === null || device === void 0 ? void 0 : device.id) || '';
|
|
37
37
|
React.useEffect(function () {
|
|
38
38
|
if (error)
|
|
39
39
|
dispatch(clearError());
|
|
@@ -50,6 +50,6 @@ var LinkedTerminalInfo = function () {
|
|
|
50
50
|
var handleOnBack = function () {
|
|
51
51
|
dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalDeviceList));
|
|
52
52
|
};
|
|
53
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(DeviceCard, { badge: true, image: image_url, name: display_name, deviceId: getId(
|
|
53
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(DeviceCard, { badge: true, image: image_url, name: ((_a = selectedTerminal.terminal_device) === null || _a === void 0 ? void 0 : _a.display_name) || '', deviceId: getId(selectedTerminal), deviceIdLabel: getIdLabel(selectedTerminal), pairedWith: getPairedWith(selectedTerminal), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_linked_with') }), _jsx(DeviceCard, { sx: { minHeight: spacing(10), borderRadius: spacing(1), background: palette.components.deviceCard.deviceInfoBackground }, image: deviceImage, name: deviceName, deviceId: deviceId, isLinked: linked })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Button, __assign({ loading: loading, onBackClicked: handleOnBack, onClick: handleOnNext, isAr: isAr }, { children: t('terminal_unlink') }))] })));
|
|
54
54
|
};
|
|
55
55
|
export default React.memo(LinkedTerminalInfo);
|
|
@@ -18,19 +18,19 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
|
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import Button from '../../../../components/Button';
|
|
20
20
|
import Warning from '../../../../components/Warning';
|
|
21
|
-
import { clearError, linkNewTerminal,
|
|
22
|
-
import { Header, Container,
|
|
23
|
-
var
|
|
21
|
+
import { clearError, linkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
22
|
+
import { Header, Container, POSDeviceList } from '../shared';
|
|
23
|
+
var POSDeviceListPage = function () {
|
|
24
24
|
var t = useTranslation().t;
|
|
25
25
|
var dispatch = useAppDispatch();
|
|
26
|
-
var _a = useAppSelector(terminalSelector), _b = _a.data,
|
|
27
|
-
var
|
|
26
|
+
var _a = useAppSelector(terminalSelector), _b = _a.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData, loading = _a.loading, error = _a.error;
|
|
27
|
+
var posDevices = (responseData || {}).posDevices;
|
|
28
28
|
React.useEffect(function () {
|
|
29
29
|
if (error)
|
|
30
30
|
dispatch(clearError());
|
|
31
31
|
}, []);
|
|
32
|
-
var
|
|
33
|
-
dispatch(
|
|
32
|
+
var handleOnSelectPOS = function (pos) {
|
|
33
|
+
dispatch(storeSelectedPOS(pos));
|
|
34
34
|
dispatch(linkNewTerminal())
|
|
35
35
|
.unwrap()
|
|
36
36
|
.then(function (_a) {
|
|
@@ -42,6 +42,6 @@ var TerminalListPage = function () {
|
|
|
42
42
|
var handleOnBack = function () {
|
|
43
43
|
dispatch(handlePrevScreenStep());
|
|
44
44
|
};
|
|
45
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(
|
|
45
|
+
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(POSDeviceList, { select: false, loading: loading, selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
|
|
46
46
|
};
|
|
47
|
-
export default React.memo(
|
|
47
|
+
export default React.memo(POSDeviceListPage);
|
|
@@ -27,6 +27,6 @@ var SuccessWithFlowButtons = function () {
|
|
|
27
27
|
var onClose = function () {
|
|
28
28
|
dispatch(onCloseCompleteTerminal());
|
|
29
29
|
};
|
|
30
|
-
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.
|
|
30
|
+
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
|
|
31
31
|
};
|
|
32
32
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TerminalInfo } from '../../../../@types';
|
|
3
3
|
interface DeviceListProps {
|
|
4
|
-
devices:
|
|
4
|
+
devices: TerminalInfo[];
|
|
5
5
|
loading?: boolean;
|
|
6
|
-
onClick: (device:
|
|
6
|
+
onClick: (device: TerminalInfo) => void;
|
|
7
7
|
}
|
|
8
8
|
declare const _default: React.MemoExoticComponent<({ devices, onClick, loading }: DeviceListProps) => JSX.Element>;
|
|
9
9
|
export default _default;
|
|
@@ -14,7 +14,7 @@ var DeviceList = function (_a) {
|
|
|
14
14
|
};
|
|
15
15
|
return (_jsx(DeviceListContainer, { children: devices.map(function (device, index) {
|
|
16
16
|
var _a;
|
|
17
|
-
return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_a = device.model.image_url) !== null && _a !== void 0 ? _a : defaultImage, name: device.display_name, deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
|
|
17
|
+
return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_a = device.terminal_device.model.image_url) !== null && _a !== void 0 ? _a : defaultImage, name: device.terminal_device.display_name, deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
|
|
18
18
|
}) }));
|
|
19
19
|
};
|
|
20
20
|
export default memo(DeviceList);
|