@wacht/jsx 0.0.1-alpha.39 → 0.0.1-alpha.40

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/index.d.ts CHANGED
@@ -133,6 +133,16 @@ export declare interface BulkUpdateResponse {
133
133
  affected: number;
134
134
  }
135
135
 
136
+ /**
137
+ * Check if user can manage the organization (admin or manage permissions)
138
+ */
139
+ export declare function canManageOrganization(membership: WithOrgRoles): boolean;
140
+
141
+ /**
142
+ * Check if user can manage the workspace (admin or manage permissions)
143
+ */
144
+ export declare function canManageWorkspace(membership: WithWsRoles): boolean;
145
+
136
146
  export declare interface ChannelCounts {
137
147
  user: number;
138
148
  organization: number;
@@ -369,6 +379,16 @@ declare type GenericSignInParams = {
369
379
 
370
380
  export declare function hasIncompleteProfile(session: Session): boolean;
371
381
 
382
+ /**
383
+ * Check if an organization membership has any of the specified permissions
384
+ */
385
+ export declare function hasOrgPermission(membership: WithOrgRoles, requiredPermissions: string[]): boolean;
386
+
387
+ /**
388
+ * Check if a workspace membership has any of the specified permissions
389
+ */
390
+ export declare function hasWorkspacePermission(membership: WithWsRoles, requiredPermissions: string[]): boolean;
391
+
372
392
  export declare interface IdentifyResult {
373
393
  strategy: "sso" | "social" | "password";
374
394
  connection_id?: string;
@@ -391,8 +411,18 @@ export declare const Input: IStyledComponentBase<"web", FastOmit<DetailedHTMLPro
391
411
 
392
412
  export declare const isExternalUrl: (url: string) => boolean;
393
413
 
414
+ /**
415
+ * Check if user is an organization admin (only admin permission)
416
+ */
417
+ export declare function isOrgAdmin(membership: WithOrgRoles): boolean;
418
+
394
419
  export declare const isSafeUrl: (url: string) => boolean;
395
420
 
421
+ /**
422
+ * Check if user is a workspace admin (only admin permission)
423
+ */
424
+ export declare function isWorkspaceAdmin(membership: WithWsRoles): boolean;
425
+
396
426
  export declare const Label: IStyledComponentBase<"web", FastOmit<DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
397
427
 
398
428
  export declare interface ListSessionsOptions {
@@ -581,6 +611,10 @@ export declare enum OAuthProvider {
581
611
  AppleOauth = "apple_oauth"
582
612
  }
583
613
 
614
+ export declare const ORG_ADMIN_PERMISSIONS: string[];
615
+
616
+ export declare const ORG_MANAGEMENT_PERMISSIONS: string[];
617
+
584
618
  export declare const OrganizationSwitcher: ({ showPersonal, }: OrganizationSwitcherProps) => JSX.Element | null;
585
619
 
586
620
  declare interface OrganizationSwitcherProps {
@@ -820,6 +854,7 @@ export declare interface UnreadCountResponse {
820
854
 
821
855
  export declare const useActiveOrganization: () => {
822
856
  activeOrganization: null;
857
+ activeMembership: null;
823
858
  loading: boolean;
824
859
  error: Error | null;
825
860
  updateOrganization: never;
@@ -850,6 +885,7 @@ export declare const useActiveOrganization: () => {
850
885
  testEnterpriseConnection?: undefined;
851
886
  } | {
852
887
  activeOrganization: Organization | null;
888
+ activeMembership: OrganizationMembershipWithOrganization | null;
853
889
  loading: boolean;
854
890
  refetch: () => Promise<void>;
855
891
  getRoles: () => Promise<OrganizationRole[]>;
@@ -919,6 +955,7 @@ export declare function useActiveTenancy(): {
919
955
 
920
956
  export declare const useActiveWorkspace: () => {
921
957
  activeWorkspace: Workspace | null;
958
+ activeMembership: WorkspaceMembership | null;
922
959
  loading: boolean;
923
960
  error: any;
924
961
  refetch: () => Promise<void>;
@@ -1400,17 +1437,19 @@ export declare interface WaitlistResponse {
1400
1437
  entry: WaitlistEntry;
1401
1438
  }
1402
1439
 
1440
+ declare type WithOrgRoles = {
1441
+ roles?: OrganizationRole[];
1442
+ } | null | undefined;
1443
+
1444
+ declare type WithWsRoles = {
1445
+ roles?: WorkspaceRole[];
1446
+ } | null | undefined;
1447
+
1448
+ export declare const WORKSPACE_ADMIN_PERMISSIONS: string[];
1449
+
1450
+ export declare const WORKSPACE_MANAGEMENT_PERMISSIONS: string[];
1451
+
1403
1452
 
1404
1453
  export * from "@wacht/types";
1405
1454
 
1406
1455
  export { }
1407
-
1408
-
1409
- declare module "@wacht/types" {
1410
- interface OrganizationMembershipWithOrganization {
1411
- eligibility_restriction?: EligibilityRestriction;
1412
- }
1413
- interface WorkspaceMembershipWithWorkspace {
1414
- eligibility_restriction?: EligibilityRestriction;
1415
- }
1416
- }