@zeniai/client-epic-state 5.1.78 → 5.1.80

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.
Files changed (100) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +0 -42
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +1 -66
  3. package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
  4. package/lib/entity/tenant/clearAllEpic.js +0 -2
  5. package/lib/epic.d.ts +1 -2
  6. package/lib/epic.js +1 -7
  7. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +0 -61
  8. package/lib/esm/entity/tenant/clearAllEpic.js +0 -2
  9. package/lib/esm/epic.js +1 -7
  10. package/lib/esm/index.js +1 -5
  11. package/lib/esm/reducer.js +0 -3
  12. package/lib/esm/view/dashboard/dashboardSelector.js +10 -14
  13. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +18 -4
  14. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -6
  15. package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +8 -1
  16. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -4
  17. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +11 -10
  18. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +10 -8
  19. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
  20. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +1 -1
  21. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +1 -1
  22. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +1 -43
  23. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +44 -0
  24. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +5 -2
  25. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +2 -1
  26. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +1 -7
  27. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +0 -3
  28. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +11 -4
  29. package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -0
  30. package/lib/esm/view/invoicing/recordPayment/recordPaymentPayload.js +14 -5
  31. package/lib/index.d.ts +1 -7
  32. package/lib/index.js +4 -20
  33. package/lib/reducer.d.ts +0 -3
  34. package/lib/reducer.js +0 -3
  35. package/lib/view/dashboard/dashboardSelector.d.ts +3 -2
  36. package/lib/view/dashboard/dashboardSelector.js +9 -13
  37. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +17 -3
  38. package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -6
  39. package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +8 -1
  40. package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +1 -3
  41. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -2
  42. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -4
  43. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +11 -10
  44. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +5 -10
  45. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +10 -8
  46. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
  47. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +3 -3
  48. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +2 -2
  49. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +2 -9
  50. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +0 -45
  51. package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.d.ts +5 -0
  52. package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +48 -0
  53. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +5 -2
  54. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +1 -3
  55. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +2 -1
  56. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +1 -4
  57. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  58. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -6
  59. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -4
  60. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +0 -3
  61. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +1 -4
  62. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +11 -4
  63. package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +2 -3
  64. package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -0
  65. package/lib/view/invoicing/recordPayment/recordPaymentPayload.js +14 -5
  66. package/lib/view/invoicing/recordPayment/recordPaymentState.d.ts +2 -4
  67. package/package.json +1 -1
  68. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  69. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  70. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +0 -15
  71. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +0 -15
  72. package/lib/esm/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +0 -1
  73. package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +0 -26
  74. package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +0 -18
  75. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +0 -47
  76. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +0 -128
  77. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -20
  78. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewState.js +0 -1
  79. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  80. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  81. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  82. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  83. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.d.ts +0 -6
  84. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +0 -19
  85. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.d.ts +0 -6
  86. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +0 -19
  87. package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +0 -2
  88. package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +0 -2
  89. package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.d.ts +0 -6
  90. package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +0 -30
  91. package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.d.ts +0 -6
  92. package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +0 -22
  93. package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.d.ts +0 -79
  94. package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +0 -52
  95. package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.d.ts +0 -25
  96. package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +0 -132
  97. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +0 -21
  98. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -24
  99. package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.d.ts +0 -14
  100. package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.js +0 -2
@@ -1,11 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeRecordPaymentDraftFromInvoice = exports.localDataToRecordPaymentPayload = exports.localDataToInvoiceRecordPaymentBody = void 0;
4
- const amount_1 = require("../../../commonStateTypes/amount");
5
4
  const zeniDayJS_1 = require("../../../zeniDayJS");
6
5
  const recordPaymentFormConfig_1 = require("./recordPaymentFormConfig");
7
6
  const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
8
- const amountDueFromInvoice = (invoice) => invoice.amountDue ?? (0, amount_1.toAmount)(0, 'USD', '$');
7
+ const dollarsFromAmountString = (value) => {
8
+ const parsed = Number.parseFloat(value);
9
+ if (Number.isNaN(parsed)) {
10
+ return 0;
11
+ }
12
+ return parsed;
13
+ };
14
+ const amountDueDollarsFromInvoice = (invoice) => {
15
+ const amountDue = invoice.amountDue?.amount ?? 0;
16
+ return amountDue.toFixed(2);
17
+ };
9
18
  /**
10
19
  * Build the invoice-scoped Record Payment body from the form draft. Amount stays
11
20
  * in dollars for the invoice endpoint.
@@ -15,7 +24,7 @@ const localDataToInvoiceRecordPaymentBody = (localData) => {
15
24
  const date = localData.date.trim();
16
25
  const referenceNumber = trimOrUndefined(localData.referenceNumber);
17
26
  return {
18
- amount: localData.amount?.amount ?? 0,
27
+ amount: dollarsFromAmountString(localData.amount),
19
28
  payment_method: localData.paymentMethod,
20
29
  ...(gateway != null ? { gateway } : {}),
21
30
  ...(date !== '' ? { date } : {}),
@@ -29,7 +38,7 @@ exports.localDataToInvoiceRecordPaymentBody = localDataToInvoiceRecordPaymentBod
29
38
  * and the linked invoice into `linked_invoices`. Currency is locked to USD.
30
39
  */
31
40
  const localDataToRecordPaymentPayload = (localData) => {
32
- const amount = localData.amount?.amount ?? 0;
41
+ const amount = dollarsFromAmountString(localData.amount);
33
42
  const gateway = trimOrUndefined(localData.gateway);
34
43
  const date = localData.date.trim();
35
44
  const transactionId = trimOrUndefined(localData.transactionId);
@@ -56,7 +65,7 @@ const localDataToRecordPaymentPayload = (localData) => {
56
65
  exports.localDataToRecordPaymentPayload = localDataToRecordPaymentPayload;
57
66
  const initializeRecordPaymentDraftFromInvoice = (invoice) => ({
58
67
  ...recordPaymentFormConfig_1.initialRecordPaymentFormLocalData,
59
- amount: amountDueFromInvoice(invoice),
68
+ amount: amountDueDollarsFromInvoice(invoice),
60
69
  customerId: invoice.customerID,
61
70
  date: (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD'),
62
71
  invoiceToLink: invoice.id,
@@ -1,12 +1,12 @@
1
- import { Amount } from '../../../commonStateTypes/amount';
2
1
  import { FetchedState, ID } from '../../../commonStateTypes/common';
3
2
  /**
4
3
  * Draft form state for the Record Payment form. Held in CES so the form flows
5
4
  * its data from here (mirrors the customer form pattern). Record payment is
6
5
  * create-only, so there is a single draft (no per-id edit tree). The date is an
7
- * ISO `YYYY-MM-DD` string; the amount as an `Amount` (as on the invoice entity).
6
+ * ISO `YYYY-MM-DD` string; amount is a raw string.
8
7
  */
9
8
  export interface RecordPaymentFormLocalData {
9
+ amount: string;
10
10
  comment: string;
11
11
  customerId: string;
12
12
  date: string;
@@ -15,8 +15,6 @@ export interface RecordPaymentFormLocalData {
15
15
  paymentMethod: string;
16
16
  referenceNumber: string;
17
17
  transactionId: string;
18
- /** Unset until entered, so a blank field is distinguishable from a real 0. */
19
- amount?: Amount;
20
18
  }
21
19
  export interface RecordPaymentState extends FetchedState {
22
20
  newPaymentDraft: RecordPaymentFormLocalData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.78",
3
+ "version": "5.1.80",
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",
@@ -1,25 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboAccounts, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboAccounts.match), mergeMap((action) => {
7
- const { accountTypes } = action.payload;
8
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
9
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
10
- if (isSuccessResponse(response)) {
11
- return updateInvoicingQboAccounts({
12
- accountTypes,
13
- accounts: mapInvoicingQboAccountOptions(response.data?.accounts ?? []),
14
- });
15
- }
16
- return updateInvoicingQboAccountsFailure({
17
- accountTypes,
18
- status: response.status,
19
- });
20
- }), catchError((error) => of(updateInvoicingQboAccountsFailure({
21
- accountTypes,
22
- status: createZeniAPIStatus('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
23
- JSON.stringify(error)),
24
- }))));
25
- }));
@@ -1,15 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboClasses, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboClasses.match), switchMap(() => {
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
8
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
9
- if (isSuccessResponse(response)) {
10
- return updateInvoicingQboClasses(mapInvoicingQboAccountOptions(response.data?.accounts ?? []));
11
- }
12
- return updateInvoicingQboClassesFailure(response.status);
13
- }), catchError((error) => of(updateInvoicingQboClassesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
14
- JSON.stringify(error))))));
15
- }));
@@ -1,15 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboConnection, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboConnection, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboConnectionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboConnection.match), switchMap(() => {
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/connection`;
8
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
9
- if (isSuccessResponse(response)) {
10
- return updateInvoicingQboConnection(mapInvoicingQboConnection(response.data ?? { connected: false }));
11
- }
12
- return updateInvoicingQboConnectionFailure(response.status);
13
- }), catchError((error) => of(updateInvoicingQboConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO connection REST API call errored out ' +
14
- JSON.stringify(error))))));
15
- }));
@@ -1,15 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboSyncHealth, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboSyncHealth, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboSyncHealthEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboSyncHealth.match), switchMap(() => {
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-health`;
8
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
9
- if (isSuccessResponse(response)) {
10
- return updateInvoicingQboSyncHealth(mapInvoicingQboSyncHealth(response.data ?? {}));
11
- }
12
- return updateInvoicingQboSyncHealthFailure(response.status);
13
- }), catchError((error) => of(updateInvoicingQboSyncHealthFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO sync health REST API call errored out ' +
14
- JSON.stringify(error))))));
15
- }));
@@ -1,26 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
5
- export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
6
- const { taskId } = action.payload;
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-tasks/${encodeURIComponent(taskId)}/retry`;
8
- return zeniAPI
9
- .postAndGetJSON(apiUrl, {})
10
- .pipe(mergeMap((response) => {
11
- if (isSuccessResponse(response)) {
12
- return of(retryInvoicingQboSyncTaskSuccess({
13
- status: response.data?.status ?? '',
14
- taskId: response.data?.task_id ?? taskId,
15
- }), fetchInvoicingQboSyncHealth());
16
- }
17
- return of(retryInvoicingQboSyncTaskFailure({
18
- status: response.status,
19
- taskId,
20
- }));
21
- }), catchError((error) => of(retryInvoicingQboSyncTaskFailure({
22
- status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
23
- JSON.stringify(error)),
24
- taskId,
25
- }))));
26
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { fetchInvoicingQboSyncHealth, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, } from '../invoicingQboViewReducer';
5
- export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startInvoicingQboBackfill.match), switchMap((action) => {
6
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/backfill`;
7
- return zeniAPI
8
- .postAndGetJSON(apiUrl, {
9
- start_date: action.payload.startDate,
10
- })
11
- .pipe(mergeMap((response) => {
12
- if (isSuccessResponse(response)) {
13
- return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth());
14
- }
15
- return of(startInvoicingQboBackfillFailure(response.status));
16
- }), catchError((error) => of(startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
17
- JSON.stringify(error))))));
18
- }));
@@ -1,47 +0,0 @@
1
- export function mapInvoicingQboConnection(payload) {
2
- return {
3
- connected: payload.connected,
4
- companyName: payload.company_name ?? undefined,
5
- connectionId: payload.connection_id ?? undefined,
6
- realmId: payload.realm_id ?? undefined,
7
- };
8
- }
9
- export function mapInvoicingQboAccountOptions(rows) {
10
- return rows.flatMap((row) => {
11
- // Only qbo_id is a valid QBO AccountRef/ClassRef value — platform-internal
12
- // ids (account_id / id) are display metadata and must never be submitted.
13
- const accountId = row.qbo_id ?? row.id ?? row.account_id ?? '';
14
- if (accountId === '') {
15
- return [];
16
- }
17
- const accountName = row.name ??
18
- row.account_name ??
19
- row.accounting_class_name ??
20
- row.qbo_accounting_class_name ??
21
- row.fully_qualified_name ??
22
- accountId;
23
- return [
24
- {
25
- id: accountId,
26
- name: accountName,
27
- accountType: row.account_type ?? undefined,
28
- },
29
- ];
30
- });
31
- }
32
- export function mapInvoicingQboSyncHealth(payload) {
33
- return {
34
- connection: payload.connection != null
35
- ? mapInvoicingQboConnection(payload.connection)
36
- : undefined,
37
- countsByStatus: payload.counts_by_status ?? {},
38
- failedTasks: (payload.failed_tasks ?? []).map((task) => ({
39
- attempts: task.attempts,
40
- entityId: task.entity_id,
41
- entityType: task.entity_type,
42
- taskId: task.task_id,
43
- lastError: task.last_error ?? undefined,
44
- updatedAt: task.updated_at ?? undefined,
45
- })),
46
- };
47
- }
@@ -1,128 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- export const initialState = {
3
- accountsByAccountTypes: {},
4
- accountsFetchStateByAccountTypes: {},
5
- backfillFetchState: { fetchState: 'Not-Started', error: undefined },
6
- classes: [],
7
- classesFetchState: { fetchState: 'Not-Started', error: undefined },
8
- connection: undefined,
9
- connectionFetchState: { fetchState: 'Not-Started', error: undefined },
10
- retryFetchStateByTaskId: {},
11
- syncHealth: undefined,
12
- syncHealthFetchState: { fetchState: 'Not-Started', error: undefined },
13
- };
14
- const invoicingQboView = createSlice({
15
- name: 'invoicingQboView',
16
- initialState,
17
- reducers: {
18
- fetchInvoicingQboConnection(draft) {
19
- draft.connectionFetchState = {
20
- fetchState: 'In-Progress',
21
- error: undefined,
22
- };
23
- },
24
- updateInvoicingQboConnection(draft, action) {
25
- draft.connection = action.payload;
26
- draft.connectionFetchState = { fetchState: 'Completed', error: undefined };
27
- },
28
- updateInvoicingQboConnectionFailure(draft, action) {
29
- draft.connectionFetchState = { fetchState: 'Error', error: action.payload };
30
- },
31
- fetchInvoicingQboAccounts: {
32
- reducer(draft, action) {
33
- draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
34
- fetchState: 'In-Progress',
35
- error: undefined,
36
- };
37
- },
38
- prepare(accountTypes) {
39
- return { payload: { accountTypes } };
40
- },
41
- },
42
- updateInvoicingQboAccounts(draft, action) {
43
- draft.accountsByAccountTypes[action.payload.accountTypes] =
44
- action.payload.accounts;
45
- draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
46
- fetchState: 'Completed',
47
- error: undefined,
48
- };
49
- },
50
- updateInvoicingQboAccountsFailure(draft, action) {
51
- draft.accountsFetchStateByAccountTypes[action.payload.accountTypes] = {
52
- fetchState: 'Error',
53
- error: action.payload.status,
54
- };
55
- },
56
- fetchInvoicingQboClasses(draft) {
57
- draft.classesFetchState = { fetchState: 'In-Progress', error: undefined };
58
- },
59
- updateInvoicingQboClasses(draft, action) {
60
- draft.classes = action.payload;
61
- draft.classesFetchState = { fetchState: 'Completed', error: undefined };
62
- },
63
- updateInvoicingQboClassesFailure(draft, action) {
64
- draft.classesFetchState = { fetchState: 'Error', error: action.payload };
65
- },
66
- fetchInvoicingQboSyncHealth(draft) {
67
- draft.syncHealthFetchState = {
68
- fetchState: 'In-Progress',
69
- error: undefined,
70
- };
71
- },
72
- updateInvoicingQboSyncHealth(draft, action) {
73
- draft.syncHealth = action.payload;
74
- draft.syncHealthFetchState = { fetchState: 'Completed', error: undefined };
75
- },
76
- updateInvoicingQboSyncHealthFailure(draft, action) {
77
- draft.syncHealthFetchState = {
78
- fetchState: 'Error',
79
- error: action.payload,
80
- };
81
- },
82
- retryInvoicingQboSyncTask: {
83
- reducer(draft, action) {
84
- draft.retryFetchStateByTaskId[action.payload.taskId] = {
85
- fetchState: 'In-Progress',
86
- error: undefined,
87
- };
88
- },
89
- prepare(taskId) {
90
- return { payload: { taskId } };
91
- },
92
- },
93
- retryInvoicingQboSyncTaskSuccess(draft, action) {
94
- draft.retryFetchStateByTaskId[action.payload.taskId] = {
95
- fetchState: 'Completed',
96
- error: undefined,
97
- };
98
- },
99
- retryInvoicingQboSyncTaskFailure(draft, action) {
100
- draft.retryFetchStateByTaskId[action.payload.taskId] = {
101
- fetchState: 'Error',
102
- error: action.payload.status,
103
- };
104
- },
105
- startInvoicingQboBackfill: {
106
- reducer(draft) {
107
- draft.backfillFetchState = {
108
- fetchState: 'In-Progress',
109
- error: undefined,
110
- };
111
- },
112
- prepare(startDate) {
113
- return { payload: { startDate } };
114
- },
115
- },
116
- startInvoicingQboBackfillSuccess(draft) {
117
- draft.backfillFetchState = { fetchState: 'Completed', error: undefined };
118
- },
119
- startInvoicingQboBackfillFailure(draft, action) {
120
- draft.backfillFetchState = { fetchState: 'Error', error: action.payload };
121
- },
122
- clearInvoicingQboView(draft) {
123
- Object.assign(draft, initialState);
124
- },
125
- },
126
- });
127
- export const { fetchInvoicingQboConnection, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, fetchInvoicingQboAccounts, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, fetchInvoicingQboClasses, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, fetchInvoicingQboSyncHealth, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskSuccess, retryInvoicingQboSyncTaskFailure, startInvoicingQboBackfill, startInvoicingQboBackfillSuccess, startInvoicingQboBackfillFailure, clearInvoicingQboView, } = invoicingQboView.actions;
128
- export default invoicingQboView.reducer;
@@ -1,20 +0,0 @@
1
- /**
2
- * Single bundled view for the QBO integration settings screen — the
3
- * connection, per-account-types account options, classes, sync health, and the
4
- * fetch/action states for each of them.
5
- */
6
- export const getInvoicingQboView = (state) => {
7
- const qboState = state.invoicingQboViewState;
8
- return {
9
- accountsByAccountTypes: qboState.accountsByAccountTypes,
10
- accountsFetchStateByAccountTypes: qboState.accountsFetchStateByAccountTypes,
11
- backfillState: qboState.backfillFetchState,
12
- classes: qboState.classes,
13
- classesFetchState: qboState.classesFetchState,
14
- connection: qboState.connection,
15
- connectionFetchState: qboState.connectionFetchState,
16
- retryFetchStateByTaskId: qboState.retryFetchStateByTaskId,
17
- syncHealth: qboState.syncHealth,
18
- syncHealthFetchState: qboState.syncHealthFetchState,
19
- };
20
- };
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboAccountsEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboAccountsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboAccounts.match), (0, operators_1.mergeMap)((action) => {
10
- const { accountTypes } = action.payload;
11
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
12
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
13
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
14
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccounts)({
15
- accountTypes,
16
- accounts: (0, invoicingQboViewPayload_1.mapInvoicingQboAccountOptions)(response.data?.accounts ?? []),
17
- });
18
- }
19
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
20
- accountTypes,
21
- status: response.status,
22
- });
23
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
24
- accountTypes,
25
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
26
- JSON.stringify(error)),
27
- }))));
28
- }));
29
- exports.fetchInvoicingQboAccountsEpic = fetchInvoicingQboAccountsEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboClassesEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboClassesEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboClasses.match), (0, operators_1.switchMap)(() => {
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
11
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
12
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
13
- return (0, invoicingQboViewReducer_1.updateInvoicingQboClasses)((0, invoicingQboViewPayload_1.mapInvoicingQboAccountOptions)(response.data?.accounts ?? []));
14
- }
15
- return (0, invoicingQboViewReducer_1.updateInvoicingQboClassesFailure)(response.status);
16
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboClassesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
17
- JSON.stringify(error))))));
18
- }));
19
- exports.fetchInvoicingQboClassesEpic = fetchInvoicingQboClassesEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboConnectionEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboConnectionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboConnectionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboConnection.match), (0, operators_1.switchMap)(() => {
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/connection`;
11
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
12
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
13
- return (0, invoicingQboViewReducer_1.updateInvoicingQboConnection)((0, invoicingQboViewPayload_1.mapInvoicingQboConnection)(response.data ?? { connected: false }));
14
- }
15
- return (0, invoicingQboViewReducer_1.updateInvoicingQboConnectionFailure)(response.status);
16
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO connection REST API call errored out ' +
17
- JSON.stringify(error))))));
18
- }));
19
- exports.fetchInvoicingQboConnectionEpic = fetchInvoicingQboConnectionEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboSyncHealthEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboSyncHealthEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboSyncHealthEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth.match), (0, operators_1.switchMap)(() => {
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-health`;
11
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
12
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
13
- return (0, invoicingQboViewReducer_1.updateInvoicingQboSyncHealth)((0, invoicingQboViewPayload_1.mapInvoicingQboSyncHealth)(response.data ?? {}));
14
- }
15
- return (0, invoicingQboViewReducer_1.updateInvoicingQboSyncHealthFailure)(response.status);
16
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboSyncHealthFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO sync health REST API call errored out ' +
17
- JSON.stringify(error))))));
18
- }));
19
- exports.fetchInvoicingQboSyncHealthEpic = fetchInvoicingQboSyncHealthEpic;
@@ -1,2 +0,0 @@
1
- import { fetchInvoicingQboAccounts, fetchInvoicingQboClasses, fetchInvoicingQboConnection, fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure } from '../invoicingQboViewReducer';
2
- export type InvoicingQboViewActionType = ReturnType<typeof fetchInvoicingQboConnection> | ReturnType<typeof updateInvoicingQboConnection> | ReturnType<typeof updateInvoicingQboConnectionFailure> | ReturnType<typeof fetchInvoicingQboAccounts> | ReturnType<typeof updateInvoicingQboAccounts> | ReturnType<typeof updateInvoicingQboAccountsFailure> | ReturnType<typeof fetchInvoicingQboClasses> | ReturnType<typeof updateInvoicingQboClasses> | ReturnType<typeof updateInvoicingQboClassesFailure> | ReturnType<typeof fetchInvoicingQboSyncHealth> | ReturnType<typeof updateInvoicingQboSyncHealth> | ReturnType<typeof updateInvoicingQboSyncHealthFailure> | ReturnType<typeof retryInvoicingQboSyncTask> | ReturnType<typeof retryInvoicingQboSyncTaskSuccess> | ReturnType<typeof retryInvoicingQboSyncTaskFailure> | ReturnType<typeof startInvoicingQboBackfill> | ReturnType<typeof startInvoicingQboBackfillSuccess> | ReturnType<typeof startInvoicingQboBackfillFailure>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const retryInvoicingQboSyncTaskEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retryInvoicingQboSyncTaskEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
8
- const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.retryInvoicingQboSyncTask.match), (0, operators_1.mergeMap)((action) => {
9
- const { taskId } = action.payload;
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-tasks/${encodeURIComponent(taskId)}/retry`;
11
- return zeniAPI
12
- .postAndGetJSON(apiUrl, {})
13
- .pipe((0, operators_1.mergeMap)((response) => {
14
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
15
- return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskSuccess)({
16
- status: response.data?.status ?? '',
17
- taskId: response.data?.task_id ?? taskId,
18
- }), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)());
19
- }
20
- return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
21
- status: response.status,
22
- taskId,
23
- }));
24
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
25
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
26
- JSON.stringify(error)),
27
- taskId,
28
- }))));
29
- }));
30
- exports.retryInvoicingQboSyncTaskEpic = retryInvoicingQboSyncTaskEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const startInvoicingQboBackfillEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startInvoicingQboBackfillEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
8
- const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.startInvoicingQboBackfill.match), (0, operators_1.switchMap)((action) => {
9
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/backfill`;
10
- return zeniAPI
11
- .postAndGetJSON(apiUrl, {
12
- start_date: action.payload.startDate,
13
- })
14
- .pipe((0, operators_1.mergeMap)((response) => {
15
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
16
- return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillSuccess)(), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)());
17
- }
18
- return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)(response.status));
19
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
20
- JSON.stringify(error))))));
21
- }));
22
- exports.startInvoicingQboBackfillEpic = startInvoicingQboBackfillEpic;