@zeniai/client-epic-state 5.2.32-betaAK4 → 5.2.32-betaAK6

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 (132) hide show
  1. package/lib/epic.d.ts +6 -4
  2. package/lib/epic.js +30 -17
  3. package/lib/esm/epic.js +17 -4
  4. package/lib/esm/index.js +2 -1
  5. package/lib/esm/view/invoicing/couponView/fetchInvoicingCouponCountsEpic.js +29 -0
  6. package/lib/esm/view/invoicing/couponView/fetchInvoicingCouponListEpic.js +41 -0
  7. package/lib/esm/view/invoicing/couponView/fetchInvoicingCouponListPageEpic.js +22 -0
  8. package/lib/esm/view/invoicing/customerPaymentMethod/createInvoicingSetupIntentEpic.js +17 -0
  9. package/lib/esm/view/invoicing/customerPaymentMethod/fetchInvoicingPlaidLinkTokenEpic.js +15 -0
  10. package/lib/esm/view/invoicing/customerPaymentMethod/saveInvoicingPaymentMethodEpic.js +21 -0
  11. package/lib/esm/view/invoicing/customerPaymentMethod/sendInvoicingPaymentLinkEpic.js +26 -0
  12. package/lib/esm/view/invoicing/dataImportView/fetchInvoicingDataImportStatusEpic.js +14 -0
  13. package/lib/esm/view/invoicing/dataImportView/fetchInvoicingMigrationDiagnosticsEpic.js +44 -0
  14. package/lib/esm/view/invoicing/dataImportView/fetchInvoicingMigrationSessionEpic.js +14 -0
  15. package/lib/esm/view/invoicing/dataImportView/fetchInvoicingMigrationSessionsEpic.js +14 -0
  16. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +8 -0
  17. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +48 -1
  18. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +52 -9
  19. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewEpic.js +31 -0
  20. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewPageEpic.js +23 -0
  21. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +4 -4
  22. package/lib/esm/view/invoicing/invoiceDetail/voidInvoiceHelper.js +32 -0
  23. package/lib/esm/view/invoicing/settingsView/initializeInvoicingBrandingAddressEpic.js +27 -0
  24. package/lib/esm/view/invoicing/settingsView/{invoicingBrandingFormEpics.js → submitInvoicingBrandingFormEpic.js} +3 -19
  25. package/lib/index.d.ts +5 -3
  26. package/lib/index.js +10 -5
  27. package/lib/view/invoicing/couponView/{couponViewEpics.d.ts → fetchInvoicingCouponCountsEpic.d.ts} +4 -2
  28. package/lib/view/invoicing/couponView/fetchInvoicingCouponCountsEpic.js +33 -0
  29. package/lib/view/invoicing/couponView/fetchInvoicingCouponListEpic.d.ts +8 -0
  30. package/lib/view/invoicing/couponView/fetchInvoicingCouponListEpic.js +45 -0
  31. package/lib/view/invoicing/couponView/fetchInvoicingCouponListPageEpic.d.ts +7 -0
  32. package/lib/view/invoicing/couponView/fetchInvoicingCouponListPageEpic.js +26 -0
  33. package/lib/view/invoicing/customerPaymentMethod/createInvoicingSetupIntentEpic.d.ts +8 -0
  34. package/lib/view/invoicing/customerPaymentMethod/createInvoicingSetupIntentEpic.js +21 -0
  35. package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodReducer.d.ts +4 -0
  36. package/lib/view/invoicing/customerPaymentMethod/{customerPaymentMethodEpic.d.ts → fetchInvoicingPlaidLinkTokenEpic.d.ts} +0 -3
  37. package/lib/view/invoicing/customerPaymentMethod/fetchInvoicingPlaidLinkTokenEpic.js +19 -0
  38. package/lib/view/invoicing/customerPaymentMethod/saveInvoicingPaymentMethodEpic.d.ts +8 -0
  39. package/lib/view/invoicing/customerPaymentMethod/saveInvoicingPaymentMethodEpic.js +25 -0
  40. package/lib/view/invoicing/customerPaymentMethod/sendInvoicingPaymentLinkEpic.d.ts +8 -0
  41. package/lib/view/invoicing/customerPaymentMethod/sendInvoicingPaymentLinkEpic.js +30 -0
  42. package/lib/view/invoicing/dataImportView/fetchInvoicingDataImportStatusEpic.d.ts +7 -0
  43. package/lib/view/invoicing/dataImportView/fetchInvoicingDataImportStatusEpic.js +18 -0
  44. package/lib/view/invoicing/dataImportView/{dataImportViewEpics.d.ts → fetchInvoicingMigrationDiagnosticsEpic.d.ts} +0 -3
  45. package/lib/view/invoicing/dataImportView/fetchInvoicingMigrationDiagnosticsEpic.js +48 -0
  46. package/lib/view/invoicing/dataImportView/fetchInvoicingMigrationSessionEpic.d.ts +7 -0
  47. package/lib/view/invoicing/dataImportView/fetchInvoicingMigrationSessionEpic.js +18 -0
  48. package/lib/view/invoicing/dataImportView/fetchInvoicingMigrationSessionsEpic.d.ts +7 -0
  49. package/lib/view/invoicing/dataImportView/fetchInvoicingMigrationSessionsEpic.js +18 -0
  50. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -0
  51. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +1 -1
  52. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.d.ts +1 -0
  53. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.d.ts +27 -0
  54. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +10 -1
  55. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +16 -1
  56. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +49 -2
  57. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +45 -1
  58. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +54 -10
  59. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +9 -0
  60. package/lib/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewEpic.d.ts +12 -0
  61. package/lib/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewEpic.js +35 -0
  62. package/lib/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewPageEpic.d.ts +10 -0
  63. package/lib/view/invoicing/editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewPageEpic.js +27 -0
  64. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.d.ts +55 -0
  65. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.d.ts +1 -1
  66. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +4 -4
  67. package/lib/view/invoicing/invoiceDetail/invoiceDetailPayload.d.ts +53 -0
  68. package/lib/view/invoicing/invoiceDetail/invoiceDetailReducer.d.ts +1 -1
  69. package/lib/view/invoicing/invoiceDetail/voidInvoiceHelper.d.ts +11 -0
  70. package/lib/view/invoicing/invoiceDetail/voidInvoiceHelper.js +38 -0
  71. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
  72. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +1 -1
  73. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +25 -0
  74. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +1 -1
  75. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingTransactionDetailViewPayload.d.ts +8 -0
  76. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingTransactionDetailViewReducer.d.ts +1 -1
  77. package/lib/view/invoicing/settingsView/{invoicingBrandingFormEpics.d.ts → initializeInvoicingBrandingAddressEpic.d.ts} +1 -8
  78. package/lib/view/invoicing/settingsView/initializeInvoicingBrandingAddressEpic.js +31 -0
  79. package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.d.ts +20 -0
  80. package/lib/view/invoicing/settingsView/{invoicingBrandingFormEpics.js → submitInvoicingBrandingFormEpic.js} +1 -18
  81. package/package.json +1 -1
  82. package/lib/esm/view/invoicing/couponView/couponViewEpics.js +0 -76
  83. package/lib/esm/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +0 -63
  84. package/lib/esm/view/invoicing/dataImportView/dataImportViewEpics.js +0 -74
  85. package/lib/esm/view/invoicing/dataImportView/invoicingDataImportActionPayload.js +0 -1
  86. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemDetailPayload.js +0 -1
  87. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/invoicingCouponDetailPayload.js +0 -1
  88. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerDetailPayload.js +0 -1
  89. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerRecordSelector.js +0 -32
  90. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/promotionalCreditPayload.js +0 -1
  91. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionPayload.js +0 -1
  92. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionRequestPayload.js +0 -2
  93. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionDetailPayload.js +0 -1
  94. package/lib/esm/view/invoicing/invoiceDetail/invoicingInvoiceActionPayload.js +0 -1
  95. package/lib/esm/view/invoicing/invoiceDetail/invoicingInvoiceActionRequestPayload.js +0 -2
  96. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionPayload.js +0 -1
  97. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionRequestPayload.js +0 -2
  98. package/lib/esm/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionPayload.js +0 -1
  99. package/lib/esm/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionRequestPayload.js +0 -2
  100. package/lib/view/invoicing/couponView/couponViewEpics.js +0 -82
  101. package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +0 -70
  102. package/lib/view/invoicing/dataImportView/dataImportViewEpics.js +0 -81
  103. package/lib/view/invoicing/dataImportView/invoicingDataImportActionPayload.d.ts +0 -3
  104. package/lib/view/invoicing/dataImportView/invoicingDataImportActionPayload.js +0 -2
  105. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemDetailPayload.d.ts +0 -3
  106. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemDetailPayload.js +0 -2
  107. package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponDetailPayload.d.ts +0 -3
  108. package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponDetailPayload.js +0 -2
  109. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerDetailPayload.d.ts +0 -3
  110. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerDetailPayload.js +0 -2
  111. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerRecordSelector.d.ts +0 -37
  112. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerRecordSelector.js +0 -36
  113. package/lib/view/invoicing/editInvoicingCustomerDetailView/promotionalCreditPayload.d.ts +0 -3
  114. package/lib/view/invoicing/editInvoicingCustomerDetailView/promotionalCreditPayload.js +0 -2
  115. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionPayload.d.ts +0 -3
  116. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionPayload.js +0 -2
  117. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionRequestPayload.d.ts +0 -53
  118. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionActionRequestPayload.js +0 -3
  119. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionDetailPayload.d.ts +0 -3
  120. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionDetailPayload.js +0 -2
  121. package/lib/view/invoicing/invoiceDetail/invoicingInvoiceActionPayload.d.ts +0 -3
  122. package/lib/view/invoicing/invoiceDetail/invoicingInvoiceActionPayload.js +0 -2
  123. package/lib/view/invoicing/invoiceDetail/invoicingInvoiceActionRequestPayload.d.ts +0 -52
  124. package/lib/view/invoicing/invoiceDetail/invoicingInvoiceActionRequestPayload.js +0 -3
  125. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionPayload.d.ts +0 -3
  126. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionPayload.js +0 -2
  127. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionRequestPayload.d.ts +0 -24
  128. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningActionRequestPayload.js +0 -3
  129. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionPayload.d.ts +0 -3
  130. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionPayload.js +0 -2
  131. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionRequestPayload.d.ts +0 -7
  132. package/lib/view/invoicing/invoicingTransactionDetailView/invoicingPaymentActionRequestPayload.js +0 -3
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingCouponListPageEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const couponViewReducer_1 = require("./couponViewReducer");
7
+ /**
8
+ * Fetch unless the endpoint is already loaded or in flight — or always when the
9
+ * caller forces a refresh via `cacheOverride` (e.g. on a filter/sort change).
10
+ */
11
+ const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
12
+ (fetchStateAndError.fetchState !== 'Completed' &&
13
+ fetchStateAndError.fetchState !== 'In-Progress');
14
+ const fetchInvoicingCouponListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(couponViewReducer_1.fetchInvoicingCouponListPage.match), (0, operators_1.mergeMap)((action) => {
15
+ const { cacheOverride, filters, sort } = action.payload;
16
+ const state = state$.value.invoicingCouponViewState;
17
+ const pageActions = [];
18
+ if (shouldFetch({ fetchState: state.fetchState, error: state.error }, cacheOverride)) {
19
+ pageActions.push((0, couponViewReducer_1.fetchInvoicingCouponList)({ filters, sort }));
20
+ }
21
+ if (shouldFetch(state.countsFetchState, cacheOverride)) {
22
+ pageActions.push((0, couponViewReducer_1.fetchInvoicingCouponCounts)());
23
+ }
24
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(pageActions));
25
+ }));
26
+ exports.fetchInvoicingCouponListPageEpic = fetchInvoicingCouponListPageEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
6
+ import { createInvoicingSetupIntent, createInvoicingSetupIntentFailure, createInvoicingSetupIntentSuccess, fetchInvoicingPlaidLinkToken, fetchInvoicingPlaidLinkTokenFailure, fetchInvoicingPlaidLinkTokenSuccess, saveInvoicingPaymentMethod, saveInvoicingPaymentMethodFailure, saveInvoicingPaymentMethodSuccess, sendInvoicingPaymentLink, sendInvoicingPaymentLinkFailure, sendInvoicingPaymentLinkSuccess } from './customerPaymentMethodReducer';
7
+ export type ActionType = ReturnType<typeof createInvoicingSetupIntent> | ReturnType<typeof createInvoicingSetupIntentSuccess> | ReturnType<typeof createInvoicingSetupIntentFailure> | ReturnType<typeof fetchInvoicingPlaidLinkToken> | ReturnType<typeof fetchInvoicingPlaidLinkTokenSuccess> | ReturnType<typeof fetchInvoicingPlaidLinkTokenFailure> | ReturnType<typeof saveInvoicingPaymentMethod> | ReturnType<typeof saveInvoicingPaymentMethodSuccess> | ReturnType<typeof saveInvoicingPaymentMethodFailure> | ReturnType<typeof sendInvoicingPaymentLink> | ReturnType<typeof sendInvoicingPaymentLinkSuccess> | ReturnType<typeof sendInvoicingPaymentLinkFailure> | ReturnType<typeof fetchInvoicingCustomerDetail>;
8
+ export declare const createInvoicingSetupIntentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInvoicingSetupIntentEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const customerPaymentMethodReducer_1 = require("./customerPaymentMethodReducer");
8
+ const createInvoicingSetupIntentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerPaymentMethodReducer_1.createInvoicingSetupIntent.match), (0, operators_1.mergeMap)((action) => {
9
+ const { customerId } = action.payload;
10
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/customers/${encodeURIComponent(customerId)}/payment-methods/setup-intent`;
11
+ return zeniAPI
12
+ .postAndGetJSON(apiUrl, {})
13
+ .pipe((0, operators_1.switchMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.createInvoicingSetupIntentSuccess)(response.data));
16
+ }
17
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.createInvoicingSetupIntentFailure)(response.status));
18
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.createInvoicingSetupIntentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Setup intent REST API call errored out ' +
19
+ JSON.stringify(error))))));
20
+ }));
21
+ exports.createInvoicingSetupIntentEpic = createInvoicingSetupIntentEpic;
@@ -13,7 +13,11 @@ export interface SaveInvoicingPaymentMethodPayload {
13
13
  }
14
14
  export interface SendInvoicingPaymentLinkPayload {
15
15
  customerId: ID;
16
+ /** Plain text; the backend escapes it and converts newlines. */
17
+ body?: string;
16
18
  email?: string;
19
+ /** Omitted to let the backend use its own default. */
20
+ subject?: string;
17
21
  }
18
22
  export interface SendInvoicingPaymentLinkSuccessPayload {
19
23
  email: string;
@@ -5,7 +5,4 @@ import { ZeniAPI } from '../../../zeniAPI';
5
5
  import { fetchInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
6
6
  import { createInvoicingSetupIntent, createInvoicingSetupIntentFailure, createInvoicingSetupIntentSuccess, fetchInvoicingPlaidLinkToken, fetchInvoicingPlaidLinkTokenFailure, fetchInvoicingPlaidLinkTokenSuccess, saveInvoicingPaymentMethod, saveInvoicingPaymentMethodFailure, saveInvoicingPaymentMethodSuccess, sendInvoicingPaymentLink, sendInvoicingPaymentLinkFailure, sendInvoicingPaymentLinkSuccess } from './customerPaymentMethodReducer';
7
7
  export type ActionType = ReturnType<typeof createInvoicingSetupIntent> | ReturnType<typeof createInvoicingSetupIntentSuccess> | ReturnType<typeof createInvoicingSetupIntentFailure> | ReturnType<typeof fetchInvoicingPlaidLinkToken> | ReturnType<typeof fetchInvoicingPlaidLinkTokenSuccess> | ReturnType<typeof fetchInvoicingPlaidLinkTokenFailure> | ReturnType<typeof saveInvoicingPaymentMethod> | ReturnType<typeof saveInvoicingPaymentMethodSuccess> | ReturnType<typeof saveInvoicingPaymentMethodFailure> | ReturnType<typeof sendInvoicingPaymentLink> | ReturnType<typeof sendInvoicingPaymentLinkSuccess> | ReturnType<typeof sendInvoicingPaymentLinkFailure> | ReturnType<typeof fetchInvoicingCustomerDetail>;
8
- export declare const createInvoicingSetupIntentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
9
8
  export declare const fetchInvoicingPlaidLinkTokenEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
10
- export declare const saveInvoicingPaymentMethodEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
11
- export declare const sendInvoicingPaymentLinkEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingPlaidLinkTokenEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const customerPaymentMethodReducer_1 = require("./customerPaymentMethodReducer");
8
+ const fetchInvoicingPlaidLinkTokenEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerPaymentMethodReducer_1.fetchInvoicingPlaidLinkToken.match), (0, operators_1.switchMap)((action) => {
9
+ const { customerId } = action.payload;
10
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/plaid/link-token?customer_id=${encodeURIComponent(customerId)}`;
11
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
12
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
13
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.fetchInvoicingPlaidLinkTokenSuccess)(response.data.link_token));
14
+ }
15
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.fetchInvoicingPlaidLinkTokenFailure)(response.status));
16
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.fetchInvoicingPlaidLinkTokenFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Plaid link token REST API call errored out ' +
17
+ JSON.stringify(error))))));
18
+ }));
19
+ exports.fetchInvoicingPlaidLinkTokenEpic = fetchInvoicingPlaidLinkTokenEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
6
+ import { createInvoicingSetupIntent, createInvoicingSetupIntentFailure, createInvoicingSetupIntentSuccess, fetchInvoicingPlaidLinkToken, fetchInvoicingPlaidLinkTokenFailure, fetchInvoicingPlaidLinkTokenSuccess, saveInvoicingPaymentMethod, saveInvoicingPaymentMethodFailure, saveInvoicingPaymentMethodSuccess, sendInvoicingPaymentLink, sendInvoicingPaymentLinkFailure, sendInvoicingPaymentLinkSuccess } from './customerPaymentMethodReducer';
7
+ export type ActionType = ReturnType<typeof createInvoicingSetupIntent> | ReturnType<typeof createInvoicingSetupIntentSuccess> | ReturnType<typeof createInvoicingSetupIntentFailure> | ReturnType<typeof fetchInvoicingPlaidLinkToken> | ReturnType<typeof fetchInvoicingPlaidLinkTokenSuccess> | ReturnType<typeof fetchInvoicingPlaidLinkTokenFailure> | ReturnType<typeof saveInvoicingPaymentMethod> | ReturnType<typeof saveInvoicingPaymentMethodSuccess> | ReturnType<typeof saveInvoicingPaymentMethodFailure> | ReturnType<typeof sendInvoicingPaymentLink> | ReturnType<typeof sendInvoicingPaymentLinkSuccess> | ReturnType<typeof sendInvoicingPaymentLinkFailure> | ReturnType<typeof fetchInvoicingCustomerDetail>;
8
+ export declare const saveInvoicingPaymentMethodEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveInvoicingPaymentMethodEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const editInvoicingCustomerDetailViewReducer_1 = require("../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer");
8
+ const customerPaymentMethodReducer_1 = require("./customerPaymentMethodReducer");
9
+ const saveInvoicingPaymentMethodEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerPaymentMethodReducer_1.saveInvoicingPaymentMethod.match), (0, operators_1.mergeMap)((action) => {
10
+ const { customerId, data } = action.payload;
11
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/customers/${encodeURIComponent(customerId)}/payment-methods`;
12
+ return zeniAPI
13
+ .postAndGetJSON(apiUrl, data)
14
+ .pipe((0, operators_1.mergeMap)((response) => {
15
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
16
+ return [
17
+ (0, customerPaymentMethodReducer_1.saveInvoicingPaymentMethodSuccess)(),
18
+ (0, editInvoicingCustomerDetailViewReducer_1.fetchInvoicingCustomerDetail)({ id: customerId }),
19
+ ];
20
+ }
21
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.saveInvoicingPaymentMethodFailure)(response.status));
22
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.saveInvoicingPaymentMethodFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save payment method REST API call errored out ' +
23
+ JSON.stringify(error))))));
24
+ }));
25
+ exports.saveInvoicingPaymentMethodEpic = saveInvoicingPaymentMethodEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
6
+ import { createInvoicingSetupIntent, createInvoicingSetupIntentFailure, createInvoicingSetupIntentSuccess, fetchInvoicingPlaidLinkToken, fetchInvoicingPlaidLinkTokenFailure, fetchInvoicingPlaidLinkTokenSuccess, saveInvoicingPaymentMethod, saveInvoicingPaymentMethodFailure, saveInvoicingPaymentMethodSuccess, sendInvoicingPaymentLink, sendInvoicingPaymentLinkFailure, sendInvoicingPaymentLinkSuccess } from './customerPaymentMethodReducer';
7
+ export type ActionType = ReturnType<typeof createInvoicingSetupIntent> | ReturnType<typeof createInvoicingSetupIntentSuccess> | ReturnType<typeof createInvoicingSetupIntentFailure> | ReturnType<typeof fetchInvoicingPlaidLinkToken> | ReturnType<typeof fetchInvoicingPlaidLinkTokenSuccess> | ReturnType<typeof fetchInvoicingPlaidLinkTokenFailure> | ReturnType<typeof saveInvoicingPaymentMethod> | ReturnType<typeof saveInvoicingPaymentMethodSuccess> | ReturnType<typeof saveInvoicingPaymentMethodFailure> | ReturnType<typeof sendInvoicingPaymentLink> | ReturnType<typeof sendInvoicingPaymentLinkSuccess> | ReturnType<typeof sendInvoicingPaymentLinkFailure> | ReturnType<typeof fetchInvoicingCustomerDetail>;
8
+ export declare const sendInvoicingPaymentLinkEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendInvoicingPaymentLinkEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const customerPaymentMethodReducer_1 = require("./customerPaymentMethodReducer");
8
+ const sendInvoicingPaymentLinkEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(customerPaymentMethodReducer_1.sendInvoicingPaymentLink.match), (0, operators_1.mergeMap)((action) => {
9
+ const { body, customerId, email, subject } = action.payload;
10
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/customers/${encodeURIComponent(customerId)}/payment-link`;
11
+ return zeniAPI
12
+ // subject/body are omitted rather than sent empty, so the backend
13
+ // falls back to its own defaults for anything the user left alone.
14
+ .postAndGetJSON(apiUrl, {
15
+ email,
16
+ ...(body != null && body !== '' ? { body } : {}),
17
+ ...(subject != null && subject !== '' ? { subject } : {}),
18
+ })
19
+ .pipe((0, operators_1.switchMap)((response) => {
20
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
21
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.sendInvoicingPaymentLinkSuccess)({
22
+ email: response.data.email,
23
+ magicLinkUrl: response.data.magic_link_url,
24
+ }));
25
+ }
26
+ return (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.sendInvoicingPaymentLinkFailure)(response.status));
27
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, customerPaymentMethodReducer_1.sendInvoicingPaymentLinkFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Send payment link REST API call errored out ' +
28
+ JSON.stringify(error))))));
29
+ }));
30
+ exports.sendInvoicingPaymentLinkEpic = sendInvoicingPaymentLinkEpic;
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationDiagnostics, fetchInvoicingMigrationSession, fetchInvoicingMigrationSessions, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, updateInvoicingMigrationDiagnostics, updateInvoicingMigrationDiagnosticsFailure, updateInvoicingMigrationSessionFailure, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, upsertInvoicingMigrationSession } from './dataImportViewReducer';
6
+ export type ActionType = ReturnType<typeof fetchInvoicingDataImportStatus> | ReturnType<typeof fetchInvoicingMigrationDiagnostics> | ReturnType<typeof fetchInvoicingMigrationSession> | ReturnType<typeof fetchInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingDataImportStatus> | ReturnType<typeof updateInvoicingDataImportStatusFailure> | ReturnType<typeof updateInvoicingMigrationDiagnostics> | ReturnType<typeof updateInvoicingMigrationDiagnosticsFailure> | ReturnType<typeof updateInvoicingMigrationSessionFailure> | ReturnType<typeof updateInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingMigrationSessionsFailure> | ReturnType<typeof upsertInvoicingMigrationSession>;
7
+ export declare const fetchInvoicingDataImportStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingDataImportStatusEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const dataImportViewReducer_1 = require("./dataImportViewReducer");
8
+ const fetchInvoicingDataImportStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dataImportViewReducer_1.fetchInvoicingDataImportStatus.match), (0, operators_1.switchMap)(() => {
9
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/data-import/status`;
10
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingDataImportStatus)(response.data ?? []));
13
+ }
14
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingDataImportStatusFailure)(response.status));
15
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingDataImportStatusFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch data import status REST API call errored out ' +
16
+ JSON.stringify(error))))));
17
+ }));
18
+ exports.fetchInvoicingDataImportStatusEpic = fetchInvoicingDataImportStatusEpic;
@@ -4,7 +4,4 @@ import { RootState } from '../../../rootStateTypes';
4
4
  import { ZeniAPI } from '../../../zeniAPI';
5
5
  import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationDiagnostics, fetchInvoicingMigrationSession, fetchInvoicingMigrationSessions, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, updateInvoicingMigrationDiagnostics, updateInvoicingMigrationDiagnosticsFailure, updateInvoicingMigrationSessionFailure, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, upsertInvoicingMigrationSession } from './dataImportViewReducer';
6
6
  export type ActionType = ReturnType<typeof fetchInvoicingDataImportStatus> | ReturnType<typeof fetchInvoicingMigrationDiagnostics> | ReturnType<typeof fetchInvoicingMigrationSession> | ReturnType<typeof fetchInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingDataImportStatus> | ReturnType<typeof updateInvoicingDataImportStatusFailure> | ReturnType<typeof updateInvoicingMigrationDiagnostics> | ReturnType<typeof updateInvoicingMigrationDiagnosticsFailure> | ReturnType<typeof updateInvoicingMigrationSessionFailure> | ReturnType<typeof updateInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingMigrationSessionsFailure> | ReturnType<typeof upsertInvoicingMigrationSession>;
7
- export declare const fetchInvoicingMigrationSessionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
8
- export declare const fetchInvoicingDataImportStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
9
- export declare const fetchInvoicingMigrationSessionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
10
7
  export declare const fetchInvoicingMigrationDiagnosticsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingMigrationDiagnosticsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const dataImportViewReducer_1 = require("./dataImportViewReducer");
8
+ const fetchInvoicingMigrationDiagnosticsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dataImportViewReducer_1.fetchInvoicingMigrationDiagnostics.match), (0, operators_1.switchMap)((action) => {
9
+ const { cursor, level, moduleId, outcome, search, sessionId } = action.payload;
10
+ const params = new URLSearchParams();
11
+ if (cursor != null) {
12
+ params.set('cursor', cursor);
13
+ }
14
+ if (moduleId != null) {
15
+ params.set('module_id', moduleId);
16
+ }
17
+ if (level != null) {
18
+ params.set('level', level);
19
+ }
20
+ if (outcome != null) {
21
+ params.set('outcome', outcome);
22
+ }
23
+ if (search != null && search.trim() !== '') {
24
+ params.set('search', search.trim());
25
+ }
26
+ const query = params.toString();
27
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/data-import/${encodeURIComponent(sessionId)}/issues${query === '' ? '' : `?${query}`}`;
28
+ return zeniAPI
29
+ .getJSON(apiUrl)
30
+ .pipe((0, operators_1.switchMap)((response) => {
31
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
32
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationDiagnostics)({
33
+ append: cursor != null,
34
+ page: response.data,
35
+ sessionId,
36
+ }));
37
+ }
38
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationDiagnosticsFailure)({
39
+ error: response.status,
40
+ sessionId,
41
+ }));
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationDiagnosticsFailure)({
43
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch migration diagnostics REST API call errored out ' +
44
+ JSON.stringify(error)),
45
+ sessionId,
46
+ }))));
47
+ }));
48
+ exports.fetchInvoicingMigrationDiagnosticsEpic = fetchInvoicingMigrationDiagnosticsEpic;
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationDiagnostics, fetchInvoicingMigrationSession, fetchInvoicingMigrationSessions, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, updateInvoicingMigrationDiagnostics, updateInvoicingMigrationDiagnosticsFailure, updateInvoicingMigrationSessionFailure, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, upsertInvoicingMigrationSession } from './dataImportViewReducer';
6
+ export type ActionType = ReturnType<typeof fetchInvoicingDataImportStatus> | ReturnType<typeof fetchInvoicingMigrationDiagnostics> | ReturnType<typeof fetchInvoicingMigrationSession> | ReturnType<typeof fetchInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingDataImportStatus> | ReturnType<typeof updateInvoicingDataImportStatusFailure> | ReturnType<typeof updateInvoicingMigrationDiagnostics> | ReturnType<typeof updateInvoicingMigrationDiagnosticsFailure> | ReturnType<typeof updateInvoicingMigrationSessionFailure> | ReturnType<typeof updateInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingMigrationSessionsFailure> | ReturnType<typeof upsertInvoicingMigrationSession>;
7
+ export declare const fetchInvoicingMigrationSessionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingMigrationSessionEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const dataImportViewReducer_1 = require("./dataImportViewReducer");
8
+ const fetchInvoicingMigrationSessionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dataImportViewReducer_1.fetchInvoicingMigrationSession.match), (0, operators_1.switchMap)((action) => {
9
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/data-import/${encodeURIComponent(action.payload)}`;
10
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
12
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.upsertInvoicingMigrationSession)(response.data));
13
+ }
14
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationSessionFailure)(response.status));
15
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationSessionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch migration session REST API call errored out ' +
16
+ JSON.stringify(error))))));
17
+ }));
18
+ exports.fetchInvoicingMigrationSessionEpic = fetchInvoicingMigrationSessionEpic;
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../rootStateTypes';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchInvoicingDataImportStatus, fetchInvoicingMigrationDiagnostics, fetchInvoicingMigrationSession, fetchInvoicingMigrationSessions, updateInvoicingDataImportStatus, updateInvoicingDataImportStatusFailure, updateInvoicingMigrationDiagnostics, updateInvoicingMigrationDiagnosticsFailure, updateInvoicingMigrationSessionFailure, updateInvoicingMigrationSessions, updateInvoicingMigrationSessionsFailure, upsertInvoicingMigrationSession } from './dataImportViewReducer';
6
+ export type ActionType = ReturnType<typeof fetchInvoicingDataImportStatus> | ReturnType<typeof fetchInvoicingMigrationDiagnostics> | ReturnType<typeof fetchInvoicingMigrationSession> | ReturnType<typeof fetchInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingDataImportStatus> | ReturnType<typeof updateInvoicingDataImportStatusFailure> | ReturnType<typeof updateInvoicingMigrationDiagnostics> | ReturnType<typeof updateInvoicingMigrationDiagnosticsFailure> | ReturnType<typeof updateInvoicingMigrationSessionFailure> | ReturnType<typeof updateInvoicingMigrationSessions> | ReturnType<typeof updateInvoicingMigrationSessionsFailure> | ReturnType<typeof upsertInvoicingMigrationSession>;
7
+ export declare const fetchInvoicingMigrationSessionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchInvoicingMigrationSessionsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const dataImportViewReducer_1 = require("./dataImportViewReducer");
8
+ const fetchInvoicingMigrationSessionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dataImportViewReducer_1.fetchInvoicingMigrationSessions.match), (0, operators_1.switchMap)(() => {
9
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/data-import/sessions`;
10
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationSessions)(response.data ?? []));
13
+ }
14
+ return (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationSessionsFailure)(response.status));
15
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dataImportViewReducer_1.updateInvoicingMigrationSessionsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch migration sessions REST API call errored out ' +
16
+ JSON.stringify(error))))));
17
+ }));
18
+ exports.fetchInvoicingMigrationSessionsEpic = fetchInvoicingMigrationSessionsEpic;
@@ -28,3 +28,4 @@ export declare const buildAccountingDetail: (subFamily: InvoicingCatalogAccounti
28
28
  export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean, lookup: InvoicingCatalogAccountingLookup) => Record<string, unknown>;
29
29
  export type RunInvoicingCatalogPlanActionResponse = ZeniAPIResponse<InvoicingPlanPayload>;
30
30
  export type RunInvoicingCatalogProductActionResponse = ZeniAPIResponse<InvoicingProductPayload>;
31
+ export type InvoicingCatalogItemDetailResponse = ZeniAPIResponse<InvoicingPlanPayload>;
@@ -9,7 +9,7 @@ export interface InvoicingCatalogItemFormTier {
9
9
  /** Unset until entered, so a blank field is distinguishable from a real 0. */
10
10
  price?: Amount;
11
11
  }
12
- /** A price point (price point) of a catalog item. */
12
+ /** A price point of a catalog item. */
13
13
  export interface InvoicingCatalogItemFormSubFamily {
14
14
  /** Accounting integration is per price point: the API carries
15
15
  * `accounting_detail` on each product, not on the parent item. */
@@ -9,3 +9,4 @@ export type InvoicingCouponWriteResponse = ZeniAPIResponse<InvoicingCouponPayloa
9
9
  */
10
10
  export declare const localDataToSaveInvoicingCouponPayload: (localData: InvoicingCouponFormLocalData, isCreate: boolean) => Record<string, unknown>;
11
11
  export type RunInvoicingDiscountActionResponse = ZeniAPIResponse<InvoicingCouponPayload>;
12
+ export type InvoicingCouponDetailResponse = ZeniAPIResponse<InvoicingCouponPayload>;
@@ -10,3 +10,30 @@ export type SaveInvoicingCustomerResponse = ZeniAPIResponse<InvoicingCustomerPay
10
10
  * vendor save flow.
11
11
  */
12
12
  export declare const localDataToSaveInvoicingCustomerPayload: (localData: InvoicingCustomerFormLocalData, billingAddress?: AddressUpdatableInfo) => Record<string, unknown>;
13
+ export type InvoicingCustomerDetailResponse = ZeniAPIResponse<InvoicingCustomerPayload>;
14
+ /** Wire shape of `POST /1.0/customers/{id}/payment-link/email-preview`. */
15
+ export interface InvoicingPaymentLinkEmailPreviewPayload {
16
+ body: string;
17
+ body_token: string;
18
+ rendered_html_template: string;
19
+ subject: string;
20
+ subject_token: string;
21
+ to: string;
22
+ }
23
+ export type InvoicingPaymentLinkEmailPreviewResponse = ZeniAPIResponse<InvoicingPaymentLinkEmailPreviewPayload>;
24
+ /**
25
+ * The email rendered once with sentinel tokens standing in for the subject and
26
+ * body, so the composer can splice a draft into it without another request.
27
+ */
28
+ export interface InvoicingPaymentLinkEmailPreviewData {
29
+ /** Default body prefill, plain text. */
30
+ body: string;
31
+ bodyToken: string;
32
+ renderedHtmlTemplate: string;
33
+ /** Default subject prefill. */
34
+ subject: string;
35
+ subjectToken: string;
36
+ to: string;
37
+ }
38
+ export declare const toInvoicingPaymentLinkEmailPreview: (payload: InvoicingPaymentLinkEmailPreviewPayload) => InvoicingPaymentLinkEmailPreviewData;
39
+ export type AddPromotionalCreditsResponse = ZeniAPIResponse<InvoicingCustomerPayload>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.localDataToSaveInvoicingCustomerPayload = void 0;
3
+ exports.toInvoicingPaymentLinkEmailPreview = exports.localDataToSaveInvoicingCustomerPayload = void 0;
4
4
  const addressViewPayload_1 = require("../../addressView/addressViewPayload");
5
5
  const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
6
6
  /**
@@ -34,3 +34,12 @@ const localDataToSaveInvoicingCustomerPayload = (localData, billingAddress) => {
34
34
  };
35
35
  };
36
36
  exports.localDataToSaveInvoicingCustomerPayload = localDataToSaveInvoicingCustomerPayload;
37
+ const toInvoicingPaymentLinkEmailPreview = (payload) => ({
38
+ body: payload.body,
39
+ bodyToken: payload.body_token,
40
+ renderedHtmlTemplate: payload.rendered_html_template,
41
+ subject: payload.subject,
42
+ subjectToken: payload.subject_token,
43
+ to: payload.to,
44
+ });
45
+ exports.toInvoicingPaymentLinkEmailPreview = toInvoicingPaymentLinkEmailPreview;
@@ -1,6 +1,7 @@
1
1
  import { ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../../responsePayload';
3
3
  import { EditInvoicingCustomerDetailViewState, InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
4
+ import { InvoicingPaymentLinkEmailPreviewData } from './editInvoicingCustomerDetailViewPayload';
4
5
  /** Add promotional credits to a customer. */
5
6
  export interface SubmitAddPromotionalCreditsPayload {
6
7
  amount: number;
@@ -22,7 +23,21 @@ export interface InitializeInvoicingCustomerAddressPayload {
22
23
  id?: ID;
23
24
  }
24
25
  export declare const initialState: EditInvoicingCustomerDetailViewState;
25
- export declare const addPromotionalCreditsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "editInvoicingCustomerDetailView/addPromotionalCreditsFailure">, addPromotionalCreditsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"editInvoicingCustomerDetailView/addPromotionalCreditsSuccess">, fetchInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
+ export declare const fetchInvoicingPaymentLinkEmailPreview: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
27
+ customerId: ID;
28
+ }, "editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreview">, fetchInvoicingPaymentLinkEmailPreviewPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
29
+ customerId: ID;
30
+ cacheOverride?: boolean;
31
+ }], {
32
+ cacheOverride: boolean;
33
+ customerId: string;
34
+ }, "editInvoicingCustomerDetailView/fetchInvoicingPaymentLinkEmailPreviewPage", never, never>, updateInvoicingPaymentLinkEmailPreview: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
35
+ customerId: ID;
36
+ preview: InvoicingPaymentLinkEmailPreviewData;
37
+ }, "editInvoicingCustomerDetailView/updateInvoicingPaymentLinkEmailPreview">, updateInvoicingPaymentLinkEmailPreviewFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
38
+ customerId: ID;
39
+ status: ZeniAPIStatus;
40
+ }, "editInvoicingCustomerDetailView/updateInvoicingPaymentLinkEmailPreviewFailure">, addPromotionalCreditsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "editInvoicingCustomerDetailView/addPromotionalCreditsFailure">, addPromotionalCreditsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"editInvoicingCustomerDetailView/addPromotionalCreditsSuccess">, fetchInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
41
  id: ID;
27
42
  }, "editInvoicingCustomerDetailView/fetchInvoicingCustomerDetail">, fetchInvoicingCustomerDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
28
43
  id: ID;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.initializeInvoicingCustomerAddress = exports.resetEditInvoicingCustomerDetailView = exports.submitInvoicingCustomerFormFailure = exports.submitInvoicingCustomerFormSuccess = exports.submitInvoicingCustomerForm = exports.updateInvoicingCustomerFormDraft = exports.updateInvoicingCustomerDetailFailure = exports.submitAddPromotionalCredits = exports.resetPromotionalCreditAction = exports.updateInvoicingCustomerDetail = exports.seedInvoicingCustomerFormDraft = exports.fetchInvoicingCustomerDetailPage = exports.fetchInvoicingCustomerDetail = exports.addPromotionalCreditsSuccess = exports.addPromotionalCreditsFailure = exports.initialState = void 0;
4
+ exports.initializeInvoicingCustomerAddress = exports.resetEditInvoicingCustomerDetailView = exports.submitInvoicingCustomerFormFailure = exports.submitInvoicingCustomerFormSuccess = exports.submitInvoicingCustomerForm = exports.updateInvoicingCustomerFormDraft = exports.updateInvoicingCustomerDetailFailure = exports.submitAddPromotionalCredits = exports.resetPromotionalCreditAction = exports.updateInvoicingCustomerDetail = exports.seedInvoicingCustomerFormDraft = exports.fetchInvoicingCustomerDetailPage = exports.fetchInvoicingCustomerDetail = exports.addPromotionalCreditsSuccess = exports.addPromotionalCreditsFailure = exports.updateInvoicingPaymentLinkEmailPreviewFailure = exports.updateInvoicingPaymentLinkEmailPreview = exports.fetchInvoicingPaymentLinkEmailPreviewPage = exports.fetchInvoicingPaymentLinkEmailPreview = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../../rootActions");
7
7
  const invoicingCustomerFormConfig_1 = require("./invoicingCustomerFormConfig");
8
8
  exports.initialState = {
9
+ emailPreviewFetchState: { fetchState: 'Not-Started', error: undefined },
10
+ emailPreview: undefined,
11
+ emailPreviewCustomerId: undefined,
9
12
  promotionalCreditSubmitState: { fetchState: 'Not-Started', error: undefined },
10
13
  recordStateById: {},
11
14
  fetchState: 'Not-Started',
@@ -21,6 +24,50 @@ const editInvoicingCustomerDetailView = (0, toolkit_1.createSlice)({
21
24
  name: 'editInvoicingCustomerDetailView',
22
25
  initialState: exports.initialState,
23
26
  reducers: {
27
+ /**
28
+ * Open the payment-link email composer. The guard epic decides whether the
29
+ * preview is already cached for this customer; `cacheOverride` forces the
30
+ * refetch behind Retry.
31
+ */
32
+ fetchInvoicingPaymentLinkEmailPreviewPage: {
33
+ reducer() {
34
+ // Orchestrator trigger only — the fetch below owns the state.
35
+ },
36
+ prepare(payload) {
37
+ return {
38
+ payload: {
39
+ cacheOverride: payload.cacheOverride ?? false,
40
+ customerId: payload.customerId,
41
+ },
42
+ };
43
+ },
44
+ },
45
+ fetchInvoicingPaymentLinkEmailPreview(draft, action) {
46
+ // A preview belongs to one customer, so anything cached for another is
47
+ // dropped rather than shown while this one loads.
48
+ draft.emailPreview = undefined;
49
+ draft.emailPreviewCustomerId = action.payload.customerId;
50
+ draft.emailPreviewFetchState = {
51
+ fetchState: 'In-Progress',
52
+ error: undefined,
53
+ };
54
+ },
55
+ updateInvoicingPaymentLinkEmailPreview(draft, action) {
56
+ draft.emailPreview = action.payload.preview;
57
+ draft.emailPreviewCustomerId = action.payload.customerId;
58
+ draft.emailPreviewFetchState = {
59
+ fetchState: 'Completed',
60
+ error: undefined,
61
+ };
62
+ },
63
+ updateInvoicingPaymentLinkEmailPreviewFailure(draft, action) {
64
+ draft.emailPreview = undefined;
65
+ draft.emailPreviewCustomerId = action.payload.customerId;
66
+ draft.emailPreviewFetchState = {
67
+ fetchState: 'Error',
68
+ error: action.payload.status,
69
+ };
70
+ },
24
71
  submitAddPromotionalCredits: {
25
72
  reducer(draft) {
26
73
  draft.promotionalCreditSubmitState = {
@@ -139,5 +186,5 @@ const editInvoicingCustomerDetailView = (0, toolkit_1.createSlice)({
139
186
  });
140
187
  },
141
188
  });
142
- _a = editInvoicingCustomerDetailView.actions, exports.addPromotionalCreditsFailure = _a.addPromotionalCreditsFailure, exports.addPromotionalCreditsSuccess = _a.addPromotionalCreditsSuccess, exports.fetchInvoicingCustomerDetail = _a.fetchInvoicingCustomerDetail, exports.fetchInvoicingCustomerDetailPage = _a.fetchInvoicingCustomerDetailPage, exports.seedInvoicingCustomerFormDraft = _a.seedInvoicingCustomerFormDraft, exports.updateInvoicingCustomerDetail = _a.updateInvoicingCustomerDetail, exports.resetPromotionalCreditAction = _a.resetPromotionalCreditAction, exports.submitAddPromotionalCredits = _a.submitAddPromotionalCredits, exports.updateInvoicingCustomerDetailFailure = _a.updateInvoicingCustomerDetailFailure, exports.updateInvoicingCustomerFormDraft = _a.updateInvoicingCustomerFormDraft, exports.submitInvoicingCustomerForm = _a.submitInvoicingCustomerForm, exports.submitInvoicingCustomerFormSuccess = _a.submitInvoicingCustomerFormSuccess, exports.submitInvoicingCustomerFormFailure = _a.submitInvoicingCustomerFormFailure, exports.resetEditInvoicingCustomerDetailView = _a.resetEditInvoicingCustomerDetailView, exports.initializeInvoicingCustomerAddress = _a.initializeInvoicingCustomerAddress;
189
+ _a = editInvoicingCustomerDetailView.actions, exports.fetchInvoicingPaymentLinkEmailPreview = _a.fetchInvoicingPaymentLinkEmailPreview, exports.fetchInvoicingPaymentLinkEmailPreviewPage = _a.fetchInvoicingPaymentLinkEmailPreviewPage, exports.updateInvoicingPaymentLinkEmailPreview = _a.updateInvoicingPaymentLinkEmailPreview, exports.updateInvoicingPaymentLinkEmailPreviewFailure = _a.updateInvoicingPaymentLinkEmailPreviewFailure, exports.addPromotionalCreditsFailure = _a.addPromotionalCreditsFailure, exports.addPromotionalCreditsSuccess = _a.addPromotionalCreditsSuccess, exports.fetchInvoicingCustomerDetail = _a.fetchInvoicingCustomerDetail, exports.fetchInvoicingCustomerDetailPage = _a.fetchInvoicingCustomerDetailPage, exports.seedInvoicingCustomerFormDraft = _a.seedInvoicingCustomerFormDraft, exports.updateInvoicingCustomerDetail = _a.updateInvoicingCustomerDetail, exports.resetPromotionalCreditAction = _a.resetPromotionalCreditAction, exports.submitAddPromotionalCredits = _a.submitAddPromotionalCredits, exports.updateInvoicingCustomerDetailFailure = _a.updateInvoicingCustomerDetailFailure, exports.updateInvoicingCustomerFormDraft = _a.updateInvoicingCustomerFormDraft, exports.submitInvoicingCustomerForm = _a.submitInvoicingCustomerForm, exports.submitInvoicingCustomerFormSuccess = _a.submitInvoicingCustomerFormSuccess, exports.submitInvoicingCustomerFormFailure = _a.submitInvoicingCustomerFormFailure, exports.resetEditInvoicingCustomerDetailView = _a.resetEditInvoicingCustomerDetailView, exports.initializeInvoicingCustomerAddress = _a.initializeInvoicingCustomerAddress;
143
190
  exports.default = editInvoicingCustomerDetailView.reducer;
@@ -2,10 +2,53 @@ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { InvoicingFieldHelpByCode, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
4
4
  import { RootState } from '../../../rootStateTypes';
5
- import { type InvoicingCustomerRecordView } from './invoicingCustomerRecordSelector';
5
+ import { InvoicingPaymentLinkEmailPreviewData } from './editInvoicingCustomerDetailViewPayload';
6
6
  import { InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
7
+ import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoiceState';
8
+ import { InvoicingCustomer, InvoicingCustomerPaymentMethod } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
9
+ import { InvoicingSetupIntent } from '../customerPaymentMethod/customerPaymentMethodState';
10
+ /**
11
+ * Read-only view for the customer detail page: the customer entity + its fetch
12
+ * state, plus everything the page renders in view mode — recent invoices, the
13
+ * Add-Payment-Method dialog state (setup intent / Plaid token / save), the
14
+ * payment-link send state, branding fields for the payment-email preview, and
15
+ * whether Stripe is connected. Lets the detail screen depend on this single
16
+ * read selector.
17
+ */
18
+ export interface InvoicingCustomerRecordView extends FetchStateAndError {
19
+ /**
20
+ * Backend help copy for this screen's field group, keyed by field code.
21
+ * Folded in here so the screen never reaches for the config view itself.
22
+ */
23
+ fieldHelp: InvoicingFieldHelpByCode;
24
+ invoices: InvoicingInvoice[];
25
+ paymentMethods: InvoicingCustomerPaymentMethod[];
26
+ paymentMethodSaveState: FetchStateAndError;
27
+ sendLinkState: FetchStateAndError;
28
+ setupIntentFetchState: FetchStateAndError;
29
+ stripeConnected: boolean;
30
+ brandingAccentColor?: string;
31
+ brandingCompanyName?: string;
32
+ brandingEmail?: string;
33
+ brandingLogoUrl?: string;
34
+ invoicingCustomer?: InvoicingCustomer;
35
+ plaidLinkToken?: string;
36
+ sentPaymentLinkEmail?: string;
37
+ sentPaymentLinkMagicUrl?: string;
38
+ setupIntent?: InvoicingSetupIntent;
39
+ }
40
+ /**
41
+ * `invoicingCustomerID` is absent in create mode, where there is no record to
42
+ * resolve — the view still renders, off an empty record.
43
+ */
44
+ export declare const getInvoicingCustomerRecord: (state: RootState, invoicingCustomerID?: ID) => InvoicingCustomerRecordView;
7
45
  export interface InvoicingCustomerFormView extends SelectorView {
8
46
  customerTypeOptions: InvoicingNamedOption[];
47
+ /**
48
+ * The payment-link email the composer previews, and the state of fetching it.
49
+ * Absent until the composer is opened for this customer.
50
+ */
51
+ emailPreviewFetchState: FetchStateAndError;
9
52
  /**
10
53
  * Backend help copy for this screen's field group, keyed by field code.
11
54
  * Folded in here so the screen never reaches for the config view itself.
@@ -34,6 +77,7 @@ export interface InvoicingCustomerFormView extends SelectorView {
34
77
  taxabilityOptions: InvoicingNamedOption[];
35
78
  billingAddressId?: ID;
36
79
  billingAddressLabel?: string;
80
+ emailPreview?: InvoicingPaymentLinkEmailPreviewData;
37
81
  savedCustomerId?: ID;
38
82
  }
39
83
  /**