@tap-payments/auth-jsconnect 2.4.0-test → 2.4.3-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.
@@ -135,10 +135,10 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
135
135
  return [4, thunkApi.dispatch(retrieveDataList())];
136
136
  case 11:
137
137
  _b.sent();
138
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
139
138
  return [4, API.brandService.retrieveBrand(brandID)];
140
139
  case 12:
141
140
  brandData = _b.sent();
141
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
142
142
  return [3, 19];
143
143
  case 13:
144
144
  if (!hasBusinessCRInfoCompleted) return [3, 15];
@@ -162,7 +162,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
162
162
  data: data,
163
163
  leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
164
164
  token: token,
165
- brandData: (brandData === null || brandData === void 0 ? void 0 : brandData.brand) || {},
165
+ brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
166
166
  boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
167
167
  }];
168
168
  case 20: return [2, { data: data, isRequireOTP: true, token: token }];
@@ -278,10 +278,10 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
278
278
  return [4, thunkApi.dispatch(retrieveDataList())];
279
279
  case 17:
280
280
  _j.sent();
281
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
282
281
  return [4, API.brandService.retrieveBrand(brandID)];
283
282
  case 18:
284
283
  brandData = _j.sent();
284
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
285
285
  return [3, 22];
286
286
  case 19:
287
287
  if (!hasBusinessCRInfoCompleted) return [3, 21];
@@ -1093,6 +1093,14 @@ export var businessSlice = createSlice({
1093
1093
  state.error = null;
1094
1094
  var _a = action.payload, data = _a.data, formData = _a.formData;
1095
1095
  state.data.activitiesData = formData;
1096
+ var terms = (data || {}).terms;
1097
+ terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
1098
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
1099
+ state.data.customersData.transactionPolicy = element.agree;
1100
+ state.data.customersData.refundPolicy = element.agree;
1101
+ }
1102
+ });
1103
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { brand: data });
1096
1104
  state.data.activitiesData.responseBody = __assign(__assign({}, data), state.data.activitiesData.responseBody);
1097
1105
  })
1098
1106
  .addCase(updateActivitiesInfo.rejected, function (state, action) {
@@ -456,6 +456,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
456
456
  brandReqBody_1 = {
457
457
  id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
458
458
  channel_services: channel_services,
459
+ term: ['general'],
459
460
  segment: { type: { id: ((_b = params.segment) === null || _b === void 0 ? void 0 : _b.id) || '' }, team: { id: ((_c = params.teamSize) === null || _c === void 0 ? void 0 : _c.id) || '' } },
460
461
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
461
462
  };
@@ -63,7 +63,7 @@ import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../..
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
- import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency } from '../../../utils';
66
+ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../utils';
67
67
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
68
  var token = _a.token, isInternally = _a.isInternally;
69
69
  return __awaiter(void 0, void 0, void 0, function () {
@@ -366,10 +366,10 @@ export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', f
366
366
  return ({ id: id, action: 'add' });
367
367
  });
368
368
  payload = __assign({ id: id, activities: isActivitiesNonEditable || (activityIds === null || activityIds === void 0 ? void 0 : activityIds.length) === 0 ? undefined : activityIds }, (!isCapitalNonEditable && {
369
- capital: __assign({ paid: isCapitalPaidNonEditable ? undefined : capitalPaid }, (!((isCapitalShareCountNonEditable && isCapitalShareValueNonEditable) || !hasCapitalShares) && {
369
+ capital: __assign({ paid: isCapitalPaidNonEditable ? undefined : removeAllCharsFromNumber(capitalPaid) }, (!((isCapitalShareCountNonEditable && isCapitalShareValueNonEditable) || !hasCapitalShares) && {
370
370
  shares: {
371
371
  count: isCapitalShareCountNonEditable ? undefined : capitalShareCount,
372
- value: isCapitalShareValueNonEditable ? undefined : capitalShareValue
372
+ value: isCapitalShareValueNonEditable ? undefined : removeAllCharsFromNumber(capitalShareValue)
373
373
  }
374
374
  }))
375
375
  }));
@@ -71,7 +71,7 @@ import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency } from '../../../utils';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
@@ -666,7 +666,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
666
666
  shares: isSharesAvailable
667
667
  ? {
668
668
  count: shareCount && Number(shareCount),
669
- value: shareValue && Number(shareValue)
669
+ value: shareValue && Number(removeAllCharsFromNumber(shareValue))
670
670
  }
671
671
  : undefined
672
672
  };
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import Box from '@mui/material/Box/Box';
25
14
  import { styled } from '@mui/material/styles';
@@ -52,16 +41,38 @@ var ListType;
52
41
  ListType["ExpectedSalesList"] = "ExpectedSalesList";
53
42
  })(ListType || (ListType = {}));
54
43
  var Customers = function (_a) {
55
- var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
44
+ var _b, _c;
45
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
56
46
  var dispatch = useAppDispatch();
57
- var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
58
- var _d = data.customersData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
47
+ var _e = useAppSelector(businessSelector), data = _e.data, loading = _e.loading, error = _e.error;
48
+ var _f = data.customersData, customerLocations = _f.customerLocations, expectedCustomer = _f.expectedCustomer, expectedSale = _f.expectedSale, refundPolicy = _f.refundPolicy, transactionPolicy = _f.transactionPolicy;
49
+ var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
59
50
  var methods = useForm({
60
51
  resolver: yupResolver(CustomerInfoValidation),
61
- defaultValues: defaultValues,
52
+ defaultValues: {
53
+ customerLocations: customerLocations,
54
+ expectedCustomer: expectedCustomer,
55
+ expectedSale: expectedSale,
56
+ refundPolicy: refundPolicy,
57
+ transactionPolicy: transactionPolicy
58
+ },
62
59
  mode: 'onChange'
63
60
  });
64
- useSetFromDefaultValues(methods, defaultValues);
61
+ useSetFromDefaultValues(methods, data.customersData);
62
+ React.useEffect(function () {
63
+ var _a, _b;
64
+ var isTermsAgreed = !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
65
+ var term = _a.term;
66
+ return term === 'general';
67
+ })) === null || _b === void 0 ? void 0 : _b.agree);
68
+ if (isTermsAgreed) {
69
+ var getValues = methods.getValues, setValue = methods.setValue;
70
+ if (!getValues('refundPolicy'))
71
+ setValue('refundPolicy', true, { shouldValidate: true });
72
+ if (!getValues('transactionPolicy'))
73
+ setValue('transactionPolicy', true, { shouldValidate: true });
74
+ }
75
+ }, [terms]);
65
76
  var onSubmit = function (data) {
66
77
  dispatch(updateCustomersInfo(data));
67
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.0-test",
3
+ "version": "2.4.3-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",