@tap-payments/auth-jsconnect 2.0.53-test → 2.0.54-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 +4 -15
- package/build/@types/app.js +0 -9
- package/build/@types/form.d.ts +0 -11
- package/build/api/auth.d.ts +1 -14
- package/build/api/auth.js +1 -24
- package/build/api/axios.js +2 -2
- package/build/api/data.d.ts +1 -4
- package/build/api/data.js +2 -6
- package/build/api/entity.d.ts +0 -2
- package/build/api/index.d.ts +1 -5
- package/build/app/rootReducer.d.ts +0 -3
- package/build/app/rootReducer.js +1 -7
- package/build/app/settings.js +2 -8
- package/build/app/store.d.ts +1 -7
- package/build/assets/locales/ar.json +4 -14
- package/build/assets/locales/en.json +4 -14
- package/build/components/AnimationFlow/AnimationFlow.d.ts +1 -4
- package/build/components/AnimationFlow/AnimationFlow.js +7 -5
- package/build/components/AnimationFlow/BottomSheet.js +1 -2
- package/build/components/AnimationFlow/Dialog.d.ts +1 -4
- package/build/components/AnimationFlow/Dialog.js +4 -9
- package/build/components/FileInput/DragAndDrop.d.ts +1 -9
- package/build/components/FileInput/DragAndDrop.js +8 -113
- package/build/components/ProgressBar/index.d.ts +0 -2
- package/build/components/ProgressBar/index.js +0 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +34 -27
- package/build/constants/api.d.ts +0 -1
- package/build/constants/api.js +2 -5
- package/build/constants/app.d.ts +0 -15
- package/build/constants/app.js +3 -75
- package/build/constants/assets.d.ts +1 -17
- package/build/constants/assets.js +6 -22
- package/build/constants/validation.d.ts +0 -1
- package/build/constants/validation.js +0 -1
- package/build/features/app/bank/bankStore.d.ts +0 -4
- package/build/features/app/bank/bankStore.js +22 -42
- package/build/features/app/business/businessStore.js +12 -16
- package/build/features/app/connect/connectStore.d.ts +1 -13
- package/build/features/app/connect/connectStore.js +4 -164
- package/build/features/app/signIn/signInStore.js +2 -2
- package/build/features/bank/Bank.js +4 -10
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +8 -33
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +5 -12
- 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/connect/Connect.d.ts +1 -2
- package/build/features/connect/Connect.js +10 -40
- package/build/features/connect/screens/Individual/Individual.js +2 -6
- package/build/features/connect/screens/Merchant/Merchant.js +11 -35
- package/build/features/connect/screens/Merchant/SocialMedia.js +11 -56
- package/build/features/connect/screens/Merchant/validation.d.ts +0 -87
- package/build/features/connect/screens/Merchant/validation.js +2 -68
- package/build/features/connect/screens/Mobile/Mobile.js +4 -7
- package/build/features/featuresScreens.d.ts +0 -3
- package/build/features/featuresScreens.js +0 -48
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +5 -12
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +5 -12
- package/build/features/shared/Background/Background.d.ts +5 -7
- package/build/features/shared/Background/Background.js +5 -16
- 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 +3 -8
- package/build/features/shared/UploadFile/UploadFile.js +8 -23
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +4 -12
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +4 -12
- package/build/hooks/index.d.ts +0 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/useAppConfig.js +0 -2
- package/build/hooks/useAppDispatch.d.ts +0 -3
- package/build/hooks/useErrorListener.js +2 -3
- package/build/index.d.ts +2 -5
- package/build/index.js +2 -11
- package/build/utils/device.d.ts +0 -1
- package/build/utils/device.js +0 -13
- package/build/utils/html.d.ts +0 -1
- package/build/utils/html.js +0 -6
- 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 +20 -22
- package/build/utils/string.js +0 -9
- package/package.json +129 -129
- package/build/components/Lottie/Lottie.d.ts +0 -878
- package/build/components/Lottie/Lottie.js +0 -58
- package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
- package/build/components/Lottie/files/success.json +0 -425
- package/build/components/Lottie/index.d.ts +0 -3
- package/build/components/Lottie/index.js +0 -3
- package/build/components/ProgressBar/CircularProgressBar.d.ts +0 -14
- package/build/components/ProgressBar/CircularProgressBar.js +0 -48
- package/build/features/app/auth/authStore.d.ts +0 -35
- package/build/features/app/auth/authStore.js +0 -148
- package/build/features/app/entity/entityStore.d.ts +0 -53
- package/build/features/app/entity/entityStore.js +0 -461
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/auth/Auth.d.ts +0 -10
- package/build/features/auth/Auth.js +0 -87
- package/build/features/auth/index.d.ts +0 -1
- package/build/features/auth/index.js +0 -1
- package/build/features/auth/screens/OTP/OTP.d.ts +0 -5
- package/build/features/auth/screens/OTP/OTP.js +0 -72
- package/build/features/auth/screens/OTP/OTPInput.d.ts +0 -5
- package/build/features/auth/screens/OTP/OTPInput.js +0 -44
- package/build/features/auth/screens/OTP/index.d.ts +0 -3
- package/build/features/auth/screens/OTP/index.js +0 -2
- package/build/features/auth/screens/OTP/validation.d.ts +0 -8
- package/build/features/auth/screens/OTP/validation.js +0 -4
- package/build/features/connect/screens/CivilID/CivilID.d.ts +0 -5
- package/build/features/connect/screens/CivilID/CivilID.js +0 -85
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +0 -7
- package/build/features/connect/screens/CivilID/IDNumber.js +0 -59
- package/build/features/connect/screens/CivilID/index.d.ts +0 -3
- package/build/features/connect/screens/CivilID/index.js +0 -2
- package/build/features/connect/screens/CivilID/validation.d.ts +0 -8
- package/build/features/connect/screens/CivilID/validation.js +0 -4
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +0 -5
- package/build/features/connect/screens/Merchant/SalesChannels.js +0 -114
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +0 -5
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +0 -169
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -5
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -22
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
- package/build/features/connect/screens/VerifyPACI/index.d.ts +0 -3
- package/build/features/connect/screens/VerifyPACI/index.js +0 -2
- package/build/features/entity/Entity.d.ts +0 -7
- package/build/features/entity/Entity.js +0 -70
- package/build/features/entity/index.d.ts +0 -1
- package/build/features/entity/index.js +0 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +0 -54
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +0 -139
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +0 -56
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +0 -17
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +0 -28
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +0 -6
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +0 -38
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
- package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +0 -2
- package/build/features/entity/screens/EntityInfoConfirm/index.js +0 -2
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +0 -107
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +0 -17
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +0 -5
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +0 -9
- package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +0 -3
- package/build/features/entity/screens/ResetPasswordSuccess/index.js +0 -2
- package/build/features/entity/screens/Success/Success.d.ts +0 -5
- package/build/features/entity/screens/Success/Success.js +0 -16
- package/build/features/entity/screens/Success/index.d.ts +0 -3
- package/build/features/entity/screens/Success/index.js +0 -2
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +0 -3
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +0 -109
- package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +0 -2
- package/build/features/entity/screens/SuccessWithFlowButtons/index.js +0 -2
- package/build/features/entity/screens/Verify/OTPInput.d.ts +0 -7
- package/build/features/entity/screens/Verify/OTPInput.js +0 -47
- package/build/features/entity/screens/Verify/Verify.d.ts +0 -5
- package/build/features/entity/screens/Verify/Verify.js +0 -78
- package/build/features/entity/screens/Verify/index.d.ts +0 -2
- package/build/features/entity/screens/Verify/index.js +0 -2
- package/build/features/entity/screens/Verify/validation.d.ts +0 -8
- package/build/features/entity/screens/Verify/validation.js +0 -4
- package/build/features/otp/OTP.d.ts +0 -7
- package/build/features/otp/OTP.js +0 -58
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +0 -1
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
- package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
- package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
- package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
- package/build/features/otp/screens/OTPVerify/index.js +0 -2
- package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
- package/build/features/otp/screens/OTPVerify/validation.js +0 -4
- package/build/features/shared/Dialog/CloseDialog.d.ts +0 -11
- package/build/features/shared/Dialog/CloseDialog.js +0 -62
- package/build/features/shared/Dialog/DialogContainer.d.ts +0 -8
- package/build/features/shared/Dialog/DialogContainer.js +0 -56
- package/build/features/shared/Dialog/index.d.ts +0 -4
- package/build/features/shared/Dialog/index.js +0 -4
- package/build/hooks/useScreen.d.ts +0 -3
- package/build/hooks/useScreen.js +0 -14
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { RootState } from '../../../app/store';
|
|
2
|
-
import { FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
-
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
data: any;
|
|
5
|
-
}, void, {}>;
|
|
6
|
-
export declare const verifyOtpLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
7
|
-
formData: OTPFormValues;
|
|
8
|
-
}, OTPFormValues, {}>;
|
|
9
|
-
declare type VerifyData = {
|
|
10
|
-
token: string;
|
|
11
|
-
};
|
|
12
|
-
export interface OtpData {
|
|
13
|
-
verify: ResponseData & VerifyData;
|
|
14
|
-
otpData: OTPFormValues & ResponseData;
|
|
15
|
-
flowName: FlowsTypes;
|
|
16
|
-
}
|
|
17
|
-
export interface OtpState extends SharedState<OtpData> {
|
|
18
|
-
customLoading?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare const otpSlice: import("@reduxjs/toolkit").Slice<OtpState, {
|
|
21
|
-
clearError: (state: OtpState) => void;
|
|
22
|
-
stopLoader: (state: OtpState) => void;
|
|
23
|
-
resetOTPScreen: (state: OtpState) => void;
|
|
24
|
-
}, "otp/store">;
|
|
25
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
26
|
-
declare const _default: import("redux").Reducer<OtpState, import("redux").AnyAction>;
|
|
27
|
-
export default _default;
|
|
28
|
-
export declare const otpSelector: (state: RootState) => OtpState;
|
|
@@ -1,153 +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 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; };
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
|
@@ -1,87 +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 __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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Auth';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Auth';
|
|
@@ -1,72 +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
|
-
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);
|
|
@@ -1,44 +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
|
-
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);
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}>>>;
|
|
@@ -1,85 +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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
16
|
-
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
-
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import { civilIDValidationSchema } from './validation';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
-
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector, createCivilIdAuth } from '../../../app/connect/connectStore';
|
|
22
|
-
import Form from '../../../../components/Form';
|
|
23
|
-
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
-
import Collapse from '../../../../components/Collapse';
|
|
26
|
-
import Box from '@mui/material/Box';
|
|
27
|
-
import Divider from '@mui/material/Divider';
|
|
28
|
-
import Text from '../../../../components/Text';
|
|
29
|
-
import IDNumber from './IDNumber';
|
|
30
|
-
var FormStyled = styled(Form)(function () { return ({
|
|
31
|
-
display: 'flex',
|
|
32
|
-
flexDirection: 'column'
|
|
33
|
-
}); });
|
|
34
|
-
var TextStyled = styled(Text)(function (_a) {
|
|
35
|
-
var theme = _a.theme;
|
|
36
|
-
return ({
|
|
37
|
-
color: alpha(theme.palette.primary.dark, 0.4)
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
var DividerStyled = styled(Divider)(function (_a) {
|
|
41
|
-
var theme = _a.theme;
|
|
42
|
-
return ({
|
|
43
|
-
width: '45%',
|
|
44
|
-
borderColor: alpha(theme.palette.primary.dark, 0.4),
|
|
45
|
-
marginBlockEnd: theme.spacing(0.62)
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
var OrBoxStyled = styled(Box)(function (_a) {
|
|
49
|
-
var theme = _a.theme;
|
|
50
|
-
return ({
|
|
51
|
-
display: 'flex',
|
|
52
|
-
justifyContent: 'space-between',
|
|
53
|
-
marginBlockEnd: theme.spacing(1.62),
|
|
54
|
-
marginBlockStart: theme.spacing(-1.25),
|
|
55
|
-
marginInline: theme.spacing(2.5)
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
var CivilID = function (_a) {
|
|
59
|
-
var isAr = useLanguage().isAr;
|
|
60
|
-
var dispatch = useAppDispatch();
|
|
61
|
-
var t = useTranslation().t;
|
|
62
|
-
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
63
|
-
var settingsStore = useAppSelector(settingsSelector);
|
|
64
|
-
var methods = useForm({
|
|
65
|
-
resolver: yupResolver(civilIDValidationSchema),
|
|
66
|
-
defaultValues: data.civilIdData,
|
|
67
|
-
mode: 'onChange'
|
|
68
|
-
});
|
|
69
|
-
React.useEffect(function () {
|
|
70
|
-
handleClearError();
|
|
71
|
-
}, [methods.formState.isValid]);
|
|
72
|
-
var onSubmit = function (data) {
|
|
73
|
-
dispatch(createCivilIdAuth(data));
|
|
74
|
-
};
|
|
75
|
-
var handleClearError = function () {
|
|
76
|
-
if (error)
|
|
77
|
-
dispatch(clearError());
|
|
78
|
-
};
|
|
79
|
-
var onBack = function () {
|
|
80
|
-
dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
|
|
81
|
-
};
|
|
82
|
-
var disabled = !methods.formState.isValid || !!error;
|
|
83
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { sx: { mb: methods.formState.isValid ? 7.5 : 0, transition: 'mb 0.3s' } }), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
84
|
-
};
|
|
85
|
-
export default React.memo(CivilID);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
interface IDNumberProps {
|
|
4
|
-
sx: SxProps<Theme> | undefined;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
|
|
7
|
-
export default _default;
|
|
@@ -1,59 +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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import Box from '@mui/material/Box';
|
|
15
|
-
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
17
|
-
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
-
import Text from '../../../../components/Text';
|
|
19
|
-
import Input from '../../../shared/Input';
|
|
20
|
-
import ClearIcon from '../../../shared/ClearIcon';
|
|
21
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
22
|
-
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
|
-
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
24
|
-
import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
|
|
25
|
-
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
26
|
-
var theme = _a.theme;
|
|
27
|
-
return ({
|
|
28
|
-
display: 'flex',
|
|
29
|
-
justifyContent: 'space-between',
|
|
30
|
-
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
34
|
-
var theme = _a.theme;
|
|
35
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
36
|
-
});
|
|
37
|
-
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
38
|
-
var _b;
|
|
39
|
-
var sx = _a.sx;
|
|
40
|
-
var t = useTranslation().t;
|
|
41
|
-
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
42
|
-
var civilIdControl = useController({ control: control, name: 'civilId' });
|
|
43
|
-
React.useEffect(function () {
|
|
44
|
-
if (civilIdControl.field.value)
|
|
45
|
-
setValue('civilId', civilIdControl.field.value, { shouldValidate: true });
|
|
46
|
-
}, []);
|
|
47
|
-
var handleIdChange = function (_a) {
|
|
48
|
-
var target = _a.target;
|
|
49
|
-
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
50
|
-
civilIdControl.field.onChange(value);
|
|
51
|
-
};
|
|
52
|
-
var clearIdNumber = function () {
|
|
53
|
-
civilIdControl.field.onChange('');
|
|
54
|
-
};
|
|
55
|
-
var idValue = civilIdControl.field.value;
|
|
56
|
-
var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
57
|
-
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: !error && idValue ? _jsx(CheckIcon, {}) : idValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
|
|
58
|
-
});
|
|
59
|
-
export default React.memo(IDNumber);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as yup from 'yup';
|
|
2
|
-
export declare const civilIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
-
civilId: 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
|
-
civilId: 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
|
-
civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
-
}>>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
|
-
export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
|
-
declare const SalesChannels: () => JSX.Element;
|
|
5
|
-
export default SalesChannels;
|