oneentry 1.0.141 → 1.0.142

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 (150) hide show
  1. package/configure.js +107 -15
  2. package/package.json +81 -3
  3. package/dist/admins/adminsApi.d.ts +0 -50
  4. package/dist/admins/adminsApi.js +0 -65
  5. package/dist/admins/adminsInterfaces.d.ts +0 -99
  6. package/dist/admins/adminsInterfaces.js +0 -2
  7. package/dist/admins/adminsSchemas.d.ts +0 -30
  8. package/dist/admins/adminsSchemas.js +0 -27
  9. package/dist/attribute-sets/attributeSetsApi.d.ts +0 -63
  10. package/dist/attribute-sets/attributeSetsApi.js +0 -98
  11. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -187
  12. package/dist/attribute-sets/attributeSetsInterfaces.js +0 -2
  13. package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -90
  14. package/dist/attribute-sets/attributeSetsSchemas.js +0 -74
  15. package/dist/auth-provider/authProviderApi.d.ts +0 -249
  16. package/dist/auth-provider/authProviderApi.js +0 -351
  17. package/dist/auth-provider/authProviderSchemas.d.ts +0 -131
  18. package/dist/auth-provider/authProviderSchemas.js +0 -82
  19. package/dist/auth-provider/authProvidersInterfaces.d.ts +0 -425
  20. package/dist/auth-provider/authProvidersInterfaces.js +0 -2
  21. package/dist/base/asyncModules.d.ts +0 -80
  22. package/dist/base/asyncModules.js +0 -440
  23. package/dist/base/result.d.ts +0 -39
  24. package/dist/base/result.js +0 -154
  25. package/dist/base/stateModule.d.ts +0 -41
  26. package/dist/base/stateModule.js +0 -128
  27. package/dist/base/syncModules.d.ts +0 -149
  28. package/dist/base/syncModules.js +0 -549
  29. package/dist/base/utils.d.ts +0 -197
  30. package/dist/base/utils.js +0 -2
  31. package/dist/base/validation.d.ts +0 -118
  32. package/dist/base/validation.js +0 -132
  33. package/dist/blocks/blocksApi.d.ts +0 -76
  34. package/dist/blocks/blocksApi.js +0 -188
  35. package/dist/blocks/blocksInterfaces.d.ts +0 -173
  36. package/dist/blocks/blocksInterfaces.js +0 -2
  37. package/dist/blocks/blocksSchemas.d.ts +0 -187
  38. package/dist/blocks/blocksSchemas.js +0 -43
  39. package/dist/discounts/discountsApi.d.ts +0 -56
  40. package/dist/discounts/discountsApi.js +0 -82
  41. package/dist/discounts/discountsInterfaces.d.ts +0 -145
  42. package/dist/discounts/discountsInterfaces.js +0 -2
  43. package/dist/events/eventsApi.d.ts +0 -60
  44. package/dist/events/eventsApi.js +0 -97
  45. package/dist/events/eventsInterfaces.d.ts +0 -87
  46. package/dist/events/eventsInterfaces.js +0 -2
  47. package/dist/file-uploading/fileUploadingApi.d.ts +0 -88
  48. package/dist/file-uploading/fileUploadingApi.js +0 -132
  49. package/dist/file-uploading/fileUploadingInterfaces.d.ts +0 -117
  50. package/dist/file-uploading/fileUploadingInterfaces.js +0 -2
  51. package/dist/file-uploading/fileUploadingSchemas.d.ts +0 -22
  52. package/dist/file-uploading/fileUploadingSchemas.js +0 -21
  53. package/dist/forms/formsApi.d.ts +0 -42
  54. package/dist/forms/formsApi.js +0 -57
  55. package/dist/forms/formsInterfaces.d.ts +0 -132
  56. package/dist/forms/formsInterfaces.js +0 -2
  57. package/dist/forms/formsSchemas.d.ts +0 -50
  58. package/dist/forms/formsSchemas.js +0 -31
  59. package/dist/forms-data/formsDataApi.d.ts +0 -106
  60. package/dist/forms-data/formsDataApi.js +0 -189
  61. package/dist/forms-data/formsDataInterfaces.d.ts +0 -525
  62. package/dist/forms-data/formsDataInterfaces.js +0 -2
  63. package/dist/forms-data/formsDataSchemas.d.ts +0 -115
  64. package/dist/forms-data/formsDataSchemas.js +0 -86
  65. package/dist/general-types/generalTypesApi.d.ts +0 -28
  66. package/dist/general-types/generalTypesApi.js +0 -38
  67. package/dist/general-types/generalTypesInterfaces.d.ts +0 -30
  68. package/dist/general-types/generalTypesInterfaces.js +0 -2
  69. package/dist/general-types/generalTypesSchemas.d.ts +0 -50
  70. package/dist/general-types/generalTypesSchemas.js +0 -35
  71. package/dist/index.d.ts +0 -100
  72. package/dist/index.js +0 -103
  73. package/dist/integration-collections/integrationCollectionsApi.d.ts +0 -173
  74. package/dist/integration-collections/integrationCollectionsApi.js +0 -220
  75. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +0 -313
  76. package/dist/integration-collections/integrationCollectionsInterfaces.js +0 -2
  77. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -80
  78. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -61
  79. package/dist/locales/localesApi.d.ts +0 -27
  80. package/dist/locales/localesApi.js +0 -37
  81. package/dist/locales/localesInterfaces.d.ts +0 -41
  82. package/dist/locales/localesInterfaces.js +0 -2
  83. package/dist/locales/localesSchemas.d.ts +0 -32
  84. package/dist/locales/localesSchemas.js +0 -26
  85. package/dist/menus/menusApi.d.ts +0 -29
  86. package/dist/menus/menusApi.js +0 -39
  87. package/dist/menus/menusInterfaces.d.ts +0 -88
  88. package/dist/menus/menusInterfaces.js +0 -4
  89. package/dist/menus/menusSchemas.d.ts +0 -16
  90. package/dist/menus/menusSchemas.js +0 -28
  91. package/dist/orders/ordersApi.d.ts +0 -149
  92. package/dist/orders/ordersApi.js +0 -203
  93. package/dist/orders/ordersInterfaces.d.ts +0 -527
  94. package/dist/orders/ordersInterfaces.js +0 -2
  95. package/dist/orders/ordersSchemas.d.ts +0 -120
  96. package/dist/orders/ordersSchemas.js +0 -101
  97. package/dist/pages/pagesApi.d.ts +0 -151
  98. package/dist/pages/pagesApi.js +0 -390
  99. package/dist/pages/pagesInterfaces.d.ts +0 -292
  100. package/dist/pages/pagesInterfaces.js +0 -2
  101. package/dist/pages/pagesSchemas.d.ts +0 -85
  102. package/dist/pages/pagesSchemas.js +0 -46
  103. package/dist/payments/paymentsApi.d.ts +0 -82
  104. package/dist/payments/paymentsApi.js +0 -121
  105. package/dist/payments/paymentsInterfaces.d.ts +0 -206
  106. package/dist/payments/paymentsInterfaces.js +0 -2
  107. package/dist/payments/paymentsSchemas.d.ts +0 -100
  108. package/dist/payments/paymentsSchemas.js +0 -65
  109. package/dist/product-statuses/productStatusesApi.d.ts +0 -47
  110. package/dist/product-statuses/productStatusesApi.js +0 -70
  111. package/dist/product-statuses/productStatusesInterfaces.d.ts +0 -66
  112. package/dist/product-statuses/productStatusesInterfaces.js +0 -2
  113. package/dist/product-statuses/productStatusesSchemas.d.ts +0 -34
  114. package/dist/product-statuses/productStatusesSchemas.js +0 -30
  115. package/dist/products/productsApi.d.ts +0 -365
  116. package/dist/products/productsApi.js +0 -459
  117. package/dist/products/productsInterfaces.d.ts +0 -586
  118. package/dist/products/productsInterfaces.js +0 -2
  119. package/dist/products/productsSchemas.d.ts +0 -192
  120. package/dist/products/productsSchemas.js +0 -96
  121. package/dist/sitemap/sitemapApi.d.ts +0 -35
  122. package/dist/sitemap/sitemapApi.js +0 -45
  123. package/dist/sitemap/sitemapInterfaces.d.ts +0 -40
  124. package/dist/sitemap/sitemapInterfaces.js +0 -2
  125. package/dist/system/systemApi.d.ts +0 -43
  126. package/dist/system/systemApi.js +0 -58
  127. package/dist/system/systemInterfaces.d.ts +0 -31
  128. package/dist/system/systemInterfaces.js +0 -5
  129. package/dist/templates/templatesApi.d.ts +0 -49
  130. package/dist/templates/templatesApi.js +0 -75
  131. package/dist/templates/templatesInterfaces.d.ts +0 -70
  132. package/dist/templates/templatesInterfaces.js +0 -2
  133. package/dist/templates/templatesSchemas.d.ts +0 -48
  134. package/dist/templates/templatesSchemas.js +0 -31
  135. package/dist/templates-preview/templatesPreviewApi.d.ts +0 -38
  136. package/dist/templates-preview/templatesPreviewApi.js +0 -53
  137. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -121
  138. package/dist/templates-preview/templatesPreviewInterfaces.js +0 -2
  139. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -83
  140. package/dist/templates-preview/templatesPreviewSchemas.js +0 -48
  141. package/dist/users/usersApi.d.ts +0 -143
  142. package/dist/users/usersApi.js +0 -173
  143. package/dist/users/usersInterfaces.d.ts +0 -235
  144. package/dist/users/usersInterfaces.js +0 -2
  145. package/dist/users/usersSchemas.d.ts +0 -38
  146. package/dist/users/usersSchemas.js +0 -28
  147. package/dist/web-socket/wsApi.d.ts +0 -25
  148. package/dist/web-socket/wsApi.js +0 -45
  149. package/dist/web-socket/wsInterfaces.d.ts +0 -17
  150. package/dist/web-socket/wsInterfaces.js +0 -2
@@ -1,75 +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 templatesSchemas_1 = require("./templatesSchemas");
9
- /**
10
- * Controllers for working with template objects
11
- * @module TemplateController
12
- * @handle /api/content/templates
13
- * @description This module provides a set of controllers for handling operations related to template objects.
14
- */
15
- class TemplatesPreviewApi extends asyncModules_1.default {
16
- /**
17
- * Constructor for TemplatesApi class.
18
- * @param {StateModule} state - The state module instance.
19
- * @description Initializes the TemplatesApi class with the provided state module instance.
20
- */
21
- constructor(state) {
22
- super(state);
23
- this._url = state.url + '/api/content/templates';
24
- }
25
- /**
26
- * Get all template objects grouped by types.
27
- * @handleName getAllTemplates
28
- * @param {string} [langCode] - Language code. Default: "en_US".
29
- * @returns {Promise<Record<Types, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
30
- * @throws {IError} When isShell=false and an error occurs during the fetch
31
- * @description This function is designed to fetch organized template objects in groups based on their types.
32
- */
33
- async getAllTemplates(langCode = this.state.lang) {
34
- const response = await this._fetchGet(`/all?langCode=${langCode}`);
35
- // Validate response if validation is enabled
36
- const validated = this._validateResponse(response, templatesSchemas_1.GroupedTemplatesResponseSchema);
37
- const result = {};
38
- // eslint-disable-next-line no-restricted-syntax
39
- for (const item in validated) {
40
- result[item] = this._normalizeData(validated[item], langCode);
41
- }
42
- return result;
43
- }
44
- /**
45
- * Get template objects by type.
46
- * @handleName getTemplateByType
47
- * @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
48
- * @param {string} [langCode] - Language code. Default: "en_US".
49
- * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
50
- * @throws {IError} When isShell=false and an error occurs during the fetch
51
- * @description Fetch template objects that belong to a specific type, with an optional filter by language.
52
- */
53
- async getTemplateByType(type, langCode = this.state.lang) {
54
- const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
55
- // Validate response if validation is enabled
56
- const validated = this._validateResponse(result, templatesSchemas_1.TemplatesResponseSchema);
57
- return this._normalizeData(validated);
58
- }
59
- /**
60
- * Get one template object by marker.
61
- * @handleName getTemplateByMarker
62
- * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
63
- * @param {string} [langCode] - Language code. Default: "en_US".
64
- * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
65
- * @throws {IError} When isShell=false and an error occurs during the fetch
66
- * @description Fetch a specific template object based on its unique marker.
67
- */
68
- async getTemplateByMarker(marker, langCode = this.state.lang) {
69
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
70
- // Validate response if validation is enabled
71
- const validated = this._validateResponse(result, templatesSchemas_1.TemplateEntitySchema);
72
- return this._normalizeData(validated);
73
- }
74
- }
75
- exports.default = TemplatesPreviewApi;
@@ -1,70 +0,0 @@
1
- import type { AttributeType, IError, Types } from '../base/utils';
2
- /**
3
- * @interface ITemplatesApi
4
- * @property {Function} getAllTemplates - Get all template objects grouped by types.
5
- * @property {Function} getTemplateByType - Get template objects by type.
6
- * @property {Function} getTemplateByMarker - Getting a single template object.
7
- * @description This interface defines methods for retrieving templates in the system, including fetching all templates, specific templates by type or ID, and by marker.
8
- */
9
- interface ITemplatesApi {
10
- /**
11
- * Get all template objects grouped by types.
12
- * @handleName getAllTemplates
13
- * @param {string} [langCode] - Language code. Default: "en_US".
14
- * @returns {Record<Types, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
15
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
16
- * @description This method gets all template objects grouped by types.
17
- */
18
- getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity[]> | IError>;
19
- /**
20
- * Get template objects by type.
21
- * @handleName getTemplateByType
22
- * @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
23
- * @param {string} [langCode] - Language code. Default: "en_US".
24
- * @returns {ITemplateEntity[]} Returns a TemplateEntity object.
25
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
26
- * @description This method gets template objects by type.
27
- */
28
- getTemplateByType(type: Types, langCode: string): Promise<ITemplateEntity[] | IError>;
29
- /**
30
- * Get one template object by id.
31
- * @handleName getTemplateByMarker
32
- * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
33
- * @param {string} [langCode] - Language code. Default: "en_US".
34
- * @returns {ITemplateEntity} Returns a TemplateEntity object
35
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
36
- * @description This method gets one template object by id.
37
- */
38
- getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
39
- }
40
- /**
41
- * The template entity interface
42
- * @interface ITemplateEntity
43
- * @property {number} id - The unique identifier of the position. Example: 12345.
44
- * @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "attribute_set_1".
45
- * @property {string} title - The name of the template. Example: "Product Template".
46
- * @property {number} generalTypeId - General type Entity id. Example: 67890.
47
- * @property {string} identifier - The textual identifier for the record field. Example: "template_12345".
48
- * @property {number} version - The version number of the object. Example: 1.
49
- * @property {Types} generalTypeName - General type name. Example: "product".
50
- * @property {AttributeType} attributeValues - Attribute values from the index (represented as a pair of user attribute id: attribute value).
51
- * @example
52
- {
53
- "id": 1,
54
- "value": "some"
55
- }
56
- * @property {number} position - The position of the object. Example: 1.
57
- * @description This interface defines the structure of a template entity, including its identifiers, attributes, and general type information.
58
- */
59
- interface ITemplateEntity {
60
- id: number;
61
- attributeSetIdentifier: string | null;
62
- title: string;
63
- generalTypeId: number;
64
- identifier: string;
65
- version: number;
66
- generalTypeName: Types;
67
- attributeValues: AttributeType;
68
- position: number;
69
- }
70
- export type { ITemplateEntity, ITemplatesApi };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,48 +0,0 @@
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>>>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GroupedTemplatesResponseSchema = exports.TemplatesResponseSchema = exports.TemplateEntitySchema = void 0;
4
- /**
5
- * Validation schemas for Templates module
6
- * @description Zod schemas for validating templates-related API responses
7
- */
8
- const zod_1 = require("zod");
9
- /**
10
- * Template entity schema
11
- * Includes all fields returned by the API
12
- */
13
- exports.TemplateEntitySchema = zod_1.z.object({
14
- id: zod_1.z.number(),
15
- attributeSetIdentifier: zod_1.z.string().nullable(),
16
- title: zod_1.z.string(),
17
- generalTypeId: zod_1.z.number(),
18
- identifier: zod_1.z.string(),
19
- version: zod_1.z.number(),
20
- generalTypeName: zod_1.z.string(),
21
- attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
22
- position: zod_1.z.number(),
23
- });
24
- /**
25
- * Templates response schema (array of templates)
26
- */
27
- exports.TemplatesResponseSchema = zod_1.z.array(exports.TemplateEntitySchema);
28
- /**
29
- * Grouped templates response schema (by type)
30
- */
31
- exports.GroupedTemplatesResponseSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.array(exports.TemplateEntitySchema));
@@ -1,38 +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 { ITemplatesPreviewApi, ITemplatesPreviewEntity } from './templatesPreviewInterfaces';
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
- */
27
- getTemplatePreviews(langCode?: string): Promise<ITemplatesPreviewEntity[] | IError>;
28
- /**
29
- * Retrieves a template object by its marker.
30
- * @handleName getTemplatePreviewByMarker
31
- * @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".
32
- * @param {string} [langCode] - Language code. Default: "en_US".
33
- * @returns {Promise<ITemplatesPreviewEntity | IError>} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
34
- * @throws {IError} When isShell=false and an error occurs during the fetch
35
- * @description This method is used to fetch a specific template object based on the provided marker.
36
- */
37
- getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity | IError>;
38
- }
@@ -1,53 +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
- const asyncModules_1 = __importDefault(require("../base/asyncModules"));
7
- const templatesPreviewSchemas_1 = require("./templatesPreviewSchemas");
8
- /**
9
- * Controllers for working with template objects for preview.
10
- * @handle /api/content/template-previews
11
- * @description This module provides a set of controllers for managing and retrieving template objects designed for preview purposes.
12
- */
13
- class TemplatePreviewsApi extends asyncModules_1.default {
14
- /**
15
- * Constructor for the TemplatePreviewsApi class.
16
- * @param {StateModule} state - The state module instance.
17
- * @description Initializes the TemplatePreviewsApi class with the provided state module instance.
18
- */
19
- constructor(state) {
20
- super(state);
21
- this._url = state.url + '/api/content/template-previews';
22
- }
23
- /**
24
- * Get all template objects.
25
- * @handleName getTemplatePreviews
26
- * @param {string} [langCode] - Language code. Default: "en_US".
27
- * @returns {Promise<ITemplatesPreviewEntity[] | IError>} - Returns all TemplatePreviewsEntity template objects.
28
- * @throws {IError} When isShell=false and an error occurs during the fetch
29
- * @description This method is used to fetch all available template objects.
30
- */
31
- async getTemplatePreviews(langCode = this.state.lang) {
32
- const result = await this._fetchGet(`?langCode=${langCode}`);
33
- // Validate response if validation is enabled
34
- const validated = this._validateResponse(result, templatesPreviewSchemas_1.TemplatePreviewsResponseSchema);
35
- return this._normalizeData(validated, langCode);
36
- }
37
- /**
38
- * Retrieves a template object by its marker.
39
- * @handleName getTemplatePreviewByMarker
40
- * @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".
41
- * @param {string} [langCode] - Language code. Default: "en_US".
42
- * @returns {Promise<ITemplatesPreviewEntity | IError>} - A promise that resolves to a TemplatePreviewsEntity object representing the template.
43
- * @throws {IError} When isShell=false and an error occurs during the fetch
44
- * @description This method is used to fetch a specific template object based on the provided marker.
45
- */
46
- async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
47
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
48
- // Validate response if validation is enabled
49
- const validated = this._validateResponse(result, templatesPreviewSchemas_1.TemplatePreviewEntitySchema);
50
- return this._normalizeData(validated, langCode);
51
- }
52
- }
53
- exports.default = TemplatePreviewsApi;
@@ -1,121 +0,0 @@
1
- import type { AttributeType, IError } from '../base/utils';
2
- /**
3
- * @interface ITemplatesPreviewApi
4
- * @property {Function} getTemplatePreviews - Get all template preview objects.
5
- * @property {Function} getTemplatePreviewByMarker - Get one template preview object by marker.
6
- * @description This interface defines methods for retrieving template previews in the system, including fetching all previews, specific previews by marker.
7
- */
8
- interface ITemplatesPreviewApi {
9
- /**
10
- * Retrieves all template preview objects.
11
- * @param {string} langCode - Language code for localization. Default: "en_US".
12
- * @returns {ITemplatesPreviewEntity[]} A promise resolving to an array of template preview entities or an error.
13
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
14
- */
15
- getTemplatePreviews(langCode: string): Promise<ITemplatesPreviewEntity[] | IError>;
16
- /**
17
- * Retrieves a specific template preview object by its marker.
18
- * @handleName getTemplatePreviewByMarker
19
- * @param {string} marker - The marker of the template preview. Example: "template_12345".
20
- * @param {string} [langCode] - Language code for localization. Default: "en_US".
21
- * @returns {ITemplatesPreviewEntity | IError} A promise resolving to the template preview entity 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 a specific template preview object by its marker.
24
- */
25
- getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatesPreviewEntity | IError>;
26
- }
27
- /**
28
- * The `ITemplatesPreview` interface defines the structure of template preview entities.
29
- * @interface ITemplatesPreviewEntity
30
- * @property {number} id - The unique identifier of the position. Example: 3.
31
- * @property {string} title - The name of the template preview. Example: "Product Template"..
32
- * @property {object} proportions - Object contains info by proportions template preview.
33
- * @example
34
- {
35
- "default": {
36
- "horizontal": {
37
- "width": 234,
38
- "height": 324,
39
- "alignmentType": "middleBottom"
40
- },
41
- "vertical": {
42
- "width": 2,
43
- "height": 3,
44
- "alignmentType": "leftTop"
45
- },
46
- "square": {
47
- "side": 3,
48
- "alignmentType": "leftTop"
49
- }
50
- }
51
- }
52
- * @property {IProportion | null} proportions.horizontal - Horizontal proportion of the template preview.
53
- * @example
54
- {
55
- "width": 234,
56
- "height": 324,
57
- "alignmentType": "middleBottom"
58
- }
59
- * @property {IProportion | null} proportions.vertical - Vertical proportion of the template preview.
60
- * @example
61
- {
62
- "width": 2,
63
- "height": 3,
64
- "alignmentType": "leftTop"
65
- }
66
- * @property {ISquare} proportions.square - Square proportion of the template preview.
67
- * @example
68
- {
69
- "side": 3,
70
- "alignmentType": "leftTop"
71
- }
72
- * @property {string} identifier - The textual identifier for the record field. Example: "preview-templates"
73
- * @property {number} version - The version number of the object. Example: 1.
74
- * @property {AttributeType} attributeValues - Attribute values from index. Example: {}
75
- * @property {number} position - The position of the object. Example: 1.
76
- * @property {boolean} isUsed - Indicates whether the template preview is used. Example: true.
77
- * @property {string | null} [attributeSetIdentifier] - Text identifier used for a set of attributes. Example: "attribute_set_1".
78
- * @description This interface defines the structure of a template preview entity, including its identifiers, attributes, proportions, and title.
79
- */
80
- interface ITemplatesPreviewEntity {
81
- id: number;
82
- title: string;
83
- proportions: {
84
- default: {
85
- horizontal: IProportion | null;
86
- vertical: IProportion | null;
87
- square: ISquare;
88
- };
89
- };
90
- identifier: string;
91
- version: number;
92
- attributeValues: AttributeType;
93
- position: number;
94
- isUsed: boolean;
95
- attributeSetIdentifier?: string | null;
96
- }
97
- /**
98
- * The `IProportion` interface defines the structure of a proportion object used in template previews.
99
- * @interface IProportion
100
- * @property {string | number | null} width - width of the template preview. Example: 100.
101
- * @property {string | number | null} height - height of the template preview. Example: 200.
102
- * @property {string} alignmentType - alignment type of the template preview. Example: "center".
103
- * @description Represents a proportion object used in template previews.
104
- */
105
- interface IProportion {
106
- width: number | null;
107
- height: number | null;
108
- alignmentType: string;
109
- }
110
- /**
111
- * The `ISquare` interface defines the structure of a square proportion object used in template previews.
112
- * @interface ISquare
113
- * @property {number | string} side - Side length of the square template preview, can be a number or string. Example: 100.
114
- * @property {string} alignmentType - Alignment type of the square template preview. Example: "center".
115
- * @description Represents a square proportion object used in template previews.
116
- */
117
- interface ISquare {
118
- side: number | string;
119
- alignmentType: string;
120
- }
121
- export type { IProportion, ISquare, ITemplatesPreviewApi, ITemplatesPreviewEntity, };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,83 +0,0 @@
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
- attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
49
- position: z.ZodNumber;
50
- isUsed: z.ZodBoolean;
51
- attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
- }, z.core.$strip>;
53
- /**
54
- * Template previews response schema (array of template previews)
55
- */
56
- export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
57
- id: z.ZodNumber;
58
- title: z.ZodString;
59
- proportions: z.ZodObject<{
60
- default: z.ZodObject<{
61
- horizontal: z.ZodNullable<z.ZodObject<{
62
- width: z.ZodNullable<z.ZodNumber>;
63
- height: z.ZodNullable<z.ZodNumber>;
64
- alignmentType: z.ZodString;
65
- }, z.core.$strip>>;
66
- vertical: z.ZodNullable<z.ZodObject<{
67
- width: z.ZodNullable<z.ZodNumber>;
68
- height: z.ZodNullable<z.ZodNumber>;
69
- alignmentType: z.ZodString;
70
- }, z.core.$strip>>;
71
- square: z.ZodObject<{
72
- side: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
73
- alignmentType: z.ZodString;
74
- }, z.core.$strip>;
75
- }, z.core.$strip>;
76
- }, z.core.$strip>;
77
- identifier: z.ZodString;
78
- version: z.ZodNumber;
79
- attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
80
- position: z.ZodNumber;
81
- isUsed: z.ZodBoolean;
82
- attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
- }, z.core.$strip>>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemplatePreviewsResponseSchema = exports.TemplatePreviewEntitySchema = exports.SquareSchema = exports.ProportionSchema = void 0;
4
- /**
5
- * Validation schemas for TemplatesPreviews module
6
- * @description Zod schemas for validating templates previews-related API responses
7
- */
8
- const zod_1 = require("zod");
9
- /**
10
- * Proportion schema
11
- */
12
- exports.ProportionSchema = zod_1.z.object({
13
- width: zod_1.z.number().nullable(),
14
- height: zod_1.z.number().nullable(),
15
- alignmentType: zod_1.z.string(),
16
- });
17
- /**
18
- * Square schema
19
- */
20
- exports.SquareSchema = zod_1.z.object({
21
- side: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
22
- alignmentType: zod_1.z.string(),
23
- });
24
- /**
25
- * Template preview entity schema
26
- * Includes all fields returned by the API
27
- */
28
- exports.TemplatePreviewEntitySchema = zod_1.z.object({
29
- id: zod_1.z.number(),
30
- title: zod_1.z.string(),
31
- proportions: zod_1.z.object({
32
- default: zod_1.z.object({
33
- horizontal: exports.ProportionSchema.nullable(),
34
- vertical: exports.ProportionSchema.nullable(),
35
- square: exports.SquareSchema,
36
- }),
37
- }),
38
- identifier: zod_1.z.string(),
39
- version: zod_1.z.number(),
40
- attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
41
- position: zod_1.z.number(),
42
- isUsed: zod_1.z.boolean(),
43
- attributeSetIdentifier: zod_1.z.string().nullable().optional(),
44
- });
45
- /**
46
- * Template previews response schema (array of template previews)
47
- */
48
- exports.TemplatePreviewsResponseSchema = zod_1.z.array(exports.TemplatePreviewEntitySchema);