@zeniai/client-epic-state 5.1.92 → 5.1.93

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 (145) hide show
  1. package/lib/entity/aiCfo/aiCfoPayload.d.ts +0 -7
  2. package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -3
  3. package/lib/entity/aiCfo/aiCfoReducer.js +2 -25
  4. package/lib/entity/aiCfo/aiCfoState.d.ts +0 -7
  5. package/lib/entity/company/companyPayload.d.ts +0 -4
  6. package/lib/entity/company/companyPayload.js +8 -18
  7. package/lib/entity/company/companyStateTypes.d.ts +0 -4
  8. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
  9. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
  10. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  11. package/lib/entity/snackbar/snackbarTypes.js +0 -31
  12. package/lib/entity/tenant/tenantReducer.d.ts +1 -5
  13. package/lib/entity/tenant/tenantReducer.js +2 -21
  14. package/lib/epic.d.ts +1 -3
  15. package/lib/epic.js +1 -5
  16. package/lib/esm/entity/aiCfo/aiCfoReducer.js +1 -23
  17. package/lib/esm/entity/company/companyPayload.js +8 -18
  18. package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
  19. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -31
  20. package/lib/esm/entity/tenant/tenantReducer.js +1 -20
  21. package/lib/esm/epic.js +1 -5
  22. package/lib/esm/index.js +8 -9
  23. package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
  24. package/lib/esm/view/companyView/companyViewReducer.js +1 -58
  25. package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +0 -52
  26. package/lib/esm/view/companyView/types/cockpitTypes.js +1 -13
  27. package/lib/esm/view/companyView/types/companyManagementViewState.js +0 -2
  28. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +4 -26
  29. package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +4 -26
  30. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
  31. package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +10 -37
  32. package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +10 -39
  33. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
  34. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +4 -5
  35. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +5 -35
  36. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +3 -25
  37. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +4 -26
  38. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +4 -26
  39. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +3 -20
  40. package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +18 -65
  41. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
  42. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
  43. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +1 -9
  44. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +1 -50
  45. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +1 -14
  46. package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +10 -31
  47. package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +5 -30
  48. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +4 -26
  49. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +14 -22
  50. package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +7 -49
  51. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +9 -30
  52. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  53. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -56
  54. package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +10 -45
  55. package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +1 -4
  56. package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +1 -4
  57. package/lib/index.d.ts +13 -17
  58. package/lib/index.js +50 -62
  59. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
  60. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
  61. package/lib/view/companyView/companyViewReducer.d.ts +1 -22
  62. package/lib/view/companyView/companyViewReducer.js +3 -60
  63. package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +0 -3
  64. package/lib/view/companyView/selector/companyManagementViewSelector.js +0 -55
  65. package/lib/view/companyView/types/cockpitTypes.d.ts +3 -7
  66. package/lib/view/companyView/types/cockpitTypes.js +1 -15
  67. package/lib/view/companyView/types/companyManagementViewState.d.ts +0 -2
  68. package/lib/view/companyView/types/companyManagementViewState.js +0 -2
  69. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  70. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +1 -2
  71. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +3 -25
  72. package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +1 -2
  73. package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +3 -25
  74. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +8 -22
  75. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
  76. package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +1 -2
  77. package/lib/view/invoicing/discountAction/discountActionEpic.js +8 -35
  78. package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +1 -2
  79. package/lib/view/invoicing/dunningAction/dunningActionEpic.js +8 -37
  80. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -3
  81. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
  82. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +4 -5
  83. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +1 -2
  84. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +4 -34
  85. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +1 -2
  86. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +2 -24
  87. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +1 -2
  88. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +3 -25
  89. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +1 -2
  90. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +3 -25
  91. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +1 -2
  92. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +2 -19
  93. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +1 -2
  94. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +16 -63
  95. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -13
  96. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  97. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
  98. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +31 -11
  99. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
  100. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -15
  101. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
  102. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +0 -12
  103. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +0 -11
  104. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +4 -21
  105. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +2 -51
  106. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +0 -3
  107. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +2 -16
  108. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +0 -13
  109. package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +1 -2
  110. package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +9 -30
  111. package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +4 -29
  112. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +1 -2
  113. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +3 -25
  114. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +7 -24
  115. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +16 -23
  116. package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +1 -2
  117. package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +6 -48
  118. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -2
  119. package/lib/view/invoicing/settingsView/settingsViewEpics.js +7 -28
  120. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -10
  121. package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  122. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +2 -44
  123. package/lib/view/invoicing/settingsView/settingsViewSelector.js +2 -59
  124. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +1 -2
  125. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +8 -43
  126. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
  127. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +2 -5
  128. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
  129. package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -5
  130. package/package.json +2 -2
  131. package/lib/entity/snackbar/snackbarApiError.d.ts +0 -8
  132. package/lib/entity/snackbar/snackbarApiError.js +0 -15
  133. package/lib/esm/entity/snackbar/snackbarApiError.js +0 -11
  134. package/lib/esm/view/companyView/epic/updateCompanyProductServicesEpic.js +0 -91
  135. package/lib/esm/view/companyView/epic/updateCompanyQboRealmIdEpic.js +0 -58
  136. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +0 -26
  137. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +0 -16
  138. package/lib/view/companyView/epic/updateCompanyProductServicesEpic.d.ts +0 -10
  139. package/lib/view/companyView/epic/updateCompanyProductServicesEpic.js +0 -95
  140. package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.d.ts +0 -8
  141. package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.js +0 -62
  142. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +0 -7
  143. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +0 -30
  144. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +0 -6
  145. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +0 -20
@@ -6,39 +6,11 @@ const operators_1 = require("rxjs/operators");
6
6
  const addressReducer_1 = require("../../../entity/address/addressReducer");
7
7
  const invoicingSubscriptionPayload_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload");
8
8
  const invoicingSubscriptionReducer_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer");
9
- const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
10
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
11
9
  const responsePayload_1 = require("../../../responsePayload");
12
10
  const subscriptionActionReducer_1 = require("./subscriptionActionReducer");
13
- /**
14
- * Each lifecycle action reports with its own copy. Keyed loosely because the
15
- * action payload carries a plain `string`; an unmapped kind stays silent.
16
- */
17
- const SNACKBAR_SECTION_BY_ACTION = {
18
- activate: 'invoicing_subscription_activated',
19
- cancel: 'invoicing_subscription_cancelled',
20
- change_term_end: 'invoicing_subscription_term_end_changed',
21
- pause: 'invoicing_subscription_paused',
22
- reactivate: 'invoicing_subscription_reactivated',
23
- remove_scheduled_cancellation: 'invoicing_subscription_cancellation_removed',
24
- resume: 'invoicing_subscription_resumed',
25
- set_non_renewing: 'invoicing_subscription_non_renewing',
26
- };
27
11
  const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(subscriptionActionReducer_1.runInvoicingSubscriptionAction.match), (0, operators_1.mergeMap)((action) => {
28
12
  const { action: kind, body, id } = action.payload;
29
13
  const requestBody = { action: kind, ...(body ?? {}) };
30
- const snackbarSection = SNACKBAR_SECTION_BY_ACTION[kind];
31
- /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
32
- const snackbar = (messageText, status) => snackbarSection == null
33
- ? []
34
- : [
35
- (0, snackbarReducer_1.openSnackbar)({
36
- messageSection: snackbarSection,
37
- messageText,
38
- type: messageText === 'success' ? 'success' : 'error',
39
- variables: (0, snackbarApiError_1.apiErrorSnackbarVariables)(status),
40
- }),
41
- ];
42
14
  const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/subscriptions/${encodeURIComponent(id)}/actions`;
43
15
  return zeniAPI
44
16
  .postAndGetJSON(apiUrl, requestBody)
@@ -48,23 +20,16 @@ const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) => actio
48
20
  (0, invoicingSubscriptionReducer_1.updateInvoicingSubscriptions)([response.data], 'merge'),
49
21
  (0, addressReducer_1.updateAddresses)((0, invoicingSubscriptionPayload_1.extractInvoicingSubscriptionAddresses)([response.data])),
50
22
  (0, subscriptionActionReducer_1.runInvoicingSubscriptionActionSuccess)({ id }),
51
- ...snackbar('success'),
52
23
  ];
53
24
  }
54
- return (0, rxjs_1.from)([
55
- (0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
56
- error: response.status,
57
- id,
58
- }),
59
- ...snackbar('failed', response.status),
60
- ]);
61
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
62
- (0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
63
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Subscription action REST API call errored out ' +
64
- JSON.stringify(error)),
25
+ return (0, rxjs_1.of)((0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
26
+ error: response.status,
65
27
  id,
66
- }),
67
- ...snackbar('failed'),
68
- ])));
28
+ }));
29
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
30
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Subscription action REST API call errored out ' +
31
+ JSON.stringify(error)),
32
+ id,
33
+ }))));
69
34
  }));
70
35
  exports.runInvoicingSubscriptionActionEpic = runInvoicingSubscriptionActionEpic;
@@ -6,7 +6,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
6
6
  import { W9Form } from './vendorFiling1099UploadDetailsPayload';
7
7
  import { VendorFiling1099UploadDetailsState, VendorsFiling1099UploadDetailsLocalData } from './vendorFiling1099UploadDetailsState';
8
8
  export declare const initialState: VendorFiling1099UploadDetailsState;
9
- export declare const clearVendorFiling1099UploadDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"vendorFiling1099UploadDetails/clearVendorFiling1099UploadDetails">, updateW9FormUploadFile: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ export declare const updateW9FormUploadFile: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
10
  w9FormFile: FilePayload;
11
11
  }, "vendorFiling1099UploadDetails/updateW9FormUploadFile">, updateW9FormUploadFetchState: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchStateAndError, "vendorFiling1099UploadDetails/updateW9FormUploadFetchState">, vendorFiling1099UploadDetailsSave: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, signal?: AbortSignal | undefined], {
12
12
  vendorId: string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.vendorFiling1099UploadDetailsResetFormStatus = exports.updateW9FormOCRDataToLocalData = exports.updateVendor1099DetailsLocalData = exports.initializeVendorFiling1099UploadDetailsLocalState = exports.vendorFiling1099UploadDetailsSuccessOrFailure = exports.vendorFiling1099UploadDetailsResetLocalData = exports.vendorFiling1099UploadDetailsSave = exports.updateW9FormUploadFetchState = exports.updateW9FormUploadFile = exports.clearVendorFiling1099UploadDetails = exports.initialState = void 0;
4
+ exports.vendorFiling1099UploadDetailsResetFormStatus = exports.updateW9FormOCRDataToLocalData = exports.updateVendor1099DetailsLocalData = exports.initializeVendorFiling1099UploadDetailsLocalState = exports.vendorFiling1099UploadDetailsSuccessOrFailure = exports.vendorFiling1099UploadDetailsResetLocalData = exports.vendorFiling1099UploadDetailsSave = exports.updateW9FormUploadFetchState = exports.updateW9FormUploadFile = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../../rootActions");
7
7
  const vendorFiling1099UploadDetailsPayload_1 = require("./vendorFiling1099UploadDetailsPayload");
@@ -210,13 +210,10 @@ const vendorFiling1099UploadDetails = (0, toolkit_1.createSlice)({
210
210
  address: action.payload.ocrData.address != null,
211
211
  };
212
212
  },
213
- clearVendorFiling1099UploadDetails() {
214
- return exports.initialState;
215
- },
216
213
  },
217
214
  extraReducers: (builder) => {
218
215
  builder.addCase(rootActions_1.clearAll, () => exports.initialState);
219
216
  },
220
217
  });
221
- _a = vendorFiling1099UploadDetails.actions, exports.clearVendorFiling1099UploadDetails = _a.clearVendorFiling1099UploadDetails, exports.updateW9FormUploadFile = _a.updateW9FormUploadFile, exports.updateW9FormUploadFetchState = _a.updateW9FormUploadFetchState, exports.vendorFiling1099UploadDetailsSave = _a.vendorFiling1099UploadDetailsSave, exports.vendorFiling1099UploadDetailsResetLocalData = _a.vendorFiling1099UploadDetailsResetLocalData, exports.vendorFiling1099UploadDetailsSuccessOrFailure = _a.vendorFiling1099UploadDetailsSuccessOrFailure, exports.initializeVendorFiling1099UploadDetailsLocalState = _a.initializeVendorFiling1099UploadDetailsLocalState, exports.updateVendor1099DetailsLocalData = _a.updateVendor1099DetailsLocalData, exports.updateW9FormOCRDataToLocalData = _a.updateW9FormOCRDataToLocalData, exports.vendorFiling1099UploadDetailsResetFormStatus = _a.vendorFiling1099UploadDetailsResetFormStatus;
218
+ _a = vendorFiling1099UploadDetails.actions, exports.updateW9FormUploadFile = _a.updateW9FormUploadFile, exports.updateW9FormUploadFetchState = _a.updateW9FormUploadFetchState, exports.vendorFiling1099UploadDetailsSave = _a.vendorFiling1099UploadDetailsSave, exports.vendorFiling1099UploadDetailsResetLocalData = _a.vendorFiling1099UploadDetailsResetLocalData, exports.vendorFiling1099UploadDetailsSuccessOrFailure = _a.vendorFiling1099UploadDetailsSuccessOrFailure, exports.initializeVendorFiling1099UploadDetailsLocalState = _a.initializeVendorFiling1099UploadDetailsLocalState, exports.updateVendor1099DetailsLocalData = _a.updateVendor1099DetailsLocalData, exports.updateW9FormOCRDataToLocalData = _a.updateW9FormOCRDataToLocalData, exports.vendorFiling1099UploadDetailsResetFormStatus = _a.vendorFiling1099UploadDetailsResetFormStatus;
222
219
  exports.default = vendorFiling1099UploadDetails.reducer;
@@ -1,6 +1,6 @@
1
1
  import { VendorTabViewState } from './vendorTabViewState';
2
2
  export declare const initialState: VendorTabViewState;
3
- export declare const clearVendorTabView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"vendorTabView/clearVendorTabView">, fetchVendorTabView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
3
+ export declare const fetchVendorTabView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
4
4
  shouldFetchAccruedExpenses: boolean;
5
5
  shouldFetchFiling1099Vendor: boolean;
6
6
  shouldFetchFixedAssets: boolean;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateVendorTabViewTab = exports.fetchVendorTabView = exports.clearVendorTabView = exports.initialState = void 0;
4
+ exports.updateVendorTabViewTab = exports.fetchVendorTabView = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../rootActions");
7
7
  const vendorTabViewState_1 = require("./vendorTabViewState");
@@ -47,9 +47,6 @@ const vendorTabView = (0, toolkit_1.createSlice)({
47
47
  draft.currentTab = action.payload.tab;
48
48
  },
49
49
  },
50
- clearVendorTabView(draft) {
51
- Object.assign(draft, exports.initialState);
52
- },
53
50
  },
54
51
  extraReducers: (builder) => {
55
52
  builder.addCase(rootActions_1.clearAll, (draft) => {
@@ -57,5 +54,5 @@ const vendorTabView = (0, toolkit_1.createSlice)({
57
54
  });
58
55
  },
59
56
  });
60
- _a = vendorTabView.actions, exports.clearVendorTabView = _a.clearVendorTabView, exports.fetchVendorTabView = _a.fetchVendorTabView, exports.updateVendorTabViewTab = _a.updateVendorTabViewTab;
57
+ _a = vendorTabView.actions, exports.fetchVendorTabView = _a.fetchVendorTabView, exports.updateVendorTabViewTab = _a.updateVendorTabViewTab;
61
58
  exports.default = vendorTabView.reducer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.92",
3
+ "version": "5.1.93",
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",
@@ -121,7 +121,7 @@
121
121
  "find-dead-code": "bash ./scripts/run-find-dead-code.sh",
122
122
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
123
123
  "circular-dependency": "madge --circular --extensions ts ./src",
124
- "build": "chmod +x ./scripts/run_build.sh && ./scripts/run_build.sh && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
124
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
125
125
  "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
126
126
  "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
127
127
  "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
@@ -1,8 +0,0 @@
1
- import { ZeniAPIStatus } from '../../responsePayload';
2
- interface SnackbarMessageVariable {
3
- variableName: string;
4
- variableValue: string;
5
- }
6
- /** Undefined when the status carries no message, so the snackbar falls back to its generic copy. */
7
- export declare const apiErrorSnackbarVariables: (status: ZeniAPIStatus | undefined) => SnackbarMessageVariable[] | undefined;
8
- export {};
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiErrorSnackbarVariables = void 0;
4
- /** Placeholder in every `failed` snackbar string, swapped for the API's message. */
5
- const API_ERROR_TOKEN = '_api-error_';
6
- /** Undefined when the status carries no message, so the snackbar falls back to its generic copy. */
7
- // Pass only platform statuses: a local `createZeniAPIStatus` holds internal debug text.
8
- const apiErrorSnackbarVariables = (status) => {
9
- const message = status?.message?.trim() ?? '';
10
- if (message === '') {
11
- return undefined;
12
- }
13
- return [{ variableName: API_ERROR_TOKEN, variableValue: message }];
14
- };
15
- exports.apiErrorSnackbarVariables = apiErrorSnackbarVariables;
@@ -1,11 +0,0 @@
1
- /** Placeholder in every `failed` snackbar string, swapped for the API's message. */
2
- const API_ERROR_TOKEN = '_api-error_';
3
- /** Undefined when the status carries no message, so the snackbar falls back to its generic copy. */
4
- // Pass only platform statuses: a local `createZeniAPIStatus` holds internal debug text.
5
- export const apiErrorSnackbarVariables = (status) => {
6
- const message = status?.message?.trim() ?? '';
7
- if (message === '') {
8
- return undefined;
9
- }
10
- return [{ variableName: API_ERROR_TOKEN, variableValue: message }];
11
- };
@@ -1,91 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateCompanies } from '../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
5
- import { updateTenantProductSettings } from '../../../entity/tenant/tenantReducer';
6
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
7
- import { updateCompanyProductServices, updateCompanyProductServicesFailure, updateCompanyProductServicesSuccess, } from '../companyViewReducer';
8
- import { resolveTenantIdByCompanyId } from '../selector/companyManagementViewSelector';
9
- export const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCompanyProductServices.match),
10
- // Per-row admin action: an operator can enable services on several
11
- // companies at once, so each trigger keeps its own request (matches
12
- // updateCompanyQboRealmIdEpic).
13
- mergeMap((action) => {
14
- const { companyId, services } = action.payload;
15
- const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
16
- const tenantId = resolveTenantIdByCompanyId(state$.value, companyId);
17
- // Send only the service-enable fields so the backend routes this through
18
- // its isolated "enable services" path. Bookkeeping is a Tenant product
19
- // flag and implies spend management; bill pay / reimbursement are Company
20
- // feature flags.
21
- const requestBody = {};
22
- if (isBookkeepingEnabled != null) {
23
- requestBody.is_book_keeping_enabled = isBookkeepingEnabled;
24
- requestBody.is_spend_management_enabled = isBookkeepingEnabled;
25
- }
26
- if (isBillPayEnabled != null) {
27
- requestBody.is_bill_pay_feature_enabled = isBillPayEnabled;
28
- }
29
- if (isReimbursementEnabled != null) {
30
- requestBody.is_reimbursement_feature_enabled = isReimbursementEnabled;
31
- }
32
- // No fields set would fall through to the normal company PUT on the backend;
33
- // treat it as an immediate no-op success so the In-Progress status resolves.
34
- if (Object.keys(requestBody).length === 0) {
35
- return from([updateCompanyProductServicesSuccess({ companyId })]);
36
- }
37
- return zeniAPI
38
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
39
- .pipe(mergeMap((response) => {
40
- if (isSuccessResponse(response)) {
41
- const companies = response.data?.companies ?? [];
42
- const actions = [];
43
- // The response normally carries the updated company; only write
44
- // company state when it does (a 200 is still a success even with
45
- // an empty company array).
46
- if (companies.length > 0) {
47
- actions.push(updateCompanies({
48
- payload: companies,
49
- schema: {},
50
- isUpdate: true,
51
- }));
52
- }
53
- // Independent of the company array: the company PUT is the source
54
- // of truth and this tenant-state patch is a best-effort optimistic
55
- // sync, skipped when the tenant isn't loaded (UI relies on the
56
- // next tenant fetch).
57
- if (isBookkeepingEnabled != null && tenantId != null) {
58
- actions.push(updateTenantProductSettings({
59
- tenantId,
60
- isBookkeepingEnabled,
61
- isSpendManagementEnabled: isBookkeepingEnabled,
62
- }));
63
- }
64
- actions.push(updateCompanyProductServicesSuccess({ companyId }));
65
- actions.push(openSnackbar({
66
- messageSection: 'product_services_update',
67
- messageText: 'success',
68
- type: 'success',
69
- }));
70
- return from(actions);
71
- }
72
- return from([
73
- updateCompanyProductServicesFailure(companyId, response.status),
74
- openSnackbar({
75
- messageSection: 'product_services_update',
76
- messageText: 'failed',
77
- type: 'error',
78
- }),
79
- ]);
80
- }), catchError((error) => from([
81
- updateCompanyProductServicesFailure(companyId, createZeniAPIStatus('Unexpected error', 'Update Company Product Services errored out: ' +
82
- (error instanceof Error
83
- ? error.message
84
- : JSON.stringify(error)))),
85
- openSnackbar({
86
- messageSection: 'product_services_update',
87
- messageText: 'failed',
88
- type: 'error',
89
- }),
90
- ])));
91
- }));
@@ -1,58 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
5
- import { updateCompanyQboRealmId, updateCompanyQboRealmIdFailure, updateCompanyQboRealmIdSuccess, } from '../companyViewReducer';
6
- import { resolveTenantIdByCompanyId } from '../selector/companyManagementViewSelector';
7
- export const updateCompanyQboRealmIdEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCompanyQboRealmId.match),
8
- // Per-row admin action: several rows can be in flight at once, so each
9
- // trigger keeps its own request instead of cancelling the previous one.
10
- mergeMap((action) => {
11
- const { companyId, qboRealmId } = action.payload;
12
- const tenantId = resolveTenantIdByCompanyId(state$.value, companyId);
13
- if (tenantId == null) {
14
- return from([
15
- updateCompanyQboRealmIdFailure(companyId, createZeniAPIStatus('Unexpected error', `No tenant found for companyId: ${companyId}`)),
16
- openSnackbar({
17
- messageSection: 'qbo_realm_id_update',
18
- messageText: 'failed',
19
- type: 'error',
20
- }),
21
- ]);
22
- }
23
- // The FE route reads the target tenant from the zeni-tenant-id header,
24
- // which overrides the operator's ambient tenant for this request only.
25
- // qboRealmId omitted -> null clears the pin; a value overwrites it.
26
- return zeniAPI
27
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/qbo-realm-id`, { qbo_realm_id: qboRealmId ?? null }, { 'zeni-tenant-id': tenantId })
28
- .pipe(mergeMap((response) => {
29
- if (isSuccessResponse(response)) {
30
- return from([
31
- updateCompanyQboRealmIdSuccess({ companyId }),
32
- openSnackbar({
33
- messageSection: 'qbo_realm_id_update',
34
- messageText: 'success',
35
- type: 'success',
36
- }),
37
- ]);
38
- }
39
- return from([
40
- updateCompanyQboRealmIdFailure(companyId, response.status),
41
- openSnackbar({
42
- messageSection: 'qbo_realm_id_update',
43
- messageText: 'failed',
44
- type: 'error',
45
- }),
46
- ]);
47
- }), catchError((error) => from([
48
- updateCompanyQboRealmIdFailure(companyId, createZeniAPIStatus('Unexpected error', 'Update Company QBO realm id errored out: ' +
49
- (error instanceof Error
50
- ? error.message
51
- : JSON.stringify(error)))),
52
- openSnackbar({
53
- messageSection: 'qbo_realm_id_update',
54
- messageText: 'failed',
55
- type: 'error',
56
- }),
57
- ])));
58
- }));
@@ -1,26 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { toInvoicingDunningEmailPreview, } from './invoicingDunningCaseDetailViewPayload';
5
- import { fetchInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreviewFailure, } from './invoicingDunningCaseDetailViewReducer';
6
- export const fetchInvoicingDunningEmailPreviewEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingDunningEmailPreview.match), switchMap((action) => {
7
- const { id } = action.payload;
8
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/email-preview`;
9
- return zeniAPI
10
- .postAndGetJSON(apiUrl, {})
11
- .pipe(map((response) => {
12
- if (isSuccessResponse(response) && response.data != null) {
13
- return updateInvoicingDunningEmailPreview({
14
- id,
15
- preview: toInvoicingDunningEmailPreview(response.data),
16
- });
17
- }
18
- return updateInvoicingDunningEmailPreviewFailure({
19
- id,
20
- status: response.status,
21
- });
22
- }), catchError((error) => of(updateInvoicingDunningEmailPreviewFailure({
23
- id,
24
- status: createZeniAPIStatus('Unexpected Error', `Dunning email preview REST API call errored out: ${error instanceof Error ? error.message : String(error)}`),
25
- }))));
26
- }));
@@ -1,16 +0,0 @@
1
- import { EMPTY, of } from 'rxjs';
2
- import { filter, mergeMap } from 'rxjs/operators';
3
- import { fetchInvoicingDunningEmailPreview, fetchInvoicingDunningEmailPreviewPage, } from './invoicingDunningCaseDetailViewReducer';
4
- const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
5
- (fetchStateAndError.fetchState !== 'Completed' &&
6
- fetchStateAndError.fetchState !== 'In-Progress');
7
- export const fetchInvoicingDunningEmailPreviewPageEpic = (actions$, state$) => actions$.pipe(filter(fetchInvoicingDunningEmailPreviewPage.match), mergeMap((action) => {
8
- const { cacheOverride, id } = action.payload;
9
- const detailState = state$.value.invoicingDunningCaseDetailViewState;
10
- if (detailState.id !== id) {
11
- return EMPTY;
12
- }
13
- return shouldFetch(detailState.emailPreview, cacheOverride)
14
- ? of(fetchInvoicingDunningEmailPreview({ id }))
15
- : EMPTY;
16
- }));
@@ -1,10 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateCompanies } from '../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
5
- import { updateTenantProductSettings } from '../../../entity/tenant/tenantReducer';
6
- import { RootState } from '../../../reducer';
7
- import { ZeniAPI } from '../../../zeniAPI';
8
- import { updateCompanyProductServices, updateCompanyProductServicesFailure, updateCompanyProductServicesSuccess } from '../companyViewReducer';
9
- export type ActionType = ReturnType<typeof updateCompanies> | ReturnType<typeof updateTenantProductSettings> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCompanyProductServices> | ReturnType<typeof updateCompanyProductServicesSuccess> | ReturnType<typeof updateCompanyProductServicesFailure>;
10
- export declare const updateCompanyProductServicesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCompanyProductServicesEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const companyReducer_1 = require("../../../entity/company/companyReducer");
7
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
8
- const tenantReducer_1 = require("../../../entity/tenant/tenantReducer");
9
- const responsePayload_1 = require("../../../responsePayload");
10
- const companyViewReducer_1 = require("../companyViewReducer");
11
- const companyManagementViewSelector_1 = require("../selector/companyManagementViewSelector");
12
- const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateCompanyProductServices.match),
13
- // Per-row admin action: an operator can enable services on several
14
- // companies at once, so each trigger keeps its own request (matches
15
- // updateCompanyQboRealmIdEpic).
16
- (0, operators_1.mergeMap)((action) => {
17
- const { companyId, services } = action.payload;
18
- const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
19
- const tenantId = (0, companyManagementViewSelector_1.resolveTenantIdByCompanyId)(state$.value, companyId);
20
- // Send only the service-enable fields so the backend routes this through
21
- // its isolated "enable services" path. Bookkeeping is a Tenant product
22
- // flag and implies spend management; bill pay / reimbursement are Company
23
- // feature flags.
24
- const requestBody = {};
25
- if (isBookkeepingEnabled != null) {
26
- requestBody.is_book_keeping_enabled = isBookkeepingEnabled;
27
- requestBody.is_spend_management_enabled = isBookkeepingEnabled;
28
- }
29
- if (isBillPayEnabled != null) {
30
- requestBody.is_bill_pay_feature_enabled = isBillPayEnabled;
31
- }
32
- if (isReimbursementEnabled != null) {
33
- requestBody.is_reimbursement_feature_enabled = isReimbursementEnabled;
34
- }
35
- // No fields set would fall through to the normal company PUT on the backend;
36
- // treat it as an immediate no-op success so the In-Progress status resolves.
37
- if (Object.keys(requestBody).length === 0) {
38
- return (0, rxjs_1.from)([(0, companyViewReducer_1.updateCompanyProductServicesSuccess)({ companyId })]);
39
- }
40
- return zeniAPI
41
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
42
- .pipe((0, operators_1.mergeMap)((response) => {
43
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
44
- const companies = response.data?.companies ?? [];
45
- const actions = [];
46
- // The response normally carries the updated company; only write
47
- // company state when it does (a 200 is still a success even with
48
- // an empty company array).
49
- if (companies.length > 0) {
50
- actions.push((0, companyReducer_1.updateCompanies)({
51
- payload: companies,
52
- schema: {},
53
- isUpdate: true,
54
- }));
55
- }
56
- // Independent of the company array: the company PUT is the source
57
- // of truth and this tenant-state patch is a best-effort optimistic
58
- // sync, skipped when the tenant isn't loaded (UI relies on the
59
- // next tenant fetch).
60
- if (isBookkeepingEnabled != null && tenantId != null) {
61
- actions.push((0, tenantReducer_1.updateTenantProductSettings)({
62
- tenantId,
63
- isBookkeepingEnabled,
64
- isSpendManagementEnabled: isBookkeepingEnabled,
65
- }));
66
- }
67
- actions.push((0, companyViewReducer_1.updateCompanyProductServicesSuccess)({ companyId }));
68
- actions.push((0, snackbarReducer_1.openSnackbar)({
69
- messageSection: 'product_services_update',
70
- messageText: 'success',
71
- type: 'success',
72
- }));
73
- return (0, rxjs_1.from)(actions);
74
- }
75
- return (0, rxjs_1.from)([
76
- (0, companyViewReducer_1.updateCompanyProductServicesFailure)(companyId, response.status),
77
- (0, snackbarReducer_1.openSnackbar)({
78
- messageSection: 'product_services_update',
79
- messageText: 'failed',
80
- type: 'error',
81
- }),
82
- ]);
83
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
84
- (0, companyViewReducer_1.updateCompanyProductServicesFailure)(companyId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update Company Product Services errored out: ' +
85
- (error instanceof Error
86
- ? error.message
87
- : JSON.stringify(error)))),
88
- (0, snackbarReducer_1.openSnackbar)({
89
- messageSection: 'product_services_update',
90
- messageText: 'failed',
91
- type: 'error',
92
- }),
93
- ])));
94
- }));
95
- exports.updateCompanyProductServicesEpic = updateCompanyProductServicesEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { RootState } from '../../../reducer';
5
- import { ZeniAPI } from '../../../zeniAPI';
6
- import { updateCompanyQboRealmId, updateCompanyQboRealmIdFailure, updateCompanyQboRealmIdSuccess } from '../companyViewReducer';
7
- export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof updateCompanyQboRealmId> | ReturnType<typeof updateCompanyQboRealmIdSuccess> | ReturnType<typeof updateCompanyQboRealmIdFailure>;
8
- export declare const updateCompanyQboRealmIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCompanyQboRealmIdEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const companyViewReducer_1 = require("../companyViewReducer");
9
- const companyManagementViewSelector_1 = require("../selector/companyManagementViewSelector");
10
- const updateCompanyQboRealmIdEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateCompanyQboRealmId.match),
11
- // Per-row admin action: several rows can be in flight at once, so each
12
- // trigger keeps its own request instead of cancelling the previous one.
13
- (0, operators_1.mergeMap)((action) => {
14
- const { companyId, qboRealmId } = action.payload;
15
- const tenantId = (0, companyManagementViewSelector_1.resolveTenantIdByCompanyId)(state$.value, companyId);
16
- if (tenantId == null) {
17
- return (0, rxjs_1.from)([
18
- (0, companyViewReducer_1.updateCompanyQboRealmIdFailure)(companyId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `No tenant found for companyId: ${companyId}`)),
19
- (0, snackbarReducer_1.openSnackbar)({
20
- messageSection: 'qbo_realm_id_update',
21
- messageText: 'failed',
22
- type: 'error',
23
- }),
24
- ]);
25
- }
26
- // The FE route reads the target tenant from the zeni-tenant-id header,
27
- // which overrides the operator's ambient tenant for this request only.
28
- // qboRealmId omitted -> null clears the pin; a value overwrites it.
29
- return zeniAPI
30
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/qbo-realm-id`, { qbo_realm_id: qboRealmId ?? null }, { 'zeni-tenant-id': tenantId })
31
- .pipe((0, operators_1.mergeMap)((response) => {
32
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
33
- return (0, rxjs_1.from)([
34
- (0, companyViewReducer_1.updateCompanyQboRealmIdSuccess)({ companyId }),
35
- (0, snackbarReducer_1.openSnackbar)({
36
- messageSection: 'qbo_realm_id_update',
37
- messageText: 'success',
38
- type: 'success',
39
- }),
40
- ]);
41
- }
42
- return (0, rxjs_1.from)([
43
- (0, companyViewReducer_1.updateCompanyQboRealmIdFailure)(companyId, response.status),
44
- (0, snackbarReducer_1.openSnackbar)({
45
- messageSection: 'qbo_realm_id_update',
46
- messageText: 'failed',
47
- type: 'error',
48
- }),
49
- ]);
50
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
51
- (0, companyViewReducer_1.updateCompanyQboRealmIdFailure)(companyId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update Company QBO realm id errored out: ' +
52
- (error instanceof Error
53
- ? error.message
54
- : JSON.stringify(error)))),
55
- (0, snackbarReducer_1.openSnackbar)({
56
- messageSection: 'qbo_realm_id_update',
57
- messageText: 'failed',
58
- type: 'error',
59
- }),
60
- ])));
61
- }));
62
- exports.updateCompanyQboRealmIdEpic = updateCompanyQboRealmIdEpic;
@@ -1,7 +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 { fetchInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreview, updateInvoicingDunningEmailPreviewFailure } from './invoicingDunningCaseDetailViewReducer';
6
- export type ActionType = ReturnType<typeof fetchInvoicingDunningEmailPreview> | ReturnType<typeof updateInvoicingDunningEmailPreview> | ReturnType<typeof updateInvoicingDunningEmailPreviewFailure>;
7
- export declare const fetchInvoicingDunningEmailPreviewEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingDunningEmailPreviewEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const invoicingDunningCaseDetailViewPayload_1 = require("./invoicingDunningCaseDetailViewPayload");
8
- const invoicingDunningCaseDetailViewReducer_1 = require("./invoicingDunningCaseDetailViewReducer");
9
- const fetchInvoicingDunningEmailPreviewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingDunningCaseDetailViewReducer_1.fetchInvoicingDunningEmailPreview.match), (0, operators_1.switchMap)((action) => {
10
- const { id } = action.payload;
11
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/email-preview`;
12
- return zeniAPI
13
- .postAndGetJSON(apiUrl, {})
14
- .pipe((0, operators_1.map)((response) => {
15
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
16
- return (0, invoicingDunningCaseDetailViewReducer_1.updateInvoicingDunningEmailPreview)({
17
- id,
18
- preview: (0, invoicingDunningCaseDetailViewPayload_1.toInvoicingDunningEmailPreview)(response.data),
19
- });
20
- }
21
- return (0, invoicingDunningCaseDetailViewReducer_1.updateInvoicingDunningEmailPreviewFailure)({
22
- id,
23
- status: response.status,
24
- });
25
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingDunningCaseDetailViewReducer_1.updateInvoicingDunningEmailPreviewFailure)({
26
- id,
27
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Dunning email preview REST API call errored out: ${error instanceof Error ? error.message : String(error)}`),
28
- }))));
29
- }));
30
- exports.fetchInvoicingDunningEmailPreviewEpic = fetchInvoicingDunningEmailPreviewEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../reducer';
4
- import { fetchInvoicingDunningEmailPreview, fetchInvoicingDunningEmailPreviewPage } from './invoicingDunningCaseDetailViewReducer';
5
- export type ActionType = ReturnType<typeof fetchInvoicingDunningEmailPreview> | ReturnType<typeof fetchInvoicingDunningEmailPreviewPage>;
6
- export declare const fetchInvoicingDunningEmailPreviewPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;