@zeniai/client-epic-state 5.3.5 → 5.3.7-betaRD0

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 (67) hide show
  1. package/lib/entity/customerIncome/customerIncomeTrend.d.ts +18 -2
  2. package/lib/entity/customerIncome/customerIncomeTrend.js +65 -5
  3. package/lib/entity/insights/insightSummary.d.ts +3 -0
  4. package/lib/entity/insights/insightSummaryPayload.js +2 -0
  5. package/lib/entity/invoicing/invoice/invoicePayload.d.ts +1 -0
  6. package/lib/entity/invoicing/invoice/invoicePayload.js +3 -0
  7. package/lib/entity/invoicing/invoice/invoiceState.d.ts +2 -0
  8. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  9. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  10. package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +45 -38
  11. package/lib/entity/vendorExpense/vendorSpendTrendFilterTabType.d.ts +2 -2
  12. package/lib/epic.d.ts +4 -1
  13. package/lib/epic.js +6 -0
  14. package/lib/esm/entity/customerIncome/customerIncomeTrend.js +63 -4
  15. package/lib/esm/entity/insights/insightSummaryPayload.js +2 -0
  16. package/lib/esm/entity/invoicing/invoice/invoicePayload.js +3 -0
  17. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  18. package/lib/esm/entity/tenant/epic/fetchAllTenantsEpic.js +46 -39
  19. package/lib/esm/epic.js +6 -0
  20. package/lib/esm/index.js +5 -2
  21. package/lib/esm/init.js +14 -3
  22. package/lib/esm/reducer.js +3 -0
  23. package/lib/esm/sessionEndpointsLoader.js +7 -0
  24. package/lib/esm/view/customerSummaryView/customerSummaryViewPayload.js +1 -0
  25. package/lib/esm/view/customerSummaryView/customerSummaryViewReducer.js +197 -0
  26. package/lib/esm/view/customerSummaryView/customerSummaryViewSelector.js +35 -0
  27. package/lib/esm/view/customerSummaryView/customerSummaryViewState.js +10 -0
  28. package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +30 -0
  29. package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +27 -0
  30. package/lib/esm/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +44 -0
  31. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
  32. package/lib/esm/view/trend/fetchIncomeTrendEpic.js +29 -6
  33. package/lib/esm/view/trend/trendReducer.js +4 -2
  34. package/lib/index.d.ts +9 -2
  35. package/lib/index.js +73 -51
  36. package/lib/init.d.ts +9 -0
  37. package/lib/init.js +17 -4
  38. package/lib/reducer.d.ts +1 -0
  39. package/lib/reducer.js +3 -0
  40. package/lib/rootStateTypes.d.ts +2 -0
  41. package/lib/sessionEndpointsLoader.d.ts +9 -0
  42. package/lib/sessionEndpointsLoader.js +11 -0
  43. package/lib/tsconfig.mocks.tsbuildinfo +1 -0
  44. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  45. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  46. package/lib/view/customerSummaryView/customerSummaryViewPayload.d.ts +38 -0
  47. package/lib/view/customerSummaryView/customerSummaryViewPayload.js +2 -0
  48. package/lib/view/customerSummaryView/customerSummaryViewReducer.d.ts +32 -0
  49. package/lib/view/customerSummaryView/customerSummaryViewReducer.js +202 -0
  50. package/lib/view/customerSummaryView/customerSummaryViewSelector.d.ts +20 -0
  51. package/lib/view/customerSummaryView/customerSummaryViewSelector.js +43 -0
  52. package/lib/view/customerSummaryView/customerSummaryViewState.d.ts +63 -0
  53. package/lib/view/customerSummaryView/customerSummaryViewState.js +13 -0
  54. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.d.ts +9 -0
  55. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +34 -0
  56. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.d.ts +7 -0
  57. package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +31 -0
  58. package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.d.ts +8 -0
  59. package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +48 -0
  60. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
  61. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  62. package/lib/view/trend/fetchIncomeTrendEpic.d.ts +1 -1
  63. package/lib/view/trend/fetchIncomeTrendEpic.js +28 -5
  64. package/lib/view/trend/trendReducer.d.ts +8 -1
  65. package/lib/view/trend/trendReducer.js +4 -2
  66. package/lib/zeniAPI.d.ts +2 -2
  67. package/package.json +26 -1
package/lib/init.js CHANGED
@@ -36,9 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.zeniAPI = void 0;
39
+ exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.setSessionEndpointsLoader = exports.zeniAPI = void 0;
40
40
  exports.default = initialize;
41
41
  exports.updateZeniAPIClientConfig = updateZeniAPIClientConfig;
42
+ exports.updateZeniAPIEndpoints = updateZeniAPIEndpoints;
42
43
  exports.zeniAPIClientConfig = zeniAPIClientConfig;
43
44
  exports.initializeWithNewStore = initializeWithNewStore;
44
45
  exports.initialize3rdPartyExtensions = initialize3rdPartyExtensions;
@@ -47,6 +48,8 @@ const zeniAPI_1 = require("./zeniAPI");
47
48
  const zeniAPIClientState_1 = require("./zeniAPIClientState");
48
49
  var zeniAPIClientState_2 = require("./zeniAPIClientState");
49
50
  Object.defineProperty(exports, "zeniAPI", { enumerable: true, get: function () { return zeniAPIClientState_2.zeniAPI; } });
51
+ var sessionEndpointsLoader_1 = require("./sessionEndpointsLoader");
52
+ Object.defineProperty(exports, "setSessionEndpointsLoader", { enumerable: true, get: function () { return sessionEndpointsLoader_1.setSessionEndpointsLoader; } });
50
53
  var pusherClient_1 = require("./pusherClient");
51
54
  Object.defineProperty(exports, "disconnectPusher", { enumerable: true, get: function () { return pusherClient_1.disconnectPusher; } });
52
55
  Object.defineProperty(exports, "initializePusher", { enumerable: true, get: function () { return pusherClient_1.initializePusher; } });
@@ -60,11 +63,10 @@ let initialized = false;
60
63
  */
61
64
  function initialize(restEndPoints, userId, sessionId, tenantId, isSandboxEnv, onSessionInvalidated) {
62
65
  if (initialized) {
63
- console.warn(`Already initialized with url ${JSON.stringify(zeniAPIClientState_1.zeniAPI.apiEndPoints)}`);
66
+ console.warn('client-epic-state is already initialized');
64
67
  return exports.store;
65
68
  }
66
69
  initialized = true;
67
- console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
68
70
  initialize3rdPartyExtensions();
69
71
  (0, zeniAPIClientState_1.setZeniAPIClient)(new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId, onSessionInvalidated));
70
72
  exports.store = (0, configureStore_1.default)(zeniAPIClientState_1.zeniAPI, isSandboxEnv);
@@ -84,6 +86,18 @@ Object.defineProperty(exports, "injectFeatureEpics", { enumerable: true, get: fu
84
86
  function updateZeniAPIClientConfig(userId, sessionId, tenantId) {
85
87
  zeniAPIClientState_1.zeniAPI.update(userId, sessionId, tenantId);
86
88
  }
89
+ /**
90
+ * Replace the REST endpoints the API client calls. Epics read the endpoints
91
+ * at request time, so every request made after this uses the new ones.
92
+ * Note: This version SHOULD BE used only in the client side.
93
+ * @param restEndPoints
94
+ */
95
+ function updateZeniAPIEndpoints(restEndPoints) {
96
+ if (zeniAPIClientState_1.zeniAPI == null) {
97
+ throw new Error('Call initialize() before updateZeniAPIEndpoints()');
98
+ }
99
+ zeniAPIClientState_1.zeniAPI.apiEndPoints = restEndPoints;
100
+ }
87
101
  /**
88
102
  * Returns current Zeni REST API client config.
89
103
  * @returns
@@ -110,7 +124,6 @@ function zeniAPIClientConfig() {
110
124
  * @param tenantId tenant id
111
125
  */
112
126
  async function initializeWithNewStore(restEndPoints, userId, sessionId, tenantId) {
113
- console.info(`initializeWithNewStore with ${JSON.stringify(restEndPoints)}`);
114
127
  initialize3rdPartyExtensions();
115
128
  const zeniHttpClient = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
116
129
  const store = (0, configureStore_1.default)(zeniHttpClient, false);
package/lib/reducer.d.ts CHANGED
@@ -188,6 +188,7 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
188
188
  vendorFirstReviewViewState: import("./view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState").VendorFirstReviewViewState;
189
189
  vendorGlobalReviewViewState: import(".").VendorGlobalReviewViewState;
190
190
  vendorListState: import("./view/vendorList/vendorListState").VendorListState;
191
+ customerSummaryViewState: import(".").CustomerSummaryViewState;
191
192
  vendorFiling1099ListState: import("./view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState").VendorFiling1099ListState;
192
193
  vendorFiling1099UploadDetailsState: import(".").VendorFiling1099UploadDetailsState;
193
194
  vendorsTabVendorViewState: import("./view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState").VendorsTabVendorViewState;
package/lib/reducer.js CHANGED
@@ -155,6 +155,7 @@ const companyTaskManagerViewReducer_1 = __importStar(require("./view/companyTask
155
155
  const companyViewReducer_1 = __importStar(require("./view/companyView/companyViewReducer"));
156
156
  const createTransferEntryReducer_1 = __importStar(require("./view/createTransferEntry/createTransferEntryReducer"));
157
157
  const creditAgentViewReducer_1 = __importStar(require("./view/creditAgentView/creditAgentViewReducer"));
158
+ const customerSummaryViewReducer_1 = __importStar(require("./view/customerSummaryView/customerSummaryViewReducer"));
158
159
  const dashboardReducer_1 = __importStar(require("./view/dashboard/dashboardReducer"));
159
160
  const dashboardLayoutReducer_1 = __importStar(require("./view/dashboardLayout/dashboardLayoutReducer"));
160
161
  const expenseAutomationViewReducer_1 = __importStar(require("./view/expenseAutomationView/expenseAutomationViewReducer"));
@@ -584,6 +585,7 @@ const initialViewsState = {
584
585
  vendorFirstReviewViewState: vendorFirstReviewViewReducer_1.initialState,
585
586
  vendorGlobalReviewViewState: vendorGlobalReviewViewReducer_1.initialState,
586
587
  vendorListState: vendorListReducer_1.initialState,
588
+ customerSummaryViewState: customerSummaryViewReducer_1.initialState,
587
589
  vendorFiling1099ListState: vendorFiling1099ListReducer_1.initialState,
588
590
  vendorFiling1099UploadDetailsState: vendorFiling1099UploadDetailsReducer_1.initialState,
589
591
  vendorsTabVendorViewState: vendorsTabVendorViewReducer_1.initialState,
@@ -872,6 +874,7 @@ const viewReducers = {
872
874
  vendorFirstReviewViewState: vendorFirstReviewViewReducer_1.default,
873
875
  vendorGlobalReviewViewState: vendorGlobalReviewViewReducer_1.default,
874
876
  vendorListState: vendorListReducer_1.default,
877
+ customerSummaryViewState: customerSummaryViewReducer_1.default,
875
878
  vendorFiling1099ListState: vendorFiling1099ListReducer_1.default,
876
879
  vendorFiling1099UploadDetailsState: vendorFiling1099UploadDetailsReducer_1.default,
877
880
  vendorsTabVendorViewState: vendorsTabVendorViewReducer_1.default,
@@ -114,6 +114,7 @@ import { CompanyTaskManagerViewState } from './view/companyTaskManagerView/compa
114
114
  import { CompanyViewState } from './view/companyView/companyViewState';
115
115
  import { CreateTransferEntryState } from './view/createTransferEntry/createTransferEntryState';
116
116
  import { CreditAgentViewState } from './view/creditAgentView/creditAgentViewState';
117
+ import { CustomerSummaryViewState } from './view/customerSummaryView/customerSummaryViewState';
117
118
  import { DashboardState } from './view/dashboard/dashboardState';
118
119
  import { DashboardLayoutState } from './view/dashboardLayout/dashboardLayoutState';
119
120
  import { ExpenseAutomationViewState } from './view/expenseAutomationView/expenseAutomationViewState';
@@ -413,6 +414,7 @@ export type ViewsState = {
413
414
  createTransferEntryState: CreateTransferEntryState;
414
415
  creditAgentEntityState: CreditAgentEntityState;
415
416
  creditAgentViewState: CreditAgentViewState;
417
+ customerSummaryViewState: CustomerSummaryViewState;
416
418
  dashboardLayoutState: DashboardLayoutState;
417
419
  dashboardState: DashboardState;
418
420
  depositAccountListState: DepositAccountListState;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Called after sign-in, before the user's tenants are fetched. The app uses it
3
+ * to fetch the endpoints that are only served to a signed-in session and to
4
+ * hand them to `updateZeniAPIEndpoints`. Without a loader, tenants are fetched
5
+ * straight away with the endpoints given to `initialize`.
6
+ */
7
+ export type SessionEndpointsLoader = (userId: string, sessionId?: string) => Promise<void>;
8
+ export declare function setSessionEndpointsLoader(loader: SessionEndpointsLoader | undefined): void;
9
+ export declare function getSessionEndpointsLoader(): SessionEndpointsLoader | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setSessionEndpointsLoader = setSessionEndpointsLoader;
4
+ exports.getSessionEndpointsLoader = getSessionEndpointsLoader;
5
+ let sessionEndpointsLoader;
6
+ function setSessionEndpointsLoader(loader) {
7
+ sessionEndpointsLoader = loader;
8
+ }
9
+ function getSessionEndpointsLoader() {
10
+ return sessionEndpointsLoader;
11
+ }