studiokit-scaffolding-js 5.1.4 → 5.1.5-alpha.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/lib/components/ConnectedModal.d.ts +3 -2
- package/lib/components/ConnectedModal.js +30 -1
- package/lib/components/HOC/ConnectedModalComponent.d.ts +13 -13
- package/lib/components/HOC/ConnectedModalComponent.js +13 -2
- package/lib/redux/sagas/downtimeApiErrorSaga.d.ts +2 -0
- package/lib/redux/sagas/downtimeApiErrorSaga.js +66 -0
- package/lib/redux/sagas/rootSaga.js +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalProps } from 'react-bootstrap';
|
|
3
|
+
declare const _default: React.ComponentClass<ModalProps, any>;
|
|
3
4
|
/**
|
|
4
5
|
* Wrapped version of "react-bootstrap"'s `Modal` component. Uses `ConnectedModalComponent` to coordinate modal state in redux.
|
|
5
6
|
*/
|
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
26
|
};
|
|
5
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
var react_1 = __importDefault(require("react"));
|
|
6
29
|
var react_bootstrap_1 = require("react-bootstrap");
|
|
7
30
|
var ConnectedModalComponent_1 = __importDefault(require("./HOC/ConnectedModalComponent"));
|
|
31
|
+
var ConnectedModal = function (_a) {
|
|
32
|
+
var
|
|
33
|
+
// exclude props that shouldn't be passed to the Modal
|
|
34
|
+
guid = _a.guid, modals = _a.modals, isTopOpenFullscreenModal = _a.isTopOpenFullscreenModal, dispatch = _a.dispatch, modalProps = __rest(_a, ["guid", "modals", "isTopOpenFullscreenModal", "dispatch"]);
|
|
35
|
+
return react_1.default.createElement(react_bootstrap_1.Modal, __assign({}, modalProps));
|
|
36
|
+
};
|
|
8
37
|
/**
|
|
9
38
|
* Wrapped version of "react-bootstrap"'s `Modal` component. Uses `ConnectedModalComponent` to coordinate modal state in redux.
|
|
10
39
|
*/
|
|
11
|
-
exports.default = ConnectedModalComponent_1.default(
|
|
40
|
+
exports.default = ConnectedModalComponent_1.default(ConnectedModal);
|
|
@@ -2,6 +2,9 @@ import React, { ComponentClass, ComponentType } from 'react';
|
|
|
2
2
|
import { ModalsState } from '../../redux/reducers/modalsReducer';
|
|
3
3
|
import { BaseReduxState } from '../../types';
|
|
4
4
|
import { GuidComponentWrappedProps } from '../HOC/GuidComponent';
|
|
5
|
+
export declare type ConnectedModalReduxProps = {
|
|
6
|
+
modals: ModalsState;
|
|
7
|
+
};
|
|
5
8
|
export interface ConnectedModalWrappedProps {
|
|
6
9
|
onEntering: () => void;
|
|
7
10
|
onExited: () => void;
|
|
@@ -10,9 +13,6 @@ export interface ConnectedModalWrappedProps {
|
|
|
10
13
|
export interface ConnectedModalState {
|
|
11
14
|
isModalOpen: boolean;
|
|
12
15
|
}
|
|
13
|
-
export declare type ConnectedModalReduxProps = {
|
|
14
|
-
modals: ModalsState;
|
|
15
|
-
};
|
|
16
16
|
export declare const configureMapStateToProps: () => (state: BaseReduxState) => ConnectedModalReduxProps;
|
|
17
17
|
/**
|
|
18
18
|
* HOC that provides modal lifecycle event methods to coordinate modal state in redux.
|
|
@@ -23,15 +23,15 @@ export declare const configureMapStateToProps: () => (state: BaseReduxState) =>
|
|
|
23
23
|
* @param {*} isFullscreen Are we rendering a fullscreen modal?
|
|
24
24
|
*/
|
|
25
25
|
export declare function configureConnectedModalComponent<TOwnProps extends {}>(WrappedComponent: ComponentType<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, isFullscreen?: boolean): {
|
|
26
|
-
new (props: TOwnProps &
|
|
26
|
+
new (props: TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps): {
|
|
27
27
|
componentWillUnmount(): void;
|
|
28
28
|
onEntering: () => void;
|
|
29
29
|
onExited: () => void;
|
|
30
30
|
render(): JSX.Element;
|
|
31
31
|
context: any;
|
|
32
|
-
setState<K extends "isModalOpen">(state: ConnectedModalState | ((prevState: Readonly<ConnectedModalState>, props: Readonly<TOwnProps &
|
|
32
|
+
setState<K extends "isModalOpen">(state: ConnectedModalState | ((prevState: Readonly<ConnectedModalState>, props: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>) => ConnectedModalState | Pick<ConnectedModalState, K> | null) | Pick<ConnectedModalState, K> | null, callback?: (() => void) | undefined): void;
|
|
33
33
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
34
|
-
readonly props: Readonly<TOwnProps &
|
|
34
|
+
readonly props: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps> & Readonly<{
|
|
35
35
|
children?: React.ReactNode;
|
|
36
36
|
}>;
|
|
37
37
|
state: Readonly<ConnectedModalState>;
|
|
@@ -39,16 +39,16 @@ export declare function configureConnectedModalComponent<TOwnProps extends {}>(W
|
|
|
39
39
|
[key: string]: React.ReactInstance;
|
|
40
40
|
};
|
|
41
41
|
componentDidMount?(): void;
|
|
42
|
-
shouldComponentUpdate?(nextProps: Readonly<TOwnProps &
|
|
42
|
+
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, nextState: Readonly<ConnectedModalState>, nextContext: any): boolean;
|
|
43
43
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
44
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps &
|
|
45
|
-
componentDidUpdate?(prevProps: Readonly<TOwnProps &
|
|
44
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, prevState: Readonly<ConnectedModalState>): any;
|
|
45
|
+
componentDidUpdate?(prevProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, prevState: Readonly<ConnectedModalState>, snapshot?: any): void;
|
|
46
46
|
componentWillMount?(): void;
|
|
47
47
|
UNSAFE_componentWillMount?(): void;
|
|
48
|
-
componentWillReceiveProps?(nextProps: Readonly<TOwnProps &
|
|
49
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TOwnProps &
|
|
50
|
-
componentWillUpdate?(nextProps: Readonly<TOwnProps &
|
|
51
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps &
|
|
48
|
+
componentWillReceiveProps?(nextProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
49
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
50
|
+
componentWillUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, nextState: Readonly<ConnectedModalState>, nextContext: any): void;
|
|
51
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalReduxProps & GuidComponentWrappedProps>, nextState: Readonly<ConnectedModalState>, nextContext: any): void;
|
|
52
52
|
};
|
|
53
53
|
contextType?: React.Context<any> | undefined;
|
|
54
54
|
};
|
|
@@ -42,6 +42,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
42
42
|
__setModuleDefault(result, mod);
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
45
56
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
57
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
58
|
};
|
|
@@ -103,11 +114,11 @@ function configureConnectedModalComponent(WrappedComponent, isFullscreen) {
|
|
|
103
114
|
};
|
|
104
115
|
ConnectedModalComponent.prototype.render = function () {
|
|
105
116
|
var _a, _b;
|
|
106
|
-
var _c = this.props, modals = _c.modals, guid = _c.guid;
|
|
117
|
+
var _c = this.props, modals = _c.modals, guid = _c.guid, ownProps = __rest(_c, ["modals", "guid"]);
|
|
107
118
|
var topOpenFullscreenModal = lodash_1.maxBy(Object.values(modals).filter(function (m) { return m.isFullscreen; }), function (modal) { return modal.index; });
|
|
108
119
|
var thisModalIndex = (_b = (_a = modals[guid]) === null || _a === void 0 ? void 0 : _a.index) !== null && _b !== void 0 ? _b : null;
|
|
109
120
|
var isTopOpenFullscreenModal = (topOpenFullscreenModal === null || topOpenFullscreenModal === void 0 ? void 0 : topOpenFullscreenModal.index) === thisModalIndex;
|
|
110
|
-
return (react_1.default.createElement(WrappedComponent, __assign({},
|
|
121
|
+
return (react_1.default.createElement(WrappedComponent, __assign({}, ownProps, { guid: guid, onEntering: this.onEntering, onExited: this.onExited, isTopOpenFullscreenModal: isTopOpenFullscreenModal })));
|
|
111
122
|
};
|
|
112
123
|
return ConnectedModalComponent;
|
|
113
124
|
}(react_1.Component));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="connected-react-router" />
|
|
2
|
+
export default function downtimeApiErrorSaga(runIndefinitely?: boolean): Generator<import("redux-saga/effects").TakeEffect | import("redux-saga/effects").PutEffect<import("connected-react-router").CallHistoryMethodAction<[import("history").LocationDescriptorObject<unknown>]>>, void, unknown>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6
|
+
function step(op) {
|
|
7
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
8
|
+
while (_) try {
|
|
9
|
+
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;
|
|
10
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
11
|
+
switch (op[0]) {
|
|
12
|
+
case 0: case 1: t = op; break;
|
|
13
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
14
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
15
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
16
|
+
default:
|
|
17
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
18
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
19
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
20
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
21
|
+
if (t[2]) _.ops.pop();
|
|
22
|
+
_.trys.pop(); continue;
|
|
23
|
+
}
|
|
24
|
+
op = body.call(thisArg, _);
|
|
25
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
26
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var connected_react_router_1 = require("connected-react-router");
|
|
31
|
+
var effects_1 = require("redux-saga/effects");
|
|
32
|
+
var actions_1 = require("../actions");
|
|
33
|
+
function downtimeApiErrorSaga(runIndefinitely) {
|
|
34
|
+
if (runIndefinitely === void 0) { runIndefinitely = true; }
|
|
35
|
+
return __generator(this, function (_a) {
|
|
36
|
+
switch (_a.label) {
|
|
37
|
+
case 0:
|
|
38
|
+
// wait for any downtime error response
|
|
39
|
+
return [4 /*yield*/, effects_1.take(function (action) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
var title = (_a = action === null || action === void 0 ? void 0 : action.errorData) === null || _a === void 0 ? void 0 : _a.title;
|
|
42
|
+
return ((action === null || action === void 0 ? void 0 : action.type) === actions_1.NET_ACTION.TRY_FETCH_FAILED &&
|
|
43
|
+
((_b = action === null || action === void 0 ? void 0 : action.errorData) === null || _b === void 0 ? void 0 : _b.status) === 403 &&
|
|
44
|
+
!!(title === null || title === void 0 ? void 0 : title.includes("We'll be right back!")));
|
|
45
|
+
})
|
|
46
|
+
// redirect to downtime route
|
|
47
|
+
];
|
|
48
|
+
case 1:
|
|
49
|
+
// wait for any downtime error response
|
|
50
|
+
_a.sent();
|
|
51
|
+
// redirect to downtime route
|
|
52
|
+
return [4 /*yield*/, effects_1.put(connected_react_router_1.push({
|
|
53
|
+
pathname: '/downtime'
|
|
54
|
+
}))];
|
|
55
|
+
case 2:
|
|
56
|
+
// redirect to downtime route
|
|
57
|
+
_a.sent();
|
|
58
|
+
_a.label = 3;
|
|
59
|
+
case 3:
|
|
60
|
+
if (runIndefinitely) return [3 /*break*/, 0];
|
|
61
|
+
_a.label = 4;
|
|
62
|
+
case 4: return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.default = downtimeApiErrorSaga;
|
|
@@ -75,6 +75,7 @@ var authSaga_1 = __importStar(require("./authSaga"));
|
|
|
75
75
|
var caliperSaga_1 = __importDefault(require("./caliperSaga"));
|
|
76
76
|
var clockOffsetSaga_1 = __importDefault(require("./clockOffsetSaga"));
|
|
77
77
|
var configurationSaga_1 = __importDefault(require("./configurationSaga"));
|
|
78
|
+
var downtimeApiErrorSaga_1 = __importDefault(require("./downtimeApiErrorSaga"));
|
|
78
79
|
var errorSaga_1 = __importDefault(require("./errorSaga"));
|
|
79
80
|
var fetchSaga_1 = __importDefault(require("./fetchSaga"));
|
|
80
81
|
var googleAnalyticsSaga_1 = __importDefault(require("./googleAnalyticsSaga"));
|
|
@@ -96,7 +97,7 @@ exports.setOtherDependentSagas = setOtherDependentSagas;
|
|
|
96
97
|
function dependentSagas() {
|
|
97
98
|
return __generator(this, function (_a) {
|
|
98
99
|
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, effects_1.all(__assign({ noStoreSaga: noStoreSaga_1.default(), configurationSaga: configurationSaga_1.default(), caliperSaga: caliperSaga_1.default(), userIdSaga: userIdSaga_1.default(), sentrySaga: sentrySaga_1.default(), googleAnalyticsSaga: googleAnalyticsSaga_1.default(), appInsightsSaga: appInsightsSaga_1.default(), initialDataLoadSaga: initialDataLoadSaga_1.default(), identityProviderSaga: identityProviderSaga_1.default(), postLoginRedirectSaga: postLoginRedirectSaga_1.default(), postLoginDataSaga: postLoginDataSaga_1.default(), clockOffsetSaga: clockOffsetSaga_1.default(), lockDownBrowserErrorSaga: lockDownBrowserErrorSaga_1.default() }, otherDependentSagas))];
|
|
100
|
+
case 0: return [4 /*yield*/, effects_1.all(__assign({ noStoreSaga: noStoreSaga_1.default(), configurationSaga: configurationSaga_1.default(), caliperSaga: caliperSaga_1.default(), userIdSaga: userIdSaga_1.default(), sentrySaga: sentrySaga_1.default(), googleAnalyticsSaga: googleAnalyticsSaga_1.default(), appInsightsSaga: appInsightsSaga_1.default(), initialDataLoadSaga: initialDataLoadSaga_1.default(), identityProviderSaga: identityProviderSaga_1.default(), postLoginRedirectSaga: postLoginRedirectSaga_1.default(), postLoginDataSaga: postLoginDataSaga_1.default(), clockOffsetSaga: clockOffsetSaga_1.default(), lockDownBrowserErrorSaga: lockDownBrowserErrorSaga_1.default(), downtimeApiErrorSaga: downtimeApiErrorSaga_1.default() }, otherDependentSagas))];
|
|
100
101
|
case 1:
|
|
101
102
|
_a.sent();
|
|
102
103
|
return [2 /*return*/];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5-alpha.1",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|