@tap-payments/auth-jsconnect 2.3.16-test → 2.3.18-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.
@@ -160,7 +160,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
160
160
  data: data,
161
161
  leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
162
162
  token: token,
163
- brandData: brandData,
163
+ brandData: (brandData === null || brandData === void 0 ? void 0 : brandData.brand) || {},
164
164
  boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
165
165
  }];
166
166
  case 19: return [2, { data: data, isRequireOTP: true, token: token }];
@@ -769,10 +769,10 @@ export var businessSlice = createSlice({
769
769
  state.customLoading = true;
770
770
  })
771
771
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
772
- var _a, _b;
772
+ var _a, _b, _c;
773
773
  state.error = null;
774
774
  state.customLoading = false;
775
- var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP;
775
+ var _d = action.payload, data = _d.data, boardId = _d.boardId, brandData = _d.brandData, leadData = _d.leadData, token = _d.token, isRequireOTP = _d.isRequireOTP;
776
776
  var responseBody = state.data.verify.responseBody;
777
777
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
778
778
  if (token)
@@ -780,8 +780,8 @@ export var businessSlice = createSlice({
780
780
  state.data.otpData.isNID = false;
781
781
  if (isRequireOTP)
782
782
  return;
783
- var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
784
- var issuingDate = (brandData === null || brandData === void 0 ? void 0 : brandData.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
783
+ var _e = state.data.verify.responseBody || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
784
+ var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date) || new Date().getTime();
785
785
  if (issuingDate)
786
786
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
787
787
  var activities = entity_activities || [];
@@ -794,11 +794,11 @@ export var businessSlice = createSlice({
794
794
  var license = (entity || {}).license;
795
795
  if (license) {
796
796
  var number_1 = license.number;
797
- var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
797
+ var _f = state.data.businessTypeData || {}, busResData = _f.responseBody, selectedLicense = _f.selectedLicense;
798
798
  var licenseList = (busResData || {}).licenseList;
799
799
  var selectedLicenseData = selectedLicense;
800
800
  if (number_1) {
801
- var findLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
801
+ var findLicense = (_c = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _c === void 0 ? void 0 : _c.call(licenseList, function (_a) {
802
802
  var license = _a.license;
803
803
  return (license === null || license === void 0 ? void 0 : license.number) === number_1;
804
804
  });
@@ -840,15 +840,15 @@ export var businessSlice = createSlice({
840
840
  state.error = null;
841
841
  })
842
842
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
843
- var _a, _b;
843
+ var _a, _b, _c;
844
844
  state.loading = false;
845
845
  state.error = null;
846
- var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
846
+ var _d = action.payload, data = _d.data, formData = _d.formData, brand = _d.brand, leadData = _d.leadData;
847
847
  state.data.otpData = formData;
848
848
  state.data.otpData.responseBody = data;
849
849
  state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
850
- var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
851
- var issuingDate = (brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at) || ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date) || new Date().getTime();
850
+ var _e = leadData || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
851
+ var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date) || new Date().getTime();
852
852
  if (issuingDate)
853
853
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
854
854
  var activities = entity_activities || [];
@@ -861,11 +861,11 @@ export var businessSlice = createSlice({
861
861
  var license = (entity || {}).license;
862
862
  if (license) {
863
863
  var number_2 = license.number;
864
- var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
864
+ var _f = state.data.businessTypeData || {}, busResData = _f.responseBody, selectedLicense = _f.selectedLicense;
865
865
  var licenseList = (busResData || {}).licenseList;
866
866
  var selectedLicenseData = selectedLicense;
867
867
  if (number_2) {
868
- var findLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
868
+ var findLicense = (_c = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _c === void 0 ? void 0 : _c.call(licenseList, function (_a) {
869
869
  var license = _a.license;
870
870
  return (license === null || license === void 0 ? void 0 : license.number) === number_2;
871
871
  });
@@ -71,7 +71,7 @@ import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } from '../../../utils';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } 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 () {
@@ -191,7 +191,12 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
191
191
  return __awaiter(void 0, void 0, void 0, function () {
192
192
  return __generator(this, function (_b) {
193
193
  switch (_b.label) {
194
- case 0: return [4, thunkApi.dispatch(verifyToken({ token: token, isInternally: isInternally }))];
194
+ case 0: return [4, thunkApi
195
+ .dispatch(verifyToken({ token: token, isInternally: isInternally }))
196
+ .unwrap()
197
+ .catch(function (err) {
198
+ throw new Error(err.message);
199
+ })];
195
200
  case 1:
196
201
  _b.sent();
197
202
  return [2];
@@ -816,7 +821,7 @@ var initialState = {
816
821
  nid: '',
817
822
  issuedCountry: undefined,
818
823
  expiryDate: '',
819
- dob: getEighteenYearsAgo(),
824
+ dob: '',
820
825
  placeOfBirthCountry: undefined,
821
826
  placeOfBirthCity: undefined,
822
827
  nationality: undefined
@@ -130,7 +130,7 @@ var BrandName = function (_a) {
130
130
  var _a, _b, _c;
131
131
  var isValid = brandNameValue && !error && brandNameValue.length > 2;
132
132
  var brand = (_c = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.en;
133
- if (isValid && (brandNameValue === null || brandNameValue === void 0 ? void 0 : brandNameValue.toLowerCase()) != brand) {
133
+ if (isValid && brandNameValue !== brand) {
134
134
  fetchingBrandName(true);
135
135
  checkBrand(brandNameValue);
136
136
  }
@@ -124,13 +124,12 @@ var BrandName = function (_a) {
124
124
  brandControl.field.onChange(target.value);
125
125
  };
126
126
  React.useEffect(function () {
127
- var _a, _b, _c;
128
127
  var brandList = (data.brandData.responseBody || {}).brand_list;
129
128
  var brandListItem = getValues('selectedBrandItem');
130
129
  var isOtherBrand = (brandList || []).length > 0 ? (brandListItem === null || brandListItem === void 0 ? void 0 : brandListItem.id) === 'other' : true;
131
130
  var isValid = brandNameValue && !error && brandNameValue.length > 2;
132
- var brand = (_c = (_b = (_a = data.otpData.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.en;
133
- if (isValid && (brandNameValue === null || brandNameValue === void 0 ? void 0 : brandNameValue.toLowerCase()) != brand && isOtherBrand) {
131
+ var brandName = data.brandData.brandName;
132
+ if (isValid && brandNameValue != brandName && isOtherBrand) {
134
133
  fetchingBrandName(true);
135
134
  checkBrand(brandNameValue);
136
135
  }
@@ -127,7 +127,7 @@ var BrandName = function (_a) {
127
127
  var _a, _b, _c, _d;
128
128
  var isValid = brandNameValue && !error && brandNameValue.length > 2;
129
129
  var brand = (_d = (_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.leadData) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.en;
130
- if (isValid && (brandNameValue === null || brandNameValue === void 0 ? void 0 : brandNameValue.toLowerCase()) != brand) {
130
+ if (isValid && brandNameValue != brand) {
131
131
  fetchingBrandName(true);
132
132
  checkBrand(brandNameValue);
133
133
  }
@@ -41,6 +41,6 @@ var BOD = function (_a) {
41
41
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
42
42
  var spacing = _a.spacing;
43
43
  return spacing(2.5, 2.5, 2.5, 2.5);
44
- } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
44
+ } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : undefined, dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
45
45
  };
46
46
  export default React.memo(BOD);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.16-test",
3
+ "version": "2.3.18-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",