oneentry 1.0.176 → 1.0.177
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 +12 -5
- package/changelog.md +116 -0
- package/dist/admins/adminsApi.js +2 -9
- package/dist/admins/adminsInterfaces.d.ts +5 -5
- package/dist/admins/adminsSchemas.d.ts +4 -4
- package/dist/admins/adminsSchemas.js +2 -2
- package/dist/attribute-sets/attributeSetsApi.d.ts +1 -1
- package/dist/attribute-sets/attributeSetsApi.js +4 -4
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +8 -6
- package/dist/attribute-sets/attributeSetsSchemas.js +6 -9
- package/dist/auth-provider/authProviderApi.d.ts +4 -4
- package/dist/auth-provider/authProviderApi.js +90 -23
- package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
- package/dist/auth-provider/authProviderSchemas.js +1 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +8 -6
- package/dist/base/asyncModules.d.ts +62 -1
- package/dist/base/asyncModules.js +219 -37
- package/dist/base/stateModule.d.ts +2 -0
- package/dist/base/stateModule.js +22 -12
- package/dist/base/syncModules.d.ts +18 -10
- package/dist/base/syncModules.js +100 -29
- package/dist/base/utils.d.ts +26 -21
- package/dist/base/validation.d.ts +3 -3
- package/dist/base/validation.js +6 -7
- package/dist/blocks/blocksApi.d.ts +20 -17
- package/dist/blocks/blocksApi.js +82 -64
- package/dist/blocks/blocksInterfaces.d.ts +8 -8
- package/dist/discounts/discountsApi.d.ts +9 -7
- package/dist/discounts/discountsApi.js +16 -13
- package/dist/discounts/discountsInterfaces.d.ts +14 -10
- package/dist/events/eventsApi.d.ts +3 -3
- package/dist/events/eventsApi.js +3 -3
- package/dist/events/eventsInterfaces.d.ts +10 -14
- package/dist/file-uploading/fileUploadingApi.d.ts +4 -4
- package/dist/file-uploading/fileUploadingApi.js +13 -5
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +5 -6
- package/dist/filters/filtersApi.js +2 -2
- package/dist/forms/formsApi.js +2 -2
- package/dist/forms/formsInterfaces.d.ts +1 -3
- package/dist/forms/formsSchemas.d.ts +3 -6
- package/dist/forms/formsSchemas.js +2 -4
- package/dist/forms-data/formsDataApi.d.ts +16 -0
- package/dist/forms-data/formsDataApi.js +32 -5
- package/dist/forms-data/formsDataInterfaces.d.ts +17 -13
- package/dist/general-types/generalTypesInterfaces.d.ts +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.js +50 -7
- package/dist/integration-collections/integrationCollectionsApi.d.ts +15 -4
- package/dist/integration-collections/integrationCollectionsApi.js +41 -14
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
- package/dist/integration-collections/integrationCollectionsSchemas.js +0 -1
- package/dist/menus/menusApi.js +1 -1
- package/dist/orders/ordersApi.d.ts +1 -13
- package/dist/orders/ordersApi.js +21 -42
- package/dist/orders/ordersInterfaces.d.ts +21 -14
- package/dist/pages/pagesApi.d.ts +6 -5
- package/dist/pages/pagesApi.js +44 -31
- package/dist/pages/pagesInterfaces.d.ts +18 -15
- package/dist/pages/pagesSchemas.d.ts +0 -3
- package/dist/pages/pagesSchemas.js +0 -1
- package/dist/payments/paymentsApi.d.ts +10 -11
- package/dist/payments/paymentsApi.js +22 -18
- package/dist/payments/paymentsInterfaces.d.ts +12 -14
- package/dist/payments/paymentsSchemas.d.ts +21 -20
- package/dist/payments/paymentsSchemas.js +5 -8
- package/dist/product-statuses/productStatusesApi.d.ts +1 -1
- package/dist/product-statuses/productStatusesApi.js +3 -3
- package/dist/product-statuses/productStatusesInterfaces.d.ts +1 -4
- package/dist/products/productsApi.d.ts +38 -58
- package/dist/products/productsApi.js +59 -72
- package/dist/products/productsInterfaces.d.ts +48 -85
- package/dist/search/searchApi.d.ts +1 -1
- package/dist/search/searchApi.js +4 -3
- package/dist/sitemap/sitemapInterfaces.d.ts +10 -6
- package/dist/subscriptions/subscriptionsApi.d.ts +1 -1
- package/dist/subscriptions/subscriptionsApi.js +1 -1
- package/dist/subscriptions/subscriptionsInterfaces.d.ts +1 -1
- package/dist/system/systemApi.d.ts +2 -0
- package/dist/system/systemApi.js +2 -0
- package/dist/system/systemInterfaces.d.ts +2 -0
- package/dist/templates/templatesApi.d.ts +2 -2
- package/dist/templates/templatesApi.js +12 -11
- package/dist/templates/templatesInterfaces.d.ts +2 -2
- package/dist/templates-preview/templatesPreviewApi.js +2 -2
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +7 -0
- package/dist/templates-preview/templatesPreviewSchemas.js +2 -0
- package/dist/user-groups/userGroupsApi.js +5 -5
- package/dist/user-groups/userGroupsSchemas.d.ts +4 -4
- package/dist/users/usersApi.d.ts +1 -1
- package/dist/users/usersApi.js +28 -15
- package/dist/users/usersInterfaces.d.ts +2 -9
- package/dist/web-socket/lazySocket.d.ts +6 -5
- package/dist/web-socket/lazySocket.js +212 -15
- package/dist/web-socket/wsApi.d.ts +7 -4
- package/dist/web-socket/wsApi.js +49 -12
- package/dist/web-socket/wsInterfaces.d.ts +41 -4
- package/esm/admins/adminsApi.js +2 -9
- package/esm/admins/adminsInterfaces.d.ts +5 -5
- package/esm/admins/adminsSchemas.d.ts +4 -4
- package/esm/admins/adminsSchemas.js +2 -2
- package/esm/attribute-sets/attributeSetsApi.d.ts +1 -1
- package/esm/attribute-sets/attributeSetsApi.js +4 -4
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +8 -6
- package/esm/attribute-sets/attributeSetsSchemas.js +6 -9
- package/esm/auth-provider/authProviderApi.d.ts +4 -4
- package/esm/auth-provider/authProviderApi.js +90 -23
- package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
- package/esm/auth-provider/authProviderSchemas.js +1 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +8 -6
- package/esm/base/asyncModules.d.ts +62 -1
- package/esm/base/asyncModules.js +219 -37
- package/esm/base/stateModule.d.ts +2 -0
- package/esm/base/stateModule.js +22 -12
- package/esm/base/syncModules.d.ts +18 -10
- package/esm/base/syncModules.js +99 -29
- package/esm/base/utils.d.ts +26 -21
- package/esm/base/validation.d.ts +3 -3
- package/esm/base/validation.js +6 -7
- package/esm/blocks/blocksApi.d.ts +20 -17
- package/esm/blocks/blocksApi.js +82 -64
- package/esm/blocks/blocksInterfaces.d.ts +8 -8
- package/esm/discounts/discountsApi.d.ts +9 -7
- package/esm/discounts/discountsApi.js +16 -13
- package/esm/discounts/discountsInterfaces.d.ts +14 -10
- package/esm/events/eventsApi.d.ts +3 -3
- package/esm/events/eventsApi.js +3 -3
- package/esm/events/eventsInterfaces.d.ts +10 -14
- package/esm/file-uploading/fileUploadingApi.d.ts +4 -4
- package/esm/file-uploading/fileUploadingApi.js +13 -5
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +5 -6
- package/esm/filters/filtersApi.js +2 -2
- package/esm/forms/formsApi.js +2 -2
- package/esm/forms/formsInterfaces.d.ts +1 -3
- package/esm/forms/formsSchemas.d.ts +3 -6
- package/esm/forms/formsSchemas.js +2 -4
- package/esm/forms-data/formsDataApi.d.ts +16 -0
- package/esm/forms-data/formsDataApi.js +32 -5
- package/esm/forms-data/formsDataInterfaces.d.ts +17 -13
- package/esm/general-types/generalTypesInterfaces.d.ts +1 -1
- package/esm/index.d.ts +7 -6
- package/esm/index.js +50 -7
- package/esm/integration-collections/integrationCollectionsApi.d.ts +15 -4
- package/esm/integration-collections/integrationCollectionsApi.js +41 -14
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
- package/esm/integration-collections/integrationCollectionsSchemas.js +0 -1
- package/esm/menus/menusApi.js +1 -1
- package/esm/orders/ordersApi.d.ts +1 -13
- package/esm/orders/ordersApi.js +21 -42
- package/esm/orders/ordersInterfaces.d.ts +21 -14
- package/esm/pages/pagesApi.d.ts +6 -5
- package/esm/pages/pagesApi.js +44 -31
- package/esm/pages/pagesInterfaces.d.ts +18 -15
- package/esm/pages/pagesSchemas.d.ts +0 -3
- package/esm/pages/pagesSchemas.js +0 -1
- package/esm/payments/paymentsApi.d.ts +10 -11
- package/esm/payments/paymentsApi.js +22 -18
- package/esm/payments/paymentsInterfaces.d.ts +12 -14
- package/esm/payments/paymentsSchemas.d.ts +21 -20
- package/esm/payments/paymentsSchemas.js +5 -8
- package/esm/product-statuses/productStatusesApi.d.ts +1 -1
- package/esm/product-statuses/productStatusesApi.js +3 -3
- package/esm/product-statuses/productStatusesInterfaces.d.ts +1 -4
- package/esm/products/productsApi.d.ts +38 -58
- package/esm/products/productsApi.js +59 -72
- package/esm/products/productsInterfaces.d.ts +48 -85
- package/esm/search/searchApi.d.ts +1 -1
- package/esm/search/searchApi.js +4 -3
- package/esm/sitemap/sitemapInterfaces.d.ts +10 -6
- package/esm/subscriptions/subscriptionsApi.d.ts +1 -1
- package/esm/subscriptions/subscriptionsApi.js +1 -1
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +1 -1
- package/esm/system/systemApi.d.ts +2 -0
- package/esm/system/systemApi.js +2 -0
- package/esm/system/systemInterfaces.d.ts +2 -0
- package/esm/templates/templatesApi.d.ts +2 -2
- package/esm/templates/templatesApi.js +11 -10
- package/esm/templates/templatesInterfaces.d.ts +2 -2
- package/esm/templates-preview/templatesPreviewApi.js +2 -2
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +7 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +2 -0
- package/esm/user-groups/userGroupsApi.js +5 -5
- package/esm/user-groups/userGroupsSchemas.d.ts +4 -4
- package/esm/users/usersApi.d.ts +1 -1
- package/esm/users/usersApi.js +28 -15
- package/esm/users/usersInterfaces.d.ts +2 -9
- package/esm/web-socket/lazySocket.d.ts +6 -5
- package/esm/web-socket/lazySocket.js +212 -15
- package/esm/web-socket/wsApi.d.ts +7 -4
- package/esm/web-socket/wsApi.js +49 -12
- package/esm/web-socket/wsInterfaces.d.ts +41 -4
- package/package.json +2 -2
|
@@ -5,6 +5,27 @@ import type { IAttributeLocalizeInfo, IError, ITimeIntervalSchedule } from '../b
|
|
|
5
5
|
* @description This interface defines methods for retrieving attributes based on markers and language codes.
|
|
6
6
|
*/
|
|
7
7
|
interface IAttributesSets {
|
|
8
|
+
/**
|
|
9
|
+
* Getting all attribute sets objects.
|
|
10
|
+
* @handleName getAttributes
|
|
11
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
12
|
+
* @param {number} [offset] - Number of records to skip. Default: 0.
|
|
13
|
+
* @param {number} [limit] - Maximum number of records to return. Default: 30.
|
|
14
|
+
* @param {number} [typeId] - ID of the attribute set type to filter by. Default: null.
|
|
15
|
+
* @param {string} [sortBy] - Field to sort by: `id` (descending) or `position`. Default: "id".
|
|
16
|
+
* @returns {IAttributesSetsResponse} Object with the array of IAttributeSetsEntity and the total count.
|
|
17
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
18
|
+
*/
|
|
19
|
+
getAttributes(langCode?: string, offset?: number, limit?: number, typeId?: any, sortBy?: string): Promise<IAttributesSetsResponse | IError>;
|
|
20
|
+
/**
|
|
21
|
+
* Getting one attribute set object by its marker.
|
|
22
|
+
* @handleName getAttributeSetByMarker
|
|
23
|
+
* @param {string} marker - Marker of the attribute set. Example: "full_form".
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @returns {IAttributeSetsEntity} The attribute set with its schema.
|
|
26
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
|
+
*/
|
|
28
|
+
getAttributeSetByMarker(marker: string, langCode?: string): Promise<IAttributeSetsEntity | IError>;
|
|
8
29
|
/**
|
|
9
30
|
* Fetches attributes by a specific marker.
|
|
10
31
|
* @handleName getAttributesByMarker
|
|
@@ -91,17 +112,15 @@ type AttributeType = 'string' | 'text' | 'textWithHeader' | 'integer' | 'real' |
|
|
|
91
112
|
[
|
|
92
113
|
{
|
|
93
114
|
"title": "red",
|
|
94
|
-
"value": 1,
|
|
115
|
+
"value": "1",
|
|
95
116
|
"position": 1,
|
|
96
|
-
"
|
|
97
|
-
"extendedValueType": null
|
|
117
|
+
"extended": { "type": null, "value": null }
|
|
98
118
|
},
|
|
99
119
|
{
|
|
100
120
|
"title": "yellow",
|
|
101
|
-
"value": 2,
|
|
121
|
+
"value": "2",
|
|
102
122
|
"position": 2,
|
|
103
|
-
"
|
|
104
|
-
"extendedValueType": null
|
|
123
|
+
"extended": { "type": null, "value": null }
|
|
105
124
|
}
|
|
106
125
|
]
|
|
107
126
|
* @property {IAttributeValidators} validators - Validators configured for the attribute; empty object when none are set.
|
|
@@ -119,7 +138,12 @@ type AttributeType = 'string' | 'text' | 'textWithHeader' | 'integer' | 'real' |
|
|
|
119
138
|
{
|
|
120
139
|
"title": "My attribute"
|
|
121
140
|
}
|
|
122
|
-
* @property {Record<string,
|
|
141
|
+
* @property {Record<string, IAttributeAdditionalField>} additionalFields - Additional fields of the attribute keyed by marker: a type and a value each, not full attributes. An empty object when there are none.
|
|
142
|
+
* @example
|
|
143
|
+
{
|
|
144
|
+
"additional_field": { "type": "string", "value": "Additional field data" }
|
|
145
|
+
}
|
|
146
|
+
* @property {boolean} [multiselect] - For `list` attributes — whether several options from `listTitles` may be selected. Example: false.
|
|
123
147
|
* @description This interface defines the structure of an attribute set entity, including its type, marker, position, validators, localization information, list titles, additional fields, and settings.
|
|
124
148
|
*/
|
|
125
149
|
interface IAttributesSetsEntity {
|
|
@@ -131,7 +155,18 @@ interface IAttributesSetsEntity {
|
|
|
131
155
|
listTitles: IListTitle[];
|
|
132
156
|
validators: IAttributeValidators;
|
|
133
157
|
localizeInfos: IAttributeLocalizeInfo;
|
|
134
|
-
additionalFields: Record<string,
|
|
158
|
+
additionalFields: Record<string, IAttributeAdditionalField>;
|
|
159
|
+
multiselect?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @interface IAttributeAdditionalField
|
|
163
|
+
* @property {string} type - Type of the additional field. Example: "string".
|
|
164
|
+
* @property {unknown} value - Value of the additional field. Example: "Additional field data".
|
|
165
|
+
* @description An additional field of an attribute, as `getAttributesByMarker` returns it.
|
|
166
|
+
*/
|
|
167
|
+
interface IAttributeAdditionalField {
|
|
168
|
+
type: string;
|
|
169
|
+
value: unknown;
|
|
135
170
|
}
|
|
136
171
|
/**
|
|
137
172
|
* @interface IAttributeSchemaItem
|
|
@@ -149,7 +184,7 @@ interface IAttributesSetsEntity {
|
|
|
149
184
|
* @property {boolean} [multiselect] - For `list` fields — whether several options from `listTitles` may be selected. Optional. Example: false.
|
|
150
185
|
* @property {string} [moduleIdentifier] - For `entity` fields — identifier of the module the linked entities are taken from. Optional. Example: "catalog".
|
|
151
186
|
* @property {number | null} [parentId] - Identifier of the parent field, `null` for top-level. Optional, seen on `groupOfImages` fields.
|
|
152
|
-
* @property {Record<string,
|
|
187
|
+
* @property {Record<string, IAttributeAdditionalField>} [additionalFields] - Additional fields keyed by marker: a type and a value each. Optional. Example: `{ "additional_field": { "type": "string", "value": "Additional field data" } }`.
|
|
153
188
|
* @property {IAttributeValidators} [validators] - Validation rules for the field. Optional.
|
|
154
189
|
* @property {boolean | string} [splitUnit] - Splitting unit configuration; `false` when disabled, otherwise the unit name (e.g. "percent"). Optional, used by numeric fields.
|
|
155
190
|
* @property {number[] | boolean} [splitParts] - For split-price fields — ids of the schema fields the price is split into (e.g. [2, 3]); `false` when the field does not split. Optional.
|
|
@@ -159,6 +194,14 @@ interface IAttributesSetsEntity {
|
|
|
159
194
|
* @property {boolean} [receiveValues] - For `timeInterval` fields — whether the field receives precomputed values. Optional.
|
|
160
195
|
* @property {ITimeIntervalSchedule[]} [intervals] - For `timeInterval` fields — top-level schedule definition (separate from `localizeInfos.intervals`). Optional.
|
|
161
196
|
* @property {unknown} [value] - Current value of the field: `null` on numeric fields without a value, an array of schedule groups on `timeInterval` fields. Optional.
|
|
197
|
+
* @property {boolean} [isLogin] - Whether the field is the login of a sign-up form. Optional.
|
|
198
|
+
* @property {boolean} [isSignUp] - Whether the field is filled at sign-up. Optional.
|
|
199
|
+
* @property {boolean} [isPassword] - Whether the field is the password of a sign-up form. Optional.
|
|
200
|
+
* @property {boolean} [isNotificationEmail] - Whether the field is the e-mail used for notifications. Optional.
|
|
201
|
+
* @property {boolean} [isNotificationPhoneSMS] - Whether the field is the phone used for SMS notifications. Optional.
|
|
202
|
+
* @property {boolean} [isNotificationPhonePush] - Whether the field is the phone used for push notifications. Optional.
|
|
203
|
+
* @property {boolean} [isProductPreview] - Whether the field is the product preview image. Optional.
|
|
204
|
+
* @property {number | null} [previewTemplateId] - ID of the preview template of an image field. Optional.
|
|
162
205
|
* @description Definition of a single field inside an attribute set's schema.
|
|
163
206
|
*/
|
|
164
207
|
interface IAttributeSchemaItem {
|
|
@@ -176,7 +219,7 @@ interface IAttributeSchemaItem {
|
|
|
176
219
|
listType?: string;
|
|
177
220
|
moduleIdentifier?: string;
|
|
178
221
|
parentId?: number | null;
|
|
179
|
-
additionalFields?: Record<string,
|
|
222
|
+
additionalFields?: Record<string, IAttributeAdditionalField>;
|
|
180
223
|
validators?: IAttributeValidators;
|
|
181
224
|
splitUnit?: boolean | string;
|
|
182
225
|
splitParts?: number[] | boolean;
|
|
@@ -186,6 +229,14 @@ interface IAttributeSchemaItem {
|
|
|
186
229
|
receiveValues?: boolean;
|
|
187
230
|
intervals?: ITimeIntervalSchedule[];
|
|
188
231
|
value?: unknown;
|
|
232
|
+
isLogin?: boolean;
|
|
233
|
+
isSignUp?: boolean;
|
|
234
|
+
isPassword?: boolean;
|
|
235
|
+
isNotificationEmail?: boolean;
|
|
236
|
+
isNotificationPhoneSMS?: boolean;
|
|
237
|
+
isNotificationPhonePush?: boolean;
|
|
238
|
+
isProductPreview?: boolean;
|
|
239
|
+
previewTemplateId?: number | null;
|
|
189
240
|
}
|
|
190
241
|
/**
|
|
191
242
|
* @interface IAttributeValidators
|
|
@@ -333,13 +384,13 @@ interface IAttributeValidators {
|
|
|
333
384
|
"original": true,
|
|
334
385
|
"identifier": "string",
|
|
335
386
|
"localizeInfos": {
|
|
336
|
-
"
|
|
387
|
+
"title": "String"
|
|
337
388
|
}
|
|
338
389
|
}
|
|
339
390
|
}
|
|
340
391
|
* @property {boolean} isVisible - Whether the attribute set is visible. Example: true.
|
|
341
|
-
* @property {
|
|
342
|
-
* @property {number} position -
|
|
392
|
+
* @property {IAttributeSetTypeRef} type - Type of the attribute set: an object with the type id and name. Example: `{ "id": 1, "type": "forProducts" }`.
|
|
393
|
+
* @property {number} position - Number of the set in the current answer, not a property of the set: it changes with `sortBy` (set 38 is `1` by `id` and `21` by `position`). Example: 1.
|
|
343
394
|
* @description This interface defines the structure of an attribute set entity.
|
|
344
395
|
*/
|
|
345
396
|
interface IAttributeSetsEntity {
|
|
@@ -386,4 +437,4 @@ interface IAttributesSetsResponse {
|
|
|
386
437
|
total: number;
|
|
387
438
|
items: IAttributeSetsEntity[];
|
|
388
439
|
}
|
|
389
|
-
export type { AttributeType, IAttributeSchemaItem, IAttributeSetsEntity, IAttributeSetTypeRef, IAttributesSets, IAttributesSetsEntity, IAttributesSetsResponse, IAttributeValidators, IListTitle, IListTitleEntityValue, IListTitleExtended, };
|
|
440
|
+
export type { AttributeType, IAttributeAdditionalField, IAttributeSchemaItem, IAttributeSetsEntity, IAttributeSetTypeRef, IAttributesSets, IAttributesSetsEntity, IAttributesSetsResponse, IAttributeValidators, IListTitle, IListTitleEntityValue, IListTitleExtended, };
|
|
@@ -24,10 +24,11 @@ export declare const AttributeEntitySchema: z.ZodObject<{
|
|
|
24
24
|
initialValue: z.ZodAny;
|
|
25
25
|
marker: z.ZodString;
|
|
26
26
|
position: z.ZodNumber;
|
|
27
|
-
listTitles: z.
|
|
28
|
-
validators: z.
|
|
27
|
+
listTitles: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
28
|
+
validators: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
29
29
|
localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
30
|
-
additionalFields: z.
|
|
30
|
+
additionalFields: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
31
|
+
multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
31
32
|
}, z.core.$strip>;
|
|
32
33
|
/**
|
|
33
34
|
* Attribute set entity schema (attribute set object)
|
|
@@ -77,8 +78,9 @@ export declare const AttributesArrayResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
77
78
|
initialValue: z.ZodAny;
|
|
78
79
|
marker: z.ZodString;
|
|
79
80
|
position: z.ZodNumber;
|
|
80
|
-
listTitles: z.
|
|
81
|
-
validators: z.
|
|
81
|
+
listTitles: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
82
|
+
validators: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
82
83
|
localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
83
|
-
additionalFields: z.
|
|
84
|
+
additionalFields: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
85
|
+
multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
84
86
|
}, z.core.$strip>>;
|
|
@@ -24,16 +24,13 @@ export const AttributeEntitySchema = z.object({
|
|
|
24
24
|
initialValue: z.any(),
|
|
25
25
|
marker: z.string(),
|
|
26
26
|
position: z.number(),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
validators: z
|
|
31
|
-
.union([z.record(z.string(), z.any()), z.array(z.any())])
|
|
32
|
-
.optional(),
|
|
27
|
+
// Required as in IAttributesSetsEntity: the API sends them on every attribute
|
|
28
|
+
listTitles: z.union([z.array(z.any()), z.record(z.string(), z.any())]),
|
|
29
|
+
validators: z.union([z.record(z.string(), z.any()), z.array(z.any())]),
|
|
33
30
|
localizeInfos: z.union([z.record(z.string(), z.any()), z.array(z.any())]),
|
|
34
|
-
additionalFields: z
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
additionalFields: z.union([z.record(z.string(), z.any()), z.array(z.any())]),
|
|
32
|
+
// The API sends it on list attributes; without it here validation dropped the field
|
|
33
|
+
multiselect: z.boolean().optional(),
|
|
37
34
|
});
|
|
38
35
|
/**
|
|
39
36
|
* Attribute set entity schema (attribute set object)
|
|
@@ -90,7 +90,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
90
90
|
* @handleName generateCode
|
|
91
91
|
* @param {string} marker - Marker of the auth provider. Example: "email".
|
|
92
92
|
* @param {string} userIdentifier - Identifier (login) of the user, such as an email address. Example: "example@oneentry.cloud".
|
|
93
|
-
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "
|
|
93
|
+
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "reg".
|
|
94
94
|
* @returns {Promise<void | IError>} Returns void if the code is successfully generated, or an error object if there was an issue.
|
|
95
95
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
96
96
|
* @description Obtaining a code to activate the user.
|
|
@@ -102,7 +102,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
102
102
|
* @handleName checkCode
|
|
103
103
|
* @param {string} marker - Marker of the auth provider. Example: "email".
|
|
104
104
|
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
105
|
-
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "
|
|
105
|
+
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "reg".
|
|
106
106
|
* @param {string} code - One-time code the user received. Example: "123456".
|
|
107
107
|
* @returns {Promise<boolean | IError>} Returns true if the code is correct, or an error object if there was an issue.
|
|
108
108
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -140,7 +140,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
140
140
|
}
|
|
141
141
|
]
|
|
142
142
|
}
|
|
143
|
-
* @param {{ marker: string; value: string
|
|
143
|
+
* @param {{ marker: string; value: string }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value.
|
|
144
144
|
* @example
|
|
145
145
|
[
|
|
146
146
|
{
|
|
@@ -253,7 +253,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
253
253
|
"redirect_uri": "http://localhost:3000"
|
|
254
254
|
}
|
|
255
255
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
256
|
-
* @returns {Promise<
|
|
256
|
+
* @returns {Promise<IAuthEntity | IError>} Returns the tokens of the signed-in user; they are stored in the state like after `auth`.
|
|
257
257
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
258
258
|
* @description User registration (authorization) via OAUTH.
|
|
259
259
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/oauth oauth} documentation.
|
|
@@ -88,17 +88,19 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
88
88
|
async signUp(marker, body, langCode = this.state.lang) {
|
|
89
89
|
// `langCode` goes onto our own copy — the caller's body stays as it was
|
|
90
90
|
// given, so a retry or a second parallel call sends the same thing (CMS-909).
|
|
91
|
-
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/sign-up`, this._normalizePostBody({ ...body, langCode }, langCode));
|
|
91
|
+
const result = await this._asSignIn()._fetchPost(`/marker/${this._pathSegment(marker)}/users/sign-up`, this._normalizePostBody({ ...body, langCode }, langCode));
|
|
92
92
|
// Validate response if validation is enabled
|
|
93
93
|
const validated = await this._validateResponse(result, schema('SignUpResponseSchema'));
|
|
94
|
-
|
|
94
|
+
// The fields went in under `langCode`; without it a sign-up in another language
|
|
95
|
+
// returned `formData` still keyed by that language
|
|
96
|
+
return this._normalizeData(validated, langCode);
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Getting a user activation code. The code is returned via the appropriate user notification method.
|
|
98
100
|
* @handleName generateCode
|
|
99
101
|
* @param {string} marker - Marker of the auth provider. Example: "email".
|
|
100
102
|
* @param {string} userIdentifier - Identifier (login) of the user, such as an email address. Example: "example@oneentry.cloud".
|
|
101
|
-
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "
|
|
103
|
+
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "reg".
|
|
102
104
|
* @returns {Promise<void | IError>} Returns void if the code is successfully generated, or an error object if there was an issue.
|
|
103
105
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
104
106
|
* @description Obtaining a code to activate the user.
|
|
@@ -110,14 +112,15 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
110
112
|
eventIdentifier,
|
|
111
113
|
};
|
|
112
114
|
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/generate-code`, data);
|
|
113
|
-
|
|
115
|
+
// An empty 2xx body is read as `{}`; the method returns nothing on success
|
|
116
|
+
return this._isErrorResponse(result) ? result : undefined;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
|
|
117
120
|
* @handleName checkCode
|
|
118
121
|
* @param {string} marker - Marker of the auth provider. Example: "email".
|
|
119
122
|
* @param {string} userIdentifier - The text identifier of the user's object (user login). Example: "example@oneentry.cloud".
|
|
120
|
-
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "
|
|
123
|
+
* @param {string} eventIdentifier - Marker of the event the code is generated for. Example: "reg".
|
|
121
124
|
* @param {string} code - One-time code the user received. Example: "123456".
|
|
122
125
|
* @returns {Promise<boolean | IError>} Returns true if the code is correct, or an error object if there was an issue.
|
|
123
126
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -131,7 +134,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
131
134
|
code,
|
|
132
135
|
};
|
|
133
136
|
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/check-code`, data);
|
|
134
|
-
return result;
|
|
137
|
+
return this._asBoolean(result);
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
140
|
* User activate.
|
|
@@ -150,7 +153,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
150
153
|
code: code,
|
|
151
154
|
};
|
|
152
155
|
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/activate`, data);
|
|
153
|
-
return result;
|
|
156
|
+
return this._asBoolean(result);
|
|
154
157
|
}
|
|
155
158
|
/**
|
|
156
159
|
* User authorization.
|
|
@@ -170,7 +173,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
170
173
|
}
|
|
171
174
|
]
|
|
172
175
|
}
|
|
173
|
-
* @param {{ marker: string; value: string
|
|
176
|
+
* @param {{ marker: string; value: string }[]} body.authData - An array of authentication data objects, each containing a marker and its corresponding value.
|
|
174
177
|
* @example
|
|
175
178
|
[
|
|
176
179
|
{
|
|
@@ -186,12 +189,14 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
186
189
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/auth auth} documentation.
|
|
187
190
|
*/
|
|
188
191
|
async auth(marker, body) {
|
|
189
|
-
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/auth`, body);
|
|
192
|
+
const result = await this._asSignIn()._fetchPost(`/marker/${this._pathSegment(marker)}/users/auth`, body);
|
|
190
193
|
// Validate response if validation is enabled
|
|
191
194
|
const validated = await this._validateResponse(result, schema('AuthResponseSchema'));
|
|
192
195
|
if (!('statusCode' in validated)) {
|
|
193
196
|
this.state.accessToken = validated.accessToken;
|
|
194
197
|
this.state.refreshToken = validated.refreshToken;
|
|
198
|
+
// The automatic refresh has to use the provider the session was opened with
|
|
199
|
+
this.state.providerMarker = marker;
|
|
195
200
|
if (this.state.saveFunction && validated.refreshToken) {
|
|
196
201
|
this.state.saveFunction(validated.refreshToken);
|
|
197
202
|
}
|
|
@@ -210,10 +215,17 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
210
215
|
*/
|
|
211
216
|
async refresh(marker, token) {
|
|
212
217
|
const data = { refreshToken: token };
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
// Sent as is: through the regular path a restored session (refresh token, no access
|
|
219
|
+
// token) first refreshed on its own, rotated this very token and the call answered 400
|
|
220
|
+
const result = await this._asSignIn()._fetchPost(`/marker/${this._pathSegment(marker)}/users/refresh`, data);
|
|
221
|
+
// Tokens are stored only when the answer carries them: an empty 2xx body came back
|
|
222
|
+
// as `{}` and wiped the session (`saveFunction(undefined)`)
|
|
223
|
+
if (!this._isErrorResponse(result) &&
|
|
224
|
+
typeof (result === null || result === void 0 ? void 0 : result.refreshToken) === 'string' &&
|
|
225
|
+
typeof (result === null || result === void 0 ? void 0 : result.accessToken) === 'string') {
|
|
215
226
|
this.state.accessToken = result.accessToken;
|
|
216
227
|
this.state.refreshToken = result.refreshToken;
|
|
228
|
+
this.state.providerMarker = marker;
|
|
217
229
|
if (this.state.saveFunction) {
|
|
218
230
|
this.state.saveFunction(result.refreshToken);
|
|
219
231
|
}
|
|
@@ -232,11 +244,51 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
232
244
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/logout logout} documentation.
|
|
233
245
|
*/
|
|
234
246
|
async logout(marker, token) {
|
|
235
|
-
|
|
236
|
-
|
|
247
|
+
var _a;
|
|
248
|
+
// Logout needs a bearer, so a restored session refreshes first — and that rotates the
|
|
249
|
+
// token passed in. Refresh up front and log out with the rotated one, or the call
|
|
250
|
+
// answered 400 and the session stayed alive
|
|
251
|
+
const wasCurrent = token === this.state.refreshToken;
|
|
252
|
+
if (!this.state.accessToken &&
|
|
253
|
+
!this.state.customAuth &&
|
|
254
|
+
wasCurrent &&
|
|
255
|
+
this._canRefresh() &&
|
|
256
|
+
(await this.refreshToken())) {
|
|
257
|
+
token = this.state.refreshToken;
|
|
258
|
+
}
|
|
259
|
+
const path = `/marker/${this._pathSegment(marker)}/users/logout`;
|
|
260
|
+
// Sent quietly and without throwing: a 401 mid-session refreshes and rotates the token
|
|
261
|
+
// the body carries, the retry answers 400 — that attempt is not the caller's failure
|
|
262
|
+
const attempt = async (refreshToken) => {
|
|
263
|
+
try {
|
|
264
|
+
return this._asBoolean(await this._asSubRequest()._fetchPost(path, {
|
|
265
|
+
refreshToken,
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
return error;
|
|
270
|
+
}
|
|
237
271
|
};
|
|
238
|
-
|
|
239
|
-
if (result)
|
|
272
|
+
let result = await attempt(token);
|
|
273
|
+
if (this._isErrorResponse(result) &&
|
|
274
|
+
wasCurrent &&
|
|
275
|
+
this.state.refreshToken &&
|
|
276
|
+
this.state.refreshToken !== token) {
|
|
277
|
+
result = await attempt(this.state.refreshToken);
|
|
278
|
+
}
|
|
279
|
+
if (this._isErrorResponse(result)) {
|
|
280
|
+
const handler = (_a = this.state.errorsFunctions) === null || _a === void 0 ? void 0 : _a[result.statusCode];
|
|
281
|
+
if (handler) {
|
|
282
|
+
await handler(result);
|
|
283
|
+
}
|
|
284
|
+
if (!this.state.isShell) {
|
|
285
|
+
throw result;
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
// An error object is truthy too: a failed logout used to wipe the tokens of a
|
|
290
|
+
// session that is still alive on the server
|
|
291
|
+
if (result && !this._isErrorResponse(result)) {
|
|
240
292
|
this.state.accessToken = undefined;
|
|
241
293
|
this.state.refreshToken = undefined;
|
|
242
294
|
if (this.state.saveFunction) {
|
|
@@ -257,14 +309,16 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
257
309
|
*/
|
|
258
310
|
async logoutAll(marker) {
|
|
259
311
|
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/logout-all`);
|
|
260
|
-
|
|
312
|
+
// An error object is truthy too: a failed logout used to wipe the tokens of a
|
|
313
|
+
// session that is still alive on the server
|
|
314
|
+
if (result && !this._isErrorResponse(result)) {
|
|
261
315
|
this.state.accessToken = undefined;
|
|
262
316
|
this.state.refreshToken = undefined;
|
|
263
317
|
if (this.state.saveFunction) {
|
|
264
318
|
this.state.saveFunction('');
|
|
265
319
|
}
|
|
266
320
|
}
|
|
267
|
-
return result;
|
|
321
|
+
return this._asBoolean(result);
|
|
268
322
|
}
|
|
269
323
|
/**
|
|
270
324
|
* Change password.
|
|
@@ -291,7 +345,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
291
345
|
password2: repeatPassword !== null && repeatPassword !== void 0 ? repeatPassword : newPassword,
|
|
292
346
|
};
|
|
293
347
|
const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/users/change-password`, data);
|
|
294
|
-
return result;
|
|
348
|
+
return this._asBoolean(result);
|
|
295
349
|
}
|
|
296
350
|
/**
|
|
297
351
|
* Get all auth providers objects.
|
|
@@ -305,7 +359,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
305
359
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getAuthProviders getAuthProviders} documentation.
|
|
306
360
|
*/
|
|
307
361
|
async getAuthProviders(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
308
|
-
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
362
|
+
const result = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}&offset=${encodeURIComponent(String(offset))}&limit=${encodeURIComponent(String(limit))}`);
|
|
309
363
|
// Validate response if validation is enabled
|
|
310
364
|
const validated = await this._validateResponse(result, schema('AuthProvidersResponseSchema'));
|
|
311
365
|
return this._normalizeData(validated);
|
|
@@ -321,7 +375,7 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
321
375
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getAuthProviderByMarker getAuthProviderByMarker} documentation.
|
|
322
376
|
*/
|
|
323
377
|
async getAuthProviderByMarker(marker, langCode = this.state.lang) {
|
|
324
|
-
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
378
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
|
|
325
379
|
return this._normalizeData(result);
|
|
326
380
|
}
|
|
327
381
|
/**
|
|
@@ -335,7 +389,9 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
335
389
|
*/
|
|
336
390
|
async getActiveSessionsByMarker(marker) {
|
|
337
391
|
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/users/sessions`);
|
|
338
|
-
|
|
392
|
+
// Validate response if validation is enabled
|
|
393
|
+
const validated = await this._validateResponse(result, schema('ActiveSessionsResponseSchema'));
|
|
394
|
+
return this._normalizeData(validated);
|
|
339
395
|
}
|
|
340
396
|
/**
|
|
341
397
|
* User registration (authorization) via OAUTH.
|
|
@@ -351,13 +407,24 @@ export default class AuthProviderApi extends AsyncModules {
|
|
|
351
407
|
"redirect_uri": "http://localhost:3000"
|
|
352
408
|
}
|
|
353
409
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
354
|
-
* @returns {Promise<
|
|
410
|
+
* @returns {Promise<IAuthEntity | IError>} Returns the tokens of the signed-in user; they are stored in the state like after `auth`.
|
|
355
411
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
356
412
|
* @description User registration (authorization) via OAUTH.
|
|
357
413
|
* @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/oauth oauth} documentation.
|
|
358
414
|
*/
|
|
359
415
|
async oauth(marker, body, langCode = this.state.lang) {
|
|
360
|
-
|
|
416
|
+
// A sign-in like `auth`: no current session, no refresh on 401, and the issued
|
|
417
|
+
// tokens are kept — they used to stay out of the state
|
|
418
|
+
const result = await this._asSignIn()._fetchPost(`/marker/${this._pathSegment(marker)}/oauth`, this._normalizePostBody(body, langCode));
|
|
419
|
+
if (!this._isErrorResponse(result) &&
|
|
420
|
+
typeof (result === null || result === void 0 ? void 0 : result.accessToken) === 'string') {
|
|
421
|
+
this.state.accessToken = result.accessToken;
|
|
422
|
+
this.state.refreshToken = result.refreshToken;
|
|
423
|
+
this.state.providerMarker = marker;
|
|
424
|
+
if (this.state.saveFunction && result.refreshToken) {
|
|
425
|
+
this.state.saveFunction(result.refreshToken);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
361
428
|
return result;
|
|
362
429
|
}
|
|
363
430
|
}
|
|
@@ -24,6 +24,7 @@ export declare const SignUpResponseSchema: z.ZodObject<{
|
|
|
24
24
|
importId: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
25
25
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
26
26
|
isDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
oauthSub: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
28
|
state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
28
29
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
30
|
attributeSetId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -25,6 +25,7 @@ export const SignUpResponseSchema = z.object({
|
|
|
25
25
|
importId: z.any().optional().nullable(),
|
|
26
26
|
deletedAt: z.string().optional().nullable(),
|
|
27
27
|
isDeleted: z.boolean().optional(),
|
|
28
|
+
oauthSub: z.string().nullable().optional(),
|
|
28
29
|
state: z.record(z.string(), z.any()).optional(),
|
|
29
30
|
rating: z.record(z.string(), z.unknown()).optional(),
|
|
30
31
|
attributeSetId: z.number().nullable().optional(),
|
|
@@ -47,7 +47,7 @@ interface IAuthProvider {
|
|
|
47
47
|
* @handleName generateCode
|
|
48
48
|
* @param {string} marker - The marker identifying the auth provider. Example: "email".
|
|
49
49
|
* @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
|
|
50
|
-
* @param {string} eventIdentifier - The event identifier related to the code generation. Example: "
|
|
50
|
+
* @param {string} eventIdentifier - The event identifier related to the code generation. Example: "reg".
|
|
51
51
|
* @returns {void} A promise that resolves to void or an error.
|
|
52
52
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
53
53
|
* @description This method generates an activation code for a user.
|
|
@@ -58,7 +58,7 @@ interface IAuthProvider {
|
|
|
58
58
|
* @handleName checkCode
|
|
59
59
|
* @param {string} marker - The marker identifying the auth provider. Example: "email".
|
|
60
60
|
* @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
|
|
61
|
-
* @param {string} eventIdentifier - The event identifier related to the code verification. Example: "
|
|
61
|
+
* @param {string} eventIdentifier - The event identifier related to the code verification. Example: "reg".
|
|
62
62
|
* @param {string} code - The activation code to verify. Example: "123456".
|
|
63
63
|
* @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
|
|
64
64
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
@@ -162,7 +162,7 @@ interface IAuthProvider {
|
|
|
162
162
|
getActiveSessionsByMarker(marker: string): Promise<IActiveSession[] | IError>;
|
|
163
163
|
/**
|
|
164
164
|
* User registration (authorization) via OAUTH.
|
|
165
|
-
* @handleName
|
|
165
|
+
* @handleName oauth
|
|
166
166
|
* @param {string} marker - Marker of the auth provider. Example: "email".
|
|
167
167
|
* @param {IOauthData} body - OAuth data for registration.
|
|
168
168
|
* @example
|
|
@@ -174,7 +174,7 @@ interface IAuthProvider {
|
|
|
174
174
|
"redirect_uri": "http://localhost:3000"
|
|
175
175
|
}
|
|
176
176
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
177
|
-
* @returns {
|
|
177
|
+
* @returns {IAuthEntity} Returns the tokens of the signed-in user; they are stored in the state like after `auth`.
|
|
178
178
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
179
179
|
* @description User registration (authorization) via OAUTH.
|
|
180
180
|
*/
|
|
@@ -267,6 +267,7 @@ interface IOauthData {
|
|
|
267
267
|
* @property {unknown} [importId] - Import identifier. Example: null.
|
|
268
268
|
* @property {string | null} [deletedAt] - Deletion date, or `null`. Example: null.
|
|
269
269
|
* @property {boolean} [isDeleted] - Whether the user account is deleted. Example: false.
|
|
270
|
+
* @property {string | null} [oauthSub] - Subject of the OAuth account the user is linked to; `null` for a user signed up by e-mail. Example: null.
|
|
270
271
|
* @property {Record<string, unknown>} [state] - Custom key-value data stored with the user. Example: {}.
|
|
271
272
|
* @property {IRating} [rating] - Rating data: average value, likes and dislikes, and the calculation method.
|
|
272
273
|
* @property {number | null} [attributeSetId] - ID of the attribute set attached to the user, or `null` when none is attached. Example: null.
|
|
@@ -286,6 +287,7 @@ interface ISignUpEntity {
|
|
|
286
287
|
importId?: unknown;
|
|
287
288
|
deletedAt?: string | null;
|
|
288
289
|
isDeleted?: boolean;
|
|
290
|
+
oauthSub?: string | null;
|
|
289
291
|
state?: Record<string, unknown>;
|
|
290
292
|
rating?: IRating;
|
|
291
293
|
attributeSetId?: number | null;
|
|
@@ -334,7 +336,7 @@ interface IAuthEntity {
|
|
|
334
336
|
* @property {number} version - Version number of the auth provider; changes with each update. Example: 1.
|
|
335
337
|
* @property {string} identifier - Marker of the auth provider. Example: "email".
|
|
336
338
|
* @property {string} type - Type of the auth provider, for example `"email"`. Example: "email".
|
|
337
|
-
* @property {string | null} formIdentifier - Marker of the form linked to the auth provider, or `null` if there is none. Example: "
|
|
339
|
+
* @property {string | null} formIdentifier - Marker of the form linked to the auth provider, or `null` if there is none. Example: "reg".
|
|
338
340
|
* @property {string} userGroupIdentifier - Identifier of the user group linked to the auth provider. Example: "guest".
|
|
339
341
|
* @property {boolean} isActive - Whether the auth provider is active. Example: true.
|
|
340
342
|
* @property {boolean} isCheckCode - Whether the auth provider requires a verification code. Example: false.
|
|
@@ -428,4 +430,4 @@ interface IDeviceInfo {
|
|
|
428
430
|
browser: string;
|
|
429
431
|
location: string;
|
|
430
432
|
}
|
|
431
|
-
export type { IActiveSession, IAuthData, IAuthEntity, IAuthFormData, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, ICodeEntity, IDeviceInfo, INotificationData, IOauthData, ISignUpData, ISignUpEntity, };
|
|
433
|
+
export type { IActiveSession, IAuthData, IAuthEntity, IAuthFormData, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, IAuthProvidersEntityConfig, ICodeEntity, IDeviceInfo, INotificationData, IOauthData, ISignUpData, ISignUpEntity, };
|