@zeniai/client-epic-state 4.19.96-betaSS2 → 4.19.97-betaRR0

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 (146) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/entity/aiCfo/aiCfoSelector.d.ts +2 -1
  3. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -38
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  6. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +1 -4
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  8. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -37
  9. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  10. package/lib/entity/tenant/tenantReducer.js +0 -1
  11. package/lib/entity/tenant/tenantSelector.d.ts +0 -1
  12. package/lib/entity/tenant/tenantSelector.js +1 -9
  13. package/lib/entity/tenant/tenantState.d.ts +0 -1
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -4
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  16. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  18. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -1
  19. package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -3
  20. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  21. package/lib/epic.d.ts +6 -2
  22. package/lib/epic.js +6 -2
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  24. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  25. package/lib/esm/entity/tenant/tenantReducer.js +0 -1
  26. package/lib/esm/entity/tenant/tenantSelector.js +0 -7
  27. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  28. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  29. package/lib/esm/epic.js +6 -2
  30. package/lib/esm/index.js +12 -10
  31. package/lib/esm/reducer.js +3 -0
  32. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +1 -82
  33. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +2 -8
  34. package/lib/esm/view/classList/fetchClassListEpic.js +2 -9
  35. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +5 -15
  36. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  37. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  38. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  39. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  40. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -17
  41. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  42. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -61
  43. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  44. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  45. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -12
  46. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -17
  47. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  48. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
  49. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  50. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  51. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  52. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  53. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.js +58 -0
  54. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.js +1 -0
  55. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.js +103 -0
  56. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.js +63 -0
  57. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.js +5 -0
  58. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.js +62 -0
  59. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.js +4 -0
  60. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.js +4 -0
  61. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.js +10 -0
  62. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  63. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +14 -1
  64. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.js +36 -0
  66. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -7
  67. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  68. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  69. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  70. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  71. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  72. package/lib/index.d.ts +16 -15
  73. package/lib/index.js +45 -42
  74. package/lib/reducer.d.ts +3 -0
  75. package/lib/reducer.js +3 -0
  76. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -7
  77. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -15
  78. package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -83
  79. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -4
  80. package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -9
  81. package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -18
  82. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  83. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  84. package/lib/view/classList/fetchClassListEpic.js +1 -8
  85. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +0 -1
  86. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +5 -15
  87. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +0 -1
  88. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  89. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  90. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  91. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  92. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  93. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -18
  94. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
  95. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  96. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -61
  97. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  98. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  99. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -11
  100. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -5
  101. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -19
  102. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  103. package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  104. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  105. package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
  106. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  107. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  108. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  109. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  110. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.d.ts +7 -0
  111. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.js +62 -0
  112. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.d.ts +34 -0
  113. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.js +2 -0
  114. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.d.ts +7 -0
  115. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.js +107 -0
  116. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.d.ts +16 -0
  117. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.js +67 -0
  118. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.d.ts +63 -0
  119. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.js +8 -0
  120. package/lib/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.d.ts +20 -0
  121. package/lib/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.js +66 -0
  122. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.d.ts +8 -0
  123. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.js +8 -0
  124. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.d.ts +13 -0
  125. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.js +8 -0
  126. package/lib/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.d.ts +13 -0
  127. package/lib/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.js +14 -0
  128. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  129. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  130. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -1
  131. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +15 -2
  132. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  133. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.d.ts +12 -0
  134. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.js +40 -0
  135. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +3 -6
  136. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
  137. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  138. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  139. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  140. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  141. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  142. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  143. package/package.json +1 -1
  144. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -29
  145. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +0 -8
  146. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -33
@@ -0,0 +1,63 @@
1
+ import { getUserByUserId, getUserName, } from '../../../../entity/user/userSelector';
2
+ function collectOwnerIds(rec) {
3
+ const ids = new Set();
4
+ for (const c of rec.vendor_cards) {
5
+ ids.add(c.owner_id);
6
+ }
7
+ for (const c of rec.dept_cards) {
8
+ ids.add(c.owner_id);
9
+ }
10
+ return [...ids];
11
+ }
12
+ function enrichCard(card, userState) {
13
+ const user = getUserByUserId(userState, card.owner_id);
14
+ const hasOwnerDetails = user != null;
15
+ return {
16
+ ...card,
17
+ hasOwnerDetails,
18
+ ownerDisplayName: hasOwnerDetails
19
+ ? getUserName(user) || card.owner_id
20
+ : card.owner_id,
21
+ ownerProfilePhoto: user?.photo,
22
+ };
23
+ }
24
+ /**
25
+ * Layout hints when using `startAiCardAgentDrawerDataLoad` (parallel CoT + recommendation GETs).
26
+ * - Run phased CoT after `hasChainOfThoughtContent`; end with `setChainOfThoughtsRevealPhase('complete')`.
27
+ * - Show sparkle when `showRecommendationSparkle` (AI still loading).
28
+ * - Render tables / pre text / coverage only when `showRecommendationSection`.
29
+ */
30
+ export function getAiCardAgentDrawerDisplayState(state) {
31
+ const c = state.cardsOnboardingState;
32
+ const cotDone = c.chainOfThoughtsRevealPhase === 'complete';
33
+ const aiDone = c.aiCardRecommendationFetchState === 'Completed' &&
34
+ c.aiCardRecommendationResponse != null;
35
+ return {
36
+ showChainOfThoughtShimmer: c.chainOfThoughtsFetchState === 'In-Progress',
37
+ hasChainOfThoughtContent: c.chainOfThoughtsFetchState === 'Completed' &&
38
+ c.chainOfThoughtsResponse != null,
39
+ showRecommendationSparkle: c.aiCardRecommendationFetchState === 'In-Progress',
40
+ showRecommendationSection: cotDone && aiDone,
41
+ };
42
+ }
43
+ /**
44
+ * Enriches `aiCardRecommendationResponse` with owner display name and photo from `userState`.
45
+ * `ownerIdsMissingFromStore` lists `owner_id`s not in `userState` after the **single** people load
46
+ * (e.g. `fetchCardsOnboardingPageEpic` → `fetchPeople()`). Do not refetch people from this package;
47
+ * show a fallback label or rely on the owner dropdown sourced from the same store.
48
+ */
49
+ export function getAiCardRecommendationDisplayView(state) {
50
+ const rec = state.cardsOnboardingState.aiCardRecommendationResponse;
51
+ if (rec == null) {
52
+ return undefined;
53
+ }
54
+ const { userState } = state;
55
+ const ownerIdsMissingFromStore = collectOwnerIds(rec).filter((id) => userState.userByUserId[id] == null);
56
+ return {
57
+ card_recommendation_pre_text: rec.card_recommendation_pre_text,
58
+ projected_coverage: rec.projected_coverage,
59
+ vendor_cards: rec.vendor_cards.map((c) => enrichCard(c, userState)),
60
+ dept_cards: rec.dept_cards.map((c) => enrichCard(c, userState)),
61
+ ownerIdsMissingFromStore,
62
+ };
63
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * In-app path to open after a successful “Create All Cards” from AI recommendations
3
+ * (e.g. `https://qa.app.zeni.ai` + this path). Routing is handled by the host app.
4
+ */
5
+ export const CREATE_ALL_AI_RECOMMENDED_CARDS_SUCCESS_APP_PATH = '/zeni.ai/cards';
@@ -0,0 +1,62 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { updateAddresses } from '../../../../entity/address/addressReducer';
4
+ import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
5
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
6
+ import { updateAllUsers } from '../../../../entity/user/userReducer';
7
+ import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
8
+ import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
9
+ import { updateChargeCardList } from '../chargeCardList/chargeCardListReducer';
10
+ import { updateChargeCardCount, updateDebitCardCount, } from '../issueChargeCard/issueChargeCardReducer';
11
+ import { createAllAiRecommendedCards, createAllAiRecommendedCardsFailed, createAllAiRecommendedCardsSucceeded, } from './cardsOnboardingReducer';
12
+ function draftsToApiCards(drafts) {
13
+ return drafts.map((d) => ({
14
+ card_holder_user_ids: [d.owner_id],
15
+ card_name: d.card_name,
16
+ card_type: d.card_type ?? 'business_virtual_credit_card',
17
+ currency_code: d.currency_code ?? 'USD',
18
+ purchase_limit: d.purchase_limit,
19
+ purchase_limit_frequency: d.purchase_limit_frequency ?? { code: 'monthly' },
20
+ }));
21
+ }
22
+ /**
23
+ * POST `${cardMicroServiceBaseUrl}/1.0/cards` with edited AI recommendation rows.
24
+ * On success, merges issued cards into entity + list state (same pattern as issue charge card).
25
+ * Host app: when `createAllAiRecommendedCardsFetchState === 'Completed'`, navigate to
26
+ * `CREATE_ALL_AI_RECOMMENDED_CARDS_SUCCESS_APP_PATH`.
27
+ */
28
+ export const createAllAiRecommendedCardsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(createAllAiRecommendedCards.match), switchMap((action) => {
29
+ if (action.payload.length === 0) {
30
+ return of(createAllAiRecommendedCardsFailed(createZeniAPIStatus('Validation', 'No cards to create')));
31
+ }
32
+ const cards = draftsToApiCards(action.payload);
33
+ return zeniAPI
34
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards`, { cards })
35
+ .pipe(mergeMap((response) => {
36
+ if (isSuccessStatus(response) && response.data != null) {
37
+ const actions = [
38
+ updateChargeCards(response.data.cards),
39
+ updateAllUsers({ users: response.data.users }),
40
+ updateUserRoles(response.data.user_roles),
41
+ updateChargeCardList({
42
+ chargeCardListPayload: response.data,
43
+ keepExistingListItems: true,
44
+ }),
45
+ updateAddresses(response.data.addresses),
46
+ updateChargeCardCount(response.data?.cards_count_by_user_id ?? []),
47
+ updateDebitCardCount(response.data?.debit_cards_count_by_deposit_account_id ?? {}),
48
+ createAllAiRecommendedCardsSucceeded(),
49
+ openSnackbar({
50
+ messageSection: 'issue_charge_cards',
51
+ messageText: 'success',
52
+ type: 'success',
53
+ }),
54
+ ];
55
+ return from(actions);
56
+ }
57
+ return of(createAllAiRecommendedCardsFailed(response.status));
58
+ }), catchError((error) => {
59
+ return of(createAllAiRecommendedCardsFailed(createZeniAPIStatus('Unexpected Error', 'Create all AI recommended cards REST API call errored out' +
60
+ JSON.stringify(error))));
61
+ }));
62
+ }));
@@ -0,0 +1,4 @@
1
+ import { filter, switchMap } from 'rxjs/operators';
2
+ import { requestAiCardRecommendation$, } from './cardsOnboardingDataRequests';
3
+ import { fetchAiCardRecommendation } from './cardsOnboardingReducer';
4
+ export const fetchAiCardRecommendationEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchAiCardRecommendation.match), switchMap(() => requestAiCardRecommendation$(zeniAPI)));
@@ -0,0 +1,4 @@
1
+ import { filter, switchMap } from 'rxjs/operators';
2
+ import { requestChainOfThoughtsForAiCardRecommendation$, } from './cardsOnboardingDataRequests';
3
+ import { fetchChainOfThoughtsForAiCardRecommendation } from './cardsOnboardingReducer';
4
+ export const fetchChainOfThoughtsForAiCardRecommendationEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchChainOfThoughtsForAiCardRecommendation.match), switchMap(() => requestChainOfThoughtsForAiCardRecommendation$(zeniAPI)));
@@ -0,0 +1,10 @@
1
+ import { merge } from 'rxjs';
2
+ import { filter, switchMap } from 'rxjs/operators';
3
+ import { requestAiCardRecommendation$, requestChainOfThoughtsForAiCardRecommendation$, } from './cardsOnboardingDataRequests';
4
+ import { startAiCardAgentDrawerDataLoad } from './cardsOnboardingReducer';
5
+ /**
6
+ * On "Let's get started": runs chain-of-thoughts GET and AI card recommendation GET **in parallel**.
7
+ * Reducer (`startAiCardAgentDrawerDataLoad`) resets both slices; use `getAiCardAgentDrawerDisplayState`
8
+ * for phased CoT UI, sparkle while recommendations load, and gated recommendation content.
9
+ */
10
+ export const startAiCardAgentDrawerDataLoadEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startAiCardAgentDrawerDataLoad.match), switchMap(() => merge(requestChainOfThoughtsForAiCardRecommendation$(zeniAPI), requestAiCardRecommendation$(zeniAPI))));
@@ -75,7 +75,6 @@ const ALL_CHARGE_CARD_SORT_KEYS = [
75
75
  'cardName',
76
76
  'department',
77
77
  'cardType',
78
- 'accountType',
79
78
  'status',
80
79
  'utilisation',
81
80
  'limit',
@@ -62,6 +62,19 @@ const chargeCardList = createSlice({
62
62
  };
63
63
  },
64
64
  },
65
+ fetchCardsOnboardingPage: {
66
+ reducer() {
67
+ //do nothing
68
+ },
69
+ prepare(isCreditCardEnabled, cacheOverride = false) {
70
+ return {
71
+ payload: {
72
+ isCreditCardEnabled,
73
+ cacheOverride,
74
+ },
75
+ };
76
+ },
77
+ },
65
78
  fetchCreditAccountRepayment(draft) {
66
79
  draft.creditAccountRepayment.fetchState = 'In-Progress';
67
80
  draft.creditAccountRepayment.error = undefined;
@@ -307,7 +320,7 @@ const chargeCardList = createSlice({
307
320
  },
308
321
  },
309
322
  });
310
- export const { fetchChargeCardListPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
323
+ export const { fetchChargeCardListPage, fetchCardsOnboardingPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
311
324
  export default chargeCardList.reducer;
312
325
  // helper
313
326
  const toCreditAccount = (payload) => ({
@@ -219,8 +219,6 @@ const getCardsBySortKey = (card, sortKey) => {
219
219
  return card.cardName.toLowerCase();
220
220
  case 'cardType':
221
221
  return card.type.code;
222
- case 'accountType':
223
- return card.type.code.includes('credit') ? 'credit' : 'debit';
224
222
  case 'status':
225
223
  return card.status.code;
226
224
  case 'utilisation':
@@ -0,0 +1,36 @@
1
+ import { concat, from } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchPeople } from '../../../people/peopleReducer';
4
+ import { fetchCashbackDetail } from '../cashbackDetail/cashbackDetailReducer';
5
+ import { fetchCardsOnboardingPage, fetchCreditAccount, } from './chargeCardListReducer';
6
+ export const fetchCardsOnboardingPageEpic = (actions$, state$) => actions$.pipe(filter(fetchCardsOnboardingPage.match), mergeMap((action) => {
7
+ const { isCreditCardEnabled, cacheOverride } = action.payload;
8
+ const actions = [];
9
+ const state = state$.value;
10
+ if (cacheOverride === true) {
11
+ if (isCreditCardEnabled) {
12
+ actions.push(fetchCreditAccount());
13
+ }
14
+ actions.push(fetchCashbackDetail());
15
+ actions.push(fetchPeople());
16
+ }
17
+ else {
18
+ const chargeCardList = state.chargeCardListState;
19
+ if (isCreditCardEnabled &&
20
+ chargeCardList.creditAccount.fetchState !== 'Completed' &&
21
+ chargeCardList.creditAccount.fetchState !== 'In-Progress') {
22
+ actions.push(fetchCreditAccount());
23
+ }
24
+ const cashbackDetailState = state.cashbackDetailState;
25
+ if (cashbackDetailState.fetchState !== 'In-Progress' &&
26
+ cashbackDetailState.hasValidState() === false) {
27
+ actions.push(fetchCashbackDetail());
28
+ }
29
+ const peopleState = state.peopleState;
30
+ if (peopleState.fetchState !== 'In-Progress' &&
31
+ peopleState.hasValidState() === false) {
32
+ actions.push(fetchPeople());
33
+ }
34
+ }
35
+ return concat(from(actions));
36
+ }));
@@ -2,7 +2,7 @@ import recordGet from 'lodash/get';
2
2
  import { reduceFetchState } from '../../../../commonStateTypes/reduceFetchState';
3
3
  import { getBankAccountByBankAccountId } from '../../../../entity/bankAccount/bankAccountSelector';
4
4
  import { getAllCurrencies } from '../../../../entity/currency/currencySelector';
5
- import { getCurrentTenant, getIsAccountingClassesEnabled, } from '../../../../entity/tenant/tenantSelector';
5
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
6
6
  import { getUserByUserId } from '../../../../entity/user/userSelector';
7
7
  import { getAccountList, getNestedAccountListHierarchy, } from '../../../accountList/accountListSelector';
8
8
  import { getBankAccount, } from '../../../bankAccountView/bankAccountViewSelector';
@@ -63,16 +63,13 @@ export const getEditRemiDetail = (state, reimbursementId) => {
63
63
  paymentTo: reimbursementInfo?.toAccount.billAccountId,
64
64
  };
65
65
  if (sourceRemiDetail != null) {
66
- const fetchStateList = [
66
+ fetchState = reduceFetchState([
67
67
  sourceRemiDetail.fetchStatus,
68
68
  accountListState.byReportId.reimbursementAccountList,
69
+ classListState,
69
70
  merchantListState,
70
71
  reimbursementConfigState,
71
- ];
72
- if (getIsAccountingClassesEnabled(state)) {
73
- fetchStateList.push(classListState);
74
- }
75
- fetchState = reduceFetchState(fetchStateList).fetchState;
72
+ ]).fetchState;
76
73
  remiStage = reimbursementInfo?.stage.code ?? 'draft';
77
74
  createdBy = getUserByUserId(userState, reimbursement?.createdBy ?? '');
78
75
  createTime = reimbursement?.createTime;
@@ -45,7 +45,6 @@ export const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled
45
45
  return {
46
46
  ...reimbursement,
47
47
  submittedBy: getUserByUserId(userState, reimbursement.reimburseeUserId),
48
- createdByUser: getUserByUserId(userState, reimbursement.createdBy),
49
48
  approvers: approvers,
50
49
  };
51
50
  });
@@ -416,14 +415,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
416
415
  reimbursementsWithNoSortKeyValue.push(reimbursement);
417
416
  }
418
417
  break;
419
- case 'createdBy':
420
- if (reimbursement.createdByUser != null) {
421
- reimbursementsWithSortKeyValue.push(reimbursement);
422
- }
423
- else {
424
- reimbursementsWithNoSortKeyValue.push(reimbursement);
425
- }
426
- break;
427
418
  }
428
419
  });
429
420
  const getColumnWiseSortOrder = (sortOrder) => {
@@ -431,7 +422,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
431
422
  case 'reportName':
432
423
  case 'type':
433
424
  case 'status':
434
- case 'createdBy':
435
425
  return sortOrder === 'ascending' ? 'asc' : 'desc';
436
426
  default:
437
427
  return sortOrder === 'ascending' ? 'desc' : 'asc';
@@ -451,8 +441,6 @@ export const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements
451
441
  return getStatusPerTab(reimbursement);
452
442
  case 'amount':
453
443
  return reimbursement.amount.amount ?? 0;
454
- case 'createdBy':
455
- return `${reimbursement.createdByUser?.firstName ?? ''} ${reimbursement.createdByUser?.lastName ?? ''}`.toLowerCase();
456
444
  }
457
445
  }, getColumnWiseSortOrder(sortOrder));
458
446
  return [
@@ -55,7 +55,6 @@ export const toRemiSubTabUnderScoreType = (v) => stringToUnion(v, REMI_SUB_TAB_U
55
55
  const ALL_REIMBURSEMENT_SORT_KEYS = [
56
56
  'reportName',
57
57
  'submittedOn',
58
- 'createdBy',
59
58
  'type',
60
59
  'status',
61
60
  'amount',
@@ -91,11 +91,11 @@ export const allTaskStatus = [
91
91
  },
92
92
  {
93
93
  code: 'done',
94
- name: 'In Review',
94
+ name: 'Done',
95
95
  },
96
96
  {
97
97
  code: 'resolved',
98
- name: 'Complete',
98
+ name: 'Resolved',
99
99
  },
100
100
  ];
101
101
  export const allTaskPriority = [
@@ -75,8 +75,8 @@ export const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDe
75
75
  lineItem.account?.qboId !== accountLine.account.qboId &&
76
76
  Boolean(lineItem.account?.qboId);
77
77
  hasClassChanged =
78
- (lineItem.class?.qboId != null || accountLine.class?.qboId != null) &&
79
- lineItem.class?.qboId !== accountLine.class?.qboId;
78
+ Boolean(lineItem.class?.qboId) &&
79
+ lineItem.class?.qboId !== accountLine.class.qboId;
80
80
  const recommendedAccountBase = toRecommendedAccountBase(lineItem.amount.amount, lineItem.account);
81
81
  const recommendedClassBase = toRecommendedClassBase(lineItem.amount.amount, lineItem.class);
82
82
  const latestRecommendedCategory = lineItem.recommendedAccount;
@@ -140,13 +140,13 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
140
140
  record.isRetainedCategorySelected = false;
141
141
  }
142
142
  if (Boolean(recommendedClass?.qboId) &&
143
- recommendedClass?.qboId !== accountLine.class?.qboId) {
143
+ recommendedClass?.qboId !== accountLine.class.qboId) {
144
144
  record.isRecommendedClassSelected = false;
145
145
  record.recommendedClass = recommendedClass;
146
146
  record.isClassUpdateSelected = false;
147
147
  }
148
148
  if (accountLine.isClassMiscategorized &&
149
- Boolean(accountLine.class?.qboId) &&
149
+ Boolean(accountLine.class.qboId) &&
150
150
  Boolean(isVendorOrCustomerPresent)) {
151
151
  record.retainedClass = accountLine.class;
152
152
  record.isRetainedClassSelected = false;
@@ -336,14 +336,14 @@ export const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionD
336
336
  }
337
337
  };
338
338
  const updateClass = () => {
339
- if (recommendedClass?.qboId !== accountLine.class?.qboId &&
339
+ if (recommendedClass?.qboId !== accountLine.class.qboId &&
340
340
  Boolean(recommendedClass?.qboId)) {
341
341
  record.class = accountLine.class;
342
342
  record.isRecommendedClassSelected = false;
343
343
  record.recommendedClass = recommendedClass;
344
344
  record.isClassUpdateSelected = false;
345
345
  if (accountLine.isClassMiscategorized &&
346
- Boolean(accountLine.class?.qboId) &&
346
+ Boolean(accountLine.class.qboId) &&
347
347
  Boolean(isVendorOrCustomerPresent)) {
348
348
  record.retainedClass = accountLine.class;
349
349
  record.isRetainedClassSelected = false;
@@ -356,7 +356,7 @@ export const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionD
356
356
  record.recommendedClass = recommendedClass;
357
357
  record.isClassUpdateSelected = false;
358
358
  if (accountLine.isClassMiscategorized &&
359
- Boolean(accountLine.class?.qboId) &&
359
+ Boolean(accountLine.class.qboId) &&
360
360
  Boolean(isVendorOrCustomerPresent)) {
361
361
  record.retainedClass = recommendedClass;
362
362
  record.isRetainedClassSelected = false;
@@ -650,13 +650,13 @@ export const setEntityRecommendationForLineIdInLocalData = (transaction, transac
650
650
  record.isRetainedCategorySelected = false;
651
651
  }
652
652
  }
653
- if (recommendedClass?.qboId !== accountLine.class?.qboId &&
653
+ if (recommendedClass?.qboId !== accountLine.class.qboId &&
654
654
  Boolean(recommendedClass?.qboId)) {
655
655
  record.isRecommendedClassSelected = false;
656
656
  record.recommendedClass = recommendedClass;
657
657
  record.isClassUpdateSelected = false;
658
658
  if (accountLine.isClassMiscategorized &&
659
- Boolean(accountLine.class?.qboId)) {
659
+ Boolean(accountLine.class.qboId)) {
660
660
  record.retainedClass = accountLine.class;
661
661
  record.isRetainedClassSelected = false;
662
662
  }
@@ -664,12 +664,12 @@ export const setEntityRecommendationForLineIdInLocalData = (transaction, transac
664
664
  else {
665
665
  record.isRecommendedClassSelected = false;
666
666
  record.recommendedClass = recommendedClass;
667
- if (recommendedClass?.qboId === accountLine.class?.qboId) {
667
+ if (recommendedClass?.qboId === accountLine.class.qboId) {
668
668
  record.recommendedClass = undefined;
669
669
  }
670
670
  record.isClassUpdateSelected = false;
671
671
  if (accountLine.isClassMiscategorized &&
672
- Boolean(accountLine.class?.qboId)) {
672
+ Boolean(accountLine.class.qboId)) {
673
673
  record.retainedClass = recommendedClass;
674
674
  record.isRetainedClassSelected = false;
675
675
  }
@@ -685,7 +685,7 @@ export const setEntityRecommendationForLineIdInLocalData = (transaction, transac
685
685
  Boolean(recommendedAccount?.qboId) !== false) {
686
686
  record.account = recommendedAccount;
687
687
  }
688
- if (Boolean(record.class?.qboId) === false &&
688
+ if (Boolean(record.class.qboId) === false &&
689
689
  Boolean(recommendedClass?.qboId) !== false) {
690
690
  record.class = recommendedClass;
691
691
  }
@@ -806,9 +806,7 @@ export const getChangedLineItemCountFromLocalData = (transaction, transactionLoc
806
806
  accountLineLocal.account?.qboId !== accountLine.account.qboId &&
807
807
  accountLineLocal.account?.accountId !== accountLine.account.accountId;
808
808
  hasClassChanged =
809
- (accountLineLocal.class?.qboId != null ||
810
- accountLine.class?.qboId != null) &&
811
- accountLineLocal.class?.qboId !== accountLine.class?.qboId;
809
+ accountLineLocal.class?.qboId !== accountLine.class.qboId;
812
810
  }
813
811
  hasDescriptionChanged =
814
812
  transactionLocalData.lineItemById[lineId] != null
@@ -946,10 +944,10 @@ export const toUpdateLineItemsToOriginalVendor = (transaction, transactionDetail
946
944
  record.isRecommendedClassSelected = false;
947
945
  record.recommendedClass = recommendedClass;
948
946
  record.isClassUpdateSelected = false;
949
- if (recommendedClass?.qboId !== accountLine.class?.qboId &&
947
+ if (recommendedClass?.qboId !== accountLine.class.qboId &&
950
948
  Boolean(recommendedClass?.qboId)) {
951
949
  if (accountLine.isClassMiscategorized &&
952
- Boolean(accountLine.class?.qboId) &&
950
+ Boolean(accountLine.class.qboId) &&
953
951
  Boolean(isVendorOrCustomerPresent)) {
954
952
  record.retainedClass = accountLine.class;
955
953
  record.isRetainedClassSelected = false;
@@ -962,7 +960,7 @@ export const toUpdateLineItemsToOriginalVendor = (transaction, transactionDetail
962
960
  record.recommendedClass = recommendedClass;
963
961
  record.isClassUpdateSelected = false;
964
962
  if (accountLine.isClassMiscategorized &&
965
- Boolean(accountLine.class?.qboId) &&
963
+ Boolean(accountLine.class.qboId) &&
966
964
  Boolean(isVendorOrCustomerPresent)) {
967
965
  record.retainedClass = recommendedClass;
968
966
  record.isRetainedClassSelected = false;