@tap-payments/auth-jsconnect 2.3.92-test → 2.3.94-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.
@@ -3,6 +3,7 @@ export declare type UpdateBoardBody = {
3
3
  infoId?: string;
4
4
  step_name: string;
5
5
  lang: string;
6
+ object_id?: string;
6
7
  encryption_contract?: string;
7
8
  };
8
9
  export declare type RetrieveBoardInfoBody = {
@@ -49,9 +49,11 @@ export declare const ICONS_NAMES: {
49
49
  WHITE_ARROW: string;
50
50
  BLACK_ARROW: string;
51
51
  BLUE_ARROW: string;
52
+ GREEN_ARROW: string;
52
53
  REQUEST_EMAIL: string;
53
54
  REQUEST_EMAIL_GREEN: string;
54
55
  ADD_DETAIL: string;
56
+ ADD_DETAIL_GREEN: string;
55
57
  SUCCESS: string;
56
58
  UNFINISHED: string;
57
59
  ABSHER_LOGO: string;
@@ -49,9 +49,11 @@ export var ICONS_NAMES = {
49
49
  WHITE_ARROW: 'https://tap-connecet.b-cdn.net/imgs/whiteArrow.svg',
50
50
  BLACK_ARROW: 'https://dash.b-cdn.net/icons/menu/arrow_right_icon.svg',
51
51
  BLUE_ARROW: 'https://dash.b-cdn.net/icons/menu/blue_arrow_next.svg',
52
+ GREEN_ARROW: 'https://dash.b-cdn.net/icons/menu/green_arrow_next.svg',
52
53
  REQUEST_EMAIL: 'https://dash.b-cdn.net/icons/menu/request_email.svg',
53
54
  REQUEST_EMAIL_GREEN: 'https://dash.b-cdn.net/icons/menu/request_email_green.svg',
54
55
  ADD_DETAIL: 'https://dash.b-cdn.net/icons/menu/add_detail.svg',
56
+ ADD_DETAIL_GREEN: 'https://dash.b-cdn.net/icons/menu/add_detail_green.svg',
55
57
  SUCCESS: 'https://dash.b-cdn.net/icons/menu/image.png',
56
58
  UNFINISHED: 'https://dash.b-cdn.net/icons/menu/not-finished.png',
57
59
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
@@ -763,31 +763,34 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
763
763
  });
764
764
  });
765
765
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
766
- var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
767
- var _c, _d, _e, _f;
768
- return __generator(this, function (_g) {
769
- switch (_g.label) {
766
+ var _a, settings, individual, _b, id, infoId, _c, notification, user, userId, payload, data, boardInfoStatus;
767
+ var _d, _e, _f, _g;
768
+ return __generator(this, function (_h) {
769
+ switch (_h.label) {
770
770
  case 0:
771
771
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
772
772
  _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
773
+ _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
774
+ userId = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
773
775
  if (!id)
774
776
  return [2];
775
777
  payload = {
776
778
  lang: settings.data.language,
779
+ object_id: userId,
777
780
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
778
781
  id: id
779
782
  };
780
783
  return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
781
784
  case 1:
782
- data = _g.sent();
785
+ data = _h.sent();
783
786
  return [4, API.boardService.retrieveBoardInfoStatus(id)];
784
787
  case 2:
785
- boardInfoStatus = _g.sent();
788
+ boardInfoStatus = _h.sent();
786
789
  return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
787
790
  case 3:
788
- _g.sent();
789
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
790
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
791
+ _h.sent();
792
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
793
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
791
794
  thunkApi.dispatch(handleNextScreenStep());
792
795
  return [2, { response: __assign(__assign({}, data), { flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [] }), formData: params }];
793
796
  }
@@ -88,7 +88,7 @@ var UserList = function (_a) {
88
88
  var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
89
89
  var is_available = (responseBody || {}).is_available;
90
90
  var verify = data.verify;
91
- var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification;
91
+ var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification, flows = _m.flows;
92
92
  var methods = useForm({
93
93
  resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
94
94
  defaultValues: {
@@ -160,6 +160,15 @@ var UserList = function (_a) {
160
160
  var _a;
161
161
  return (user === null || user === void 0 ? void 0 : user.id) === ((_a = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _a === void 0 ? void 0 : _a.id);
162
162
  };
163
+ var isUserCompleted = function (user) {
164
+ var _a;
165
+ var status = (flows || []).find(function (_a) {
166
+ var name = _a.name;
167
+ return name === 'individual';
168
+ });
169
+ var isCompleted = ((_a = status === null || status === void 0 ? void 0 : status.object_status) === null || _a === void 0 ? void 0 : _a[user.id]) === 'completed';
170
+ return isCompleted;
171
+ };
163
172
  var isPhoneAndEmailAvailable = function (user) {
164
173
  var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
165
174
  return !!(isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number));
@@ -186,6 +195,7 @@ var UserList = function (_a) {
186
195
  return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
187
196
  cursor: emailChecking ? 'default' : 'pointer'
188
197
  }, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [_jsx("span", { children: getName(user) || '' }), _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(IndividualActionButtons, { isAr: isAr, addDetails: {
198
+ isCompleted: isUserCompleted(user),
189
199
  title: t('add_details'),
190
200
  onClick: onAddDetails,
191
201
  loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
@@ -13,7 +13,9 @@ interface IndividualActionButtonsProps extends ButtonProps {
13
13
  show: boolean;
14
14
  children?: React.ReactNode;
15
15
  };
16
- addDetails: buttonProps;
16
+ addDetails: buttonProps & {
17
+ isCompleted: boolean;
18
+ };
17
19
  }
18
20
  export default function IndividualActionButtons({ isAr, requestEmail, addDetails }: IndividualActionButtonsProps): JSX.Element;
19
21
  export {};
@@ -81,6 +81,29 @@ var LoaderStyled = styled(Loader)(function (_a) {
81
81
  height: theme.spacing(3.75)
82
82
  });
83
83
  });
84
+ var AddDetailsButtonStyled = styled(ButtonStyled, {
85
+ shouldForwardProp: function (prop) { return prop !== 'isCompleted'; }
86
+ })(function (_a) {
87
+ var theme = _a.theme, isCompleted = _a.isCompleted;
88
+ return (__assign({}, (isCompleted && {
89
+ '&.MuiButton-outlined': {
90
+ backgroundColor: theme.palette.common.white,
91
+ border: "1px solid ".concat(theme.palette.success.main),
92
+ color: theme.palette.success.main,
93
+ '&:hover': {
94
+ cursor: 'pointer',
95
+ backgroundColor: theme.palette.success.main,
96
+ color: theme.palette.common.white,
97
+ img: {
98
+ filter: 'brightness(0) invert(1)'
99
+ },
100
+ svg: {
101
+ filter: 'brightness(0) invert(1)'
102
+ }
103
+ }
104
+ }
105
+ })));
106
+ });
84
107
  var RequestEmailButtonStyled = styled(ButtonStyled, {
85
108
  shouldForwardProp: function (prop) { return prop !== 'isRequested' && prop !== 'disabled'; }
86
109
  })(function (_a) {
@@ -128,5 +151,5 @@ export default function IndividualActionButtons(_a) {
128
151
  var theme = useTheme();
129
152
  var isRequestedAndNotLoading = requestEmail.isRequested && !requestEmail.loading;
130
153
  var requestEmailLoaderColor = isRequestedAndNotLoading ? theme.palette.success.main : theme.palette.primary.main;
131
- return (_jsxs(ButtonBoxStyled, { children: [_jsxs(ButtonStyled, __assign({ isLoading: addDetails.loading, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(LoaderStyled, { innerColor: theme.palette.primary.main, outerColor: theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.show && (_jsxs(_Fragment, { children: [requestEmail.children, _jsxs(RequestEmailButtonStyled, __assign({ isRequested: requestEmail.isRequested, isLoading: requestEmail.loading, variant: 'outlined', disabled: requestEmail.disabled, type: 'button', onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: isRequestedAndNotLoading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: isRequestedAndNotLoading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(LoaderStyled, { innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))] }))] }));
154
+ return (_jsxs(ButtonBoxStyled, { children: [_jsxs(AddDetailsButtonStyled, __assign({ isCompleted: addDetails.isCompleted, isLoading: addDetails.loading, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: addDetails.isCompleted ? ICONS_NAMES.ADD_DETAIL_GREEN : ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(ArrowIconStyled, { isAr: isAr, src: addDetails.isCompleted ? ICONS_NAMES.GREEN_ARROW : ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(LoaderStyled, { innerColor: addDetails.isCompleted ? theme.palette.success.main : theme.palette.primary.main, outerColor: addDetails.isCompleted ? theme.palette.success.main : theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.show && (_jsxs(_Fragment, { children: [requestEmail.children, _jsxs(RequestEmailButtonStyled, __assign({ isRequested: requestEmail.isRequested, isLoading: requestEmail.loading, variant: 'outlined', disabled: requestEmail.disabled, type: 'button', onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: isRequestedAndNotLoading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: isRequestedAndNotLoading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(LoaderStyled, { innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))] }))] }));
132
155
  }
@@ -71,6 +71,7 @@ var SuccessFlowButtons = function (_a) {
71
71
  var mappedFlows = flows
72
72
  .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
73
73
  .map(function (_a) {
74
+ var _b;
74
75
  var name = _a.name, url = _a.url, status = _a.status, token = _a.token;
75
76
  var type = status === 'completed' ? 'completed' : 'pending';
76
77
  var title = t("".concat(name, "_flow_").concat(type), {
@@ -82,8 +83,14 @@ var SuccessFlowButtons = function (_a) {
82
83
  iban: iban ? t('masking_symbols') + iban : '',
83
84
  tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
84
85
  });
85
- var isCompleted = status === 'completed' && name !== 'password';
86
+ var individualStatus = ((_b = (flows || []).find(function (_a) {
87
+ var name = _a.name;
88
+ return name === 'individual';
89
+ })) === null || _b === void 0 ? void 0 : _b.object_status) || {};
90
+ var isIndividualAllCompleted = Object.keys(individualStatus).length === count;
91
+ var isIndividualCompleted = is_authorized && count > 1 ? isIndividualAllCompleted : status === 'completed';
86
92
  var isIndividual = name === 'individual';
93
+ var isCompleted = isIndividual ? isIndividualCompleted : status === 'completed' && name !== 'password';
87
94
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
88
95
  var hoverSrc = "".concat(name, "_white_icon");
89
96
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.92-test",
3
+ "version": "2.3.94-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -11,7 +11,7 @@
11
11
  "README.md"
12
12
  ],
13
13
  "scripts": {
14
- "preinstall": "npx husky install",
14
+ "prepare": "npx husky install",
15
15
  "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
16
  "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
17
  "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
@@ -21,7 +21,7 @@
21
21
  "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
22
  "tsc:alias": "tsc-alias -p tsconfig.json",
23
23
  "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public"
24
+ "push": "npm publish --access public --tag test"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {