mezon-js 2.11.22 → 2.11.23

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/client.ts CHANGED
@@ -5157,5 +5157,22 @@ export class Client {
5157
5157
  return Promise.resolve(response);
5158
5158
  });
5159
5159
  }
5160
-
5160
+
5161
+ async deleteAccount(
5162
+ session: Session
5163
+ ): Promise<any> {
5164
+ if (
5165
+ this.autoRefreshSession &&
5166
+ session.refresh_token &&
5167
+ session.isexpired(Date.now() / 1000)
5168
+ ) {
5169
+ await this.sessionRefresh(session);
5170
+ }
5171
+
5172
+ return this.apiClient
5173
+ .deleteAccount(session.token)
5174
+ .then((response: ApiMezonOauthClientList) => {
5175
+ return Promise.resolve(response);
5176
+ });
5177
+ }
5161
5178
  }
package/dist/client.d.ts CHANGED
@@ -654,4 +654,5 @@ export declare class Client {
654
654
  /** Delete user event */
655
655
  deleteUserEvent(session: Session, clanId?: string, eventId?: string): Promise<any>;
656
656
  updateRoleOrder(session: Session, request: ApiUpdateRoleOrderRequest): Promise<any>;
657
+ deleteAccount(session: Session): Promise<any>;
657
658
  }
@@ -7500,6 +7500,8 @@ var _DefaultSocket = class _DefaultSocket {
7500
7500
  this.onstickerdeleted(message.sticker_delete_event);
7501
7501
  } else if (message.channel_updated_event) {
7502
7502
  this.onchannelupdated(message.channel_updated_event);
7503
+ } else if (message.delete_account_event) {
7504
+ this.ondeleteaccount(message.delete_account_event);
7503
7505
  } else if (message.clan_profile_updated_event) {
7504
7506
  this.onclanprofileupdated(message.clan_profile_updated_event);
7505
7507
  } else if (message.clan_updated_event) {
@@ -7884,6 +7886,11 @@ var _DefaultSocket = class _DefaultSocket {
7884
7886
  console.log(channelUpdated);
7885
7887
  }
7886
7888
  }
7889
+ ondeleteaccount(deleteAccountEvent) {
7890
+ if (this.verbose && window && window.console) {
7891
+ console.log(deleteAccountEvent);
7892
+ }
7893
+ }
7887
7894
  onclanprofileupdated(clanprofile) {
7888
7895
  if (this.verbose && window && window.console) {
7889
7896
  console.log(clanprofile);
@@ -11172,4 +11179,14 @@ var Client = class {
11172
11179
  });
11173
11180
  });
11174
11181
  }
11182
+ deleteAccount(session) {
11183
+ return __async(this, null, function* () {
11184
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11185
+ yield this.sessionRefresh(session);
11186
+ }
11187
+ return this.apiClient.deleteAccount(session.token).then((response) => {
11188
+ return Promise.resolve(response);
11189
+ });
11190
+ });
11191
+ }
11175
11192
  };
@@ -7466,6 +7466,8 @@ var _DefaultSocket = class _DefaultSocket {
7466
7466
  this.onstickerdeleted(message.sticker_delete_event);
7467
7467
  } else if (message.channel_updated_event) {
7468
7468
  this.onchannelupdated(message.channel_updated_event);
7469
+ } else if (message.delete_account_event) {
7470
+ this.ondeleteaccount(message.delete_account_event);
7469
7471
  } else if (message.clan_profile_updated_event) {
7470
7472
  this.onclanprofileupdated(message.clan_profile_updated_event);
7471
7473
  } else if (message.clan_updated_event) {
@@ -7850,6 +7852,11 @@ var _DefaultSocket = class _DefaultSocket {
7850
7852
  console.log(channelUpdated);
7851
7853
  }
7852
7854
  }
7855
+ ondeleteaccount(deleteAccountEvent) {
7856
+ if (this.verbose && window && window.console) {
7857
+ console.log(deleteAccountEvent);
7858
+ }
7859
+ }
7853
7860
  onclanprofileupdated(clanprofile) {
7854
7861
  if (this.verbose && window && window.console) {
7855
7862
  console.log(clanprofile);
@@ -11138,6 +11145,16 @@ var Client = class {
11138
11145
  });
11139
11146
  });
11140
11147
  }
11148
+ deleteAccount(session) {
11149
+ return __async(this, null, function* () {
11150
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
11151
+ yield this.sessionRefresh(session);
11152
+ }
11153
+ return this.apiClient.deleteAccount(session.token).then((response) => {
11154
+ return Promise.resolve(response);
11155
+ });
11156
+ });
11157
+ }
11141
11158
  };
11142
11159
  export {
11143
11160
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -338,6 +338,9 @@ export interface ChannelUpdatedEvent {
338
338
  is_active_thread: boolean;
339
339
  active: number;
340
340
  }
341
+ export interface DeleteAccountEvent {
342
+ user_id: string;
343
+ }
341
344
  export interface ChannelCreatedEvent {
342
345
  clan_id: string;
343
346
  category_id: string;
@@ -859,6 +862,7 @@ export interface Socket {
859
862
  oneventnotiuserchannel: (noti_user_channel: ApiNotificationUserChannel) => void;
860
863
  oneventwebhook: (webhook_event: ApiWebhook) => void;
861
864
  onroleassign: (role_assign_event: RoleAssignedEvent) => void;
865
+ ondeleteaccount: (deleteAccountEvent: DeleteAccountEvent) => void;
862
866
  onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
863
867
  onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
864
868
  onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
@@ -933,6 +937,7 @@ export declare class DefaultSocket implements Socket {
933
937
  onstickerdeleted(stickerDeleted: StickerDeleteEvent): void;
934
938
  onstickerupdated(stickerUpdated: StickerUpdateEvent): void;
935
939
  onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
940
+ ondeleteaccount(deleteAccountEvent: DeleteAccountEvent): void;
936
941
  onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent): void;
937
942
  onclanupdated(clan: ClanUpdatedEvent): void;
938
943
  onlastseenupdated(event: LastSeenMessageEvent): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.11.22",
4
+ "version": "2.11.23",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -500,6 +500,11 @@ export interface ChannelUpdatedEvent {
500
500
  active: number;
501
501
  }
502
502
 
503
+ export interface DeleteAccountEvent {
504
+ // user id
505
+ user_id: string;
506
+ }
507
+
503
508
  export interface ChannelCreatedEvent {
504
509
  // clan id
505
510
  clan_id: string;
@@ -1403,6 +1408,8 @@ export interface Socket {
1403
1408
 
1404
1409
  onroleassign: (role_assign_event: RoleAssignedEvent) => void;
1405
1410
 
1411
+ ondeleteaccount: (deleteAccountEvent: DeleteAccountEvent) => void;
1412
+
1406
1413
  onstreamingchannelstarted: (
1407
1414
  streaming_started_event: StreamingStartedEvent
1408
1415
  ) => void;
@@ -1554,6 +1561,8 @@ export class DefaultSocket implements Socket {
1554
1561
  this.onstickerdeleted(message.sticker_delete_event);
1555
1562
  } else if (message.channel_updated_event) {
1556
1563
  this.onchannelupdated(message.channel_updated_event);
1564
+ } else if (message.delete_account_event) {
1565
+ this.ondeleteaccount(message.delete_account_event);
1557
1566
  } else if (message.clan_profile_updated_event) {
1558
1567
  this.onclanprofileupdated(message.clan_profile_updated_event);
1559
1568
  } else if (message.clan_updated_event) {
@@ -1978,6 +1987,12 @@ export class DefaultSocket implements Socket {
1978
1987
  }
1979
1988
  }
1980
1989
 
1990
+ ondeleteaccount(deleteAccountEvent: DeleteAccountEvent) {
1991
+ if (this.verbose && window && window.console) {
1992
+ console.log(deleteAccountEvent);
1993
+ }
1994
+ }
1995
+
1981
1996
  onclanprofileupdated(clanprofile: ClanProfileUpdatedEvent) {
1982
1997
  if (this.verbose && window && window.console) {
1983
1998
  console.log(clanprofile);