oneentry 1.0.139 → 1.0.140

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