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
package/dist/cjs/index.js
CHANGED
|
@@ -3875,6 +3875,10 @@ var LogAction;
|
|
|
3875
3875
|
LogAction["Jump"] = "Jump";
|
|
3876
3876
|
// Post a submission/message/etc. into the target
|
|
3877
3877
|
LogAction["Post"] = "Post";
|
|
3878
|
+
// Like something
|
|
3879
|
+
LogAction["Like"] = "Like";
|
|
3880
|
+
// Dislike something
|
|
3881
|
+
LogAction["Dislike"] = "Dislike";
|
|
3878
3882
|
// Unknown action
|
|
3879
3883
|
LogAction["Unknown"] = "Unknown";
|
|
3880
3884
|
})(LogAction || (LogAction = {}));
|
|
@@ -16422,6 +16426,42 @@ const getTimestampFromTimeInfoInET = (opts) => {
|
|
|
16422
16426
|
return timestamp;
|
|
16423
16427
|
};
|
|
16424
16428
|
|
|
16429
|
+
/*------------------------------------------------------------------------*/
|
|
16430
|
+
/* ------------------------------- Caching ------------------------------ */
|
|
16431
|
+
/*------------------------------------------------------------------------*/
|
|
16432
|
+
// If true, user is a select admin
|
|
16433
|
+
let cachedUserIsSelectAdmin;
|
|
16434
|
+
/*------------------------------------------------------------------------*/
|
|
16435
|
+
/* -------------------------------- Main -------------------------------- */
|
|
16436
|
+
/*------------------------------------------------------------------------*/
|
|
16437
|
+
/**
|
|
16438
|
+
* Checks if the current user is a select admin
|
|
16439
|
+
* @author Gardenia Liu
|
|
16440
|
+
* @returns true if the user is a select admin, false otherwise
|
|
16441
|
+
*/
|
|
16442
|
+
const isSelectAdmin = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16443
|
+
// Use cached version if we have one
|
|
16444
|
+
if (cachedUserIsSelectAdmin !== undefined) {
|
|
16445
|
+
return cachedUserIsSelectAdmin;
|
|
16446
|
+
}
|
|
16447
|
+
// Check if the user is a select admin
|
|
16448
|
+
try {
|
|
16449
|
+
const userIsSelectAdmin = yield visitServerEndpoint({
|
|
16450
|
+
path: SELECT_ADMIN_CHECK_ROUTE,
|
|
16451
|
+
method: 'GET',
|
|
16452
|
+
});
|
|
16453
|
+
// Cache the result
|
|
16454
|
+
cachedUserIsSelectAdmin = !!userIsSelectAdmin;
|
|
16455
|
+
// Return the result
|
|
16456
|
+
return userIsSelectAdmin;
|
|
16457
|
+
}
|
|
16458
|
+
catch (err) {
|
|
16459
|
+
// Error means the user isn't a select admin
|
|
16460
|
+
cachedUserIsSelectAdmin = false;
|
|
16461
|
+
return false;
|
|
16462
|
+
}
|
|
16463
|
+
});
|
|
16464
|
+
|
|
16425
16465
|
/**
|
|
16426
16466
|
* Days of the week
|
|
16427
16467
|
* @author Gabe Abrams
|
|
@@ -16517,6 +16557,7 @@ exports.getWordCount = getWordCount;
|
|
|
16517
16557
|
exports.idify = idify;
|
|
16518
16558
|
exports.initClient = initClient;
|
|
16519
16559
|
exports.isMobileOrTablet = isMobileOrTablet;
|
|
16560
|
+
exports.isSelectAdmin = isSelectAdmin;
|
|
16520
16561
|
exports.leaveToURL = leaveToURL;
|
|
16521
16562
|
exports.logClientEvent = logClientEvent;
|
|
16522
16563
|
exports.makeLinksClickable = makeLinksClickable;
|