oneentry 1.0.159 → 1.0.161

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 (222) hide show
  1. package/README.md +2 -0
  2. package/changelog.md +56 -1
  3. package/dist/admins/adminsApi.d.ts +15 -1
  4. package/dist/admins/adminsApi.js +29 -0
  5. package/dist/admins/adminsInterfaces.d.ts +37 -1
  6. package/dist/base/lazySchema.d.ts +15 -0
  7. package/dist/base/lazySchema.js +20 -0
  8. package/dist/discounts/discountsApi.d.ts +14 -1
  9. package/dist/discounts/discountsApi.js +21 -0
  10. package/dist/discounts/discountsInterfaces.d.ts +27 -1
  11. package/dist/filters/filtersInterfaces.d.ts +2 -2
  12. package/dist/filters/filtersSchemas.d.ts +1 -1
  13. package/dist/filters/filtersSchemas.js +4 -1
  14. package/dist/forms-data/formsDataApi.d.ts +14 -1
  15. package/dist/forms-data/formsDataApi.js +21 -0
  16. package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
  17. package/dist/index.d.ts +4 -0
  18. package/dist/index.js +3 -0
  19. package/dist/orders/ordersApi.d.ts +15 -1
  20. package/dist/orders/ordersApi.js +22 -0
  21. package/dist/orders/ordersInterfaces.d.ts +27 -1
  22. package/dist/pages/pagesApi.d.ts +14 -1
  23. package/dist/pages/pagesApi.js +21 -0
  24. package/dist/pages/pagesInterfaces.d.ts +38 -1
  25. package/dist/payments/paymentsInterfaces.d.ts +2 -2
  26. package/dist/products/productsInterfaces.d.ts +1 -1
  27. package/dist/search/searchApi.d.ts +35 -0
  28. package/dist/search/searchApi.js +86 -0
  29. package/dist/search/searchInterfaces.d.ts +94 -0
  30. package/dist/search/searchInterfaces.js +2 -0
  31. package/dist/search/searchSchemas.d.ts +73 -0
  32. package/dist/search/searchSchemas.js +44 -0
  33. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
  34. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
  35. package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
  36. package/dist/types.d.ts +35 -0
  37. package/dist/types.js +2 -0
  38. package/dist/users/usersApi.d.ts +15 -1
  39. package/dist/users/usersApi.js +22 -0
  40. package/dist/users/usersInterfaces.d.ts +39 -1
  41. package/dist/web-socket/lazySocket.d.ts +18 -0
  42. package/dist/web-socket/lazySocket.js +70 -0
  43. package/esm/admins/adminsApi.d.ts +66 -0
  44. package/esm/admins/adminsApi.js +90 -0
  45. package/esm/admins/adminsInterfaces.d.ts +137 -0
  46. package/esm/admins/adminsInterfaces.js +1 -0
  47. package/esm/admins/adminsSchemas.d.ts +48 -0
  48. package/esm/admins/adminsSchemas.js +31 -0
  49. package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
  50. package/esm/attribute-sets/attributeSetsApi.js +97 -0
  51. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
  52. package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
  53. package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
  54. package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
  55. package/esm/auth-provider/authProviderApi.d.ts +262 -0
  56. package/esm/auth-provider/authProviderApi.js +362 -0
  57. package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
  58. package/esm/auth-provider/authProviderSchemas.js +92 -0
  59. package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
  60. package/esm/auth-provider/authProvidersInterfaces.js +1 -0
  61. package/esm/base/asyncModules.d.ts +123 -0
  62. package/esm/base/asyncModules.js +382 -0
  63. package/esm/base/lazySchema.d.ts +15 -0
  64. package/esm/base/lazySchema.js +17 -0
  65. package/esm/base/stateModule.d.ts +35 -0
  66. package/esm/base/stateModule.js +51 -0
  67. package/esm/base/syncModules.d.ts +245 -0
  68. package/esm/base/syncModules.js +555 -0
  69. package/esm/base/timeIntervals.d.ts +95 -0
  70. package/esm/base/timeIntervals.js +317 -0
  71. package/esm/base/utils.d.ts +354 -0
  72. package/esm/base/utils.js +1 -0
  73. package/esm/base/validation.d.ts +98 -0
  74. package/esm/base/validation.js +118 -0
  75. package/esm/blocks/blocksApi.d.ts +252 -0
  76. package/esm/blocks/blocksApi.js +394 -0
  77. package/esm/blocks/blocksInterfaces.d.ts +361 -0
  78. package/esm/blocks/blocksInterfaces.js +1 -0
  79. package/esm/blocks/blocksSchemas.d.ts +213 -0
  80. package/esm/blocks/blocksSchemas.js +40 -0
  81. package/esm/discounts/discountsApi.d.ts +94 -0
  82. package/esm/discounts/discountsApi.js +136 -0
  83. package/esm/discounts/discountsInterfaces.d.ts +293 -0
  84. package/esm/discounts/discountsInterfaces.js +1 -0
  85. package/esm/events/eventsApi.d.ts +108 -0
  86. package/esm/events/eventsApi.js +141 -0
  87. package/esm/events/eventsInterfaces.d.ts +176 -0
  88. package/esm/events/eventsInterfaces.js +1 -0
  89. package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
  90. package/esm/file-uploading/fileUploadingApi.js +127 -0
  91. package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
  92. package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
  93. package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
  94. package/esm/file-uploading/fileUploadingSchemas.js +19 -0
  95. package/esm/filters/filtersApi.d.ts +32 -0
  96. package/esm/filters/filtersApi.js +36 -0
  97. package/esm/filters/filtersInterfaces.d.ts +56 -0
  98. package/esm/filters/filtersInterfaces.js +1 -0
  99. package/esm/filters/filtersSchemas.d.ts +32 -0
  100. package/esm/filters/filtersSchemas.js +29 -0
  101. package/esm/forms/formsApi.d.ts +44 -0
  102. package/esm/forms/formsApi.js +54 -0
  103. package/esm/forms/formsInterfaces.d.ts +237 -0
  104. package/esm/forms/formsInterfaces.js +1 -0
  105. package/esm/forms/formsSchemas.d.ts +56 -0
  106. package/esm/forms/formsSchemas.js +32 -0
  107. package/esm/forms-data/formsDataApi.d.ts +124 -0
  108. package/esm/forms-data/formsDataApi.js +210 -0
  109. package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
  110. package/esm/forms-data/formsDataInterfaces.js +1 -0
  111. package/esm/forms-data/formsDataSchemas.d.ts +107 -0
  112. package/esm/forms-data/formsDataSchemas.js +83 -0
  113. package/esm/general-types/generalTypesApi.d.ts +29 -0
  114. package/esm/general-types/generalTypesApi.js +34 -0
  115. package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
  116. package/esm/general-types/generalTypesInterfaces.js +1 -0
  117. package/esm/general-types/generalTypesSchemas.d.ts +68 -0
  118. package/esm/general-types/generalTypesSchemas.js +42 -0
  119. package/esm/index.d.ts +143 -0
  120. package/esm/index.js +124 -0
  121. package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
  122. package/esm/integration-collections/integrationCollectionsApi.js +224 -0
  123. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
  124. package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
  125. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
  126. package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
  127. package/esm/locales/localesApi.d.ts +28 -0
  128. package/esm/locales/localesApi.js +33 -0
  129. package/esm/locales/localesInterfaces.d.ts +40 -0
  130. package/esm/locales/localesInterfaces.js +1 -0
  131. package/esm/locales/localesSchemas.d.ts +32 -0
  132. package/esm/locales/localesSchemas.js +23 -0
  133. package/esm/menus/menusApi.d.ts +30 -0
  134. package/esm/menus/menusApi.js +35 -0
  135. package/esm/menus/menusInterfaces.d.ts +87 -0
  136. package/esm/menus/menusInterfaces.js +2 -0
  137. package/esm/menus/menusSchemas.d.ts +16 -0
  138. package/esm/menus/menusSchemas.js +25 -0
  139. package/esm/orders/ordersApi.d.ts +213 -0
  140. package/esm/orders/ordersApi.js +288 -0
  141. package/esm/orders/ordersInterfaces.d.ts +763 -0
  142. package/esm/orders/ordersInterfaces.js +1 -0
  143. package/esm/orders/ordersSchemas.d.ts +312 -0
  144. package/esm/orders/ordersSchemas.js +171 -0
  145. package/esm/package.json +4 -0
  146. package/esm/pages/pagesApi.d.ts +173 -0
  147. package/esm/pages/pagesApi.js +414 -0
  148. package/esm/pages/pagesInterfaces.d.ts +344 -0
  149. package/esm/pages/pagesInterfaces.js +1 -0
  150. package/esm/pages/pagesSchemas.d.ts +121 -0
  151. package/esm/pages/pagesSchemas.js +60 -0
  152. package/esm/payments/paymentsApi.d.ts +88 -0
  153. package/esm/payments/paymentsApi.js +122 -0
  154. package/esm/payments/paymentsInterfaces.d.ts +189 -0
  155. package/esm/payments/paymentsInterfaces.js +1 -0
  156. package/esm/payments/paymentsSchemas.d.ts +94 -0
  157. package/esm/payments/paymentsSchemas.js +53 -0
  158. package/esm/product-statuses/productStatusesApi.d.ts +50 -0
  159. package/esm/product-statuses/productStatusesApi.js +68 -0
  160. package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
  161. package/esm/product-statuses/productStatusesInterfaces.js +1 -0
  162. package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
  163. package/esm/product-statuses/productStatusesSchemas.js +27 -0
  164. package/esm/products/productsApi.d.ts +366 -0
  165. package/esm/products/productsApi.js +468 -0
  166. package/esm/products/productsInterfaces.d.ts +723 -0
  167. package/esm/products/productsInterfaces.js +1 -0
  168. package/esm/products/productsSchemas.d.ts +234 -0
  169. package/esm/products/productsSchemas.js +121 -0
  170. package/esm/search/searchApi.d.ts +35 -0
  171. package/esm/search/searchApi.js +47 -0
  172. package/esm/search/searchInterfaces.d.ts +94 -0
  173. package/esm/search/searchInterfaces.js +1 -0
  174. package/esm/search/searchSchemas.d.ts +73 -0
  175. package/esm/search/searchSchemas.js +41 -0
  176. package/esm/sitemap/sitemapApi.d.ts +37 -0
  177. package/esm/sitemap/sitemapApi.js +41 -0
  178. package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
  179. package/esm/sitemap/sitemapInterfaces.js +1 -0
  180. package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
  181. package/esm/subscriptions/subscriptionsApi.js +90 -0
  182. package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
  183. package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
  184. package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
  185. package/esm/subscriptions/subscriptionsSchemas.js +38 -0
  186. package/esm/system/systemApi.d.ts +46 -0
  187. package/esm/system/systemApi.js +53 -0
  188. package/esm/system/systemInterfaces.d.ts +29 -0
  189. package/esm/system/systemInterfaces.js +1 -0
  190. package/esm/templates/templatesApi.d.ts +53 -0
  191. package/esm/templates/templatesApi.js +78 -0
  192. package/esm/templates/templatesInterfaces.d.ts +68 -0
  193. package/esm/templates/templatesInterfaces.js +1 -0
  194. package/esm/templates/templatesSchemas.d.ts +48 -0
  195. package/esm/templates/templatesSchemas.js +28 -0
  196. package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
  197. package/esm/templates-preview/templatesPreviewApi.js +50 -0
  198. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
  199. package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
  200. package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
  201. package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
  202. package/esm/types.d.ts +35 -0
  203. package/esm/types.js +1 -0
  204. package/esm/user-activity/userActivityApi.d.ts +31 -0
  205. package/esm/user-activity/userActivityApi.js +37 -0
  206. package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
  207. package/esm/user-activity/userActivityInterfaces.js +1 -0
  208. package/esm/users/usersApi.d.ts +249 -0
  209. package/esm/users/usersApi.js +312 -0
  210. package/esm/users/usersInterfaces.d.ts +419 -0
  211. package/esm/users/usersInterfaces.js +1 -0
  212. package/esm/users/usersSchemas.d.ts +72 -0
  213. package/esm/users/usersSchemas.js +55 -0
  214. package/esm/web-socket/lazySocket.d.ts +18 -0
  215. package/esm/web-socket/lazySocket.js +67 -0
  216. package/esm/web-socket/wsApi.d.ts +27 -0
  217. package/esm/web-socket/wsApi.js +43 -0
  218. package/esm/web-socket/wsInterfaces.d.ts +16 -0
  219. package/esm/web-socket/wsInterfaces.js +1 -0
  220. package/package.json +47 -2
  221. package/types.d.ts +1 -0
  222. package/types.js +1 -0
@@ -0,0 +1,53 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import type StateModule from '../base/stateModule.js';
3
+ import type { IError } from '../base/utils.js';
4
+ import type { BlockType } from '../blocks/blocksInterfaces.js';
5
+ import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces.js';
6
+ /**
7
+ * Controllers for working with template objects
8
+ * @module TemplateController
9
+ * @handle /api/content/templates
10
+ * @description This module provides a set of controllers for handling operations related to template objects.
11
+ */
12
+ export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
13
+ protected state: StateModule;
14
+ protected _url: string;
15
+ /**
16
+ * Constructor for TemplatesApi class.
17
+ * @param {StateModule} state - The state module instance.
18
+ * @description Initializes the TemplatesApi class with the provided state module instance.
19
+ */
20
+ constructor(state: StateModule);
21
+ /**
22
+ * Get all template objects grouped by types.
23
+ * @handleName getAllTemplates
24
+ * @param {string} [langCode] - Language code. Default: "en_US".
25
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
26
+ * @throws {IError} When isShell=false and an error occurs during the fetch
27
+ * @description This function is designed to fetch organized template objects in groups based on their types.
28
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
29
+ */
30
+ getAllTemplates(langCode?: string): Promise<Record<BlockType, ITemplateEntity[]> | IError>;
31
+ /**
32
+ * Get template objects by type.
33
+ * @handleName getTemplateByType
34
+ * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
35
+ * @param {string} [langCode] - Language code. Default: "en_US".
36
+ * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
37
+ * @throws {IError} When isShell=false and an error occurs during the fetch
38
+ * @description Fetch template objects that belong to a specific type, with an optional filter by language.
39
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
40
+ */
41
+ getTemplateByType(type: BlockType, langCode?: string): Promise<ITemplateEntity[] | IError>;
42
+ /**
43
+ * Get one template object by marker.
44
+ * @handleName getTemplateByMarker
45
+ * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
46
+ * @param {string} [langCode] - Language code. Default: "en_US".
47
+ * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
48
+ * @throws {IError} When isShell=false and an error occurs during the fetch
49
+ * @description Fetch a specific template object based on its unique marker.
50
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
51
+ */
52
+ getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
53
+ }
@@ -0,0 +1,78 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import AsyncModules from '../base/asyncModules.js';
3
+ import createSchemaLoader from '../base/lazySchema.js';
4
+ const schema = createSchemaLoader(() => import('./templatesSchemas.js'));
5
+ /**
6
+ * Controllers for working with template objects
7
+ * @module TemplateController
8
+ * @handle /api/content/templates
9
+ * @description This module provides a set of controllers for handling operations related to template objects.
10
+ */
11
+ export default class TemplatesPreviewApi extends AsyncModules {
12
+ /**
13
+ * Constructor for TemplatesApi class.
14
+ * @param {StateModule} state - The state module instance.
15
+ * @description Initializes the TemplatesApi class with the provided state module instance.
16
+ */
17
+ constructor(state) {
18
+ super(state);
19
+ this._url = state.url + '/api/content/templates';
20
+ }
21
+ /**
22
+ * Get all template objects grouped by types.
23
+ * @handleName getAllTemplates
24
+ * @param {string} [langCode] - Language code. Default: "en_US".
25
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
26
+ * @throws {IError} When isShell=false and an error occurs during the fetch
27
+ * @description This function is designed to fetch organized template objects in groups based on their types.
28
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
29
+ */
30
+ async getAllTemplates(langCode = this.state.lang) {
31
+ const response = await this._fetchGet(`/all?langCode=${langCode}`);
32
+ // Validate response if validation is enabled
33
+ const validated = await this._validateResponse(response, schema('GroupedTemplatesResponseSchema'));
34
+ const result = {};
35
+ if (validated &&
36
+ typeof validated === 'object' &&
37
+ !('statusCode' in validated)) {
38
+ const grouped = validated;
39
+ // eslint-disable-next-line no-restricted-syntax
40
+ for (const item in grouped) {
41
+ result[item] = this._normalizeData(grouped[item], langCode);
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+ /**
47
+ * Get template objects by type.
48
+ * @handleName getTemplateByType
49
+ * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
50
+ * @param {string} [langCode] - Language code. Default: "en_US".
51
+ * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
52
+ * @throws {IError} When isShell=false and an error occurs during the fetch
53
+ * @description Fetch template objects that belong to a specific type, with an optional filter by language.
54
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
55
+ */
56
+ async getTemplateByType(type, langCode = this.state.lang) {
57
+ const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
58
+ // Validate response if validation is enabled
59
+ const validated = await this._validateResponse(result, schema('TemplatesResponseSchema'));
60
+ return this._normalizeData(validated);
61
+ }
62
+ /**
63
+ * Get one template object by marker.
64
+ * @handleName getTemplateByMarker
65
+ * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
66
+ * @param {string} [langCode] - Language code. Default: "en_US".
67
+ * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
68
+ * @throws {IError} When isShell=false and an error occurs during the fetch
69
+ * @description Fetch a specific template object based on its unique marker.
70
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
71
+ */
72
+ async getTemplateByMarker(marker, langCode = this.state.lang) {
73
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
74
+ // Validate response if validation is enabled
75
+ const validated = await this._validateResponse(result, schema('TemplateEntitySchema'));
76
+ return this._normalizeData(validated);
77
+ }
78
+ }
@@ -0,0 +1,68 @@
1
+ import type { IAttributeValues, IError } from '../base/utils.js';
2
+ import type { BlockType } from '../blocks/blocksInterfaces.js';
3
+ /**
4
+ * @interface ITemplatesApi
5
+ * @description This interface defines methods for retrieving templates in the system, including fetching all templates, specific templates by type or ID, and by marker.
6
+ */
7
+ interface ITemplatesApi {
8
+ /**
9
+ * Get all template objects grouped by types.
10
+ * @handleName getAllTemplates
11
+ * @param {string} [langCode] - Language code. Default: "en_US".
12
+ * @returns {Record<BlockType, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
13
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
14
+ * @description This method gets all template objects grouped by types.
15
+ */
16
+ getAllTemplates(langCode?: string): Promise<Record<BlockType, ITemplateEntity[]> | IError>;
17
+ /**
18
+ * Get template objects by type.
19
+ * @handleName getTemplateByType
20
+ * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
21
+ * @param {string} [langCode] - Language code. Default: "en_US".
22
+ * @returns {ITemplateEntity[]} Returns a TemplateEntity object.
23
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
+ * @description This method gets template objects by type.
25
+ */
26
+ getTemplateByType(type: BlockType, langCode: string): Promise<ITemplateEntity[] | IError>;
27
+ /**
28
+ * Get one template object by id.
29
+ * @handleName getTemplateByMarker
30
+ * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
31
+ * @param {string} [langCode] - Language code. Default: "en_US".
32
+ * @returns {ITemplateEntity} Returns a TemplateEntity object
33
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
+ * @description This method gets one template object by id.
35
+ */
36
+ getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
37
+ }
38
+ /**
39
+ * The template entity interface
40
+ * @interface ITemplateEntity
41
+ * @property {number} id - The unique identifier of the position. Example: 12345.
42
+ * @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "attribute_set_1".
43
+ * @property {string} title - The name of the template. Example: "Product Template".
44
+ * @property {number} generalTypeId - General type Entity id. Example: 67890.
45
+ * @property {string} identifier - The textual identifier for the record field. Example: "template_12345".
46
+ * @property {number} version - The version number of the object. Example: 1.
47
+ * @property {BlockType} generalTypeName - General type name. Example: "product".
48
+ * @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
49
+ * @example
50
+ {
51
+ "id": 1,
52
+ "value": "some"
53
+ }
54
+ * @property {number} position - The position of the object. Example: 1.
55
+ * @description This interface defines the structure of a template entity, including its identifiers, attributes, and general type information.
56
+ */
57
+ interface ITemplateEntity {
58
+ id: number;
59
+ attributeSetIdentifier: string | null;
60
+ title: string;
61
+ generalTypeId: number;
62
+ identifier: string;
63
+ version: number;
64
+ generalTypeName: BlockType;
65
+ attributeValues: IAttributeValues;
66
+ position: number;
67
+ }
68
+ export type { ITemplateEntity, ITemplatesApi };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Validation schemas for Templates module
3
+ * @description Zod schemas for validating templates-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Template entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export declare const TemplateEntitySchema: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
13
+ title: z.ZodString;
14
+ generalTypeId: z.ZodNumber;
15
+ identifier: z.ZodString;
16
+ version: z.ZodNumber;
17
+ generalTypeName: z.ZodString;
18
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
19
+ position: z.ZodNumber;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Templates response schema (array of templates)
23
+ */
24
+ export declare const TemplatesResponseSchema: z.ZodArray<z.ZodObject<{
25
+ id: z.ZodNumber;
26
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
27
+ title: z.ZodString;
28
+ generalTypeId: z.ZodNumber;
29
+ identifier: z.ZodString;
30
+ version: z.ZodNumber;
31
+ generalTypeName: z.ZodString;
32
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
33
+ position: z.ZodNumber;
34
+ }, z.core.$strip>>;
35
+ /**
36
+ * Grouped templates response schema (by type)
37
+ */
38
+ export declare const GroupedTemplatesResponseSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
39
+ id: z.ZodNumber;
40
+ attributeSetIdentifier: z.ZodNullable<z.ZodString>;
41
+ title: z.ZodString;
42
+ generalTypeId: z.ZodNumber;
43
+ identifier: z.ZodString;
44
+ version: z.ZodNumber;
45
+ generalTypeName: z.ZodString;
46
+ attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
47
+ position: z.ZodNumber;
48
+ }, z.core.$strip>>>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Validation schemas for Templates module
3
+ * @description Zod schemas for validating templates-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Template entity schema
8
+ * Includes all fields returned by the API
9
+ */
10
+ export const TemplateEntitySchema = z.object({
11
+ id: z.number(),
12
+ attributeSetIdentifier: z.string().nullable(),
13
+ title: z.string(),
14
+ generalTypeId: z.number(),
15
+ identifier: z.string(),
16
+ version: z.number(),
17
+ generalTypeName: z.string(),
18
+ attributeValues: z.record(z.string(), z.any()),
19
+ position: z.number(),
20
+ });
21
+ /**
22
+ * Templates response schema (array of templates)
23
+ */
24
+ export const TemplatesResponseSchema = z.array(TemplateEntitySchema);
25
+ /**
26
+ * Grouped templates response schema (by type)
27
+ */
28
+ export const GroupedTemplatesResponseSchema = z.record(z.string(), z.array(TemplateEntitySchema));
@@ -0,0 +1,40 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import type StateModule from '../base/stateModule.js';
3
+ import type { IError } from '../base/utils.js';
4
+ import type { ITemplatesPreviewApi, ITemplatesPreviewEntity } from './templatesPreviewInterfaces.js';
5
+ /**
6
+ * Controllers for working with template objects for preview.
7
+ * @handle /api/content/template-previews
8
+ * @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
9
+ */
10
+ export default class TemplatePreviewsApi extends AsyncModules implements ITemplatesPreviewApi {
11
+ protected state: StateModule;
12
+ protected _url: string;
13
+ /**
14
+ * Constructor for the TemplatePreviewsApi class.
15
+ * @param {StateModule} state - The state module instance.
16
+ * @description Initializes the TemplatePreviewsApi class with the provided state module instance.
17
+ */
18
+ constructor(state: StateModule);
19
+ /**
20
+ * Get all template objects.
21
+ * @handleName getTemplatePreviews
22
+ * @param {string} [langCode] - Language code. Default: "en_US".
23
+ * @returns {Promise<ITemplatesPreviewEntity[] | IError>} - Returns all TemplatePreviewsEntity template objects.
24
+ * @throws {IError} When isShell=false and an error occurs during the fetch
25
+ * @description This method is used to fetch all available template objects.
26
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviews getTemplatePreviews} documentation.
27
+ */
28
+ getTemplatePreviews(langCode?: string): Promise<ITemplatesPreviewEntity[] | IError>;
29
+ /**
30
+ * Retrieves a template object by its marker.
31
+ * @handleName getTemplatePreviewByMarker
32
+ * @param {string} marker - The unique product marker used to identify the template. If not provided, a default behavior or error may occur. Example: "template_12345".
33
+ * @param {string} [langCode] - Language code. Default: "en_US".
34
+ * @returns {Promise<ITemplatesPreviewEntity | IError>} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
35
+ * @throws {IError} When isShell=false and an error occurs during the fetch
36
+ * @description This method is used to fetch a specific template object based on the provided marker.
37
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
38
+ */
39
+ getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity | IError>;
40
+ }
@@ -0,0 +1,50 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import createSchemaLoader from '../base/lazySchema.js';
3
+ const schema = createSchemaLoader(() => import('./templatesPreviewSchemas.js'));
4
+ /**
5
+ * Controllers for working with template objects for preview.
6
+ * @handle /api/content/template-previews
7
+ * @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
8
+ */
9
+ export default class TemplatePreviewsApi extends AsyncModules {
10
+ /**
11
+ * Constructor for the TemplatePreviewsApi class.
12
+ * @param {StateModule} state - The state module instance.
13
+ * @description Initializes the TemplatePreviewsApi class with the provided state module instance.
14
+ */
15
+ constructor(state) {
16
+ super(state);
17
+ this._url = state.url + '/api/content/template-previews';
18
+ }
19
+ /**
20
+ * Get all template objects.
21
+ * @handleName getTemplatePreviews
22
+ * @param {string} [langCode] - Language code. Default: "en_US".
23
+ * @returns {Promise<ITemplatesPreviewEntity[] | IError>} - Returns all TemplatePreviewsEntity template objects.
24
+ * @throws {IError} When isShell=false and an error occurs during the fetch
25
+ * @description This method is used to fetch all available template objects.
26
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviews getTemplatePreviews} documentation.
27
+ */
28
+ async getTemplatePreviews(langCode = this.state.lang) {
29
+ const result = await this._fetchGet(`?langCode=${langCode}`);
30
+ // Validate response if validation is enabled
31
+ const validated = await this._validateResponse(result, schema('TemplatePreviewsResponseSchema'));
32
+ return this._normalizeData(validated, langCode);
33
+ }
34
+ /**
35
+ * Retrieves a template object by its marker.
36
+ * @handleName getTemplatePreviewByMarker
37
+ * @param {string} marker - The unique product marker used to identify the template. If not provided, a default behavior or error may occur. Example: "template_12345".
38
+ * @param {string} [langCode] - Language code. Default: "en_US".
39
+ * @returns {Promise<ITemplatesPreviewEntity | IError>} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
40
+ * @throws {IError} When isShell=false and an error occurs during the fetch
41
+ * @description This method is used to fetch a specific template object based on the provided marker.
42
+ * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
43
+ */
44
+ async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
45
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
46
+ // Validate response if validation is enabled
47
+ const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
48
+ return this._normalizeData(validated, langCode);
49
+ }
50
+ }
@@ -0,0 +1,129 @@
1
+ import type { IError } from '../base/utils.js';
2
+ /**
3
+ * @interface ITemplatesPreviewApi
4
+ * @description This interface defines methods for retrieving template previews in the system, including fetching all previews, specific previews by marker.
5
+ */
6
+ interface ITemplatesPreviewApi {
7
+ /**
8
+ * Retrieves all template preview objects.
9
+ * @param {string} langCode - Language code for localization. Default: "en_US".
10
+ * @returns {ITemplatesPreviewEntity[]} A promise resolving to an array of template preview entities or an error.
11
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
12
+ */
13
+ getTemplatePreviews(langCode: string): Promise<ITemplatesPreviewEntity[] | IError>;
14
+ /**
15
+ * Retrieves a specific template preview object by its marker.
16
+ * @handleName getTemplatePreviewByMarker
17
+ * @param {string} marker - The marker of the template preview. Example: "template_12345".
18
+ * @param {string} [langCode] - Language code for localization. Default: "en_US".
19
+ * @returns {ITemplatesPreviewEntity | IError} A promise resolving to the template preview entity or an error.
20
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
21
+ * @description This method retrieves a specific template preview object by its marker.
22
+ */
23
+ getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatesPreviewEntity | IError>;
24
+ }
25
+ /**
26
+ * The `ITemplatesPreview` interface defines the structure of template preview entities.
27
+ * @interface ITemplatesPreviewEntity
28
+ * @property {number} id - The unique identifier of the position. Example: 3.
29
+ * @property {string} title - The name of the template preview. Example: "Product Template"..
30
+ * @property {object} proportions - Object contains info by proportions template preview.
31
+ * @example
32
+ {
33
+ "default": {
34
+ "horizontal": {
35
+ "width": 234,
36
+ "height": 324,
37
+ "alignmentType": "middleBottom"
38
+ },
39
+ "vertical": {
40
+ "width": 2,
41
+ "height": 3,
42
+ "alignmentType": "leftTop"
43
+ },
44
+ "square": {
45
+ "side": 3,
46
+ "alignmentType": "leftTop"
47
+ }
48
+ }
49
+ }
50
+ * @property {IProportion | null} proportions.horizontal - Horizontal proportion of the template preview.
51
+ * @example
52
+ {
53
+ "width": 234,
54
+ "height": 324,
55
+ "alignmentType": "middleBottom"
56
+ }
57
+ * @property {IProportion | null} proportions.vertical - Vertical proportion of the template preview.
58
+ * @example
59
+ {
60
+ "width": 2,
61
+ "height": 3,
62
+ "alignmentType": "leftTop"
63
+ }
64
+ * @property {ISquare} proportions.square - Square proportion of the template preview.
65
+ * @example
66
+ {
67
+ "side": 3,
68
+ "alignmentType": "leftTop"
69
+ }
70
+ * @property {string} identifier - The textual identifier for the record field. Example: "preview-templates"
71
+ * @property {number} version - The version number of the object. Example: 1.
72
+ * @property {number} position - The position of the object. Example: 1.
73
+ * @property {boolean} isUsed - Indicates whether the template preview is used. Example: true.
74
+ * @description This interface defines the structure of a template preview entity, including its identifiers, attributes, proportions, and title.
75
+ */
76
+ interface ITemplatesPreviewEntity {
77
+ id: number;
78
+ title: string;
79
+ proportions: ITemplatesPreviewProportions;
80
+ identifier: string;
81
+ version: number;
82
+ position: number;
83
+ isUsed: boolean;
84
+ }
85
+ /**
86
+ * @interface ITemplatesPreviewProportions
87
+ * @property {ITemplatesPreviewProportionVariants} default - Default proportion variants for horizontal, vertical, and square layouts.
88
+ * @description Container for proportion variants of a template preview.
89
+ */
90
+ interface ITemplatesPreviewProportions {
91
+ default: ITemplatesPreviewProportionVariants;
92
+ }
93
+ /**
94
+ * @interface ITemplatesPreviewProportionVariants
95
+ * @property {IProportion | null} horizontal - Horizontal layout proportion, or null when not configured.
96
+ * @property {IProportion | null} vertical - Vertical layout proportion, or null when not configured.
97
+ * @property {ISquare} square - Square layout proportion.
98
+ * @description Layout proportion variants of a template preview.
99
+ */
100
+ interface ITemplatesPreviewProportionVariants {
101
+ horizontal: IProportion | null;
102
+ vertical: IProportion | null;
103
+ square: ISquare;
104
+ }
105
+ /**
106
+ * The `IProportion` interface defines the structure of a proportion object used in template previews.
107
+ * @interface IProportion
108
+ * @property {string | number | null} width - width of the template preview. Example: 100.
109
+ * @property {string | number | null} height - height of the template preview. Example: 200.
110
+ * @property {string} alignmentType - alignment type of the template preview. Example: "center".
111
+ * @description Represents a proportion object used in template previews.
112
+ */
113
+ interface IProportion {
114
+ width: number | null;
115
+ height: number | null;
116
+ alignmentType: string;
117
+ }
118
+ /**
119
+ * The `ISquare` interface defines the structure of a square proportion object used in template previews.
120
+ * @interface ISquare
121
+ * @property {number | string} side - Side length of the square template preview, can be a number or string. Example: 100.
122
+ * @property {string} alignmentType - Alignment type of the square template preview. Example: "center".
123
+ * @description Represents a square proportion object used in template previews.
124
+ */
125
+ interface ISquare {
126
+ side: number | string;
127
+ alignmentType: string;
128
+ }
129
+ export type { IProportion, ISquare, ITemplatesPreviewApi, ITemplatesPreviewEntity, ITemplatesPreviewProportions, ITemplatesPreviewProportionVariants, };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Validation schemas for TemplatesPreviews module
3
+ * @description Zod schemas for validating templates previews-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Proportion schema
8
+ */
9
+ export declare const ProportionSchema: z.ZodObject<{
10
+ width: z.ZodNullable<z.ZodNumber>;
11
+ height: z.ZodNullable<z.ZodNumber>;
12
+ alignmentType: z.ZodString;
13
+ }, z.core.$strip>;
14
+ /**
15
+ * Square schema
16
+ */
17
+ export declare const SquareSchema: z.ZodObject<{
18
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
19
+ alignmentType: z.ZodString;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Template preview entity schema
23
+ * Includes all fields returned by the API
24
+ */
25
+ export declare const TemplatePreviewEntitySchema: z.ZodObject<{
26
+ id: z.ZodNumber;
27
+ title: z.ZodString;
28
+ proportions: z.ZodObject<{
29
+ default: z.ZodObject<{
30
+ horizontal: z.ZodNullable<z.ZodObject<{
31
+ width: z.ZodNullable<z.ZodNumber>;
32
+ height: z.ZodNullable<z.ZodNumber>;
33
+ alignmentType: z.ZodString;
34
+ }, z.core.$strip>>;
35
+ vertical: z.ZodNullable<z.ZodObject<{
36
+ width: z.ZodNullable<z.ZodNumber>;
37
+ height: z.ZodNullable<z.ZodNumber>;
38
+ alignmentType: z.ZodString;
39
+ }, z.core.$strip>>;
40
+ square: z.ZodObject<{
41
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
42
+ alignmentType: z.ZodString;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>;
45
+ }, z.core.$strip>;
46
+ identifier: z.ZodString;
47
+ version: z.ZodNumber;
48
+ position: z.ZodNumber;
49
+ isUsed: z.ZodBoolean;
50
+ }, z.core.$strip>;
51
+ /**
52
+ * Template previews response schema (array of template previews)
53
+ */
54
+ export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
55
+ id: z.ZodNumber;
56
+ title: z.ZodString;
57
+ proportions: z.ZodObject<{
58
+ default: z.ZodObject<{
59
+ horizontal: z.ZodNullable<z.ZodObject<{
60
+ width: z.ZodNullable<z.ZodNumber>;
61
+ height: z.ZodNullable<z.ZodNumber>;
62
+ alignmentType: z.ZodString;
63
+ }, z.core.$strip>>;
64
+ vertical: z.ZodNullable<z.ZodObject<{
65
+ width: z.ZodNullable<z.ZodNumber>;
66
+ height: z.ZodNullable<z.ZodNumber>;
67
+ alignmentType: z.ZodString;
68
+ }, z.core.$strip>>;
69
+ square: z.ZodObject<{
70
+ side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
71
+ alignmentType: z.ZodString;
72
+ }, z.core.$strip>;
73
+ }, z.core.$strip>;
74
+ }, z.core.$strip>;
75
+ identifier: z.ZodString;
76
+ version: z.ZodNumber;
77
+ position: z.ZodNumber;
78
+ isUsed: z.ZodBoolean;
79
+ }, z.core.$strip>>;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Validation schemas for TemplatesPreviews module
3
+ * @description Zod schemas for validating templates previews-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Proportion schema
8
+ */
9
+ export const ProportionSchema = z.object({
10
+ width: z.number().nullable(),
11
+ height: z.number().nullable(),
12
+ alignmentType: z.string(),
13
+ });
14
+ /**
15
+ * Square schema
16
+ */
17
+ export const SquareSchema = z.object({
18
+ side: z.union([z.number(), z.string()]),
19
+ alignmentType: z.string(),
20
+ });
21
+ /**
22
+ * Template preview entity schema
23
+ * Includes all fields returned by the API
24
+ */
25
+ export const TemplatePreviewEntitySchema = z.object({
26
+ id: z.number(),
27
+ title: z.string(),
28
+ proportions: z.object({
29
+ default: z.object({
30
+ horizontal: ProportionSchema.nullable(),
31
+ vertical: ProportionSchema.nullable(),
32
+ square: SquareSchema,
33
+ }),
34
+ }),
35
+ identifier: z.string(),
36
+ version: z.number(),
37
+ position: z.number(),
38
+ isUsed: z.boolean(),
39
+ });
40
+ /**
41
+ * Template previews response schema (array of template previews)
42
+ */
43
+ export const TemplatePreviewsResponseSchema = z.array(TemplatePreviewEntitySchema);
package/esm/types.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * OneEntry SDK public types.
3
+ * @description Aggregates every public interface and type of the SDK in a single entry point,
4
+ * so consumers can import them from 'oneentry' or 'oneentry/types' instead of deep paths
5
+ * like 'oneentry/dist/attribute-sets/attributeSetsInterfaces'.
6
+ */
7
+ export type * from './admins/adminsInterfaces.js';
8
+ export type * from './attribute-sets/attributeSetsInterfaces.js';
9
+ export type * from './auth-provider/authProvidersInterfaces.js';
10
+ export type * from './base/utils.js';
11
+ export type * from './blocks/blocksInterfaces.js';
12
+ export type * from './discounts/discountsInterfaces.js';
13
+ export type * from './events/eventsInterfaces.js';
14
+ export type * from './file-uploading/fileUploadingInterfaces.js';
15
+ export type * from './filters/filtersInterfaces.js';
16
+ export type * from './forms/formsInterfaces.js';
17
+ export type * from './forms-data/formsDataInterfaces.js';
18
+ export type * from './general-types/generalTypesInterfaces.js';
19
+ export type * from './integration-collections/integrationCollectionsInterfaces.js';
20
+ export type * from './locales/localesInterfaces.js';
21
+ export type * from './menus/menusInterfaces.js';
22
+ export type * from './orders/ordersInterfaces.js';
23
+ export type * from './pages/pagesInterfaces.js';
24
+ export type * from './payments/paymentsInterfaces.js';
25
+ export type * from './product-statuses/productStatusesInterfaces.js';
26
+ export type * from './products/productsInterfaces.js';
27
+ export type * from './search/searchInterfaces.js';
28
+ export type * from './sitemap/sitemapInterfaces.js';
29
+ export type * from './subscriptions/subscriptionsInterfaces.js';
30
+ export type * from './system/systemInterfaces.js';
31
+ export type * from './templates/templatesInterfaces.js';
32
+ export type * from './templates-preview/templatesPreviewInterfaces.js';
33
+ export type * from './user-activity/userActivityInterfaces.js';
34
+ export type * from './users/usersInterfaces.js';
35
+ export type * from './web-socket/wsInterfaces.js';