@zeniai/client-epic-state 5.3.10-beta0KB → 5.3.10-beta1KB

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.
@@ -137,7 +137,15 @@ export const prepareCreateTransactionPayload = (state, localData) => {
137
137
  if (transactionType === 'journal_entry') {
138
138
  return { ...base, ...documentId, lines };
139
139
  }
140
- // A bill posts to accounts payable, so it carries no header account or payment type.
140
+ // Both post to accounts payable, so they carry no header account or payment type.
141
+ if (transactionType === 'vendor_credit') {
142
+ return {
143
+ ...base,
144
+ vendor_id: toQboVendorId(state, localData.vendorId),
145
+ ...documentId,
146
+ lines,
147
+ };
148
+ }
141
149
  if (transactionType === 'bill') {
142
150
  return {
143
151
  ...base,
@@ -9,4 +9,5 @@ export const ALL_CREATABLE_TRANSACTION_TYPES = [
9
9
  'transfer',
10
10
  'journal_entry',
11
11
  'bill',
12
+ 'vendor_credit',
12
13
  ];
@@ -13,8 +13,9 @@ import { CreateTransactionLocalData } from './createTransactionState';
13
13
  * constant NAMES; ZENI_LINE_DETAIL_TYPE_TO_QBO_LINE_DETAIL_TYPE_MAP converts them for the
14
14
  * body the backend sends on to QuickBooks, never for ours.
15
15
  * 2. The QBO Purchases (check, credit_card_credit) send their reference number as
16
- * `document_number`; a journal entry sends its entry name, and a bill its bill number, as
17
- * `document_id`. All land on QBO's DocNumber, but QBOJournalEntry reads only `document_id`.
16
+ * `document_number`; a journal entry sends its entry name, a bill its bill number and a
17
+ * vendor credit its reference number as `document_id`. All land on QBO's DocNumber, but
18
+ * QBOJournalEntry reads only `document_id`.
18
19
  */
19
20
  export interface CreateTransactionAccountPayload {
20
21
  qbo_id: ID;
@@ -53,7 +54,7 @@ export interface CreateTransactionRemitToAddressPayload {
53
54
  export interface CreateTransactionRequest extends Record<string, unknown> {
54
55
  transaction_date: string;
55
56
  transaction_type: string;
56
- /** journal_entry entry name or bill number (QBO DocNumber). */
57
+ /** journal_entry entry name, bill number or vendor_credit reference number (QBO DocNumber). */
57
58
  document_id?: string;
58
59
  /** check / credit_card_credit reference number (QBO Purchase). */
59
60
  document_number?: string;
@@ -141,7 +141,15 @@ const prepareCreateTransactionPayload = (state, localData) => {
141
141
  if (transactionType === 'journal_entry') {
142
142
  return { ...base, ...documentId, lines };
143
143
  }
144
- // A bill posts to accounts payable, so it carries no header account or payment type.
144
+ // Both post to accounts payable, so they carry no header account or payment type.
145
+ if (transactionType === 'vendor_credit') {
146
+ return {
147
+ ...base,
148
+ vendor_id: toQboVendorId(state, localData.vendorId),
149
+ ...documentId,
150
+ lines,
151
+ };
152
+ }
145
153
  if (transactionType === 'bill') {
146
154
  return {
147
155
  ...base,
@@ -9,7 +9,7 @@ import { ZeniDate } from '../../../zeniDayJS';
9
9
  * The transaction types the Create Transaction flow can originate. A narrow subset of
10
10
  * TransactionType -- everything else is read-only and arrives via sync.
11
11
  */
12
- export declare const ALL_CREATABLE_TRANSACTION_TYPES: readonly ["expense", "check", "credit_card_credit", "transfer", "journal_entry", "bill"];
12
+ export declare const ALL_CREATABLE_TRANSACTION_TYPES: readonly ["expense", "check", "credit_card_credit", "transfer", "journal_entry", "bill", "vendor_credit"];
13
13
  export type CreatableTransactionType = (typeof ALL_CREATABLE_TRANSACTION_TYPES)[number];
14
14
  /**
15
15
  * The wire shape the create endpoint expects for a check's remit-to address. Deliberately not
@@ -54,7 +54,10 @@ export interface CreateTransactionLocalData {
54
54
  /** Empty for transfer, which has no lines at all. */
55
55
  lines: CreateTransactionLineLocalData[];
56
56
  transactionType: CreatableTransactionType;
57
- /** check / credit_card_credit reference number, journal_entry entry name, or bill number. */
57
+ /**
58
+ * check / credit_card_credit / vendor_credit reference number, journal_entry entry name, or
59
+ * bill number.
60
+ */
58
61
  documentNumber?: string;
59
62
  /** bill only. */
60
63
  dueDate?: ZeniDate;
@@ -12,4 +12,5 @@ exports.ALL_CREATABLE_TRANSACTION_TYPES = [
12
12
  'transfer',
13
13
  'journal_entry',
14
14
  'bill',
15
+ 'vendor_credit',
15
16
  ];
@@ -177,39 +177,39 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
177
177
  }, "transactionDetail/deleteSplitLine", never, never>, toggleSplitEditMode: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, editMode: boolean], {
178
178
  transactionId: TransactionID;
179
179
  editMode: boolean;
180
- }, "transactionDetail/toggleSplitEditMode", never, never>, initializeCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry"], {
181
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
182
- }, "transactionDetail/initializeCreateTransactionLocalData", never, never>, updateCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", localData: Partial<CreateTransactionLocalData>], {
183
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
180
+ }, "transactionDetail/toggleSplitEditMode", never, never>, initializeCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry"], {
181
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
182
+ }, "transactionDetail/initializeCreateTransactionLocalData", never, never>, updateCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", localData: Partial<CreateTransactionLocalData>], {
183
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
184
184
  localData: Partial<CreateTransactionLocalData>;
185
- }, "transactionDetail/updateCreateTransactionLocalData", never, never>, updateCreateTransactionLineLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string, lineUpdates: Partial<CreateTransactionLineLocalData>], {
186
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
185
+ }, "transactionDetail/updateCreateTransactionLocalData", never, never>, updateCreateTransactionLineLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string, lineUpdates: Partial<CreateTransactionLineLocalData>], {
186
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
187
187
  lineId: string;
188
188
  lineUpdates: Partial<CreateTransactionLineLocalData>;
189
- }, "transactionDetail/updateCreateTransactionLineLocalData", never, never>, addCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", line?: Partial<CreateTransactionLineLocalData> | undefined], {
190
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
189
+ }, "transactionDetail/updateCreateTransactionLineLocalData", never, never>, addCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", line?: Partial<CreateTransactionLineLocalData> | undefined], {
190
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
191
191
  line: Partial<CreateTransactionLineLocalData> | undefined;
192
- }, "transactionDetail/addCreateTransactionLine", never, never>, removeCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string], {
193
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
192
+ }, "transactionDetail/addCreateTransactionLine", never, never>, removeCreateTransactionLine: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", lineId: string], {
193
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
194
194
  lineId: string;
195
- }, "transactionDetail/removeCreateTransactionLine", never, never>, resetCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry"], {
196
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
197
- }, "transactionDetail/resetCreateTransactionLocalData", never, never>, createTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry"], {
198
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
195
+ }, "transactionDetail/removeCreateTransactionLine", never, never>, resetCreateTransactionLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry"], {
196
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
197
+ }, "transactionDetail/resetCreateTransactionLocalData", never, never>, createTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry"], {
198
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
199
199
  }, "transactionDetail/createTransaction", never, never>, createTransactionSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, createdTransactionId?: TransactionID | undefined, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
200
200
  fetchState: FetchState;
201
201
  createdTransactionId: TransactionID | undefined;
202
202
  error: ZeniAPIStatus<Record<string, unknown>> | undefined;
203
- }, "transactionDetail/createTransactionSuccessOrFailure", never, never>, setRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], recommendations: Recommendation[], isAccountingClassesEnabled: boolean], {
204
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
203
+ }, "transactionDetail/createTransactionSuccessOrFailure", never, never>, setRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], recommendations: Recommendation[], isAccountingClassesEnabled: boolean], {
204
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
205
205
  lineIds: string[];
206
206
  recommendations: Recommendation[];
207
207
  isAccountingClassesEnabled: boolean;
208
- }, "transactionDetail/setRecommendationsForCreateTransactionLines", never, never>, clearRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[]], {
209
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
208
+ }, "transactionDetail/setRecommendationsForCreateTransactionLines", never, never>, clearRecommendationsForCreateTransactionLines: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[]], {
209
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
210
210
  lineIds: string[];
211
- }, "transactionDetail/clearRecommendationsForCreateTransactionLines", never, never>, fetchVendorRecommendationsForCreateTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], entity?: Entity | undefined], {
212
- transactionType: "expense" | "check" | "bill" | "credit_card_credit" | "transfer" | "journal_entry";
211
+ }, "transactionDetail/clearRecommendationsForCreateTransactionLines", never, never>, fetchVendorRecommendationsForCreateTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry", lineIds: string[], entity?: Entity | undefined], {
212
+ transactionType: "expense" | "check" | "bill" | "vendor_credit" | "credit_card_credit" | "transfer" | "journal_entry";
213
213
  lineIds: string[];
214
214
  entity: Entity | undefined;
215
215
  }, "transactionDetail/fetchVendorRecommendationsForCreateTransaction", never, never>, createTransactionAttachmentUploadFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedAttachmentFileNames: string[]], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.3.10-beta0KB",
3
+ "version": "5.3.10-beta1KB",
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",