oneentry 1.0.142 → 1.0.144

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 (150) hide show
  1. package/configure.js +2 -2
  2. package/dist/admins/adminsApi.d.ts +50 -0
  3. package/dist/admins/adminsApi.js +65 -0
  4. package/dist/admins/adminsInterfaces.d.ts +98 -0
  5. package/dist/admins/adminsInterfaces.js +2 -0
  6. package/dist/admins/adminsSchemas.d.ts +30 -0
  7. package/dist/admins/adminsSchemas.js +27 -0
  8. package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
  9. package/dist/attribute-sets/attributeSetsApi.js +98 -0
  10. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +185 -0
  11. package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
  12. package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
  13. package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
  14. package/dist/auth-provider/authProviderApi.d.ts +249 -0
  15. package/dist/auth-provider/authProviderApi.js +354 -0
  16. package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
  17. package/dist/auth-provider/authProviderSchemas.js +82 -0
  18. package/dist/auth-provider/authProvidersInterfaces.d.ts +412 -0
  19. package/dist/auth-provider/authProvidersInterfaces.js +2 -0
  20. package/dist/base/asyncModules.d.ts +80 -0
  21. package/dist/base/asyncModules.js +448 -0
  22. package/dist/base/result.d.ts +39 -0
  23. package/dist/base/result.js +154 -0
  24. package/dist/base/stateModule.d.ts +41 -0
  25. package/dist/base/stateModule.js +128 -0
  26. package/dist/base/syncModules.d.ts +286 -0
  27. package/dist/base/syncModules.js +716 -0
  28. package/dist/base/utils.d.ts +197 -0
  29. package/dist/base/utils.js +2 -0
  30. package/dist/base/validation.d.ts +118 -0
  31. package/dist/base/validation.js +132 -0
  32. package/dist/blocks/blocksApi.d.ts +88 -0
  33. package/dist/blocks/blocksApi.js +207 -0
  34. package/dist/blocks/blocksInterfaces.d.ts +179 -0
  35. package/dist/blocks/blocksInterfaces.js +2 -0
  36. package/dist/blocks/blocksSchemas.d.ts +195 -0
  37. package/dist/blocks/blocksSchemas.js +43 -0
  38. package/dist/discounts/discountsApi.d.ts +76 -0
  39. package/dist/discounts/discountsApi.js +116 -0
  40. package/dist/discounts/discountsInterfaces.d.ts +217 -0
  41. package/dist/discounts/discountsInterfaces.js +2 -0
  42. package/dist/events/eventsApi.d.ts +60 -0
  43. package/dist/events/eventsApi.js +97 -0
  44. package/dist/events/eventsInterfaces.d.ts +87 -0
  45. package/dist/events/eventsInterfaces.js +2 -0
  46. package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
  47. package/dist/file-uploading/fileUploadingApi.js +129 -0
  48. package/dist/file-uploading/fileUploadingInterfaces.d.ts +114 -0
  49. package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
  50. package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
  51. package/dist/file-uploading/fileUploadingSchemas.js +21 -0
  52. package/dist/forms/formsApi.d.ts +42 -0
  53. package/dist/forms/formsApi.js +57 -0
  54. package/dist/forms/formsInterfaces.d.ts +144 -0
  55. package/dist/forms/formsInterfaces.js +2 -0
  56. package/dist/forms/formsSchemas.d.ts +53 -0
  57. package/dist/forms/formsSchemas.js +34 -0
  58. package/dist/forms-data/formsDataApi.d.ts +106 -0
  59. package/dist/forms-data/formsDataApi.js +189 -0
  60. package/dist/forms-data/formsDataInterfaces.d.ts +522 -0
  61. package/dist/forms-data/formsDataInterfaces.js +2 -0
  62. package/dist/forms-data/formsDataSchemas.d.ts +115 -0
  63. package/dist/forms-data/formsDataSchemas.js +86 -0
  64. package/dist/general-types/generalTypesApi.d.ts +28 -0
  65. package/dist/general-types/generalTypesApi.js +38 -0
  66. package/dist/general-types/generalTypesInterfaces.d.ts +29 -0
  67. package/dist/general-types/generalTypesInterfaces.js +2 -0
  68. package/dist/general-types/generalTypesSchemas.d.ts +52 -0
  69. package/dist/general-types/generalTypesSchemas.js +36 -0
  70. package/dist/index.d.ts +124 -0
  71. package/dist/index.js +103 -0
  72. package/dist/integration-collections/integrationCollectionsApi.d.ts +163 -0
  73. package/dist/integration-collections/integrationCollectionsApi.js +220 -0
  74. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
  75. package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
  76. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
  77. package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
  78. package/dist/locales/localesApi.d.ts +27 -0
  79. package/dist/locales/localesApi.js +37 -0
  80. package/dist/locales/localesInterfaces.d.ts +40 -0
  81. package/dist/locales/localesInterfaces.js +2 -0
  82. package/dist/locales/localesSchemas.d.ts +32 -0
  83. package/dist/locales/localesSchemas.js +26 -0
  84. package/dist/menus/menusApi.d.ts +29 -0
  85. package/dist/menus/menusApi.js +39 -0
  86. package/dist/menus/menusInterfaces.d.ts +87 -0
  87. package/dist/menus/menusInterfaces.js +3 -0
  88. package/dist/menus/menusSchemas.d.ts +16 -0
  89. package/dist/menus/menusSchemas.js +28 -0
  90. package/dist/orders/ordersApi.d.ts +175 -0
  91. package/dist/orders/ordersApi.js +247 -0
  92. package/dist/orders/ordersInterfaces.d.ts +593 -0
  93. package/dist/orders/ordersInterfaces.js +2 -0
  94. package/dist/orders/ordersSchemas.d.ts +120 -0
  95. package/dist/orders/ordersSchemas.js +101 -0
  96. package/dist/pages/pagesApi.d.ts +151 -0
  97. package/dist/pages/pagesApi.js +390 -0
  98. package/dist/pages/pagesInterfaces.d.ts +286 -0
  99. package/dist/pages/pagesInterfaces.js +2 -0
  100. package/dist/pages/pagesSchemas.d.ts +85 -0
  101. package/dist/pages/pagesSchemas.js +46 -0
  102. package/dist/payments/paymentsApi.d.ts +82 -0
  103. package/dist/payments/paymentsApi.js +121 -0
  104. package/dist/payments/paymentsInterfaces.d.ts +200 -0
  105. package/dist/payments/paymentsInterfaces.js +2 -0
  106. package/dist/payments/paymentsSchemas.d.ts +100 -0
  107. package/dist/payments/paymentsSchemas.js +65 -0
  108. package/dist/product-statuses/productStatusesApi.d.ts +47 -0
  109. package/dist/product-statuses/productStatusesApi.js +70 -0
  110. package/dist/product-statuses/productStatusesInterfaces.d.ts +62 -0
  111. package/dist/product-statuses/productStatusesInterfaces.js +2 -0
  112. package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
  113. package/dist/product-statuses/productStatusesSchemas.js +30 -0
  114. package/dist/products/productsApi.d.ts +366 -0
  115. package/dist/products/productsApi.js +458 -0
  116. package/dist/products/productsInterfaces.d.ts +593 -0
  117. package/dist/products/productsInterfaces.js +2 -0
  118. package/dist/products/productsSchemas.d.ts +200 -0
  119. package/dist/products/productsSchemas.js +98 -0
  120. package/dist/sitemap/sitemapApi.d.ts +35 -0
  121. package/dist/sitemap/sitemapApi.js +45 -0
  122. package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
  123. package/dist/sitemap/sitemapInterfaces.js +2 -0
  124. package/dist/system/systemApi.d.ts +43 -0
  125. package/dist/system/systemApi.js +56 -0
  126. package/dist/system/systemInterfaces.d.ts +29 -0
  127. package/dist/system/systemInterfaces.js +2 -0
  128. package/dist/templates/templatesApi.d.ts +49 -0
  129. package/dist/templates/templatesApi.js +75 -0
  130. package/dist/templates/templatesInterfaces.d.ts +67 -0
  131. package/dist/templates/templatesInterfaces.js +2 -0
  132. package/dist/templates/templatesSchemas.d.ts +48 -0
  133. package/dist/templates/templatesSchemas.js +31 -0
  134. package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
  135. package/dist/templates-preview/templatesPreviewApi.js +53 -0
  136. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +119 -0
  137. package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
  138. package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
  139. package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
  140. package/dist/users/usersApi.d.ts +143 -0
  141. package/dist/users/usersApi.js +171 -0
  142. package/dist/users/usersInterfaces.d.ts +231 -0
  143. package/dist/users/usersInterfaces.js +2 -0
  144. package/dist/users/usersSchemas.d.ts +38 -0
  145. package/dist/users/usersSchemas.js +28 -0
  146. package/dist/web-socket/wsApi.d.ts +25 -0
  147. package/dist/web-socket/wsApi.js +45 -0
  148. package/dist/web-socket/wsInterfaces.d.ts +16 -0
  149. package/dist/web-socket/wsInterfaces.js +2 -0
  150. package/package.json +2 -80
@@ -0,0 +1,354 @@
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
+ * constructor
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
+ if (!('statusCode' in validated)) {
191
+ this.state.accessToken = validated.accessToken;
192
+ this.state.refreshToken = validated.refreshToken;
193
+ if (this.state.saveFunction && validated.refreshToken) {
194
+ this.state.saveFunction(validated.refreshToken);
195
+ }
196
+ }
197
+ return validated;
198
+ }
199
+ /**
200
+ * Refresh token.
201
+ * @handleName refresh
202
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
203
+ * @param {string} token - Refresh token. Example: "abcdef123456".
204
+ * @returns {Promise<IAuthEntity | IError>} Returns an auth entity object with the following values: accessToken, refreshToken, user, and other auth-related data.
205
+ * @throws {IError} When isShell=false and an error occurs during the fetch
206
+ * @description User token refresh.
207
+ */
208
+ async refresh(marker, token) {
209
+ const data = { refreshToken: token };
210
+ const result = await this._fetchPost(`/marker/${marker}/users/refresh`, data);
211
+ if (!('statusCode' in result)) {
212
+ this.state.accessToken = result.accessToken;
213
+ this.state.refreshToken = result.refreshToken;
214
+ if (this.state.saveFunction) {
215
+ this.state.saveFunction(result.refreshToken);
216
+ }
217
+ }
218
+ return result;
219
+ }
220
+ /**
221
+ * User account logout.
222
+ * @handleName logout
223
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
224
+ * @param {string} token - Refresh token. Example: "abcdef123456".
225
+ * @returns {Promise<boolean | IError>} Returns true if the logout was successful, or an error object if there was an issue.
226
+ * @throws {IError} When isShell=false and an error occurs during the fetch
227
+ * @description This method requires user authorization.
228
+ * @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}.
229
+ */
230
+ async logout(marker, token) {
231
+ const data = {
232
+ refreshToken: token,
233
+ };
234
+ const result = await this._fetchPost(`/marker/${marker}/users/logout`, data);
235
+ if (result) {
236
+ this.state.accessToken = undefined;
237
+ this.state.refreshToken = undefined;
238
+ if (this.state.saveFunction) {
239
+ this.state.saveFunction('');
240
+ }
241
+ }
242
+ return result;
243
+ }
244
+ /**
245
+ * Logout of user account on all devices.
246
+ * @handleName logoutAll
247
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
248
+ * @returns {Promise<boolean | IError>} Returns true if the logout was successful, or an error object if there was an issue.
249
+ * @throws {IError} When isShell=false and an error occurs during the fetch
250
+ * @description This method requires user authorization.
251
+ * @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}.
252
+ */
253
+ async logoutAll(marker) {
254
+ const result = await this._fetchPost(`/marker/${marker}/users/logout-all`);
255
+ if (result) {
256
+ this.state.accessToken = undefined;
257
+ this.state.refreshToken = undefined;
258
+ if (this.state.saveFunction) {
259
+ this.state.saveFunction('');
260
+ }
261
+ }
262
+ return result;
263
+ }
264
+ /**
265
+ * Change password.
266
+ * @handleName changePassword
267
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
268
+ * @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
269
+ * @param {string} eventIdentifier - The text identifier of the event. Example: "reg".
270
+ * @param {string} type - Operation type (1 - for changing password, 2 - for recovery). Example: 1.
271
+ * @param {string} code - Service code. Example: "123456".
272
+ * @param {string} newPassword - New password. Example: "newPassword123".
273
+ * @param {string} [repeatPassword] - Optional variable contains repeat new password for validation. Example: "newPassword123".
274
+ * @returns {Promise<boolean | IError>} Returns true if the password was successfully changed, or an error object if there was an issue.
275
+ * @throws {IError} When isShell=false and an error occurs during the fetch
276
+ * @description User password change (only for tariffs with account activation and the Activation feature enabled).
277
+ */
278
+ async changePassword(marker, userIdentifier, eventIdentifier, type, code, newPassword, repeatPassword) {
279
+ const data = {
280
+ userIdentifier: userIdentifier,
281
+ eventIdentifier: eventIdentifier,
282
+ code: code,
283
+ type: type,
284
+ password1: newPassword,
285
+ password2: repeatPassword !== null && repeatPassword !== void 0 ? repeatPassword : newPassword,
286
+ };
287
+ const result = await this._fetchPost(`/marker/${marker}/users/change-password`, data);
288
+ return result;
289
+ }
290
+ /**
291
+ * Get all auth providers objects.
292
+ * @handleName getAuthProviders
293
+ * @param {string} [langCode] - Language code. Default: "en_US".
294
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
295
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
296
+ * @returns {Promise<IAuthProvidersEntity[] | IError>} Returns an array of auth provider objects.
297
+ * @throws {IError} When isShell=false and an error occurs during the fetch
298
+ * @description Getting all objects of authorization providers.
299
+ */
300
+ async getAuthProviders(langCode = this.state.lang, offset = 0, limit = 30) {
301
+ const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
302
+ // Validate response if validation is enabled
303
+ const validated = this._validateResponse(result, authProviderSchemas_1.AuthProvidersResponseSchema);
304
+ return this._normalizeData(validated);
305
+ }
306
+ /**
307
+ * Get one auth provider object by marker.
308
+ * @handleName getAuthProviderByMarker
309
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
310
+ * @param {string} [langCode] - Language code. Default: "en_US".
311
+ * @returns {Promise<IAuthProvidersEntity | IError>} Returns an auth provider object.
312
+ * @throws {IError} When isShell=false and an error occurs during the fetch
313
+ * @description Getting a single authorization provider object by marker.
314
+ */
315
+ async getAuthProviderByMarker(marker, langCode = this.state.lang) {
316
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
317
+ return this._normalizeData(result);
318
+ }
319
+ /**
320
+ * Getting active user sessions data.
321
+ * @handleName getActiveSessionsByMarker
322
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
323
+ * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
324
+ * @throws {IError} When isShell=false and an error occurs during the fetch
325
+ * @description Getting a single authorization provider object by marker.
326
+ */
327
+ async getActiveSessionsByMarker(marker) {
328
+ const result = await this._fetchGet(`/marker/${marker}/users/sessions`);
329
+ return this._normalizeData(result);
330
+ }
331
+ /**
332
+ * User registration (authorization) via OAUTH.
333
+ * @handleName oauth
334
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
335
+ * @param {IOauthData} body - Object contains OAuth information for registration.
336
+ * @example
337
+ {
338
+ "client_id": "34346983-luuct343473qdkqidjopdfp3eb3k4thp.apps.googleusercontent.com",
339
+ "client_secret": "43434343434",
340
+ "code": "4/0AVMBsJgwewewewewewei4D7T6E_fbswxnL3g",
341
+ "grant_type": "authorization_code",
342
+ "redirect_uri": "http://localhost:3000"
343
+ }
344
+ * @param {string} [langCode] - Language code. Default: "en_US".
345
+ * @returns {Promise<ISignUpEntity | IError>} Returns a user object.
346
+ * @throws {IError} When isShell=false and an error occurs during the fetch
347
+ * @description User registration (authorization) via OAUTH.
348
+ */
349
+ async oauth(marker, body, langCode = this.state.lang) {
350
+ const result = await this._fetchPost(`/marker/${marker}/oauth`, this._normalizePostBody(body, langCode));
351
+ return result;
352
+ }
353
+ }
354
+ exports.default = AuthProviderApi;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Validation schemas for Auth Provider module
3
+ * @description Zod schemas for validating auth-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Sign up response schema
8
+ * @description Schema for validating sign up response
9
+ */
10
+ export declare const SignUpResponseSchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ identifier: z.ZodOptional<z.ZodString>;
13
+ email: z.ZodOptional<z.ZodString>;
14
+ phoneMask: z.ZodOptional<z.ZodString>;
15
+ phoneCode: z.ZodOptional<z.ZodString>;
16
+ phoneNumber: z.ZodOptional<z.ZodString>;
17
+ statusMarker: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>;
19
+ /**
20
+ * Auth response schema (login/refresh)
21
+ * @description Schema for validating auth response
22
+ */
23
+ export declare const AuthResponseSchema: z.ZodObject<{
24
+ accessToken: z.ZodString;
25
+ refreshToken: z.ZodString;
26
+ userIdentifier: z.ZodOptional<z.ZodString>;
27
+ authProviderIdentifier: z.ZodOptional<z.ZodString>;
28
+ user: z.ZodOptional<z.ZodObject<{
29
+ id: z.ZodNumber;
30
+ identifier: z.ZodOptional<z.ZodString>;
31
+ email: z.ZodOptional<z.ZodString>;
32
+ phoneMask: z.ZodOptional<z.ZodString>;
33
+ phoneCode: z.ZodOptional<z.ZodString>;
34
+ phoneNumber: z.ZodOptional<z.ZodString>;
35
+ statusMarker: z.ZodOptional<z.ZodString>;
36
+ formData: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
37
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
38
+ authProviderIdentifier: z.ZodOptional<z.ZodString>;
39
+ formIdentifier: z.ZodOptional<z.ZodString>;
40
+ groups: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
41
+ state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
42
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
43
+ }, z.core.$strip>>;
44
+ }, z.core.$strip>;
45
+ /**
46
+ * User response schema
47
+ * @description Schema for validating user response
48
+ */
49
+ export declare const UserResponseSchema: z.ZodObject<{
50
+ id: z.ZodNumber;
51
+ identifier: z.ZodOptional<z.ZodString>;
52
+ email: z.ZodOptional<z.ZodString>;
53
+ phoneMask: z.ZodOptional<z.ZodString>;
54
+ phoneCode: z.ZodOptional<z.ZodString>;
55
+ phoneNumber: z.ZodOptional<z.ZodString>;
56
+ statusMarker: z.ZodOptional<z.ZodString>;
57
+ formData: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
58
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
59
+ authProviderIdentifier: z.ZodOptional<z.ZodString>;
60
+ formIdentifier: z.ZodOptional<z.ZodString>;
61
+ groups: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
62
+ state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
63
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
64
+ }, z.core.$strip>;
65
+ /**
66
+ * Auth provider entity schema
67
+ * @description Schema for validating auth provider entity
68
+ * Includes all fields returned by the API
69
+ */
70
+ export declare const AuthProviderEntitySchema: z.ZodObject<{
71
+ id: z.ZodNumber;
72
+ identifier: z.ZodString;
73
+ type: z.ZodString;
74
+ formIdentifier: z.ZodNullable<z.ZodString>;
75
+ userGroupIdentifier: z.ZodString;
76
+ isActive: z.ZodBoolean;
77
+ isCheckCode: z.ZodBoolean;
78
+ version: z.ZodNumber;
79
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
80
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
81
+ }, z.core.$strip>;
82
+ /**
83
+ * Auth providers list response schema
84
+ * @description Schema for validating auth providers list response
85
+ */
86
+ export declare const AuthProvidersResponseSchema: z.ZodArray<z.ZodObject<{
87
+ id: z.ZodNumber;
88
+ identifier: z.ZodString;
89
+ type: z.ZodString;
90
+ formIdentifier: z.ZodNullable<z.ZodString>;
91
+ userGroupIdentifier: z.ZodString;
92
+ isActive: z.ZodBoolean;
93
+ isCheckCode: z.ZodBoolean;
94
+ version: z.ZodNumber;
95
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
96
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
97
+ }, z.core.$strip>>;
98
+ /**
99
+ * Generate code response schema
100
+ * @description Schema for validating generate code response
101
+ */
102
+ export declare const GenerateCodeResponseSchema: z.ZodObject<{
103
+ success: z.ZodBoolean;
104
+ message: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>;
106
+ /**
107
+ * Logout response schema
108
+ * @description Schema for validating logout response
109
+ */
110
+ export declare const LogoutResponseSchema: z.ZodObject<{
111
+ success: z.ZodBoolean;
112
+ message: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>;
114
+ /**
115
+ * Active sessions response schema
116
+ * @description Schema for validating active sessions response
117
+ */
118
+ export declare const ActiveSessionSchema: z.ZodObject<{
119
+ deviceInfo: z.ZodObject<{
120
+ os: z.ZodString;
121
+ browser: z.ZodString;
122
+ location: z.ZodString;
123
+ }, z.core.$strip>;
124
+ }, z.core.$strip>;
125
+ export declare const ActiveSessionsResponseSchema: z.ZodArray<z.ZodObject<{
126
+ deviceInfo: z.ZodObject<{
127
+ os: z.ZodString;
128
+ browser: z.ZodString;
129
+ location: z.ZodString;
130
+ }, z.core.$strip>;
131
+ }, z.core.$strip>>;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActiveSessionsResponseSchema = exports.ActiveSessionSchema = exports.LogoutResponseSchema = exports.GenerateCodeResponseSchema = exports.AuthProvidersResponseSchema = exports.AuthProviderEntitySchema = exports.UserResponseSchema = exports.AuthResponseSchema = exports.SignUpResponseSchema = void 0;
4
+ /**
5
+ * Validation schemas for Auth Provider module
6
+ * @description Zod schemas for validating auth-related API responses
7
+ */
8
+ const zod_1 = require("zod");
9
+ const validation_1 = require("../base/validation");
10
+ /**
11
+ * Sign up response schema
12
+ * @description Schema for validating sign up response
13
+ */
14
+ exports.SignUpResponseSchema = zod_1.z.object({
15
+ id: zod_1.z.number(),
16
+ identifier: zod_1.z.string().optional(),
17
+ email: zod_1.z.string().email().optional(),
18
+ phoneMask: zod_1.z.string().optional(),
19
+ phoneCode: zod_1.z.string().optional(),
20
+ phoneNumber: zod_1.z.string().optional(),
21
+ statusMarker: zod_1.z.string().optional(),
22
+ });
23
+ /**
24
+ * Auth response schema (login/refresh)
25
+ * @description Schema for validating auth response
26
+ */
27
+ exports.AuthResponseSchema = validation_1.AuthEntitySchema;
28
+ /**
29
+ * User response schema
30
+ * @description Schema for validating user response
31
+ */
32
+ exports.UserResponseSchema = validation_1.UserEntitySchema;
33
+ /**
34
+ * Auth provider entity schema
35
+ * @description Schema for validating auth provider entity
36
+ * Includes all fields returned by the API
37
+ */
38
+ exports.AuthProviderEntitySchema = zod_1.z.object({
39
+ id: zod_1.z.number(),
40
+ identifier: zod_1.z.string(),
41
+ type: zod_1.z.string(),
42
+ formIdentifier: zod_1.z.string().nullable(),
43
+ userGroupIdentifier: zod_1.z.string(),
44
+ isActive: zod_1.z.boolean(),
45
+ isCheckCode: zod_1.z.boolean(),
46
+ version: zod_1.z.number(),
47
+ localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
48
+ config: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
49
+ });
50
+ /**
51
+ * Auth providers list response schema
52
+ * @description Schema for validating auth providers list response
53
+ */
54
+ exports.AuthProvidersResponseSchema = zod_1.z.array(exports.AuthProviderEntitySchema);
55
+ /**
56
+ * Generate code response schema
57
+ * @description Schema for validating generate code response
58
+ */
59
+ exports.GenerateCodeResponseSchema = zod_1.z.object({
60
+ success: zod_1.z.boolean(),
61
+ message: zod_1.z.string().optional(),
62
+ });
63
+ /**
64
+ * Logout response schema
65
+ * @description Schema for validating logout response
66
+ */
67
+ exports.LogoutResponseSchema = zod_1.z.object({
68
+ success: zod_1.z.boolean(),
69
+ message: zod_1.z.string().optional(),
70
+ });
71
+ /**
72
+ * Active sessions response schema
73
+ * @description Schema for validating active sessions response
74
+ */
75
+ exports.ActiveSessionSchema = zod_1.z.object({
76
+ deviceInfo: zod_1.z.object({
77
+ os: zod_1.z.string(),
78
+ browser: zod_1.z.string(),
79
+ location: zod_1.z.string(),
80
+ }),
81
+ });
82
+ exports.ActiveSessionsResponseSchema = zod_1.z.array(exports.ActiveSessionSchema);