@zeniai/client-epic-state 5.0.36-betaRR05 → 5.0.37
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/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +0 -1
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +1 -2
- package/lib/entity/file/fileState.d.ts +4 -4
- package/lib/entity/file/fileState.js +0 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/entity/task/taskPayload.d.ts +0 -4
- package/lib/entity/task/taskPayload.js +0 -10
- package/lib/entity/task/taskState.d.ts +0 -8
- package/lib/entity/task/taskState.js +1 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -5
- package/lib/entity/tenant/clearAllEpic.js +0 -6
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +1 -59
- package/lib/entity/tenant/tenantReducer.js +4 -139
- package/lib/entity/tenant/tenantState.d.ts +0 -7
- package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +1 -12
- package/lib/esm/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +0 -1
- package/lib/esm/entity/file/fileState.js +0 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/esm/entity/task/taskPayload.js +1 -11
- package/lib/esm/entity/task/taskState.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -6
- package/lib/esm/entity/tenant/tenantReducer.js +2 -135
- package/lib/esm/epic.js +1 -12
- package/lib/esm/index.js +9 -18
- package/lib/esm/init.js +16 -71
- package/lib/esm/reducer.js +0 -9
- package/lib/esm/view/common/recurringViewHelper.js +0 -17
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +7 -60
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +21 -56
- package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -7
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -106
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/lib/index.d.ts +9 -21
- package/lib/index.js +30 -70
- package/lib/init.d.ts +3 -5
- package/lib/init.js +16 -71
- package/lib/reducer.d.ts +0 -9
- package/lib/reducer.js +0 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/common/recurringViewHelper.d.ts +2 -3
- package/lib/view/common/recurringViewHelper.js +1 -18
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -5
- package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -61
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +7 -6
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +22 -56
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -14
- package/lib/view/taskManager/taskListView/taskList.js +1 -8
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -9
- package/lib/view/taskManager/taskListView/taskListReducer.js +13 -107
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
- package/lib/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/package.json +1 -1
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +0 -29
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -31
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -33
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +0 -25
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -27
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -29
- package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -23
- package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -25
- package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +0 -11
- package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +0 -106
- package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +0 -4
- package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponses.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -12
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -64
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -3
- package/lib/esm/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -17
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -21
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -29
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -66
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -57
- package/lib/esm/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -65
- package/lib/esm/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -41
- package/lib/esm/view/zeniOAuthView/zeniOAuthReducer.js +0 -49
- package/lib/esm/view/zeniOAuthView/zeniOAuthSelector.js +0 -3
- package/lib/esm/view/zeniOAuthView/zeniOAuthState.js +0 -1
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +0 -16
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -27
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +0 -14
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -29
- package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +0 -23
- package/lib/view/featureNotificationView/featureNotificationViewPayload.js +0 -15
- package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +0 -19
- package/lib/view/featureNotificationView/featureNotificationViewReducer.js +0 -110
- package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +0 -6
- package/lib/view/featureNotificationView/featureNotificationViewSelector.js +0 -11
- package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +0 -26
- package/lib/view/featureNotificationView/featureNotificationViewState.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.d.ts +0 -19
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.d.ts +0 -21
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -15
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.d.ts +0 -30
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -68
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.d.ts +0 -3
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -6
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -21
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -25
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -33
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -70
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -61
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.d.ts +0 -27
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -69
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.d.ts +0 -16
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -44
- package/lib/view/zeniOAuthView/zeniOAuthReducer.d.ts +0 -29
- package/lib/view/zeniOAuthView/zeniOAuthReducer.js +0 -53
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +0 -5
- package/lib/view/zeniOAuthView/zeniOAuthSelector.js +0 -9
- package/lib/view/zeniOAuthView/zeniOAuthState.d.ts +0 -4
- package/lib/view/zeniOAuthView/zeniOAuthState.js +0 -2
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unsnoozeTaskEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
8
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const taskListReducer_1 = require("../../taskListView/taskListReducer");
|
|
10
|
-
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
11
|
-
const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.unsnoozeTask.match), (0, operators_1.mergeMap)((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
|
|
12
|
-
exports.unsnoozeTaskEpic = unsnoozeTaskEpic;
|
|
13
|
-
const handleUnsnoozeTask = (taskId, zeniAPI) => {
|
|
14
|
-
const unsnoozeTaskApi$ = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`);
|
|
15
|
-
return unsnoozeTaskApi$.pipe((0, operators_1.mergeMap)((response) => handleApiResponse(response, taskId)), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.snoozeTaskSuccessOrFailure)({
|
|
16
|
-
fetchState: 'Error',
|
|
17
|
-
taskId,
|
|
18
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Unsnooze Task REST API call errored out: ' + JSON.stringify(error)),
|
|
19
|
-
}))));
|
|
20
|
-
};
|
|
21
|
-
const handleApiResponse = (response, taskId) => {
|
|
22
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
23
|
-
response.data != null &&
|
|
24
|
-
response.data.tasks.length > 0) {
|
|
25
|
-
const fetchActions = [
|
|
26
|
-
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
27
|
-
(0, taskListReducer_1.removeTaskFromList)(taskId),
|
|
28
|
-
(0, taskListReducer_1.fetchTaskList)(),
|
|
29
|
-
(0, taskDetailReducer_1.snoozeTaskSuccessOrFailure)({
|
|
30
|
-
fetchState: 'Completed',
|
|
31
|
-
taskId,
|
|
32
|
-
}),
|
|
33
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
34
|
-
messageSection: 'unsnooze_task',
|
|
35
|
-
messageText: 'success',
|
|
36
|
-
type: 'success',
|
|
37
|
-
}),
|
|
38
|
-
];
|
|
39
|
-
return (0, rxjs_1.from)(fetchActions);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return (0, rxjs_1.from)([
|
|
43
|
-
(0, taskDetailReducer_1.snoozeTaskSuccessOrFailure)({
|
|
44
|
-
fetchState: 'Error',
|
|
45
|
-
taskId,
|
|
46
|
-
error: response.status,
|
|
47
|
-
}),
|
|
48
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
49
|
-
messageSection: 'unsnooze_task',
|
|
50
|
-
messageText: 'failed',
|
|
51
|
-
type: 'error',
|
|
52
|
-
variables: [
|
|
53
|
-
{
|
|
54
|
-
variableName: '_api-error_',
|
|
55
|
-
variableValue: response.status.message,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
}),
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
3
|
-
import { RootState } from '../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
-
import { approveOAuthConsent, approveOAuthConsentFailure, approveOAuthConsentSuccess } from '../zeniOAuthReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof approveOAuthConsent> | ReturnType<typeof approveOAuthConsentSuccess> | ReturnType<typeof approveOAuthConsentFailure> | ReturnType<typeof openSnackbar>;
|
|
7
|
-
export declare const approveOAuthConsentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
|
-
payload: {
|
|
9
|
-
messageSection: import("../../..").SnackbarMessageSections;
|
|
10
|
-
messageText: import("../../..").SnackbarMessageSectionTexts;
|
|
11
|
-
type: import("../../..").SnackbarMessageType;
|
|
12
|
-
showStatusIcon?: boolean;
|
|
13
|
-
variables?: {
|
|
14
|
-
variableName: string;
|
|
15
|
-
variableValue: string;
|
|
16
|
-
}[];
|
|
17
|
-
};
|
|
18
|
-
type: "snackbar/openSnackbar";
|
|
19
|
-
} | {
|
|
20
|
-
payload: {
|
|
21
|
-
redirectUrl: string;
|
|
22
|
-
};
|
|
23
|
-
type: "zeniOAuthView/approveOAuthConsentSuccess";
|
|
24
|
-
} | {
|
|
25
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
26
|
-
type: "zeniOAuthView/approveOAuthConsentFailure";
|
|
27
|
-
}>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.approveOAuthConsentEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const zeniOAuthReducer_1 = require("../zeniOAuthReducer");
|
|
9
|
-
const failureSnackbar = (reason) => (0, snackbarReducer_1.openSnackbar)({
|
|
10
|
-
messageSection: 'oauth_consent_approve',
|
|
11
|
-
messageText: 'failed',
|
|
12
|
-
type: 'error',
|
|
13
|
-
variables: [{ variableName: '__reason__', variableValue: reason }],
|
|
14
|
-
});
|
|
15
|
-
const approveOAuthConsentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(zeniOAuthReducer_1.approveOAuthConsent.match),
|
|
16
|
-
// `approveOAuthConsent` reducer sets fetchState to In-Progress before epics
|
|
17
|
-
// run, so a guard on In-Progress would block every legitimate request.
|
|
18
|
-
// exhaustMap drops duplicate approve clicks while the HTTP call is in flight.
|
|
19
|
-
(0, operators_1.exhaustMap)((action) => {
|
|
20
|
-
const { userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType, } = action.payload;
|
|
21
|
-
const authHeaders = {
|
|
22
|
-
'zeni-user-id': userId,
|
|
23
|
-
'zeni-tenant-id': tenantId,
|
|
24
|
-
};
|
|
25
|
-
if (zeniSessionId != null) {
|
|
26
|
-
authHeaders['zeni-session-id'] = zeniSessionId;
|
|
27
|
-
}
|
|
28
|
-
return zeniAPI
|
|
29
|
-
.postJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/oauth/authorize/approve`, {
|
|
30
|
-
client_id: clientId,
|
|
31
|
-
redirect_uri: redirectUri,
|
|
32
|
-
code_challenge: codeChallenge,
|
|
33
|
-
code_challenge_method: codeChallengeMethod,
|
|
34
|
-
state,
|
|
35
|
-
response_type: responseType,
|
|
36
|
-
tenant_id: tenantId,
|
|
37
|
-
}, authHeaders)
|
|
38
|
-
.pipe((0, operators_1.concatMap)((response) => (0, rxjs_1.from)(response.json()).pipe((0, operators_1.mergeMap)((responseJson) => {
|
|
39
|
-
if (!response.ok) {
|
|
40
|
-
const errBody = responseJson;
|
|
41
|
-
const errorMessage = errBody?.error ??
|
|
42
|
-
errBody?.message ??
|
|
43
|
-
errBody?.status?.message ??
|
|
44
|
-
`Authorization failed (${response.status})`;
|
|
45
|
-
return (0, rxjs_1.from)([
|
|
46
|
-
(0, zeniOAuthReducer_1.approveOAuthConsentFailure)((0, responsePayload_1.createZeniAPIStatus)(errorMessage)),
|
|
47
|
-
failureSnackbar(errorMessage),
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
const body = responseJson;
|
|
51
|
-
const redirectUrl = body?.redirect_url ?? body?.data?.redirect_url;
|
|
52
|
-
if (redirectUrl == null || redirectUrl === '') {
|
|
53
|
-
const noRedirectMessage = 'No redirect URL returned from authorization server';
|
|
54
|
-
return (0, rxjs_1.from)([
|
|
55
|
-
(0, zeniOAuthReducer_1.approveOAuthConsentFailure)((0, responsePayload_1.createZeniAPIStatus)(noRedirectMessage)),
|
|
56
|
-
failureSnackbar(noRedirectMessage),
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
return (0, rxjs_1.of)((0, zeniOAuthReducer_1.approveOAuthConsentSuccess)({ redirectUrl }));
|
|
60
|
-
}))), (0, operators_1.catchError)((error) => {
|
|
61
|
-
const errorDetail = error instanceof Error ? error.message : JSON.stringify(error);
|
|
62
|
-
const networkErrorMessage = 'OAuth approve request failed: ' + errorDetail;
|
|
63
|
-
return (0, rxjs_1.from)([
|
|
64
|
-
(0, zeniOAuthReducer_1.approveOAuthConsentFailure)((0, responsePayload_1.createZeniAPIStatus)(networkErrorMessage)),
|
|
65
|
-
failureSnackbar(networkErrorMessage),
|
|
66
|
-
]);
|
|
67
|
-
}));
|
|
68
|
-
}));
|
|
69
|
-
exports.approveOAuthConsentEpic = approveOAuthConsentEpic;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface OAuthParams {
|
|
2
|
-
clientId: string;
|
|
3
|
-
codeChallenge: string;
|
|
4
|
-
codeChallengeMethod: string;
|
|
5
|
-
redirectUri: string;
|
|
6
|
-
responseType: string;
|
|
7
|
-
state: string;
|
|
8
|
-
}
|
|
9
|
-
export type ParseOAuthParamsResult = {
|
|
10
|
-
error: null;
|
|
11
|
-
params: OAuthParams;
|
|
12
|
-
} | {
|
|
13
|
-
error: string;
|
|
14
|
-
params: null;
|
|
15
|
-
};
|
|
16
|
-
export declare function parseOAuthParams(search: string): ParseOAuthParamsResult;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseOAuthParams = parseOAuthParams;
|
|
4
|
-
function parseOAuthParams(search) {
|
|
5
|
-
const searchParams = new URLSearchParams(search);
|
|
6
|
-
const clientId = searchParams.get('client_id');
|
|
7
|
-
const redirectUri = searchParams.get('redirect_uri');
|
|
8
|
-
const codeChallenge = searchParams.get('code_challenge');
|
|
9
|
-
const codeChallengeMethod = searchParams.get('code_challenge_method') ?? 'S256';
|
|
10
|
-
const state = searchParams.get('state');
|
|
11
|
-
const responseType = searchParams.get('response_type') ?? 'code';
|
|
12
|
-
if (clientId == null || clientId === '') {
|
|
13
|
-
return { params: null, error: 'Missing client_id parameter' };
|
|
14
|
-
}
|
|
15
|
-
if (redirectUri == null || redirectUri === '') {
|
|
16
|
-
return { params: null, error: 'Missing redirect_uri parameter' };
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
void new URL(redirectUri);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return { params: null, error: 'Invalid redirect_uri parameter' };
|
|
23
|
-
}
|
|
24
|
-
if (codeChallenge == null || codeChallenge === '') {
|
|
25
|
-
return {
|
|
26
|
-
params: null,
|
|
27
|
-
error: 'Missing code_challenge parameter (PKCE required)',
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
if (state == null || state === '') {
|
|
31
|
-
return { params: null, error: 'Missing state parameter' };
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
params: {
|
|
35
|
-
clientId,
|
|
36
|
-
redirectUri,
|
|
37
|
-
codeChallenge,
|
|
38
|
-
codeChallengeMethod,
|
|
39
|
-
state,
|
|
40
|
-
responseType,
|
|
41
|
-
},
|
|
42
|
-
error: null,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import { ZeniOAuthViewState } from './zeniOAuthState';
|
|
3
|
-
export declare const initialState: ZeniOAuthViewState;
|
|
4
|
-
export interface ApproveOAuthConsentPayload {
|
|
5
|
-
clientId: string;
|
|
6
|
-
codeChallenge: string;
|
|
7
|
-
codeChallengeMethod: string;
|
|
8
|
-
redirectUri: string;
|
|
9
|
-
responseType: string;
|
|
10
|
-
state: string;
|
|
11
|
-
tenantId: string;
|
|
12
|
-
userId: string;
|
|
13
|
-
zeniSessionId: string | undefined;
|
|
14
|
-
}
|
|
15
|
-
export declare const approveOAuthConsent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, zeniSessionId: string | undefined, tenantId: string, clientId: string, redirectUri: string, codeChallenge: string, codeChallengeMethod: string, state: string, responseType: string], {
|
|
16
|
-
userId: string;
|
|
17
|
-
zeniSessionId: string | undefined;
|
|
18
|
-
tenantId: string;
|
|
19
|
-
clientId: string;
|
|
20
|
-
redirectUri: string;
|
|
21
|
-
codeChallenge: string;
|
|
22
|
-
codeChallengeMethod: string;
|
|
23
|
-
state: string;
|
|
24
|
-
responseType: string;
|
|
25
|
-
}, "zeniOAuthView/approveOAuthConsent", never, never>, approveOAuthConsentSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
26
|
-
redirectUrl: string;
|
|
27
|
-
}, "zeniOAuthView/approveOAuthConsentSuccess">, approveOAuthConsentFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "zeniOAuthView/approveOAuthConsentFailure">, clearZeniOAuthView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"zeniOAuthView/clearZeniOAuthView">;
|
|
28
|
-
declare const _default: import("redux").Reducer<ZeniOAuthViewState>;
|
|
29
|
-
export default _default;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearZeniOAuthView = exports.approveOAuthConsentFailure = exports.approveOAuthConsentSuccess = exports.approveOAuthConsent = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
exports.initialState = {
|
|
7
|
-
fetchState: 'Not-Started',
|
|
8
|
-
error: undefined,
|
|
9
|
-
approveRedirectUrl: undefined,
|
|
10
|
-
};
|
|
11
|
-
const zeniOAuthView = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'zeniOAuthView',
|
|
13
|
-
initialState: exports.initialState,
|
|
14
|
-
reducers: {
|
|
15
|
-
approveOAuthConsent: {
|
|
16
|
-
prepare(userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType) {
|
|
17
|
-
return {
|
|
18
|
-
payload: {
|
|
19
|
-
userId,
|
|
20
|
-
zeniSessionId,
|
|
21
|
-
tenantId,
|
|
22
|
-
clientId,
|
|
23
|
-
redirectUri,
|
|
24
|
-
codeChallenge,
|
|
25
|
-
codeChallengeMethod,
|
|
26
|
-
state,
|
|
27
|
-
responseType,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
reducer(draft) {
|
|
32
|
-
draft.fetchState = 'In-Progress';
|
|
33
|
-
draft.error = undefined;
|
|
34
|
-
draft.approveRedirectUrl = undefined;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
approveOAuthConsentSuccess(draft, action) {
|
|
38
|
-
draft.fetchState = 'Completed';
|
|
39
|
-
draft.error = undefined;
|
|
40
|
-
draft.approveRedirectUrl = action.payload.redirectUrl;
|
|
41
|
-
},
|
|
42
|
-
approveOAuthConsentFailure(draft, action) {
|
|
43
|
-
draft.fetchState = 'Error';
|
|
44
|
-
draft.error = action.payload;
|
|
45
|
-
draft.approveRedirectUrl = undefined;
|
|
46
|
-
},
|
|
47
|
-
clearZeniOAuthView() {
|
|
48
|
-
return exports.initialState;
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
_a = zeniOAuthView.actions, exports.approveOAuthConsent = _a.approveOAuthConsent, exports.approveOAuthConsentSuccess = _a.approveOAuthConsentSuccess, exports.approveOAuthConsentFailure = _a.approveOAuthConsentFailure, exports.clearZeniOAuthView = _a.clearZeniOAuthView;
|
|
53
|
-
exports.default = zeniOAuthView.reducer;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RootState } from '../../reducer';
|
|
2
|
-
import { FetchState } from '../../commonStateTypes/common';
|
|
3
|
-
export declare const getZeniOAuthApproveFetchState: (state: RootState) => FetchState;
|
|
4
|
-
export declare const getZeniOAuthApproveRedirectUrl: (state: RootState) => string | undefined;
|
|
5
|
-
export declare const getZeniOAuthApproveError: (state: RootState) => string | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getZeniOAuthApproveError = exports.getZeniOAuthApproveRedirectUrl = exports.getZeniOAuthApproveFetchState = void 0;
|
|
4
|
-
const getZeniOAuthApproveFetchState = (state) => state.zeniOAuthViewState.fetchState;
|
|
5
|
-
exports.getZeniOAuthApproveFetchState = getZeniOAuthApproveFetchState;
|
|
6
|
-
const getZeniOAuthApproveRedirectUrl = (state) => state.zeniOAuthViewState.approveRedirectUrl;
|
|
7
|
-
exports.getZeniOAuthApproveRedirectUrl = getZeniOAuthApproveRedirectUrl;
|
|
8
|
-
const getZeniOAuthApproveError = (state) => state.zeniOAuthViewState.error?.message ?? null;
|
|
9
|
-
exports.getZeniOAuthApproveError = getZeniOAuthApproveError;
|