@fiado/type-kit 3.506.0 → 3.508.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,36 @@
1
+ import 'reflect-metadata';
2
+ import { ClientLevelEnum } from '../../../src/loanScoring/enums/ClientLevelEnum';
3
+ import {
4
+ SellerTableSourceStatusEnum,
5
+ type BackofficeCustomerTableResponse,
6
+ } from '../../../src/retailWizard';
7
+
8
+ describe('BackofficeCustomerTableResponse', () => {
9
+ it('declara las fuentes, el cursor y una fila completa', () => {
10
+ const response: BackofficeCustomerTableResponse = {
11
+ from: null,
12
+ to: '2026-10-07T18:00:00.000Z',
13
+ nextToken: 'abc',
14
+ sources: { sales: SellerTableSourceStatusEnum.OK, credit: SellerTableSourceStatusEnum.UNAVAILABLE },
15
+ items: [
16
+ {
17
+ retailCustomerId: 'RC-1',
18
+ name: 'Ana',
19
+ phone: null,
20
+ purchaseCount: 2,
21
+ totalSpentCents: 300_000,
22
+ averageTicketCents: 150_000,
23
+ firstPurchaseAt: '2026-09-01T18:00:00.000Z',
24
+ lastPurchaseAt: '2026-10-01T18:00:00.000Z',
25
+ lastStoreName: 'Centro',
26
+ favoriteStoreId: 'ST-1',
27
+ favoriteStoreName: 'Centro',
28
+ skLevel: ClientLevelEnum.GOLD,
29
+ activeCreditsCount: null,
30
+ },
31
+ ],
32
+ };
33
+ expect(response.items[0].skLevel).toBe('GOLD');
34
+ expect(response.sources.credit).toBe('UNAVAILABLE');
35
+ });
36
+ });
@@ -0,0 +1,47 @@
1
+ import 'reflect-metadata';
2
+ import { ProductCategoryEnum } from '../../../src/retailCatalog/enums/ProductCategoryEnum';
3
+ import { StoreStatusEnum } from '../../../src/retailOrg/enums/StoreStatusEnum';
4
+ import {
5
+ SellerTableSourceStatusEnum,
6
+ StoreKindEnum,
7
+ type BackofficeStoreDetailResponse,
8
+ type BackofficeStoreTableResponse,
9
+ } from '../../../src/retailWizard';
10
+
11
+ describe('BackofficeStoreTableResponse', () => {
12
+ it('declara las fuentes y una fila completa', () => {
13
+ const response: BackofficeStoreTableResponse = {
14
+ from: '2026-09-30T06:00:00.000Z',
15
+ to: '2026-10-07T05:59:59.999Z',
16
+ truncated: false,
17
+ sources: { roster: SellerTableSourceStatusEnum.OK, team: SellerTableSourceStatusEnum.OK, goals: SellerTableSourceStatusEnum.UNAVAILABLE },
18
+ items: [
19
+ {
20
+ storeId: 'ST-1', code: 'CEN', name: 'Centro', zoneId: 'Z-1', zoneName: 'Norte',
21
+ status: StoreStatusEnum.ACTIVE, kind: null,
22
+ managerRetailUserId: 'V-1', managerName: 'Karla',
23
+ teamActiveCount: 3, teamTotalCount: 4,
24
+ salesCount: 2, placedCents: 200_000, averageTicketCents: 100_000, customersServed: 2,
25
+ lastSaleAt: '2026-10-05T18:00:00.000Z', weekOverWeekChangePct: 12.5,
26
+ goalCents: null, networkSharePct: 40, npiM30Pct: null,
27
+ },
28
+ ],
29
+ };
30
+ expect(response.items[0].status).toBe('ACTIVE');
31
+ expect(StoreKindEnum.SUBDISTRIBUTOR).toBe('SUBDISTRIBUTOR');
32
+ });
33
+ });
34
+
35
+ describe('BackofficeStoreDetailResponse', () => {
36
+ it('declara la serie semanal y el mix por categoría', () => {
37
+ const response: BackofficeStoreDetailResponse = {
38
+ storeId: 'ST-1',
39
+ from: '2026-09-30T06:00:00.000Z',
40
+ to: '2026-10-07T05:59:59.999Z',
41
+ truncated: false,
42
+ weeklyPlacement: [{ from: '2026-09-30T06:00:00.000Z', to: '2026-10-07T05:59:59.999Z', salesCount: 1, placedCents: 100_000 }],
43
+ categoryMix: [{ category: ProductCategoryEnum.PHONE, units: 1, placedCents: 100_000 }, { category: null, units: 1, placedCents: 5_000 }],
44
+ };
45
+ expect(response.categoryMix[1].category).toBeNull();
46
+ });
47
+ });
@@ -0,0 +1,38 @@
1
+ import type { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
+ import type { SellerTableSourceStatusEnum } from '../../enums/SellerTableSourceStatusEnum';
3
+ /** Una fila de la tabla de Clientes: compras en la cadena dentro de la ventana, sin canceladas, más su crédito SK. */
4
+ export interface CustomerTableRow {
5
+ retailCustomerId: string;
6
+ name: string | null;
7
+ phone: string | null;
8
+ purchaseCount: number;
9
+ /** Precio de lo comprado (en crédito, el precio del equipo, no el enganche). */
10
+ totalSpentCents: number;
11
+ averageTicketCents: number | null;
12
+ firstPurchaseAt: string;
13
+ lastPurchaseAt: string;
14
+ lastStoreName: string | null;
15
+ /** Tienda con más compras; en empate, la de la compra más reciente. */
16
+ favoriteStoreId: string | null;
17
+ favoriteStoreName: string | null;
18
+ /** `null` sin nivel o con el crédito sin leer. */
19
+ skLevel: ClientLevelEnum | null;
20
+ /** `null` con el crédito sin leer. */
21
+ activeCreditsCount: number | null;
22
+ }
23
+ /** Estado de cada fuente. Con el crédito `UNAVAILABLE` sus campos van en `null`, nunca en `0`. */
24
+ export interface CustomerTableSources {
25
+ sales: SellerTableSourceStatusEnum.OK;
26
+ credit: SellerTableSourceStatusEnum;
27
+ }
28
+ /**
29
+ * `GET /backoffice/customers/table?from&to&limit&nextToken&storeId&sellerId&value` — tabla de Clientes
30
+ * del Portal Admin VL, paginada por última compra descendente. `from` en `null` es «Todo».
31
+ */
32
+ export interface BackofficeCustomerTableResponse {
33
+ from: string | null;
34
+ to: string;
35
+ nextToken: string | null;
36
+ sources: CustomerTableSources;
37
+ items: CustomerTableRow[];
38
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ import type { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
2
+ /** Colocación de una semana de 7 días; ISO, ambos extremos incluidos. */
3
+ export interface StoreWeeklyPlacement {
4
+ from: string;
5
+ to: string;
6
+ salesCount: number;
7
+ placedCents: number;
8
+ }
9
+ /** Lo vendido de una categoría en la ventana. `category: null` = venta sin líneas de producto. */
10
+ export interface StoreCategoryMixEntry {
11
+ category: ProductCategoryEnum | null;
12
+ units: number;
13
+ placedCents: number;
14
+ }
15
+ /**
16
+ * `GET /backoffice/stores/{storeId}/detail?from&to` — el cajón de una tienda: colocación de las 8
17
+ * semanas que terminan en `to` (de la más vieja a la más nueva) y mix por categoría de `[from, to]`.
18
+ */
19
+ export interface BackofficeStoreDetailResponse {
20
+ storeId: string;
21
+ from: string;
22
+ to: string;
23
+ truncated: boolean;
24
+ weeklyPlacement: StoreWeeklyPlacement[];
25
+ /** De mayor a menor colocación. */
26
+ categoryMix: StoreCategoryMixEntry[];
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,55 @@
1
+ import type { StoreStatusEnum } from '../../../retailOrg/enums/StoreStatusEnum';
2
+ import type { SellerTableSourceStatusEnum } from '../../enums/SellerTableSourceStatusEnum';
3
+ import type { StoreKindEnum } from '../../enums/StoreKindEnum';
4
+ /** Una fila de la tabla de Tiendas: padrón + equipo + ventas de la ventana + meta. */
5
+ export interface StoreTableRow {
6
+ storeId: string;
7
+ /** `null` si la tienda vendió pero ya no está en el padrón. */
8
+ code: string | null;
9
+ name: string | null;
10
+ zoneId: string | null;
11
+ zoneName: string | null;
12
+ status: StoreStatusEnum | null;
13
+ /** Propia o subdistribuidor; `null` mientras ninguna fuente lo sepa. */
14
+ kind: StoreKindEnum | null;
15
+ managerRetailUserId: string | null;
16
+ /** `null` sin encargado o con el equipo sin leer. */
17
+ managerName: string | null;
18
+ /** Vendedores activos con esa tienda de casa; `null` con el equipo sin leer. */
19
+ teamActiveCount: number | null;
20
+ teamTotalCount: number | null;
21
+ /** Sin ventas en la ventana viaja `0`: el barrido es exhaustivo. */
22
+ salesCount: number;
23
+ placedCents: number;
24
+ averageTicketCents: number | null;
25
+ /** Clientes distintos que compraron en la ventana. */
26
+ customersServed: number | null;
27
+ lastSaleAt: string | null;
28
+ /** Δ % contra la misma ventana 7 días antes; `null` si la ventana pasa de 7 días o no hubo base. */
29
+ weekOverWeekChangePct: number | null;
30
+ /** Meta mensual de la tienda escalada a los días de la ventana; `null` sin meta, con metas caídas o ventana > 90 días. */
31
+ goalCents: number | null;
32
+ /** % de la colocación de la cadena en la ventana, a un decimal; `null` si la cadena no colocó. */
33
+ networkSharePct: number | null;
34
+ /** NPI M30: no lo calcula ningún lambda todavía. Siempre `null`. */
35
+ npiM30Pct: null;
36
+ }
37
+ /** Estado de cada fuente. Una fuente `UNAVAILABLE` deja sus campos en `null`, nunca en `0`. */
38
+ export interface StoreTableSources {
39
+ roster: SellerTableSourceStatusEnum;
40
+ /** Vendedores de la cadena: equipo y nombre del encargado. */
41
+ team: SellerTableSourceStatusEnum;
42
+ goals: SellerTableSourceStatusEnum;
43
+ }
44
+ /**
45
+ * `GET /backoffice/stores/table?from&to&value` — la tabla completa de Tiendas del Portal Admin VL,
46
+ * sin paginación. Incluye las tiendas del padrón sin ventas y las inactivas.
47
+ */
48
+ export interface BackofficeStoreTableResponse {
49
+ from: string;
50
+ to: string;
51
+ /** Las ventas de la ventana pasaron el tope de lectura: los números están recortados. */
52
+ truncated: boolean;
53
+ sources: StoreTableSources;
54
+ items: StoreTableRow[];
55
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /** Si la tienda es propia de la cadena o de un subdistribuidor. */
2
+ export declare enum StoreKindEnum {
3
+ OWN = "OWN",
4
+ SUBDISTRIBUTOR = "SUBDISTRIBUTOR"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoreKindEnum = void 0;
4
+ /** Si la tienda es propia de la cadena o de un subdistribuidor. */
5
+ var StoreKindEnum;
6
+ (function (StoreKindEnum) {
7
+ StoreKindEnum["OWN"] = "OWN";
8
+ StoreKindEnum["SUBDISTRIBUTOR"] = "SUBDISTRIBUTOR";
9
+ })(StoreKindEnum || (exports.StoreKindEnum = StoreKindEnum = {}));
@@ -137,6 +137,10 @@ export * from './dtos/responses/BackofficeStoreKpisResponse';
137
137
  export * from './dtos/responses/BackofficeSellerKpisResponse';
138
138
  export * from './enums/SellerTableSourceStatusEnum';
139
139
  export * from './dtos/responses/BackofficeSellerTableResponse';
140
+ export * from './dtos/responses/BackofficeCustomerTableResponse';
141
+ export * from './enums/StoreKindEnum';
142
+ export * from './dtos/responses/BackofficeStoreTableResponse';
143
+ export * from './dtos/responses/BackofficeStoreDetailResponse';
140
144
  export * from './events/SaleCompletedV1';
141
145
  export * from './events/SaleCancelledV1';
142
146
  export * from './events/SaleCompletedV2';
@@ -170,6 +170,10 @@ __exportStar(require("./dtos/responses/BackofficeStoreKpisResponse"), exports);
170
170
  __exportStar(require("./dtos/responses/BackofficeSellerKpisResponse"), exports);
171
171
  __exportStar(require("./enums/SellerTableSourceStatusEnum"), exports);
172
172
  __exportStar(require("./dtos/responses/BackofficeSellerTableResponse"), exports);
173
+ __exportStar(require("./dtos/responses/BackofficeCustomerTableResponse"), exports);
174
+ __exportStar(require("./enums/StoreKindEnum"), exports);
175
+ __exportStar(require("./dtos/responses/BackofficeStoreTableResponse"), exports);
176
+ __exportStar(require("./dtos/responses/BackofficeStoreDetailResponse"), exports);
173
177
  // Contratos de eventos (PascalCase + sufijo V1)
174
178
  __exportStar(require("./events/SaleCompletedV1"), exports);
175
179
  __exportStar(require("./events/SaleCancelledV1"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.506.0",
3
+ "version": "3.508.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -0,0 +1,41 @@
1
+ import type { ClientLevelEnum } from '../../../loanScoring/enums/ClientLevelEnum';
2
+ import type { SellerTableSourceStatusEnum } from '../../enums/SellerTableSourceStatusEnum';
3
+
4
+ /** Una fila de la tabla de Clientes: compras en la cadena dentro de la ventana, sin canceladas, más su crédito SK. */
5
+ export interface CustomerTableRow {
6
+ retailCustomerId: string;
7
+ name: string | null;
8
+ phone: string | null;
9
+ purchaseCount: number;
10
+ /** Precio de lo comprado (en crédito, el precio del equipo, no el enganche). */
11
+ totalSpentCents: number;
12
+ averageTicketCents: number | null;
13
+ firstPurchaseAt: string;
14
+ lastPurchaseAt: string;
15
+ lastStoreName: string | null;
16
+ /** Tienda con más compras; en empate, la de la compra más reciente. */
17
+ favoriteStoreId: string | null;
18
+ favoriteStoreName: string | null;
19
+ /** `null` sin nivel o con el crédito sin leer. */
20
+ skLevel: ClientLevelEnum | null;
21
+ /** `null` con el crédito sin leer. */
22
+ activeCreditsCount: number | null;
23
+ }
24
+
25
+ /** Estado de cada fuente. Con el crédito `UNAVAILABLE` sus campos van en `null`, nunca en `0`. */
26
+ export interface CustomerTableSources {
27
+ sales: SellerTableSourceStatusEnum.OK;
28
+ credit: SellerTableSourceStatusEnum;
29
+ }
30
+
31
+ /**
32
+ * `GET /backoffice/customers/table?from&to&limit&nextToken&storeId&sellerId&value` — tabla de Clientes
33
+ * del Portal Admin VL, paginada por última compra descendente. `from` en `null` es «Todo».
34
+ */
35
+ export interface BackofficeCustomerTableResponse {
36
+ from: string | null;
37
+ to: string;
38
+ nextToken: string | null;
39
+ sources: CustomerTableSources;
40
+ items: CustomerTableRow[];
41
+ }
@@ -0,0 +1,30 @@
1
+ import type { ProductCategoryEnum } from '../../../retailCatalog/enums/ProductCategoryEnum';
2
+
3
+ /** Colocación de una semana de 7 días; ISO, ambos extremos incluidos. */
4
+ export interface StoreWeeklyPlacement {
5
+ from: string;
6
+ to: string;
7
+ salesCount: number;
8
+ placedCents: number;
9
+ }
10
+
11
+ /** Lo vendido de una categoría en la ventana. `category: null` = venta sin líneas de producto. */
12
+ export interface StoreCategoryMixEntry {
13
+ category: ProductCategoryEnum | null;
14
+ units: number;
15
+ placedCents: number;
16
+ }
17
+
18
+ /**
19
+ * `GET /backoffice/stores/{storeId}/detail?from&to` — el cajón de una tienda: colocación de las 8
20
+ * semanas que terminan en `to` (de la más vieja a la más nueva) y mix por categoría de `[from, to]`.
21
+ */
22
+ export interface BackofficeStoreDetailResponse {
23
+ storeId: string;
24
+ from: string;
25
+ to: string;
26
+ truncated: boolean;
27
+ weeklyPlacement: StoreWeeklyPlacement[];
28
+ /** De mayor a menor colocación. */
29
+ categoryMix: StoreCategoryMixEntry[];
30
+ }
@@ -0,0 +1,58 @@
1
+ import type { StoreStatusEnum } from '../../../retailOrg/enums/StoreStatusEnum';
2
+ import type { SellerTableSourceStatusEnum } from '../../enums/SellerTableSourceStatusEnum';
3
+ import type { StoreKindEnum } from '../../enums/StoreKindEnum';
4
+
5
+ /** Una fila de la tabla de Tiendas: padrón + equipo + ventas de la ventana + meta. */
6
+ export interface StoreTableRow {
7
+ storeId: string;
8
+ /** `null` si la tienda vendió pero ya no está en el padrón. */
9
+ code: string | null;
10
+ name: string | null;
11
+ zoneId: string | null;
12
+ zoneName: string | null;
13
+ status: StoreStatusEnum | null;
14
+ /** Propia o subdistribuidor; `null` mientras ninguna fuente lo sepa. */
15
+ kind: StoreKindEnum | null;
16
+ managerRetailUserId: string | null;
17
+ /** `null` sin encargado o con el equipo sin leer. */
18
+ managerName: string | null;
19
+ /** Vendedores activos con esa tienda de casa; `null` con el equipo sin leer. */
20
+ teamActiveCount: number | null;
21
+ teamTotalCount: number | null;
22
+ /** Sin ventas en la ventana viaja `0`: el barrido es exhaustivo. */
23
+ salesCount: number;
24
+ placedCents: number;
25
+ averageTicketCents: number | null;
26
+ /** Clientes distintos que compraron en la ventana. */
27
+ customersServed: number | null;
28
+ lastSaleAt: string | null;
29
+ /** Δ % contra la misma ventana 7 días antes; `null` si la ventana pasa de 7 días o no hubo base. */
30
+ weekOverWeekChangePct: number | null;
31
+ /** Meta mensual de la tienda escalada a los días de la ventana; `null` sin meta, con metas caídas o ventana > 90 días. */
32
+ goalCents: number | null;
33
+ /** % de la colocación de la cadena en la ventana, a un decimal; `null` si la cadena no colocó. */
34
+ networkSharePct: number | null;
35
+ /** NPI M30: no lo calcula ningún lambda todavía. Siempre `null`. */
36
+ npiM30Pct: null;
37
+ }
38
+
39
+ /** Estado de cada fuente. Una fuente `UNAVAILABLE` deja sus campos en `null`, nunca en `0`. */
40
+ export interface StoreTableSources {
41
+ roster: SellerTableSourceStatusEnum;
42
+ /** Vendedores de la cadena: equipo y nombre del encargado. */
43
+ team: SellerTableSourceStatusEnum;
44
+ goals: SellerTableSourceStatusEnum;
45
+ }
46
+
47
+ /**
48
+ * `GET /backoffice/stores/table?from&to&value` — la tabla completa de Tiendas del Portal Admin VL,
49
+ * sin paginación. Incluye las tiendas del padrón sin ventas y las inactivas.
50
+ */
51
+ export interface BackofficeStoreTableResponse {
52
+ from: string;
53
+ to: string;
54
+ /** Las ventas de la ventana pasaron el tope de lectura: los números están recortados. */
55
+ truncated: boolean;
56
+ sources: StoreTableSources;
57
+ items: StoreTableRow[];
58
+ }
@@ -0,0 +1,5 @@
1
+ /** Si la tienda es propia de la cadena o de un subdistribuidor. */
2
+ export enum StoreKindEnum {
3
+ OWN = 'OWN',
4
+ SUBDISTRIBUTOR = 'SUBDISTRIBUTOR',
5
+ }
@@ -162,6 +162,10 @@ export * from './dtos/responses/BackofficeStoreKpisResponse';
162
162
  export * from './dtos/responses/BackofficeSellerKpisResponse';
163
163
  export * from './enums/SellerTableSourceStatusEnum';
164
164
  export * from './dtos/responses/BackofficeSellerTableResponse';
165
+ export * from './dtos/responses/BackofficeCustomerTableResponse';
166
+ export * from './enums/StoreKindEnum';
167
+ export * from './dtos/responses/BackofficeStoreTableResponse';
168
+ export * from './dtos/responses/BackofficeStoreDetailResponse';
165
169
 
166
170
  // Contratos de eventos (PascalCase + sufijo V1)
167
171
  export * from './events/SaleCompletedV1';