@zeniai/client-epic-state 4.8.10 → 4.8.12
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/scheduleView/scheduleListView/scheduleListHelper.js +3 -1
- package/lib/view/vendorReviewView/common/payload/commonTypes.js +10 -15
- package/lib/view/vendorReviewView/common/state/commonTypes.js +9 -11
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js +7 -3
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +3 -4
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.js +4 -4
- package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js +9 -6
- package/package.json +1 -1
|
@@ -197,7 +197,9 @@ const countStatusForDuration = (statusCode) => {
|
|
|
197
197
|
const getDurationOfMonthOutTotalMonth = (jeSchedule) => {
|
|
198
198
|
let totalDurationCompleted = 0;
|
|
199
199
|
const scheduledEntries = jeSchedule.scheduledJournalEntry;
|
|
200
|
-
|
|
200
|
+
const allowedJEScheduleStatus = ['ongoing', 'completed'];
|
|
201
|
+
if (allowedJEScheduleStatus.includes(jeSchedule.status.code) === true &&
|
|
202
|
+
scheduledEntries.length > 0) {
|
|
201
203
|
totalDurationCompleted = scheduledEntries.filter((scheduledEntry) => countStatusForDuration(scheduledEntry.status.code)).length;
|
|
202
204
|
}
|
|
203
205
|
return totalDurationCompleted;
|
|
@@ -4,6 +4,7 @@ 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"));
|
|
7
8
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
9
|
const globalMerchantPayload_1 = require("../../../../entity/globalMerchant/globalMerchantPayload");
|
|
9
10
|
/**
|
|
@@ -68,25 +69,19 @@ const toVendorReviewViewRecommendationPayload = (recommendations, nonExistingRec
|
|
|
68
69
|
global_merchants: recommendationEntities,
|
|
69
70
|
};
|
|
70
71
|
});
|
|
71
|
-
const allRecommendations =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...recommendationsPayload[0].global_merchants,
|
|
75
|
-
...nonExistingRecommendationsPayload[0].global_merchants,
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
];
|
|
72
|
+
const allRecommendations = recommendationsPayload.length > 0
|
|
73
|
+
? recommendationsPayload
|
|
74
|
+
: nonExistingRecommendationsPayload;
|
|
79
75
|
return allRecommendations;
|
|
80
76
|
};
|
|
81
77
|
exports.toVendorReviewViewRecommendationPayload = toVendorReviewViewRecommendationPayload;
|
|
82
78
|
const toGlobalMerchantsBasePayload = (vendorsRecommendationsPayload) => {
|
|
83
|
-
var _a;
|
|
84
|
-
|
|
85
|
-
(_a = vendorsRecommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
79
|
+
var _a, _b;
|
|
80
|
+
let globalMerchantBasePayload = [];
|
|
81
|
+
if (((_b = (_a = vendorsRecommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants[0]) === null || _b === void 0 ? void 0 : _b.global_merchant_id) != null) {
|
|
82
|
+
globalMerchantBasePayload = (0, flatMap_1.default)(vendorsRecommendationsPayload.map((vendorsRecoomendation) => vendorsRecoomendation
|
|
83
|
+
.global_merchants));
|
|
84
|
+
}
|
|
90
85
|
return globalMerchantBasePayload;
|
|
91
86
|
};
|
|
92
87
|
exports.toGlobalMerchantsBasePayload = toGlobalMerchantsBasePayload;
|
|
@@ -67,17 +67,15 @@ const toNonExistingGlobalMerchantBase = (globalMerchantPayload) => {
|
|
|
67
67
|
};
|
|
68
68
|
exports.toNonExistingGlobalMerchantBase = toNonExistingGlobalMerchantBase;
|
|
69
69
|
const toAllRecommendationsFromPayload = (recommendationsPayload) => {
|
|
70
|
-
var _a;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(_a = recommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
});
|
|
70
|
+
var _a, _b;
|
|
71
|
+
let recommendations = [];
|
|
72
|
+
let nonExistingRecommendations = [];
|
|
73
|
+
if (((_b = (_a = recommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants[0]) === null || _b === void 0 ? void 0 : _b.global_merchant_id) != null) {
|
|
74
|
+
recommendations = (0, exports.toRecommendationsFromPayload)(recommendationsPayload);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
nonExistingRecommendations = (0, exports.toNonExistingRecommendationsFromPayload)(recommendationsPayload);
|
|
78
|
+
}
|
|
81
79
|
const recommendationIds = recommendations.map((recommendation) => recommendation.globalMerchantId);
|
|
82
80
|
return {
|
|
83
81
|
recommendationIds,
|
package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js
CHANGED
|
@@ -82,13 +82,17 @@ exports.mapUsersPayloadFromVendorFirstReviewViewResponse = mapUsersPayloadFromVe
|
|
|
82
82
|
const mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse = (vendorsResponse) => {
|
|
83
83
|
const globalMerchantBasePayload = [];
|
|
84
84
|
vendorsResponse.forEach((vendor) => {
|
|
85
|
-
var _a;
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
var _a, _b;
|
|
86
|
+
if (((_b = (_a = vendor.recommendations[0]) === null || _a === void 0 ? void 0 : _a.global_merchants[0]) === null || _b === void 0 ? void 0 : _b.global_merchant_id) != null) {
|
|
87
|
+
mapVendorRecommendationsToGlobalMerchantBasePayload(vendor.recommendations, globalMerchantBasePayload);
|
|
88
|
+
}
|
|
88
89
|
});
|
|
89
90
|
return globalMerchantBasePayload;
|
|
90
91
|
};
|
|
91
92
|
exports.mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse = mapGlobalMerchantsBasePayloadFromVendorFirstReviewViewResponse;
|
|
93
|
+
const mapVendorRecommendationsToGlobalMerchantBasePayload = (recommendations, globalMerchantBasePayload) => {
|
|
94
|
+
recommendations.forEach((recommendation) => mapEntitiesRecommendationsPayloadToGlobalMerchantsBasePayload(recommendation.global_merchants, globalMerchantBasePayload));
|
|
95
|
+
};
|
|
92
96
|
const mapEntitiesRecommendationsPayloadToGlobalMerchantsBasePayload = (entities, globalMerchantBasePayload) => {
|
|
93
97
|
entities.forEach((entity) => globalMerchantBasePayload.push(entity));
|
|
94
98
|
};
|
|
@@ -83,9 +83,8 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
83
83
|
const isRecommendationSelected = selectedGlobalMerchantId != null &&
|
|
84
84
|
(selectedGlobalMerchantId ===
|
|
85
85
|
vendorLocalData.recommendationIds[0] ||
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
((_a = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _a === void 0 ? void 0 : _a.globalMerchantName)));
|
|
86
|
+
selectedGlobalMerchantId ===
|
|
87
|
+
((_a = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _a === void 0 ? void 0 : _a.globalMerchantName));
|
|
89
88
|
const isRetainSelected = selectedGlobalMerchantId != null &&
|
|
90
89
|
selectedGlobalMerchantId === vendorLocalData.vendorId;
|
|
91
90
|
currentSelection =
|
|
@@ -245,7 +244,7 @@ const mapPayloadToVendorFirstReviewView = (payload) => {
|
|
|
245
244
|
},
|
|
246
245
|
currentSelection: null,
|
|
247
246
|
recommendationIds,
|
|
248
|
-
recommendedNonExistingGlobalMerchants: nonExistingRecommendations,
|
|
247
|
+
recommendedNonExistingGlobalMerchants: recommendationIds.length === 0 ? nonExistingRecommendations : [],
|
|
249
248
|
lastUpdatedVendorNameByUserId: (_a = payload.last_updated_vendor_name_by_user) === null || _a === void 0 ? void 0 : _a.user_id,
|
|
250
249
|
};
|
|
251
250
|
};
|
|
@@ -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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
recommendations =
|
|
23
|
+
recommendations.length > 0
|
|
24
|
+
? recommendations
|
|
25
|
+
: vendorLocalData.recommendedNonExistingGlobalMerchants;
|
|
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,12 +71,15 @@ exports.toUsersPayload = toUsersPayload;
|
|
|
71
71
|
const mapGlobalReviewPayloadToGlobalMerchantsBasePayload = (vendorsResponse) => {
|
|
72
72
|
let globalMerchantBasePayload = [];
|
|
73
73
|
vendorsResponse.forEach((vendor) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
var _a, _b;
|
|
75
|
+
if (((_b = (_a = vendor.recommendations[0]) === null || _a === void 0 ? void 0 : _a.global_merchants[0]) === null || _b === void 0 ? void 0 : _b.global_merchant_id) != null) {
|
|
76
|
+
globalMerchantBasePayload = [
|
|
77
|
+
...new Set([
|
|
78
|
+
...globalMerchantBasePayload,
|
|
79
|
+
...(0, commonTypes_1.toGlobalMerchantsBasePayload)(vendor.recommendations),
|
|
80
|
+
]),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
80
83
|
});
|
|
81
84
|
return globalMerchantBasePayload;
|
|
82
85
|
};
|
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.12",
|
|
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",
|