@tap-payments/auth-jsconnect 2.1.50-test → 2.1.51-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.
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType } from '../../../@types';
61
61
  import API from '../../../api';
62
62
  import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
65
65
  export var getLeadByIdAsync = createAsyncThunk('expressConnect/getLeadByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, countryCode, data, phone;
67
67
  return __generator(this, function (_a) {
@@ -578,8 +578,8 @@ var initialState = {
578
578
  mobile: ''
579
579
  },
580
580
  nidData: {
581
- nid: '1089254054',
582
- dob: '1994-12-16'
581
+ nid: '',
582
+ dob: getEighteenYearsAgo()
583
583
  },
584
584
  civilIdData: {
585
585
  civilId: ''
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { FlowsTypes } from '../../../@types';
3
+ interface SuccessFlowButtonsProps {
4
+ brand: any;
5
+ entity: any;
6
+ business: any;
7
+ merchant: any;
8
+ bank: any;
9
+ user: any;
10
+ flows: any[];
11
+ boardInfoId: string;
12
+ boardId: string;
13
+ flowName: FlowsTypes;
14
+ }
15
+ declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName }: SuccessFlowButtonsProps) => JSX.Element>;
16
+ export default _default;
@@ -0,0 +1,112 @@
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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo, useEffect, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { FlowsButtons } from '../../shared/Button';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../hooks';
19
+ import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenString, shortenBrand } from '../../../utils';
20
+ import { settingsSelector } from '../../../app/settings';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../components/Text';
23
+ import Container from '../Containers/ScreenContainer';
24
+ import AcceptancePayouts from '../AcceptancePayouts';
25
+ var TitleStyled = styled(Text)(function (_a) {
26
+ var _b;
27
+ var theme = _a.theme;
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
29
+ });
30
+ var ContainerStyled = styled(Container)(function (_a) {
31
+ var theme = _a.theme;
32
+ return ({
33
+ justifyContent: 'space-between',
34
+ minHeight: theme.spacing(30),
35
+ alignItems: 'center'
36
+ });
37
+ });
38
+ var ButtonGroupStyled = styled(Box)(function (_a) {
39
+ var theme = _a.theme;
40
+ return ({
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
43
+ });
44
+ });
45
+ var SuccessFlowButtons = function (_a) {
46
+ var _b, _c, _d;
47
+ var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName;
48
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
49
+ var t = useTranslation().t;
50
+ var isAr = useLanguage().isAr;
51
+ var settings = useAppSelector(settingsSelector);
52
+ var _f = user || {}, names = _f.names, identification = _f.identification;
53
+ var primary_contact = (business || {}).primary_contact;
54
+ var _g = entity || {}, license = _g.license, vat_id = _g.vat_id, legal_name = _g.legal_name;
55
+ var username = isAr ? concatenateObjectValues(names.ar || names.en, ['first', 'last']) : concatenateObjectValues(names.en, ['first', 'last']);
56
+ var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
57
+ var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
58
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
+ var taxID = vat_id || '';
60
+ var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
61
+ var entityLegalName = shortenString(isAr ? legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar : legal_name === null || legal_name === void 0 ? void 0 : legal_name.en, 20) || '';
62
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var email = (primary_contact || {}).email;
66
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
67
+ var reMapFlowData = function (flows) {
68
+ if (flows === void 0) { flows = []; }
69
+ var images = ICONS_NAMES;
70
+ var mappedFlows = flows
71
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
72
+ .map(function (_a) {
73
+ var name = _a.name, url = _a.url, status = _a.status;
74
+ var type = status === 'completed' ? 'completed' : 'pending';
75
+ var title = t("".concat(name, "_flow_").concat(type), {
76
+ individual_name: username.toLowerCase() + maskedId,
77
+ brand: brandName,
78
+ business_type: entityLegalName,
79
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
80
+ bank_name: bankName,
81
+ iban: iban ? t('masking_symbols') + iban : '',
82
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
83
+ });
84
+ var isCompleted = status === 'completed' && name !== 'password';
85
+ var isIndividual = name === 'individual';
86
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
87
+ var hoverSrc = "".concat(name, "_white_icon");
88
+ return {
89
+ name: name,
90
+ status: status,
91
+ title: title,
92
+ href: url,
93
+ src: images[src],
94
+ hoverSrc: images[hoverSrc],
95
+ isCompleted: isCompleted,
96
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
97
+ };
98
+ });
99
+ setButtons(mappedFlows);
100
+ };
101
+ useEffect(function () {
102
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
103
+ reMapFlowData(flows);
104
+ }, [flows, isAr]);
105
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
106
+ flowName: flowName,
107
+ email: email || '',
108
+ emailUrl: url,
109
+ brandName: shortenBrand(brandName)
110
+ } }) })] }));
111
+ };
112
+ export default memo(SuccessFlowButtons);
@@ -0,0 +1,2 @@
1
+ import FlowsButtons from './SuccessFlowButtons';
2
+ export default FlowsButtons;
@@ -0,0 +1,2 @@
1
+ import FlowsButtons from './SuccessFlowButtons';
2
+ export default FlowsButtons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.50-test",
3
+ "version": "2.1.51-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const FlowButtons: () => JSX.Element;
3
- declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
- export default _default;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
- export var FlowButtons = function () {
4
- return _jsx("div", { children: "FlowButtons" });
5
- };
6
- export default React.memo(FlowButtons);
@@ -1,2 +0,0 @@
1
- import FlowsButtons from './FlowButtons';
2
- export default FlowsButtons;
@@ -1,2 +0,0 @@
1
- import FlowsButtons from './FlowButtons';
2
- export default FlowsButtons;