@fiado/type-kit 3.474.0 → 3.475.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.
@@ -0,0 +1,38 @@
1
+ import 'reflect-metadata';
2
+ import {
3
+ EvaluatedSalePromotion,
4
+ RetailPromotionsErrorCodeEnum,
5
+ } from '../../../src/retailPromotions/index';
6
+
7
+ const basePromotion: EvaluatedSalePromotion = {
8
+ promotionId: 'promo-1',
9
+ version: 1,
10
+ name: 'Regalo',
11
+ customerText: 'Llévate un regalo',
12
+ levers: [],
13
+ lines: [],
14
+ totalDiscountCents: 0,
15
+ giftOptions: [],
16
+ giftChooseCount: null,
17
+ afterSale: [],
18
+ };
19
+
20
+ describe('EvaluatedSalePromotion.blockedBy', () => {
21
+ it('es opcional: una promo elegible no lo trae', () => {
22
+ expect(basePromotion.blockedBy).toBeUndefined();
23
+ });
24
+
25
+ it.each([
26
+ RetailPromotionsErrorCodeEnum.CUSTOMER_NOT_IDENTIFIED,
27
+ RetailPromotionsErrorCodeEnum.PROMOTION_NOT_APPLICABLE,
28
+ RetailPromotionsErrorCodeEnum.INSUFFICIENT_STOCK,
29
+ ])('acepta el motivo de bloqueo %s', (code) => {
30
+ const blocked: EvaluatedSalePromotion = { ...basePromotion, blockedBy: code };
31
+ expect(blocked.blockedBy).toBe(code);
32
+ });
33
+
34
+ it('acepta null como sin bloqueo', () => {
35
+ const open: EvaluatedSalePromotion = { ...basePromotion, blockedBy: null };
36
+ expect(open.blockedBy).toBeNull();
37
+ });
38
+ });
@@ -194,4 +194,30 @@ describe('respuestas de los M2M de Promociones', () => {
194
194
  };
195
195
  expect(view.payment?.paidAt).toBe('2026-09-28T20:00:00.000Z');
196
196
  });
197
+
198
+ it('la lectura privada acepta splitFinancingEnabled como booleano opcional', () => {
199
+ const base: PrivateWizardSessionResponse = {
200
+ sessionId: 'ses-1',
201
+ retailerId: 'ret',
202
+ storeId: 'st',
203
+ retailCustomerId: null,
204
+ state: WizardStateEnum.ACTIVE,
205
+ currentStep: WizardStepEnum.S06,
206
+ creditId: null,
207
+ anchorLineId: null,
208
+ salePromotionId: null,
209
+ salePromotionVersion: null,
210
+ lines: [],
211
+ };
212
+ const enabled: PrivateWizardSessionResponse = { ...base, splitFinancingEnabled: true };
213
+ const disabled: PrivateWizardSessionResponse = { ...base, splitFinancingEnabled: false };
214
+ // @ts-expect-error el flag es booleano, no string
215
+ const asString: PrivateWizardSessionResponse = { ...base, splitFinancingEnabled: 'true' };
216
+ expect([enabled.splitFinancingEnabled, disabled.splitFinancingEnabled, base.splitFinancingEnabled]).toEqual([
217
+ true,
218
+ false,
219
+ undefined,
220
+ ]);
221
+ expect(asString).toBeDefined();
222
+ });
197
223
  });
@@ -46,6 +46,8 @@ export interface EvaluatedSalePromotion {
46
46
  giftOptions: GiftOption[];
47
47
  giftChooseCount: number | null;
48
48
  afterSale: AfterSaleBenefit[];
49
+ /** Si viene, la promo se muestra pero no se puede elegir; dice por qué (ej. CUSTOMER_NOT_IDENTIFIED). */
50
+ blockedBy?: RetailPromotionsErrorCodeEnum | null;
49
51
  }
50
52
  /** Resultado del código tecleado: si no aplica, `rejectionCode` dice por qué. */
51
53
  export interface EvaluatedDiscountCode {
@@ -26,4 +26,6 @@ export interface PrivateWizardSessionResponse {
26
26
  paymentMethod?: PaymentMethodEnum | null;
27
27
  /** Cobro de contado; `null` mientras no se cobra. */
28
28
  payment?: WizardPayment | null;
29
+ /** Valor efectivo del flag SPLIT_FINANCING_ENABLED del wizard. */
30
+ splitFinancingEnabled?: boolean;
29
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.474.0",
3
+ "version": "3.475.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -51,6 +51,8 @@ export interface EvaluatedSalePromotion {
51
51
  giftOptions: GiftOption[];
52
52
  giftChooseCount: number | null;
53
53
  afterSale: AfterSaleBenefit[];
54
+ /** Si viene, la promo se muestra pero no se puede elegir; dice por qué (ej. CUSTOMER_NOT_IDENTIFIED). */
55
+ blockedBy?: RetailPromotionsErrorCodeEnum | null;
54
56
  }
55
57
 
56
58
  /** Resultado del código tecleado: si no aplica, `rejectionCode` dice por qué. */
@@ -27,4 +27,6 @@ export interface PrivateWizardSessionResponse {
27
27
  paymentMethod?: PaymentMethodEnum | null;
28
28
  /** Cobro de contado; `null` mientras no se cobra. */
29
29
  payment?: WizardPayment | null;
30
+ /** Valor efectivo del flag SPLIT_FINANCING_ENABLED del wizard. */
31
+ splitFinancingEnabled?: boolean;
30
32
  }