@propriety/court-calendar 1.0.139 → 1.0.140

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/dist/index.mjs CHANGED
@@ -12233,7 +12233,7 @@ function au(t) {
12233
12233
  return iu(t) ? !1 : !t.evidence.uploaded || !t.evidence.uploaded.Evidence;
12234
12234
  }
12235
12235
  function L7(t) {
12236
- return t.OfferedBy === "Aventine" && t.LiveOffer === !0 && t.Offer != null && t.Offer !== 0;
12236
+ return t.OfferedBy === "Aventine" && Number(t.LiveOffer) === 1 && t.Offer != null && Number(t.Offer) !== 0;
12237
12237
  }
12238
12238
  function Fy(t) {
12239
12239
  return t.stipTracking?.Status ? t.stipTracking.Status === "NyscefUploaded" || t.stipTracking.Status === "SoOrdered" : !1;
package/dist/types.d.ts CHANGED
@@ -111,7 +111,7 @@ export interface NegotiationLog {
111
111
  CaseType: 'Town' | 'Village';
112
112
  Comments: string;
113
113
  DueDate: Date | null;
114
- LiveOffer: boolean;
114
+ LiveOffer: boolean | number;
115
115
  Negotiator: number;
116
116
  Offer: number;
117
117
  OfferDate: Date;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@propriety/court-calendar",
3
3
  "private": false,
4
- "version": "1.0.139",
4
+ "version": "1.0.140",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -8,7 +8,7 @@ function makeNeg(overrides: Partial<NegotiationLog> = {}): NegotiationLog {
8
8
  CaseType: 'Town',
9
9
  Comments: '',
10
10
  DueDate: null,
11
- LiveOffer: true,
11
+ LiveOffer: 1, // real API shape: tinyint 0/1, not a JS boolean
12
12
  Negotiator: 1,
13
13
  Offer: 100000,
14
14
  OfferDate: new Date('2025-01-01'),
@@ -43,14 +43,30 @@ function makeStip(overrides: Partial<StipulationStatus> = {}): StipulationStatus
43
43
  // ─── isSentOffer ──────────────────────────────────────────────────────────────
44
44
 
45
45
  describe('isSentOffer', () => {
46
- it('returns true for an Aventine live offer with a real amount', () => {
47
- expect(isSentOffer(makeNeg({ OfferedBy: 'Aventine', LiveOffer: true, Offer: 100000 }))).toBe(true);
46
+ it('returns true for an Aventine live offer (LiveOffer = 1) with a real amount', () => {
47
+ expect(isSentOffer(makeNeg({ OfferedBy: 'Aventine', LiveOffer: 1, Offer: 100000 }))).toBe(true);
48
48
  });
49
49
 
50
- it('returns false when LiveOffer is false (created but not sent)', () => {
50
+ it('returns true when LiveOffer is the boolean true (defensive)', () => {
51
+ expect(isSentOffer(makeNeg({ LiveOffer: true }))).toBe(true);
52
+ });
53
+
54
+ it('returns false when LiveOffer is 0 (created but not sent)', () => {
55
+ expect(isSentOffer(makeNeg({ LiveOffer: 0 }))).toBe(false);
56
+ });
57
+
58
+ it('returns false when LiveOffer is the boolean false', () => {
51
59
  expect(isSentOffer(makeNeg({ LiveOffer: false }))).toBe(false);
52
60
  });
53
61
 
62
+ it('returns true when LiveOffer is the string "1"', () => {
63
+ expect(isSentOffer(makeNeg({ LiveOffer: '1' as unknown as number }))).toBe(true);
64
+ });
65
+
66
+ it('returns false when LiveOffer is the string "0"', () => {
67
+ expect(isSentOffer(makeNeg({ LiveOffer: '0' as unknown as number }))).toBe(false);
68
+ });
69
+
54
70
  it('returns false when the offer amount is 0', () => {
55
71
  expect(isSentOffer(makeNeg({ Offer: 0 }))).toBe(false);
56
72
  });
@@ -35,7 +35,9 @@ export function hasCaseUnuploadedEvidence(c: Case): boolean {
35
35
  }
36
36
 
37
37
  export function isSentOffer(n: NegotiationLog): boolean {
38
- return n.OfferedBy === 'Aventine' && n.LiveOffer === true && n.Offer != null && n.Offer !== 0;
38
+ // LiveOffer is a MySQL tinyint; the API may send 0/1, true/false, or "0"/"1".
39
+ // Number(x) === 1 is correct for all three (and excludes the string "0", which Boolean() would not).
40
+ return n.OfferedBy === 'Aventine' && Number(n.LiveOffer) === 1 && n.Offer != null && Number(n.Offer) !== 0;
39
41
  }
40
42
 
41
43
  export function hasCaseSentOffer(c: Case): boolean {
package/src/types.ts CHANGED
@@ -138,7 +138,7 @@ export interface NegotiationLog {
138
138
  CaseType: 'Town' | 'Village';
139
139
  Comments: string;
140
140
  DueDate: Date | null;
141
- LiveOffer: boolean;
141
+ LiveOffer: boolean | number; // tinyint flag from the API: 1/0 (or true/false)
142
142
  Negotiator: number;
143
143
  Offer: number;
144
144
  OfferDate: Date;