@zeniai/client-epic-state 5.0.36-betaRR04 → 5.0.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.
Files changed (65) hide show
  1. package/lib/entity/task/taskPayload.d.ts +0 -1
  2. package/lib/entity/task/taskPayload.js +0 -5
  3. package/lib/entity/task/taskState.d.ts +0 -5
  4. package/lib/entity/task/taskState.js +1 -6
  5. package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
  6. package/lib/entity/tenant/clearAllEpic.js +0 -2
  7. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  8. package/lib/entity/tenant/tenantReducer.d.ts +1 -59
  9. package/lib/entity/tenant/tenantReducer.js +4 -139
  10. package/lib/entity/tenant/tenantState.d.ts +0 -7
  11. package/lib/epic.d.ts +1 -3
  12. package/lib/epic.js +1 -6
  13. package/lib/esm/entity/task/taskPayload.js +1 -6
  14. package/lib/esm/entity/task/taskState.js +0 -3
  15. package/lib/esm/entity/tenant/clearAllEpic.js +0 -2
  16. package/lib/esm/entity/tenant/tenantReducer.js +2 -135
  17. package/lib/esm/epic.js +1 -6
  18. package/lib/esm/index.js +5 -8
  19. package/lib/esm/reducer.js +0 -3
  20. package/lib/esm/view/common/recurringViewHelper.js +0 -17
  21. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -2
  22. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -5
  23. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -1
  24. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -7
  25. package/lib/index.d.ts +5 -9
  26. package/lib/index.js +31 -48
  27. package/lib/reducer.d.ts +0 -3
  28. package/lib/reducer.js +0 -3
  29. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  30. package/lib/view/common/recurringViewHelper.d.ts +2 -3
  31. package/lib/view/common/recurringViewHelper.js +1 -18
  32. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -2
  33. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -5
  34. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -3
  35. package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -1
  36. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -1
  37. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -7
  38. package/package.json +1 -1
  39. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +0 -19
  40. package/lib/entity/tenant/epic/deleteConnectionEpic.js +0 -29
  41. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +0 -19
  42. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -31
  43. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +0 -19
  44. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -33
  45. package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +0 -25
  46. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -27
  47. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -29
  48. package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -23
  49. package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -25
  50. package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +0 -11
  51. package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +0 -106
  52. package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +0 -4
  53. package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +0 -1
  54. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +0 -16
  55. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -27
  56. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +0 -14
  57. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -29
  58. package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +0 -23
  59. package/lib/view/featureNotificationView/featureNotificationViewPayload.js +0 -15
  60. package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +0 -19
  61. package/lib/view/featureNotificationView/featureNotificationViewReducer.js +0 -110
  62. package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +0 -6
  63. package/lib/view/featureNotificationView/featureNotificationViewSelector.js +0 -11
  64. package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +0 -26
  65. package/lib/view/featureNotificationView/featureNotificationViewState.js +0 -2
@@ -1,8 +1,7 @@
1
1
  import { ZeniDate } from '../../zeniDayJS';
2
- export declare const toRecurringFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | "semi_weekly";
3
- export declare const toRecurringFrequencyStrict: (v?: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | "semi_weekly" | undefined;
2
+ export declare const toRecurringFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily";
3
+ export declare const toRecurringFrequencyStrict: (v?: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | undefined;
4
4
  export type RecurringFrequencyType = NonNullable<ReturnType<typeof toRecurringFrequency>>;
5
- export declare const SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
6
5
  declare const toRecurringDatePickerOptions: (v: string) => "date" | "recurringCount";
7
6
  export type RecurringDatePickerOptions = NonNullable<ReturnType<typeof toRecurringDatePickerOptions>>;
8
7
  export declare const getRecurringFrequencyInDays: (frequency: RecurringFrequencyType) => number;
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMinAllowedEndDate = exports.getRecurringEndDateFromCount = exports.getRecurringFrequencyInDays = exports.SEMI_WEEKLY_REQUIRED_DAYS_COUNT = exports.toRecurringFrequencyStrict = exports.toRecurringFrequency = void 0;
3
+ exports.getMinAllowedEndDate = exports.getRecurringEndDateFromCount = exports.getRecurringFrequencyInDays = exports.toRecurringFrequencyStrict = exports.toRecurringFrequency = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  const ALL_RECURRING_FREQUENCY = [
6
6
  'daily',
7
7
  'weekly',
8
8
  'biweekly',
9
- 'semi_weekly',
10
9
  'monthly',
11
10
  'quarterly',
12
11
  ];
@@ -14,7 +13,6 @@ const toRecurringFrequency = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_RE
14
13
  exports.toRecurringFrequency = toRecurringFrequency;
15
14
  const toRecurringFrequencyStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', ALL_RECURRING_FREQUENCY);
16
15
  exports.toRecurringFrequencyStrict = toRecurringFrequencyStrict;
17
- exports.SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
18
16
  const ALL_RECURRING_DATE_PICKER_OPTIONS = ['date', 'recurringCount'];
19
17
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
18
  const toRecurringDatePickerOptions = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_RECURRING_DATE_PICKER_OPTIONS);
@@ -22,8 +20,6 @@ const getRecurringFrequencyInDays = (frequency) => {
22
20
  switch (frequency) {
23
21
  case 'daily':
24
22
  return 1;
25
- case 'semi_weekly':
26
- return 3;
27
23
  case 'weekly':
28
24
  return 7;
29
25
  case 'biweekly':
@@ -45,17 +41,6 @@ const getRecurringEndDateFromCount = (startDate, frequency, recurringCount) => {
45
41
  case 'biweekly':
46
42
  endDate = startDate.add((0, exports.getRecurringFrequencyInDays)(frequency) * (recurringCount - 1), 'day');
47
43
  break;
48
- case 'semi_weekly': {
49
- // Two semi-weekly occurrences span exactly 7 days regardless of which
50
- // two weekdays are picked (since gap1 + gap2 = 7). So odd counts are
51
- // exact; even counts use the conservative half-week step (4 days).
52
- const stepsRemaining = recurringCount - 1;
53
- const fullWeekPairs = Math.floor(stepsRemaining / 2);
54
- const hasOddTailStep = stepsRemaining % 2 === 1;
55
- const days = fullWeekPairs * 7 + (hasOddTailStep ? 4 : 0);
56
- endDate = startDate.add(days, 'day');
57
- break;
58
- }
59
44
  case 'monthly':
60
45
  endDate = startDate.add(recurringCount - 1, 'month');
61
46
  break;
@@ -73,8 +58,6 @@ const getMinAllowedEndDate = (frequency, startDate) => {
73
58
  switch (frequency) {
74
59
  case 'daily':
75
60
  return startDate.add(1, 'day');
76
- case 'semi_weekly':
77
- return startDate.add(3, 'day');
78
61
  case 'weekly':
79
62
  return startDate.add(7, 'day');
80
63
  case 'biweekly':
@@ -18,14 +18,12 @@ const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
18
18
  description: task.description,
19
19
  status: task.status.code,
20
20
  assignee: task.assignees,
21
- groupAssignees: task.groupAssignees,
22
21
  dueDate: task.dueDate,
23
22
  priority: task.priority.code,
24
23
  tagIds: task.tagIds,
25
24
  fileIds: task.fileIds,
26
25
  type: task.type,
27
26
  recurringFrequency: task.recurringFrequency,
28
- recurringDaysOfWeek: task.recurringDaysOfWeek,
29
27
  recurringEndDateLocalData: {
30
28
  recurringDatePickerOptionsType: 'date', // by default, date would be selected
31
29
  recurringEndDate: task.recurringEndDate,
@@ -95,14 +95,9 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
95
95
  recurring_start_date: localData.type.code === 'recurring'
96
96
  ? (localData.recurringStartDate?.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT) ?? null)
97
97
  : null,
98
- recurring_days_of_week: localData.type.code === 'recurring' &&
99
- localData.recurringFrequency === 'semi_weekly'
100
- ? (localData.recurringDaysOfWeek ?? [])
101
- : null,
102
98
  sync_token: syncToken,
103
99
  task_group_ids: taskGroupId != null ? [taskGroupId] : [],
104
100
  time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(localData.timeSpent),
105
- group_assignees: localData.groupAssignees,
106
101
  ...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
107
102
  };
108
103
  };
@@ -1,5 +1,5 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
- import { DayOfWeek, PriorityCodeType, TaskStatusCodeType, TaskType } from '../../../entity/task/taskState';
2
+ import { PriorityCodeType, TaskStatusCodeType, TaskType } from '../../../entity/task/taskState';
3
3
  import { ZeniDate } from '../../../zeniDayJS';
4
4
  import { RecurringDatePickerOptions, RecurringFrequencyType } from '../../common/recurringViewHelper';
5
5
  import { CommonHistoryView } from '../../spendManagement/commonHistoryView/commonHistory';
@@ -21,7 +21,6 @@ export interface EditTaskLocalData {
21
21
  assignee: ID[];
22
22
  description: string;
23
23
  fileIds: ID[];
24
- groupAssignees: ID[];
25
24
  name: string;
26
25
  priority: PriorityCodeType;
27
26
  recurringEndDateLocalData: {
@@ -35,7 +34,6 @@ export interface EditTaskLocalData {
35
34
  type: TaskType;
36
35
  dueDate?: ZeniDate;
37
36
  isPrivate?: boolean;
38
- recurringDaysOfWeek?: DayOfWeek[];
39
37
  recurringFrequency?: RecurringFrequencyType;
40
38
  recurringStartDate?: ZeniDate;
41
39
  savedRecurringEndDate?: ZeniDate;
@@ -6,7 +6,6 @@ exports.initialTaskDetailLocalData = {
6
6
  description: '',
7
7
  status: 'todo',
8
8
  assignee: [],
9
- groupAssignees: [],
10
9
  dueDate: undefined,
11
10
  priority: 'medium',
12
11
  tagIds: [],
@@ -23,7 +23,6 @@ export interface TaskDetailSelectorView extends SelectorView {
23
23
  isDeleted?: boolean;
24
24
  recurringSourceTaskId?: ID;
25
25
  snoozedUntil?: ZeniDate | null;
26
- taskGroupId?: ID;
27
26
  }
28
27
  export declare const getTaskDetail: (state: RootState, taskId?: ID) => TaskDetailSelectorView;
29
28
  export declare const allTaskStatus: TaskStatus[];
@@ -32,7 +32,6 @@ const getTaskDetail = (state, taskId) => {
32
32
  let isDeleted = undefined;
33
33
  let recurringSourceTaskId = undefined;
34
34
  let snoozedUntil = undefined;
35
- let taskGroupId = undefined;
36
35
  if (taskId != null && sourceTaskDetail != null) {
37
36
  const taskEntity = (0, taskSelector_1.getTaskById)(taskState, taskId);
38
37
  const fileIdsInEntity = taskEntity?.fileIds ?? [];
@@ -42,7 +41,6 @@ const getTaskDetail = (state, taskId) => {
42
41
  isDeleted = taskEntity.isDeleted;
43
42
  recurringSourceTaskId = taskEntity.recurringSourceTaskId;
44
43
  snoozedUntil = taskEntity.snoozedUntil;
45
- taskGroupId = taskEntity.taskGroupIds[0];
46
44
  }
47
45
  if (fileIdsInEntity.length > 0) {
48
46
  fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
@@ -95,7 +93,6 @@ const getTaskDetail = (state, taskId) => {
95
93
  recurringSourceTaskId,
96
94
  showTaskDetailFormFooter,
97
95
  snoozedUntil,
98
- taskGroupId,
99
96
  };
100
97
  };
101
98
  exports.getTaskDetail = getTaskDetail;
@@ -150,15 +147,11 @@ const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
150
147
  taskDetailLocalData.status !== taskDetailInStore.status.code ||
151
148
  !(0, isEqual_1.default)(taskDetailInStore.tagIds, taskDetailLocalData.tagIds) ||
152
149
  !(0, isEqual_1.default)(taskDetailLocalData.assignee, taskDetailInStore?.assignees ?? []) ||
153
- !(0, isEqual_1.default)(taskDetailLocalData.groupAssignees, taskDetailInStore?.groupAssignees ?? []) ||
154
150
  !(0, isEqual_1.default)(taskDetailLocalData.fileIds, taskDetailInStore.fileIds ?? []) ||
155
151
  !(0, isEqual_1.default)(taskDetailLocalData.dueDate, taskDetailInStore.dueDate) ||
156
152
  !(0, isEqual_1.default)(taskDetailLocalData.type, taskDetailInStore.type) ||
157
- (taskDetailLocalData.isPrivate ?? false) !==
158
- (taskDetailInStore.isPrivate ?? false) ||
159
153
  !(0, isEqual_1.default)(taskDetailLocalData.savedRecurringEndDate, taskDetailInStore.recurringEndDate) ||
160
154
  !(0, isEqual_1.default)(taskDetailLocalData.recurringFrequency, taskDetailInStore.recurringFrequency) ||
161
- !(0, isEqual_1.default)(taskDetailLocalData.recurringDaysOfWeek, taskDetailInStore.recurringDaysOfWeek) ||
162
155
  !(0, isEqual_1.default)(taskDetailLocalData.recurringStartDate, taskDetailInStore.recurringStartDate) ||
163
156
  !(0, isEqual_1.default)(taskDetailLocalData.timeSpent, taskDetailInStore.timeSpent)) {
164
157
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.36-betaRR04",
3
+ "version": "5.0.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
  "module": "lib/esm/index.js",
@@ -1,19 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { deleteConnection, deleteConnectionFailure, deleteConnectionSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof deleteConnection> | ReturnType<typeof deleteConnectionSuccess> | ReturnType<typeof deleteConnectionFailure>;
6
- export declare const deleteConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- tenantId: string;
9
- connectionId: string;
10
- connectionType: "revenue";
11
- };
12
- type: "tenant/deleteConnectionSuccess";
13
- } | {
14
- payload: {
15
- tenantId: string;
16
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
- };
18
- type: "tenant/deleteConnectionFailure";
19
- }>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteConnectionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- const deleteConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.deleteConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
- .deleteAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, undefined, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
10
- .pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
12
- return (0, rxjs_1.from)([
13
- (0, tenantReducer_1.deleteConnectionSuccess)(action.payload.tenantId, action.payload.connectionId, action.payload.connectionType),
14
- ]);
15
- }
16
- const status = response.status ??
17
- (0, responsePayload_1.createZeniAPIStatus)('Failed to delete connection. Please try again.');
18
- return (0, rxjs_1.from)([
19
- (0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, status),
20
- ]);
21
- }), (0, operators_1.catchError)((error) => {
22
- const message = error instanceof Error
23
- ? error.message
24
- : 'Unexpected error deleting connection.';
25
- return (0, rxjs_1.from)([
26
- (0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
27
- ]);
28
- }))));
29
- exports.deleteConnectionEpic = deleteConnectionEpic;
@@ -1,19 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { saveAPIKeyConnection, saveAPIKeyConnectionFailure, saveAPIKeyConnectionSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof saveAPIKeyConnection> | ReturnType<typeof saveAPIKeyConnectionSuccess> | ReturnType<typeof saveAPIKeyConnectionFailure>;
6
- export declare const saveAPIKeyConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- tenantId: string;
9
- connectionType: "revenue";
10
- connectionPayload: import("../tenantPayload").ConnectionDataPayload;
11
- };
12
- type: "tenant/saveAPIKeyConnectionSuccess";
13
- } | {
14
- payload: {
15
- tenantId: string;
16
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
- };
18
- type: "tenant/saveAPIKeyConnectionFailure";
19
- }>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveAPIKeyConnectionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- const saveAPIKeyConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveAPIKeyConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
10
- api_key: action.payload.credentials.api_key,
11
- connection_name: action.payload.connectionName,
12
- connection_type: action.payload.connectionType,
13
- site: action.payload.credentials.site,
14
- }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
15
- .pipe((0, operators_1.mergeMap)((response) => {
16
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
17
- return (0, rxjs_1.from)([
18
- (0, tenantReducer_1.saveAPIKeyConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
19
- ),
20
- ]);
21
- }
22
- const status = response.status ??
23
- (0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
24
- return (0, rxjs_1.from)([(0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, status)]);
25
- }), (0, operators_1.catchError)((error) => {
26
- const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
27
- return (0, rxjs_1.from)([
28
- (0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
29
- ]);
30
- }))));
31
- exports.saveAPIKeyConnectionEpic = saveAPIKeyConnectionEpic;
@@ -1,19 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { saveOAuthConnection, saveOAuthConnectionFailure, saveOAuthConnectionSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof saveOAuthConnection> | ReturnType<typeof saveOAuthConnectionSuccess> | ReturnType<typeof saveOAuthConnectionFailure>;
6
- export declare const saveOAuthConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- tenantId: string;
9
- connectionType: "revenue";
10
- connectionPayload: import("../tenantPayload").ConnectionDataPayload;
11
- };
12
- type: "tenant/saveOAuthConnectionSuccess";
13
- } | {
14
- payload: {
15
- tenantId: string;
16
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
- };
18
- type: "tenant/saveOAuthConnectionFailure";
19
- }>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveOAuthConnectionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- const saveOAuthConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveOAuthConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
10
- authorization_code: action.payload.credentials.authorization_code,
11
- client_id: action.payload.credentials.client_id,
12
- client_secret: action.payload.credentials.client_secret,
13
- connection_name: action.payload.connectionName,
14
- connection_type: action.payload.connectionType,
15
- redirect_uri: action.payload.credentials.redirect_uri,
16
- }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
17
- .pipe((0, operators_1.mergeMap)((response) => {
18
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
19
- return (0, rxjs_1.from)([
20
- (0, tenantReducer_1.saveOAuthConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
21
- ),
22
- ]);
23
- }
24
- const status = response.status ??
25
- (0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
26
- return (0, rxjs_1.from)([(0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, status)]);
27
- }), (0, operators_1.catchError)((error) => {
28
- const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
29
- return (0, rxjs_1.from)([
30
- (0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
31
- ]);
32
- }))));
33
- exports.saveOAuthConnectionEpic = saveOAuthConnectionEpic;
@@ -1,25 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../responsePayload';
4
- import { deleteConnection, deleteConnectionFailure, deleteConnectionSuccess, } from '../tenantReducer';
5
- export const deleteConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(deleteConnection.match), switchMap((action) => zeniAPI
6
- .deleteAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, undefined, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
7
- .pipe(mergeMap((response) => {
8
- if (isSuccessStatus(response)) {
9
- return from([
10
- deleteConnectionSuccess(action.payload.tenantId, action.payload.connectionId, action.payload.connectionType),
11
- ]);
12
- }
13
- const status = response.status ??
14
- createZeniAPIStatus('Failed to delete connection. Please try again.');
15
- return from([
16
- deleteConnectionFailure(action.payload.tenantId, status),
17
- ]);
18
- }), catchError((error) => {
19
- const message = error instanceof Error
20
- ? error.message
21
- : 'Unexpected error deleting connection.';
22
- return from([
23
- deleteConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
24
- ]);
25
- }))));
@@ -1,27 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { saveAPIKeyConnection, saveAPIKeyConnectionFailure, saveAPIKeyConnectionSuccess, } from '../tenantReducer';
5
- export const saveAPIKeyConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(saveAPIKeyConnection.match), switchMap((action) => zeniAPI
6
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
7
- api_key: action.payload.credentials.api_key,
8
- connection_name: action.payload.connectionName,
9
- connection_type: action.payload.connectionType,
10
- site: action.payload.credentials.site,
11
- }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
12
- .pipe(mergeMap((response) => {
13
- if (isSuccessResponse(response)) {
14
- return from([
15
- saveAPIKeyConnectionSuccess(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
16
- ),
17
- ]);
18
- }
19
- const status = response.status ??
20
- createZeniAPIStatus('Failed to save connection. Please try again.');
21
- return from([saveAPIKeyConnectionFailure(action.payload.tenantId, status)]);
22
- }), catchError((error) => {
23
- const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
24
- return from([
25
- saveAPIKeyConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
26
- ]);
27
- }))));
@@ -1,29 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { saveOAuthConnection, saveOAuthConnectionFailure, saveOAuthConnectionSuccess, } from '../tenantReducer';
5
- export const saveOAuthConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(saveOAuthConnection.match), switchMap((action) => zeniAPI
6
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
7
- authorization_code: action.payload.credentials.authorization_code,
8
- client_id: action.payload.credentials.client_id,
9
- client_secret: action.payload.credentials.client_secret,
10
- connection_name: action.payload.connectionName,
11
- connection_type: action.payload.connectionType,
12
- redirect_uri: action.payload.credentials.redirect_uri,
13
- }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
14
- .pipe(mergeMap((response) => {
15
- if (isSuccessResponse(response)) {
16
- return from([
17
- saveOAuthConnectionSuccess(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
18
- ),
19
- ]);
20
- }
21
- const status = response.status ??
22
- createZeniAPIStatus('Failed to save connection. Please try again.');
23
- return from([saveOAuthConnectionFailure(action.payload.tenantId, status)]);
24
- }), catchError((error) => {
25
- const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
26
- return from([
27
- saveOAuthConnectionFailure(action.payload.tenantId, createZeniAPIStatus(message)),
28
- ]);
29
- }))));
@@ -1,23 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { toFeatureInterest, } from '../featureNotificationViewPayload';
5
- import { fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess, } from '../featureNotificationViewReducer';
6
- export const fetchRegisteredInterestsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchRegisteredInterests.match), switchMap((action) => zeniAPI
7
- .getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests?feature=${encodeURIComponent(action.payload.feature)}`)
8
- .pipe(mergeMap((response) => {
9
- if (isSuccessResponse(response) && response.data != null) {
10
- const interests = response.data.feature_interests.map(toFeatureInterest);
11
- return from([fetchRegisteredInterestsSuccess(interests)]);
12
- }
13
- const status = response.status ??
14
- createZeniAPIStatus('Failed to fetch registered interests. Please try again.');
15
- return from([fetchRegisteredInterestsFailure(status)]);
16
- }), catchError((error) => {
17
- const message = error instanceof Error
18
- ? error.message
19
- : 'Unexpected error fetching registered interests.';
20
- return from([
21
- fetchRegisteredInterestsFailure(createZeniAPIStatus(message)),
22
- ]);
23
- }))));
@@ -1,25 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess, } from '../featureNotificationViewReducer';
5
- export const notifyMeForFeatureEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(notifyMeForFeature.match), switchMap((action) => zeniAPI
6
- .postAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests`, {
7
- additional_info: action.payload.additionalInfo,
8
- email: action.payload.email,
9
- feature: action.payload.feature,
10
- })
11
- .pipe(mergeMap((response) => {
12
- if (isSuccessResponse(response) && response.data != null) {
13
- return from([notifyMeForFeatureSuccess(response.data)]);
14
- }
15
- const status = response.status ??
16
- createZeniAPIStatus('Failed to register interest. Please try again.');
17
- return from([notifyMeForFeatureFailure(status)]);
18
- }), catchError((error) => {
19
- const message = error instanceof Error
20
- ? error.message
21
- : 'Unexpected error registering interest.';
22
- return from([
23
- notifyMeForFeatureFailure(createZeniAPIStatus(message)),
24
- ]);
25
- }))));
@@ -1,11 +0,0 @@
1
- import { date } from '../../zeniDayJS';
2
- export const toFeatureInterest = (payload) => ({
3
- interestId: payload.interest_id,
4
- feature: payload.feature,
5
- notified: payload.notified,
6
- createTime: date(payload.create_time),
7
- updateTime: date(payload.update_time),
8
- additionalInfo: payload.additional_info ?? undefined,
9
- email: payload.email ?? undefined,
10
- notifiedTime: payload.notified_time != null ? date(payload.notified_time) : undefined,
11
- });
@@ -1,106 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- import { toFeatureInterest, } from './featureNotificationViewPayload';
3
- export const initialState = {
4
- fetchRegisteredInterestsState: {
5
- fetchState: 'Not-Started',
6
- error: undefined,
7
- },
8
- notifyMeForFeatureState: {
9
- fetchState: 'Not-Started',
10
- error: undefined,
11
- },
12
- registeredInterests: [],
13
- };
14
- const featureNotificationView = createSlice({
15
- name: 'featureNotificationView',
16
- initialState,
17
- reducers: {
18
- notifyMeForFeature: {
19
- prepare(feature, additionalInfo, email) {
20
- return { payload: { feature, additionalInfo, email } };
21
- },
22
- reducer(draft,
23
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
- _action) {
25
- draft.notifyMeForFeatureState = {
26
- fetchState: 'In-Progress',
27
- error: undefined,
28
- };
29
- },
30
- },
31
- notifyMeForFeatureSuccess: {
32
- prepare(payload) {
33
- return { payload };
34
- },
35
- reducer(draft, action) {
36
- draft.notifyMeForFeatureState = {
37
- fetchState: 'Completed',
38
- error: undefined,
39
- };
40
- const interest = toFeatureInterest(action.payload);
41
- // Idempotent: if a row for this (feature, additional_info) already
42
- // exists in the slice, replace it; otherwise append.
43
- const existingIndex = draft.registeredInterests.findIndex((r) => r.feature === interest.feature &&
44
- r.additionalInfo === interest.additionalInfo);
45
- if (existingIndex >= 0) {
46
- draft.registeredInterests[existingIndex] = interest;
47
- }
48
- else {
49
- draft.registeredInterests.push(interest);
50
- }
51
- },
52
- },
53
- notifyMeForFeatureFailure: {
54
- prepare(status) {
55
- return { payload: { status } };
56
- },
57
- reducer(draft, action) {
58
- draft.notifyMeForFeatureState = {
59
- fetchState: 'Error',
60
- error: action.payload.status,
61
- };
62
- },
63
- },
64
- fetchRegisteredInterests: {
65
- prepare(feature) {
66
- return { payload: { feature } };
67
- },
68
- reducer(draft,
69
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
70
- _action) {
71
- draft.fetchRegisteredInterestsState = {
72
- fetchState: 'In-Progress',
73
- error: undefined,
74
- };
75
- },
76
- },
77
- fetchRegisteredInterestsSuccess: {
78
- prepare(interests) {
79
- return { payload: { interests } };
80
- },
81
- reducer(draft, action) {
82
- draft.fetchRegisteredInterestsState = {
83
- fetchState: 'Completed',
84
- error: undefined,
85
- };
86
- draft.registeredInterests = action.payload.interests;
87
- },
88
- },
89
- fetchRegisteredInterestsFailure: {
90
- prepare(status) {
91
- return { payload: { status } };
92
- },
93
- reducer(draft, action) {
94
- draft.fetchRegisteredInterestsState = {
95
- fetchState: 'Error',
96
- error: action.payload.status,
97
- };
98
- },
99
- },
100
- clearFeatureNotificationView(draft) {
101
- Object.assign(draft, initialState);
102
- },
103
- },
104
- });
105
- export const { clearFeatureNotificationView, fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess, notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess, } = featureNotificationView.actions;
106
- export default featureNotificationView.reducer;
@@ -1,4 +0,0 @@
1
- export const getFeatureNotificationView = (state) => state.featureNotificationViewState;
2
- export const getRegisteredInterests = (state) => state.featureNotificationViewState.registeredInterests;
3
- export const getRegisteredInterestsByFeature = (state, feature) => state.featureNotificationViewState.registeredInterests.filter((interest) => interest.feature === feature);
4
- export const isFeatureInterestRegistered = (state, feature, additionalInfo) => state.featureNotificationViewState.registeredInterests.some((interest) => interest.feature === feature && interest.additionalInfo === additionalInfo);
@@ -1,16 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess } from '../featureNotificationViewReducer';
5
- export type ActionType = ReturnType<typeof fetchRegisteredInterests> | ReturnType<typeof fetchRegisteredInterestsSuccess> | ReturnType<typeof fetchRegisteredInterestsFailure>;
6
- export declare const fetchRegisteredInterestsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- interests: import("../featureNotificationViewState").FeatureInterest[];
9
- };
10
- type: "featureNotificationView/fetchRegisteredInterestsSuccess";
11
- } | {
12
- payload: {
13
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
14
- };
15
- type: "featureNotificationView/fetchRegisteredInterestsFailure";
16
- }>;