@ynput/ayon-frontend-shared 0.8.0 → 0.8.1

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.
@@ -3856,6 +3856,27 @@ declare interface SlotMap {
3856
3856
  context: TableShortcutContext
3857
3857
  pieces: TableShortcutPieces
3858
3858
  }
3859
+ /**
3860
+ * A section in the user details panel (Settings → Users), below AYON's own forms, for the
3861
+ * selected users. The section shows from the description, titled like AYON's; `component`
3862
+ * loads when it is first shown. Saving is the section's own: AYON's Save button doesn't see it.
3863
+ */
3864
+ 'userDetails.section': {
3865
+ version: 1
3866
+ meta: UserDetailsSectionMeta
3867
+ context: UserDetailsContext
3868
+ pieces: { component: Loader<ComponentType<SlotProps<'userDetails.section'>>> }
3869
+ }
3870
+ /**
3871
+ * An item in the user details panel's "more" menu (Settings → Users), for the selected users.
3872
+ * It shows from the description; `run` loads when the menu opens and is called on click.
3873
+ */
3874
+ 'userDetails.menuItem': {
3875
+ version: 1
3876
+ meta: UserDetailsMenuItemMeta
3877
+ context: UserDetailsContext
3878
+ pieces: { run: Loader<RunPiece<'userDetails.menuItem'>> }
3879
+ }
3859
3880
  /**
3860
3881
  * Code with no UI that runs while AYON is open, whatever the page: keeping a state, listening to
3861
3882
  * websocket events, registering a store listener. `component` loads at startup and is mounted
@@ -4677,6 +4698,35 @@ declare type User = {
4677
4698
  hidden?: boolean;
4678
4699
  };
4679
4700
 
4701
+ /** Context of a user details section or menu item. */
4702
+ declare interface UserDetailsContext extends UsersScope {
4703
+ /**
4704
+ * the signed-in user can't change these users (a manager and an admin among them): show,
4705
+ * don't edit
4706
+ */
4707
+ readOnly: boolean
4708
+ }
4709
+
4710
+ /** Description of a `userDetails.menuItem` contribution. */
4711
+ declare interface UserDetailsMenuItemMeta extends MenuItemMeta {
4712
+ /** `single`: only when one user is selected; `multi` (default): for one or more */
4713
+ selection?: UserSelection
4714
+ }
4715
+
4716
+ /** Description of a `userDetails.section` contribution. */
4717
+ declare interface UserDetailsSectionMeta {
4718
+ /** unique among the addon's sections */
4719
+ id: string
4720
+ /** the section's title, above its content */
4721
+ title: string
4722
+ /** order among addon sections, lowest first */
4723
+ order?: number
4724
+ /** `single`: only when one user is selected; `multi` (default): for one or more */
4725
+ selection?: UserSelection
4726
+ /** also shown for service users, whose panel has no forms; `false` by default */
4727
+ serviceUsers?: boolean
4728
+ }
4729
+
4680
4730
  declare type UserModel = {
4681
4731
  /** Unique name of the user */
4682
4732
  name: string;
@@ -4698,11 +4748,38 @@ declare type UserModel = {
4698
4748
  updatedAt?: string;
4699
4749
  };
4700
4750
 
4751
+ /**
4752
+ * A user a slot is about, e.g. one selected in Settings → Users. Not the signed-in user: that is
4753
+ * `user` in every slot.
4754
+ */
4755
+ declare interface UserRef {
4756
+ name: string
4757
+ fullName?: string
4758
+ email?: string
4759
+ /** the account is active (not disabled) */
4760
+ active: boolean
4761
+ isAdmin: boolean
4762
+ /** managers and admins */
4763
+ isManager: boolean
4764
+ isGuest: boolean
4765
+ /** a service user (API key) */
4766
+ isService: boolean
4767
+ }
4768
+
4701
4769
  /** Every slot: the signed-in user. The host adds it; AYON renders addons only once signed in. */
4702
4770
  declare interface UserScope {
4703
4771
  user: AddonUser
4704
4772
  }
4705
4773
 
4774
+ /** Which selections a user details contribution shows for. */
4775
+ declare type UserSelection = 'single' | 'multi'
4776
+
4777
+ /** Slots about one or more users. */
4778
+ declare interface UsersScope {
4779
+ /** the users the slot is about, e.g. the ones selected in Settings → Users */
4780
+ users: UserRef[]
4781
+ }
4782
+
4706
4783
  export declare const useScopedAttributeFields: <T extends AttributeField>({ attribFields, allowedScopes, }: UseScopedAttributeFieldsProps<T>) => T[];
4707
4784
 
4708
4785
  declare interface UseScopedAttributeFieldsProps<T extends AttributeField> {
@@ -14540,6 +14540,7 @@ declare type ImportDataApiArg = {
14540
14540
  entityType?: ('folder' | 'task') | null;
14541
14541
  newListLabel?: string | null;
14542
14542
  newListEntityType?: ('folder' | 'product' | 'version' | 'representation' | 'task' | 'workfile') | null;
14543
+ newListFolderId?: string | null;
14543
14544
  updateListedEntities?: boolean;
14544
14545
  projectName?: string | null;
14545
14546
  folderId?: string | null;
@@ -280,6 +280,22 @@ declare interface AddonUser {
280
280
  isDeveloper: boolean
281
281
  }
282
282
 
283
+ /** The addons' sections, each in a panel titled like AYON's own. */
284
+ export declare const AddonUserDetailsSections: ({ context }: AddonUserDetailsSectionsProps) => JSX_2.Element;
285
+
286
+ declare interface AddonUserDetailsSectionsProps {
287
+ context: UserDetailsContext;
288
+ }
289
+
290
+ export declare interface AddonUserMenuItems {
291
+ /** first in the menu (`position: 'top'`) */
292
+ topItems: MenuItemType[];
293
+ /** after the menu's own items, above Delete */
294
+ items: MenuItemType[];
295
+ /** loads the items' code: call it when the menu opens */
296
+ prefetch: () => void;
297
+ }
298
+
283
299
  declare type AlignType = 'left' | 'right';
284
300
 
285
301
  declare type Anatomy = {
@@ -3664,6 +3680,9 @@ declare type ShortcutKeyEvent = Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' |
3664
3680
  */
3665
3681
  declare type ShortcutTable = ProjectTablePage | 'slicer' | 'projects' | 'listsPanel' | 'versionsPanel'
3666
3682
 
3683
+ /** A contribution with this `selection` shows for `count` selected users. */
3684
+ export declare const showsForSelection: (selection: UserSelection | undefined, count: number) => boolean;
3685
+
3667
3686
  declare interface SidebarConfig {
3668
3687
  width?: string;
3669
3688
  minWidth?: string;
@@ -3948,6 +3967,27 @@ declare interface SlotMap {
3948
3967
  context: TableShortcutContext
3949
3968
  pieces: TableShortcutPieces
3950
3969
  }
3970
+ /**
3971
+ * A section in the user details panel (Settings → Users), below AYON's own forms, for the
3972
+ * selected users. The section shows from the description, titled like AYON's; `component`
3973
+ * loads when it is first shown. Saving is the section's own: AYON's Save button doesn't see it.
3974
+ */
3975
+ 'userDetails.section': {
3976
+ version: 1
3977
+ meta: UserDetailsSectionMeta
3978
+ context: UserDetailsContext
3979
+ pieces: { component: Loader<ComponentType<SlotProps<'userDetails.section'>>> }
3980
+ }
3981
+ /**
3982
+ * An item in the user details panel's "more" menu (Settings → Users), for the selected users.
3983
+ * It shows from the description; `run` loads when the menu opens and is called on click.
3984
+ */
3985
+ 'userDetails.menuItem': {
3986
+ version: 1
3987
+ meta: UserDetailsMenuItemMeta
3988
+ context: UserDetailsContext
3989
+ pieces: { run: Loader<RunPiece<'userDetails.menuItem'>> }
3990
+ }
3951
3991
  /**
3952
3992
  * Code with no UI that runs while AYON is open, whatever the page: keeping a state, listening to
3953
3993
  * websocket events, registering a store listener. `component` loads at startup and is mounted
@@ -4474,6 +4514,8 @@ export declare type ToolbarLayout = (ToolbarItem | '|')[];
4474
4514
 
4475
4515
  declare type TopicUpdateType = 'created' | 'label_changed' | 'renamed' | 'type_changed' | 'status_changed' | 'tags_changed' | 'attrib_changed' | 'deleted';
4476
4516
 
4517
+ export declare const toUserRef: (user: UserDetailsSource) => UserRef;
4518
+
4477
4519
  declare type UpdateEntitiesArgs = {
4478
4520
  operations: UpdateEntityOperation[];
4479
4521
  entityType: EntityType_2;
@@ -4546,6 +4588,9 @@ export declare const useAddonTableShortcuts: (table: ShortcutTable | undefined)
4546
4588
  dialog: OpenAddonShortcutDialog | null;
4547
4589
  };
4548
4590
 
4591
+ /** The addons' items for the user details "more" menu. */
4592
+ export declare const useAddonUserMenuItems: (context: UserDetailsContext) => AddonUserMenuItems;
4593
+
4549
4594
  export declare const useBuildFilterOptions: ({ filterTypes: globalFilterTypes, projectNames, scope, scopes: customScopes, data, config, power, }: BuildFilterOptions) => {
4550
4595
  options: Option_2[];
4551
4596
  groupOptions: SearchFilterGroupOption[];
@@ -4615,6 +4660,49 @@ export declare const useProjectPageSlotContext: (projectName: string) => SlotMap
4615
4660
 
4616
4661
  export declare const USER_KEY_PREFIX = "user:";
4617
4662
 
4663
+ /** Context of a user details section or menu item. */
4664
+ declare interface UserDetailsContext extends UsersScope {
4665
+ /**
4666
+ * the signed-in user can't change these users (a manager and an admin among them): show,
4667
+ * don't edit
4668
+ */
4669
+ readOnly: boolean
4670
+ }
4671
+
4672
+ /** Description of a `userDetails.menuItem` contribution. */
4673
+ declare interface UserDetailsMenuItemMeta extends MenuItemMeta {
4674
+ /** `single`: only when one user is selected; `multi` (default): for one or more */
4675
+ selection?: UserSelection
4676
+ }
4677
+
4678
+ /** Description of a `userDetails.section` contribution. */
4679
+ declare interface UserDetailsSectionMeta {
4680
+ /** unique among the addon's sections */
4681
+ id: string
4682
+ /** the section's title, above its content */
4683
+ title: string
4684
+ /** order among addon sections, lowest first */
4685
+ order?: number
4686
+ /** `single`: only when one user is selected; `multi` (default): for one or more */
4687
+ selection?: UserSelection
4688
+ /** also shown for service users, whose panel has no forms; `false` by default */
4689
+ serviceUsers?: boolean
4690
+ }
4691
+
4692
+ /** A user as AYON's users queries have it. */
4693
+ export declare interface UserDetailsSource {
4694
+ name: string;
4695
+ active?: boolean;
4696
+ isAdmin?: boolean;
4697
+ isManager?: boolean;
4698
+ isGuest?: boolean;
4699
+ isService?: boolean;
4700
+ attrib?: {
4701
+ fullName?: string | null;
4702
+ email?: string | null;
4703
+ } | null;
4704
+ }
4705
+
4618
4706
  export declare const useReviewablesUpload: ({ projectName, versionId, taskId, folderId, productId, dispatch, onUpload, onProgress, }: UseReviewablesUploadProps) => UploadHandlers;
4619
4707
 
4620
4708
  export declare interface UseReviewablesUploadProps {
@@ -4660,11 +4748,38 @@ declare type UserModel = {
4660
4748
  updatedAt?: string;
4661
4749
  };
4662
4750
 
4751
+ /**
4752
+ * A user a slot is about, e.g. one selected in Settings → Users. Not the signed-in user: that is
4753
+ * `user` in every slot.
4754
+ */
4755
+ declare interface UserRef {
4756
+ name: string
4757
+ fullName?: string
4758
+ email?: string
4759
+ /** the account is active (not disabled) */
4760
+ active: boolean
4761
+ isAdmin: boolean
4762
+ /** managers and admins */
4763
+ isManager: boolean
4764
+ isGuest: boolean
4765
+ /** a service user (API key) */
4766
+ isService: boolean
4767
+ }
4768
+
4663
4769
  /** Every slot: the signed-in user. The host adds it; AYON renders addons only once signed in. */
4664
4770
  declare interface UserScope {
4665
4771
  user: AddonUser
4666
4772
  }
4667
4773
 
4774
+ /** Which selections a user details contribution shows for. */
4775
+ declare type UserSelection = 'single' | 'multi'
4776
+
4777
+ /** Slots about one or more users. */
4778
+ declare interface UsersScope {
4779
+ /** the users the slot is about, e.g. the ones selected in Settings → Users */
4780
+ users: UserRef[]
4781
+ }
4782
+
4668
4783
  declare type UserSuggestionItem = {
4669
4784
  /** The date and time when the suggested entity was created */
4670
4785
  createdAt?: string | null;
@@ -4859,6 +4974,9 @@ declare const useUpdateSubtasksMutation: <R extends Record<string, any> = ({
4859
4974
  reset: () => void;
4860
4975
  }];
4861
4976
 
4977
+ /** The context of the user details slots for the selected users. */
4978
+ export declare const useUserDetailsSlotContext: (users: UserDetailsSource[], readOnly: boolean) => UserDetailsContext;
4979
+
4862
4980
  export declare const useVersionUploadContext: () => VersionUploadContextType;
4863
4981
 
4864
4982
  declare type UseViewMutations = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynput/ayon-frontend-shared",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Shared React components for AYON frontend",
5
5
  "repository": {
6
6
  "type": "git",
@@ -104,7 +104,7 @@
104
104
  "@reduxjs/toolkit": "2.11.2",
105
105
  "@rtk-query/graphql-request-base-query": "2.3.2",
106
106
  "@tanstack/react-table": "8.21.3",
107
- "@ynput/ayon-addon": "0.3.0",
107
+ "@ynput/ayon-addon": "0.4.0",
108
108
  "@ynput/ayon-react-components": "^1.25.1",
109
109
  "graphql-request": "7.4.0",
110
110
  "react": "18.3.1",