@zeniai/client-epic-state 5.1.61 → 5.1.62-betaRD2

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/coreEpics.js +3 -2
  2. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  5. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
  6. package/lib/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  7. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  8. package/lib/entity/notificationRegistry/notificationRegistryPayload.d.ts +18 -0
  9. package/lib/entity/notificationRegistry/notificationRegistryPayload.js +28 -0
  10. package/lib/entity/notificationRegistry/notificationRegistryReducer.d.ts +10 -0
  11. package/lib/entity/notificationRegistry/notificationRegistryReducer.js +50 -0
  12. package/lib/entity/notificationRegistry/notificationRegistrySelector.d.ts +2 -0
  13. package/lib/entity/notificationRegistry/notificationRegistrySelector.js +10 -0
  14. package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +32 -0
  15. package/lib/entity/notificationRegistry/notificationRegistryState.js +10 -0
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  18. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  19. package/lib/entity/tenant/clearAllEpic.js +4 -0
  20. package/lib/entity/tenant/tenantReducer.d.ts +4 -1
  21. package/lib/entity/tenant/tenantReducer.js +8 -2
  22. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  23. package/lib/entity/tenant/tenantSelector.js +4 -0
  24. package/lib/entity/transaction/scheduleTransactionHelper.d.ts +15 -0
  25. package/lib/entity/transaction/scheduleTransactionHelper.js +43 -0
  26. package/lib/epic.d.ts +9 -1
  27. package/lib/epic.js +9 -1
  28. package/lib/esm/coreEpics.js +3 -2
  29. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  30. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  31. package/lib/esm/entity/notificationRegistry/notificationRegistryPayload.js +24 -0
  32. package/lib/esm/entity/notificationRegistry/notificationRegistryReducer.js +46 -0
  33. package/lib/esm/entity/notificationRegistry/notificationRegistrySelector.js +6 -0
  34. package/lib/esm/entity/notificationRegistry/notificationRegistryState.js +5 -0
  35. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  36. package/lib/esm/entity/tenant/clearAllEpic.js +4 -0
  37. package/lib/esm/entity/tenant/tenantReducer.js +7 -1
  38. package/lib/esm/entity/tenant/tenantSelector.js +3 -0
  39. package/lib/esm/entity/transaction/scheduleTransactionHelper.js +39 -0
  40. package/lib/esm/epic.js +9 -1
  41. package/lib/esm/index.js +14 -6
  42. package/lib/esm/reducer.js +6 -0
  43. package/lib/esm/view/companyView/companyViewReducer.js +68 -1
  44. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  45. package/lib/esm/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +56 -0
  46. package/lib/esm/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +37 -0
  47. package/lib/esm/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +73 -0
  48. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  49. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  50. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +15 -2
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  53. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  54. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +44 -0
  55. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  56. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +152 -0
  57. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +126 -6
  58. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +71 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +78 -11
  61. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -6
  62. package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +116 -0
  63. package/lib/esm/view/notificationPreferencesView/notificationPreferencesEndpoint.js +5 -0
  64. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +36 -0
  65. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +222 -0
  66. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +25 -0
  67. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +4 -0
  68. package/lib/esm/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
  69. package/lib/esm/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
  70. package/lib/esm/view/settingsView/settingsViewHelpers.js +3 -2
  71. package/lib/index.d.ts +17 -8
  72. package/lib/index.js +85 -47
  73. package/lib/reducer.d.ts +6 -0
  74. package/lib/reducer.js +6 -0
  75. package/lib/view/common/recurringViewHelper.d.ts +2 -2
  76. package/lib/view/companyView/companyViewReducer.d.ts +9 -1
  77. package/lib/view/companyView/companyViewReducer.js +70 -3
  78. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  79. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.d.ts +10 -0
  80. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +60 -0
  81. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.d.ts +11 -0
  82. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +41 -0
  83. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.d.ts +13 -0
  84. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +77 -0
  85. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  86. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  87. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +2 -0
  88. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +14 -1
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +48 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  98. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +43 -0
  99. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +158 -0
  100. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  101. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -0
  102. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +36 -8
  103. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +128 -7
  104. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
  105. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  106. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +29 -4
  107. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
  108. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +76 -0
  109. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -0
  110. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +80 -11
  111. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +53 -6
  112. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -8
  113. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +40 -0
  114. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +120 -0
  115. package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.d.ts +2 -0
  116. package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.js +9 -0
  117. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +7 -0
  118. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +41 -0
  119. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +30 -0
  120. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +226 -0
  121. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.d.ts +7 -0
  122. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +32 -0
  123. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +14 -0
  124. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +8 -0
  125. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +9 -1
  126. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
  127. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
  128. package/lib/view/settingsView/settingsViewHelpers.d.ts +1 -1
  129. package/lib/view/settingsView/settingsViewHelpers.js +3 -2
  130. package/lib/view/settingsView/settingsViewPayload.d.ts +4 -0
  131. package/lib/view/settingsView/settingsViewState.d.ts +1 -1
  132. package/package.json +1 -1
@@ -3,20 +3,52 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchNotificationSettingsEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
+ const notificationRegistryReducer_1 = require("../../../entity/notificationRegistry/notificationRegistryReducer");
6
7
  const responsePayload_1 = require("../../../responsePayload");
8
+ const notificationPreferencesEndpoint_1 = require("../../notificationPreferencesView/notificationPreferencesEndpoint");
9
+ const notificationPreferencesViewReducer_1 = require("../../notificationPreferencesView/notificationPreferencesViewReducer");
7
10
  const settingsViewReducer_1 = require("../settingsViewReducer");
8
11
  const fetchNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettings.match), (0, operators_1.switchMap)(() => {
9
12
  const state = state$.value;
10
- const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
11
13
  const userEmail = state.tenantState.loggedInUser?.userEmail;
12
14
  if (userEmail == null) {
13
15
  return (0, rxjs_1.from)([]);
14
16
  }
15
- return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
17
+ // Snapshot the save epoch at GET-dispatch time. The reducer compares
18
+ // the captured value against the current `saveEpoch` on response and
19
+ // skips the `preferences` replace when a save has landed in the
20
+ // meantime — the GET is carrying the pre-PUT snapshot and would
21
+ // otherwise clobber the fresh save. Cursor Bugbot 3632510237.
22
+ const saveEpochAtDispatch = state.notificationPreferencesViewState.saveEpoch;
23
+ // Snapshot the registry clear epoch at GET-dispatch time (same idiom as
24
+ // `saveEpochAtDispatch` above). The registry reducer compares it against
25
+ // the current `registryEpoch` and skips its write when a
26
+ // `clearAllNotificationRegistry` (tenant switch) has landed since — the
27
+ // GET is carrying the prior tenant's snapshot. Cursor Bugbot 67d6918e.
28
+ const registryEpochAtDispatch = state.notificationRegistryState.registryEpoch;
29
+ return zeniAPI
30
+ .getJSON((0, notificationPreferencesEndpoint_1.notificationPreferencesUrl)(zeniAPI))
31
+ .pipe((0, operators_1.mergeMap)((response) => {
16
32
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
17
33
  const updateActions = [
18
34
  (0, settingsViewReducer_1.updateNotificationSettingsOnSuccess)(response.data, userEmail),
19
35
  ];
36
+ // Always dispatch — an absent `task_checklist_registry` (gate
37
+ // off) must CLEAR the prior tenant's registry, not leave it in
38
+ // place. The reducer clears on `undefined` and full-replaces
39
+ // otherwise, both guarded by the registry epoch so a stale GET
40
+ // that lands after a tenant switch is skipped. Cursor Bugbot
41
+ // 67d6918e.
42
+ updateActions.push((0, notificationRegistryReducer_1.updateNotificationRegistry)({
43
+ registry: response.data.task_checklist_registry ?? undefined,
44
+ registryEpochAtDispatch,
45
+ }));
46
+ if (response.data.task_checklist_preferences != null) {
47
+ updateActions.push((0, notificationPreferencesViewReducer_1.fetchNotificationPreferencesSuccess)({
48
+ preferences: response.data.task_checklist_preferences,
49
+ saveEpochAtDispatch,
50
+ }));
51
+ }
20
52
  return (0, rxjs_1.of)(...updateActions);
21
53
  }
22
54
  else {
@@ -5,9 +5,10 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
7
  const responsePayload_1 = require("../../../responsePayload");
8
+ const notificationPreferencesEndpoint_1 = require("../../notificationPreferencesView/notificationPreferencesEndpoint");
8
9
  const settingsViewReducer_1 = require("../settingsViewReducer");
9
10
  const saveNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveNotificationSettings.match), (0, operators_1.switchMap)(() => {
10
- const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
11
+ const URL = (0, notificationPreferencesEndpoint_1.notificationPreferencesUrl)(zeniAPI);
11
12
  const { notificationSettings, notificationSettingsLocalData } = state$.value.settingsViewState.notification;
12
13
  const payload = toSaveNotificationSettingsPayload(notificationSettingsLocalData, notificationSettings);
13
14
  return zeniAPI
@@ -14,4 +14,4 @@ export declare const isMyBankConnectionsTabVisible: (currentTenant: CurrentTenan
14
14
  export declare const isPerformanceTabVisible: (userRole: UserRoleType[], loggedInUser?: LoggedInUser) => boolean;
15
15
  export declare const isRemindersSectionVisibleOnSettingsPage: (reminderNotificationSettings: ReminderNotificationSettingsData) => boolean;
16
16
  export declare const isMonthEndNotificationsSectionVisibleOnSettingsPage: (monthEndInsightsNotificationSettings: MonthEndInsightsNotificationSettingsData, signedInUseEmail: string) => boolean;
17
- export declare const isNotificationsTabVisible: (notificationSettings: NotificationSettingsData, signedInUseEmail: string, isDebitCardFlagEnabled: boolean, currentTenant: CurrentTenant | undefined) => boolean;
17
+ export declare const isNotificationsTabVisible: (notificationSettings: NotificationSettingsData, signedInUseEmail: string, isDebitCardFlagEnabled: boolean, currentTenant: CurrentTenant | undefined, hasTaskChecklistAccess: boolean) => boolean;
@@ -160,13 +160,14 @@ const isMonthEndNotificationsSectionVisibleOnSettingsPage = (monthEndInsightsNot
160
160
  monthEndInsightsNotificationSettings.recipientEmailIds.includes(signedInUseEmail));
161
161
  };
162
162
  exports.isMonthEndNotificationsSectionVisibleOnSettingsPage = isMonthEndNotificationsSectionVisibleOnSettingsPage;
163
- const isNotificationsTabVisible = (notificationSettings, signedInUseEmail, isDebitCardFlagEnabled, currentTenant) => {
163
+ const isNotificationsTabVisible = (notificationSettings, signedInUseEmail, isDebitCardFlagEnabled, currentTenant, hasTaskChecklistAccess) => {
164
164
  if (currentTenant == null) {
165
165
  return false;
166
166
  }
167
167
  const { reminderNotificationSettings, monthEndInsightsNotificationSettings } = notificationSettings;
168
168
  return (((0, exports.isRemindersSectionVisibleOnSettingsPage)(reminderNotificationSettings) ||
169
- (0, exports.isMonthEndNotificationsSectionVisibleOnSettingsPage)(monthEndInsightsNotificationSettings, signedInUseEmail)) &&
169
+ (0, exports.isMonthEndNotificationsSectionVisibleOnSettingsPage)(monthEndInsightsNotificationSettings, signedInUseEmail) ||
170
+ hasTaskChecklistAccess) &&
170
171
  ((0, tenantSelector_1.isTenantAccountingServicesEnabled)(currentTenant) ||
171
172
  ((0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) === false &&
172
173
  (0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false)));
@@ -1,9 +1,11 @@
1
1
  import { AddressPayload } from '../../entity/address/addressPayload';
2
2
  import { CompanyPayload } from '../../entity/company/companyPayload';
3
+ import { NotificationRegistryPayload } from '../../entity/notificationRegistry/notificationRegistryPayload';
3
4
  import { UserPayload } from '../../entity/user/userPayload';
4
5
  import { UserRolePayload } from '../../entity/userRole/userRolePayload';
5
6
  import { ZeniAPIResponse } from '../../responsePayload';
6
7
  import { AddressUpdatableInfoPayload } from '../addressView/addressViewPayload';
8
+ import { NotificationPreferencesPayload } from '../notificationPreferencesView/notificationPreferencesViewPayload';
7
9
  interface MyProfilePeoplePayload {
8
10
  user_roles: UserRolePayload[];
9
11
  users: UserPayload[];
@@ -36,6 +38,8 @@ export interface NotificationSettingsPayload {
36
38
  pending_reimbursement_approval_notification: RemindersPayload | null;
37
39
  uncategorized_transaction_notification: RemindersPayload | null;
38
40
  month_end_email_recipient_email_ids?: string[];
41
+ task_checklist_preferences?: NotificationPreferencesPayload;
42
+ task_checklist_registry?: NotificationRegistryPayload;
39
43
  }
40
44
  export type NotificationSettingsResponse = ZeniAPIResponse<NotificationSettingsPayload>;
41
45
  interface RefreshQBOPayload {
@@ -12,7 +12,7 @@ export interface IntegrationsSettings {
12
12
  export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
13
13
  declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
14
14
  export type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
15
- export declare const toRemindersFrequencyType: (v: string) => "weekly" | "monthly" | "daily" | "bi-weekly";
15
+ export declare const toRemindersFrequencyType: (v: string) => "daily" | "weekly" | "monthly" | "bi-weekly";
16
16
  export type FrequencyTypeKey = ReturnType<typeof toRemindersFrequencyType>;
17
17
  export declare const NOTIFICATION_MODES: readonly ["email", "dashboard"];
18
18
  export declare const toNotificationMode: (v: string) => "dashboard" | "email";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.61",
3
+ "version": "5.1.62-betaRD2",
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",