@fiado/type-kit 3.535.0 → 3.536.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,54 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance } from 'class-transformer';
3
+ import { validate } from 'class-validator';
4
+ import {
5
+ CancelOtherStoreSaleRequest,
6
+ SystemCancelReasonEnum,
7
+ type ActiveSessionByPhoneResponse,
8
+ type CancelOtherStoreSaleResponse,
9
+ type WizardSession,
10
+ } from '../../../src/retailWizard';
11
+
12
+ async function errorsOf(body: Record<string, unknown>): Promise<string[]> {
13
+ const errors = await validate(plainToInstance(CancelOtherStoreSaleRequest, body));
14
+ return errors.map((e) => e.property);
15
+ }
16
+
17
+ describe('SystemCancelReasonEnum', () => {
18
+ it('names the cancel when another store takes the customer over', () => {
19
+ expect(SystemCancelReasonEnum.TAKEN_OVER_BY_OTHER_STORE).toBe('TAKEN_OVER_BY_OTHER_STORE');
20
+ });
21
+ });
22
+
23
+ describe('CancelOtherStoreSaleRequest', () => {
24
+ it('accepts a phone and a reason of at least 10 characters', async () => {
25
+ expect(await errorsOf({ phone: '5512345678', reason: 'El cliente compra aquí' })).toEqual([]);
26
+ });
27
+
28
+ it('the reason is mandatory and meaningful', async () => {
29
+ expect(await errorsOf({ phone: '5512345678' })).toContain('reason');
30
+ expect(await errorsOf({ phone: '5512345678', reason: 'corto' })).toContain('reason');
31
+ });
32
+
33
+ it('the phone is mandatory', async () => {
34
+ expect(await errorsOf({ reason: 'El cliente compra aquí' })).toContain('phone');
35
+ });
36
+ });
37
+
38
+ describe('cash-only sale', () => {
39
+ it('WizardSession and the sale by phone carry the cash-only mark', () => {
40
+ const session: Pick<WizardSession, 'cashOnly'> = { cashOnly: true };
41
+ const byPhone: Pick<ActiveSessionByPhoneResponse, 'cashOnly'> = { cashOnly: true };
42
+ const cancelled: CancelOtherStoreSaleResponse = { sessionId: 'S1', refundPendingCents: null };
43
+ expect([session.cashOnly, byPhone.cashOnly, cancelled.sessionId]).toEqual([true, true, 'S1']);
44
+ });
45
+ });
46
+
47
+ describe('MoneyAtStakeKindEnum', () => {
48
+ it('distinguishes a charged or closed sale from a quoted credit', async () => {
49
+ const { MoneyAtStakeKindEnum } = await import('../../../src/retailWizard');
50
+ expect(Object.values(MoneyAtStakeKindEnum)).toEqual(['SALE', 'CREDIT_QUOTED']);
51
+ const byPhone: Pick<ActiveSessionByPhoneResponse, 'moneyAtStakeKind'> = { moneyAtStakeKind: MoneyAtStakeKindEnum.CREDIT_QUOTED };
52
+ expect(byPhone.moneyAtStakeKind).toBe('CREDIT_QUOTED');
53
+ });
54
+ });
@@ -151,6 +151,11 @@ export interface WizardSession {
151
151
  /** Prospecto vinculado (si la sesión se reanudó desde un prospecto): se cierra al cerrar la venta (D-prospecto). */
152
152
  prospectId: string | null;
153
153
  cancelReason: string | null;
154
+ /**
155
+ * Venta solo de contado: el cliente tiene una venta con dinero en juego en otra sucursal.
156
+ * Crédito y derivación se rechazan con `CREDIT_IN_PROGRESS_OTHER_STORE`. Ausente = venta completa.
157
+ */
158
+ cashOnly?: boolean;
154
159
  /** TTL DDB ~24h de inactividad (D14). */
155
160
  ttlEpoch: number;
156
161
  createdBy: string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * POST /wizard/phone-holder/cancel y /backoffice/phone-holder/cancel — el encargado de tienda o el
3
+ * Admin VL cancela la venta viva de otra sucursal que retiene al cliente. SureKeep — pista Retail.
4
+ */
5
+ export declare class CancelOtherStoreSaleRequest {
6
+ /** Teléfono del cliente: la venta ajena no se expone, así que es la única llave. */
7
+ phone: string;
8
+ reason: string;
9
+ }
@@ -0,0 +1,34 @@
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.CancelOtherStoreSaleRequest = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * POST /wizard/phone-holder/cancel y /backoffice/phone-holder/cancel — el encargado de tienda o el
17
+ * Admin VL cancela la venta viva de otra sucursal que retiene al cliente. SureKeep — pista Retail.
18
+ */
19
+ class CancelOtherStoreSaleRequest {
20
+ }
21
+ exports.CancelOtherStoreSaleRequest = CancelOtherStoreSaleRequest;
22
+ __decorate([
23
+ (0, class_transformer_1.Expose)(),
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.MaxLength)(20),
26
+ __metadata("design:type", String)
27
+ ], CancelOtherStoreSaleRequest.prototype, "phone", void 0);
28
+ __decorate([
29
+ (0, class_transformer_1.Expose)(),
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.MinLength)(10),
32
+ (0, class_validator_1.MaxLength)(200),
33
+ __metadata("design:type", String)
34
+ ], CancelOtherStoreSaleRequest.prototype, "reason", void 0);
@@ -1,3 +1,4 @@
1
+ import type { MoneyAtStakeKindEnum } from '../../enums/MoneyAtStakeKindEnum';
1
2
  import type { WizardStateEnum } from '../../enums/WizardStateEnum';
2
3
  import type { WizardStepEnum } from '../../enums/WizardStepEnum';
3
4
  import type { WizardBlockedSummary } from '../WizardBlocked';
@@ -32,4 +33,8 @@ export interface ActiveSessionByPhoneResponse {
32
33
  exactUntil?: string | null;
33
34
  /** La venta movió dinero u originó crédito: siempre se retoma la misma. */
34
35
  moneyAtStake?: boolean;
36
+ /** Qué dinero retiene: SALE (folio, cobro o venta) o CREDIT_QUOTED (solo crédito cotizado); `null` = ninguno. */
37
+ moneyAtStakeKind?: MoneyAtStakeKindEnum | null;
38
+ /** Venta solo de contado (el cliente tiene una venta con dinero en otra sucursal). */
39
+ cashOnly?: boolean;
35
40
  }
@@ -0,0 +1,7 @@
1
+ /** Resultado de cancelar la venta de otra sucursal que retenía al cliente. SureKeep — pista Retail. */
2
+ export interface CancelOtherStoreSaleResponse {
3
+ /** Venta cancelada. */
4
+ sessionId: string;
5
+ /** Enganche cobrado que queda por reembolsar; `null` si no hubo cobro. */
6
+ refundPendingCents: number | null;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Qué dinero retiene la venta, para el texto de la ficha.
3
+ * SALE: hay folio, cobro o venta cerrada.
4
+ * CREDIT_QUOTED: solo hay un crédito cotizado (sin cobro).
5
+ */
6
+ export declare enum MoneyAtStakeKindEnum {
7
+ SALE = "SALE",
8
+ CREDIT_QUOTED = "CREDIT_QUOTED"
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MoneyAtStakeKindEnum = void 0;
4
+ /**
5
+ * Qué dinero retiene la venta, para el texto de la ficha.
6
+ * SALE: hay folio, cobro o venta cerrada.
7
+ * CREDIT_QUOTED: solo hay un crédito cotizado (sin cobro).
8
+ */
9
+ var MoneyAtStakeKindEnum;
10
+ (function (MoneyAtStakeKindEnum) {
11
+ MoneyAtStakeKindEnum["SALE"] = "SALE";
12
+ MoneyAtStakeKindEnum["CREDIT_QUOTED"] = "CREDIT_QUOTED";
13
+ })(MoneyAtStakeKindEnum || (exports.MoneyAtStakeKindEnum = MoneyAtStakeKindEnum = {}));
@@ -1,4 +1,9 @@
1
- /** `cancelReason` que escribe el sistema (no el vendedor). La saga cierra la venta cuyo crédito se descartó. */
1
+ /**
2
+ * `cancelReason` que escribe el sistema (no el vendedor).
3
+ * SWEEP_CREDIT_DISCARDED: la saga cierra la venta cuyo crédito se descartó.
4
+ * TAKEN_OVER_BY_OTHER_STORE: otra tienda tomó al cliente y la venta no tenía dinero en juego.
5
+ */
2
6
  export declare enum SystemCancelReasonEnum {
3
- SWEEP_CREDIT_DISCARDED = "SWEEP_CREDIT_DISCARDED"
7
+ SWEEP_CREDIT_DISCARDED = "SWEEP_CREDIT_DISCARDED",
8
+ TAKEN_OVER_BY_OTHER_STORE = "TAKEN_OVER_BY_OTHER_STORE"
4
9
  }
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SystemCancelReasonEnum = void 0;
4
- /** `cancelReason` que escribe el sistema (no el vendedor). La saga cierra la venta cuyo crédito se descartó. */
4
+ /**
5
+ * `cancelReason` que escribe el sistema (no el vendedor).
6
+ * SWEEP_CREDIT_DISCARDED: la saga cierra la venta cuyo crédito se descartó.
7
+ * TAKEN_OVER_BY_OTHER_STORE: otra tienda tomó al cliente y la venta no tenía dinero en juego.
8
+ */
5
9
  var SystemCancelReasonEnum;
6
10
  (function (SystemCancelReasonEnum) {
7
11
  SystemCancelReasonEnum["SWEEP_CREDIT_DISCARDED"] = "SWEEP_CREDIT_DISCARDED";
12
+ SystemCancelReasonEnum["TAKEN_OVER_BY_OTHER_STORE"] = "TAKEN_OVER_BY_OTHER_STORE";
8
13
  })(SystemCancelReasonEnum || (exports.SystemCancelReasonEnum = SystemCancelReasonEnum = {}));
@@ -19,6 +19,7 @@ export * from './enums/AccountStepStatusEnum';
19
19
  export * from './enums/ResumeReasonEnum';
20
20
  export * from './enums/ProspectResumeModeEnum';
21
21
  export * from './enums/SystemCancelReasonEnum';
22
+ export * from './enums/MoneyAtStakeKindEnum';
22
23
  export * from './enums/AppOnboardingStepEnum';
23
24
  export * from './enums/AppOnboardingStepStatusEnum';
24
25
  export * from './enums/BlockedReasonEnum';
@@ -58,6 +59,7 @@ export * from './dtos/Prospect';
58
59
  export * from './dtos/PaginatedResult';
59
60
  export * from './dtos/requests/StartSessionRequest';
60
61
  export * from './dtos/requests/CancelSessionRequest';
62
+ export * from './dtos/requests/CancelOtherStoreSaleRequest';
61
63
  export * from './dtos/requests/VerifyOtpRequest';
62
64
  export * from './dtos/requests/ResendOtpRequest';
63
65
  export * from './dtos/requests/SkipOtpRequest';
@@ -109,6 +111,7 @@ export * from './dtos/responses/RegisterDeviceResponse';
109
111
  export * from './dtos/responses/AccountStatusResponse';
110
112
  export * from './dtos/responses/ActiveSessionByPhoneResponse';
111
113
  export * from './dtos/responses/ProspectResumeResponse';
114
+ export * from './dtos/responses/CancelOtherStoreSaleResponse';
112
115
  export * from './dtos/responses/ProspectByPhoneResponse';
113
116
  export * from './dtos/responses/AppOnboardingResponse';
114
117
  export * from './enums/SaleFinancierEnum';
@@ -38,6 +38,7 @@ __exportStar(require("./enums/AccountStepStatusEnum"), exports);
38
38
  __exportStar(require("./enums/ResumeReasonEnum"), exports);
39
39
  __exportStar(require("./enums/ProspectResumeModeEnum"), exports);
40
40
  __exportStar(require("./enums/SystemCancelReasonEnum"), exports);
41
+ __exportStar(require("./enums/MoneyAtStakeKindEnum"), exports);
41
42
  __exportStar(require("./enums/AppOnboardingStepEnum"), exports);
42
43
  __exportStar(require("./enums/AppOnboardingStepStatusEnum"), exports);
43
44
  __exportStar(require("./enums/BlockedReasonEnum"), exports);
@@ -83,6 +84,7 @@ __exportStar(require("./dtos/PaginatedResult"), exports);
83
84
  // Request DTOs (input validado por endpoint)
84
85
  __exportStar(require("./dtos/requests/StartSessionRequest"), exports);
85
86
  __exportStar(require("./dtos/requests/CancelSessionRequest"), exports);
87
+ __exportStar(require("./dtos/requests/CancelOtherStoreSaleRequest"), exports);
86
88
  __exportStar(require("./dtos/requests/VerifyOtpRequest"), exports);
87
89
  __exportStar(require("./dtos/requests/ResendOtpRequest"), exports);
88
90
  __exportStar(require("./dtos/requests/SkipOtpRequest"), exports);
@@ -135,6 +137,7 @@ __exportStar(require("./dtos/responses/RegisterDeviceResponse"), exports);
135
137
  __exportStar(require("./dtos/responses/AccountStatusResponse"), exports);
136
138
  __exportStar(require("./dtos/responses/ActiveSessionByPhoneResponse"), exports);
137
139
  __exportStar(require("./dtos/responses/ProspectResumeResponse"), exports);
140
+ __exportStar(require("./dtos/responses/CancelOtherStoreSaleResponse"), exports);
138
141
  __exportStar(require("./dtos/responses/ProspectByPhoneResponse"), exports);
139
142
  __exportStar(require("./dtos/responses/AppOnboardingResponse"), exports);
140
143
  // ── F3 · Backoffice VentasLuga ────────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.535.0",
3
+ "version": "3.536.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -155,6 +155,11 @@ export interface WizardSession {
155
155
  /** Prospecto vinculado (si la sesión se reanudó desde un prospecto): se cierra al cerrar la venta (D-prospecto). */
156
156
  prospectId: string | null;
157
157
  cancelReason: string | null;
158
+ /**
159
+ * Venta solo de contado: el cliente tiene una venta con dinero en juego en otra sucursal.
160
+ * Crédito y derivación se rechazan con `CREDIT_IN_PROGRESS_OTHER_STORE`. Ausente = venta completa.
161
+ */
162
+ cashOnly?: boolean;
158
163
  /** TTL DDB ~24h de inactividad (D14). */
159
164
  ttlEpoch: number;
160
165
  createdBy: string;
@@ -0,0 +1,20 @@
1
+ import { Expose } from 'class-transformer';
2
+ import { IsString, MaxLength, MinLength } from 'class-validator';
3
+
4
+ /**
5
+ * POST /wizard/phone-holder/cancel y /backoffice/phone-holder/cancel — el encargado de tienda o el
6
+ * Admin VL cancela la venta viva de otra sucursal que retiene al cliente. SureKeep — pista Retail.
7
+ */
8
+ export class CancelOtherStoreSaleRequest {
9
+ /** Teléfono del cliente: la venta ajena no se expone, así que es la única llave. */
10
+ @Expose()
11
+ @IsString()
12
+ @MaxLength(20)
13
+ phone!: string;
14
+
15
+ @Expose()
16
+ @IsString()
17
+ @MinLength(10)
18
+ @MaxLength(200)
19
+ reason!: string;
20
+ }
@@ -1,3 +1,4 @@
1
+ import type { MoneyAtStakeKindEnum } from '../../enums/MoneyAtStakeKindEnum';
1
2
  import type { WizardStateEnum } from '../../enums/WizardStateEnum';
2
3
  import type { WizardStepEnum } from '../../enums/WizardStepEnum';
3
4
  import type { WizardBlockedSummary } from '../WizardBlocked';
@@ -33,4 +34,8 @@ export interface ActiveSessionByPhoneResponse {
33
34
  exactUntil?: string | null;
34
35
  /** La venta movió dinero u originó crédito: siempre se retoma la misma. */
35
36
  moneyAtStake?: boolean;
37
+ /** Qué dinero retiene: SALE (folio, cobro o venta) o CREDIT_QUOTED (solo crédito cotizado); `null` = ninguno. */
38
+ moneyAtStakeKind?: MoneyAtStakeKindEnum | null;
39
+ /** Venta solo de contado (el cliente tiene una venta con dinero en otra sucursal). */
40
+ cashOnly?: boolean;
36
41
  }
@@ -0,0 +1,7 @@
1
+ /** Resultado de cancelar la venta de otra sucursal que retenía al cliente. SureKeep — pista Retail. */
2
+ export interface CancelOtherStoreSaleResponse {
3
+ /** Venta cancelada. */
4
+ sessionId: string;
5
+ /** Enganche cobrado que queda por reembolsar; `null` si no hubo cobro. */
6
+ refundPendingCents: number | null;
7
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Qué dinero retiene la venta, para el texto de la ficha.
3
+ * SALE: hay folio, cobro o venta cerrada.
4
+ * CREDIT_QUOTED: solo hay un crédito cotizado (sin cobro).
5
+ */
6
+ export enum MoneyAtStakeKindEnum {
7
+ SALE = 'SALE',
8
+ CREDIT_QUOTED = 'CREDIT_QUOTED',
9
+ }
@@ -1,4 +1,9 @@
1
- /** `cancelReason` que escribe el sistema (no el vendedor). La saga cierra la venta cuyo crédito se descartó. */
1
+ /**
2
+ * `cancelReason` que escribe el sistema (no el vendedor).
3
+ * SWEEP_CREDIT_DISCARDED: la saga cierra la venta cuyo crédito se descartó.
4
+ * TAKEN_OVER_BY_OTHER_STORE: otra tienda tomó al cliente y la venta no tenía dinero en juego.
5
+ */
2
6
  export enum SystemCancelReasonEnum {
3
7
  SWEEP_CREDIT_DISCARDED = 'SWEEP_CREDIT_DISCARDED',
8
+ TAKEN_OVER_BY_OTHER_STORE = 'TAKEN_OVER_BY_OTHER_STORE',
4
9
  }
@@ -22,6 +22,7 @@ export * from './enums/AccountStepStatusEnum';
22
22
  export * from './enums/ResumeReasonEnum';
23
23
  export * from './enums/ProspectResumeModeEnum';
24
24
  export * from './enums/SystemCancelReasonEnum';
25
+ export * from './enums/MoneyAtStakeKindEnum';
25
26
  export * from './enums/AppOnboardingStepEnum';
26
27
  export * from './enums/AppOnboardingStepStatusEnum';
27
28
  export * from './enums/BlockedReasonEnum';
@@ -69,6 +70,7 @@ export * from './dtos/PaginatedResult';
69
70
  // Request DTOs (input validado por endpoint)
70
71
  export * from './dtos/requests/StartSessionRequest';
71
72
  export * from './dtos/requests/CancelSessionRequest';
73
+ export * from './dtos/requests/CancelOtherStoreSaleRequest';
72
74
  export * from './dtos/requests/VerifyOtpRequest';
73
75
  export * from './dtos/requests/ResendOtpRequest';
74
76
  export * from './dtos/requests/SkipOtpRequest';
@@ -122,6 +124,7 @@ export * from './dtos/responses/RegisterDeviceResponse';
122
124
  export * from './dtos/responses/AccountStatusResponse';
123
125
  export * from './dtos/responses/ActiveSessionByPhoneResponse';
124
126
  export * from './dtos/responses/ProspectResumeResponse';
127
+ export * from './dtos/responses/CancelOtherStoreSaleResponse';
125
128
  export * from './dtos/responses/ProspectByPhoneResponse';
126
129
  export * from './dtos/responses/AppOnboardingResponse';
127
130