mezon-js 2.10.68 → 2.10.70
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/api.gen.ts +2 -62
- package/client.ts +0 -56
- package/dist/api.gen.d.ts +1 -13
- package/dist/client.d.ts +1 -8
- package/dist/mezon-js.cjs.js +9 -71
- package/dist/mezon-js.esm.mjs +9 -71
- package/dist/socket.d.ts +5 -0
- package/package.json +1 -1
- package/socket.ts +16 -0
    
        package/api.gen.ts
    CHANGED
    
    | @@ -1426,6 +1426,8 @@ export interface ApiHashtagDmList { | |
| 1426 1426 |  | 
| 1427 1427 | 
             
            /** Add link invite users to. */
         | 
| 1428 1428 | 
             
            export interface ApiInviteUserRes {
         | 
| 1429 | 
            +
              //
         | 
| 1430 | 
            +
              channel_desc?: ApiChannelDescription;
         | 
| 1429 1431 | 
             
              //id channel to add link to.
         | 
| 1430 1432 | 
             
              channel_id?: string;
         | 
| 1431 1433 | 
             
              //
         | 
| @@ -1781,24 +1783,6 @@ export interface ApiStreamHttpCallbackResponse { | |
| 1781 1783 | 
             
              msg?: string;
         | 
| 1782 1784 | 
             
            }
         | 
| 1783 1785 |  | 
| 1784 | 
            -
            /** A list of users belonging to a channel, along with their role. */
         | 
| 1785 | 
            -
            export interface ApiSFUChannelUser {
         | 
| 1786 | 
            -
              //
         | 
| 1787 | 
            -
              channel_id?: string;
         | 
| 1788 | 
            -
              //
         | 
| 1789 | 
            -
              id?: string;
         | 
| 1790 | 
            -
              //
         | 
| 1791 | 
            -
              participant?: string;
         | 
| 1792 | 
            -
              //user for a channel.
         | 
| 1793 | 
            -
              user_id?: string;
         | 
| 1794 | 
            -
            }
         | 
| 1795 | 
            -
             | 
| 1796 | 
            -
            /** A list of users belonging to a channel, along with their role. */
         | 
| 1797 | 
            -
            export interface ApiSFUChannelUserList {
         | 
| 1798 | 
            -
              //
         | 
| 1799 | 
            -
              sfu_channel_users?: Array<ApiSFUChannelUser>;
         | 
| 1800 | 
            -
            }
         | 
| 1801 | 
            -
             | 
| 1802 1786 | 
             
            /**  */
         | 
| 1803 1787 | 
             
            export interface ApiPermission {
         | 
| 1804 1788 | 
             
              //
         | 
| @@ -8134,50 +8118,6 @@ export class MezonApi { | |
| 8134 8118 | 
             
                ]);
         | 
| 8135 8119 | 
             
              }
         | 
| 8136 8120 |  | 
| 8137 | 
            -
              /** List all users in SFU channel. */
         | 
| 8138 | 
            -
              listSFUChannelUsers(
         | 
| 8139 | 
            -
                bearerToken: string,
         | 
| 8140 | 
            -
                clanId?: string,
         | 
| 8141 | 
            -
                channelId?: string,
         | 
| 8142 | 
            -
                channelType?: number,
         | 
| 8143 | 
            -
                limit?: number,
         | 
| 8144 | 
            -
                state?: number,
         | 
| 8145 | 
            -
                cursor?: string,
         | 
| 8146 | 
            -
                options: any = {}
         | 
| 8147 | 
            -
              ): Promise<ApiSFUChannelUserList> {
         | 
| 8148 | 
            -
                const urlPath = "/v2/sfu_channels/users";
         | 
| 8149 | 
            -
                const queryParams = new Map<string, any>();
         | 
| 8150 | 
            -
                queryParams.set("clan_id", clanId);
         | 
| 8151 | 
            -
                queryParams.set("channel_id", channelId);
         | 
| 8152 | 
            -
                queryParams.set("channel_type", channelType);
         | 
| 8153 | 
            -
                queryParams.set("limit", limit);
         | 
| 8154 | 
            -
                queryParams.set("state", state);
         | 
| 8155 | 
            -
                queryParams.set("cursor", cursor);
         | 
| 8156 | 
            -
             | 
| 8157 | 
            -
                let bodyJson: string = "";
         | 
| 8158 | 
            -
             | 
| 8159 | 
            -
                const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
         | 
| 8160 | 
            -
                const fetchOptions = buildFetchOptions("GET", options, bodyJson);
         | 
| 8161 | 
            -
                if (bearerToken) {
         | 
| 8162 | 
            -
                  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
         | 
| 8163 | 
            -
                }
         | 
| 8164 | 
            -
             | 
| 8165 | 
            -
                return Promise.race([
         | 
| 8166 | 
            -
                  fetch(fullUrl, fetchOptions).then((response) => {
         | 
| 8167 | 
            -
                    if (response.status == 204) {
         | 
| 8168 | 
            -
                      return response;
         | 
| 8169 | 
            -
                    } else if (response.status >= 200 && response.status < 300) {
         | 
| 8170 | 
            -
                      return response.json();
         | 
| 8171 | 
            -
                    } else {
         | 
| 8172 | 
            -
                      throw response;
         | 
| 8173 | 
            -
                    }
         | 
| 8174 | 
            -
                  }),
         | 
| 8175 | 
            -
                  new Promise((_, reject) =>
         | 
| 8176 | 
            -
                    setTimeout(reject, this.timeoutMs, "Request timed out.")
         | 
| 8177 | 
            -
                  ),
         | 
| 8178 | 
            -
                ]);
         | 
| 8179 | 
            -
              }
         | 
| 8180 | 
            -
             | 
| 8181 8121 | 
             
              /** get pubkey */
         | 
| 8182 8122 | 
             
              getPubKeys(
         | 
| 8183 8123 | 
             
                bearerToken: string,
         | 
    
        package/client.ts
    CHANGED
    
    | @@ -156,7 +156,6 @@ import { | |
| 156 156 | 
             
              ApiSdTopicList,
         | 
| 157 157 | 
             
              ApiSdTopicRequest,
         | 
| 158 158 | 
             
              ApiSdTopic,
         | 
| 159 | 
            -
              ApiSFUChannelUserList,
         | 
| 160 159 | 
             
              MezonUpdateEventBody,
         | 
| 161 160 | 
             
            } from "./api.gen";
         | 
| 162 161 |  | 
| @@ -204,12 +203,6 @@ export enum WebrtcSignalingType { | |
| 204 203 | 
             
              WEBRTC_SDP_QUIT = 4,
         | 
| 205 204 | 
             
            }
         | 
| 206 205 |  | 
| 207 | 
            -
            export enum SFUSignalingType {
         | 
| 208 | 
            -
              JOINE = 0,
         | 
| 209 | 
            -
              LEAVE = 1,
         | 
| 210 | 
            -
              TALK = 2,
         | 
| 211 | 
            -
            }
         | 
| 212 | 
            -
             | 
| 213 206 | 
             
            /** Response for an RPC function executed on the server. */
         | 
| 214 207 | 
             
            export interface RpcResponse {
         | 
| 215 208 | 
             
              /** The identifier of the function. */
         | 
| @@ -4769,55 +4762,6 @@ export class Client { | |
| 4769 4762 | 
             
                  });
         | 
| 4770 4763 | 
             
              }
         | 
| 4771 4764 |  | 
| 4772 | 
            -
              /** List a ptt channel's users. */
         | 
| 4773 | 
            -
              async listSFUChannelUsers(
         | 
| 4774 | 
            -
                session: Session,
         | 
| 4775 | 
            -
                clanId: string,
         | 
| 4776 | 
            -
                channelId: string,
         | 
| 4777 | 
            -
                channelType: number,
         | 
| 4778 | 
            -
                state?: number,
         | 
| 4779 | 
            -
                limit?: number,
         | 
| 4780 | 
            -
                cursor?: string
         | 
| 4781 | 
            -
              ): Promise<ApiSFUChannelUserList> {
         | 
| 4782 | 
            -
                if (
         | 
| 4783 | 
            -
                  this.autoRefreshSession &&
         | 
| 4784 | 
            -
                  session.refresh_token &&
         | 
| 4785 | 
            -
                  session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
         | 
| 4786 | 
            -
                ) {
         | 
| 4787 | 
            -
                  await this.sessionRefresh(session);
         | 
| 4788 | 
            -
                }
         | 
| 4789 | 
            -
             | 
| 4790 | 
            -
                return this.apiClient
         | 
| 4791 | 
            -
                  .listSFUChannelUsers(
         | 
| 4792 | 
            -
                    session.token,
         | 
| 4793 | 
            -
                    clanId,
         | 
| 4794 | 
            -
                    channelId,
         | 
| 4795 | 
            -
                    channelType,
         | 
| 4796 | 
            -
                    limit,
         | 
| 4797 | 
            -
                    state,
         | 
| 4798 | 
            -
                    cursor
         | 
| 4799 | 
            -
                  )
         | 
| 4800 | 
            -
                  .then((response: ApiSFUChannelUserList) => {
         | 
| 4801 | 
            -
                    var result: ApiSFUChannelUserList = {
         | 
| 4802 | 
            -
                      sfu_channel_users: [],
         | 
| 4803 | 
            -
                    };
         | 
| 4804 | 
            -
             | 
| 4805 | 
            -
                    if (response.sfu_channel_users == null) {
         | 
| 4806 | 
            -
                      return Promise.resolve(result);
         | 
| 4807 | 
            -
                    }
         | 
| 4808 | 
            -
             | 
| 4809 | 
            -
                    response.sfu_channel_users!.forEach((gu) => {
         | 
| 4810 | 
            -
                      result.sfu_channel_users!.push({
         | 
| 4811 | 
            -
                        id: gu.id,
         | 
| 4812 | 
            -
                        channel_id: gu.channel_id,
         | 
| 4813 | 
            -
                        user_id: gu.user_id,
         | 
| 4814 | 
            -
                        participant: gu.participant,
         | 
| 4815 | 
            -
                      });
         | 
| 4816 | 
            -
                    });
         | 
| 4817 | 
            -
                    return Promise.resolve(result);
         | 
| 4818 | 
            -
                  });
         | 
| 4819 | 
            -
              }
         | 
| 4820 | 
            -
             | 
| 4821 4765 | 
             
              //**list wallet ledger */
         | 
| 4822 4766 | 
             
              async listWalletLedger(
         | 
| 4823 4767 | 
             
                session: Session,
         | 
    
        package/dist/api.gen.d.ts
    CHANGED
    
    | @@ -819,6 +819,7 @@ export interface ApiHashtagDmList { | |
| 819 819 | 
             
            }
         | 
| 820 820 | 
             
            /** Add link invite users to. */
         | 
| 821 821 | 
             
            export interface ApiInviteUserRes {
         | 
| 822 | 
            +
                channel_desc?: ApiChannelDescription;
         | 
| 822 823 | 
             
                channel_id?: string;
         | 
| 823 824 | 
             
                channel_label?: string;
         | 
| 824 825 | 
             
                clan_id?: string;
         | 
| @@ -1029,17 +1030,6 @@ export interface ApiStreamHttpCallbackResponse { | |
| 1029 1030 | 
             
                code?: number;
         | 
| 1030 1031 | 
             
                msg?: string;
         | 
| 1031 1032 | 
             
            }
         | 
| 1032 | 
            -
            /** A list of users belonging to a channel, along with their role. */
         | 
| 1033 | 
            -
            export interface ApiSFUChannelUser {
         | 
| 1034 | 
            -
                channel_id?: string;
         | 
| 1035 | 
            -
                id?: string;
         | 
| 1036 | 
            -
                participant?: string;
         | 
| 1037 | 
            -
                user_id?: string;
         | 
| 1038 | 
            -
            }
         | 
| 1039 | 
            -
            /** A list of users belonging to a channel, along with their role. */
         | 
| 1040 | 
            -
            export interface ApiSFUChannelUserList {
         | 
| 1041 | 
            -
                sfu_channel_users?: Array<ApiSFUChannelUser>;
         | 
| 1042 | 
            -
            }
         | 
| 1043 1033 | 
             
            /**  */
         | 
| 1044 1034 | 
             
            export interface ApiPermission {
         | 
| 1045 1035 | 
             
                active?: number;
         | 
| @@ -1902,8 +1892,6 @@ export declare class MezonApi { | |
| 1902 1892 | 
             
                getPinMessagesList(bearerToken: string, messageId?: string, channelId?: string, clanId?: string, options?: any): Promise<ApiPinMessagesList>;
         | 
| 1903 1893 | 
             
                /** set notification user channel. */
         | 
| 1904 1894 | 
             
                createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<ApiChannelMessageHeader>;
         | 
| 1905 | 
            -
                /** List all users in SFU channel. */
         | 
| 1906 | 
            -
                listSFUChannelUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiSFUChannelUserList>;
         | 
| 1907 1895 | 
             
                /** get pubkey */
         | 
| 1908 1896 | 
             
                getPubKeys(bearerToken: string, userIds?: Array<string>, options?: any): Promise<ApiGetPubKeysResponse>;
         | 
| 1909 1897 | 
             
                /** store pubkey for e2ee */
         | 
    
        package/dist/client.d.ts
    CHANGED
    
    | @@ -13,7 +13,7 @@ | |
| 13 13 | 
             
             * See the License for the specific language governing permissions and
         | 
| 14 14 | 
             
             * limitations under the License.
         | 
| 15 15 | 
             
             */
         | 
| 16 | 
            -
            import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic,  | 
| 16 | 
            +
            import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody } from "./api.gen";
         | 
| 17 17 | 
             
            import { Session } from "./session";
         | 
| 18 18 | 
             
            import { Socket } from "./socket";
         | 
| 19 19 | 
             
            import { WebSocketAdapter } from "./web_socket_adapter";
         | 
| @@ -47,11 +47,6 @@ export declare enum WebrtcSignalingType { | |
| 47 47 | 
             
                WEBRTC_ICE_CANDIDATE = 3,
         | 
| 48 48 | 
             
                WEBRTC_SDP_QUIT = 4
         | 
| 49 49 | 
             
            }
         | 
| 50 | 
            -
            export declare enum SFUSignalingType {
         | 
| 51 | 
            -
                JOINE = 0,
         | 
| 52 | 
            -
                LEAVE = 1,
         | 
| 53 | 
            -
                TALK = 2
         | 
| 54 | 
            -
            }
         | 
| 55 50 | 
             
            /** Response for an RPC function executed on the server. */
         | 
| 56 51 | 
             
            export interface RpcResponse {
         | 
| 57 52 | 
             
                /** The identifier of the function. */
         | 
| @@ -637,8 +632,6 @@ export declare class Client { | |
| 637 632 | 
             
                updateOnboardingStepByClanId(session: Session, clan_id: string, request: MezonUpdateOnboardingStepByClanIdBody): Promise<boolean>;
         | 
| 638 633 | 
             
                updateUserStatus(session: Session, request: ApiUserStatusUpdate): Promise<boolean>;
         | 
| 639 634 | 
             
                getUserStatus(session: Session): Promise<ApiUserStatus>;
         | 
| 640 | 
            -
                /** List a ptt channel's users. */
         | 
| 641 | 
            -
                listSFUChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiSFUChannelUserList>;
         | 
| 642 635 | 
             
                listWalletLedger(session: Session, limit?: number, cursor?: string, transactionId?: string): Promise<ApiWalletLedgerList>;
         | 
| 643 636 | 
             
                listSdTopic(session: Session, clanId?: string, limit?: number): Promise<ApiSdTopicList>;
         | 
| 644 637 | 
             
                createSdTopic(session: Session, request: ApiSdTopicRequest): Promise<ApiSdTopic>;
         | 
    
        package/dist/mezon-js.cjs.js
    CHANGED
    
    | @@ -59,7 +59,6 @@ __export(mezon_js_exports, { | |
| 59 59 | 
             
              Client: () => Client,
         | 
| 60 60 | 
             
              DefaultSocket: () => DefaultSocket,
         | 
| 61 61 | 
             
              NotificationType: () => NotificationType,
         | 
| 62 | 
            -
              SFUSignalingType: () => SFUSignalingType,
         | 
| 63 62 | 
             
              Session: () => Session,
         | 
| 64 63 | 
             
              WebSocketAdapterText: () => WebSocketAdapterText,
         | 
| 65 64 | 
             
              WebrtcSignalingType: () => WebrtcSignalingType,
         | 
| @@ -4879,37 +4878,6 @@ var MezonApi = class { | |
| 4879 4878 | 
             
                  )
         | 
| 4880 4879 | 
             
                ]);
         | 
| 4881 4880 | 
             
              }
         | 
| 4882 | 
            -
              /** List all users in SFU channel. */
         | 
| 4883 | 
            -
              listSFUChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
         | 
| 4884 | 
            -
                const urlPath = "/v2/sfu_channels/users";
         | 
| 4885 | 
            -
                const queryParams = /* @__PURE__ */ new Map();
         | 
| 4886 | 
            -
                queryParams.set("clan_id", clanId);
         | 
| 4887 | 
            -
                queryParams.set("channel_id", channelId);
         | 
| 4888 | 
            -
                queryParams.set("channel_type", channelType);
         | 
| 4889 | 
            -
                queryParams.set("limit", limit);
         | 
| 4890 | 
            -
                queryParams.set("state", state);
         | 
| 4891 | 
            -
                queryParams.set("cursor", cursor);
         | 
| 4892 | 
            -
                let bodyJson = "";
         | 
| 4893 | 
            -
                const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
         | 
| 4894 | 
            -
                const fetchOptions = buildFetchOptions("GET", options, bodyJson);
         | 
| 4895 | 
            -
                if (bearerToken) {
         | 
| 4896 | 
            -
                  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
         | 
| 4897 | 
            -
                }
         | 
| 4898 | 
            -
                return Promise.race([
         | 
| 4899 | 
            -
                  fetch(fullUrl, fetchOptions).then((response) => {
         | 
| 4900 | 
            -
                    if (response.status == 204) {
         | 
| 4901 | 
            -
                      return response;
         | 
| 4902 | 
            -
                    } else if (response.status >= 200 && response.status < 300) {
         | 
| 4903 | 
            -
                      return response.json();
         | 
| 4904 | 
            -
                    } else {
         | 
| 4905 | 
            -
                      throw response;
         | 
| 4906 | 
            -
                    }
         | 
| 4907 | 
            -
                  }),
         | 
| 4908 | 
            -
                  new Promise(
         | 
| 4909 | 
            -
                    (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
         | 
| 4910 | 
            -
                  )
         | 
| 4911 | 
            -
                ]);
         | 
| 4912 | 
            -
              }
         | 
| 4913 4881 | 
             
              /** get pubkey */
         | 
| 4914 4882 | 
             
              getPubKeys(bearerToken, userIds, options = {}) {
         | 
| 4915 4883 | 
             
                const urlPath = "/v2/pubkey";
         | 
| @@ -7304,6 +7272,10 @@ var _DefaultSocket = class _DefaultSocket { | |
| 7304 7272 | 
             
                      this.onuserchannelremoved(
         | 
| 7305 7273 | 
             
                        message.user_channel_removed_event
         | 
| 7306 7274 | 
             
                      );
         | 
| 7275 | 
            +
                    } else if (message.remove_friend) {
         | 
| 7276 | 
            +
                      this.onremovefriend(
         | 
| 7277 | 
            +
                        message.remove_friend
         | 
| 7278 | 
            +
                      );
         | 
| 7307 7279 | 
             
                    } else if (message.user_clan_removed_event) {
         | 
| 7308 7280 | 
             
                      this.onuserclanremoved(
         | 
| 7309 7281 | 
             
                        message.user_clan_removed_event
         | 
| @@ -7466,6 +7438,11 @@ var _DefaultSocket = class _DefaultSocket { | |
| 7466 7438 | 
             
                  console.log(user);
         | 
| 7467 7439 | 
             
                }
         | 
| 7468 7440 | 
             
              }
         | 
| 7441 | 
            +
              onremovefriend(user) {
         | 
| 7442 | 
            +
                if (this.verbose && window && window.console) {
         | 
| 7443 | 
            +
                  console.log(user);
         | 
| 7444 | 
            +
                }
         | 
| 7445 | 
            +
              }
         | 
| 7469 7446 | 
             
              onuserclanremoved(user) {
         | 
| 7470 7447 | 
             
                if (this.verbose && window && window.console) {
         | 
| 7471 7448 | 
             
                  console.log(user);
         | 
| @@ -8089,12 +8066,6 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => { | |
| 8089 8066 | 
             
              WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
         | 
| 8090 8067 | 
             
              return WebrtcSignalingType2;
         | 
| 8091 8068 | 
             
            })(WebrtcSignalingType || {});
         | 
| 8092 | 
            -
            var SFUSignalingType = /* @__PURE__ */ ((SFUSignalingType2) => {
         | 
| 8093 | 
            -
              SFUSignalingType2[SFUSignalingType2["JOINE"] = 0] = "JOINE";
         | 
| 8094 | 
            -
              SFUSignalingType2[SFUSignalingType2["LEAVE"] = 1] = "LEAVE";
         | 
| 8095 | 
            -
              SFUSignalingType2[SFUSignalingType2["TALK"] = 2] = "TALK";
         | 
| 8096 | 
            -
              return SFUSignalingType2;
         | 
| 8097 | 
            -
            })(SFUSignalingType || {});
         | 
| 8098 8069 | 
             
            var Client = class {
         | 
| 8099 8070 | 
             
              constructor(serverkey = DEFAULT_SERVER_KEY, host = DEFAULT_HOST, port = DEFAULT_PORT, useSSL = false, timeout = DEFAULT_TIMEOUT_MS, autoRefreshSession = true) {
         | 
| 8100 8071 | 
             
                this.serverkey = serverkey;
         | 
| @@ -10588,39 +10559,6 @@ var Client = class { | |
| 10588 10559 | 
             
                  });
         | 
| 10589 10560 | 
             
                });
         | 
| 10590 10561 | 
             
              }
         | 
| 10591 | 
            -
              /** List a ptt channel's users. */
         | 
| 10592 | 
            -
              listSFUChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
         | 
| 10593 | 
            -
                return __async(this, null, function* () {
         | 
| 10594 | 
            -
                  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
         | 
| 10595 | 
            -
                    yield this.sessionRefresh(session);
         | 
| 10596 | 
            -
                  }
         | 
| 10597 | 
            -
                  return this.apiClient.listSFUChannelUsers(
         | 
| 10598 | 
            -
                    session.token,
         | 
| 10599 | 
            -
                    clanId,
         | 
| 10600 | 
            -
                    channelId,
         | 
| 10601 | 
            -
                    channelType,
         | 
| 10602 | 
            -
                    limit,
         | 
| 10603 | 
            -
                    state,
         | 
| 10604 | 
            -
                    cursor
         | 
| 10605 | 
            -
                  ).then((response) => {
         | 
| 10606 | 
            -
                    var result = {
         | 
| 10607 | 
            -
                      sfu_channel_users: []
         | 
| 10608 | 
            -
                    };
         | 
| 10609 | 
            -
                    if (response.sfu_channel_users == null) {
         | 
| 10610 | 
            -
                      return Promise.resolve(result);
         | 
| 10611 | 
            -
                    }
         | 
| 10612 | 
            -
                    response.sfu_channel_users.forEach((gu) => {
         | 
| 10613 | 
            -
                      result.sfu_channel_users.push({
         | 
| 10614 | 
            -
                        id: gu.id,
         | 
| 10615 | 
            -
                        channel_id: gu.channel_id,
         | 
| 10616 | 
            -
                        user_id: gu.user_id,
         | 
| 10617 | 
            -
                        participant: gu.participant
         | 
| 10618 | 
            -
                      });
         | 
| 10619 | 
            -
                    });
         | 
| 10620 | 
            -
                    return Promise.resolve(result);
         | 
| 10621 | 
            -
                  });
         | 
| 10622 | 
            -
                });
         | 
| 10623 | 
            -
              }
         | 
| 10624 10562 | 
             
              //**list wallet ledger */
         | 
| 10625 10563 | 
             
              listWalletLedger(session, limit, cursor, transactionId) {
         | 
| 10626 10564 | 
             
                return __async(this, null, function* () {
         | 
    
        package/dist/mezon-js.esm.mjs
    CHANGED
    
    | @@ -4844,37 +4844,6 @@ var MezonApi = class { | |
| 4844 4844 | 
             
                  )
         | 
| 4845 4845 | 
             
                ]);
         | 
| 4846 4846 | 
             
              }
         | 
| 4847 | 
            -
              /** List all users in SFU channel. */
         | 
| 4848 | 
            -
              listSFUChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
         | 
| 4849 | 
            -
                const urlPath = "/v2/sfu_channels/users";
         | 
| 4850 | 
            -
                const queryParams = /* @__PURE__ */ new Map();
         | 
| 4851 | 
            -
                queryParams.set("clan_id", clanId);
         | 
| 4852 | 
            -
                queryParams.set("channel_id", channelId);
         | 
| 4853 | 
            -
                queryParams.set("channel_type", channelType);
         | 
| 4854 | 
            -
                queryParams.set("limit", limit);
         | 
| 4855 | 
            -
                queryParams.set("state", state);
         | 
| 4856 | 
            -
                queryParams.set("cursor", cursor);
         | 
| 4857 | 
            -
                let bodyJson = "";
         | 
| 4858 | 
            -
                const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
         | 
| 4859 | 
            -
                const fetchOptions = buildFetchOptions("GET", options, bodyJson);
         | 
| 4860 | 
            -
                if (bearerToken) {
         | 
| 4861 | 
            -
                  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
         | 
| 4862 | 
            -
                }
         | 
| 4863 | 
            -
                return Promise.race([
         | 
| 4864 | 
            -
                  fetch(fullUrl, fetchOptions).then((response) => {
         | 
| 4865 | 
            -
                    if (response.status == 204) {
         | 
| 4866 | 
            -
                      return response;
         | 
| 4867 | 
            -
                    } else if (response.status >= 200 && response.status < 300) {
         | 
| 4868 | 
            -
                      return response.json();
         | 
| 4869 | 
            -
                    } else {
         | 
| 4870 | 
            -
                      throw response;
         | 
| 4871 | 
            -
                    }
         | 
| 4872 | 
            -
                  }),
         | 
| 4873 | 
            -
                  new Promise(
         | 
| 4874 | 
            -
                    (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
         | 
| 4875 | 
            -
                  )
         | 
| 4876 | 
            -
                ]);
         | 
| 4877 | 
            -
              }
         | 
| 4878 4847 | 
             
              /** get pubkey */
         | 
| 4879 4848 | 
             
              getPubKeys(bearerToken, userIds, options = {}) {
         | 
| 4880 4849 | 
             
                const urlPath = "/v2/pubkey";
         | 
| @@ -7269,6 +7238,10 @@ var _DefaultSocket = class _DefaultSocket { | |
| 7269 7238 | 
             
                      this.onuserchannelremoved(
         | 
| 7270 7239 | 
             
                        message.user_channel_removed_event
         | 
| 7271 7240 | 
             
                      );
         | 
| 7241 | 
            +
                    } else if (message.remove_friend) {
         | 
| 7242 | 
            +
                      this.onremovefriend(
         | 
| 7243 | 
            +
                        message.remove_friend
         | 
| 7244 | 
            +
                      );
         | 
| 7272 7245 | 
             
                    } else if (message.user_clan_removed_event) {
         | 
| 7273 7246 | 
             
                      this.onuserclanremoved(
         | 
| 7274 7247 | 
             
                        message.user_clan_removed_event
         | 
| @@ -7431,6 +7404,11 @@ var _DefaultSocket = class _DefaultSocket { | |
| 7431 7404 | 
             
                  console.log(user);
         | 
| 7432 7405 | 
             
                }
         | 
| 7433 7406 | 
             
              }
         | 
| 7407 | 
            +
              onremovefriend(user) {
         | 
| 7408 | 
            +
                if (this.verbose && window && window.console) {
         | 
| 7409 | 
            +
                  console.log(user);
         | 
| 7410 | 
            +
                }
         | 
| 7411 | 
            +
              }
         | 
| 7434 7412 | 
             
              onuserclanremoved(user) {
         | 
| 7435 7413 | 
             
                if (this.verbose && window && window.console) {
         | 
| 7436 7414 | 
             
                  console.log(user);
         | 
| @@ -8054,12 +8032,6 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => { | |
| 8054 8032 | 
             
              WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
         | 
| 8055 8033 | 
             
              return WebrtcSignalingType2;
         | 
| 8056 8034 | 
             
            })(WebrtcSignalingType || {});
         | 
| 8057 | 
            -
            var SFUSignalingType = /* @__PURE__ */ ((SFUSignalingType2) => {
         | 
| 8058 | 
            -
              SFUSignalingType2[SFUSignalingType2["JOINE"] = 0] = "JOINE";
         | 
| 8059 | 
            -
              SFUSignalingType2[SFUSignalingType2["LEAVE"] = 1] = "LEAVE";
         | 
| 8060 | 
            -
              SFUSignalingType2[SFUSignalingType2["TALK"] = 2] = "TALK";
         | 
| 8061 | 
            -
              return SFUSignalingType2;
         | 
| 8062 | 
            -
            })(SFUSignalingType || {});
         | 
| 8063 8035 | 
             
            var Client = class {
         | 
| 8064 8036 | 
             
              constructor(serverkey = DEFAULT_SERVER_KEY, host = DEFAULT_HOST, port = DEFAULT_PORT, useSSL = false, timeout = DEFAULT_TIMEOUT_MS, autoRefreshSession = true) {
         | 
| 8065 8037 | 
             
                this.serverkey = serverkey;
         | 
| @@ -10553,39 +10525,6 @@ var Client = class { | |
| 10553 10525 | 
             
                  });
         | 
| 10554 10526 | 
             
                });
         | 
| 10555 10527 | 
             
              }
         | 
| 10556 | 
            -
              /** List a ptt channel's users. */
         | 
| 10557 | 
            -
              listSFUChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
         | 
| 10558 | 
            -
                return __async(this, null, function* () {
         | 
| 10559 | 
            -
                  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
         | 
| 10560 | 
            -
                    yield this.sessionRefresh(session);
         | 
| 10561 | 
            -
                  }
         | 
| 10562 | 
            -
                  return this.apiClient.listSFUChannelUsers(
         | 
| 10563 | 
            -
                    session.token,
         | 
| 10564 | 
            -
                    clanId,
         | 
| 10565 | 
            -
                    channelId,
         | 
| 10566 | 
            -
                    channelType,
         | 
| 10567 | 
            -
                    limit,
         | 
| 10568 | 
            -
                    state,
         | 
| 10569 | 
            -
                    cursor
         | 
| 10570 | 
            -
                  ).then((response) => {
         | 
| 10571 | 
            -
                    var result = {
         | 
| 10572 | 
            -
                      sfu_channel_users: []
         | 
| 10573 | 
            -
                    };
         | 
| 10574 | 
            -
                    if (response.sfu_channel_users == null) {
         | 
| 10575 | 
            -
                      return Promise.resolve(result);
         | 
| 10576 | 
            -
                    }
         | 
| 10577 | 
            -
                    response.sfu_channel_users.forEach((gu) => {
         | 
| 10578 | 
            -
                      result.sfu_channel_users.push({
         | 
| 10579 | 
            -
                        id: gu.id,
         | 
| 10580 | 
            -
                        channel_id: gu.channel_id,
         | 
| 10581 | 
            -
                        user_id: gu.user_id,
         | 
| 10582 | 
            -
                        participant: gu.participant
         | 
| 10583 | 
            -
                      });
         | 
| 10584 | 
            -
                    });
         | 
| 10585 | 
            -
                    return Promise.resolve(result);
         | 
| 10586 | 
            -
                  });
         | 
| 10587 | 
            -
                });
         | 
| 10588 | 
            -
              }
         | 
| 10589 10528 | 
             
              //**list wallet ledger */
         | 
| 10590 10529 | 
             
              listWalletLedger(session, limit, cursor, transactionId) {
         | 
| 10591 10530 | 
             
                return __async(this, null, function* () {
         | 
| @@ -10637,7 +10576,6 @@ export { | |
| 10637 10576 | 
             
              Client,
         | 
| 10638 10577 | 
             
              DefaultSocket,
         | 
| 10639 10578 | 
             
              NotificationType,
         | 
| 10640 | 
            -
              SFUSignalingType,
         | 
| 10641 10579 | 
             
              Session,
         | 
| 10642 10580 | 
             
              WebSocketAdapterText,
         | 
| 10643 10581 | 
             
              WebrtcSignalingType,
         | 
    
        package/dist/socket.d.ts
    CHANGED
    
    | @@ -511,6 +511,9 @@ export interface UserEmojiUsage { | |
| 511 511 | 
             
                clan_id: string;
         | 
| 512 512 | 
             
                create_time: string;
         | 
| 513 513 | 
             
            }
         | 
| 514 | 
            +
            export interface RemoveFriend {
         | 
| 515 | 
            +
                user_id: string;
         | 
| 516 | 
            +
            }
         | 
| 514 517 | 
             
            export interface AddUserEmojiUsageEvent {
         | 
| 515 518 | 
             
                emoji_id: string;
         | 
| 516 519 | 
             
                clan_id: string;
         | 
| @@ -742,6 +745,7 @@ export interface Socket { | |
| 742 745 | 
             
                onuserprofileupdate: (user: UserProfileUpdatedEvent) => void;
         | 
| 743 746 | 
             
                /** Receive channel removed user event */
         | 
| 744 747 | 
             
                onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
         | 
| 748 | 
            +
                onremovefriend: (user: RemoveFriend) => void;
         | 
| 745 749 | 
             
                /** Receive clan removed user event */
         | 
| 746 750 | 
             
                onuserclanremoved: (user: UserClanRemovedEvent) => void;
         | 
| 747 751 | 
             
                onvoicestarted: (voice: VoiceStartedEvent) => void;
         | 
| @@ -818,6 +822,7 @@ export declare class DefaultSocket implements Socket { | |
| 818 822 | 
             
                onuserclanadded(user: AddClanUserEvent): void;
         | 
| 819 823 | 
             
                onuserprofileupdate(user: UserProfileUpdatedEvent): void;
         | 
| 820 824 | 
             
                onuserchannelremoved(user: UserChannelRemovedEvent): void;
         | 
| 825 | 
            +
                onremovefriend(user: RemoveFriend): void;
         | 
| 821 826 | 
             
                onuserclanremoved(user: UserClanRemovedEvent): void;
         | 
| 822 827 | 
             
                onnotification(notification: Notification): void;
         | 
| 823 828 | 
             
                onstatuspresence(statusPresence: StatusPresenceEvent): void;
         | 
    
        package/package.json
    CHANGED
    
    
    
        package/socket.ts
    CHANGED
    
    | @@ -755,6 +755,10 @@ export interface UserEmojiUsage { | |
| 755 755 | 
             
              clan_id: string;
         | 
| 756 756 | 
             
              create_time: string;
         | 
| 757 757 | 
             
            }
         | 
| 758 | 
            +
            export interface RemoveFriend {
         | 
| 759 | 
            +
              // 
         | 
| 760 | 
            +
              user_id: string;
         | 
| 761 | 
            +
            }
         | 
| 758 762 |  | 
| 759 763 | 
             
            export interface AddUserEmojiUsageEvent {
         | 
| 760 764 | 
             
              emoji_id: string;
         | 
| @@ -1189,6 +1193,8 @@ export interface Socket { | |
| 1189 1193 | 
             
              /** Receive channel removed user event */
         | 
| 1190 1194 | 
             
              onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
         | 
| 1191 1195 |  | 
| 1196 | 
            +
              onremovefriend: (user: RemoveFriend) => void;
         | 
| 1197 | 
            +
             | 
| 1192 1198 | 
             
              /** Receive clan removed user event */
         | 
| 1193 1199 | 
             
              onuserclanremoved: (user: UserClanRemovedEvent) => void;
         | 
| 1194 1200 |  | 
| @@ -1498,6 +1504,10 @@ export class DefaultSocket implements Socket { | |
| 1498 1504 | 
             
                      this.onuserchannelremoved(
         | 
| 1499 1505 | 
             
                        <UserChannelRemovedEvent>message.user_channel_removed_event
         | 
| 1500 1506 | 
             
                      );
         | 
| 1507 | 
            +
                    } else if (message.remove_friend) {
         | 
| 1508 | 
            +
                      this.onremovefriend(
         | 
| 1509 | 
            +
                        <RemoveFriend>message.remove_friend
         | 
| 1510 | 
            +
                      );
         | 
| 1501 1511 | 
             
                    } else if (message.user_clan_removed_event) {
         | 
| 1502 1512 | 
             
                      this.onuserclanremoved(
         | 
| 1503 1513 | 
             
                        <UserClanRemovedEvent>message.user_clan_removed_event
         | 
| @@ -1679,6 +1689,12 @@ export class DefaultSocket implements Socket { | |
| 1679 1689 | 
             
                }
         | 
| 1680 1690 | 
             
              }
         | 
| 1681 1691 |  | 
| 1692 | 
            +
              onremovefriend(user: RemoveFriend) {
         | 
| 1693 | 
            +
                if (this.verbose && window && window.console) {
         | 
| 1694 | 
            +
                  console.log(user);
         | 
| 1695 | 
            +
                }
         | 
| 1696 | 
            +
              }
         | 
| 1697 | 
            +
             | 
| 1682 1698 | 
             
              onuserclanremoved(user: UserClanRemovedEvent) {
         | 
| 1683 1699 | 
             
                if (this.verbose && window && window.console) {
         | 
| 1684 1700 | 
             
                  console.log(user);
         |