dce-reactkit 2.0.11 → 3.0.0-beta.10

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.
Files changed (129) hide show
  1. package/dist/cjs/index.js +921 -0
  2. package/dist/cjs/index.js.map +1 -0
  3. package/{lib → dist/cjs/types}/components/AppWrapper.d.ts +9 -4
  4. package/{lib → dist/cjs/types}/components/ErrorBox.d.ts +0 -0
  5. package/{lib → dist/cjs/types}/components/LoadingSpinner.d.ts +1 -0
  6. package/{lib → dist/cjs/types}/components/Modal.d.ts +5 -36
  7. package/{lib → dist/cjs/types}/components/TabBox.d.ts +0 -0
  8. package/{lib → dist/cjs/types}/errors/ErrorWithCode.d.ts +0 -0
  9. package/{lib → dist/cjs/types}/helpers/abbreviate.d.ts +1 -0
  10. package/{lib → dist/cjs/types}/helpers/avg.d.ts +0 -0
  11. package/{lib → dist/cjs/types}/helpers/ceilToNumDecimals.d.ts +0 -0
  12. package/{lib → dist/cjs/types}/helpers/floorToNumDecimals.d.ts +0 -0
  13. package/{lib → dist/cjs/types}/helpers/forceNumIntoBounds.d.ts +0 -0
  14. package/{lib → dist/cjs/types}/helpers/padDecimalZeros.d.ts +0 -0
  15. package/{lib → dist/cjs/types}/helpers/padZerosLeft.d.ts +0 -0
  16. package/{lib → dist/cjs/types}/helpers/roundToNumDecimals.d.ts +0 -0
  17. package/{lib → dist/cjs/types}/helpers/sum.d.ts +0 -0
  18. package/{lib → dist/cjs/types}/helpers/waitMs.d.ts +0 -0
  19. package/dist/cjs/types/index.d.ts +22 -0
  20. package/dist/cjs/types/types/ModalButtonType.d.ts +17 -0
  21. package/dist/cjs/types/types/ModalSize.d.ts +11 -0
  22. package/dist/cjs/types/types/ModalType.d.ts +16 -0
  23. package/{lib → dist/cjs/types}/types/ReactKitErrorCode.d.ts +0 -0
  24. package/{lib → dist/cjs/types}/types/Variant.d.ts +0 -0
  25. package/dist/esm/index.js +890 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/types/components/AppWrapper.d.ts +40 -0
  28. package/dist/esm/types/components/ErrorBox.d.ts +12 -0
  29. package/dist/esm/types/components/LoadingSpinner.d.ts +7 -0
  30. package/dist/esm/types/components/Modal.d.ts +40 -0
  31. package/dist/esm/types/components/TabBox.d.ts +11 -0
  32. package/dist/esm/types/errors/ErrorWithCode.d.ts +9 -0
  33. package/dist/esm/types/helpers/abbreviate.d.ts +10 -0
  34. package/dist/esm/types/helpers/avg.d.ts +8 -0
  35. package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +9 -0
  36. package/dist/esm/types/helpers/floorToNumDecimals.d.ts +9 -0
  37. package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +10 -0
  38. package/dist/esm/types/helpers/padDecimalZeros.d.ts +10 -0
  39. package/dist/esm/types/helpers/padZerosLeft.d.ts +9 -0
  40. package/dist/esm/types/helpers/roundToNumDecimals.d.ts +9 -0
  41. package/dist/esm/types/helpers/sum.d.ts +8 -0
  42. package/dist/esm/types/helpers/waitMs.d.ts +7 -0
  43. package/dist/esm/types/index.d.ts +22 -0
  44. package/dist/esm/types/types/ModalButtonType.d.ts +17 -0
  45. package/dist/esm/types/types/ModalSize.d.ts +11 -0
  46. package/dist/esm/types/types/ModalType.d.ts +16 -0
  47. package/dist/esm/types/types/ReactKitErrorCode.d.ts +13 -0
  48. package/dist/esm/types/types/Variant.d.ts +15 -0
  49. package/dist/index.d.ts +274 -0
  50. package/package.json +23 -15
  51. package/rollup.config.js +45 -0
  52. package/src/components/AppWrapper.tsx +38 -37
  53. package/src/components/LoadingSpinner.tsx +3 -0
  54. package/src/components/Modal.tsx +86 -173
  55. package/src/helpers/abbreviate.tsx +2 -0
  56. package/src/helpers/padDecimalZeros.tsx +1 -1
  57. package/src/index.ts +61 -0
  58. package/src/types/ModalButtonType.tsx +18 -0
  59. package/src/types/ModalSize.tsx +12 -0
  60. package/src/types/ModalType.tsx +17 -0
  61. package/tsconfig.json +16 -17
  62. package/lib/components/AppWrapper.js +0 -277
  63. package/lib/components/AppWrapper.js.map +0 -1
  64. package/lib/components/ErrorBox.js +0 -65
  65. package/lib/components/ErrorBox.js.map +0 -1
  66. package/lib/components/LoadingSpinner.js +0 -41
  67. package/lib/components/LoadingSpinner.js.map +0 -1
  68. package/lib/components/Modal.js +0 -321
  69. package/lib/components/Modal.js.map +0 -1
  70. package/lib/components/TabBox.js +0 -42
  71. package/lib/components/TabBox.js.map +0 -1
  72. package/lib/errors/ErrorWithCode.js +0 -33
  73. package/lib/errors/ErrorWithCode.js.map +0 -1
  74. package/lib/helpers/abbreviate.js +0 -21
  75. package/lib/helpers/abbreviate.js.map +0 -1
  76. package/lib/helpers/alert.d.ts +0 -2
  77. package/lib/helpers/alert.js +0 -5
  78. package/lib/helpers/alert.js.map +0 -1
  79. package/lib/helpers/avg.js +0 -24
  80. package/lib/helpers/avg.js.map +0 -1
  81. package/lib/helpers/ceilToNumDecimals.js +0 -15
  82. package/lib/helpers/ceilToNumDecimals.js.map +0 -1
  83. package/lib/helpers/confirm.d.ts +0 -2
  84. package/lib/helpers/confirm.js +0 -5
  85. package/lib/helpers/confirm.js.map +0 -1
  86. package/lib/helpers/floorToNumDecimals.js +0 -15
  87. package/lib/helpers/floorToNumDecimals.js.map +0 -1
  88. package/lib/helpers/forceNumIntoBounds.js +0 -15
  89. package/lib/helpers/forceNumIntoBounds.js.map +0 -1
  90. package/lib/helpers/handleError.d.ts +0 -14
  91. package/lib/helpers/handleError.js +0 -54
  92. package/lib/helpers/handleError.js.map +0 -1
  93. package/lib/helpers/handleSuccess.d.ts +0 -8
  94. package/lib/helpers/handleSuccess.js +0 -20
  95. package/lib/helpers/handleSuccess.js.map +0 -1
  96. package/lib/helpers/padDecimalZeros.js +0 -30
  97. package/lib/helpers/padDecimalZeros.js.map +0 -1
  98. package/lib/helpers/padZerosLeft.js +0 -21
  99. package/lib/helpers/padZerosLeft.js.map +0 -1
  100. package/lib/helpers/parseRequest.d.ts +0 -21
  101. package/lib/helpers/parseRequest.js +0 -240
  102. package/lib/helpers/parseRequest.js.map +0 -1
  103. package/lib/helpers/roundToNumDecimals.js +0 -15
  104. package/lib/helpers/roundToNumDecimals.js.map +0 -1
  105. package/lib/helpers/showFatalError.d.ts +0 -2
  106. package/lib/helpers/showFatalError.js +0 -5
  107. package/lib/helpers/showFatalError.js.map +0 -1
  108. package/lib/helpers/sum.js +0 -15
  109. package/lib/helpers/sum.js.map +0 -1
  110. package/lib/helpers/visitServerEndpoint.d.ts +0 -23
  111. package/lib/helpers/visitServerEndpoint.js +0 -135
  112. package/lib/helpers/visitServerEndpoint.js.map +0 -1
  113. package/lib/helpers/waitMs.js +0 -55
  114. package/lib/helpers/waitMs.js.map +0 -1
  115. package/lib/types/ParamType.d.ts +0 -17
  116. package/lib/types/ParamType.js +0 -21
  117. package/lib/types/ParamType.js.map +0 -1
  118. package/lib/types/ReactKitErrorCode.js +0 -18
  119. package/lib/types/ReactKitErrorCode.js.map +0 -1
  120. package/lib/types/Variant.js +0 -19
  121. package/lib/types/Variant.js.map +0 -1
  122. package/src/helpers/alert.tsx +0 -3
  123. package/src/helpers/confirm.tsx +0 -3
  124. package/src/helpers/handleError.ts +0 -65
  125. package/src/helpers/handleSuccess.ts +0 -18
  126. package/src/helpers/parseRequest.ts +0 -299
  127. package/src/helpers/showFatalError.tsx +0 -3
  128. package/src/helpers/visitServerEndpoint.tsx +0 -110
  129. package/src/types/ParamType.ts +0 -18
@@ -1,8 +0,0 @@
1
- /**
2
- * Send successful API response
3
- * @author Gabe Abrams
4
- * @param res express response
5
- * @param body the body of the response to send to the client
6
- */
7
- declare const handleSuccess: (res: any, body: any) => undefined;
8
- export default handleSuccess;
@@ -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,21 +0,0 @@
1
- import ParamType from '../types/ParamType';
2
- /**
3
- * Parse express request params and body
4
- * @author Gabe Abrams
5
- * @param opts object containing all arguments
6
- * @param opts.req express request instance
7
- * @param opts.res express response instance
8
- * @param opts.params map of parameters that should be parsed out of the request
9
- * @returns parsed params + user info from session (if it exists) or undefined
10
- * if an error occurred
11
- */
12
- declare const parseRequest: (opts: {
13
- req: any;
14
- res: any;
15
- params: {
16
- [x: string]: ParamType;
17
- };
18
- }) => {
19
- [x: string]: any;
20
- };
21
- export default parseRequest;
@@ -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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AC,UAAU,CAAC,OAAO,CAAC;IACtC,MAAM,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEtE,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAE5C,mEAAmE;IACnE,IACE,MAAM,CAAC,QAAQ;WACZ,UAAU,CAAC,QAAQ;WACnB,MAAM,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ;WACvC,CAAC,MAAM,CAAC,KAAK;WACb,CAAC,MAAM,CAAC,OAAO,EAClB;QACA,8CAA8C;QAC9C,OAAO,IAAA,qBAAW,EAChB,IAAI,CAAC,GAAG,EACR;YACE,OAAO,EAAE,6GAA6G;YACtH,IAAI,EAAE,2BAAiB,CAAC,WAAW;YACnC,MAAM,EAAE,GAAG;SACZ,CACF,CAAC;KACH;IAED,0BAA0B;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__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,2 +0,0 @@
1
- import { showFatalError } from '../components/AppWrapper';
2
- export default showFatalError;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var AppWrapper_1 = require("../components/AppWrapper");
4
- exports.default = AppWrapper_1.showFatalError;
5
- //# sourceMappingURL=showFatalError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"showFatalError.js","sourceRoot":"","sources":["../../src/helpers/showFatalError.tsx"],"names":[],"mappings":";;AAAA,uDAA0D;AAE1D,kBAAe,2BAAc,CAAC"}
@@ -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
@@ -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"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Set the session expiry handler
3
- * @author Gabe Abrams
4
- * @param handler new handler to use when session expires
5
- */
6
- export declare const setSessionExpiryHandler: (handler: () => void) => void;
7
- /**
8
- * Visit an endpoint on the server [for client only]
9
- * @author Gabe Abrams
10
- * @param opts object containing all arguments
11
- * @param opts.path - the path of the server endpoint
12
- * @param [opts.method=GET] - the method of the endpoint
13
- * @param [opts.params] - query/body parameters to include
14
- * @returns response from server
15
- */
16
- declare const visitServerEndpoint: (opts: {
17
- path: string;
18
- method?: ('GET' | 'POST' | 'DELETE' | 'PUT');
19
- params?: {
20
- [x: string]: any;
21
- };
22
- }) => Promise<any>;
23
- export default visitServerEndpoint;
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.setSessionExpiryHandler = void 0;
43
- // Initialize caccl
44
- var client_1 = require("caccl/client");
45
- // Import custom error
46
- var ErrorWithCode_1 = __importDefault(require("../errors/ErrorWithCode"));
47
- var ReactKitErrorCode_1 = __importDefault(require("../types/ReactKitErrorCode"));
48
- /*------------------------------------------------------------------------*/
49
- /* Listener */
50
- /*------------------------------------------------------------------------*/
51
- // Handler for session expiry
52
- var sessionExpiryHandler;
53
- // Keep track of whether or not session expiry has already been handled
54
- var sessionAlreadyExpired = false;
55
- /**
56
- * Set the session expiry handler
57
- * @author Gabe Abrams
58
- * @param handler new handler to use when session expires
59
- */
60
- var setSessionExpiryHandler = function (handler) {
61
- sessionExpiryHandler = handler;
62
- };
63
- exports.setSessionExpiryHandler = setSessionExpiryHandler;
64
- /*------------------------------------------------------------------------*/
65
- /* Main */
66
- /*------------------------------------------------------------------------*/
67
- /**
68
- * Visit an endpoint on the server [for client only]
69
- * @author Gabe Abrams
70
- * @param opts object containing all arguments
71
- * @param opts.path - the path of the server endpoint
72
- * @param [opts.method=GET] - the method of the endpoint
73
- * @param [opts.params] - query/body parameters to include
74
- * @returns response from server
75
- */
76
- var visitServerEndpoint = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
77
- var response, body;
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0: return [4 /*yield*/, (0, client_1.sendRequest)({
81
- path: opts.path,
82
- method: opts.method,
83
- params: opts.params,
84
- })];
85
- case 1:
86
- response = _a.sent();
87
- // Check for failure
88
- if (!response || !response.body) {
89
- throw new ErrorWithCode_1.default('We didn\'t get a response from the server. Please check your internet connection.', ReactKitErrorCode_1.default.NoResponse);
90
- }
91
- if (!!response.body.success) return [3 /*break*/, 6];
92
- if (!(response.body.code === ReactKitErrorCode_1.default.SessionExpired)) return [3 /*break*/, 5];
93
- if (!sessionAlreadyExpired) return [3 /*break*/, 3];
94
- // Never return (browser is already reloading)
95
- return [4 /*yield*/, new Promise(function () {
96
- // Promise that never returns
97
- })];
98
- case 2:
99
- // Never return (browser is already reloading)
100
- _a.sent();
101
- _a.label = 3;
102
- case 3:
103
- sessionAlreadyExpired = true;
104
- // Show session expiration message
105
- if (sessionExpiryHandler) {
106
- // Use handler
107
- sessionExpiryHandler();
108
- }
109
- else {
110
- // Fallback to alert
111
- // eslint-disable-next-line no-alert
112
- alert('Your session has expired. Please start over.');
113
- }
114
- // Never return (don't continue execution)
115
- return [4 /*yield*/, new Promise(function () {
116
- // Promise that never returns
117
- })];
118
- case 4:
119
- // Never return (don't continue execution)
120
- _a.sent();
121
- _a.label = 5;
122
- case 5:
123
- // Other errors
124
- throw new ErrorWithCode_1.default((response.body.message
125
- || 'An unknown error occurred. Please contact an admin.'), (response.body.code
126
- || ReactKitErrorCode_1.default.NoCode));
127
- case 6:
128
- body = response.body.body;
129
- // Return
130
- return [2 /*return*/, body];
131
- }
132
- });
133
- }); };
134
- exports.default = visitServerEndpoint;
135
- //# sourceMappingURL=visitServerEndpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitServerEndpoint.js","sourceRoot":"","sources":["../../src/helpers/visitServerEndpoint.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA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oB,EAAE,CAAC;iBACxB;qBAAM;oBACL,oBAAoB;oBAEpB,oCAAoC;oBACpC,KAAK,CAAC,8CAA8C,CAAC,CAAC;iBACvD;gBAED,0CAA0C;gBAC1C,qBAAM,IAAI,OAAO,CAA2B;wBAC1C,6BAA6B;oBAC/B,CAAC,CAAC,EAAA;;gBAHF,0CAA0C;gBAC1C,SAEE,CAAC;;;YAGL,eAAe;YACf,MAAM,IAAI,uBAAa,CACrB,CACE,QAAQ,CAAC,IAAI,CAAC,OAAO;mBAClB,qDAAqD,CACzD,EACD,CACE,QAAQ,CAAC,IAAI,CAAC,IAAI;mBACf,2BAAiB,CAAC,MAAM,CAC5B,CACF,CAAC;;gBAII,IAAI,GAAK,QAAQ,CAAC,IAAI,KAAlB,CAAmB;gBAE/B,SAAS;gBACT,sBAAO,IAAI,EAAC;;;KACb,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- /**
40
- * Wait for a certain number of ms
41
- * @author Gabe Abrams
42
- * @param ms number of ms to wait
43
- */
44
- var waitMs = function (ms) {
45
- if (ms === void 0) { ms = 0; }
46
- return __awaiter(void 0, void 0, void 0, function () {
47
- return __generator(this, function (_a) {
48
- return [2 /*return*/, new Promise(function (resolve) {
49
- setTimeout(resolve, ms);
50
- })];
51
- });
52
- });
53
- };
54
- exports.default = waitMs;
55
- //# sourceMappingURL=waitMs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"waitMs.js","sourceRoot":"","sources":["../../src/helpers/waitMs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,IAAM,MAAM,GAAG,UAAO,EAAM;IAAN,mBAAA,EAAA,MAAM;;;YAC1B,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO;oBACzB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC1B,CAAC,CAAC,EAAC;;;CACJ,CAAC;AAEF,kBAAe,MAAM,CAAC"}