@tap-payments/auth-jsconnect 2.0.109-test → 2.0.111-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.
@@ -53,7 +53,7 @@ export declare type UploadFileBody = {
53
53
  title: string | undefined;
54
54
  purpose: string;
55
55
  };
56
- export declare type EntityLicenseBody = {
56
+ export declare type UpdateEntityBody = {
57
57
  id: string;
58
58
  license: {
59
59
  type?: string;
@@ -64,20 +64,15 @@ export declare type EntityLicenseBody = {
64
64
  issuing_date: number;
65
65
  expiry_date?: string;
66
66
  };
67
- encryption_contract?: Array<string>;
68
- };
69
- export declare type EntityActivitiesBody = {
70
- id: string;
71
67
  activities?: Array<{
72
68
  id: string;
69
+ action: string;
73
70
  }>;
74
- };
75
- export declare type EntityNameBody = {
76
- id: string;
77
71
  legal_name: {
78
72
  ar: string;
79
73
  en: string;
80
74
  };
75
+ encryption_contract?: Array<string>;
81
76
  };
82
77
  export declare type DocumentInfo = {
83
78
  type?: string;
@@ -99,10 +94,8 @@ declare const entityService: {
99
94
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
100
95
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
101
96
  uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
102
- updateEntityLicense: ({ id, ...data }: EntityLicenseBody) => Promise<any>;
103
- updateEntityName: ({ id, ...data }: EntityNameBody) => Promise<any>;
104
- updateEntityActivities: ({ id, ...data }: EntityActivitiesBody) => Promise<any>;
105
97
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
106
98
  retrieveEntity: (entity_id: string) => Promise<any>;
99
+ updateEntity: ({ id, ...data }: UpdateEntityBody) => Promise<any>;
107
100
  };
108
101
  export { entityService };
@@ -39,27 +39,11 @@ var retrieveEntity = function (entity_id) {
39
39
  url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(entity_id)
40
40
  });
41
41
  };
42
- var updateEntityActivities = function (_a) {
42
+ var updateEntity = function (_a) {
43
43
  var id = _a.id, data = __rest(_a, ["id"]);
44
44
  return httpClient({
45
45
  method: 'put',
46
- url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(id, "/activities/add"),
47
- data: data
48
- });
49
- };
50
- var updateEntityName = function (_a) {
51
- var id = _a.id, data = __rest(_a, ["id"]);
52
- return httpClient({
53
- method: 'put',
54
- url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(id, "/name"),
55
- data: data
56
- });
57
- };
58
- var updateEntityLicense = function (_a) {
59
- var id = _a.id, data = __rest(_a, ["id"]);
60
- return httpClient({
61
- method: 'put',
62
- url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(id, "/license"),
46
+ url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(id),
63
47
  data: data
64
48
  });
65
49
  };
@@ -98,10 +82,8 @@ var entityService = {
98
82
  retrieveEntityInfo: retrieveEntityInfo,
99
83
  updateIndividualInfo: updateIndividualInfo,
100
84
  uploadFileInfo: uploadFileInfo,
101
- updateEntityLicense: updateEntityLicense,
102
- updateEntityName: updateEntityName,
103
- updateEntityActivities: updateEntityActivities,
104
85
  updateDocumentInfo: updateDocumentInfo,
105
- retrieveEntity: retrieveEntity
86
+ retrieveEntity: retrieveEntity,
87
+ updateEntity: updateEntity
106
88
  };
107
89
  export { entityService };
@@ -3,7 +3,7 @@ import { ValidateOperatorBody } from './operator';
3
3
  import { CreateAuthBody, VerifyAuthBody, CreatePasswordBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, VerifyAuthKitOTPBody } from './auth';
4
4
  import { UpdateLeadBody, LeadVerifyBody, CreateLeadBody, LeadOTPVerifyBody, LeadIdentityUpdateBody } from './lead';
5
5
  import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
6
- import { EntityInfoBody, EntityBankUpdateBody, UploadFileBody, EntityLicenseBody, EntityActivitiesBody, EntityNameBody, DocumentUpdateBody, DocumentInfo } from './entity';
6
+ import { EntityInfoBody, EntityBankUpdateBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo } from './entity';
7
7
  import { CreateAccountBody } from './account';
8
8
  import { DataElementBody } from './data';
9
9
  import { BrandListBody, UpdateBrandBody, UpdateIndividualBody } from './individual';
@@ -45,11 +45,9 @@ declare const API: {
45
45
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
46
46
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
47
47
  uploadFileInfo: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
48
- updateEntityLicense: ({ id, ...data }: EntityLicenseBody) => Promise<any>;
49
- updateEntityName: ({ id, ...data }: EntityNameBody) => Promise<any>;
50
- updateEntityActivities: ({ id, ...data }: EntityActivitiesBody) => Promise<any>;
51
48
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
52
49
  retrieveEntity: (entity_id: string) => Promise<any>;
50
+ updateEntity: ({ id, ...data }: UpdateEntityBody) => Promise<any>;
53
51
  };
54
52
  availabilityServices: {
55
53
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -109,6 +107,6 @@ declare const API: {
109
107
  updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
110
108
  };
111
109
  };
112
- export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, EntityLicenseBody, EntityActivitiesBody, EntityNameBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody, UpdateIndividualBody };
110
+ export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody, UpdateIndividualBody };
113
111
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
114
112
  export default API;
@@ -216,44 +216,32 @@ 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, licenseBody, activitiesBody, nameBody, _b, nameData, activitiesData, licenseData, documentBody;
220
- var _c, _d, _e, _f, _g;
221
- return __generator(this, function (_h) {
222
- switch (_h.label) {
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) {
223
223
  case 0:
224
224
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
225
- id = (_d = (_c = entity.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id;
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
226
  documentData = undefined;
227
227
  articleId = entity.data.entityData.articleId;
228
- licenseBody = {
228
+ payload = {
229
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
+ }),
230
234
  license: {
231
235
  issuing_date: moment(params.operationStartDate).format('x'),
232
236
  number: params.licenseNumber
233
- }
234
- };
235
- activitiesBody = {
236
- id: id,
237
- activities: (_e = (params.activities || [])) === null || _e === void 0 ? void 0 : _e.map(function (_a) {
238
- var id = _a.id;
239
- return ({ id: id });
240
- })
241
- };
242
- nameBody = {
243
- id: id,
237
+ },
244
238
  legal_name: {
245
239
  ar: params.licenseName,
246
240
  en: params.licenseName
247
- }
241
+ },
242
+ encryption_contract: ['license.issuing_date', 'license.number', 'legal_name.ar', 'legal_name.en']
248
243
  };
249
- return [4, Promise.all([
250
- API.entityService.updateEntityName(nameBody),
251
- API.entityService.updateEntityActivities(activitiesBody),
252
- API.entityService.updateEntityLicense(licenseBody)
253
- ])];
254
- case 1:
255
- _b = _h.sent(), nameData = _b[0], activitiesData = _b[1], licenseData = _b[2];
256
- if (!articleId) return [3, 3];
244
+ if (!articleId) return [3, 2];
257
245
  documentBody = {
258
246
  entity_id: id || '',
259
247
  documents: [
@@ -263,13 +251,15 @@ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (param
263
251
  ]
264
252
  };
265
253
  return [4, API.entityService.updateDocumentInfo(documentBody)];
266
- case 2:
267
- documentData = _h.sent();
268
- _h.label = 3;
254
+ case 1:
255
+ documentData = _g.sent();
256
+ _g.label = 2;
257
+ case 2: return [4, API.entityService.updateEntity(payload)];
269
258
  case 3:
259
+ data = _g.sent();
270
260
  thunkApi.dispatch(handleNextScreenStep());
271
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
272
- return [2, { data: __assign(__assign(__assign(__assign({}, nameData), activitiesData), licenseData), documentData), formData: params }];
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 }];
273
263
  }
274
264
  });
275
265
  }); });
@@ -68,13 +68,13 @@ var Individual = function (_a) {
68
68
  }, [methods.formState.isValid]);
69
69
  React.useEffect(function () {
70
70
  var name = individualData.name, email = individualData.email, mobile = individualData.mobile, countryCode = individualData.countryCode;
71
- if (!!name)
71
+ if (name && !methods.getValues('name'))
72
72
  methods.setValue('name', name, { shouldValidate: true });
73
- if (!!email)
73
+ if (email && !methods.getValues('email'))
74
74
  methods.setValue('email', email, { shouldValidate: true });
75
- if (!!mobile)
75
+ if (mobile && !methods.getValues('mobile'))
76
76
  methods.setValue('mobile', mobile, { shouldValidate: true });
77
- if (!!countryCode)
77
+ if (countryCode && !methods.getValues('countryCode'))
78
78
  methods.setValue('countryCode', countryCode, { shouldValidate: true });
79
79
  }, [individualData.name, individualData.email, individualData.mobile, individualData.countryCode]);
80
80
  var handleMenuListClick = function () {
@@ -78,10 +78,14 @@ var Mobile = function (_a) {
78
78
  var settingsStore = useAppSelector(settingsSelector);
79
79
  var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
80
80
  var _d = React.useState(), listType = _d[0], setListType = _d[1];
81
+ var _e = data.mobileData, countryCode = _e.countryCode, mobile = _e.mobile;
81
82
  var dispatch = useAppDispatch();
82
83
  var methods = useForm({
83
84
  resolver: yupResolver(PhoneValidationSchema),
84
- defaultValues: data.mobileData,
85
+ defaultValues: {
86
+ mobile: mobile || '',
87
+ countryCode: countryCode
88
+ },
85
89
  mode: 'onChange'
86
90
  });
87
91
  var t = useTranslation().t;
@@ -90,10 +94,10 @@ var Mobile = function (_a) {
90
94
  setListType(flag);
91
95
  };
92
96
  React.useEffect(function () {
93
- if (data.mobileData.countryCode) {
94
- methods.setValue('countryCode', data.mobileData.countryCode);
97
+ if (countryCode && !methods.getValues('countryCode')) {
98
+ methods.setValue('countryCode', countryCode);
95
99
  }
96
- }, [data.mobileData]);
100
+ }, [countryCode]);
97
101
  React.useEffect(function () {
98
102
  dispatch(resetOTPScreen());
99
103
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.109-test",
3
+ "version": "2.0.111-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",