@tap-payments/auth-jsconnect 2.0.54-test → 2.0.56-test
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 +39 -14
- package/build/@types/app.js +9 -0
- package/build/@types/form.d.ts +11 -0
- package/build/api/auth.d.ts +14 -1
- package/build/api/auth.js +24 -1
- package/build/api/axios.js +2 -2
- package/build/api/data.d.ts +33 -7
- package/build/api/data.js +41 -16
- package/build/api/entity.d.ts +2 -0
- package/build/api/index.d.ts +11 -8
- package/build/api/individual.d.ts +1 -1
- package/build/app/rootReducer.d.ts +3 -0
- package/build/app/rootReducer.js +7 -1
- package/build/app/settings.js +8 -2
- package/build/app/store.d.ts +7 -1
- package/build/assets/locales/ar.json +14 -4
- package/build/assets/locales/en.json +14 -4
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +5 -7
- package/build/components/AnimationFlow/BottomSheet.js +2 -1
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +9 -4
- package/build/components/FileInput/DragAndDrop.d.ts +9 -1
- package/build/components/FileInput/DragAndDrop.js +113 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -1
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +27 -34
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +10 -7
- package/build/constants/app.d.ts +15 -0
- package/build/constants/app.js +75 -3
- package/build/constants/assets.d.ts +17 -1
- package/build/constants/assets.js +22 -6
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +35 -0
- package/build/features/app/auth/authStore.js +148 -0
- package/build/features/app/bank/bankStore.d.ts +4 -0
- package/build/features/app/bank/bankStore.js +42 -22
- package/build/features/app/business/businessStore.js +53 -43
- package/build/features/app/connect/connectStore.d.ts +13 -1
- package/build/features/app/connect/connectStore.js +164 -4
- package/build/features/app/entity/entityStore.d.ts +53 -0
- package/build/features/app/entity/entityStore.js +461 -0
- package/build/features/app/individual/individualStore.js +19 -11
- package/build/features/app/otp/otpStore.d.ts +28 -0
- package/build/features/app/otp/otpStore.js +153 -0
- package/build/features/app/signIn/signInStore.js +2 -2
- package/build/features/auth/Auth.d.ts +10 -0
- package/build/features/auth/Auth.js +87 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +72 -0
- package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTPInput.js +44 -0
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/auth/screens/OTP/validation.d.ts +8 -0
- package/build/features/auth/screens/OTP/validation.js +4 -0
- package/build/features/bank/Bank.js +10 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +33 -8
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +12 -5
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +25 -7
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/connect/Connect.d.ts +2 -1
- package/build/features/connect/Connect.js +40 -10
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +85 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Individual.js +6 -2
- package/build/features/connect/screens/Merchant/Merchant.js +35 -11
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +5 -0
- package/build/features/connect/screens/Merchant/SalesChannels.js +114 -0
- package/build/features/connect/screens/Merchant/SocialMedia.js +56 -11
- package/build/features/connect/screens/Merchant/validation.d.ts +87 -0
- package/build/features/connect/screens/Merchant/validation.js +68 -2
- package/build/features/connect/screens/Mobile/Mobile.js +7 -4
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +169 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/Entity.d.ts +7 -0
- package/build/features/entity/Entity.js +70 -0
- package/build/features/entity/index.d.ts +1 -0
- package/build/features/entity/index.js +1 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +139 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +56 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +112 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/entity/screens/Success/Success.d.ts +5 -0
- package/build/features/entity/screens/Success/Success.js +16 -0
- package/build/features/entity/screens/Success/index.d.ts +3 -0
- package/build/features/entity/screens/Success/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +109 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/entity/screens/Verify/OTPInput.js +47 -0
- package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
- package/build/features/entity/screens/Verify/Verify.js +78 -0
- package/build/features/entity/screens/Verify/index.d.ts +2 -0
- package/build/features/entity/screens/Verify/index.js +2 -0
- package/build/features/entity/screens/Verify/validation.d.ts +8 -0
- package/build/features/entity/screens/Verify/validation.js +4 -0
- package/build/features/featuresScreens.d.ts +3 -0
- package/build/features/featuresScreens.js +48 -0
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +12 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +14 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/otp/OTP.d.ts +7 -0
- package/build/features/otp/OTP.js +58 -0
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +1 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +6 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.js +47 -0
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +5 -0
- package/build/features/otp/screens/OTPVerify/Verify.js +49 -0
- package/build/features/otp/screens/OTPVerify/index.d.ts +2 -0
- package/build/features/otp/screens/OTPVerify/index.js +2 -0
- package/build/features/otp/screens/OTPVerify/validation.d.ts +8 -0
- package/build/features/otp/screens/OTPVerify/validation.js +4 -0
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +12 -5
- package/build/features/shared/Background/Background.d.ts +7 -5
- package/build/features/shared/Background/Background.js +16 -5
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +62 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +8 -3
- package/build/features/shared/UploadFile/UploadFile.js +23 -8
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +12 -4
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +12 -4
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.js +2 -0
- package/build/hooks/useAppDispatch.d.ts +3 -0
- package/build/hooks/useErrorListener.js +3 -2
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/index.d.ts +5 -2
- package/build/index.js +11 -2
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/html.d.ts +1 -0
- package/build/utils/html.js +6 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +22 -20
- package/build/utils/string.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
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 API from '../../../api';
|
|
51
|
+
import { FlowsTypes } from '../../../@types';
|
|
52
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
|
+
import { OTP_STEP_NAMES } from '../../../constants';
|
|
54
|
+
export var resendOTP = createAsyncThunk('otpResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var otp, payload, data;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
otp = thunkApi.getState().otp;
|
|
60
|
+
payload = {
|
|
61
|
+
service_name: 'tap_email',
|
|
62
|
+
verify_token: otp.data.verify.token
|
|
63
|
+
};
|
|
64
|
+
return [4, API.leadService.verifyLeadToken(payload)];
|
|
65
|
+
case 1:
|
|
66
|
+
data = (_a.sent()).data;
|
|
67
|
+
return [2, { data: data }];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); });
|
|
71
|
+
export var verifyOtpLeadOTP = createAsyncThunk('verifyOtpLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var otp, responseBody, payload;
|
|
73
|
+
var _a;
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
otp = thunkApi.getState().otp;
|
|
76
|
+
responseBody = otp.data.verify.responseBody;
|
|
77
|
+
payload = {
|
|
78
|
+
data: params.otp,
|
|
79
|
+
service_name: (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _a === void 0 ? void 0 : _a.service_name,
|
|
80
|
+
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
81
|
+
step_name: OTP_STEP_NAMES.PHONE_AUTH,
|
|
82
|
+
encryption_contract: ['data']
|
|
83
|
+
};
|
|
84
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
85
|
+
return [2, { formData: params }];
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
88
|
+
var initialState = {
|
|
89
|
+
error: null,
|
|
90
|
+
loading: false,
|
|
91
|
+
customLoading: false,
|
|
92
|
+
data: {
|
|
93
|
+
flowName: FlowsTypes.OTP,
|
|
94
|
+
verify: {
|
|
95
|
+
token: ''
|
|
96
|
+
},
|
|
97
|
+
otpData: {
|
|
98
|
+
otp: ''
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export var otpSlice = createSlice({
|
|
103
|
+
name: 'otp/store',
|
|
104
|
+
initialState: initialState,
|
|
105
|
+
reducers: {
|
|
106
|
+
clearError: function (state) {
|
|
107
|
+
state.error = null;
|
|
108
|
+
},
|
|
109
|
+
stopLoader: function (state) {
|
|
110
|
+
state.loading = false;
|
|
111
|
+
},
|
|
112
|
+
resetOTPScreen: function (state) {
|
|
113
|
+
state.data.otpData.otp = '';
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
extraReducers: function (builder) {
|
|
117
|
+
builder
|
|
118
|
+
.addCase(resendOTP.pending, function (state) {
|
|
119
|
+
state.error = null;
|
|
120
|
+
})
|
|
121
|
+
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
122
|
+
var _a;
|
|
123
|
+
state.error = null;
|
|
124
|
+
var data = action.payload.data;
|
|
125
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
126
|
+
if (description) {
|
|
127
|
+
state.error = description;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
|
|
131
|
+
})
|
|
132
|
+
.addCase(resendOTP.rejected, function (state, action) {
|
|
133
|
+
state.error = action.error.message;
|
|
134
|
+
})
|
|
135
|
+
.addCase(verifyOtpLeadOTP.pending, function (state) {
|
|
136
|
+
state.loading = true;
|
|
137
|
+
state.error = null;
|
|
138
|
+
})
|
|
139
|
+
.addCase(verifyOtpLeadOTP.fulfilled, function (state, action) {
|
|
140
|
+
state.loading = false;
|
|
141
|
+
state.error = null;
|
|
142
|
+
var formData = action.payload.formData;
|
|
143
|
+
state.data.otpData = formData;
|
|
144
|
+
})
|
|
145
|
+
.addCase(verifyOtpLeadOTP.rejected, function (state, action) {
|
|
146
|
+
state.loading = false;
|
|
147
|
+
state.error = action.error.message;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
export var clearError = (_a = otpSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
152
|
+
export default otpSlice.reducer;
|
|
153
|
+
export var otpSelector = function (state) { return state.otp; };
|
|
@@ -177,7 +177,7 @@ export var verifyAuthOTP = createAsyncThunk('signIn/verifyAuthOTP', function (pa
|
|
|
177
177
|
new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
|
|
178
178
|
sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
|
|
179
179
|
remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
|
|
180
|
-
scopes:
|
|
180
|
+
scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
|
|
181
181
|
step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL_OTP,
|
|
182
182
|
encryption_contract: ['data']
|
|
183
183
|
};
|
|
@@ -210,7 +210,7 @@ export var verifyAuthPassword = createAsyncThunk('signIn/verifyAuthPassword', fu
|
|
|
210
210
|
new_user: responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user,
|
|
211
211
|
sign_in: responseBody === null || responseBody === void 0 ? void 0 : responseBody.sign_in,
|
|
212
212
|
remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
|
|
213
|
-
scopes:
|
|
213
|
+
scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
|
|
214
214
|
step_name: mobile ? SignIn_STEP_NAMES.VERIFY_AUTH_MOBILE : SignIn_STEP_NAMES.VERIFY_AUTH_EMAIL,
|
|
215
215
|
encryption_contract: ['data']
|
|
216
216
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface AuthLibProps extends LibConfig {
|
|
4
|
+
leadId: string;
|
|
5
|
+
postURL: string;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AuthLib(props: AuthLibProps): JSX.Element;
|
|
9
|
+
export declare function renderAuthLib(config: AuthLibProps, elementId: string): void;
|
|
10
|
+
export declare function unmountAuthLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
import { memo, useEffect } from 'react';
|
|
25
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
26
|
+
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
|
|
27
|
+
import { settingsSelector, handleOpen } from '../../app/settings';
|
|
28
|
+
import AnimationFlow from '../../components/AnimationFlow';
|
|
29
|
+
import { store } from '../../app/store';
|
|
30
|
+
import { authSelector, retrieveLead, storeLeadId, storePostUrl } from '../app/auth/authStore';
|
|
31
|
+
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
32
|
+
import Collapse from '../../components/Collapse';
|
|
33
|
+
import { reactElement, removeElement } from '../../utils';
|
|
34
|
+
import { AUTH_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
|
|
35
|
+
import { authFeatureScreens } from '../featuresScreens';
|
|
36
|
+
import Background from '../shared/Background';
|
|
37
|
+
var Auth = memo(function (_a) {
|
|
38
|
+
var onClose = _a.onClose, props = __rest(_a, ["onClose"]);
|
|
39
|
+
var theme = useAppTheme().theme;
|
|
40
|
+
var dispatch = useAppDispatch();
|
|
41
|
+
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
42
|
+
var _c = useAppSelector(authSelector), authError = _c.error, customLoading = _c.customLoading;
|
|
43
|
+
useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION }, props));
|
|
44
|
+
useErrorListener(authError || error);
|
|
45
|
+
useStepStartedListener();
|
|
46
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (!props.leadId)
|
|
49
|
+
throw new Error('leadId is required');
|
|
50
|
+
var _a = props || {}, leadId = _a.leadId, postURL = _a.postURL;
|
|
51
|
+
var data = {
|
|
52
|
+
leadId: leadId,
|
|
53
|
+
postUrl: postURL
|
|
54
|
+
};
|
|
55
|
+
dispatch(storeLeadId(data));
|
|
56
|
+
dispatch(storePostUrl(data));
|
|
57
|
+
}, []);
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
var leadId = (props || {}).leadId;
|
|
60
|
+
if (!settingLoading)
|
|
61
|
+
dispatch(retrieveLead(leadId));
|
|
62
|
+
}, [settingLoading]);
|
|
63
|
+
var handleDialogClose = function () {
|
|
64
|
+
dispatch(handleOpen(false));
|
|
65
|
+
};
|
|
66
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(_Fragment, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
|
|
67
|
+
var Element = _a.element, name = _a.name;
|
|
68
|
+
var isActive = activeScreen.name === name;
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
70
|
+
}) }) })) })) })));
|
|
71
|
+
});
|
|
72
|
+
export function AuthLib(props) {
|
|
73
|
+
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
|
|
74
|
+
}
|
|
75
|
+
export function renderAuthLib(config, elementId) {
|
|
76
|
+
reactElement(elementId).render(_jsx(AuthLib, __assign({}, config)));
|
|
77
|
+
}
|
|
78
|
+
export function unmountAuthLib(elementId, unmountTimeout) {
|
|
79
|
+
if (unmountTimeout === void 0) { unmountTimeout = 1000; }
|
|
80
|
+
var element = document.getElementById(elementId);
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
var _a;
|
|
83
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
84
|
+
removeElement(DIALOG_ID);
|
|
85
|
+
reactElement(elementId).unmount();
|
|
86
|
+
}, unmountTimeout);
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Auth';
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import { clearError, authSelector, resetOTPScreen, verifyAuthOTP } from '../../../app/auth/authStore';
|
|
19
|
+
import Button from '../../../shared/Button';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { useLanguage } from '../../../../hooks';
|
|
23
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
24
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
25
|
+
import Form from '../../../../components/Form';
|
|
26
|
+
import { maskPhone } from '../../../../utils';
|
|
27
|
+
import { OTPValidation } from './validation';
|
|
28
|
+
import OTPInput from './OTPInput';
|
|
29
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
background: theme.palette.common.white,
|
|
33
|
+
border: '1px solid',
|
|
34
|
+
borderColor: theme.palette.divider,
|
|
35
|
+
direction: theme.direction,
|
|
36
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
37
|
+
marginBottom: theme.spacing(5.75)
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
43
|
+
});
|
|
44
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column'
|
|
47
|
+
}); });
|
|
48
|
+
var OTP = function () {
|
|
49
|
+
var dispatch = useAppDispatch();
|
|
50
|
+
var _a = useAppSelector(authSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
51
|
+
var methods = useForm({
|
|
52
|
+
resolver: yupResolver(OTPValidation),
|
|
53
|
+
defaultValues: { otp: '' },
|
|
54
|
+
mode: 'onChange'
|
|
55
|
+
});
|
|
56
|
+
var t = useTranslation().t;
|
|
57
|
+
var isAr = useLanguage().isAr;
|
|
58
|
+
React.useEffect(function () {
|
|
59
|
+
if (!!data.mobileNumber && error)
|
|
60
|
+
dispatch(clearError());
|
|
61
|
+
return function () {
|
|
62
|
+
dispatch(resetOTPScreen());
|
|
63
|
+
};
|
|
64
|
+
}, [methods.formState.isValid]);
|
|
65
|
+
var onSubmit = function (formData) {
|
|
66
|
+
dispatch(verifyAuthOTP(formData));
|
|
67
|
+
};
|
|
68
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
69
|
+
var phone = data.mobileNumber;
|
|
70
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
71
|
+
};
|
|
72
|
+
export default React.memo(OTP);
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Box from '@mui/material/Box/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import OTPField from '../../../shared/OTP';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
22
|
+
var theme = _a.theme;
|
|
23
|
+
return ({
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
fontFamily: theme.typography.fontFamily
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var OTPInput = function (_a) {
|
|
30
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
31
|
+
var t = useTranslation().t;
|
|
32
|
+
var dispatch = useAppDispatch();
|
|
33
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
34
|
+
var handleOnOTPChange = function (otp) {
|
|
35
|
+
otpControl.field.onChange(otp);
|
|
36
|
+
};
|
|
37
|
+
var handleOnResendOTP = function () {
|
|
38
|
+
if (otpControl.field.value)
|
|
39
|
+
setValue('otp', '', { shouldValidate: true });
|
|
40
|
+
};
|
|
41
|
+
var otpValue = otpControl.field.value;
|
|
42
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
43
|
+
};
|
|
44
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -17,9 +17,9 @@ import AnimationFlow from '../../components/AnimationFlow';
|
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
19
|
import Collapse from '../../components/Collapse';
|
|
20
|
-
import { getParameterByName, reactElement } from '../../utils';
|
|
20
|
+
import { getParameterByName, reactElement, removeElement } from '../../utils';
|
|
21
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
-
import { BANK_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { BANK_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
|
|
23
23
|
import { bankFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import CustomFooter from '../shared/Footer';
|
|
25
25
|
import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
|
|
@@ -46,7 +46,7 @@ var Bank = memo(function (props) {
|
|
|
46
46
|
if (!settingLoading)
|
|
47
47
|
verifyToken();
|
|
48
48
|
}, [settingLoading]);
|
|
49
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
|
|
50
50
|
var Element = _a.element, name = _a.name;
|
|
51
51
|
var isActive = activeScreen.name === name;
|
|
52
52
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -59,5 +59,11 @@ export function renderBankLib(config, elementId) {
|
|
|
59
59
|
reactElement(elementId).render(_jsx(BankLib, __assign({}, config)));
|
|
60
60
|
}
|
|
61
61
|
export function unmountBankLib(elementId) {
|
|
62
|
-
|
|
62
|
+
var element = document.getElementById(elementId);
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
66
|
+
removeElement(DIALOG_ID);
|
|
67
|
+
reactElement(elementId).unmount();
|
|
68
|
+
}, 1000);
|
|
63
69
|
}
|
|
@@ -42,7 +42,7 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
42
42
|
var BankDetails = function () {
|
|
43
43
|
var _a = React.useState(false), ibanChecking = _a[0], setIbanChecking = _a[1];
|
|
44
44
|
var dispatch = useAppDispatch();
|
|
45
|
-
var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
45
|
+
var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
|
|
46
46
|
var methods = useForm({
|
|
47
47
|
resolver: yupResolver(BankValidation),
|
|
48
48
|
defaultValues: data.bankData,
|
|
@@ -56,7 +56,7 @@ var BankDetails = function () {
|
|
|
56
56
|
var onBack = function () {
|
|
57
57
|
dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
58
58
|
};
|
|
59
|
-
var disabled = ibanChecking || !methods.formState.isValid || !!error;
|
|
59
|
+
var disabled = ibanChecking || !methods.formState.isValid || !!error || uploading;
|
|
60
60
|
React.useEffect(function () {
|
|
61
61
|
if (error)
|
|
62
62
|
dispatch(clearError());
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { styled } from '@mui/material/styles';
|
|
3
4
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
6
|
import { useController, useFormContext } from 'react-hook-form';
|
|
6
|
-
import { useAppSelector } from '../../../../hooks';
|
|
7
|
-
import { bankSelector } from '../../../app/bank/bankStore';
|
|
7
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
|
+
import { bankSelector, uploadBankStatement } from '../../../app/bank/bankStore';
|
|
8
9
|
import UploadFile from '../../../shared/UploadFile';
|
|
10
|
+
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
9
11
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
10
12
|
var theme = _a.theme;
|
|
11
13
|
return ({
|
|
@@ -13,18 +15,41 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
13
15
|
});
|
|
14
16
|
});
|
|
15
17
|
var BankStatement = function () {
|
|
16
|
-
var _a;
|
|
18
|
+
var _a, _b;
|
|
17
19
|
var t = useTranslation().t;
|
|
18
|
-
var
|
|
20
|
+
var _c = useFormContext(), control = _c.control, setError = _c.setError, clearErrors = _c.clearErrors;
|
|
19
21
|
var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
+
var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
|
|
23
|
+
var _d = useAppSelector(bankSelector), loading = _d.loading, uploading = _d.uploading, sysError = _d.error;
|
|
24
|
+
var dispatch = useAppDispatch();
|
|
25
|
+
var bankStatementValue = bankStatementFileControl.field.value;
|
|
26
|
+
var error = ((_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = bankStatementIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
22
27
|
var handleBankStatementChange = function (file) {
|
|
23
|
-
|
|
28
|
+
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
29
|
+
setError('bankStatementFile', { message: 'file_not_supported_alert' });
|
|
30
|
+
}
|
|
31
|
+
else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
32
|
+
setError('bankStatementFile', { message: 'file_size_alert' });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
bankStatementFileControl.field.onChange(file);
|
|
36
|
+
dispatch(uploadBankStatement(file));
|
|
37
|
+
}
|
|
24
38
|
};
|
|
25
39
|
var handleReset = function () {
|
|
26
40
|
bankStatementFileControl.field.onChange(null);
|
|
41
|
+
bankStatementIdControl.field.onChange('');
|
|
27
42
|
};
|
|
28
|
-
|
|
43
|
+
React.useEffect(function () {
|
|
44
|
+
if (sysError === 'file_upload_error') {
|
|
45
|
+
setError('bankStatementId', { message: sysError });
|
|
46
|
+
bankStatementFileControl.field.onChange(null);
|
|
47
|
+
}
|
|
48
|
+
}, [sysError]);
|
|
49
|
+
React.useEffect(function () {
|
|
50
|
+
if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
|
|
51
|
+
clearErrors();
|
|
52
|
+
}, [bankStatementFileControl.formState.isValid, bankStatementValue]);
|
|
53
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, onReset: handleReset, error: error && t(error) }) }));
|
|
29
54
|
};
|
|
30
55
|
export default BankStatement;
|
|
@@ -4,4 +4,4 @@ export interface BusinessLibProps extends LibConfig {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function BusinessLib(props: BusinessLibProps): JSX.Element;
|
|
6
6
|
export declare function renderBusinessLib(config: BusinessLibProps, elementId: string): void;
|
|
7
|
-
export declare function unmountBusinessLib(elementId: string): void;
|
|
7
|
+
export declare function unmountBusinessLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -19,8 +19,8 @@ import AnimationFlow from '../../components/AnimationFlow';
|
|
|
19
19
|
import { store } from '../../app/store';
|
|
20
20
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
21
21
|
import Collapse from '../../components/Collapse';
|
|
22
|
-
import { getParameterByName, reactElement } from '../../utils';
|
|
23
|
-
import { BUSINESS_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { getParameterByName, reactElement, removeElement } from '../../utils';
|
|
23
|
+
import { BUSINESS_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
|
|
24
24
|
import { businessFeatureScreens } from '../featuresScreens';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
import Background from '../shared/Background';
|
|
@@ -46,7 +46,7 @@ var Business = memo(function (props) {
|
|
|
46
46
|
if (!settingLoading)
|
|
47
47
|
verifyToken();
|
|
48
48
|
}, [settingLoading]);
|
|
49
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
|
|
50
50
|
var Element = _a.element, name = _a.name;
|
|
51
51
|
var isActive = activeScreen.name === name;
|
|
52
52
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -58,6 +58,13 @@ export function BusinessLib(props) {
|
|
|
58
58
|
export function renderBusinessLib(config, elementId) {
|
|
59
59
|
reactElement(elementId).render(_jsx(BusinessLib, __assign({}, config)));
|
|
60
60
|
}
|
|
61
|
-
export function unmountBusinessLib(elementId) {
|
|
62
|
-
|
|
61
|
+
export function unmountBusinessLib(elementId, unmountTimeout) {
|
|
62
|
+
if (unmountTimeout === void 0) { unmountTimeout = 1000; }
|
|
63
|
+
var element = document.getElementById(elementId);
|
|
64
|
+
setTimeout(function () {
|
|
65
|
+
var _a;
|
|
66
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
67
|
+
removeElement(DIALOG_ID);
|
|
68
|
+
reactElement(elementId).unmount();
|
|
69
|
+
}, unmountTimeout);
|
|
63
70
|
}
|
|
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
20
20
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
23
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
23
|
+
color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
|
|
24
24
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
25
25
|
htmlColor?: string | undefined;
|
|
26
26
|
inheritViewBox?: boolean | undefined;
|
|
@@ -107,6 +107,6 @@ var SalesChannels = function () {
|
|
|
107
107
|
if (channelsChecked)
|
|
108
108
|
return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
|
|
109
109
|
};
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.
|
|
110
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
111
111
|
};
|
|
112
112
|
export default SalesChannels;
|
|
@@ -35,7 +35,7 @@ export declare const NameContainer: import("@emotion/styled").StyledComponent<im
|
|
|
35
35
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
36
36
|
children?: React.ReactNode;
|
|
37
37
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
38
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
38
|
+
color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
|
|
39
39
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
40
40
|
htmlColor?: string | undefined;
|
|
41
41
|
inheritViewBox?: boolean | undefined;
|
|
@@ -49,7 +49,7 @@ export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<
|
|
|
49
49
|
export declare const RemainingCheck: import("@emotion/styled").StyledComponent<{
|
|
50
50
|
children?: React.ReactNode;
|
|
51
51
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
52
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
52
|
+
color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
|
|
53
53
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
54
54
|
htmlColor?: string | undefined;
|
|
55
55
|
inheritViewBox?: boolean | undefined;
|