@tap-payments/auth-jsconnect 2.1.98-test → 2.1.99-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.
@@ -176,6 +176,7 @@ interface LibCallbacks {
176
176
  onStepStarted?: (name: string) => void;
177
177
  onBoardButtonClick?: (data: Record<string, any>) => void;
178
178
  onCreated?: (res: Record<string, any>) => void;
179
+ onBoardCompleted?: () => void;
179
180
  }
180
181
  export interface LibConfig extends LibCallbacks {
181
182
  publicKey: string;
@@ -4193,9 +4193,8 @@ export declare const LottieAnimationFiles: {
4193
4193
  markers: never[];
4194
4194
  };
4195
4195
  };
4196
- export declare type LottieAnimationFiles = typeof LottieAnimationFiles[keyof typeof LottieAnimationFiles];
4197
4196
  interface LottieFileProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
4198
- file: LottieAnimationFiles;
4197
+ file: (typeof LottieAnimationFiles)[keyof typeof LottieAnimationFiles];
4199
4198
  width?: number | string;
4200
4199
  height?: number | string;
4201
4200
  loop?: boolean;
@@ -58,7 +58,7 @@ var LottieFile = function (_a) {
58
58
  return (_jsx(_Fragment, { children: _jsx("div", __assign({ ref: lottieContainer, style: {
59
59
  width: width || '100%',
60
60
  height: height || '100%'
61
- }, className: "".concat(props.className ? props.className : '') }, props)) }));
61
+ }, className: "".concat(props.className || '') }, props)) }));
62
62
  };
63
63
  LottieFile.defaultProps = {
64
64
  file: LottieAnimationFiles.start_loading
@@ -1,3 +1,3 @@
1
- import LottieFile from './Lottie';
1
+ import LottieFile, { LottieAnimationFiles } from './Lottie';
2
+ export { LottieAnimationFiles };
2
3
  export default LottieFile;
3
- export { LottieAnimationFiles } from './Lottie';
@@ -1,3 +1,3 @@
1
- import LottieFile from './Lottie';
1
+ import LottieFile, { LottieAnimationFiles } from './Lottie';
2
+ export { LottieAnimationFiles };
2
3
  export default LottieFile;
3
- export { LottieAnimationFiles } from './Lottie';
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { FieldType, FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BRAND_STEP_NAMES } from '../../../constants';
54
- import { isKW, isSA, isTwitter, isWebsite, sleep } from '../../../utils';
54
+ import { isKW, isTwitter, isWebsite, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -610,23 +610,13 @@ export var brandSlice = createSlice({
610
610
  state.error = null;
611
611
  })
612
612
  .addCase(retrieveDataList.fulfilled, function (state, action) {
613
- var _a, _b;
614
613
  state.loading = false;
615
614
  state.error = null;
616
- var _c = action.payload, customerBases = _c.customerBases, expectedSales = _c.expectedSales, expectedCustomerSales = _c.expectedCustomerSales, countryISO2 = _c.countryISO2;
617
- var regional = customerBases.at(1);
615
+ var _a = action.payload, customerBases = _a.customerBases, expectedSales = _a.expectedSales, expectedCustomerSales = _a.expectedCustomerSales, countryISO2 = _a.countryISO2;
618
616
  var local = customerBases.at(0);
619
- var expectedSale = (_b = (_a = expectedSales.at(0)) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b.at(4);
620
- var expectedCustomerSale = expectedCustomerSales.at(3);
621
617
  state.data.brandActivities.responseBody = __assign(__assign({}, state.data.brandActivities.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
622
618
  if (local && isKW(countryISO2))
623
619
  state.data.brandActivities.customerLocations = [local];
624
- if (regional && local && isSA(countryISO2))
625
- state.data.brandActivities.customerLocations = [regional, local];
626
- if (!!expectedSale)
627
- state.data.brandActivities.expectedSale = expectedSale;
628
- if (!!expectedCustomerSale)
629
- state.data.brandActivities.expectedCustomer = expectedCustomerSale;
630
620
  })
631
621
  .addCase(retrieveDataList.rejected, function (state, action) {
632
622
  state.loading = false;
@@ -382,10 +382,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
382
382
  });
383
383
  }); });
384
384
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
385
- var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, payload_2, info, hasIndividualCompleted, birthCountry;
386
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
387
- return __generator(this, function (_p) {
388
- switch (_p.label) {
385
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, notification, _c, id, type, payload_2, info, hasIndividualCompleted, birthCountry;
386
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
387
+ return __generator(this, function (_q) {
388
+ switch (_q.label) {
389
389
  case 0:
390
390
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
391
391
  responseBody = individual.data.verify.responseBody;
@@ -400,76 +400,83 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
400
400
  };
401
401
  return [4, API.leadService.verifyLeadOTP(payload)];
402
402
  case 1:
403
- data = (_p.sent()).data;
403
+ data = (_q.sent()).data;
404
404
  boardInfoStatus = undefined;
405
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 14];
406
- if (!board_id) return [3, 4];
407
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
408
- case 2:
409
- boardInfoStatus = _p.sent();
405
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
406
+ throw new Error(data.errors[0].description);
407
+ if (!board_id) return [3, 3];
410
408
  return [4, API.boardService.retrieveBoardDetails(board_id)];
409
+ case 2:
410
+ boardData = _q.sent();
411
+ _q.label = 3;
411
412
  case 3:
412
- boardData = _p.sent();
413
- _p.label = 4;
414
- case 4:
415
- countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
416
- if (!(board_id && board_info_id)) return [3, 7];
413
+ countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
414
+ if (!(board_id && board_info_id)) return [3, 6];
417
415
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
418
- case 5:
419
- boardInfoData = _p.sent();
416
+ case 4:
417
+ boardInfoData = _q.sent();
420
418
  notification = (boardInfoData || {}).notification;
421
419
  _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
422
- if (!(id && type)) return [3, 7];
420
+ if (!(id && type)) return [3, 6];
423
421
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
424
- case 6:
425
- payload_2 = (_p.sent()).payload;
422
+ case 5:
423
+ payload_2 = (_q.sent()).payload;
426
424
  individualData = payload_2.data || {};
427
- _p.label = 7;
425
+ _q.label = 6;
426
+ case 6:
427
+ if (countryCode)
428
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
429
+ if (!board_id) return [3, 8];
430
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
428
431
  case 7:
432
+ boardInfoStatus = _q.sent();
433
+ _q.label = 8;
434
+ case 8:
429
435
  info = (boardInfoStatus || {}).info;
430
- hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
431
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
432
- if (!hasIndividualCompleted) return [3, 8];
436
+ hasIndividualCompleted = ((_g = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _g === void 0 ? void 0 : _g.status) === 'completed';
437
+ if (!hasIndividualCompleted) return [3, 9];
433
438
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
434
- return [3, 14];
435
- case 8:
436
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
437
- if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 10];
438
- return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
439
+ return [3, 15];
439
440
  case 9:
440
- _p.sent();
441
- _p.label = 10;
441
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 12];
442
+ if (!((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)) return [3, 11];
443
+ return [4, thunkApi.dispatch(getIndividualList((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id))];
442
444
  case 10:
443
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
444
- return [3, 14];
445
+ _q.sent();
446
+ _q.label = 11;
445
447
  case 11:
446
- birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
447
- if (!birthCountry) return [3, 13];
448
- return [4, thunkApi.dispatch(getCityList(birthCountry))];
448
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
449
+ return [3, 15];
449
450
  case 12:
450
- _p.sent();
451
- _p.label = 13;
451
+ birthCountry = ((_k = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _k === void 0 ? void 0 : _k.country) || countryCode;
452
+ if (!birthCountry) return [3, 14];
453
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
452
454
  case 13:
455
+ _q.sent();
456
+ _q.label = 14;
457
+ case 14:
453
458
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
454
- _p.label = 14;
455
- case 14: return [2, {
456
- data: data,
457
- boardResponse: {
458
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
459
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
460
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
461
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
462
- merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
463
- name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
464
- contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
465
- individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
466
- countries: countries,
467
- countryCode: countryCode,
468
- notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
469
- flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
470
- },
471
- formData: __assign({}, params)
472
- }];
459
+ _q.label = 15;
460
+ case 15:
461
+ (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
462
+ return [2, {
463
+ data: data,
464
+ boardResponse: {
465
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
466
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
467
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
468
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
469
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
470
+ name: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.names,
471
+ contact: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.contact,
472
+ individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
473
+ countries: countries,
474
+ countryCode: countryCode,
475
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
476
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
477
+ },
478
+ formData: __assign({}, params)
479
+ }];
473
480
  }
474
481
  });
475
482
  }); });
@@ -57,7 +57,7 @@ var TextBoxStyled = styled(Box)(function (_a) {
57
57
  });
58
58
  var TextStyled = styled(Box)(function (_a) {
59
59
  var theme = _a.theme;
60
- return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
60
+ return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default, display: 'inline-flex' }));
61
61
  });
62
62
  var RoleTextStyled = styled(Text)(function (_a) {
63
63
  var theme = _a.theme;
@@ -181,7 +181,7 @@ var UserList = function (_a) {
181
181
  return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
182
182
  return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
183
183
  cursor: emailChecking ? 'default' : 'pointer'
184
- }, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { 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(ListButton, { isAr: isAr, addDetails: {
184
+ }, 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(ListButton, { isAr: isAr, addDetails: {
185
185
  title: t('add_details'),
186
186
  onClick: onAddDetails,
187
187
  loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
@@ -100,9 +100,19 @@ var SuccessFlowButtons = function (_a) {
100
100
  });
101
101
  setButtons(mappedFlows);
102
102
  };
103
+ var checkIfFlowsAreCompletedExceptPassword = function (data) {
104
+ var isFlowsCompleted = data.every(function (flow) { return flow.status === 'completed' && flow.name !== 'password'; });
105
+ return isFlowsCompleted;
106
+ };
103
107
  useEffect(function () {
104
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
108
+ var _a, _b;
109
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
105
110
  reMapFlowData(flows);
111
+ var isFlowsCompleted = checkIfFlowsAreCompletedExceptPassword(flows);
112
+ if (isFlowsCompleted) {
113
+ (_b = (_a = settings.data.appConfig).onBoardCompleted) === null || _b === void 0 ? void 0 : _b.call(_a);
114
+ }
115
+ }
106
116
  }, [flows, isAr]);
107
117
  return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
108
118
  flowName: flowName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.98-test",
3
+ "version": "2.1.99-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",