@tap-payments/auth-jsconnect 2.0.112-test → 2.0.114-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.
@@ -52,6 +52,7 @@ export declare type UploadFileBody = {
52
52
  file?: File;
53
53
  title: string | undefined;
54
54
  purpose: string;
55
+ type?: string;
55
56
  };
56
57
  export declare type UpdateEntityBody = {
57
58
  id: string;
@@ -61,7 +62,7 @@ export declare type UpdateEntityBody = {
61
62
  additional_info?: {
62
63
  unified_number: string;
63
64
  };
64
- issuing_date: number;
65
+ issuing_date?: number;
65
66
  expiry_date?: string;
66
67
  };
67
68
  activities?: Array<{
@@ -72,6 +73,7 @@ export declare type UpdateEntityBody = {
72
73
  ar: string;
73
74
  en: string;
74
75
  };
76
+ AOA_file_id?: string;
75
77
  encryption_contract?: Array<string>;
76
78
  };
77
79
  export declare type DocumentInfo = {
@@ -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,64 +216,65 @@ 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, articleId, 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
- documentData = undefined;
226
+ brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
227
227
  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) {
228
+ requestBody = {
229
+ id: brandId,
230
+ activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
231
231
  var id = _a.id;
232
- return ({ id: id, action: 'add' });
232
+ return ({ id: id });
233
233
  }),
234
+ operations: {
235
+ start_date: params.operationStartDate
236
+ },
237
+ encryption_contract: ['operations.start_date']
238
+ };
239
+ return [4, API.brandService.updateBrandInfo(requestBody)];
240
+ case 1:
241
+ brandData = (_j.sent()).data;
242
+ payload = {
243
+ id: id,
234
244
  license: {
235
- issuing_date: moment(params.operationStartDate).format('x'),
236
245
  number: params.licenseNumber
237
246
  },
238
247
  legal_name: {
239
248
  ar: params.licenseName,
240
249
  en: params.licenseName
241
250
  },
242
- encryption_contract: ['license.issuing_date', 'license.number', 'legal_name.ar', 'legal_name.en']
243
- };
244
- if (!articleId) return [3, 2];
245
- documentBody = {
246
- entity_id: id || '',
247
- documents: [
248
- {
249
- images: [articleId]
250
- }
251
- ]
251
+ AOA_file_id: articleId,
252
+ encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en']
252
253
  };
253
- return [4, API.entityService.updateDocumentInfo(documentBody)];
254
- case 1:
255
- documentData = _g.sent();
256
- _g.label = 2;
257
- case 2: return [4, API.entityService.updateEntity(payload)];
258
- case 3:
259
- data = _g.sent();
254
+ return [4, API.entityService.updateEntity(payload)];
255
+ case 2:
256
+ data = _j.sent();
260
257
  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 }];
258
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
259
+ return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
263
260
  }
264
261
  });
265
262
  }); });
266
263
  export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
267
264
  var file = _a.file, onProgress = _a.onProgress;
268
265
  return __awaiter(void 0, void 0, void 0, function () {
269
- var uploadPayload, onUploadProgress, data;
270
- return __generator(this, function (_b) {
271
- switch (_b.label) {
266
+ var typeArray, type, uploadPayload, onUploadProgress, data;
267
+ var _b;
268
+ return __generator(this, function (_c) {
269
+ switch (_c.label) {
272
270
  case 0:
271
+ typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
272
+ type = typeArray[1] || '';
273
273
  uploadPayload = {
274
274
  file_link_create: true,
275
275
  title: file === null || file === void 0 ? void 0 : file.name,
276
276
  purpose: 'identity_document',
277
+ type: type,
277
278
  file: file
278
279
  };
279
280
  onUploadProgress = function (progressEvent) {
@@ -282,7 +283,7 @@ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a)
282
283
  };
283
284
  return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
284
285
  case 1:
285
- data = _b.sent();
286
+ data = _c.sent();
286
287
  return [2, { data: data }];
287
288
  }
288
289
  });
@@ -333,7 +334,7 @@ var initialState = {
333
334
  licenseName: '',
334
335
  licenseNumber: '',
335
336
  activities: [],
336
- operationStartDate: new Date().toString(),
337
+ operationStartDate: '',
337
338
  uploading: false
338
339
  }
339
340
  }
@@ -371,12 +372,14 @@ export var entitySlice = createSlice({
371
372
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
372
373
  state.data.verify.token = token;
373
374
  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);
375
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
376
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
377
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
378
+ var issuingDate = undefined;
379
+ if (entityDate) {
380
+ var date = new Date(entityDate);
378
381
  var formattedDate = moment(date).format('YYYY-MM-DD');
379
- state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
382
+ issuingDate = convertNumbers2English(formattedDate);
380
383
  }
381
384
  if (licenseNumber)
382
385
  state.data.entityData.licenseNumber = licenseNumber;
@@ -385,8 +388,7 @@ export var entitySlice = createSlice({
385
388
  var _a;
386
389
  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
390
  });
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]] });
391
+ 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
392
  })
391
393
  .addCase(verifyLeadToken.rejected, function (state, action) {
392
394
  state.error = action.error.message;
@@ -427,12 +429,14 @@ export var entitySlice = createSlice({
427
429
  state.data.otpData.responseBody = data;
428
430
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
429
431
  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);
432
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
433
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
434
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
435
+ var issuingDate = undefined;
436
+ if (entityDate) {
437
+ var date = new Date(entityDate);
434
438
  var formattedDate = moment(date).format('YYYY-MM-DD');
435
- state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
439
+ issuingDate = convertNumbers2English(formattedDate);
436
440
  }
437
441
  if (licenseNumber)
438
442
  state.data.entityData.licenseNumber = licenseNumber;
@@ -441,8 +445,7 @@ export var entitySlice = createSlice({
441
445
  var _a;
442
446
  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
447
  });
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]] });
448
+ 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
449
  })
447
450
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
448
451
  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.114-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",