@zeniai/client-epic-state 5.2.11-betaRD6 → 5.2.11-betaRD7

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.
@@ -149,7 +149,12 @@ export interface OneTimeAccrualEdits {
149
149
  jeDebitAccountingClassId?: ID;
150
150
  jeDebitAccountingClassName?: string;
151
151
  memo?: string;
152
- reversalPolicy?: OneTimeAccrualReversalPolicyType;
152
+ /**
153
+ * The Auto Reversal toggle, modelled as the same boolean the New form and the create payload use
154
+ * rather than a policy string: `reverse_next_month` alone decides the policy server-side, and
155
+ * sending both would be two sources of truth for one control.
156
+ */
157
+ reverseNextMonth?: boolean;
153
158
  }
154
159
  export interface JEOneTimeAccrualCreator {
155
160
  userId: ID;
@@ -63,7 +63,10 @@ export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$
63
63
  // vendor_id, vendor_name and service_month are deliberately absent: promote takes them from
64
64
  // the stored draft and ignores them in the body, so sending them would imply a reassignment
65
65
  // that never happens.
66
- const reversalPolicy = edits?.reversalPolicy ?? accrual?.reversalPolicy;
66
+ // Untouched falls back to the stored policy, so posting without editing cannot silently
67
+ // flip a scheduled reversal to on-bill-match.
68
+ const reverseNextMonth = edits?.reverseNextMonth ??
69
+ accrual?.reversalPolicy === 'scheduled_date';
67
70
  const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
68
71
  const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
69
72
  const debitClassName = edits?.jeDebitAccountingClassName ??
@@ -77,9 +80,10 @@ export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$
77
80
  ...(debitClassName != null
78
81
  ? { je_debit_accounting_class_name: debitClassName }
79
82
  : {}),
80
- ...(reversalPolicy != null ? { reversal_policy: reversalPolicy } : {}),
81
- // Only meaningful for the scheduled-date policy; agent-je derives it for on_bill_match.
82
- ...(reversalPolicy === 'scheduled_date' && expectedReversalDate != null
83
+ // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
84
+ // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
85
+ reverse_next_month: reverseNextMonth,
86
+ ...(reverseNextMonth && expectedReversalDate != null
83
87
  ? {
84
88
  expected_reversal_date: expectedReversalDate.format(DEFAULT_DATE_FORMAT),
85
89
  }
@@ -66,7 +66,10 @@ const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((
66
66
  // vendor_id, vendor_name and service_month are deliberately absent: promote takes them from
67
67
  // the stored draft and ignores them in the body, so sending them would imply a reassignment
68
68
  // that never happens.
69
- const reversalPolicy = edits?.reversalPolicy ?? accrual?.reversalPolicy;
69
+ // Untouched falls back to the stored policy, so posting without editing cannot silently
70
+ // flip a scheduled reversal to on-bill-match.
71
+ const reverseNextMonth = edits?.reverseNextMonth ??
72
+ accrual?.reversalPolicy === 'scheduled_date';
70
73
  const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
71
74
  const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
72
75
  const debitClassName = edits?.jeDebitAccountingClassName ??
@@ -80,9 +83,10 @@ const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((
80
83
  ...(debitClassName != null
81
84
  ? { je_debit_accounting_class_name: debitClassName }
82
85
  : {}),
83
- ...(reversalPolicy != null ? { reversal_policy: reversalPolicy } : {}),
84
- // Only meaningful for the scheduled-date policy; agent-je derives it for on_bill_match.
85
- ...(reversalPolicy === 'scheduled_date' && expectedReversalDate != null
86
+ // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
87
+ // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
88
+ reverse_next_month: reverseNextMonth,
89
+ ...(reverseNextMonth && expectedReversalDate != null
86
90
  ? {
87
91
  expected_reversal_date: expectedReversalDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
88
92
  }
@@ -70,7 +70,7 @@ export interface PromoteOneTimeAccrualPayload {
70
70
  je_credit_accounting_class_name?: string;
71
71
  je_debit_accounting_class_id?: ID;
72
72
  je_debit_accounting_class_name?: string;
73
- reversal_policy?: string;
73
+ reverse_next_month?: boolean;
74
74
  }
75
75
  /**
76
76
  * Ignore body. `scope` is deliberately absent — the API returns 400 if it is sent, which is why the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.11-betaRD6",
3
+ "version": "5.2.11-betaRD7",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",