@zeniai/client-epic-state 4.12.12 → 4.12.14

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 (43) hide show
  1. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +2 -0
  2. package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +5 -0
  3. package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.js +4 -2
  4. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +6 -2
  5. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +8 -2
  6. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  7. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  8. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  9. package/lib/epic.d.ts +2 -1
  10. package/lib/epic.js +2 -1
  11. package/lib/index.d.ts +6 -4
  12. package/lib/index.js +11 -5
  13. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
  14. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
  15. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
  16. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
  17. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  18. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  19. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  20. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  21. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  22. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  23. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +6 -0
  24. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +9 -0
  25. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +3 -0
  26. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +11 -1
  27. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +20 -2
  28. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +5 -0
  29. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +27 -2
  30. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +77 -4
  31. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +8 -0
  32. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +19 -2
  33. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionAttachmentsEpic.d.ts +10 -0
  34. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionAttachmentsEpic.js +42 -0
  35. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +3 -1
  36. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  37. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  38. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +31 -1
  39. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +32 -38
  40. package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +4 -1
  41. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -0
  42. package/lib/view/taskManager/taskListView/taskListReducer.js +19 -2
  43. package/package.json +1 -1
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getChargeCardDetailView = void 0;
6
+ exports.getChargeCardTransactionAttachmentView = exports.getChargeCardDetailView = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
9
9
  const addressSelector_1 = require("../../../../entity/address/addressSelector");
@@ -14,7 +14,7 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
14
14
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
15
15
  const chargeCardDetail_1 = require("./chargeCardDetail");
16
16
  const getChargeCardDetailView = (state, chargeCardId) => {
17
- var _a, _b, _c, _d, _e, _f;
17
+ var _a, _b, _c, _d, _e, _f, _g, _h;
18
18
  const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, twoFactorAuthenticationState, } = state;
19
19
  const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
20
20
  const loggedInUserPhone = (_e = (_c = twoFactorAuthenticationState.phone) !== null && _c !== void 0 ? _c : (_d = (0, userSelector_1.getUserByUserId)(userState, loggedInUserId)) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : '';
@@ -69,6 +69,8 @@ const getChargeCardDetailView = (state, chargeCardId) => {
69
69
  error: reducedFetchState.error,
70
70
  chargeCardConfig: chargeCardConfigState,
71
71
  transactions,
72
+ uploadReceiptsFetchStateByTransactionId: (_g = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.transactionList.uploadReceiptsFetchStateByTransactionId) !== null && _g !== void 0 ? _g : {},
73
+ uploadReceiptsShowTickByTransactionId: (_h = chargeCardDetail === null || chargeCardDetail === void 0 ? void 0 : chargeCardDetail.transactionList.uploadReceiptsShowTickByTransactionId) !== null && _h !== void 0 ? _h : {},
72
74
  uiState,
73
75
  transactionListFetchState,
74
76
  twoFAView: twoFactorAuthenticationState,
@@ -77,3 +79,18 @@ const getChargeCardDetailView = (state, chargeCardId) => {
77
79
  };
78
80
  };
79
81
  exports.getChargeCardDetailView = getChargeCardDetailView;
82
+ const getChargeCardTransactionAttachmentView = (state, cardId, transactionId) => {
83
+ const { chargeCardDetailState } = state;
84
+ const { transactionAttachmentsByTransactionId } = chargeCardDetailState.detailById[cardId].transactionList;
85
+ if (transactionAttachmentsByTransactionId[transactionId] == null) {
86
+ return undefined;
87
+ }
88
+ return {
89
+ attachmentFetchStatus: {
90
+ fetchState: transactionAttachmentsByTransactionId[transactionId].fetchState,
91
+ error: transactionAttachmentsByTransactionId[transactionId].error,
92
+ },
93
+ transactionAttachments: transactionAttachmentsByTransactionId[transactionId].attachments,
94
+ };
95
+ };
96
+ exports.getChargeCardTransactionAttachmentView = getChargeCardTransactionAttachmentView;
@@ -0,0 +1,10 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../reducer';
4
+ import { ZeniAPI } from '../../../../zeniAPI';
5
+ import { fetchChargeCardTransactionAttachments, updateChargeCardTransactionAttachmentsInCardDetail, updateChargeCardTransactionAttachmentsFailure } from './chargeCardDetailReducer';
6
+ export declare type ActionType = ReturnType<typeof fetchChargeCardTransactionAttachments> | ReturnType<typeof updateChargeCardTransactionAttachmentsInCardDetail> | ReturnType<typeof updateChargeCardTransactionAttachmentsFailure>;
7
+ export declare const fetchChargeCardTransactionAttachmentsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
8
+ export interface ChargeCardTransactionAttachmentQueryPayload {
9
+ attachment_ids: string[];
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchChargeCardTransactionAttachmentsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
8
+ const fetchChargeCardTransactionAttachmentsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.fetchChargeCardTransactionAttachments.match), (0, operators_1.switchMap)((action) => {
9
+ const { transactionId, cardId, attachmentIds } = action.payload;
10
+ let apiUrl = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/transactions/${transactionId}/attachments`;
11
+ const queryParam = {
12
+ attachment_ids: attachmentIds,
13
+ };
14
+ apiUrl =
15
+ apiUrl + `?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
16
+ return zeniAPI
17
+ .getJSON(apiUrl)
18
+ .pipe((0, operators_1.mergeMap)((response) => {
19
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
20
+ return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardTransactionAttachmentsInCardDetail)({
21
+ transactionId,
22
+ cardId,
23
+ transactionAttachments: response.data.attachments,
24
+ }));
25
+ }
26
+ else {
27
+ return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardTransactionAttachmentsFailure)({
28
+ cardId,
29
+ transactionId,
30
+ status: response.status,
31
+ }));
32
+ }
33
+ }), (0, operators_1.catchError)((error) => {
34
+ return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardTransactionAttachmentsFailure)({
35
+ cardId,
36
+ transactionId,
37
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch charge card transaction attachments API call errored out' +
38
+ JSON.stringify(error)),
39
+ }));
40
+ }));
41
+ }));
42
+ exports.fetchChargeCardTransactionAttachmentsEpic = fetchChargeCardTransactionAttachmentsEpic;
@@ -15,7 +15,9 @@ const fetchChargeCardTransactionListEpic = (actions$, state$, zeniAPI) => action
15
15
  const queryParam = {
16
16
  page_token: pageToken,
17
17
  page_token_type: pageTokenType,
18
- sort_by: uiState.sortBy,
18
+ sort_by: uiState.sortKey === 'paymentDate'
19
+ ? 'transaction_date'
20
+ : uiState.sortKey,
19
21
  sort_order: (0, sortOrderPayload_1.getSortOrder)(uiState.sortOrder),
20
22
  };
21
23
  return zeniAPI
@@ -8,7 +8,7 @@ import { updateCreatedTagToLocalStore } from '../../taskManager/taskDetailView/t
8
8
  export declare type ActionType = ReturnType<typeof createTag> | ReturnType<typeof updateTagCreateStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCreatedTagToLocalStore> | ReturnType<typeof updateTags>;
9
9
  export declare const createTagEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
10
  payload: {
11
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
11
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
12
12
  messageText: "failed" | "success" | "notification";
13
13
  type: import("../../..").SnackbarMessageType;
14
14
  showStatusIcon?: boolean | undefined;
@@ -9,7 +9,7 @@ export declare const deleteTagEpic: (actions$: ActionsObservable<ActionType>, _s
9
9
  type: string;
10
10
  } | {
11
11
  payload: {
12
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
12
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
13
13
  messageText: "failed" | "success" | "notification";
14
14
  type: import("../../..").SnackbarMessageType;
15
15
  showStatusIcon?: boolean | undefined;
@@ -6,4 +6,34 @@ import { updateTasks } from '../../../../entity/task/taskReducer';
6
6
  import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
7
7
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
8
8
  export declare type ActionType = ReturnType<typeof saveTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof saveTaskSuccessOrFailure>;
9
- export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
9
+ export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
+ payload: {
11
+ task: import("../../../../entity/task/taskPayload").TaskPayload;
12
+ taskGroupId: string;
13
+ currentTaskState?: import("../../../..").Task | undefined;
14
+ };
15
+ type: string;
16
+ } | {
17
+ payload: {
18
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated";
19
+ messageText: "failed" | "success" | "notification";
20
+ type: import("../../../..").SnackbarMessageType;
21
+ showStatusIcon?: boolean | undefined;
22
+ variables?: {
23
+ variableName: string;
24
+ variableValue: string;
25
+ }[] | undefined;
26
+ };
27
+ type: string;
28
+ } | {
29
+ payload: {
30
+ fetchState: import("../../../../commonStateTypes/common").FetchState;
31
+ newTaskId?: string | undefined;
32
+ taskId?: string | undefined;
33
+ error?: import("../../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
34
+ };
35
+ type: string;
36
+ } | {
37
+ payload: import("../../../../entity/task/taskPayload").TaskPayload[];
38
+ type: string;
39
+ }>;
@@ -11,56 +11,50 @@ const taskSelector_1 = require("../../../../entity/task/taskSelector");
11
11
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
12
12
  const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
13
13
  const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.saveTaskDetail.match), (0, operators_1.mergeMap)((action) => {
14
+ var _a;
14
15
  const { taskId, taskGroupId } = action.payload;
15
16
  const state = state$.value;
16
- const payload = prepareTaskPayload(state, taskId, taskGroupId);
17
+ const updatedTaskGroupId = taskId == null
18
+ ? taskGroupId
19
+ : (_a = (0, taskSelector_1.getTaskById)(state.taskState, taskId)) === null || _a === void 0 ? void 0 : _a.taskGroupIds[0];
20
+ const payload = prepareTaskPayload(state, taskId, updatedTaskGroupId);
17
21
  const saveTaskApi = taskId != null
18
22
  ? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
19
23
  : zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload);
20
24
  return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
21
- var _a;
22
25
  if ((0, responsePayload_1.isSuccessResponse)(response) &&
23
26
  response.data != null &&
27
+ updatedTaskGroupId != null &&
24
28
  response.data.tasks.length > 0) {
25
29
  const newTaskId = response.data.tasks[0].task_id;
26
- const newTaskGroupId = taskGroupId != null
27
- ? taskGroupId
28
- : (_a = response.data.tasks[0].task_group_ids) === null || _a === void 0 ? void 0 : _a[0];
29
- const fetchActions = [
30
- (0, taskReducer_1.updateTasks)(response.data.tasks),
31
- (0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
32
- fetchState: 'Completed',
33
- newTaskId,
34
- taskId,
35
- }),
36
- ];
37
- if (newTaskGroupId != null) {
38
- fetchActions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
39
- taskGroupId: newTaskGroupId,
40
- task: response.data.tasks[0],
41
- }));
42
- }
43
- return (0, rxjs_1.from)(fetchActions);
30
+ return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(response.data.tasks), (0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
31
+ fetchState: 'Completed',
32
+ newTaskId,
33
+ taskId,
34
+ }), (0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
35
+ taskGroupId: updatedTaskGroupId,
36
+ task: response.data.tasks[0],
37
+ currentTaskState: taskId != null
38
+ ? (0, taskSelector_1.getTaskById)(state.taskState, taskId)
39
+ : undefined,
40
+ }));
44
41
  }
45
42
  else {
46
- return (0, rxjs_1.from)([
47
- (0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
48
- fetchState: 'Error',
49
- taskId,
50
- error: response.status,
51
- }),
52
- (0, snackbarReducer_1.openSnackbar)({
53
- messageSection: 'save_task_detail',
54
- messageText: 'failed',
55
- type: 'error',
56
- variables: [
57
- {
58
- variableName: '_api-error_',
59
- variableValue: response.status.message,
60
- },
61
- ],
62
- }),
63
- ]);
43
+ return (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
44
+ fetchState: 'Error',
45
+ taskId,
46
+ error: response.status,
47
+ }), (0, snackbarReducer_1.openSnackbar)({
48
+ messageSection: 'save_task_detail',
49
+ messageText: 'failed',
50
+ type: 'error',
51
+ variables: [
52
+ {
53
+ variableName: '_api-error_',
54
+ variableValue: response.status.message,
55
+ },
56
+ ],
57
+ }));
64
58
  }
65
59
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
66
60
  fetchState: 'Error',
@@ -20,7 +20,10 @@ const fetchTaskListPageEpic = (actions$, state$) => actions$.pipe((0, operators_
20
20
  taskListPageActions.push((0, taskGroupViewReducer_1.fetchAllTaskGroups)());
21
21
  }
22
22
  else {
23
- taskListPageActions.push((0, taskListReducer_1.fetchTaskList)());
23
+ if (state.taskListState.fetchState !== 'In-Progress' &&
24
+ state.taskListState.hasValidState() === false) {
25
+ taskListPageActions.push((0, taskListReducer_1.fetchTaskList)());
26
+ }
24
27
  if (state.classListState.hasValidState() === false &&
25
28
  state.classListState.fetchState !== 'In-Progress') {
26
29
  taskListPageActions.push((0, classListReducer_1.fetchClassList)());
@@ -43,6 +43,7 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
43
43
  }, string, never, never>, updateTaskListOnNewTaskCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
44
44
  task: TaskPayload;
45
45
  taskGroupId: ID;
46
+ currentTaskState?: Task | undefined;
46
47
  }, string>, updateTaskListOnTaskGroupNameUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
47
48
  taskGroupName: ID;
48
49
  taskGroupId: ID;
@@ -280,9 +280,26 @@ const taskList = (0, toolkit_1.createSlice)({
280
280
  delete draft.localData.existingTaskGroupNamesByGroupId[taskGroupId];
281
281
  },
282
282
  updateTaskListOnNewTaskCreationSuccess(draft, action) {
283
- const { task, taskGroupId } = action.payload;
283
+ const { task, taskGroupId, currentTaskState } = action.payload;
284
284
  const taskId = task.task_id;
285
- draft.taskIds.push(taskId);
285
+ if (currentTaskState == null) {
286
+ draft.taskIds.push(taskId);
287
+ }
288
+ else {
289
+ const priorityKey = (0, taskState_1.toPriorityCodeType)(currentTaskState.priority.code);
290
+ const statusKey = (0, taskState_1.toTaskStatusCodeType)(currentTaskState.status.code);
291
+ const assigneeKey = getAssigneesGroupKey(currentTaskState.assignees);
292
+ const tagsKey = currentTaskState.tagIds.join();
293
+ const dueDateKey = currentTaskState.dueDate != null
294
+ ? getDueDateGroupKey(currentTaskState.dueDate.toString())
295
+ : 'upcoming';
296
+ draft.taskIdsByPriority[priorityKey].filter((taskId) => taskId !== currentTaskState.id);
297
+ draft.taskIdsByStatus[statusKey].filter((taskId) => taskId !== currentTaskState.id);
298
+ draft.taskIdsByAssignees[assigneeKey].filter((taskId) => taskId !== currentTaskState.id);
299
+ draft.taskIdsByTags[tagsKey].filter((taskId) => taskId !== currentTaskState.id);
300
+ draft.taskIdsByDueDate[dueDateKey].filter((taskId) => taskId !== currentTaskState.id);
301
+ draft.taskIdsByGroupsIds[taskGroupId].filter((taskId) => taskId !== currentTaskState.id);
302
+ }
286
303
  const priorityKey = (0, taskState_1.toPriorityCodeType)(task.priority.code);
287
304
  const statusKey = (0, taskState_1.toTaskStatusCodeType)(task.status.code);
288
305
  const assigneeKey = getAssigneesGroupKey(task.assignees);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.12.12",
3
+ "version": "4.12.14",
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
  "types": "lib/index.d.ts",