@tap-payments/auth-jsconnect 2.0.43-test → 2.0.44
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 +21 -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 +9 -2
- package/build/app/settings.js +22 -11
- package/build/app/store.d.ts +0 -2
- 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 +5 -3
- 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 +5 -5
- package/build/constants/app.js +62 -32
- 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 +182 -20
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +88 -41
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +445 -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 +40 -8
- package/build/features/app/entity/entityStore.js +389 -149
- package/build/features/app/individual/individualStore.d.ts +18 -0
- package/build/features/app/individual/individualStore.js +178 -85
- package/build/features/app/password/passwordStore.d.ts +1 -7
- package/build/features/app/password/passwordStore.js +31 -20
- package/build/features/app/tax/taxStore.js +23 -16
- package/build/features/auth/Auth.d.ts +2 -1
- package/build/features/auth/Auth.js +37 -9
- 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 +4 -4
- 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/Success/Success.js +7 -3
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/business/Business.js +4 -4
- 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 +26 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +78 -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 +1 -0
- package/build/features/connect/Connect.js +38 -10
- 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 +48 -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.js +6 -6
- package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
- package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
- package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
- package/build/features/entity/screens/Customers/Customers.js +90 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
- package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
- package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
- package/build/features/entity/screens/Customers/index.d.ts +3 -0
- package/build/features/entity/screens/Customers/index.js +2 -0
- package/build/features/entity/screens/Customers/validation.d.ts +20 -0
- package/build/features/entity/screens/Customers/validation.js +13 -0
- 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 +38 -10
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
- package/build/features/entity/screens/Success/Success.js +7 -3
- 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 +30 -7
- package/build/features/individual/Individual.js +4 -4
- 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/Success/Success.js +7 -3
- 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.js +4 -4
- 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/Success/Success.js +7 -3
- 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 +2 -5
- package/build/features/shared/Background/Background.js +7 -3
- 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 +3 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
- package/build/features/shared/UploadFile/UploadFile.js +24 -9
- package/build/features/signIn/SignIn.js +4 -4
- 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.js +6 -6
- package/build/features/tax/screens/Success/Success.js +9 -3
- 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 +2 -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/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/string.d.ts +13 -0
- 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 +4 -3
- 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
|
@@ -1,142 +1,32 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare
|
|
3
|
-
NEW_USER = "NEW_USER",
|
|
4
|
-
EXISTING_USER_WITH_EXIST_BRAND = "EXISTING_USER_WITH_EXIST_BRAND",
|
|
5
|
-
EXISTING_USER_WITH_OTHER_BRAND = "EXISTING_USER_WITH_OTHER_BRAND"
|
|
6
|
-
}
|
|
7
|
-
export declare const MerchantValidationSchema: (userType: ValidationOptions) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
8
|
-
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
9
|
-
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
2
|
+
export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
3
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
|
-
id: yup.
|
|
12
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
4
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
5
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
|
-
id: yup.
|
|
16
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
6
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
7
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
19
|
-
id: yup.
|
|
20
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
9
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
23
|
-
id: yup.
|
|
24
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
11
|
}>>[] | undefined>;
|
|
27
|
-
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
30
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
31
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
32
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
33
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
34
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
35
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
36
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
37
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
38
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
39
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
40
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
41
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
42
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
43
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
44
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
45
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
46
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
47
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
48
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
49
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
50
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
51
|
-
}>>>;
|
|
52
12
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
53
|
-
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
54
|
-
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
55
13
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
56
|
-
id: yup.
|
|
57
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
59
15
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
60
|
-
id: yup.
|
|
61
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
62
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
16
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
63
17
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
64
|
-
id: yup.
|
|
65
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
66
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
67
19
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
68
|
-
id: yup.
|
|
69
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
71
21
|
}>>[] | undefined>;
|
|
72
|
-
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
73
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
74
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
75
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
76
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
77
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
78
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
79
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
80
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
81
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
82
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
83
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
84
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
85
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
86
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
87
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
88
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
89
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
90
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
91
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
92
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
93
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
94
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
95
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
96
|
-
}>>>;
|
|
97
22
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
98
|
-
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
99
|
-
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
100
23
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
101
|
-
id: yup.
|
|
102
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
103
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
104
25
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
105
|
-
id: yup.
|
|
106
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
107
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
108
27
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
109
|
-
id: yup.
|
|
110
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
111
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
112
29
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
113
|
-
id: yup.
|
|
114
|
-
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
115
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
30
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
116
31
|
}>>[] | undefined>;
|
|
117
|
-
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
118
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
119
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
120
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
121
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
122
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
123
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
124
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
125
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
126
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
127
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
128
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
129
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
130
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
131
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
132
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
133
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
134
|
-
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
135
|
-
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
136
|
-
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
137
|
-
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
138
|
-
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
139
|
-
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
140
|
-
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
141
|
-
}>>>;
|
|
142
32
|
}>>>;
|
|
@@ -1,197 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { REGEX_WEBSITE, REGEX_BRAND_NAME, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_PHONE_APP_NAME } from '../../../../constants';
|
|
2
11
|
import * as yup from 'yup';
|
|
3
|
-
|
|
4
|
-
(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
var validationSalesChannels = function (channels) {
|
|
13
|
+
if (channels === void 0) { channels = []; }
|
|
14
|
+
var dic = {};
|
|
15
|
+
var typeDic = {};
|
|
16
|
+
channels.forEach(function (channel) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
19
|
+
var key_1 = (_b = channel.code) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
20
|
+
if (key_1)
|
|
21
|
+
dic[key_1] = [];
|
|
22
|
+
channel.sub.forEach(function (sub) {
|
|
23
|
+
dic[key_1].push(sub.address || '');
|
|
24
|
+
typeDic[sub.code] = sub.address || '';
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
var key = (_c = channel.code) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
29
|
+
if (key)
|
|
30
|
+
dic[key] = [channel.address || ''];
|
|
31
|
+
typeDic[key] = channel.address || '';
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
for (var key in dic) {
|
|
35
|
+
var values = dic[key];
|
|
36
|
+
var atLestOne = values.every(function (item) { return item === ''; });
|
|
37
|
+
if (atLestOne)
|
|
38
|
+
return "enter_at_least_one_".concat(key);
|
|
39
|
+
}
|
|
40
|
+
console.log('dic', dic);
|
|
41
|
+
console.log('typeDic', typeDic);
|
|
42
|
+
for (var key in typeDic) {
|
|
43
|
+
var value = typeDic[key];
|
|
44
|
+
if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
|
|
45
|
+
return 'invalid_url';
|
|
46
|
+
}
|
|
47
|
+
if (key === 'linkedin' && value && !value.match(LINKEDIN_URL)) {
|
|
48
|
+
return 'invalid_linkedin_profile_url';
|
|
49
|
+
}
|
|
50
|
+
if (key === 'facebook' && value && !value.match(SOCIAL_USERNAME)) {
|
|
51
|
+
return 'invalid_facebook_username';
|
|
52
|
+
}
|
|
53
|
+
if (key === 'instagram' && value && !value.match(SOCIAL_USERNAME)) {
|
|
54
|
+
return 'invalid_instagram_username';
|
|
55
|
+
}
|
|
56
|
+
if (key === 'twitter' && value && !value.match(SOCIAL_USERNAME)) {
|
|
57
|
+
return 'invalid_twitter_username';
|
|
58
|
+
}
|
|
59
|
+
if (key === 'physical_store' && value && value.length < 3) {
|
|
60
|
+
return 'invalid_physical_store_location';
|
|
61
|
+
}
|
|
62
|
+
if (key === 'ios' && value && !value.match(REGEX_PHONE_APP_NAME)) {
|
|
63
|
+
return 'invalid_ios_app';
|
|
64
|
+
}
|
|
65
|
+
if (key === 'android' && value && !value.match(REGEX_PHONE_APP_NAME)) {
|
|
66
|
+
return 'invalid_android_app';
|
|
67
|
+
}
|
|
68
|
+
if (key === 'call_center' && value && !value.match(DIGITS_ONLY)) {
|
|
69
|
+
return 'invalid_call_center_number';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
};
|
|
74
|
+
export var MerchantValidationSchema = function (isNewBrand) {
|
|
75
|
+
if (isNewBrand === void 0) { isNewBrand = true; }
|
|
76
|
+
if (isNewBrand)
|
|
12
77
|
return yup.object().shape({
|
|
13
78
|
brandName: yup
|
|
14
79
|
.string()
|
|
15
80
|
.test({
|
|
16
81
|
test: function (value) {
|
|
17
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
18
82
|
if (length === 0)
|
|
19
83
|
return true;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
84
|
+
if (length < 3 || !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
|
|
85
|
+
return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
|
|
86
|
+
return true;
|
|
23
87
|
}
|
|
24
88
|
})
|
|
25
|
-
.required(''),
|
|
26
|
-
termAndConditionChecked: yup.boolean().
|
|
89
|
+
.required('enter_brand_name_english_chars_numbers_space'),
|
|
90
|
+
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
27
91
|
salesChannels: yup
|
|
28
92
|
.array()
|
|
29
93
|
.min(1, 'choose_atleast_one_channel')
|
|
30
94
|
.of(yup.object().shape({
|
|
31
|
-
id: yup.string()
|
|
32
|
-
name_en: yup.string(),
|
|
33
|
-
name_ar: yup.string()
|
|
95
|
+
id: yup.string().required('choose_atleast_one_channel')
|
|
34
96
|
}))
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.string()
|
|
49
|
-
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
50
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
51
|
-
.nullable()
|
|
52
|
-
.optional();
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
instagram: yup
|
|
56
|
-
.string()
|
|
57
|
-
.nullable()
|
|
58
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
59
|
-
.when(['twitter', 'website'], function (twitter, website) {
|
|
60
|
-
if (!website && !twitter) {
|
|
61
|
-
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return yup.string().optional();
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
twitter: yup
|
|
68
|
-
.string()
|
|
69
|
-
.nullable()
|
|
70
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
71
|
-
.min(2, 'enter_at_least_one')
|
|
72
|
-
.when(['website', 'instagram'], function (website, instagram) {
|
|
73
|
-
if (!website && !instagram) {
|
|
74
|
-
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return yup.string().optional();
|
|
78
|
-
}
|
|
79
|
-
}),
|
|
80
|
-
apple_store: yup
|
|
81
|
-
.string()
|
|
82
|
-
.nullable()
|
|
83
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
84
|
-
.min(2, 'enter_at_least_one')
|
|
85
|
-
.optional(),
|
|
86
|
-
play_store: yup
|
|
87
|
-
.string()
|
|
88
|
-
.nullable()
|
|
89
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
90
|
-
.min(2, 'enter_at_least_one')
|
|
91
|
-
.optional(),
|
|
92
|
-
call_center: yup
|
|
93
|
-
.string()
|
|
94
|
-
.nullable()
|
|
95
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
96
|
-
.min(2, 'enter_at_least_one')
|
|
97
|
-
.optional(),
|
|
98
|
-
physical_store: yup
|
|
99
|
-
.string()
|
|
100
|
-
.nullable()
|
|
101
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
102
|
-
.min(2, 'enter_at_least_one')
|
|
103
|
-
.optional()
|
|
104
|
-
}, [
|
|
105
|
-
['instagram', 'website'],
|
|
106
|
-
['twitter', 'website'],
|
|
107
|
-
['instagram', 'twitter']
|
|
108
|
-
])
|
|
97
|
+
.test({
|
|
98
|
+
test: function (value) {
|
|
99
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
100
|
+
if (length === 0)
|
|
101
|
+
return true;
|
|
102
|
+
var channels = __spreadArray([], (value || []), true);
|
|
103
|
+
var result = validationSalesChannels(channels);
|
|
104
|
+
if (result === true)
|
|
105
|
+
return true;
|
|
106
|
+
return this.createError({ message: result });
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
.required('choose_atleast_one_channel')
|
|
109
110
|
});
|
|
110
|
-
}
|
|
111
111
|
return yup.object().shape({
|
|
112
|
-
brandName: yup.string().optional(),
|
|
113
|
-
termAndConditionChecked: yup.boolean().optional(),
|
|
114
112
|
salesChannels: yup
|
|
115
113
|
.array()
|
|
116
114
|
.min(1, 'choose_atleast_one_channel')
|
|
117
115
|
.of(yup.object().shape({
|
|
118
|
-
id: yup.string()
|
|
119
|
-
name_en: yup.string(),
|
|
120
|
-
name_ar: yup.string()
|
|
116
|
+
id: yup.string().required('choose_atleast_one_channel')
|
|
121
117
|
}))
|
|
122
|
-
.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.string()
|
|
136
|
-
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
137
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
138
|
-
.nullable()
|
|
139
|
-
.optional();
|
|
140
|
-
}
|
|
141
|
-
}),
|
|
142
|
-
instagram: yup
|
|
143
|
-
.string()
|
|
144
|
-
.nullable()
|
|
145
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
146
|
-
.when(['twitter', 'website'], function (twitter, website) {
|
|
147
|
-
if (!website && !twitter) {
|
|
148
|
-
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
return yup.string().optional();
|
|
152
|
-
}
|
|
153
|
-
}),
|
|
154
|
-
twitter: yup
|
|
155
|
-
.string()
|
|
156
|
-
.nullable()
|
|
157
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
158
|
-
.min(2, 'enter_at_least_one')
|
|
159
|
-
.when(['website', 'instagram'], function (website, instagram) {
|
|
160
|
-
if (!website && !instagram) {
|
|
161
|
-
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
return yup.string().optional();
|
|
165
|
-
}
|
|
166
|
-
}),
|
|
167
|
-
apple_store: yup
|
|
168
|
-
.string()
|
|
169
|
-
.nullable()
|
|
170
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
171
|
-
.min(2, 'enter_at_least_one')
|
|
172
|
-
.optional(),
|
|
173
|
-
play_store: yup
|
|
174
|
-
.string()
|
|
175
|
-
.nullable()
|
|
176
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
177
|
-
.min(2, 'enter_at_least_one')
|
|
178
|
-
.optional(),
|
|
179
|
-
call_center: yup
|
|
180
|
-
.string()
|
|
181
|
-
.nullable()
|
|
182
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
183
|
-
.min(2, 'enter_at_least_one')
|
|
184
|
-
.optional(),
|
|
185
|
-
physical_store: yup
|
|
186
|
-
.string()
|
|
187
|
-
.nullable()
|
|
188
|
-
.transform(function (value) { return (!!value ? value : null); })
|
|
189
|
-
.min(2, 'enter_at_least_one')
|
|
190
|
-
.optional()
|
|
191
|
-
}, [
|
|
192
|
-
['instagram', 'website'],
|
|
193
|
-
['twitter', 'website'],
|
|
194
|
-
['instagram', 'twitter']
|
|
195
|
-
])
|
|
118
|
+
.test({
|
|
119
|
+
test: function (value) {
|
|
120
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
121
|
+
if (length === 0)
|
|
122
|
+
return true;
|
|
123
|
+
var channels = __spreadArray([], (value || []), true);
|
|
124
|
+
var result = validationSalesChannels(channels);
|
|
125
|
+
if (result === true)
|
|
126
|
+
return true;
|
|
127
|
+
return this.createError({ message: result });
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
.required('choose_atleast_one_channel')
|
|
196
131
|
});
|
|
197
132
|
};
|
|
@@ -9,6 +9,17 @@ 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 * as React from 'react';
|
|
14
25
|
import Box from '@mui/material/Box';
|
|
@@ -18,17 +29,19 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
29
|
import { styled, alpha } from '@mui/material/styles';
|
|
19
30
|
import Collapse from '../../../../components/Collapse';
|
|
20
31
|
import Form from '../../../../components/Form';
|
|
21
|
-
import Button, { AbsherButton } from '../../../shared/Button';
|
|
22
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
32
|
+
import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
|
|
33
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
23
34
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
35
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
|
-
import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
|
|
36
|
+
import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
|
|
26
37
|
import { useLanguage } from '../../../../hooks';
|
|
27
38
|
import Divider from '@mui/material/Divider';
|
|
39
|
+
import { isKW } from '../../../../utils';
|
|
28
40
|
import Text from '../../../../components/Text';
|
|
29
41
|
import MIDTitle from './Title';
|
|
30
42
|
import MobileNumber from './MobileNumber';
|
|
31
43
|
import { PhoneValidationSchema } from './validation';
|
|
44
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
32
45
|
var FormStyled = styled(Form)(function () { return ({
|
|
33
46
|
display: 'flex',
|
|
34
47
|
flexDirection: 'column'
|
|
@@ -72,41 +85,49 @@ var ListType;
|
|
|
72
85
|
ListType["CountryCodeList"] = "CountryCodeList";
|
|
73
86
|
})(ListType || (ListType = {}));
|
|
74
87
|
var Mobile = function (_a) {
|
|
88
|
+
var _b;
|
|
75
89
|
var settingsStore = useAppSelector(settingsSelector);
|
|
76
|
-
var
|
|
77
|
-
var
|
|
90
|
+
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
91
|
+
var _d = React.useState(), listType = _d[0], setListType = _d[1];
|
|
92
|
+
var _e = data.mobileData, countryCode = _e.countryCode, mobile = _e.mobile;
|
|
78
93
|
var dispatch = useAppDispatch();
|
|
94
|
+
var _f = data.mobileData, responseBody = _f.responseBody, defaultValues = __rest(_f, ["responseBody"]);
|
|
79
95
|
var methods = useForm({
|
|
80
96
|
resolver: yupResolver(PhoneValidationSchema),
|
|
81
|
-
defaultValues:
|
|
97
|
+
defaultValues: defaultValues,
|
|
82
98
|
mode: 'onChange'
|
|
83
99
|
});
|
|
100
|
+
useSetFromDefaultValues(methods, defaultValues);
|
|
84
101
|
var t = useTranslation().t;
|
|
85
102
|
var isAr = useLanguage().isAr;
|
|
86
103
|
var handleMenuListClick = function (flag) {
|
|
87
104
|
setListType(flag);
|
|
88
105
|
};
|
|
89
106
|
React.useEffect(function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}, [data.mobileData]);
|
|
107
|
+
dispatch(resetOTPScreen());
|
|
108
|
+
}, []);
|
|
94
109
|
React.useEffect(function () {
|
|
95
110
|
if (error)
|
|
96
111
|
dispatch(clearError());
|
|
97
112
|
}, [methods.formState.isValid]);
|
|
98
113
|
var onSubmit = function (formData) {
|
|
99
114
|
dispatch(createMobileAuth(formData));
|
|
115
|
+
dispatch(resetNIDScreen());
|
|
116
|
+
dispatch(resetCivilScreen());
|
|
100
117
|
};
|
|
118
|
+
var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
|
|
101
119
|
var onBack = function () {
|
|
102
|
-
dispatch(handlePrevScreenStep());
|
|
120
|
+
dispatch(handlePrevScreenStep(isKWCountry ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP'));
|
|
103
121
|
};
|
|
122
|
+
React.useEffect(function () {
|
|
123
|
+
dispatch(resetStore());
|
|
124
|
+
}, []);
|
|
104
125
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
105
126
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
106
127
|
var listActive = isBusinessListActive || isCountryListActive;
|
|
107
128
|
var disabled = !methods.formState.isValid || !!error;
|
|
108
129
|
var title = t('join_our_community');
|
|
109
130
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: 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(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] }))] })) }))] }));
|
|
131
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: 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, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
|
|
111
132
|
};
|
|
112
133
|
export default React.memo(Mobile);
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { NIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
|
|
21
|
+
import { clearError, connectSelector, createNIDAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -73,6 +73,7 @@ var NID = function (_a) {
|
|
|
73
73
|
}, [methods.formState.isValid]);
|
|
74
74
|
var onSubmit = function (data) {
|
|
75
75
|
dispatch(createNIDAuth(data));
|
|
76
|
+
dispatch(resetMobileScreen(settingsStore.data.businessCountry));
|
|
76
77
|
};
|
|
77
78
|
var handleCollapseOpenClose = function (flag) {
|
|
78
79
|
setCollapse(flag);
|
|
@@ -84,6 +85,9 @@ var NID = function (_a) {
|
|
|
84
85
|
var onBack = function () {
|
|
85
86
|
dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
|
|
86
87
|
};
|
|
88
|
+
React.useEffect(function () {
|
|
89
|
+
dispatch(resetStore());
|
|
90
|
+
}, []);
|
|
87
91
|
var disabled = !methods.formState.isValid || !!error;
|
|
88
92
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_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') }))] }))] }))] })) })) }));
|
|
89
93
|
};
|