mezon-js 2.9.79 → 2.9.81

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -2590,6 +2590,30 @@ export interface ApiListClanWebhookResponse {
2590
2590
  list_clan_webhooks?: Array<ApiClanWebhook>;
2591
2591
  }
2592
2592
 
2593
+ /** */
2594
+ export interface MezonUpdateOnboardingStepByIdBody {
2595
+ //onboarding step.
2596
+ onboarding_step?: number;
2597
+ }
2598
+
2599
+ /** */
2600
+ export interface ApiListOnboardingStepResponse {
2601
+ //list onboarding steps.
2602
+ list_onboarding_step?: Array<ApiOnboardingSteps>;
2603
+ }
2604
+
2605
+ /** */
2606
+ export interface ApiOnboardingSteps {
2607
+ //clan id.
2608
+ clan_id?: string;
2609
+ //id.
2610
+ id?: string;
2611
+ //onboarding step.
2612
+ onboarding_step?: number;
2613
+ //user id.
2614
+ user_id?: string;
2615
+ }
2616
+
2593
2617
  export class MezonApi {
2594
2618
  constructor(
2595
2619
  readonly serverKey: string,
@@ -10087,4 +10111,82 @@ pushPubKey(bearerToken: string,
10087
10111
  ),
10088
10112
  ]);
10089
10113
  }
10114
+
10115
+ /** List onboarding step. */
10116
+ listOnboardingStep(bearerToken: string,
10117
+ clanId?:string,
10118
+ limit?:number,
10119
+ page?:number,
10120
+ options: any = {}): Promise<ApiListOnboardingStepResponse> {
10121
+
10122
+ const urlPath = "/v2/onboardingsteps";
10123
+ const queryParams = new Map<string, any>();
10124
+ queryParams.set("clan_id", clanId);
10125
+ queryParams.set("limit", limit);
10126
+ queryParams.set("page", page);
10127
+
10128
+ let bodyJson : string = "";
10129
+
10130
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
10131
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
10132
+ if (bearerToken) {
10133
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
10134
+ }
10135
+
10136
+ return Promise.race([
10137
+ fetch(fullUrl, fetchOptions).then((response) => {
10138
+ if (response.status == 204) {
10139
+ return response;
10140
+ } else if (response.status >= 200 && response.status < 300) {
10141
+ return response.json();
10142
+ } else {
10143
+ throw response;
10144
+ }
10145
+ }),
10146
+ new Promise((_, reject) =>
10147
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
10148
+ ),
10149
+ ]);
10150
+ }
10151
+
10152
+ /** Update onboarding step. */
10153
+ updateOnboardingStepById(bearerToken: string,
10154
+ id:string,
10155
+ body:MezonUpdateOnboardingStepByIdBody,
10156
+ options: any = {}): Promise<any> {
10157
+
10158
+ if (id === null || id === undefined) {
10159
+ throw new Error("'id' is a required parameter but is null or undefined.");
10160
+ }
10161
+ if (body === null || body === undefined) {
10162
+ throw new Error("'body' is a required parameter but is null or undefined.");
10163
+ }
10164
+ const urlPath = "/v2/onboardingsteps/{id}"
10165
+ .replace("{id}", encodeURIComponent(String(id)));
10166
+ const queryParams = new Map<string, any>();
10167
+
10168
+ let bodyJson : string = "";
10169
+ bodyJson = JSON.stringify(body || {});
10170
+
10171
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
10172
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
10173
+ if (bearerToken) {
10174
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
10175
+ }
10176
+
10177
+ return Promise.race([
10178
+ fetch(fullUrl, fetchOptions).then((response) => {
10179
+ if (response.status == 204) {
10180
+ return response;
10181
+ } else if (response.status >= 200 && response.status < 300) {
10182
+ return response.json();
10183
+ } else {
10184
+ throw response;
10185
+ }
10186
+ }),
10187
+ new Promise((_, reject) =>
10188
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
10189
+ ),
10190
+ ]);
10191
+ }
10090
10192
  }
package/client.ts CHANGED
@@ -149,6 +149,8 @@ import {
149
149
  ApiListClanWebhookResponse,
150
150
  MezonUpdateClanWebhookByIdBody,
151
151
  MezonUpdateClanDescBody,
152
+ ApiListOnboardingStepResponse,
153
+ MezonUpdateOnboardingStepByIdBody,
152
154
  } from "./api.gen";
153
155
 
154
156
  import { Session } from "./session";
@@ -4615,4 +4617,47 @@ export class Client {
4615
4617
  return response !== undefined;
4616
4618
  });
4617
4619
  }
4620
+
4621
+ //**list onboarding step */
4622
+ async listOnboardingStep(
4623
+ session: Session,
4624
+ clan_id?: string,
4625
+ limit?: number,
4626
+ page? :number,
4627
+ ): Promise<ApiListOnboardingStepResponse> {
4628
+ if (
4629
+ this.autoRefreshSession &&
4630
+ session.refresh_token &&
4631
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4632
+ ) {
4633
+ await this.sessionRefresh(session);
4634
+ }
4635
+
4636
+ return this.apiClient
4637
+ .listOnboardingStep(session.token, clan_id, limit, page)
4638
+ .then((response: ApiListOnboardingStepResponse) => {
4639
+ return Promise.resolve(response);
4640
+ });
4641
+ }
4642
+
4643
+ //**update onboarding step by id */
4644
+ async updateOnboardingStepById(
4645
+ session: Session,
4646
+ id: string,
4647
+ request: MezonUpdateOnboardingStepByIdBody
4648
+ ) {
4649
+ if (
4650
+ this.autoRefreshSession &&
4651
+ session.refresh_token &&
4652
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4653
+ ) {
4654
+ await this.sessionRefresh(session);
4655
+ }
4656
+
4657
+ return this.apiClient
4658
+ .updateOnboardingStepById(session.token, id, request)
4659
+ .then((response: any) => {
4660
+ return response !== undefined;
4661
+ });
4662
+ }
4618
4663
  }
package/dist/api.gen.d.ts CHANGED
@@ -1506,6 +1506,21 @@ export interface ApiGenerateClanWebhookResponse {
1506
1506
  export interface ApiListClanWebhookResponse {
1507
1507
  list_clan_webhooks?: Array<ApiClanWebhook>;
1508
1508
  }
1509
+ /** */
1510
+ export interface MezonUpdateOnboardingStepByIdBody {
1511
+ onboarding_step?: number;
1512
+ }
1513
+ /** */
1514
+ export interface ApiListOnboardingStepResponse {
1515
+ list_onboarding_step?: Array<ApiOnboardingSteps>;
1516
+ }
1517
+ /** */
1518
+ export interface ApiOnboardingSteps {
1519
+ clan_id?: string;
1520
+ id?: string;
1521
+ onboarding_step?: number;
1522
+ user_id?: string;
1523
+ }
1509
1524
  export declare class MezonApi {
1510
1525
  readonly serverKey: string;
1511
1526
  readonly basePath: string;
@@ -1888,4 +1903,8 @@ export declare class MezonApi {
1888
1903
  deleteClanWebhookById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1889
1904
  /** Update clan webhook by id. */
1890
1905
  updateClanWebhookById(bearerToken: string, id: string, body: MezonUpdateClanWebhookByIdBody, options?: any): Promise<any>;
1906
+ /** List onboarding step. */
1907
+ listOnboardingStep(bearerToken: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiListOnboardingStepResponse>;
1908
+ /** Update onboarding step. */
1909
+ updateOnboardingStepById(bearerToken: string, id: string, body: MezonUpdateOnboardingStepByIdBody, options?: any): Promise<any>;
1891
1910
  }
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, ApiUpdateEventRequest, 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, 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 } from "./api.gen";
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, ApiUpdateEventRequest, 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, 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, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByIdBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -619,4 +619,6 @@ export declare class Client {
619
619
  listClanWebhook(session: Session, clan_id: string): Promise<ApiListClanWebhookResponse>;
620
620
  deleteClanWebhookById(session: Session, id: string, clan_id: string): Promise<boolean>;
621
621
  updateClanWebhookById(session: Session, id: string, request: MezonUpdateClanWebhookByIdBody): Promise<boolean>;
622
+ listOnboardingStep(session: Session, clan_id?: string, limit?: number, page?: number): Promise<ApiListOnboardingStepResponse>;
623
+ updateOnboardingStepById(session: Session, id: string, request: MezonUpdateOnboardingStepByIdBody): Promise<boolean>;
622
624
  }
@@ -6548,6 +6548,66 @@ var MezonApi = class {
6548
6548
  )
6549
6549
  ]);
6550
6550
  }
6551
+ /** List onboarding step. */
6552
+ listOnboardingStep(bearerToken, clanId, limit, page, options = {}) {
6553
+ const urlPath = "/v2/onboardingsteps";
6554
+ const queryParams = /* @__PURE__ */ new Map();
6555
+ queryParams.set("clan_id", clanId);
6556
+ queryParams.set("limit", limit);
6557
+ queryParams.set("page", page);
6558
+ let bodyJson = "";
6559
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6560
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6561
+ if (bearerToken) {
6562
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6563
+ }
6564
+ return Promise.race([
6565
+ fetch(fullUrl, fetchOptions).then((response) => {
6566
+ if (response.status == 204) {
6567
+ return response;
6568
+ } else if (response.status >= 200 && response.status < 300) {
6569
+ return response.json();
6570
+ } else {
6571
+ throw response;
6572
+ }
6573
+ }),
6574
+ new Promise(
6575
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6576
+ )
6577
+ ]);
6578
+ }
6579
+ /** Update onboarding step. */
6580
+ updateOnboardingStepById(bearerToken, id, body, options = {}) {
6581
+ if (id === null || id === void 0) {
6582
+ throw new Error("'id' is a required parameter but is null or undefined.");
6583
+ }
6584
+ if (body === null || body === void 0) {
6585
+ throw new Error("'body' is a required parameter but is null or undefined.");
6586
+ }
6587
+ const urlPath = "/v2/onboardingsteps/{id}".replace("{id}", encodeURIComponent(String(id)));
6588
+ const queryParams = /* @__PURE__ */ new Map();
6589
+ let bodyJson = "";
6590
+ bodyJson = JSON.stringify(body || {});
6591
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6592
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6593
+ if (bearerToken) {
6594
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6595
+ }
6596
+ return Promise.race([
6597
+ fetch(fullUrl, fetchOptions).then((response) => {
6598
+ if (response.status == 204) {
6599
+ return response;
6600
+ } else if (response.status >= 200 && response.status < 300) {
6601
+ return response.json();
6602
+ } else {
6603
+ throw response;
6604
+ }
6605
+ }),
6606
+ new Promise(
6607
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6608
+ )
6609
+ ]);
6610
+ }
6551
6611
  };
6552
6612
 
6553
6613
  // session.ts
@@ -6938,6 +6998,10 @@ var _DefaultSocket = class _DefaultSocket {
6938
6998
  this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
6939
6999
  } else if (message.list_activity) {
6940
7000
  this.onactivityupdated(message.list_activity);
7001
+ } else if (message.join_ptt_channel) {
7002
+ this.onjoinpttchannel(message.join_ptt_channel);
7003
+ } else if (message.talk_ptt_channel) {
7004
+ this.ontalkpttchannel(message.talk_ptt_channel);
6941
7005
  } else {
6942
7006
  if (this.verbose && window && window.console) {
6943
7007
  console.log("Unrecognized message received: %o", message);
@@ -7230,6 +7294,16 @@ var _DefaultSocket = class _DefaultSocket {
7230
7294
  console.log(list_activity);
7231
7295
  }
7232
7296
  }
7297
+ onjoinpttchannel(join_ptt_channel) {
7298
+ if (this.verbose && window && window.console) {
7299
+ console.log(join_ptt_channel);
7300
+ }
7301
+ }
7302
+ ontalkpttchannel(talk_ptt_channel) {
7303
+ if (this.verbose && window && window.console) {
7304
+ console.log(talk_ptt_channel);
7305
+ }
7306
+ }
7233
7307
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7234
7308
  const untypedMessage = message;
7235
7309
  return new Promise((resolve, reject) => {
@@ -7476,10 +7550,10 @@ var _DefaultSocket = class _DefaultSocket {
7476
7550
  return response.check_name_existed_event;
7477
7551
  });
7478
7552
  }
7479
- forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id) {
7553
+ forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
7480
7554
  return __async(this, null, function* () {
7481
7555
  const response = yield this.send({
7482
- webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id }
7556
+ webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id, caller_id }
7483
7557
  });
7484
7558
  return response.webrtc_signaling_fwd;
7485
7559
  });
@@ -9994,4 +10068,26 @@ var Client = class {
9994
10068
  });
9995
10069
  });
9996
10070
  }
10071
+ //**list onboarding step */
10072
+ listOnboardingStep(session, clan_id, limit, page) {
10073
+ return __async(this, null, function* () {
10074
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10075
+ yield this.sessionRefresh(session);
10076
+ }
10077
+ return this.apiClient.listOnboardingStep(session.token, clan_id, limit, page).then((response) => {
10078
+ return Promise.resolve(response);
10079
+ });
10080
+ });
10081
+ }
10082
+ //**update onboarding step by id */
10083
+ updateOnboardingStepById(session, id, request) {
10084
+ return __async(this, null, function* () {
10085
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10086
+ yield this.sessionRefresh(session);
10087
+ }
10088
+ return this.apiClient.updateOnboardingStepById(session.token, id, request).then((response) => {
10089
+ return response !== void 0;
10090
+ });
10091
+ });
10092
+ }
9997
10093
  };
@@ -6518,6 +6518,66 @@ var MezonApi = class {
6518
6518
  )
6519
6519
  ]);
6520
6520
  }
6521
+ /** List onboarding step. */
6522
+ listOnboardingStep(bearerToken, clanId, limit, page, options = {}) {
6523
+ const urlPath = "/v2/onboardingsteps";
6524
+ const queryParams = /* @__PURE__ */ new Map();
6525
+ queryParams.set("clan_id", clanId);
6526
+ queryParams.set("limit", limit);
6527
+ queryParams.set("page", page);
6528
+ let bodyJson = "";
6529
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6530
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6531
+ if (bearerToken) {
6532
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6533
+ }
6534
+ return Promise.race([
6535
+ fetch(fullUrl, fetchOptions).then((response) => {
6536
+ if (response.status == 204) {
6537
+ return response;
6538
+ } else if (response.status >= 200 && response.status < 300) {
6539
+ return response.json();
6540
+ } else {
6541
+ throw response;
6542
+ }
6543
+ }),
6544
+ new Promise(
6545
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6546
+ )
6547
+ ]);
6548
+ }
6549
+ /** Update onboarding step. */
6550
+ updateOnboardingStepById(bearerToken, id, body, options = {}) {
6551
+ if (id === null || id === void 0) {
6552
+ throw new Error("'id' is a required parameter but is null or undefined.");
6553
+ }
6554
+ if (body === null || body === void 0) {
6555
+ throw new Error("'body' is a required parameter but is null or undefined.");
6556
+ }
6557
+ const urlPath = "/v2/onboardingsteps/{id}".replace("{id}", encodeURIComponent(String(id)));
6558
+ const queryParams = /* @__PURE__ */ new Map();
6559
+ let bodyJson = "";
6560
+ bodyJson = JSON.stringify(body || {});
6561
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6562
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6563
+ if (bearerToken) {
6564
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6565
+ }
6566
+ return Promise.race([
6567
+ fetch(fullUrl, fetchOptions).then((response) => {
6568
+ if (response.status == 204) {
6569
+ return response;
6570
+ } else if (response.status >= 200 && response.status < 300) {
6571
+ return response.json();
6572
+ } else {
6573
+ throw response;
6574
+ }
6575
+ }),
6576
+ new Promise(
6577
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
6578
+ )
6579
+ ]);
6580
+ }
6521
6581
  };
6522
6582
 
6523
6583
  // session.ts
@@ -6908,6 +6968,10 @@ var _DefaultSocket = class _DefaultSocket {
6908
6968
  this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
6909
6969
  } else if (message.list_activity) {
6910
6970
  this.onactivityupdated(message.list_activity);
6971
+ } else if (message.join_ptt_channel) {
6972
+ this.onjoinpttchannel(message.join_ptt_channel);
6973
+ } else if (message.talk_ptt_channel) {
6974
+ this.ontalkpttchannel(message.talk_ptt_channel);
6911
6975
  } else {
6912
6976
  if (this.verbose && window && window.console) {
6913
6977
  console.log("Unrecognized message received: %o", message);
@@ -7200,6 +7264,16 @@ var _DefaultSocket = class _DefaultSocket {
7200
7264
  console.log(list_activity);
7201
7265
  }
7202
7266
  }
7267
+ onjoinpttchannel(join_ptt_channel) {
7268
+ if (this.verbose && window && window.console) {
7269
+ console.log(join_ptt_channel);
7270
+ }
7271
+ }
7272
+ ontalkpttchannel(talk_ptt_channel) {
7273
+ if (this.verbose && window && window.console) {
7274
+ console.log(talk_ptt_channel);
7275
+ }
7276
+ }
7203
7277
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
7204
7278
  const untypedMessage = message;
7205
7279
  return new Promise((resolve, reject) => {
@@ -7446,10 +7520,10 @@ var _DefaultSocket = class _DefaultSocket {
7446
7520
  return response.check_name_existed_event;
7447
7521
  });
7448
7522
  }
7449
- forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id) {
7523
+ forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
7450
7524
  return __async(this, null, function* () {
7451
7525
  const response = yield this.send({
7452
- webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id }
7526
+ webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id, caller_id }
7453
7527
  });
7454
7528
  return response.webrtc_signaling_fwd;
7455
7529
  });
@@ -9964,6 +10038,28 @@ var Client = class {
9964
10038
  });
9965
10039
  });
9966
10040
  }
10041
+ //**list onboarding step */
10042
+ listOnboardingStep(session, clan_id, limit, page) {
10043
+ return __async(this, null, function* () {
10044
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10045
+ yield this.sessionRefresh(session);
10046
+ }
10047
+ return this.apiClient.listOnboardingStep(session.token, clan_id, limit, page).then((response) => {
10048
+ return Promise.resolve(response);
10049
+ });
10050
+ });
10051
+ }
10052
+ //**update onboarding step by id */
10053
+ updateOnboardingStepById(session, id, request) {
10054
+ return __async(this, null, function* () {
10055
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10056
+ yield this.sessionRefresh(session);
10057
+ }
10058
+ return this.apiClient.updateOnboardingStepById(session.token, id, request).then((response) => {
10059
+ return response !== void 0;
10060
+ });
10061
+ });
10062
+ }
9967
10063
  };
9968
10064
  export {
9969
10065
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -589,6 +589,7 @@ export interface WebrtcSignalingFwd {
589
589
  data_type: number;
590
590
  json_data: string;
591
591
  channel_id: string;
592
+ caller_id: string;
592
593
  }
593
594
  export interface JoinPTTChannel {
594
595
  channel_id: string;
@@ -708,7 +709,7 @@ export interface Socket {
708
709
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
709
710
  handleMessageButtonClick: (message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string) => Promise<MessageButtonClicked>;
710
711
  onmessagebuttonclicked: (event: MessageButtonClicked) => void;
711
- forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string) => Promise<WebrtcSignalingFwd>;
712
+ forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string, caller_id: string) => Promise<WebrtcSignalingFwd>;
712
713
  onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
713
714
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
714
715
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
@@ -723,6 +724,8 @@ export interface Socket {
723
724
  onunmuteevent: (unmute_event: UnmuteEvent) => void;
724
725
  ontokensent: (token: ApiTokenSentEvent) => void;
725
726
  onactivityupdated: (list_activity: ListActivity) => void;
727
+ onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
728
+ ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
726
729
  }
727
730
  /** Reports an error received from a socket message. */
728
731
  export interface SocketError {
@@ -800,6 +803,8 @@ export declare class DefaultSocket implements Socket {
800
803
  onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
801
804
  onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
802
805
  onactivityupdated(list_activity: ListActivity): void;
806
+ onjoinpttchannel(join_ptt_channel: JoinPTTChannel): void;
807
+ ontalkpttchannel(talk_ptt_channel: TalkPTTChannel): void;
803
808
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
804
809
  followUsers(userIds: string[]): Promise<Status>;
805
810
  joinClanChat(clan_id: string): Promise<ClanJoin>;
@@ -819,7 +824,7 @@ export declare class DefaultSocket implements Socket {
819
824
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
820
825
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
821
826
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
822
- forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string, channel_id: string): Promise<WebrtcSignalingFwd>;
827
+ forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string, channel_id: string, caller_id: string): Promise<WebrtcSignalingFwd>;
823
828
  handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string): Promise<MessageButtonClicked>;
824
829
  joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
825
830
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.79",
4
+ "version": "2.9.81",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -833,6 +833,7 @@ export interface WebrtcSignalingFwd {
833
833
  data_type: number;
834
834
  json_data: string;
835
835
  channel_id: string;
836
+ caller_id: string;
836
837
  }
837
838
 
838
839
  export interface JoinPTTChannel {
@@ -1147,7 +1148,7 @@ export interface Socket {
1147
1148
 
1148
1149
  onmessagebuttonclicked: (event: MessageButtonClicked) => void;
1149
1150
 
1150
- forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string) => Promise<WebrtcSignalingFwd>;
1151
+ forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string, caller_id: string) => Promise<WebrtcSignalingFwd>;
1151
1152
 
1152
1153
  onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
1153
1154
 
@@ -1184,6 +1185,10 @@ export interface Socket {
1184
1185
  ontokensent: (token: ApiTokenSentEvent) => void;
1185
1186
 
1186
1187
  onactivityupdated: (list_activity: ListActivity) => void;
1188
+
1189
+ onjoinpttchannel: (join_ptt_channel: JoinPTTChannel) => void;
1190
+
1191
+ ontalkpttchannel: (talk_ptt_channel: TalkPTTChannel) => void;
1187
1192
  }
1188
1193
 
1189
1194
  /** Reports an error received from a socket message. */
@@ -1261,7 +1266,6 @@ export class DefaultSocket implements Socket {
1261
1266
  if (this.verbose && window && window.console) {
1262
1267
  console.log("Response: %o", JSON.stringify(message));
1263
1268
  }
1264
-
1265
1269
  /** Inbound message from server. */
1266
1270
  if (!message.cid) {
1267
1271
  if (message.notifications) {
@@ -1441,6 +1445,10 @@ export class DefaultSocket implements Socket {
1441
1445
  this.onwebrtcsignalingfwd(<WebrtcSignalingFwd>message.webrtc_signaling_fwd);
1442
1446
  } else if (message.list_activity){
1443
1447
  this.onactivityupdated(<ListActivity>message.list_activity);
1448
+ } else if (message.join_ptt_channel){
1449
+ this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
1450
+ } else if (message.talk_ptt_channel){
1451
+ this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
1444
1452
  } else {
1445
1453
  if (this.verbose && window && window.console) {
1446
1454
  console.log("Unrecognized message received: %o", message);
@@ -1789,6 +1797,18 @@ export class DefaultSocket implements Socket {
1789
1797
  console.log(list_activity);
1790
1798
  }
1791
1799
  }
1800
+
1801
+ onjoinpttchannel(join_ptt_channel: JoinPTTChannel) {
1802
+ if (this.verbose && window && window.console) {
1803
+ console.log(join_ptt_channel);
1804
+ }
1805
+ }
1806
+
1807
+ ontalkpttchannel(talk_ptt_channel: TalkPTTChannel) {
1808
+ if (this.verbose && window && window.console) {
1809
+ console.log(talk_ptt_channel);
1810
+ }
1811
+ }
1792
1812
  send(
1793
1813
  message:
1794
1814
  | ChannelJoin
@@ -2145,9 +2165,10 @@ export class DefaultSocket implements Socket {
2145
2165
  receiver_id: string,
2146
2166
  data_type: number,
2147
2167
  json_data: string,
2148
- channel_id: string): Promise<WebrtcSignalingFwd> {
2168
+ channel_id: string,
2169
+ caller_id: string): Promise<WebrtcSignalingFwd> {
2149
2170
  const response = await this.send({
2150
- webrtc_signaling_fwd: { receiver_id: receiver_id, data_type: data_type, json_data: json_data, channel_id: channel_id },
2171
+ webrtc_signaling_fwd: { receiver_id: receiver_id, data_type: data_type, json_data: json_data, channel_id: channel_id, caller_id: caller_id },
2151
2172
  });
2152
2173
  return response.webrtc_signaling_fwd;
2153
2174
  }