@zeniai/client-epic-state 5.2.58-beta0ND → 5.2.58-betaNB1
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.
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/reconciliationReport/reconciliationReportPayload.d.ts +123 -0
- package/lib/entity/reconciliationReport/reconciliationReportPayload.js +2 -0
- package/lib/entity/reconciliationReport/reconciliationReportReducer.d.ts +7 -0
- package/lib/entity/reconciliationReport/reconciliationReportReducer.js +172 -0
- package/lib/entity/reconciliationReport/reconciliationReportSelector.d.ts +3 -0
- package/lib/entity/reconciliationReport/reconciliationReportSelector.js +10 -0
- package/lib/entity/reconciliationReport/reconciliationReportState.d.ts +132 -0
- package/lib/entity/reconciliationReport/reconciliationReportState.js +15 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +2 -0
- package/lib/esm/entity/reconciliationReport/reconciliationReportPayload.js +1 -0
- package/lib/esm/entity/reconciliationReport/reconciliationReportReducer.js +167 -0
- package/lib/esm/entity/reconciliationReport/reconciliationReportSelector.js +4 -0
- package/lib/esm/entity/reconciliationReport/reconciliationReportState.js +10 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/epic.js +2 -0
- package/lib/esm/index.js +4 -2
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/recommendation/recommendationReducer.js +8 -26
- package/lib/esm/view/recommendation/recommendationSelector.js +1 -2
- package/lib/esm/view/recommendation/recommendationState.js +0 -1
- package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +9 -16
- package/lib/esm/view/reconciliationReportView/epic/fetchReconciliationReportEpic.js +29 -0
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewPayload.js +1 -0
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewReducer.js +44 -0
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewSelector.js +10 -0
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewState.js +1 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.js +38 -36
- package/lib/reducer.d.ts +2 -0
- package/lib/reducer.js +6 -0
- package/lib/rootStateTypes.d.ts +4 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/recommendation/recommendationReducer.d.ts +2 -10
- package/lib/view/recommendation/recommendationReducer.js +8 -26
- package/lib/view/recommendation/recommendationSelector.d.ts +0 -2
- package/lib/view/recommendation/recommendationSelector.js +1 -3
- package/lib/view/recommendation/recommendationState.d.ts +1 -4
- package/lib/view/recommendation/recommendationState.js +1 -3
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +2 -2
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +7 -14
- package/lib/view/reconciliationReportView/epic/fetchReconciliationReportEpic.d.ts +19 -0
- package/lib/view/reconciliationReportView/epic/fetchReconciliationReportEpic.js +33 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewPayload.d.ts +3 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewPayload.js +2 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewReducer.d.ts +13 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewReducer.js +48 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewSelector.d.ts +9 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewSelector.js +13 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewState.d.ts +4 -0
- package/lib/view/reconciliationReportView/reconciliationReportViewState.js +2 -0
- package/package.json +1 -1
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
|
|
|
39
39
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
40
40
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
41
41
|
export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
|
|
42
|
-
messageSection: "common" | "
|
|
42
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "actual_matching_match_and_reverse" | "actual_matching_undo_reversal" | "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_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_approval_reorder" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "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_approval_reorder" | "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" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "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_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "revert_schedule" | "ignore_accrual" | "revert_accrual" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "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" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "confirm_statement_mapping" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update" | "qbo_realm_id_update" | "invoicing_dunning_case_resolved" | "invoicing_dunning_retry" | "invoicing_dunning_cancel" | "invoicing_dunning_settings_save" | "invoicing_qbo_backfill" | "invoicing_qbo_sync_health_retry" | "invoicing_qbo_settings_save" | "invoicing_branding_save" | "invoicing_discount_archive" | "invoicing_discount_unarchive" | "invoicing_discount_delete" | "invoicing_invoice_reminder_sent" | "invoicing_invoice_regenerated" | "invoicing_invoice_voided" | "invoicing_catalog_item_saved" | "invoicing_customer_saved" | "invoicing_subscription_saved" | "invoicing_coupon_saved" | "invoicing_invoice_saved" | "invoicing_credit_note_saved" | "invoicing_payment_recorded" | "invoicing_subscription_activated" | "invoicing_subscription_cancellation_removed" | "invoicing_subscription_cancelled" | "invoicing_subscription_non_renewing" | "invoicing_subscription_paused" | "invoicing_subscription_reactivated" | "invoicing_subscription_resumed" | "invoicing_subscription_term_end_changed";
|
|
43
43
|
messageText: "notification" | "failed" | "success";
|
|
44
44
|
type: "error" | "success" | "info";
|
|
45
45
|
variables: {
|
|
@@ -6,7 +6,7 @@ import { SupportedTransaction } from '../../entity/transaction/transactionState'
|
|
|
6
6
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
7
7
|
import { TransactionsTab } from '../expenseAutomationView/types/transactionsViewState';
|
|
8
8
|
import { SubmitRecommendationFeedbackPayload } from './recommendationPayload';
|
|
9
|
-
import { EntityRecommendationState
|
|
9
|
+
import { EntityRecommendationState } from './recommendationState';
|
|
10
10
|
export type RecommendationLineUpdateFlowType = 'categorization' | 'detail';
|
|
11
11
|
type FetchEntityRecommendationsForLineUpdateCommonPayload = {
|
|
12
12
|
amount: number;
|
|
@@ -58,14 +58,6 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
|
|
|
58
58
|
}, "recommendation/updateRecommendationForEntityFailure">, indicateReadyToInitializeRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityIdOrName: string, entityType: EntityType], {
|
|
59
59
|
entityIdOrName: string;
|
|
60
60
|
entityType: EntityType;
|
|
61
|
-
}, "recommendation/indicateReadyToInitializeRecommendation", never, never>, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never
|
|
62
|
-
key: RecommendationFeedbackKey;
|
|
63
|
-
succeeded: boolean;
|
|
64
|
-
error?: ZeniAPIStatus;
|
|
65
|
-
}], {
|
|
66
|
-
key: RecommendationFeedbackKey;
|
|
67
|
-
succeeded: boolean;
|
|
68
|
-
error?: ZeniAPIStatus;
|
|
69
|
-
}, "recommendation/submitRecommendationFeedbackCompleted", never, never>;
|
|
61
|
+
}, "recommendation/indicateReadyToInitializeRecommendation", never, never>, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never>;
|
|
70
62
|
declare const _default: import("redux").Reducer<EntityRecommendationState>;
|
|
71
63
|
export default _default;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.submitRecommendationFeedback = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../rootActions");
|
|
7
7
|
const recommendationState_1 = require("./recommendationState");
|
|
8
8
|
exports.initialState = {
|
|
9
|
-
feedbackSubmitStateByKey: {},
|
|
10
9
|
recommendationByEntity: {},
|
|
11
10
|
};
|
|
12
11
|
const recommendation = (0, toolkit_1.createSlice)({
|
|
@@ -136,30 +135,13 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
136
135
|
};
|
|
137
136
|
},
|
|
138
137
|
},
|
|
139
|
-
//
|
|
140
|
-
// override). Handled by submitRecommendationFeedbackEpic
|
|
141
|
-
// accounting recommendation-feedback endpoint.
|
|
142
|
-
//
|
|
138
|
+
// Fire-and-forget human feedback on a recommendation (accept, ranked
|
|
139
|
+
// override or outside override). Handled by submitRecommendationFeedbackEpic
|
|
140
|
+
// which POSTs to the accounting recommendation-feedback endpoint. No state
|
|
141
|
+
// mutation: the categorization UX must not depend on the feedback round-trip.
|
|
143
142
|
submitRecommendationFeedback: {
|
|
144
|
-
reducer(
|
|
145
|
-
|
|
146
|
-
const key = (0, recommendationState_1.getRecommendationFeedbackKey)(transactionId, lineId, dimension);
|
|
147
|
-
draft.feedbackSubmitStateByKey[key] = {
|
|
148
|
-
fetchState: 'In-Progress',
|
|
149
|
-
error: undefined,
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
prepare(args) {
|
|
153
|
-
return { payload: args };
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
submitRecommendationFeedbackCompleted: {
|
|
157
|
-
reducer(draft, action) {
|
|
158
|
-
const { key, succeeded, error } = action.payload;
|
|
159
|
-
draft.feedbackSubmitStateByKey[key] = {
|
|
160
|
-
fetchState: succeeded ? 'Completed' : 'Error',
|
|
161
|
-
error,
|
|
162
|
-
};
|
|
143
|
+
reducer() {
|
|
144
|
+
// Fire-and-forget: no state mutation; the epic performs the POST.
|
|
163
145
|
},
|
|
164
146
|
prepare(args) {
|
|
165
147
|
return { payload: args };
|
|
@@ -172,7 +154,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
172
154
|
});
|
|
173
155
|
},
|
|
174
156
|
});
|
|
175
|
-
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback
|
|
157
|
+
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback;
|
|
176
158
|
exports.default = recommendation.reducer;
|
|
177
159
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
178
160
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
1
|
import { Recommendation } from '../../commonStateTypes/recommendationBase';
|
|
3
2
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
3
|
import { EntityType } from '../../entity/genericEntity/entity';
|
|
@@ -9,4 +8,3 @@ export interface RecommendationByEntitySelectorView extends SelectorView {
|
|
|
9
8
|
recommendations?: Recommendation[];
|
|
10
9
|
}
|
|
11
10
|
export declare const getRecommendationsForEntity: (state: RootState, entityId: string, entityType: EntityType) => RecommendationByEntitySelectorView;
|
|
12
|
-
export declare const getRecommendationFeedbackSubmitState: (state: RootState, transactionId: string, lineId: string | null | undefined, dimension: string) => FetchStateAndError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRecommendationsForEntity = void 0;
|
|
4
4
|
const recommendationState_1 = require("./recommendationState");
|
|
5
5
|
const getRecommendationsForEntity = (state, entityId, entityType) => {
|
|
6
6
|
const { entityRecommendationState } = state;
|
|
@@ -15,5 +15,3 @@ const getRecommendationsForEntity = (state, entityId, entityType) => {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
exports.getRecommendationsForEntity = getRecommendationsForEntity;
|
|
18
|
-
const getRecommendationFeedbackSubmitState = (state, transactionId, lineId, dimension) => state.entityRecommendationState.feedbackSubmitStateByKey[(0, recommendationState_1.getRecommendationFeedbackKey)(transactionId, lineId, dimension)] ?? { fetchState: 'Not-Started', error: undefined };
|
|
19
|
-
exports.getRecommendationFeedbackSubmitState = getRecommendationFeedbackSubmitState;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FetchedState } from '../../commonStateTypes/common';
|
|
2
2
|
import { Recommendation } from '../../commonStateTypes/recommendationBase';
|
|
3
3
|
import { EntityType } from '../../entity/genericEntity/entity';
|
|
4
4
|
export declare const getEntityRecommendationKey: (entityType: EntityType, entityIdOrName: string) => `vendor_${string}` | `customer_${string}` | `merchant_${string}`;
|
|
5
5
|
export type EntityRecommendationKey = ReturnType<typeof getEntityRecommendationKey>;
|
|
6
|
-
export declare const getRecommendationFeedbackKey: (transactionId: string, lineId: string | null | undefined, dimension: string) => `${string}|${string}|${string}`;
|
|
7
|
-
export type RecommendationFeedbackKey = ReturnType<typeof getRecommendationFeedbackKey>;
|
|
8
6
|
export interface EntityRecommendationsStatus extends FetchedState {
|
|
9
7
|
recommendations?: Recommendation[];
|
|
10
8
|
}
|
|
11
9
|
export declare const initialEntityRecommendationState: EntityRecommendationsStatus;
|
|
12
10
|
export interface EntityRecommendationState {
|
|
13
|
-
feedbackSubmitStateByKey: Record<RecommendationFeedbackKey, FetchStateAndError>;
|
|
14
11
|
recommendationByEntity: Record<EntityRecommendationKey, EntityRecommendationsStatus>;
|
|
15
12
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialEntityRecommendationState = exports.
|
|
3
|
+
exports.initialEntityRecommendationState = exports.getEntityRecommendationKey = void 0;
|
|
4
4
|
const getEntityRecommendationKey = (entityType, entityIdOrName) => `${entityType}_${entityIdOrName}`;
|
|
5
5
|
exports.getEntityRecommendationKey = getEntityRecommendationKey;
|
|
6
|
-
const getRecommendationFeedbackKey = (transactionId, lineId, dimension) => `${transactionId}|${lineId ?? ''}|${dimension}`;
|
|
7
|
-
exports.getRecommendationFeedbackKey = getRecommendationFeedbackKey;
|
|
8
6
|
exports.initialEntityRecommendationState = {
|
|
9
7
|
fetchState: 'Not-Started',
|
|
10
8
|
error: undefined,
|
|
@@ -2,6 +2,6 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../reducer';
|
|
4
4
|
import { ZeniAPI } from '../../zeniAPI';
|
|
5
|
-
import { submitRecommendationFeedback
|
|
6
|
-
export type ActionType = ReturnType<typeof submitRecommendationFeedback
|
|
5
|
+
import { submitRecommendationFeedback } from './recommendationReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof submitRecommendationFeedback>;
|
|
7
7
|
export declare const submitRecommendationFeedbackEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -5,7 +5,6 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
7
7
|
const recommendationReducer_1 = require("./recommendationReducer");
|
|
8
|
-
const recommendationState_1 = require("./recommendationState");
|
|
9
8
|
const toRequestBody = (payload) => ({
|
|
10
9
|
line_id: payload.lineId ?? null,
|
|
11
10
|
dimension: payload.dimension,
|
|
@@ -37,27 +36,21 @@ const toRequestBody = (payload) => ({
|
|
|
37
36
|
retracts_feedback_id: payload.retractsFeedbackId ?? null,
|
|
38
37
|
features: payload.features ?? null,
|
|
39
38
|
});
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
39
|
+
// Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
|
|
40
|
+
// side-effect that must not disrupt the categorization UX, so both the
|
|
41
|
+
// success and error paths complete silently (errors are logged for debugging).
|
|
43
42
|
const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.submitRecommendationFeedback.match), (0, operators_1.mergeMap)((action) => {
|
|
44
|
-
const { transactionId
|
|
45
|
-
const key = (0, recommendationState_1.getRecommendationFeedbackKey)(transactionId, lineId, dimension);
|
|
43
|
+
const { transactionId } = action.payload;
|
|
46
44
|
return zeniAPI
|
|
47
45
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
|
|
48
46
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
49
|
-
|
|
50
|
-
if (!succeeded) {
|
|
47
|
+
if (!(0, responsePayload_1.isSuccessStatus)(response)) {
|
|
51
48
|
console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
|
|
52
49
|
}
|
|
53
|
-
return
|
|
54
|
-
key,
|
|
55
|
-
succeeded,
|
|
56
|
-
error: succeeded ? undefined : response.status,
|
|
57
|
-
}));
|
|
50
|
+
return rxjs_1.EMPTY;
|
|
58
51
|
}), (0, operators_1.catchError)((error) => {
|
|
59
52
|
console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
|
|
60
|
-
return
|
|
53
|
+
return rxjs_1.EMPTY;
|
|
61
54
|
}));
|
|
62
55
|
}));
|
|
63
56
|
exports.submitRecommendationFeedbackEpic = submitRecommendationFeedbackEpic;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { updateReconciliationReport } from '../../../entity/reconciliationReport/reconciliationReportReducer';
|
|
3
|
+
import { RootState } from '../../../rootStateTypes';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { fetchReconciliationReport, fetchReconciliationReportFailure, fetchReconciliationReportSuccess } from '../reconciliationReportViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchReconciliationReport> | ReturnType<typeof updateReconciliationReport> | ReturnType<typeof fetchReconciliationReportSuccess> | ReturnType<typeof fetchReconciliationReportFailure>;
|
|
7
|
+
export declare const fetchReconciliationReportEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
|
+
payload: import("../../../entity/reconciliationReport/reconciliationReportPayload").ReconciliationReportPayload;
|
|
9
|
+
type: "reconciliationReport/updateReconciliationReport";
|
|
10
|
+
} | {
|
|
11
|
+
payload: string;
|
|
12
|
+
type: "reconciliationReportView/fetchReconciliationReportSuccess";
|
|
13
|
+
} | {
|
|
14
|
+
payload: {
|
|
15
|
+
reconciliationId: import("../../..").ID;
|
|
16
|
+
status: import("../../../zeniAPIStatus").ZeniAPIStatus;
|
|
17
|
+
};
|
|
18
|
+
type: "reconciliationReportView/fetchReconciliationReportFailure";
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchReconciliationReportEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const reconciliationReportReducer_1 = require("../../../entity/reconciliationReport/reconciliationReportReducer");
|
|
7
|
+
const reconciliationReportSelector_1 = require("../../../entity/reconciliationReport/reconciliationReportSelector");
|
|
8
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
9
|
+
const reconciliationReportViewReducer_1 = require("../reconciliationReportViewReducer");
|
|
10
|
+
const fetchReconciliationReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationReportViewReducer_1.fetchReconciliationReport.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const { reconciliationId, cacheOverride } = action.payload;
|
|
12
|
+
const cachedReport = (0, reconciliationReportSelector_1.getReconciliationReportByReconciliationId)(state$.value.reconciliationReportState, reconciliationId);
|
|
13
|
+
if (cacheOverride === true || cachedReport == null) {
|
|
14
|
+
return zeniAPI
|
|
15
|
+
.getJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/reconciliation/${reconciliationId}/report`)
|
|
16
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) === true &&
|
|
18
|
+
response.data != null) {
|
|
19
|
+
return (0, rxjs_1.of)((0, reconciliationReportReducer_1.updateReconciliationReport)(response.data), (0, reconciliationReportViewReducer_1.fetchReconciliationReportSuccess)(reconciliationId));
|
|
20
|
+
}
|
|
21
|
+
return (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportFailure)({
|
|
22
|
+
reconciliationId,
|
|
23
|
+
status: response.status,
|
|
24
|
+
}));
|
|
25
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportFailure)({
|
|
26
|
+
reconciliationId,
|
|
27
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Reconciliation Report REST API call errored out' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
}))));
|
|
30
|
+
}
|
|
31
|
+
return (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportSuccess)(reconciliationId));
|
|
32
|
+
}));
|
|
33
|
+
exports.fetchReconciliationReportEpic = fetchReconciliationReportEpic;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
+
import { ReconciliationReportViewState } from './reconciliationReportViewState';
|
|
4
|
+
export declare const initialState: ReconciliationReportViewState;
|
|
5
|
+
export declare const fetchReconciliationReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reconciliationId: string, cacheOverride?: any], {
|
|
6
|
+
reconciliationId: string;
|
|
7
|
+
cacheOverride: any;
|
|
8
|
+
}, "reconciliationReportView/fetchReconciliationReport", never, never>, fetchReconciliationReportSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "reconciliationReportView/fetchReconciliationReportSuccess">, fetchReconciliationReportFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
reconciliationId: ID;
|
|
10
|
+
status: ZeniAPIStatus;
|
|
11
|
+
}, "reconciliationReportView/fetchReconciliationReportFailure">;
|
|
12
|
+
declare const _default: import("redux").Reducer<ReconciliationReportViewState>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.fetchReconciliationReportFailure = exports.fetchReconciliationReportSuccess = exports.fetchReconciliationReport = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const rootActions_1 = require("../../rootActions");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
fetchReconciliationReportState: {},
|
|
9
|
+
};
|
|
10
|
+
const reconciliationReportView = (0, toolkit_1.createSlice)({
|
|
11
|
+
name: 'reconciliationReportView',
|
|
12
|
+
initialState: exports.initialState,
|
|
13
|
+
reducers: {
|
|
14
|
+
fetchReconciliationReport: {
|
|
15
|
+
prepare(reconciliationId, cacheOverride = false) {
|
|
16
|
+
return { payload: { reconciliationId, cacheOverride } };
|
|
17
|
+
},
|
|
18
|
+
reducer(draft, action) {
|
|
19
|
+
const { reconciliationId } = action.payload;
|
|
20
|
+
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
21
|
+
fetchState: 'In-Progress',
|
|
22
|
+
error: undefined,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
fetchReconciliationReportSuccess(draft, action) {
|
|
27
|
+
const reconciliationId = action.payload;
|
|
28
|
+
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
29
|
+
fetchState: 'Completed',
|
|
30
|
+
error: undefined,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
fetchReconciliationReportFailure(draft, action) {
|
|
34
|
+
const { reconciliationId, status } = action.payload;
|
|
35
|
+
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
36
|
+
fetchState: 'Error',
|
|
37
|
+
error: status,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
extraReducers: (builder) => {
|
|
42
|
+
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
43
|
+
Object.assign(draft, exports.initialState);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
_a = reconciliationReportView.actions, exports.fetchReconciliationReport = _a.fetchReconciliationReport, exports.fetchReconciliationReportSuccess = _a.fetchReconciliationReportSuccess, exports.fetchReconciliationReportFailure = _a.fetchReconciliationReportFailure;
|
|
48
|
+
exports.default = reconciliationReportView.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ReconciliationReport } from '../../entity/reconciliationReport/reconciliationReportState';
|
|
3
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
+
import { RootState } from '../../rootStateTypes';
|
|
5
|
+
export declare function getReconciliationReport(state: RootState, reconciliationId: ID): {
|
|
6
|
+
fetchState: FetchState;
|
|
7
|
+
fetchError?: ZeniAPIStatus;
|
|
8
|
+
report?: ReconciliationReport;
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReconciliationReport = getReconciliationReport;
|
|
4
|
+
const reconciliationReportSelector_1 = require("../../entity/reconciliationReport/reconciliationReportSelector");
|
|
5
|
+
function getReconciliationReport(state, reconciliationId) {
|
|
6
|
+
const fetchReconciliationReportState = state.reconciliationReportViewState.fetchReconciliationReportState[reconciliationId];
|
|
7
|
+
const report = (0, reconciliationReportSelector_1.getReconciliationReportByReconciliationId)(state.reconciliationReportState, reconciliationId);
|
|
8
|
+
return {
|
|
9
|
+
fetchState: fetchReconciliationReportState?.fetchState ?? 'Not-Started',
|
|
10
|
+
fetchError: fetchReconciliationReportState?.error,
|
|
11
|
+
report,
|
|
12
|
+
};
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.58-
|
|
3
|
+
"version": "5.2.58-betaNB1",
|
|
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",
|