oneentry 1.0.147 → 1.0.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +1 -1
- package/dist/base/utils.d.ts +3 -19
- package/dist/blocks/blocksInterfaces.d.ts +1 -1
- package/dist/forms/formsInterfaces.d.ts +6 -1
- package/dist/forms-data/formsDataInterfaces.d.ts +1 -1
- package/dist/general-types/generalTypesSchemas.d.ts +2 -2
- package/dist/pages/pagesInterfaces.d.ts +6 -6
- package/dist/payments/paymentsInterfaces.d.ts +1 -1
- package/dist/products/productsInterfaces.d.ts +11 -10
- package/dist/templates/templatesApi.d.ts +6 -5
- package/dist/templates/templatesApi.js +2 -2
- package/dist/templates/templatesInterfaces.d.ts +8 -7
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +3 -3
- package/package.json +1 -1
|
@@ -77,7 +77,7 @@ interface IListTitleExtended {
|
|
|
77
77
|
* @type {AttributeType}
|
|
78
78
|
* @description This type defines the possible values for attribute types used in the system.
|
|
79
79
|
*/
|
|
80
|
-
type AttributeType = 'string' | 'text' | 'textWithHeader' | 'integer' | 'real' | 'float' | 'dateTime' | 'date' | 'time' | 'file' | 'image' | 'groupOfImages' | 'radioButton' | 'list' | 'button' | 'entity' | 'timeInterval';
|
|
80
|
+
type AttributeType = 'string' | 'text' | 'textWithHeader' | 'integer' | 'real' | 'float' | 'dateTime' | 'date' | 'time' | 'file' | 'image' | 'groupOfImages' | 'radioButton' | 'list' | 'button' | 'spam' | 'entity' | 'timeInterval';
|
|
81
81
|
/**
|
|
82
82
|
* Represents an attribute set entity.
|
|
83
83
|
* @interface IAttributesSetsEntity
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
*/
|
|
4
|
-
type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount' | 'frequently_ordered_block' | 'none';
|
|
5
|
-
/**
|
|
2
|
+
* @interface IConfig
|
|
6
3
|
* @property {string} [token] - If your project is protected by a token, specify this token in this parameter.
|
|
7
4
|
* @property {string} [langCode] - specify the default language to avoid specifying it in every request.
|
|
8
5
|
* @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
@@ -152,6 +149,7 @@ interface ILocalizeInfo {
|
|
|
152
149
|
*/
|
|
153
150
|
interface IAttributeLocalizeInfo extends ILocalizeInfo {
|
|
154
151
|
intervals?: ITimeIntervalSchedule[];
|
|
152
|
+
[key: string]: unknown;
|
|
155
153
|
}
|
|
156
154
|
/**
|
|
157
155
|
* @interface ITimeIntervalSchedule
|
|
@@ -205,11 +203,6 @@ interface ITimeIntervalRange {
|
|
|
205
203
|
* @property {Record<string, IAttributeValue> | unknown[]} [additionalFields] - Nested attribute values keyed by marker; the API may also return an empty array when none are configured. Optional.
|
|
206
204
|
* @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
|
|
207
205
|
* @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
|
|
208
|
-
* @property {boolean} [isLogin] - Form attribute flag — whether the field carries the login value used for authentication. Optional.
|
|
209
|
-
* @property {boolean} [isSignUp] - Form attribute flag — whether the field is required during sign-up. Optional.
|
|
210
|
-
* @property {boolean} [isNotificationEmail] - Form attribute flag — whether the field stores the email used for notifications. Optional.
|
|
211
|
-
* @property {boolean} [isNotificationPhonePush] - Form attribute flag — whether the field stores the phone number used for push notifications. Optional.
|
|
212
|
-
* @property {boolean} [isNotificationPhoneSMS] - Form attribute flag — whether the field stores the phone number used for SMS notifications. Optional.
|
|
213
206
|
* @description A single attribute value attached to an entity (admin, user, page, product, …).
|
|
214
207
|
*/
|
|
215
208
|
interface IAttributeValue {
|
|
@@ -219,11 +212,6 @@ interface IAttributeValue {
|
|
|
219
212
|
additionalFields?: Record<string, IAttributeValue> | unknown[];
|
|
220
213
|
isIcon?: boolean;
|
|
221
214
|
isProductPreview?: boolean;
|
|
222
|
-
isLogin?: boolean;
|
|
223
|
-
isSignUp?: boolean;
|
|
224
|
-
isNotificationEmail?: boolean;
|
|
225
|
-
isNotificationPhonePush?: boolean;
|
|
226
|
-
isNotificationPhoneSMS?: boolean;
|
|
227
215
|
}
|
|
228
216
|
/**
|
|
229
217
|
* @interface IAttributeValues
|
|
@@ -288,10 +276,6 @@ interface IHttpOptions {
|
|
|
288
276
|
headers: IHttpHeaders;
|
|
289
277
|
body?: string | FormData | Blob;
|
|
290
278
|
}
|
|
291
|
-
/**
|
|
292
|
-
* AttributeType
|
|
293
|
-
*/
|
|
294
|
-
type AttributeType = IAttributeValue | IAttributeValues;
|
|
295
279
|
/**
|
|
296
280
|
* LangType
|
|
297
281
|
*/
|
|
@@ -300,4 +284,4 @@ type LangType = string | Array<string>;
|
|
|
300
284
|
* LocalizeType
|
|
301
285
|
*/
|
|
302
286
|
type LocalizeType = ILocalizeInfo;
|
|
303
|
-
export type {
|
|
287
|
+
export type { IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, IRating, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, LangType, LocalizeType, };
|
|
@@ -122,6 +122,8 @@ interface IFormLocalizeInfo extends ILocalizeInfo {
|
|
|
122
122
|
* @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
|
|
123
123
|
* @property {boolean} isLogin - Whether this field carries the login value used for authentication. Example: false.
|
|
124
124
|
* @property {boolean} isSignUp - Whether this field is required during sign-up. Example: false.
|
|
125
|
+
* @property {boolean} isPassword - Whether this field carries the password value used for authentication. Example: false.
|
|
126
|
+
* @property {boolean} isSignUpRequired - Whether this field is required during sign-up. Example: false.
|
|
125
127
|
* @property {boolean} isNotificationEmail - Whether this field stores the email used for notifications. Example: false.
|
|
126
128
|
* @property {boolean} isNotificationPhonePush - Whether this field stores the phone number used for push notifications. Example: false.
|
|
127
129
|
* @property {boolean} isNotificationPhoneSMS - Whether this field stores the phone number used for SMS notifications. Example: false.
|
|
@@ -140,9 +142,12 @@ interface IFormAttribute {
|
|
|
140
142
|
additionalFields: Record<string, IFormAttributeAdditionalField>;
|
|
141
143
|
isLogin: boolean;
|
|
142
144
|
isSignUp: boolean;
|
|
145
|
+
isPassword: boolean;
|
|
146
|
+
isSignUpRequired: boolean;
|
|
143
147
|
isNotificationEmail: boolean;
|
|
144
148
|
isNotificationPhonePush: boolean;
|
|
145
149
|
isNotificationPhoneSMS: boolean;
|
|
150
|
+
[key: string]: unknown;
|
|
146
151
|
}
|
|
147
152
|
/**
|
|
148
153
|
* @interface IFormAttributeAdditionalField
|
|
@@ -211,7 +216,7 @@ interface IFormConfig {
|
|
|
211
216
|
* @interface IEntityIdentifier
|
|
212
217
|
* @property {string} id - Entity identifier (e.g. page or product marker). Example: "blog".
|
|
213
218
|
* @property {boolean} isNested - Whether the entit, is treated as ,ested unde, its parent. Exa,ple: false.
|
|
214
|
-
* @description
|
|
219
|
+
* @description Reference to an entity attached to a form configuration.
|
|
215
220
|
*/
|
|
216
221
|
interface IEntityIdentifier {
|
|
217
222
|
id: string;
|
|
@@ -302,7 +302,7 @@ interface IUpdateFormsData {
|
|
|
302
302
|
/**
|
|
303
303
|
* Contains an array of data form objects with the following values
|
|
304
304
|
*/
|
|
305
|
-
type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string,
|
|
305
|
+
type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
|
|
306
306
|
/**
|
|
307
307
|
* Represents the structure of the body for posting form data.
|
|
308
308
|
* @interface IBodyPostFormData
|
|
@@ -19,12 +19,12 @@ export declare const GeneralTypeEntitySchema: z.ZodObject<{
|
|
|
19
19
|
product_preview: "product_preview";
|
|
20
20
|
similar_products_block: "similar_products_block";
|
|
21
21
|
product_block: "product_block";
|
|
22
|
+
frequently_ordered_block: "frequently_ordered_block";
|
|
22
23
|
common_page: "common_page";
|
|
23
24
|
common_block: "common_block";
|
|
24
25
|
service: "service";
|
|
25
26
|
external_page: "external_page";
|
|
26
27
|
discount: "discount";
|
|
27
|
-
frequently_ordered_block: "frequently_ordered_block";
|
|
28
28
|
}>;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
/**
|
|
@@ -42,11 +42,11 @@ export declare const GeneralTypesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
42
42
|
product_preview: "product_preview";
|
|
43
43
|
similar_products_block: "similar_products_block";
|
|
44
44
|
product_block: "product_block";
|
|
45
|
+
frequently_ordered_block: "frequently_ordered_block";
|
|
45
46
|
common_page: "common_page";
|
|
46
47
|
common_block: "common_block";
|
|
47
48
|
service: "service";
|
|
48
49
|
external_page: "external_page";
|
|
49
50
|
discount: "discount";
|
|
50
|
-
frequently_ordered_block: "frequently_ordered_block";
|
|
51
51
|
}>;
|
|
52
52
|
}, z.core.$strip>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IAttributes, IAttributeValues, IError, ILocalizeInfo, IRating, LangType
|
|
2
|
-
import type { IBlockEntity } from '../blocks/blocksInterfaces';
|
|
1
|
+
import type { IAttributes, IAttributeValues, IError, ILocalizeInfo, IRating, LangType } from '../base/utils';
|
|
2
|
+
import type { BlockType, IBlockEntity } from '../blocks/blocksInterfaces';
|
|
3
3
|
import type { IFormConfig } from '../forms/formsInterfaces';
|
|
4
4
|
import type { ITemplateEntity } from '../templates/templatesInterfaces';
|
|
5
5
|
/**
|
|
@@ -169,7 +169,7 @@ interface IPositionForm {
|
|
|
169
169
|
* @property {number} version - The version number of the object. Example: 0.
|
|
170
170
|
* @property {number} position - The position of the object. Example: 1.
|
|
171
171
|
* @property {string} identifier - The textual identifier for the record field. Example: "product_block".
|
|
172
|
-
* @property {
|
|
172
|
+
* @property {BlockType} type - Page type. Example: "product".
|
|
173
173
|
* @property {string | null} templateIdentifier - User id of the linked template. Example: null.
|
|
174
174
|
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
175
175
|
* @property {boolean} isSync - Indication of page indexing. Example: false.
|
|
@@ -194,7 +194,7 @@ interface IPositionBlock {
|
|
|
194
194
|
version: number;
|
|
195
195
|
position: number;
|
|
196
196
|
identifier: string;
|
|
197
|
-
type:
|
|
197
|
+
type: BlockType;
|
|
198
198
|
templateIdentifier: string | null;
|
|
199
199
|
isVisible: boolean;
|
|
200
200
|
isSync: boolean;
|
|
@@ -217,7 +217,7 @@ interface IPositionBlock {
|
|
|
217
217
|
"plainContent": ""
|
|
218
218
|
}
|
|
219
219
|
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
220
|
-
* @property {
|
|
220
|
+
* @property {BlockType} type - Page type. Example: "common_page".
|
|
221
221
|
* @property {string | null} templateIdentifier - User id of the linked template. Example: "template".
|
|
222
222
|
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "page".
|
|
223
223
|
* @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
|
|
@@ -267,7 +267,7 @@ interface IPagesEntity {
|
|
|
267
267
|
depth: number;
|
|
268
268
|
localizeInfos: ILocalizeInfo;
|
|
269
269
|
isVisible: boolean;
|
|
270
|
-
type:
|
|
270
|
+
type: BlockType;
|
|
271
271
|
templateIdentifier: string | null;
|
|
272
272
|
attributeSetIdentifier: string | null;
|
|
273
273
|
attributeValues: IAttributeValues;
|
|
@@ -135,7 +135,7 @@ interface IIntent {
|
|
|
135
135
|
* @property {boolean} isVisible - Visibility indicator of the payment account. Example: true.
|
|
136
136
|
* @property {boolean} isUsed - Usage indicator of the payment account. Example: false.
|
|
137
137
|
* @property {boolean} testMode - Indicates whether the payment account is in test mode. Example: true.
|
|
138
|
-
* @property {IPaymentAccountSettings} settings - Payment account settings. Example: { "status": "connected" }
|
|
138
|
+
* @property {IPaymentAccountSettings} settings - Payment account settings. Example: `{ "status": "connected" }`.
|
|
139
139
|
* @property {object} [testSettings] - Test mode settings for the payment account.
|
|
140
140
|
* @property {string} updatedDate - Object modification date. Example: "2025-02-26T10:13:16.839Z".
|
|
141
141
|
* @description This interface defines the structure of a payment account entity, including its identifiers, localization information, type, visibility, and usage status.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAttributeValues, IError, ILocalizeInfo, IRating } from '../base/utils';
|
|
2
|
+
import type { BlockType } from '../blocks/blocksInterfaces';
|
|
2
3
|
import type { IFormConfig } from '../forms/formsInterfaces';
|
|
3
4
|
/**
|
|
4
5
|
* @interface IProductsApi
|
|
@@ -413,21 +414,21 @@ interface IProductPageRef {
|
|
|
413
414
|
* @property {number} id - The unique identifier. Example: 12345.
|
|
414
415
|
* @property {ILocalizeInfo} localizeInfos - The name of the products, taking into account localization. Example: {}.
|
|
415
416
|
* @property {string | null} statusIdentifier - Product page status identifiers (may be null). Example: "in_stock".
|
|
416
|
-
* @property {ILocalizeInfo} statusLocalizeInfos - Localized status name for the product. Example: { "title": "Sale" }
|
|
417
|
+
* @property {ILocalizeInfo} statusLocalizeInfos - Localized status name for the product. Example: `{ "title": "Sale" }`.
|
|
417
418
|
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "set_12345".
|
|
418
419
|
* @property {number} position - Item number (for sorting). Example: 1.
|
|
419
420
|
* @property {number | null} price - The value of the product page price taken from the index. Example: 150.00.
|
|
420
421
|
* @property {object} additional - Additional value from the index.
|
|
421
422
|
* @example
|
|
422
|
-
{
|
|
423
|
+
`{
|
|
423
424
|
prices: {
|
|
424
425
|
min: 5
|
|
425
426
|
max: 150
|
|
426
427
|
}
|
|
427
|
-
}
|
|
428
|
+
}`
|
|
428
429
|
* @property {string | null} sku - Product SKU (Stock Keeping Unit), may be null. Example: "SKU_12345".
|
|
429
430
|
* @property {boolean} isSync - Indication of page indexing. Example: true.
|
|
430
|
-
* @property {
|
|
431
|
+
* @property {IAttributeValues} attributeValues - Array of attribute values from the index, represented.
|
|
431
432
|
* @example
|
|
432
433
|
[
|
|
433
434
|
{
|
|
@@ -487,7 +488,7 @@ interface IProductsEntity {
|
|
|
487
488
|
additional: IProductAdditional;
|
|
488
489
|
sku: string | null;
|
|
489
490
|
isSync: boolean;
|
|
490
|
-
attributeValues:
|
|
491
|
+
attributeValues: IAttributeValues;
|
|
491
492
|
categories: string[];
|
|
492
493
|
isVisible: boolean;
|
|
493
494
|
moduleFormConfigs?: Array<IFormConfig>;
|
|
@@ -578,12 +579,12 @@ interface IProductInfo {
|
|
|
578
579
|
* @property {number} version - Version of the product block entity. Example: 1.
|
|
579
580
|
* @property {number} position - Position of the product block in a list or layout. Example: 1.
|
|
580
581
|
* @property {string} identifier - Unique string identifier for the product block. Example: "product_block_12345".
|
|
581
|
-
* @property {
|
|
582
|
+
* @property {BlockType} type - Type of the product block, such as "product", "error_page", etc. Example: "product".
|
|
582
583
|
* @property {object} customSettings - Custom settings for the product block, including slider delay, product configuration, similar product rules, and conditions. Example: {}
|
|
583
584
|
* @property {string | null} templateIdentifier - Identifier for the template used by the product block, or null if not applicable. Example: "template_12345".
|
|
584
585
|
* @property {boolean} isVisible - Indicates whether the product block is visible. Example: true.
|
|
585
586
|
* @property {boolean} isSync - Indicates whether the product block is synchronized. Example: false.
|
|
586
|
-
* @property {
|
|
587
|
+
* @property {IAttributeValues} attributeValues - Array of attribute values from the index, represented as a pair of user attribute id and attribute value.
|
|
587
588
|
* @example
|
|
588
589
|
[
|
|
589
590
|
{
|
|
@@ -646,12 +647,12 @@ interface IProductBlock {
|
|
|
646
647
|
version: number;
|
|
647
648
|
position: number;
|
|
648
649
|
identifier: string;
|
|
649
|
-
type:
|
|
650
|
+
type: BlockType;
|
|
650
651
|
customSettings: IProductBlockSettings;
|
|
651
652
|
templateIdentifier: string | null;
|
|
652
653
|
isVisible: boolean;
|
|
653
654
|
isSync: boolean;
|
|
654
|
-
attributeValues:
|
|
655
|
+
attributeValues: IAttributeValues;
|
|
655
656
|
}
|
|
656
657
|
/**
|
|
657
658
|
* @interface IAggregatedProductGroup
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
|
-
import type { IError
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { BlockType } from '../blocks/blocksInterfaces';
|
|
4
5
|
import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces';
|
|
5
6
|
/**
|
|
6
7
|
* Controllers for working with template objects
|
|
@@ -21,21 +22,21 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
|
|
|
21
22
|
* Get all template objects grouped by types.
|
|
22
23
|
* @handleName getAllTemplates
|
|
23
24
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
-
* @returns {Promise<Record<
|
|
25
|
+
* @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
25
26
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
27
|
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
27
28
|
*/
|
|
28
|
-
getAllTemplates(langCode?: string): Promise<Record<
|
|
29
|
+
getAllTemplates(langCode?: string): Promise<Record<BlockType, ITemplateEntity[]> | IError>;
|
|
29
30
|
/**
|
|
30
31
|
* Get template objects by type.
|
|
31
32
|
* @handleName getTemplateByType
|
|
32
|
-
* @param {
|
|
33
|
+
* @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
33
34
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
35
|
* @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
|
|
35
36
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
36
37
|
* @description Fetch template objects that belong to a specific type, with an optional filter by language.
|
|
37
38
|
*/
|
|
38
|
-
getTemplateByType(type:
|
|
39
|
+
getTemplateByType(type: BlockType, langCode?: string): Promise<ITemplateEntity[] | IError>;
|
|
39
40
|
/**
|
|
40
41
|
* Get one template object by marker.
|
|
41
42
|
* @handleName getTemplateByMarker
|
|
@@ -26,7 +26,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
26
26
|
* Get all template objects grouped by types.
|
|
27
27
|
* @handleName getAllTemplates
|
|
28
28
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
|
-
* @returns {Promise<Record<
|
|
29
|
+
* @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
30
30
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
31
31
|
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
32
32
|
*/
|
|
@@ -49,7 +49,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
49
49
|
/**
|
|
50
50
|
* Get template objects by type.
|
|
51
51
|
* @handleName getTemplateByType
|
|
52
|
-
* @param {
|
|
52
|
+
* @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
53
53
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
54
54
|
* @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
|
|
55
55
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IAttributeValues, IError
|
|
1
|
+
import type { IAttributeValues, IError } from '../base/utils';
|
|
2
|
+
import type { BlockType } from '../blocks/blocksInterfaces';
|
|
2
3
|
/**
|
|
3
4
|
* @interface ITemplatesApi
|
|
4
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.
|
|
@@ -8,21 +9,21 @@ interface ITemplatesApi {
|
|
|
8
9
|
* Get all template objects grouped by types.
|
|
9
10
|
* @handleName getAllTemplates
|
|
10
11
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
11
|
-
* @returns {Record<
|
|
12
|
+
* @returns {Record<BlockType, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
12
13
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
13
14
|
* @description This method gets all template objects grouped by types.
|
|
14
15
|
*/
|
|
15
|
-
getAllTemplates(langCode?: string): Promise<Record<
|
|
16
|
+
getAllTemplates(langCode?: string): Promise<Record<BlockType, ITemplateEntity[]> | IError>;
|
|
16
17
|
/**
|
|
17
18
|
* Get template objects by type.
|
|
18
19
|
* @handleName getTemplateByType
|
|
19
|
-
* @param {
|
|
20
|
+
* @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
20
21
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
21
22
|
* @returns {ITemplateEntity[]} Returns a TemplateEntity object.
|
|
22
23
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
23
24
|
* @description This method gets template objects by type.
|
|
24
25
|
*/
|
|
25
|
-
getTemplateByType(type:
|
|
26
|
+
getTemplateByType(type: BlockType, langCode: string): Promise<ITemplateEntity[] | IError>;
|
|
26
27
|
/**
|
|
27
28
|
* Get one template object by id.
|
|
28
29
|
* @handleName getTemplateByMarker
|
|
@@ -43,7 +44,7 @@ interface ITemplatesApi {
|
|
|
43
44
|
* @property {number} generalTypeId - General type Entity id. Example: 67890.
|
|
44
45
|
* @property {string} identifier - The textual identifier for the record field. Example: "template_12345".
|
|
45
46
|
* @property {number} version - The version number of the object. Example: 1.
|
|
46
|
-
* @property {
|
|
47
|
+
* @property {BlockType} generalTypeName - General type name. Example: "product".
|
|
47
48
|
* @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
|
|
48
49
|
* @example
|
|
49
50
|
{
|
|
@@ -60,7 +61,7 @@ interface ITemplateEntity {
|
|
|
60
61
|
generalTypeId: number;
|
|
61
62
|
identifier: string;
|
|
62
63
|
version: number;
|
|
63
|
-
generalTypeName:
|
|
64
|
+
generalTypeName: BlockType;
|
|
64
65
|
attributeValues: IAttributeValues;
|
|
65
66
|
position: number;
|
|
66
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAttributeValues, IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* @interface ITemplatesPreviewApi
|
|
4
4
|
* @description This interface defines methods for retrieving template previews in the system, including fetching all previews, specific previews by marker.
|
|
@@ -69,7 +69,7 @@ interface ITemplatesPreviewApi {
|
|
|
69
69
|
}
|
|
70
70
|
* @property {string} identifier - The textual identifier for the record field. Example: "preview-templates"
|
|
71
71
|
* @property {number} version - The version number of the object. Example: 1.
|
|
72
|
-
* @property {
|
|
72
|
+
* @property {IAttributeValues} attributeValues - Attribute values from index. Example: {}
|
|
73
73
|
* @property {number} position - The position of the object. Example: 1.
|
|
74
74
|
* @property {boolean} isUsed - Indicates whether the template preview is used. Example: true.
|
|
75
75
|
* @property {string | null} [attributeSetIdentifier] - Text identifier used for a set of attributes. Example: "attribute_set_1".
|
|
@@ -81,7 +81,7 @@ interface ITemplatesPreviewEntity {
|
|
|
81
81
|
proportions: ITemplatesPreviewProportions;
|
|
82
82
|
identifier: string;
|
|
83
83
|
version: number;
|
|
84
|
-
attributeValues:
|
|
84
|
+
attributeValues: IAttributeValues;
|
|
85
85
|
position: number;
|
|
86
86
|
isUsed: boolean;
|
|
87
87
|
attributeSetIdentifier?: string | null;
|