UNPKG

cspace-ui

Version:
139 lines (107 loc) 12.8 MB
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["cspaceUI"] = factory(); else root["cspaceUI"] = factory(); })(self, () => { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./src/actions/account.js": /*!********************************!*\ !*** ./src/actions/account.js ***! \********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ checkForRoleUses: () => (/* binding */ checkForRoleUses),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ readAccountPerms: () => (/* binding */ readAccountPerms),\n/* harmony export */ readAccountRoles: () => (/* binding */ readAccountRoles),\n/* harmony export */ requestPasswordReset: () => (/* binding */ requestPasswordReset),\n/* harmony export */ resetPassword: () => (/* binding */ resetPassword)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n/* global btoa */\n\n\n\n\n\nconst checkForRoleUses = csid => () => (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().read(`authorization/roles/${csid}/accountroles`).then(response => {\n const account = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(response, ['data', 'ns2:account_role', 'account']);\n return !!account;\n});\nconst readAccountPerms = config => dispatch => (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().read('accounts/0/accountperms').then(response => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ACCOUNT_PERMS_READ_FULFILLED,\n payload: response,\n meta: {\n config\n }\n})).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ACCOUNT_PERMS_READ_REJECTED,\n payload: error\n });\n return Promise.reject(error);\n});\nconst readAccountRoles = () => (dispatch, getState) => {\n const accountId = (0,_reducers__WEBPACK_IMPORTED_MODULE_2__.getUserAccountId)(getState());\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().read(`accounts/${accountId}/accountroles`).then(response => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ACCOUNT_ROLES_READ_FULFILLED,\n payload: response\n })).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ACCOUNT_ROLES_READ_REJECTED,\n payload: error\n });\n return Promise.reject(error);\n });\n};\nconst requestPasswordReset = (email, tenantId) => () => {\n const config = {\n params: {\n email,\n tid: tenantId\n }\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().create('accounts/requestpasswordreset', config);\n};\nconst resetPassword = (password, token) => () => {\n const config = {\n data: {\n 'ns2:passwordreset': {\n '@xmlns:ns2': 'http://collectionspace.org/services/authentication',\n token,\n password: btoa(password)\n }\n }\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().create('accounts/processpasswordreset', config);\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({});\n\n//# sourceURL=webpack://cspaceUI/./src/actions/account.js?"); /***/ }), /***/ "./src/actions/authority.js": /*!**********************************!*\ !*** ./src/actions/authority.js ***! \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ checkForUses: () => (/* binding */ checkForUses),\n/* harmony export */ readAuthVocabs: () => (/* binding */ readAuthVocabs)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\nconst readAuthVocabs = config => dispatch => {\n const recordTypes = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(config, 'recordTypes');\n if (!recordTypes) {\n // This is mostly to allow tests to run without having a config.\n\n return Promise.resolve();\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__.AUTH_VOCABS_READ_STARTED\n });\n const session = (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\n const readPromises = Object.values(config.recordTypes).filter(recordTypeConfig => recordTypeConfig.serviceConfig.serviceType === 'authority').map(recordTypeConfig => session.read(recordTypeConfig.serviceConfig.servicePath).catch(error => {\n // 403 Forbidden might happen if the user doesn't have any permissions on an authority, and\n // 404 Not Found might happen if an authority isn't configured/available in the services\n // layer. Just swallow these, but reject other errors.\n\n const status = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(error, ['response', 'status']);\n return status === 403 || status === 404 ? undefined : Promise.reject(error);\n }));\n return Promise.all(readPromises).then(responses => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__.AUTH_VOCABS_READ_FULFILLED,\n payload: responses,\n meta: {\n config\n }\n })).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__.AUTH_VOCABS_READ_REJECTED,\n payload: error\n });\n return Promise.reject(error);\n });\n};\n\n/**\n * Check if any uses exist for the given authority item. Resolves to true or false.\n */\nconst checkForUses = (config, recordType, vocabulary, csid) => () => {\n const recordTypeConfig = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(config, ['recordTypes', recordType]);\n const vocabularyConfig = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(recordTypeConfig, ['vocabularies', vocabulary]);\n const recordServicePath = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(recordTypeConfig, ['serviceConfig', 'servicePath']);\n const vocabularyServicePath = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(vocabularyConfig, ['serviceConfig', 'servicePath']);\n const pathParts = [recordServicePath, vocabularyServicePath, 'items', csid, 'refObjs'];\n const path = pathParts.join('/');\n const requestConfig = {\n params: {\n wf_deleted: 'false',\n pgSz: '1'\n }\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().read(path, requestConfig).then(response => {\n const totalItems = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(response, ['data', 'ns3:authority-ref-doc-list', 'totalItems']);\n return totalItems && parseInt(totalItems, 10) > 0;\n });\n};\n\n//# sourceURL=webpack://cspaceUI/./src/actions/authority.js?"); /***/ }), /***/ "./src/actions/authz.js": /*!******************************!*\ !*** ./src/actions/authz.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ readPerms: () => (/* binding */ readPerms),\n/* harmony export */ readRoles: () => (/* binding */ readRoles)\n/* harmony export */ });\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _constants_errorCodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/errorCodes */ \"./src/constants/errorCodes.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\n\nconst readPerms = config => (dispatch, getState) => {\n if ((0,_reducers__WEBPACK_IMPORTED_MODULE_2__.isAuthzPermsReadPending)(getState()) || (0,_reducers__WEBPACK_IMPORTED_MODULE_2__.getAuthzResourceNames)(getState())) {\n // We've already read the perms, or a request is already pending. Do nothing.\n\n return Promise.resolve();\n }\n const requestConfig = {\n params: {\n pgSz: 0,\n actGrp: 'CRUDL'\n }\n };\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.PERMS_READ_STARTED\n });\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().read('authorization/permissions', requestConfig).then(response => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.PERMS_READ_FULFILLED,\n payload: response,\n meta: {\n config\n }\n });\n }).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.PERMS_READ_REJECTED,\n payload: {\n code: _constants_errorCodes__WEBPACK_IMPORTED_MODULE_1__.ERR_API,\n error\n }\n });\n });\n};\nconst readRoles = () => (dispatch, getState) => {\n if ((0,_reducers__WEBPACK_IMPORTED_MODULE_2__.isAuthzRolesReadPending)(getState()) || (0,_reducers__WEBPACK_IMPORTED_MODULE_2__.getAuthzRoles)(getState())) {\n // We've already read the perms, or a request is already pending. Do nothing.\n\n return Promise.resolve();\n }\n const requestConfig = {\n params: {\n pgSz: 0\n }\n };\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ROLES_READ_STARTED\n });\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().read('authorization/roles', requestConfig).then(response => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ROLES_READ_FULFILLED,\n payload: response\n });\n }).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ROLES_READ_REJECTED,\n payload: {\n code: _constants_errorCodes__WEBPACK_IMPORTED_MODULE_1__.ERR_API,\n error\n }\n });\n });\n};\n\n//# sourceURL=webpack://cspaceUI/./src/actions/authz.js?"); /***/ }), /***/ "./src/actions/batch.js": /*!******************************!*\ !*** ./src/actions/batch.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ invoke: () => (/* binding */ invoke)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-intl */ \"./node_modules/react-intl/lib/index.es.js\");\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _helpers_getErrorDescription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers/getErrorDescription */ \"./src/helpers/getErrorDescription.js\");\n/* harmony import */ var _helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/invocationHelpers */ \"./src/helpers/invocationHelpers.js\");\n/* harmony import */ var _helpers_recordDataHelpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../helpers/recordDataHelpers */ \"./src/helpers/recordDataHelpers.js\");\n/* harmony import */ var _helpers_notificationHelpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../helpers/notificationHelpers */ \"./src/helpers/notificationHelpers.js\");\n/* harmony import */ var _helpers_validationHelpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers/validationHelpers */ \"./src/helpers/validationHelpers.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _notification__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./notification */ \"./src/actions/notification.js\");\n/* harmony import */ var _record__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./record */ \"./src/actions/record.js\");\n/* harmony import */ var _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../constants/notificationStatusCodes */ \"./src/constants/notificationStatusCodes.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({\n running: {\n \"id\": \"batch.running\",\n \"defaultMessage\": \"Running {name}\\u2026\"\n },\n complete: {\n \"id\": \"batch.complete\",\n \"defaultMessage\": \"Completed {name}: {numAffected, plural, =0 {No records} one {# record} other {# records}} affected. {userNote}\"\n },\n error: {\n \"id\": \"batch.error\",\n \"defaultMessage\": \"Error running {name}: {error}\"\n }\n});\nconst invoke = (config, batchMetadata, invocationDescriptor, onValidationSuccess) => (dispatch, getState) => {\n const batchCsid = (0,_helpers_recordDataHelpers__WEBPACK_IMPORTED_MODULE_5__.getCsid)(batchMetadata);\n const batchNameGetter = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(config, ['recordTypes', 'batch', 'invocableName']);\n const batchName = batchNameGetter && batchNameGetter(batchMetadata);\n const paramRecordTypeConfig = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(config, ['invocables', 'batch', batchName]);\n const paramRecordCsid = '';\n let params;\n let validateParams;\n if (paramRecordTypeConfig) {\n validateParams = dispatch((0,_record__WEBPACK_IMPORTED_MODULE_10__.validateRecordData)(paramRecordTypeConfig, paramRecordCsid)).then(() => {\n if ((0,_helpers_validationHelpers__WEBPACK_IMPORTED_MODULE_7__.hasBlockingError)((0,_reducers__WEBPACK_IMPORTED_MODULE_8__.getRecordValidationErrors)(getState(), paramRecordCsid))) {\n return Promise.reject();\n }\n const data = (0,_reducers__WEBPACK_IMPORTED_MODULE_8__.getNewRecordData)(getState());\n params = data && data.first().toJS();\n return Promise.resolve();\n });\n } else {\n validateParams = Promise.resolve();\n }\n return validateParams.then(() => {\n if (onValidationSuccess) {\n onValidationSuccess();\n }\n const notificationID = (0,_helpers_notificationHelpers__WEBPACK_IMPORTED_MODULE_6__[\"default\"])();\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_12__.BATCH_INVOKE_STARTED,\n meta: {\n csid: batchCsid\n }\n });\n dispatch((0,_notification__WEBPACK_IMPORTED_MODULE_9__.showNotification)({\n items: [{\n message: messages.running,\n values: {\n name: batchMetadata.getIn(['document', 'ns2:batch_common', 'name'])\n }\n }],\n date: new Date(),\n status: _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_11__.STATUS_PENDING\n }, notificationID));\n const requestConfig = {\n data: (0,_helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__.createInvocationData)(config, invocationDescriptor, params)\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_2__[\"default\"])().create(`batch/${batchCsid}/invoke`, requestConfig).then(response => {\n const {\n data\n } = response;\n const numAffected = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(data, ['ns2:invocationResults', 'numAffected']);\n const userNote = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(data, ['ns2:invocationResults', 'userNote']);\n let numAffectedInt;\n numAffectedInt = parseInt(numAffected, 10);\n if (Number.isNaN(numAffectedInt)) {\n numAffectedInt = undefined;\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_12__.BATCH_INVOKE_FULFILLED,\n meta: {\n csid: batchCsid,\n numAffected: numAffectedInt\n }\n });\n dispatch((0,_notification__WEBPACK_IMPORTED_MODULE_9__.showNotification)({\n items: [{\n message: messages.complete,\n values: {\n numAffected,\n userNote,\n name: batchMetadata.getIn(['document', 'ns2:batch_common', 'name'])\n }\n }],\n date: new Date(),\n status: _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_11__.STATUS_SUCCESS,\n autoClose: true\n }, notificationID));\n return response;\n }).catch(error => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_12__.BATCH_INVOKE_REJECTED,\n meta: {\n csid: batchCsid\n }\n });\n dispatch((0,_notification__WEBPACK_IMPORTED_MODULE_9__.showNotification)({\n items: [{\n message: messages.error,\n values: {\n name: batchName,\n error: (0,_helpers_getErrorDescription__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(error)\n }\n }],\n date: new Date(),\n status: _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_11__.STATUS_ERROR\n }, notificationID));\n });\n });\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({});\n\n//# sourceURL=webpack://cspaceUI/./src/actions/batch.js?"); /***/ }), /***/ "./src/actions/cspace.js": /*!*******************************!*\ !*** ./src/actions/cspace.js ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ configureCSpace: () => (/* binding */ configureCSpace),\n/* harmony export */ createSession: () => (/* binding */ createSession),\n/* harmony export */ readSystemInfo: () => (/* binding */ readSystemInfo),\n/* harmony export */ setSession: () => (/* binding */ setSession)\n/* harmony export */ });\n/* harmony import */ var cspace_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! cspace-client */ \"./node_modules/cspace-client/lib/index.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _constants_modalNames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/modalNames */ \"./src/constants/modalNames.js\");\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _notification__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./notification */ \"./src/actions/notification.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\n\n\n\nlet client;\nconst createSession = (authCode, codeVerifier, redirectUri) => {\n if (typeof authCode === 'undefined') {\n return client.session();\n }\n return client.session({\n authCode,\n codeVerifier,\n redirectUri\n });\n};\nconst setSession = newSession => {\n (0,_helpers_session__WEBPACK_IMPORTED_MODULE_3__.storeSession)(newSession);\n return {\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_5__.CSPACE_CONFIGURED,\n payload: (0,_helpers_session__WEBPACK_IMPORTED_MODULE_3__[\"default\"])().config(),\n meta: {\n username: (0,_helpers_session__WEBPACK_IMPORTED_MODULE_3__[\"default\"])().username()\n }\n };\n};\nconst readSystemInfo = config => dispatch => (0,_helpers_session__WEBPACK_IMPORTED_MODULE_3__[\"default\"])().read('systeminfo', {\n auth: false,\n params: {\n tid: lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(config, 'tenantId')\n }\n}).then(response => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_5__.SYSTEM_INFO_READ_FULFILLED,\n payload: response\n})).catch(error => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_5__.SYSTEM_INFO_READ_REJECTED,\n payload: error\n}));\nconst configureCSpace = config => dispatch => {\n client = (0,cspace_client__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({\n url: lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(config, 'serverUrl'),\n onError: error => {\n const status = lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(error, ['response', 'status']);\n if (status === 401) {\n const headers = lodash_get__WEBPACK_IMPORTED_MODULE_1___default()(error, ['response', 'headers']);\n const wwwAuthenticate = headers.get('Www-Authenticate');\n if (wwwAuthenticate && wwwAuthenticate.includes('invalid_token')) {\n // The stored token is no longer valid. Show the login modal.\n\n dispatch((0,_notification__WEBPACK_IMPORTED_MODULE_4__.openModal)(_constants_modalNames__WEBPACK_IMPORTED_MODULE_2__.MODAL_LOGIN));\n }\n }\n return Promise.reject(error);\n }\n });\n const newSession = createSession();\n dispatch(setSession(newSession));\n return Promise.resolve();\n};\n\n//# sourceURL=webpack://cspaceUI/./src/actions/cspace.js?"); /***/ }), /***/ "./src/actions/export.js": /*!*******************************!*\ !*** ./src/actions/export.js ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ invoke: () => (/* binding */ invoke),\n/* harmony export */ openExport: () => (/* binding */ openExport)\n/* harmony export */ });\n/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-intl */ \"./node_modules/react-intl/lib/index.es.js\");\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _helpers_getErrorDescription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../helpers/getErrorDescription */ \"./src/helpers/getErrorDescription.js\");\n/* harmony import */ var _helpers_notificationHelpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../helpers/notificationHelpers */ \"./src/helpers/notificationHelpers.js\");\n/* harmony import */ var _helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers/invocationHelpers */ \"./src/helpers/invocationHelpers.js\");\n/* harmony import */ var _notification__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./notification */ \"./src/actions/notification.js\");\n/* harmony import */ var _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants/notificationStatusCodes */ \"./src/constants/notificationStatusCodes.js\");\n/* global window */\n\n\n\n\n\n\n\n\nconst messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_0__.defineMessages)({\n error: {\n \"id\": \"export.error\",\n \"defaultMessage\": \"Error generating export: {error}\"\n }\n});\nconst openExport = (config, invocationDescriptor) => () => {\n (0,_helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__.storeInvocationDescriptor)(invocationDescriptor);\n const viewerPath = (0,_helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__.getExportViewerPath)(config, invocationDescriptor);\n return new Promise(resolve => {\n window.open(viewerPath, _helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__.VIEWER_WINDOW_NAME);\n resolve();\n });\n};\nconst invoke = (config, invocationDescriptor) => dispatch => {\n const requestConfig = {\n data: (0,_helpers_invocationHelpers__WEBPACK_IMPORTED_MODULE_4__.createInvocationData)(config, invocationDescriptor),\n responseType: 'blob'\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_1__[\"default\"])().create('exports', requestConfig).catch(error => {\n const notificationID = (0,_helpers_notificationHelpers__WEBPACK_IMPORTED_MODULE_3__[\"default\"])();\n dispatch((0,_notification__WEBPACK_IMPORTED_MODULE_5__.showNotification)({\n items: [{\n message: messages.error,\n values: {\n error: (0,_helpers_getErrorDescription__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(error)\n }\n }],\n date: new Date(),\n status: _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_6__.STATUS_ERROR\n }, notificationID));\n throw error;\n });\n};\n\n//# sourceURL=webpack://cspaceUI/./src/actions/export.js?"); /***/ }), /***/ "./src/actions/idGenerator.js": /*!************************************!*\ !*** ./src/actions/idGenerator.js ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addIDGenerators: () => (/* binding */ addIDGenerators),\n/* harmony export */ createID: () => (/* binding */ createID),\n/* harmony export */ readIDGenerator: () => (/* binding */ readIDGenerator)\n/* harmony export */ });\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _record__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./record */ \"./src/actions/record.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\n\nconst addIDGenerators = idGenerators => ({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.ADD_ID_GENERATORS,\n payload: idGenerators\n});\nconst readIDGenerator = idGeneratorName => (dispatch, getState) => {\n let idGeneratorCsid = null;\n const idGenerator = (0,_reducers__WEBPACK_IMPORTED_MODULE_2__.getIDGenerator)(getState(), idGeneratorName);\n if (idGenerator) {\n idGeneratorCsid = idGenerator.get('csid');\n }\n if (!idGeneratorCsid) {\n return null;\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.READ_ID_GENERATOR_STARTED,\n meta: {\n idGeneratorName\n }\n });\n const config = {\n params: {\n wf_deleted: false\n }\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().read(`idgenerators/${idGeneratorCsid}`, config).then(response => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.READ_ID_GENERATOR_FULFILLED,\n payload: response,\n meta: {\n idGeneratorName\n }\n })).catch(error => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.READ_ID_GENERATOR_REJECTED,\n payload: error,\n meta: {\n idGeneratorName\n }\n }));\n};\nconst createID = (recordTypeConfig, idGeneratorName, csid, path, transform) => (dispatch, getState) => {\n let idGeneratorCsid = null;\n const idGenerator = (0,_reducers__WEBPACK_IMPORTED_MODULE_2__.getIDGenerator)(getState(), idGeneratorName);\n if (idGenerator) {\n idGeneratorCsid = idGenerator.get('csid');\n }\n if (!idGeneratorCsid) {\n return null;\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.CREATE_ID_STARTED,\n meta: {\n recordTypeConfig,\n idGeneratorName,\n csid,\n path\n }\n });\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().create(`idgenerators/${idGeneratorCsid}/ids`).then(response => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.CREATE_ID_FULFILLED,\n payload: response,\n meta: {\n recordTypeConfig,\n idGeneratorName,\n csid,\n path,\n transform\n }\n });\n return dispatch((0,_record__WEBPACK_IMPORTED_MODULE_1__.computeRecordData)(recordTypeConfig, csid)).then(() => dispatch((0,_record__WEBPACK_IMPORTED_MODULE_1__.validateRecordData)(recordTypeConfig, csid)));\n }).catch(error => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.CREATE_ID_REJECTED,\n payload: error,\n meta: {\n recordTypeConfig,\n idGeneratorName,\n csid,\n path\n }\n }));\n};\n\n//# sourceURL=webpack://cspaceUI/./src/actions/idGenerator.js?"); /***/ }), /***/ "./src/actions/login.js": /*!******************************!*\ !*** ./src/actions/login.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LOGIN_WINDOW_NAME: () => (/* binding */ LOGIN_WINDOW_NAME),\n/* harmony export */ createAuthCodeUrl: () => (/* binding */ createAuthCodeUrl),\n/* harmony export */ login: () => (/* binding */ login),\n/* harmony export */ loginWindowClosed: () => (/* binding */ loginWindowClosed),\n/* harmony export */ openLoginWindow: () => (/* binding */ openLoginWindow),\n/* harmony export */ receiveAuthCode: () => (/* binding */ receiveAuthCode)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! qs */ \"./node_modules/qs/lib/index.js\");\n/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _authority__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./authority */ \"./src/actions/authority.js\");\n/* harmony import */ var _cspace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cspace */ \"./src/actions/cspace.js\");\n/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./prefs */ \"./src/actions/prefs.js\");\n/* harmony import */ var _account__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./account */ \"./src/actions/account.js\");\n/* harmony import */ var _tags__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tags */ \"./src/actions/tags.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants/errorCodes */ \"./src/constants/errorCodes.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n/* global window */\n\n\n\n\n\n\n\n\n\n\n\nconst LOGIN_WINDOW_NAME = 'cspace-login';\nconst renewAuth = (config, authCode, authCodeRequestData = {}) => dispatch => {\n const {\n codeVerifier,\n redirectUri\n } = authCodeRequestData;\n const session = (0,_cspace__WEBPACK_IMPORTED_MODULE_2__.createSession)(authCode, codeVerifier, redirectUri);\n const loginPromise = authCode ? session.login() : Promise.resolve();\n let username = null;\n return loginPromise.then(() => session.read('accounts/0/accountperms')).then(response => {\n if (lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(response, ['data', 'ns2:account_permission', 'account', 'tenantId']) !== config.tenantId) {\n // The logged in user doesn't belong to the tenant that this UI expects.\n\n return session.logout().finally(() => {\n const error = new Error();\n error.code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_WRONG_TENANT;\n return Promise.reject(error);\n });\n }\n username = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(response, ['data', 'ns2:account_permission', 'account', 'userId']);\n dispatch((0,_cspace__WEBPACK_IMPORTED_MODULE_2__.setSession)(session));\n return dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.AUTH_RENEW_FULFILLED,\n payload: response,\n meta: {\n config,\n username\n }\n });\n }).then(() => dispatch((0,_account__WEBPACK_IMPORTED_MODULE_4__.readAccountRoles)(config, username))).then(() => Promise.resolve(username)).catch(error => {\n let {\n code\n } = error;\n const data = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(error, ['response', 'data']) || '';\n if (/invalid state/.test(data)) {\n code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_ACCOUNT_INVALID;\n } else if (/inactive/.test(data)) {\n code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_ACCOUNT_INACTIVE;\n } else if (/account not found/.test(data)) {\n code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_ACCOUNT_NOT_FOUND;\n } else {\n const desc = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(error, ['response', 'data', 'error_description']) || lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(error, 'message');\n if (desc === 'Network Error') {\n code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_NETWORK;\n }\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.AUTH_RENEW_REJECTED,\n payload: {\n code,\n error\n },\n meta: {\n username\n }\n });\n const wrapper = new Error();\n wrapper.code = code;\n wrapper.error = error;\n return Promise.reject(wrapper);\n });\n};\nconst generateS256Hash = async input => {\n const inputBytes = new TextEncoder().encode(input);\n const sha256Bytes = await window.crypto.subtle.digest('SHA-256', inputBytes);\n const base64 = window.btoa(String.fromCharCode(...new Uint8Array(sha256Bytes)));\n const urlSafeBase64 = base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n return urlSafeBase64;\n};\nconst authCodeRequestRedirectUrl = serverUrl => {\n const currentUrl = window.location.href;\n const authorizedUrl = new URL('authorized', currentUrl);\n if (!serverUrl) {\n // Note: The \"/..\" prefix is needed because Spring Security OAuth appears to be appending\n // to the base path of the services layer when sending redirects, so \"/cspace\" becomes\n // \"/cspace-services/cspace\". The \"/..\" works around that, until I can figure out how to\n // configure Spring to do something different.\n\n return `/..${authorizedUrl.pathname}`;\n }\n return authorizedUrl.toString();\n};\nconst authCodeRequestStorageKey = requestId => `authCodeRequest:${requestId}`;\nconst createAuthCodeUrl = (config, landingPath) => async dispatch => {\n const {\n serverUrl\n } = config;\n const requestId = window.crypto.randomUUID();\n const codeVerifier = window.crypto.randomUUID();\n const codeChallenge = await generateS256Hash(codeVerifier);\n const redirectUri = authCodeRequestRedirectUrl(serverUrl);\n const requestData = {\n codeVerifier,\n landingPath,\n redirectUri\n };\n window.sessionStorage.setItem(authCodeRequestStorageKey(requestId), JSON.stringify(requestData));\n const params = {\n response_type: 'code',\n client_id: 'cspace-ui',\n scope: 'cspace.full',\n redirect_uri: redirectUri,\n state: requestId,\n code_challenge: codeChallenge,\n code_challenge_method: 'S256',\n tid: config.tenantId\n };\n const queryString = qs__WEBPACK_IMPORTED_MODULE_9___default().stringify(params);\n const url = `${serverUrl}/cspace-services/oauth2/authorize?${queryString}`;\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.AUTH_CODE_URL_CREATED,\n payload: url\n });\n return url;\n};\n\n/**\n * Log in, using either the saved user or an authorization code.\n *\n * @param {*} config\n * @param {*} authCode The authorization code. If undefined, the stored user will be used.\n * @param {*} requestData The data that was used to retrieve the authorization code.\n * @returns\n */\nconst login = (config, authCode, authCodeRequestData = {}) => (dispatch, getState) => {\n const prevUsername = (0,_reducers__WEBPACK_IMPORTED_MODULE_6__.getUserUsername)(getState());\n dispatch((0,_prefs__WEBPACK_IMPORTED_MODULE_3__.savePrefs)());\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_STARTED\n });\n let username;\n return dispatch(renewAuth(config, authCode, authCodeRequestData)).then(loggedInUsername => {\n username = loggedInUsername;\n return Promise.resolve();\n }).then(() => dispatch((0,_prefs__WEBPACK_IMPORTED_MODULE_3__.loadPrefs)(config, username))).then(() => dispatch((0,_tags__WEBPACK_IMPORTED_MODULE_5__[\"default\"])())).then(() => dispatch((0,_authority__WEBPACK_IMPORTED_MODULE_1__.readAuthVocabs)(config))).then(() => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_FULFILLED,\n meta: {\n landingPath: authCodeRequestData.landingPath,\n prevUsername,\n username\n }\n })).catch(error => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_REJECTED,\n payload: error\n }));\n};\n\n/**\n * Receive an authorization code from the OAuth server. This will have been sent in a redirect from\n * the server, in response to an authorization code request.\n *\n * @param {*} config\n * @param {*} authCodeRequestId\n * @param {*} authCode\n * @returns\n */\nconst receiveAuthCode = (config, authCodeRequestId, authCode) => async dispatch => {\n const storageKey = authCodeRequestStorageKey(authCodeRequestId);\n const authCodeRequestDataJson = window.sessionStorage.getItem(storageKey);\n window.sessionStorage.removeItem(storageKey);\n if (!authCodeRequestDataJson) {\n const error = new Error();\n error.code = _constants_errorCodes__WEBPACK_IMPORTED_MODULE_7__.ERR_AUTH_CODE_REQUEST_NOT_FOUND;\n return dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_REJECTED,\n payload: error\n });\n }\n const authCodeRequestData = JSON.parse(authCodeRequestDataJson);\n if (window.name === LOGIN_WINDOW_NAME && window.opener && window.opener.onAuthCodeReceived != null) {\n // If this is a pop-up, send the auth code and request data to the parent, and close this\n // window.\n\n window.opener.onAuthCodeReceived(authCode, authCodeRequestData);\n window.close();\n return undefined;\n }\n return dispatch(login(config, authCode, authCodeRequestData));\n};\nconst openLoginWindow = url => {\n const popupWidth = 550;\n const popupHeight = 800;\n const screenWidth = window.screen.width;\n const screenHeight = window.screen.height;\n const left = (screenWidth - popupWidth) / 2;\n const top = (screenHeight - popupHeight) / 2;\n const popup = window.open(url, LOGIN_WINDOW_NAME, `width=${popupWidth},height=${popupHeight},left=${left},top=${top}`);\n if (!popup) {\n return {\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_WINDOW_OPEN_FAILED\n };\n }\n return {\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_WINDOW_OPENED\n };\n};\nconst loginWindowClosed = () => ({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_8__.LOGIN_WINDOW_CLOSED\n});\n\n//# sourceURL=webpack://cspaceUI/./src/actions/login.js?"); /***/ }), /***/ "./src/actions/logout.js": /*!*******************************!*\ !*** ./src/actions/logout.js ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ logout: () => (/* binding */ logout)\n/* harmony export */ });\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./prefs */ \"./src/actions/prefs.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n\n\n\nconst logout = () => dispatch => {\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__.LOGOUT_STARTED\n });\n dispatch((0,_prefs__WEBPACK_IMPORTED_MODULE_1__.savePrefs)());\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().logout(false).then(response => dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_2__.LOGOUT_FULFILLED,\n payload: response\n })).then(() => dispatch((0,_prefs__WEBPACK_IMPORTED_MODULE_1__.loadPrefs)()));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({});\n\n//# sourceURL=webpack://cspaceUI/./src/actions/logout.js?"); /***/ }), /***/ "./src/actions/media.js": /*!******************************!*\ !*** ./src/actions/media.js ***! \******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ readBinary: () => (/* binding */ readBinary)\n/* harmony export */ });\n/* harmony import */ var _helpers_session__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/session */ \"./src/helpers/session.js\");\n\nconst readBinary = path => () => {\n const config = {\n responseType: 'blob'\n };\n return (0,_helpers_session__WEBPACK_IMPORTED_MODULE_0__[\"default\"])().read(path, config);\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({});\n\n//# sourceURL=webpack://cspaceUI/./src/actions/media.js?"); /***/ }), /***/ "./src/actions/notification.js": /*!*************************************!*\ !*** ./src/actions/notification.js ***! \*************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NOTIFICATION_ID_VALIDATION: () => (/* binding */ NOTIFICATION_ID_VALIDATION),\n/* harmony export */ closeModal: () => (/* binding */ closeModal),\n/* harmony export */ openModal: () => (/* binding */ openModal),\n/* harmony export */ removeNotification: () => (/* binding */ removeNotification),\n/* harmony export */ removeValidationNotification: () => (/* binding */ removeValidationNotification),\n/* harmony export */ showNotification: () => (/* binding */ showNotification),\n/* harmony export */ showValidationNotification: () => (/* binding */ showValidationNotification)\n/* harmony export */ });\n/* harmony import */ var _helpers_validationHelpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers/validationHelpers */ \"./src/helpers/validationHelpers.js\");\n/* harmony import */ var _reducers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../reducers */ \"./src/reducers/index.js\");\n/* harmony import */ var _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/notificationStatusCodes */ \"./src/constants/notificationStatusCodes.js\");\n/* harmony import */ var _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/actionCodes */ \"./src/constants/actionCodes.js\");\n/* global window */\n\n\n\n\n\nconst NOTIFICATION_ID_VALIDATION = 'NOTIFICATION_ID_VALIDATION';\nconst modalCloseCallbacks = {};\nconst showNotification = (notificationDescriptor, notificationID) => ({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.SHOW_NOTIFICATION,\n payload: notificationDescriptor,\n meta: {\n notificationID\n }\n});\nconst removeNotification = notificationID => ({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.REMOVE_NOTIFICATION,\n meta: {\n notificationID\n }\n});\nconst showValidationNotification = (recordType, csid) => (dispatch, getState) => dispatch(showNotification({\n recordType,\n csid,\n type: 'validation',\n date: new Date(),\n status: (0,_helpers_validationHelpers__WEBPACK_IMPORTED_MODULE_0__.hasBlockingError)((0,_reducers__WEBPACK_IMPORTED_MODULE_1__.getRecordValidationErrors)(getState(), csid)) ? _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_2__.STATUS_ERROR : _constants_notificationStatusCodes__WEBPACK_IMPORTED_MODULE_2__.STATUS_WARNING\n}, NOTIFICATION_ID_VALIDATION));\nconst removeValidationNotification = () => removeNotification(NOTIFICATION_ID_VALIDATION);\nconst openModal = (name, onClose) => (dispatch, getState) => {\n const openModalName = (0,_reducers__WEBPACK_IMPORTED_MODULE_1__.getOpenModalName)(getState());\n if (openModalName !== name) {\n if (openModalName) {\n // There's another modal open. Make sure its callback gets called when this modal is closed.\n // This lets us transfer control from one modal to another simply by opening the new one\n // without closing the previous one, since all onClose callbacks will get called at the end.\n // This is used when navigating away from movement records with unsaved changes -- first the\n // confirm navigation modal is shown, and if save is selected, control is transferred to the\n // lock modal.\n\n let composedOnClose;\n const pendingOnClose = modalCloseCallbacks[openModalName];\n delete modalCloseCallbacks[openModalName];\n if (pendingOnClose && onClose) {\n composedOnClose = () => {\n onClose();\n pendingOnClose();\n };\n } else if (pendingOnClose) {\n composedOnClose = pendingOnClose;\n } else {\n composedOnClose = onClose;\n }\n modalCloseCallbacks[name] = composedOnClose;\n } else {\n modalCloseCallbacks[name] = onClose;\n }\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.OPEN_MODAL,\n meta: {\n name\n }\n });\n }\n};\nconst closeModal = result => (dispatch, getState) => {\n const modalName = (0,_reducers__WEBPACK_IMPORTED_MODULE_1__.getOpenModalName)(getState());\n dispatch({\n type: _constants_actionCodes__WEBPACK_IMPORTED_MODULE_3__.CLOSE_MODAL\n });\n const onClose = modalCloseCallbacks[modalName];\n delete modalCloseCallbacks[modalName];\n if (onClose) {\n window.setTimeout(() => {\n onClose(resu