@zeniai/client-epic-state 4.8.6 → 4.8.7
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/epics/fetchScheduleListEpic.js +3 -1
- package/lib/view/vendorReviewView/common/payload/commonTypes.js +7 -7
- 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
|
@@ -24,7 +24,9 @@ const fetchScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
24
24
|
const timePeriod = (0, timeframeTick_1.toTimePeriod)(timeframe);
|
|
25
25
|
const key = (0, scheduleListTypes_1.getScheduleListKey)(action.payload.tab, categoryId, timeframe);
|
|
26
26
|
const draft = scheduleListState.byScheduleListKey[key];
|
|
27
|
-
if (draft != null &&
|
|
27
|
+
if (draft != null &&
|
|
28
|
+
draft.fetchState === 'Completed' &&
|
|
29
|
+
action.payload.cacheOverride === false) {
|
|
28
30
|
return (0, rxjs_1.from)([]);
|
|
29
31
|
}
|
|
30
32
|
const scheduleListCurrentTabAccountTypes = (0, scheduleListHelper_1.getAccountsTypesForSchedulePayload)(scheduleListState.currentTab).allowedAccountList;
|
|
@@ -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
|
/**
|
|
@@ -75,13 +76,12 @@ const toVendorReviewViewRecommendationPayload = (recommendations, nonExistingRec
|
|
|
75
76
|
};
|
|
76
77
|
exports.toVendorReviewViewRecommendationPayload = toVendorReviewViewRecommendationPayload;
|
|
77
78
|
const toGlobalMerchantsBasePayload = (vendorsRecommendationsPayload) => {
|
|
78
|
-
var _a;
|
|
79
|
-
|
|
80
|
-
(_a = vendorsRecommendationsPayload[0]) === null || _a === void 0 ? void 0 : _a.global_merchants.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
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
|
+
}
|
|
85
85
|
return globalMerchantBasePayload;
|
|
86
86
|
};
|
|
87
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.7",
|
|
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",
|