@tap-payments/auth-jsconnect 2.1.9-test → 2.1.10-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +4 -3
- package/build/api/entity.d.ts +1 -1
- package/build/assets/locales/ar.json +7 -0
- package/build/assets/locales/en.json +7 -0
- package/build/components/FileInput/DragAndDrop.d.ts +3 -2
- package/build/components/FileInput/DragAndDrop.js +4 -4
- package/build/components/Lottie/Lottie.d.ts +2924 -127
- package/build/components/Lottie/Lottie.js +8 -4
- package/build/components/Lottie/files/error.json +692 -0
- package/build/components/Lottie/files/start_loading.json +1140 -0
- package/build/components/Lottie/files/still_loading.json +1140 -0
- package/build/features/app/business/businessStore.d.ts +8 -1
- package/build/features/app/business/businessStore.js +74 -15
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +47 -38
- package/build/features/bank/screens/BankDetails/BankStatement.js +14 -11
- package/build/features/business/screens/BusinessType/Article.d.ts +6 -0
- package/build/features/business/screens/BusinessType/Article.js +89 -0
- package/build/features/business/screens/BusinessType/BusinessType.js +16 -10
- package/build/features/business/screens/BusinessType/EntityName.js +1 -1
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +14 -9
- package/build/features/business/screens/BusinessType/LicenseList.js +3 -2
- package/build/features/business/screens/BusinessType/LicenseType.js +3 -3
- package/build/features/business/screens/BusinessType/validation.js +17 -8
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +9 -134
- package/build/features/connect/screens/Merchant/Merchant.js +4 -24
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -5
- package/build/features/connect/screens/Merchant/SalesChannels.js +29 -99
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -73
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +14 -11
- package/build/features/shared/PaciVerification/PaciVerification.d.ts +12 -0
- package/build/features/shared/PaciVerification/PaciVerification.js +91 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACILoading.d.ts +1 -0
- package/build/features/shared/PaciVerification/VerifyPACILoading.js +13 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.d.ts +0 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js +1 -1
- package/build/features/shared/PaciVerification/index.d.ts +2 -0
- package/build/features/shared/PaciVerification/index.js +2 -0
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +11 -0
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +100 -0
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +10 -0
- package/build/features/shared/SalesChannels/SalesChannel.js +132 -0
- package/build/features/shared/SalesChannels/index.d.ts +2 -0
- package/build/features/shared/SalesChannels/index.js +2 -0
- package/build/features/shared/UploadFile/UploadFile.d.ts +3 -2
- package/build/features/shared/UploadFile/UploadFile.js +13 -13
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useCountUp.d.ts +9 -0
- package/build/hooks/useCountUp.js +17 -0
- package/package.json +1 -1
- package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +0 -23
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +0 -8
- package/build/features/connect/screens/Merchant/SocialMedia.js +0 -156
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -6
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -23
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
|
@@ -54,15 +54,24 @@ export var KWLicenseValidationSchema = yup.object().shape({
|
|
|
54
54
|
.required(''),
|
|
55
55
|
entityLegalName: yup
|
|
56
56
|
.string()
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return true;
|
|
62
|
-
return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) || (value === null || value === void 0 ? void 0 : value.length) < 3
|
|
63
|
-
? this.createError({ message: 'enter_entity_name_english_chars_numbers_space' })
|
|
64
|
-
: true;
|
|
57
|
+
.when('selectedLicense', function (selectedLicense) {
|
|
58
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
59
|
+
if (!isCR) {
|
|
60
|
+
return yup.string().optional();
|
|
65
61
|
}
|
|
62
|
+
return yup
|
|
63
|
+
.string()
|
|
64
|
+
.required('')
|
|
65
|
+
.test({
|
|
66
|
+
test: function (value) {
|
|
67
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
68
|
+
if (length === 0)
|
|
69
|
+
return true;
|
|
70
|
+
return (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) && length >= 3
|
|
71
|
+
? true
|
|
72
|
+
: this.createError({ message: 'enter_entity_name_english_chars_numbers_space' });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
66
75
|
})
|
|
67
76
|
.required(''),
|
|
68
77
|
certificateId: yup.string().optional(),
|
|
@@ -1,159 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
2
|
import * as React from 'react';
|
|
50
|
-
import Box from '@mui/material/Box/Box';
|
|
51
|
-
import { styled } from '@mui/material/styles';
|
|
52
|
-
import { useTranslation } from 'react-i18next';
|
|
53
|
-
import Text from '../../../../components/Text';
|
|
54
3
|
import { businessSelector, verifyPACI as verifyPACIFun } from '../../../app/business/businessStore';
|
|
55
4
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
56
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
|
-
import { MobileButton } from '../../../shared/Button';
|
|
58
5
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
-
import
|
|
60
|
-
import Warning from '../../../../components/Warning';
|
|
61
|
-
import { mobileOS, sleep } from '../../../../utils';
|
|
62
|
-
import VerifyPACILoading from './VerifyPACILoading';
|
|
63
|
-
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
64
|
-
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
65
|
-
var theme = _a.theme;
|
|
66
|
-
return ({
|
|
67
|
-
direction: theme.direction,
|
|
68
|
-
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
69
|
-
display: 'flex',
|
|
70
|
-
flexDirection: 'column',
|
|
71
|
-
alignItems: 'center',
|
|
72
|
-
marginBottom: theme.spacing(2.5)
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
var VerifyPACITitleStyled = styled(Text)(function (_a) {
|
|
76
|
-
var theme = _a.theme;
|
|
77
|
-
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
78
|
-
});
|
|
79
|
-
var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
|
|
80
|
-
var theme = _a.theme;
|
|
81
|
-
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
|
|
82
|
-
});
|
|
83
|
-
var Container = styled(Box)(function (_a) {
|
|
84
|
-
var theme = _a.theme;
|
|
85
|
-
return ({
|
|
86
|
-
position: 'relative',
|
|
87
|
-
display: 'flex',
|
|
88
|
-
justifyContent: 'center',
|
|
89
|
-
alignItems: 'center',
|
|
90
|
-
maxHeight: '300px'
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
var BackButton = styled('button')(function (_a) {
|
|
94
|
-
var theme = _a.theme;
|
|
95
|
-
return ({
|
|
96
|
-
cursor: 'pointer',
|
|
97
|
-
height: 44,
|
|
98
|
-
appearance: 'none',
|
|
99
|
-
background: 'none',
|
|
100
|
-
pointerEvents: 'auto',
|
|
101
|
-
border: 'none',
|
|
102
|
-
color: theme.palette.primary.main,
|
|
103
|
-
fontSize: theme.typography.body1.fontSize,
|
|
104
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
105
|
-
textTransform: 'capitalize',
|
|
106
|
-
'&:hover': {
|
|
107
|
-
backgroundColor: 'transparent'
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
6
|
+
import PaciVerification from '../../../shared/PaciVerification';
|
|
111
7
|
var VerifyPACI = function () {
|
|
112
8
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
113
9
|
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
114
10
|
var dispatch = useAppDispatch();
|
|
115
|
-
var
|
|
11
|
+
var data = useAppSelector(businessSelector).data;
|
|
116
12
|
var responseBody = data.civilIdData.responseBody;
|
|
117
|
-
var
|
|
118
|
-
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
-
return __generator(this, function (_a) {
|
|
120
|
-
switch (_a.label) {
|
|
121
|
-
case 0:
|
|
122
|
-
setSuccess(true);
|
|
123
|
-
return [4, sleep(2000)];
|
|
124
|
-
case 1:
|
|
125
|
-
_a.sent();
|
|
126
|
-
return [2];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}); };
|
|
13
|
+
var _c = responseBody || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios;
|
|
130
14
|
React.useEffect(function () {
|
|
131
|
-
if (responseBody) {
|
|
15
|
+
if (responseBody && !isReady) {
|
|
132
16
|
setIsReady(true);
|
|
133
17
|
}
|
|
134
18
|
}, [responseBody]);
|
|
135
19
|
React.useEffect(function () {
|
|
136
20
|
if (!isReady)
|
|
137
21
|
return;
|
|
138
|
-
var promise = dispatch(verifyPACIFun({ onSuccess:
|
|
22
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: function () { return setSuccess(true); } }));
|
|
139
23
|
return function () {
|
|
140
24
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
141
25
|
};
|
|
142
26
|
}, [isReady]);
|
|
143
|
-
var onRedirect = React.useCallback(function () {
|
|
144
|
-
if (os === 'Android') {
|
|
145
|
-
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
146
|
-
}
|
|
147
|
-
if (os === 'iOS') {
|
|
148
|
-
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
|
|
149
|
-
}
|
|
150
|
-
}, [responseBody]);
|
|
151
27
|
var onBack = React.useCallback(function () {
|
|
152
28
|
dispatch(handlePrevScreenStep());
|
|
153
29
|
}, []);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { loop: !error }) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), _jsx(Collapse, __assign({ in: !!error, sx: { width: '100%' } }, { children: _jsx(Warning, { children: t(error) }) })), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
|
|
30
|
+
if (!isReady)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(PaciVerification, { expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
158
33
|
};
|
|
159
34
|
export default React.memo(VerifyPACI);
|
|
@@ -23,10 +23,9 @@ import Button from '../../../shared/Button';
|
|
|
23
23
|
import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
|
|
24
24
|
import { useLanguage } from '../../../../hooks';
|
|
25
25
|
import { AuthForType } from '../../../../@types';
|
|
26
|
-
import {
|
|
26
|
+
import { isKW } from '../../../../utils';
|
|
27
27
|
import { MerchantValidationSchema } from './validation';
|
|
28
28
|
import BrandName from './BrandName';
|
|
29
|
-
import SocialMedia from './SocialMedia';
|
|
30
29
|
import TAC from './TAC';
|
|
31
30
|
import BrandList from './BrandList';
|
|
32
31
|
import SalesChannels from './SalesChannels';
|
|
@@ -35,12 +34,11 @@ var Merchant = function (_a) {
|
|
|
35
34
|
var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
|
|
36
35
|
var _e = React.useState(false), isBrandListOpen = _e[0], setIsBrandListOpen = _e[1];
|
|
37
36
|
var _f = React.useState(false), isRequiredNewBrand = _f[0], setIsRequiredNewBrand = _f[1];
|
|
38
|
-
var _g =
|
|
39
|
-
var _h = useAppSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
37
|
+
var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
40
38
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
41
39
|
var isNewIndividual = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.is_new_individual;
|
|
42
40
|
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
43
|
-
var
|
|
41
|
+
var _h = data.brandData, brandName = _h.brandName, selectedBrandItem = _h.selectedBrandItem, termAndConditionChecked = _h.termAndConditionChecked, responseBody = _h.responseBody, salesChannels = _h.salesChannels;
|
|
44
42
|
var brandList = (responseBody || {}).brand_list;
|
|
45
43
|
var methods = useForm({
|
|
46
44
|
resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
|
|
@@ -77,24 +75,6 @@ var Merchant = function (_a) {
|
|
|
77
75
|
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
78
76
|
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
79
77
|
}, [responseBody]);
|
|
80
|
-
var onSaleIconChange = function (id) {
|
|
81
|
-
setActiveIconId(id);
|
|
82
|
-
};
|
|
83
|
-
React.useEffect(function () {
|
|
84
|
-
if (selectedBrandItem.id) {
|
|
85
|
-
methods.setValue('selectedBrandItem', selectedBrandItem);
|
|
86
|
-
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
87
|
-
setActiveIconId(findFirstId(sales));
|
|
88
|
-
methods.setValue('salesChannels', sales, { shouldValidate: true });
|
|
89
|
-
}
|
|
90
|
-
}, [selectedBrandItem]);
|
|
91
|
-
React.useEffect(function () {
|
|
92
|
-
if (salesChannels.length > 0) {
|
|
93
|
-
var sales = mapSalesChannel(salesChannels);
|
|
94
|
-
setActiveIconId(findFirstId(sales));
|
|
95
|
-
methods.setValue('salesChannels', sales, { shouldValidate: true });
|
|
96
|
-
}
|
|
97
|
-
}, [salesChannels]);
|
|
98
78
|
React.useEffect(function () {
|
|
99
79
|
if (termAndConditionChecked === true)
|
|
100
80
|
methods.setValue('termAndConditionChecked', termAndConditionChecked);
|
|
@@ -107,6 +87,6 @@ var Merchant = function (_a) {
|
|
|
107
87
|
React.useEffect(function () {
|
|
108
88
|
setIsRequiredNewBrand(isOtherBrand || isNewBrand);
|
|
109
89
|
}, [isOtherBrand, isNewBrand]);
|
|
110
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {
|
|
90
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
111
91
|
};
|
|
112
92
|
export default React.memo(Merchant);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
|
-
export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
1
|
+
/// <reference types="react" />
|
|
4
2
|
interface SalesChannelsProps {
|
|
5
|
-
onSaleIconChange: (id: string) => void;
|
|
6
3
|
}
|
|
7
|
-
declare const SalesChannels: ({
|
|
4
|
+
declare const SalesChannels: ({}: SalesChannelsProps) => JSX.Element;
|
|
8
5
|
export default SalesChannels;
|
|
@@ -1,111 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import Box from '@mui/material/Box';
|
|
23
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
24
3
|
import { useTranslation } from 'react-i18next';
|
|
25
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
26
|
-
import {
|
|
27
|
-
import Text from '../../../../components/Text';
|
|
5
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
28
6
|
import { connectSelector, clearError } from '../../../app/connect/connectStore';
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import Collapse from '../../../../components/Collapse';
|
|
32
|
-
import { findFirstId } from '../../../../utils';
|
|
33
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
34
|
-
var theme = _a.theme;
|
|
35
|
-
return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
36
|
-
});
|
|
37
|
-
var ContainerStyled = styled(Box)(function (_a) {
|
|
38
|
-
var theme = _a.theme;
|
|
39
|
-
return ({
|
|
40
|
-
display: 'flex',
|
|
41
|
-
flexDirection: 'row',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
padding: theme.spacing(0, 0.5, 0, 0.5),
|
|
44
|
-
height: theme.spacing(3.625),
|
|
45
|
-
marginBlockEnd: theme.spacing(0.2)
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
var TextStyled = styled(Text)(function (_a) {
|
|
49
|
-
var theme = _a.theme;
|
|
50
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2), { marginBlockStart: theme.spacing(1.75) }));
|
|
51
|
-
});
|
|
52
|
-
var CheckBoxStyled = styled(CheckBox)(function (_a) {
|
|
53
|
-
var theme = _a.theme;
|
|
54
|
-
return ({
|
|
55
|
-
paddingInline: '15px',
|
|
56
|
-
marginInlineEnd: theme.spacing(-1),
|
|
57
|
-
'& .MuiSvgIcon-root': {
|
|
58
|
-
fontSize: 30
|
|
59
|
-
},
|
|
60
|
-
'&.Mui-checked': {
|
|
61
|
-
color: theme.palette.text.primary,
|
|
62
|
-
borderRadius: theme.spacing(2.5)
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
export var MandatoryStyled = styled('span')(function (_a) {
|
|
67
|
-
var theme = _a.theme;
|
|
68
|
-
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
69
|
-
});
|
|
70
|
-
export var CollapseStyled = styled(Collapse)(function (_a) {
|
|
71
|
-
var theme = _a.theme;
|
|
72
|
-
return ({
|
|
73
|
-
marginBlockStart: theme.spacing(2)
|
|
74
|
-
});
|
|
75
|
-
});
|
|
7
|
+
import { mapSalesChannel } from '../../../../utils';
|
|
8
|
+
import SalesChannel from '../../../shared/SalesChannels';
|
|
76
9
|
var SalesChannels = function (_a) {
|
|
77
10
|
var _b;
|
|
78
|
-
var
|
|
11
|
+
var _c = React.useState([]), defaultValues = _c[0], setDefaultValues = _c[1];
|
|
79
12
|
var t = useTranslation().t;
|
|
80
|
-
var
|
|
81
|
-
var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
|
|
13
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
82
14
|
var dispatch = useAppDispatch();
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (isChecked(channel.id)) {
|
|
94
|
-
var filterChannels = channelsControl.field.value.filter(function (item) { return item.id !== channel.id; });
|
|
95
|
-
onSaleIconChange(findFirstId([filterChannels.at(-1)]));
|
|
96
|
-
channelsControl.field.onChange(filterChannels);
|
|
15
|
+
var _e = useController({ control: control, name: 'salesChannels' }), fieldState = _e.fieldState, field = _e.field;
|
|
16
|
+
var _f = useAppSelector(connectSelector), data = _f.data, error = _f.error;
|
|
17
|
+
var _g = data.brandData, selectedBrandItem = _g.selectedBrandItem, responseBody = _g.responseBody, defaultSalesChannels = _g.salesChannels;
|
|
18
|
+
var channelList = (responseBody || {}).channel_list;
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
if (selectedBrandItem.id) {
|
|
21
|
+
setValue('selectedBrandItem', selectedBrandItem);
|
|
22
|
+
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
23
|
+
setDefaultValues(sales);
|
|
24
|
+
setValue('salesChannels', sales, { shouldValidate: true });
|
|
97
25
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
26
|
+
}, [selectedBrandItem]);
|
|
27
|
+
React.useEffect(function () {
|
|
28
|
+
if (defaultSalesChannels.length > 0) {
|
|
29
|
+
var sales = mapSalesChannel(defaultSalesChannels);
|
|
30
|
+
setDefaultValues(sales);
|
|
31
|
+
setValue('salesChannels', sales, { shouldValidate: true });
|
|
102
32
|
}
|
|
33
|
+
}, [defaultSalesChannels]);
|
|
34
|
+
var onChange = function (channels) {
|
|
35
|
+
if (error)
|
|
36
|
+
dispatch(clearError());
|
|
37
|
+
field.onChange(channels);
|
|
103
38
|
};
|
|
104
|
-
|
|
105
|
-
var isSalesChannelError = warningMessage === 'choose_atleast_one_channel';
|
|
106
|
-
return (_jsxs(Box, __assign({ sx: { mb: 3 } }, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), (channelList || []).map(function (channel, index) {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onChange(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, channel.id));
|
|
109
|
-
}), _jsx(CollapseStyled, __assign({ in: isSalesChannelError }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] })));
|
|
39
|
+
return (_jsx(_Fragment, { children: _jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValues: defaultValues }) }));
|
|
110
40
|
};
|
|
111
41
|
export default SalesChannels;
|
|
@@ -9,58 +9,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
13
|
import * as React from 'react';
|
|
50
14
|
import Box from '@mui/material/Box/Box';
|
|
51
15
|
import { styled } from '@mui/material/styles';
|
|
52
|
-
import { useTranslation } from 'react-i18next';
|
|
53
16
|
import Text from '../../../../components/Text';
|
|
54
17
|
import { connectSelector, verifyPACI as verifyPACIFun } from '../../../app/connect/connectStore';
|
|
18
|
+
import PaciVerification from '../../../shared/PaciVerification';
|
|
55
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
56
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
|
-
import { MobileButton } from '../../../shared/Button';
|
|
58
20
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
-
import { mobileOS, sleep } from '../../../../utils';
|
|
60
|
-
import Collapse from '../../../../components/Collapse';
|
|
61
|
-
import Warning from '../../../../components/Warning';
|
|
62
|
-
import VerifyPACILoading from './VerifyPACILoading';
|
|
63
|
-
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
64
21
|
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
65
22
|
var theme = _a.theme;
|
|
66
23
|
return ({
|
|
@@ -112,48 +69,27 @@ var VerifyPACI = function () {
|
|
|
112
69
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
113
70
|
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
114
71
|
var dispatch = useAppDispatch();
|
|
115
|
-
var
|
|
72
|
+
var data = useAppSelector(connectSelector).data;
|
|
116
73
|
var responseBody = data.civilIdData.responseBody;
|
|
117
|
-
var
|
|
118
|
-
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
-
return __generator(this, function (_a) {
|
|
120
|
-
switch (_a.label) {
|
|
121
|
-
case 0:
|
|
122
|
-
setSuccess(true);
|
|
123
|
-
return [4, sleep(2000)];
|
|
124
|
-
case 1:
|
|
125
|
-
_a.sent();
|
|
126
|
-
return [2];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}); };
|
|
74
|
+
var _c = responseBody || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios;
|
|
130
75
|
React.useEffect(function () {
|
|
131
|
-
if (responseBody) {
|
|
76
|
+
if (responseBody && !isReady) {
|
|
132
77
|
setIsReady(true);
|
|
133
78
|
}
|
|
134
79
|
}, [responseBody]);
|
|
135
80
|
React.useEffect(function () {
|
|
136
81
|
if (!isReady)
|
|
137
82
|
return;
|
|
138
|
-
var promise = dispatch(verifyPACIFun({ onSuccess:
|
|
83
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: function () { return setSuccess(true); } }));
|
|
139
84
|
return function () {
|
|
140
85
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
141
86
|
};
|
|
142
87
|
}, [isReady]);
|
|
143
|
-
var onRedirect = React.useCallback(function () {
|
|
144
|
-
if (os === 'Android') {
|
|
145
|
-
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
146
|
-
}
|
|
147
|
-
if (os === 'iOS') {
|
|
148
|
-
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
|
|
149
|
-
}
|
|
150
|
-
}, [responseBody]);
|
|
151
88
|
var onBack = React.useCallback(function () {
|
|
152
89
|
dispatch(handlePrevScreenStep());
|
|
153
90
|
}, []);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { loop: !error }) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), _jsx(Collapse, __assign({ in: !!error, sx: { width: '100%' } }, { children: _jsx(Warning, { children: t(error) }) })), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
|
|
91
|
+
if (!isReady)
|
|
92
|
+
return null;
|
|
93
|
+
return (_jsx(PaciVerification, { expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
158
94
|
};
|
|
159
95
|
export default React.memo(VerifyPACI);
|
|
@@ -34,22 +34,25 @@ var Article = function () {
|
|
|
34
34
|
setValue('articleId', articleId);
|
|
35
35
|
}
|
|
36
36
|
}, [articleFile, articleId]);
|
|
37
|
-
var handleArticleChange = function (
|
|
37
|
+
var handleArticleChange = function (files) {
|
|
38
|
+
var file = files === null || files === void 0 ? void 0 : files[0];
|
|
39
|
+
if (!file)
|
|
40
|
+
return;
|
|
38
41
|
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
39
42
|
setError('articleFile', { message: 'file_not_supported_alert' });
|
|
43
|
+
return;
|
|
40
44
|
}
|
|
41
|
-
|
|
45
|
+
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
42
46
|
setError('articleFile', { message: 'file_size_alert' });
|
|
47
|
+
return;
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
49
|
+
articleFileControl.field.onChange(file);
|
|
50
|
+
dispatch(uploadArticle({
|
|
51
|
+
file: file,
|
|
52
|
+
onProgress: function (value) {
|
|
53
|
+
setProgress(value);
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
53
56
|
};
|
|
54
57
|
var handleReset = function () {
|
|
55
58
|
articleFileControl.field.onChange(null);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface VerifyPACIProps {
|
|
3
|
+
success: boolean;
|
|
4
|
+
expiryInSeconds: number;
|
|
5
|
+
urls?: {
|
|
6
|
+
android: string;
|
|
7
|
+
ios: string;
|
|
8
|
+
};
|
|
9
|
+
onFinish?: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ success, expiryInSeconds, urls, onFinish }: VerifyPACIProps) => JSX.Element>;
|
|
12
|
+
export default _default;
|