@tap-payments/auth-jsconnect 2.0.50-test → 2.0.52-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.
@@ -9,6 +9,42 @@ 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
+ };
12
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
49
  import Box from '@mui/material/Box/Box';
14
50
  import { styled } from '@mui/material/styles';
@@ -20,11 +56,10 @@ import { handlePrevScreenStep } from '../../../../app/settings';
20
56
  import { ScreenContainer } from '../../../shared/Containers';
21
57
  import { MobileButton } from '../../../shared/Button';
22
58
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
23
- import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
24
59
  import Icon from '../../../../components/Icon';
25
- import { ICONS_NAMES } from '../../../../constants';
26
- import Button from '@mui/material/Button';
27
60
  import { mobileOS } from '../../../../utils';
61
+ import VerifyPACILoading from './VerifyPACILoading';
62
+ import VerifyPACISuccess from './VerifyPACISuccess';
28
63
  var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
29
64
  var theme = _a.theme;
30
65
  return ({
@@ -83,16 +118,32 @@ var BackButton = styled('button')(function (_a) {
83
118
  });
84
119
  });
85
120
  var VerifyPACI = function () {
121
+ var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
86
122
  var dispatch = useAppDispatch();
87
123
  var data = useAppSelector(connectSelector).data;
88
124
  var responseBody = data.civilIdData.responseBody;
89
125
  var t = useTranslation().t;
126
+ var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
127
+ return __generator(this, function (_a) {
128
+ switch (_a.label) {
129
+ case 0: return [4, new Promise(function (resolve) {
130
+ setSuccess(true);
131
+ setTimeout(function () {
132
+ resolve('success');
133
+ }, 1000);
134
+ })];
135
+ case 1:
136
+ _a.sent();
137
+ return [2];
138
+ }
139
+ });
140
+ }); };
90
141
  React.useEffect(function () {
91
142
  if (responseBody)
92
- dispatch(verifyPACIFun());
143
+ dispatch(verifyPACIFun({ onSuccess: onSuccess }));
93
144
  var interval = setInterval(function () {
94
145
  if (responseBody)
95
- dispatch(verifyPACIFun());
146
+ dispatch(verifyPACIFun({ onSuccess: onSuccess }));
96
147
  }, 10000);
97
148
  setTimeout(function () {
98
149
  clearInterval(interval);
@@ -113,6 +164,6 @@ var VerifyPACI = function () {
113
164
  var os = React.useMemo(function () { return mobileOS(); }, []);
114
165
  var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
115
166
  var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
116
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsxs(Container, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(Button, __assign({ variant: 'text', onClick: onBack }, { children: t('back') }))] })));
167
+ return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, {}) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
117
168
  };
118
169
  export default React.memo(VerifyPACI);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface VerifyPACILoadingProps {
3
+ }
4
+ declare const _default: React.NamedExoticComponent<VerifyPACILoadingProps>;
5
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
5
+ import { ICONS_NAMES } from '../../../../constants';
6
+ import Icon from '../../../../components/Icon';
7
+ var IconStyled = styled(Icon)(function (_a) {
8
+ var theme = _a.theme;
9
+ return ({
10
+ position: 'absolute',
11
+ top: '50%',
12
+ left: '50%',
13
+ transform: 'translate(-50%, -50%)',
14
+ width: 64,
15
+ height: 64
16
+ });
17
+ });
18
+ var VerifyPACILoading = function () {
19
+ return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
20
+ };
21
+ VerifyPACILoading.defaultProps = {};
22
+ export default memo(VerifyPACILoading);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ interface VerifyPACISuccessProps {
3
+ }
4
+ declare const _default: React.NamedExoticComponent<VerifyPACISuccessProps>;
5
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
4
+ var VerifyPACISuccess = function () {
5
+ return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
6
+ };
7
+ VerifyPACISuccess.defaultProps = {};
8
+ export default memo(VerifyPACISuccess);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.50-test",
3
+ "version": "2.0.52-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",