oneentry 1.0.146 → 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/admins/adminsApi.d.ts +4 -3
- package/dist/admins/adminsApi.js +1 -1
- package/dist/admins/adminsInterfaces.d.ts +4 -4
- package/dist/admins/adminsSchemas.d.ts +24 -8
- package/dist/admins/adminsSchemas.js +11 -5
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +122 -25
- package/dist/auth-provider/authProvidersInterfaces.d.ts +34 -25
- package/dist/base/utils.d.ts +147 -71
- package/dist/blocks/blocksApi.d.ts +3 -3
- package/dist/blocks/blocksApi.js +1 -1
- package/dist/blocks/blocksInterfaces.d.ts +8 -8
- package/dist/blocks/blocksSchemas.d.ts +52 -8
- package/dist/discounts/discountsInterfaces.d.ts +53 -19
- package/dist/forms/formsInterfaces.d.ts +89 -14
- package/dist/forms-data/formsDataInterfaces.d.ts +141 -66
- package/dist/general-types/generalTypesSchemas.d.ts +2 -2
- package/dist/menus/menusInterfaces.d.ts +1 -1
- package/dist/orders/ordersInterfaces.d.ts +81 -19
- package/dist/orders/ordersSchemas.d.ts +73 -2
- package/dist/orders/ordersSchemas.js +32 -3
- package/dist/pages/pagesApi.js +1 -1
- package/dist/pages/pagesInterfaces.d.ts +12 -12
- package/dist/payments/paymentsInterfaces.d.ts +41 -16
- package/dist/products/productsApi.d.ts +26 -19
- package/dist/products/productsApi.js +27 -20
- package/dist/products/productsInterfaces.d.ts +118 -41
- package/dist/products/productsSchemas.d.ts +52 -8
- package/dist/products/productsSchemas.js +15 -2
- package/dist/sitemap/sitemapApi.d.ts +4 -4
- package/dist/sitemap/sitemapApi.js +2 -2
- package/dist/sitemap/sitemapInterfaces.d.ts +13 -11
- package/dist/templates/templatesApi.d.ts +6 -5
- package/dist/templates/templatesApi.js +10 -5
- package/dist/templates/templatesInterfaces.d.ts +10 -9
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +25 -11
- package/dist/users/usersInterfaces.d.ts +4 -8
- package/package.json +2 -2
|
@@ -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
|
|
@@ -332,11 +333,15 @@ interface IProductsApi {
|
|
|
332
333
|
* @property {string | null} [conditionValue] - The value that is being searched for, default null. Example: "new".
|
|
333
334
|
* @property {string | null} [attributeMarker] - The text identifier of the indexed attribute by which values are filtered, default null. Example: "color".
|
|
334
335
|
* @property {string | null} [conditionMarker] - Marker of the filter condition by which the values are filtered, default null. Example: "equals".
|
|
336
|
+
* @property {string} [langCode] - Language code. Default: "en_US".
|
|
337
|
+
* @property {string} [ids] - Comma-separated list of product ids — used by `getProductsByIds`. Example: "1,2,3".
|
|
335
338
|
* @description This interface defines the structure of a query for retrieving products, including pagination, sorting, and filtering parameters.
|
|
336
339
|
*/
|
|
337
340
|
interface IProductsQuery {
|
|
338
341
|
offset?: number;
|
|
339
342
|
limit?: number;
|
|
343
|
+
langCode?: string;
|
|
344
|
+
ids?: string;
|
|
340
345
|
sortOrder?: 'DESC' | 'ASC' | null;
|
|
341
346
|
sortKey?: 'id' | 'position' | 'title' | 'date' | 'price' | null;
|
|
342
347
|
signPrice?: string;
|
|
@@ -345,7 +350,6 @@ interface IProductsQuery {
|
|
|
345
350
|
conditionValue?: string | null;
|
|
346
351
|
attributeMarker?: string | null;
|
|
347
352
|
conditionMarker?: 'in' /** in - Contains */ | 'nin' /** nin - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | null;
|
|
348
|
-
[key: string]: unknown;
|
|
349
353
|
}
|
|
350
354
|
/**
|
|
351
355
|
* @interface IFilterParams
|
|
@@ -369,24 +373,62 @@ interface IFilterParams {
|
|
|
369
373
|
title?: string;
|
|
370
374
|
isNested?: boolean;
|
|
371
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* @interface IProductAdditional
|
|
378
|
+
* @property {object} prices - Aggregated price range for the product across all variants.
|
|
379
|
+
* @property {number} prices.min - Minimum price value. Example: 5.
|
|
380
|
+
* @property {number} prices.max - Maximum price value. Example: 150.
|
|
381
|
+
* @description Additional indexed values attached to a product entity.
|
|
382
|
+
*/
|
|
383
|
+
interface IProductAdditional {
|
|
384
|
+
prices: IProductPriceRange;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @interface IProductPriceRange
|
|
388
|
+
* @property {number} min - Minimum price across product variants. Example: 5.
|
|
389
|
+
* @property {number} max - Maximum price across product variants. Example: 150.
|
|
390
|
+
* @description Aggregated price range for a product, computed from all its variants.
|
|
391
|
+
*/
|
|
392
|
+
interface IProductPriceRange {
|
|
393
|
+
min: number;
|
|
394
|
+
max: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* @interface IProductPageRef
|
|
398
|
+
* @property {number} id - Unique identifier of the product-to-page link record. Example: 16.
|
|
399
|
+
* @property {number} pageId - Identifier of the page the product is linked to. Example: 4.
|
|
400
|
+
* @property {number} productId - Identifier of the product. Example: 15.
|
|
401
|
+
* @property {number} positionId - Sorting position identifier within the page. Example: 244.
|
|
402
|
+
* @property {string} categoryPath - Category path of the page the product belongs to. Example: "products".
|
|
403
|
+
* @description Reference linking a product to one of the pages it is published on.
|
|
404
|
+
*/
|
|
405
|
+
interface IProductPageRef {
|
|
406
|
+
id: number;
|
|
407
|
+
pageId: number;
|
|
408
|
+
productId: number;
|
|
409
|
+
positionId: number;
|
|
410
|
+
categoryPath: string;
|
|
411
|
+
}
|
|
372
412
|
/**
|
|
373
413
|
* @interface IProductsEntity
|
|
374
414
|
* @property {number} id - The unique identifier. Example: 12345.
|
|
375
415
|
* @property {ILocalizeInfo} localizeInfos - The name of the products, taking into account localization. Example: {}.
|
|
376
416
|
* @property {string | null} statusIdentifier - Product page status identifiers (may be null). Example: "in_stock".
|
|
377
|
-
* @property {
|
|
417
|
+
* @property {ILocalizeInfo} statusLocalizeInfos - Localized status name for the product. Example: `{ "title": "Sale" }`.
|
|
378
418
|
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "set_12345".
|
|
379
419
|
* @property {number} position - Item number (for sorting). Example: 1.
|
|
380
420
|
* @property {number | null} price - The value of the product page price taken from the index. Example: 150.00.
|
|
381
421
|
* @property {object} additional - Additional value from the index.
|
|
382
422
|
* @example
|
|
383
|
-
{
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
423
|
+
`{
|
|
424
|
+
prices: {
|
|
425
|
+
min: 5
|
|
426
|
+
max: 150
|
|
427
|
+
}
|
|
428
|
+
}`
|
|
387
429
|
* @property {string | null} sku - Product SKU (Stock Keeping Unit), may be null. Example: "SKU_12345".
|
|
388
430
|
* @property {boolean} isSync - Indication of page indexing. Example: true.
|
|
389
|
-
* @property {
|
|
431
|
+
* @property {IAttributeValues} attributeValues - Array of attribute values from the index, represented.
|
|
390
432
|
* @example
|
|
391
433
|
[
|
|
392
434
|
{
|
|
@@ -403,7 +445,7 @@ interface IFilterParams {
|
|
|
403
445
|
]
|
|
404
446
|
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
405
447
|
* @property {Array<IFormConfig>} [moduleFormConfigs] - Module form configurations (optional).
|
|
406
|
-
* @property {
|
|
448
|
+
* @property {IRating} [rating] - Rating data.
|
|
407
449
|
* @property {boolean} isPositionLocked - Sorting position lock indicator (optional). Example: false.
|
|
408
450
|
* @property {number[]} relatedIds - Ids of related product pages.
|
|
409
451
|
* @example
|
|
@@ -416,7 +458,17 @@ interface IFilterParams {
|
|
|
416
458
|
* @property {string | null} [templateIdentifier] - User id of the linked template. Example: "template_12345".
|
|
417
459
|
* @property {string | null} [shortDescTemplateIdentifier] - User id of the linked template for a short description. Example: "short_desc_template_12345".
|
|
418
460
|
* @property {string} [signedPrice] - Price sign.
|
|
419
|
-
* @property {
|
|
461
|
+
* @property {IProductPageRef[]} [productPages] - Array of product page references linking the product to its pages.
|
|
462
|
+
* @example
|
|
463
|
+
[
|
|
464
|
+
{
|
|
465
|
+
"id": 16,
|
|
466
|
+
"pageId": 4,
|
|
467
|
+
"productId": 15,
|
|
468
|
+
"positionId": 244,
|
|
469
|
+
"categoryPath": "products"
|
|
470
|
+
}
|
|
471
|
+
]
|
|
420
472
|
* @property {string[]} [blocks] - Array of block identifiers.
|
|
421
473
|
* @example
|
|
422
474
|
[
|
|
@@ -429,27 +481,22 @@ interface IProductsEntity {
|
|
|
429
481
|
id: number;
|
|
430
482
|
localizeInfos: ILocalizeInfo;
|
|
431
483
|
statusIdentifier: string | null;
|
|
432
|
-
statusLocalizeInfos:
|
|
484
|
+
statusLocalizeInfos: ILocalizeInfo;
|
|
433
485
|
attributeSetIdentifier: string | null;
|
|
434
486
|
position: number;
|
|
435
487
|
price: number | null;
|
|
436
|
-
additional:
|
|
437
|
-
prices: {
|
|
438
|
-
min: number;
|
|
439
|
-
max: number;
|
|
440
|
-
};
|
|
441
|
-
};
|
|
488
|
+
additional: IProductAdditional;
|
|
442
489
|
sku: string | null;
|
|
443
490
|
isSync: boolean;
|
|
444
|
-
attributeValues:
|
|
491
|
+
attributeValues: IAttributeValues;
|
|
445
492
|
categories: string[];
|
|
446
493
|
isVisible: boolean;
|
|
447
494
|
moduleFormConfigs?: Array<IFormConfig>;
|
|
448
|
-
rating?:
|
|
495
|
+
rating?: IRating;
|
|
449
496
|
templateIdentifier?: string | null;
|
|
450
497
|
shortDescTemplateIdentifier?: string | null;
|
|
451
498
|
signedPrice?: string;
|
|
452
|
-
productPages?:
|
|
499
|
+
productPages?: IProductPageRef[];
|
|
453
500
|
blocks?: string[];
|
|
454
501
|
isPositionLocked?: boolean;
|
|
455
502
|
relatedIds?: number[];
|
|
@@ -532,12 +579,12 @@ interface IProductInfo {
|
|
|
532
579
|
* @property {number} version - Version of the product block entity. Example: 1.
|
|
533
580
|
* @property {number} position - Position of the product block in a list or layout. Example: 1.
|
|
534
581
|
* @property {string} identifier - Unique string identifier for the product block. Example: "product_block_12345".
|
|
535
|
-
* @property {
|
|
582
|
+
* @property {BlockType} type - Type of the product block, such as "product", "error_page", etc. Example: "product".
|
|
536
583
|
* @property {object} customSettings - Custom settings for the product block, including slider delay, product configuration, similar product rules, and conditions. Example: {}
|
|
537
584
|
* @property {string | null} templateIdentifier - Identifier for the template used by the product block, or null if not applicable. Example: "template_12345".
|
|
538
585
|
* @property {boolean} isVisible - Indicates whether the product block is visible. Example: true.
|
|
539
586
|
* @property {boolean} isSync - Indicates whether the product block is synchronized. Example: false.
|
|
540
|
-
* @property {
|
|
587
|
+
* @property {IAttributeValues} attributeValues - Array of attribute values from the index, represented as a pair of user attribute id and attribute value.
|
|
541
588
|
* @example
|
|
542
589
|
[
|
|
543
590
|
{
|
|
@@ -547,6 +594,52 @@ interface IProductInfo {
|
|
|
547
594
|
]
|
|
548
595
|
* @description This interface defines the structure of a product block entity, including its identifiers, attributes, and custom settings.
|
|
549
596
|
*/
|
|
597
|
+
/**
|
|
598
|
+
* @interface IProductBlockSettings
|
|
599
|
+
* @property {number | null} sliderDelay - Slider auto-advance delay. Example: 5000.
|
|
600
|
+
* @property {string | null} sliderDelayType - Unit of `sliderDelay` (e.g. "ms", "s"). Example: "ms".
|
|
601
|
+
* @property {IProductBlockProductConfig} productConfig - Layout configuration for products inside the block.
|
|
602
|
+
* @property {IProductBlockSimilarRule[]} similarProductRules - Rules used to find similar products.
|
|
603
|
+
* @property {Record<string, unknown>} condition - Filter condition applied to products in the block; field set varies by condition type (e.g. `{ name: "cost", costFrom: 0, costTo: 130 }`).
|
|
604
|
+
* @property {Record<string, unknown> | null} [frequentlyOrderedConfig] - Configuration for the frequently-ordered products feature, or null when not configured.
|
|
605
|
+
* @description Custom settings of a product block — controls layout, sorting and similarity rules.
|
|
606
|
+
*/
|
|
607
|
+
interface IProductBlockSettings {
|
|
608
|
+
sliderDelay: number | null;
|
|
609
|
+
sliderDelayType: string | null;
|
|
610
|
+
productConfig: IProductBlockProductConfig;
|
|
611
|
+
similarProductRules: IProductBlockSimilarRule[];
|
|
612
|
+
condition: Record<string, unknown>;
|
|
613
|
+
frequentlyOrderedConfig?: Record<string, unknown> | null;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* @interface IProductBlockProductConfig
|
|
617
|
+
* @property {string | number} quantity - Number of products to render. Example: 9.
|
|
618
|
+
* @property {string | number} countElementsPerRow - Products per row. Example: 3.
|
|
619
|
+
* @property {string | number} [sortType] - Sort field. Example: "price".
|
|
620
|
+
* @property {string | number} [sortOrder] - Sort direction. Example: "ASC".
|
|
621
|
+
* @description Layout config for products inside a {@link IProductBlock}.
|
|
622
|
+
*/
|
|
623
|
+
interface IProductBlockProductConfig {
|
|
624
|
+
quantity: string | number;
|
|
625
|
+
countElementsPerRow: string | number;
|
|
626
|
+
sortType?: string | number;
|
|
627
|
+
sortOrder?: string | number;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* @interface IProductBlockSimilarRule
|
|
631
|
+
* @property {string} property - Product property to match on. Example: "categories".
|
|
632
|
+
* @property {string} includes - Match strategy (e.g. "any", "all"). Example: "any".
|
|
633
|
+
* @property {string} keywords - Keywords used for the match. Example: "foo,bar".
|
|
634
|
+
* @property {string} strict - Strictness flag ("true"/"false") of the match. Example: "false".
|
|
635
|
+
* @description Single rule used to compute similar products for a {@link IProductBlock}.
|
|
636
|
+
*/
|
|
637
|
+
interface IProductBlockSimilarRule {
|
|
638
|
+
property: string;
|
|
639
|
+
includes: string;
|
|
640
|
+
keywords: string;
|
|
641
|
+
strict: string;
|
|
642
|
+
}
|
|
550
643
|
interface IProductBlock {
|
|
551
644
|
id: number;
|
|
552
645
|
attributeSetIdentifier: string | null;
|
|
@@ -554,28 +647,12 @@ interface IProductBlock {
|
|
|
554
647
|
version: number;
|
|
555
648
|
position: number;
|
|
556
649
|
identifier: string;
|
|
557
|
-
type:
|
|
558
|
-
customSettings:
|
|
559
|
-
sliderDelay: number | null;
|
|
560
|
-
sliderDelayType: string | null;
|
|
561
|
-
productConfig: {
|
|
562
|
-
quantity: string | number;
|
|
563
|
-
countElementsPerRow: string | number;
|
|
564
|
-
sortType?: string | number;
|
|
565
|
-
sortOrder?: string | number;
|
|
566
|
-
};
|
|
567
|
-
similarProductRules: Array<{
|
|
568
|
-
property: string;
|
|
569
|
-
includes: string;
|
|
570
|
-
keywords: string;
|
|
571
|
-
strict: string;
|
|
572
|
-
}>;
|
|
573
|
-
condition: Record<string, unknown>;
|
|
574
|
-
};
|
|
650
|
+
type: BlockType;
|
|
651
|
+
customSettings: IProductBlockSettings;
|
|
575
652
|
templateIdentifier: string | null;
|
|
576
653
|
isVisible: boolean;
|
|
577
654
|
isSync: boolean;
|
|
578
|
-
attributeValues:
|
|
655
|
+
attributeValues: IAttributeValues;
|
|
579
656
|
}
|
|
580
657
|
/**
|
|
581
658
|
* @interface IAggregatedProductGroup
|
|
@@ -33,7 +33,12 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
33
33
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
34
34
|
position: z.ZodNumber;
|
|
35
35
|
price: z.ZodNullable<z.ZodNumber>;
|
|
36
|
-
additional: z.
|
|
36
|
+
additional: z.ZodObject<{
|
|
37
|
+
prices: z.ZodObject<{
|
|
38
|
+
min: z.ZodNumber;
|
|
39
|
+
max: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
}, z.core.$strip>;
|
|
37
42
|
sku: z.ZodNullable<z.ZodString>;
|
|
38
43
|
isSync: z.ZodBoolean;
|
|
39
44
|
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -44,7 +49,13 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
44
49
|
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
45
50
|
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
46
51
|
signedPrice: z.ZodOptional<z.ZodString>;
|
|
47
|
-
productPages: z.ZodOptional<z.ZodArray<z.
|
|
52
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53
|
+
id: z.ZodNumber;
|
|
54
|
+
pageId: z.ZodNumber;
|
|
55
|
+
productId: z.ZodNumber;
|
|
56
|
+
positionId: z.ZodNumber;
|
|
57
|
+
categoryPath: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
48
59
|
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
60
|
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
50
61
|
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
@@ -63,7 +74,12 @@ export declare const ProductsResponseSchema: z.ZodObject<{
|
|
|
63
74
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
64
75
|
position: z.ZodNumber;
|
|
65
76
|
price: z.ZodNullable<z.ZodNumber>;
|
|
66
|
-
additional: z.
|
|
77
|
+
additional: z.ZodObject<{
|
|
78
|
+
prices: z.ZodObject<{
|
|
79
|
+
min: z.ZodNumber;
|
|
80
|
+
max: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
67
83
|
sku: z.ZodNullable<z.ZodString>;
|
|
68
84
|
isSync: z.ZodBoolean;
|
|
69
85
|
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -74,7 +90,13 @@ export declare const ProductsResponseSchema: z.ZodObject<{
|
|
|
74
90
|
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
75
91
|
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
76
92
|
signedPrice: z.ZodOptional<z.ZodString>;
|
|
77
|
-
productPages: z.ZodOptional<z.ZodArray<z.
|
|
93
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
id: z.ZodNumber;
|
|
95
|
+
pageId: z.ZodNumber;
|
|
96
|
+
productId: z.ZodNumber;
|
|
97
|
+
positionId: z.ZodNumber;
|
|
98
|
+
categoryPath: z.ZodString;
|
|
99
|
+
}, z.core.$strip>>>;
|
|
78
100
|
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
79
101
|
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
80
102
|
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
@@ -94,7 +116,12 @@ export declare const SingleProductSchema: z.ZodObject<{
|
|
|
94
116
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
95
117
|
position: z.ZodNumber;
|
|
96
118
|
price: z.ZodNullable<z.ZodNumber>;
|
|
97
|
-
additional: z.
|
|
119
|
+
additional: z.ZodObject<{
|
|
120
|
+
prices: z.ZodObject<{
|
|
121
|
+
min: z.ZodNumber;
|
|
122
|
+
max: z.ZodNumber;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>;
|
|
98
125
|
sku: z.ZodNullable<z.ZodString>;
|
|
99
126
|
isSync: z.ZodBoolean;
|
|
100
127
|
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -105,7 +132,13 @@ export declare const SingleProductSchema: z.ZodObject<{
|
|
|
105
132
|
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
106
133
|
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
107
134
|
signedPrice: z.ZodOptional<z.ZodString>;
|
|
108
|
-
productPages: z.ZodOptional<z.ZodArray<z.
|
|
135
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
136
|
+
id: z.ZodNumber;
|
|
137
|
+
pageId: z.ZodNumber;
|
|
138
|
+
productId: z.ZodNumber;
|
|
139
|
+
positionId: z.ZodNumber;
|
|
140
|
+
categoryPath: z.ZodString;
|
|
141
|
+
}, z.core.$strip>>>;
|
|
109
142
|
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
143
|
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
111
144
|
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
@@ -148,7 +181,12 @@ export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
|
|
|
148
181
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
149
182
|
position: z.ZodNumber;
|
|
150
183
|
price: z.ZodNullable<z.ZodNumber>;
|
|
151
|
-
additional: z.
|
|
184
|
+
additional: z.ZodObject<{
|
|
185
|
+
prices: z.ZodObject<{
|
|
186
|
+
min: z.ZodNumber;
|
|
187
|
+
max: z.ZodNumber;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
}, z.core.$strip>;
|
|
152
190
|
sku: z.ZodNullable<z.ZodString>;
|
|
153
191
|
isSync: z.ZodBoolean;
|
|
154
192
|
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -159,7 +197,13 @@ export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
|
|
|
159
197
|
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
160
198
|
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
161
199
|
signedPrice: z.ZodOptional<z.ZodString>;
|
|
162
|
-
productPages: z.ZodOptional<z.ZodArray<z.
|
|
200
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
201
|
+
id: z.ZodNumber;
|
|
202
|
+
pageId: z.ZodNumber;
|
|
203
|
+
productId: z.ZodNumber;
|
|
204
|
+
positionId: z.ZodNumber;
|
|
205
|
+
categoryPath: z.ZodString;
|
|
206
|
+
}, z.core.$strip>>>;
|
|
163
207
|
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
208
|
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
165
209
|
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
@@ -36,7 +36,12 @@ exports.ProductEntitySchema = zod_1.z.object({
|
|
|
36
36
|
attributeSetIdentifier: zod_1.z.string().nullable(),
|
|
37
37
|
position: zod_1.z.number(),
|
|
38
38
|
price: zod_1.z.number().nullable(),
|
|
39
|
-
additional: zod_1.z.
|
|
39
|
+
additional: zod_1.z.object({
|
|
40
|
+
prices: zod_1.z.object({
|
|
41
|
+
min: zod_1.z.number(),
|
|
42
|
+
max: zod_1.z.number(),
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
40
45
|
sku: zod_1.z.string().nullable(),
|
|
41
46
|
isSync: zod_1.z.boolean(),
|
|
42
47
|
attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
@@ -47,7 +52,15 @@ exports.ProductEntitySchema = zod_1.z.object({
|
|
|
47
52
|
templateIdentifier: zod_1.z.string().optional().nullable(),
|
|
48
53
|
shortDescTemplateIdentifier: zod_1.z.string().optional().nullable(),
|
|
49
54
|
signedPrice: zod_1.z.string().optional(),
|
|
50
|
-
productPages: zod_1.z
|
|
55
|
+
productPages: zod_1.z
|
|
56
|
+
.array(zod_1.z.object({
|
|
57
|
+
id: zod_1.z.number(),
|
|
58
|
+
pageId: zod_1.z.number(),
|
|
59
|
+
productId: zod_1.z.number(),
|
|
60
|
+
positionId: zod_1.z.number(),
|
|
61
|
+
categoryPath: zod_1.z.string(),
|
|
62
|
+
}))
|
|
63
|
+
.optional(),
|
|
51
64
|
blocks: zod_1.z.array(zod_1.z.string()).optional(),
|
|
52
65
|
isPositionLocked: zod_1.z.boolean().optional(),
|
|
53
66
|
relatedIds: zod_1.z.array(zod_1.z.number()).optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type { ISitemapApi,
|
|
4
|
+
import type { ISitemapApi, ISitemapQuery } from './sitemapInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with sitemaps.
|
|
7
7
|
* @handle /api/content/sitemap
|
|
@@ -27,9 +27,9 @@ export default class SitemapApi extends AsyncModules implements ISitemapApi {
|
|
|
27
27
|
/**
|
|
28
28
|
* Generates a new set of sitemaps.
|
|
29
29
|
* @handleName updateSitemap
|
|
30
|
-
* @param {
|
|
31
|
-
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
30
|
+
* @param {ISitemapQuery} body - Sitemap body params (e.g. `{ baseUrls: { en_US: "https://…" } }`).
|
|
31
|
+
* @returns {Promise<string[] | IError>} Returns an array of generated sitemap URLs.
|
|
32
32
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
33
33
|
*/
|
|
34
|
-
updateSitemap(body:
|
|
34
|
+
updateSitemap(body: ISitemapQuery): Promise<string[] | IError>;
|
|
35
35
|
}
|
|
@@ -33,8 +33,8 @@ class SitemapApi extends asyncModules_1.default {
|
|
|
33
33
|
/**
|
|
34
34
|
* Generates a new set of sitemaps.
|
|
35
35
|
* @handleName updateSitemap
|
|
36
|
-
* @param {
|
|
37
|
-
* @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
|
|
36
|
+
* @param {ISitemapQuery} body - Sitemap body params (e.g. `{ baseUrls: { en_US: "https://…" } }`).
|
|
37
|
+
* @returns {Promise<string[] | IError>} Returns an array of generated sitemap URLs.
|
|
38
38
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
39
39
|
*/
|
|
40
40
|
async updateSitemap(body) {
|
|
@@ -13,24 +13,26 @@ interface ISitemapApi {
|
|
|
13
13
|
/**
|
|
14
14
|
* Generates a new set of sitemaps.
|
|
15
15
|
* @handleName updateSitemap
|
|
16
|
-
* @param {
|
|
17
|
-
* @returns {Promise<
|
|
16
|
+
* @param {ISitemapQuery} body - Sitemap body params.
|
|
17
|
+
* @returns {Promise<string[] | IError>} Returns an array of generated sitemap URLs.
|
|
18
18
|
*/
|
|
19
|
-
updateSitemap(body:
|
|
19
|
+
updateSitemap(body: ISitemapQuery): Promise<string[] | IError>;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Query parameters for sitemap requests.
|
|
23
23
|
* @interface ISitemapQuery
|
|
24
|
-
* @property {string}
|
|
25
|
-
* @property {string}
|
|
26
|
-
* @property {string}
|
|
27
|
-
* @property {
|
|
24
|
+
* @property {Record<string, string>} [baseUrls] - Base URLs per language for sitemap generation. Example: `{ "en_US": "https://example.com/" }`.
|
|
25
|
+
* @property {string} [url] - URL of a single sitemap entry.
|
|
26
|
+
* @property {string} [lastmod] - Last modification date of the entry.
|
|
27
|
+
* @property {string} [changefreq] - Frequency of changes for the entry.
|
|
28
|
+
* @property {number} [priority] - Priority of the entry.
|
|
28
29
|
*/
|
|
29
30
|
interface ISitemapQuery {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
baseUrls?: Record<string, string>;
|
|
32
|
+
url?: string;
|
|
33
|
+
lastmod?: string;
|
|
34
|
+
changefreq?: string;
|
|
35
|
+
priority?: number;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Entity interface for sitemap.
|
|
@@ -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
|
*/
|
|
@@ -35,16 +35,21 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
35
35
|
// Validate response if validation is enabled
|
|
36
36
|
const validated = this._validateResponse(response, templatesSchemas_1.GroupedTemplatesResponseSchema);
|
|
37
37
|
const result = {};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (validated &&
|
|
39
|
+
typeof validated === 'object' &&
|
|
40
|
+
!('statusCode' in validated)) {
|
|
41
|
+
const grouped = validated;
|
|
42
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
43
|
+
for (const item in grouped) {
|
|
44
|
+
result[item] = this._normalizeData(grouped[item], langCode);
|
|
45
|
+
}
|
|
41
46
|
}
|
|
42
47
|
return result;
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Get template objects by type.
|
|
46
51
|
* @handleName getTemplateByType
|
|
47
|
-
* @param {
|
|
52
|
+
* @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
48
53
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
49
54
|
* @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
|
|
50
55
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
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,8 +44,8 @@ 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 {
|
|
47
|
+
* @property {BlockType} generalTypeName - General type name. Example: "product".
|
|
48
|
+
* @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
|
|
48
49
|
* @example
|
|
49
50
|
{
|
|
50
51
|
"id": 1,
|
|
@@ -60,8 +61,8 @@ interface ITemplateEntity {
|
|
|
60
61
|
generalTypeId: number;
|
|
61
62
|
identifier: string;
|
|
62
63
|
version: number;
|
|
63
|
-
generalTypeName:
|
|
64
|
-
attributeValues:
|
|
64
|
+
generalTypeName: BlockType;
|
|
65
|
+
attributeValues: IAttributeValues;
|
|
65
66
|
position: number;
|
|
66
67
|
}
|
|
67
68
|
export type { ITemplateEntity, ITemplatesApi };
|