oneentry 1.0.123 → 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.
- package/README.md +24 -22
- package/dist/admins/adminsApi.d.ts +30 -9
- package/dist/admins/adminsApi.js +30 -9
- package/dist/admins/adminsInterfaces.d.ts +77 -32
- package/dist/attribute-sets/attributeSetsApi.d.ts +36 -22
- package/dist/attribute-sets/attributeSetsApi.js +41 -25
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +133 -39
- package/dist/auth-provider/authProviderApi.d.ts +209 -88
- package/dist/auth-provider/authProviderApi.js +226 -87
- package/dist/auth-provider/authProvidersInterfaces.d.ts +345 -18
- package/dist/base/asyncModules.d.ts +38 -28
- package/dist/base/asyncModules.js +178 -47
- package/dist/base/result.js +23 -0
- package/dist/base/syncModules.d.ts +48 -44
- package/dist/base/syncModules.js +84 -64
- package/dist/base/utils.d.ts +1 -1
- package/dist/blocks/blocksApi.d.ts +48 -27
- package/dist/blocks/blocksApi.js +48 -27
- package/dist/blocks/blocksInterfaces.d.ts +126 -32
- package/dist/events/eventsApi.d.ts +45 -12
- package/dist/events/eventsApi.js +47 -12
- package/dist/events/eventsInterfaces.d.ts +50 -3
- package/dist/file-uploading/fileUploadingApi.d.ts +57 -29
- package/dist/file-uploading/fileUploadingApi.js +57 -30
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +90 -17
- package/dist/forms/formsApi.d.ts +20 -9
- package/dist/forms/formsApi.js +19 -8
- package/dist/forms/formsInterfaces.d.ts +86 -23
- package/dist/formsData/formsDataApi.d.ts +33 -21
- package/dist/formsData/formsDataApi.js +33 -21
- package/dist/formsData/formsDataInterfaces.d.ts +212 -41
- package/dist/general-types/generalTypesApi.d.ts +11 -2
- package/dist/general-types/generalTypesApi.js +10 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/integration-collections/integrationCollectionsApi.d.ts +134 -81
- package/dist/integration-collections/integrationCollectionsApi.js +135 -83
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +246 -43
- package/dist/locales/localesApi.d.ts +5 -1
- package/dist/locales/localesApi.js +5 -1
- package/dist/locales/localesInterfaces.d.ts +19 -12
- package/dist/menus/menusApi.d.ts +6 -3
- package/dist/menus/menusApi.js +6 -3
- package/dist/menus/menusInterfaces.d.ts +60 -21
- package/dist/orders/ordersApi.d.ts +84 -66
- package/dist/orders/ordersApi.js +91 -71
- package/dist/orders/ordersInterfaces.d.ts +282 -86
- package/dist/pages/pagesApi.d.ts +101 -42
- package/dist/pages/pagesApi.js +93 -39
- package/dist/pages/pagesInterfaces.d.ts +218 -75
- package/dist/payments/paymentsApi.d.ts +53 -39
- package/dist/payments/paymentsApi.js +55 -40
- package/dist/payments/paymentsInterfaces.d.ts +121 -56
- package/dist/product-statuses/productStatusesApi.d.ts +17 -17
- package/dist/product-statuses/productStatusesApi.js +16 -19
- package/dist/product-statuses/productStatusesInterfaces.d.ts +43 -14
- package/dist/products/productsApi.d.ts +309 -177
- package/dist/products/productsApi.js +313 -167
- package/dist/products/productsInterfaces.d.ts +447 -81
- package/dist/system/systemApi.d.ts +42 -12
- package/dist/system/systemApi.js +43 -10
- package/dist/system/systemInterfaces.d.ts +7 -0
- package/dist/templates/templatesApi.d.ts +24 -20
- package/dist/templates/templatesApi.js +22 -21
- package/dist/templates/templatesInterfaces.d.ts +48 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +17 -17
- package/dist/templates-preview/templatesPreviewApi.js +16 -19
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +85 -32
- package/dist/users/usersApi.d.ts +59 -35
- package/dist/users/usersApi.js +62 -35
- package/dist/users/usersInterfaces.d.ts +136 -14
- package/dist/web-socket/wsApi.d.ts +4 -5
- package/dist/web-socket/wsApi.js +4 -5
- package/dist/web-socket/wsInterfaces.d.ts +2 -1
- package/package.json +20 -18
|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with auth services.
|
|
9
|
+
*
|
|
9
10
|
* @handle /api/content/users-auth-providers
|
|
11
|
+
* @class AuthProviderApi
|
|
12
|
+
* @extends AsyncModules
|
|
13
|
+
* @implements {IAuthProvider}
|
|
14
|
+
*
|
|
15
|
+
* @description This class provides methods for user registration, authentication, and management of authentication providers.
|
|
10
16
|
*/
|
|
11
17
|
class AuthProviderApi extends asyncModules_1.default {
|
|
12
18
|
constructor(state) {
|
|
@@ -14,38 +20,65 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
14
20
|
this._url = state.url + '/api/content/users-auth-providers';
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
|
-
* User registration
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
* @param {string}
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
23
|
+
* User registration.
|
|
24
|
+
*
|
|
25
|
+
* @handleName signUp
|
|
26
|
+
*
|
|
27
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
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
|
+
}
|
|
78
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
79
|
+
* @return {ISignUpEntity} Returns a user object.
|
|
80
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
81
|
+
* @description User registration (❗️For a provider with user activation, the activation code is sent through the corresponding user notification method).
|
|
49
82
|
*/
|
|
50
83
|
async signUp(marker, body, langCode = this.state.lang) {
|
|
51
84
|
body['langCode'] = langCode;
|
|
@@ -53,11 +86,16 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
53
86
|
return this._normalizeData(result);
|
|
54
87
|
}
|
|
55
88
|
/**
|
|
56
|
-
* Getting a user activation code. The code is returned via the appropriate user notification method
|
|
89
|
+
* Getting a user activation code. The code is returned via the appropriate user notification method.
|
|
57
90
|
*
|
|
58
|
-
* @
|
|
59
|
-
*
|
|
60
|
-
* @param {string}
|
|
91
|
+
* @handleName generateCode
|
|
92
|
+
*
|
|
93
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
94
|
+
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
95
|
+
* @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
|
|
96
|
+
* @return {void} Returns void if the code is successfully generated, or an error object if there was an issue.
|
|
97
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
98
|
+
* @description Obtaining a code to activate the user.
|
|
61
99
|
*/
|
|
62
100
|
async generateCode(marker, userIdentifier, eventIdentifier) {
|
|
63
101
|
const data = {
|
|
@@ -71,10 +109,15 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
71
109
|
/**
|
|
72
110
|
* User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
|
|
73
111
|
*
|
|
74
|
-
* @
|
|
75
|
-
*
|
|
76
|
-
* @param {string}
|
|
77
|
-
* @param {string}
|
|
112
|
+
* @handleName checkCode
|
|
113
|
+
*
|
|
114
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
115
|
+
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
116
|
+
* @param {string} eventIdentifier - Text identifier of the event object for which the code is generated. Example: "user_registration".
|
|
117
|
+
* @param {string} code - Service code. Example: "123456".
|
|
118
|
+
* @return {boolean} Returns true if the code is correct, or an error object if there was an issue.
|
|
119
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
120
|
+
* @description Checking the user activation code
|
|
78
121
|
*/
|
|
79
122
|
async checkCode(marker, userIdentifier, eventIdentifier, code) {
|
|
80
123
|
const data = {
|
|
@@ -88,9 +131,14 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
88
131
|
/**
|
|
89
132
|
* User activate.
|
|
90
133
|
*
|
|
91
|
-
* @
|
|
92
|
-
*
|
|
93
|
-
* @param {string}
|
|
134
|
+
* @handleName activateUser
|
|
135
|
+
*
|
|
136
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
137
|
+
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
138
|
+
* @param {string} code - Service code. Example: "123456".
|
|
139
|
+
* @return {boolean} Returns true if the user was successfully activated, or an error object if there was an issue.
|
|
140
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
141
|
+
* @description User activation.
|
|
94
142
|
*/
|
|
95
143
|
async activateUser(marker, userIdentifier, code) {
|
|
96
144
|
const data = {
|
|
@@ -101,41 +149,58 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
101
149
|
return result;
|
|
102
150
|
}
|
|
103
151
|
/**
|
|
104
|
-
* User authorization
|
|
105
|
-
*
|
|
106
|
-
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
107
|
-
* @param {IAuthPostBody} data - Array of objects contains auth information
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* const data = {
|
|
111
|
-
* authData: [
|
|
112
|
-
* {
|
|
113
|
-
* marker: "login",
|
|
114
|
-
* value: "test"
|
|
115
|
-
* },
|
|
116
|
-
* {
|
|
117
|
-
* marker: "password",
|
|
118
|
-
* value: "12345"
|
|
119
|
-
* }
|
|
120
|
-
* ]
|
|
121
|
-
* }
|
|
152
|
+
* User authorization.
|
|
122
153
|
*
|
|
154
|
+
* @handleName auth
|
|
155
|
+
*
|
|
156
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
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".
|
|
179
|
+
*
|
|
180
|
+
* @return {IAuthEntity} Returns an auth entity object.
|
|
181
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
182
|
+
* @description User authorization.
|
|
123
183
|
*/
|
|
124
|
-
async auth(marker,
|
|
125
|
-
const result = await this._fetchPost(`/marker/${marker}/users/auth`,
|
|
184
|
+
async auth(marker, body) {
|
|
185
|
+
const result = await this._fetchPost(`/marker/${marker}/users/auth`, body);
|
|
126
186
|
this.state.accessToken = result.accessToken;
|
|
127
187
|
this.state.refreshToken = result.refreshToken;
|
|
188
|
+
// console.log(result);
|
|
128
189
|
if (this.state.saveFunction) {
|
|
129
190
|
this.state.saveFunction(result.refreshToken);
|
|
130
191
|
}
|
|
131
192
|
return result;
|
|
132
193
|
}
|
|
133
194
|
/**
|
|
134
|
-
* Refresh token
|
|
195
|
+
* Refresh token.
|
|
135
196
|
*
|
|
136
|
-
* @
|
|
137
|
-
* @param {string} [token] - Refresh token
|
|
197
|
+
* @handleName refresh
|
|
138
198
|
*
|
|
199
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
200
|
+
* @param {string} token - Refresh token. Example: "abcdef123456".
|
|
201
|
+
* @return {IAuthEntity} Returns an auth entity object with the following values: accessToken, refreshToken, user, and other auth-related data.
|
|
202
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
203
|
+
* @description User token refresh.
|
|
139
204
|
*/
|
|
140
205
|
async refresh(marker, token) {
|
|
141
206
|
const data = { refreshToken: token };
|
|
@@ -148,11 +213,14 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
148
213
|
return result;
|
|
149
214
|
}
|
|
150
215
|
/**
|
|
151
|
-
* User logout.
|
|
216
|
+
* User account logout.
|
|
152
217
|
*
|
|
153
|
-
* @
|
|
154
|
-
* @param {string} token - Refresh token
|
|
218
|
+
* @handleName logout
|
|
155
219
|
*
|
|
220
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
221
|
+
* @param {string} token - Refresh token. Example: "abcdef123456".
|
|
222
|
+
* @return {boolean} Returns true if the logout was successful, or an error object if there was an issue.
|
|
223
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
156
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.
|
|
157
225
|
*/
|
|
158
226
|
async logout(marker, token) {
|
|
@@ -170,22 +238,46 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
170
238
|
return result;
|
|
171
239
|
}
|
|
172
240
|
/**
|
|
173
|
-
*
|
|
241
|
+
* Logout of user account on all devices.
|
|
174
242
|
*
|
|
175
|
-
* @
|
|
176
|
-
* @param {string} [userIdentifier] - The text identifier of the user's object (user login)
|
|
177
|
-
* @param {string} [type] - Operation type (1 - for changing password, 2 - for recovery)
|
|
178
|
-
* @param {string} [code] - Service code
|
|
179
|
-
* @param {string} [newPassword] - New password
|
|
180
|
-
* @param {string} [repeatPassword] - Optional variable contains repeat new password for validation
|
|
243
|
+
* @handleName logoutAll
|
|
181
244
|
*
|
|
182
|
-
* @
|
|
183
|
-
*
|
|
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
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Change password.
|
|
263
|
+
*
|
|
264
|
+
* @handleName changePassword
|
|
184
265
|
*
|
|
266
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
267
|
+
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
268
|
+
* @param {string} eventIdentifier - The text identifier of the event. Example: "reg".
|
|
269
|
+
* @param {string} type - Operation type (1 - for changing password, 2 - for recovery). Example: 1.
|
|
270
|
+
* @param {string} code - Service code. Example: "123456".
|
|
271
|
+
* @param {string} newPassword - New password. Example: "newPassword123".
|
|
272
|
+
* @param {string} [repeatPassword] - Optional variable contains repeat new password for validation. Example: "newPassword123".
|
|
273
|
+
* @return {boolean} Returns true if the password was successfully changed, or an error object if there was an issue.
|
|
274
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
275
|
+
* @description User password change (only for tariffs with account activation and the Activation feature enabled).
|
|
185
276
|
*/
|
|
186
|
-
async changePassword(marker, userIdentifier, type, code, newPassword, repeatPassword) {
|
|
277
|
+
async changePassword(marker, userIdentifier, eventIdentifier, type, code, newPassword, repeatPassword) {
|
|
187
278
|
const data = {
|
|
188
279
|
userIdentifier: userIdentifier,
|
|
280
|
+
eventIdentifier: eventIdentifier,
|
|
189
281
|
code: code,
|
|
190
282
|
type: type,
|
|
191
283
|
password1: newPassword,
|
|
@@ -195,25 +287,72 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
195
287
|
return result;
|
|
196
288
|
}
|
|
197
289
|
/**
|
|
198
|
-
* Get all auth providers objects
|
|
290
|
+
* Get all auth providers objects.
|
|
199
291
|
*
|
|
200
|
-
* @
|
|
201
|
-
*
|
|
202
|
-
* @param {
|
|
292
|
+
* @handleName getAuthProviders
|
|
293
|
+
*
|
|
294
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
295
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
296
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
297
|
+
* @return {IAuthProvidersEntity[]} Returns an array of auth provider objects.
|
|
298
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
299
|
+
* @description Getting all objects of authorization providers.
|
|
203
300
|
*/
|
|
204
301
|
async getAuthProviders(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
205
302
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
206
303
|
return this._normalizeData(result);
|
|
207
304
|
}
|
|
208
305
|
/**
|
|
209
|
-
* Get one auth provider object by marker
|
|
306
|
+
* Get one auth provider object by marker.
|
|
307
|
+
*
|
|
308
|
+
* @handleName getAuthProviderByMarker
|
|
210
309
|
*
|
|
211
|
-
* @param {string}
|
|
212
|
-
* @param {string} [langCode] -
|
|
310
|
+
* @param {string} marker - The text identifier of the authorization provider. Example: "email".
|
|
311
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
312
|
+
* @return {IAuthProvidersEntity} Returns an auth provider object.
|
|
313
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
314
|
+
* @description Getting a single authorization provider object by marker.
|
|
213
315
|
*/
|
|
214
|
-
async
|
|
316
|
+
async getAuthProviderByMarker(marker, langCode = this.state.lang) {
|
|
215
317
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
216
318
|
return this._normalizeData(result);
|
|
217
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
|
+
}
|
|
218
357
|
}
|
|
219
358
|
exports.default = AuthProviderApi;
|