@fiado/type-kit 3.512.0 → 3.514.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 (64) hide show
  1. package/_test_/unit/retailPromotions/activeSalePromotionsBySkus.test.ts +58 -0
  2. package/_test_/unit/rewards/backoffice.test.ts +96 -0
  3. package/bin/retailCatalog/dtos/responses/GetInventorySkuResponse.d.ts +9 -0
  4. package/bin/retailCatalog/dtos/responses/InventoryLensResponse.d.ts +10 -0
  5. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.d.ts +5 -0
  6. package/bin/retailCatalog/enums/CatalogSourceStatusEnum.js +9 -0
  7. package/bin/retailCatalog/index.d.ts +1 -0
  8. package/bin/retailCatalog/index.js +1 -0
  9. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.d.ts +2 -0
  10. package/bin/retailPromotions/constants/activeSalePromotionsBySkus.js +5 -0
  11. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.d.ts +17 -0
  12. package/bin/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.js +69 -0
  13. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.d.ts +26 -0
  14. package/bin/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.js +2 -0
  15. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.d.ts +9 -0
  16. package/bin/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.js +13 -0
  17. package/bin/retailPromotions/index.d.ts +4 -0
  18. package/bin/retailPromotions/index.js +4 -0
  19. package/bin/rewards/constants/BackofficeLimits.d.ts +6 -0
  20. package/bin/rewards/constants/BackofficeLimits.js +9 -0
  21. package/bin/rewards/dtos/backoffice/CatalogItemListResponse.d.ts +6 -0
  22. package/bin/rewards/dtos/backoffice/CatalogItemListResponse.js +6 -0
  23. package/bin/rewards/dtos/backoffice/CatalogItemRequest.d.ts +19 -0
  24. package/bin/rewards/dtos/backoffice/CatalogItemRequest.js +70 -0
  25. package/bin/rewards/dtos/backoffice/CatalogItemResponse.d.ts +23 -0
  26. package/bin/rewards/dtos/backoffice/CatalogItemResponse.js +6 -0
  27. package/bin/rewards/dtos/backoffice/PackageItemRequest.d.ts +4 -0
  28. package/bin/rewards/dtos/backoffice/PackageItemRequest.js +30 -0
  29. package/bin/rewards/dtos/backoffice/PackageListResponse.d.ts +6 -0
  30. package/bin/rewards/dtos/backoffice/PackageListResponse.js +6 -0
  31. package/bin/rewards/dtos/backoffice/PackageRequest.d.ts +9 -0
  32. package/bin/rewards/dtos/backoffice/PackageRequest.js +47 -0
  33. package/bin/rewards/dtos/backoffice/PackageResponse.d.ts +18 -0
  34. package/bin/rewards/dtos/backoffice/PackageResponse.js +9 -0
  35. package/bin/rewards/dtos/backoffice/RewardChargeToInput.d.ts +4 -0
  36. package/bin/rewards/dtos/backoffice/RewardChargeToInput.js +31 -0
  37. package/bin/rewards/dtos/backoffice/RewardCostInput.d.ts +5 -0
  38. package/bin/rewards/dtos/backoffice/RewardCostInput.js +29 -0
  39. package/bin/rewards/dtos/backoffice/RewardTypeResponse.d.ts +6 -0
  40. package/bin/rewards/dtos/backoffice/RewardTypeResponse.js +7 -0
  41. package/bin/rewards/index.d.ts +11 -0
  42. package/bin/rewards/index.js +13 -0
  43. package/package.json +1 -1
  44. package/src/retailCatalog/dtos/responses/GetInventorySkuResponse.ts +10 -0
  45. package/src/retailCatalog/dtos/responses/InventoryLensResponse.ts +12 -0
  46. package/src/retailCatalog/enums/CatalogSourceStatusEnum.ts +5 -0
  47. package/src/retailCatalog/index.ts +1 -0
  48. package/src/retailPromotions/constants/activeSalePromotionsBySkus.ts +2 -0
  49. package/src/retailPromotions/dtos/requests/ActiveSalePromotionsBySkusRequest.ts +50 -0
  50. package/src/retailPromotions/dtos/responses/ActiveSalePromotionsBySkusResponse.ts +29 -0
  51. package/src/retailPromotions/enums/SkuSalePromotionLookupStatusEnum.ts +9 -0
  52. package/src/retailPromotions/index.ts +4 -0
  53. package/src/rewards/constants/BackofficeLimits.ts +6 -0
  54. package/src/rewards/dtos/backoffice/CatalogItemListResponse.ts +7 -0
  55. package/src/rewards/dtos/backoffice/CatalogItemRequest.ts +52 -0
  56. package/src/rewards/dtos/backoffice/CatalogItemResponse.ts +22 -0
  57. package/src/rewards/dtos/backoffice/PackageItemRequest.ts +15 -0
  58. package/src/rewards/dtos/backoffice/PackageListResponse.ts +7 -0
  59. package/src/rewards/dtos/backoffice/PackageRequest.ts +31 -0
  60. package/src/rewards/dtos/backoffice/PackageResponse.ts +20 -0
  61. package/src/rewards/dtos/backoffice/RewardChargeToInput.ts +16 -0
  62. package/src/rewards/dtos/backoffice/RewardCostInput.ts +14 -0
  63. package/src/rewards/dtos/backoffice/RewardTypeResponse.ts +7 -0
  64. package/src/rewards/index.ts +15 -0
@@ -0,0 +1,30 @@
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.PackageItemRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const BackofficeLimits_1 = require("../../constants/BackofficeLimits");
16
+ class PackageItemRequest {
17
+ }
18
+ exports.PackageItemRequest = PackageItemRequest;
19
+ __decorate([
20
+ (0, class_transformer_1.Expose)(),
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.Matches)(BackofficeLimits_1.REWARD_ITEM_KEY_PATTERN),
23
+ __metadata("design:type", String)
24
+ ], PackageItemRequest.prototype, "itemKey", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsString)(),
28
+ (0, class_validator_1.Matches)(BackofficeLimits_1.REWARD_ID_PATTERN),
29
+ __metadata("design:type", String)
30
+ ], PackageItemRequest.prototype, "catalogItemId", void 0);
@@ -0,0 +1,6 @@
1
+ import { PackageResponse } from './PackageResponse';
2
+ export declare class PackageListResponse {
3
+ items: PackageResponse[];
4
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
5
+ nextCursor?: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackageListResponse = void 0;
4
+ class PackageListResponse {
5
+ }
6
+ exports.PackageListResponse = PackageListResponse;
@@ -0,0 +1,9 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ import { PackageItemRequest } from './PackageItemRequest';
3
+ export declare class PackageRequest {
4
+ id: string;
5
+ name: string;
6
+ status: RewardStatusEnum;
7
+ /** Ordenada: el orden es el de ejecución. De 1 a 4 ítems (el tope depende del presupuesto de tiempo del worker, B-12; el lambda lo valida otra vez). */
8
+ items: PackageItemRequest[];
9
+ }
@@ -0,0 +1,47 @@
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.PackageRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const BackofficeLimits_1 = require("../../constants/BackofficeLimits");
16
+ const RewardStatusEnum_1 = require("../../enums/RewardStatusEnum");
17
+ const PackageItemRequest_1 = require("./PackageItemRequest");
18
+ class PackageRequest {
19
+ }
20
+ exports.PackageRequest = PackageRequest;
21
+ __decorate([
22
+ (0, class_transformer_1.Expose)(),
23
+ (0, class_validator_1.IsString)(),
24
+ (0, class_validator_1.Matches)(BackofficeLimits_1.REWARD_ID_PATTERN),
25
+ __metadata("design:type", String)
26
+ ], PackageRequest.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, class_transformer_1.Expose)(),
29
+ (0, class_validator_1.IsString)(),
30
+ (0, class_validator_1.IsNotEmpty)(),
31
+ (0, class_validator_1.MaxLength)(120),
32
+ __metadata("design:type", String)
33
+ ], PackageRequest.prototype, "name", void 0);
34
+ __decorate([
35
+ (0, class_transformer_1.Expose)(),
36
+ (0, class_validator_1.IsEnum)(RewardStatusEnum_1.RewardStatusEnum),
37
+ __metadata("design:type", String)
38
+ ], PackageRequest.prototype, "status", void 0);
39
+ __decorate([
40
+ (0, class_transformer_1.Expose)(),
41
+ (0, class_validator_1.IsArray)(),
42
+ (0, class_validator_1.ArrayMinSize)(1),
43
+ (0, class_validator_1.ArrayMaxSize)(BackofficeLimits_1.REWARD_PACKAGE_MAX_ITEMS),
44
+ (0, class_validator_1.ValidateNested)({ each: true }),
45
+ (0, class_transformer_1.Type)(() => PackageItemRequest_1.PackageItemRequest),
46
+ __metadata("design:type", Array)
47
+ ], PackageRequest.prototype, "items", void 0);
@@ -0,0 +1,18 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ import { RewardCost } from '../RewardCost';
3
+ export declare class PackageItemResponse {
4
+ itemKey: string;
5
+ catalogItemId: string;
6
+ }
7
+ export declare class PackageResponse {
8
+ id: string;
9
+ name: string;
10
+ status: RewardStatusEnum;
11
+ version: number;
12
+ items: PackageItemResponse[];
13
+ /** Costo total declarado por moneda (spec 5.2). */
14
+ totalCost: RewardCost[];
15
+ updatedBy: string;
16
+ createdAt: number;
17
+ updatedAt: number;
18
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackageResponse = exports.PackageItemResponse = void 0;
4
+ class PackageItemResponse {
5
+ }
6
+ exports.PackageItemResponse = PackageItemResponse;
7
+ class PackageResponse {
8
+ }
9
+ exports.PackageResponse = PackageResponse;
@@ -0,0 +1,4 @@
1
+ export declare class RewardChargeToInput {
2
+ partnerId: string;
3
+ partnerName: string;
4
+ }
@@ -0,0 +1,31 @@
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.RewardChargeToInput = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ class RewardChargeToInput {
16
+ }
17
+ exports.RewardChargeToInput = RewardChargeToInput;
18
+ __decorate([
19
+ (0, class_transformer_1.Expose)(),
20
+ (0, class_validator_1.IsString)(),
21
+ (0, class_validator_1.IsNotEmpty)(),
22
+ (0, class_validator_1.MaxLength)(64),
23
+ __metadata("design:type", String)
24
+ ], RewardChargeToInput.prototype, "partnerId", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsString)(),
28
+ (0, class_validator_1.IsNotEmpty)(),
29
+ (0, class_validator_1.MaxLength)(120),
30
+ __metadata("design:type", String)
31
+ ], RewardChargeToInput.prototype, "partnerName", void 0);
@@ -0,0 +1,5 @@
1
+ import { CurrencyId } from '../../../currency';
2
+ export declare class RewardCostInput {
3
+ amount: number;
4
+ currency: CurrencyId;
5
+ }
@@ -0,0 +1,29 @@
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.RewardCostInput = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ const currency_1 = require("../../../currency");
16
+ class RewardCostInput {
17
+ }
18
+ exports.RewardCostInput = RewardCostInput;
19
+ __decorate([
20
+ (0, class_transformer_1.Expose)(),
21
+ (0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
22
+ (0, class_validator_1.Min)(0),
23
+ __metadata("design:type", Number)
24
+ ], RewardCostInput.prototype, "amount", void 0);
25
+ __decorate([
26
+ (0, class_transformer_1.Expose)(),
27
+ (0, class_validator_1.IsEnum)(currency_1.CurrencyId),
28
+ __metadata("design:type", String)
29
+ ], RewardCostInput.prototype, "currency", void 0);
@@ -0,0 +1,6 @@
1
+ import { InputField } from '../../../dynamicForm/dtos/InputField';
2
+ /** `GET /reward-types`: un tipo registrado y el formulario dinámico de su `config`. */
3
+ export declare class RewardTypeResponse {
4
+ type: string;
5
+ configFields: InputField[];
6
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RewardTypeResponse = void 0;
4
+ /** `GET /reward-types`: un tipo registrado y el formulario dinámico de su `config`. */
5
+ class RewardTypeResponse {
6
+ }
7
+ exports.RewardTypeResponse = RewardTypeResponse;
@@ -22,3 +22,14 @@ export * from './dtos/responses/PackageContractResponse';
22
22
  export * from './dtos/responses/GrantAttemptResponse';
23
23
  export * from './dtos/responses/GrantItemResponse';
24
24
  export * from './dtos/responses/GrantResponse';
25
+ export * from './constants/BackofficeLimits';
26
+ export * from './dtos/backoffice/RewardCostInput';
27
+ export * from './dtos/backoffice/RewardChargeToInput';
28
+ export * from './dtos/backoffice/CatalogItemRequest';
29
+ export * from './dtos/backoffice/CatalogItemResponse';
30
+ export * from './dtos/backoffice/PackageItemRequest';
31
+ export * from './dtos/backoffice/PackageRequest';
32
+ export * from './dtos/backoffice/PackageResponse';
33
+ export * from './dtos/backoffice/RewardTypeResponse';
34
+ export * from './dtos/backoffice/CatalogItemListResponse';
35
+ export * from './dtos/backoffice/PackageListResponse';
@@ -45,3 +45,16 @@ __exportStar(require("./dtos/responses/PackageContractResponse"), exports);
45
45
  __exportStar(require("./dtos/responses/GrantAttemptResponse"), exports);
46
46
  __exportStar(require("./dtos/responses/GrantItemResponse"), exports);
47
47
  __exportStar(require("./dtos/responses/GrantResponse"), exports);
48
+ //Constants backoffice
49
+ __exportStar(require("./constants/BackofficeLimits"), exports);
50
+ //DTOs backoffice
51
+ __exportStar(require("./dtos/backoffice/RewardCostInput"), exports);
52
+ __exportStar(require("./dtos/backoffice/RewardChargeToInput"), exports);
53
+ __exportStar(require("./dtos/backoffice/CatalogItemRequest"), exports);
54
+ __exportStar(require("./dtos/backoffice/CatalogItemResponse"), exports);
55
+ __exportStar(require("./dtos/backoffice/PackageItemRequest"), exports);
56
+ __exportStar(require("./dtos/backoffice/PackageRequest"), exports);
57
+ __exportStar(require("./dtos/backoffice/PackageResponse"), exports);
58
+ __exportStar(require("./dtos/backoffice/RewardTypeResponse"), exports);
59
+ __exportStar(require("./dtos/backoffice/CatalogItemListResponse"), exports);
60
+ __exportStar(require("./dtos/backoffice/PackageListResponse"), 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.514.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';
@@ -0,0 +1,6 @@
1
+ /** Máximo del `itemKey` de un paquete: `RW-{grantId(32)}-{itemKey}` ≤ 64 (igual que REWARDS_MAX_ITEM_KEY_LENGTH de api-invoker). */
2
+ export const REWARD_ITEM_KEY_MAX_LENGTH = 28;
3
+ export const REWARD_ITEM_KEY_PATTERN = new RegExp(`^[A-Za-z0-9_-]{1,${REWARD_ITEM_KEY_MAX_LENGTH}}$`);
4
+ export const REWARD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
5
+ /** Máximo de ítems de un paquete (B-12 de rewards-business: presupuesto de tiempo del worker). Igual a `MAX_ITEMS_PER_PACKAGE` del lambda. */
6
+ export const REWARD_PACKAGE_MAX_ITEMS = 4;
@@ -0,0 +1,7 @@
1
+ import { CatalogItemResponse } from './CatalogItemResponse';
2
+
3
+ export class CatalogItemListResponse {
4
+ items: CatalogItemResponse[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,52 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { IsEnum, IsNotEmpty, IsObject, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
3
+ import { JsonValue } from '../../../common';
4
+ import { REWARD_ID_PATTERN } from '../../constants/BackofficeLimits';
5
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
6
+ import { RewardChargeToInput } from './RewardChargeToInput';
7
+ import { RewardCostInput } from './RewardCostInput';
8
+
9
+ /** Crear (POST) o reemplazar (PUT) una recompensa del catálogo. `version`, `dependencies` y `updatedBy` los pone el servidor. */
10
+ export class CatalogItemRequest {
11
+ @Expose()
12
+ @IsString()
13
+ @Matches(REWARD_ID_PATTERN)
14
+ id: string;
15
+
16
+ @Expose()
17
+ @IsString()
18
+ @IsNotEmpty()
19
+ @MaxLength(120)
20
+ name: string;
21
+
22
+ @Expose()
23
+ @IsString()
24
+ @MaxLength(500)
25
+ description: string;
26
+
27
+ /** `type` del adaptador (IRewardType.type). Inmutable una vez creada la recompensa. */
28
+ @Expose()
29
+ @IsString()
30
+ @IsNotEmpty()
31
+ @MaxLength(60)
32
+ type: string;
33
+
34
+ /** Forma definida por cada tipo; el lambda la valida con `IRewardType.validateConfig`. */
35
+ @Expose()
36
+ @IsObject()
37
+ config: { [key: string]: JsonValue };
38
+
39
+ @Expose()
40
+ @ValidateNested()
41
+ @Type(() => RewardCostInput)
42
+ cost: RewardCostInput;
43
+
44
+ @Expose()
45
+ @ValidateNested()
46
+ @Type(() => RewardChargeToInput)
47
+ chargeTo: RewardChargeToInput;
48
+
49
+ @Expose()
50
+ @IsEnum(RewardStatusEnum)
51
+ status: RewardStatusEnum;
52
+ }
@@ -0,0 +1,22 @@
1
+ import { JsonValue } from '../../../common';
2
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
3
+ import { RewardChargeTo } from '../RewardChargeTo';
4
+ import { RewardCost } from '../RewardCost';
5
+ import { RewardDependency } from '../RewardDependency';
6
+
7
+ export class CatalogItemResponse {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ type: string;
12
+ config: { [key: string]: JsonValue };
13
+ cost: RewardCost;
14
+ chargeTo: RewardChargeTo;
15
+ /** Solo lectura: las calcula el tipo a partir de `config`. */
16
+ dependencies: RewardDependency[];
17
+ status: RewardStatusEnum;
18
+ version: number;
19
+ updatedBy: string;
20
+ createdAt: number;
21
+ updatedAt: number;
22
+ }
@@ -0,0 +1,15 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsString, Matches } from 'class-validator';
3
+ import { REWARD_ID_PATTERN, REWARD_ITEM_KEY_PATTERN } from '../../constants/BackofficeLimits';
4
+
5
+ export class PackageItemRequest {
6
+ @Expose()
7
+ @IsString()
8
+ @Matches(REWARD_ITEM_KEY_PATTERN)
9
+ itemKey: string;
10
+
11
+ @Expose()
12
+ @IsString()
13
+ @Matches(REWARD_ID_PATTERN)
14
+ catalogItemId: string;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { PackageResponse } from './PackageResponse';
2
+
3
+ export class PackageListResponse {
4
+ items: PackageResponse[];
5
+ /** Cursor opaco de la página siguiente; ausente en la última página. */
6
+ nextCursor?: string;
7
+ }
@@ -0,0 +1,31 @@
1
+ import { Expose, Type } from 'class-transformer';
2
+ import { ArrayMaxSize, ArrayMinSize, IsArray, IsEnum, IsNotEmpty, IsString, Matches, MaxLength, ValidateNested } from 'class-validator';
3
+ import { REWARD_ID_PATTERN, REWARD_PACKAGE_MAX_ITEMS } from '../../constants/BackofficeLimits';
4
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
5
+ import { PackageItemRequest } from './PackageItemRequest';
6
+
7
+ export class PackageRequest {
8
+ @Expose()
9
+ @IsString()
10
+ @Matches(REWARD_ID_PATTERN)
11
+ id: string;
12
+
13
+ @Expose()
14
+ @IsString()
15
+ @IsNotEmpty()
16
+ @MaxLength(120)
17
+ name: string;
18
+
19
+ @Expose()
20
+ @IsEnum(RewardStatusEnum)
21
+ status: RewardStatusEnum;
22
+
23
+ /** Ordenada: el orden es el de ejecución. De 1 a 4 ítems (el tope depende del presupuesto de tiempo del worker, B-12; el lambda lo valida otra vez). */
24
+ @Expose()
25
+ @IsArray()
26
+ @ArrayMinSize(1)
27
+ @ArrayMaxSize(REWARD_PACKAGE_MAX_ITEMS)
28
+ @ValidateNested({ each: true })
29
+ @Type(() => PackageItemRequest)
30
+ items: PackageItemRequest[];
31
+ }
@@ -0,0 +1,20 @@
1
+ import { RewardStatusEnum } from '../../enums/RewardStatusEnum';
2
+ import { RewardCost } from '../RewardCost';
3
+
4
+ export class PackageItemResponse {
5
+ itemKey: string;
6
+ catalogItemId: string;
7
+ }
8
+
9
+ export class PackageResponse {
10
+ id: string;
11
+ name: string;
12
+ status: RewardStatusEnum;
13
+ version: number;
14
+ items: PackageItemResponse[];
15
+ /** Costo total declarado por moneda (spec 5.2). */
16
+ totalCost: RewardCost[];
17
+ updatedBy: string;
18
+ createdAt: number;
19
+ updatedAt: number;
20
+ }