dce-reactkit 2.0.10 → 3.0.0
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/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/lib/components/AppWrapper.d.ts +35 -0
- package/lib/{components → cjs/lib/components}/ErrorBox.d.ts +0 -0
- package/lib/{components → cjs/lib/components}/LoadingSpinner.d.ts +1 -0
- package/lib/cjs/lib/components/Modal.d.ts +40 -0
- package/lib/cjs/lib/components/TabBox.d.ts +11 -0
- package/lib/{errors → cjs/lib/errors}/ErrorWithCode.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/abbreviate.d.ts +1 -0
- package/lib/{helpers → cjs/lib/helpers}/avg.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/ceilToNumDecimals.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/floorToNumDecimals.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/forceNumIntoBounds.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/handleError.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/handleSuccess.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/padDecimalZeros.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/padZerosLeft.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/parseRequest.d.ts +1 -1
- package/lib/{helpers → cjs/lib/helpers}/roundToNumDecimals.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/sum.d.ts +0 -0
- package/lib/{helpers → cjs/lib/helpers}/visitServerEndpoint.d.ts +2 -2
- package/lib/{helpers → cjs/lib/helpers}/waitMs.d.ts +0 -0
- package/lib/cjs/lib/index.d.ts +27 -0
- package/lib/cjs/lib/types/ModalButtonType.d.ts +17 -0
- package/lib/cjs/lib/types/ModalSize.d.ts +11 -0
- package/lib/cjs/lib/types/ModalType.d.ts +16 -0
- package/lib/{types → cjs/lib/types}/ParamType.d.ts +0 -0
- package/lib/{types → cjs/lib/types}/ReactKitErrorCode.d.ts +0 -0
- package/lib/{types → cjs/lib/types}/Variant.d.ts +0 -0
- package/lib/cjs/types/components/AppWrapper.d.ts +40 -0
- package/lib/cjs/types/components/ErrorBox.d.ts +12 -0
- package/lib/cjs/types/components/LoadingSpinner.d.ts +7 -0
- package/lib/cjs/types/components/Modal.d.ts +40 -0
- package/lib/cjs/types/components/TabBox.d.ts +11 -0
- package/lib/cjs/types/errors/ErrorWithCode.d.ts +9 -0
- package/lib/cjs/types/helpers/abbreviate.d.ts +10 -0
- package/lib/cjs/types/helpers/alert.d.ts +2 -0
- package/lib/cjs/types/helpers/avg.d.ts +8 -0
- package/lib/cjs/types/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/cjs/types/helpers/confirm.d.ts +2 -0
- package/lib/cjs/types/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/cjs/types/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/cjs/types/helpers/handleError.d.ts +14 -0
- package/lib/cjs/types/helpers/handleSuccess.d.ts +8 -0
- package/lib/cjs/types/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/cjs/types/helpers/padZerosLeft.d.ts +9 -0
- package/lib/cjs/types/helpers/parseRequest.d.ts +21 -0
- package/lib/cjs/types/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/cjs/types/helpers/showFatalError.d.ts +2 -0
- package/lib/cjs/types/helpers/sum.d.ts +8 -0
- package/lib/cjs/types/helpers/visitServerEndpoint.d.ts +23 -0
- package/lib/cjs/types/helpers/waitMs.d.ts +7 -0
- package/lib/cjs/types/index.d.ts +22 -0
- package/lib/cjs/types/types/ModalButtonType.d.ts +17 -0
- package/lib/cjs/types/types/ModalSize.d.ts +11 -0
- package/lib/cjs/types/types/ModalType.d.ts +16 -0
- package/lib/cjs/types/types/ParamType.d.ts +17 -0
- package/lib/cjs/types/types/ReactKitErrorCode.d.ts +13 -0
- package/lib/cjs/types/types/Variant.d.ts +15 -0
- package/lib/esm/index.js +16 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/lib/components/AppWrapper.d.ts +35 -0
- package/lib/esm/lib/components/ErrorBox.d.ts +12 -0
- package/lib/esm/lib/components/LoadingSpinner.d.ts +7 -0
- package/lib/esm/lib/components/Modal.d.ts +40 -0
- package/lib/esm/lib/components/TabBox.d.ts +11 -0
- package/lib/esm/lib/errors/ErrorWithCode.d.ts +9 -0
- package/lib/esm/lib/helpers/abbreviate.d.ts +10 -0
- package/lib/esm/lib/helpers/avg.d.ts +8 -0
- package/lib/esm/lib/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/esm/lib/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/esm/lib/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/esm/lib/helpers/handleError.d.ts +14 -0
- package/lib/esm/lib/helpers/handleSuccess.d.ts +8 -0
- package/lib/esm/lib/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/esm/lib/helpers/padZerosLeft.d.ts +9 -0
- package/lib/esm/lib/helpers/parseRequest.d.ts +21 -0
- package/lib/esm/lib/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/esm/lib/helpers/sum.d.ts +8 -0
- package/lib/esm/lib/helpers/visitServerEndpoint.d.ts +23 -0
- package/lib/esm/lib/helpers/waitMs.d.ts +7 -0
- package/lib/esm/lib/index.d.ts +27 -0
- package/lib/esm/lib/types/ModalButtonType.d.ts +17 -0
- package/lib/esm/lib/types/ModalSize.d.ts +11 -0
- package/lib/esm/lib/types/ModalType.d.ts +16 -0
- package/lib/esm/lib/types/ParamType.d.ts +17 -0
- package/lib/esm/lib/types/ReactKitErrorCode.d.ts +13 -0
- package/lib/esm/lib/types/Variant.d.ts +15 -0
- package/lib/esm/types/components/AppWrapper.d.ts +40 -0
- package/lib/esm/types/components/ErrorBox.d.ts +12 -0
- package/lib/esm/types/components/LoadingSpinner.d.ts +7 -0
- package/lib/esm/types/components/Modal.d.ts +40 -0
- package/lib/esm/types/components/TabBox.d.ts +11 -0
- package/lib/esm/types/errors/ErrorWithCode.d.ts +9 -0
- package/lib/esm/types/helpers/abbreviate.d.ts +10 -0
- package/lib/esm/types/helpers/alert.d.ts +2 -0
- package/lib/esm/types/helpers/avg.d.ts +8 -0
- package/lib/esm/types/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/esm/types/helpers/confirm.d.ts +2 -0
- package/lib/esm/types/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/esm/types/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/esm/types/helpers/handleError.d.ts +14 -0
- package/lib/esm/types/helpers/handleSuccess.d.ts +8 -0
- package/lib/esm/types/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/esm/types/helpers/padZerosLeft.d.ts +9 -0
- package/lib/esm/types/helpers/parseRequest.d.ts +21 -0
- package/lib/esm/types/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/esm/types/helpers/showFatalError.d.ts +2 -0
- package/lib/esm/types/helpers/sum.d.ts +8 -0
- package/lib/esm/types/helpers/visitServerEndpoint.d.ts +23 -0
- package/lib/esm/types/helpers/waitMs.d.ts +7 -0
- package/lib/esm/types/index.d.ts +22 -0
- package/lib/esm/types/types/ModalButtonType.d.ts +17 -0
- package/lib/esm/types/types/ModalSize.d.ts +11 -0
- package/lib/esm/types/types/ModalType.d.ts +16 -0
- package/lib/esm/types/types/ParamType.d.ts +17 -0
- package/lib/esm/types/types/ReactKitErrorCode.d.ts +13 -0
- package/lib/esm/types/types/Variant.d.ts +15 -0
- package/lib/index.d.ts +274 -0
- package/package.json +26 -5
- package/rollup.config.js +43 -0
- package/src/components/AppWrapper.tsx +212 -36
- package/src/components/LoadingSpinner.tsx +3 -0
- package/src/components/Modal.tsx +65 -95
- package/src/components/TabBox.tsx +136 -0
- package/src/helpers/abbreviate.tsx +2 -0
- package/src/helpers/padDecimalZeros.tsx +1 -1
- package/src/index.ts +61 -0
- package/src/types/ModalButtonType.tsx +18 -0
- package/src/types/ModalSize.tsx +12 -0
- package/src/types/ModalType.tsx +17 -0
- package/tsconfig.json +14 -17
- package/lib/components/AppWrapper.d.ts +0 -20
- package/lib/components/AppWrapper.js +0 -133
- package/lib/components/AppWrapper.js.map +0 -1
- package/lib/components/ErrorBox.js +0 -65
- package/lib/components/ErrorBox.js.map +0 -1
- package/lib/components/LoadingSpinner.js +0 -41
- package/lib/components/LoadingSpinner.js.map +0 -1
- package/lib/components/Modal.d.ts +0 -69
- package/lib/components/Modal.js +0 -315
- package/lib/components/Modal.js.map +0 -1
- package/lib/errors/ErrorWithCode.js +0 -33
- package/lib/errors/ErrorWithCode.js.map +0 -1
- package/lib/helpers/abbreviate.js +0 -21
- package/lib/helpers/abbreviate.js.map +0 -1
- package/lib/helpers/avg.js +0 -24
- package/lib/helpers/avg.js.map +0 -1
- package/lib/helpers/ceilToNumDecimals.js +0 -15
- package/lib/helpers/ceilToNumDecimals.js.map +0 -1
- package/lib/helpers/floorToNumDecimals.js +0 -15
- package/lib/helpers/floorToNumDecimals.js.map +0 -1
- package/lib/helpers/forceNumIntoBounds.js +0 -15
- package/lib/helpers/forceNumIntoBounds.js.map +0 -1
- package/lib/helpers/handleError.js +0 -54
- package/lib/helpers/handleError.js.map +0 -1
- package/lib/helpers/handleSuccess.js +0 -20
- package/lib/helpers/handleSuccess.js.map +0 -1
- package/lib/helpers/padDecimalZeros.js +0 -30
- package/lib/helpers/padDecimalZeros.js.map +0 -1
- package/lib/helpers/padZerosLeft.js +0 -21
- package/lib/helpers/padZerosLeft.js.map +0 -1
- package/lib/helpers/parseRequest.js +0 -240
- package/lib/helpers/parseRequest.js.map +0 -1
- package/lib/helpers/roundToNumDecimals.js +0 -15
- package/lib/helpers/roundToNumDecimals.js.map +0 -1
- package/lib/helpers/showFatalError.d.ts +0 -2
- package/lib/helpers/showFatalError.js +0 -5
- package/lib/helpers/showFatalError.js.map +0 -1
- package/lib/helpers/sum.js +0 -15
- package/lib/helpers/sum.js.map +0 -1
- package/lib/helpers/visitServerEndpoint.js +0 -135
- package/lib/helpers/visitServerEndpoint.js.map +0 -1
- package/lib/helpers/waitMs.js +0 -55
- package/lib/helpers/waitMs.js.map +0 -1
- package/lib/types/ParamType.js +0 -21
- package/lib/types/ParamType.js.map +0 -1
- package/lib/types/ReactKitErrorCode.js +0 -18
- package/lib/types/ReactKitErrorCode.js.map +0 -1
- package/lib/types/Variant.js +0 -19
- package/lib/types/Variant.js.map +0 -1
- package/src/helpers/handleError.ts +0 -65
- package/src/helpers/handleSuccess.ts +0 -18
- package/src/helpers/parseRequest.ts +0 -299
- package/src/helpers/showFatalError.tsx +0 -3
- package/src/helpers/visitServerEndpoint.tsx +0 -110
- package/src/types/ParamType.ts +0 -18
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
/**
|
|
19
|
-
* An error with a code
|
|
20
|
-
* @author Gabe Abrams
|
|
21
|
-
*/
|
|
22
|
-
var ErrorWithCode = /** @class */ (function (_super) {
|
|
23
|
-
__extends(ErrorWithCode, _super);
|
|
24
|
-
function ErrorWithCode(message, code) {
|
|
25
|
-
var _this = _super.call(this, message) || this;
|
|
26
|
-
_this.name = 'ErrorWithCode';
|
|
27
|
-
_this.code = code;
|
|
28
|
-
return _this;
|
|
29
|
-
}
|
|
30
|
-
return ErrorWithCode;
|
|
31
|
-
}(Error));
|
|
32
|
-
exports.default = ErrorWithCode;
|
|
33
|
-
//# sourceMappingURL=ErrorWithCode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorWithCode.js","sourceRoot":"","sources":["../../src/errors/ErrorWithCode.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH;IAA4B,iCAAK;IAG/B,uBAAY,OAAe,EAAE,IAAY;QAAzC,YACE,kBAAM,OAAO,CAAC,SAGf;QAFC,KAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;;IACnB,CAAC;IACH,oBAAC;AAAD,CAAC,AARD,CAA4B,KAAK,GAQhC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shorten text so it fits into a certain number of chars
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
* @param text the text to abbreviate
|
|
5
|
-
* @param maxChars the maximum number of chars to include
|
|
6
|
-
* @returns abbreviated text with length no greater than maxChars
|
|
7
|
-
* (including ellipses if applicable)
|
|
8
|
-
*/
|
|
9
|
-
var abbreviate = function (text, maxChars) {
|
|
10
|
-
// Check if already short enough
|
|
11
|
-
if (text.trim().length < maxChars) {
|
|
12
|
-
return text.trim();
|
|
13
|
-
}
|
|
14
|
-
// Abbreviate
|
|
15
|
-
var shortenedText = (text
|
|
16
|
-
.trim()
|
|
17
|
-
.substring(0, maxChars - 3)
|
|
18
|
-
.trim());
|
|
19
|
-
return "".concat(shortenedText, "...");
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=abbreviate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abbreviate.js","sourceRoot":"","sources":["../../src/helpers/abbreviate.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,IAAM,UAAU,GAAG,UAAC,IAAY,EAAE,QAAgB;IAChD,gCAAgC;IAChC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,QAAQ,EAAE;QACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;KACpB;IAED,aAAa;IACb,IAAM,aAAa,GAAG,CACpB,IAAI;SACD,IAAI,EAAE;SACN,SAAS,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC;SAC1B,IAAI,EAAE,CACV,CAAC;IACF,OAAO,UAAG,aAAa,QAAK,CAAC;AAC/B,CAAC,CAAC"}
|
package/lib/helpers/avg.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var sum_1 = __importDefault(require("./sum"));
|
|
7
|
-
/**
|
|
8
|
-
* Get the average of a set of numbers
|
|
9
|
-
* @author Gabe Abrams
|
|
10
|
-
* @param nums the numbers to average
|
|
11
|
-
* @returns average value or 0 if no numbers
|
|
12
|
-
*/
|
|
13
|
-
var avg = function (nums) {
|
|
14
|
-
// Handle empty array case
|
|
15
|
-
if (nums.length === 0) {
|
|
16
|
-
return 0;
|
|
17
|
-
}
|
|
18
|
-
// Get the total value
|
|
19
|
-
var total = (0, sum_1.default)(nums);
|
|
20
|
-
// Get average
|
|
21
|
-
return (total / nums.length);
|
|
22
|
-
};
|
|
23
|
-
exports.default = avg;
|
|
24
|
-
//# sourceMappingURL=avg.js.map
|
package/lib/helpers/avg.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"avg.js","sourceRoot":"","sources":["../../src/helpers/avg.tsx"],"names":[],"mappings":";;;;;AAAA,8CAAwB;AAExB;;;;;GAKG;AACH,IAAM,GAAG,GAAG,UAAC,IAAc;IACzB,0BAA0B;IAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,CAAC,CAAC;KACV;IAED,sBAAsB;IACtB,IAAM,KAAK,GAAG,IAAA,aAAG,EAAC,IAAI,CAAC,CAAC;IAExB,cAAc;IACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Round a number (ceiling) to a certain number of decimals
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to round
|
|
7
|
-
* @param numDecimals the number of decimals to round to
|
|
8
|
-
* @returns rounded number
|
|
9
|
-
*/
|
|
10
|
-
var ceilToNumDecimals = function (num, numDecimals) {
|
|
11
|
-
var rounder = Math.pow(10, numDecimals);
|
|
12
|
-
return (Math.ceil(num * rounder) / rounder);
|
|
13
|
-
};
|
|
14
|
-
exports.default = ceilToNumDecimals;
|
|
15
|
-
//# sourceMappingURL=ceilToNumDecimals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ceilToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/ceilToNumDecimals.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,iBAAiB,GAAG,UAAC,GAAW,EAAE,WAAmB;IACzD,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Round a number (floor) to a certain number of decimals
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to round
|
|
7
|
-
* @param numDecimals the number of decimals to round to
|
|
8
|
-
* @returns rounded number
|
|
9
|
-
*/
|
|
10
|
-
var floorToNumDecimals = function (num, numDecimals) {
|
|
11
|
-
var rounder = Math.pow(10, numDecimals);
|
|
12
|
-
return (Math.floor(num * rounder) / rounder);
|
|
13
|
-
};
|
|
14
|
-
exports.default = floorToNumDecimals;
|
|
15
|
-
//# sourceMappingURL=floorToNumDecimals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"floorToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/floorToNumDecimals.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,WAAmB;IAC1D,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Force a number to stay within specific bounds
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to move into the bounds
|
|
7
|
-
* @param min the minimum number in the bound
|
|
8
|
-
* @param max the maximum number in the bound
|
|
9
|
-
* @returns bounded number
|
|
10
|
-
*/
|
|
11
|
-
var forceNumIntoBounds = function (num, min, max) {
|
|
12
|
-
return Math.max(min, Math.min(max, num));
|
|
13
|
-
};
|
|
14
|
-
exports.default = forceNumIntoBounds;
|
|
15
|
-
//# sourceMappingURL=forceNumIntoBounds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forceNumIntoBounds.js","sourceRoot":"","sources":["../../src/helpers/forceNumIntoBounds.tsx"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAC/D,OAAO,IAAI,CAAC,GAAG,CACb,GAAG,EACH,IAAI,CAAC,GAAG,CACN,GAAG,EACH,GAAG,CACJ,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// Import shared types
|
|
7
|
-
var ReactKitErrorCode_1 = __importDefault(require("../types/ReactKitErrorCode"));
|
|
8
|
-
/**
|
|
9
|
-
* Handle an error and respond to the client
|
|
10
|
-
* @author Gabe Abrams
|
|
11
|
-
* @param res express response
|
|
12
|
-
* @param error error info
|
|
13
|
-
* @param opts.err the error to send to the client
|
|
14
|
-
* or the error message
|
|
15
|
-
* @param [opts.code] an error code (only used if err.code is not
|
|
16
|
-
* included)
|
|
17
|
-
* @param [opts.status=500] the https status code to use
|
|
18
|
-
* defined)
|
|
19
|
-
*/
|
|
20
|
-
var handleError = function (res, error) {
|
|
21
|
-
// Get the error message
|
|
22
|
-
var message;
|
|
23
|
-
if (error && error.message) {
|
|
24
|
-
message = (error.message || 'An unknown error occurred.');
|
|
25
|
-
}
|
|
26
|
-
else if (typeof error === 'string') {
|
|
27
|
-
message = (error.trim().length > 0
|
|
28
|
-
? error
|
|
29
|
-
: 'An unknown error occurred.');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
message = 'An unknown error occurred.';
|
|
33
|
-
}
|
|
34
|
-
// Get the error code
|
|
35
|
-
var code = (error.code || ReactKitErrorCode_1.default.NoCode);
|
|
36
|
-
// Get the status code
|
|
37
|
-
var status = (error.status || 500);
|
|
38
|
-
// Respond to user
|
|
39
|
-
res
|
|
40
|
-
// Set the http status code
|
|
41
|
-
.status(status)
|
|
42
|
-
// Send a JSON response
|
|
43
|
-
.json({
|
|
44
|
-
// Error message
|
|
45
|
-
message: message,
|
|
46
|
-
// Error code
|
|
47
|
-
code: code,
|
|
48
|
-
// Success = false flag so client can detect server-side errors
|
|
49
|
-
success: false,
|
|
50
|
-
});
|
|
51
|
-
return undefined;
|
|
52
|
-
};
|
|
53
|
-
exports.default = handleError;
|
|
54
|
-
//# sourceMappingURL=handleError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleError.js","sourceRoot":"","sources":["../../src/helpers/handleError.ts"],"names":[],"mappings":";;;;;AAAA,sBAAsB;AACtB,iFAA2D;AAE3D;;;;;;;;;;;GAWG;AACH,IAAM,WAAW,GAAG,UAClB,GAAQ,EACR,KASC;IAED,wBAAwB;IACxB,IAAI,OAAO,CAAC;IACZ,IAAI,KAAK,IAAK,KAAa,CAAC,OAAO,EAAE;QACnC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,4BAA4B,CAAC,CAAC;KAC3D;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,OAAO,GAAG,CACR,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,4BAA4B,CACjC,CAAC;KACH;SAAM;QACL,OAAO,GAAG,4BAA4B,CAAC;KACxC;IAED,qBAAqB;IACrB,IAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,2BAAiB,CAAC,MAAM,CAAC,CAAC;IAEtD,sBAAsB;IACtB,IAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;IAErC,kBAAkB;IAClB,GAAG;QACD,2BAA2B;SAC1B,MAAM,CAAC,MAAM,CAAC;QACf,uBAAuB;SACtB,IAAI,CAAC;QACJ,gBAAgB;QAChB,OAAO,SAAA;QACP,aAAa;QACb,IAAI,MAAA;QACJ,+DAA+D;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IACL,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Send successful API response
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param res express response
|
|
7
|
-
* @param body the body of the response to send to the client
|
|
8
|
-
*/
|
|
9
|
-
var handleSuccess = function (res, body) {
|
|
10
|
-
// Send a http 200 json response
|
|
11
|
-
res.json({
|
|
12
|
-
// Include the body as a parameter
|
|
13
|
-
body: body,
|
|
14
|
-
// Success = true flag so client can detect successful responses
|
|
15
|
-
success: true,
|
|
16
|
-
});
|
|
17
|
-
return undefined;
|
|
18
|
-
};
|
|
19
|
-
exports.default = handleSuccess;
|
|
20
|
-
//# sourceMappingURL=handleSuccess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleSuccess.js","sourceRoot":"","sources":["../../src/helpers/handleSuccess.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,IAAM,aAAa,GAAG,UAAC,GAAQ,EAAE,IAAS;IACxC,gCAAgC;IAChC,GAAG,CAAC,IAAI,CAAC;QACP,kCAAkC;QAClC,IAAI,MAAA;QACJ,gEAAgE;QAChE,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Pad a number's decimal with zeros on the right
|
|
5
|
-
* (e.g. 5.2 becomes 5.20 with 2 digit padding)
|
|
6
|
-
* @author Gabe Abrams
|
|
7
|
-
* @param num the number to pad
|
|
8
|
-
* @param numDigits the minimum number of digits after the decimal
|
|
9
|
-
* @returns padded number
|
|
10
|
-
*/
|
|
11
|
-
var padDecimalZeros = function (num, numDigits) {
|
|
12
|
-
// Skip if nothing to do
|
|
13
|
-
if (numDigits < 1) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
// Convert to string
|
|
17
|
-
var out = String(num);
|
|
18
|
-
// Add a decimal point if there isn't one
|
|
19
|
-
if (!out.includes('.')) {
|
|
20
|
-
out += '.';
|
|
21
|
-
}
|
|
22
|
-
// Add zeros
|
|
23
|
-
while (out.split('.')[1].length < numDigits) {
|
|
24
|
-
out = "".concat(out, "0");
|
|
25
|
-
}
|
|
26
|
-
// Return
|
|
27
|
-
return out;
|
|
28
|
-
};
|
|
29
|
-
exports.default = padDecimalZeros;
|
|
30
|
-
//# sourceMappingURL=padDecimalZeros.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padDecimalZeros.js","sourceRoot":"","sources":["../../src/helpers/padDecimalZeros.tsx"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,eAAe,GAAG,UAAC,GAAW,EAAE,SAAiB;IACrD,wBAAwB;IACxB,IAAI,SAAS,GAAG,CAAC,EAAE;QACjB,OAAO;KACR;IAED,oBAAoB;IACpB,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEtB,yCAAyC;IACzC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,GAAG,IAAI,GAAG,CAAC;KACZ;IAED,YAAY;IACZ,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE;QAC3C,GAAG,GAAG,UAAG,GAAG,MAAG,CAAC;KACjB;IAED,SAAS;IACT,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Pad a number with zeros on the left (e.g. 5 becomes 05 with 2 digit padding)
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to pad
|
|
7
|
-
* @param numDigits the minimum number of digits before the decimal
|
|
8
|
-
* @returns padded number
|
|
9
|
-
*/
|
|
10
|
-
var padZerosLeft = function (num, numDigits) {
|
|
11
|
-
// Convert to string
|
|
12
|
-
var out = String(num);
|
|
13
|
-
// Add zeros
|
|
14
|
-
while (out.split('.')[0].length < numDigits) {
|
|
15
|
-
out = "0".concat(out);
|
|
16
|
-
}
|
|
17
|
-
// Return
|
|
18
|
-
return out;
|
|
19
|
-
};
|
|
20
|
-
exports.default = padZerosLeft;
|
|
21
|
-
//# sourceMappingURL=padZerosLeft.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padZerosLeft.js","sourceRoot":"","sources":["../../src/helpers/padZerosLeft.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,YAAY,GAAG,UAAC,GAAW,EAAE,SAAiB;IAClD,oBAAoB;IACpB,IAAI,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEtB,YAAY;IACZ,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE;QAC3C,GAAG,GAAG,WAAI,GAAG,CAAE,CAAC;KACjB;IAED,SAAS;IACT,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// Import caccl libs
|
|
7
|
-
var caccl_lti_1 = require("caccl-lti");
|
|
8
|
-
// Import shared types
|
|
9
|
-
var ReactKitErrorCode_1 = __importDefault(require("../types/ReactKitErrorCode"));
|
|
10
|
-
var ParamType_1 = __importDefault(require("../types/ParamType"));
|
|
11
|
-
// Import helpers
|
|
12
|
-
var handleError_1 = __importDefault(require("./handleError"));
|
|
13
|
-
/**
|
|
14
|
-
* Parse express request params and body
|
|
15
|
-
* @author Gabe Abrams
|
|
16
|
-
* @param opts object containing all arguments
|
|
17
|
-
* @param opts.req express request instance
|
|
18
|
-
* @param opts.res express response instance
|
|
19
|
-
* @param opts.params map of parameters that should be parsed out of the request
|
|
20
|
-
* @returns parsed params + user info from session (if it exists) or undefined
|
|
21
|
-
* if an error occurred
|
|
22
|
-
*/
|
|
23
|
-
var parseRequest = function (opts) {
|
|
24
|
-
// Output
|
|
25
|
-
var output = {};
|
|
26
|
-
/*----------------------------------------*/
|
|
27
|
-
/* Parse Params */
|
|
28
|
-
/*----------------------------------------*/
|
|
29
|
-
// Process items one by one
|
|
30
|
-
var paramList = Object.entries(opts.params);
|
|
31
|
-
for (var i = 0; i < paramList.length; i++) {
|
|
32
|
-
var _a = paramList[i], name_1 = _a[0], type = _a[1];
|
|
33
|
-
// Find the value as a string
|
|
34
|
-
var value = (opts.req.params[name_1]
|
|
35
|
-
|| opts.req.query[name_1]
|
|
36
|
-
|| opts.req.body[name_1]);
|
|
37
|
-
// Parse
|
|
38
|
-
if (type === ParamType_1.default.Boolean || type === ParamType_1.default.BooleanOptional) {
|
|
39
|
-
// Boolean
|
|
40
|
-
// Handle case where value doesn't exist
|
|
41
|
-
if (value === undefined) {
|
|
42
|
-
if (type === ParamType_1.default.BooleanOptional) {
|
|
43
|
-
output[name_1] = undefined;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return (0, handleError_1.default)(opts.res, {
|
|
47
|
-
message: "Parameter ".concat(name_1, " is required, but it was not included."),
|
|
48
|
-
code: ReactKitErrorCode_1.default.MissingParameter,
|
|
49
|
-
status: 422,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// Value exists
|
|
55
|
-
// Simplify value
|
|
56
|
-
var simpleVal = (String(value)
|
|
57
|
-
.trim()
|
|
58
|
-
.toLowerCase());
|
|
59
|
-
// Parse
|
|
60
|
-
output[name_1] = ([
|
|
61
|
-
'true',
|
|
62
|
-
'yes',
|
|
63
|
-
'y',
|
|
64
|
-
'1',
|
|
65
|
-
't',
|
|
66
|
-
].indexOf(simpleVal) >= 0);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else if (type === ParamType_1.default.Float || type === ParamType_1.default.FloatOptional) {
|
|
70
|
-
// Float
|
|
71
|
-
// Handle case where value doesn't exist
|
|
72
|
-
if (value === undefined) {
|
|
73
|
-
if (type === ParamType_1.default.FloatOptional) {
|
|
74
|
-
output[name_1] = undefined;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return (0, handleError_1.default)(opts.res, {
|
|
78
|
-
message: "Parameter ".concat(name_1, " is required, but it was not included."),
|
|
79
|
-
code: ReactKitErrorCode_1.default.MissingParameter,
|
|
80
|
-
status: 422,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else if (!Number.isNaN(Number.parseFloat(String(value)))) {
|
|
85
|
-
// Value is a number
|
|
86
|
-
output[name_1] = Number.parseFloat(String(value));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
// Issue!
|
|
90
|
-
return (0, handleError_1.default)(opts.res, {
|
|
91
|
-
message: "Request data was malformed: ".concat(name_1, " was not a valid float."),
|
|
92
|
-
code: ReactKitErrorCode_1.default.InvalidParameter,
|
|
93
|
-
status: 422,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else if (type === ParamType_1.default.Int || type === ParamType_1.default.IntOptional) {
|
|
98
|
-
// Int
|
|
99
|
-
// Handle case where value doesn't exist
|
|
100
|
-
if (value === undefined) {
|
|
101
|
-
if (type === ParamType_1.default.IntOptional) {
|
|
102
|
-
output[name_1] = undefined;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
return (0, handleError_1.default)(opts.res, {
|
|
106
|
-
message: "Parameter ".concat(name_1, " is required, but it was not included."),
|
|
107
|
-
code: ReactKitErrorCode_1.default.MissingParameter,
|
|
108
|
-
status: 422,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
else if (!Number.isNaN(Number.parseInt(String(value), 10))) {
|
|
113
|
-
// Value is a number
|
|
114
|
-
output[name_1] = Number.parseInt(String(value), 10);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
// Issue!
|
|
118
|
-
return (0, handleError_1.default)(opts.res, {
|
|
119
|
-
message: "Request data was malformed: ".concat(name_1, " was not a valid int."),
|
|
120
|
-
code: ReactKitErrorCode_1.default.InvalidParameter,
|
|
121
|
-
status: 422,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else if (type === ParamType_1.default.JSON || type === ParamType_1.default.JSONOptional) {
|
|
126
|
-
// Stringified JSON
|
|
127
|
-
// Handle case where value doesn't exist
|
|
128
|
-
if (value === undefined) {
|
|
129
|
-
if (type === ParamType_1.default.JSONOptional) {
|
|
130
|
-
output[name_1] = undefined;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return (0, handleError_1.default)(opts.res, {
|
|
134
|
-
message: "Parameter ".concat(name_1, " is required, but it was not included."),
|
|
135
|
-
code: ReactKitErrorCode_1.default.MissingParameter,
|
|
136
|
-
status: 422,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
// Value exists
|
|
142
|
-
// Parse
|
|
143
|
-
try {
|
|
144
|
-
output[name_1] = JSON.parse(String(value));
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
return (0, handleError_1.default)(opts.res, {
|
|
148
|
-
message: "Request data was malformed: ".concat(name_1, " was not a valid JSON payload."),
|
|
149
|
-
code: ReactKitErrorCode_1.default.InvalidParameter,
|
|
150
|
-
status: 422,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else if (type === ParamType_1.default.String || type === ParamType_1.default.StringOptional) {
|
|
156
|
-
// String
|
|
157
|
-
// Handle case where value doesn't exist
|
|
158
|
-
if (value === undefined) {
|
|
159
|
-
if (type === ParamType_1.default.StringOptional) {
|
|
160
|
-
output[name_1] = undefined;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
return (0, handleError_1.default)(opts.res, {
|
|
164
|
-
message: "Parameter ".concat(name_1, " is required, but it was not included."),
|
|
165
|
-
code: ReactKitErrorCode_1.default.MissingParameter,
|
|
166
|
-
status: 422,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
// Value exists
|
|
172
|
-
// Leave as is
|
|
173
|
-
output[name_1] = value;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
// No valid data type
|
|
178
|
-
return (0, handleError_1.default)(opts.res, {
|
|
179
|
-
message: "An internal error occurred: we could not determine the type of ".concat(name_1, "."),
|
|
180
|
-
code: ReactKitErrorCode_1.default.InvalidParameter,
|
|
181
|
-
status: 422,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/*----------------------------------------*/
|
|
186
|
-
/* Launch Info */
|
|
187
|
-
/*----------------------------------------*/
|
|
188
|
-
// Get launch info
|
|
189
|
-
var _b = (0, caccl_lti_1.getLaunchInfo)(opts.req), launched = _b.launched, launchInfo = _b.launchInfo;
|
|
190
|
-
if (!launched || !launchInfo) {
|
|
191
|
-
return (0, handleError_1.default)(opts.res, {
|
|
192
|
-
message: 'Your session has expired. Please refresh the page and try again.',
|
|
193
|
-
code: ReactKitErrorCode_1.default.SessionExpired,
|
|
194
|
-
status: 440,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
// Error if user info cannot be found
|
|
198
|
-
if (!launchInfo.userId
|
|
199
|
-
|| !launchInfo.userFirstName
|
|
200
|
-
|| !launchInfo.userLastName
|
|
201
|
-
|| (launchInfo.notInCourse
|
|
202
|
-
&& !launchInfo.isAdmin)
|
|
203
|
-
|| (!launchInfo.isTTM
|
|
204
|
-
&& !launchInfo.isLearner
|
|
205
|
-
&& !launchInfo.isAdmin)) {
|
|
206
|
-
return (0, handleError_1.default)(opts.res, {
|
|
207
|
-
message: 'Your session was invalid. Please refresh the page and try again.',
|
|
208
|
-
code: ReactKitErrorCode_1.default.SessionExpired,
|
|
209
|
-
status: 440,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
// Add launch info to output
|
|
213
|
-
output.userId = launchInfo.userId;
|
|
214
|
-
output.userFirstName = launchInfo.userFirstName;
|
|
215
|
-
output.userLastName = launchInfo.userLastName;
|
|
216
|
-
output.isLearner = !!launchInfo.isLearner;
|
|
217
|
-
output.isTTM = !!launchInfo.isTTM;
|
|
218
|
-
output.isAdmin = !!launchInfo.isAdmin;
|
|
219
|
-
output.isWatchingInPrivate = !!(opts.req.session.isWatchingInPrivate);
|
|
220
|
-
/*----------------------------------------*/
|
|
221
|
-
/* Require Course Consistency */
|
|
222
|
-
/*----------------------------------------*/
|
|
223
|
-
// Make sure the user actually launched from the appropriate course
|
|
224
|
-
if (output.courseId
|
|
225
|
-
&& launchInfo.courseId
|
|
226
|
-
&& output.courseId !== launchInfo.courseId
|
|
227
|
-
&& !output.isTTM
|
|
228
|
-
&& !output.isAdmin) {
|
|
229
|
-
// Course of interest is not the launch course
|
|
230
|
-
return (0, handleError_1.default)(opts.res, {
|
|
231
|
-
message: 'You switched sessions by opening Immersive Classroom in another tab. Please refresh the page and try again.',
|
|
232
|
-
code: ReactKitErrorCode_1.default.WrongCourse,
|
|
233
|
-
status: 401,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
// Return processed params
|
|
237
|
-
return output;
|
|
238
|
-
};
|
|
239
|
-
exports.default = parseRequest;
|
|
240
|
-
//# sourceMappingURL=parseRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequest.js","sourceRoot":"","sources":["../../src/helpers/parseRequest.ts"],"names":[],"mappings":";;;;;AAAA,oBAAoB;AACpB,uCAA0C;AAE1C,sBAAsB;AACtB,iFAA2D;AAC3D,iEAA2C;AAE3C,iBAAiB;AACjB,8DAAwC;AAExC;;;;;;;;;GASG;AACH,IAAM,YAAY,GAAG,UACnB,IAMC;IAED,SAAS;IAET,IAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAE5C,2BAA2B;IAC3B,IAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAA,KAAe,SAAS,CAAC,CAAC,CAAC,EAA1B,MAAI,QAAA,EAAE,IAAI,QAAgB,CAAC;QAElC,6BAA6B;QAC7B,IAAM,KAAK,GAAG,CACZ,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAI,CAAC;eAClB,IAAI,CAAC,GAAG,CAAC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__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Round a number to a certain number of decimals
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param num the number to round
|
|
7
|
-
* @param numDecimals the number of decimals to round to
|
|
8
|
-
* @returns rounded number
|
|
9
|
-
*/
|
|
10
|
-
var roundToNumDecimals = function (num, numDecimals) {
|
|
11
|
-
var rounder = Math.pow(10, numDecimals);
|
|
12
|
-
return (Math.round(num * rounder) / rounder);
|
|
13
|
-
};
|
|
14
|
-
exports.default = roundToNumDecimals;
|
|
15
|
-
//# sourceMappingURL=roundToNumDecimals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roundToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/roundToNumDecimals.tsx"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,WAAmB;IAC1D,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"showFatalError.js","sourceRoot":"","sources":["../../src/helpers/showFatalError.tsx"],"names":[],"mappings":";;AAAA,uDAA0D;AAE1D,kBAAe,2BAAc,CAAC"}
|
package/lib/helpers/sum.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Sum the numbers in an array
|
|
5
|
-
* @author Gabe Abrams
|
|
6
|
-
* @param nums the numbers to sum
|
|
7
|
-
* @returns the sum of the numbers
|
|
8
|
-
*/
|
|
9
|
-
var sum = function (nums) {
|
|
10
|
-
return nums.reduce(function (a, b) {
|
|
11
|
-
return (a + b);
|
|
12
|
-
}, 0);
|
|
13
|
-
};
|
|
14
|
-
exports.default = sum;
|
|
15
|
-
//# sourceMappingURL=sum.js.map
|
package/lib/helpers/sum.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sum.js","sourceRoot":"","sources":["../../src/helpers/sum.tsx"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,IAAM,GAAG,GAAG,UAAC,IAAc;IACzB,OAAO,IAAI,CAAC,MAAM,CAChB,UAAC,CAAS,EAAE,CAAS;QACnB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|