oneentry 1.0.138 → 1.0.140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +16 -1
  2. package/configure.js +40 -21
  3. package/package.json +15 -12
  4. package/dist/admins/adminsApi.d.ts +0 -50
  5. package/dist/admins/adminsApi.js +0 -65
  6. package/dist/admins/adminsInterfaces.d.ts +0 -99
  7. package/dist/admins/adminsInterfaces.js +0 -2
  8. package/dist/admins/adminsSchemas.d.ts +0 -30
  9. package/dist/admins/adminsSchemas.js +0 -27
  10. package/dist/attribute-sets/attributeSetsApi.d.ts +0 -63
  11. package/dist/attribute-sets/attributeSetsApi.js +0 -98
  12. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -187
  13. package/dist/attribute-sets/attributeSetsInterfaces.js +0 -2
  14. package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -90
  15. package/dist/attribute-sets/attributeSetsSchemas.js +0 -74
  16. package/dist/auth-provider/authProviderApi.d.ts +0 -249
  17. package/dist/auth-provider/authProviderApi.js +0 -351
  18. package/dist/auth-provider/authProviderSchemas.d.ts +0 -137
  19. package/dist/auth-provider/authProviderSchemas.js +0 -85
  20. package/dist/auth-provider/authProvidersInterfaces.d.ts +0 -417
  21. package/dist/auth-provider/authProvidersInterfaces.js +0 -2
  22. package/dist/base/asyncModules.d.ts +0 -80
  23. package/dist/base/asyncModules.js +0 -440
  24. package/dist/base/result.d.ts +0 -39
  25. package/dist/base/result.js +0 -154
  26. package/dist/base/stateModule.d.ts +0 -41
  27. package/dist/base/stateModule.js +0 -128
  28. package/dist/base/syncModules.d.ts +0 -148
  29. package/dist/base/syncModules.js +0 -530
  30. package/dist/base/utils.d.ts +0 -197
  31. package/dist/base/utils.js +0 -2
  32. package/dist/base/validation.d.ts +0 -118
  33. package/dist/base/validation.js +0 -132
  34. package/dist/blocks/blocksApi.d.ts +0 -74
  35. package/dist/blocks/blocksApi.js +0 -184
  36. package/dist/blocks/blocksInterfaces.d.ts +0 -173
  37. package/dist/blocks/blocksInterfaces.js +0 -2
  38. package/dist/blocks/blocksSchemas.d.ts +0 -187
  39. package/dist/blocks/blocksSchemas.js +0 -43
  40. package/dist/events/eventsApi.d.ts +0 -60
  41. package/dist/events/eventsApi.js +0 -97
  42. package/dist/events/eventsInterfaces.d.ts +0 -87
  43. package/dist/events/eventsInterfaces.js +0 -2
  44. package/dist/file-uploading/fileUploadingApi.d.ts +0 -88
  45. package/dist/file-uploading/fileUploadingApi.js +0 -132
  46. package/dist/file-uploading/fileUploadingInterfaces.d.ts +0 -117
  47. package/dist/file-uploading/fileUploadingInterfaces.js +0 -2
  48. package/dist/file-uploading/fileUploadingSchemas.d.ts +0 -22
  49. package/dist/file-uploading/fileUploadingSchemas.js +0 -21
  50. package/dist/forms/formsApi.d.ts +0 -42
  51. package/dist/forms/formsApi.js +0 -57
  52. package/dist/forms/formsInterfaces.d.ts +0 -132
  53. package/dist/forms/formsInterfaces.js +0 -2
  54. package/dist/forms/formsSchemas.d.ts +0 -65
  55. package/dist/forms/formsSchemas.js +0 -36
  56. package/dist/forms-data/formsDataApi.d.ts +0 -106
  57. package/dist/forms-data/formsDataApi.js +0 -189
  58. package/dist/forms-data/formsDataInterfaces.d.ts +0 -525
  59. package/dist/forms-data/formsDataInterfaces.js +0 -2
  60. package/dist/forms-data/formsDataSchemas.d.ts +0 -115
  61. package/dist/forms-data/formsDataSchemas.js +0 -86
  62. package/dist/general-types/generalTypesApi.d.ts +0 -28
  63. package/dist/general-types/generalTypesApi.js +0 -38
  64. package/dist/general-types/generalTypesInterfaces.d.ts +0 -30
  65. package/dist/general-types/generalTypesInterfaces.js +0 -2
  66. package/dist/general-types/generalTypesSchemas.d.ts +0 -50
  67. package/dist/general-types/generalTypesSchemas.js +0 -35
  68. package/dist/index.d.ts +0 -94
  69. package/dist/index.js +0 -97
  70. package/dist/integration-collections/integrationCollectionsApi.d.ts +0 -173
  71. package/dist/integration-collections/integrationCollectionsApi.js +0 -220
  72. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +0 -313
  73. package/dist/integration-collections/integrationCollectionsInterfaces.js +0 -2
  74. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -84
  75. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -63
  76. package/dist/locales/localesApi.d.ts +0 -27
  77. package/dist/locales/localesApi.js +0 -37
  78. package/dist/locales/localesInterfaces.d.ts +0 -41
  79. package/dist/locales/localesInterfaces.js +0 -2
  80. package/dist/locales/localesSchemas.d.ts +0 -32
  81. package/dist/locales/localesSchemas.js +0 -26
  82. package/dist/menus/menusApi.d.ts +0 -29
  83. package/dist/menus/menusApi.js +0 -39
  84. package/dist/menus/menusInterfaces.d.ts +0 -88
  85. package/dist/menus/menusInterfaces.js +0 -4
  86. package/dist/menus/menusSchemas.d.ts +0 -16
  87. package/dist/menus/menusSchemas.js +0 -28
  88. package/dist/orders/ordersApi.d.ts +0 -126
  89. package/dist/orders/ordersApi.js +0 -169
  90. package/dist/orders/ordersInterfaces.d.ts +0 -427
  91. package/dist/orders/ordersInterfaces.js +0 -2
  92. package/dist/orders/ordersSchemas.d.ts +0 -158
  93. package/dist/orders/ordersSchemas.js +0 -120
  94. package/dist/pages/pagesApi.d.ts +0 -151
  95. package/dist/pages/pagesApi.js +0 -390
  96. package/dist/pages/pagesInterfaces.d.ts +0 -292
  97. package/dist/pages/pagesInterfaces.js +0 -2
  98. package/dist/pages/pagesSchemas.d.ts +0 -85
  99. package/dist/pages/pagesSchemas.js +0 -46
  100. package/dist/payments/paymentsApi.d.ts +0 -82
  101. package/dist/payments/paymentsApi.js +0 -121
  102. package/dist/payments/paymentsInterfaces.d.ts +0 -206
  103. package/dist/payments/paymentsInterfaces.js +0 -2
  104. package/dist/payments/paymentsSchemas.d.ts +0 -137
  105. package/dist/payments/paymentsSchemas.js +0 -78
  106. package/dist/product-statuses/productStatusesApi.d.ts +0 -47
  107. package/dist/product-statuses/productStatusesApi.js +0 -70
  108. package/dist/product-statuses/productStatusesInterfaces.d.ts +0 -66
  109. package/dist/product-statuses/productStatusesInterfaces.js +0 -2
  110. package/dist/product-statuses/productStatusesSchemas.d.ts +0 -34
  111. package/dist/product-statuses/productStatusesSchemas.js +0 -30
  112. package/dist/products/productsApi.d.ts +0 -365
  113. package/dist/products/productsApi.js +0 -464
  114. package/dist/products/productsInterfaces.d.ts +0 -583
  115. package/dist/products/productsInterfaces.js +0 -2
  116. package/dist/products/productsSchemas.d.ts +0 -212
  117. package/dist/products/productsSchemas.js +0 -85
  118. package/dist/system/systemApi.d.ts +0 -65
  119. package/dist/system/systemApi.js +0 -82
  120. package/dist/system/systemInterfaces.d.ts +0 -23
  121. package/dist/system/systemInterfaces.js +0 -2
  122. package/dist/templates/templatesApi.d.ts +0 -49
  123. package/dist/templates/templatesApi.js +0 -75
  124. package/dist/templates/templatesInterfaces.d.ts +0 -70
  125. package/dist/templates/templatesInterfaces.js +0 -2
  126. package/dist/templates/templatesSchemas.d.ts +0 -48
  127. package/dist/templates/templatesSchemas.js +0 -31
  128. package/dist/templates-preview/templatesPreviewApi.d.ts +0 -38
  129. package/dist/templates-preview/templatesPreviewApi.js +0 -53
  130. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -121
  131. package/dist/templates-preview/templatesPreviewInterfaces.js +0 -2
  132. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -83
  133. package/dist/templates-preview/templatesPreviewSchemas.js +0 -48
  134. package/dist/users/usersApi.d.ts +0 -143
  135. package/dist/users/usersApi.js +0 -174
  136. package/dist/users/usersInterfaces.d.ts +0 -235
  137. package/dist/users/usersInterfaces.js +0 -2
  138. package/dist/users/usersSchemas.d.ts +0 -38
  139. package/dist/users/usersSchemas.js +0 -28
  140. package/dist/web-socket/wsApi.d.ts +0 -25
  141. package/dist/web-socket/wsApi.js +0 -45
  142. package/dist/web-socket/wsInterfaces.d.ts +0 -17
  143. package/dist/web-socket/wsInterfaces.js +0 -2
@@ -1,184 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
- const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
- const blocksSchemas_1 = require("./blocksSchemas");
9
- /**
10
- * Controllers for working with blocks.
11
- * @handle /api/content/blocks
12
- * @class BlocksApi
13
- * @augments AsyncModules
14
- * @implements {IBlocks}
15
- * @description This class provides methods to interact with blocks.
16
- */
17
- class BlocksApi extends asyncModules_1.default {
18
- /**
19
- * Constructor for BlocksApi class.
20
- */
21
- constructor(state) {
22
- super(state);
23
- this._url = state.url + '/api/content/blocks';
24
- }
25
- /**
26
- * Get blocks by parameters.
27
- * @handleName getBlocks
28
- * @param {BlockType} type - Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". Example: 'product'.
29
- * @param {string} [langCode] - Language code. Default: "en_US".
30
- * @param {number} [offset] - Parameter for pagination. Default: 0.
31
- * @param {number} [limit] - Parameter for pagination. Default: 30.
32
- * @returns {Promise<IBlocksResponse | IError>} Returns BlocksEntity object.
33
- * @throws {IError} When isShell=false and an error occurs during the fetch
34
- */
35
- async getBlocks(type = '', langCode = this.state.lang, offset = 0, limit = 30) {
36
- const response = await this._fetchPost(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
37
- // Validate response if validation is enabled
38
- const validated = this._validateResponse(response, blocksSchemas_1.BlocksResponseSchema);
39
- if (!this.state.traficLimit) {
40
- const normalizeResponse = this._normalizeData(validated);
41
- await Promise.all(normalizeResponse.items.map(async (block) => {
42
- const customSettings = block.customSettings;
43
- if (customSettings &&
44
- Object.prototype.hasOwnProperty.call(customSettings, 'productConfig')) {
45
- if (customSettings.productConfig.countElementsPerRow)
46
- block.countElementsPerRow =
47
- +customSettings.productConfig.countElementsPerRow;
48
- if (customSettings.productConfig.quantity)
49
- block.quantity = +customSettings.productConfig.quantity;
50
- }
51
- delete block.customSettings;
52
- delete block.attributesSetIdentifier;
53
- delete block.productPageUrls;
54
- if (block.type === 'similar_products_block') {
55
- try {
56
- await this.getSimilarProducts(block.identifier, langCode, offset, limit).then((result) => {
57
- block.similarProducts = result;
58
- });
59
- }
60
- catch {
61
- block.similarProducts = [];
62
- }
63
- }
64
- else if (block.type === 'product_block') {
65
- try {
66
- await this.getProductsByBlockMarker(block.identifier, langCode, offset, limit).then((result) => {
67
- block.products = result;
68
- });
69
- }
70
- catch {
71
- block.products = [];
72
- }
73
- }
74
- }));
75
- return this._normalizeData(normalizeResponse);
76
- }
77
- return this._normalizeData(validated);
78
- }
79
- /**
80
- * Get block by marker.
81
- * @handleName getBlockByMarker
82
- * @param {string} marker - Marker of Block. Example: "product_block".
83
- * @param {string} [langCode] - Language code. Default: "en_US".
84
- * @param {number} [offset] - Parameter for pagination. Default: 0.
85
- * @param {number} [limit] - Parameter for pagination. Default: 30.
86
- * @returns {Promise<IBlockEntity | IError>} - Returns a BlockEntity object.
87
- * @throws {IError} When isShell=false and an error occurs during the fetch
88
- * @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
89
- */
90
- async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
91
- const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
92
- // Validate response if validation is enabled
93
- const validated = this._validateResponse(response, blocksSchemas_1.BlockEntitySchema);
94
- const normalizeResponse = this._normalizeData(validated);
95
- const customSettings = normalizeResponse.customSettings;
96
- if (customSettings &&
97
- Object.prototype.hasOwnProperty.call(customSettings, 'productConfig')) {
98
- if (customSettings.productConfig.countElementsPerRow)
99
- normalizeResponse.countElementsPerRow =
100
- +customSettings.productConfig.countElementsPerRow;
101
- if (customSettings.productConfig.quantity)
102
- normalizeResponse.quantity = +customSettings.productConfig.quantity;
103
- }
104
- delete normalizeResponse.customSettings;
105
- delete normalizeResponse.attributesSetIdentifier;
106
- delete normalizeResponse.productPageUrls;
107
- if (!this.state.traficLimit) {
108
- if (normalizeResponse.type === 'similar_products_block') {
109
- try {
110
- await this.getSimilarProducts(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
111
- normalizeResponse.similarProducts = result;
112
- });
113
- }
114
- catch {
115
- normalizeResponse.similarProducts = [];
116
- }
117
- }
118
- else if (normalizeResponse.type === 'product_block') {
119
- try {
120
- await this.getProductsByBlockMarker(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
121
- normalizeResponse.products = result;
122
- });
123
- }
124
- catch {
125
- normalizeResponse.products = [];
126
- }
127
- }
128
- }
129
- return this._normalizeData(normalizeResponse);
130
- }
131
- /**
132
- * Get similar products by block marker.
133
- * @handleName getSimilarProducts
134
- * @param {string} marker - Block identifier. Example: "similar_products_block".
135
- * @param {string} [langCode] - Language code. Default: "en_US".
136
- * @param {number} [offset] - Parameter for pagination. Default: 0.
137
- * @param {number} [limit] - Parameter for pagination. Default: 30.
138
- * @returns {Promise<IProductsResponse | IError>} - Returns the total count and an array of product items in object by specified block marker.
139
- * @throws {IError} When isShell=false and an error occurs during the fetch
140
- */
141
- async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
142
- const query = {
143
- langCode,
144
- offset,
145
- limit,
146
- };
147
- const result = await this._fetchGet(`/${marker}/similar-products?` + this._queryParamsToString(query));
148
- return this._normalizeData(result);
149
- }
150
- /**
151
- * Get products by block marker.
152
- * @handleName getProductsByBlockMarker
153
- * @param {string} marker - Block identifier. Example: "product_block".
154
- * @param {string} [langCode] - Language code. Default: "en_US".
155
- * @param {number} [offset] - Parameter for pagination. Default: 0.
156
- * @param {number} [limit] - Parameter for pagination. Default: 30.
157
- * @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
158
- * @throws {IError} When isShell=false and an error occurs during the fetch
159
- */
160
- async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
161
- const query = {
162
- langCode,
163
- offset,
164
- limit,
165
- };
166
- const result = await this._fetchGet(`/${marker}/products?` + this._queryParamsToString(query));
167
- return this._normalizeData(result.items);
168
- }
169
- /**
170
- * Quick search for block objects with limited output.
171
- * @handleName searchBlock
172
- * @param {string} name - Search string. Example: "product_block".
173
- * @param {string} [langCode] - Language code. Default: "en_US".
174
- * @returns {Promise<ISearchBlock[] | IError>} Returns an array of ISearchBlock objects.
175
- * @throws {IError} When isShell=false and an error occurs during the fetch
176
- */
177
- async searchBlock(name, langCode = this.state.lang) {
178
- const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
179
- // Validate response if validation is enabled
180
- const validated = this._validateResponse(result, blocksSchemas_1.SearchBlocksResponseSchema);
181
- return validated;
182
- }
183
- }
184
- exports.default = BlocksApi;
@@ -1,173 +0,0 @@
1
- import type { AttributeType, IError, ILocalizeInfo } from '../base/utils';
2
- import type { IProductsEntity, IProductsResponse } from '../products/productsInterfaces';
3
- /**
4
- * Interface for managing and retrieving blocks in the system.
5
- * @interface IBlocks
6
- * @property {Function} getBlocks - Get all Blocks objects.
7
- * @property {Function} getBlockByMarker - Get Block object by marker.
8
- * @property {Function} getSimilarProducts - Get Array of similar products from product-similar block.
9
- * @property {Function} getProductsByBlockMarker - Get Array of products from product block.
10
- * @property {Function} searchBlock - Quick search for block objects with limited output.
11
- * @description This interface defines methods for retrieving and managing blocks in the system.
12
- */
13
- interface IBlocks {
14
- /**
15
- * Retrieves all block objects of a specific type.
16
- * @handleName getBlocks
17
- * @param {BlockType} type - The type of blocks to retrieve. Example: "product".
18
- * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
19
- * @param {number} [offset] - Optional offset for pagination. Default: 0.
20
- * @param {number} [limit] - Optional limit for pagination. Default: 30.
21
- * @returns {IBlocksResponse} A promise that resolves to a blocks response or an error.
22
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
23
- * @description This method retrieves all block objects of a specific type.
24
- */
25
- getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
26
- /**
27
- * Retrieves a block object by its marker.
28
- * @handleName getBlockByMarker
29
- * @param {string} marker - The marker identifying the block. Example: "product_block".
30
- * @param {string} langCode - Language code for localization. Default: "en_US".
31
- * @param {number} [offset] - Optional offset for pagination. Default: 0.
32
- * @param {number} [limit] - Optional limit for pagination. Default: 30.
33
- * @returns {IBlockEntity} A promise that resolves to a block entity or an error.
34
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
35
- * @description This method retrieves a block object by its marker.
36
- */
37
- getBlockByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
38
- /**
39
- * Performs a quick search for block objects with limited output.
40
- * @handleName searchBlock
41
- * @param {string} name - The name to search for. Example: "product_block".
42
- * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
43
- * @returns {ISearchBlock[]} A promise that resolves to an array of search blocks or an error.
44
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
45
- * @description This method performs a quick search for block objects with limited output.
46
- */
47
- searchBlock(name: string, langCode?: string): Promise<ISearchBlock[] | IError>;
48
- }
49
- /**
50
- * Represents a response from the blocks API.
51
- * @interface IBlocksResponse
52
- * @property {number} total - Total number of found records. Example: 100.
53
- * @property {IBlockEntity[]} items - Array of block entities.
54
- * @example
55
- [
56
- {
57
- "attributeValues": [],
58
- "id": 1,
59
- "identifier": "block1",
60
- "isVisible": true,
61
- "localizeInfos": { "key": "value" },
62
- "position": 1,
63
- "templateIdentifier": null,
64
- "type": "product",
65
- "version": 1,
66
- "countElementsPerRow": 3,
67
- "quantity": 9,
68
- "similarProducts": {
69
- "total": 0,
70
- "items": []
71
- },
72
- "products": [
73
- {
74
- "id": 1,
75
- "name": "Product 1"
76
- },
77
- {
78
- "id": 2,
79
- "name": "Product 2"
80
- }
81
- ]
82
- }
83
- ]
84
- * @description Represents a response from the blocks API containing a total count and an array of block entities.
85
- */
86
- interface IBlocksResponse {
87
- items: IBlockEntity[];
88
- total: number;
89
- }
90
- /**
91
- * Represents a block entity with various attributes and properties.
92
- * @interface IBlockEntity
93
- * @property {AttributeType} attributeValues - Type of attributes used in the block.
94
- * @example
95
- {
96
- "block-text": {
97
- "type": "string",
98
- "value": "some text",
99
- "isIcon": false,
100
- "position": 0,
101
- "additionalFields": [],
102
- "isProductPreview": false
103
- }
104
- }
105
- * @property {number} id - Unique identifier of the block. Example: 1234.
106
- * @property {ILocalizeInfo} localizeInfos - Localization information for the block.
107
- * @example
108
- {
109
- "key": "value"
110
- }
111
- * @property {number} version - Version of the block entity. Example: 1.
112
- * @property {string} identifier - Unique string identifier for the block. Example: "block1".
113
- * @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: "product".
114
- * @property {number} position - Position of the block for sorting. Example: 1.
115
- * @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: "template1".
116
- * @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
117
- * @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
118
- * @property {number} [quantity] - Quantity of items in the block, if applicable. Example: 5.
119
- * @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block.
120
- * @example
121
- {
122
- "total": 10,
123
- "items": []
124
- }
125
- * @property {IProductsEntity[]} [products] - Array of product entities associated with the block.
126
- * @example
127
- [
128
- {
129
- "id": 1,
130
- "name": "Product 1"
131
- },
132
- {
133
- "id": 2,
134
- "name": "Product 2"
135
- }
136
- ]
137
- * @description Represents a block entity with various attributes and properties.
138
- */
139
- interface IBlockEntity {
140
- id: number;
141
- localizeInfos: ILocalizeInfo;
142
- version: number;
143
- position: number;
144
- identifier: string;
145
- type: string;
146
- templateIdentifier: string | null;
147
- isVisible: boolean;
148
- attributeValues: AttributeType;
149
- similarProducts?: IProductsResponse;
150
- countElementsPerRow?: number;
151
- quantity?: number;
152
- products?: IProductsEntity[];
153
- }
154
- /**
155
- * Represents a search block entity with an identifier, name, and ID.
156
- * @interface ISearchBlock
157
- * @property {number} id - Unique identifier of the search block. Example: 1.
158
- * @property {string} identifier - Unique string identifier for the search block. Example: "search_block_1".
159
- * @property {string} name - Name of the search block. Example: "Search Block 1".
160
- * @description Represents a search block entity with an identifier, name, and ID.
161
- */
162
- interface ISearchBlock {
163
- id: number;
164
- identifier: string;
165
- name: string;
166
- }
167
- /**
168
- * BlockType
169
- * @type {BlockType}
170
- * @description This type defines the possible values for block types used in the system.
171
- */
172
- type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount' | 'none';
173
- export type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,187 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Block entity schema
4
- * Includes all fields returned by the API
5
- */
6
- export declare const BlockEntitySchema: z.ZodObject<{
7
- id: z.ZodNumber;
8
- localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
9
- version: z.ZodNumber;
10
- position: z.ZodNumber;
11
- identifier: z.ZodString;
12
- type: z.ZodString;
13
- templateIdentifier: z.ZodNullable<z.ZodString>;
14
- isVisible: z.ZodBoolean;
15
- attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
16
- similarProducts: z.ZodOptional<z.ZodObject<{
17
- items: z.ZodArray<z.ZodObject<{
18
- id: z.ZodNumber;
19
- identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
- attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
- localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
22
- statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
23
- isVisible: z.ZodOptional<z.ZodBoolean>;
24
- statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
- position: z.ZodOptional<z.ZodNumber>;
26
- isPositionLocked: z.ZodOptional<z.ZodBoolean>;
27
- templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
- shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
- price: z.ZodNullable<z.ZodNumber>;
30
- additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
31
- sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
- isSync: z.ZodOptional<z.ZodBoolean>;
33
- categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
- attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
35
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
36
- blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
- moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
38
- currency: z.ZodOptional<z.ZodString>;
39
- images: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
- id: z.ZodNumber;
41
- filename: z.ZodString;
42
- url: z.ZodString;
43
- size: z.ZodOptional<z.ZodNumber>;
44
- type: z.ZodOptional<z.ZodString>;
45
- }, z.core.$strip>>>;
46
- relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
47
- pageId: z.ZodOptional<z.ZodNumber>;
48
- }, z.core.$strip>>;
49
- total: z.ZodNumber;
50
- }, z.core.$strip>>;
51
- countElementsPerRow: z.ZodOptional<z.ZodNumber>;
52
- quantity: z.ZodOptional<z.ZodNumber>;
53
- products: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
- id: z.ZodNumber;
55
- identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
56
- attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
57
- localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
58
- statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
59
- isVisible: z.ZodOptional<z.ZodBoolean>;
60
- statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
61
- position: z.ZodOptional<z.ZodNumber>;
62
- isPositionLocked: z.ZodOptional<z.ZodBoolean>;
63
- templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
64
- shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
65
- price: z.ZodNullable<z.ZodNumber>;
66
- additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
67
- sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
- isSync: z.ZodOptional<z.ZodBoolean>;
69
- categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
- attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
71
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
72
- blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
- moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
74
- currency: z.ZodOptional<z.ZodString>;
75
- images: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
- id: z.ZodNumber;
77
- filename: z.ZodString;
78
- url: z.ZodString;
79
- size: z.ZodOptional<z.ZodNumber>;
80
- type: z.ZodOptional<z.ZodString>;
81
- }, z.core.$strip>>>;
82
- relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
83
- pageId: z.ZodOptional<z.ZodNumber>;
84
- }, z.core.$strip>>>;
85
- }, z.core.$strip>;
86
- /**
87
- * Blocks response schema
88
- */
89
- export declare const BlocksResponseSchema: z.ZodObject<{
90
- items: z.ZodArray<z.ZodObject<{
91
- id: z.ZodNumber;
92
- localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
93
- version: z.ZodNumber;
94
- position: z.ZodNumber;
95
- identifier: z.ZodString;
96
- type: z.ZodString;
97
- templateIdentifier: z.ZodNullable<z.ZodString>;
98
- isVisible: z.ZodBoolean;
99
- attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
100
- similarProducts: z.ZodOptional<z.ZodObject<{
101
- items: z.ZodArray<z.ZodObject<{
102
- id: z.ZodNumber;
103
- identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
104
- attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
105
- localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
106
- statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
107
- isVisible: z.ZodOptional<z.ZodBoolean>;
108
- statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
109
- position: z.ZodOptional<z.ZodNumber>;
110
- isPositionLocked: z.ZodOptional<z.ZodBoolean>;
111
- templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
112
- shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
113
- price: z.ZodNullable<z.ZodNumber>;
114
- additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
115
- sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
116
- isSync: z.ZodOptional<z.ZodBoolean>;
117
- categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
- attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
119
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
120
- blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
- moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
122
- currency: z.ZodOptional<z.ZodString>;
123
- images: z.ZodOptional<z.ZodArray<z.ZodObject<{
124
- id: z.ZodNumber;
125
- filename: z.ZodString;
126
- url: z.ZodString;
127
- size: z.ZodOptional<z.ZodNumber>;
128
- type: z.ZodOptional<z.ZodString>;
129
- }, z.core.$strip>>>;
130
- relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
131
- pageId: z.ZodOptional<z.ZodNumber>;
132
- }, z.core.$strip>>;
133
- total: z.ZodNumber;
134
- }, z.core.$strip>>;
135
- countElementsPerRow: z.ZodOptional<z.ZodNumber>;
136
- quantity: z.ZodOptional<z.ZodNumber>;
137
- products: z.ZodOptional<z.ZodArray<z.ZodObject<{
138
- id: z.ZodNumber;
139
- identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
140
- attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
141
- localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
142
- statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
143
- isVisible: z.ZodOptional<z.ZodBoolean>;
144
- statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
145
- position: z.ZodOptional<z.ZodNumber>;
146
- isPositionLocked: z.ZodOptional<z.ZodBoolean>;
147
- templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
148
- shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
149
- price: z.ZodNullable<z.ZodNumber>;
150
- additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
151
- sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
152
- isSync: z.ZodOptional<z.ZodBoolean>;
153
- categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
- attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
155
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
156
- blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
- moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
158
- currency: z.ZodOptional<z.ZodString>;
159
- images: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
- id: z.ZodNumber;
161
- filename: z.ZodString;
162
- url: z.ZodString;
163
- size: z.ZodOptional<z.ZodNumber>;
164
- type: z.ZodOptional<z.ZodString>;
165
- }, z.core.$strip>>>;
166
- relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
167
- pageId: z.ZodOptional<z.ZodNumber>;
168
- }, z.core.$strip>>>;
169
- }, z.core.$strip>>;
170
- total: z.ZodNumber;
171
- }, z.core.$strip>;
172
- /**
173
- * Search block schema
174
- */
175
- export declare const SearchBlockSchema: z.ZodObject<{
176
- id: z.ZodNumber;
177
- identifier: z.ZodString;
178
- name: z.ZodString;
179
- }, z.core.$strip>;
180
- /**
181
- * Search blocks response schema
182
- */
183
- export declare const SearchBlocksResponseSchema: z.ZodArray<z.ZodObject<{
184
- id: z.ZodNumber;
185
- identifier: z.ZodString;
186
- name: z.ZodString;
187
- }, z.core.$strip>>;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SearchBlocksResponseSchema = exports.SearchBlockSchema = exports.BlocksResponseSchema = exports.BlockEntitySchema = void 0;
4
- const zod_1 = require("zod");
5
- const productsSchemas_1 = require("../products/productsSchemas");
6
- /**
7
- * Block entity schema
8
- * Includes all fields returned by the API
9
- */
10
- exports.BlockEntitySchema = zod_1.z.object({
11
- id: zod_1.z.number(),
12
- localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
13
- version: zod_1.z.number(),
14
- position: zod_1.z.number(),
15
- identifier: zod_1.z.string(),
16
- type: zod_1.z.string(),
17
- templateIdentifier: zod_1.z.string().nullable(),
18
- isVisible: zod_1.z.boolean(),
19
- attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
20
- similarProducts: productsSchemas_1.ProductsResponseSchema.optional(),
21
- countElementsPerRow: zod_1.z.number().optional(),
22
- quantity: zod_1.z.number().optional(),
23
- products: zod_1.z.array(productsSchemas_1.ProductEntitySchema).optional(),
24
- });
25
- /**
26
- * Blocks response schema
27
- */
28
- exports.BlocksResponseSchema = zod_1.z.object({
29
- items: zod_1.z.array(exports.BlockEntitySchema),
30
- total: zod_1.z.number(),
31
- });
32
- /**
33
- * Search block schema
34
- */
35
- exports.SearchBlockSchema = zod_1.z.object({
36
- id: zod_1.z.number(),
37
- identifier: zod_1.z.string(),
38
- name: zod_1.z.string(),
39
- });
40
- /**
41
- * Search blocks response schema
42
- */
43
- exports.SearchBlocksResponseSchema = zod_1.z.array(exports.SearchBlockSchema);
@@ -1,60 +0,0 @@
1
- import AsyncModules from '../base/asyncModules';
2
- import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
4
- import type { IEvents, ISubscriptions } from './eventsInterfaces';
5
- /**
6
- * Controllers for working with events
7
- * @handle /api/content/events
8
- * @class EventsApi
9
- * @augments AsyncModules
10
- * @implements {IEvents}
11
- * @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
12
- */
13
- export default class EventsApi extends AsyncModules implements IEvents {
14
- protected state: StateModule;
15
- protected _url: string;
16
- /**
17
- * Initializes the EventsApi with the provided state module.
18
- * @class EventsApi
19
- * @augments AsyncModules
20
- * @implements {IEvents}
21
- * @param {StateModule} state - The state module containing the base URL and other configurations.
22
- * @description Initializes the EventsApi with the provided state module.
23
- */
24
- constructor(state: StateModule);
25
- /**
26
- * Return all subscriptions to product.
27
- * @handleName getAllSubscriptions
28
- * @param {number} [offset] - Optional offset for pagination. Default: 0.
29
- * @param {number} [limit] - Optional limit for pagination. Default: 30.
30
- * @returns {Promise<ISubscriptions | IError>} Returns an object containing all subscriptions or an error object if there was an issue.
31
- * @throws {IError} When isShell=false and an error occurs during the fetch
32
- * @description This method requires user authorization.
33
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
34
- */
35
- getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
36
- /**
37
- * Subscribing to an event on a product.
38
- * @handleName subscribeByMarker
39
- * @param {string} marker - Event marker. Example: "product_price_change".
40
- * @param {number} productId - Product id. Example: 12345.
41
- * @param {string} [langCode] - Language code. Default: "en_US".=
42
- * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
43
- * @throws {IError} When isShell=false and an error occurs during the fetch
44
- * @description This method requires user authorization.
45
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
46
- */
47
- subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
48
- /**
49
- * Unsubscribing to an event on a product.
50
- * @handleName unsubscribeByMarker
51
- * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
52
- * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
53
- * @param {string} [langCode] - Language code. Default: "en_US".
54
- * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
55
- * @throws {IError} When isShell=false and an error occurs during the fetch
56
- * @description This method requires user authorization.
57
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
58
- */
59
- unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
60
- }