@tap-payments/auth-jsconnect 2.1.9-test → 2.1.11-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.
Files changed (74) hide show
  1. package/build/@types/form.d.ts +4 -3
  2. package/build/api/board.d.ts +1 -0
  3. package/build/api/board.js +8 -1
  4. package/build/api/entity.d.ts +1 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/assets/locales/ar.json +7 -0
  7. package/build/assets/locales/en.json +7 -0
  8. package/build/components/FileInput/DragAndDrop.d.ts +3 -2
  9. package/build/components/FileInput/DragAndDrop.js +4 -4
  10. package/build/components/Lottie/Lottie.d.ts +2924 -127
  11. package/build/components/Lottie/Lottie.js +8 -4
  12. package/build/components/Lottie/files/error.json +692 -0
  13. package/build/components/Lottie/files/start_loading.json +1140 -0
  14. package/build/components/Lottie/files/still_loading.json +1140 -0
  15. package/build/constants/validation.d.ts +1 -0
  16. package/build/constants/validation.js +1 -0
  17. package/build/features/app/bank/bankStore.js +13 -10
  18. package/build/features/app/business/businessStore.d.ts +8 -1
  19. package/build/features/app/business/businessStore.js +123 -66
  20. package/build/features/app/connect/connectStore.d.ts +1 -1
  21. package/build/features/app/connect/connectStore.js +47 -38
  22. package/build/features/app/entity/entityStore.js +37 -42
  23. package/build/features/app/individual/individualStore.js +47 -38
  24. package/build/features/app/password/passwordStore.js +19 -20
  25. package/build/features/app/tax/taxStore.js +13 -10
  26. package/build/features/bank/screens/BankDetails/BankDetails.js +13 -6
  27. package/build/features/bank/screens/BankDetails/BankStatement.js +14 -11
  28. package/build/features/bank/screens/BankDetails/validation.d.ts +22 -0
  29. package/build/features/bank/screens/BankDetails/validation.js +29 -2
  30. package/build/features/business/screens/BusinessType/Article.d.ts +6 -0
  31. package/build/features/business/screens/BusinessType/Article.js +89 -0
  32. package/build/features/business/screens/BusinessType/BusinessType.js +16 -10
  33. package/build/features/business/screens/BusinessType/EntityName.js +1 -1
  34. package/build/features/business/screens/BusinessType/LicenseCertificate.js +14 -9
  35. package/build/features/business/screens/BusinessType/LicenseList.js +3 -2
  36. package/build/features/business/screens/BusinessType/LicenseType.js +3 -3
  37. package/build/features/business/screens/BusinessType/validation.js +17 -8
  38. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  39. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +9 -134
  40. package/build/features/connect/screens/Merchant/Merchant.js +4 -24
  41. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -5
  42. package/build/features/connect/screens/Merchant/SalesChannels.js +29 -99
  43. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  44. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -73
  45. package/build/features/entity/screens/EntityInfoConfirm/Article.js +14 -11
  46. package/build/features/shared/PaciVerification/PaciVerification.d.ts +12 -0
  47. package/build/features/shared/PaciVerification/PaciVerification.js +91 -0
  48. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACILoading.d.ts +1 -0
  49. package/build/features/shared/PaciVerification/VerifyPACILoading.js +13 -0
  50. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.d.ts +0 -0
  51. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js +1 -1
  52. package/build/features/shared/PaciVerification/index.d.ts +2 -0
  53. package/build/features/shared/PaciVerification/index.js +2 -0
  54. package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +11 -0
  55. package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +100 -0
  56. package/build/features/shared/SalesChannels/SalesChannel.d.ts +10 -0
  57. package/build/features/shared/SalesChannels/SalesChannel.js +132 -0
  58. package/build/features/shared/SalesChannels/index.d.ts +2 -0
  59. package/build/features/shared/SalesChannels/index.js +2 -0
  60. package/build/features/shared/UploadFile/UploadFile.d.ts +3 -2
  61. package/build/features/shared/UploadFile/UploadFile.js +13 -13
  62. package/build/hooks/index.d.ts +1 -0
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/useCountUp.d.ts +9 -0
  65. package/build/hooks/useCountUp.js +17 -0
  66. package/package.json +1 -1
  67. package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
  68. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  69. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +0 -8
  70. package/build/features/connect/screens/Merchant/SocialMedia.js +0 -156
  71. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -6
  72. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  73. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
  74. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
@@ -1,111 +1,41 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __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 { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
27
- import Text from '../../../../components/Text';
5
+ import { useAppSelector, useAppDispatch } from '../../../../hooks';
28
6
  import { connectSelector, clearError } from '../../../app/connect/connectStore';
29
- import CheckBox from '../../../../components/CheckBox';
30
- import Warning from '../../../../components/Warning';
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 onSaleIconChange = _a.onSaleIconChange;
11
+ var _c = React.useState([]), defaultValues = _c[0], setDefaultValues = _c[1];
79
12
  var t = useTranslation().t;
80
- var isAr = useLanguage().isAr;
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 channelsControl = useController({ control: control, name: 'salesChannels' });
84
- var _d = useAppSelector(connectSelector), data = _d.data, error = _d.error;
85
- var channelList = (data.brandData.responseBody || {}).channel_list;
86
- var isChecked = function (id) {
87
- var item = channelsControl.field.value.find(function (item) { return item.id === id; });
88
- return !!item;
89
- };
90
- var onChange = function (channel) {
91
- if (error)
92
- dispatch(clearError());
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
- else {
99
- onSaleIconChange(findFirstId([channel]));
100
- var newChannel = __assign({}, channel);
101
- channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsControl.field.value, true), [newChannel], false));
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
- var warningMessage = (_b = channelsControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
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;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  export interface VerifyPACIProps {
3
3
  }
4
- declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element | null>;
5
5
  export default _default;
@@ -9,58 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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";
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 _c = useAppSelector(connectSelector), data = _c.data, error = _c.error;
72
+ var data = useAppSelector(connectSelector).data;
116
73
  var responseBody = data.civilIdData.responseBody;
117
- var t = useTranslation().t;
118
- var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
119
- return __generator(this, function (_a) {
120
- switch (_a.label) {
121
- case 0:
122
- setSuccess(true);
123
- return [4, sleep(2000)];
124
- case 1:
125
- _a.sent();
126
- return [2];
127
- }
128
- });
129
- }); };
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: 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
- var os = React.useMemo(function () { return mobileOS(); }, []);
155
- var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
156
- var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
157
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { loop: !error }) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), _jsx(Collapse, __assign({ in: !!error, sx: { width: '100%' } }, { children: _jsx(Warning, { children: t(error) }) })), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
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 (file) {
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
- else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
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
- else {
45
- articleFileControl.field.onChange(file);
46
- dispatch(uploadArticle({
47
- file: file,
48
- onProgress: function (value) {
49
- setProgress(value);
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;
@@ -0,0 +1,91 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box/Box';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useTranslation } from 'react-i18next';
17
+ import Text from '../../../components/Text';
18
+ import { ScreenContainer } from '../../shared/Containers';
19
+ import { MobileButton } from '../../shared/Button';
20
+ import { mobileOS } from '../../../utils';
21
+ import { useCountUp } from '../../../hooks';
22
+ import VerifyPACILoading from './VerifyPACILoading';
23
+ import VerifyPACISuccess from './VerifyPACISuccess';
24
+ var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
25
+ var theme = _a.theme;
26
+ return ({
27
+ direction: theme.direction,
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ alignItems: 'center',
31
+ marginBottom: theme.spacing(2.5)
32
+ });
33
+ });
34
+ var VerifyPACITitleStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBottom: theme.spacing(2.4), lineHeight: '19.2px' }));
37
+ });
38
+ var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
39
+ var theme = _a.theme;
40
+ return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, lineHeight: '16.8px' }));
41
+ });
42
+ var Container = styled(Box)(function (_a) {
43
+ var theme = _a.theme;
44
+ return ({
45
+ position: 'relative',
46
+ display: 'flex',
47
+ justifyContent: 'center',
48
+ alignItems: 'center',
49
+ maxHeight: '300px',
50
+ marginBottom: theme.spacing(3.25)
51
+ });
52
+ });
53
+ var VerifyPACI = function (_a) {
54
+ var success = _a.success, expiryInSeconds = _a.expiryInSeconds, urls = _a.urls, onFinish = _a.onFinish;
55
+ var t = useTranslation().t;
56
+ var count = useCountUp({ start: 0, end: expiryInSeconds, sleepMS: 1000 }).count;
57
+ var errorWaitingTime = 3;
58
+ var phases = 2;
59
+ var remainingTime = expiryInSeconds - errorWaitingTime;
60
+ var phaseNumber = Math.floor((count / remainingTime) * phases) + 1;
61
+ var isEnded = count === expiryInSeconds;
62
+ var endPhaseStarted = count >= remainingTime;
63
+ React.useEffect(function () {
64
+ if (isEnded && onFinish)
65
+ onFinish();
66
+ }, [isEnded]);
67
+ var onRedirect = React.useCallback(function () {
68
+ if (os === 'Android') {
69
+ window.open(urls === null || urls === void 0 ? void 0 : urls.android, '_blank');
70
+ }
71
+ if (os === 'iOS') {
72
+ window.open(urls === null || urls === void 0 ? void 0 : urls.ios, '_blank');
73
+ }
74
+ }, [urls]);
75
+ var os = React.useMemo(function () { return mobileOS(); }, []);
76
+ var isAndroid = React.useMemo(function () { return os === 'Android' && (urls === null || urls === void 0 ? void 0 : urls.android); }, [os, urls]);
77
+ var isIOS = React.useMemo(function () { return os === 'iOS' && (urls === null || urls === void 0 ? void 0 : urls.ios); }, [os, urls]);
78
+ var title = React.useMemo(function () {
79
+ if (phaseNumber === 1)
80
+ return 'paci_verification_title_wait';
81
+ return 'paci_verification_title_check';
82
+ }, [phaseNumber]);
83
+ var description = React.useMemo(function () {
84
+ if (phaseNumber === 1)
85
+ return 'paci_verification_description_wait';
86
+ return 'paci_verification_description_check';
87
+ }, [phaseNumber]);
88
+ var isErrorPhase = endPhaseStarted && !success;
89
+ return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { type: isErrorPhase ? 3 : phaseNumber }) }), isErrorPhase ? (_jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t('paci_verification_title_error') }), _jsx(VerifyPACISubTitleStyled, __assign({ sx: { pb: 1 } }, { children: t('paci_verification_description_error') })), _jsx(VerifyPACISubTitleStyled, { children: t('paci_verification_redirection_message') })] })) : (_jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t(title) }), _jsx(VerifyPACISubTitleStyled, { children: t(description) })] }))] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') })))] })));
90
+ };
91
+ export default React.memo(VerifyPACI);
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface VerifyPACILoadingProps {
3
3
  loop?: boolean;
4
+ type: number;
4
5
  }
5
6
  declare const _default: React.NamedExoticComponent<VerifyPACILoadingProps>;
6
7
  export default _default;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
4
+ var VerifyPACILoading = function (_a) {
5
+ var _b = _a.loop, loop = _b === void 0 ? true : _b, type = _a.type;
6
+ if (type === 1)
7
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.start_loading, loop: loop, width: '90%' }) }));
8
+ if (type === 2)
9
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.still_loading, loop: loop, width: '90%' }) }));
10
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.error, loop: false, width: '90%' }) }));
11
+ };
12
+ VerifyPACILoading.defaultProps = {};
13
+ export default memo(VerifyPACILoading);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
3
+ import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
4
4
  var VerifyPACISuccess = function () {
5
5
  return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
6
6
  };
@@ -0,0 +1,2 @@
1
+ import PaciVerification from './PaciVerification';
2
+ export default PaciVerification;
@@ -0,0 +1,2 @@
1
+ import PaciVerification from './PaciVerification';
2
+ export default PaciVerification;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { SaleChannel } from '../../../@types';
3
+ interface SaleChannelIconsInputProps {
4
+ selectedChannels: SaleChannel[];
5
+ onSelectIcon: (id: string) => void;
6
+ selectedIconId: string;
7
+ onChangeValue: (val: string, id: string) => void;
8
+ error: string | undefined;
9
+ }
10
+ export default function SaleChannelIconsInput({ selectedChannels, onSelectIcon, selectedIconId, onChangeValue, error }: SaleChannelIconsInputProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,100 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { styled, alpha } from '@mui/material/styles';
15
+ import Box from '@mui/material/Box';
16
+ import Input from '../../../components/Input';
17
+ import Warning from '../../../components/Warning';
18
+ import Text from '../../../components/Text';
19
+ import Collapse from '../../../components/Collapse';
20
+ import SocialMediaGroup from '../../../components/SocialMediaGroup';
21
+ import ToggleButton from '../../../components/ToggleButton';
22
+ import Icon from '../../../components/Icon';
23
+ import { useLanguage } from '../../../hooks';
24
+ import { isWebsite, isTwitter } from '../../../utils';
25
+ var SocialMediaGroupStyled = styled(SocialMediaGroup)(function (_a) {
26
+ var theme = _a.theme, defaultValue = _a.defaultValue;
27
+ return ({
28
+ borderTop: "1px solid ".concat(alpha(theme.palette.divider, 0.8)),
29
+ borderBottom: !defaultValue ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : '',
30
+ width: '100%'
31
+ });
32
+ });
33
+ var InputStyled = styled(Input)(function (_a) {
34
+ var theme = _a.theme;
35
+ return ({
36
+ padding: theme.spacing(0, 2, 0, 0),
37
+ paddingInlineEnd: theme.spacing(2),
38
+ input: {
39
+ paddingInlineStart: theme.spacing(0)
40
+ }
41
+ });
42
+ });
43
+ var TextStyled = styled(Text)(function (_a) {
44
+ var theme = _a.theme;
45
+ return ({
46
+ padding: theme.spacing(0, 0, 0, 1.5)
47
+ });
48
+ });
49
+ var ToggleIconStyled = styled(Icon, {
50
+ shouldForwardProp: function (prop) { return prop !== 'isActive'; }
51
+ })(function (_a) {
52
+ var theme = _a.theme, isActive = _a.isActive;
53
+ return ({
54
+ width: theme.spacing(3),
55
+ height: theme.spacing(3),
56
+ filter: isActive ? 'invert(1) sepia(1) saturate(5) hue-rotate(175deg)' : ''
57
+ });
58
+ });
59
+ var SocialMediaButtonStyled = styled(ToggleButton, {
60
+ shouldForwardProp: function (prop) { return prop !== 'isActive' && prop !== 'isShow'; }
61
+ })(function (_a) {
62
+ var theme = _a.theme, isActive = _a.isActive, isShow = _a.isShow;
63
+ return ({
64
+ borderBottom: isActive ? "".concat(theme.spacing(0.1875), " solid #3478F6") : 'none',
65
+ display: isShow ? 'inherit' : 'none',
66
+ transition: 'display 0.3s'
67
+ });
68
+ });
69
+ export default function SaleChannelIconsInput(_a) {
70
+ var selectedChannels = _a.selectedChannels, onSelectIcon = _a.onSelectIcon, selectedIconId = _a.selectedIconId, onChangeValue = _a.onChangeValue, error = _a.error;
71
+ var isAr = useLanguage().isAr;
72
+ var t = useTranslation().t;
73
+ var getPlaceHolder = function (item) {
74
+ var _a, _b;
75
+ if (isAr)
76
+ return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.ar) || '';
77
+ return ((_b = item.name) === null || _b === void 0 ? void 0 : _b.en) || '';
78
+ };
79
+ return (_jsx(Collapse, __assign({ in: selectedChannels.length > 0 }, { children: _jsxs(Box, __assign({ sx: { mb: 3, direction: 'ltr' } }, { children: [_jsx(SocialMediaGroupStyled, __assign({ exclusive: true, onChange: function (e, value) {
80
+ onSelectIcon(value);
81
+ } }, { children: selectedChannels.map(function (channel, index) {
82
+ var _a;
83
+ var isActive = selectedIconId === channel.id;
84
+ return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
85
+ var isSubActive = selectedIconId === sub.id;
86
+ return (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isSubActive, value: sub.id }, { children: _jsx(ToggleIconStyled, { isActive: isSubActive, src: (sub === null || sub === void 0 ? void 0 : sub.logo) || '' }) }), "sub_".concat(subIndex)));
87
+ })) : (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isActive, value: channel.id || '' }, { children: _jsx(ToggleIconStyled, { isActive: isActive, src: (channel === null || channel === void 0 ? void 0 : channel.logo) || '' }) }), index));
88
+ }) })), selectedChannels.map(function (channel, index) {
89
+ var _a;
90
+ var isActive = selectedIconId === channel.id;
91
+ return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
92
+ var isSubActive = selectedIconId === sub.id;
93
+ return (_jsx(Collapse, __assign({ in: isSubActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
94
+ onChangeValue(e.target.value, sub.id);
95
+ }, value: sub.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(sub.code) && { fontSize: '20px' })) }, { children: isWebsite(sub.code) ? "https://" : isTwitter(sub.code) ? "@" : '' })), placeholder: t(getPlaceHolder(sub)) }) }), "sub_".concat(subIndex)));
96
+ })) : (_jsx(Collapse, __assign({ in: isActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
97
+ onChangeValue(e.target.value, channel.id);
98
+ }, value: channel.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(channel.code) && { fontSize: '20px' })) }, { children: isWebsite(channel.code) ? "https://" : isTwitter(channel.code) ? "@" : '' })), placeholder: t(getPlaceHolder(channel)) }) }), index));
99
+ }), _jsx(Collapse, __assign({ in: !!(error && error !== 'choose_atleast_one_channel') }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] })) })));
100
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SaleChannel } from '../../../@types';
3
+ interface SalesChannelProps {
4
+ list: SaleChannel[];
5
+ error: string | undefined;
6
+ onChange: (channel: SaleChannel[]) => void;
7
+ defaultValues?: SaleChannel[];
8
+ }
9
+ declare const _default: React.MemoExoticComponent<({ list, onChange, error, defaultValues }: SalesChannelProps) => JSX.Element>;
10
+ export default _default;