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,24 @@
1
+ /**
2
+ * Validation schemas for FileUploading module
3
+ * @description Zod schemas for validating file uploading-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Upload return schema
8
+ * Includes filename, downloadLink, and size
9
+ */
10
+ export declare const UploadingReturnSchema: z.ZodObject<{
11
+ filename: z.ZodString;
12
+ downloadLink: z.ZodString;
13
+ size: z.ZodNumber;
14
+ contentType: z.ZodString;
15
+ }, z.core.$strip>;
16
+ /**
17
+ * Upload response schema (array of upload results)
18
+ */
19
+ export declare const UploadResponseSchema: z.ZodArray<z.ZodObject<{
20
+ filename: z.ZodString;
21
+ downloadLink: z.ZodString;
22
+ size: z.ZodNumber;
23
+ contentType: z.ZodString;
24
+ }, z.core.$strip>>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Validation schemas for FileUploading module
3
+ * @description Zod schemas for validating file uploading-related API responses
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Upload return schema
8
+ * Includes filename, downloadLink, and size
9
+ */
10
+ export const UploadingReturnSchema = z.object({
11
+ filename: z.string(),
12
+ downloadLink: z.string(),
13
+ size: z.number(),
14
+ contentType: z.string(),
15
+ });
16
+ /**
17
+ * Upload response schema (array of upload results)
18
+ */
19
+ export const UploadResponseSchema = z.array(UploadingReturnSchema);
@@ -0,0 +1,32 @@
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 { IContentFilter, IFiltersApi } from './filtersInterfaces.js';
5
+ /**
6
+ * Controllers for working with content filters.
7
+ * @handle /api/content/filters
8
+ * @class FiltersApi
9
+ * @augments AsyncModules
10
+ * @implements {IFiltersApi}
11
+ * @description This class provides methods to retrieve content filters.
12
+ */
13
+ export default class FiltersApi extends AsyncModules implements IFiltersApi {
14
+ protected state: StateModule;
15
+ protected _url: string;
16
+ /**
17
+ * Constructor for FiltersApi class.
18
+ * @param {StateModule} state - The state module.
19
+ */
20
+ constructor(state: StateModule);
21
+ /**
22
+ * Get a filter by its marker (tree of items).
23
+ * @handleName getFilterByMarker
24
+ * @param {string} marker - Filter marker. Example: "main".
25
+ * @param {string} [langCode] - Language code. Default: "en_US".
26
+ * @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
27
+ * @throws {IError} When isShell=false and an error occurs during the fetch
28
+ * @description Retrieves a single content filter by marker.
29
+ * @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
30
+ */
31
+ getFilterByMarker(marker: string, langCode?: string): Promise<IContentFilter | IError>;
32
+ }
@@ -0,0 +1,36 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import createSchemaLoader from '../base/lazySchema.js';
3
+ const schema = createSchemaLoader(() => import('./filtersSchemas.js'));
4
+ /**
5
+ * Controllers for working with content filters.
6
+ * @handle /api/content/filters
7
+ * @class FiltersApi
8
+ * @augments AsyncModules
9
+ * @implements {IFiltersApi}
10
+ * @description This class provides methods to retrieve content filters.
11
+ */
12
+ export default class FiltersApi extends AsyncModules {
13
+ /**
14
+ * Constructor for FiltersApi class.
15
+ * @param {StateModule} state - The state module.
16
+ */
17
+ constructor(state) {
18
+ super(state);
19
+ this._url = state.url + '/api/content/filters';
20
+ }
21
+ /**
22
+ * Get a filter by its marker (tree of items).
23
+ * @handleName getFilterByMarker
24
+ * @param {string} marker - Filter marker. Example: "main".
25
+ * @param {string} [langCode] - Language code. Default: "en_US".
26
+ * @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
27
+ * @throws {IError} When isShell=false and an error occurs during the fetch
28
+ * @description Retrieves a single content filter by marker.
29
+ * @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
30
+ */
31
+ async getFilterByMarker(marker, langCode = this.state.lang) {
32
+ const data = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
33
+ const validated = await this._validateResponse(data, schema('ContentFilterSchema'));
34
+ return this._normalizeData(validated);
35
+ }
36
+ }
@@ -0,0 +1,56 @@
1
+ import type { IError, ILocalizeInfo } from '../base/utils.js';
2
+ /**
3
+ * Interface for the Filters API module.
4
+ * @interface IFiltersApi
5
+ * @description This interface defines methods for retrieving content filters.
6
+ */
7
+ interface IFiltersApi {
8
+ /**
9
+ * Get a filter by its marker (tree of items).
10
+ * @handleName getFilterByMarker
11
+ * @param {string} marker - Filter marker. Example: "main".
12
+ * @param {string} [langCode] - Language code. Default: "en_US".
13
+ * @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
14
+ * @throws {IError} When isShell=false and an error occurs during the fetch
15
+ * @description Retrieves a single content filter by marker.
16
+ */
17
+ getFilterByMarker(marker: string, langCode?: string): Promise<IContentFilter | IError>;
18
+ }
19
+ /**
20
+ * Type of a filter item tree node.
21
+ * @description Type of a filter item tree node (including `custom` for custom entries).
22
+ */
23
+ type TContentFilterItemType = 'page' | 'product' | 'admin' | 'attribute' | 'discount' | 'personal-discount' | 'bonus' | 'payment-method' | 'custom';
24
+ /**
25
+ * Content filter item (tree node).
26
+ * @interface IContentFilterItem
27
+ * @property {TContentFilterItemType} type - Tree node type. Example: "page".
28
+ * @property {string | null} [marker] - Marker of the linked entity, or null for type=page. Example: "about".
29
+ * @property {string | null} [url] - Page URL (only for type=page; null otherwise). Example: "about".
30
+ * @property {ILocalizeInfo} [localizeInfos] - Localized info of the linked entity in the requested locale.
31
+ * @property {string | string[] | null} [value] - Unified node value: an array of values in range for a range attribute, a resolved title for a legacy checkbox attribute, the discount value for discount/personal-discount/bonus, the object id for product/admin/payment-method, and null for a page. Example: ["25", "50", "75"].
32
+ * @property {number} [position] - Numeric position (per-level). Example: 1.
33
+ * @property {IContentFilterItem[]} [children] - Nested tree nodes (regular and custom items in a single array).
34
+ * @description A single node of a content filter items tree.
35
+ */
36
+ interface IContentFilterItem {
37
+ type: TContentFilterItemType;
38
+ marker?: string | null;
39
+ url?: string | null;
40
+ localizeInfos?: ILocalizeInfo;
41
+ value?: string | string[] | null;
42
+ position?: number;
43
+ children?: IContentFilterItem[];
44
+ }
45
+ /**
46
+ * Content filter.
47
+ * @interface IContentFilter
48
+ * @property {ILocalizeInfo} localizeInfos - Localized info of the filter in the requested locale.
49
+ * @property {IContentFilterItem[]} [items] - Filter items tree (regular items + custom items in a single array).
50
+ * @description A content filter with its localized info and items tree.
51
+ */
52
+ interface IContentFilter {
53
+ localizeInfos: ILocalizeInfo;
54
+ items?: IContentFilterItem[];
55
+ }
56
+ export type { IContentFilter, IContentFilterItem, IFiltersApi, TContentFilterItemType, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Validation schemas for Filters module
3
+ * @description Zod schemas for validating filters-related API responses (raw API data, before normalization)
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Raw content filter item shape (before normalization), used to type the recursive schema.
8
+ * @description Raw filter item tree node as returned by the API (localizeInfos kept as a locale map).
9
+ */
10
+ type IContentFilterItemRaw = {
11
+ type: string;
12
+ marker?: string | null;
13
+ url?: string | null;
14
+ localizeInfos?: Record<string, unknown>;
15
+ value?: string | string[] | null;
16
+ position?: number;
17
+ children?: IContentFilterItemRaw[];
18
+ };
19
+ /**
20
+ * Content filter item schema (recursive)
21
+ * @description Schema for a single filter item tree node; `children` recurses into the same schema
22
+ */
23
+ export declare const ContentFilterItemSchema: z.ZodType<IContentFilterItemRaw>;
24
+ /**
25
+ * Content filter schema
26
+ * @description Schema for a content filter returned by getFilterByMarker
27
+ */
28
+ export declare const ContentFilterSchema: z.ZodObject<{
29
+ localizeInfos: z.ZodRecord<z.ZodString, z.ZodUnknown>;
30
+ items: z.ZodOptional<z.ZodArray<z.ZodType<IContentFilterItemRaw, unknown, z.core.$ZodTypeInternals<IContentFilterItemRaw, unknown>>>>;
31
+ }, z.core.$strip>;
32
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Validation schemas for Filters module
3
+ * @description Zod schemas for validating filters-related API responses (raw API data, before normalization)
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Content filter item schema (recursive)
8
+ * @description Schema for a single filter item tree node; `children` recurses into the same schema
9
+ */
10
+ export const ContentFilterItemSchema = z.lazy(() => z.object({
11
+ type: z.string(),
12
+ marker: z.string().nullable().optional(),
13
+ url: z.string().nullable().optional(),
14
+ localizeInfos: z.record(z.string(), z.unknown()).optional(),
15
+ value: z
16
+ .union([z.string(), z.array(z.string())])
17
+ .nullable()
18
+ .optional(),
19
+ position: z.number().optional(),
20
+ children: z.array(ContentFilterItemSchema).optional(),
21
+ }));
22
+ /**
23
+ * Content filter schema
24
+ * @description Schema for a content filter returned by getFilterByMarker
25
+ */
26
+ export const ContentFilterSchema = z.object({
27
+ localizeInfos: z.record(z.string(), z.unknown()),
28
+ items: z.array(ContentFilterItemSchema).optional(),
29
+ });
@@ -0,0 +1,44 @@
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 { IForms, IFormsEntity, IFormsResponse } from './formsInterfaces.js';
5
+ /**
6
+ * Controllers for forms objects
7
+ * @class FormsApi
8
+ * @augments AsyncModules
9
+ * @implements {IForms}
10
+ * @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
11
+ */
12
+ export default class FormsApi extends AsyncModules implements IForms {
13
+ protected state: StateModule;
14
+ protected _url: string;
15
+ /**
16
+ * Initializes the FormsApi with the provided state module.
17
+ * @class
18
+ * @class FormsApi
19
+ * @param {StateModule} state - The state module containing configuration data.
20
+ * @description Constructor initializes the FormsApi with a given state.
21
+ */
22
+ constructor(state: StateModule);
23
+ /**
24
+ * Get all forms.
25
+ * @handleName getAllForms
26
+ * @param {string} [langCode] - Language code. Default: "en_US".
27
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
28
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
29
+ * @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
30
+ * @throws {IError} When isShell=false and an error occurs during the fetch
31
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
32
+ */
33
+ getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsResponse | IError>;
34
+ /**
35
+ * Get one form by form marker.
36
+ * @handleName getFormByMarker
37
+ * @param {string} marker - Marker of form. Example: "contact_form".
38
+ * @param {string} [langCode] - Language code. Default: "en_US".
39
+ * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
40
+ * @throws {IError} When isShell=false and an error occurs during the fetch
41
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
42
+ */
43
+ getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
44
+ }
@@ -0,0 +1,54 @@
1
+ import AsyncModules from '../base/asyncModules.js';
2
+ import createSchemaLoader from '../base/lazySchema.js';
3
+ const schema = createSchemaLoader(() => import('./formsSchemas.js'));
4
+ /**
5
+ * Controllers for forms objects
6
+ * @class FormsApi
7
+ * @augments AsyncModules
8
+ * @implements {IForms}
9
+ * @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
10
+ */
11
+ export default class FormsApi extends AsyncModules {
12
+ /**
13
+ * Initializes the FormsApi with the provided state module.
14
+ * @class
15
+ * @class FormsApi
16
+ * @param {StateModule} state - The state module containing configuration data.
17
+ * @description Constructor initializes the FormsApi with a given state.
18
+ */
19
+ constructor(state) {
20
+ super(state);
21
+ this._url = state.url + '/api/content/forms';
22
+ }
23
+ /**
24
+ * Get all forms.
25
+ * @handleName getAllForms
26
+ * @param {string} [langCode] - Language code. Default: "en_US".
27
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
28
+ * @param {number} [limit] - Parameter for pagination. Default: 30.
29
+ * @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
30
+ * @throws {IError} When isShell=false and an error occurs during the fetch
31
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
32
+ */
33
+ async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
34
+ const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
35
+ // Validate response if validation is enabled
36
+ const validated = await this._validateResponse(result, schema('FormsResponseSchema'));
37
+ return this._normalizeData(validated, langCode);
38
+ }
39
+ /**
40
+ * Get one form by form marker.
41
+ * @handleName getFormByMarker
42
+ * @param {string} marker - Marker of form. Example: "contact_form".
43
+ * @param {string} [langCode] - Language code. Default: "en_US".
44
+ * @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
45
+ * @throws {IError} When isShell=false and an error occurs during the fetch
46
+ * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
47
+ */
48
+ async getFormByMarker(marker, langCode = this.state.lang) {
49
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
50
+ // Validate response if validation is enabled
51
+ const validated = await this._validateResponse(result, schema('FormEntitySchema'));
52
+ return this._normalizeData(validated, langCode);
53
+ }
54
+ }
@@ -0,0 +1,237 @@
1
+ import type { IPosition } from '../admins/adminsInterfaces.js';
2
+ import type { AttributeType, IAttributeValidators, IListTitle } from '../attribute-sets/attributeSetsInterfaces.js';
3
+ import type { IAttributeLocalizeInfo, IError, ILocalizeInfo } from '../base/utils.js';
4
+ /**
5
+ * Interface for retrieving forms in the system.
6
+ * @interface IForms
7
+ * @description This interface defines methods for retrieving forms in the system.
8
+ */
9
+ interface IForms {
10
+ /**
11
+ * Retrieves all forms in the system.
12
+ * @handleName getAllForms
13
+ * @param {string} [langCode] - The language code for localization. Default: "en_US".
14
+ * @param {number} [offset] - Optional offset for pagination. Default: 0.
15
+ * @param {number} [limit] - Optional limit for pagination. Default: 30.
16
+ * @returns {IFormsEntity[]} A promise that resolves to an array of form entities or an error.
17
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
18
+ * @description This method retrieves all forms in the system.
19
+ */
20
+ getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsResponse | IError>;
21
+ /**
22
+ * Retrieves a form by its marker.
23
+ * @handleName getFormByMarker
24
+ * @param {string} marker - The marker identifying the form. Example: "contact_form".
25
+ * @param {string} [langCode] - The language code for localization. Default: "en_US".
26
+ * @returns {IFormsEntity} A promise that resolves to a form entity or an error.
27
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
28
+ * @description This method retrieves a form by its marker.
29
+ */
30
+ getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
31
+ }
32
+ /**
33
+ * Represents the structure of a form page.
34
+ * @interface IFromPages
35
+ * @property {number} id - The unique identifier of the form page. Example: 123.
36
+ * @property {number} pageId - The identifier of the page. Example: 12.
37
+ * @property {number} formId - The identifier of the form. Example: 321.
38
+ * @property {number} positionId - The identifier of the position. Example: 1.
39
+ * @property {IPosition} position - The position object.
40
+ * @example
41
+ {
42
+ "id": 1,
43
+ "position": 1,
44
+ "objectId": 2,
45
+ "objectType": "admin",
46
+ "isLocked": false,
47
+ "objectCategoryId": 1
48
+ }
49
+ * @description This interface defines the structure of a form page.
50
+ */
51
+ interface IFromPages {
52
+ id: number;
53
+ pageId: number;
54
+ formId: number;
55
+ positionId: number;
56
+ position: IPosition;
57
+ }
58
+ /**
59
+ * Represents the structure of a form entity.
60
+ * @interface IFormsEntity
61
+ * @property {number} id - The identifier of the object. Example: 12345.
62
+ * @property {number | null} attributeSetId - The identifier of the attribute set being used, or null if not applicable. Example: 1234.
63
+ * @property {string | null} type - Form type. Example: "contact".
64
+ * @property {IFormLocalizeInfo} localizeInfos - The name of the form and form-side localization fields (success/error messages, processing config, etc.).
65
+ * @example
66
+ {
67
+ "key": "value"
68
+ }
69
+ * @property {number} version - The version number of the object. Example: 1.
70
+ * @property {number} position - The position of the object. Example: 1.
71
+ * @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
72
+ * @property {string} processingType - Type of form processing. Example: "async".
73
+ * @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
74
+ * @property {IFormAttribute[]} attributes - Form fields with their localization, validators and form-specific flags, sorted by `position`. The API returns an empty object for forms with no attributes — the SDK normalizes it to an empty array.
75
+ * @property {number | string} [total] - Total count of related entries. Example: "1".
76
+ * @property {IFormConfig[]} [moduleFormConfigs] - Array of module form configurations associated with the form.
77
+ * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
78
+ */
79
+ interface IFormsEntity {
80
+ id: number;
81
+ attributeSetId: number | null;
82
+ type: 'order' | 'sign_in_up' | 'collection' | 'data' | 'rating' | null;
83
+ localizeInfos: IFormLocalizeInfo;
84
+ version: number;
85
+ position: number;
86
+ identifier: string;
87
+ processingType: string;
88
+ templateId: number | null;
89
+ attributes: IFormAttribute[];
90
+ total?: number | string;
91
+ moduleFormConfigs?: IFormConfig[];
92
+ }
93
+ /**
94
+ * @interface IFormLocalizeInfo
95
+ * @property {string} [title] - Localized name of the form. Optional — the payload is an empty object when the form has no localization for the requested language (e.g. in list responses). Example: "Contact form".
96
+ * @property {string} [titleForSite] - Public-facing title shown on the website. Example: "Form title (for application)".
97
+ * @property {string} [successMessage] - Message shown to the user after successful submission.
98
+ * @property {string} [unsuccessMessage] - Message shown to the user after a failed submission.
99
+ * @property {string} [urlAddress] - URL where the form data is sent for processing (used by `processingType: "url"`).
100
+ * @property {string} [database] - Database flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
101
+ * @property {string} [script] - Script flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
102
+ * @description Localization payload of a form — extends {@link ILocalizeInfo} with form-side fields (messages, processing config). Unlike the base type, `title` is optional here.
103
+ */
104
+ interface IFormLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
105
+ title?: string;
106
+ titleForSite?: string;
107
+ successMessage?: string;
108
+ unsuccessMessage?: string;
109
+ urlAddress?: string;
110
+ database?: string;
111
+ script?: string;
112
+ }
113
+ /**
114
+ * @interface IFormAttribute
115
+ * @property {string} marker - Field marker (machine name). Example: "email".
116
+ * @property {AttributeType} type - Attribute data type (e.g. "string", "file").
117
+ * @property {number} position - Sort position of the field. Example: 1.
118
+ * @property {boolean} isVisible - Whether the field is exposed to the user. Example: true.
119
+ * @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the field. For `timeInterval` attributes, also carries the `intervals` schedule payload.
120
+ * @property {unknown} initialValue - Default value applied when the field is not filled.
121
+ * @property {IListTitle[]} listTitles - Predefined options for `list`/`radioButton` fields; empty array for other types.
122
+ * @property {IAttributeValidators} validators - Validation rules; empty object when no validators are configured.
123
+ * @property {Record<string, unknown>} settings - Field-specific configuration; empty object by default.
124
+ * @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
125
+ * @property {boolean} [isLogin] - Whether this field carries the login value used for authentication. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
126
+ * @property {boolean} [isSignUp] - Whether this field is required during sign-up. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
127
+ * @property {boolean} [isPassword] - Whether this field carries the password value used for authentication. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
128
+ * @property {boolean} [isSignUpRequired] - Whether this field is required during sign-up. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
129
+ * @property {boolean} [isNotificationEmail] - Whether this field stores the email used for notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
130
+ * @property {boolean} [isNotificationPhonePush] - Whether this field stores the phone number used for push notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
131
+ * @property {boolean} [isNotificationPhoneSMS] - Whether this field stores the phone number used for SMS notifications. Optional — present only on attributes of sign-in/sign-up forms. Example: false.
132
+ * @description Definition of a single field inside a form — extends a generic attribute with form-specific authentication / notification flags (returned only for sign-in/sign-up forms).
133
+ */
134
+ interface IFormAttribute {
135
+ marker: string;
136
+ type: AttributeType;
137
+ position: number;
138
+ isVisible: boolean;
139
+ localizeInfos: IAttributeLocalizeInfo;
140
+ initialValue: unknown;
141
+ listTitles: IListTitle[];
142
+ validators: IAttributeValidators;
143
+ settings: Record<string, unknown>;
144
+ additionalFields: Record<string, IFormAttributeAdditionalField>;
145
+ isLogin?: boolean;
146
+ isSignUp?: boolean;
147
+ isPassword?: boolean;
148
+ isSignUpRequired?: boolean;
149
+ isNotificationEmail?: boolean;
150
+ isNotificationPhonePush?: boolean;
151
+ isNotificationPhoneSMS?: boolean;
152
+ [key: string]: unknown;
153
+ }
154
+ /**
155
+ * @interface IFormAttributeAdditionalField
156
+ * @property {string} [marker] - Marker of the additional field. Optional — the API returns entries as `{ type, value }`, the marker itself is the key of the `additionalFields` map. Example: "additional_field".
157
+ * @property {string} type - Type of the additional field. Example: "string".
158
+ * @property {unknown} value - Value of the additional field, normalized like any other attribute value: `number | null` for numeric types, the file object itself for a single-file `image`/`file`, `null` when empty. Example: "Additional field data".
159
+ * @description A single nested entry inside {@link IFormAttribute}'s `additionalFields` map.
160
+ */
161
+ interface IFormAttributeAdditionalField {
162
+ marker?: string;
163
+ type: string;
164
+ value: unknown;
165
+ }
166
+ /**
167
+ * Represents the structure of a form configuration.
168
+ * @interface IFormConfig
169
+ * @property {number} id - The identifier of the form configuration. Example: 123.
170
+ * @property {string} [formIdentifier] - The form identifier (only in products/pages API). Example: "review".
171
+ * @property {string} moduleIdentifier - The identifier of the module associated with the form configuration. Example: "module_identifier".
172
+ * @property {boolean} isGlobal - Indicates whether the form configuration is global. Example: true.
173
+ * @property {boolean} isClosed - Indicates whether the form configuration is closed. Example: true.
174
+ * @property {boolean} [isModerate] - Indicates whether the form requires moderation (only in products/pages API). Example: false.
175
+ * @property {boolean} [viewOnlyUserData] - Indicates whether the form configuration allows viewing user data (used in forms API). Example: true.
176
+ * @property {boolean} [commentOnlyUserData] - Indicates whether the form configuration allows commenting on user data (used in forms API). Example: true.
177
+ * @property {boolean} [viewOnlyMyData] - Indicates whether the form configuration allows viewing my data (used in products/pages API). Example: false.
178
+ * @property {boolean} [commentOnlyMyData] - Indicates whether the form configuration allows commenting on my data (used in products/pages API). Example: false.
179
+ * @property {object[]} entityIdentifiers - An array of entity identifiers associated with the form configuration.
180
+ * @property {string} entityIdentifiers[].id - Entity identifier. Example: "catalog".
181
+ * @property {boolean} entityIdentifiers[].isNested - Indicates if entity is nested. Example: false.
182
+ * @property {string[]} [nestedEntityIdentifiers] - An array of nested entity identifier strings (only in products/pages API). Example: ["catalog"].
183
+ * @property {string[]} [exceptionIds] - An array of exception identifiers.
184
+ * @property {number} [formDataCount] - Total count of form data entries (only in products/pages API). Example: 306.
185
+ * @property {Record<string, number>} [entityFormDataCount] - Form data count per entity identifier (only in products/pages API). Example: `{"catalog": 306}`.
186
+ * @property {boolean | null} [isRating] - Indicates whether this form config is for ratings. Example: null.
187
+ * @property {boolean | null} [isAnonymous] - Indicates whether anonymous submissions are allowed. Example: null.
188
+ * @property {boolean | null} [allowHalfRatings] - Indicates whether half ratings are allowed. Example: null.
189
+ * @property {boolean | null} [allowRerating] - Indicates whether re-rating is allowed. Example: null.
190
+ * @property {number | null} [maxRatingScale] - Maximum rating scale value. Example: 5.
191
+ * @property {string} [ratingCalculation] - Rating calculation method. Example: "average".
192
+ * @description This interface defines the structure of a form configuration, including its identifiers, module association, and entity identifiers. Different APIs return different field variants.
193
+ */
194
+ interface IFormConfig {
195
+ id: number;
196
+ formIdentifier?: string;
197
+ moduleIdentifier: string;
198
+ isGlobal: boolean;
199
+ isClosed: boolean;
200
+ isModerate?: boolean;
201
+ viewOnlyUserData?: boolean;
202
+ commentOnlyUserData?: boolean;
203
+ viewOnlyMyData?: boolean;
204
+ commentOnlyMyData?: boolean;
205
+ entityIdentifiers: IEntityIdentifier[];
206
+ nestedEntityIdentifiers?: string[];
207
+ exceptionIds?: string[];
208
+ formDataCount?: number;
209
+ entityFormDataCount?: Record<string, number>;
210
+ isRating?: boolean | null;
211
+ isAnonymous?: boolean | null;
212
+ allowHalfRatings?: boolean | null;
213
+ allowRerating?: boolean | null;
214
+ maxRatingScale?: number | null;
215
+ ratingCalculation?: string;
216
+ }
217
+ /**
218
+ * @interface IEntityIdentifier
219
+ * @property {string} id - Entity identifier (e.g. page or product marker). Example: "blog".
220
+ * @property {boolean} isNested - Whether the entit, is treated as ,ested unde, its parent. Exa,ple: false.
221
+ * @description Reference to an entity attached to a form configuration.
222
+ */
223
+ interface IEntityIdentifier {
224
+ id: string;
225
+ isNested: boolean;
226
+ }
227
+ /**
228
+ * Represents the paginated response structure for forms.
229
+ * @interface IFormsResponse
230
+ * @property {number} total - Total items count.
231
+ * @property {IFormsEntity[]} items - Array of form entities.
232
+ */
233
+ interface IFormsResponse {
234
+ total: number;
235
+ items: IFormsEntity[];
236
+ }
237
+ export type { IEntityIdentifier, IFormAttribute, IFormAttributeAdditionalField, IFormConfig, IFormLocalizeInfo, IForms, IFormsEntity, IFormsResponse, IFromPages, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Form entity schema
4
+ * Includes all fields returned by the API
5
+ */
6
+ export declare const FormEntitySchema: z.ZodObject<{
7
+ id: z.ZodNumber;
8
+ identifier: z.ZodString;
9
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
10
+ version: z.ZodNumber;
11
+ position: z.ZodNumber;
12
+ processingType: z.ZodString;
13
+ type: z.ZodNullable<z.ZodString>;
14
+ attributeSetId: z.ZodNullable<z.ZodNumber>;
15
+ templateId: z.ZodNullable<z.ZodNumber>;
16
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
17
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
18
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
19
+ }, z.core.$strip>;
20
+ /**
21
+ * Forms response schema (paginated)
22
+ */
23
+ export declare const FormsResponseSchema: z.ZodObject<{
24
+ total: z.ZodNumber;
25
+ items: z.ZodArray<z.ZodObject<{
26
+ id: z.ZodNumber;
27
+ identifier: z.ZodString;
28
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
29
+ version: z.ZodNumber;
30
+ position: z.ZodNumber;
31
+ processingType: z.ZodString;
32
+ type: z.ZodNullable<z.ZodString>;
33
+ attributeSetId: z.ZodNullable<z.ZodNumber>;
34
+ templateId: z.ZodNullable<z.ZodNumber>;
35
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
36
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
37
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>;
40
+ /**
41
+ * Single form response schema
42
+ */
43
+ export declare const SingleFormSchema: z.ZodObject<{
44
+ id: z.ZodNumber;
45
+ identifier: z.ZodString;
46
+ localizeInfos: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
47
+ version: z.ZodNumber;
48
+ position: z.ZodNumber;
49
+ processingType: z.ZodString;
50
+ type: z.ZodNullable<z.ZodString>;
51
+ attributeSetId: z.ZodNullable<z.ZodNumber>;
52
+ templateId: z.ZodNullable<z.ZodNumber>;
53
+ total: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
54
+ attributes: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
55
+ moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
56
+ }, z.core.$strip>;