@zeniai/client-epic-state 4.8.4 → 4.8.6
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/payload/commonTypes.js +7 -7
- package/lib/view/vendorReviewView/common/state/commonTypes.js +11 -9
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js +3 -7
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +4 -3
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.js +4 -4
- package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js +6 -9
- package/package.json +1 -1
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.toGlobalMerchantsBasePayload = exports.toVendorReviewViewRecommendationPayload = exports.toNonExistingRecommendationGlobalMerchantBasePayload = exports.toUserPayload = void 0;
|
|
7
|
-
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
8
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
9
8
|
const globalMerchantPayload_1 = require("../../../../entity/globalMerchant/globalMerchantPayload");
|
|
10
9
|
/**
|
|
@@ -76,12 +75,13 @@ const toVendorReviewViewRecommendationPayload = (recommendations, nonExistingRec
|
|
|
76
75
|
};
|
|
77
76
|
exports.toVendorReviewViewRecommendationPayload = toVendorReviewViewRecommendationPayload;
|
|
78
77
|
const toGlobalMerchantsBasePayload = (vendorsRecommendationsPayload) => {
|
|
79
|
-
var _a
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.
|
|
84
|
-
|
|
78
|
+
var _a;
|
|
79
|
+
const globalMerchantBasePayload = [];
|
|
80
|
+
(_a = vendorsRecommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.forEach((globalMerchantPayload) => {
|
|
81
|
+
if (globalMerchantPayload.global_merchant_id != null) {
|
|
82
|
+
globalMerchantBasePayload.push(globalMerchantPayload);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
85
|
return globalMerchantBasePayload;
|
|
86
86
|
};
|
|
87
87
|
exports.toGlobalMerchantsBasePayload = toGlobalMerchantsBasePayload;
|
|
@@ -67,15 +67,17 @@ const toNonExistingGlobalMerchantBase = (globalMerchantPayload) => {
|
|
|
67
67
|
};
|
|
68
68
|
exports.toNonExistingGlobalMerchantBase = toNonExistingGlobalMerchantBase;
|
|
69
69
|
const toAllRecommendationsFromPayload = (recommendationsPayload) => {
|
|
70
|
-
var _a
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
const recommendations = [];
|
|
72
|
+
const nonExistingRecommendations = [];
|
|
73
|
+
(_a = recommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.forEach((globalmerchant) => {
|
|
74
|
+
if (globalmerchant.global_merchant_id != null) {
|
|
75
|
+
recommendations.push((0, globalMerchantPayload_1.toGlobalMerchantBase)(globalmerchant));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
nonExistingRecommendations.push((0, exports.toNonExistingGlobalMerchantBase)(globalmerchant));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
79
81
|
const recommendationIds = recommendations.map((recommendation) => recommendation.globalMerchantId);
|
|
80
82
|
return {
|
|
81
83
|
recommendationIds,
|
package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js
CHANGED
|
@@ -82,17 +82,13 @@ exports.mapUsersPayloadFromVendorFirstReviewViewResponse = mapUsersPayloadFromVe
|
|
|
82
82
|
const mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse = (vendorsResponse) => {
|
|
83
83
|
const globalMerchantBasePayload = [];
|
|
84
84
|
vendorsResponse.forEach((vendor) => {
|
|
85
|
-
var _a
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
85
|
+
var _a;
|
|
86
|
+
const existingMerchants = (_a = vendor.recommendations[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.filter((merchant) => merchant.global_merchant_id != null);
|
|
87
|
+
mapEntitiesRecommendationsPayloadToGlobalMerchantsBasePayload(existingMerchants, globalMerchantBasePayload);
|
|
89
88
|
});
|
|
90
89
|
return globalMerchantBasePayload;
|
|
91
90
|
};
|
|
92
91
|
exports.mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse = mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse;
|
|
93
|
-
const mapVendorRecommendationsToGlobalMerchantBasePayload = (recommendations, globalMerchantBasePayload) => {
|
|
94
|
-
recommendations.forEach((recommendation) => mapEntitiesRecommendationsPayloadToGlobalMerchantsBasePayload(recommendation.global_merchants, globalMerchantBasePayload));
|
|
95
|
-
};
|
|
96
92
|
const mapEntitiesRecommendationsPayloadToGlobalMerchantsBasePayload = (entities, globalMerchantBasePayload) => {
|
|
97
93
|
entities.forEach((entity) => globalMerchantBasePayload.push(entity));
|
|
98
94
|
};
|
|
@@ -83,8 +83,9 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
83
83
|
const isRecommendationSelected = selectedGlobalMerchantId != null &&
|
|
84
84
|
(selectedGlobalMerchantId ===
|
|
85
85
|
vendorLocalData.recommendationIds[0] ||
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
(vendorLocalData.recommendationIds.length === 0 &&
|
|
87
|
+
selectedGlobalMerchantId ===
|
|
88
|
+
((_a = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _a === void 0 ? void 0 : _a.globalMerchantName)));
|
|
88
89
|
const isRetainSelected = selectedGlobalMerchantId != null &&
|
|
89
90
|
selectedGlobalMerchantId === vendorLocalData.vendorId;
|
|
90
91
|
currentSelection =
|
|
@@ -244,7 +245,7 @@ const mapPayloadToVendorFirstReviewView = (payload) => {
|
|
|
244
245
|
},
|
|
245
246
|
currentSelection: null,
|
|
246
247
|
recommendationIds,
|
|
247
|
-
recommendedNonExistingGlobalMerchants:
|
|
248
|
+
recommendedNonExistingGlobalMerchants: nonExistingRecommendations,
|
|
248
249
|
lastUpdatedVendorNameByUserId: (_a = payload.last_updated_vendor_name_by_user) === null || _a === void 0 ? void 0 : _a.user_id,
|
|
249
250
|
};
|
|
250
251
|
};
|
|
@@ -19,10 +19,10 @@ const getVendorFirstReviewView = (state) => {
|
|
|
19
19
|
const currentVendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorLocalData.vendorId);
|
|
20
20
|
const users = (0, userSelector_1.getUsersByUserIds)(userState, userIds);
|
|
21
21
|
let recommendations = (0, globalMerchantSelector_1.getGlobalMerchantsByMerchantIds)(globalMerchantState, vendorLocalData.recommendationIds);
|
|
22
|
-
recommendations =
|
|
23
|
-
recommendations
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
recommendations = [
|
|
23
|
+
...recommendations,
|
|
24
|
+
...vendorLocalData.recommendedNonExistingGlobalMerchants,
|
|
25
|
+
];
|
|
26
26
|
let selectedVendor;
|
|
27
27
|
const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorLocalData.selectedVendorId);
|
|
28
28
|
if (vendor != null) {
|
package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js
CHANGED
|
@@ -71,15 +71,12 @@ exports.toUsersPayload = toUsersPayload;
|
|
|
71
71
|
const mapGlobalReviewPayloadToGlobalMerchantsBasePayload = (vendorsResponse) => {
|
|
72
72
|
let globalMerchantBasePayload = [];
|
|
73
73
|
vendorsResponse.forEach((vendor) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]),
|
|
81
|
-
];
|
|
82
|
-
}
|
|
74
|
+
globalMerchantBasePayload = [
|
|
75
|
+
...new Set([
|
|
76
|
+
...globalMerchantBasePayload,
|
|
77
|
+
...(0, commonTypes_1.toGlobalMerchantsBasePayload)(vendor.recommendations),
|
|
78
|
+
]),
|
|
79
|
+
];
|
|
83
80
|
});
|
|
84
81
|
return globalMerchantBasePayload;
|
|
85
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.6",
|
|
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",
|