@fiado/type-kit 3.637.0 → 3.638.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.
@@ -1,4 +1,5 @@
1
1
  import type { CommissionPlanStatusEnum } from '../enums/CommissionPlanStatusEnum';
2
+ import type { CommissionRuleStatusEnum } from '../enums/CommissionRuleStatusEnum';
2
3
  import type { CommissionPayoutStatusEnum } from '../enums/CommissionPayoutStatusEnum';
3
4
  import type { CommissionAddOn, CommissionCategory, CommissionPlanSnapshot, CommissionQuota } from './CommissionPlan';
4
5
  import type { CommissionAccrual, CommissionAppliedBonus, CommissionSaleInput, CommissionSaleLine } from './CommissionAccrual';
@@ -227,12 +228,74 @@ export interface RuleActionResponse {
227
228
  rule: CommissionRule;
228
229
  snapshotId: string;
229
230
  }
231
+ /** Un campo de la regla que cambió de una versión a la siguiente, con su valor antes y después. */
232
+ export type CommissionRuleChange = {
233
+ field: 'name';
234
+ before: string;
235
+ after: string;
236
+ } | {
237
+ field: 'description';
238
+ before: string | null;
239
+ after: string | null;
240
+ } | {
241
+ field: 'levers';
242
+ before: CommissionRuleLevers;
243
+ after: CommissionRuleLevers;
244
+ } | {
245
+ field: 'scope';
246
+ before: CommissionRuleScope;
247
+ after: CommissionRuleScope;
248
+ } | {
249
+ field: 'condition';
250
+ before: CommissionRuleCondition | null;
251
+ after: CommissionRuleCondition | null;
252
+ } | {
253
+ field: 'effectiveFrom';
254
+ before: string;
255
+ after: string;
256
+ } | {
257
+ field: 'effectiveTo';
258
+ before: string | null;
259
+ after: string | null;
260
+ } | {
261
+ field: 'priority';
262
+ before: number;
263
+ after: number;
264
+ } | {
265
+ field: 'replacesOthers';
266
+ before: boolean;
267
+ after: boolean;
268
+ } | {
269
+ field: 'countBy';
270
+ before: CommissionCountByEnum;
271
+ after: CommissionCountByEnum;
272
+ } | {
273
+ field: 'payTiming';
274
+ before: CommissionPayTimingEnum;
275
+ after: CommissionPayTimingEnum;
276
+ } | {
277
+ field: 'onSaleAdvanceBps';
278
+ before: number | null;
279
+ after: number | null;
280
+ };
230
281
  /** Un evento del historial de una regla. */
231
282
  export interface CommissionRuleEvent {
232
283
  at: string;
233
284
  action: string;
234
285
  performedBy: string;
235
286
  version: number | null;
287
+ /**
288
+ * Solo en ediciones: lo que cambió respecto a la versión anterior; vacío si no cambió ningún campo.
289
+ * Ausente si no hay versión anterior con qué comparar, y en motores anteriores.
290
+ */
291
+ changes?: CommissionRuleChange[];
292
+ /** Junto a `changes`: si la versión editada cuenta piezas o ventas, para leer sus palancas y su condición. */
293
+ countBy?: CommissionCountByEnum;
294
+ /** El estado que tenía la regla y el que le dejó el evento; `null` si no lo cambió o no se sabe. Ausente en motores anteriores. */
295
+ statusChange?: {
296
+ from: CommissionRuleStatusEnum;
297
+ to: CommissionRuleStatusEnum;
298
+ } | null;
236
299
  }
237
300
  /** `GET /backoffice/commissions/rules/{ruleId}/history` — del más nuevo al más viejo. */
238
301
  export interface RuleHistoryResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/type-kit",
3
- "version": "3.637.0",
3
+ "version": "3.638.0",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import type { CommissionPlanStatusEnum } from '../enums/CommissionPlanStatusEnum';
2
+ import type { CommissionRuleStatusEnum } from '../enums/CommissionRuleStatusEnum';
2
3
  import type { CommissionPayoutStatusEnum } from '../enums/CommissionPayoutStatusEnum';
3
4
  import type {
4
5
  CommissionAddOn,
@@ -295,12 +296,36 @@ export interface RuleActionResponse {
295
296
  snapshotId: string;
296
297
  }
297
298
 
299
+ /** Un campo de la regla que cambió de una versión a la siguiente, con su valor antes y después. */
300
+ export type CommissionRuleChange =
301
+ | { field: 'name'; before: string; after: string }
302
+ | { field: 'description'; before: string | null; after: string | null }
303
+ | { field: 'levers'; before: CommissionRuleLevers; after: CommissionRuleLevers }
304
+ | { field: 'scope'; before: CommissionRuleScope; after: CommissionRuleScope }
305
+ | { field: 'condition'; before: CommissionRuleCondition | null; after: CommissionRuleCondition | null }
306
+ | { field: 'effectiveFrom'; before: string; after: string }
307
+ | { field: 'effectiveTo'; before: string | null; after: string | null }
308
+ | { field: 'priority'; before: number; after: number }
309
+ | { field: 'replacesOthers'; before: boolean; after: boolean }
310
+ | { field: 'countBy'; before: CommissionCountByEnum; after: CommissionCountByEnum }
311
+ | { field: 'payTiming'; before: CommissionPayTimingEnum; after: CommissionPayTimingEnum }
312
+ | { field: 'onSaleAdvanceBps'; before: number | null; after: number | null };
313
+
298
314
  /** Un evento del historial de una regla. */
299
315
  export interface CommissionRuleEvent {
300
316
  at: string;
301
317
  action: string;
302
318
  performedBy: string;
303
319
  version: number | null;
320
+ /**
321
+ * Solo en ediciones: lo que cambió respecto a la versión anterior; vacío si no cambió ningún campo.
322
+ * Ausente si no hay versión anterior con qué comparar, y en motores anteriores.
323
+ */
324
+ changes?: CommissionRuleChange[];
325
+ /** Junto a `changes`: si la versión editada cuenta piezas o ventas, para leer sus palancas y su condición. */
326
+ countBy?: CommissionCountByEnum;
327
+ /** El estado que tenía la regla y el que le dejó el evento; `null` si no lo cambió o no se sabe. Ausente en motores anteriores. */
328
+ statusChange?: { from: CommissionRuleStatusEnum; to: CommissionRuleStatusEnum } | null;
304
329
  }
305
330
 
306
331
  /** `GET /backoffice/commissions/rules/{ruleId}/history` — del más nuevo al más viejo. */