@zeniai/client-epic-state 4.12.34 → 4.12.36
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/view/vendorReviewView/common/state/commonTypes.d.ts +1 -0
- package/lib/view/vendorReviewView/common/state/commonTypes.js +27 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/approveVendorGlobalReviewEpic.js +40 -12
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewPayload.d.ts +2 -2
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export declare type GlobalVendorReviewRowCurrentSelection = 'requested' | 'recom
|
|
|
20
20
|
* Helpers
|
|
21
21
|
*/
|
|
22
22
|
export declare const toNonExistingGlobalMerchantBase: (globalMerchantPayload: RecommendedNonExistingGlobalMerchantBasePayload) => RecommendedNonExistingGlobalMerchant;
|
|
23
|
+
export declare const toNonExistingGlobalMerchantBasePayload: (globalMerchant: RecommendedNonExistingGlobalMerchant) => RecommendedNonExistingGlobalMerchantBasePayload;
|
|
23
24
|
export declare const toAllRecommendationsFromPayload: (recommendationsPayload: VendorReviewViewAllRecommendationsPayload) => {
|
|
24
25
|
recommendationIds: ID[];
|
|
25
26
|
nonExistingRecommendations: RecommendedNonExistingGlobalMerchant[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAllRecommendationsFromPayload = exports.toNonExistingGlobalMerchantBase = exports.toVendorFirstReviewViewStatusesTypeStrict = void 0;
|
|
3
|
+
exports.toAllRecommendationsFromPayload = exports.toNonExistingGlobalMerchantBasePayload = exports.toNonExistingGlobalMerchantBase = exports.toVendorFirstReviewViewStatusesTypeStrict = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const globalMerchantPayload_1 = require("../../../../entity/globalMerchant/globalMerchantPayload");
|
|
6
6
|
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
7
7
|
const zeniUrl_1 = require("../../../../zeniUrl");
|
|
8
8
|
const globalMerchantAutoCompleteViewState_1 = require("../../../globalMerchantView/globalMerchantAutoCompleteView/globalMerchantAutoCompleteViewState");
|
|
9
|
+
const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
9
10
|
const VENDOR_FIRST_REVIEW_VIEW_STATUSES = [
|
|
10
11
|
'pending',
|
|
11
12
|
'under_review',
|
|
@@ -45,6 +46,31 @@ const toNonExistingGlobalMerchantBase = (globalMerchantPayload) => {
|
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
48
|
exports.toNonExistingGlobalMerchantBase = toNonExistingGlobalMerchantBase;
|
|
49
|
+
const toNonExistingGlobalMerchantBasePayload = (globalMerchant) => {
|
|
50
|
+
var _a, _b, _c, _d, _e, _f;
|
|
51
|
+
const payload = {
|
|
52
|
+
global_merchant_name: globalMerchant.globalMerchantName,
|
|
53
|
+
global_merchant_type: (_a = globalMerchant.globalMerchantType) !== null && _a !== void 0 ? _a : 'vendor',
|
|
54
|
+
logo: {
|
|
55
|
+
url: (_b = globalMerchant.logo) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
56
|
+
base64: null,
|
|
57
|
+
},
|
|
58
|
+
reason: (_c = globalMerchant.reason) !== null && _c !== void 0 ? _c : null,
|
|
59
|
+
website_url: (_e = (_d = globalMerchant.websiteUrl) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : null,
|
|
60
|
+
third_party_merchant_id: (_f = globalMerchant.thirdPartyMerchantId) !== null && _f !== void 0 ? _f : null,
|
|
61
|
+
update_time: globalMerchant.updateTime != null
|
|
62
|
+
? globalMerchant.updateTime.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)
|
|
63
|
+
: null,
|
|
64
|
+
create_time: globalMerchant.createTime != null
|
|
65
|
+
? globalMerchant.createTime.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)
|
|
66
|
+
: null,
|
|
67
|
+
};
|
|
68
|
+
if (globalMerchant.isActive != null) {
|
|
69
|
+
payload.is_active = globalMerchant.isActive;
|
|
70
|
+
}
|
|
71
|
+
return payload;
|
|
72
|
+
};
|
|
73
|
+
exports.toNonExistingGlobalMerchantBasePayload = toNonExistingGlobalMerchantBasePayload;
|
|
48
74
|
const toAllRecommendationsFromPayload = (recommendationsPayload) => {
|
|
49
75
|
var _a;
|
|
50
76
|
const recommendations = [];
|
package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/approveVendorGlobalReviewEpic.js
CHANGED
|
@@ -13,18 +13,40 @@ const globalMerchantPayload_1 = require("../../../../entity/globalMerchant/globa
|
|
|
13
13
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
14
14
|
const globalMerchantSelector_1 = require("../../../../entity/globalMerchant/globalMerchantSelector");
|
|
15
15
|
const globalMerchantState_1 = require("../../../../entity/globalMerchant/globalMerchantState");
|
|
16
|
-
const commonTypes_1 = require("../../common/
|
|
16
|
+
const commonTypes_1 = require("../../common/state/commonTypes");
|
|
17
|
+
const commonTypes_2 = require("../../common/payload/commonTypes");
|
|
18
|
+
const vendorGlobalReviewViewSelector_1 = require("../vendorGlobalReviewViewSelector");
|
|
17
19
|
const approveVendorGlobalReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorGlobalReviewViewReducer_1.approveVendorGlobalReview.match), (0, operators_1.mergeMap)((action) => {
|
|
18
20
|
const { merchantId } = action.payload;
|
|
19
21
|
const { globalMerchantState, vendorGlobalReviewViewState } = state$.value;
|
|
20
22
|
const { vendorGlobalByMerchantId } = vendorGlobalReviewViewState;
|
|
23
|
+
const globalSelectorView = (0, vendorGlobalReviewViewSelector_1.getVendorGlobalReviewView)(state$.value);
|
|
24
|
+
const merchantSelectorView = globalSelectorView.vendorGlobalReviewData.find((merchant) => merchant.merchant.tenantMerchantId === merchantId);
|
|
21
25
|
const merchantData = vendorGlobalByMerchantId[merchantId].vendorGlobalReviewViewLocalData;
|
|
22
26
|
const selectedMerchant = merchantData != null && merchantData.selectedMerchantId != null
|
|
23
27
|
? (0, globalMerchantSelector_1.getGlobalMerchantByMerchantId)(globalMerchantState, merchantData.selectedMerchantId)
|
|
24
28
|
: undefined;
|
|
29
|
+
let selectedMerchantName = selectedMerchant === null || selectedMerchant === void 0 ? void 0 : selectedMerchant.globalMerchantName;
|
|
30
|
+
let selectedNonExistingGlobalMerchant;
|
|
25
31
|
const tenantMerchant = (0, globalMerchantSelector_1.getTenantMerchantByMerchantKey)(globalMerchantState, (0, globalMerchantState_1.getTenantMerchantKey)(merchantData.tenantId, merchantId));
|
|
32
|
+
if (selectedMerchantName == null &&
|
|
33
|
+
(merchantData.currentSelection === 'recommendedFirst' ||
|
|
34
|
+
merchantData.currentSelection === 'recommendedSecond')) {
|
|
35
|
+
if (merchantData.currentSelection === 'recommendedFirst') {
|
|
36
|
+
selectedMerchantName =
|
|
37
|
+
merchantSelectorView === null || merchantSelectorView === void 0 ? void 0 : merchantSelectorView.recommendations[0].globalMerchantName;
|
|
38
|
+
selectedNonExistingGlobalMerchant =
|
|
39
|
+
merchantSelectorView === null || merchantSelectorView === void 0 ? void 0 : merchantSelectorView.recommendations[0];
|
|
40
|
+
}
|
|
41
|
+
else if (merchantData.currentSelection === 'recommendedSecond') {
|
|
42
|
+
selectedMerchantName =
|
|
43
|
+
merchantSelectorView === null || merchantSelectorView === void 0 ? void 0 : merchantSelectorView.recommendations[1].globalMerchantName;
|
|
44
|
+
selectedNonExistingGlobalMerchant =
|
|
45
|
+
merchantSelectorView === null || merchantSelectorView === void 0 ? void 0 : merchantSelectorView.recommendations[1];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
26
48
|
if (merchantData != null &&
|
|
27
|
-
|
|
49
|
+
selectedMerchantName != null &&
|
|
28
50
|
tenantMerchant != null) {
|
|
29
51
|
const recommendations = Array({
|
|
30
52
|
globalMerchants: (0, globalMerchantSelector_1.getGlobalMerchantsByMerchantIds)(globalMerchantState, merchantData.recommendationIds),
|
|
@@ -32,19 +54,18 @@ const approveVendorGlobalReviewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
32
54
|
const nonExistingRecommendations = Array({
|
|
33
55
|
globalMerchants: merchantData.recommendedNonExistingGlobalMerchants,
|
|
34
56
|
});
|
|
35
|
-
const allRecommendations = (0,
|
|
36
|
-
const payload = Object.assign({}, toApproveVendorGlobalReviewQueryPayload(tenantMerchant, selectedMerchant,
|
|
57
|
+
const allRecommendations = (0, commonTypes_2.toVendorReviewViewRecommendationPayload)(recommendations, nonExistingRecommendations);
|
|
58
|
+
const payload = Object.assign({}, toApproveVendorGlobalReviewQueryPayload(tenantMerchant, allRecommendations, selectedMerchantName, selectedMerchant, selectedNonExistingGlobalMerchant));
|
|
37
59
|
return zeniAPI
|
|
38
60
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/reviews/global-merchant-list/${merchantId}`, payload)
|
|
39
61
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
40
|
-
const isOriginalMerchant = tenantMerchant.tenantMerchantName ===
|
|
41
|
-
|
|
42
|
-
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
62
|
+
const isOriginalMerchant = tenantMerchant.tenantMerchantName === selectedMerchantName;
|
|
63
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && selectedMerchantName != null) {
|
|
43
64
|
const variables = isOriginalMerchant
|
|
44
65
|
? [
|
|
45
66
|
{
|
|
46
67
|
variableName: '_merchant_name_',
|
|
47
|
-
variableValue:
|
|
68
|
+
variableValue: selectedMerchantName,
|
|
48
69
|
},
|
|
49
70
|
]
|
|
50
71
|
: [
|
|
@@ -54,7 +75,7 @@ const approveVendorGlobalReviewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
54
75
|
},
|
|
55
76
|
{
|
|
56
77
|
variableName: '_approved_merchant_name_',
|
|
57
|
-
variableValue:
|
|
78
|
+
variableValue: selectedMerchantName,
|
|
58
79
|
},
|
|
59
80
|
];
|
|
60
81
|
const actions = [
|
|
@@ -106,14 +127,21 @@ exports.approveVendorGlobalReviewEpic = approveVendorGlobalReviewEpic;
|
|
|
106
127
|
/**
|
|
107
128
|
* Helper
|
|
108
129
|
*/
|
|
109
|
-
const toApproveVendorGlobalReviewQueryPayload = (tenantMerchant, selectedMerchant,
|
|
130
|
+
const toApproveVendorGlobalReviewQueryPayload = (tenantMerchant, allRecommendations, selectedMerchantName, selectedMerchant, selectedNonExistingMerchant) => {
|
|
110
131
|
const payload = {
|
|
111
132
|
tenant_name: tenantMerchant.tenantName,
|
|
112
133
|
merchant_type: 'vendor',
|
|
113
134
|
tenant_id: tenantMerchant.tenantId,
|
|
114
|
-
selected_global_merchant:
|
|
135
|
+
selected_global_merchant: selectedMerchant != null
|
|
136
|
+
? (0, omit_1.default)((0, globalMerchantPayload_1.toGlobalMerchantBasePayload)(selectedMerchant), [
|
|
137
|
+
'create_time',
|
|
138
|
+
'update_time',
|
|
139
|
+
])
|
|
140
|
+
: selectedNonExistingMerchant != null
|
|
141
|
+
? (0, commonTypes_1.toNonExistingGlobalMerchantBasePayload)(selectedNonExistingMerchant)
|
|
142
|
+
: null,
|
|
115
143
|
recommendations: allRecommendations,
|
|
116
|
-
merchant_name:
|
|
144
|
+
merchant_name: selectedMerchantName,
|
|
117
145
|
};
|
|
118
146
|
return payload;
|
|
119
147
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalMerchantBasePayload, TenantMerchantPayload } from '../../../entity/globalMerchant/globalMerchantPayload';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
3
|
-
import { VendorReviewViewAllRecommendationsPayload } from '../common/payload/commonTypes';
|
|
3
|
+
import { RecommendedNonExistingGlobalMerchantBasePayload, VendorReviewViewAllRecommendationsPayload } from '../common/payload/commonTypes';
|
|
4
4
|
export interface VendorGlobalReviewPayload extends TenantMerchantPayload {
|
|
5
5
|
recommendations: VendorReviewViewAllRecommendationsPayload;
|
|
6
6
|
}
|
|
@@ -30,7 +30,7 @@ export declare type VendorGlobalReviewViewResponse = ZeniAPIResponse<VendorGloba
|
|
|
30
30
|
export interface ApproveVendorGlobalReviewQueryPayload {
|
|
31
31
|
merchant_type: string;
|
|
32
32
|
tenant_id: string;
|
|
33
|
-
selected_global_merchant: GlobalMerchantBasePayload | null;
|
|
33
|
+
selected_global_merchant: GlobalMerchantBasePayload | RecommendedNonExistingGlobalMerchantBasePayload | null;
|
|
34
34
|
tenant_name: string;
|
|
35
35
|
merchant_name: string;
|
|
36
36
|
recommendations: VendorReviewViewAllRecommendationsPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.36",
|
|
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",
|