zmp-sdk 2.16.5 → 2.17.0-rc.0

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.
@@ -35278,6 +35278,9 @@
35278
35278
  PICK_MEDIA: {
35279
35279
  name: 'action.pick.media',
35280
35280
  version_live: { iOS: 999 }
35281
+ },
35282
+ MP_CLOSE_LOADINGVIEW: {
35283
+ name: 'action.mp.close.loadingview'
35281
35284
  }
35282
35285
  };
35283
35286
  const RESPONSE_CODE = {
@@ -36740,7 +36743,7 @@
36740
36743
  }
36741
36744
  _ZJSBridgeProvider_bridge = new WeakMap();
36742
36745
 
36743
- var version = "2.16.5";
36746
+ var version = "2.17.0-rc.0";
36744
36747
 
36745
36748
  class Basics {
36746
36749
  /**
@@ -38180,7 +38183,7 @@
38180
38183
  return Promise.reject(error);
38181
38184
  }
38182
38185
  },
38183
- delay: this.isIOS ? 200 : 0
38186
+ delay: this.isIOS ? 400 : 0
38184
38187
  });
38185
38188
  });
38186
38189
  }
@@ -38242,6 +38245,23 @@
38242
38245
  });
38243
38246
  });
38244
38247
  }
38248
+ /**
38249
+ * Close loading view.
38250
+ *
38251
+ * @async
38252
+ * @function closeLoading
38253
+ * @category Window
38254
+ *
38255
+ */
38256
+ static closeLoading(when) {
38257
+ return __awaiter(this, void 0, void 0, function* () {
38258
+ yield this.callNative(ACTION.MP_CLOSE_LOADINGVIEW, {
38259
+ at: new Date().getTime(),
38260
+ when: when,
38261
+ url: location.href
38262
+ });
38263
+ });
38264
+ }
38245
38265
  }
38246
38266
 
38247
38267
  class Location {
@@ -38287,7 +38307,7 @@
38287
38307
  return Promise.reject(error);
38288
38308
  }
38289
38309
  },
38290
- delay: this.isIOS ? 200 : 0
38310
+ delay: this.isIOS ? 400 : 0
38291
38311
  });
38292
38312
  });
38293
38313
  }
@@ -38773,7 +38793,7 @@
38773
38793
  var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump, _ZaloMiniProgramSDKService_setNavigationBarRightButton, _ZaloMiniProgramSDKService_getActionsSupported;
38774
38794
  class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38775
38795
  constructor() {
38776
- var _a, _b, _c, _d, _e, _f, _g, _h;
38796
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
38777
38797
  super();
38778
38798
  _ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
38779
38799
  _ZaloMiniProgramSDKService_appId.set(this, APP_ID);
@@ -38885,6 +38905,7 @@
38885
38905
  this.connectWifi = Device.connectWifi;
38886
38906
  this.openMediaPicker = Zalo.openMediaPicker;
38887
38907
  this.openOutApp = Zalo.openOutApp;
38908
+ this.closeLoading = Window.closeLoading;
38888
38909
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, null);
38889
38910
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null);
38890
38911
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null);
@@ -38896,20 +38917,20 @@
38896
38917
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
38897
38918
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
38898
38919
  const currentUrl = new URL(location.href);
38899
- const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
38900
- __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
38920
+ const actionBarType = lodash.isString((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.headerColor) &&
38921
+ ((_j = (_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.headerColor) === null || _j === void 0 ? void 0 : _j.length) > 0
38901
38922
  ? SHOW_ACTION_BAR
38902
38923
  : HIDE_ACTION_BAR;
38903
- const leftButtonType = ((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.leftButton) === 'none' ||
38904
- ((_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.leftButton) === 'home'
38924
+ const leftButtonType = ((_l = (_k = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _k === void 0 ? void 0 : _k.app) === null || _l === void 0 ? void 0 : _l.leftButton) === 'none' ||
38925
+ ((_o = (_m = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _m === void 0 ? void 0 : _m.app) === null || _o === void 0 ? void 0 : _o.leftButton) === 'home'
38905
38926
  ? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
38906
38927
  : ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
38907
38928
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
38908
38929
  actionbarType: actionBarType,
38909
38930
  buttonType: leftButtonType,
38910
38931
  dataConfig: {
38911
- backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
38912
- textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
38932
+ backgroundColor: ((_q = (_p = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _p === void 0 ? void 0 : _p.app) === null || _q === void 0 ? void 0 : _q.headerColor) || '',
38933
+ textColor: ((_s = (_r = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _r === void 0 ? void 0 : _r.app) === null || _s === void 0 ? void 0 : _s.textColor) || '',
38913
38934
  viewInLeftType: leftButtonType,
38914
38935
  confirmToExit: 1
38915
38936
  },
@@ -39355,6 +39376,9 @@
39355
39376
  location.href = url;
39356
39377
  return Promise.resolve();
39357
39378
  };
39379
+ this.closeLoading = (when) => {
39380
+ return Promise.resolve();
39381
+ };
39358
39382
  }
39359
39383
  on(event, fn, context) {
39360
39384
  throw new Error('Method not implemented.');
@@ -40848,13 +40872,10 @@
40848
40872
  }
40849
40873
  createShortcut(object) {
40850
40874
  return __awaiter(this, void 0, void 0, function* () {
40875
+ const appInfo = yield getAppInfo(APP_ID, 0);
40851
40876
  const isIOS = checkPlatform().isIOS;
40852
- let iconURL = getMetaValue('og:image:url') || '';
40853
- iconURL = iconURL.replace(/^zbrowser?:/, '');
40854
- if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
40855
- iconURL = `https:${iconURL}`;
40856
- }
40857
- const title = document.title;
40877
+ const iconURL = appInfo.logoUrl || getMetaValue('og:image:url') || '';
40878
+ const title = appInfo.name || document.title;
40858
40879
  const searchParams = object.params
40859
40880
  ? new URLSearchParams(object.params)
40860
40881
  : new URLSearchParams();
@@ -41001,6 +41022,11 @@
41001
41022
  return zmpShareableInfo.shareableLink;
41002
41023
  });
41003
41024
  }
41025
+ closeLoading(object) {
41026
+ return __awaiter(this, void 0, void 0, function* () {
41027
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeLoading('user action');
41028
+ });
41029
+ }
41004
41030
  }
41005
41031
  _SDKCreator_sdkService = new WeakMap();
41006
41032
  __decorate([
@@ -41407,6 +41433,10 @@
41407
41433
  description: ''
41408
41434
  }))
41409
41435
  ], SDKCreator.prototype, "getShareableLink", null);
41436
+ __decorate([
41437
+ handleError,
41438
+ validate
41439
+ ], SDKCreator.prototype, "closeLoading", null);
41410
41440
  class ZaloMiniAppSDKCreator extends SDKCreator {
41411
41441
  getServiceInstance() {
41412
41442
  return ZaloMiniProgramSDKService.getInstance();
package/dist/index.es.js CHANGED
@@ -35275,6 +35275,9 @@ const ACTION = {
35275
35275
  PICK_MEDIA: {
35276
35276
  name: 'action.pick.media',
35277
35277
  version_live: { iOS: 999 }
35278
+ },
35279
+ MP_CLOSE_LOADINGVIEW: {
35280
+ name: 'action.mp.close.loadingview'
35278
35281
  }
35279
35282
  };
35280
35283
  const RESPONSE_CODE = {
@@ -36737,7 +36740,7 @@ class ZJSBridgeProvider {
36737
36740
  }
36738
36741
  _ZJSBridgeProvider_bridge = new WeakMap();
36739
36742
 
36740
- var version = "2.16.5";
36743
+ var version = "2.17.0-rc.0";
36741
36744
 
36742
36745
  class Basics {
36743
36746
  /**
@@ -38177,7 +38180,7 @@ class OpenApi {
38177
38180
  return Promise.reject(error);
38178
38181
  }
38179
38182
  },
38180
- delay: this.isIOS ? 200 : 0
38183
+ delay: this.isIOS ? 400 : 0
38181
38184
  });
38182
38185
  });
38183
38186
  }
@@ -38239,6 +38242,23 @@ class Window {
38239
38242
  });
38240
38243
  });
38241
38244
  }
38245
+ /**
38246
+ * Close loading view.
38247
+ *
38248
+ * @async
38249
+ * @function closeLoading
38250
+ * @category Window
38251
+ *
38252
+ */
38253
+ static closeLoading(when) {
38254
+ return __awaiter(this, void 0, void 0, function* () {
38255
+ yield this.callNative(ACTION.MP_CLOSE_LOADINGVIEW, {
38256
+ at: new Date().getTime(),
38257
+ when: when,
38258
+ url: location.href
38259
+ });
38260
+ });
38261
+ }
38242
38262
  }
38243
38263
 
38244
38264
  class Location {
@@ -38284,7 +38304,7 @@ class Location {
38284
38304
  return Promise.reject(error);
38285
38305
  }
38286
38306
  },
38287
- delay: this.isIOS ? 200 : 0
38307
+ delay: this.isIOS ? 400 : 0
38288
38308
  });
38289
38309
  });
38290
38310
  }
@@ -38770,7 +38790,7 @@ class Routing {
38770
38790
  var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump, _ZaloMiniProgramSDKService_setNavigationBarRightButton, _ZaloMiniProgramSDKService_getActionsSupported;
38771
38791
  class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38772
38792
  constructor() {
38773
- var _a, _b, _c, _d, _e, _f, _g, _h;
38793
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
38774
38794
  super();
38775
38795
  _ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
38776
38796
  _ZaloMiniProgramSDKService_appId.set(this, APP_ID);
@@ -38882,6 +38902,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38882
38902
  this.connectWifi = Device.connectWifi;
38883
38903
  this.openMediaPicker = Zalo.openMediaPicker;
38884
38904
  this.openOutApp = Zalo.openOutApp;
38905
+ this.closeLoading = Window.closeLoading;
38885
38906
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, null);
38886
38907
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null);
38887
38908
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null);
@@ -38893,20 +38914,20 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38893
38914
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
38894
38915
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
38895
38916
  const currentUrl = new URL(location.href);
38896
- const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
38897
- __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
38917
+ const actionBarType = lodash.isString((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.headerColor) &&
38918
+ ((_j = (_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.headerColor) === null || _j === void 0 ? void 0 : _j.length) > 0
38898
38919
  ? SHOW_ACTION_BAR
38899
38920
  : HIDE_ACTION_BAR;
38900
- const leftButtonType = ((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.leftButton) === 'none' ||
38901
- ((_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.leftButton) === 'home'
38921
+ const leftButtonType = ((_l = (_k = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _k === void 0 ? void 0 : _k.app) === null || _l === void 0 ? void 0 : _l.leftButton) === 'none' ||
38922
+ ((_o = (_m = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _m === void 0 ? void 0 : _m.app) === null || _o === void 0 ? void 0 : _o.leftButton) === 'home'
38902
38923
  ? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
38903
38924
  : ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
38904
38925
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
38905
38926
  actionbarType: actionBarType,
38906
38927
  buttonType: leftButtonType,
38907
38928
  dataConfig: {
38908
- backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
38909
- textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
38929
+ backgroundColor: ((_q = (_p = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _p === void 0 ? void 0 : _p.app) === null || _q === void 0 ? void 0 : _q.headerColor) || '',
38930
+ textColor: ((_s = (_r = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _r === void 0 ? void 0 : _r.app) === null || _s === void 0 ? void 0 : _s.textColor) || '',
38910
38931
  viewInLeftType: leftButtonType,
38911
38932
  confirmToExit: 1
38912
38933
  },
@@ -39352,6 +39373,9 @@ class MockSDKService {
39352
39373
  location.href = url;
39353
39374
  return Promise.resolve();
39354
39375
  };
39376
+ this.closeLoading = (when) => {
39377
+ return Promise.resolve();
39378
+ };
39355
39379
  }
39356
39380
  on(event, fn, context) {
39357
39381
  throw new Error('Method not implemented.');
@@ -40845,13 +40869,10 @@ class SDKCreator {
40845
40869
  }
40846
40870
  createShortcut(object) {
40847
40871
  return __awaiter(this, void 0, void 0, function* () {
40872
+ const appInfo = yield getAppInfo(APP_ID, 0);
40848
40873
  const isIOS = checkPlatform().isIOS;
40849
- let iconURL = getMetaValue('og:image:url') || '';
40850
- iconURL = iconURL.replace(/^zbrowser?:/, '');
40851
- if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
40852
- iconURL = `https:${iconURL}`;
40853
- }
40854
- const title = document.title;
40874
+ const iconURL = appInfo.logoUrl || getMetaValue('og:image:url') || '';
40875
+ const title = appInfo.name || document.title;
40855
40876
  const searchParams = object.params
40856
40877
  ? new URLSearchParams(object.params)
40857
40878
  : new URLSearchParams();
@@ -40998,6 +41019,11 @@ class SDKCreator {
40998
41019
  return zmpShareableInfo.shareableLink;
40999
41020
  });
41000
41021
  }
41022
+ closeLoading(object) {
41023
+ return __awaiter(this, void 0, void 0, function* () {
41024
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeLoading('user action');
41025
+ });
41026
+ }
41001
41027
  }
41002
41028
  _SDKCreator_sdkService = new WeakMap();
41003
41029
  __decorate([
@@ -41404,6 +41430,10 @@ __decorate([
41404
41430
  description: ''
41405
41431
  }))
41406
41432
  ], SDKCreator.prototype, "getShareableLink", null);
41433
+ __decorate([
41434
+ handleError,
41435
+ validate
41436
+ ], SDKCreator.prototype, "closeLoading", null);
41407
41437
  class ZaloMiniAppSDKCreator extends SDKCreator {
41408
41438
  getServiceInstance() {
41409
41439
  return ZaloMiniProgramSDKService.getInstance();