@zeniai/client-epic-state 5.2.7 → 5.2.8-betaAK0

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 (50) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +36 -2
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +89 -11
  3. package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
  4. package/lib/entity/invoicing/product/productPayload.js +14 -2
  5. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +86 -10
  6. package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
  7. package/lib/esm/index.js +3 -2
  8. package/lib/esm/view/accountList/accountListReducer.js +0 -1
  9. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
  10. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
  11. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +56 -11
  12. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  13. package/lib/esm/view/expenseAutomationView/types/transactionGroup.js +21 -0
  14. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
  15. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
  16. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  17. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  18. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  19. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +47 -3
  20. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +17 -2
  21. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  22. package/lib/index.d.ts +3 -2
  23. package/lib/index.js +52 -47
  24. package/lib/view/accountList/accountListReducer.js +0 -1
  25. package/lib/view/accountList/accountListState.d.ts +1 -1
  26. package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
  27. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
  28. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +11 -0
  29. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -1
  30. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +57 -12
  31. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
  32. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  33. package/lib/view/expenseAutomationView/types/transactionGroup.d.ts +21 -0
  34. package/lib/view/expenseAutomationView/types/transactionGroup.js +25 -0
  35. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +11 -0
  36. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
  37. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +24 -9
  38. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
  39. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
  40. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  41. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
  42. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  43. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  44. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +19 -2
  45. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +52 -4
  46. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -1
  47. package/lib/view/invoicing/settingsView/settingsViewEpics.js +17 -2
  48. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
  49. package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  50. package/package.json +1 -1
@@ -4,9 +4,11 @@ exports.saveInvoicingSettingsEpic = exports.disconnectInvoicingStripeEpic = expo
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const addressReducer_1 = require("../../../entity/address/addressReducer");
7
+ const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
7
8
  const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
8
9
  const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
9
10
  const responsePayload_1 = require("../../../responsePayload");
11
+ const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
10
12
  const settingsViewReducer_1 = require("./settingsViewReducer");
11
13
  const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
12
14
  const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
@@ -63,9 +65,22 @@ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.p
63
65
  JSON.stringify(error))))));
64
66
  }));
65
67
  exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
66
- const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
68
+ const saveInvoicingSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
67
69
  const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
68
70
  const { settings, snackbarSection } = action.payload;
71
+ // The QBO page edits mappings as picker ids; the service stores whole
72
+ // accounts. Expanded here, at the request boundary, so the page does not
73
+ // have to hold entities it only needs in order to save.
74
+ const qboSettings = settings.qbo;
75
+ const body = qboSettings?.account_mappings != null
76
+ ? {
77
+ ...settings,
78
+ qbo: {
79
+ ...qboSettings,
80
+ account_mappings: (0, invoicingCommonPayload_1.withInvoicingQboMappedAccounts)(qboSettings.account_mappings, (qboId) => (0, invoicingQboViewSelector_1.invoicingQboAccountByQboId)(state$.value, qboId)),
81
+ },
82
+ }
83
+ : settings;
69
84
  /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
70
85
  const snackbar = (messageText, status) => snackbarSection == null
71
86
  ? []
@@ -78,7 +93,7 @@ const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(
78
93
  }),
79
94
  ];
80
95
  return zeniAPI
81
- .putAndGetJSON(apiUrl, { ...settings })
96
+ .putAndGetJSON(apiUrl, { ...body })
82
97
  .pipe((0, operators_1.switchMap)((response) => {
83
98
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
84
99
  return (0, rxjs_1.from)([
@@ -1,7 +1,7 @@
1
1
  import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
3
- import { RootState } from '../../../rootStateTypes';
4
3
  import { ZeniAPIStatus } from '../../../responsePayload';
4
+ import { RootState } from '../../../rootStateTypes';
5
5
  import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
6
6
  /**
7
7
  * Shared primitive: the raw invoicing settings. Consumed internally by other
@@ -53,6 +53,12 @@ export interface InvoicingSettingsHubView {
53
53
  configFetchState: FetchState;
54
54
  dunningScheduleActionOptions: InvoicingDunningActionOption[];
55
55
  isEnablingInvoicing: boolean;
56
+ /**
57
+ * Whether the tenant has already enabled invoicing. The enable footer is for
58
+ * tenants that have not, so this — not `canEnableInvoicing` — decides whether
59
+ * it renders at all.
60
+ */
61
+ isInvoicingEnabled: boolean;
56
62
  isQboConfigured: boolean;
57
63
  isStripeConnected: boolean;
58
64
  qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
@@ -67,9 +73,10 @@ export interface InvoicingSettingsHubView {
67
73
  * two integration prerequisites kept separate so the hub can name the step still
68
74
  * outstanding instead of showing a dead button.
69
75
  *
70
- * `canEnableInvoicing` folds in the onboarding step, so the screen does not need
71
- * to re-check it: the footer is only offered mid-onboarding and only once both
72
- * integrations are ready.
76
+ * `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
77
+ * whether its button is live, and it still requires the onboarding step so the
78
+ * terms cannot be skipped. A tenant partway through therefore sees the footer,
79
+ * disabled and naming what is left, rather than nothing at all.
73
80
  *
74
81
  * Deliberately not folded into `getInvoicingConfigView`: that selector gates
75
82
  * every invoicing route and stays a pure read of the config slice. The settings
@@ -70,9 +70,10 @@ function deriveInvoicingEnablePrerequisites(settings, isQboConnected, qboAccount
70
70
  * two integration prerequisites kept separate so the hub can name the step still
71
71
  * outstanding instead of showing a dead button.
72
72
  *
73
- * `canEnableInvoicing` folds in the onboarding step, so the screen does not need
74
- * to re-check it: the footer is only offered mid-onboarding and only once both
75
- * integrations are ready.
73
+ * `isInvoicingEnabled` decides whether the footer renders; `canEnableInvoicing`
74
+ * whether its button is live, and it still requires the onboarding step so the
75
+ * terms cannot be skipped. A tenant partway through therefore sees the footer,
76
+ * disabled and naming what is left, rather than nothing at all.
76
77
  *
77
78
  * Deliberately not folded into `getInvoicingConfigView`: that selector gates
78
79
  * every invoicing route and stays a pure read of the config slice. The settings
@@ -82,7 +83,10 @@ const getInvoicingSettingsHubView = (state) => {
82
83
  const { dunningScheduleActionOptions, enableState, error: configError, fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, status, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
83
84
  const { canEnable, isQboConfigured, isStripeConnected } = deriveInvoicingEnablePrerequisites(state.invoicingSettingsViewState.settings, state.invoicingQboViewState.connection?.connected === true, qboAccountMappingKindOptions);
84
85
  return {
86
+ // Keeps the onboarding step in the gate: a tenant that has not accepted the
87
+ // terms cannot enable invoicing, whatever the integrations say.
85
88
  canEnableInvoicing: status === 'settings' && canEnable,
89
+ isInvoicingEnabled: state.invoicingConfigViewState.isInvoicingEnabled === true,
86
90
  configError,
87
91
  configFetchState,
88
92
  dunningScheduleActionOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.7",
3
+ "version": "5.2.8-betaAK0",
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",