@zeniai/client-epic-state 4.9.58 → 4.9.59

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.
@@ -136,6 +136,6 @@ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBi
136
136
  recurringBillInstancesLocalData: RecurringBillInstance[];
137
137
  recurringConfigLocalData?: RecurringBillConfigLocalData | undefined;
138
138
  };
139
- export declare const getInvoiceDate: (invoiceDate: ZeniDate, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
140
- export declare const getDueDate: (dueDate: ZeniDate, invoiceDate?: import("dayjs").Dayjs | undefined, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
139
+ export declare const getInvoiceDate: (billStageCode: BillStageCodeType, invoiceDate: ZeniDate, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
140
+ export declare const getDueDate: (billStageCode: BillStageCodeType, dueDate: ZeniDate, invoiceDate?: import("dayjs").Dayjs | undefined, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
141
141
  export declare const getWithdrawFrom: (paymentAccountState: PaymentAccountState, depositAccountState: DepositAccountState, fromAccountId: ID, fromAccountType: string) => TransferMoneyParty | undefined;
@@ -558,8 +558,10 @@ const getRecurringBillLocalData = (recurringBillState, transaction) => {
558
558
  return { recurringConfigLocalData, recurringBillInstancesLocalData };
559
559
  };
560
560
  exports.getRecurringBillLocalData = getRecurringBillLocalData;
561
- const getInvoiceDate = (invoiceDate, bookCloseDate) => {
562
- if (bookCloseDate != null && invoiceDate.isBefore(bookCloseDate)) {
561
+ const getInvoiceDate = (billStageCode, invoiceDate, bookCloseDate) => {
562
+ if (billStageCode === 'draft' &&
563
+ bookCloseDate != null &&
564
+ invoiceDate.isBefore(bookCloseDate)) {
563
565
  return (0, zeniDayJS_1.dateNow)().startOf('month');
564
566
  }
565
567
  else {
@@ -567,8 +569,9 @@ const getInvoiceDate = (invoiceDate, bookCloseDate) => {
567
569
  }
568
570
  };
569
571
  exports.getInvoiceDate = getInvoiceDate;
570
- const getDueDate = (dueDate, invoiceDate, bookCloseDate) => {
571
- if (bookCloseDate != null &&
572
+ const getDueDate = (billStageCode, dueDate, invoiceDate, bookCloseDate) => {
573
+ if (billStageCode === 'draft' &&
574
+ bookCloseDate != null &&
572
575
  invoiceDate != null &&
573
576
  invoiceDate.isBefore(bookCloseDate)) {
574
577
  return (0, zeniDayJS_1.dateNow)().startOf('month');
@@ -138,12 +138,14 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
138
138
  const whatForSection = {
139
139
  invoiceNumber: transaction.documentId,
140
140
  billDueDate: transaction.dueDate != null && transaction.date != null
141
- ? (0, editBillViewSelector_1.getDueDate)(transaction.dueDate, transaction.date, bookCloseDate)
141
+ ? (0, editBillViewSelector_1.getDueDate)(transaction.billPayInfo.stage.code, transaction.dueDate, transaction.date, bookCloseDate)
142
142
  : transaction.dueDate,
143
- invoiceDate: (0, editBillViewSelector_1.getInvoiceDate)(transaction.date, bookCloseDate),
143
+ invoiceDate: (0, editBillViewSelector_1.getInvoiceDate)(transaction.billPayInfo.stage.code, transaction.date, bookCloseDate),
144
144
  memo: transaction.memo,
145
145
  currencyCode: transaction.amount.currencyCode,
146
- isInvoiceDateAutoUpdated: transaction.date != null && bookCloseDate != null
146
+ isInvoiceDateAutoUpdated: transaction.billPayInfo.stage.code === 'draft' &&
147
+ transaction.date != null &&
148
+ bookCloseDate != null
147
149
  ? transaction.date.isBefore(bookCloseDate)
148
150
  : false,
149
151
  };
@@ -190,11 +190,11 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
190
190
  const fromAccountType = (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_m = (_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_type) !== null && _m !== void 0 ? _m : ''));
191
191
  const bookCloseDate = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyInfo.bookCloseDate;
192
192
  const invoiceDate = Boolean(billPayload.transaction_date) === true
193
- ? (0, editBillViewSelector_1.getInvoiceDate)((0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
193
+ ? (0, editBillViewSelector_1.getInvoiceDate)('draft', (0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
194
194
  : undefined;
195
195
  const dueDate = Boolean(billPayload.due_date) === true
196
196
  ? Boolean(billPayload.transaction_date) === true
197
- ? (0, editBillViewSelector_1.getDueDate)((0, zeniDayJS_1.date)(billPayload.due_date), (0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
197
+ ? (0, editBillViewSelector_1.getDueDate)('draft', (0, zeniDayJS_1.date)(billPayload.due_date), (0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
198
198
  : (0, zeniDayJS_1.date)(billPayload.due_date)
199
199
  : undefined;
200
200
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.9.58",
3
+ "version": "4.9.59",
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
  "types": "lib/index.d.ts",