zmp-sdk 2.16.1 → 2.16.4

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.
@@ -34930,12 +34930,39 @@
34930
34930
  return ck;
34931
34931
  };
34932
34932
 
34933
+ const Byte = 1;
34934
+ const KB = 1024 * Byte;
34935
+ const MB = 1024 * KB;
34933
34936
  const ZAPP_ID = window.zAppID;
34934
34937
  const APP_ID = window.APP_ID;
34935
34938
  const APP_CONFIG = window.APP_CONFIG || {};
34939
+ const MINI_APP_LINK = 'https://zalo.me/app/link/zapps';
34940
+ const MINI_APP_INTERNAL_LINK = 'https://h5.zdn.vn/zapps';
34941
+ const COOKIE_NAME = {
34942
+ ZOAUTH: `h5.zdn.vn_zoauth`,
34943
+ ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
34944
+ JS_TOKEN: `h5.zdn.vn_zlink3rd`,
34945
+ ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`
34946
+ };
34947
+ const APIS = {
34948
+ GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
34949
+ GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
34950
+ GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token'
34951
+ };
34952
+ const STORAGE_LIMIT = 5 * MB;
34953
+ const NETWORK_TYPE = (isAndroid) => ({
34954
+ NONE: isAndroid ? -2 : 0,
34955
+ WIFI: isAndroid ? 0 : 1,
34956
+ '2G': isAndroid ? 2 : 2,
34957
+ '3G': isAndroid ? 15 : 2,
34958
+ '4G': isAndroid ? 13 : 2
34959
+ });
34960
+ const MEDIA_PICKER_LIMIT = 1 * MB;
34961
+ const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
34936
34962
  const ACTION = {
34937
34963
  GET_DOWNLOADED_STICKER: {
34938
- name: 'action.get.downloaded.sticker'
34964
+ name: 'action.get.downloaded.sticker',
34965
+ have_callback: true
34939
34966
  },
34940
34967
  OPEN_SHARE_STICKER: {
34941
34968
  name: 'action.open.share.sticker'
@@ -35025,19 +35052,23 @@
35025
35052
  name: 'action.open.sendsticker'
35026
35053
  },
35027
35054
  REPORT_ABUSE: {
35028
- name: 'action.report.abuse'
35055
+ name: 'action.report.abuse',
35056
+ have_callback: true
35029
35057
  },
35030
35058
  FOLLOW_OA: {
35031
- name: 'action.follow.oa'
35059
+ name: 'action.follow.oa',
35060
+ have_callback: true
35032
35061
  },
35033
35062
  UNFOLLOW_OA: {
35034
- name: 'action.unfollow.oa'
35063
+ name: 'action.unfollow.oa',
35064
+ have_callback: true
35035
35065
  },
35036
35066
  OPEN_GAMEDETAIL: {
35037
35067
  name: 'action.open.gamedetail'
35038
35068
  },
35039
35069
  OPEN_SHARESHEET: {
35040
- name: 'action.open.sharesheet'
35070
+ name: 'action.open.sharesheet',
35071
+ have_callback: true
35041
35072
  },
35042
35073
  REQUEST_PERMISSION_CAMERA: {
35043
35074
  name: 'action.request.permission.camera'
@@ -35064,18 +35095,21 @@
35064
35095
  },
35065
35096
  CREATE_OPTIONS_MENU: {
35066
35097
  name: 'action.create.options.menu',
35067
- skip_jump: true
35098
+ skip_jump: true,
35099
+ have_callback: true
35068
35100
  },
35069
35101
  CREATE_SHORTCUT: {
35070
35102
  name: 'action.create.shortcut'
35071
35103
  },
35072
35104
  CHANGE_ACTIONBAR_LEFTBUTTON_TYPE: {
35073
35105
  name: 'action.change.actionbar.leftbutton.type',
35074
- skip_jump: true
35106
+ skip_jump: true,
35107
+ have_callback: true
35075
35108
  },
35076
35109
  WINDOW_CLOSE: {
35077
35110
  name: 'action.window.close',
35078
- skip_jump: true
35111
+ skip_jump: true,
35112
+ have_callback: true
35079
35113
  },
35080
35114
  WEBVIEW_CHECKRESERROR: {
35081
35115
  name: 'action.webview.checkResError'
@@ -35088,7 +35122,8 @@
35088
35122
  },
35089
35123
  ZBROWSER_JSBRIDGE: {
35090
35124
  name: 'action.zbrowser.jsbridge',
35091
- skip_jump: true
35125
+ skip_jump: true,
35126
+ have_callback: true
35092
35127
  },
35093
35128
  PROMPT_AUTHENTICATION: {
35094
35129
  name: 'action.prompt.authentication'
@@ -35104,13 +35139,16 @@
35104
35139
  name: 'action.open.appstore'
35105
35140
  },
35106
35141
  GET_LOCATION: {
35107
- name: 'action.get.location'
35142
+ name: 'action.get.location',
35143
+ have_callback: true
35108
35144
  },
35109
35145
  QUERY_LOCATION_HIDE: {
35110
- name: 'action.query.location.hide'
35146
+ name: 'action.query.location.hide',
35147
+ have_callback: true
35111
35148
  },
35112
35149
  SHOW_TOAST: {
35113
- name: 'action.show.toast'
35150
+ name: 'action.show.toast',
35151
+ have_callback: true
35114
35152
  },
35115
35153
  OPEN_APP: {
35116
35154
  name: 'action.open.app'
@@ -35128,10 +35166,12 @@
35128
35166
  name: 'action.open.sms'
35129
35167
  },
35130
35168
  VIEW_MYQR: {
35131
- name: 'action.view.myqr'
35169
+ name: 'action.view.myqr',
35170
+ have_callback: true
35132
35171
  },
35133
35172
  KEEP_SCREEN: {
35134
- name: 'action.keep.screen'
35173
+ name: 'action.keep.screen',
35174
+ have_callback: true
35135
35175
  },
35136
35176
  CHANGE_AUTOROTATE: {
35137
35177
  name: 'action.change.autorotate',
@@ -35150,25 +35190,31 @@
35150
35190
  name: 'action.open.inapprw'
35151
35191
  },
35152
35192
  ZALORUN_GETTRACKINGSTATUS: {
35153
- name: 'action.zalorun.getTrackingStatus'
35193
+ name: 'action.zalorun.getTrackingStatus',
35194
+ have_callback: true
35154
35195
  },
35155
35196
  ZALORUN_SETTRACKINGSTATUS: {
35156
- name: 'action.zalorun.setTrackingStatus'
35197
+ name: 'action.zalorun.setTrackingStatus',
35198
+ have_callback: true
35157
35199
  },
35158
35200
  ZALORUN_GETDAYSTEP: {
35159
- name: 'action.zalorun.getDayStep'
35201
+ name: 'action.zalorun.getDayStep',
35202
+ have_callback: true
35160
35203
  },
35161
35204
  ZALORUN_FORCESUBMITDATA: {
35162
- name: 'action.zalorun.forceSubmitData'
35205
+ name: 'action.zalorun.forceSubmitData',
35206
+ have_callback: true
35163
35207
  },
35164
35208
  ZALORUN_SETWEIGHT: {
35165
- name: 'action.zalorun.setWeight'
35209
+ name: 'action.zalorun.setWeight',
35210
+ have_callback: true
35166
35211
  },
35167
35212
  OPEN_PROFILE_EXT: {
35168
35213
  name: 'action.open.profile.ext'
35169
35214
  },
35170
35215
  DOWNLOAD_CATE: {
35171
- name: 'action.download.cate'
35216
+ name: 'action.download.cate',
35217
+ have_callback: true
35172
35218
  },
35173
35219
  JUMP_LOGIN: {
35174
35220
  name: 'action.jump.login',
@@ -35234,28 +35280,6 @@
35234
35280
  version_live: { iOS: 999 }
35235
35281
  }
35236
35282
  };
35237
- const ACTION_HAVE_CALLBACK = [
35238
- ACTION.GET_DOWNLOADED_STICKER.name,
35239
- ACTION.REPORT_ABUSE.name,
35240
- ACTION.FOLLOW_OA.name,
35241
- ACTION.UNFOLLOW_OA.name,
35242
- ACTION.OPEN_SHARESHEET.name,
35243
- ACTION.CREATE_OPTIONS_MENU.name,
35244
- ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,
35245
- ACTION.WINDOW_CLOSE.name,
35246
- ACTION.ZBROWSER_JSBRIDGE.name,
35247
- ACTION.GET_LOCATION.name,
35248
- ACTION.QUERY_LOCATION_HIDE.name,
35249
- ACTION.SHOW_TOAST.name,
35250
- ACTION.VIEW_MYQR.name,
35251
- ACTION.KEEP_SCREEN.name,
35252
- ACTION.ZALORUN_GETTRACKINGSTATUS.name,
35253
- ACTION.ZALORUN_SETTRACKINGSTATUS.name,
35254
- ACTION.ZALORUN_GETDAYSTEP.name,
35255
- ACTION.ZALORUN_FORCESUBMITDATA.name,
35256
- ACTION.ZALORUN_SETWEIGHT.name,
35257
- ACTION.DOWNLOAD_CATE.name
35258
- ];
35259
35283
  const RESPONSE_CODE = {
35260
35284
  BAD_REQUEST: -1400,
35261
35285
  INTERNAL_SERVER_ERROR: -1500,
@@ -35511,6 +35535,96 @@
35511
35535
  }
35512
35536
  };
35513
35537
 
35538
+ function encode(bag) {
35539
+ var pairs = [];
35540
+ for (var key in bag) {
35541
+ if (bag.hasOwnProperty(key)) {
35542
+ var value = bag[key];
35543
+ if (typeof value === "undefined") {
35544
+ return;
35545
+ }
35546
+ if (value === null) {
35547
+ pairs.push(key);
35548
+ return;
35549
+ }
35550
+ pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
35551
+ }
35552
+ }
35553
+ return pairs.join("&");
35554
+ }
35555
+ function decode(str, strict) {
35556
+ var data = {};
35557
+ if (str === "") {
35558
+ return data;
35559
+ }
35560
+ var pairs = str.split("&");
35561
+ for (var i = 0; i < pairs.length; i++) {
35562
+ var pair = pairs[i].split("=", 2);
35563
+ var key = decodeURIComponent(pair[0]);
35564
+ if (strict && Object.prototype.hasOwnProperty.call(data, key)) {
35565
+ throw new URIError("Duplicate key: " + key);
35566
+ }
35567
+ data[key] = pair.length === 2 ? decodeURIComponent(pair[1]) : null;
35568
+ }
35569
+ return data;
35570
+ }
35571
+ function appendToUrl(url, params) {
35572
+ return (url +
35573
+ (url.indexOf("?") !== -1 ? "&" : "?") +
35574
+ (typeof params === "string" ? params : QueryString.encode(params)));
35575
+ }
35576
+ function getParameterByName(name, url) {
35577
+ if (!url) {
35578
+ url = window.location.href;
35579
+ }
35580
+ name = name.replace(/[\[\]]/g, "\\$&");
35581
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
35582
+ if (!results)
35583
+ return null;
35584
+ if (!results[2])
35585
+ return "";
35586
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
35587
+ }
35588
+ function getParamsAsObject(query) {
35589
+ var params = {};
35590
+ if (!query)
35591
+ return params;
35592
+ var values = query.split("&");
35593
+ values.map(function (item) {
35594
+ var data = item.split("=");
35595
+ if (!data || data.length != 2)
35596
+ return;
35597
+ params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
35598
+ });
35599
+ return params;
35600
+ }
35601
+ function toQueryString(data) {
35602
+ if (!data)
35603
+ return "";
35604
+ if ((typeof data === "undefined" ? "undefined" : typeof (data)) != "object")
35605
+ return data;
35606
+ var key = Object.keys(data);
35607
+ var params = [];
35608
+ key.map(function (k) {
35609
+ var v = data[k];
35610
+ if ((typeof v === "undefined" ? "undefined" : typeof (v)) == "object")
35611
+ v = JSON.stringify(v);
35612
+ else
35613
+ v = encodeURIComponent(v);
35614
+ var item = [k, v].join("=");
35615
+ params.push(item);
35616
+ });
35617
+ return params.join("&");
35618
+ }
35619
+ const QueryString = {
35620
+ encode: encode,
35621
+ decode: decode,
35622
+ appendToUrl: appendToUrl,
35623
+ getParameterByName: getParameterByName,
35624
+ getParamsAsObject: getParamsAsObject,
35625
+ toQueryString: toQueryString,
35626
+ };
35627
+
35514
35628
  const REGEXP_SPECIAL_UNICODE = new RegExp('[\\u0300-\\u036f]', 'g');
35515
35629
  const REGEXP_ACCENT_D = new RegExp('[đ|Đ]', 'g');
35516
35630
  const REGEXP_SPACES = new RegExp('\\s', 'g');
@@ -35731,13 +35845,12 @@
35731
35845
  }
35732
35846
  };
35733
35847
  const checkIOSSupportAction = (action) => {
35734
- var _a, _b;
35735
- const key = action.slice(7, action.length).replace(/\./gi, '_').toUpperCase();
35848
+ var _a;
35736
35849
  const zaloIOSVersion = getZaloVersion();
35737
- const actionVersionLive = ((_b = (_a = ACTION[key]) === null || _a === void 0 ? void 0 : _a.version_live) === null || _b === void 0 ? void 0 : _b.iOS) || 0;
35850
+ const actionVersionLive = ((_a = action === null || action === void 0 ? void 0 : action.version_live) === null || _a === void 0 ? void 0 : _a.iOS) || 0;
35738
35851
  if (Array.isArray(window.ignoreCheckSupport) &&
35739
35852
  window.ignoreCheckSupport.length > 0 &&
35740
- window.ignoreCheckSupport.includes(action)) {
35853
+ window.ignoreCheckSupport.includes(action.name)) {
35741
35854
  return true;
35742
35855
  }
35743
35856
  return zaloIOSVersion >= actionVersionLive;
@@ -35819,7 +35932,36 @@
35819
35932
  return {
35820
35933
  error: false
35821
35934
  };
35822
- };
35935
+ };
35936
+ const getAppInfo = (appId, versionStatus, currentVersion) => __awaiter(void 0, void 0, void 0, function* () {
35937
+ const inputData = {
35938
+ appId,
35939
+ versionStatus
35940
+ };
35941
+ if (!lodash.isUndefined(currentVersion)) {
35942
+ inputData.currentVersion = currentVersion;
35943
+ }
35944
+ const api = QueryString.appendToUrl(`${API_DOMAIN}${H5_API.GET_APP_INFO}`, inputData);
35945
+ const msgApi = yield fetch(api, {
35946
+ credentials: 'include'
35947
+ });
35948
+ if (msgApi.ok) {
35949
+ const appInfo = yield msgApi.json();
35950
+ if (appInfo.err < 0 || !appInfo.data) {
35951
+ throw new Error(appInfo);
35952
+ }
35953
+ const info = {
35954
+ name: appInfo.data.name,
35955
+ version: appInfo.data.version,
35956
+ description: appInfo.data.description,
35957
+ appUrl: appInfo.data.appUrl,
35958
+ qrCodeUrl: appInfo.data.qrCodeUrl,
35959
+ logoUrl: appInfo.data.logoUrl
35960
+ };
35961
+ return info;
35962
+ }
35963
+ throw new Error("Can't get app info");
35964
+ });
35823
35965
 
35824
35966
  var eventemitter3 = createCommonjsModule(function (module) {
35825
35967
 
@@ -36191,129 +36333,6 @@
36191
36333
  }
36192
36334
  }
36193
36335
 
36194
- var CONFIG = (() => {
36195
- const Byte = 1;
36196
- const KB = 1024 * Byte;
36197
- const MB = 1024 * KB;
36198
- const device = checkPlatform();
36199
- return {
36200
- MINI_APP_LINK: 'https://zalo.me/app/link/zapps',
36201
- MINI_APP_INTERNAL_LINK: 'https://h5.zdn.vn/zapps',
36202
- COOKIE_NAME: {
36203
- ZOAUTH: `h5.zdn.vn_zoauth`,
36204
- ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
36205
- JS_TOKEN: `h5.zdn.vn_zlink3rd`,
36206
- ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`
36207
- },
36208
- APIS: {
36209
- GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
36210
- GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
36211
- GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token'
36212
- },
36213
- STORAGE_DATA_LIMIT: 100 * KB,
36214
- STORAGE_LIMIT: 5 * MB,
36215
- NETWORK_TYPE: {
36216
- NONE: device.isAndroid ? -2 : 0,
36217
- WIFI: device.isAndroid ? 0 : 1,
36218
- '2G': device.isAndroid ? 2 : 2,
36219
- '3G': device.isAndroid ? 15 : 2,
36220
- '4G': device.isAndroid ? 13 : 2
36221
- },
36222
- MEDIA_PICKER_LIMIT: 1 * MB,
36223
- MEDIA_PICKER_UPLOAD_SERVER: 'https://zapi-server.tungnt.xyz/upload/photos'
36224
- };
36225
- })();
36226
-
36227
- function encode(bag) {
36228
- var pairs = [];
36229
- for (var key in bag) {
36230
- if (bag.hasOwnProperty(key)) {
36231
- var value = bag[key];
36232
- if (typeof value === "undefined") {
36233
- return;
36234
- }
36235
- if (value === null) {
36236
- pairs.push(key);
36237
- return;
36238
- }
36239
- pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
36240
- }
36241
- }
36242
- return pairs.join("&");
36243
- }
36244
- function decode(str, strict) {
36245
- var data = {};
36246
- if (str === "") {
36247
- return data;
36248
- }
36249
- var pairs = str.split("&");
36250
- for (var i = 0; i < pairs.length; i++) {
36251
- var pair = pairs[i].split("=", 2);
36252
- var key = decodeURIComponent(pair[0]);
36253
- if (strict && Object.prototype.hasOwnProperty.call(data, key)) {
36254
- throw new URIError("Duplicate key: " + key);
36255
- }
36256
- data[key] = pair.length === 2 ? decodeURIComponent(pair[1]) : null;
36257
- }
36258
- return data;
36259
- }
36260
- function appendToUrl(url, params) {
36261
- return (url +
36262
- (url.indexOf("?") !== -1 ? "&" : "?") +
36263
- (typeof params === "string" ? params : QueryString.encode(params)));
36264
- }
36265
- function getParameterByName(name, url) {
36266
- if (!url) {
36267
- url = window.location.href;
36268
- }
36269
- name = name.replace(/[\[\]]/g, "\\$&");
36270
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
36271
- if (!results)
36272
- return null;
36273
- if (!results[2])
36274
- return "";
36275
- return decodeURIComponent(results[2].replace(/\+/g, " "));
36276
- }
36277
- function getParamsAsObject(query) {
36278
- var params = {};
36279
- if (!query)
36280
- return params;
36281
- var values = query.split("&");
36282
- values.map(function (item) {
36283
- var data = item.split("=");
36284
- if (!data || data.length != 2)
36285
- return;
36286
- params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
36287
- });
36288
- return params;
36289
- }
36290
- function toQueryString(data) {
36291
- if (!data)
36292
- return "";
36293
- if ((typeof data === "undefined" ? "undefined" : typeof (data)) != "object")
36294
- return data;
36295
- var key = Object.keys(data);
36296
- var params = [];
36297
- key.map(function (k) {
36298
- var v = data[k];
36299
- if ((typeof v === "undefined" ? "undefined" : typeof (v)) == "object")
36300
- v = JSON.stringify(v);
36301
- else
36302
- v = encodeURIComponent(v);
36303
- var item = [k, v].join("=");
36304
- params.push(item);
36305
- });
36306
- return params.join("&");
36307
- }
36308
- const QueryString = {
36309
- encode: encode,
36310
- decode: decode,
36311
- appendToUrl: appendToUrl,
36312
- getParameterByName: getParameterByName,
36313
- getParamsAsObject: getParamsAsObject,
36314
- toQueryString: toQueryString,
36315
- };
36316
-
36317
36336
  var wrappers = {};
36318
36337
  var WrapperFn = function wrapFunction(fn, type, source) {
36319
36338
  var t = type || 'default';
@@ -36575,8 +36594,9 @@
36575
36594
  }
36576
36595
  jsCall(action, options, callback, isMultiCallback = false, nRetry = 3, haveTimeout = true) {
36577
36596
  try {
36578
- const key = generateUniqueString(action);
36579
- if (!this._device.isMobile || lodash.isEmpty(action)) {
36597
+ const actionName = action.name;
36598
+ const key = generateUniqueString(actionName);
36599
+ if (!this._device.isMobile || lodash.isEmpty(actionName)) {
36580
36600
  this.onJSCall(key, {
36581
36601
  error_code: -13,
36582
36602
  error_message: 'params invalid!',
@@ -36585,7 +36605,7 @@
36585
36605
  jsToken: this._jsAccessTk,
36586
36606
  access_token: this._accessTk
36587
36607
  },
36588
- action: action
36608
+ action: actionName
36589
36609
  });
36590
36610
  return false;
36591
36611
  }
@@ -36599,11 +36619,11 @@
36599
36619
  error_code: -14,
36600
36620
  error_message: 'Request Timeout!',
36601
36621
  data: {},
36602
- action: action
36622
+ action: actionName
36603
36623
  };
36604
36624
  this._jsCallFuncCallbacks[key] = {
36605
36625
  timeout: haveTimeout &&
36606
- ACTION_HAVE_CALLBACK.includes(action) &&
36626
+ action.have_callback &&
36607
36627
  setTimeout(() => {
36608
36628
  this.onJSCall(key, timeoutCallback);
36609
36629
  }, 8000),
@@ -36613,14 +36633,14 @@
36613
36633
  options = serialize(options);
36614
36634
  if (isMultiCallback) {
36615
36635
  if (this._device.isIOS) {
36616
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, window.onMultiJSCall(key));
36636
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, window.onMultiJSCall(key));
36617
36637
  }
36618
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, `window.onMultiJSCall('${key}')`);
36638
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, `window.onMultiJSCall('${key}')`);
36619
36639
  }
36620
36640
  if (this._device.isIOS) {
36621
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, window.onJSCall(key));
36641
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, window.onJSCall(key));
36622
36642
  }
36623
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, `window.onJSCall('${key}')`);
36643
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, `window.onJSCall('${key}')`);
36624
36644
  }
36625
36645
  catch (error) {
36626
36646
  if (nRetry-- > 0) {
@@ -36638,7 +36658,7 @@
36638
36658
  jsToken: this._jsAccessTk,
36639
36659
  access_token: this._accessTk
36640
36660
  },
36641
- action: action,
36661
+ action: actionName,
36642
36662
  js_error: error
36643
36663
  };
36644
36664
  this.onJSCall(key, errorCallback);
@@ -36669,7 +36689,7 @@
36669
36689
  __classPrivateFieldGet(this, _ZJSBridgeProvider_bridge).jsAccessTk = value;
36670
36690
  }
36671
36691
  callNative(action, data, option) {
36672
- this.debug(action, data);
36692
+ this.debug(action.name, data);
36673
36693
  return new Promise((resolve, reject) => {
36674
36694
  const fn = (cb) => __awaiter(this, void 0, void 0, function* () {
36675
36695
  try {
@@ -36685,7 +36705,7 @@
36685
36705
  else if (cb && cb.error_code < 0) {
36686
36706
  try {
36687
36707
  window.zmpSentry &&
36688
- window.zmpSentry.captureMessage(`${action}: call native fail`, {
36708
+ window.zmpSentry.captureMessage(`${action.name}: call native fail`, {
36689
36709
  extra: {
36690
36710
  data: data,
36691
36711
  rs: cb
@@ -36707,6 +36727,11 @@
36707
36727
  const error = new NativeError(-5, `${action}: Client isn't support this action`);
36708
36728
  return reject(error);
36709
36729
  }
36730
+ else if (option === null || option === void 0 ? void 0 : option.delay) {
36731
+ setTimeout(() => {
36732
+ __classPrivateFieldGet(this, _ZJSBridgeProvider_bridge).jsCall(action, data, fn, option === null || option === void 0 ? void 0 : option.isMultiCallback, option === null || option === void 0 ? void 0 : option.nRetry, option === null || option === void 0 ? void 0 : option.haveTimeout);
36733
+ }, option.delay);
36734
+ }
36710
36735
  else {
36711
36736
  __classPrivateFieldGet(this, _ZJSBridgeProvider_bridge).jsCall(action, data, fn, option === null || option === void 0 ? void 0 : option.isMultiCallback, option === null || option === void 0 ? void 0 : option.nRetry, option === null || option === void 0 ? void 0 : option.haveTimeout);
36712
36737
  }
@@ -36715,7 +36740,7 @@
36715
36740
  }
36716
36741
  _ZJSBridgeProvider_bridge = new WeakMap();
36717
36742
 
36718
- var version = "2.16.1";
36743
+ var version = "2.16.4";
36719
36744
 
36720
36745
  class Basics {
36721
36746
  /**
@@ -36757,31 +36782,9 @@
36757
36782
  */
36758
36783
  static getAppInfo() {
36759
36784
  return __awaiter(this, void 0, void 0, function* () {
36760
- let info = {};
36761
36785
  const appId = this.getAppId();
36762
36786
  const systemInfo = this.getSystemInfo();
36763
- const api = QueryString.appendToUrl(`${API_DOMAIN}${H5_API.GET_APP_INFO}`, {
36764
- appId,
36765
- versionStatus: 0,
36766
- currentVersion: systemInfo.version
36767
- });
36768
- const msgApi = yield fetch(api, {
36769
- credentials: 'include'
36770
- });
36771
- if (msgApi.ok) {
36772
- const appInfo = yield msgApi.json();
36773
- if (appInfo.err < 0 || !appInfo.data) {
36774
- throw new Error(appInfo);
36775
- }
36776
- info = {
36777
- name: appInfo.data.name,
36778
- version: appInfo.data.version,
36779
- description: appInfo.data.description,
36780
- appUrl: appInfo.data.appUrl,
36781
- qrCodeUrl: appInfo.data.qrCodeUrl
36782
- };
36783
- }
36784
- return info;
36787
+ return yield getAppInfo(appId, 0, systemInfo.version);
36785
36788
  });
36786
36789
  }
36787
36790
  }
@@ -36820,7 +36823,7 @@
36820
36823
  */
36821
36824
  static setNavigationBarTitle(object) {
36822
36825
  return __awaiter(this, void 0, void 0, function* () {
36823
- yield this.callNative(ACTION.CHANGE_TITLE_HEADER.name, {
36826
+ yield this.callNative(ACTION.CHANGE_TITLE_HEADER, {
36824
36827
  title: object.title
36825
36828
  }, {
36826
36829
  haveTimeout: false
@@ -36868,7 +36871,7 @@
36868
36871
  actionBarType = HIDE_ACTION_BAR;
36869
36872
  }
36870
36873
  this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { actionbarType: actionBarType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), dataConfig) })));
36871
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, Object.assign({}, this.getActionBarConfig()), {
36874
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, Object.assign({}, this.getActionBarConfig()), {
36872
36875
  haveTimeout: false
36873
36876
  });
36874
36877
  });
@@ -36912,7 +36915,7 @@
36912
36915
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
36913
36916
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
36914
36917
  this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { buttonType: leftButtonType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), { viewInLeftType: leftButtonType }), homeConfig: Object.assign(Object.assign({}, state.homeConfig), { enable: showHomeButton }) })));
36915
- yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name, Object.assign({}, this.getActionBarConfig()), {
36918
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
36916
36919
  haveTimeout: false
36917
36920
  });
36918
36921
  });
@@ -36954,7 +36957,7 @@
36954
36957
  */
36955
36958
  static setNavigationBarRightButton(object) {
36956
36959
  return __awaiter(this, void 0, void 0, function* () {
36957
- yield this.callNative(ACTION.CREATE_OPTIONS_MENU.name, {
36960
+ yield this.callNative(ACTION.CREATE_OPTIONS_MENU, {
36958
36961
  supportToolBar: object.supportToolBar,
36959
36962
  reset: object.reset,
36960
36963
  menuListItems: object.menuListItems,
@@ -36990,7 +36993,7 @@
36990
36993
  return __awaiter(this, void 0, void 0, function* () {
36991
36994
  if (lodash.isString(object.backgroundColor) &&
36992
36995
  object.backgroundColor.length > 0) {
36993
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, {
36996
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
36994
36997
  actionbarType: this.isShowNavBar ? 5 : 6,
36995
36998
  dataConfig: {
36996
36999
  backgroundColor: object.backgroundColor,
@@ -37102,7 +37105,7 @@
37102
37105
  */
37103
37106
  static setDeviceOrientation(object) {
37104
37107
  return __awaiter(this, void 0, void 0, function* () {
37105
- yield this.callNative(ACTION.CHANGE_AUTOROTATE.name, {
37108
+ yield this.callNative(ACTION.CHANGE_AUTOROTATE, {
37106
37109
  autoRotate: OrientationType[object.rotate]
37107
37110
  });
37108
37111
  });
@@ -37126,26 +37129,27 @@
37126
37129
  */
37127
37130
  static getNetworkType(object) {
37128
37131
  return __awaiter(this, void 0, void 0, function* () {
37129
- const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE.name, {
37132
+ const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE, {
37130
37133
  url: window.location.href,
37131
37134
  featureId: ''
37132
37135
  }).then((data) => {
37133
37136
  const network = data.network;
37134
37137
  let networkType;
37138
+ const isAndroid = checkPlatform().isAndroid;
37135
37139
  switch (network) {
37136
- case CONFIG.NETWORK_TYPE.NONE:
37140
+ case NETWORK_TYPE(isAndroid).NONE:
37137
37141
  networkType = NetworkType.none;
37138
37142
  break;
37139
- case CONFIG.NETWORK_TYPE.WIFI:
37143
+ case NETWORK_TYPE(isAndroid).WIFI:
37140
37144
  networkType = NetworkType.wifi;
37141
37145
  break;
37142
- case CONFIG.NETWORK_TYPE['2G']:
37146
+ case NETWORK_TYPE(isAndroid)['2G']:
37143
37147
  networkType = NetworkType.cellular;
37144
37148
  break;
37145
- case CONFIG.NETWORK_TYPE['3G']:
37149
+ case NETWORK_TYPE(isAndroid)['3G']:
37146
37150
  networkType = NetworkType.cellular;
37147
37151
  break;
37148
- case CONFIG.NETWORK_TYPE['4G']:
37152
+ case NETWORK_TYPE(isAndroid)['4G']:
37149
37153
  networkType = NetworkType.cellular;
37150
37154
  break;
37151
37155
  default:
@@ -37239,7 +37243,7 @@
37239
37243
  items: Array.isArray(object === null || object === void 0 ? void 0 : object.items) ? object === null || object === void 0 ? void 0 : object.items : []
37240
37244
  }
37241
37245
  };
37242
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37246
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37243
37247
  return true;
37244
37248
  });
37245
37249
  }
@@ -37258,7 +37262,7 @@
37258
37262
  const data = {
37259
37263
  subaction: 2
37260
37264
  };
37261
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37265
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37262
37266
  return true;
37263
37267
  });
37264
37268
  }
@@ -37279,7 +37283,7 @@
37279
37283
  const data = {
37280
37284
  subaction: 1
37281
37285
  };
37282
- const resData = yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data), {
37286
+ const resData = yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data), {
37283
37287
  isMultiCallback: true
37284
37288
  }).then((resData) => {
37285
37289
  const res = {
@@ -37321,7 +37325,9 @@
37321
37325
  */
37322
37326
  static stopBluetoothDevicesDiscovery() {
37323
37327
  return __awaiter(this, void 0, void 0, function* () {
37324
- return this.callNative('', {});
37328
+ return this.callNative({
37329
+ name: ''
37330
+ }, {});
37325
37331
  });
37326
37332
  }
37327
37333
  /**
@@ -37346,7 +37352,9 @@
37346
37352
  */
37347
37353
  static startBluetoothDevicesDiscovery(object) {
37348
37354
  return __awaiter(this, void 0, void 0, function* () {
37349
- return this.callNative('', Object.assign({}, object));
37355
+ return this.callNative({
37356
+ name: ''
37357
+ }, Object.assign({}, object));
37350
37358
  });
37351
37359
  }
37352
37360
  /**
@@ -37368,7 +37376,9 @@
37368
37376
  */
37369
37377
  static openBluetoothAdapter() {
37370
37378
  return __awaiter(this, void 0, void 0, function* () {
37371
- return this.callNative('', {});
37379
+ return this.callNative({
37380
+ name: ''
37381
+ }, {});
37372
37382
  });
37373
37383
  }
37374
37384
  /**
@@ -37386,7 +37396,9 @@
37386
37396
  */
37387
37397
  static onBluetoothDeviceFound() {
37388
37398
  return __awaiter(this, void 0, void 0, function* () {
37389
- return this.callNative('', {});
37399
+ return this.callNative({
37400
+ name: ''
37401
+ }, {});
37390
37402
  });
37391
37403
  }
37392
37404
  /**
@@ -37432,7 +37444,9 @@
37432
37444
  const data = {
37433
37445
  services: object.services || []
37434
37446
  };
37435
- return this.callNative('', data);
37447
+ return this.callNative({
37448
+ name: ''
37449
+ }, data);
37436
37450
  });
37437
37451
  }
37438
37452
  /**
@@ -37451,7 +37465,9 @@
37451
37465
  */
37452
37466
  static getBluetoothDevices() {
37453
37467
  return __awaiter(this, void 0, void 0, function* () {
37454
- return this.callNative('', {});
37468
+ return this.callNative({
37469
+ name: ''
37470
+ }, {});
37455
37471
  });
37456
37472
  }
37457
37473
  /**
@@ -37470,7 +37486,9 @@
37470
37486
  */
37471
37487
  static getBluetoothAdapterState() {
37472
37488
  return __awaiter(this, void 0, void 0, function* () {
37473
- return this.callNative('', {});
37489
+ return this.callNative({
37490
+ name: ''
37491
+ }, {});
37474
37492
  });
37475
37493
  }
37476
37494
  /**
@@ -37489,7 +37507,9 @@
37489
37507
  */
37490
37508
  static closeBluetoothAdapter() {
37491
37509
  return __awaiter(this, void 0, void 0, function* () {
37492
- return this.callNative('', {});
37510
+ return this.callNative({
37511
+ name: ''
37512
+ }, {});
37493
37513
  });
37494
37514
  }
37495
37515
  /**
@@ -37501,7 +37521,7 @@
37501
37521
  */
37502
37522
  static scanQRCode(object) {
37503
37523
  return __awaiter(this, void 0, void 0, function* () {
37504
- return yield this.callNative(ACTION.OPEN_QR.name, {
37524
+ return yield this.callNative(ACTION.OPEN_QR, {
37505
37525
  skipOpenLink: true
37506
37526
  });
37507
37527
  });
@@ -37515,7 +37535,7 @@
37515
37535
  */
37516
37536
  static showToast(object) {
37517
37537
  return __awaiter(this, void 0, void 0, function* () {
37518
- yield this.callNative(ACTION.SHOW_TOAST.name, {
37538
+ yield this.callNative(ACTION.SHOW_TOAST, {
37519
37539
  toast: object.message
37520
37540
  });
37521
37541
  });
@@ -37529,7 +37549,7 @@
37529
37549
  */
37530
37550
  static hideKeyboard(object) {
37531
37551
  return __awaiter(this, void 0, void 0, function* () {
37532
- yield this.callNative(ACTION.HIDE_KEYBOARD.name, {});
37552
+ yield this.callNative(ACTION.HIDE_KEYBOARD, {});
37533
37553
  });
37534
37554
  }
37535
37555
  /**
@@ -37541,7 +37561,7 @@
37541
37561
  */
37542
37562
  static openPhone(object) {
37543
37563
  return __awaiter(this, void 0, void 0, function* () {
37544
- yield this.callNative(ACTION.OPEN_PHONE.name, {
37564
+ yield this.callNative(ACTION.OPEN_PHONE, {
37545
37565
  phoneNum: object.phoneNumber,
37546
37566
  phoneCode: object.phoneNumber
37547
37567
  });
@@ -37556,7 +37576,7 @@
37556
37576
  */
37557
37577
  static openSMS(object) {
37558
37578
  return __awaiter(this, void 0, void 0, function* () {
37559
- yield this.callNative(ACTION.OPEN_SMS.name, {
37579
+ yield this.callNative(ACTION.OPEN_SMS, {
37560
37580
  content: object.content,
37561
37581
  phoneCode: object.phoneNumber
37562
37582
  });
@@ -37571,7 +37591,7 @@
37571
37591
  */
37572
37592
  static keepScreen(object) {
37573
37593
  return __awaiter(this, void 0, void 0, function* () {
37574
- return yield this.callNative(ACTION.KEEP_SCREEN.name, {
37594
+ return yield this.callNative(ACTION.KEEP_SCREEN, {
37575
37595
  data: {
37576
37596
  keep_screen_on: object.keepScreenOn ? 1 : 0
37577
37597
  }
@@ -37587,7 +37607,7 @@
37587
37607
  */
37588
37608
  static openBioAuthentication(object) {
37589
37609
  return __awaiter(this, void 0, void 0, function* () {
37590
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION.name, {
37610
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION, {
37591
37611
  secret_data: object.secretData,
37592
37612
  app_id: this.getZAppId(),
37593
37613
  ui: {
@@ -37626,7 +37646,7 @@
37626
37646
  */
37627
37647
  static checkStateBioAuthentication(object) {
37628
37648
  return __awaiter(this, void 0, void 0, function* () {
37629
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE.name, {}).then((data) => {
37649
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE, {}).then((data) => {
37630
37650
  return {
37631
37651
  bioState: data === null || data === void 0 ? void 0 : data.bio_state
37632
37652
  };
@@ -37642,7 +37662,7 @@
37642
37662
  */
37643
37663
  static vibrate(object) {
37644
37664
  return __awaiter(this, void 0, void 0, function* () {
37645
- return yield this.callNative(ACTION.INTERACTIVE_VIBRATION.name, {
37665
+ return yield this.callNative(ACTION.INTERACTIVE_VIBRATION, {
37646
37666
  type: VibrateType[object.type],
37647
37667
  vibrate_time: object.milliseconds
37648
37668
  });
@@ -37661,7 +37681,7 @@
37661
37681
  if (lodash.isString(object.password) && object.password.length > 0) {
37662
37682
  securityType = 'wpa_wpa2';
37663
37683
  }
37664
- return yield this.callNative(ACTION.MP_JOIN_WIFI.name, {
37684
+ return yield this.callNative(ACTION.MP_JOIN_WIFI, {
37665
37685
  ssid: object.SSID,
37666
37686
  securityType: securityType,
37667
37687
  password: object.password,
@@ -37689,7 +37709,7 @@
37689
37709
  __classPrivateFieldSet(this, _LocalResourceStorage_resourceInfo, {
37690
37710
  keys: new Set(),
37691
37711
  currentSize: 0,
37692
- limitSize: CONFIG.STORAGE_LIMIT
37712
+ limitSize: STORAGE_LIMIT
37693
37713
  });
37694
37714
  __classPrivateFieldSet(this, _LocalResourceStorage_prefix, prefix);
37695
37715
  this.findAllCurrentDataByApp(prefix);
@@ -37752,7 +37772,7 @@
37752
37772
  currentSize: lodash.isNumber(currentSize)
37753
37773
  ? Number((currentSize / 1024).toFixed(2))
37754
37774
  : 0,
37755
- limitSize: Number((CONFIG.STORAGE_LIMIT / 1024).toFixed(2))
37775
+ limitSize: Number((STORAGE_LIMIT / 1024).toFixed(2))
37756
37776
  };
37757
37777
  }
37758
37778
  remove(keys) {
@@ -37798,13 +37818,13 @@
37798
37818
  __classPrivateFieldSet(this, _NativeResourceStorage_resourceInfo, {
37799
37819
  keys: new Set(),
37800
37820
  currentSize: 0,
37801
- limitSize: CONFIG.STORAGE_LIMIT
37821
+ limitSize: STORAGE_LIMIT
37802
37822
  });
37803
37823
  __classPrivateFieldSet(this, _NativeResourceStorage_appId, appId);
37804
37824
  }
37805
37825
  get(keys) {
37806
37826
  return __awaiter(this, void 0, void 0, function* () {
37807
- return yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37827
+ return yield this.callNative(ACTION.ZBROWSER_MPDS, {
37808
37828
  mpds_action: 'mpds.get',
37809
37829
  mpds_data: {
37810
37830
  keys
@@ -37823,7 +37843,7 @@
37823
37843
  }
37824
37844
  set(data) {
37825
37845
  return __awaiter(this, void 0, void 0, function* () {
37826
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37846
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37827
37847
  mpds_action: 'mpds.set',
37828
37848
  mpds_data: {
37829
37849
  map: data
@@ -37843,7 +37863,7 @@
37843
37863
  }
37844
37864
  getInfo() {
37845
37865
  return __awaiter(this, void 0, void 0, function* () {
37846
- const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37866
+ const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37847
37867
  mpds_action: 'mpds.get.size',
37848
37868
  mpds_data: {},
37849
37869
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -37858,13 +37878,13 @@
37858
37878
  });
37859
37879
  return {
37860
37880
  currentSize: lodash.isNumber(currentSize) ? Number(currentSize / 1024) : 0,
37861
- limitSize: Number(CONFIG.STORAGE_LIMIT / 1024)
37881
+ limitSize: Number(STORAGE_LIMIT / 1024)
37862
37882
  };
37863
37883
  });
37864
37884
  }
37865
37885
  remove(keys) {
37866
37886
  return __awaiter(this, void 0, void 0, function* () {
37867
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37887
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37868
37888
  mpds_action: 'mpds.remove.key',
37869
37889
  mpds_data: {
37870
37890
  keys: keys
@@ -37884,7 +37904,7 @@
37884
37904
  }
37885
37905
  clear() {
37886
37906
  return __awaiter(this, void 0, void 0, function* () {
37887
- yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37907
+ yield this.callNative(ACTION.ZBROWSER_MPDS, {
37888
37908
  mpds_action: 'mpds.clear.appData',
37889
37909
  mpds_data: {},
37890
37910
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -38114,7 +38134,7 @@
38114
38134
  fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
38115
38135
  }
38116
38136
  const userInfo = yield axios
38117
- .get(CONFIG.APIS.GET_USER_INFO, {
38137
+ .get(APIS.GET_USER_INFO, {
38118
38138
  params: {
38119
38139
  fields: fields,
38120
38140
  access_token: accessToken
@@ -38147,7 +38167,7 @@
38147
38167
  */
38148
38168
  static getPhoneNumber(object) {
38149
38169
  return __awaiter(this, void 0, void 0, function* () {
38150
- return yield this.callNative(ACTION.MP_GET_NUMBER.name, {}, {
38170
+ return yield this.callNative(ACTION.MP_GET_NUMBER, {}, {
38151
38171
  isMultiCallback: true,
38152
38172
  callback: (nativeData, error) => {
38153
38173
  if (nativeData.error_code === 0) {
@@ -38159,7 +38179,8 @@
38159
38179
  else {
38160
38180
  return Promise.reject(error);
38161
38181
  }
38162
- }
38182
+ },
38183
+ delay: this.isIOS ? 200 : 0
38163
38184
  });
38164
38185
  });
38165
38186
  }
@@ -38176,7 +38197,7 @@
38176
38197
  */
38177
38198
  static closeApp(object) {
38178
38199
  return __awaiter(this, void 0, void 0, function* () {
38179
- yield this.callNative(ACTION.WINDOW_CLOSE.name, {});
38200
+ yield this.callNative(ACTION.WINDOW_CLOSE, {});
38180
38201
  });
38181
38202
  }
38182
38203
  /**
@@ -38196,10 +38217,12 @@
38196
38217
  return [key, value].join('=');
38197
38218
  })
38198
38219
  .join('&');
38199
- yield this.callNative(ACTION.OPEN_MP.name, {
38200
- mpUrl: `${CONFIG.MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
38220
+ const appInfo = yield getAppInfo(appId, 0);
38221
+ yield this.callNative(ACTION.OPEN_MP, {
38222
+ mpUrl: `${MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
38201
38223
  mpInfo: {
38202
- appId: appId
38224
+ appId: appId,
38225
+ appAvtUrl: appInfo.logoUrl || ''
38203
38226
  }
38204
38227
  });
38205
38228
  });
@@ -38214,7 +38237,7 @@
38214
38237
  */
38215
38238
  static openWebview(object) {
38216
38239
  return __awaiter(this, void 0, void 0, function* () {
38217
- yield this.callNative(ACTION.OPEN_INAPP.name, {
38240
+ yield this.callNative(ACTION.OPEN_INAPP, {
38218
38241
  url: object.url
38219
38242
  });
38220
38243
  });
@@ -38239,7 +38262,7 @@
38239
38262
  */
38240
38263
  static getLocation(object) {
38241
38264
  return __awaiter(this, void 0, void 0, function* () {
38242
- return yield this.callNative(ACTION.GET_LOCATION.name, {
38265
+ return yield this.callNative(ACTION.GET_LOCATION, {
38243
38266
  silent_request: false,
38244
38267
  permission_description: 'Cho phép Zalo truy cập vào vị trí của thiết bị này?'
38245
38268
  }, {
@@ -38263,7 +38286,8 @@
38263
38286
  else {
38264
38287
  return Promise.reject(error);
38265
38288
  }
38266
- }
38289
+ },
38290
+ delay: this.isIOS ? 200 : 0
38267
38291
  });
38268
38292
  });
38269
38293
  }
@@ -38277,7 +38301,7 @@
38277
38301
  */
38278
38302
  static sendLocation(object) {
38279
38303
  return __awaiter(this, void 0, void 0, function* () {
38280
- yield this.callNative(ACTION.QUERY_LOCATION_HIDE.name, {
38304
+ yield this.callNative(ACTION.QUERY_LOCATION_HIDE, {
38281
38305
  title: object.title,
38282
38306
  touserid: object.toUserId,
38283
38307
  zapp: this.getZAppId()
@@ -38297,7 +38321,7 @@
38297
38321
  */
38298
38322
  static requestCameraPermission(object) {
38299
38323
  return __awaiter(this, void 0, void 0, function* () {
38300
- return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA.name, {}, {
38324
+ return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
38301
38325
  callback: (nativeData, error) => {
38302
38326
  if (nativeData.error_code === -2 || nativeData.error_code >= 0) {
38303
38327
  return Promise.resolve({
@@ -38333,7 +38357,7 @@
38333
38357
  imageUrl: object.imageUrl
38334
38358
  };
38335
38359
  }
38336
- return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY.name, Object.assign({}, data));
38360
+ return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY, Object.assign({}, data));
38337
38361
  });
38338
38362
  }
38339
38363
  }
@@ -38348,7 +38372,7 @@
38348
38372
  */
38349
38373
  static viewOAQr(object) {
38350
38374
  return __awaiter(this, void 0, void 0, function* () {
38351
- yield this.callNative(ACTION.VIEW_MYQR.name, {
38375
+ yield this.callNative(ACTION.VIEW_MYQR, {
38352
38376
  dpn: object.displayName,
38353
38377
  uid: object.id,
38354
38378
  zapp: this.getZAppId()
@@ -38367,7 +38391,7 @@
38367
38391
  */
38368
38392
  static openProfile(object) {
38369
38393
  return __awaiter(this, void 0, void 0, function* () {
38370
- return yield this.callNative(ACTION.OPEN_PROFILE.name, {
38394
+ return yield this.callNative(ACTION.OPEN_PROFILE, {
38371
38395
  uId: object.id,
38372
38396
  type: ProfileType[object.type],
38373
38397
  zapp: this.getZAppId(),
@@ -38385,7 +38409,7 @@
38385
38409
  */
38386
38410
  static openChat(object) {
38387
38411
  return __awaiter(this, void 0, void 0, function* () {
38388
- return yield this.callNative(ACTION.OPEN_CHAT.name, {
38412
+ return yield this.callNative(ACTION.OPEN_CHAT, {
38389
38413
  uId: object.id,
38390
38414
  type: ChatType[object.type],
38391
38415
  zapp: this.getZAppId(),
@@ -38426,7 +38450,7 @@
38426
38450
  };
38427
38451
  break;
38428
38452
  }
38429
- return yield this.callNative(ACTION.OPEN_POSTFEED.name, Object.assign(Object.assign({ type: PostFeedType[object.type] }, reqData), { zapp: this.getZAppId() })).then((res) => {
38453
+ return yield this.callNative(ACTION.OPEN_POSTFEED, Object.assign(Object.assign({ type: PostFeedType[object.type] }, reqData), { zapp: this.getZAppId() })).then((res) => {
38430
38454
  return {
38431
38455
  status: res.status,
38432
38456
  shareType: res.share_type,
@@ -38445,7 +38469,7 @@
38445
38469
  */
38446
38470
  static followOA(object) {
38447
38471
  return __awaiter(this, void 0, void 0, function* () {
38448
- yield this.callNative(ACTION.FOLLOW_OA.name, {
38472
+ yield this.callNative(ACTION.FOLLOW_OA, {
38449
38473
  uid: object.id,
38450
38474
  showDialogConfirm: true,
38451
38475
  zapp: this.getZAppId()
@@ -38464,7 +38488,7 @@
38464
38488
  */
38465
38489
  static unfollowOA(object) {
38466
38490
  return __awaiter(this, void 0, void 0, function* () {
38467
- yield this.callNative(ACTION.UNFOLLOW_OA.name, {
38491
+ yield this.callNative(ACTION.UNFOLLOW_OA, {
38468
38492
  uid: object.id,
38469
38493
  zapp: this.getZAppId()
38470
38494
  }, {
@@ -38544,7 +38568,7 @@
38544
38568
  object.type = 'link';
38545
38569
  }
38546
38570
  }
38547
- return yield this.callNative(ACTION.OPEN_SHARESHEET.name, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38571
+ return yield this.callNative(ACTION.OPEN_SHARESHEET, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38548
38572
  haveTimeout: false
38549
38573
  }).then((res) => {
38550
38574
  return {
@@ -38563,25 +38587,13 @@
38563
38587
  * @category Zalo
38564
38588
  *
38565
38589
  */
38566
- static createShortcut(object) {
38590
+ static createShortcut(url, title, icon) {
38567
38591
  return __awaiter(this, void 0, void 0, function* () {
38568
- const isIOS = checkPlatform().isIOS;
38569
- let iconURL = getMetaValue('og:image:url');
38570
- if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
38571
- iconURL = `https:${iconURL}`;
38572
- }
38573
- if (isIOS) {
38574
- const iosShortcutURL = `https://mini.zalo.me/shortcut.html?appId=${this.getAppId()}&appName=${document.title}&appIcon=${iconURL}`;
38575
- return yield this.callNative(ACTION.OPEN_OUTAPP.name, {
38576
- url: encodeURI(iosShortcutURL)
38577
- });
38578
- }
38579
- else
38580
- return yield this.callNative(ACTION.CREATE_SHORTCUT.name, {
38581
- url: `${CONFIG.MINI_APP_LINK}/${this.getAppId()}/`,
38582
- title: document.title,
38583
- iconUrl: iconURL
38584
- });
38592
+ return yield this.callNative(ACTION.CREATE_SHORTCUT, {
38593
+ url: url,
38594
+ title: title,
38595
+ iconUrl: icon
38596
+ });
38585
38597
  });
38586
38598
  }
38587
38599
  /**
@@ -38594,7 +38606,7 @@
38594
38606
  */
38595
38607
  static openProfilePicker(object) {
38596
38608
  return __awaiter(this, void 0, void 0, function* () {
38597
- return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER.name, {
38609
+ return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER, {
38598
38610
  maxProfile: object === null || object === void 0 ? void 0 : object.maxProfile
38599
38611
  }, {
38600
38612
  isMultiCallback: true,
@@ -38620,7 +38632,7 @@
38620
38632
  */
38621
38633
  static getActionsSupported(object) {
38622
38634
  return __awaiter(this, void 0, void 0, function* () {
38623
- return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS.name, {}, {
38635
+ return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS, {}, {
38624
38636
  isMultiCallback: false,
38625
38637
  callback: (nativeData, error) => {
38626
38638
  const platform = getPlatform();
@@ -38655,14 +38667,14 @@
38655
38667
  return __awaiter(this, void 0, void 0, function* () {
38656
38668
  const uploadSetting = {
38657
38669
  type: 0,
38658
- url: CONFIG.MEDIA_PICKER_UPLOAD_SERVER,
38659
- maxSize: CONFIG.MEDIA_PICKER_LIMIT
38670
+ url: MEDIA_PICKER_UPLOAD_SERVER,
38671
+ maxSize: MEDIA_PICKER_LIMIT
38660
38672
  };
38661
38673
  const defaultEditView = {
38662
38674
  enable: 1,
38663
38675
  aspect_ratio: '1:1'
38664
38676
  };
38665
- return yield this.callNative(ACTION.PICK_MEDIA.name, {
38677
+ return yield this.callNative(ACTION.PICK_MEDIA, {
38666
38678
  media_type: MediaPickerType[type],
38667
38679
  edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
38668
38680
  silent_request: silentRequest,
@@ -38684,6 +38696,21 @@
38684
38696
  });
38685
38697
  });
38686
38698
  }
38699
+ /**
38700
+ * Mở url out app zalo
38701
+ *
38702
+ * @async
38703
+ * @function openOutApp
38704
+ * @category Zalo
38705
+ *
38706
+ */
38707
+ static openOutApp(url) {
38708
+ return __awaiter(this, void 0, void 0, function* () {
38709
+ return yield this.callNative(ACTION.OPEN_OUTAPP, {
38710
+ url: url
38711
+ });
38712
+ });
38713
+ }
38687
38714
  }
38688
38715
 
38689
38716
  class Routing {
@@ -38718,7 +38745,7 @@
38718
38745
  */
38719
38746
  static sendDataToPreviousMiniApp(object) {
38720
38747
  return __awaiter(this, void 0, void 0, function* () {
38721
- return yield this.callNative(ACTION.WEBVIEW_SET_RESULT.name, {
38748
+ return yield this.callNative(ACTION.WEBVIEW_SET_RESULT, {
38722
38749
  result: stringifyData(object.data)
38723
38750
  });
38724
38751
  });
@@ -38764,6 +38791,7 @@
38764
38791
  _ZaloMiniProgramSDK_tokenExpiresIn.set(this, void 0);
38765
38792
  _ZaloMiniProgramSDK_cookies.set(this, null);
38766
38793
  this.events = ZMPEEmitter.getInstance();
38794
+ this.isIOS = checkPlatform().isIOS;
38767
38795
  _ZaloMiniProgramSDK_actionBarConfig.set(this, void 0);
38768
38796
  this.getActionBarConfig = () => {
38769
38797
  return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_actionBarConfig);
@@ -38777,10 +38805,10 @@
38777
38805
  resolve(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies));
38778
38806
  }
38779
38807
  else {
38780
- this.callNative('action.jump.login', {})
38808
+ this.callNative(ACTION.JUMP_LOGIN, {})
38781
38809
  .then((data) => {
38782
38810
  const cookies = (data && data.cookiesOAuthLogins) || [];
38783
- const jsToken = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.JS_TOKEN);
38811
+ const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
38784
38812
  if (jsToken) {
38785
38813
  this.setJSToken(jsToken.value);
38786
38814
  window.ZJSBridge.setJSToken &&
@@ -38856,6 +38884,7 @@
38856
38884
  _ZaloMiniProgramSDK_getActionsSupported.set(this, Zalo.getActionsSupported);
38857
38885
  this.connectWifi = Device.connectWifi;
38858
38886
  this.openMediaPicker = Zalo.openMediaPicker;
38887
+ this.openOutApp = Zalo.openOutApp;
38859
38888
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
38860
38889
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38861
38890
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
@@ -38886,7 +38915,7 @@
38886
38915
  },
38887
38916
  homeConfig: {
38888
38917
  enable: showHomeButton,
38889
- url: `${CONFIG.MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38918
+ url: `${MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38890
38919
  }
38891
38920
  });
38892
38921
  }
@@ -38908,8 +38937,8 @@
38908
38937
  login(object) {
38909
38938
  return __awaiter(this, void 0, void 0, function* () {
38910
38939
  const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDK_callJump).call(this);
38911
- const zOAuthCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH);
38912
- const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH_VRF);
38940
+ const zOAuthCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH);
38941
+ const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH_VRF);
38913
38942
  if (!lodash.isUndefined(zOAuthCookie) &&
38914
38943
  !lodash.isNull(zOAuthCookie) &&
38915
38944
  lodash.isString(zOAuthCookie.value)) {
@@ -38934,10 +38963,10 @@
38934
38963
  loginZaloV3() {
38935
38964
  return __awaiter(this, void 0, void 0, function* () {
38936
38965
  return yield axios
38937
- .get(CONFIG.APIS.GET_ACCESS_TOKEN_V3, {
38966
+ .get(APIS.GET_ACCESS_TOKEN_V3, {
38938
38967
  params: {
38939
38968
  app_id: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zAppId),
38940
- redirect_uri: `${CONFIG.MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId)}/`,
38969
+ redirect_uri: `${MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId)}/`,
38941
38970
  code: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuth),
38942
38971
  isSDK: true
38943
38972
  }
@@ -38977,7 +39006,7 @@
38977
39006
  }
38978
39007
  };
38979
39008
  return yield axios
38980
- .post(CONFIG.APIS.GET_ACCESS_TOKEN, inputData, config)
39009
+ .post(APIS.GET_ACCESS_TOKEN, inputData, config)
38981
39010
  .then((response) => {
38982
39011
  const resData = response.data;
38983
39012
  if (resData.refresh_token) {
@@ -39322,6 +39351,10 @@
39322
39351
  console.warn('This api only works on zalo app');
39323
39352
  return Promise.resolve();
39324
39353
  };
39354
+ this.openOutApp = (url) => {
39355
+ location.href = url;
39356
+ return Promise.resolve();
39357
+ };
39325
39358
  }
39326
39359
  on(event, fn, context) {
39327
39360
  throw new Error('Method not implemented.');
@@ -40815,7 +40848,23 @@
40815
40848
  }
40816
40849
  createShortcut(object) {
40817
40850
  return __awaiter(this, void 0, void 0, function* () {
40818
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).createShortcut(object);
40851
+ 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;
40858
+ const searchParams = object.params ? new URLSearchParams(object.params) : new URLSearchParams();
40859
+ if (isIOS) {
40860
+ searchParams.append('appId', APP_ID);
40861
+ searchParams.append('appName', title);
40862
+ searchParams.append('appIcon', iconURL);
40863
+ const iosShortcutURL = `https://mini.zalo.me/shortcut.html?${searchParams.toString()}`;
40864
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openOutApp(encodeURI(iosShortcutURL));
40865
+ }
40866
+ else
40867
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).createShortcut(`${MINI_APP_LINK}/${APP_ID}/?${searchParams.toString()}`, title, iconURL);
40819
40868
  });
40820
40869
  }
40821
40870
  openBioAuthentication(object) {
@@ -41351,12 +41400,9 @@
41351
41400
  title: checkData('string', { maxLength: 100 }),
41352
41401
  'thumbnail?': checkData('url'),
41353
41402
  'path?': checkData('url'),
41354
- description: checkData(['string'], { maxLength: 400 }),
41403
+ description: checkData(['string'], { maxLength: 400 })
41355
41404
  }, {
41356
- description: {
41357
- vi: '',
41358
- en: ''
41359
- }
41405
+ description: ''
41360
41406
  }))
41361
41407
  ], SDKCreator.prototype, "getShareableLink", null);
41362
41408
  class ZaloMiniAppSDKCreator extends SDKCreator {