@bitrix24/b24jssdk 0.4.10 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -927,6 +927,7 @@ type MessageInitData = RefreshAuthData & {
927
927
  type AuthData = {
928
928
  access_token: string;
929
929
  refresh_token: string;
930
+ expires: number;
930
931
  expires_in: number;
931
932
  domain: string;
932
933
  member_id: string;
@@ -927,6 +927,7 @@ type MessageInitData = RefreshAuthData & {
927
927
  type AuthData = {
928
928
  access_token: string;
929
929
  refresh_token: string;
930
+ expires: number;
930
931
  expires_in: number;
931
932
  domain: string;
932
933
  member_id: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.4.10
2
+ * @version @bitrix24/b24jssdk v0.5.1
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -1683,7 +1683,7 @@ class Http {
1683
1683
  #clientSideWarningMessage = "";
1684
1684
  constructor(baseURL, authActions, options) {
1685
1685
  const defaultHeaders = {
1686
- // 'X-Sdk': 'b24-js-sdk-v-0.4.10'
1686
+ // 'X-Sdk': 'b24-js-sdk-v-0.5.1'
1687
1687
  };
1688
1688
  this.#clientAxios = axios.create({
1689
1689
  baseURL,
@@ -2116,7 +2116,7 @@ class Http {
2116
2116
  }
2117
2117
  const queryParams = new URLSearchParams({
2118
2118
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
2119
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.10",
2119
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.5.1",
2120
2120
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
2121
2121
  });
2122
2122
  return `${baseUrl}?${queryParams.toString()}`;
@@ -3167,6 +3167,7 @@ class AuthHookManager {
3167
3167
  return {
3168
3168
  access_token: this.#b24HookParams.secret,
3169
3169
  refresh_token: "hook",
3170
+ expires: 0,
3170
3171
  expires_in: 0,
3171
3172
  domain: this.#domain,
3172
3173
  member_id: this.#domain
@@ -3546,6 +3547,7 @@ class AuthManager {
3546
3547
  #accessToken = null;
3547
3548
  #refreshId = null;
3548
3549
  #authExpires = 0;
3550
+ #authExpiresIn = 0;
3549
3551
  #memberId = null;
3550
3552
  #isAdmin = false;
3551
3553
  #appFrame;
@@ -3562,7 +3564,8 @@ class AuthManager {
3562
3564
  if (data.AUTH_ID) {
3563
3565
  this.#accessToken = data.AUTH_ID;
3564
3566
  this.#refreshId = data.REFRESH_ID;
3565
- this.#authExpires = Date.now() + Number.parseInt(data.AUTH_EXPIRES) * 1e3;
3567
+ this.#authExpiresIn = Number.parseInt(data.AUTH_EXPIRES);
3568
+ this.#authExpires = Date.now() + this.#authExpiresIn * 1e3;
3566
3569
  this.#isAdmin = data.IS_ADMIN;
3567
3570
  this.#memberId = data.MEMBER_ID || "";
3568
3571
  }
@@ -3577,7 +3580,8 @@ class AuthManager {
3577
3580
  return this.#authExpires > Date.now() ? {
3578
3581
  access_token: this.#accessToken,
3579
3582
  refresh_token: this.#refreshId,
3580
- expires_in: this.#authExpires,
3583
+ expires: this.#authExpires / 1e3,
3584
+ expires_in: this.#authExpiresIn,
3581
3585
  domain: this.#appFrame.getTargetOrigin(),
3582
3586
  member_id: this.#memberId
3583
3587
  } : false;
@@ -4398,6 +4402,7 @@ class AuthOAuthManager {
4398
4402
  #authOptions;
4399
4403
  #oAuthSecret;
4400
4404
  #authExpires = 0;
4405
+ #authExpiresIn = 0;
4401
4406
  #domain;
4402
4407
  #b24TargetRest;
4403
4408
  #b24Target;
@@ -4412,6 +4417,7 @@ class AuthOAuthManager {
4412
4417
  this.#b24Target = this.#b24TargetRest.replace("/rest/", "");
4413
4418
  this.#oAuthTarget = this.#authOptions.serverEndpoint.replace("/rest/", "");
4414
4419
  this.#authExpires = this.#authOptions.expires * 1e3;
4420
+ this.#authExpiresIn = this.#authOptions.expiresIn;
4415
4421
  this.#clientAxios = axios.create({
4416
4422
  baseURL: this.#oAuthTarget,
4417
4423
  headers: {
@@ -4427,7 +4433,8 @@ class AuthOAuthManager {
4427
4433
  return this.#authExpires > Date.now() ? {
4428
4434
  access_token: this.#authOptions.accessToken,
4429
4435
  refresh_token: this.#authOptions.refreshToken,
4430
- expires_in: this.#authOptions.expiresIn,
4436
+ expires: this.#authExpires / 1e3,
4437
+ expires_in: this.#authExpiresIn,
4431
4438
  domain: this.#domain,
4432
4439
  member_id: this.#authOptions.memberId
4433
4440
  } : false;