zmp-sdk 2.15.0-rc.4 → 2.15.2

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.
@@ -36589,7 +36589,7 @@
36589
36589
  }
36590
36590
  };
36591
36591
 
36592
- var version = "2.15.0-rc.4";
36592
+ var version = "2.15.2";
36593
36593
 
36594
36594
  class Basics {
36595
36595
  /**
@@ -38464,6 +38464,7 @@
38464
38464
  case 'zmp':
38465
38465
  const currentUrl = new URL(location.href);
38466
38466
  const params = new URLSearchParams();
38467
+ const accessToken = yield this.getAccessToken();
38467
38468
  const description = {
38468
38469
  vi: '',
38469
38470
  en: ''
@@ -38484,43 +38485,27 @@
38484
38485
  params.append('description', description.vi || description.en);
38485
38486
  params.append('thumbnail', object.data.thumbnail);
38486
38487
  params.append('url', validUrl.href);
38487
- const config = {
38488
+ params.append('accessToken', accessToken || '');
38489
+ const postConfig = {
38488
38490
  headers: {
38489
38491
  'Content-Type': 'application/x-www-form-urlencoded'
38490
38492
  }
38491
38493
  };
38492
- const res = yield axios.post('https://h5.zalo.me/openapi/create-sharelink', params, config);
38494
+ const res = yield axios.post('https://h5.zalo.me/openapi/create-sharelink', params, postConfig);
38493
38495
  const resData = res.data;
38494
38496
  if (!resData || resData.err !== 0) {
38495
38497
  throw apiResponse.error.cannotGetShareInfo();
38496
38498
  }
38497
- const zaloVersion = getZaloVersion();
38498
- const platform = checkPlatform();
38499
- if ((platform.isAndroid && zaloVersion % 100000 <= 593) ||
38500
- (platform.isIOS && zaloVersion <= 424)) {
38499
+ getZaloVersion();
38500
+ checkPlatform();
38501
+ {
38502
+ validUrl.search = `${validUrl.search}&zshareId=${resData.data.shareId}`;
38501
38503
  reqData = {
38502
- link: `${resData.data.shareUrl}`,
38504
+ link: validUrl.href,
38503
38505
  chatOnly: object.data.chatOnly ? 1 : 0
38504
38506
  };
38505
38507
  object.type = 'link';
38506
38508
  }
38507
- else {
38508
- reqData = {
38509
- data: {
38510
- ZInstantAPIInfo: {
38511
- url: `${resData.data.zinstantApi}`,
38512
- zinstantdata_id: `templateId=11412&appId=${this.getAppId()}&shareId=${resData.data.shareId}`
38513
- },
38514
- previewMsgText: {
38515
- msg: {
38516
- en: description.en,
38517
- vi: description.vi
38518
- }
38519
- },
38520
- enableReactions: 1
38521
- }
38522
- };
38523
- }
38524
38509
  }
38525
38510
  return yield this.callNative(ACTION.OPEN_SHARESHEET.name, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38526
38511
  haveTimeout: false
@@ -38671,6 +38656,7 @@
38671
38656
  var _ZaloMiniProgramSDK_zAppId, _ZaloMiniProgramSDK_appId, _ZaloMiniProgramSDK_appConfig, _ZaloMiniProgramSDK_zOAuth, _ZaloMiniProgramSDK_zOAuthVrf, _ZaloMiniProgramSDK_accessToken, _ZaloMiniProgramSDK_refreshToken, _ZaloMiniProgramSDK_cache, _ZaloMiniProgramSDK_prevGetTokenTimestamp, _ZaloMiniProgramSDK_tokenExpiresIn, _ZaloMiniProgramSDK_cookies, _ZaloMiniProgramSDK_configWindow, _ZaloMiniProgramSDK_configApp, _ZaloMiniProgramSDK_callJump, _ZaloMiniProgramSDK_setNavigationBarRightButton, _ZaloMiniProgramSDK_getActionsSupported;
38672
38657
  class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38673
38658
  constructor() {
38659
+ var _a, _b, _c, _d;
38674
38660
  super();
38675
38661
  _ZaloMiniProgramSDK_zAppId.set(this, window.zAppID);
38676
38662
  _ZaloMiniProgramSDK_appId.set(this, window.APP_ID);
@@ -38816,10 +38802,9 @@
38816
38802
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38817
38803
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
38818
38804
  this.isShowNavBar = true;
38819
- this.isShowHomeButton = true;
38820
38805
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, 0);
38821
38806
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, 0);
38822
- // this.#configApp();
38807
+ this.isShowHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' || ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both';
38823
38808
  }
38824
38809
  static getInstance() {
38825
38810
  if (!ZaloMiniProgramSDK.instance) {
package/dist/index.es.js CHANGED
@@ -36586,7 +36586,7 @@ const apiResponse = {
36586
36586
  }
36587
36587
  };
36588
36588
 
36589
- var version = "2.15.0-rc.4";
36589
+ var version = "2.15.2";
36590
36590
 
36591
36591
  class Basics {
36592
36592
  /**
@@ -38461,6 +38461,7 @@ class Zalo {
38461
38461
  case 'zmp':
38462
38462
  const currentUrl = new URL(location.href);
38463
38463
  const params = new URLSearchParams();
38464
+ const accessToken = yield this.getAccessToken();
38464
38465
  const description = {
38465
38466
  vi: '',
38466
38467
  en: ''
@@ -38481,43 +38482,27 @@ class Zalo {
38481
38482
  params.append('description', description.vi || description.en);
38482
38483
  params.append('thumbnail', object.data.thumbnail);
38483
38484
  params.append('url', validUrl.href);
38484
- const config = {
38485
+ params.append('accessToken', accessToken || '');
38486
+ const postConfig = {
38485
38487
  headers: {
38486
38488
  'Content-Type': 'application/x-www-form-urlencoded'
38487
38489
  }
38488
38490
  };
38489
- const res = yield axios.post('https://h5.zalo.me/openapi/create-sharelink', params, config);
38491
+ const res = yield axios.post('https://h5.zalo.me/openapi/create-sharelink', params, postConfig);
38490
38492
  const resData = res.data;
38491
38493
  if (!resData || resData.err !== 0) {
38492
38494
  throw apiResponse.error.cannotGetShareInfo();
38493
38495
  }
38494
- const zaloVersion = getZaloVersion();
38495
- const platform = checkPlatform();
38496
- if ((platform.isAndroid && zaloVersion % 100000 <= 593) ||
38497
- (platform.isIOS && zaloVersion <= 424)) {
38496
+ getZaloVersion();
38497
+ checkPlatform();
38498
+ {
38499
+ validUrl.search = `${validUrl.search}&zshareId=${resData.data.shareId}`;
38498
38500
  reqData = {
38499
- link: `${resData.data.shareUrl}`,
38501
+ link: validUrl.href,
38500
38502
  chatOnly: object.data.chatOnly ? 1 : 0
38501
38503
  };
38502
38504
  object.type = 'link';
38503
38505
  }
38504
- else {
38505
- reqData = {
38506
- data: {
38507
- ZInstantAPIInfo: {
38508
- url: `${resData.data.zinstantApi}`,
38509
- zinstantdata_id: `templateId=11412&appId=${this.getAppId()}&shareId=${resData.data.shareId}`
38510
- },
38511
- previewMsgText: {
38512
- msg: {
38513
- en: description.en,
38514
- vi: description.vi
38515
- }
38516
- },
38517
- enableReactions: 1
38518
- }
38519
- };
38520
- }
38521
38506
  }
38522
38507
  return yield this.callNative(ACTION.OPEN_SHARESHEET.name, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38523
38508
  haveTimeout: false
@@ -38668,6 +38653,7 @@ class Routing {
38668
38653
  var _ZaloMiniProgramSDK_zAppId, _ZaloMiniProgramSDK_appId, _ZaloMiniProgramSDK_appConfig, _ZaloMiniProgramSDK_zOAuth, _ZaloMiniProgramSDK_zOAuthVrf, _ZaloMiniProgramSDK_accessToken, _ZaloMiniProgramSDK_refreshToken, _ZaloMiniProgramSDK_cache, _ZaloMiniProgramSDK_prevGetTokenTimestamp, _ZaloMiniProgramSDK_tokenExpiresIn, _ZaloMiniProgramSDK_cookies, _ZaloMiniProgramSDK_configWindow, _ZaloMiniProgramSDK_configApp, _ZaloMiniProgramSDK_callJump, _ZaloMiniProgramSDK_setNavigationBarRightButton, _ZaloMiniProgramSDK_getActionsSupported;
38669
38654
  class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38670
38655
  constructor() {
38656
+ var _a, _b, _c, _d;
38671
38657
  super();
38672
38658
  _ZaloMiniProgramSDK_zAppId.set(this, window.zAppID);
38673
38659
  _ZaloMiniProgramSDK_appId.set(this, window.APP_ID);
@@ -38813,10 +38799,9 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38813
38799
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38814
38800
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
38815
38801
  this.isShowNavBar = true;
38816
- this.isShowHomeButton = true;
38817
38802
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, 0);
38818
38803
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, 0);
38819
- // this.#configApp();
38804
+ this.isShowHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' || ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both';
38820
38805
  }
38821
38806
  static getInstance() {
38822
38807
  if (!ZaloMiniProgramSDK.instance) {