PluginProbe
Parse.ly / 3.24.2
Parse.ly v3.24.2
3.24.3 3.24.2 3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 All 107 releases
wp-parsely / src / content-helper / common / utils / permissions.ts

permissions.ts in Parse.ly 3.24.2, at src/content-helper/common/utils/permissions.ts

40 lines 919 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Defines the structure of a Content Intelligence Permissions object.
3 *
4 * @since 3.16.0
5 */
6 export interface ContentHelperPermissions {
7 ExcerptSuggestions: boolean;
8 SmartLinking: boolean;
9 TitleSuggestions: boolean;
10 TrafficBoost: boolean;
11 }
12
13 /**
14 * Returns the current user's permissions for Content Intelligence.
15 *
16 * @since 3.16.0
17 *
18 * @return {ContentHelperPermissions} The current user's permissions.
19 */
20 export function getContentHelperPermissions(): ContentHelperPermissions {
21 const defaultPermissions: ContentHelperPermissions = {
22 ExcerptSuggestions: false,
23 SmartLinking: false,
24 TitleSuggestions: false,
25 TrafficBoost: false,
26 };
27
28 try {
29 const permissions = JSON.parse( window.wpParselyContentHelperPermissions );
30
31 if ( 'object' !== typeof permissions || null === permissions ) {
32 return defaultPermissions;
33 }
34
35 return permissions;
36 } catch ( e ) {
37 return defaultPermissions;
38 }
39 }
40