@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
|
@@ -48,16 +48,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
|
-
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import {
|
|
53
|
-
import { ENTITY_STEP_NAMES
|
|
51
|
+
import { BusinessType, FlowsTypes } from '../../../@types';
|
|
52
|
+
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
|
+
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import moment from 'moment';
|
|
55
55
|
import { convertNumbers2English } from '../../../utils';
|
|
56
56
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var payload, data, boardInfoData, board_id, board_info_id, info, hasEntityCompleted;
|
|
58
|
-
var _a;
|
|
59
|
-
return __generator(this, function (
|
|
60
|
-
switch (
|
|
57
|
+
var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, activities, data_1, info, hasEntityCompleted;
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
return __generator(this, function (_e) {
|
|
60
|
+
switch (_e.label) {
|
|
61
61
|
case 0:
|
|
62
62
|
payload = {
|
|
63
63
|
service_name: 'tap_email',
|
|
@@ -65,36 +65,71 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
65
65
|
};
|
|
66
66
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
67
67
|
case 1:
|
|
68
|
-
data = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
data = (_e.sent()).data;
|
|
69
|
+
countryIso2 = undefined;
|
|
70
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
|
|
71
|
+
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
72
|
+
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
73
|
+
if (countryIso2)
|
|
74
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
75
|
+
}
|
|
76
|
+
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 9];
|
|
74
77
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
75
78
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
76
|
-
if (!(
|
|
79
|
+
if (!(board_id && board_info_id)) return [3, 3];
|
|
77
80
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
81
|
+
case 2:
|
|
82
|
+
boardInfoData = _e.sent();
|
|
83
|
+
_e.label = 3;
|
|
78
84
|
case 3:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
case 4:
|
|
85
|
+
if (!board_id) return [3, 5];
|
|
86
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
87
|
+
case 4:
|
|
88
|
+
boardData = _e.sent();
|
|
89
|
+
_e.label = 5;
|
|
82
90
|
case 5:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
|
|
92
|
+
if (!entityId) return [3, 8];
|
|
93
|
+
return [4, API.entityService.retrieveEntity(entityId)];
|
|
94
|
+
case 6:
|
|
95
|
+
entityData = _e.sent();
|
|
96
|
+
activities = (entityData || {}).activities;
|
|
97
|
+
if (!!activities) return [3, 8];
|
|
98
|
+
return [4, API.dataService.getActivities()];
|
|
99
|
+
case 7:
|
|
100
|
+
data_1 = _e.sent();
|
|
101
|
+
entityData = __assign(__assign({}, entityData), { entity_activities: data_1.list });
|
|
102
|
+
_e.label = 8;
|
|
103
|
+
case 8:
|
|
104
|
+
if (!countryIso2) {
|
|
105
|
+
countryIso2 = entityData.country;
|
|
106
|
+
if (countryIso2)
|
|
107
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
89
108
|
}
|
|
90
|
-
|
|
109
|
+
info = (boardInfoData || {}).info;
|
|
110
|
+
hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
|
|
111
|
+
if (hasEntityCompleted) {
|
|
91
112
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
92
113
|
}
|
|
93
|
-
else
|
|
114
|
+
else {
|
|
94
115
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
95
116
|
}
|
|
96
|
-
|
|
97
|
-
case
|
|
117
|
+
_e.label = 9;
|
|
118
|
+
case 9: return [2, {
|
|
119
|
+
data: data,
|
|
120
|
+
boardResponse: {
|
|
121
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
122
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
123
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
124
|
+
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
125
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
126
|
+
name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
|
|
127
|
+
contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
|
|
128
|
+
flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
|
|
129
|
+
entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
|
|
130
|
+
},
|
|
131
|
+
token: token
|
|
132
|
+
}];
|
|
98
133
|
}
|
|
99
134
|
});
|
|
100
135
|
}); });
|
|
@@ -116,14 +151,13 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
116
151
|
});
|
|
117
152
|
}); });
|
|
118
153
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
-
var _a, entity, settings, responseBody,
|
|
120
|
-
var _b, _c, _d, _e;
|
|
121
|
-
return __generator(this, function (
|
|
122
|
-
switch (
|
|
154
|
+
var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, activities, data_2, info, hasEntityCompleted;
|
|
155
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
156
|
+
return __generator(this, function (_j) {
|
|
157
|
+
switch (_j.label) {
|
|
123
158
|
case 0:
|
|
124
159
|
_a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
|
|
125
160
|
responseBody = entity.data.verify.responseBody;
|
|
126
|
-
flows = (responseBody || {}).flows;
|
|
127
161
|
payload = {
|
|
128
162
|
data: params.otp,
|
|
129
163
|
service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
|
|
@@ -133,18 +167,61 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
133
167
|
};
|
|
134
168
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
135
169
|
case 1:
|
|
136
|
-
data = (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
170
|
+
data = (_j.sent()).data;
|
|
171
|
+
boardInfoData = undefined;
|
|
172
|
+
if (!!data.errors) return [3, 9];
|
|
173
|
+
board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
|
|
174
|
+
board_info_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.board_info_id;
|
|
175
|
+
if (!(board_id && board_info_id)) return [3, 3];
|
|
176
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
177
|
+
case 2:
|
|
178
|
+
boardInfoData = _j.sent();
|
|
179
|
+
_j.label = 3;
|
|
180
|
+
case 3:
|
|
181
|
+
if (!board_id) return [3, 5];
|
|
182
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
183
|
+
case 4:
|
|
184
|
+
boardData = _j.sent();
|
|
185
|
+
_j.label = 5;
|
|
186
|
+
case 5:
|
|
187
|
+
entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
188
|
+
if (!entityId) return [3, 8];
|
|
189
|
+
return [4, API.entityService.retrieveEntity(entityId)];
|
|
190
|
+
case 6:
|
|
191
|
+
entityData = _j.sent();
|
|
192
|
+
activities = (entityData || {}).activities;
|
|
193
|
+
if (!!activities) return [3, 8];
|
|
194
|
+
return [4, API.dataService.getActivities()];
|
|
195
|
+
case 7:
|
|
196
|
+
data_2 = _j.sent();
|
|
197
|
+
entityData = __assign(__assign({}, entityData), { entity_activities: data_2.list });
|
|
198
|
+
_j.label = 8;
|
|
199
|
+
case 8:
|
|
200
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
201
|
+
info = (boardInfoData || {}).info;
|
|
202
|
+
hasEntityCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
203
|
+
if (hasEntityCompleted) {
|
|
204
|
+
thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
146
208
|
}
|
|
147
|
-
|
|
209
|
+
_j.label = 9;
|
|
210
|
+
case 9: return [2, {
|
|
211
|
+
data: data,
|
|
212
|
+
boardResponse: {
|
|
213
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
214
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
215
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
216
|
+
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
217
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
218
|
+
name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
|
|
219
|
+
contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
|
|
220
|
+
flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info,
|
|
221
|
+
entity_activities: entityData === null || entityData === void 0 ? void 0 : entityData.entity_activities
|
|
222
|
+
},
|
|
223
|
+
formData: params
|
|
224
|
+
}];
|
|
148
225
|
}
|
|
149
226
|
});
|
|
150
227
|
}); });
|
|
@@ -157,37 +234,144 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
157
234
|
case 1:
|
|
158
235
|
data = _c.sent();
|
|
159
236
|
return [2, {
|
|
160
|
-
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.
|
|
237
|
+
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
161
238
|
}];
|
|
162
239
|
}
|
|
163
240
|
});
|
|
164
241
|
}); });
|
|
165
|
-
export var
|
|
166
|
-
var _a, settings, entity, requestBody, data;
|
|
167
|
-
var _b, _c, _d, _e, _f;
|
|
168
|
-
return __generator(this, function (
|
|
169
|
-
switch (
|
|
242
|
+
export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
243
|
+
var _a, settings, entity, id, brandId, articleId, requestBody, brandData, payload, data;
|
|
244
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
245
|
+
return __generator(this, function (_j) {
|
|
246
|
+
switch (_j.label) {
|
|
170
247
|
case 0:
|
|
171
248
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
249
|
+
id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
250
|
+
brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
|
|
251
|
+
articleId = entity.data.entityData.articleId;
|
|
172
252
|
requestBody = {
|
|
173
|
-
id:
|
|
174
|
-
activities: (
|
|
175
|
-
var
|
|
176
|
-
return
|
|
253
|
+
id: brandId,
|
|
254
|
+
activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
|
|
255
|
+
var id = _a.id;
|
|
256
|
+
return ({ id: id });
|
|
177
257
|
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
258
|
+
operations: {
|
|
259
|
+
start_date: params.operationStartDate
|
|
260
|
+
},
|
|
261
|
+
encryption_contract: ['operations.start_date']
|
|
182
262
|
};
|
|
183
|
-
return [4, API.
|
|
263
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
184
264
|
case 1:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
265
|
+
brandData = (_j.sent()).data;
|
|
266
|
+
payload = {
|
|
267
|
+
id: id,
|
|
268
|
+
license: {
|
|
269
|
+
number: params.licenseNumber && params.licenseNumber,
|
|
270
|
+
type: params.licenseType
|
|
271
|
+
},
|
|
272
|
+
legal_name: {
|
|
273
|
+
ar: params.licenseName,
|
|
274
|
+
en: params.licenseName
|
|
275
|
+
},
|
|
276
|
+
AOA_file_id: articleId,
|
|
277
|
+
encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en', 'license.type']
|
|
278
|
+
};
|
|
279
|
+
return [4, API.entityService.updateEntity(payload)];
|
|
280
|
+
case 2:
|
|
281
|
+
data = _j.sent();
|
|
282
|
+
thunkApi.dispatch(retrieveDataList());
|
|
283
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
284
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
|
|
285
|
+
return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}); });
|
|
289
|
+
export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
|
|
290
|
+
var file = _a.file, onProgress = _a.onProgress;
|
|
291
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
292
|
+
var typeArray, type, uploadPayload, onUploadProgress, data;
|
|
293
|
+
var _b;
|
|
294
|
+
return __generator(this, function (_c) {
|
|
295
|
+
switch (_c.label) {
|
|
296
|
+
case 0:
|
|
297
|
+
typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
|
|
298
|
+
type = typeArray[1] || '';
|
|
299
|
+
uploadPayload = {
|
|
300
|
+
file_link_create: true,
|
|
301
|
+
title: file === null || file === void 0 ? void 0 : file.name,
|
|
302
|
+
purpose: 'identity_document',
|
|
303
|
+
type: type,
|
|
304
|
+
file: file
|
|
305
|
+
};
|
|
306
|
+
onUploadProgress = function (progressEvent) {
|
|
307
|
+
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
308
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
309
|
+
};
|
|
310
|
+
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
311
|
+
case 1:
|
|
312
|
+
data = _c.sent();
|
|
313
|
+
return [2, { data: data }];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
export var updateCustomersInfo = createAsyncThunk('entityUpdateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
|
+
var _a, settings, entity, id, customerLocation, customerBase, sales, requestBody, data;
|
|
320
|
+
var _b, _c, _d, _e, _f, _g;
|
|
321
|
+
return __generator(this, function (_h) {
|
|
322
|
+
switch (_h.label) {
|
|
323
|
+
case 0:
|
|
324
|
+
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
325
|
+
id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
|
|
326
|
+
customerLocation = params.customerLocations.map(function (location) { return ({
|
|
327
|
+
id: location === null || location === void 0 ? void 0 : location.id
|
|
328
|
+
}); });
|
|
329
|
+
customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
|
|
330
|
+
sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
|
|
331
|
+
requestBody = {
|
|
332
|
+
operations: {
|
|
333
|
+
customer_base: customerBase,
|
|
334
|
+
sales: sales,
|
|
335
|
+
start_date: entity.data.entityData.operationStartDate
|
|
336
|
+
},
|
|
337
|
+
term: ['refund', 'chargeback'],
|
|
338
|
+
id: id,
|
|
339
|
+
encryption_contract: []
|
|
340
|
+
};
|
|
341
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
342
|
+
case 1:
|
|
343
|
+
data = _h.sent();
|
|
344
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
345
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
|
|
346
|
+
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: params }];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}); });
|
|
350
|
+
export var retrieveDataList = createAsyncThunk('entityRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
351
|
+
var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
|
|
352
|
+
return __generator(this, function (_b) {
|
|
353
|
+
switch (_b.label) {
|
|
354
|
+
case 0:
|
|
355
|
+
settings = thunkApi.getState().settings;
|
|
356
|
+
dataBody = {
|
|
357
|
+
page: 0
|
|
358
|
+
};
|
|
359
|
+
salesDataBody = {
|
|
360
|
+
page: 0,
|
|
361
|
+
country_code: [settings.data.businessCountry.iso2]
|
|
362
|
+
};
|
|
363
|
+
return [4, Promise.all([
|
|
364
|
+
API.dataService.getCustomerBases(dataBody),
|
|
365
|
+
API.dataService.getExpectedSales(salesDataBody),
|
|
366
|
+
API.dataService.getExpectedCustomerSales(dataBody)
|
|
367
|
+
])];
|
|
368
|
+
case 1:
|
|
369
|
+
_a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
|
|
370
|
+
return [2, {
|
|
371
|
+
customerBases: customerBases,
|
|
372
|
+
expectedSales: expectedSales,
|
|
373
|
+
expectedCustomerSales: expectedCustomerSales
|
|
374
|
+
}];
|
|
191
375
|
}
|
|
192
376
|
});
|
|
193
377
|
}); });
|
|
@@ -215,18 +399,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
|
|
|
215
399
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
216
400
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
217
401
|
thunkApi.dispatch(handleNextScreenStep());
|
|
218
|
-
return [2, { response: __assign(__assign({}, data), { flows:
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}); });
|
|
222
|
-
export var retrieveChannels = createAsyncThunk('retrieveChannelsEntity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var data;
|
|
224
|
-
return __generator(this, function (_a) {
|
|
225
|
-
switch (_a.label) {
|
|
226
|
-
case 0: return [4, API.dataService.getChannelsOfServices()];
|
|
227
|
-
case 1:
|
|
228
|
-
data = (_a.sent()).data;
|
|
229
|
-
return [2, data];
|
|
402
|
+
return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
|
|
230
403
|
}
|
|
231
404
|
});
|
|
232
405
|
}); });
|
|
@@ -234,6 +407,7 @@ var initialState = {
|
|
|
234
407
|
error: null,
|
|
235
408
|
loading: false,
|
|
236
409
|
customLoading: false,
|
|
410
|
+
uploading: false,
|
|
237
411
|
data: {
|
|
238
412
|
flowName: FlowsTypes.ENTITY,
|
|
239
413
|
verify: {
|
|
@@ -243,9 +417,19 @@ var initialState = {
|
|
|
243
417
|
otp: ''
|
|
244
418
|
},
|
|
245
419
|
entityData: {
|
|
420
|
+
licenseName: '',
|
|
421
|
+
licenseNumber: '',
|
|
422
|
+
licenseType: BusinessType.CR,
|
|
246
423
|
activities: [],
|
|
247
|
-
|
|
248
|
-
|
|
424
|
+
operationStartDate: '',
|
|
425
|
+
uploading: false
|
|
426
|
+
},
|
|
427
|
+
customersData: {
|
|
428
|
+
customerLocations: [],
|
|
429
|
+
expectedCustomer: undefined,
|
|
430
|
+
expectedSale: undefined,
|
|
431
|
+
refundPolicy: false,
|
|
432
|
+
transactionPolicy: false
|
|
249
433
|
}
|
|
250
434
|
}
|
|
251
435
|
};
|
|
@@ -270,51 +454,40 @@ export var entitySlice = createSlice({
|
|
|
270
454
|
state.customLoading = true;
|
|
271
455
|
})
|
|
272
456
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
273
|
-
var _a, _b, _c;
|
|
457
|
+
var _a, _b, _c, _d, _e;
|
|
274
458
|
state.error = null;
|
|
275
459
|
state.customLoading = false;
|
|
276
|
-
var
|
|
460
|
+
var _f = action.payload, data = _f.data, token = _f.token, boardResponse = _f.boardResponse;
|
|
277
461
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
278
462
|
if (description) {
|
|
279
463
|
state.error = description;
|
|
280
464
|
return;
|
|
281
465
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
|
|
295
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
|
|
296
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
297
|
-
selectedChannels = [websiteData, socialData];
|
|
298
|
-
else if (isHasTwitter || isHasInstagram)
|
|
299
|
-
selectedChannels = [socialData];
|
|
300
|
-
else if (isHasWebsite)
|
|
301
|
-
selectedChannels = [websiteData];
|
|
302
|
-
if (((_c = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
303
|
-
selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
304
|
-
var _a;
|
|
305
|
-
return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
|
|
306
|
-
});
|
|
466
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
467
|
+
state.data.verify.token = token;
|
|
468
|
+
var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
|
|
469
|
+
var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
|
|
470
|
+
var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
471
|
+
var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
|
|
472
|
+
var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
|
|
473
|
+
var issuingDate = undefined;
|
|
474
|
+
if (entityDate) {
|
|
475
|
+
var date = new Date(entityDate);
|
|
476
|
+
var formattedDate = moment(date).format('YYYY-MM-DD');
|
|
477
|
+
issuingDate = convertNumbers2English(formattedDate);
|
|
307
478
|
}
|
|
308
|
-
|
|
309
|
-
|
|
479
|
+
if (licenseNumber)
|
|
480
|
+
state.data.entityData.licenseNumber = licenseNumber;
|
|
481
|
+
if (licenseType)
|
|
482
|
+
state.data.entityData.licenseType = licenseType;
|
|
483
|
+
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
|
|
310
484
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
311
485
|
var _a;
|
|
312
|
-
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) {
|
|
486
|
+
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
|
|
313
487
|
});
|
|
314
|
-
|
|
315
|
-
state.data.entityData.
|
|
316
|
-
state.data.
|
|
317
|
-
state.data.verify.token = token;
|
|
488
|
+
var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
|
|
489
|
+
state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
|
|
490
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities });
|
|
318
491
|
})
|
|
319
492
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
320
493
|
state.error = action.error.message;
|
|
@@ -342,10 +515,10 @@ export var entitySlice = createSlice({
|
|
|
342
515
|
state.error = null;
|
|
343
516
|
})
|
|
344
517
|
.addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
|
|
345
|
-
var _a;
|
|
518
|
+
var _a, _b, _c, _d, _e;
|
|
346
519
|
state.loading = false;
|
|
347
520
|
state.error = null;
|
|
348
|
-
var
|
|
521
|
+
var _f = action.payload, data = _f.data, boardResponse = _f.boardResponse, formData = _f.formData;
|
|
349
522
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
350
523
|
if (description) {
|
|
351
524
|
state.error = description;
|
|
@@ -353,16 +526,39 @@ export var entitySlice = createSlice({
|
|
|
353
526
|
}
|
|
354
527
|
state.data.otpData = formData;
|
|
355
528
|
state.data.otpData.responseBody = data;
|
|
529
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
530
|
+
var _g = boardResponse || {}, brand = _g.brand, entity = _g.entity, entity_activities = _g.entity_activities;
|
|
531
|
+
var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
|
|
532
|
+
var licenseType = (_c = entity === null || entity === void 0 ? void 0 : entity.type) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
533
|
+
var entityDate = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.issuing_date;
|
|
534
|
+
var startDate = (_e = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _e === void 0 ? void 0 : _e.start_date;
|
|
535
|
+
var issuingDate = undefined;
|
|
536
|
+
if (entityDate) {
|
|
537
|
+
var date = new Date(entityDate);
|
|
538
|
+
var formattedDate = moment(date).format('YYYY-MM-DD');
|
|
539
|
+
issuingDate = convertNumbers2English(formattedDate);
|
|
540
|
+
}
|
|
541
|
+
if (licenseNumber)
|
|
542
|
+
state.data.entityData.licenseNumber = licenseNumber;
|
|
543
|
+
if (licenseType)
|
|
544
|
+
state.data.entityData.licenseType = licenseType;
|
|
545
|
+
var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || entity_activities || [];
|
|
546
|
+
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
547
|
+
var _a;
|
|
548
|
+
return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
|
|
549
|
+
});
|
|
550
|
+
var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
|
|
551
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities, operationStartDate: startDate || issuingDate });
|
|
356
552
|
})
|
|
357
553
|
.addCase(verifyEntityLeadOTP.rejected, function (state, action) {
|
|
358
554
|
state.loading = false;
|
|
359
555
|
state.error = action.error.message;
|
|
360
556
|
})
|
|
361
|
-
.addCase(
|
|
557
|
+
.addCase(updateEntity.pending, function (state) {
|
|
362
558
|
state.loading = true;
|
|
363
559
|
state.error = null;
|
|
364
560
|
})
|
|
365
|
-
.addCase(
|
|
561
|
+
.addCase(updateEntity.fulfilled, function (state, action) {
|
|
366
562
|
var _a;
|
|
367
563
|
state.loading = false;
|
|
368
564
|
state.error = null;
|
|
@@ -373,9 +569,9 @@ export var entitySlice = createSlice({
|
|
|
373
569
|
return;
|
|
374
570
|
}
|
|
375
571
|
state.data.entityData = formData;
|
|
376
|
-
state.data.entityData.responseBody = data;
|
|
572
|
+
state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { data: data });
|
|
377
573
|
})
|
|
378
|
-
.addCase(
|
|
574
|
+
.addCase(updateEntity.rejected, function (state, action) {
|
|
379
575
|
state.loading = false;
|
|
380
576
|
state.error = action.error.message;
|
|
381
577
|
})
|
|
@@ -392,6 +588,72 @@ export var entitySlice = createSlice({
|
|
|
392
588
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
393
589
|
state.error = action.error.message;
|
|
394
590
|
state.loading = false;
|
|
591
|
+
})
|
|
592
|
+
.addCase(retrieveDataList.pending, function (state) {
|
|
593
|
+
state.loading = true;
|
|
594
|
+
state.error = null;
|
|
595
|
+
})
|
|
596
|
+
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
597
|
+
var _a, _b, _c, _d, _e, _f;
|
|
598
|
+
state.loading = false;
|
|
599
|
+
state.error = null;
|
|
600
|
+
var payload = action.payload;
|
|
601
|
+
state.data.customersData.responseBody = payload;
|
|
602
|
+
var brand = (state.data.verify.responseBody || {}).brand;
|
|
603
|
+
var _g = (brand === null || brand === void 0 ? void 0 : brand.operations) || {}, customer_base = _g.customer_base, sales = _g.sales;
|
|
604
|
+
var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
|
|
605
|
+
var customerBase = undefined;
|
|
606
|
+
if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) > 1)
|
|
607
|
+
customerBase = [customerBases === null || customerBases === void 0 ? void 0 : customerBases[1], customerBases[0]];
|
|
608
|
+
else if ((customerBases === null || customerBases === void 0 ? void 0 : customerBases.length) === 1)
|
|
609
|
+
customerBase = [customerBases[0]];
|
|
610
|
+
if (((_b = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
611
|
+
customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases.filter(function (base) {
|
|
612
|
+
var _a;
|
|
613
|
+
return (_a = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === base.id; });
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
var expectedSales = ((_c = payload.expectedSales) === null || _c === void 0 ? void 0 : _c.list) || [];
|
|
617
|
+
var expectedSale = (_e = (_d = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _d === void 0 ? void 0 : _d.sub) === null || _e === void 0 ? void 0 : _e[4];
|
|
618
|
+
if ((sales === null || sales === void 0 ? void 0 : sales.length) > 0) {
|
|
619
|
+
expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.find(function (sale) {
|
|
620
|
+
var _a;
|
|
621
|
+
return (_a = sales === null || sales === void 0 ? void 0 : sales.sub) === null || _a === void 0 ? void 0 : _a.find(function (s) { return s.id === sale.id; });
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
var expectedCustomerSales = ((_f = payload.expectedCustomerSales) === null || _f === void 0 ? void 0 : _f.list) || [];
|
|
625
|
+
var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
|
|
626
|
+
if ((customer_base === null || customer_base === void 0 ? void 0 : customer_base.length) > 0) {
|
|
627
|
+
expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.find(function (base) {
|
|
628
|
+
return customer_base.id === base.id;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
|
|
632
|
+
if (!!customerBase)
|
|
633
|
+
state.data.customersData.customerLocations = customerBase;
|
|
634
|
+
if (!!expectedSale)
|
|
635
|
+
state.data.customersData.expectedSale = expectedSale;
|
|
636
|
+
if (!!expectedCustomerSale)
|
|
637
|
+
state.data.customersData.expectedCustomer = expectedCustomerSale;
|
|
638
|
+
})
|
|
639
|
+
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
640
|
+
state.loading = false;
|
|
641
|
+
state.error = action.error.message;
|
|
642
|
+
})
|
|
643
|
+
.addCase(updateCustomersInfo.pending, function (state) {
|
|
644
|
+
state.loading = true;
|
|
645
|
+
state.error = null;
|
|
646
|
+
})
|
|
647
|
+
.addCase(updateCustomersInfo.fulfilled, function (state, action) {
|
|
648
|
+
state.loading = false;
|
|
649
|
+
state.error = null;
|
|
650
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
651
|
+
state.data.customersData = formData;
|
|
652
|
+
state.data.customersData.responseBody = data;
|
|
653
|
+
})
|
|
654
|
+
.addCase(updateCustomersInfo.rejected, function (state, action) {
|
|
655
|
+
state.loading = false;
|
|
656
|
+
state.error = action.error.message;
|
|
395
657
|
})
|
|
396
658
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
397
659
|
var _a;
|
|
@@ -414,41 +676,19 @@ export var entitySlice = createSlice({
|
|
|
414
676
|
state.loading = false;
|
|
415
677
|
state.error = action.error.message;
|
|
416
678
|
})
|
|
417
|
-
.addCase(
|
|
679
|
+
.addCase(uploadArticle.pending, function (state) {
|
|
418
680
|
state.error = null;
|
|
419
|
-
state.
|
|
681
|
+
state.uploading = true;
|
|
420
682
|
})
|
|
421
|
-
.addCase(
|
|
422
|
-
var _a;
|
|
683
|
+
.addCase(uploadArticle.fulfilled, function (state, action) {
|
|
423
684
|
state.error = null;
|
|
424
|
-
state.
|
|
425
|
-
var data = action.payload
|
|
426
|
-
|
|
427
|
-
if (description) {
|
|
428
|
-
state.error = description;
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
var channels = data || [];
|
|
432
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { channelList: channels });
|
|
433
|
-
var brand = (state.data.verify.responseBody || {}).brand;
|
|
434
|
-
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
435
|
-
var _b = brand || {}, website = _b.website, social = _b.social;
|
|
436
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
437
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
438
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
439
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
|
|
440
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
|
|
441
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
442
|
-
selectedChannels = [websiteData, socialData];
|
|
443
|
-
else if (isHasTwitter || isHasInstagram)
|
|
444
|
-
selectedChannels = [socialData];
|
|
445
|
-
else if (isHasWebsite)
|
|
446
|
-
selectedChannels = [websiteData];
|
|
447
|
-
state.data.entityData.salesChannels = selectedChannels;
|
|
685
|
+
state.uploading = false;
|
|
686
|
+
var data = action.payload.data;
|
|
687
|
+
state.data.entityData.articleId = data === null || data === void 0 ? void 0 : data.id;
|
|
448
688
|
})
|
|
449
|
-
.addCase(
|
|
450
|
-
state.
|
|
451
|
-
state.
|
|
689
|
+
.addCase(uploadArticle.rejected, function (state) {
|
|
690
|
+
state.uploading = false;
|
|
691
|
+
state.error = 'file_upload_error';
|
|
452
692
|
});
|
|
453
693
|
}
|
|
454
694
|
});
|