@fiado/type-kit 3.506.0 → 3.507.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.
- package/_test_/unit/retailWizard/customerTableShapes.test.ts +36 -0
- package/bin/retailWizard/dtos/responses/BackofficeCustomerTableResponse.d.ts +38 -0
- package/bin/retailWizard/dtos/responses/BackofficeCustomerTableResponse.js +2 -0
- package/bin/retailWizard/index.d.ts +1 -0
- package/bin/retailWizard/index.js +1 -0
- package/package.json +1 -1
- package/src/retailWizard/dtos/responses/BackofficeCustomerTableResponse.ts +41 -0
- package/src/retailWizard/index.ts +1 -0
|
@@ -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,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
|
+
}
|
|
@@ -137,6 +137,7 @@ 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';
|
|
140
141
|
export * from './events/SaleCompletedV1';
|
|
141
142
|
export * from './events/SaleCancelledV1';
|
|
142
143
|
export * from './events/SaleCompletedV2';
|
|
@@ -170,6 +170,7 @@ __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);
|
|
173
174
|
// Contratos de eventos (PascalCase + sufijo V1)
|
|
174
175
|
__exportStar(require("./events/SaleCompletedV1"), exports);
|
|
175
176
|
__exportStar(require("./events/SaleCancelledV1"), exports);
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|
|
@@ -162,6 +162,7 @@ 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';
|
|
165
166
|
|
|
166
167
|
// Contratos de eventos (PascalCase + sufijo V1)
|
|
167
168
|
export * from './events/SaleCompletedV1';
|