oneentry 1.0.176 → 1.0.178
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 +27 -1
- package/dist/forms-data/formsDataApi.js +119 -68
- 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 +8 -6
- package/dist/pages/pagesApi.js +48 -33
- package/dist/pages/pagesInterfaces.d.ts +20 -16
- 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 +50 -64
- package/dist/products/productsApi.js +79 -80
- package/dist/products/productsInterfaces.d.ts +59 -90
- package/dist/search/searchApi.d.ts +3 -2
- package/dist/search/searchApi.js +7 -4
- package/dist/search/searchInterfaces.d.ts +2 -1
- 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 +27 -1
- package/esm/forms-data/formsDataApi.js +119 -68
- 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 +8 -6
- package/esm/pages/pagesApi.js +48 -33
- package/esm/pages/pagesInterfaces.d.ts +20 -16
- 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 +50 -64
- package/esm/products/productsApi.js +79 -80
- package/esm/products/productsInterfaces.d.ts +59 -90
- package/esm/search/searchApi.d.ts +3 -2
- package/esm/search/searchApi.js +7 -4
- package/esm/search/searchInterfaces.d.ts +2 -1
- 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
|
@@ -17,7 +17,7 @@ interface ITemplatesApi {
|
|
|
17
17
|
/**
|
|
18
18
|
* Get template objects by type.
|
|
19
19
|
* @handleName getTemplateByType
|
|
20
|
-
* @param {BlockType} type - Type of templates to fetch. Example: "
|
|
20
|
+
* @param {BlockType} type - Type of templates to fetch. Example: "product_block". A type with no templates gives an empty array.
|
|
21
21
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
22
22
|
* @returns {ITemplateEntity[]} Array of `ITemplateEntity` objects of the given type.
|
|
23
23
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
@@ -44,7 +44,7 @@ interface ITemplatesApi {
|
|
|
44
44
|
* @property {number} generalTypeId - ID of the general type. Example: 67890.
|
|
45
45
|
* @property {string} identifier - Text identifier (marker) of the object. Example: "template_12345".
|
|
46
46
|
* @property {number} version - Version number of the object; changes with each update. Example: 1.
|
|
47
|
-
* @property {BlockType} generalTypeName - General type name. Example: "
|
|
47
|
+
* @property {BlockType} generalTypeName - General type name. Example: "product_block".
|
|
48
48
|
* @property {IAttributeValues} attributeValues - Attribute values keyed by marker; an empty object when there are none.
|
|
49
49
|
* @example
|
|
50
50
|
{
|
|
@@ -26,7 +26,7 @@ export default class TemplatePreviewsApi extends AsyncModules {
|
|
|
26
26
|
* @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviews getTemplatePreviews} documentation.
|
|
27
27
|
*/
|
|
28
28
|
async getTemplatePreviews(langCode = this.state.lang) {
|
|
29
|
-
const result = await this._fetchGet(`?langCode=${langCode}`);
|
|
29
|
+
const result = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}`);
|
|
30
30
|
// Validate response if validation is enabled
|
|
31
31
|
const validated = await this._validateResponse(result, schema('TemplatePreviewsResponseSchema'));
|
|
32
32
|
return this._normalizeData(validated, langCode);
|
|
@@ -42,7 +42,7 @@ export default class TemplatePreviewsApi extends AsyncModules {
|
|
|
42
42
|
* @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
|
|
43
43
|
*/
|
|
44
44
|
async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
|
|
45
|
-
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
45
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
|
|
46
46
|
// Validate response if validation is enabled
|
|
47
47
|
const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
|
|
48
48
|
return this._normalizeData(validated, langCode);
|
|
@@ -27,46 +27,52 @@ interface ITemplatesPreviewApi {
|
|
|
27
27
|
* @interface ITemplatesPreviewEntity
|
|
28
28
|
* @property {number} id - ID of the object. Example: 3.
|
|
29
29
|
* @property {string} title - Name of the preview template. Example: "Product Template".
|
|
30
|
-
* @property {object} proportions - Preview proportions: the horizontal, vertical and square variants
|
|
30
|
+
* @property {object} proportions - Preview proportions: the horizontal, vertical and square variants under `default`.
|
|
31
31
|
* @example
|
|
32
32
|
{
|
|
33
33
|
"default": {
|
|
34
34
|
"horizontal": {
|
|
35
35
|
"width": 234,
|
|
36
36
|
"height": 324,
|
|
37
|
-
"alignmentType": "middleBottom"
|
|
37
|
+
"alignmentType": "middleBottom",
|
|
38
|
+
"weight": 234
|
|
38
39
|
},
|
|
39
40
|
"vertical": {
|
|
40
41
|
"width": 2,
|
|
41
42
|
"height": 3,
|
|
42
|
-
"alignmentType": "leftTop"
|
|
43
|
+
"alignmentType": "leftTop",
|
|
44
|
+
"weight": 2
|
|
43
45
|
},
|
|
44
46
|
"square": {
|
|
45
|
-
"side":
|
|
46
|
-
"alignmentType": "
|
|
47
|
-
}
|
|
47
|
+
"side": 360,
|
|
48
|
+
"alignmentType": "middleMiddle"
|
|
49
|
+
},
|
|
50
|
+
"default": true
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
* @property {IProportion | null} proportions.horizontal - Horizontal proportion of the preview.
|
|
53
|
+
* @property {IProportion | null} proportions.default.horizontal - Horizontal proportion of the preview.
|
|
51
54
|
* @example
|
|
52
55
|
{
|
|
53
56
|
"width": 234,
|
|
54
57
|
"height": 324,
|
|
55
|
-
"alignmentType": "middleBottom"
|
|
58
|
+
"alignmentType": "middleBottom",
|
|
59
|
+
"weight": 234
|
|
56
60
|
}
|
|
57
|
-
* @property {IProportion | null} proportions.vertical - Vertical variant of the preview, or `null`.
|
|
61
|
+
* @property {IProportion | null} proportions.default.vertical - Vertical variant of the preview, or `null`.
|
|
58
62
|
* @example
|
|
59
63
|
{
|
|
60
64
|
"width": 2,
|
|
61
65
|
"height": 3,
|
|
62
|
-
"alignmentType": "leftTop"
|
|
66
|
+
"alignmentType": "leftTop",
|
|
67
|
+
"weight": 2
|
|
63
68
|
}
|
|
64
|
-
* @property {ISquare} proportions.square - Square variant of the preview.
|
|
69
|
+
* @property {ISquare} proportions.default.square - Square variant of the preview.
|
|
65
70
|
* @example
|
|
66
71
|
{
|
|
67
|
-
"side":
|
|
68
|
-
"alignmentType": "
|
|
72
|
+
"side": 360,
|
|
73
|
+
"alignmentType": "middleMiddle"
|
|
69
74
|
}
|
|
75
|
+
* @property {boolean} [proportions.default.default] - Whether these are the default proportions. Example: true.
|
|
70
76
|
* @property {string} identifier - Text identifier (marker) of the object. Example: "preview-templates"
|
|
71
77
|
* @property {number} version - Version number of the object; changes with each update. Example: 1.
|
|
72
78
|
* @property {number} position - Position of the object, used for sorting. Example: 1.
|
|
@@ -95,12 +101,14 @@ interface ITemplatesPreviewProportions {
|
|
|
95
101
|
* @property {IProportion | null} horizontal - Horizontal layout proportion, or null when not configured.
|
|
96
102
|
* @property {IProportion | null} vertical - Vertical layout proportion, or null when not configured.
|
|
97
103
|
* @property {ISquare} square - Square layout proportion.
|
|
104
|
+
* @property {boolean} [default] - Whether these are the default proportions. Example: true.
|
|
98
105
|
* @description Layout proportion variants of a template preview.
|
|
99
106
|
*/
|
|
100
107
|
interface ITemplatesPreviewProportionVariants {
|
|
101
108
|
horizontal: IProportion | null;
|
|
102
109
|
vertical: IProportion | null;
|
|
103
110
|
square: ISquare;
|
|
111
|
+
default?: boolean;
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
106
114
|
* The `IProportion` interface defines the structure of a proportion object used in template previews.
|
|
@@ -108,12 +116,14 @@ interface ITemplatesPreviewProportionVariants {
|
|
|
108
116
|
* @property {string | number | null} width - Width of the preview. Example: 100.
|
|
109
117
|
* @property {string | number | null} height - Height of the preview. Example: 200.
|
|
110
118
|
* @property {string} alignmentType - Alignment of the preview, such as `center`. Example: "center".
|
|
119
|
+
* @property {number | null} [weight] - Weight of the proportion; the API sends the width value. Example: 234.
|
|
111
120
|
* @description Represents a proportion object used in template previews.
|
|
112
121
|
*/
|
|
113
122
|
interface IProportion {
|
|
114
123
|
width: number | null;
|
|
115
124
|
height: number | null;
|
|
116
125
|
alignmentType: string;
|
|
126
|
+
weight?: number | null;
|
|
117
127
|
}
|
|
118
128
|
/**
|
|
119
129
|
* The `ISquare` interface defines the structure of a square proportion object used in template previews.
|
|
@@ -10,6 +10,7 @@ export declare const ProportionSchema: z.ZodObject<{
|
|
|
10
10
|
width: z.ZodNullable<z.ZodNumber>;
|
|
11
11
|
height: z.ZodNullable<z.ZodNumber>;
|
|
12
12
|
alignmentType: z.ZodString;
|
|
13
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
13
14
|
}, z.core.$strip>;
|
|
14
15
|
/**
|
|
15
16
|
* Square schema
|
|
@@ -31,16 +32,19 @@ export declare const TemplatePreviewEntitySchema: z.ZodObject<{
|
|
|
31
32
|
width: z.ZodNullable<z.ZodNumber>;
|
|
32
33
|
height: z.ZodNullable<z.ZodNumber>;
|
|
33
34
|
alignmentType: z.ZodString;
|
|
35
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
34
36
|
}, z.core.$strip>>;
|
|
35
37
|
vertical: z.ZodNullable<z.ZodObject<{
|
|
36
38
|
width: z.ZodNullable<z.ZodNumber>;
|
|
37
39
|
height: z.ZodNullable<z.ZodNumber>;
|
|
38
40
|
alignmentType: z.ZodString;
|
|
41
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
39
42
|
}, z.core.$strip>>;
|
|
40
43
|
square: z.ZodObject<{
|
|
41
44
|
side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
42
45
|
alignmentType: z.ZodString;
|
|
43
46
|
}, z.core.$strip>;
|
|
47
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
44
48
|
}, z.core.$strip>;
|
|
45
49
|
}, z.core.$strip>;
|
|
46
50
|
identifier: z.ZodString;
|
|
@@ -60,16 +64,19 @@ export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
60
64
|
width: z.ZodNullable<z.ZodNumber>;
|
|
61
65
|
height: z.ZodNullable<z.ZodNumber>;
|
|
62
66
|
alignmentType: z.ZodString;
|
|
67
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
63
68
|
}, z.core.$strip>>;
|
|
64
69
|
vertical: z.ZodNullable<z.ZodObject<{
|
|
65
70
|
width: z.ZodNullable<z.ZodNumber>;
|
|
66
71
|
height: z.ZodNullable<z.ZodNumber>;
|
|
67
72
|
alignmentType: z.ZodString;
|
|
73
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
68
74
|
}, z.core.$strip>>;
|
|
69
75
|
square: z.ZodObject<{
|
|
70
76
|
side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
71
77
|
alignmentType: z.ZodString;
|
|
72
78
|
}, z.core.$strip>;
|
|
79
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
73
80
|
}, z.core.$strip>;
|
|
74
81
|
}, z.core.$strip>;
|
|
75
82
|
identifier: z.ZodString;
|
|
@@ -10,6 +10,7 @@ export const ProportionSchema = z.object({
|
|
|
10
10
|
width: z.number().nullable(),
|
|
11
11
|
height: z.number().nullable(),
|
|
12
12
|
alignmentType: z.string(),
|
|
13
|
+
weight: z.number().nullable().optional(),
|
|
13
14
|
});
|
|
14
15
|
/**
|
|
15
16
|
* Square schema
|
|
@@ -30,6 +31,7 @@ export const TemplatePreviewEntitySchema = z.object({
|
|
|
30
31
|
horizontal: ProportionSchema.nullable(),
|
|
31
32
|
vertical: ProportionSchema.nullable(),
|
|
32
33
|
square: SquareSchema,
|
|
34
|
+
default: z.boolean().optional(),
|
|
33
35
|
}),
|
|
34
36
|
}),
|
|
35
37
|
identifier: z.string(),
|
|
@@ -34,7 +34,7 @@ export default class UserGroupsApi extends AsyncModules {
|
|
|
34
34
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroups getUserGroups} documentation.
|
|
35
35
|
*/
|
|
36
36
|
async getUserGroups(langCode = this.state.lang) {
|
|
37
|
-
const result = await this._fetchGet(`/?langCode=${langCode}`);
|
|
37
|
+
const result = await this._fetchGet(`/?langCode=${encodeURIComponent(langCode)}`);
|
|
38
38
|
// Validate response if validation is enabled
|
|
39
39
|
const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
|
|
40
40
|
return this._normalizeData(validated, langCode);
|
|
@@ -49,7 +49,7 @@ export default class UserGroupsApi extends AsyncModules {
|
|
|
49
49
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getRootUserGroups getRootUserGroups} documentation.
|
|
50
50
|
*/
|
|
51
51
|
async getRootUserGroups(langCode = this.state.lang) {
|
|
52
|
-
const result = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
52
|
+
const result = await this._fetchGet(`/root?langCode=${encodeURIComponent(langCode)}`);
|
|
53
53
|
// Validate response if validation is enabled
|
|
54
54
|
const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
|
|
55
55
|
return this._normalizeData(validated, langCode);
|
|
@@ -65,7 +65,7 @@ export default class UserGroupsApi extends AsyncModules {
|
|
|
65
65
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupById getUserGroupById} documentation.
|
|
66
66
|
*/
|
|
67
67
|
async getUserGroupById(id, langCode = this.state.lang) {
|
|
68
|
-
const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
68
|
+
const result = await this._fetchGet(`/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
|
|
69
69
|
// Validate response if validation is enabled
|
|
70
70
|
const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
|
|
71
71
|
return this._normalizeData(validated, langCode);
|
|
@@ -81,7 +81,7 @@ export default class UserGroupsApi extends AsyncModules {
|
|
|
81
81
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
|
|
82
82
|
*/
|
|
83
83
|
async getUserGroupByMarker(marker, langCode = this.state.lang) {
|
|
84
|
-
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
|
|
84
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
|
|
85
85
|
// Validate response if validation is enabled
|
|
86
86
|
const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
|
|
87
87
|
return this._normalizeData(validated, langCode);
|
|
@@ -98,7 +98,7 @@ export default class UserGroupsApi extends AsyncModules {
|
|
|
98
98
|
* @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
|
|
99
99
|
*/
|
|
100
100
|
async getChildUserGroupsByMarker(marker, langCode = this.state.lang) {
|
|
101
|
-
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${langCode}`);
|
|
101
|
+
const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${encodeURIComponent(langCode)}`);
|
|
102
102
|
// Validate response if validation is enabled
|
|
103
103
|
const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
|
|
104
104
|
return this._normalizeData(validated, langCode);
|
|
@@ -17,11 +17,11 @@ export declare const UserGroupEntitySchema: z.ZodObject<{
|
|
|
17
17
|
localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
18
18
|
title: z.ZodString;
|
|
19
19
|
content: z.ZodOptional<z.ZodString>;
|
|
20
|
-
menuTitle: z.ZodOptional<z.ZodString
|
|
20
|
+
menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
21
|
}, z.core.$strip>>, z.ZodObject<{
|
|
22
22
|
title: z.ZodString;
|
|
23
23
|
content: z.ZodOptional<z.ZodString>;
|
|
24
|
-
menuTitle: z.ZodOptional<z.ZodString
|
|
24
|
+
menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
25
|
}, z.core.$strip>]>;
|
|
26
26
|
isVisible: z.ZodBoolean;
|
|
27
27
|
childrenCount: z.ZodString;
|
|
@@ -40,11 +40,11 @@ export declare const UserGroupsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
40
40
|
localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
41
41
|
title: z.ZodString;
|
|
42
42
|
content: z.ZodOptional<z.ZodString>;
|
|
43
|
-
menuTitle: z.ZodOptional<z.ZodString
|
|
43
|
+
menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
44
|
}, z.core.$strip>>, z.ZodObject<{
|
|
45
45
|
title: z.ZodString;
|
|
46
46
|
content: z.ZodOptional<z.ZodString>;
|
|
47
|
-
menuTitle: z.ZodOptional<z.ZodString
|
|
47
|
+
menuTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
48
|
}, z.core.$strip>]>;
|
|
49
49
|
isVisible: z.ZodBoolean;
|
|
50
50
|
childrenCount: z.ZodString;
|
package/esm/users/usersApi.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
|
|
|
58
58
|
},
|
|
59
59
|
"state": {}
|
|
60
60
|
}
|
|
61
|
-
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "
|
|
61
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
|
|
62
62
|
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
63
63
|
* @example
|
|
64
64
|
[
|
package/esm/users/usersApi.js
CHANGED
|
@@ -27,10 +27,21 @@ export default class UsersApi extends AsyncModules {
|
|
|
27
27
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/getUser getUser} documentation.
|
|
28
28
|
*/
|
|
29
29
|
async getUser(langCode = this.state.lang) {
|
|
30
|
-
const result = await this._fetchGet(`/me?langCode=${langCode}`);
|
|
30
|
+
const result = await this._fetchGet(`/me?langCode=${encodeURIComponent(langCode)}`);
|
|
31
31
|
// Validate response if validation is enabled
|
|
32
32
|
const validated = await this._validateResponse(result, schema('UserResponseSchema'));
|
|
33
|
-
|
|
33
|
+
// `state` is the caller's own data, stored as written: the normalizer took a
|
|
34
|
+
// `{ en_US: … }` map in it for a localization and `{ type, value }` for an attribute.
|
|
35
|
+
// It is kept out of the normalization altogether — `{ attributes: { x: 's' } }`
|
|
36
|
+
// in it made `getUser` throw a TypeError.
|
|
37
|
+
if (validated &&
|
|
38
|
+
typeof validated === 'object' &&
|
|
39
|
+
!this._isErrorResponse(validated) &&
|
|
40
|
+
'state' in validated) {
|
|
41
|
+
const { state, ...rest } = validated;
|
|
42
|
+
return { ...this._normalizeData(rest, langCode), state };
|
|
43
|
+
}
|
|
44
|
+
return this._normalizeData(validated, langCode);
|
|
34
45
|
}
|
|
35
46
|
/**
|
|
36
47
|
* Updating a single user object.
|
|
@@ -63,7 +74,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
63
74
|
},
|
|
64
75
|
"state": {}
|
|
65
76
|
}
|
|
66
|
-
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "
|
|
77
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
|
|
67
78
|
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
68
79
|
* @example
|
|
69
80
|
[
|
|
@@ -111,8 +122,13 @@ export default class UsersApi extends AsyncModules {
|
|
|
111
122
|
async updateUser(body, langCode = this.state.lang) {
|
|
112
123
|
// The language goes onto our own copy; the caller's body is left alone (CMS-909).
|
|
113
124
|
const payload = 'langCode' in body ? body : { ...body, langCode };
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
// formData is wrapped under the language of the body: a `langCode: 'ru_RU'` in the
|
|
126
|
+
// body used to be sent with the fields under `en_US`
|
|
127
|
+
const bodyLang = payload.langCode || langCode;
|
|
128
|
+
const result = await this._fetchPut('/me', this._normalizePostBody(payload, bodyLang));
|
|
129
|
+
// An empty 2xx body comes back as `{}`; the method declares `true`. Read before
|
|
130
|
+
// validation: in strict mode the boolean schema turned that success into a 422
|
|
131
|
+
const validated = await this._validateResponse(this._asBoolean(result), schema('UpdateUserResponseSchema'));
|
|
116
132
|
return validated;
|
|
117
133
|
}
|
|
118
134
|
/**
|
|
@@ -125,8 +141,8 @@ export default class UsersApi extends AsyncModules {
|
|
|
125
141
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/archiveUser archiveUser} documentation.
|
|
126
142
|
*/
|
|
127
143
|
async archiveUser() {
|
|
128
|
-
|
|
129
|
-
return
|
|
144
|
+
// An empty 2xx body came back as `{}`; the method declares `true`
|
|
145
|
+
return this._fetchBoolean(() => this._fetchDelete('/me'));
|
|
130
146
|
}
|
|
131
147
|
/**
|
|
132
148
|
* Delete a single user.
|
|
@@ -138,8 +154,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
138
154
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/deleteUser deleteUser} documentation.
|
|
139
155
|
*/
|
|
140
156
|
async deleteUser() {
|
|
141
|
-
|
|
142
|
-
return result;
|
|
157
|
+
return this._fetchBoolean(() => this._fetchDelete('/me/account'));
|
|
143
158
|
}
|
|
144
159
|
/**
|
|
145
160
|
* Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
|
|
@@ -152,8 +167,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
152
167
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/addFCMToken addFCMToken} documentation.
|
|
153
168
|
*/
|
|
154
169
|
async addFCMToken(token) {
|
|
155
|
-
|
|
156
|
-
return result;
|
|
170
|
+
return this._fetchBoolean(() => this._fetchPost(`/me/fcm-token/${this._pathSegment(token)}`));
|
|
157
171
|
}
|
|
158
172
|
/**
|
|
159
173
|
* Deletes an FCM (Firebase Cloud Messaging) token.
|
|
@@ -166,8 +180,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
166
180
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/deleteFCMToken deleteFCMToken} documentation.
|
|
167
181
|
*/
|
|
168
182
|
async deleteFCMToken(token) {
|
|
169
|
-
|
|
170
|
-
return result;
|
|
183
|
+
return this._fetchBoolean(() => this._fetchDelete(`/me/fcm-token/${this._pathSegment(token)}`));
|
|
171
184
|
}
|
|
172
185
|
/**
|
|
173
186
|
* Get the current user's or guest's cart.
|
|
@@ -224,7 +237,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
224
237
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/removeCartItem removeCartItem} documentation.
|
|
225
238
|
*/
|
|
226
239
|
async removeCartItem(productId) {
|
|
227
|
-
const result = await this._fetchDelete(`/me/cart/items/${productId}`);
|
|
240
|
+
const result = await this._fetchDelete(`/me/cart/items/${this._pathSegment(String(productId))}`);
|
|
228
241
|
const validated = await this._validateResponse(result, schema('CartResponseSchema'));
|
|
229
242
|
return this._normalizeData(validated);
|
|
230
243
|
}
|
|
@@ -283,7 +296,7 @@ export default class UsersApi extends AsyncModules {
|
|
|
283
296
|
* @see {@link https://js-sdk.oneentry.cloud/docs/users/removeWishlistItem removeWishlistItem} documentation.
|
|
284
297
|
*/
|
|
285
298
|
async removeWishlistItem(productId) {
|
|
286
|
-
const result = await this._fetchDelete(`/me/wishlist/items/${productId}`);
|
|
299
|
+
const result = await this._fetchDelete(`/me/wishlist/items/${this._pathSegment(String(productId))}`);
|
|
287
300
|
const validated = await this._validateResponse(result, schema('WishlistResponseSchema'));
|
|
288
301
|
return this._normalizeData(validated);
|
|
289
302
|
}
|
|
@@ -49,7 +49,7 @@ interface IUsersApi {
|
|
|
49
49
|
},
|
|
50
50
|
"state": {}
|
|
51
51
|
}
|
|
52
|
-
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "
|
|
52
|
+
* @param {string} body.formIdentifier - Identifies the registration form being used. Example: "reg".
|
|
53
53
|
* @param {string} body.authData - Contains authentication credentials for the user. Example:
|
|
54
54
|
* @example
|
|
55
55
|
[
|
|
@@ -264,13 +264,7 @@ interface IUsersResponse {
|
|
|
264
264
|
}
|
|
265
265
|
]
|
|
266
266
|
* @property {string} formIdentifier - Marker of the form. Example: "form_12345".
|
|
267
|
-
* @property {string}
|
|
268
|
-
* @property {Array<string | number>} groups - User groups.
|
|
269
|
-
* @example
|
|
270
|
-
[
|
|
271
|
-
"group_1",
|
|
272
|
-
"group_2"
|
|
273
|
-
]
|
|
267
|
+
* @property {Array<string | number>} groups - IDs of the user groups the user belongs to (numbers on the API). Example: [1].
|
|
274
268
|
* @property {object} state - Custom key-value data stored with the user.
|
|
275
269
|
* @example
|
|
276
270
|
{
|
|
@@ -288,7 +282,6 @@ interface IUserEntity {
|
|
|
288
282
|
formData: FormDataType[];
|
|
289
283
|
formIdentifier: string;
|
|
290
284
|
/** @deprecated Service counter leaking into the response, always `"1"`; the field may disappear. */
|
|
291
|
-
total?: string;
|
|
292
285
|
groups: Array<string | number>;
|
|
293
286
|
state: Record<string, unknown>;
|
|
294
287
|
moduleFormConfigs?: Array<IFormConfig>;
|
|
@@ -8,11 +8,12 @@ import type { Socket } from 'socket.io-client';
|
|
|
8
8
|
* queued and replayed onto the real socket as soon as the chunk resolves, and every later
|
|
9
9
|
* call passes straight through.
|
|
10
10
|
* @param {() => Promise<Socket>} createSocket - Loads Socket.io and creates the socket.
|
|
11
|
-
* @returns {Socket} Stand-in usable
|
|
11
|
+
* @returns {Socket} Stand-in usable like the socket it will become.
|
|
12
12
|
* @description Listener registration is what matters for ordering, and it is safe: the queue is
|
|
13
13
|
* replayed in the same tick the socket is created, before the connection can deliver anything.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Before the chunk arrives: `emitWithAck` returns a Promise settled by the real socket,
|
|
15
|
+
* `hasListeners`/`listeners` answer from the queued listeners, `socket.io.on(…)` and `volatile` are
|
|
16
|
+
* queued, assignments (e.g. `socket.auth = …`) are applied to the real socket, and other properties
|
|
17
|
+
* read `undefined`. A failed chunk load is reported to the `connect_error` listeners.
|
|
17
18
|
*/
|
|
18
|
-
export default function createLazySocket(createSocket: () => Promise<
|
|
19
|
+
export default function createLazySocket<S extends Socket = Socket>(createSocket: () => Promise<S>): S;
|