@fiado/type-kit 3.512.0 → 3.513.0

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 (27) hide show
  1. package/_test_/unit/retailPromotions/activeSalePromotionsBySkus.test.ts +58 -0
  2. package/bin/retailCatalog/dtos/responses/GetInventorySkuResponse.d.ts +9 -0
  3. package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +10 -0
  4. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.d.ts +5 -0
  5. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.js +9 -0
  6. package/bin/retailCatalog/index.d.ts +1 -0
  7. package/bin/retailCatalog/index.js +1 -0
  8. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.d.ts +2 -0
  9. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.js +5 -0
  10. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.d.ts +17 -0
  11. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.js +69 -0
  12. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.d.ts +26 -0
  13. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.js +2 -0
  14. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.d.ts +9 -0
  15. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.js +13 -0
  16. package/bin/retailPromotions/index.d.ts +4 -0
  17. package/bin/retailPromotions/index.js +4 -0
  18. package/package.json +1 -1
  19. package/src/retailCatalog/dtos/responses/GetInventorySkuResponse.ts +10 -0
  20. package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +12 -0
  21. package/src/retailCatalog/enums/CatalogSourceStatusEnum.ts +5 -0
  22. package/src/retailCatalog/index.ts +1 -0
  23. package/src/retailPromotions/constants/activeSalePromotionsBySkus.ts +2 -0
  24. package/src/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.ts +50 -0
  25. package/src/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.ts +29 -0
  26. package/src/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.ts +9 -0
  27. package/src/retailPromotions/index.ts +4 -0
@@ -0,0 +1,58 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import {
5
+ ACTIVE_SALE_PROMOTIONS_MAX_SKUS,
6
+ ActiveSalePromotionsBySkusRequest,
7
+ SkuSalePromotionLookupStatusEnum,
8
+ } from '../../../src/retailPromotions/index';
9
+ import type { ActiveSalePromotionsBySkusResponse } from '../../../src/retailPromotions/index';
10
+ import { CatalogSourceStatusEnum } from '../../../src/retailCatalog/index';
11
+ import type { GetInventorySkuResponse, InventoryLensListItem, InventoryLensResponse } from '../../../src/retailCatalog/index';
12
+
13
+ const errorsOf = async (body: object) =>
14
+ (await validate(plainToInstance(ActiveSalePromotionsBySkusRequest, body, { excludeExtraneousValues: true }))).map((e) => e.property);
15
+
16
+ const valid = { tenantId: 'SUREKEEP', retailerId: 'ret-1', items: [{ sku: 'SKU-1', category: 'PHONE', tier: 'MID' }] };
17
+
18
+ describe('ActiveSalePromotionsBySkusRequest', () => {
19
+ it('acepta tenant, cadena, tienda opcional y SKUs con tipo y gama opcionales', async () => {
20
+ expect(await errorsOf(valid)).toEqual([]);
21
+ expect(await errorsOf({ ...valid, storeId: 'st-1', items: [{ sku: 'SKU-2' }] })).toEqual([]);
22
+ });
23
+
24
+ it('un SKU vacío no tumba el lote: se resuelve como INVALID_ID por entrada', async () => {
25
+ expect(await errorsOf({ ...valid, items: [{ sku: '' }] })).toEqual([]);
26
+ });
27
+
28
+ it.each([
29
+ ['sin tenantId', { ...valid, tenantId: undefined }, 'tenantId'],
30
+ ['sin retailerId', { ...valid, retailerId: '' }, 'retailerId'],
31
+ ['sin items', { ...valid, items: undefined }, 'items'],
32
+ ['tipo fuera del enum', { ...valid, items: [{ sku: 'A', category: 'CAR' }] }, 'items'],
33
+ ])('rechaza %s', async (_l, body, property) => {
34
+ expect(await errorsOf(body)).toContain(property);
35
+ });
36
+
37
+ it(`rechaza más de ${ACTIVE_SALE_PROMOTIONS_MAX_SKUS} SKUs`, async () => {
38
+ const items = Array.from({ length: ACTIVE_SALE_PROMOTIONS_MAX_SKUS + 1 }, (_v, i) => ({ sku: `S${i}` }));
39
+ expect(await errorsOf({ ...valid, items })).toContain('items');
40
+ });
41
+ });
42
+
43
+ describe('contratos de promos vigentes por SKU', () => {
44
+ it('una entrada por SKU con su estado y sus promos', () => {
45
+ const response: ActiveSalePromotionsBySkusResponse = {
46
+ items: [{ sku: 'SKU-1', status: SkuSalePromotionLookupStatusEnum.OK, promotions: [] }],
47
+ };
48
+ expect(Object.values(SkuSalePromotionLookupStatusEnum)).toEqual(['OK', 'UNAVAILABLE', 'INVALID_ID']);
49
+ expect(response.items[0]?.status).toBe('OK');
50
+ });
51
+
52
+ it('la ficha y el lente del catálogo llevan las promos y el estado de su fuente', () => {
53
+ const sku: Pick<GetInventorySkuResponse, 'promotions' | 'sources'> = { promotions: null, sources: { promotions: CatalogSourceStatusEnum.UNAVAILABLE } };
54
+ const row: Pick<InventoryLensListItem, 'hasPromotion' | 'promotionNames'> = { hasPromotion: true, promotionNames: ['Hot Sale'] };
55
+ const lens: Pick<InventoryLensResponse, 'sources'> = { sources: { promotions: CatalogSourceStatusEnum.OK } };
56
+ expect([sku.sources?.promotions, row.promotionNames, lens.sources?.promotions]).toEqual(['UNAVAILABLE', ['Hot Sale'], 'OK']);
57
+ });
58
+ });
@@ -2,6 +2,8 @@ import type { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnu
2
2
  import type { InventoryMovementTypeEnum } from '../../enums/InventoryMovementTypeEnum';
3
3
  import type { InventoryMovementReasonEnum } from '../../enums/InventoryMovementReasonEnum';
4
4
  import type { SkuPriceEntry } from './SkuPriceEntry';
5
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
6
+ import type { ActiveSalePromotionSummary } from '../../../retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse';
5
7
  /** Un movimiento del libro de inventario. */
6
8
  export interface InventoryMovementEntry {
7
9
  storeId: string;
@@ -36,4 +38,11 @@ export interface GetInventorySkuResponse {
36
38
  /** Vacío si el SKU se rastrea por cantidad. */
37
39
  piecesByStore: InventoryStorePieces[];
38
40
  currentPrice: SkuPriceEntry | null;
41
+ /** Promos de venta vigentes del SKU; `null` si retail-promotions no respondió. */
42
+ promotions?: ActiveSalePromotionSummary[] | null;
43
+ sources?: InventorySkuSources;
44
+ }
45
+ /** Estado de las fuentes externas de la ficha. */
46
+ export interface InventorySkuSources {
47
+ promotions: CatalogSourceStatusEnum;
39
48
  }
@@ -5,6 +5,7 @@ import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { InventoryLensUnavailableReasonEnum } from '../../enums/InventoryLensUnavailableReasonEnum';
6
6
  import type { InventoryTransferReasonEnum } from '../../enums/InventoryTransferReasonEnum';
7
7
  import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
8
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
8
9
  /**
9
10
  * Los contadores que la pantalla «Inventario» del Admin VL pinta arriba, siempre — los cuatro viajan
10
11
  * con cualquier `filter`, porque las tarjetas no cambian al cambiar de tab.
@@ -115,6 +116,10 @@ export interface InventoryLensListItem {
115
116
  sold30d: number;
116
117
  /** Producto físico o servicio. Ausente = PRODUCT. */
117
118
  itemType?: ItemTypeEnum;
119
+ /** Tiene al menos una promo de venta vigente; `null` si retail-promotions no respondió. */
120
+ hasPromotion?: boolean | null;
121
+ /** Nombres de sus promos de venta vigentes; `null` si retail-promotions no respondió. */
122
+ promotionNames?: string[] | null;
118
123
  }
119
124
  /** Fila del lente — el tipo depende del tab pedido. */
120
125
  export type InventoryLensItem = InventoryLensSkuItem | InventoryLensTransferSuggestion | InventoryLensListItem;
@@ -147,4 +152,9 @@ export interface InventoryLensResponse {
147
152
  unavailable?: boolean;
148
153
  /** Por qué no se pudo. Presente solo junto a `unavailable: true`. */
149
154
  reason?: InventoryLensUnavailableReasonEnum;
155
+ /** Estado de las fuentes externas; solo en el modo `list`. */
156
+ sources?: InventoryLensSources;
157
+ }
158
+ export interface InventoryLensSources {
159
+ promotions: CatalogSourceStatusEnum;
150
160
  }
@@ -0,0 +1,5 @@
1
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
2
+ export declare enum CatalogSourceStatusEnum {
3
+ OK = "OK",
4
+ UNAVAILABLE = "UNAVAILABLE"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CatalogSourceStatusEnum = void 0;
4
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
5
+ var CatalogSourceStatusEnum;
6
+ (function (CatalogSourceStatusEnum) {
7
+ CatalogSourceStatusEnum["OK"] = "OK";
8
+ CatalogSourceStatusEnum["UNAVAILABLE"] = "UNAVAILABLE";
9
+ })(CatalogSourceStatusEnum || (exports.CatalogSourceStatusEnum = CatalogSourceStatusEnum = {}));
@@ -36,6 +36,7 @@ export * from './enums/InventorySyncResultStatusEnum';
36
36
  export * from './enums/InventorySyncRejectionCodeEnum';
37
37
  export * from './enums/PriceSourceEnum';
38
38
  export * from './enums/InventoryLensPeriodEnum';
39
+ export * from './enums/CatalogSourceStatusEnum';
39
40
  export * from './dtos/ProductComponent';
40
41
  export * from './dtos/requests/ReservationLineRef';
41
42
  export * from './dtos/requests/StockLine';
@@ -60,6 +60,7 @@ __exportStar(require("./enums/InventorySyncResultStatusEnum"), exports);
60
60
  __exportStar(require("./enums/InventorySyncRejectionCodeEnum"), exports);
61
61
  __exportStar(require("./enums/PriceSourceEnum"), exports);
62
62
  __exportStar(require("./enums/InventoryLensPeriodEnum"), exports);
63
+ __exportStar(require("./enums/CatalogSourceStatusEnum"), exports);
63
64
  __exportStar(require("./dtos/ProductComponent"), exports);
64
65
  __exportStar(require("./dtos/requests/ReservationLineRef"), exports);
65
66
  __exportStar(require("./dtos/requests/StockLine"), exports);
@@ -0,0 +1,2 @@
1
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
2
+ export declare const ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACTIVE_SALE_PROMOTIONS_MAX_SKUS = void 0;
4
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
5
+ exports.ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,17 @@
1
+ import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
2
+ import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
3
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
4
+ export declare class ActiveSalePromotionsSkuInput {
5
+ /** Un SKU vacío no invalida el lote: sale como `INVALID_ID`. */
6
+ sku: string;
7
+ category?: ProductCategoryEnum | null;
8
+ tier?: ProductTierEnum | null;
9
+ }
10
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
11
+ export declare class ActiveSalePromotionsBySkusRequest {
12
+ tenantId: string;
13
+ retailerId: string;
14
+ /** Con tienda, solo las promos cuyo alcance la incluye; sin ella, las de cualquier tienda. */
15
+ storeId?: string;
16
+ items: ActiveSalePromotionsSkuInput[];
17
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ActiveSalePromotionsBySkusRequest = exports.ActiveSalePromotionsSkuInput = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const ProductCategoryEnum_1 = require("../../../retailCatalog/enums/ProductCategoryEnum");
16
+ const ProductTierEnum_1 = require("../../../retailCatalog/enums/ProductTierEnum");
17
+ const activeSalePromotionsBySkus_1 = require("../../constants/activeSalePromotionsBySkus");
18
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
19
+ class ActiveSalePromotionsSkuInput {
20
+ }
21
+ exports.ActiveSalePromotionsSkuInput = ActiveSalePromotionsSkuInput;
22
+ __decorate([
23
+ (0, class_transformer_1.Expose)(),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], ActiveSalePromotionsSkuInput.prototype, "sku", void 0);
27
+ __decorate([
28
+ (0, class_transformer_1.Expose)(),
29
+ (0, class_validator_1.IsOptional)(),
30
+ (0, class_validator_1.IsEnum)(ProductCategoryEnum_1.ProductCategoryEnum),
31
+ __metadata("design:type", String)
32
+ ], ActiveSalePromotionsSkuInput.prototype, "category", void 0);
33
+ __decorate([
34
+ (0, class_transformer_1.Expose)(),
35
+ (0, class_validator_1.IsOptional)(),
36
+ (0, class_validator_1.IsEnum)(ProductTierEnum_1.ProductTierEnum),
37
+ __metadata("design:type", String)
38
+ ], ActiveSalePromotionsSkuInput.prototype, "tier", void 0);
39
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
40
+ class ActiveSalePromotionsBySkusRequest {
41
+ }
42
+ exports.ActiveSalePromotionsBySkusRequest = ActiveSalePromotionsBySkusRequest;
43
+ __decorate([
44
+ (0, class_transformer_1.Expose)(),
45
+ (0, class_validator_1.IsString)(),
46
+ (0, class_validator_1.IsNotEmpty)(),
47
+ __metadata("design:type", String)
48
+ ], ActiveSalePromotionsBySkusRequest.prototype, "tenantId", void 0);
49
+ __decorate([
50
+ (0, class_transformer_1.Expose)(),
51
+ (0, class_validator_1.IsString)(),
52
+ (0, class_validator_1.IsNotEmpty)(),
53
+ __metadata("design:type", String)
54
+ ], ActiveSalePromotionsBySkusRequest.prototype, "retailerId", void 0);
55
+ __decorate([
56
+ (0, class_transformer_1.Expose)(),
57
+ (0, class_validator_1.IsOptional)(),
58
+ (0, class_validator_1.IsString)(),
59
+ (0, class_validator_1.IsNotEmpty)(),
60
+ __metadata("design:type", String)
61
+ ], ActiveSalePromotionsBySkusRequest.prototype, "storeId", void 0);
62
+ __decorate([
63
+ (0, class_transformer_1.Expose)(),
64
+ (0, class_validator_1.IsArray)(),
65
+ (0, class_validator_1.ArrayMaxSize)(activeSalePromotionsBySkus_1.ACTIVE_SALE_PROMOTIONS_MAX_SKUS),
66
+ (0, class_validator_1.ValidateNested)({ each: true }),
67
+ (0, class_transformer_1.Type)(() => ActiveSalePromotionsSkuInput),
68
+ __metadata("design:type", Array)
69
+ ], ActiveSalePromotionsBySkusRequest.prototype, "items", void 0);
@@ -0,0 +1,26 @@
1
+ import type { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from '../SalePromotionLevers';
2
+ import type { SkuSalePromotionLookupStatusEnum } from '../../enums/SkuSalePromotionLookupStatusEnum';
3
+ /** Promo de venta vigente hoy que alcanza al SKU, con su contenido de la versión actual. */
4
+ export interface ActiveSalePromotionSummary {
5
+ promotionId: string;
6
+ name: string;
7
+ /** Palancas en español: «$500 de descuento + 3× $50 de tiempo aire + $300 al Wallet Fiado». */
8
+ benefitSummary: string;
9
+ levers: SalePromotionLevers;
10
+ /** `null` = arrancó al publicarse. */
11
+ validFrom: string | null;
12
+ /** `null` = permanente. */
13
+ validUntil: string | null;
14
+ segmentation: SalePromotionSegmentation;
15
+ scope: SalePromotionScope;
16
+ }
17
+ export interface SkuActiveSalePromotions {
18
+ sku: string;
19
+ status: SkuSalePromotionLookupStatusEnum;
20
+ /** Vacío si no tiene ninguna o si el estado no es `OK`. */
21
+ promotions: ActiveSalePromotionSummary[];
22
+ }
23
+ /** Response de `POST /private/sale-promotions/active-by-skus`: una entrada por SKU, en el orden pedido. */
24
+ export interface ActiveSalePromotionsBySkusResponse {
25
+ items: SkuActiveSalePromotions[];
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
2
+ export declare enum SkuSalePromotionLookupStatusEnum {
3
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
4
+ OK = "OK",
5
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
6
+ UNAVAILABLE = "UNAVAILABLE",
7
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
8
+ INVALID_ID = "INVALID_ID"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SkuSalePromotionLookupStatusEnum = void 0;
4
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
5
+ var SkuSalePromotionLookupStatusEnum;
6
+ (function (SkuSalePromotionLookupStatusEnum) {
7
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
8
+ SkuSalePromotionLookupStatusEnum["OK"] = "OK";
9
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
10
+ SkuSalePromotionLookupStatusEnum["UNAVAILABLE"] = "UNAVAILABLE";
11
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
12
+ SkuSalePromotionLookupStatusEnum["INVALID_ID"] = "INVALID_ID";
13
+ })(SkuSalePromotionLookupStatusEnum || (exports.SkuSalePromotionLookupStatusEnum = SkuSalePromotionLookupStatusEnum = {}));
@@ -17,9 +17,11 @@ export * from './enums/EntitlementKindEnum';
17
17
  export * from './enums/SaleCouponAvailabilityEnum';
18
18
  export * from './enums/RetailPromotionsErrorCodeEnum';
19
19
  export * from './enums/SalePromotionKindEnum';
20
+ export * from './enums/SkuSalePromotionLookupStatusEnum';
20
21
  export * from './constants/retailPromotionsErrorHttpStatus';
21
22
  export * from './constants/salePromotionTransitions';
22
23
  export * from './constants/bonusPreMoney';
24
+ export * from './constants/activeSalePromotionsBySkus';
23
25
  export * from './helpers/resolveSalePromotionTransition';
24
26
  export * from './helpers/computeBudgetUsedBps';
25
27
  export * from './helpers/resolveSalePromotionKind';
@@ -50,8 +52,10 @@ export * from './dtos/requests/HoldPromotionInput';
50
52
  export * from './dtos/requests/HoldSalePromotionRequest';
51
53
  export * from './dtos/requests/GetSaleCouponQuery';
52
54
  export * from './dtos/requests/SkuSalePromotionsQuery';
55
+ export * from './dtos/requests/ActiveSalePromotionsBySkusRequest';
53
56
  export * from './dtos/responses/SalePromotionCrudResponses';
54
57
  export * from './dtos/responses/DiscountCodeResponses';
55
58
  export * from './dtos/responses/WizardSalePromotionResponses';
56
59
  export * from './dtos/responses/SkuSalePromotionsResponse';
57
60
  export * from './dtos/responses/SalePromotionSegmentsResponse';
61
+ export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';
@@ -34,10 +34,12 @@ __exportStar(require("./enums/EntitlementKindEnum"), exports);
34
34
  __exportStar(require("./enums/SaleCouponAvailabilityEnum"), exports);
35
35
  __exportStar(require("./enums/RetailPromotionsErrorCodeEnum"), exports);
36
36
  __exportStar(require("./enums/SalePromotionKindEnum"), exports);
37
+ __exportStar(require("./enums/SkuSalePromotionLookupStatusEnum"), exports);
37
38
  // Constantes y helpers puros
38
39
  __exportStar(require("./constants/retailPromotionsErrorHttpStatus"), exports);
39
40
  __exportStar(require("./constants/salePromotionTransitions"), exports);
40
41
  __exportStar(require("./constants/bonusPreMoney"), exports);
42
+ __exportStar(require("./constants/activeSalePromotionsBySkus"), exports);
41
43
  __exportStar(require("./helpers/resolveSalePromotionTransition"), exports);
42
44
  __exportStar(require("./helpers/computeBudgetUsedBps"), exports);
43
45
  __exportStar(require("./helpers/resolveSalePromotionKind"), exports);
@@ -71,9 +73,11 @@ __exportStar(require("./dtos/requests/HoldPromotionInput"), exports);
71
73
  __exportStar(require("./dtos/requests/HoldSalePromotionRequest"), exports);
72
74
  __exportStar(require("./dtos/requests/GetSaleCouponQuery"), exports);
73
75
  __exportStar(require("./dtos/requests/SkuSalePromotionsQuery"), exports);
76
+ __exportStar(require("./dtos/requests/ActiveSalePromotionsBySkusRequest"), exports);
74
77
  // Response DTOs
75
78
  __exportStar(require("./dtos/responses/SalePromotionCrudResponses"), exports);
76
79
  __exportStar(require("./dtos/responses/DiscountCodeResponses"), exports);
77
80
  __exportStar(require("./dtos/responses/WizardSalePromotionResponses"), exports);
78
81
  __exportStar(require("./dtos/responses/SkuSalePromotionsResponse"), exports);
79
82
  __exportStar(require("./dtos/responses/SalePromotionSegmentsResponse"), exports);
83
+ __exportStar(require("./dtos/responses/ActiveSalePromotionsBySkusResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.512.0",
3
+ "version": "3.513.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -2,6 +2,8 @@ import type { InventoryItemStatusEnum } from '../../enums/InventoryItemStatusEnu
2
2
  import type { InventoryMovementTypeEnum } from '../../enums/InventoryMovementTypeEnum';
3
3
  import type { InventoryMovementReasonEnum } from '../../enums/InventoryMovementReasonEnum';
4
4
  import type { SkuPriceEntry } from './SkuPriceEntry';
5
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
6
+ import type { ActiveSalePromotionSummary } from '../../../retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse';
5
7
 
6
8
  /** Un movimiento del libro de inventario. */
7
9
  export interface InventoryMovementEntry {
@@ -40,4 +42,12 @@ export interface GetInventorySkuResponse {
40
42
  /** Vacío si el SKU se rastrea por cantidad. */
41
43
  piecesByStore: InventoryStorePieces[];
42
44
  currentPrice: SkuPriceEntry | null;
45
+ /** Promos de venta vigentes del SKU; `null` si retail-promotions no respondió. */
46
+ promotions?: ActiveSalePromotionSummary[] | null;
47
+ sources?: InventorySkuSources;
48
+ }
49
+
50
+ /** Estado de las fuentes externas de la ficha. */
51
+ export interface InventorySkuSources {
52
+ promotions: CatalogSourceStatusEnum;
43
53
  }
@@ -5,6 +5,7 @@ import type { ProductTierEnum } from '../../enums/ProductTierEnum';
5
5
  import type { InventoryLensUnavailableReasonEnum } from '../../enums/InventoryLensUnavailableReasonEnum';
6
6
  import type { InventoryTransferReasonEnum } from '../../enums/InventoryTransferReasonEnum';
7
7
  import type { ItemTypeEnum } from '../../enums/ItemTypeEnum';
8
+ import type { CatalogSourceStatusEnum } from '../../enums/CatalogSourceStatusEnum';
8
9
 
9
10
  /**
10
11
  * Los contadores que la pantalla «Inventario» del Admin VL pinta arriba, siempre — los cuatro viajan
@@ -130,6 +131,10 @@ export interface InventoryLensListItem {
130
131
  sold30d: number;
131
132
  /** Producto físico o servicio. Ausente = PRODUCT. */
132
133
  itemType?: ItemTypeEnum;
134
+ /** Tiene al menos una promo de venta vigente; `null` si retail-promotions no respondió. */
135
+ hasPromotion?: boolean | null;
136
+ /** Nombres de sus promos de venta vigentes; `null` si retail-promotions no respondió. */
137
+ promotionNames?: string[] | null;
133
138
  }
134
139
 
135
140
  /** Fila del lente — el tipo depende del tab pedido. */
@@ -169,4 +174,11 @@ export interface InventoryLensResponse {
169
174
 
170
175
  /** Por qué no se pudo. Presente solo junto a `unavailable: true`. */
171
176
  reason?: InventoryLensUnavailableReasonEnum;
177
+
178
+ /** Estado de las fuentes externas; solo en el modo `list`. */
179
+ sources?: InventoryLensSources;
180
+ }
181
+
182
+ export interface InventoryLensSources {
183
+ promotions: CatalogSourceStatusEnum;
172
184
  }
@@ -0,0 +1,5 @@
1
+ /** Si una fuente externa de una respuesta del catálogo contestó (`OK`) o falló (`UNAVAILABLE`). */
2
+ export enum CatalogSourceStatusEnum {
3
+ OK = 'OK',
4
+ UNAVAILABLE = 'UNAVAILABLE',
5
+ }
@@ -52,6 +52,7 @@ export * from './enums/InventorySyncResultStatusEnum';
52
52
  export * from './enums/InventorySyncRejectionCodeEnum';
53
53
  export * from './enums/PriceSourceEnum';
54
54
  export * from './enums/InventoryLensPeriodEnum';
55
+ export * from './enums/CatalogSourceStatusEnum';
55
56
  export * from './dtos/ProductComponent';
56
57
  export * from './dtos/requests/ReservationLineRef';
57
58
  export * from './dtos/requests/StockLine';
@@ -0,0 +1,2 @@
1
+ /** Tope de SKUs por llamada a `POST /private/sale-promotions/active-by-skus`; el caller parte en bloques. */
2
+ export const ACTIVE_SALE_PROMOTIONS_MAX_SKUS = 100;
@@ -0,0 +1,50 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { ArrayMaxSize, IsArray, IsEnum, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
3
+ import { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
4
+ import { ProductTierEnum } from '../../../retailCatalog/enums/ProductTierEnum';
5
+ import { ACTIVE_SALE_PROMOTIONS_MAX_SKUS } from '../../constants/activeSalePromotionsBySkus';
6
+
7
+ /** Un SKU con su tipo y gama; sin ellos no cumple un alcance por tipo o por gama. */
8
+ export class ActiveSalePromotionsSkuInput {
9
+ /** Un SKU vacío no invalida el lote: sale como `INVALID_ID`. */
10
+ @Expose()
11
+ @IsString()
12
+ sku!: string;
13
+
14
+ @Expose()
15
+ @IsOptional()
16
+ @IsEnum(ProductCategoryEnum)
17
+ category?: ProductCategoryEnum | null;
18
+
19
+ @Expose()
20
+ @IsOptional()
21
+ @IsEnum(ProductTierEnum)
22
+ tier?: ProductTierEnum | null;
23
+ }
24
+
25
+ /** Body de `POST /private/sale-promotions/active-by-skus` (M2M): hasta 100 SKUs; los repetidos se cuentan una vez. */
26
+ export class ActiveSalePromotionsBySkusRequest {
27
+ @Expose()
28
+ @IsString()
29
+ @IsNotEmpty()
30
+ tenantId!: string;
31
+
32
+ @Expose()
33
+ @IsString()
34
+ @IsNotEmpty()
35
+ retailerId!: string;
36
+
37
+ /** Con tienda, solo las promos cuyo alcance la incluye; sin ella, las de cualquier tienda. */
38
+ @Expose()
39
+ @IsOptional()
40
+ @IsString()
41
+ @IsNotEmpty()
42
+ storeId?: string;
43
+
44
+ @Expose()
45
+ @IsArray()
46
+ @ArrayMaxSize(ACTIVE_SALE_PROMOTIONS_MAX_SKUS)
47
+ @ValidateNested({ each: true })
48
+ @Type(() => ActiveSalePromotionsSkuInput)
49
+ items!: ActiveSalePromotionsSkuInput[];
50
+ }
@@ -0,0 +1,29 @@
1
+ import type { SalePromotionLevers, SalePromotionScope, SalePromotionSegmentation } from '../SalePromotionLevers';
2
+ import type { SkuSalePromotionLookupStatusEnum } from '../../enums/SkuSalePromotionLookupStatusEnum';
3
+
4
+ /** Promo de venta vigente hoy que alcanza al SKU, con su contenido de la versión actual. */
5
+ export interface ActiveSalePromotionSummary {
6
+ promotionId: string;
7
+ name: string;
8
+ /** Palancas en español: «$500 de descuento + 3× $50 de tiempo aire + $300 al Wallet Fiado». */
9
+ benefitSummary: string;
10
+ levers: SalePromotionLevers;
11
+ /** `null` = arrancó al publicarse. */
12
+ validFrom: string | null;
13
+ /** `null` = permanente. */
14
+ validUntil: string | null;
15
+ segmentation: SalePromotionSegmentation;
16
+ scope: SalePromotionScope;
17
+ }
18
+
19
+ export interface SkuActiveSalePromotions {
20
+ sku: string;
21
+ status: SkuSalePromotionLookupStatusEnum;
22
+ /** Vacío si no tiene ninguna o si el estado no es `OK`. */
23
+ promotions: ActiveSalePromotionSummary[];
24
+ }
25
+
26
+ /** Response de `POST /private/sale-promotions/active-by-skus`: una entrada por SKU, en el orden pedido. */
27
+ export interface ActiveSalePromotionsBySkusResponse {
28
+ items: SkuActiveSalePromotions[];
29
+ }
@@ -0,0 +1,9 @@
1
+ /** Cómo se resolvió cada SKU del lote de promos vigentes; hay una entrada por SKU pedido. */
2
+ export enum SkuSalePromotionLookupStatusEnum {
3
+ /** Se leyeron las promos; `promotions` vacío es un dato: no tiene ninguna vigente. */
4
+ OK = 'OK',
5
+ /** No se pudieron leer las promos; el caller lo pinta como fuente caída y reintenta. */
6
+ UNAVAILABLE = 'UNAVAILABLE',
7
+ /** El SKU no tiene forma de SKU; reintentarlo igual nunca sirve. */
8
+ INVALID_ID = 'INVALID_ID',
9
+ }
@@ -18,11 +18,13 @@ export * from './enums/EntitlementKindEnum';
18
18
  export * from './enums/SaleCouponAvailabilityEnum';
19
19
  export * from './enums/RetailPromotionsErrorCodeEnum';
20
20
  export * from './enums/SalePromotionKindEnum';
21
+ export * from './enums/SkuSalePromotionLookupStatusEnum';
21
22
 
22
23
  // Constantes y helpers puros
23
24
  export * from './constants/retailPromotionsErrorHttpStatus';
24
25
  export * from './constants/salePromotionTransitions';
25
26
  export * from './constants/bonusPreMoney';
27
+ export * from './constants/activeSalePromotionsBySkus';
26
28
  export * from './helpers/resolveSalePromotionTransition';
27
29
  export * from './helpers/computeBudgetUsedBps';
28
30
  export * from './helpers/resolveSalePromotionKind';
@@ -59,6 +61,7 @@ export * from './dtos/requests/HoldPromotionInput';
59
61
  export * from './dtos/requests/HoldSalePromotionRequest';
60
62
  export * from './dtos/requests/GetSaleCouponQuery';
61
63
  export * from './dtos/requests/SkuSalePromotionsQuery';
64
+ export * from './dtos/requests/ActiveSalePromotionsBySkusRequest';
62
65
 
63
66
  // Response DTOs
64
67
  export * from './dtos/responses/SalePromotionCrudResponses';
@@ -66,3 +69,4 @@ export * from './dtos/responses/DiscountCodeResponses';
66
69
  export * from './dtos/responses/WizardSalePromotionResponses';
67
70
  export * from './dtos/responses/SkuSalePromotionsResponse';
68
71
  export * from './dtos/responses/SalePromotionSegmentsResponse';
72
+ export * from './dtos/responses/ActiveSalePromotionsBySkusResponse';