@tap-payments/auth-jsconnect 2.0.112-test → 2.0.113-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 @@ export declare type UpdateEntityBody = {
61
61
  additional_info?: {
62
62
  unified_number: string;
63
63
  };
64
- issuing_date: number;
64
+ issuing_date?: number;
65
65
  expiry_date?: string;
66
66
  };
67
67
  activities?: Array<{
@@ -52,7 +52,7 @@ export declare type UpdateBrandBody = {
52
52
  };
53
53
  };
54
54
  term?: Array<string>;
55
- step_name: string;
55
+ step_name?: string;
56
56
  encryption_contract?: Array<string>;
57
57
  };
58
58
  export declare type UpdateSalesChannels = {
@@ -216,31 +216,16 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
216
216
  });
217
217
  }); });
218
218
  export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
219
- var _a, settings, entity, id, documentData, articleId, payload, documentBody, data;
220
- var _b, _c, _d, _e, _f;
221
- return __generator(this, function (_g) {
222
- switch (_g.label) {
219
+ var _a, settings, entity, id, brandId, documentData, articleId, documentBody, requestBody, brandData, payload, data;
220
+ var _b, _c, _d, _e, _f, _g, _h;
221
+ return __generator(this, function (_j) {
222
+ switch (_j.label) {
223
223
  case 0:
224
224
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
225
225
  id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
226
+ brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
226
227
  documentData = undefined;
227
228
  articleId = entity.data.entityData.articleId;
228
- payload = {
229
- id: id,
230
- activities: (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
231
- var id = _a.id;
232
- return ({ id: id, action: 'add' });
233
- }),
234
- license: {
235
- issuing_date: moment(params.operationStartDate).format('x'),
236
- number: params.licenseNumber
237
- },
238
- legal_name: {
239
- ar: params.licenseName,
240
- en: params.licenseName
241
- },
242
- encryption_contract: ['license.issuing_date', 'license.number', 'legal_name.ar', 'legal_name.en']
243
- };
244
229
  if (!articleId) return [3, 2];
245
230
  documentBody = {
246
231
  entity_id: id || '',
@@ -252,14 +237,40 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
252
237
  };
253
238
  return [4, API.entityService.updateDocumentInfo(documentBody)];
254
239
  case 1:
255
- documentData = _g.sent();
256
- _g.label = 2;
257
- case 2: return [4, API.entityService.updateEntity(payload)];
240
+ documentData = _j.sent();
241
+ _j.label = 2;
242
+ case 2:
243
+ requestBody = {
244
+ id: brandId,
245
+ activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
246
+ var id = _a.id;
247
+ return ({ id: id });
248
+ }),
249
+ operations: {
250
+ start_date: params.operationStartDate
251
+ },
252
+ encryption_contract: ['operations.start_date']
253
+ };
254
+ return [4, API.brandService.updateBrandInfo(requestBody)];
258
255
  case 3:
259
- data = _g.sent();
256
+ brandData = (_j.sent()).data;
257
+ payload = {
258
+ id: id,
259
+ license: {
260
+ number: params.licenseNumber
261
+ },
262
+ legal_name: {
263
+ ar: params.licenseName,
264
+ en: params.licenseName
265
+ },
266
+ encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en']
267
+ };
268
+ return [4, API.entityService.updateEntity(payload)];
269
+ case 4:
270
+ data = _j.sent();
260
271
  thunkApi.dispatch(handleNextScreenStep());
261
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
262
- return [2, { data: __assign(__assign({}, data), documentData), formData: params }];
272
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
273
+ return [2, { data: __assign(__assign(__assign({}, data), brandData), documentData), formData: params }];
263
274
  }
264
275
  });
265
276
  }); });
@@ -333,7 +344,7 @@ var initialState = {
333
344
  licenseName: '',
334
345
  licenseNumber: '',
335
346
  activities: [],
336
- operationStartDate: new Date().toString(),
347
+ operationStartDate: '',
337
348
  uploading: false
338
349
  }
339
350
  }
@@ -371,12 +382,14 @@ export var entitySlice = createSlice({
371
382
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
372
383
  state.data.verify.token = token;
373
384
  var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
374
- var issuingDate = ((_b = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _b === void 0 ? void 0 : _b.start_date) || ((_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date);
375
- var licenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
376
- if (issuingDate) {
377
- var date = new Date(issuingDate);
385
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
386
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
387
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
388
+ var issuingDate = undefined;
389
+ if (entityDate) {
390
+ var date = new Date(entityDate);
378
391
  var formattedDate = moment(date).format('YYYY-MM-DD');
379
- state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
392
+ issuingDate = convertNumbers2English(formattedDate);
380
393
  }
381
394
  if (licenseNumber)
382
395
  state.data.entityData.licenseNumber = licenseNumber;
@@ -385,8 +398,7 @@ export var entitySlice = createSlice({
385
398
  var _a;
386
399
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
387
400
  });
388
- state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
389
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]] });
401
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]], operationStartDate: startDate || issuingDate });
390
402
  })
391
403
  .addCase(verifyLeadToken.rejected, function (state, action) {
392
404
  state.error = action.error.message;
@@ -427,12 +439,14 @@ export var entitySlice = createSlice({
427
439
  state.data.otpData.responseBody = data;
428
440
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
429
441
  var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
430
- var issuingDate = ((_b = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _b === void 0 ? void 0 : _b.start_date) || ((_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date);
431
- var licenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
432
- if (issuingDate) {
433
- var date = new Date(issuingDate);
442
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
443
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
444
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
445
+ var issuingDate = undefined;
446
+ if (entityDate) {
447
+ var date = new Date(entityDate);
434
448
  var formattedDate = moment(date).format('YYYY-MM-DD');
435
- state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
449
+ issuingDate = convertNumbers2English(formattedDate);
436
450
  }
437
451
  if (licenseNumber)
438
452
  state.data.entityData.licenseNumber = licenseNumber;
@@ -441,8 +455,7 @@ export var entitySlice = createSlice({
441
455
  var _a;
442
456
  return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
443
457
  });
444
- state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
445
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]] });
458
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]], operationStartDate: startDate || issuingDate });
446
459
  })
447
460
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
448
461
  state.loading = false;
@@ -61,6 +61,6 @@ var BankDetails = function () {
61
61
  if (error)
62
62
  dispatch(clearError());
63
63
  }, [methods.formState.isValid, methods.watch('bankStatementFile')]);
64
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
64
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
65
65
  };
66
66
  export default BankDetails;
@@ -103,12 +103,11 @@ var ActivitiesList = function (_a) {
103
103
  React.useEffect(function () {
104
104
  if ((selectedActivities === null || selectedActivities === void 0 ? void 0 : selectedActivities.length) > 0) {
105
105
  setStoredActivities(selectedActivities);
106
+ if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) === 0) {
107
+ setValue('activities', selectedActivities);
108
+ }
106
109
  }
107
110
  }, [selectedActivities]);
108
- React.useEffect(function () {
109
- var activities = entityData.activities;
110
- setValue('activities', activities);
111
- }, [entityData === null || entityData === void 0 ? void 0 : entityData.activities]);
112
111
  var onOpenList = function (event) {
113
112
  var _a;
114
113
  setAnchorEl(event.currentTarget);
@@ -14,17 +14,20 @@ var OperationStartDate = function (_a) {
14
14
  var dispatch = useAppDispatch();
15
15
  var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
16
16
  var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
17
- var operationStartDate = data.entityData.operationStartDate;
17
+ var operationStartDate = (data.entityData.responseBody || {}).operationStartDate;
18
18
  var oDateControl = useController({ control: control, name: 'operationStartDate' });
19
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
19
20
  React.useEffect(function () {
20
- setValue('operationStartDate', operationStartDate, { shouldValidate: true });
21
+ if (!dateValue) {
22
+ var date = operationStartDate || new Date().toString();
23
+ setValue('operationStartDate', date, { shouldValidate: true });
24
+ }
21
25
  }, [operationStartDate]);
22
26
  var handleOperationStartDateChange = function (data) {
23
27
  if (error)
24
28
  dispatch(clearError());
25
29
  oDateControl.field.onChange(data);
26
30
  };
27
- var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
28
31
  return (_jsx(ScreenContainer, { children: _jsxs(_Fragment, { children: [_jsx(InputLabelStyled, { children: t('business_start_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: handleOperationStartDateChange })] }) }));
29
32
  };
30
33
  export default OperationStartDate;
@@ -95,7 +95,7 @@ var AdditionalIndividualInfo = function (_a) {
95
95
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive &&
96
96
  employerFieldsActive &&
97
97
  !isMonthlyIncomeListActive &&
98
- !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
98
+ !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
99
99
  };
100
100
  export default React.memo(AdditionalIndividualInfo);
101
101
  AdditionalIndividualInfo.defaultProps = {};
@@ -55,6 +55,6 @@ var CreatePassword = function (_a) {
55
55
  var onBack = function () {
56
56
  dispatch(handleCurrentActiveScreen('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
57
57
  };
58
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(Password, {}) }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
58
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(Password, {}) }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
59
59
  };
60
60
  export default React.memo(CreatePassword);
@@ -45,6 +45,6 @@ var TaxDetails = function () {
45
45
  var onBack = function () {
46
46
  dispatch(handleCurrentActiveScreen('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
47
47
  };
48
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, {}), _jsx(ConfirmPolicy, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
48
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, {}), _jsx(ConfirmPolicy, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
49
49
  };
50
50
  export default TaxDetails;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.112-test",
3
+ "version": "2.0.113-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",