@zeniai/client-epic-state 4.10.30 → 4.10.32

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.
@@ -8,7 +8,7 @@ const notificationViewReducer_1 = require("../notificationViewReducer");
8
8
  const userReducer_1 = require("../../../entity/user/userReducer");
9
9
  const notificationReducer_1 = require("../../../entity/notification/notificationReducer");
10
10
  const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.fetchNotificationView.match), (0, operators_1.switchMap)((action) => {
11
- const { notificationGroup, mode, status } = action.payload;
11
+ const { notificationGroup, mode, status, isNewNotificationFetch } = action.payload;
12
12
  const { stateByTab } = state$.value.notificationViewState;
13
13
  const notificationTab = (0, notificationViewReducer_1.toNotificationTab)(notificationGroup);
14
14
  const notificationTabState = stateByTab[notificationTab];
@@ -18,7 +18,9 @@ const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
18
18
  is_paginated: true,
19
19
  limit: 10,
20
20
  mode,
21
- page_token: notificationTabState.uiState.pageToken,
21
+ page_token: isNewNotificationFetch
22
+ ? null
23
+ : notificationTabState.uiState.pageToken,
22
24
  };
23
25
  return zeniAPI
24
26
  .getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -35,7 +37,7 @@ const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
35
37
  const actions = [
36
38
  (0, userReducer_1.updateAllUsers)({ users: allUniqueUsers, updateType: 'merge' }),
37
39
  (0, notificationReducer_1.updateAllNotifications)(notifications, 'replace'),
38
- (0, notificationViewReducer_1.fetchNotificationViewSuccess)(notifications, total_count, notificationGroup, next_page_token),
40
+ (0, notificationViewReducer_1.fetchNotificationViewSuccess)(notifications, total_count, notificationGroup, isNewNotificationFetch ? null : next_page_token),
39
41
  ];
40
42
  return actions;
41
43
  }
@@ -4,10 +4,11 @@ import { NotificationTabState, NotificationTabType, NotificationViewState, Notif
4
4
  import { NotificationGroup } from '../../entity/notification/types/notificationTypes';
5
5
  import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
6
6
  export declare const initialState: NotificationViewState;
7
- export declare const fetchNotificationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined, status?: ("unread" | "read")[] | undefined], {
7
+ export declare const fetchNotificationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined, status?: ("unread" | "read")[] | undefined, isNewNotificationFetch?: boolean | undefined], {
8
8
  notificationGroup: "task_manager";
9
9
  mode: "dashboard" | "email";
10
10
  status: ("unread" | "read")[];
11
+ isNewNotificationFetch: boolean;
11
12
  }, string, never, never>, fetchNotificationViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notifications: NotificationPayload[], totalCount: number, notificationGroup: "task_manager", pageToken: PageToken], {
12
13
  notifications: NotificationPayload[];
13
14
  totalCount: number;
@@ -79,12 +79,13 @@ const notificationView = (0, toolkit_1.createSlice)({
79
79
  draft.stateByTab[notificationTab].fetchState = 'In-Progress';
80
80
  draft.stateByTab[notificationTab].error = undefined;
81
81
  },
82
- prepare(notificationGroup, mode = 'dashboard', status = ['read', 'unread']) {
82
+ prepare(notificationGroup, mode = 'dashboard', status = ['read', 'unread'], isNewNotificationFetch) {
83
83
  return {
84
84
  payload: {
85
85
  notificationGroup,
86
86
  mode,
87
87
  status,
88
+ isNewNotificationFetch: isNewNotificationFetch !== null && isNewNotificationFetch !== void 0 ? isNewNotificationFetch : false,
88
89
  },
89
90
  };
90
91
  },
@@ -107,7 +108,9 @@ const notificationView = (0, toolkit_1.createSlice)({
107
108
  draft.stateByTab[notificationTab].uiState.hasMore = false;
108
109
  }
109
110
  draft.stateByTab[notificationTab].uiState.totalCount = totalCount;
110
- draft.stateByTab[notificationTab].uiState.pageToken = pageToken;
111
+ if (pageToken != null) {
112
+ draft.stateByTab[notificationTab].uiState.pageToken = pageToken;
113
+ }
111
114
  draft.stateByTab[notificationTab].fetchState = 'Completed';
112
115
  draft.stateByTab[notificationTab].error = undefined;
113
116
  },
@@ -71,7 +71,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
71
71
  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 });
72
72
  },
73
73
  updateVendorFirstReviewViewLocalData(draft, action) {
74
- var _a, _b;
74
+ var _a, _b, _c;
75
75
  const { vendorId, vendorRenamedText, selectedGlobalMerchantId, currentSelection, } = action.payload;
76
76
  if (draft.vendorFirstReviewViewLocalDataById[vendorId]
77
77
  .vendorFirstReviewViewLocalData != null) {
@@ -106,8 +106,7 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
106
106
  }
107
107
  else {
108
108
  updateSelectedGlobalMerchantId =
109
- (_b = vendorLocalData.recommendationIds[0]) !== null && _b !== void 0 ? _b : vendorLocalData.recommendedNonExistingGlobalMerchants[0]
110
- .globalMerchantName;
109
+ (_b = vendorLocalData.recommendationIds[0]) !== null && _b !== void 0 ? _b : (_c = vendorLocalData.recommendedNonExistingGlobalMerchants[0]) === null || _c === void 0 ? void 0 : _c.globalMerchantName;
111
110
  }
112
111
  draft.vendorFirstReviewViewLocalDataById[vendorId].vendorFirstReviewViewLocalData = Object.assign(Object.assign({}, vendorLocalData), { vendorRenamedText: undefined, selectedVendorId: updateSelectedGlobalMerchantId, currentSelection: isRetainSelected
113
112
  ? 'retain'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.30",
3
+ "version": "4.10.32",
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",