@selfcommunity/react-core 0.4.50-events.82 → 0.4.50-events.83

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.
@@ -6,6 +6,7 @@ import { SCUserType } from '@selfcommunity/types';
6
6
  export declare const ADMIN_ROLE = "admin";
7
7
  export declare const MODERATOR_ROLE = "moderator";
8
8
  export declare const EDITOR_ROLE = "editor";
9
+ export declare const COMMUNITY_CREATOR = 1;
9
10
  /**
10
11
  * Get user role from roles(set)
11
12
  * @param user
@@ -18,6 +19,12 @@ export declare function getUserRole(user: SCUserType): string | null;
18
19
  * @returns boolean
19
20
  */
20
21
  export declare function isAdmin(user: SCUserType): boolean;
22
+ /**
23
+ * Check if user is admin
24
+ * @param user
25
+ * @returns boolean
26
+ */
27
+ export declare function isCommunityCreator(user: SCUserType): boolean;
21
28
  /**
22
29
  * Check if user is moderator
23
30
  * @param user
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBlocked = exports.isStaff = exports.isEditor = exports.isModerator = exports.isAdmin = exports.getUserRole = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
3
+ exports.isBlocked = exports.isStaff = exports.isEditor = exports.isModerator = exports.isCommunityCreator = exports.isAdmin = exports.getUserRole = exports.COMMUNITY_CREATOR = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
4
4
  const types_1 = require("@selfcommunity/types");
5
5
  /**
6
6
  * Staff Roles
@@ -9,6 +9,7 @@ const types_1 = require("@selfcommunity/types");
9
9
  exports.ADMIN_ROLE = 'admin';
10
10
  exports.MODERATOR_ROLE = 'moderator';
11
11
  exports.EDITOR_ROLE = 'editor';
12
+ exports.COMMUNITY_CREATOR = 1;
12
13
  /**
13
14
  * Get user role from roles(set)
14
15
  * @param user
@@ -39,6 +40,15 @@ function isAdmin(user) {
39
40
  return getUserRole(user) === exports.ADMIN_ROLE;
40
41
  }
41
42
  exports.isAdmin = isAdmin;
43
+ /**
44
+ * Check if user is admin
45
+ * @param user
46
+ * @returns boolean
47
+ */
48
+ function isCommunityCreator(user) {
49
+ return user && user.id === exports.COMMUNITY_CREATOR;
50
+ }
51
+ exports.isCommunityCreator = isCommunityCreator;
42
52
  /**
43
53
  * Check if user is moderator
44
54
  * @param user
@@ -6,6 +6,7 @@ import { SCUserType } from '@selfcommunity/types';
6
6
  export declare const ADMIN_ROLE = "admin";
7
7
  export declare const MODERATOR_ROLE = "moderator";
8
8
  export declare const EDITOR_ROLE = "editor";
9
+ export declare const COMMUNITY_CREATOR = 1;
9
10
  /**
10
11
  * Get user role from roles(set)
11
12
  * @param user
@@ -18,6 +19,12 @@ export declare function getUserRole(user: SCUserType): string | null;
18
19
  * @returns boolean
19
20
  */
20
21
  export declare function isAdmin(user: SCUserType): boolean;
22
+ /**
23
+ * Check if user is admin
24
+ * @param user
25
+ * @returns boolean
26
+ */
27
+ export declare function isCommunityCreator(user: SCUserType): boolean;
21
28
  /**
22
29
  * Check if user is moderator
23
30
  * @param user
@@ -6,6 +6,7 @@ import { SCUserStatus } from '@selfcommunity/types';
6
6
  export const ADMIN_ROLE = 'admin';
7
7
  export const MODERATOR_ROLE = 'moderator';
8
8
  export const EDITOR_ROLE = 'editor';
9
+ export const COMMUNITY_CREATOR = 1;
9
10
  /**
10
11
  * Get user role from roles(set)
11
12
  * @param user
@@ -34,6 +35,14 @@ export function getUserRole(user) {
34
35
  export function isAdmin(user) {
35
36
  return getUserRole(user) === ADMIN_ROLE;
36
37
  }
38
+ /**
39
+ * Check if user is admin
40
+ * @param user
41
+ * @returns boolean
42
+ */
43
+ export function isCommunityCreator(user) {
44
+ return user && user.id === COMMUNITY_CREATOR;
45
+ }
37
46
  /**
38
47
  * Check if user is moderator
39
48
  * @param user