oneentry 1.0.123 → 1.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -22
- package/dist/admins/adminsApi.d.ts +30 -9
- package/dist/admins/adminsApi.js +30 -9
- package/dist/admins/adminsInterfaces.d.ts +77 -32
- package/dist/attribute-sets/attributeSetsApi.d.ts +36 -22
- package/dist/attribute-sets/attributeSetsApi.js +41 -25
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +133 -39
- package/dist/auth-provider/authProviderApi.d.ts +209 -88
- package/dist/auth-provider/authProviderApi.js +226 -87
- package/dist/auth-provider/authProvidersInterfaces.d.ts +345 -18
- package/dist/base/asyncModules.d.ts +38 -28
- package/dist/base/asyncModules.js +178 -47
- package/dist/base/result.js +23 -0
- package/dist/base/syncModules.d.ts +48 -44
- package/dist/base/syncModules.js +84 -64
- package/dist/base/utils.d.ts +1 -1
- package/dist/blocks/blocksApi.d.ts +48 -27
- package/dist/blocks/blocksApi.js +48 -27
- package/dist/blocks/blocksInterfaces.d.ts +126 -32
- package/dist/events/eventsApi.d.ts +45 -12
- package/dist/events/eventsApi.js +47 -12
- package/dist/events/eventsInterfaces.d.ts +50 -3
- package/dist/file-uploading/fileUploadingApi.d.ts +57 -29
- package/dist/file-uploading/fileUploadingApi.js +57 -30
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +90 -17
- package/dist/forms/formsApi.d.ts +20 -9
- package/dist/forms/formsApi.js +19 -8
- package/dist/forms/formsInterfaces.d.ts +86 -23
- package/dist/formsData/formsDataApi.d.ts +33 -21
- package/dist/formsData/formsDataApi.js +33 -21
- package/dist/formsData/formsDataInterfaces.d.ts +212 -41
- package/dist/general-types/generalTypesApi.d.ts +11 -2
- package/dist/general-types/generalTypesApi.js +10 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/integration-collections/integrationCollectionsApi.d.ts +134 -81
- package/dist/integration-collections/integrationCollectionsApi.js +135 -83
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +246 -43
- package/dist/locales/localesApi.d.ts +5 -1
- package/dist/locales/localesApi.js +5 -1
- package/dist/locales/localesInterfaces.d.ts +19 -12
- package/dist/menus/menusApi.d.ts +6 -3
- package/dist/menus/menusApi.js +6 -3
- package/dist/menus/menusInterfaces.d.ts +60 -21
- package/dist/orders/ordersApi.d.ts +84 -66
- package/dist/orders/ordersApi.js +91 -71
- package/dist/orders/ordersInterfaces.d.ts +282 -86
- package/dist/pages/pagesApi.d.ts +101 -42
- package/dist/pages/pagesApi.js +93 -39
- package/dist/pages/pagesInterfaces.d.ts +218 -75
- package/dist/payments/paymentsApi.d.ts +53 -39
- package/dist/payments/paymentsApi.js +55 -40
- package/dist/payments/paymentsInterfaces.d.ts +121 -56
- package/dist/product-statuses/productStatusesApi.d.ts +17 -17
- package/dist/product-statuses/productStatusesApi.js +16 -19
- package/dist/product-statuses/productStatusesInterfaces.d.ts +43 -14
- package/dist/products/productsApi.d.ts +309 -177
- package/dist/products/productsApi.js +313 -167
- package/dist/products/productsInterfaces.d.ts +447 -81
- package/dist/system/systemApi.d.ts +42 -12
- package/dist/system/systemApi.js +43 -10
- package/dist/system/systemInterfaces.d.ts +7 -0
- package/dist/templates/templatesApi.d.ts +24 -20
- package/dist/templates/templatesApi.js +22 -21
- package/dist/templates/templatesInterfaces.d.ts +48 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +17 -17
- package/dist/templates-preview/templatesPreviewApi.js +16 -19
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +85 -32
- package/dist/users/usersApi.d.ts +59 -35
- package/dist/users/usersApi.js +62 -35
- package/dist/users/usersInterfaces.d.ts +136 -14
- package/dist/web-socket/wsApi.d.ts +4 -5
- package/dist/web-socket/wsApi.js +4 -5
- package/dist/web-socket/wsInterfaces.d.ts +2 -1
- package/package.json +20 -18
|
@@ -1,65 +1,118 @@
|
|
|
1
1
|
import type { AttributeType, IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* @interface ITemplatesPreview
|
|
4
4
|
*
|
|
5
|
-
* @interface
|
|
6
5
|
* @property {function} getTemplatesPreview - Get all template objects.
|
|
7
6
|
* @property {function} getTemplatesPreviewById - Get one template object by id.
|
|
8
7
|
* @property {function} getTemplatesPreviewByMarker - Get one template object by marker.
|
|
8
|
+
*
|
|
9
|
+
* @description This interface defines methods for retrieving template previews in the system, including fetching all previews, specific previews by ID, and by marker.
|
|
9
10
|
*/
|
|
10
11
|
interface ITemplatesPreview {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves all template preview objects.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} langCode - Language code for localization. Default: "en_US".
|
|
16
|
+
* @returns {ITemplatesPreviewEntity[]} A promise resolving to an array of template preview entities or an error.
|
|
17
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
18
|
+
*/
|
|
19
|
+
getTemplatePreviews(langCode: string): Promise<ITemplatesPreviewEntity[] | IError>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a specific template preview object by its marker.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} marker - The marker of the template preview. Example: "template_12345".
|
|
24
|
+
* @param {string} [langCode] - Language code for localization. Default: "en_US".
|
|
25
|
+
* @returns {ITemplatesPreviewEntity} A promise resolving to the template preview entity or an error.
|
|
26
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
|
+
*/
|
|
13
28
|
getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatesPreviewEntity | IError>;
|
|
14
29
|
}
|
|
15
30
|
/**
|
|
16
|
-
*
|
|
31
|
+
* @interface ITemplatesPreviewEntity
|
|
17
32
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @property {
|
|
20
|
-
* @property {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
* @property {number} id - The unique identifier of the position. Example: 3.
|
|
34
|
+
* @property {string} title - The name of the template preview. Example: "Product Template"..
|
|
35
|
+
* @property {object} proportions - Object contains info by proportions template preview. Example:
|
|
36
|
+
{
|
|
37
|
+
"default": {
|
|
38
|
+
"horizontal": {
|
|
39
|
+
"width": 234,
|
|
40
|
+
"height": 324,
|
|
41
|
+
"alignmentType": "middleBottom"
|
|
42
|
+
},
|
|
43
|
+
"vertical": {
|
|
44
|
+
"width": 2,
|
|
45
|
+
"height": 3,
|
|
46
|
+
"alignmentType": "leftTop"
|
|
47
|
+
},
|
|
48
|
+
"square": {
|
|
49
|
+
"side": 3,
|
|
50
|
+
"alignmentType": "leftTop"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
* @property {string} identifier - The textual identifier for the record field. Example: "preview-templates"
|
|
55
|
+
* @property {number} version - The version number of the object. Example: 1.
|
|
56
|
+
* @property {AttributeType} attributeValues - Attribute values from index. Example: {}
|
|
57
|
+
* @property {number} position - The position of the object. Example: 1.
|
|
58
|
+
* @property {string | null} [attributeSetIdentifier] - Text identifier used for a set of attributes. Example: "attribute_set_1".
|
|
59
|
+
* @property {IProportion | null} proportions.horizontal - Horizontal proportion of the template preview. Example:
|
|
60
|
+
{
|
|
61
|
+
"width": 234,
|
|
62
|
+
"height": 324,
|
|
63
|
+
"alignmentType": "middleBottom"
|
|
64
|
+
}
|
|
65
|
+
* @property {IProportion | null} proportions.vertical - Vertical proportion of the template preview. Example:
|
|
66
|
+
{
|
|
67
|
+
"width": 2,
|
|
68
|
+
"height": 3,
|
|
69
|
+
"alignmentType": "leftTop"
|
|
70
|
+
}
|
|
71
|
+
* @property {ISquare} proportions.square - Square proportion of the template preview. Example:
|
|
72
|
+
{
|
|
73
|
+
"side": 3,
|
|
74
|
+
"alignmentType": "leftTop"
|
|
75
|
+
}
|
|
76
|
+
* @description This interface defines the structure of a template preview entity, including its identifiers, attributes, proportions, and title.
|
|
26
77
|
*/
|
|
27
78
|
interface ITemplatesPreviewEntity {
|
|
28
79
|
id: number;
|
|
29
|
-
|
|
30
|
-
identifier: string;
|
|
31
|
-
attributeValues: AttributeType;
|
|
32
|
-
attributeSetIdentifier?: string | null;
|
|
80
|
+
title: string;
|
|
33
81
|
proportions: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
82
|
+
default: {
|
|
83
|
+
horizontal: IProportion | null;
|
|
84
|
+
vertical: IProportion | null;
|
|
85
|
+
square: ISquare;
|
|
86
|
+
};
|
|
37
87
|
};
|
|
38
|
-
|
|
88
|
+
identifier: string;
|
|
89
|
+
version: number;
|
|
90
|
+
attributeValues: AttributeType;
|
|
39
91
|
position: number;
|
|
92
|
+
isUsed: boolean;
|
|
93
|
+
attributeSetIdentifier?: string | null;
|
|
40
94
|
}
|
|
41
95
|
/**
|
|
42
|
-
* IProportion
|
|
96
|
+
* @interface IProportion
|
|
43
97
|
*
|
|
44
|
-
* @property {string | number | null} width -
|
|
45
|
-
* @property {string | number | null} height -
|
|
46
|
-
* @property {string}
|
|
47
|
-
* @
|
|
98
|
+
* @property {string | number | null} width - width of the template preview. Example: 100.
|
|
99
|
+
* @property {string | number | null} height - height of the template preview. Example: 200.
|
|
100
|
+
* @property {string} alignmentType - alignment type of the template preview. Example: "center".
|
|
101
|
+
* @description Represents a proportion object used in template previews.
|
|
48
102
|
*/
|
|
49
103
|
interface IProportion {
|
|
50
104
|
width: number | null;
|
|
51
105
|
height: number | null;
|
|
52
|
-
marker: string;
|
|
53
106
|
alignmentType: string;
|
|
54
107
|
}
|
|
55
108
|
/**
|
|
56
|
-
* ISquare
|
|
57
|
-
*
|
|
58
|
-
* @property {number | string} side -
|
|
59
|
-
* @property {string} alignmentType -
|
|
109
|
+
* @interface ISquare
|
|
110
|
+
*
|
|
111
|
+
* @property {number | string} side - Side length of the square template preview, can be a number or string. Example: 100.
|
|
112
|
+
* @property {string} alignmentType - Alignment type of the square template preview. Example: "center".
|
|
113
|
+
* @description Represents a square proportion object used in template previews.
|
|
60
114
|
*/
|
|
61
115
|
interface ISquare {
|
|
62
|
-
marker: string;
|
|
63
116
|
side: number | string;
|
|
64
117
|
alignmentType: string;
|
|
65
118
|
}
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { IUserBody, IUserEntity, IUsers } from './usersInterfaces';
|
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with users
|
|
7
7
|
* @handle /api/content/users
|
|
8
|
+
* @description This module provides various methods to manage users, including creating, retrieving, updating, and deleting user data. It requires proper authorization to access these endpoints.
|
|
8
9
|
*/
|
|
9
10
|
export default class UsersApi extends AsyncModules implements IUsers {
|
|
10
11
|
protected state: StateModule;
|
|
@@ -13,63 +14,86 @@ export default class UsersApi extends AsyncModules implements IUsers {
|
|
|
13
14
|
/**
|
|
14
15
|
* Getting the data of an authorized user.
|
|
15
16
|
*
|
|
16
|
-
* @
|
|
17
|
+
* @handleName getUser
|
|
17
18
|
*
|
|
18
|
-
* @param {string} [langCode] -
|
|
19
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
20
|
+
* @return {IUserEntity} Returns a promise that resolves to the user entity object if successful; otherwise, returns an error object.
|
|
21
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
22
|
+
* @description Getting the data of an authorized user. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
19
23
|
*/
|
|
20
24
|
getUser(langCode?: string): Promise<IUserEntity | IError>;
|
|
21
25
|
/**
|
|
22
26
|
* Updating a single user object.
|
|
23
27
|
*
|
|
24
|
-
* @
|
|
25
|
-
*
|
|
26
|
-
* @param {object} [body] - Request body.
|
|
27
|
-
* @param {string} [langCode] - Optional language field
|
|
28
|
+
* @handleName updateUser
|
|
28
29
|
*
|
|
29
|
-
* @
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
* @param {IUserBody} body - Request body. Example:
|
|
31
|
+
{
|
|
32
|
+
"formIdentifier": "reg",
|
|
33
|
+
"authData": [
|
|
34
|
+
{
|
|
35
|
+
"marker": "password",
|
|
36
|
+
"value": "12345"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"formData": {
|
|
40
|
+
"marker": "last_name",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"value": "Username"
|
|
43
|
+
},
|
|
44
|
+
"notificationData": {
|
|
45
|
+
"email": "example@oneentry.cloud",
|
|
46
|
+
"phonePush": ["+99999999999"],
|
|
47
|
+
"phoneSMS": "+99999999999"
|
|
48
|
+
},
|
|
49
|
+
"state": {}
|
|
50
|
+
}
|
|
51
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
52
|
+
* @return {boolean} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
|
|
53
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
54
|
+
* @description Updating a single user object. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
50
55
|
*/
|
|
51
56
|
updateUser(body: IUserBody, langCode?: string): Promise<boolean | IError>;
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
58
|
+
* Archiving one user object (marked for deletion).
|
|
54
59
|
*
|
|
55
|
-
* @
|
|
60
|
+
* @handleName archiveUser
|
|
56
61
|
*
|
|
62
|
+
* @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
63
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
64
|
+
* @description Archiving one user object (marked for deletion). This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
57
65
|
*/
|
|
58
|
-
|
|
66
|
+
archiveUser(): Promise<boolean | IError>;
|
|
59
67
|
/**
|
|
60
|
-
*
|
|
68
|
+
* Delete a single user.
|
|
69
|
+
*
|
|
70
|
+
* @handleName deleteUser
|
|
61
71
|
*
|
|
72
|
+
* @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
73
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
62
74
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
75
|
+
*/
|
|
76
|
+
deleteUser(): Promise<boolean | IError>;
|
|
77
|
+
/**
|
|
78
|
+
* Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
79
|
+
*
|
|
80
|
+
* @handleName addFCMToken
|
|
63
81
|
*
|
|
64
|
-
* @param {string}
|
|
82
|
+
* @param {string} token - The cloud messaging token to be added. This token is used to identify the user's device for push notifications. Example: "fcm_token_1234567890abcdefg".
|
|
83
|
+
* @return {boolean} Returns `true` if the token was successfully added; otherwise, returns an error object.
|
|
84
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
85
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
65
86
|
*/
|
|
66
87
|
addFCMToken(token: string): Promise<boolean | IError>;
|
|
67
88
|
/**
|
|
68
|
-
*
|
|
89
|
+
* Deletes an FCM (Firebase Cloud Messaging) token.
|
|
69
90
|
*
|
|
70
|
-
* @
|
|
91
|
+
* @handleName deleteFCMToken
|
|
71
92
|
*
|
|
72
|
-
* @param {string}
|
|
93
|
+
* @param {string} token - The cloud messaging token to be deleted. This token is used to identify the user's device for push notifications and will be removed. Example: "fcm_token_1234567890abcdefg".
|
|
94
|
+
* @return {boolean} Returns `true` if the token was successfully deleted; otherwise, returns an error object.
|
|
95
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
96
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
73
97
|
*/
|
|
74
98
|
deleteFCMToken(token: string): Promise<boolean | IError>;
|
|
75
99
|
}
|
package/dist/users/usersApi.js
CHANGED
|
@@ -7,6 +7,7 @@ const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with users
|
|
9
9
|
* @handle /api/content/users
|
|
10
|
+
* @description This module provides various methods to manage users, including creating, retrieving, updating, and deleting user data. It requires proper authorization to access these endpoints.
|
|
10
11
|
*/
|
|
11
12
|
class UsersApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
|
@@ -16,9 +17,12 @@ class UsersApi extends asyncModules_1.default {
|
|
|
16
17
|
/**
|
|
17
18
|
* Getting the data of an authorized user.
|
|
18
19
|
*
|
|
19
|
-
* @
|
|
20
|
+
* @handleName getUser
|
|
20
21
|
*
|
|
21
|
-
* @param {string} [langCode] -
|
|
22
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
23
|
+
* @return {IUserEntity} Returns a promise that resolves to the user entity object if successful; otherwise, returns an error object.
|
|
24
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
25
|
+
* @description Getting the data of an authorized user. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
22
26
|
*/
|
|
23
27
|
async getUser(langCode = this.state.lang) {
|
|
24
28
|
const result = await this._fetchGet(`/me?langCode=${langCode}`);
|
|
@@ -27,32 +31,33 @@ class UsersApi extends asyncModules_1.default {
|
|
|
27
31
|
/**
|
|
28
32
|
* Updating a single user object.
|
|
29
33
|
*
|
|
30
|
-
* @
|
|
31
|
-
*
|
|
32
|
-
* @param {object} [body] - Request body.
|
|
33
|
-
* @param {string} [langCode] - Optional language field
|
|
34
|
+
* @handleName updateUser
|
|
34
35
|
*
|
|
35
|
-
* @
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
* @param {IUserBody} body - Request body. Example:
|
|
37
|
+
{
|
|
38
|
+
"formIdentifier": "reg",
|
|
39
|
+
"authData": [
|
|
40
|
+
{
|
|
41
|
+
"marker": "password",
|
|
42
|
+
"value": "12345"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"formData": {
|
|
46
|
+
"marker": "last_name",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"value": "Username"
|
|
49
|
+
},
|
|
50
|
+
"notificationData": {
|
|
51
|
+
"email": "example@oneentry.cloud",
|
|
52
|
+
"phonePush": ["+99999999999"],
|
|
53
|
+
"phoneSMS": "+99999999999"
|
|
54
|
+
},
|
|
55
|
+
"state": {}
|
|
56
|
+
}
|
|
57
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
58
|
+
* @return {boolean} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
|
|
59
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
60
|
+
* @description Updating a single user object. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
56
61
|
*/
|
|
57
62
|
async updateUser(body, langCode = this.state.lang) {
|
|
58
63
|
if (!('langCode' in body))
|
|
@@ -65,32 +70,54 @@ class UsersApi extends asyncModules_1.default {
|
|
|
65
70
|
return result;
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
68
|
-
*
|
|
73
|
+
* Archiving one user object (marked for deletion).
|
|
69
74
|
*
|
|
70
|
-
* @
|
|
75
|
+
* @handleName archiveUser
|
|
71
76
|
*
|
|
77
|
+
* @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
78
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
79
|
+
* @description Archiving one user object (marked for deletion). This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
72
80
|
*/
|
|
73
|
-
async
|
|
81
|
+
async archiveUser() {
|
|
74
82
|
const result = await this._fetchDelete('/me');
|
|
75
83
|
return result;
|
|
76
84
|
}
|
|
77
85
|
/**
|
|
78
|
-
*
|
|
86
|
+
* Delete a single user.
|
|
87
|
+
*
|
|
88
|
+
* @handleName deleteUser
|
|
79
89
|
*
|
|
90
|
+
* @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
|
|
91
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
80
92
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
93
|
+
*/
|
|
94
|
+
async deleteUser() {
|
|
95
|
+
const result = await this._fetchDelete('/me/account');
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
100
|
+
*
|
|
101
|
+
* @handleName addFCMToken
|
|
81
102
|
*
|
|
82
|
-
* @param {string}
|
|
103
|
+
* @param {string} token - The cloud messaging token to be added. This token is used to identify the user's device for push notifications. Example: "fcm_token_1234567890abcdefg".
|
|
104
|
+
* @return {boolean} Returns `true` if the token was successfully added; otherwise, returns an error object.
|
|
105
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
106
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
83
107
|
*/
|
|
84
108
|
async addFCMToken(token) {
|
|
85
109
|
const result = await this._fetchPost(`/me/fcm-token/${token}`);
|
|
86
110
|
return result;
|
|
87
111
|
}
|
|
88
112
|
/**
|
|
89
|
-
*
|
|
113
|
+
* Deletes an FCM (Firebase Cloud Messaging) token.
|
|
90
114
|
*
|
|
91
|
-
* @
|
|
115
|
+
* @handleName deleteFCMToken
|
|
92
116
|
*
|
|
93
|
-
* @param {string}
|
|
117
|
+
* @param {string} token - The cloud messaging token to be deleted. This token is used to identify the user's device for push notifications and will be removed. Example: "fcm_token_1234567890abcdefg".
|
|
118
|
+
* @return {boolean} Returns `true` if the token was successfully deleted; otherwise, returns an error object.
|
|
119
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
120
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
94
121
|
*/
|
|
95
122
|
async deleteFCMToken(token) {
|
|
96
123
|
const result = await this._fetchDelete(`/me/fcm-token/${token}`);
|
|
@@ -1,35 +1,157 @@
|
|
|
1
|
+
import type { IFormConfig } from 'forms/formsInterfaces';
|
|
1
2
|
import type { IAuthFormData } from '../auth-provider/authProvidersInterfaces';
|
|
2
3
|
import type { IError } from '../base/utils';
|
|
3
|
-
import type { FormDataType } from '../
|
|
4
|
+
import type { FormDataType } from '../forms-data/formsDataInterfaces';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Interface representing user-related operations.
|
|
6
7
|
*
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* @property {function}
|
|
10
|
-
* @property {function}
|
|
11
|
-
* @property {function}
|
|
8
|
+
* @interface IUsers
|
|
9
|
+
*
|
|
10
|
+
* @property {function} getUser - Retrieves the data of an authorized user, optionally based on a language code.
|
|
11
|
+
* @property {function} updateUser - Updates the user's data with the provided information.
|
|
12
|
+
* @property {function} archiveUser - Archiving one user object (marked for deletion).
|
|
13
|
+
* @property {function} deleteUser - Deletes the user from the system.
|
|
14
|
+
* @property {function} addFCMToken - Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
15
|
+
* @property {function} deleteFCMToken - Deletes an existing FCM token.
|
|
16
|
+
* @description This interface defines methods for managing user data and handling Firebase Cloud Messaging tokens.
|
|
12
17
|
*/
|
|
13
18
|
interface IUsers {
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the data of an authorized user.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
23
|
+
* @return {IUserEntity} A promise resolving to the user entity or an error.
|
|
24
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
25
|
+
* @description Retrieves the data of an authorized user.
|
|
26
|
+
*/
|
|
14
27
|
getUser(langCode?: string): Promise<IUserEntity | IError>;
|
|
28
|
+
/**
|
|
29
|
+
* Updates the user's data.
|
|
30
|
+
*
|
|
31
|
+
* @param {IUserBody} data - The new data for the user. Example:
|
|
32
|
+
{
|
|
33
|
+
"formIdentifier": "reg",
|
|
34
|
+
"authData": [
|
|
35
|
+
{
|
|
36
|
+
"marker": "password",
|
|
37
|
+
"value": "12345"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"formData": {
|
|
41
|
+
"marker": "last_name",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"value": "Username"
|
|
44
|
+
},
|
|
45
|
+
"notificationData": {
|
|
46
|
+
"email": "example@oneentry.cloud",
|
|
47
|
+
"phonePush": ["+99999999999"],
|
|
48
|
+
"phoneSMS": "+99999999999"
|
|
49
|
+
},
|
|
50
|
+
"state": {}
|
|
51
|
+
}
|
|
52
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
53
|
+
* @return {boolean} A promise resolving to true if successful, or an error.
|
|
54
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
+
* @description Updates the user's data.
|
|
56
|
+
*/
|
|
15
57
|
updateUser(data: IUserBody, langCode?: string): Promise<boolean | IError>;
|
|
58
|
+
/**
|
|
59
|
+
* Archiving one user object (marked for deletion).
|
|
60
|
+
*
|
|
61
|
+
* @return {boolean} A promise resolving to true if successful, or an error.
|
|
62
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
63
|
+
* @description Deletes the user from the system.
|
|
64
|
+
*/
|
|
65
|
+
archiveUser(): Promise<boolean | IError>;
|
|
66
|
+
/**
|
|
67
|
+
* Deletes the user from the system.
|
|
68
|
+
*
|
|
69
|
+
* @return {boolean} A promise resolving to true if successful, or an error.
|
|
70
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
71
|
+
* @description Deletes the user from the system.
|
|
72
|
+
*/
|
|
73
|
+
deleteUser(): Promise<boolean | IError>;
|
|
74
|
+
/**
|
|
75
|
+
* Adds an FCM token for sending push notifications.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} token - The FCM token to be added. Example: "fcm_token_1234567890abcdefg".
|
|
78
|
+
* @return {boolean} A promise resolving to true if successful, or an error.
|
|
79
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
80
|
+
* @description Adds an FCM token for sending push notifications.
|
|
81
|
+
*/
|
|
16
82
|
addFCMToken(token: string): Promise<boolean | IError>;
|
|
83
|
+
/**
|
|
84
|
+
* Deletes an existing FCM token.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} token - The FCM token to be deleted. Example: "fcm_token_1234567890abcdefg".
|
|
87
|
+
* @return {boolean} A promise resolving to true if successful, or an error.
|
|
88
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
89
|
+
* @description Deletes an existing FCM token.
|
|
90
|
+
*/
|
|
17
91
|
deleteFCMToken(token: string): Promise<boolean | IError>;
|
|
18
92
|
}
|
|
19
93
|
/**
|
|
20
|
-
* IUserEntity
|
|
94
|
+
* @interface IUserEntity
|
|
95
|
+
*
|
|
96
|
+
* @property {number} id - Object identifier. Example: 12345.
|
|
97
|
+
* @property {string} identifier - Text identifier for record field. Example: "user_12345".
|
|
98
|
+
* @property {string} authProviderIdentifier - Text identifier of the authentication provider. Example: "auth_provider_12345".
|
|
99
|
+
* @property {FormDataType[]} formData - Array of data form objects with the following values. Example:
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
"marker": "last_name",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"value": "Username"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
* @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
|
|
108
|
+
* @property {any[]} groups - Array of user groups. Example: ["group_1", "group_2"].
|
|
109
|
+
* @property {any} state - Object containing additional user state information. Example: {"key": "value"}
|
|
110
|
+
* @description Represents a user entity with various properties, including identifiers, form data, and user groups.
|
|
21
111
|
*/
|
|
22
112
|
interface IUserEntity {
|
|
23
113
|
id: number;
|
|
24
114
|
identifier: string;
|
|
25
|
-
formData: Array<FormDataType>;
|
|
26
|
-
formIdentifier: string;
|
|
27
115
|
authProviderIdentifier: string;
|
|
28
|
-
|
|
116
|
+
formData: FormDataType[];
|
|
117
|
+
formIdentifier: string;
|
|
118
|
+
groups: Array<string | number>;
|
|
29
119
|
state: Record<string, any>;
|
|
120
|
+
moduleFormConfigs: IFormConfig;
|
|
30
121
|
}
|
|
31
122
|
/**
|
|
32
|
-
* IUserBody
|
|
123
|
+
* @interface IUserBody
|
|
124
|
+
*
|
|
125
|
+
* @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
|
|
126
|
+
* @property {string} [langCode] - Language code for localization. Default: "en_US".
|
|
127
|
+
* @property {{ marker: string; value: string }[]} [authData] - Array of authentication data objects with markers and values. Example:
|
|
128
|
+
[
|
|
129
|
+
{
|
|
130
|
+
"marker": "password",
|
|
131
|
+
"value": "12345"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
* @property {IAuthFormData | IAuthFormData[]} [formData] - Form data object or array of form data objects. Example:
|
|
135
|
+
[
|
|
136
|
+
{
|
|
137
|
+
"marker": "first_name",
|
|
138
|
+
"type": "string",
|
|
139
|
+
"value": "John"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"marker": "last_name",
|
|
143
|
+
"type": "string",
|
|
144
|
+
"value": "Doe"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
* @property {object} [notificationData] - Object containing notification data, including email and phone information. Example:
|
|
148
|
+
{
|
|
149
|
+
"email": "example@oneentry.cloud",
|
|
150
|
+
"phonePush": ["+99999999999"],
|
|
151
|
+
"phoneSMS": "+99999999999"
|
|
152
|
+
}
|
|
153
|
+
* @property {any} [state] - Object containing additional state information. Example: {"key": "value"}
|
|
154
|
+
* @description Represents the body of a user request, including form identifiers, authentication data, form data, notification data, and state information.
|
|
33
155
|
*/
|
|
34
156
|
interface IUserBody {
|
|
35
157
|
formIdentifier: string;
|
|
@@ -38,10 +160,10 @@ interface IUserBody {
|
|
|
38
160
|
marker: string;
|
|
39
161
|
value: string;
|
|
40
162
|
}>;
|
|
41
|
-
formData?: IAuthFormData |
|
|
163
|
+
formData?: IAuthFormData | IAuthFormData[];
|
|
42
164
|
notificationData?: {
|
|
43
165
|
email: string;
|
|
44
|
-
phonePush:
|
|
166
|
+
phonePush: string[];
|
|
45
167
|
phoneSMS: string;
|
|
46
168
|
};
|
|
47
169
|
state?: Record<string, any>;
|
|
@@ -11,13 +11,12 @@ export default class WsApi extends AsyncModules implements IWS {
|
|
|
11
11
|
protected _url: string;
|
|
12
12
|
constructor(state: StateModule);
|
|
13
13
|
/**
|
|
14
|
-
* Creates an instance of an object Socket.io with a connection.
|
|
15
|
-
* This method requires mandatory user authorization
|
|
14
|
+
* Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
16
15
|
*
|
|
17
|
-
* @
|
|
18
|
-
* const socket = WS.connect()
|
|
16
|
+
* @handleName connect
|
|
19
17
|
*
|
|
20
|
-
*
|
|
18
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
19
|
+
* @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
21
20
|
*/
|
|
22
21
|
connect(): Socket;
|
|
23
22
|
}
|
package/dist/web-socket/wsApi.js
CHANGED
|
@@ -15,13 +15,12 @@ class WsApi extends asyncModules_1.default {
|
|
|
15
15
|
this._url = state.url + '/api/content/ws';
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Creates an instance of an object Socket.io with a connection.
|
|
19
|
-
* This method requires mandatory user authorization
|
|
18
|
+
* Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
20
19
|
*
|
|
21
|
-
* @
|
|
22
|
-
* const socket = WS.connect()
|
|
20
|
+
* @handleName connect
|
|
23
21
|
*
|
|
24
|
-
*
|
|
22
|
+
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
23
|
+
* @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
|
|
25
24
|
*/
|
|
26
25
|
connect() {
|
|
27
26
|
if (!this.state.accessToken) {
|