@wacht/jsx 0.0.1-alpha.57 → 0.0.1-alpha.59

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
@@ -31,6 +31,8 @@ import { LabelHTMLAttributes } from 'react';
31
31
  import { ListContextsOptions } from '@wacht/types';
32
32
  import { NewDomain } from '@wacht/types';
33
33
  import { NewOrgnization } from '@wacht/types';
34
+ import { Notification as Notification_2 } from '@wacht/types';
35
+ import { NotificationListParams } from '@wacht/types';
34
36
  import { Organization } from '@wacht/types';
35
37
  import { OrganizationDomain } from '@wacht/types';
36
38
  import { OrganizationInvitation } from '@wacht/types';
@@ -92,10 +94,6 @@ declare interface AcceptInviteProps {
92
94
 
93
95
  export declare function AuthFormImage(): JSX.Element | null;
94
96
 
95
- export declare interface BulkUpdateResponse {
96
- affected: number;
97
- }
98
-
99
97
  /**
100
98
  * Check if user can manage the organization (admin or manage permissions)
101
99
  */
@@ -106,22 +104,6 @@ export declare function canManageOrganization(membership: WithOrgRoles): boolean
106
104
  */
107
105
  export declare function canManageWorkspace(membership: WithWsRoles): boolean;
108
106
 
109
- export declare interface ChannelCounts {
110
- user: number;
111
- organization: number;
112
- workspace: number;
113
- current: number;
114
- total: number;
115
- }
116
-
117
- export declare function ChannelSelector({ selectedChannels, channelCounts, onChannelsChange }: ChannelSelectorProps): JSX.Element;
118
-
119
- declare interface ChannelSelectorProps {
120
- selectedChannels: string[];
121
- channelCounts?: ChannelCounts;
122
- onChannelsChange: (channels: string[]) => void;
123
- }
124
-
125
107
  export declare function clearTokenCache(): void;
126
108
 
127
109
  declare const CONNECTION_STATES: {
@@ -155,13 +137,13 @@ declare interface CreateWorkspaceDialogProps {
155
137
  isOpen: boolean;
156
138
  onClose?: () => void;
157
139
  onCreated?: () => void;
158
- organizationId: string;
140
+ organizationId?: string;
159
141
  }
160
142
 
161
143
  export declare const CreateWorkspaceForm: default_2.FC<CreateWorkspaceFormProps>;
162
144
 
163
145
  declare interface CreateWorkspaceFormProps {
164
- organizationId: string;
146
+ organizationId?: string;
165
147
  onSuccess?: (workspace?: any) => void;
166
148
  onCancel?: () => void;
167
149
  onCreateOrganization?: () => void;
@@ -212,11 +194,13 @@ export declare const Dialog: FC<DialogProps> & {
212
194
  declare interface DialogBodyProps {
213
195
  children: ReactNode;
214
196
  style?: React.CSSProperties;
197
+ className?: string;
215
198
  }
216
199
 
217
200
  declare interface DialogContentProps {
218
201
  children: ReactNode;
219
202
  style?: React.CSSProperties;
203
+ className?: string;
220
204
  }
221
205
 
222
206
  declare interface DialogFooterProps {
@@ -284,8 +268,6 @@ declare type EmailSignInParams = {
284
268
  password: string;
285
269
  };
286
270
 
287
- export declare function fetchChannelCounts(client: Client): Promise<ChannelCounts>;
288
-
289
271
  export declare const Form: IStyledComponentBase<"web", FastOmit<DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, never>> & string;
290
272
 
291
273
  export declare const FormGroup: IStyledComponentBase<"web", FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -429,64 +411,37 @@ export declare interface NavigationProps {
429
411
  [key: string]: any;
430
412
  }
431
413
 
432
- declare interface Notification_2 {
414
+ declare type NotificationAction = {
415
+ type: 'read';
433
416
  id: string;
434
- deployment_id: string;
435
- user_id: string;
436
- organization_id?: string;
437
- workspace_id?: string;
438
- title: string;
439
- body: string;
440
- action_url?: string;
441
- action_label?: string;
442
- severity: "info" | "success" | "warning" | "error";
443
- is_read: boolean;
444
- read_at?: string;
445
- is_archived: boolean;
446
- archived_at?: string;
447
- metadata?: Record<string, any>;
448
- created_at: string;
449
- updated_at: string;
450
- expires_at?: string;
451
- }
452
- export { Notification_2 as Notification }
417
+ } | {
418
+ type: 'unread';
419
+ id: string;
420
+ } | {
421
+ type: 'archive';
422
+ id: string;
423
+ } | {
424
+ type: 'star';
425
+ id: string;
426
+ } | {
427
+ type: 'custom';
428
+ payload: any;
429
+ };
453
430
 
454
- export declare function NotificationBell({ className, showBadge, channels, organizationIds, workspaceIds, }: NotificationBellProps): JSX.Element;
431
+ export declare function NotificationBell({ className, showBadge, scope, onAction, }: NotificationBellProps): JSX.Element;
455
432
 
456
433
  declare interface NotificationBellProps {
457
434
  className?: string;
458
435
  showBadge?: boolean;
459
- channels?: string[];
460
- organizationIds?: number[];
461
- workspaceIds?: number[];
436
+ scope?: "all" | "current" | "user";
437
+ onAction?: (payload: any) => void;
462
438
  }
463
439
 
464
- export declare function NotificationItem({ notification, onMarkAsRead, onDelete }: NotificationItemProps): JSX.Element;
440
+ export declare function NotificationItem({ notification, onAction, }: NotificationItemProps): JSX.Element;
465
441
 
466
442
  declare interface NotificationItemProps {
467
443
  notification: Notification_2;
468
- onMarkAsRead: (id: string) => void;
469
- onDelete: (id: string) => void;
470
- }
471
-
472
- export declare interface NotificationListParams {
473
- limit?: number;
474
- offset?: number;
475
- channels?: string[];
476
- organization_ids?: number[];
477
- workspace_ids?: number[];
478
- is_read?: boolean;
479
- is_archived?: boolean;
480
- severity?: "info" | "success" | "warning" | "error";
481
- }
482
-
483
- export declare interface NotificationListResponse {
484
- notifications: Notification_2[];
485
- total: number;
486
- unread_count: number;
487
- has_more: boolean;
488
- channels: string[];
489
- unread_counts: ChannelCounts;
444
+ onAction: (action: NotificationAction) => void;
490
445
  }
491
446
 
492
447
  export declare interface NotificationMessage {
@@ -496,25 +451,34 @@ export declare interface NotificationMessage {
496
451
  title: string;
497
452
  body: string;
498
453
  severity: string;
499
- action_url?: string;
500
- action_label?: string;
454
+ ctas?: {
455
+ label: string;
456
+ payload: any;
457
+ }[];
501
458
  created_at: string;
502
459
  }
503
460
 
461
+ export declare const NotificationPanel: ForwardRefExoticComponent<NotificationPanelProps & RefAttributes<HTMLDivElement>>;
462
+
463
+ declare interface NotificationPanelProps {
464
+ scope?: "all" | "current" | "user";
465
+ onAction?: (payload: any) => void;
466
+ fullWidth?: boolean;
467
+ maxHeight?: string;
468
+ className?: string;
469
+ }
470
+
504
471
  export declare const NotificationPopover: ForwardRefExoticComponent<NotificationPopoverProps & RefAttributes<HTMLDivElement>>;
505
472
 
506
- declare interface NotificationPopoverProps {
473
+ declare interface NotificationPopoverProps extends Omit<NotificationPanelProps, 'fullWidth' | 'maxHeight'> {
507
474
  position?: {
508
475
  top?: number;
509
476
  bottom?: number;
510
477
  left?: number;
511
478
  right?: number;
479
+ maxHeight?: number;
512
480
  };
513
- notifications: Notification_2[];
514
- loading: boolean;
515
- onMarkAsRead: (id: string) => void;
516
- onMarkAllAsRead: () => void;
517
- onDelete: (id: string) => void;
481
+ onClose?: () => void;
518
482
  }
519
483
 
520
484
  export declare enum OAuthProvider {
@@ -549,6 +513,15 @@ declare interface OTPInputProps {
549
513
  isSubmitting?: boolean;
550
514
  }
551
515
 
516
+ export declare interface PaginatedResponse<T> {
517
+ data: T;
518
+ meta: {
519
+ total: number;
520
+ page: number;
521
+ limit: number;
522
+ };
523
+ }
524
+
552
525
  export declare const PhoneNumberInput: ({ value, onChange, error, countryCode, setCountryCode, }: {
553
526
  value: string | number | readonly string[] | undefined;
554
527
  onChange: React.ChangeEventHandler<HTMLInputElement>;
@@ -764,10 +737,6 @@ declare interface TwoFactorMethodSelectorProps {
764
737
 
765
738
  export declare function TwoFactorVerification({ onBack, attempt, completeVerification, prepareVerification, }: Omit<ProfileCompletionProps, "completeProfile">): JSX.Element;
766
739
 
767
- export declare interface UnreadCountResponse {
768
- count: number;
769
- }
770
-
771
740
  export declare const useActiveOrganization: () => {
772
741
  activeOrganization: null;
773
742
  activeMembership: null;
@@ -808,7 +777,7 @@ export declare const useActiveOrganization: () => {
808
777
  updateOrganization: (update: OrganizationUpdate) => Promise<{
809
778
  data: Organization;
810
779
  } | never[]>;
811
- getMembers: () => Promise<OrganizationMembership[]>;
780
+ getMembers: () => Promise<PaginatedResponse<OrganizationMembership[]> | never[]>;
812
781
  getDomains: () => Promise<OrganizationDomain[]>;
813
782
  addDomain: (domain: NewDomain) => Promise<{
814
783
  data: OrganizationDomain;
@@ -880,9 +849,16 @@ export declare const useActiveWorkspace: () => {
880
849
  name?: string;
881
850
  description?: string;
882
851
  image?: File;
852
+ enforce_2fa?: boolean;
853
+ enable_ip_restriction?: boolean;
854
+ whitelisted_ips?: string[];
883
855
  }) => Promise<unknown>;
884
856
  deleteWorkspace: () => Promise<unknown>;
885
- getMembers: () => Promise<WorkspaceMembership[]>;
857
+ getMembers: (params?: {
858
+ page: number;
859
+ limit: number;
860
+ search?: string;
861
+ }) => Promise<PaginatedResponse<WorkspaceMembership[]>>;
886
862
  getRoles: () => Promise<WorkspaceRole[]>;
887
863
  createRole: (name: string, permissions: string[]) => Promise<WorkspaceRole | undefined>;
888
864
  deleteRole: (role: WorkspaceRole) => Promise<unknown>;
@@ -933,7 +909,11 @@ declare interface UseAgentContextProps {
933
909
  onUserInputRequest?: (request: UserInputRequestContent) => Promise<string>;
934
910
  }
935
911
 
936
- export declare function useAgentContexts(options?: ListContextsOptions): UseAgentContextsReturnType;
912
+ export declare function useAgentContexts(options?: UseAgentContextsOptions): UseAgentContextsReturnType;
913
+
914
+ declare interface UseAgentContextsOptions extends ListContextsOptions {
915
+ enabled?: boolean;
916
+ }
937
917
 
938
918
  declare type UseAgentContextsReturnType = {
939
919
  contexts: AgentContext[];
@@ -975,20 +955,6 @@ declare interface UseAgentSessionResult {
975
955
  refetch: () => Promise<void>;
976
956
  }
977
957
 
978
- export declare function useChannelCounts(): UseChannelCountsReturnType;
979
-
980
- declare type UseChannelCountsReturnType = {
981
- loading: true;
982
- counts: never;
983
- error: Error | null;
984
- refetch: () => Promise<void>;
985
- } | {
986
- loading: false;
987
- counts: ChannelCounts;
988
- error: Error | null;
989
- refetch: () => Promise<void>;
990
- };
991
-
992
958
  export declare function useClient(): UseClientReturnType;
993
959
 
994
960
  declare type UseClientReturnType = {
@@ -998,14 +964,6 @@ declare type UseClientReturnType = {
998
964
 
999
965
  export declare function useDeployment(): DeploymentContextType_2;
1000
966
 
1001
- export declare function useExchangeTicket(ticket?: string | null): UseExchangeTicketResult;
1002
-
1003
- declare interface UseExchangeTicketResult {
1004
- exchanged: boolean;
1005
- loading: boolean;
1006
- error: Error | null;
1007
- }
1008
-
1009
967
  export declare function useForgotPassword(): {
1010
968
  loading: boolean;
1011
969
  forgotPassword: (email: string) => Promise<ApiResult<{}, ErrorInterface>>;
@@ -1040,32 +998,38 @@ export declare const useNavigation: () => {
1040
998
  navigateToSignUp: (redirectUri?: string) => void;
1041
999
  };
1042
1000
 
1043
- export declare function useNotifications(params?: NotificationListParams): UseNotificationsReturnType;
1001
+ export declare function useNotifications(params?: UseNotificationsOptions): UseNotificationsReturnType;
1002
+
1003
+ export declare interface UseNotificationsOptions extends NotificationListParams {
1004
+ onNotification?: (notification: NotificationMessage) => void;
1005
+ }
1044
1006
 
1045
1007
  declare type UseNotificationsReturnType = {
1046
1008
  loading: true;
1047
- notifications: never;
1048
- unreadCount: never;
1049
- unreadCounts: never;
1050
- channels: never;
1051
- hasMore: never;
1009
+ notifications: Notification_2[];
1010
+ hasMore: boolean;
1052
1011
  markAsRead: never;
1053
1012
  markAllAsRead: never;
1054
- deleteNotification: never;
1013
+ archiveAllRead: never;
1014
+ archiveNotification: never;
1015
+ starNotification: never;
1016
+ markAsUnread: never;
1055
1017
  error: Error | null;
1056
1018
  refetch: () => Promise<void>;
1019
+ loadMore: () => Promise<void>;
1057
1020
  } | {
1058
1021
  loading: false;
1059
1022
  error: Error | null;
1060
1023
  notifications: Notification_2[];
1061
- unreadCount: number;
1062
- unreadCounts: ChannelCounts;
1063
- channels: string[];
1064
1024
  hasMore: boolean;
1065
1025
  markAsRead: (notificationId: string) => Promise<void>;
1066
1026
  markAllAsRead: () => Promise<void>;
1067
- deleteNotification: (notificationId: string) => Promise<void>;
1027
+ archiveAllRead: () => Promise<void>;
1028
+ archiveNotification: (notificationId: string) => Promise<void>;
1029
+ starNotification: (notificationId: string) => Promise<void>;
1030
+ markAsUnread: (notificationId: string) => Promise<void>;
1068
1031
  refetch: () => Promise<void>;
1032
+ loadMore: () => Promise<void>;
1069
1033
  };
1070
1034
 
1071
1035
  export declare function useNotificationStream({ enabled, channels, organizationIds, workspaceIds, onNotification, onError, reconnectDelay, maxReconnectAttempts, }?: UseNotificationStreamOptions): {
@@ -1093,7 +1057,11 @@ export declare const useOrganizationList: () => {
1093
1057
  refetch: () => Promise<void>;
1094
1058
  leaveOrganization: (organization: Organization) => Promise<void>;
1095
1059
  getOrganizationRoles: (organization: Organization) => Promise<OrganizationRole[]>;
1096
- getOrganizationMembers: (organization: Organization) => Promise<OrganizationMembership[]>;
1060
+ getOrganizationMembers: (organization: Organization, params?: {
1061
+ page: number;
1062
+ limit: number;
1063
+ search?: string;
1064
+ }) => Promise<PaginatedResponse<OrganizationMembership[]>>;
1097
1065
  removeOrganizationMember: (organization: Organization, member: OrganizationMembership) => Promise<void>;
1098
1066
  createOrganization: (organization: NewOrgnization) => Promise<ApiResult< {
1099
1067
  organization: Organization;
@@ -1167,6 +1135,20 @@ declare type UsernameSignInParams = {
1167
1135
  password: string;
1168
1136
  };
1169
1137
 
1138
+ export declare function useScopeUnread(params?: NotificationListParams): UseScopeUnreadReturnType;
1139
+
1140
+ declare type UseScopeUnreadReturnType = {
1141
+ loading: true;
1142
+ count: number;
1143
+ error: Error | null;
1144
+ refetch: () => Promise<void>;
1145
+ } | {
1146
+ loading: false;
1147
+ count: number;
1148
+ error: Error | null;
1149
+ refetch: () => Promise<void>;
1150
+ };
1151
+
1170
1152
  export declare function useSession(): UseSessionReturnType;
1171
1153
 
1172
1154
  declare type UseSessionReturnType = {
@@ -1351,7 +1333,11 @@ export declare const useWorkspaceList: () => {
1351
1333
  whitelisted_ips?: string[];
1352
1334
  }) => Promise<unknown>;
1353
1335
  deleteWorkspace: (workspace: Workspace) => Promise<unknown>;
1354
- getWorkspaceMembers: (workspace: Workspace) => Promise<WorkspaceMembership[]>;
1336
+ getWorkspaceMembers: (workspace: Workspace, params?: {
1337
+ page: number;
1338
+ limit: number;
1339
+ search?: string;
1340
+ }) => Promise<PaginatedResponse<WorkspaceMembership[]>>;
1355
1341
  getWorkspaceRoles: (workspace: Workspace) => Promise<WorkspaceRole[]>;
1356
1342
  createWorkspaceRole: (workspace: Workspace, name: string, permissions: string[]) => Promise<WorkspaceRole>;
1357
1343
  deleteWorkspaceRole: (workspace: Workspace, role: WorkspaceRole) => Promise<unknown>;