@tap-payments/auth-jsconnect 2.10.11-development → 2.10.11
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/app.d.ts +2 -2
- package/build/@types/app.js +0 -1
- package/build/@types/form.d.ts +4 -2
- package/build/@types/index.d.ts +0 -1
- package/build/@types/index.js +0 -1
- package/build/api/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/auth.d.ts +2 -10
- package/build/api/auth.js +7 -3
- package/build/api/axios.d.ts +1 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +5 -11
- package/build/api/index.js +1 -3
- package/build/api/lead.d.ts +1 -0
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +1 -3
- package/build/app/settings.js +1 -2
- package/build/app/store.d.ts +0 -2
- package/build/assets/currencies/AEDSymbol.js +1 -1
- package/build/assets/currencies/SARSymbol.js +1 -1
- package/build/assets/locales/ar.json +14 -5
- package/build/assets/locales/en.json +17 -7
- package/build/components/OTPTimer/OTPTimer.d.ts +1 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -4
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +4 -0
- package/build/constants/app.d.ts +12 -12
- package/build/constants/app.js +98 -129
- package/build/constants/flows.d.ts +0 -15
- package/build/constants/flows.js +0 -15
- package/build/constants/validation.d.ts +1 -1
- package/build/constants/validation.js +1 -1
- package/build/features/app/auth/authStore.js +64 -54
- package/build/features/app/bank/bankStore.js +24 -20
- package/build/features/app/board/boardStore.js +11 -7
- package/build/features/app/brand/brandStore.js +22 -18
- package/build/features/app/business/businessStore.js +45 -36
- package/build/features/app/connect/connectStore.d.ts +6 -5
- package/build/features/app/connect/connectStore.js +48 -31
- package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
- package/build/features/app/connectExpress/connectExpressStore.js +61 -20
- package/build/features/app/entity/entityStore.js +21 -17
- package/build/features/app/individual/individualStore.js +34 -28
- package/build/features/app/password/passwordStore.js +44 -46
- package/build/features/app/signIn/signInStore.js +12 -16
- package/build/features/app/tax/taxStore.js +20 -16
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/auth/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +15 -5
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +20 -12
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +27 -16
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
- package/build/features/entity/screens/EntityName/EntityName.js +16 -15
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
- package/build/features/entity/screens/EntityName/validation.js +100 -85
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +55 -67
- package/build/features/shared/Button/Button.js +1 -1
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
- package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
- package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -3
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/hooks/useAppConfig.js +1 -1
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +2 -4
- package/build/theme/palette.js +0 -12
- package/build/theme/typography.js +0 -4
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +14 -8
- package/build/utils/error.d.ts +2 -0
- package/build/utils/error.js +6 -0
- package/build/utils/string.d.ts +3 -3
- package/build/utils/string.js +5 -11
- package/build/utils/validation.js +1 -1
- package/package.json +3 -3
- package/build/@types/terminal.d.ts +0 -116
- package/build/@types/terminal.js +0 -1
- package/build/api/terminal.d.ts +0 -28
- package/build/api/terminal.js +0 -45
- package/build/components/DeviceCard/DeviceCard.d.ts +0 -18
- package/build/components/DeviceCard/DeviceCard.js +0 -103
- package/build/components/DeviceCard/index.d.ts +0 -3
- package/build/components/DeviceCard/index.js +0 -2
- package/build/features/app/terminal/terminalStore.d.ts +0 -109
- package/build/features/app/terminal/terminalStore.js +0 -673
- package/build/features/shared/PushNotification/PushNotification.d.ts +0 -11
- package/build/features/shared/PushNotification/PushNotification.js +0 -34
- package/build/features/shared/PushNotification/index.d.ts +0 -2
- package/build/features/shared/PushNotification/index.js +0 -2
- package/build/features/terminal/Terminal.d.ts +0 -14
- package/build/features/terminal/Terminal.js +0 -95
- package/build/features/terminal/index.d.ts +0 -1
- package/build/features/terminal/index.js +0 -1
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +0 -69
- package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/index.js +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +0 -10
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +0 -28
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +0 -51
- package/build/features/terminal/screens/LinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +0 -50
- package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/Loading/Loading.d.ts +0 -4
- package/build/features/terminal/screens/Loading/Loading.js +0 -10
- package/build/features/terminal/screens/Loading/index.d.ts +0 -2
- package/build/features/terminal/screens/Loading/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +0 -3
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +0 -56
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +0 -36
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +0 -34
- package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +0 -5
- package/build/features/terminal/screens/OperatorError/OperatorError.js +0 -9
- package/build/features/terminal/screens/OperatorError/index.d.ts +0 -2
- package/build/features/terminal/screens/OperatorError/index.js +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +0 -3
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +0 -21
- package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/index.js +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +0 -3
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +0 -31
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +0 -20
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +0 -3
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +0 -144
- package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/styles.js +0 -13
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +0 -3
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +0 -42
- 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/UnlinkedSuccess/UnlinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +0 -53
- package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +0 -98
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +0 -26
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +0 -30
- package/build/features/terminal/screens/Verify/OTPInput.d.ts +0 -7
- package/build/features/terminal/screens/Verify/OTPInput.js +0 -51
- package/build/features/terminal/screens/Verify/Verify.d.ts +0 -5
- package/build/features/terminal/screens/Verify/Verify.js +0 -85
- package/build/features/terminal/screens/Verify/index.d.ts +0 -2
- package/build/features/terminal/screens/Verify/index.js +0 -2
- package/build/features/terminal/screens/Verify/validation.d.ts +0 -8
- package/build/features/terminal/screens/Verify/validation.js +0 -4
- package/build/features/terminal/screens/shared/Header.d.ts +0 -10
- package/build/features/terminal/screens/shared/Header.js +0 -30
- 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/shared/index.d.ts +0 -5
- package/build/features/terminal/screens/shared/index.js +0 -5
- package/build/features/terminal/screens/shared/styles.d.ts +0 -196
- package/build/features/terminal/screens/shared/styles.js +0 -155
- package/build/features/terminal/screens/shared/utils.d.ts +0 -7
- package/build/features/terminal/screens/shared/utils.js +0 -24
- /package/build/features/{terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts → shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts} +0 -0
|
@@ -1,673 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var _a;
|
|
49
|
-
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
|
-
import { handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
51
|
-
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION, SELECTED_TERMINAL_DEFAULT_INFO, SELECTED_TERMINAL_DEVICE_DEFAULT_INFO, TERMINAL_PUSH_NOTIFICATION_DURATION, TERMINAL_PUSH_NOTIFICATION_FAILED, TERMINAL_STEP_NAMES } from '../../../constants';
|
|
53
|
-
import API from '../../../api';
|
|
54
|
-
import { isNetworkError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
|
-
export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (_a, thunkApi) {
|
|
56
|
-
var token = _a.token, isInternally = _a.isInternally;
|
|
57
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, _b, step_name, merchant_id, config, country_code, publicKey, terminalData, nextScreen;
|
|
59
|
-
var _c;
|
|
60
|
-
return __generator(this, function (_d) {
|
|
61
|
-
switch (_d.label) {
|
|
62
|
-
case 0:
|
|
63
|
-
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
64
|
-
notification: {
|
|
65
|
-
sms: false
|
|
66
|
-
}
|
|
67
|
-
}));
|
|
68
|
-
return [4, API.leadService.verifyToken(payload)];
|
|
69
|
-
case 1:
|
|
70
|
-
data = _d.sent();
|
|
71
|
-
_b = data || {}, step_name = _b.step_name, merchant_id = _b.merchant_id, config = _b.config, country_code = _b.country_code;
|
|
72
|
-
if (isInternally)
|
|
73
|
-
data.step_name = TERMINAL_STEP_NAMES.PHONE_AUTH;
|
|
74
|
-
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
75
|
-
if (publicKey)
|
|
76
|
-
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
77
|
-
if (country_code)
|
|
78
|
-
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
79
|
-
if (step_name === TERMINAL_STEP_NAMES.PHONE_AUTH) {
|
|
80
|
-
return [2, { data: data, token: token, nextScreen: CONNECT_FLOWS.terminal.verify }];
|
|
81
|
-
}
|
|
82
|
-
return [4, API.terminalService.retrieveTerminalDeviceList([merchant_id])];
|
|
83
|
-
case 2:
|
|
84
|
-
terminalData = _d.sent();
|
|
85
|
-
nextScreen = ((_c = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _c === void 0 ? void 0 : _c.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
86
|
-
return [2, {
|
|
87
|
-
data: data,
|
|
88
|
-
token: token,
|
|
89
|
-
terminalData: terminalData,
|
|
90
|
-
nextScreen: nextScreen
|
|
91
|
-
}];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
export var resendOTP = createAsyncThunk('terminal/resendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
-
var terminal, payload, data;
|
|
98
|
-
return __generator(this, function (_a) {
|
|
99
|
-
switch (_a.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
terminal = thunkApi.getState().terminal;
|
|
102
|
-
payload = {
|
|
103
|
-
service_name: 'tap_email',
|
|
104
|
-
verify_token: terminal.data.verify.token
|
|
105
|
-
};
|
|
106
|
-
return [4, API.leadService.verifyToken(payload)];
|
|
107
|
-
case 1:
|
|
108
|
-
data = _a.sent();
|
|
109
|
-
return [2, { data: data }];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}); });
|
|
113
|
-
export var verifyTokenOTP = createAsyncThunk('terminal/verifyOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
114
|
-
var _a, terminal, settings, authData, payload, data, _b, config, country_code, merchant_id, publicKey, countryIso2, terminalData, nextScreen;
|
|
115
|
-
var _c, _d, _e, _f;
|
|
116
|
-
return __generator(this, function (_g) {
|
|
117
|
-
switch (_g.label) {
|
|
118
|
-
case 0:
|
|
119
|
-
_a = thunkApi.getState(), terminal = _a.terminal, settings = _a.settings;
|
|
120
|
-
authData = (terminal.data.responseData || {}).authData;
|
|
121
|
-
payload = {
|
|
122
|
-
data: params.otp,
|
|
123
|
-
service_name: (_c = authData === null || authData === void 0 ? void 0 : authData.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
|
|
124
|
-
verify_token: authData === null || authData === void 0 ? void 0 : authData.verify_token,
|
|
125
|
-
step_name: TERMINAL_STEP_NAMES.PHONE_AUTH,
|
|
126
|
-
encryption_contract: ['data']
|
|
127
|
-
};
|
|
128
|
-
return [4, API.leadService.verifyTokenOTP(payload)];
|
|
129
|
-
case 1:
|
|
130
|
-
data = _g.sent();
|
|
131
|
-
_b = data || {}, config = _b.config, country_code = _b.country_code, merchant_id = _b.merchant_id;
|
|
132
|
-
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
133
|
-
countryIso2 = country_code || (authData === null || authData === void 0 ? void 0 : authData.country_code);
|
|
134
|
-
if (publicKey)
|
|
135
|
-
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
136
|
-
if (countryIso2)
|
|
137
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
138
|
-
return [4, API.terminalService.retrieveTerminalDeviceList([merchant_id])];
|
|
139
|
-
case 2:
|
|
140
|
-
terminalData = _g.sent();
|
|
141
|
-
nextScreen = ((_d = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _d === void 0 ? void 0 : _d.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
142
|
-
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
143
|
-
return [2, { data: data, terminalData: terminalData, formData: params, nextScreen: nextScreen }];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}); });
|
|
147
|
-
export var linkNewTerminal = createAsyncThunk('terminal/linkNewTerminal', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
-
var _a, terminal, _b, language, businessCountry, scope, terminalId, payload, data;
|
|
149
|
-
return __generator(this, function (_c) {
|
|
150
|
-
switch (_c.label) {
|
|
151
|
-
case 0:
|
|
152
|
-
_a = thunkApi.getState(), terminal = _a.terminal, _b = _a.settings.data, language = _b.language, businessCountry = _b.businessCountry, scope = _b.appConfig.scope;
|
|
153
|
-
terminalId = (terminal.data.terminalInfo.selectedTerminal || {}).id;
|
|
154
|
-
payload = {
|
|
155
|
-
user_credentail: {
|
|
156
|
-
terminal: {
|
|
157
|
-
id: terminalId
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
country: businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2,
|
|
161
|
-
scope: scope,
|
|
162
|
-
lang: language,
|
|
163
|
-
is_lead: false,
|
|
164
|
-
sign_in: false,
|
|
165
|
-
step_name: TERMINAL_STEP_NAMES.CREATE_TERMINAL_AUTH,
|
|
166
|
-
encryption_contract: []
|
|
167
|
-
};
|
|
168
|
-
return [4, API.authService.createAuth(payload)];
|
|
169
|
-
case 1:
|
|
170
|
-
data = _c.sent();
|
|
171
|
-
return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.terminalLinkNew }];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}); });
|
|
175
|
-
export var retrieveTerminalList = createAsyncThunk('terminal/retrieveTerminalList', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var terminal, merchant_id, data;
|
|
177
|
-
var _a;
|
|
178
|
-
return __generator(this, function (_b) {
|
|
179
|
-
switch (_b.label) {
|
|
180
|
-
case 0:
|
|
181
|
-
terminal = thunkApi.getState().terminal;
|
|
182
|
-
merchant_id = (((_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).merchant_id;
|
|
183
|
-
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
184
|
-
case 1:
|
|
185
|
-
data = _b.sent();
|
|
186
|
-
return [2, { data: data }];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}); });
|
|
190
|
-
export var pushNotificationLinkNewTerminal = createAsyncThunk('terminal/pushNotificationLinkNewTerminal', function (_a, thunkApi) {
|
|
191
|
-
var newTerminal = _a.newTerminal, onSuccess = _a.onSuccess, onFailure = _a.onFailure;
|
|
192
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
-
var terminal, _b, linkNewTerminalData, linkTerminalDeviceData, id, e, interval, maxCalls, count, data, error_1, isSuccess, isFailed, nextScreen;
|
|
194
|
-
var _c, _d;
|
|
195
|
-
return __generator(this, function (_e) {
|
|
196
|
-
switch (_e.label) {
|
|
197
|
-
case 0:
|
|
198
|
-
terminal = thunkApi.getState().terminal;
|
|
199
|
-
_b = terminal.data.responseData || {}, linkNewTerminalData = _b.linkNewTerminalData, linkTerminalDeviceData = _b.linkTerminalDeviceData;
|
|
200
|
-
id = ((newTerminal ? linkNewTerminalData : linkTerminalDeviceData) || {}).id;
|
|
201
|
-
e = TERMINAL_PUSH_NOTIFICATION_DURATION;
|
|
202
|
-
interval = 3;
|
|
203
|
-
maxCalls = Math.floor(e / interval);
|
|
204
|
-
count = 1;
|
|
205
|
-
_e.label = 1;
|
|
206
|
-
case 1:
|
|
207
|
-
if (!(count <= maxCalls)) return [3, 8];
|
|
208
|
-
if (thunkApi.signal.aborted) {
|
|
209
|
-
return [3, 8];
|
|
210
|
-
}
|
|
211
|
-
data = undefined;
|
|
212
|
-
_e.label = 2;
|
|
213
|
-
case 2:
|
|
214
|
-
_e.trys.push([2, 4, , 5]);
|
|
215
|
-
return [4, API.authService.getVerifyAuth(id, { timeout: NAFATH_PACI_TIMEOUT_DURATION })];
|
|
216
|
-
case 3:
|
|
217
|
-
data = _e.sent();
|
|
218
|
-
return [3, 5];
|
|
219
|
-
case 4:
|
|
220
|
-
error_1 = _e.sent();
|
|
221
|
-
if (!isNetworkError(error_1.message) && !isTimeoutError(error_1.message)) {
|
|
222
|
-
throw new Error(error_1);
|
|
223
|
-
}
|
|
224
|
-
return [3, 5];
|
|
225
|
-
case 5:
|
|
226
|
-
isSuccess = ((_c = data === null || data === void 0 ? void 0 : data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'success';
|
|
227
|
-
isFailed = ((_d = data === null || data === void 0 ? void 0 : data.status) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === 'failed';
|
|
228
|
-
if (isFailed) {
|
|
229
|
-
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
|
230
|
-
return [2, { data: data }];
|
|
231
|
-
}
|
|
232
|
-
if (isSuccess) {
|
|
233
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
234
|
-
nextScreen = CONNECT_FLOWS.terminal.terminalLinkedSuccess;
|
|
235
|
-
return [2, { data: data, nextScreen: nextScreen, linkNewTerminalData: linkNewTerminalData }];
|
|
236
|
-
}
|
|
237
|
-
return [4, sleep(interval * 1000)];
|
|
238
|
-
case 6:
|
|
239
|
-
_e.sent();
|
|
240
|
-
_e.label = 7;
|
|
241
|
-
case 7:
|
|
242
|
-
count++;
|
|
243
|
-
return [3, 1];
|
|
244
|
-
case 8: throw new Error(TERMINAL_PUSH_NOTIFICATION_FAILED);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
export var unlinkTerminalDevice = createAsyncThunk('terminal/unlinkTerminalDevice', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
250
|
-
var terminal, _a, id, terminalInfo, merchant, payload, data;
|
|
251
|
-
return __generator(this, function (_b) {
|
|
252
|
-
switch (_b.label) {
|
|
253
|
-
case 0:
|
|
254
|
-
terminal = thunkApi.getState().terminal;
|
|
255
|
-
_a = terminal.data.terminalInfo.selectedTerminalDevice, id = _a.id, terminalInfo = _a.terminal, merchant = _a.merchant;
|
|
256
|
-
payload = {
|
|
257
|
-
deviceId: id,
|
|
258
|
-
initiator: 'connect',
|
|
259
|
-
terminal: {
|
|
260
|
-
id: (terminalInfo === null || terminalInfo === void 0 ? void 0 : terminalInfo.id) || ''
|
|
261
|
-
},
|
|
262
|
-
merchant: {
|
|
263
|
-
id: (merchant === null || merchant === void 0 ? void 0 : merchant.id) || ''
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
return [4, API.terminalService.unlinkTerminalDevice(payload)];
|
|
267
|
-
case 1:
|
|
268
|
-
data = _b.sent();
|
|
269
|
-
return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.terminalUnlinkedSuccess }];
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}); });
|
|
273
|
-
export var linkTerminalDevice = createAsyncThunk('terminal/linkTerminalDevice', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
274
|
-
var _a, _b, terminalId, deviceId, _c, businessCountry, language, scope, payload, data;
|
|
275
|
-
return __generator(this, function (_d) {
|
|
276
|
-
switch (_d.label) {
|
|
277
|
-
case 0:
|
|
278
|
-
_a = thunkApi.getState(), _b = _a.terminal.data.terminalInfo, terminalId = _b.selectedTerminal.id, deviceId = _b.selectedTerminalDevice.id, _c = _a.settings.data, businessCountry = _c.businessCountry, language = _c.language, scope = _c.appConfig.scope;
|
|
279
|
-
payload = {
|
|
280
|
-
user_credentail: {
|
|
281
|
-
terminal: {
|
|
282
|
-
id: terminalId,
|
|
283
|
-
terminal_device: {
|
|
284
|
-
id: deviceId
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
country: businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2,
|
|
289
|
-
scope: scope,
|
|
290
|
-
lang: language,
|
|
291
|
-
is_lead: false,
|
|
292
|
-
sign_in: false,
|
|
293
|
-
step_name: TERMINAL_STEP_NAMES.CREATE_AUTH,
|
|
294
|
-
encryption_contract: []
|
|
295
|
-
};
|
|
296
|
-
return [4, API.authService.createAuth(payload)];
|
|
297
|
-
case 1:
|
|
298
|
-
data = _d.sent();
|
|
299
|
-
return [2, { data: data }];
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}); });
|
|
303
|
-
export var retrieveBoardDetails = createAsyncThunk('terminal/retrieveBoardDetails', function (_a) {
|
|
304
|
-
var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
|
|
305
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
306
|
-
var data, individualData, boardData, serviceCallBack, _b, boardRes, individualRes;
|
|
307
|
-
var _c, _d, _e, _f;
|
|
308
|
-
return __generator(this, function (_g) {
|
|
309
|
-
switch (_g.label) {
|
|
310
|
-
case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
311
|
-
case 1:
|
|
312
|
-
data = _g.sent();
|
|
313
|
-
individualData = data === null || data === void 0 ? void 0 : data.user;
|
|
314
|
-
boardData = data;
|
|
315
|
-
if (!(((_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.id) !== id && id && type)) return [3, 3];
|
|
316
|
-
serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
|
|
317
|
-
return [4, retrieveIndividualData(type, data, serviceCallBack)];
|
|
318
|
-
case 2:
|
|
319
|
-
_b = _g.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
|
|
320
|
-
individualData = individualRes;
|
|
321
|
-
boardData = boardRes;
|
|
322
|
-
_g.label = 3;
|
|
323
|
-
case 3: return [2, __assign(__assign({}, boardData), { brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names, vatID: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.vat_id, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact, user: individualData, board_status: boardData === null || boardData === void 0 ? void 0 : boardData.status })];
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
export var retrieveBoardStatus = createAsyncThunk('terminal/retrieveBoardStatus', function (_a) {
|
|
329
|
-
var boardId = _a.boardId;
|
|
330
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
331
|
-
var data;
|
|
332
|
-
return __generator(this, function (_b) {
|
|
333
|
-
switch (_b.label) {
|
|
334
|
-
case 0:
|
|
335
|
-
if (!boardId)
|
|
336
|
-
throw new Error('Internal server error');
|
|
337
|
-
return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
|
|
338
|
-
case 1:
|
|
339
|
-
data = _b.sent();
|
|
340
|
-
return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
export var retrieveTerminalDeviceList = createAsyncThunk('terminal/retrieveTerminalDeviceList', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
346
|
-
var terminal, merchant_id, data;
|
|
347
|
-
var _a;
|
|
348
|
-
return __generator(this, function (_b) {
|
|
349
|
-
switch (_b.label) {
|
|
350
|
-
case 0:
|
|
351
|
-
terminal = thunkApi.getState().terminal;
|
|
352
|
-
merchant_id = (((_a = terminal.data.responseData) === null || _a === void 0 ? void 0 : _a.authData) || {}).merchant_id;
|
|
353
|
-
return [4, API.terminalService.retrieveTerminalDeviceList([merchant_id])];
|
|
354
|
-
case 1:
|
|
355
|
-
data = _b.sent();
|
|
356
|
-
return [2, { data: data }];
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}); });
|
|
360
|
-
export var updateDeviceLinkedSuccess = createAsyncThunk('terminal/updateDeviceLinkedSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
361
|
-
var _a, settings, terminal, _b, showBoard, mode, _c, id, board_info_id, payload, data;
|
|
362
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
363
|
-
return __generator(this, function (_o) {
|
|
364
|
-
switch (_o.label) {
|
|
365
|
-
case 0:
|
|
366
|
-
_a = thunkApi.getState(), settings = _a.settings, terminal = _a.terminal;
|
|
367
|
-
_b = settings.data.appConfig, showBoard = _b.showBoard, mode = _b.mode;
|
|
368
|
-
_c = ((_d = terminal.data.responseData) === null || _d === void 0 ? void 0 : _d.boardData) || {}, id = _c.id, board_info_id = _c.board_info_id;
|
|
369
|
-
if (!id)
|
|
370
|
-
return [2, { data: undefined, nextScreen: '' }];
|
|
371
|
-
payload = {
|
|
372
|
-
lang: settings.data.language,
|
|
373
|
-
step_name: TERMINAL_STEP_NAMES.SUCCESS
|
|
374
|
-
};
|
|
375
|
-
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: board_info_id }, payload))];
|
|
376
|
-
case 1:
|
|
377
|
-
data = _o.sent();
|
|
378
|
-
if (!showBoard && mode === 'content') {
|
|
379
|
-
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
380
|
-
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
|
|
381
|
-
return [2, { data: data, nextScreen: '' }];
|
|
382
|
-
}
|
|
383
|
-
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, {});
|
|
384
|
-
(_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, { data: data });
|
|
385
|
-
return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.board }];
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
}); });
|
|
389
|
-
export var updateDeviceUnlinkedSuccess = createAsyncThunk('terminal/updateDeviceUnlinkedSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
390
|
-
var _a, settings, terminal, _b, showBoard, mode, _c, id, board_info_id, payload, data;
|
|
391
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
392
|
-
return __generator(this, function (_o) {
|
|
393
|
-
switch (_o.label) {
|
|
394
|
-
case 0:
|
|
395
|
-
_a = thunkApi.getState(), settings = _a.settings, terminal = _a.terminal;
|
|
396
|
-
_b = settings.data.appConfig, showBoard = _b.showBoard, mode = _b.mode;
|
|
397
|
-
_c = ((_d = terminal.data.responseData) === null || _d === void 0 ? void 0 : _d.boardData) || {}, id = _c.id, board_info_id = _c.board_info_id;
|
|
398
|
-
if (!id)
|
|
399
|
-
return [2, { data: undefined, nextScreen: '' }];
|
|
400
|
-
payload = {
|
|
401
|
-
lang: settings.data.language,
|
|
402
|
-
step_name: 'bank_success'
|
|
403
|
-
};
|
|
404
|
-
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: board_info_id }, payload))];
|
|
405
|
-
case 1:
|
|
406
|
-
data = _o.sent();
|
|
407
|
-
if (!showBoard && mode === 'content') {
|
|
408
|
-
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
409
|
-
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
|
|
410
|
-
return [2, { data: data, nextScreen: '' }];
|
|
411
|
-
}
|
|
412
|
-
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, {});
|
|
413
|
-
(_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, { data: data });
|
|
414
|
-
return [2, { data: data, nextScreen: CONNECT_FLOWS.terminal.board }];
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}); });
|
|
418
|
-
export var onCloseCompleteTerminal = createAsyncThunk('terminal/onCloseCompleteTerminal', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
|
-
var terminal, _a, merchant, brand, entity;
|
|
420
|
-
var _b;
|
|
421
|
-
return __generator(this, function (_c) {
|
|
422
|
-
switch (_c.label) {
|
|
423
|
-
case 0:
|
|
424
|
-
terminal = thunkApi.getState().terminal;
|
|
425
|
-
_a = ((_b = terminal.data.responseData) === null || _b === void 0 ? void 0 : _b.boardData) || {}, merchant = _a.merchant, brand = _a.brand, entity = _a.entity;
|
|
426
|
-
return [4, thunkApi.dispatch(onCloseComplete({ merchantId: merchant === null || merchant === void 0 ? void 0 : merchant.id, brandId: brand === null || brand === void 0 ? void 0 : brand.id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
427
|
-
case 1:
|
|
428
|
-
_c.sent();
|
|
429
|
-
return [2];
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
}); });
|
|
433
|
-
var initialState = {
|
|
434
|
-
error: 'null',
|
|
435
|
-
loading: false,
|
|
436
|
-
customLoading: false,
|
|
437
|
-
terminalListLoading: false,
|
|
438
|
-
data: {
|
|
439
|
-
flowName: FlowsTypes.TERMINAL,
|
|
440
|
-
verify: {
|
|
441
|
-
token: ''
|
|
442
|
-
},
|
|
443
|
-
otpData: {
|
|
444
|
-
otp: ''
|
|
445
|
-
},
|
|
446
|
-
terminalInfo: {
|
|
447
|
-
selectedTerminalDevice: SELECTED_TERMINAL_DEVICE_DEFAULT_INFO,
|
|
448
|
-
selectedTerminal: SELECTED_TERMINAL_DEFAULT_INFO
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
export var terminalSlice = createSlice({
|
|
453
|
-
name: 'terminal/store',
|
|
454
|
-
initialState: initialState,
|
|
455
|
-
reducers: {
|
|
456
|
-
clearError: function (state) {
|
|
457
|
-
state.error = null;
|
|
458
|
-
},
|
|
459
|
-
setError: function (state, action) {
|
|
460
|
-
state.error = action.payload;
|
|
461
|
-
},
|
|
462
|
-
stopLoader: function (state) {
|
|
463
|
-
state.loading = false;
|
|
464
|
-
},
|
|
465
|
-
resetOTPScreen: function (state) {
|
|
466
|
-
state.data.otpData.otp = '';
|
|
467
|
-
},
|
|
468
|
-
storeSelectedTerminalDevice: function (state, action) {
|
|
469
|
-
state.data.terminalInfo.selectedTerminalDevice = action.payload;
|
|
470
|
-
},
|
|
471
|
-
storeSelectedTerminal: function (state, action) {
|
|
472
|
-
state.data.terminalInfo.selectedTerminal = action.payload;
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
extraReducers: function (builder) {
|
|
476
|
-
builder
|
|
477
|
-
.addCase(verifyToken.pending, function (state) {
|
|
478
|
-
state.error = null;
|
|
479
|
-
state.customLoading = true;
|
|
480
|
-
})
|
|
481
|
-
.addCase(verifyToken.fulfilled, function (state, action) {
|
|
482
|
-
state.error = null;
|
|
483
|
-
state.customLoading = false;
|
|
484
|
-
var _a = action.payload || {}, data = _a.data, token = _a.token, terminalData = _a.terminalData;
|
|
485
|
-
state.data.responseData = { authData: data, boardData: { id: data === null || data === void 0 ? void 0 : data.id, board_info_id: data === null || data === void 0 ? void 0 : data.board_info_id }, terminalData: terminalData };
|
|
486
|
-
state.data.verify.token = token;
|
|
487
|
-
})
|
|
488
|
-
.addCase(verifyToken.rejected, function (state, action) {
|
|
489
|
-
state.error = action.error.message;
|
|
490
|
-
state.customLoading = false;
|
|
491
|
-
})
|
|
492
|
-
.addCase(resendOTP.pending, function (state) {
|
|
493
|
-
state.error = null;
|
|
494
|
-
})
|
|
495
|
-
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
496
|
-
state.error = null;
|
|
497
|
-
var data = action.payload.data;
|
|
498
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: data, boardData: { id: data === null || data === void 0 ? void 0 : data.id, board_info_id: data === null || data === void 0 ? void 0 : data.board_info_id } });
|
|
499
|
-
})
|
|
500
|
-
.addCase(resendOTP.rejected, function (state, action) {
|
|
501
|
-
state.error = action.error.message;
|
|
502
|
-
})
|
|
503
|
-
.addCase(verifyTokenOTP.pending, function (state) {
|
|
504
|
-
state.loading = true;
|
|
505
|
-
state.error = null;
|
|
506
|
-
})
|
|
507
|
-
.addCase(verifyTokenOTP.fulfilled, function (state, action) {
|
|
508
|
-
state.loading = false;
|
|
509
|
-
state.error = null;
|
|
510
|
-
var _a = action.payload, data = _a.data, formData = _a.formData, terminalData = _a.terminalData;
|
|
511
|
-
state.data.otpData = formData;
|
|
512
|
-
state.data.responseData = { authData: data, boardData: { id: data === null || data === void 0 ? void 0 : data.id, board_info_id: data === null || data === void 0 ? void 0 : data.board_info_id }, terminalData: terminalData };
|
|
513
|
-
})
|
|
514
|
-
.addCase(verifyTokenOTP.rejected, function (state, action) {
|
|
515
|
-
state.loading = false;
|
|
516
|
-
state.error = action.error.message;
|
|
517
|
-
})
|
|
518
|
-
.addCase(linkNewTerminal.pending, function (state) {
|
|
519
|
-
state.loading = true;
|
|
520
|
-
state.error = null;
|
|
521
|
-
})
|
|
522
|
-
.addCase(linkNewTerminal.fulfilled, function (state, action) {
|
|
523
|
-
state.loading = false;
|
|
524
|
-
state.error = null;
|
|
525
|
-
var data = action.payload.data;
|
|
526
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { linkNewTerminalData: data });
|
|
527
|
-
})
|
|
528
|
-
.addCase(linkNewTerminal.rejected, function (state, action) {
|
|
529
|
-
state.loading = false;
|
|
530
|
-
state.error = action.error.message;
|
|
531
|
-
})
|
|
532
|
-
.addCase(retrieveTerminalList.fulfilled, function (state, action) {
|
|
533
|
-
var _a, _b;
|
|
534
|
-
state.terminalListLoading = false;
|
|
535
|
-
state.error = null;
|
|
536
|
-
var data = action.payload.data;
|
|
537
|
-
if ((_a = data === null || data === void 0 ? void 0 : data.list) === null || _a === void 0 ? void 0 : _a.length)
|
|
538
|
-
state.data.terminalInfo.selectedTerminal = data.list[0];
|
|
539
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { terminalList: (_b = data === null || data === void 0 ? void 0 : data.list) !== null && _b !== void 0 ? _b : [] });
|
|
540
|
-
})
|
|
541
|
-
.addCase(retrieveTerminalList.rejected, function (state, action) {
|
|
542
|
-
state.terminalListLoading = false;
|
|
543
|
-
state.error = action.error.message;
|
|
544
|
-
})
|
|
545
|
-
.addCase(retrieveTerminalList.pending, function (state) {
|
|
546
|
-
state.terminalListLoading = true;
|
|
547
|
-
state.error = null;
|
|
548
|
-
})
|
|
549
|
-
.addCase(retrieveTerminalDeviceList.pending, function (state) {
|
|
550
|
-
state.error = null;
|
|
551
|
-
})
|
|
552
|
-
.addCase(retrieveTerminalDeviceList.fulfilled, function (state, action) {
|
|
553
|
-
state.error = null;
|
|
554
|
-
var data = action.payload.data;
|
|
555
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { terminalData: data });
|
|
556
|
-
})
|
|
557
|
-
.addCase(retrieveTerminalDeviceList.rejected, function (state, action) {
|
|
558
|
-
state.error = action.error.message;
|
|
559
|
-
})
|
|
560
|
-
.addCase(pushNotificationLinkNewTerminal.pending, function (state) {
|
|
561
|
-
state.error = null;
|
|
562
|
-
})
|
|
563
|
-
.addCase(pushNotificationLinkNewTerminal.fulfilled, function (state, action) {
|
|
564
|
-
state.error = null;
|
|
565
|
-
var data = action.payload.data;
|
|
566
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { pushNotificationLinkedNewTerminalData: data });
|
|
567
|
-
})
|
|
568
|
-
.addCase(pushNotificationLinkNewTerminal.rejected, function (state, action) {
|
|
569
|
-
var error = action.error.message;
|
|
570
|
-
if (error !== 'Aborted') {
|
|
571
|
-
state.error = error;
|
|
572
|
-
}
|
|
573
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { pushNotificationLinkedNewTerminalData: undefined });
|
|
574
|
-
})
|
|
575
|
-
.addCase(unlinkTerminalDevice.pending, function (state) {
|
|
576
|
-
state.loading = true;
|
|
577
|
-
state.error = null;
|
|
578
|
-
})
|
|
579
|
-
.addCase(unlinkTerminalDevice.fulfilled, function (state, action) {
|
|
580
|
-
state.loading = false;
|
|
581
|
-
state.error = null;
|
|
582
|
-
var data = action.payload.data;
|
|
583
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { unlinkTerminalDeviceData: data });
|
|
584
|
-
})
|
|
585
|
-
.addCase(unlinkTerminalDevice.rejected, function (state, action) {
|
|
586
|
-
state.loading = false;
|
|
587
|
-
state.error = action.error.message;
|
|
588
|
-
})
|
|
589
|
-
.addCase(linkTerminalDevice.pending, function (state) {
|
|
590
|
-
state.error = null;
|
|
591
|
-
})
|
|
592
|
-
.addCase(linkTerminalDevice.fulfilled, function (state, action) {
|
|
593
|
-
state.error = null;
|
|
594
|
-
var data = action.payload.data;
|
|
595
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { pushNotificationLinkedNewTerminalData: data, linkTerminalDeviceData: data });
|
|
596
|
-
})
|
|
597
|
-
.addCase(linkTerminalDevice.rejected, function (state, action) {
|
|
598
|
-
state.error = action.error.message;
|
|
599
|
-
})
|
|
600
|
-
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
601
|
-
state.loading = true;
|
|
602
|
-
state.error = null;
|
|
603
|
-
})
|
|
604
|
-
.addCase(retrieveBoardDetails.fulfilled, function (state, action) {
|
|
605
|
-
var _a;
|
|
606
|
-
state.loading = false;
|
|
607
|
-
state.error = null;
|
|
608
|
-
var boardData = __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.boardData), action.payload);
|
|
609
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { boardData: boardData });
|
|
610
|
-
})
|
|
611
|
-
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
612
|
-
state.loading = false;
|
|
613
|
-
state.error = action.error.message;
|
|
614
|
-
})
|
|
615
|
-
.addCase(retrieveBoardStatus.pending, function (state) {
|
|
616
|
-
state.loading = true;
|
|
617
|
-
state.error = null;
|
|
618
|
-
})
|
|
619
|
-
.addCase(retrieveBoardStatus.fulfilled, function (state, action) {
|
|
620
|
-
state.loading = false;
|
|
621
|
-
state.error = null;
|
|
622
|
-
var flows = action.payload.flows;
|
|
623
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { boardFlows: flows });
|
|
624
|
-
})
|
|
625
|
-
.addCase(retrieveBoardStatus.rejected, function (state, action) {
|
|
626
|
-
state.loading = false;
|
|
627
|
-
state.error = action.error.message;
|
|
628
|
-
})
|
|
629
|
-
.addCase(updateDeviceLinkedSuccess.pending, function (state) {
|
|
630
|
-
state.loading = true;
|
|
631
|
-
state.error = null;
|
|
632
|
-
})
|
|
633
|
-
.addCase(updateDeviceLinkedSuccess.fulfilled, function (state, action) {
|
|
634
|
-
state.loading = false;
|
|
635
|
-
state.error = null;
|
|
636
|
-
var data = action.payload.data;
|
|
637
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { boardInfoData: data });
|
|
638
|
-
})
|
|
639
|
-
.addCase(updateDeviceLinkedSuccess.rejected, function (state, action) {
|
|
640
|
-
state.loading = false;
|
|
641
|
-
state.error = action.error.message;
|
|
642
|
-
})
|
|
643
|
-
.addCase(updateDeviceUnlinkedSuccess.pending, function (state) {
|
|
644
|
-
state.loading = true;
|
|
645
|
-
state.error = null;
|
|
646
|
-
})
|
|
647
|
-
.addCase(updateDeviceUnlinkedSuccess.fulfilled, function (state, action) {
|
|
648
|
-
state.loading = false;
|
|
649
|
-
state.error = null;
|
|
650
|
-
var data = action.payload.data;
|
|
651
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { boardInfoData: data });
|
|
652
|
-
})
|
|
653
|
-
.addCase(updateDeviceUnlinkedSuccess.rejected, function (state, action) {
|
|
654
|
-
state.loading = false;
|
|
655
|
-
state.error = action.error.message;
|
|
656
|
-
})
|
|
657
|
-
.addCase(onCloseCompleteTerminal.pending, function (state) {
|
|
658
|
-
state.loading = true;
|
|
659
|
-
state.error = null;
|
|
660
|
-
})
|
|
661
|
-
.addCase(onCloseCompleteTerminal.fulfilled, function (state) {
|
|
662
|
-
state.loading = false;
|
|
663
|
-
state.error = null;
|
|
664
|
-
})
|
|
665
|
-
.addCase(onCloseCompleteTerminal.rejected, function (state, action) {
|
|
666
|
-
state.loading = false;
|
|
667
|
-
state.error = action.error.message;
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
export var clearError = (_a = terminalSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeSelectedTerminalDevice = _a.storeSelectedTerminalDevice, storeSelectedTerminal = _a.storeSelectedTerminal;
|
|
672
|
-
export default terminalSlice.reducer;
|
|
673
|
-
export var terminalSelector = function (state) { return state.terminal; };
|