@zeniai/client-epic-state 4.12.21 → 4.12.22
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/chargeCardTransaction/chargeCardTransaction.d.ts +2 -0
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +5 -0
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.js +4 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +6 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +8 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskState.d.ts +0 -3
- package/lib/entity/task/taskState.js +0 -13
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/epic.d.ts +4 -1
- package/lib/epic.js +4 -1
- package/lib/index.d.ts +18 -16
- package/lib/index.js +17 -5
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
- package/lib/view/globalMerchantView/epics/fetchGlobalMerchantRecommendationEpic.d.ts +3 -3
- package/lib/view/globalMerchantView/epics/fetchGlobalMerchantRecommendationEpic.js +20 -4
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +5 -2
- package/lib/view/globalMerchantView/globalMerchantViewReducer.js +8 -3
- package/lib/view/globalMerchantView/globalMerchantViewSelector.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewSelector.js +6 -5
- package/lib/view/globalMerchantView/globalMerchantViewState.d.ts +1 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +4 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigReducer.js +9 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +4 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +82 -29
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +6 -0
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +9 -0
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +11 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +20 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +5 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +27 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +77 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +19 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionAttachmentsEpic.d.ts +10 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionAttachmentsEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +3 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.js +4 -2
- package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/taskDetail.js +1 -1
- package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.d.ts +23 -0
- package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.js +3 -2
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +5 -0
- package/lib/view/taskManager/taskListView/taskListReducer.js +64 -3
- package/lib/view/taskManager/taskListView/updateTaskFromListViewEpic.d.ts +8 -0
- package/lib/view/taskManager/taskListView/updateTaskFromListViewEpic.js +38 -0
- package/lib/view/vendorReviewView/common/state/commonTypes.d.ts +2 -1
- package/lib/view/vendorReviewView/common/state/commonTypes.js +4 -4
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorDetailsViewEpic.d.ts +8 -0
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorDetailsViewEpic.js +62 -0
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +7 -1
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.js +11 -1
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +14 -4
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +58 -49
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.d.ts +10 -0
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.js +21 -1
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.d.ts +20 -2
- package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js +4 -4
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewPayload.d.ts +1 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewPayload.js +2 -2
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewReducer.d.ts +6 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewReducer.js +18 -6
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewSelector.d.ts +3 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewSelector.js +7 -5
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +9 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveVendorDetailsViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const vendorFirstReviewViewReducer_1 = require("../vendorFirstReviewViewReducer");
|
|
8
|
+
const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
10
|
+
const vendorFirstReviewViewPayload_1 = require("../vendorFirstReviewViewPayload");
|
|
11
|
+
const saveVendorDetailsViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorFirstReviewViewReducer_1.saveVendorDetailsView.match), (0, operators_1.mergeMap)(() => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const { vendorFirstReviewViewState } = state$.value;
|
|
14
|
+
const vendorDetails = (_a = vendorFirstReviewViewState.vendorLocalData) === null || _a === void 0 ? void 0 : _a.vendorDetails;
|
|
15
|
+
const payload = (0, vendorFirstReviewViewPayload_1.prepareVendorPayload)(vendorDetails);
|
|
16
|
+
const vendorId = (_b = vendorFirstReviewViewState.vendorLocalData) === null || _b === void 0 ? void 0 : _b.vendorDetails.id;
|
|
17
|
+
if (vendorId != null) {
|
|
18
|
+
const saveVendorApi = zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors/${vendorId}`, payload);
|
|
19
|
+
return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
21
|
+
const actions = [
|
|
22
|
+
(0, vendorReducer_1.updateVendors)(response.data.vendors),
|
|
23
|
+
];
|
|
24
|
+
actions.push((0, vendorFirstReviewViewReducer_1.updateVendorDetailsViewFailureOrSuccess)({
|
|
25
|
+
vendorId,
|
|
26
|
+
fetchState: 'Completed',
|
|
27
|
+
}));
|
|
28
|
+
return (0, rxjs_1.from)(actions);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const actions = [];
|
|
32
|
+
// Note: We need to skip snackbar when error code is 409, which is Vendor already exists error code.
|
|
33
|
+
// We show inline error message in this case instead of snackbar
|
|
34
|
+
if (response.status.code !== 409) {
|
|
35
|
+
actions.push((0, vendorFirstReviewViewReducer_1.updateVendorDetailsViewFailureOrSuccess)({
|
|
36
|
+
vendorId,
|
|
37
|
+
fetchState: 'Error',
|
|
38
|
+
}));
|
|
39
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
40
|
+
messageSection: 'update_vendor',
|
|
41
|
+
messageText: 'failed',
|
|
42
|
+
type: 'error',
|
|
43
|
+
variables: [
|
|
44
|
+
{
|
|
45
|
+
variableName: '_api-error_',
|
|
46
|
+
variableValue: response.status.message,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
return (0, rxjs_1.from)(actions);
|
|
52
|
+
}
|
|
53
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.updateVendorDetailsViewFailureOrSuccess)({
|
|
54
|
+
vendorId,
|
|
55
|
+
fetchState: 'Error',
|
|
56
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Vendor Save on First Review View REST API call errored out ' +
|
|
57
|
+
JSON.stringify(error)),
|
|
58
|
+
}))));
|
|
59
|
+
}
|
|
60
|
+
return (0, rxjs_1.from)([]);
|
|
61
|
+
}));
|
|
62
|
+
exports.saveVendorDetailsViewEpic = saveVendorDetailsViewEpic;
|
|
@@ -4,7 +4,7 @@ import { UserBasePayload } from '../../../entity/user/userPayload';
|
|
|
4
4
|
import { VendorPayload } from '../../../entity/vendor/vendorPayload';
|
|
5
5
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
6
6
|
import { AllGlobalMerchantBasePayload, VendorReviewViewAllRecommendationsPayload, VendorReviewViewRecommendationsPayload } from '../common/payload/commonTypes';
|
|
7
|
-
import { VendorFirstReviewViewColumnKey } from './vendorFirstReviewViewState';
|
|
7
|
+
import { VendorFirstReviewViewColumnKey, VendorViewLocalData } from './vendorFirstReviewViewState';
|
|
8
8
|
export interface VendorTransactionAttachment {
|
|
9
9
|
attachmentEndpoint: string;
|
|
10
10
|
vendorId: ID;
|
|
@@ -71,4 +71,10 @@ export declare type SaveVendorFirstReviewResponse = ZeniAPIResponse<SaveVendorFi
|
|
|
71
71
|
* helpers
|
|
72
72
|
*/
|
|
73
73
|
export declare const toVendorFirstReviewViewColumnKeyPayload: (key: VendorFirstReviewViewColumnKey) => string;
|
|
74
|
+
export interface VendorWebsiteUrlUpdatePayload {
|
|
75
|
+
qbo_id: string;
|
|
76
|
+
vendor_name: string;
|
|
77
|
+
website_url: string;
|
|
78
|
+
}
|
|
79
|
+
export declare const prepareVendorPayload: (vendorDetailLocalData?: VendorViewLocalData | undefined) => Partial<VendorWebsiteUrlUpdatePayload>;
|
|
74
80
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toVendorFirstReviewViewColumnKeyPayload = void 0;
|
|
3
|
+
exports.prepareVendorPayload = exports.toVendorFirstReviewViewColumnKeyPayload = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* helpers
|
|
6
6
|
*/
|
|
@@ -18,3 +18,13 @@ const toVendorFirstReviewViewColumnKeyPayload = (key) => {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
exports.toVendorFirstReviewViewColumnKeyPayload = toVendorFirstReviewViewColumnKeyPayload;
|
|
21
|
+
const prepareVendorPayload = (vendorDetailLocalData) => {
|
|
22
|
+
const payload = {};
|
|
23
|
+
payload.vendor_name = vendorDetailLocalData === null || vendorDetailLocalData === void 0 ? void 0 : vendorDetailLocalData.name;
|
|
24
|
+
payload.qbo_id = vendorDetailLocalData === null || vendorDetailLocalData === void 0 ? void 0 : vendorDetailLocalData.qboId;
|
|
25
|
+
if ((vendorDetailLocalData === null || vendorDetailLocalData === void 0 ? void 0 : vendorDetailLocalData.websiteUrl) != null) {
|
|
26
|
+
payload.website_url = vendorDetailLocalData.websiteUrl.toString();
|
|
27
|
+
}
|
|
28
|
+
return payload;
|
|
29
|
+
};
|
|
30
|
+
exports.prepareVendorPayload = prepareVendorPayload;
|
|
@@ -2,8 +2,9 @@ import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
4
|
import { SaveVendorFirstReviewViewPayload, ReviewStatusPayload, VendorFirstReviewPayload } from './vendorFirstReviewViewPayload';
|
|
5
|
-
import { VendorFirstReviewViewColumnKey, VendorFirstReviewViewState, RecommendedNonExistingGlobalMerchant,
|
|
5
|
+
import { VendorFirstReviewViewColumnKey, VendorFirstReviewViewState, RecommendedNonExistingGlobalMerchant, VendorViewLocalData } from './vendorFirstReviewViewState';
|
|
6
6
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
7
|
+
import { VendorReviewRowCurrentSelection } from '../common/state/commonTypes';
|
|
7
8
|
import { AttachmentPayload } from '../../../entity/transaction/payloadTypes/attachmentPayload';
|
|
8
9
|
export declare const initialState: VendorFirstReviewViewState;
|
|
9
10
|
export declare const fetchVendorFirstReviewAttachments: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, attachmentIds: string[]], {
|
|
@@ -28,14 +29,14 @@ export declare const fetchVendorFirstReviewAttachments: import("@reduxjs/toolkit
|
|
|
28
29
|
markAsLocalContractor: any;
|
|
29
30
|
}, string, never, never>, updateVendorFirstReviewSortUiState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
31
|
sortOrder: SortOrder;
|
|
31
|
-
|
|
32
|
+
sortKey: VendorFirstReviewViewColumnKey;
|
|
32
33
|
}, string>, initializeVendorFirstReviewViewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
34
|
response: VendorFirstReviewPayload;
|
|
34
35
|
keepExistingListItems?: boolean | undefined;
|
|
35
36
|
}, string>, updateVendorFirstReviewViewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
36
37
|
vendorId: ID;
|
|
37
|
-
currentSelection:
|
|
38
|
-
selectedGlobalMerchantId
|
|
38
|
+
currentSelection: VendorReviewRowCurrentSelection;
|
|
39
|
+
selectedGlobalMerchantId: ID;
|
|
39
40
|
vendorRenamedText?: string | undefined;
|
|
40
41
|
}, string>, resetVendorFirstReviewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
41
42
|
vendorId: ID;
|
|
@@ -57,6 +58,15 @@ export declare const fetchVendorFirstReviewAttachments: import("@reduxjs/toolkit
|
|
|
57
58
|
transactionAttachments: AttachmentPayload[];
|
|
58
59
|
}, string>, updateVendorFirstReviewViewTransactionAttachmentsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
59
60
|
status: ZeniAPIStatus;
|
|
61
|
+
}, string>, updateVendorDetailRecommendations: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
62
|
+
recommendationIds: ID[];
|
|
63
|
+
recommendedNonExistingGlobalMerchants: RecommendedNonExistingGlobalMerchant[];
|
|
64
|
+
}, string>, updateReviewVendorDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
65
|
+
vendorDetails: VendorViewLocalData;
|
|
66
|
+
}, string>, saveVendorDetailsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateVendorDetailsViewFailureOrSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
67
|
+
vendorId: ID;
|
|
68
|
+
fetchState: FetchState;
|
|
69
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
60
70
|
}, string>;
|
|
61
71
|
declare const _default: import("@reduxjs/toolkit").Reducer<VendorFirstReviewViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
62
72
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateVendorFirstReviewViewTransactionAttachmentsFailure = exports.updateVendorFirstReviewViewTransactionAttachments = exports.saveVendorFirstReviewViewSuccessOrFailure = exports.clearRecentlySavedErroredVendorData = exports.updateRecentlySavedErroredVendorData = exports.resetVendorFirstReviewLocalData = exports.updateVendorFirstReviewViewLocalData = exports.initializeVendorFirstReviewViewLocalData = exports.updateVendorFirstReviewSortUiState = exports.saveVendorFirstReviewView = exports.updateVendorFirstReviewViewPageToken = exports.updateVendorFirstReviewViewScrollYOffset = exports.clearVendorReviewView = exports.updateVendorFirstReviewViewFailure = exports.updateSavedVendorFirstReviewViewLocalData = exports.fetchVendorFirstReviewView = exports.fetchVendorFirstReviewAttachments = exports.initialState = void 0;
|
|
4
|
+
exports.updateVendorDetailsViewFailureOrSuccess = exports.saveVendorDetailsView = exports.updateReviewVendorDetailLocalData = exports.updateVendorDetailRecommendations = exports.updateVendorFirstReviewViewTransactionAttachmentsFailure = exports.updateVendorFirstReviewViewTransactionAttachments = exports.saveVendorFirstReviewViewSuccessOrFailure = exports.clearRecentlySavedErroredVendorData = exports.updateRecentlySavedErroredVendorData = exports.resetVendorFirstReviewLocalData = exports.updateVendorFirstReviewViewLocalData = exports.initializeVendorFirstReviewViewLocalData = exports.updateVendorFirstReviewSortUiState = exports.saveVendorFirstReviewView = exports.updateVendorFirstReviewViewPageToken = exports.updateVendorFirstReviewViewScrollYOffset = exports.clearVendorReviewView = exports.updateVendorFirstReviewViewFailure = exports.updateSavedVendorFirstReviewViewLocalData = exports.fetchVendorFirstReviewView = exports.fetchVendorFirstReviewAttachments = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const commonTypes_1 = require("../common/state/commonTypes");
|
|
7
7
|
const attachmentPayload_1 = require("../../../entity/transaction/payloadTypes/attachmentPayload");
|
|
@@ -22,6 +22,7 @@ exports.initialState = {
|
|
|
22
22
|
fetchState: 'Not-Started',
|
|
23
23
|
error: undefined,
|
|
24
24
|
},
|
|
25
|
+
vendorLocalData: null,
|
|
25
26
|
hasValidState() {
|
|
26
27
|
return this.fetchState == 'Completed';
|
|
27
28
|
},
|
|
@@ -73,7 +74,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
73
74
|
},
|
|
74
75
|
},
|
|
75
76
|
updateVendorFirstReviewSortUiState(draft, action) {
|
|
76
|
-
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { sortKey: action.payload.
|
|
77
|
+
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { sortKey: action.payload.sortKey, sortOrder: action.payload.sortOrder });
|
|
77
78
|
},
|
|
78
79
|
updateVendorFirstReviewViewPageToken(draft, action) {
|
|
79
80
|
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { pageToken: action.payload.pageToken });
|
|
@@ -93,48 +94,17 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
93
94
|
draft.uiState = Object.assign(Object.assign({}, draft.uiState), { pageToken: (_a = query === null || query === void 0 ? void 0 : query.page_token) !== null && _a !== void 0 ? _a : null, totalCount: total_count });
|
|
94
95
|
},
|
|
95
96
|
updateVendorFirstReviewViewLocalData(draft, action) {
|
|
96
|
-
var _a, _b, _c;
|
|
97
97
|
const { vendorId, vendorRenamedText, selectedGlobalMerchantId, currentSelection, } = action.payload;
|
|
98
98
|
if (draft.vendorFirstReviewViewLocalDataById[vendorId]
|
|
99
99
|
.vendorFirstReviewViewLocalData != null) {
|
|
100
100
|
const vendorLocalData = draft.vendorFirstReviewViewLocalDataById[vendorId]
|
|
101
101
|
.vendorFirstReviewViewLocalData;
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
if (selectedGlobalMerchantId != null) {
|
|
105
|
-
const isRecommendationSelected = selectedGlobalMerchantId != null &&
|
|
106
|
-
(selectedGlobalMerchantId ===
|
|
107
|
-
vendorLocalData.recommendationIds[0] ||
|
|
108
|
-
(vendorLocalData.recommendationIds.length === 0 &&
|
|
109
|
-
selectedGlobalMerchantId ===
|
|
110
|
-
((_a = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _a === void 0 ? void 0 : _a.globalMerchantName)));
|
|
111
|
-
const isRetainSelected = selectedGlobalMerchantId != null &&
|
|
112
|
-
selectedGlobalMerchantId === vendorLocalData.vendorId;
|
|
113
|
-
currentSelection =
|
|
114
|
-
isRecommendationSelected === true
|
|
115
|
-
? 'update'
|
|
116
|
-
: isRetainSelected === true
|
|
117
|
-
? 'retain'
|
|
118
|
-
: 'custom_merchant';
|
|
119
|
-
}
|
|
120
|
-
draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { selectedVendorId: selectedGlobalMerchantId !== null && selectedGlobalMerchantId !== void 0 ? selectedGlobalMerchantId : vendorLocalData.vendorId, currentSelection,
|
|
102
|
+
if (vendorRenamedText != null) {
|
|
103
|
+
draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { selectedVendorId: selectedGlobalMerchantId, currentSelection,
|
|
121
104
|
vendorRenamedText });
|
|
122
105
|
}
|
|
123
106
|
else {
|
|
124
|
-
|
|
125
|
-
const { isRetainSelected, isUpdateSelected, bothRetainAndUpdateUnSelected, } = getCurrentSelectionStatus(vendorLocalData.currentSelection, currentSelection);
|
|
126
|
-
if (bothRetainAndUpdateUnSelected || isRetainSelected) {
|
|
127
|
-
updateSelectedGlobalMerchantId = vendorLocalData.vendorId;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
updateSelectedGlobalMerchantId =
|
|
131
|
-
(_b = vendorLocalData.recommendationIds[0]) !== null && _b !== void 0 ? _b : (_c = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _c === void 0 ? void 0 : _c.globalMerchantName;
|
|
132
|
-
}
|
|
133
|
-
draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { vendorRenamedText: undefined, selectedVendorId: updateSelectedGlobalMerchantId, currentSelection: isRetainSelected
|
|
134
|
-
? 'retain'
|
|
135
|
-
: isUpdateSelected
|
|
136
|
-
? 'update'
|
|
137
|
-
: null });
|
|
107
|
+
draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { vendorRenamedText: undefined, selectedVendorId: selectedGlobalMerchantId, currentSelection });
|
|
138
108
|
}
|
|
139
109
|
}
|
|
140
110
|
},
|
|
@@ -212,6 +182,52 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
212
182
|
};
|
|
213
183
|
}
|
|
214
184
|
},
|
|
185
|
+
updateReviewVendorDetailLocalData(draft, action) {
|
|
186
|
+
const { vendorDetails } = action.payload;
|
|
187
|
+
const { id, qboId, websiteUrl, name, recommendationIds, recommendedNonExistingGlobalMerchants, } = vendorDetails;
|
|
188
|
+
draft.vendorLocalData = {
|
|
189
|
+
vendorDetails: {
|
|
190
|
+
id,
|
|
191
|
+
qboId,
|
|
192
|
+
name,
|
|
193
|
+
websiteUrl,
|
|
194
|
+
recommendationIds,
|
|
195
|
+
recommendedNonExistingGlobalMerchants,
|
|
196
|
+
},
|
|
197
|
+
saveStatus: { fetchState: 'Not-Started', error: undefined },
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
updateVendorDetailRecommendations(draft, action) {
|
|
201
|
+
const { recommendationIds, recommendedNonExistingGlobalMerchants } = action.payload;
|
|
202
|
+
if (draft.vendorLocalData != null) {
|
|
203
|
+
draft.vendorLocalData.vendorDetails.recommendationIds =
|
|
204
|
+
recommendationIds;
|
|
205
|
+
draft.vendorLocalData.vendorDetails.recommendedNonExistingGlobalMerchants =
|
|
206
|
+
recommendedNonExistingGlobalMerchants;
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
saveVendorDetailsView(draft) {
|
|
210
|
+
if (draft.vendorLocalData != null) {
|
|
211
|
+
draft.vendorLocalData = Object.assign(Object.assign({}, draft.vendorLocalData), { saveStatus: {
|
|
212
|
+
fetchState: 'In-Progress',
|
|
213
|
+
error: undefined,
|
|
214
|
+
} });
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
updateVendorDetailsViewFailureOrSuccess(draft, action) {
|
|
218
|
+
const { vendorId, fetchState, error } = action.payload;
|
|
219
|
+
if (draft.vendorLocalData != null) {
|
|
220
|
+
draft.vendorLocalData.saveStatus = {
|
|
221
|
+
fetchState: fetchState,
|
|
222
|
+
error: error,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (fetchState === 'Completed') {
|
|
226
|
+
const vendorReviewViewLocalData = draft.vendorFirstReviewViewLocalDataById[vendorId]
|
|
227
|
+
.vendorFirstReviewViewLocalData;
|
|
228
|
+
draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorReviewViewLocalData), { isWebsiteUrlSaved: true });
|
|
229
|
+
}
|
|
230
|
+
},
|
|
215
231
|
clearRecentlySavedErroredVendorData(draft) {
|
|
216
232
|
draft.recentlySavedErroredVendorData = undefined;
|
|
217
233
|
},
|
|
@@ -228,6 +244,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
228
244
|
// Note: We need to delete vendor local data when save is success with status code 'reviewed' OR it is marked as en employee
|
|
229
245
|
if (action.payload.fetchState === 'Completed' &&
|
|
230
246
|
(status === 'reviewed' ||
|
|
247
|
+
status === 'under_review' ||
|
|
231
248
|
action.payload.markAsEmployee ||
|
|
232
249
|
action.payload.markAsLocalContractor)) {
|
|
233
250
|
delete draft.vendorFirstReviewViewLocalDataById[vendorId];
|
|
@@ -251,16 +268,6 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
251
268
|
},
|
|
252
269
|
},
|
|
253
270
|
});
|
|
254
|
-
const getCurrentSelectionStatus = (stateCurrentSelection, currentSelection) => {
|
|
255
|
-
const isRetainSelected = stateCurrentSelection !== 'retain' && currentSelection.retain;
|
|
256
|
-
const isUpdateSelected = stateCurrentSelection !== 'update' && currentSelection.update;
|
|
257
|
-
const bothRetainAndUpdateUnSelected = !currentSelection.retain && !currentSelection.update;
|
|
258
|
-
return {
|
|
259
|
-
isRetainSelected,
|
|
260
|
-
isUpdateSelected,
|
|
261
|
-
bothRetainAndUpdateUnSelected,
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
271
|
const toVendorReviewViewUpdatedVendorLocalData = (vendorId, vendorPayload) => {
|
|
265
272
|
const vendorView = mapPayloadToVendorFirstReviewView(Object.assign(Object.assign({}, vendorPayload), { vendor_id: vendorId }));
|
|
266
273
|
return vendorView;
|
|
@@ -293,15 +300,17 @@ const mapPayloadToVendorFirstReviewView = (payload) => {
|
|
|
293
300
|
recommendationIds,
|
|
294
301
|
recommendedNonExistingGlobalMerchants: nonExistingRecommendations,
|
|
295
302
|
lastUpdatedVendorNameByUserId: (_a = payload.last_updated_vendor_name_by_user) === null || _a === void 0 ? void 0 : _a.user_id,
|
|
303
|
+
/* merge_vendor_name can be an empty string from platform in cases other than `merge_in_qbo` status.
|
|
304
|
+
So, to avoid further string length checks, making this undefined.*/
|
|
296
305
|
mergeVendorName: payload.merge_vendor_name != null && payload.merge_vendor_name.length > 0
|
|
297
306
|
? payload.merge_vendor_name
|
|
298
307
|
: undefined,
|
|
299
308
|
transactionAttachments: payload.transaction_attachments != null
|
|
300
309
|
? payload.transaction_attachments.map((attachmentPayload) => (0, attachmentPayload_1.toAttachment)(attachmentPayload))
|
|
301
310
|
: [],
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
// initially set to false since we haven't saved the url from vendor detail slider, will be true once saved.
|
|
312
|
+
isWebsiteUrlSaved: false,
|
|
304
313
|
};
|
|
305
314
|
};
|
|
306
|
-
_a = vendorFirstReviewView.actions, exports.fetchVendorFirstReviewAttachments = _a.fetchVendorFirstReviewAttachments, exports.fetchVendorFirstReviewView = _a.fetchVendorFirstReviewView, exports.updateSavedVendorFirstReviewViewLocalData = _a.updateSavedVendorFirstReviewViewLocalData, exports.updateVendorFirstReviewViewFailure = _a.updateVendorFirstReviewViewFailure, exports.clearVendorReviewView = _a.clearVendorReviewView, exports.updateVendorFirstReviewViewScrollYOffset = _a.updateVendorFirstReviewViewScrollYOffset, exports.updateVendorFirstReviewViewPageToken = _a.updateVendorFirstReviewViewPageToken, exports.saveVendorFirstReviewView = _a.saveVendorFirstReviewView, exports.updateVendorFirstReviewSortUiState = _a.updateVendorFirstReviewSortUiState, exports.initializeVendorFirstReviewViewLocalData = _a.initializeVendorFirstReviewViewLocalData, exports.updateVendorFirstReviewViewLocalData = _a.updateVendorFirstReviewViewLocalData, exports.resetVendorFirstReviewLocalData = _a.resetVendorFirstReviewLocalData, exports.updateRecentlySavedErroredVendorData = _a.updateRecentlySavedErroredVendorData, exports.clearRecentlySavedErroredVendorData = _a.clearRecentlySavedErroredVendorData, exports.saveVendorFirstReviewViewSuccessOrFailure = _a.saveVendorFirstReviewViewSuccessOrFailure, exports.updateVendorFirstReviewViewTransactionAttachments = _a.updateVendorFirstReviewViewTransactionAttachments, exports.updateVendorFirstReviewViewTransactionAttachmentsFailure = _a.updateVendorFirstReviewViewTransactionAttachmentsFailure;
|
|
315
|
+
_a = vendorFirstReviewView.actions, exports.fetchVendorFirstReviewAttachments = _a.fetchVendorFirstReviewAttachments, exports.fetchVendorFirstReviewView = _a.fetchVendorFirstReviewView, exports.updateSavedVendorFirstReviewViewLocalData = _a.updateSavedVendorFirstReviewViewLocalData, exports.updateVendorFirstReviewViewFailure = _a.updateVendorFirstReviewViewFailure, exports.clearVendorReviewView = _a.clearVendorReviewView, exports.updateVendorFirstReviewViewScrollYOffset = _a.updateVendorFirstReviewViewScrollYOffset, exports.updateVendorFirstReviewViewPageToken = _a.updateVendorFirstReviewViewPageToken, exports.saveVendorFirstReviewView = _a.saveVendorFirstReviewView, exports.updateVendorFirstReviewSortUiState = _a.updateVendorFirstReviewSortUiState, exports.initializeVendorFirstReviewViewLocalData = _a.initializeVendorFirstReviewViewLocalData, exports.updateVendorFirstReviewViewLocalData = _a.updateVendorFirstReviewViewLocalData, exports.resetVendorFirstReviewLocalData = _a.resetVendorFirstReviewLocalData, exports.updateRecentlySavedErroredVendorData = _a.updateRecentlySavedErroredVendorData, exports.clearRecentlySavedErroredVendorData = _a.clearRecentlySavedErroredVendorData, exports.saveVendorFirstReviewViewSuccessOrFailure = _a.saveVendorFirstReviewViewSuccessOrFailure, exports.updateVendorFirstReviewViewTransactionAttachments = _a.updateVendorFirstReviewViewTransactionAttachments, exports.updateVendorFirstReviewViewTransactionAttachmentsFailure = _a.updateVendorFirstReviewViewTransactionAttachmentsFailure, exports.updateVendorDetailRecommendations = _a.updateVendorDetailRecommendations, exports.updateReviewVendorDetailLocalData = _a.updateReviewVendorDetailLocalData, exports.saveVendorDetailsView = _a.saveVendorDetailsView, exports.updateVendorDetailsViewFailureOrSuccess = _a.updateVendorDetailsViewFailureOrSuccess;
|
|
307
316
|
exports.default = vendorFirstReviewView.reducer;
|
|
@@ -27,6 +27,7 @@ export interface VendorFirstReviewSelectorView {
|
|
|
27
27
|
status: ReviewStatus;
|
|
28
28
|
lastUpdatedVendorNameByUser?: User;
|
|
29
29
|
mergeVendorName: string | undefined;
|
|
30
|
+
isWebsiteUrlSaved: boolean;
|
|
30
31
|
saveStatus: FetchStateAndError;
|
|
31
32
|
attachmentFetchStatus: FetchStateAndError;
|
|
32
33
|
recommendations: RecommendedNonExistingGlobalMerchant[];
|
|
@@ -39,10 +40,19 @@ interface RecentlySavedErroredVendorView {
|
|
|
39
40
|
oldRecommendedVendor?: RecommendedNonExistingGlobalMerchant;
|
|
40
41
|
newRecommendedVendor?: RecommendedNonExistingGlobalMerchant;
|
|
41
42
|
}
|
|
43
|
+
export interface FirstReviewVendorDetailSelectorView {
|
|
44
|
+
id?: ID;
|
|
45
|
+
qboId?: ID;
|
|
46
|
+
name?: string;
|
|
47
|
+
websiteUrl?: ZeniUrl;
|
|
48
|
+
recommendations: RecommendedNonExistingGlobalMerchant[];
|
|
49
|
+
saveStatus: FetchStateAndError;
|
|
50
|
+
}
|
|
42
51
|
export declare const getVendorFirstReviewView: (state: RootState) => VendorFirstReviewViewSelectorView;
|
|
43
52
|
export interface VendorFirstReviewSelectorAttachmentView {
|
|
44
53
|
attachmentFetchStatus: FetchStateAndError;
|
|
45
54
|
transactionAttachments: Attachment[];
|
|
46
55
|
}
|
|
47
56
|
export declare const getVendorFirstReviewAttachmentView: (state: RootState, vendorId: ID) => VendorFirstReviewSelectorAttachmentView | undefined;
|
|
57
|
+
export declare const getVendorDetailSelectorView: (state: RootState) => FirstReviewVendorDetailSelectorView;
|
|
48
58
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVendorFirstReviewAttachmentView = exports.getVendorFirstReviewView = void 0;
|
|
3
|
+
exports.getVendorDetailSelectorView = exports.getVendorFirstReviewAttachmentView = exports.getVendorFirstReviewView = void 0;
|
|
4
4
|
const globalMerchantSelector_1 = require("../../../entity/globalMerchant/globalMerchantSelector");
|
|
5
5
|
const userSelector_1 = require("../../../entity/user/userSelector");
|
|
6
6
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
@@ -63,6 +63,7 @@ const getVendorFirstReviewView = (state) => {
|
|
|
63
63
|
recommendations,
|
|
64
64
|
currentSelection: vendorLocalData.currentSelection,
|
|
65
65
|
mergeVendorName: vendorLocalData.mergeVendorName,
|
|
66
|
+
isWebsiteUrlSaved: vendorLocalData.isWebsiteUrlSaved,
|
|
66
67
|
transactionAttachments,
|
|
67
68
|
};
|
|
68
69
|
});
|
|
@@ -110,3 +111,22 @@ const getVendorFirstReviewAttachmentView = (state, vendorId) => {
|
|
|
110
111
|
};
|
|
111
112
|
};
|
|
112
113
|
exports.getVendorFirstReviewAttachmentView = getVendorFirstReviewAttachmentView;
|
|
114
|
+
const getVendorDetailSelectorView = (state) => {
|
|
115
|
+
var _a, _b, _c;
|
|
116
|
+
const { vendorFirstReviewViewState, globalMerchantState } = state;
|
|
117
|
+
const { vendorLocalData } = vendorFirstReviewViewState;
|
|
118
|
+
let recommendations = (0, globalMerchantSelector_1.getGlobalMerchantsByMerchantIds)(globalMerchantState, (_a = vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.recommendationIds) !== null && _a !== void 0 ? _a : []);
|
|
119
|
+
recommendations = [
|
|
120
|
+
...recommendations,
|
|
121
|
+
...((_b = vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.recommendedNonExistingGlobalMerchants) !== null && _b !== void 0 ? _b : []),
|
|
122
|
+
];
|
|
123
|
+
return {
|
|
124
|
+
id: vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.id,
|
|
125
|
+
qboId: vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.qboId,
|
|
126
|
+
name: vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.name,
|
|
127
|
+
websiteUrl: vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.vendorDetails.websiteUrl,
|
|
128
|
+
recommendations,
|
|
129
|
+
saveStatus: (_c = vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.saveStatus) !== null && _c !== void 0 ? _c : { fetchState: 'Not-Started' },
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
exports.getVendorDetailSelectorView = getVendorDetailSelectorView;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { FetchedState, FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import ZeniUrl from '../../../zeniUrl';
|
|
2
3
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
4
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
5
|
import { GlobalMerchant } from '../../../entity/globalMerchant/globalMerchantState';
|
|
5
6
|
import { Attachment } from '../../../entity/transaction/stateTypes/attachment';
|
|
6
7
|
import { VendorReviewRowCurrentSelection, ReviewStatus } from '../common/state/commonTypes';
|
|
7
|
-
export interface
|
|
8
|
+
export interface FirstReviewPageCurrentSelectionByColumn {
|
|
8
9
|
retain: boolean;
|
|
9
|
-
|
|
10
|
+
recommendedFirst: boolean;
|
|
11
|
+
recommendedSecond: boolean;
|
|
12
|
+
rename: boolean;
|
|
13
|
+
customMerchant: boolean;
|
|
10
14
|
}
|
|
11
15
|
export declare const toVendorFirstReviewViewColumnKeyType: (v: string) => "action" | "status" | "vendor" | "retain" | "updateTo" | "ytd" | "viewTenantInvoice";
|
|
12
16
|
export declare type VendorFirstReviewViewColumnKey = ReturnType<typeof toVendorFirstReviewViewColumnKeyType>;
|
|
@@ -32,6 +36,7 @@ export interface VendorFirstReviewViewLocalData {
|
|
|
32
36
|
lastUpdatedVendorNameByUserId?: ID;
|
|
33
37
|
mergeVendorName: string | undefined;
|
|
34
38
|
transactionAttachments: Attachment[];
|
|
39
|
+
isWebsiteUrlSaved: boolean;
|
|
35
40
|
}
|
|
36
41
|
interface RecentlySavedErroredVendorData {
|
|
37
42
|
vendorId: ID;
|
|
@@ -47,7 +52,20 @@ export interface VendorFirstReviewViewState extends FetchedState {
|
|
|
47
52
|
vendorFirstReviewViewLocalDataById: Record<ID, VendorFirstReviewView>;
|
|
48
53
|
recentlySavedErroredVendorData?: RecentlySavedErroredVendorData;
|
|
49
54
|
uiState: VendorFirstReviewViewUIState;
|
|
55
|
+
vendorLocalData: ReviewVendorViewLocalData | null;
|
|
50
56
|
attachmentFetchStatus: FetchStateAndError;
|
|
51
57
|
transactionAttachmentsByVendorId: Record<ID, Attachment[]>;
|
|
52
58
|
}
|
|
59
|
+
export interface VendorViewLocalData {
|
|
60
|
+
id: ID;
|
|
61
|
+
qboId: ID;
|
|
62
|
+
name: string;
|
|
63
|
+
websiteUrl?: ZeniUrl;
|
|
64
|
+
recommendationIds: ID[];
|
|
65
|
+
recommendedNonExistingGlobalMerchants: RecommendedNonExistingGlobalMerchant[];
|
|
66
|
+
}
|
|
67
|
+
export interface ReviewVendorViewLocalData {
|
|
68
|
+
vendorDetails: VendorViewLocalData;
|
|
69
|
+
saveStatus: FetchStateAndError;
|
|
70
|
+
}
|
|
53
71
|
export {};
|
package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js
CHANGED
|
@@ -83,10 +83,10 @@ const mapGlobalReviewPayloadToGlobalMerchantsBasePayload = (vendorsResponse) =>
|
|
|
83
83
|
exports.mapGlobalReviewPayloadToGlobalMerchantsBasePayload = mapGlobalReviewPayloadToGlobalMerchantsBasePayload;
|
|
84
84
|
const toVendorGlobalReviewSortByKey = (columnKey) => {
|
|
85
85
|
switch (columnKey) {
|
|
86
|
-
case '
|
|
87
|
-
return '
|
|
88
|
-
case '
|
|
89
|
-
return '
|
|
86
|
+
case 'originalVendor':
|
|
87
|
+
return 'original_vendor';
|
|
88
|
+
case 'requestedVendor':
|
|
89
|
+
return 'requested_vendor';
|
|
90
90
|
case 'recommended':
|
|
91
91
|
return 'recommended_global_merchant_name';
|
|
92
92
|
case 'tenants':
|
|
@@ -4,7 +4,7 @@ import { VendorReviewViewAllRecommendationsPayload } from '../common/payload/com
|
|
|
4
4
|
export interface VendorGlobalReviewPayload extends TenantMerchantPayload {
|
|
5
5
|
recommendations: VendorReviewViewAllRecommendationsPayload;
|
|
6
6
|
}
|
|
7
|
-
export declare const toVendorGlobalReviewSortByKeyType: (v: string) => "recommended_global_merchant_name" | "
|
|
7
|
+
export declare const toVendorGlobalReviewSortByKeyType: (v: string) => "recommended_global_merchant_name" | "original_vendor" | "requested_vendor" | "tenant_name";
|
|
8
8
|
export declare type VendorGlobalReviewViewSortByKey = ReturnType<typeof toVendorGlobalReviewSortByKeyType>;
|
|
9
9
|
export interface VendorGlobalReviewViewQueryPayload {
|
|
10
10
|
entity_type: string;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toVendorGlobalReviewSortByKeyType = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const VENDOR_GLOBAL_REVIEW_SORT_BY_KEYS = [
|
|
6
|
-
'
|
|
7
|
-
'
|
|
6
|
+
'original_vendor',
|
|
7
|
+
'requested_vendor',
|
|
8
8
|
'tenant_name',
|
|
9
9
|
'recommended_global_merchant_name',
|
|
10
10
|
];
|
|
@@ -3,6 +3,7 @@ import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
3
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
4
|
import { VendorGlobalReviewPayload, VendorGlobalReviewViewQueryPayload } from './vendorGlobalReviewViewPayload';
|
|
5
5
|
import { VendorGlobalReviewViewState, VendorGlobalReviewViewUIState } from './vendorGlobalReviewViewState';
|
|
6
|
+
import { GlobalVendorReviewRowCurrentSelection } from '../common/state/commonTypes';
|
|
6
7
|
export declare const initialState: VendorGlobalReviewViewState;
|
|
7
8
|
export declare const fetchVendorGlobalReviewView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[searchString?: string | undefined, keepExistingListItems?: any, pageToken?: PageToken | undefined], {
|
|
8
9
|
searchString: string | undefined;
|
|
@@ -29,6 +30,10 @@ export declare const fetchVendorGlobalReviewView: import("@reduxjs/toolkit").Act
|
|
|
29
30
|
}, string>, rejectVendorGlobalReviewFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
31
|
merchantId: ID;
|
|
31
32
|
status: ZeniAPIStatus;
|
|
32
|
-
}, string>, rejectVendorGlobalReviewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, clearVendorGlobalReviewView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string
|
|
33
|
+
}, string>, rejectVendorGlobalReviewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, clearVendorGlobalReviewView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateVendorGlobalReviewViewLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
34
|
+
merchantId: ID;
|
|
35
|
+
currentSelection: GlobalVendorReviewRowCurrentSelection;
|
|
36
|
+
customMerchantId?: string | undefined;
|
|
37
|
+
}, string>;
|
|
33
38
|
declare const _default: import("@reduxjs/toolkit").Reducer<VendorGlobalReviewViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
34
39
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearVendorGlobalReviewView = exports.rejectVendorGlobalReviewSuccess = exports.rejectVendorGlobalReviewFailure = exports.approveVendorGlobalReviewFailure = exports.approveVendorGlobalReviewSuccess = exports.rejectVendorGlobalReview = exports.approveVendorGlobalReview = exports.updateSelectedGlobalMerchant = exports.updateVendorGlobalReviewViewUIState = exports.initializeVendorGlobalReviewViewLocalData = exports.fetchVendorGlobalReviewViewFailure = exports.fetchVendorGlobalReviewViewSuccess = exports.fetchVendorGlobalReviewView = exports.initialState = void 0;
|
|
4
|
+
exports.updateVendorGlobalReviewViewLocalData = exports.clearVendorGlobalReviewView = exports.rejectVendorGlobalReviewSuccess = exports.rejectVendorGlobalReviewFailure = exports.approveVendorGlobalReviewFailure = exports.approveVendorGlobalReviewSuccess = exports.rejectVendorGlobalReview = exports.approveVendorGlobalReview = exports.updateSelectedGlobalMerchant = exports.updateVendorGlobalReviewViewUIState = exports.initializeVendorGlobalReviewViewLocalData = exports.fetchVendorGlobalReviewViewFailure = exports.fetchVendorGlobalReviewViewSuccess = exports.fetchVendorGlobalReviewView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const vendorGlobalReviewViewPayload_1 = require("./vendorGlobalReviewViewPayload");
|
|
7
7
|
const commonTypes_1 = require("../common/state/commonTypes");
|
|
@@ -153,6 +153,17 @@ const vendorGlobalReviewView = (0, toolkit_1.createSlice)({
|
|
|
153
153
|
error: status,
|
|
154
154
|
};
|
|
155
155
|
},
|
|
156
|
+
updateVendorGlobalReviewViewLocalData(draft, action) {
|
|
157
|
+
const { merchantId, customMerchantId, currentSelection } = action.payload;
|
|
158
|
+
if (draft.vendorGlobalByMerchantId[merchantId]
|
|
159
|
+
.vendorGlobalReviewViewLocalData != null) {
|
|
160
|
+
const vendorLocalData = draft.vendorGlobalByMerchantId[merchantId]
|
|
161
|
+
.vendorGlobalReviewViewLocalData;
|
|
162
|
+
draft.vendorGlobalByMerchantId[merchantId].vendorGlobalReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { selectedMerchantId: customMerchantId != null
|
|
163
|
+
? customMerchantId
|
|
164
|
+
: vendorLocalData.merchantId, currentSelection: currentSelection });
|
|
165
|
+
}
|
|
166
|
+
},
|
|
156
167
|
rejectVendorGlobalReview: {
|
|
157
168
|
reducer(draft, action) {
|
|
158
169
|
const { merchantId } = action.payload;
|
|
@@ -189,7 +200,7 @@ const vendorGlobalReviewView = (0, toolkit_1.createSlice)({
|
|
|
189
200
|
},
|
|
190
201
|
},
|
|
191
202
|
});
|
|
192
|
-
_a = vendorGlobalReviewView.actions, exports.fetchVendorGlobalReviewView = _a.fetchVendorGlobalReviewView, exports.fetchVendorGlobalReviewViewSuccess = _a.fetchVendorGlobalReviewViewSuccess, exports.fetchVendorGlobalReviewViewFailure = _a.fetchVendorGlobalReviewViewFailure, exports.initializeVendorGlobalReviewViewLocalData = _a.initializeVendorGlobalReviewViewLocalData, exports.updateVendorGlobalReviewViewUIState = _a.updateVendorGlobalReviewViewUIState, exports.updateSelectedGlobalMerchant = _a.updateSelectedGlobalMerchant, exports.approveVendorGlobalReview = _a.approveVendorGlobalReview, exports.rejectVendorGlobalReview = _a.rejectVendorGlobalReview, exports.approveVendorGlobalReviewSuccess = _a.approveVendorGlobalReviewSuccess, exports.approveVendorGlobalReviewFailure = _a.approveVendorGlobalReviewFailure, exports.rejectVendorGlobalReviewFailure = _a.rejectVendorGlobalReviewFailure, exports.rejectVendorGlobalReviewSuccess = _a.rejectVendorGlobalReviewSuccess, exports.clearVendorGlobalReviewView = _a.clearVendorGlobalReviewView;
|
|
203
|
+
_a = vendorGlobalReviewView.actions, exports.fetchVendorGlobalReviewView = _a.fetchVendorGlobalReviewView, exports.fetchVendorGlobalReviewViewSuccess = _a.fetchVendorGlobalReviewViewSuccess, exports.fetchVendorGlobalReviewViewFailure = _a.fetchVendorGlobalReviewViewFailure, exports.initializeVendorGlobalReviewViewLocalData = _a.initializeVendorGlobalReviewViewLocalData, exports.updateVendorGlobalReviewViewUIState = _a.updateVendorGlobalReviewViewUIState, exports.updateSelectedGlobalMerchant = _a.updateSelectedGlobalMerchant, exports.approveVendorGlobalReview = _a.approveVendorGlobalReview, exports.rejectVendorGlobalReview = _a.rejectVendorGlobalReview, exports.approveVendorGlobalReviewSuccess = _a.approveVendorGlobalReviewSuccess, exports.approveVendorGlobalReviewFailure = _a.approveVendorGlobalReviewFailure, exports.rejectVendorGlobalReviewFailure = _a.rejectVendorGlobalReviewFailure, exports.rejectVendorGlobalReviewSuccess = _a.rejectVendorGlobalReviewSuccess, exports.clearVendorGlobalReviewView = _a.clearVendorGlobalReviewView, exports.updateVendorGlobalReviewViewLocalData = _a.updateVendorGlobalReviewViewLocalData;
|
|
193
204
|
exports.default = vendorGlobalReviewView.reducer;
|
|
194
205
|
/**
|
|
195
206
|
* Helpers
|
|
@@ -220,14 +231,15 @@ const mapPayloadToVendorGlobalReviewView = (payload) => {
|
|
|
220
231
|
tenantId: payload.tenant_id,
|
|
221
232
|
recommendationIds,
|
|
222
233
|
recommendedNonExistingGlobalMerchants: nonExistingRecommendations,
|
|
234
|
+
currentSelection: null,
|
|
223
235
|
};
|
|
224
236
|
};
|
|
225
237
|
const toVendorGlobalReviewColumnSortKey = (sortByKey) => {
|
|
226
238
|
switch (sortByKey) {
|
|
227
|
-
case '
|
|
228
|
-
return '
|
|
229
|
-
case '
|
|
230
|
-
return '
|
|
239
|
+
case 'original_vendor':
|
|
240
|
+
return 'originalVendor';
|
|
241
|
+
case 'requested_vendor':
|
|
242
|
+
return 'requestedVendor';
|
|
231
243
|
case 'recommended_global_merchant_name':
|
|
232
244
|
return 'recommended';
|
|
233
245
|
case 'tenant_name':
|
package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewSelector.d.ts
CHANGED
|
@@ -5,12 +5,14 @@ import { GlobalMerchantAutoCompleteView } from '../../globalMerchantView/globalM
|
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { VendorGlobalReviewViewUIState } from './vendorGlobalReviewViewState';
|
|
7
7
|
import { RecommendedNonExistingGlobalMerchant } from '../vendorFirstReviewView/vendorFirstReviewViewState';
|
|
8
|
+
import { GlobalVendorReviewRowCurrentSelection } from '../common/state/commonTypes';
|
|
8
9
|
export interface VendorGlobalReview {
|
|
9
10
|
merchant: TenantMerchant;
|
|
10
11
|
selectedMerchantId: ID;
|
|
11
12
|
approveStatus: FetchStateAndError;
|
|
12
13
|
rejectStatus: FetchStateAndError;
|
|
13
|
-
|
|
14
|
+
recommendations: RecommendedNonExistingGlobalMerchant[];
|
|
15
|
+
currentSelection: GlobalVendorReviewRowCurrentSelection;
|
|
14
16
|
}
|
|
15
17
|
export interface VendorGlobalReviewViewSelectorView extends SelectorView {
|
|
16
18
|
vendorGlobalReviewData: VendorGlobalReview[];
|
|
@@ -15,16 +15,18 @@ exports.getVendorGlobalReviewView = (0, toolkit_1.createSelector)((state) => sta
|
|
|
15
15
|
.map((merchantData) => {
|
|
16
16
|
const { vendorGlobalReviewViewLocalData: vendorLocalData, approveStatus, rejectStatus, } = merchantData;
|
|
17
17
|
const { tenantId, merchantId, selectedMerchantId, recommendationIds, recommendedNonExistingGlobalMerchants, } = vendorLocalData;
|
|
18
|
-
|
|
18
|
+
let recommendations = (0, globalMerchantSelector_1.getGlobalMerchantsByMerchantIds)(globalMerchantState, recommendationIds);
|
|
19
19
|
const merchant = (0, globalMerchantSelector_1.getTenantMerchantByMerchantKey)(globalMerchantState, (0, globalMerchantState_1.getTenantMerchantKey)(tenantId, merchantId));
|
|
20
20
|
if (merchant != null) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
recommendations = [
|
|
22
|
+
...recommendations,
|
|
23
|
+
...recommendedNonExistingGlobalMerchants,
|
|
24
|
+
];
|
|
24
25
|
return {
|
|
25
26
|
merchant,
|
|
26
27
|
selectedMerchantId,
|
|
27
|
-
|
|
28
|
+
recommendations,
|
|
29
|
+
currentSelection: merchantData.vendorGlobalReviewViewLocalData.currentSelection,
|
|
28
30
|
approveStatus,
|
|
29
31
|
rejectStatus,
|
|
30
32
|
};
|