eservices-core 1.0.343 → 1.0.346

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.
package/dist/index.d.ts CHANGED
@@ -93,8 +93,9 @@ import WidgetSection from "./widgets/section/widget-section.vue";
93
93
  import WidgetTableController from "./widgets/tables/table-with-form/widget-table-controller.vue";
94
94
  import WidgetSpinner from "./widgets/spinner/WidgetSpinner.vue";
95
95
  import WidgetTable from './widgets/tables/table-with-form/widget-table.vue';
96
+ import WidgetForm from "./widgets/forms/naomi/WidgetForm.vue";
96
97
  import ModalValidation from "./widgets/modals/modal-validation/modal-validation.vue";
97
- export { ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection };
98
+ export { WidgetForm, ModalValidation, WidgetTable, WidgetTableController, WidgetSpinner, WidgetBreadcrumbs, WidgetCommunication, WidgetList, WidgetSection };
98
99
  import valuesToUpperCase from "./utils/values-to-upper-case";
99
100
  declare const utils: {
100
101
  valuesToUpperCase: typeof valuesToUpperCase;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.343
2
+ * eservices-core v1.0.346
3
3
  * (c) 2022 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -4703,6 +4703,9 @@ class authService {
4703
4703
  Object.values(data.errors).map(a => a[0]) : null;
4704
4704
  throw CoreError.AuthServiceError(data.title, details);
4705
4705
  }
4706
+ /**
4707
+ * @deprecated
4708
+ * */
4706
4709
  static login(values) {
4707
4710
  return Request(configuration.identityServerURL + "/api/Authenticate/Login", {
4708
4711
  method: "POST",
@@ -4714,6 +4717,9 @@ class authService {
4714
4717
  })
4715
4718
  .catch(authService.parseError);
4716
4719
  }
4720
+ /**
4721
+ * @deprecated
4722
+ * */
4717
4723
  static registration(values) {
4718
4724
  values.AppName = configuration.applicationName;
4719
4725
  return Request(configuration.identityServerURL + "/api/Authenticate/Registration", {
@@ -4726,7 +4732,86 @@ class authService {
4726
4732
  })
4727
4733
  .catch(authService.parseError);
4728
4734
  }
4729
- }
4735
+ static parseProcessAnswer(answer) {
4736
+ const wrongStatus = ['PhoneCodeIncorrect', 'EmailCodeIncorrect'];
4737
+ const status = answer.statusName;
4738
+ if (wrongStatus.includes(status))
4739
+ throw CoreError.UndefinedError(status);
4740
+ return answer;
4741
+ }
4742
+ static startRegistrationProcess(values) {
4743
+ return authService.requestStepRegistrationProcess('StartRegistration', values);
4744
+ }
4745
+ static confirmPhoneRegistrationProcess(values) {
4746
+ return authService.requestStepRegistrationProcess('ConfirmPhoneNumberByRegistration', values);
4747
+ }
4748
+ static confirmEmailRegistrationProcess(values) {
4749
+ return authService.requestStepRegistrationProcess('ConfirmEmailByRegistration', values);
4750
+ }
4751
+ static finishEmailRegistrationProcess(values) {
4752
+ return authService.requestStepRegistrationProcess('FinishRegistration', values);
4753
+ }
4754
+ /**
4755
+ * @description Steps of registration process are the same. Current method provide one requestInterface for all
4756
+ * steps.
4757
+ * */
4758
+ static requestStepRegistrationProcess(name, values) {
4759
+ return Request(`${configuration.identityServerURL}/api/Authenticate/${name}`, {
4760
+ method: 'POST',
4761
+ headers: {
4762
+ 'Content-Type': 'application/json',
4763
+ },
4764
+ credentials: 'include',
4765
+ body: JSON.stringify(values)
4766
+ })
4767
+ .catch(authService.parseError)
4768
+ .then(authService.parseProcessAnswer);
4769
+ }
4770
+ static startLoginProcess(values) {
4771
+ return authService.requestStepLoginProcess('StartLogin', values);
4772
+ }
4773
+ static loginWithPassword(values) {
4774
+ return authService.requestStepLoginProcess('LoginWithPassword', values);
4775
+ }
4776
+ static loginWithOtpCode(values) {
4777
+ return authService.requestStepLoginProcess('LoginWithOtpCode', values);
4778
+ }
4779
+ /**
4780
+ * @description Method for step-to-step login process
4781
+ * @return {ILoginAnswer} answer
4782
+ * */
4783
+ static requestStepLoginProcess(name, values) {
4784
+ return Request(`${configuration.identityServerURL}/api/Authenticate/${name}`, {
4785
+ method: 'POST',
4786
+ headers: {
4787
+ 'Content-Type': 'application/json',
4788
+ },
4789
+ credentials: 'include',
4790
+ body: JSON.stringify(values)
4791
+ })
4792
+ .catch(authService.parseError)
4793
+ .then(authService.parseLoginProcessAnswer);
4794
+ }
4795
+ static parseLoginProcessAnswer(answer) {
4796
+ if (answer.statusCode >= 4)
4797
+ throw CoreError.UndefinedError(answer.statusName);
4798
+ return answer;
4799
+ }
4800
+ }
4801
+ var LoginStatus;
4802
+ (function (LoginStatus) {
4803
+ LoginStatus[LoginStatus["Created"] = 0] = "Created";
4804
+ LoginStatus[LoginStatus["PasswordRequired"] = 1] = "PasswordRequired";
4805
+ LoginStatus[LoginStatus["OtpCodeRequrid"] = 2] = "OtpCodeRequrid";
4806
+ LoginStatus[LoginStatus["Authenticated"] = 3] = "Authenticated";
4807
+ LoginStatus[LoginStatus["UserNotFound"] = 4] = "UserNotFound";
4808
+ LoginStatus[LoginStatus["PasswordIncorrect"] = 5] = "PasswordIncorrect";
4809
+ LoginStatus[LoginStatus["OtpCodeIncorrect"] = 6] = "OtpCodeIncorrect";
4810
+ LoginStatus[LoginStatus["ApplicationNotSupported"] = 7] = "ApplicationNotSupported";
4811
+ LoginStatus[LoginStatus["OtpCodeExpired"] = 8] = "OtpCodeExpired";
4812
+ LoginStatus[LoginStatus["TokenIncorrect"] = 9] = "TokenIncorrect";
4813
+ LoginStatus[LoginStatus["Unauthorized"] = 10] = "Unauthorized";
4814
+ })(LoginStatus || (LoginStatus = {}));
4730
4815
 
4731
4816
  class ActionService {
4732
4817
  static url() {
@@ -6002,6 +6087,7 @@ exports.ProcessWrap = ProcessWrap;
6002
6087
  exports.Table = Table;
6003
6088
  exports.WidgetBreadcrumbs = script$a;
6004
6089
  exports.WidgetCommunication = script$4;
6090
+ exports.WidgetForm = script$I;
6005
6091
  exports.WidgetList = script$y;
6006
6092
  exports.WidgetSection = script$3;
6007
6093
  exports.WidgetSpinner = script$K;
@@ -14,7 +14,63 @@ interface ResponseInterface {
14
14
  }
15
15
  export default class authService {
16
16
  static parseError(data: ResponseInterface): void;
17
+ /**
18
+ * @deprecated
19
+ * */
17
20
  static login(values: LoginValues): Promise<any>;
21
+ /**
22
+ * @deprecated
23
+ * */
18
24
  static registration(values: any): Promise<any>;
25
+ static parseProcessAnswer(answer: IRegistrationAnswer): IRegistrationAnswer;
26
+ static startRegistrationProcess(values: any): Promise<IRegistrationAnswer>;
27
+ static confirmPhoneRegistrationProcess(values: any): Promise<IRegistrationAnswer>;
28
+ static confirmEmailRegistrationProcess(values: any): Promise<IRegistrationAnswer>;
29
+ static finishEmailRegistrationProcess(values: any): Promise<IRegistrationAnswer>;
30
+ /**
31
+ * @description Steps of registration process are the same. Current method provide one requestInterface for all
32
+ * steps.
33
+ * */
34
+ static requestStepRegistrationProcess(name: string, values: any): Promise<IRegistrationAnswer>;
35
+ static startLoginProcess(values: any): Promise<ILoginAnswer>;
36
+ static loginWithPassword(values: any): Promise<ILoginAnswer>;
37
+ static loginWithOtpCode(values: any): Promise<ILoginAnswer>;
38
+ /**
39
+ * @description Method for step-to-step login process
40
+ * @return {ILoginAnswer} answer
41
+ * */
42
+ static requestStepLoginProcess(name: string, values: any): Promise<ILoginAnswer>;
43
+ static parseLoginProcessAnswer(answer: ILoginAnswer): ILoginAnswer;
19
44
  }
45
+ interface ILoginAnswer {
46
+ maskedPhoneNumber: string;
47
+ otpPrefix: string;
48
+ token: string;
49
+ statusName: keyof LoginStatus;
50
+ statusCode: number;
51
+ username: string;
52
+ }
53
+ declare enum LoginStatus {
54
+ Created = 0,
55
+ PasswordRequired = 1,
56
+ OtpCodeRequrid = 2,
57
+ Authenticated = 3,
58
+ UserNotFound = 4,
59
+ PasswordIncorrect = 5,
60
+ OtpCodeIncorrect = 6,
61
+ ApplicationNotSupported = 7,
62
+ OtpCodeExpired = 8,
63
+ TokenIncorrect = 9,
64
+ Unauthorized = 10
65
+ }
66
+ interface IRegistrationAnswer {
67
+ appName: string;
68
+ maskedAddress: string;
69
+ otpCodeAttempts: number;
70
+ otpPrefix: string;
71
+ statusCode: number;
72
+ statusName: statusName;
73
+ token: string;
74
+ }
75
+ declare type statusName = 'EmailCodeRequired' | 'PhoneCodeRequired' | 'FinishRequired' | 'Registred' | 'EmailIncorrect' | 'PhoneIncorrect' | 'EmailCodeIncorrect' | 'PhoneCodeIncorrect' | 'EmailCodeExpired' | 'PhoneCodeExpired' | 'PasswordIncorrect' | 'TokenIncorrect' | 'ApplicationNotSupported';
20
76
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.343",
3
+ "version": "1.0.346",
4
4
  "description": "----",
5
5
  "author": "",
6
6
  "scripts": {