oneentry 1.0.124 → 1.0.125

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.
Files changed (76) hide show
  1. package/README.md +24 -22
  2. package/dist/admins/adminsApi.d.ts +17 -4
  3. package/dist/admins/adminsApi.js +16 -3
  4. package/dist/admins/adminsInterfaces.d.ts +47 -26
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +10 -18
  6. package/dist/attribute-sets/attributeSetsApi.js +9 -17
  7. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +92 -44
  8. package/dist/auth-provider/authProviderApi.d.ts +146 -36
  9. package/dist/auth-provider/authProviderApi.js +163 -37
  10. package/dist/auth-provider/authProvidersInterfaces.d.ts +189 -40
  11. package/dist/base/asyncModules.d.ts +7 -1
  12. package/dist/base/asyncModules.js +127 -21
  13. package/dist/base/result.js +23 -0
  14. package/dist/base/syncModules.d.ts +4 -0
  15. package/dist/base/syncModules.js +19 -1
  16. package/dist/base/utils.d.ts +1 -1
  17. package/dist/blocks/blocksApi.d.ts +7 -17
  18. package/dist/blocks/blocksApi.js +7 -17
  19. package/dist/blocks/blocksInterfaces.d.ts +77 -32
  20. package/dist/events/eventsApi.d.ts +7 -8
  21. package/dist/events/eventsApi.js +12 -7
  22. package/dist/events/eventsInterfaces.d.ts +16 -11
  23. package/dist/file-uploading/fileUploadingApi.d.ts +22 -14
  24. package/dist/file-uploading/fileUploadingApi.js +20 -12
  25. package/dist/file-uploading/fileUploadingInterfaces.d.ts +42 -18
  26. package/dist/forms/formsApi.d.ts +3 -7
  27. package/dist/forms/formsApi.js +2 -6
  28. package/dist/forms/formsInterfaces.d.ts +44 -28
  29. package/dist/formsData/formsDataApi.d.ts +21 -9
  30. package/dist/formsData/formsDataApi.js +21 -9
  31. package/dist/formsData/formsDataInterfaces.d.ts +128 -45
  32. package/dist/general-types/generalTypesApi.d.ts +1 -3
  33. package/dist/general-types/generalTypesApi.js +0 -2
  34. package/dist/general-types/generalTypesInterfaces.d.ts +2 -4
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/integration-collections/integrationCollectionsApi.d.ts +74 -47
  38. package/dist/integration-collections/integrationCollectionsApi.js +64 -45
  39. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +144 -63
  40. package/dist/locales/localesApi.d.ts +1 -2
  41. package/dist/locales/localesApi.js +1 -2
  42. package/dist/locales/localesInterfaces.d.ts +2 -4
  43. package/dist/menus/menusApi.d.ts +1 -3
  44. package/dist/menus/menusApi.js +1 -3
  45. package/dist/menus/menusInterfaces.d.ts +39 -13
  46. package/dist/orders/ordersApi.d.ts +36 -18
  47. package/dist/orders/ordersApi.js +40 -22
  48. package/dist/orders/ordersInterfaces.d.ts +163 -81
  49. package/dist/pages/pagesApi.d.ts +48 -48
  50. package/dist/pages/pagesApi.js +40 -45
  51. package/dist/pages/pagesInterfaces.d.ts +147 -98
  52. package/dist/payments/paymentsApi.d.ts +25 -45
  53. package/dist/payments/paymentsApi.js +27 -46
  54. package/dist/payments/paymentsInterfaces.d.ts +42 -60
  55. package/dist/product-statuses/productStatusesApi.d.ts +6 -12
  56. package/dist/product-statuses/productStatusesApi.js +5 -11
  57. package/dist/product-statuses/productStatusesInterfaces.d.ts +16 -15
  58. package/dist/products/productsApi.d.ts +256 -104
  59. package/dist/products/productsApi.js +263 -97
  60. package/dist/products/productsInterfaces.d.ts +343 -160
  61. package/dist/system/systemApi.d.ts +21 -10
  62. package/dist/system/systemApi.js +22 -8
  63. package/dist/system/systemInterfaces.d.ts +0 -1
  64. package/dist/templates/templatesApi.d.ts +6 -12
  65. package/dist/templates/templatesApi.js +4 -10
  66. package/dist/templates/templatesInterfaces.d.ts +20 -20
  67. package/dist/templates-preview/templatesPreviewApi.d.ts +2 -6
  68. package/dist/templates-preview/templatesPreviewApi.js +1 -5
  69. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +50 -25
  70. package/dist/users/usersApi.d.ts +33 -13
  71. package/dist/users/usersApi.js +38 -15
  72. package/dist/users/usersInterfaces.d.ts +78 -27
  73. package/dist/web-socket/wsApi.d.ts +1 -5
  74. package/dist/web-socket/wsApi.js +1 -5
  75. package/dist/web-socket/wsInterfaces.d.ts +0 -1
  76. package/package.json +18 -16
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IAuthEntity, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, ISignUpData, ISignUpEntity } from './authProvidersInterfaces';
4
+ import type { IAuthEntity, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, IOAuthSignUpData, ISignUpData, ISignUpEntity } from './authProvidersInterfaces';
5
5
  /**
6
6
  * Controllers for working with auth services.
7
7
  *
@@ -19,96 +19,179 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
19
19
  /**
20
20
  * User registration.
21
21
  *
22
+ * @handleName signUp
23
+ *
22
24
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
23
- * @param {ISignUpData} body - Request body. Example: { "formIdentifier": "reg", "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value": "12345" } ], "formData": [ { "marker": "last_name", "type": "string", "value": "Name" } ], "notificationData": {"email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999" } }
25
+ * @param {ISignUpData} body - Request body. Example:
26
+ {
27
+ "formIdentifier": "reg",
28
+ "authData": [
29
+ {
30
+ "marker": "login",
31
+ "value": "example@oneentry.cloud"
32
+ },
33
+ {
34
+ "marker": "password",
35
+ "value": "12345"
36
+ }
37
+ ],
38
+ "formData": [
39
+ {
40
+ "marker": "last_name",
41
+ "type": "string",
42
+ "value": "Name"
43
+ }
44
+ ],
45
+ "notificationData": {
46
+ "email": "example@oneentry.cloud",
47
+ "phonePush": ["+99999999999"],
48
+ "phoneSMS": "+99999999999"
49
+ }
50
+ }
51
+ * @param {string} body.formIdentifier - The identifier for the registration form. Example: "reg".
52
+ * @param {{ marker: string; value: string }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value. Example:
53
+ [
54
+ {
55
+ "marker": "login",
56
+ "value": "example@oneentry.cloud"
57
+ },
58
+ {
59
+ "marker": "password",
60
+ "value": "12345"
61
+ }
62
+ ]
63
+ * @param {IAuthFormData | IAuthFormData[]} body.formData - The form data for the registration, which can be a single object or an array of objects. Example:
64
+ {
65
+ "marker": "last_name",
66
+ "type": "string",
67
+ "value": "Name"
68
+ }
69
+ * @param {Object} body.notificationData - An object containing notification data, including email, phonePush, and phoneSMS. Example:
70
+ {
71
+ "email": "example@oneentry.cloud",
72
+ "phonePush": ["+99999999999"],
73
+ "phoneSMS": "+99999999999"
74
+ }
24
75
  * @param {string} [langCode] - Language code. Default: "en_US".
25
- *
26
76
  * @return {ISignUpEntity} Returns a user object.
27
77
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
28
- *
29
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
78
+ * @description User registration (❗️For a provider with user activation, the activation code is sent through the corresponding user notification method).
30
79
  */
31
80
  signUp(marker: string, body: ISignUpData, langCode?: string): Promise<ISignUpEntity | IError>;
32
81
  /**
33
82
  * Getting a user activation code. The code is returned via the appropriate user notification method.
34
83
  *
84
+ * @handleName generateCode
85
+ *
35
86
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
36
87
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
37
88
  * @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
38
- *
39
89
  * @return {void} Returns void if the code is successfully generated, or an error object if there was an issue.
40
90
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
41
- *
42
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
91
+ * @description Obtaining a code to activate the user.
43
92
  */
44
93
  generateCode(marker: string, userIdentifier: string, eventIdentifier: string): Promise<void | IError>;
45
94
  /**
46
95
  * User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
47
96
  *
97
+ * @handleName checkCode
98
+ *
48
99
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
49
100
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
50
101
  * @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
51
102
  * @param {string} code - Service code. Example: "123456".
52
- *
53
103
  * @return {boolean} Returns true if the code is correct, or an error object if there was an issue.
54
104
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
- *
56
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
105
+ * @description Checking the user activation code
57
106
  */
58
107
  checkCode(marker: string, userIdentifier: string, eventIdentifier: string, code: string): Promise<boolean | IError>;
59
108
  /**
60
109
  * User activate.
61
110
  *
111
+ * @handleName activateUser
112
+ *
62
113
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
63
114
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
64
115
  * @param {string} code - Service code. Example: "123456".
65
- *
66
116
  * @return {boolean} Returns true if the user was successfully activated, or an error object if there was an issue.
67
117
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
68
- *
69
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
118
+ * @description User activation.
70
119
  */
71
120
  activateUser(marker: string, userIdentifier: string, code: string): Promise<boolean | IError>;
72
121
  /**
73
122
  * User authorization.
74
123
  *
124
+ * @handleName auth
125
+ *
75
126
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
76
- * @param {IAuthPostBody} data - Array of objects contains auth information. Example: { "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value": "12345" } ] } }
127
+ * @param {IAuthPostBody} body - Objects contains auth information. Example:
128
+ {
129
+ "authData": [
130
+ {
131
+ "marker": "login",
132
+ "value": "example@oneentry.cloud"
133
+ },
134
+ {
135
+ "marker": "password",
136
+ "value": "12345"
137
+ }
138
+ ]
139
+ }
140
+ * @param {{ marker: string; value: string | number }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value. Example:
141
+ [
142
+ {
143
+ "marker": "login",
144
+ "value": "user@example.com"
145
+ }
146
+ ]
147
+ * @param {string} body.authData[index].marker - The marker for the authentication data. Example: "login".
148
+ * @param {string} body.authData[index].value - The value for the authentication data. Example: "user@example.com".
77
149
  *
78
150
  * @return {IAuthEntity} Returns an auth entity object.
79
151
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
80
-
81
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
82
- *
152
+ * @description User authorization.
83
153
  */
84
- auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity | IError>;
154
+ auth(marker: string, body: IAuthPostBody): Promise<IAuthEntity | IError>;
85
155
  /**
86
156
  * Refresh token.
87
157
  *
158
+ * @handleName refresh
159
+ *
88
160
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
89
161
  * @param {string} token - Refresh token. Example: "abcdef123456".
90
- *
91
162
  * @return {IAuthEntity} Returns an auth entity object with the following values: accessToken, refreshToken, user, and other auth-related data.
92
163
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
93
- *
94
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
164
+ * @description User token refresh.
95
165
  */
96
166
  refresh(marker: string, token: string): Promise<IAuthEntity | IError>;
97
167
  /**
98
- * User logout.
168
+ * User account logout.
169
+ *
170
+ * @handleName logout
99
171
  *
100
172
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
101
173
  * @param {string} token - Refresh token. Example: "abcdef123456".
102
- *
103
174
  * @return {boolean} Returns true if the logout was successful, or an error object if there was an issue.
104
175
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
105
- *
106
176
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
107
177
  */
108
178
  logout(marker: string, token: string): Promise<boolean | IError>;
179
+ /**
180
+ * Logout of user account on all devices.
181
+ *
182
+ * @handleName logoutAll
183
+ *
184
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
185
+ * @return {boolean} Returns true if the logout was successful, or an error object if there was an issue.
186
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
187
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
188
+ */
189
+ logoutAll(marker: string): Promise<boolean | IError>;
109
190
  /**
110
191
  * Change password.
111
192
  *
193
+ * @handleName changePassword
194
+ *
112
195
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
113
196
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
114
197
  * @param {string} eventIdentifier - The text identifier of the event. Example: "reg".
@@ -116,38 +199,65 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
116
199
  * @param {string} code - Service code. Example: "123456".
117
200
  * @param {string} newPassword - New password. Example: "newPassword123".
118
201
  * @param {string} [repeatPassword] - Optional variable contains repeat new password for validation. Example: "newPassword123".
119
- *
120
202
  * @return {boolean} Returns true if the password was successfully changed, or an error object if there was an issue.
121
203
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
122
- *
123
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
124
- * @example await AuthProvider.changePassword('email', userIdentifier, type, code, newPassword, repeatPassword);
125
- *
204
+ * @description User password change (only for tariffs with account activation and the Activation feature enabled).
126
205
  */
127
206
  changePassword(marker: string, userIdentifier: string, eventIdentifier: string, type: number, code: string, newPassword: string, repeatPassword?: string): Promise<boolean | IError>;
128
207
  /**
129
208
  * Get all auth providers objects.
130
209
  *
210
+ * @handleName getAuthProviders
211
+ *
131
212
  * @param {string} [langCode] - Language code. Default: "en_US".
132
213
  * @param {number} [offset] - Parameter for pagination. Default: 0.
133
214
  * @param {number} [limit] - Parameter for pagination. Default: 30.
134
- *
135
215
  * @return {IAuthProvidersEntity[]} Returns an array of auth provider objects.
136
216
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
137
- *
138
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
217
+ * @description Getting all objects of authorization providers.
139
218
  */
140
- getAuthProviders(langCode?: string, offset?: number, limit?: number): Promise<Array<IAuthProvidersEntity> | IError>;
219
+ getAuthProviders(langCode?: string, offset?: number, limit?: number): Promise<IAuthProvidersEntity[] | IError>;
141
220
  /**
142
221
  * Get one auth provider object by marker.
143
222
  *
223
+ * @handleName getAuthProviderByMarker
224
+ *
144
225
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
145
226
  * @param {string} [langCode] - Language code. Default: "en_US".
227
+ * @return {IAuthProvidersEntity} Returns an auth provider object.
228
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
229
+ * @description Getting a single authorization provider object by marker.
230
+ */
231
+ getAuthProviderByMarker(marker: string, langCode?: string): Promise<IAuthProvidersEntity | IError>;
232
+ /**
233
+ * Getting active user sessions data.
146
234
  *
235
+ * @handleName getActiveSessions
236
+ *
237
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
147
238
  * @return {IAuthProvidersEntity} Returns an auth provider object.
148
239
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
240
+ * @description Getting a single authorization provider object by marker.
241
+ */
242
+ getActiveSessionsByMarker(marker: string): Promise<any | IError>;
243
+ /**
244
+ * User registration (authorization) via OAUTH.
149
245
  *
150
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
246
+ * @handleName oauthSignUp
247
+ *
248
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
249
+ * @param {IOAuthSignUpData} body - Object contains OAuth information for registration. Example:
250
+ {
251
+ "client_id": "34346983-luuct343473qdkqidjopdfp3eb3k4thp.apps.googleusercontent.com",
252
+ "client_secret": "43434343434",
253
+ "code": "4/0AVMBsJgwewewewewewei4D7T6E_fbswxnL3g",
254
+ "grant_type": "authorization_code",
255
+ "redirect_uri": "http://localhost:3000"
256
+ }
257
+ * @param {string} [langCode] - Language code. Default: "en_US".
258
+ * @return {ISignUpEntity} Returns a user object.
259
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
260
+ * @description User registration (authorization) via OAUTH.
151
261
  */
152
- getMarker(marker: string, langCode?: string): Promise<IAuthProvidersEntity | IError>;
262
+ oauthSignUp(marker: string, body: IOAuthSignUpData, langCode?: string): Promise<IAuthEntity | IError>;
153
263
  }
@@ -22,14 +22,63 @@ class AuthProviderApi extends asyncModules_1.default {
22
22
  /**
23
23
  * User registration.
24
24
  *
25
+ * @handleName signUp
26
+ *
25
27
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
26
- * @param {ISignUpData} body - Request body. Example: { "formIdentifier": "reg", "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value": "12345" } ], "formData": [ { "marker": "last_name", "type": "string", "value": "Name" } ], "notificationData": {"email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999" } }
28
+ * @param {ISignUpData} body - Request body. Example:
29
+ {
30
+ "formIdentifier": "reg",
31
+ "authData": [
32
+ {
33
+ "marker": "login",
34
+ "value": "example@oneentry.cloud"
35
+ },
36
+ {
37
+ "marker": "password",
38
+ "value": "12345"
39
+ }
40
+ ],
41
+ "formData": [
42
+ {
43
+ "marker": "last_name",
44
+ "type": "string",
45
+ "value": "Name"
46
+ }
47
+ ],
48
+ "notificationData": {
49
+ "email": "example@oneentry.cloud",
50
+ "phonePush": ["+99999999999"],
51
+ "phoneSMS": "+99999999999"
52
+ }
53
+ }
54
+ * @param {string} body.formIdentifier - The identifier for the registration form. Example: "reg".
55
+ * @param {{ marker: string; value: string }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value. Example:
56
+ [
57
+ {
58
+ "marker": "login",
59
+ "value": "example@oneentry.cloud"
60
+ },
61
+ {
62
+ "marker": "password",
63
+ "value": "12345"
64
+ }
65
+ ]
66
+ * @param {IAuthFormData | IAuthFormData[]} body.formData - The form data for the registration, which can be a single object or an array of objects. Example:
67
+ {
68
+ "marker": "last_name",
69
+ "type": "string",
70
+ "value": "Name"
71
+ }
72
+ * @param {Object} body.notificationData - An object containing notification data, including email, phonePush, and phoneSMS. Example:
73
+ {
74
+ "email": "example@oneentry.cloud",
75
+ "phonePush": ["+99999999999"],
76
+ "phoneSMS": "+99999999999"
77
+ }
27
78
  * @param {string} [langCode] - Language code. Default: "en_US".
28
- *
29
79
  * @return {ISignUpEntity} Returns a user object.
30
80
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
31
- *
32
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
81
+ * @description User registration (❗️For a provider with user activation, the activation code is sent through the corresponding user notification method).
33
82
  */
34
83
  async signUp(marker, body, langCode = this.state.lang) {
35
84
  body['langCode'] = langCode;
@@ -39,14 +88,14 @@ class AuthProviderApi extends asyncModules_1.default {
39
88
  /**
40
89
  * Getting a user activation code. The code is returned via the appropriate user notification method.
41
90
  *
91
+ * @handleName generateCode
92
+ *
42
93
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
43
94
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
44
95
  * @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
45
- *
46
96
  * @return {void} Returns void if the code is successfully generated, or an error object if there was an issue.
47
97
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
48
- *
49
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
98
+ * @description Obtaining a code to activate the user.
50
99
  */
51
100
  async generateCode(marker, userIdentifier, eventIdentifier) {
52
101
  const data = {
@@ -60,15 +109,15 @@ class AuthProviderApi extends asyncModules_1.default {
60
109
  /**
61
110
  * User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
62
111
  *
112
+ * @handleName checkCode
113
+ *
63
114
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
64
115
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
65
116
  * @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
66
117
  * @param {string} code - Service code. Example: "123456".
67
- *
68
118
  * @return {boolean} Returns true if the code is correct, or an error object if there was an issue.
69
119
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
70
- *
71
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
120
+ * @description Checking the user activation code
72
121
  */
73
122
  async checkCode(marker, userIdentifier, eventIdentifier, code) {
74
123
  const data = {
@@ -82,14 +131,14 @@ class AuthProviderApi extends asyncModules_1.default {
82
131
  /**
83
132
  * User activate.
84
133
  *
134
+ * @handleName activateUser
135
+ *
85
136
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
86
137
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
87
138
  * @param {string} code - Service code. Example: "123456".
88
- *
89
139
  * @return {boolean} Returns true if the user was successfully activated, or an error object if there was an issue.
90
140
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
91
- *
92
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
141
+ * @description User activation.
93
142
  */
94
143
  async activateUser(marker, userIdentifier, code) {
95
144
  const data = {
@@ -102,17 +151,38 @@ class AuthProviderApi extends asyncModules_1.default {
102
151
  /**
103
152
  * User authorization.
104
153
  *
154
+ * @handleName auth
155
+ *
105
156
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
106
- * @param {IAuthPostBody} data - Array of objects contains auth information. Example: { "authData": [ { "marker": "login", "value": "example@oneentry.cloud" }, { "marker": "password", "value": "12345" } ] } }
157
+ * @param {IAuthPostBody} body - Objects contains auth information. Example:
158
+ {
159
+ "authData": [
160
+ {
161
+ "marker": "login",
162
+ "value": "example@oneentry.cloud"
163
+ },
164
+ {
165
+ "marker": "password",
166
+ "value": "12345"
167
+ }
168
+ ]
169
+ }
170
+ * @param {{ marker: string; value: string | number }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value. Example:
171
+ [
172
+ {
173
+ "marker": "login",
174
+ "value": "user@example.com"
175
+ }
176
+ ]
177
+ * @param {string} body.authData[index].marker - The marker for the authentication data. Example: "login".
178
+ * @param {string} body.authData[index].value - The value for the authentication data. Example: "user@example.com".
107
179
  *
108
180
  * @return {IAuthEntity} Returns an auth entity object.
109
181
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
110
-
111
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
112
- *
182
+ * @description User authorization.
113
183
  */
114
- async auth(marker, data) {
115
- const result = await this._fetchPost(`/marker/${marker}/users/auth`, data);
184
+ async auth(marker, body) {
185
+ const result = await this._fetchPost(`/marker/${marker}/users/auth`, body);
116
186
  this.state.accessToken = result.accessToken;
117
187
  this.state.refreshToken = result.refreshToken;
118
188
  // console.log(result);
@@ -124,13 +194,13 @@ class AuthProviderApi extends asyncModules_1.default {
124
194
  /**
125
195
  * Refresh token.
126
196
  *
197
+ * @handleName refresh
198
+ *
127
199
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
128
200
  * @param {string} token - Refresh token. Example: "abcdef123456".
129
- *
130
201
  * @return {IAuthEntity} Returns an auth entity object with the following values: accessToken, refreshToken, user, and other auth-related data.
131
202
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
132
- *
133
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
203
+ * @description User token refresh.
134
204
  */
135
205
  async refresh(marker, token) {
136
206
  const data = { refreshToken: token };
@@ -143,14 +213,14 @@ class AuthProviderApi extends asyncModules_1.default {
143
213
  return result;
144
214
  }
145
215
  /**
146
- * User logout.
216
+ * User account logout.
217
+ *
218
+ * @handleName logout
147
219
  *
148
220
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
149
221
  * @param {string} token - Refresh token. Example: "abcdef123456".
150
- *
151
222
  * @return {boolean} Returns true if the logout was successful, or an error object if there was an issue.
152
223
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
153
- *
154
224
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
155
225
  */
156
226
  async logout(marker, token) {
@@ -167,9 +237,32 @@ class AuthProviderApi extends asyncModules_1.default {
167
237
  }
168
238
  return result;
169
239
  }
240
+ /**
241
+ * Logout of user account on all devices.
242
+ *
243
+ * @handleName logoutAll
244
+ *
245
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
246
+ * @return {boolean} Returns true if the logout was successful, or an error object if there was an issue.
247
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
248
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
249
+ */
250
+ async logoutAll(marker) {
251
+ const result = await this._fetchPost(`/marker/${marker}/users/logout-all`);
252
+ if (result) {
253
+ this.state.accessToken = undefined;
254
+ this.state.refreshToken = undefined;
255
+ if (this.state.saveFunction) {
256
+ this.state.saveFunction('');
257
+ }
258
+ }
259
+ return result;
260
+ }
170
261
  /**
171
262
  * Change password.
172
263
  *
264
+ * @handleName changePassword
265
+ *
173
266
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
174
267
  * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
175
268
  * @param {string} eventIdentifier - The text identifier of the event. Example: "reg".
@@ -177,13 +270,9 @@ class AuthProviderApi extends asyncModules_1.default {
177
270
  * @param {string} code - Service code. Example: "123456".
178
271
  * @param {string} newPassword - New password. Example: "newPassword123".
179
272
  * @param {string} [repeatPassword] - Optional variable contains repeat new password for validation. Example: "newPassword123".
180
- *
181
273
  * @return {boolean} Returns true if the password was successfully changed, or an error object if there was an issue.
182
274
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
183
- *
184
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
185
- * @example await AuthProvider.changePassword('email', userIdentifier, type, code, newPassword, repeatPassword);
186
- *
275
+ * @description User password change (only for tariffs with account activation and the Activation feature enabled).
187
276
  */
188
277
  async changePassword(marker, userIdentifier, eventIdentifier, type, code, newPassword, repeatPassword) {
189
278
  const data = {
@@ -200,14 +289,14 @@ class AuthProviderApi extends asyncModules_1.default {
200
289
  /**
201
290
  * Get all auth providers objects.
202
291
  *
292
+ * @handleName getAuthProviders
293
+ *
203
294
  * @param {string} [langCode] - Language code. Default: "en_US".
204
295
  * @param {number} [offset] - Parameter for pagination. Default: 0.
205
296
  * @param {number} [limit] - Parameter for pagination. Default: 30.
206
- *
207
297
  * @return {IAuthProvidersEntity[]} Returns an array of auth provider objects.
208
298
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
209
- *
210
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
299
+ * @description Getting all objects of authorization providers.
211
300
  */
212
301
  async getAuthProviders(langCode = this.state.lang, offset = 0, limit = 30) {
213
302
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
@@ -216,17 +305,54 @@ class AuthProviderApi extends asyncModules_1.default {
216
305
  /**
217
306
  * Get one auth provider object by marker.
218
307
  *
308
+ * @handleName getAuthProviderByMarker
309
+ *
219
310
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
220
311
  * @param {string} [langCode] - Language code. Default: "en_US".
221
- *
222
312
  * @return {IAuthProvidersEntity} Returns an auth provider object.
223
313
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
224
- *
225
- * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
314
+ * @description Getting a single authorization provider object by marker.
226
315
  */
227
- async getMarker(marker, langCode = this.state.lang) {
316
+ async getAuthProviderByMarker(marker, langCode = this.state.lang) {
228
317
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
229
318
  return this._normalizeData(result);
230
319
  }
320
+ /**
321
+ * Getting active user sessions data.
322
+ *
323
+ * @handleName getActiveSessions
324
+ *
325
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
326
+ * @return {IAuthProvidersEntity} Returns an auth provider object.
327
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
328
+ * @description Getting a single authorization provider object by marker.
329
+ */
330
+ async getActiveSessionsByMarker(marker) {
331
+ const result = await this._fetchGet(`/marker/${marker}/users/sessions`);
332
+ return this._normalizeData(result);
333
+ }
334
+ /**
335
+ * User registration (authorization) via OAUTH.
336
+ *
337
+ * @handleName oauthSignUp
338
+ *
339
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
340
+ * @param {IOAuthSignUpData} body - Object contains OAuth information for registration. Example:
341
+ {
342
+ "client_id": "34346983-luuct343473qdkqidjopdfp3eb3k4thp.apps.googleusercontent.com",
343
+ "client_secret": "43434343434",
344
+ "code": "4/0AVMBsJgwewewewewewei4D7T6E_fbswxnL3g",
345
+ "grant_type": "authorization_code",
346
+ "redirect_uri": "http://localhost:3000"
347
+ }
348
+ * @param {string} [langCode] - Language code. Default: "en_US".
349
+ * @return {ISignUpEntity} Returns a user object.
350
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
351
+ * @description User registration (authorization) via OAUTH.
352
+ */
353
+ async oauthSignUp(marker, body, langCode = this.state.lang) {
354
+ const result = await this._fetchPost(`/marker/${marker}/oauth`, this._normalizePostBody(body, langCode));
355
+ return result;
356
+ }
231
357
  }
232
358
  exports.default = AuthProviderApi;