@tap-payments/auth-jsconnect 2.0.37-test → 2.0.37
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 +50 -20
- package/build/@types/app.js +9 -3
- package/build/@types/form.d.ts +20 -12
- package/build/api/auth.d.ts +28 -5
- package/build/api/auth.js +36 -1
- package/build/api/axios.js +2 -2
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/country.d.ts +3 -1
- package/build/api/country.js +3 -1
- package/build/api/data.d.ts +38 -7
- package/build/api/data.js +57 -17
- package/build/api/entity.d.ts +51 -5
- package/build/api/entity.js +39 -9
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +3 -1
- package/build/api/index.d.ts +44 -14
- package/build/api/individual.d.ts +76 -19
- package/build/api/individual.js +29 -2
- package/build/api/lead.d.ts +9 -6
- package/build/api/lead.js +8 -1
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +0 -2
- package/build/app/settings.d.ts +8 -2
- package/build/app/settings.js +29 -12
- package/build/app/store.d.ts +1 -3
- package/build/assets/locales/ar.json +258 -183
- package/build/assets/locales/en.json +190 -108
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +6 -8
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +4 -3
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +7 -5
- package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
- package/build/components/ArabicDatePicker/index.d.ts +2 -0
- package/build/components/ArabicDatePicker/index.js +2 -0
- package/build/components/ArabicDatePicker/style.css +24 -0
- package/build/components/FileInput/DragAndDrop.d.ts +10 -1
- package/build/components/FileInput/DragAndDrop.js +108 -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/OTPField/OTPField.d.ts +2 -1
- package/build/components/OTPField/OTPField.js +2 -2
- package/build/components/OTPTimer/OTPTimer.js +1 -1
- 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/RadioLabel/RadioLabel.d.ts +2 -1
- package/build/components/RadioLabel/RadioLabel.js +2 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.js +14 -1
- package/build/constants/app.d.ts +6 -5
- package/build/constants/app.js +53 -28
- package/build/constants/assets.d.ts +14 -0
- package/build/constants/assets.js +16 -2
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +2 -2
- package/build/constants/validation.d.ts +10 -0
- package/build/constants/validation.js +11 -1
- package/build/features/app/auth/authStore.d.ts +30 -4
- package/build/features/app/auth/authStore.js +181 -21
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +86 -39
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +438 -296
- package/build/features/app/connect/connectStore.d.ts +34 -31
- package/build/features/app/connect/connectStore.js +427 -300
- package/build/features/app/entity/entityStore.d.ts +27 -7
- package/build/features/app/entity/entityStore.js +222 -145
- package/build/features/app/individual/individualStore.d.ts +18 -0
- package/build/features/app/individual/individualStore.js +171 -84
- package/build/features/app/password/passwordStore.js +1 -1
- package/build/features/app/tax/taxStore.js +18 -14
- package/build/features/auth/Auth.d.ts +3 -1
- package/build/features/auth/Auth.js +48 -14
- package/build/features/auth/screens/NID/DOB.d.ts +7 -0
- package/build/features/auth/screens/NID/DOB.js +47 -0
- package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
- package/build/features/auth/screens/NID/IDNumber.js +64 -0
- package/build/features/auth/screens/NID/NID.d.ts +5 -0
- package/build/features/auth/screens/NID/NID.js +68 -0
- package/build/features/auth/screens/NID/TAC.d.ts +3 -0
- package/build/features/auth/screens/NID/TAC.js +87 -0
- package/build/features/auth/screens/NID/index.d.ts +3 -0
- package/build/features/auth/screens/NID/index.js +2 -0
- package/build/features/auth/screens/NID/validation.d.ts +27 -0
- package/build/features/auth/screens/NID/validation.js +19 -0
- package/build/features/auth/screens/OTP/OTP.js +8 -4
- package/build/features/auth/screens/OTP/OTPInput.js +9 -2
- package/build/features/bank/Bank.js +12 -6
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
- package/build/features/bank/screens/BankDetails/BankName.js +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +14 -7
- package/build/features/business/screens/Activities/Activities.js +16 -17
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
- package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
- package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
- package/build/features/business/screens/BusinessType/EntityName.js +56 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
- package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
- package/build/features/business/screens/BusinessType/validation.js +52 -3
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +67 -0
- package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/business/screens/CivilID/IDNumber.js +59 -0
- package/build/features/business/screens/CivilID/index.d.ts +3 -0
- package/build/features/business/screens/CivilID/index.js +2 -0
- package/build/features/business/screens/CivilID/validation.d.ts +8 -0
- package/build/features/business/screens/CivilID/validation.js +4 -0
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
- package/build/features/business/screens/Customers/Customers.js +15 -9
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
- package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
- package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
- package/build/features/business/screens/OTP/OTP.js +15 -2
- package/build/features/business/screens/Success/Success.js +10 -3
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
- package/build/features/business/screens/Verify/Verify.js +4 -4
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/business/screens/VerifyPACI/index.js +2 -0
- package/build/features/connect/Connect.d.ts +2 -1
- package/build/features/connect/Connect.js +47 -12
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +102 -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/Email.js +11 -3
- package/build/features/connect/screens/Individual/Individual.js +44 -28
- package/build/features/connect/screens/Merchant/BrandList.js +15 -7
- package/build/features/connect/screens/Merchant/BrandName.js +7 -4
- package/build/features/connect/screens/Merchant/Merchant.js +41 -64
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
- package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
- package/build/features/connect/screens/Merchant/TAC.js +8 -2
- package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
- package/build/features/connect/screens/Merchant/validation.js +108 -173
- package/build/features/connect/screens/Mobile/Mobile.js +33 -12
- package/build/features/connect/screens/NID/NID.js +5 -1
- package/build/features/connect/screens/OTP/OTP.js +20 -6
- package/build/features/connect/screens/OTP/OTPInput.js +3 -2
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -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 +1 -1
- package/build/features/entity/Entity.js +16 -9
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
- package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +26 -7
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +25 -4
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +12 -51
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -10
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
- package/build/features/entity/screens/Verify/Verify.js +18 -5
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +25 -7
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +14 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/individual/screens/Verify/Verify.js +18 -5
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +14 -7
- package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
- package/build/features/password/screens/OTP/OTP.js +15 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
- package/build/features/password/screens/Verify/Verify.js +16 -3
- package/build/features/shared/Background/Background.d.ts +4 -5
- package/build/features/shared/Background/Background.js +16 -5
- package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
- package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
- package/build/features/shared/Button/MobileButton.d.ts +2 -1
- package/build/features/shared/Button/MobileButton.js +2 -2
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +71 -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/SuccessScreen/SuccessScreen.js +1 -1
- package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
- package/build/features/shared/UploadFile/UploadFile.js +24 -9
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +14 -6
- package/build/features/signIn/screens/Email/Email.js +4 -2
- package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
- package/build/features/signIn/screens/OTP/OTP.js +14 -1
- package/build/features/signIn/screens/Password/Password.js +15 -2
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +16 -8
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
- package/build/features/tax/screens/Verify/Verify.js +16 -3
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/useAppConfig.d.ts +3 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/hooks/useErrorListener.js +0 -6
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
- package/build/hooks/useSetFromDefaultValues.js +24 -0
- package/build/index.d.ts +2 -3
- package/build/index.js +1 -4
- package/build/utils/array.d.ts +49 -1
- package/build/utils/array.js +58 -0
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +3 -0
- 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/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +12 -0
- package/build/utils/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +33 -20
- package/build/utils/string.js +71 -1
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +5 -4
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
- package/build/features/business/screens/Activities/SalesChannels.js +0 -112
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
- 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
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
50
|
+
import Box from '@mui/material/Box/Box';
|
|
51
|
+
import { styled } from '@mui/material/styles';
|
|
52
|
+
import { useTranslation } from 'react-i18next';
|
|
53
|
+
import Text from '../../../../components/Text';
|
|
54
|
+
import { connectSelector, verifyPACI as verifyPACIFun } from '../../../app/connect/connectStore';
|
|
55
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
56
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
|
+
import { MobileButton } from '../../../shared/Button';
|
|
58
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
+
import { mobileOS, sleep } from '../../../../utils';
|
|
60
|
+
import Collapse from '../../../../components/Collapse';
|
|
61
|
+
import Warning from '../../../../components/Warning';
|
|
62
|
+
import VerifyPACILoading from './VerifyPACILoading';
|
|
63
|
+
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
64
|
+
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
65
|
+
var theme = _a.theme;
|
|
66
|
+
return ({
|
|
67
|
+
direction: theme.direction,
|
|
68
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
69
|
+
display: 'flex',
|
|
70
|
+
flexDirection: 'column',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
marginBottom: theme.spacing(2.5)
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
var VerifyPACITitleStyled = styled(Text)(function (_a) {
|
|
76
|
+
var theme = _a.theme;
|
|
77
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
78
|
+
});
|
|
79
|
+
var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
|
|
80
|
+
var theme = _a.theme;
|
|
81
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
|
|
82
|
+
});
|
|
83
|
+
var Container = styled(Box)(function (_a) {
|
|
84
|
+
var theme = _a.theme;
|
|
85
|
+
return ({
|
|
86
|
+
position: 'relative',
|
|
87
|
+
display: 'flex',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
maxHeight: '300px'
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
var BackButton = styled('button')(function (_a) {
|
|
94
|
+
var theme = _a.theme;
|
|
95
|
+
return ({
|
|
96
|
+
cursor: 'pointer',
|
|
97
|
+
pointerEvents: 'auto',
|
|
98
|
+
height: 44,
|
|
99
|
+
appearance: 'none',
|
|
100
|
+
background: 'none',
|
|
101
|
+
border: 'none',
|
|
102
|
+
color: theme.palette.primary.main,
|
|
103
|
+
fontSize: theme.typography.body1.fontSize,
|
|
104
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
105
|
+
textTransform: 'capitalize',
|
|
106
|
+
'&:hover': {
|
|
107
|
+
backgroundColor: 'transparent'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
var VerifyPACI = function () {
|
|
112
|
+
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
113
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
114
|
+
var dispatch = useAppDispatch();
|
|
115
|
+
var _c = useAppSelector(connectSelector), data = _c.data, error = _c.error;
|
|
116
|
+
var responseBody = data.civilIdData.responseBody;
|
|
117
|
+
var t = useTranslation().t;
|
|
118
|
+
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
setSuccess(true);
|
|
123
|
+
return [4, sleep(2000)];
|
|
124
|
+
case 1:
|
|
125
|
+
_a.sent();
|
|
126
|
+
return [2];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}); };
|
|
130
|
+
React.useEffect(function () {
|
|
131
|
+
if (responseBody) {
|
|
132
|
+
setIsReady(true);
|
|
133
|
+
}
|
|
134
|
+
}, [responseBody]);
|
|
135
|
+
React.useEffect(function () {
|
|
136
|
+
if (!isReady)
|
|
137
|
+
return;
|
|
138
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
|
|
139
|
+
return function () {
|
|
140
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
141
|
+
};
|
|
142
|
+
}, [isReady]);
|
|
143
|
+
var onRedirect = React.useCallback(function () {
|
|
144
|
+
if (os === 'Android') {
|
|
145
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
146
|
+
}
|
|
147
|
+
if (os === 'iOS') {
|
|
148
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
|
|
149
|
+
}
|
|
150
|
+
}, [responseBody]);
|
|
151
|
+
var onBack = React.useCallback(function () {
|
|
152
|
+
dispatch(handlePrevScreenStep());
|
|
153
|
+
}, []);
|
|
154
|
+
var os = React.useMemo(function () { return mobileOS(); }, []);
|
|
155
|
+
var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
156
|
+
var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
157
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { loop: !error }) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), _jsx(Collapse, __assign({ in: !!error, sx: { width: '100%' } }, { children: _jsx(Warning, { children: t(error) }) })), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
|
|
158
|
+
};
|
|
159
|
+
export default React.memo(VerifyPACI);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
|
|
5
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
6
|
+
import Icon from '../../../../components/Icon';
|
|
7
|
+
var IconStyled = styled(Icon)(function (_a) {
|
|
8
|
+
var theme = _a.theme;
|
|
9
|
+
return ({
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
top: '50%',
|
|
12
|
+
left: '50%',
|
|
13
|
+
transform: 'translate(-50%, -50%)',
|
|
14
|
+
width: 64,
|
|
15
|
+
height: 64
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
var VerifyPACILoading = function (_a) {
|
|
19
|
+
var _b = _a.loop, loop = _b === void 0 ? true : _b;
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, loop: loop, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
|
|
21
|
+
};
|
|
22
|
+
VerifyPACILoading.defaultProps = {};
|
|
23
|
+
export default memo(VerifyPACILoading);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
|
|
4
|
+
var VerifyPACISuccess = function () {
|
|
5
|
+
return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
|
|
6
|
+
};
|
|
7
|
+
VerifyPACISuccess.defaultProps = {};
|
|
8
|
+
export default memo(VerifyPACISuccess);
|
|
@@ -4,4 +4,4 @@ export interface EntityLibProps extends LibConfig {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function EntityLib(props: EntityLibProps): JSX.Element;
|
|
6
6
|
export declare function renderEntityLib(config: EntityLibProps, elementId: string): void;
|
|
7
|
-
export declare function unmountEntityLib(elementId: string): void;
|
|
7
|
+
export declare function unmountEntityLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -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 { ENTITY_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { DIALOG_ID, ENTITY_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { entityFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import CustomFooter from '../shared/Footer';
|
|
25
25
|
import { entitySelector, verifyLeadToken } from '../app/entity/entityStore';
|
|
@@ -27,8 +27,8 @@ import Background from '../shared/Background';
|
|
|
27
27
|
var Entity = memo(function (props) {
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
|
-
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error,
|
|
31
|
-
var _b = useAppSelector(entitySelector), customLoading = _b.customLoading, entityError = _b.error;
|
|
30
|
+
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
+
var _b = useAppSelector(entitySelector), customLoading = _b.customLoading, entityError = _b.error, loading = _b.loading;
|
|
32
32
|
useAppConfig(__assign({ navigation: ENTITY_SCREENS_NAVIGATION }, props));
|
|
33
33
|
useErrorListener(entityError || error);
|
|
34
34
|
useStepStartedListener();
|
|
@@ -43,10 +43,10 @@ var Entity = memo(function (props) {
|
|
|
43
43
|
dispatch(verifyLeadToken(token));
|
|
44
44
|
};
|
|
45
45
|
useEffect(function () {
|
|
46
|
-
if (!
|
|
46
|
+
if (!settingLoading)
|
|
47
47
|
verifyToken();
|
|
48
|
-
}, [
|
|
49
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading:
|
|
48
|
+
}, [settingLoading]);
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: entityFeatureScreens.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 EntityLib(props) {
|
|
|
58
58
|
export function renderEntityLib(config, elementId) {
|
|
59
59
|
reactElement(elementId).render(_jsx(EntityLib, __assign({}, config)));
|
|
60
60
|
}
|
|
61
|
-
export function unmountEntityLib(elementId) {
|
|
62
|
-
|
|
61
|
+
export function unmountEntityLib(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
|
+
elementId && reactElement(elementId).unmount();
|
|
69
|
+
}, unmountTimeout);
|
|
63
70
|
}
|
|
@@ -17,10 +17,11 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
17
17
|
hide?: boolean | undefined;
|
|
18
18
|
warningType?: "alert" | "error" | "hint" | undefined;
|
|
19
19
|
} & {} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
20
|
+
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
20
21
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
22
|
children?: React.ReactNode;
|
|
22
23
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
23
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
24
|
+
color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
|
|
24
25
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
25
26
|
htmlColor?: string | undefined;
|
|
26
27
|
inheritViewBox?: boolean | undefined;
|
|
@@ -58,6 +58,10 @@ export var InputStyled = styled(Input)(function (_a) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
export var MandatoryStyled = styled('span')(function (_a) {
|
|
62
|
+
var theme = _a.theme;
|
|
63
|
+
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
64
|
+
});
|
|
61
65
|
var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
62
66
|
height: 'fit-content'
|
|
63
67
|
}); });
|
|
@@ -74,21 +78,22 @@ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { r
|
|
|
74
78
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
75
79
|
});
|
|
76
80
|
var ActivitiesList = function (_a) {
|
|
77
|
-
var _b
|
|
81
|
+
var _b;
|
|
78
82
|
var rest = __rest(_a, []);
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
83
|
+
var _c = React.useState([]), activitiesMenuList = _c[0], setActivitiesMenuList = _c[1];
|
|
84
|
+
var _d = React.useState([]), storedActivities = _d[0], setStoredActivities = _d[1];
|
|
85
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
82
86
|
var t = useTranslation().t;
|
|
83
87
|
var isAr = useLanguage().isAr;
|
|
84
|
-
var
|
|
88
|
+
var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
|
|
85
89
|
var data = useAppSelector(entitySelector).data;
|
|
86
90
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
87
91
|
var controlValue = activitiesControl.field.value;
|
|
88
92
|
var verify = data.verify, entityData = data.entityData;
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
93
|
+
var _g = entityData.responseBody || {}, activities = _g.activities, selectedActivities = _g.selectedActivities;
|
|
94
|
+
var entity = (verify.responseBody || {}).entity;
|
|
95
|
+
var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
|
|
96
|
+
var businessType = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
|
|
92
97
|
var isCR = businessType === BusinessType.CR;
|
|
93
98
|
React.useEffect(function () {
|
|
94
99
|
if ((activities === null || activities === void 0 ? void 0 : activities.length) > 0) {
|
|
@@ -98,8 +103,11 @@ var ActivitiesList = function (_a) {
|
|
|
98
103
|
React.useEffect(function () {
|
|
99
104
|
if ((selectedActivities === null || selectedActivities === void 0 ? void 0 : selectedActivities.length) > 0) {
|
|
100
105
|
setStoredActivities(selectedActivities);
|
|
106
|
+
if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) === 0) {
|
|
107
|
+
setValue('activities', selectedActivities);
|
|
108
|
+
}
|
|
101
109
|
}
|
|
102
|
-
}, []);
|
|
110
|
+
}, [selectedActivities]);
|
|
103
111
|
var onOpenList = function (event) {
|
|
104
112
|
var _a;
|
|
105
113
|
setAnchorEl(event.currentTarget);
|
|
@@ -111,10 +119,10 @@ var ActivitiesList = function (_a) {
|
|
|
111
119
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
112
120
|
};
|
|
113
121
|
var onSelectItem = function (item) {
|
|
114
|
-
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
115
|
-
var storedActivity = storedActivities === null || storedActivities === void 0 ? void 0 : storedActivities.find(function (activity) { return activity.
|
|
122
|
+
var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === (item === null || item === void 0 ? void 0 : item.id); });
|
|
123
|
+
var storedActivity = storedActivities === null || storedActivities === void 0 ? void 0 : storedActivities.find(function (activity) { return activity.id === (item === null || item === void 0 ? void 0 : item.id); });
|
|
116
124
|
if (isActivityExists && !storedActivity) {
|
|
117
|
-
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.
|
|
125
|
+
var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.id !== (item === null || item === void 0 ? void 0 : item.id); });
|
|
118
126
|
if (updatedIdList.length >= 1)
|
|
119
127
|
activitiesControl.field.onChange(updatedIdList);
|
|
120
128
|
return;
|
|
@@ -127,13 +135,15 @@ var ActivitiesList = function (_a) {
|
|
|
127
135
|
if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > 1) {
|
|
128
136
|
return (controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) + ' ' + t('activities_selected');
|
|
129
137
|
}
|
|
130
|
-
|
|
138
|
+
var item = controlValue[0];
|
|
139
|
+
return isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en;
|
|
131
140
|
};
|
|
132
141
|
var getSelectedActivityFlag = function (item) {
|
|
133
|
-
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.
|
|
142
|
+
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return (activity === null || activity === void 0 ? void 0 : activity.id) === (item === null || item === void 0 ? void 0 : item.id); });
|
|
134
143
|
};
|
|
135
144
|
return (_jsx(Collapse, __assign({ in: (activitiesMenuList === null || activitiesMenuList === void 0 ? void 0 : activitiesMenuList.length) > 0 }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t(isCR ? 'activities' : 'category') }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
136
|
-
|
|
145
|
+
var _a;
|
|
146
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? item === null || item === void 0 ? void 0 : item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
|
|
137
147
|
} }) }))] })] }) })));
|
|
138
148
|
};
|
|
139
149
|
export default ActivitiesList;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
7
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
|
+
import { entitySelector, uploadArticle } from '../../../app/entity/entityStore';
|
|
9
|
+
import UploadFile from '../../../shared/UploadFile';
|
|
10
|
+
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
11
|
+
import { maskFileName } from '../../../../utils';
|
|
12
|
+
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
13
|
+
var theme = _a.theme;
|
|
14
|
+
return ({
|
|
15
|
+
marginBlockStart: theme.spacing(3)
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
var Article = function () {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
21
|
+
var t = useTranslation().t;
|
|
22
|
+
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
|
|
23
|
+
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
24
|
+
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
25
|
+
var _e = useAppSelector(entitySelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error, data = _e.data;
|
|
26
|
+
var dispatch = useAppDispatch();
|
|
27
|
+
var articleValue = articleFileControl.field.value;
|
|
28
|
+
var error = ((_a = articleFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = articleIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
29
|
+
var entityData = data.entityData;
|
|
30
|
+
var articleFile = entityData.articleFile, articleId = entityData.articleId;
|
|
31
|
+
React.useEffect(function () {
|
|
32
|
+
if (!articleValue) {
|
|
33
|
+
setValue('articleFile', articleFile);
|
|
34
|
+
setValue('articleId', articleId);
|
|
35
|
+
}
|
|
36
|
+
}, [articleFile, articleId]);
|
|
37
|
+
var handleArticleChange = function (file) {
|
|
38
|
+
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
39
|
+
setError('articleFile', { message: 'file_not_supported_alert' });
|
|
40
|
+
}
|
|
41
|
+
else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
42
|
+
setError('articleFile', { message: 'file_size_alert' });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
articleFileControl.field.onChange(file);
|
|
46
|
+
dispatch(uploadArticle({
|
|
47
|
+
file: file,
|
|
48
|
+
onProgress: function (value) {
|
|
49
|
+
setProgress(value);
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var handleReset = function () {
|
|
55
|
+
articleFileControl.field.onChange(null);
|
|
56
|
+
articleIdControl.field.onChange('');
|
|
57
|
+
setProgress(0);
|
|
58
|
+
};
|
|
59
|
+
React.useEffect(function () {
|
|
60
|
+
if (sysError === 'file_upload_error') {
|
|
61
|
+
setError('articleId', { message: sysError });
|
|
62
|
+
articleFileControl.field.onChange(null);
|
|
63
|
+
setProgress(0);
|
|
64
|
+
}
|
|
65
|
+
}, [sysError]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
|
|
68
|
+
clearErrors();
|
|
69
|
+
}, [articleFileControl.formState.isValid, articleValue]);
|
|
70
|
+
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
71
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploading && !!articleValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error), initialFileName: fileName }) }));
|
|
72
|
+
};
|
|
73
|
+
export default Article;
|
|
@@ -9,14 +9,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
25
|
import LicenseName from './LicenseName';
|
|
15
26
|
import * as React from 'react';
|
|
16
27
|
import LicenseNumber from './LicenseNumber';
|
|
17
28
|
import ActivitiesList from './ActivitiesList';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { entitySelector,
|
|
29
|
+
import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
|
|
30
|
+
import { entitySelector, updateEntity } from '../../../app/entity/entityStore';
|
|
20
31
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
21
32
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
22
33
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
@@ -27,30 +38,38 @@ import Collapse from '../../../../components/Collapse';
|
|
|
27
38
|
import Button from '../../../shared/Button';
|
|
28
39
|
import { useTranslation } from 'react-i18next';
|
|
29
40
|
import OperationStartDate from './OperationStartDate';
|
|
41
|
+
import Article from './Article';
|
|
30
42
|
var FormStyled = styled(Form)(function () { return ({
|
|
31
43
|
display: 'flex',
|
|
32
44
|
flexDirection: 'column'
|
|
33
45
|
}); });
|
|
34
46
|
var EntityInfo = function (_a) {
|
|
35
47
|
var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
36
|
-
var _c =
|
|
48
|
+
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
49
|
+
var _d = useAppSelector(entitySelector), data = _d.data, loading = _d.loading, error = _d.error, uploading = _d.uploading;
|
|
37
50
|
var isAr = useLanguage().isAr;
|
|
38
51
|
var t = useTranslation().t;
|
|
39
52
|
var dispatch = useAppDispatch();
|
|
53
|
+
var _e = data.entityData, responseBody = _e.responseBody, defaultValues = __rest(_e, ["responseBody"]);
|
|
40
54
|
var methods = useForm({
|
|
41
55
|
resolver: yupResolver(EntityInfoValidationSchema),
|
|
42
|
-
defaultValues:
|
|
56
|
+
defaultValues: defaultValues,
|
|
43
57
|
mode: 'onChange'
|
|
44
58
|
});
|
|
59
|
+
useSetFromDefaultValues(methods, defaultValues);
|
|
45
60
|
var onSubmit = function (data) {
|
|
46
|
-
dispatch(
|
|
61
|
+
dispatch(updateEntity(__assign({}, data)));
|
|
62
|
+
};
|
|
63
|
+
var handleCollapseOpenClose = function (flag) {
|
|
64
|
+
setCollapse(flag);
|
|
47
65
|
};
|
|
48
66
|
var onBack = function () {
|
|
49
|
-
dispatch(handlePrevScreenStep());
|
|
67
|
+
dispatch(handlePrevScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
50
68
|
};
|
|
51
69
|
var handleMenuClick = function () {
|
|
52
70
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
53
71
|
};
|
|
54
|
-
|
|
72
|
+
var disabled = !methods.formState.isValid || !!error || uploading;
|
|
73
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse && !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, {})] })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Article, {}) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
55
74
|
};
|
|
56
75
|
export default EntityInfo;
|
|
@@ -2,16 +2,31 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
5
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
5
6
|
import Input from '../../../shared/Input';
|
|
6
7
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
8
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
7
9
|
import { entitySelector } from '../../../app/entity/entityStore';
|
|
8
10
|
var LicenseName = function (_a) {
|
|
9
|
-
var _b, _c
|
|
11
|
+
var _b, _c;
|
|
10
12
|
var t = useTranslation().t;
|
|
11
|
-
var isAr = useLanguage()
|
|
13
|
+
var isAr = useLanguage();
|
|
14
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
12
15
|
var data = useAppSelector(entitySelector).data;
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
+
var verify = data.verify;
|
|
17
|
+
var legalName = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.legal_name;
|
|
18
|
+
var name = isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en;
|
|
19
|
+
var licenseNameControl = useController({ control: control, name: 'licenseName' });
|
|
20
|
+
var licenseNameValue = licenseNameControl.field.value;
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
if (name && !licenseNameValue)
|
|
23
|
+
setValue('licenseName', name, { shouldValidate: true });
|
|
24
|
+
}, [name]);
|
|
25
|
+
var handleChange = function (_a) {
|
|
26
|
+
var target = _a.target;
|
|
27
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
28
|
+
licenseNameControl.field.onChange(value);
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(ScreenContainer, { children: _jsx(Input, { onChange: handleChange, value: licenseNameValue, label: t('license_name_label'), placeholder: t('license_name_label'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) }));
|
|
16
31
|
};
|
|
17
32
|
export default React.memo(LicenseName);
|
|
@@ -12,17 +12,38 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
17
|
import Input from '../../../shared/Input';
|
|
17
|
-
import Collapse from '../../../../components/Collapse';
|
|
18
18
|
import { useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { entitySelector } from '../../../app/entity/entityStore';
|
|
20
|
+
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
21
|
+
import { BusinessType } from '../../../../@types';
|
|
22
|
+
import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
|
|
20
23
|
var LicenseNumber = function (_a) {
|
|
21
24
|
var _b, _c;
|
|
22
25
|
var t = useTranslation().t;
|
|
23
26
|
var data = useAppSelector(entitySelector).data;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
28
|
+
var entity = (data.verify.responseBody || {}).entity;
|
|
29
|
+
var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
|
|
30
|
+
var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
|
|
31
|
+
var isLicensedTrue = entity === null || entity === void 0 ? void 0 : entity.is_licensed;
|
|
32
|
+
var hasLicenseNumber = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
|
|
33
|
+
var licenseNumber = data.entityData.licenseNumber;
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
setValue('licenseNumber', licenseNumber, { shouldValidate: true });
|
|
36
|
+
}, [licenseNumber]);
|
|
37
|
+
var handleChange = function (_a) {
|
|
38
|
+
var target = _a.target;
|
|
39
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
40
|
+
licenseNumberControl.field.onChange(value);
|
|
41
|
+
};
|
|
42
|
+
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|
|
43
|
+
var licenseNumberValue = licenseNumberControl.field.value;
|
|
44
|
+
var isCR = type === BusinessType.CR;
|
|
45
|
+
var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
|
|
46
|
+
var disabled = hasLicenseNumber && isLicensedTrue;
|
|
47
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), onChange: handleChange, disabled: disabled, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) })));
|
|
27
48
|
};
|
|
28
49
|
export default React.memo(LicenseNumber);
|