@zeniai/client-epic-state 5.2.28 → 5.2.30

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.
@@ -145,9 +145,16 @@ export interface JEAccruedScheduledTransactionState extends Omit<JEScheduledTran
145
145
  export interface OneTimeAccrualEdits {
146
146
  expectedReversalDate?: ZeniDate;
147
147
  jeCreditAccountId?: ID;
148
+ /**
149
+ * Carried beside the id, not derived from it later: the accrual document stores the name too, so
150
+ * an id sent without its name leaves the row displaying the account the user just moved away
151
+ * from.
152
+ */
153
+ jeCreditAccountName?: string;
148
154
  jeDebitAccountId?: ID;
149
155
  jeDebitAccountingClassId?: ID;
150
156
  jeDebitAccountingClassName?: string;
157
+ jeDebitAccountName?: string;
151
158
  memo?: string;
152
159
  /**
153
160
  * The Auto Reversal toggle, modelled as the same boolean the New form and the create payload use
@@ -73,17 +73,39 @@ export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$
73
73
  const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
74
74
  const debitClassName = edits?.jeDebitAccountingClassName ??
75
75
  accrual?.jeDebitAccountingClassName;
76
+ // The accrual document stores names alongside ids, so every id below travels with its name.
77
+ // Sending an id on its own leaves the stored row -- and the JE posted from it -- naming the
78
+ // account the user just moved away from. Create has always sent the full set; promote did
79
+ // not, which is the difference the two paths were showing.
80
+ const debitAccountName = edits?.jeDebitAccountName ?? accrual?.jeDebitAccountName;
81
+ const creditAccountName = edits?.jeCreditAccountName ?? accrual?.jeCreditAccountName;
82
+ // Credit-side class is never edited on this form -- the liability side is the Balance Sheet
83
+ // class the draft was born with -- so it is echoed straight back from the draft.
84
+ const creditClassId = accrual?.jeCreditAccountingClassId;
85
+ const creditClassName = accrual?.jeCreditAccountingClassName;
76
86
  const payload = {
77
87
  amount,
78
88
  memo: edits?.memo ?? accrual?.memo ?? '',
79
89
  je_debit_account_id: debitAccountId,
80
90
  je_credit_account_id: creditAccountId,
91
+ ...(debitAccountName != null
92
+ ? { je_debit_account_name: debitAccountName }
93
+ : {}),
94
+ ...(creditAccountName != null
95
+ ? { je_credit_account_name: creditAccountName }
96
+ : {}),
81
97
  ...(debitClassId != null
82
98
  ? { je_debit_accounting_class_id: debitClassId }
83
99
  : {}),
84
100
  ...(debitClassName != null
85
101
  ? { je_debit_accounting_class_name: debitClassName }
86
102
  : {}),
103
+ ...(creditClassId != null
104
+ ? { je_credit_accounting_class_id: creditClassId }
105
+ : {}),
106
+ ...(creditClassName != null
107
+ ? { je_credit_accounting_class_name: creditClassName }
108
+ : {}),
87
109
  // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
88
110
  // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
89
111
  reverse_next_month: reverseNextMonth,
@@ -76,17 +76,39 @@ const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((
76
76
  const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
77
77
  const debitClassName = edits?.jeDebitAccountingClassName ??
78
78
  accrual?.jeDebitAccountingClassName;
79
+ // The accrual document stores names alongside ids, so every id below travels with its name.
80
+ // Sending an id on its own leaves the stored row -- and the JE posted from it -- naming the
81
+ // account the user just moved away from. Create has always sent the full set; promote did
82
+ // not, which is the difference the two paths were showing.
83
+ const debitAccountName = edits?.jeDebitAccountName ?? accrual?.jeDebitAccountName;
84
+ const creditAccountName = edits?.jeCreditAccountName ?? accrual?.jeCreditAccountName;
85
+ // Credit-side class is never edited on this form -- the liability side is the Balance Sheet
86
+ // class the draft was born with -- so it is echoed straight back from the draft.
87
+ const creditClassId = accrual?.jeCreditAccountingClassId;
88
+ const creditClassName = accrual?.jeCreditAccountingClassName;
79
89
  const payload = {
80
90
  amount,
81
91
  memo: edits?.memo ?? accrual?.memo ?? '',
82
92
  je_debit_account_id: debitAccountId,
83
93
  je_credit_account_id: creditAccountId,
94
+ ...(debitAccountName != null
95
+ ? { je_debit_account_name: debitAccountName }
96
+ : {}),
97
+ ...(creditAccountName != null
98
+ ? { je_credit_account_name: creditAccountName }
99
+ : {}),
84
100
  ...(debitClassId != null
85
101
  ? { je_debit_accounting_class_id: debitClassId }
86
102
  : {}),
87
103
  ...(debitClassName != null
88
104
  ? { je_debit_accounting_class_name: debitClassName }
89
105
  : {}),
106
+ ...(creditClassId != null
107
+ ? { je_credit_accounting_class_id: creditClassId }
108
+ : {}),
109
+ ...(creditClassName != null
110
+ ? { je_credit_accounting_class_name: creditClassName }
111
+ : {}),
90
112
  // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
91
113
  // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
92
114
  reverse_next_month: reverseNextMonth,
@@ -119,8 +119,10 @@ export interface PromoteOneTimeAccrualPayload {
119
119
  je_debit_account_id: ID;
120
120
  memo: string;
121
121
  expected_reversal_date?: string;
122
+ je_credit_account_name?: string;
122
123
  je_credit_accounting_class_id?: ID;
123
124
  je_credit_accounting_class_name?: string;
125
+ je_debit_account_name?: string;
124
126
  je_debit_accounting_class_id?: ID;
125
127
  je_debit_accounting_class_name?: string;
126
128
  reverse_next_month?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.28",
3
+ "version": "5.2.30",
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",