dce-reactkit 4.2.0-beta-select-admin-check.2 → 4.2.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/dist/cjs/index.js +41 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/isSelectAdmin.d.ts +7 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/types/types/LogAction.d.ts +2 -0
- package/dist/esm/index.js +41 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/isSelectAdmin.d.ts +7 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/types/types/LogAction.d.ts +2 -0
- package/dist/index.d.ts +10 -1
- package/package.json +1 -1
- package/src/helpers/isSelectAdmin.ts +48 -0
- package/src/index.ts +2 -0
- package/src/types/LogAction.ts +4 -0
|
@@ -81,6 +81,7 @@ import shuffleArray from './helpers/shuffleArray';
|
|
|
81
81
|
import getWordCount from './helpers/getWordCount';
|
|
82
82
|
import cloneDeep from './helpers/cloneDeep';
|
|
83
83
|
import getTimestampFromTimeInfoInET from './helpers/getTimestampFromTimeInfoInET';
|
|
84
|
+
import isSelectAdmin from './helpers/isSelectAdmin';
|
|
84
85
|
import ParamType from './types/ParamType';
|
|
85
86
|
import ModalButtonType from './types/ModalButtonType';
|
|
86
87
|
import ModalSize from './types/ModalSize';
|
|
@@ -106,4 +107,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
|
106
107
|
import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
|
|
107
108
|
import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
|
|
108
109
|
import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
|
|
109
|
-
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, SimpleTimeChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, LogReviewerFilterState, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
|
|
110
|
+
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, SimpleTimeChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, isSelectAdmin, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, LogReviewerFilterState, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
|
package/dist/esm/index.js
CHANGED
|
@@ -3848,6 +3848,10 @@ var LogAction;
|
|
|
3848
3848
|
LogAction["Jump"] = "Jump";
|
|
3849
3849
|
// Post a submission/message/etc. into the target
|
|
3850
3850
|
LogAction["Post"] = "Post";
|
|
3851
|
+
// Like something
|
|
3852
|
+
LogAction["Like"] = "Like";
|
|
3853
|
+
// Dislike something
|
|
3854
|
+
LogAction["Dislike"] = "Dislike";
|
|
3851
3855
|
// Unknown action
|
|
3852
3856
|
LogAction["Unknown"] = "Unknown";
|
|
3853
3857
|
})(LogAction || (LogAction = {}));
|
|
@@ -16395,6 +16399,42 @@ const getTimestampFromTimeInfoInET = (opts) => {
|
|
|
16395
16399
|
return timestamp;
|
|
16396
16400
|
};
|
|
16397
16401
|
|
|
16402
|
+
/*------------------------------------------------------------------------*/
|
|
16403
|
+
/* ------------------------------- Caching ------------------------------ */
|
|
16404
|
+
/*------------------------------------------------------------------------*/
|
|
16405
|
+
// If true, user is a select admin
|
|
16406
|
+
let cachedUserIsSelectAdmin;
|
|
16407
|
+
/*------------------------------------------------------------------------*/
|
|
16408
|
+
/* -------------------------------- Main -------------------------------- */
|
|
16409
|
+
/*------------------------------------------------------------------------*/
|
|
16410
|
+
/**
|
|
16411
|
+
* Checks if the current user is a select admin
|
|
16412
|
+
* @author Gardenia Liu
|
|
16413
|
+
* @returns true if the user is a select admin, false otherwise
|
|
16414
|
+
*/
|
|
16415
|
+
const isSelectAdmin = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16416
|
+
// Use cached version if we have one
|
|
16417
|
+
if (cachedUserIsSelectAdmin !== undefined) {
|
|
16418
|
+
return cachedUserIsSelectAdmin;
|
|
16419
|
+
}
|
|
16420
|
+
// Check if the user is a select admin
|
|
16421
|
+
try {
|
|
16422
|
+
const userIsSelectAdmin = yield visitServerEndpoint({
|
|
16423
|
+
path: SELECT_ADMIN_CHECK_ROUTE,
|
|
16424
|
+
method: 'GET',
|
|
16425
|
+
});
|
|
16426
|
+
// Cache the result
|
|
16427
|
+
cachedUserIsSelectAdmin = !!userIsSelectAdmin;
|
|
16428
|
+
// Return the result
|
|
16429
|
+
return userIsSelectAdmin;
|
|
16430
|
+
}
|
|
16431
|
+
catch (err) {
|
|
16432
|
+
// Error means the user isn't a select admin
|
|
16433
|
+
cachedUserIsSelectAdmin = false;
|
|
16434
|
+
return false;
|
|
16435
|
+
}
|
|
16436
|
+
});
|
|
16437
|
+
|
|
16398
16438
|
/**
|
|
16399
16439
|
* Days of the week
|
|
16400
16440
|
* @author Gabe Abrams
|
|
@@ -16411,5 +16451,5 @@ var DayOfWeek;
|
|
|
16411
16451
|
})(DayOfWeek || (DayOfWeek = {}));
|
|
16412
16452
|
var DayOfWeek$1 = DayOfWeek;
|
|
16413
16453
|
|
|
16414
|
-
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, Dropdown, DropdownItemType$1 as DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LOG_REVIEW_GET_LOGS_ROUTE, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogLevel$1 as LogLevel, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SELECT_ADMIN_CHECK_ROUTE, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, cloneDeep, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getTimestampFromTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
16454
|
+
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, Dropdown, DropdownItemType$1 as DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LOG_REVIEW_GET_LOGS_ROUTE, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogLevel$1 as LogLevel, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SELECT_ADMIN_CHECK_ROUTE, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, cloneDeep, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getTimestampFromTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, isSelectAdmin, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
16415
16455
|
//# sourceMappingURL=index.js.map
|