@amityco/ui-kit-open-source 4.12.0 → 4.14.0

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.mts CHANGED
@@ -62,6 +62,12 @@ type DefaultConfig = {
62
62
  type NetworkConfig = {
63
63
  config: DefaultConfig;
64
64
  };
65
+ declare const enum UserAccessTypes {
66
+ ALL = "all",
67
+ SIGNED_IN_USER_ONLY = "singed_in_user_only",
68
+ NONE = "none"
69
+ }
70
+ type UserAccess = `${UserAccessTypes}`;
65
71
  interface Config {
66
72
  preferred_theme?: 'light' | 'dark' | 'default';
67
73
  theme?: {
@@ -74,6 +80,14 @@ interface Config {
74
80
  customizations?: {
75
81
  [key: string]: GetConfigReturnValue;
76
82
  };
83
+ feature_flags?: {
84
+ post?: {
85
+ clip?: {
86
+ can_create: UserAccess;
87
+ can_view_tab: UserAccess;
88
+ };
89
+ };
90
+ };
77
91
  }
78
92
 
79
93
  interface PostDetailPageProps {
@@ -477,6 +491,11 @@ interface PageBehavior {
477
491
  communityId: string;
478
492
  }): void;
479
493
  };
494
+ AmityGlobalBehavior?: {
495
+ handleVisitorUserAction?(): void;
496
+ handleNonMemberAction?(): void;
497
+ handleNonFollowerAction?(): void;
498
+ };
480
499
  }
481
500
 
482
501
  type AmityUIKitConfig = Config;
@@ -492,7 +511,7 @@ interface AmityUIKitProviderProps {
492
511
  mqtt?: string;
493
512
  upload?: string;
494
513
  };
495
- userId: string;
514
+ userId?: string;
496
515
  displayName?: string;
497
516
  postRendererConfig?: any;
498
517
  theme?: Record<string, unknown>;
@@ -518,6 +537,12 @@ interface AmityUIKitProviderProps {
518
537
  onConnected?: () => void;
519
538
  onDisconnected?: () => void;
520
539
  getAuthToken?: () => Promise<string>;
540
+ authSignatureExpiresAt?: string;
541
+ getAuthSignature?: ({ deviceId, authSignatureExpiresAt, }: {
542
+ deviceId: string;
543
+ authSignatureExpiresAt: string;
544
+ }) => Promise<string>;
545
+ isBotUser?: boolean;
521
546
  configs?: AmityUIKitConfig;
522
547
  activeRoute?: AmityRoute;
523
548
  onRouteChange?: (route: AmityRoute) => void;
@@ -712,6 +737,20 @@ interface SessionHandler {
712
737
  */
713
738
  sessionWillRenewAccessToken(renewal: Amity.AccessTokenRenewal): void;
714
739
  }
740
+ /**
741
+ * Interface for the registerDevice parameters.
742
+ */
743
+ interface RegisterDeviceParams {
744
+ userId?: string;
745
+ displayName?: string;
746
+ sessionHandler: SessionHandler;
747
+ authToken?: string;
748
+ authSignatureParams?: Amity.ConnectClientAsVisitorParams;
749
+ onConnectionStatusChange?: (state: Amity.SessionStates) => void;
750
+ onConnected?: () => void;
751
+ onDisconnected?: () => void;
752
+ onGlobalBanned?: (payload: Amity.UserPayload) => void;
753
+ }
715
754
  /**
716
755
  * Manages the Amity SDK client and authentication state.
717
756
  */
@@ -745,15 +784,9 @@ declare class AmityUIKitManager {
745
784
  }): void;
746
785
  /**
747
786
  * Registers a device with the Amity SDK and handles the login process.
748
- * @param userId - The user ID to be used for login.
749
- * @param displayName - The display name of the user.
750
- * @param sessionHandler - The session handler for access token renewal.
751
- * @param authToken - The authentication token to be used for login.
752
- * @param onConnectionStatusChange - The callback function for connection status changes.
753
- * @param onConnected - The callback function to be called when connected.
754
- * @param onDisconnected - The callback function to be called when disconnected.
787
+ * @param params - The parameters object containing all registration options.
755
788
  */
756
- static registerDevice(userId: string, displayName: string, sessionHandler: SessionHandler, authToken?: string, onConnectionStatusChange?: (state: Amity.SessionStates) => void, onConnected?: () => void, onDisconnected?: () => void, onGlobalBanned?: (payload: Amity.UserPayload) => void): Promise<void>;
789
+ static registerDevice({ userId, displayName, sessionHandler, authToken, authSignatureParams, onConnectionStatusChange, onConnected, onDisconnected, onGlobalBanned, }: RegisterDeviceParams): Promise<void>;
757
790
  /**
758
791
  * Sets the AmityClient instance to be used by the AmityUIKitManager.
759
792
  * This method is useful when sharing the AmityClient instance between different parts of the application.
@@ -1053,7 +1086,7 @@ type CommentTrayProps = {
1053
1086
  referenceId: string;
1054
1087
  community: Amity.Community;
1055
1088
  shouldAllowCreation?: boolean;
1056
- shouldAllowInteraction: boolean;
1089
+ shouldAllowInteraction?: boolean;
1057
1090
  referenceType: Amity.CommentReferenceType;
1058
1091
  };
1059
1092
  declare const CommentTray: ({ referenceId, pageId, referenceType, shouldAllowCreation, shouldAllowInteraction, community, }: CommentTrayProps) => React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -62,6 +62,12 @@ type DefaultConfig = {
62
62
  type NetworkConfig = {
63
63
  config: DefaultConfig;
64
64
  };
65
+ declare const enum UserAccessTypes {
66
+ ALL = "all",
67
+ SIGNED_IN_USER_ONLY = "singed_in_user_only",
68
+ NONE = "none"
69
+ }
70
+ type UserAccess = `${UserAccessTypes}`;
65
71
  interface Config {
66
72
  preferred_theme?: 'light' | 'dark' | 'default';
67
73
  theme?: {
@@ -74,6 +80,14 @@ interface Config {
74
80
  customizations?: {
75
81
  [key: string]: GetConfigReturnValue;
76
82
  };
83
+ feature_flags?: {
84
+ post?: {
85
+ clip?: {
86
+ can_create: UserAccess;
87
+ can_view_tab: UserAccess;
88
+ };
89
+ };
90
+ };
77
91
  }
78
92
 
79
93
  interface PostDetailPageProps {
@@ -477,6 +491,11 @@ interface PageBehavior {
477
491
  communityId: string;
478
492
  }): void;
479
493
  };
494
+ AmityGlobalBehavior?: {
495
+ handleVisitorUserAction?(): void;
496
+ handleNonMemberAction?(): void;
497
+ handleNonFollowerAction?(): void;
498
+ };
480
499
  }
481
500
 
482
501
  type AmityUIKitConfig = Config;
@@ -492,7 +511,7 @@ interface AmityUIKitProviderProps {
492
511
  mqtt?: string;
493
512
  upload?: string;
494
513
  };
495
- userId: string;
514
+ userId?: string;
496
515
  displayName?: string;
497
516
  postRendererConfig?: any;
498
517
  theme?: Record<string, unknown>;
@@ -518,6 +537,12 @@ interface AmityUIKitProviderProps {
518
537
  onConnected?: () => void;
519
538
  onDisconnected?: () => void;
520
539
  getAuthToken?: () => Promise<string>;
540
+ authSignatureExpiresAt?: string;
541
+ getAuthSignature?: ({ deviceId, authSignatureExpiresAt, }: {
542
+ deviceId: string;
543
+ authSignatureExpiresAt: string;
544
+ }) => Promise<string>;
545
+ isBotUser?: boolean;
521
546
  configs?: AmityUIKitConfig;
522
547
  activeRoute?: AmityRoute;
523
548
  onRouteChange?: (route: AmityRoute) => void;
@@ -712,6 +737,20 @@ interface SessionHandler {
712
737
  */
713
738
  sessionWillRenewAccessToken(renewal: Amity.AccessTokenRenewal): void;
714
739
  }
740
+ /**
741
+ * Interface for the registerDevice parameters.
742
+ */
743
+ interface RegisterDeviceParams {
744
+ userId?: string;
745
+ displayName?: string;
746
+ sessionHandler: SessionHandler;
747
+ authToken?: string;
748
+ authSignatureParams?: Amity.ConnectClientAsVisitorParams;
749
+ onConnectionStatusChange?: (state: Amity.SessionStates) => void;
750
+ onConnected?: () => void;
751
+ onDisconnected?: () => void;
752
+ onGlobalBanned?: (payload: Amity.UserPayload) => void;
753
+ }
715
754
  /**
716
755
  * Manages the Amity SDK client and authentication state.
717
756
  */
@@ -745,15 +784,9 @@ declare class AmityUIKitManager {
745
784
  }): void;
746
785
  /**
747
786
  * Registers a device with the Amity SDK and handles the login process.
748
- * @param userId - The user ID to be used for login.
749
- * @param displayName - The display name of the user.
750
- * @param sessionHandler - The session handler for access token renewal.
751
- * @param authToken - The authentication token to be used for login.
752
- * @param onConnectionStatusChange - The callback function for connection status changes.
753
- * @param onConnected - The callback function to be called when connected.
754
- * @param onDisconnected - The callback function to be called when disconnected.
787
+ * @param params - The parameters object containing all registration options.
755
788
  */
756
- static registerDevice(userId: string, displayName: string, sessionHandler: SessionHandler, authToken?: string, onConnectionStatusChange?: (state: Amity.SessionStates) => void, onConnected?: () => void, onDisconnected?: () => void, onGlobalBanned?: (payload: Amity.UserPayload) => void): Promise<void>;
789
+ static registerDevice({ userId, displayName, sessionHandler, authToken, authSignatureParams, onConnectionStatusChange, onConnected, onDisconnected, onGlobalBanned, }: RegisterDeviceParams): Promise<void>;
757
790
  /**
758
791
  * Sets the AmityClient instance to be used by the AmityUIKitManager.
759
792
  * This method is useful when sharing the AmityClient instance between different parts of the application.
@@ -1053,7 +1086,7 @@ type CommentTrayProps = {
1053
1086
  referenceId: string;
1054
1087
  community: Amity.Community;
1055
1088
  shouldAllowCreation?: boolean;
1056
- shouldAllowInteraction: boolean;
1089
+ shouldAllowInteraction?: boolean;
1057
1090
  referenceType: Amity.CommentReferenceType;
1058
1091
  };
1059
1092
  declare const CommentTray: ({ referenceId, pageId, referenceType, shouldAllowCreation, shouldAllowInteraction, community, }: CommentTrayProps) => React.JSX.Element;