cloudmr-ux 2.0.6 → 3.0.1
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/README.md +24 -24
- package/dist/CmrComponents/CmrButton/CmrButton.css +0 -0
- package/dist/CmrComponents/CmrButton/CmrButton.d.ts +4 -0
- package/dist/CmrComponents/CmrButton/CmrButton.js +30 -0
- package/dist/CmrComponents/CmrButton/index.d.ts +1 -0
- package/dist/CmrComponents/CmrButton/index.js +1 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.css +29 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.d.ts +14 -0
- package/dist/CmrComponents/CmrCheckbox/CmrCheckbox.js +30 -0
- package/dist/CmrComponents/CmrCheckbox/index.d.ts +1 -0
- package/dist/CmrComponents/CmrCheckbox/index.js +1 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.d.ts +8 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.js +29 -0
- package/dist/CmrComponents/CmrColorPicker/CmrColorPicker.scss +27 -0
- package/dist/CmrComponents/CmrInput/CmrInput.css +27 -0
- package/dist/CmrComponents/CmrInput/CmrInput.d.ts +17 -0
- package/dist/CmrComponents/CmrInput/CmrInput.js +29 -0
- package/dist/CmrComponents/CmrInput/index.d.ts +1 -0
- package/dist/CmrComponents/CmrInput/index.js +1 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.css +25 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.d.ts +15 -0
- package/dist/CmrComponents/CmrRadioGroup/CmrRadioGroup.js +37 -0
- package/dist/CmrComponents/CmrRadioGroup/index.d.ts +1 -0
- package/dist/CmrComponents/CmrRadioGroup/index.js +1 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.css +1 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.d.ts +24 -0
- package/dist/CmrComponents/CmrSelect/CmrSelect.js +46 -0
- package/dist/CmrComponents/CmrSelect/index.d.ts +1 -0
- package/dist/CmrComponents/CmrSelect/index.js +1 -0
- package/dist/CmrComponents/checkbox/Checkbox.css +8 -0
- package/dist/CmrComponents/checkbox/Checkbox.d.ts +15 -0
- package/dist/CmrComponents/checkbox/Checkbox.js +25 -0
- package/dist/CmrComponents/collapse/Collapse.css +3 -0
- package/dist/CmrComponents/collapse/Collapse.d.ts +18 -0
- package/dist/CmrComponents/collapse/Collapse.js +87 -0
- package/dist/CmrComponents/dialogue/Confirmation.d.ts +20 -0
- package/dist/CmrComponents/dialogue/Confirmation.js +36 -0
- package/dist/CmrComponents/dialogue/DeletionDialog.d.ts +4 -0
- package/dist/CmrComponents/dialogue/DeletionDialog.js +39 -0
- package/dist/CmrComponents/dialogue/EditConfirmation.d.ts +13 -0
- package/dist/CmrComponents/dialogue/EditConfirmation.js +45 -0
- package/dist/CmrComponents/double-slider/DualSlider.d.ts +21 -0
- package/dist/CmrComponents/double-slider/DualSlider.js +152 -0
- package/dist/CmrComponents/double-slider/InvertibleDualSlider.d.ts +24 -0
- package/dist/CmrComponents/double-slider/InvertibleDualSlider.js +174 -0
- package/dist/CmrComponents/gui-slider/ControlledSlider.d.ts +9 -0
- package/dist/CmrComponents/gui-slider/ControlledSlider.js +96 -0
- package/dist/CmrComponents/gui-slider/Slider.d.ts +20 -0
- package/dist/CmrComponents/gui-slider/Slider.js +127 -0
- package/dist/CmrComponents/header/Header.d.ts +17 -0
- package/dist/CmrComponents/header/Header.js +90 -0
- package/dist/CmrComponents/header/Header.scss +32 -0
- package/dist/CmrComponents/input-number/InputNumber.css +0 -0
- package/dist/CmrComponents/input-number/InputNumber.d.ts +17 -0
- package/dist/CmrComponents/input-number/InputNumber.js +30 -0
- package/dist/CmrComponents/label/Label.css +13 -0
- package/dist/CmrComponents/label/Label.d.ts +9 -0
- package/dist/CmrComponents/label/Label.js +18 -0
- package/dist/CmrComponents/panel/Panel.css +5 -0
- package/dist/CmrComponents/panel/Panel.d.ts +12 -0
- package/dist/CmrComponents/panel/Panel.js +42 -0
- package/dist/CmrComponents/rename/edit.d.ts +7 -0
- package/dist/CmrComponents/rename/edit.js +117 -0
- package/dist/CmrComponents/select-upload/SelectUpload.css +26 -0
- package/dist/CmrComponents/select-upload/SelectUpload.d.ts +33 -0
- package/dist/CmrComponents/select-upload/SelectUpload.js +90 -0
- package/dist/CmrComponents/tk-dualrange/TKDualRange.d.ts +17 -0
- package/dist/CmrComponents/tk-dualrange/TKDualRange.js +65 -0
- package/dist/CmrComponents/tk-dualrange/tk-dual-range.css +140 -0
- package/dist/CmrComponents/tooltip/Tooltip.css +0 -0
- package/dist/CmrComponents/tooltip/Tooltip.d.ts +18 -0
- package/dist/CmrComponents/tooltip/Tooltip.js +30 -0
- package/dist/CmrComponents/upload/Upload.css +5 -0
- package/dist/CmrComponents/upload/Upload.d.ts +80 -0
- package/dist/CmrComponents/upload/Upload.js +185 -0
- package/dist/CmrComponents/upload/UploadWindow.d.ts +15 -0
- package/dist/CmrComponents/upload/UploadWindow.js +286 -0
- package/dist/CmrTable/CmrTable.css +26 -0
- package/dist/CmrTable/CmrTable.d.ts +13 -0
- package/dist/CmrTable/CmrTable.js +47 -0
- package/dist/CmrTabs/CmrTabs.d.ts +7 -0
- package/dist/CmrTabs/CmrTabs.js +64 -0
- package/dist/CmrTabs/tab.model.d.ts +12 -0
- package/dist/CmrTabs/tab.model.js +1 -0
- package/dist/core/app/main/Main.d.ts +6 -0
- package/dist/core/app/main/Main.js +18 -0
- package/dist/core/app/results/Logs.d.ts +1 -0
- package/dist/core/app/results/Logs.js +33 -0
- package/dist/core/app/results/PreprocessJob.d.ts +1 -0
- package/dist/core/app/results/PreprocessJob.js +100 -0
- package/dist/core/app/results/Results.d.ts +15 -0
- package/dist/core/app/results/Results.js +372 -0
- package/dist/core/app/results/Results.scss +92 -0
- package/dist/core/app/results/Rois.d.ts +11 -0
- package/dist/core/app/results/Rois.js +269 -0
- package/dist/core/app/settings/Settings.d.ts +1 -0
- package/dist/core/app/settings/Settings.js +109 -0
- package/dist/core/app/signin/ForgotPassword.d.ts +3 -0
- package/dist/core/app/signin/ForgotPassword.js +142 -0
- package/dist/core/app/signin/Register.d.ts +3 -0
- package/dist/core/app/signin/Register.js +126 -0
- package/dist/core/app/signin/Signin.d.ts +5 -0
- package/dist/core/app/signin/Signin.js +84 -0
- package/dist/core/app/signin/Signin.scss +86 -0
- package/dist/core/app/upload/Upload.d.ts +3 -0
- package/dist/core/app/upload/Upload.js +261 -0
- package/dist/core/app/upload/Upload.scss +0 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.d.ts +8 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.js +29 -0
- package/dist/core/common/components/CmrColorPicker/CmrColorPicker.scss +27 -0
- package/dist/core/common/components/NiivueTools/Niivue.css +8 -0
- package/dist/core/common/components/NiivueTools/Niivue.d.ts +14 -0
- package/dist/core/common/components/NiivueTools/Niivue.js +1270 -0
- package/dist/core/common/components/NiivueTools/NiivuePatcher.js +1875 -0
- package/dist/core/common/components/NiivueTools/components/ColorPicker.d.ts +5 -0
- package/dist/core/common/components/NiivueTools/components/ColorPicker.js +68 -0
- package/dist/core/common/components/NiivueTools/components/DrawPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/DrawPlatte.js +88 -0
- package/dist/core/common/components/NiivueTools/components/DrawToolKit.d.ts +32 -0
- package/dist/core/common/components/NiivueTools/components/DrawToolKit.js +164 -0
- package/dist/core/common/components/NiivueTools/components/EraserPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/EraserPlatte.js +43 -0
- package/dist/core/common/components/NiivueTools/components/Layer.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/Layer.js +117 -0
- package/dist/core/common/components/NiivueTools/components/LayersPanel.d.ts +8 -0
- package/dist/core/common/components/NiivueTools/components/LayersPanel.js +108 -0
- package/dist/core/common/components/NiivueTools/components/LocationTable.d.ts +9 -0
- package/dist/core/common/components/NiivueTools/components/LocationTable.js +42 -0
- package/dist/core/common/components/NiivueTools/components/MaskPlatte.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/MaskPlatte.js +123 -0
- package/dist/core/common/components/NiivueTools/components/NiivuePanel.d.ts +34 -0
- package/dist/core/common/components/NiivueTools/components/NiivuePanel.js +305 -0
- package/dist/core/common/components/NiivueTools/components/NumberPicker.d.ts +8 -0
- package/dist/core/common/components/NiivueTools/components/NumberPicker.js +40 -0
- package/dist/core/common/components/NiivueTools/components/SettingsPanel.d.ts +7 -0
- package/dist/core/common/components/NiivueTools/components/SettingsPanel.js +30 -0
- package/dist/core/common/components/NiivueTools/components/Switch.d.ts +5 -0
- package/dist/core/common/components/NiivueTools/components/Switch.js +26 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.d.ts +40 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.js +184 -0
- package/dist/core/common/components/NiivueTools/components/Toolbar.scss +39 -0
- package/dist/core/common/components/NiivueTools/components/stats.d.ts +2 -0
- package/dist/core/common/components/NiivueTools/components/stats.js +13 -0
- package/dist/core/common/components/NiivueTools/index.css +14 -0
- package/dist/core/common/components/NiivueTools/util.js +309 -0
- package/dist/core/common/components/footer/Footer.d.ts +3 -0
- package/dist/core/common/components/footer/Footer.js +20 -0
- package/dist/core/common/components/footer/Footer.scss +5 -0
- package/dist/core/common/utilities/AuthenticatedRequests.d.ts +16 -0
- package/dist/core/common/utilities/AuthenticatedRequests.js +158 -0
- package/dist/core/common/utilities/CalendarHelper.d.ts +5 -0
- package/dist/core/common/utilities/CalendarHelper.js +27 -0
- package/dist/core/common/utilities/DownloadFromText.d.ts +3 -0
- package/dist/core/common/utilities/DownloadFromText.js +20 -0
- package/dist/core/common/utilities/StoreToRequest.d.ts +1 -0
- package/dist/core/common/utilities/StoreToRequest.js +4 -0
- package/dist/core/common/utilities/SystemUtilities.d.ts +4 -0
- package/dist/core/common/utilities/SystemUtilities.js +79 -0
- package/dist/core/common/utilities/file-transformation/anonymize.d.ts +1 -0
- package/dist/core/common/utilities/file-transformation/anonymize.js +114 -0
- package/dist/core/common/utilities/file-transformation/utilities.d.ts +2 -0
- package/dist/core/common/utilities/file-transformation/utilities.js +23 -0
- package/dist/core/common/utilities/index.d.ts +25 -0
- package/dist/core/common/utilities/index.js +118 -0
- package/dist/core/common/utilities/parse-jwt.d.ts +1 -0
- package/dist/core/common/utilities/parse-jwt.js +14 -0
- package/dist/core/components/PasswordRequirements.d.ts +7 -0
- package/dist/core/components/PasswordRequirements.js +30 -0
- package/dist/core/config/AppConfig.d.ts +5 -0
- package/dist/core/config/AppConfig.js +42 -0
- package/dist/core/config/types.d.ts +40 -0
- package/dist/core/config/types.js +1 -0
- package/dist/core/features/authenticate/authenticateActionCreation.d.ts +46 -0
- package/dist/core/features/authenticate/authenticateActionCreation.js +326 -0
- package/dist/core/features/authenticate/authenticateSlice.d.ts +45 -0
- package/dist/core/features/authenticate/authenticateSlice.js +203 -0
- package/dist/core/features/data/dataActionCreation.d.ts +40 -0
- package/dist/core/features/data/dataActionCreation.js +340 -0
- package/dist/core/features/data/dataSlice.d.ts +37 -0
- package/dist/core/features/data/dataSlice.js +87 -0
- package/dist/core/features/jobs/jobActionCreation.d.ts +35 -0
- package/dist/core/features/jobs/jobActionCreation.js +242 -0
- package/dist/core/features/jobs/jobsSlice.d.ts +57 -0
- package/dist/core/features/jobs/jobsSlice.js +54 -0
- package/dist/core/features/rois/resultActionCreation.d.ts +21 -0
- package/dist/core/features/rois/resultActionCreation.js +114 -0
- package/dist/core/features/rois/resultSlice.d.ts +24 -0
- package/dist/core/features/rois/resultSlice.js +68 -0
- package/dist/core/features/rois/roiTypes.d.ts +44 -0
- package/dist/core/features/rois/roiTypes.js +1 -0
- package/dist/core/features/setup/setupActionCreation.d.ts +7 -0
- package/dist/core/features/setup/setupActionCreation.js +100 -0
- package/dist/core/index.d.ts +22 -0
- package/dist/core/index.js +27 -0
- package/dist/core/store/configureStore.d.ts +13 -0
- package/dist/core/store/configureStore.js +38 -0
- package/dist/core/store/hooks.d.ts +11 -0
- package/dist/core/store/hooks.js +5 -0
- package/dist/core/utils/passwordValidation.d.ts +25 -0
- package/dist/core/utils/passwordValidation.js +19 -0
- package/dist/index.d.ts +29 -329
- package/dist/index.js +26 -1402
- package/dist/style.css +47 -0
- package/package.json +309 -41
- package/dist/index.css +0 -170
- package/dist/index.mjs +0 -1354
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import axios from "axios";
|
|
38
|
+
import { createAsyncThunk } from "@reduxjs/toolkit";
|
|
39
|
+
import { getAppConfig, getEndpoints } from "../../config/AppConfig";
|
|
40
|
+
import { AuthenticatedHttpClient } from "../../common/utilities/AuthenticatedRequests";
|
|
41
|
+
export var registerUser = createAsyncThunk("REGISTER", function (registerData, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var endpoints, response, error_1;
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
return __generator(this, function (_e) {
|
|
45
|
+
switch (_e.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
endpoints = getEndpoints();
|
|
48
|
+
_e.label = 1;
|
|
49
|
+
case 1:
|
|
50
|
+
_e.trys.push([1, 3, , 4]);
|
|
51
|
+
return [4 /*yield*/, axios.post(endpoints.REGISTER, registerData)];
|
|
52
|
+
case 2:
|
|
53
|
+
response = _e.sent();
|
|
54
|
+
return [2 /*return*/, response.data];
|
|
55
|
+
case 3:
|
|
56
|
+
error_1 = _e.sent();
|
|
57
|
+
console.error(error_1);
|
|
58
|
+
return [2 /*return*/, thunkAPI.rejectWithValue({
|
|
59
|
+
message: ((_b = (_a = error_1.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || error_1.message,
|
|
60
|
+
status: (_c = error_1.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
61
|
+
data: (_d = error_1.response) === null || _d === void 0 ? void 0 : _d.data
|
|
62
|
+
})];
|
|
63
|
+
case 4: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); });
|
|
67
|
+
export var changePassword = createAsyncThunk("CHANGE_PASSWORD", function (passwordData, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var endpoints, response, error_2;
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
return __generator(this, function (_e) {
|
|
71
|
+
switch (_e.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
endpoints = getEndpoints();
|
|
74
|
+
_e.label = 1;
|
|
75
|
+
case 1:
|
|
76
|
+
_e.trys.push([1, 3, , 4]);
|
|
77
|
+
return [4 /*yield*/, AuthenticatedHttpClient.request({
|
|
78
|
+
method: "POST",
|
|
79
|
+
url: endpoints.CHANGE_PASSWORD,
|
|
80
|
+
data: passwordData
|
|
81
|
+
})];
|
|
82
|
+
case 2:
|
|
83
|
+
response = _e.sent();
|
|
84
|
+
return [2 /*return*/, response.data];
|
|
85
|
+
case 3:
|
|
86
|
+
error_2 = _e.sent();
|
|
87
|
+
console.error(error_2);
|
|
88
|
+
return [2 /*return*/, thunkAPI.rejectWithValue({
|
|
89
|
+
message: ((_b = (_a = error_2.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || error_2.message,
|
|
90
|
+
status: (_c = error_2.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
91
|
+
data: (_d = error_2.response) === null || _d === void 0 ? void 0 : _d.data
|
|
92
|
+
})];
|
|
93
|
+
case 4: return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); });
|
|
97
|
+
export var forgotPassword = createAsyncThunk("FORGOT_PASSWORD", function (forgotData, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
+
var endpoints, response, error_3;
|
|
99
|
+
var _a, _b, _c, _d;
|
|
100
|
+
return __generator(this, function (_e) {
|
|
101
|
+
switch (_e.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
endpoints = getEndpoints();
|
|
104
|
+
_e.label = 1;
|
|
105
|
+
case 1:
|
|
106
|
+
_e.trys.push([1, 3, , 4]);
|
|
107
|
+
return [4 /*yield*/, axios.post(endpoints.FORGOT_PASSWORD, forgotData)];
|
|
108
|
+
case 2:
|
|
109
|
+
response = _e.sent();
|
|
110
|
+
return [2 /*return*/, response.data];
|
|
111
|
+
case 3:
|
|
112
|
+
error_3 = _e.sent();
|
|
113
|
+
console.error(error_3);
|
|
114
|
+
return [2 /*return*/, thunkAPI.rejectWithValue({
|
|
115
|
+
message: ((_b = (_a = error_3.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || error_3.message,
|
|
116
|
+
status: (_c = error_3.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
117
|
+
data: (_d = error_3.response) === null || _d === void 0 ? void 0 : _d.data
|
|
118
|
+
})];
|
|
119
|
+
case 4: return [2 /*return*/];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); });
|
|
123
|
+
export var resetPassword = createAsyncThunk("RESET_PASSWORD", function (resetData, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var endpoints, response, error_4;
|
|
125
|
+
var _a, _b, _c, _d;
|
|
126
|
+
return __generator(this, function (_e) {
|
|
127
|
+
switch (_e.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
endpoints = getEndpoints();
|
|
130
|
+
_e.label = 1;
|
|
131
|
+
case 1:
|
|
132
|
+
_e.trys.push([1, 3, , 4]);
|
|
133
|
+
return [4 /*yield*/, axios.post(endpoints.RESET_PASSWORD, resetData)];
|
|
134
|
+
case 2:
|
|
135
|
+
response = _e.sent();
|
|
136
|
+
return [2 /*return*/, response.data];
|
|
137
|
+
case 3:
|
|
138
|
+
error_4 = _e.sent();
|
|
139
|
+
console.error(error_4);
|
|
140
|
+
return [2 /*return*/, thunkAPI.rejectWithValue({
|
|
141
|
+
message: ((_b = (_a = error_4.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || error_4.message,
|
|
142
|
+
status: (_c = error_4.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
143
|
+
data: (_d = error_4.response) === null || _d === void 0 ? void 0 : _d.data
|
|
144
|
+
})];
|
|
145
|
+
case 4: return [2 /*return*/];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}); });
|
|
149
|
+
export var getLoggedInToken = createAsyncThunk("SIGN_IN", function (signinData, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
150
|
+
var endpoints, response, error_5, result;
|
|
151
|
+
var _a, _b, _c, _d;
|
|
152
|
+
return __generator(this, function (_e) {
|
|
153
|
+
switch (_e.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
endpoints = getEndpoints();
|
|
156
|
+
_e.label = 1;
|
|
157
|
+
case 1:
|
|
158
|
+
_e.trys.push([1, 3, , 4]);
|
|
159
|
+
if (!axios.post) {
|
|
160
|
+
console.error("Axios.post does not exist, axios is", axios);
|
|
161
|
+
console.error("axios keys:", Object.keys(axios));
|
|
162
|
+
console.error("axios.default?", axios["default"]);
|
|
163
|
+
console.error("axios.default keys?", axios["default"] ? Object.keys(axios["default"]) : "N/A");
|
|
164
|
+
}
|
|
165
|
+
return [4 /*yield*/, axios.post(endpoints.SIGNIN, signinData)];
|
|
166
|
+
case 2:
|
|
167
|
+
response = _e.sent();
|
|
168
|
+
return [3 /*break*/, 4];
|
|
169
|
+
case 3:
|
|
170
|
+
error_5 = _e.sent();
|
|
171
|
+
console.error(error_5);
|
|
172
|
+
return [2 /*return*/, thunkAPI.rejectWithValue({
|
|
173
|
+
message: ((_b = (_a = error_5.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || error_5.message,
|
|
174
|
+
status: (_c = error_5.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
175
|
+
data: (_d = error_5.response) === null || _d === void 0 ? void 0 : _d.data
|
|
176
|
+
})];
|
|
177
|
+
case 4:
|
|
178
|
+
result = Object.assign(signinData, response.data);
|
|
179
|
+
thunkAPI.dispatch(getProfile(result.access_token));
|
|
180
|
+
return [2 /*return*/, result];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}); });
|
|
184
|
+
export var signOut = createAsyncThunk("SIGN_OUT", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
// const endpoints = getEndpoints();
|
|
187
|
+
// const response = await axios.post(endpoints.SIGNOUT, null, config);
|
|
188
|
+
// return response.data;
|
|
189
|
+
return [2 /*return*/, { message: "Successfully logged out" }];
|
|
190
|
+
});
|
|
191
|
+
}); });
|
|
192
|
+
export var getFineGrainToken = createAsyncThunk("FINE_GRAIN", function (_a) {
|
|
193
|
+
var accessToken = _a.accessToken, categories = _a.categories;
|
|
194
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
195
|
+
var config, endpoints, defaultCategories, response, e_1;
|
|
196
|
+
return __generator(this, function (_b) {
|
|
197
|
+
switch (_b.label) {
|
|
198
|
+
case 0:
|
|
199
|
+
config = getAppConfig();
|
|
200
|
+
endpoints = getEndpoints();
|
|
201
|
+
defaultCategories = {
|
|
202
|
+
app: config.APP_NAME,
|
|
203
|
+
activities: ["queue", "upload"]
|
|
204
|
+
};
|
|
205
|
+
if (!config.API_URL)
|
|
206
|
+
return [2 /*return*/];
|
|
207
|
+
_b.label = 1;
|
|
208
|
+
case 1:
|
|
209
|
+
_b.trys.push([1, 3, , 4]);
|
|
210
|
+
return [4 /*yield*/, axios.post(config.API_URL, categories || defaultCategories, {
|
|
211
|
+
headers: {
|
|
212
|
+
Authorization: "Bearer ".concat(accessToken)
|
|
213
|
+
}
|
|
214
|
+
})];
|
|
215
|
+
case 2:
|
|
216
|
+
response = _b.sent();
|
|
217
|
+
return [2 /*return*/, response.data];
|
|
218
|
+
case 3:
|
|
219
|
+
e_1 = _b.sent();
|
|
220
|
+
return [2 /*return*/, undefined];
|
|
221
|
+
case 4: return [2 /*return*/];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
export var webSignin = createAsyncThunk("WEB_SIGN_IN", function (accessToken, thunkAPI) { return __awaiter(void 0, void 0, void 0, function () {
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
// Import getUpstreamJobs dynamically to avoid circular dependency
|
|
229
|
+
// thunkAPI.dispatch(getUpstreamJobs());
|
|
230
|
+
if (accessToken !== undefined) {
|
|
231
|
+
thunkAPI.dispatch(getProfile(accessToken));
|
|
232
|
+
}
|
|
233
|
+
return [2 /*return*/, {
|
|
234
|
+
access_token: accessToken,
|
|
235
|
+
token_type: "bearer",
|
|
236
|
+
expires_in: "1440"
|
|
237
|
+
}];
|
|
238
|
+
});
|
|
239
|
+
}); });
|
|
240
|
+
export var getProfile = createAsyncThunk("GET_PROFILE", function (accessToken) { return __awaiter(void 0, void 0, void 0, function () {
|
|
241
|
+
var endpoints, config, response, e_2;
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
switch (_a.label) {
|
|
244
|
+
case 0:
|
|
245
|
+
endpoints = getEndpoints();
|
|
246
|
+
config = getAppConfig();
|
|
247
|
+
_a.label = 1;
|
|
248
|
+
case 1:
|
|
249
|
+
_a.trys.push([1, 3, , 4]);
|
|
250
|
+
return [4 /*yield*/, axios.get(endpoints.PROFILE, {
|
|
251
|
+
headers: {
|
|
252
|
+
Authorization: "Bearer ".concat(accessToken)
|
|
253
|
+
},
|
|
254
|
+
timeout: config.REQUESTS_TIMEOUT || 5000
|
|
255
|
+
})];
|
|
256
|
+
case 2:
|
|
257
|
+
response = _a.sent();
|
|
258
|
+
if (response.data[0] === "<") {
|
|
259
|
+
return [2 /*return*/, { error: "user not recognized" }];
|
|
260
|
+
}
|
|
261
|
+
return [2 /*return*/, response.data];
|
|
262
|
+
case 3:
|
|
263
|
+
e_2 = _a.sent();
|
|
264
|
+
return [2 /*return*/, undefined];
|
|
265
|
+
case 4: return [2 /*return*/];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}); });
|
|
269
|
+
var runningPromise = null;
|
|
270
|
+
export var refreshAccessToken = createAsyncThunk("REFRESH_ACCESS_TOKEN", function (refresh_token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
271
|
+
var endpoints, parseResult, _a, data, _b, error_6;
|
|
272
|
+
var _c;
|
|
273
|
+
return __generator(this, function (_d) {
|
|
274
|
+
switch (_d.label) {
|
|
275
|
+
case 0:
|
|
276
|
+
endpoints = getEndpoints();
|
|
277
|
+
parseResult = function (response) {
|
|
278
|
+
return {
|
|
279
|
+
refreshToken: response.data.refresh_token || refresh_token,
|
|
280
|
+
accessToken: response.data.access_token,
|
|
281
|
+
idToken: response.data.id_token,
|
|
282
|
+
tokenType: "bearer",
|
|
283
|
+
expiresIn: response.data.expires_in,
|
|
284
|
+
parsedToken: parseJwt(response.data.id_token)
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
if (!runningPromise) return [3 /*break*/, 2];
|
|
288
|
+
_a = parseResult;
|
|
289
|
+
return [4 /*yield*/, runningPromise];
|
|
290
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_d.sent()])];
|
|
291
|
+
case 2:
|
|
292
|
+
data = {
|
|
293
|
+
refresh_token: refresh_token
|
|
294
|
+
};
|
|
295
|
+
if (!endpoints.REFRESH_TOKEN) {
|
|
296
|
+
throw new Error("Refresh token endpoint not configured");
|
|
297
|
+
}
|
|
298
|
+
runningPromise = axios.post(endpoints.REFRESH_TOKEN, data);
|
|
299
|
+
_d.label = 3;
|
|
300
|
+
case 3:
|
|
301
|
+
_d.trys.push([3, 5, 6, 7]);
|
|
302
|
+
_b = parseResult;
|
|
303
|
+
return [4 /*yield*/, runningPromise];
|
|
304
|
+
case 4: return [2 /*return*/, _b.apply(void 0, [_d.sent()])];
|
|
305
|
+
case 5:
|
|
306
|
+
error_6 = _d.sent();
|
|
307
|
+
if (axios.isAxiosError(error_6)) {
|
|
308
|
+
console.error("Token refresh failed:", ((_c = error_6.response) === null || _c === void 0 ? void 0 : _c.data) || error_6.message);
|
|
309
|
+
}
|
|
310
|
+
throw error_6;
|
|
311
|
+
case 6:
|
|
312
|
+
runningPromise = null;
|
|
313
|
+
return [7 /*endfinally*/];
|
|
314
|
+
case 7: return [2 /*return*/];
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}); });
|
|
318
|
+
// Helper function for JWT parsing
|
|
319
|
+
function parseJwt(token) {
|
|
320
|
+
try {
|
|
321
|
+
return JSON.parse(atob(token.split(".")[1]));
|
|
322
|
+
}
|
|
323
|
+
catch (e) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
export interface AuthenticateToken {
|
|
3
|
+
idToken: string;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
tokenType: string;
|
|
7
|
+
expiresIn: number;
|
|
8
|
+
parsedToken: any;
|
|
9
|
+
}
|
|
10
|
+
export interface AuthenticateState {
|
|
11
|
+
id?: string;
|
|
12
|
+
email: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
status?: string;
|
|
15
|
+
level?: string;
|
|
16
|
+
isAdmin?: boolean;
|
|
17
|
+
logged_in_token?: AuthenticateToken;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
uploadToken: string;
|
|
20
|
+
queueToken: string;
|
|
21
|
+
accessToken: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
registerSuccess?: boolean;
|
|
24
|
+
changePasswordSuccess?: boolean;
|
|
25
|
+
forgotPasswordSuccess?: boolean;
|
|
26
|
+
resetPasswordSuccess?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const authenticateSlice: import("@reduxjs/toolkit").Slice<AuthenticateState, {
|
|
29
|
+
setInitialTokens: (state: import("immer").WritableDraft<AuthenticateState>, action: PayloadAction<{
|
|
30
|
+
uploadToken: string;
|
|
31
|
+
queueToken: string;
|
|
32
|
+
}>) => void;
|
|
33
|
+
resetAuth: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
34
|
+
clearError: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
35
|
+
clearRegisterSuccess: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
36
|
+
clearChangePasswordSuccess: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
37
|
+
clearForgotPasswordSuccess: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
38
|
+
clearResetPasswordSuccess: (state: import("immer").WritableDraft<AuthenticateState>) => void;
|
|
39
|
+
}, "authenticate", "authenticate", import("@reduxjs/toolkit").SliceSelectors<AuthenticateState>>;
|
|
40
|
+
export declare const setInitialTokens: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
41
|
+
uploadToken: string;
|
|
42
|
+
queueToken: string;
|
|
43
|
+
}, "authenticate/setInitialTokens">, resetAuth: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/resetAuth">, clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/clearError">, clearRegisterSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/clearRegisterSuccess">, clearChangePasswordSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/clearChangePasswordSuccess">, clearForgotPasswordSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/clearForgotPasswordSuccess">, clearResetPasswordSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"authenticate/clearResetPasswordSuccess">;
|
|
44
|
+
declare const _default: import("redux").Reducer<AuthenticateState, import("redux").UnknownAction, AuthenticateState>;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { getLoggedInToken, refreshAccessToken, getProfile, signOut, registerUser, changePassword, forgotPassword, resetPassword } from './authenticateActionCreation';
|
|
4
|
+
import { getUploadedData } from '../data/dataActionCreation';
|
|
5
|
+
var initialState = {
|
|
6
|
+
email: '',
|
|
7
|
+
loading: false,
|
|
8
|
+
uploadToken: '',
|
|
9
|
+
queueToken: '',
|
|
10
|
+
accessToken: ''
|
|
11
|
+
};
|
|
12
|
+
export var authenticateSlice = createSlice({
|
|
13
|
+
name: 'authenticate',
|
|
14
|
+
initialState: initialState,
|
|
15
|
+
reducers: {
|
|
16
|
+
// Add action to set initial tokens from config
|
|
17
|
+
setInitialTokens: function (state, action) {
|
|
18
|
+
state.uploadToken = action.payload.uploadToken;
|
|
19
|
+
state.queueToken = action.payload.queueToken;
|
|
20
|
+
},
|
|
21
|
+
resetAuth: function (state) {
|
|
22
|
+
state.email = "";
|
|
23
|
+
state.logged_in_token = undefined;
|
|
24
|
+
state.accessToken = "";
|
|
25
|
+
state.loading = false;
|
|
26
|
+
state.error = undefined;
|
|
27
|
+
state.registerSuccess = undefined;
|
|
28
|
+
},
|
|
29
|
+
clearError: function (state) {
|
|
30
|
+
state.error = undefined;
|
|
31
|
+
},
|
|
32
|
+
clearRegisterSuccess: function (state) {
|
|
33
|
+
state.registerSuccess = undefined;
|
|
34
|
+
},
|
|
35
|
+
clearChangePasswordSuccess: function (state) {
|
|
36
|
+
state.changePasswordSuccess = undefined;
|
|
37
|
+
},
|
|
38
|
+
clearForgotPasswordSuccess: function (state) {
|
|
39
|
+
state.forgotPasswordSuccess = undefined;
|
|
40
|
+
},
|
|
41
|
+
clearResetPasswordSuccess: function (state) {
|
|
42
|
+
state.resetPasswordSuccess = undefined;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
extraReducers: function (builder) { return (builder.addCase('persist/REHYDRATE', function (state, action) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
var authenticate = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.authenticate;
|
|
48
|
+
if (authenticate) {
|
|
49
|
+
state.email = authenticate.email;
|
|
50
|
+
state.logged_in_token = authenticate.logged_in_token;
|
|
51
|
+
state.accessToken = ((_b = authenticate.logged_in_token) === null || _b === void 0 ? void 0 : _b.accessToken) || "";
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
builder.addCase(registerUser.pending, function (state, action) {
|
|
55
|
+
state.loading = true;
|
|
56
|
+
state.error = undefined;
|
|
57
|
+
state.registerSuccess = undefined;
|
|
58
|
+
}),
|
|
59
|
+
builder.addCase(registerUser.fulfilled, function (state, action) {
|
|
60
|
+
state.loading = false;
|
|
61
|
+
state.registerSuccess = true;
|
|
62
|
+
state.error = undefined;
|
|
63
|
+
}),
|
|
64
|
+
builder.addCase(registerUser.rejected, function (state, action) {
|
|
65
|
+
state.loading = false;
|
|
66
|
+
state.registerSuccess = false;
|
|
67
|
+
var payload = action.payload;
|
|
68
|
+
state.error = (payload === null || payload === void 0 ? void 0 : payload.message) || "Registration failed";
|
|
69
|
+
}),
|
|
70
|
+
builder.addCase(getLoggedInToken.pending, function (state, action) {
|
|
71
|
+
state.loading = true;
|
|
72
|
+
state.error = undefined;
|
|
73
|
+
}),
|
|
74
|
+
builder.addCase(getLoggedInToken.fulfilled, function (state, action) {
|
|
75
|
+
var _a = action.payload, email = _a.email, id_token = _a.id_token, access_token = _a.access_token, refresh_token = _a.refresh_token, token_type = _a.token_type, expires_in = _a.expires_in;
|
|
76
|
+
state.logged_in_token = {
|
|
77
|
+
idToken: id_token,
|
|
78
|
+
accessToken: access_token,
|
|
79
|
+
refreshToken: refresh_token,
|
|
80
|
+
tokenType: token_type,
|
|
81
|
+
expiresIn: expires_in,
|
|
82
|
+
parsedToken: parseJwt(id_token)
|
|
83
|
+
};
|
|
84
|
+
console.log("logged in token", parseJwt(id_token));
|
|
85
|
+
state.email = email;
|
|
86
|
+
state.accessToken = access_token;
|
|
87
|
+
state.loading = false;
|
|
88
|
+
state.error = undefined;
|
|
89
|
+
}),
|
|
90
|
+
builder.addCase(getLoggedInToken.rejected, function (state, action) {
|
|
91
|
+
state.loading = false;
|
|
92
|
+
var payload = action.payload;
|
|
93
|
+
state.error = (payload === null || payload === void 0 ? void 0 : payload.message) || "Sign in failed";
|
|
94
|
+
}),
|
|
95
|
+
builder.addCase(refreshAccessToken.fulfilled, function (state, action) {
|
|
96
|
+
console.log("refreshed token", action.payload.parsedToken);
|
|
97
|
+
state.logged_in_token = action.payload;
|
|
98
|
+
state.accessToken = action.payload.accessToken;
|
|
99
|
+
}),
|
|
100
|
+
builder.addCase(signOut.pending, function (state, action) {
|
|
101
|
+
state.loading = true;
|
|
102
|
+
}),
|
|
103
|
+
builder.addCase(signOut.fulfilled, function (state, action) {
|
|
104
|
+
var message = action.payload.message;
|
|
105
|
+
if (message === "Successfully logged out") {
|
|
106
|
+
state.email = "";
|
|
107
|
+
state.logged_in_token = undefined;
|
|
108
|
+
state.accessToken = "";
|
|
109
|
+
state.loading = false;
|
|
110
|
+
}
|
|
111
|
+
}),
|
|
112
|
+
builder.addCase(getUploadedData.pending, function (state, action) {
|
|
113
|
+
state.loading = true;
|
|
114
|
+
}),
|
|
115
|
+
builder.addCase(getUploadedData.fulfilled, function (state, action) {
|
|
116
|
+
var payloadData = action.payload;
|
|
117
|
+
if (payloadData === undefined || payloadData.error === 'user not recognized') {
|
|
118
|
+
state.logged_in_token = undefined;
|
|
119
|
+
state.accessToken = "";
|
|
120
|
+
state.loading = false;
|
|
121
|
+
}
|
|
122
|
+
state.loading = false;
|
|
123
|
+
}),
|
|
124
|
+
builder.addCase(getProfile.fulfilled, function (state, action) {
|
|
125
|
+
var payloadData = action.payload;
|
|
126
|
+
if (payloadData === undefined || payloadData.error === 'user not recognized') {
|
|
127
|
+
state.logged_in_token = undefined;
|
|
128
|
+
state.accessToken = "";
|
|
129
|
+
state.loading = false;
|
|
130
|
+
// Reset to default tokens
|
|
131
|
+
state.uploadToken = '';
|
|
132
|
+
state.queueToken = '';
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
state.email = payloadData.email;
|
|
136
|
+
state.level = payloadData.level;
|
|
137
|
+
state.status = payloadData.status;
|
|
138
|
+
state.username = payloadData.username;
|
|
139
|
+
state.isAdmin = payloadData.isAdmin;
|
|
140
|
+
}
|
|
141
|
+
state.loading = false;
|
|
142
|
+
}),
|
|
143
|
+
builder.addCase(changePassword.pending, function (state, action) {
|
|
144
|
+
state.loading = true;
|
|
145
|
+
state.error = undefined;
|
|
146
|
+
state.changePasswordSuccess = undefined;
|
|
147
|
+
}),
|
|
148
|
+
builder.addCase(changePassword.fulfilled, function (state, action) {
|
|
149
|
+
state.loading = false;
|
|
150
|
+
state.changePasswordSuccess = true;
|
|
151
|
+
state.error = undefined;
|
|
152
|
+
}),
|
|
153
|
+
builder.addCase(changePassword.rejected, function (state, action) {
|
|
154
|
+
state.loading = false;
|
|
155
|
+
state.changePasswordSuccess = false;
|
|
156
|
+
var payload = action.payload;
|
|
157
|
+
state.error = (payload === null || payload === void 0 ? void 0 : payload.message) || "Failed to change password";
|
|
158
|
+
}),
|
|
159
|
+
builder.addCase(forgotPassword.pending, function (state, action) {
|
|
160
|
+
state.loading = true;
|
|
161
|
+
state.error = undefined;
|
|
162
|
+
state.forgotPasswordSuccess = undefined;
|
|
163
|
+
}),
|
|
164
|
+
builder.addCase(forgotPassword.fulfilled, function (state, action) {
|
|
165
|
+
state.loading = false;
|
|
166
|
+
state.forgotPasswordSuccess = true;
|
|
167
|
+
state.error = undefined;
|
|
168
|
+
}),
|
|
169
|
+
builder.addCase(forgotPassword.rejected, function (state, action) {
|
|
170
|
+
state.loading = false;
|
|
171
|
+
state.forgotPasswordSuccess = false;
|
|
172
|
+
var payload = action.payload;
|
|
173
|
+
state.error = (payload === null || payload === void 0 ? void 0 : payload.message) || "Failed to send reset code";
|
|
174
|
+
}),
|
|
175
|
+
builder.addCase(resetPassword.pending, function (state, action) {
|
|
176
|
+
state.loading = true;
|
|
177
|
+
state.error = undefined;
|
|
178
|
+
state.resetPasswordSuccess = undefined;
|
|
179
|
+
}),
|
|
180
|
+
builder.addCase(resetPassword.fulfilled, function (state, action) {
|
|
181
|
+
state.loading = false;
|
|
182
|
+
state.resetPasswordSuccess = true;
|
|
183
|
+
state.error = undefined;
|
|
184
|
+
}),
|
|
185
|
+
builder.addCase(resetPassword.rejected, function (state, action) {
|
|
186
|
+
state.loading = false;
|
|
187
|
+
state.resetPasswordSuccess = false;
|
|
188
|
+
var payload = action.payload;
|
|
189
|
+
state.error = (payload === null || payload === void 0 ? void 0 : payload.message) || "Failed to reset password";
|
|
190
|
+
})); }
|
|
191
|
+
});
|
|
192
|
+
// Export actions
|
|
193
|
+
export var setInitialTokens = (_a = authenticateSlice.actions, _a.setInitialTokens), resetAuth = _a.resetAuth, clearError = _a.clearError, clearRegisterSuccess = _a.clearRegisterSuccess, clearChangePasswordSuccess = _a.clearChangePasswordSuccess, clearForgotPasswordSuccess = _a.clearForgotPasswordSuccess, clearResetPasswordSuccess = _a.clearResetPasswordSuccess;
|
|
194
|
+
// Helper function for JWT parsing
|
|
195
|
+
function parseJwt(token) {
|
|
196
|
+
try {
|
|
197
|
+
return JSON.parse(atob(token.split('.')[1]));
|
|
198
|
+
}
|
|
199
|
+
catch (e) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export default authenticateSlice.reducer;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
export interface LambdaFile {
|
|
3
|
+
filename: string;
|
|
4
|
+
filetype: string;
|
|
5
|
+
filesize: string;
|
|
6
|
+
filemd5: string;
|
|
7
|
+
file: {
|
|
8
|
+
lastModified: number;
|
|
9
|
+
name: string;
|
|
10
|
+
size: number;
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const getUploadedData: import("@reduxjs/toolkit").AsyncThunk<any, void, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
15
|
+
export declare const renameUploadedData: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
16
|
+
fileId: number;
|
|
17
|
+
newName: string;
|
|
18
|
+
is_demo_data?: boolean | undefined;
|
|
19
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
20
|
+
export declare const deleteUploadedData: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
21
|
+
fileId: number;
|
|
22
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|
|
23
|
+
export declare const uploadData: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
|
+
code: number;
|
|
25
|
+
response: any;
|
|
26
|
+
file: LambdaFile;
|
|
27
|
+
uploadTarget: string | undefined;
|
|
28
|
+
} | {
|
|
29
|
+
code: number;
|
|
30
|
+
response: any;
|
|
31
|
+
file: undefined;
|
|
32
|
+
uploadTarget: string | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
uploadToken: string;
|
|
35
|
+
file: File;
|
|
36
|
+
fileAlias: string;
|
|
37
|
+
onProgress?: ((progress: number) => void) | undefined;
|
|
38
|
+
uploadTarget?: string | undefined;
|
|
39
|
+
onUploaded?: ((res: AxiosResponse, file: File) => void) | undefined;
|
|
40
|
+
}, import("@reduxjs/toolkit").AsyncThunkConfig>;
|