zmp-sdk 2.16.2 → 2.16.5

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
@@ -36720,7 +36740,7 @@
36720
36740
  }
36721
36741
  _ZJSBridgeProvider_bridge = new WeakMap();
36722
36742
 
36723
- var version = "2.16.2";
36743
+ var version = "2.16.5";
36724
36744
 
36725
36745
  class Basics {
36726
36746
  /**
@@ -36762,31 +36782,9 @@
36762
36782
  */
36763
36783
  static getAppInfo() {
36764
36784
  return __awaiter(this, void 0, void 0, function* () {
36765
- let info = {};
36766
36785
  const appId = this.getAppId();
36767
36786
  const systemInfo = this.getSystemInfo();
36768
- const api = QueryString.appendToUrl(`${API_DOMAIN}${H5_API.GET_APP_INFO}`, {
36769
- appId,
36770
- versionStatus: 0,
36771
- currentVersion: systemInfo.version
36772
- });
36773
- const msgApi = yield fetch(api, {
36774
- credentials: 'include'
36775
- });
36776
- if (msgApi.ok) {
36777
- const appInfo = yield msgApi.json();
36778
- if (appInfo.err < 0 || !appInfo.data) {
36779
- throw new Error(appInfo);
36780
- }
36781
- info = {
36782
- name: appInfo.data.name,
36783
- version: appInfo.data.version,
36784
- description: appInfo.data.description,
36785
- appUrl: appInfo.data.appUrl,
36786
- qrCodeUrl: appInfo.data.qrCodeUrl
36787
- };
36788
- }
36789
- return info;
36787
+ return yield getAppInfo(appId, 0, systemInfo.version);
36790
36788
  });
36791
36789
  }
36792
36790
  }
@@ -36825,7 +36823,7 @@
36825
36823
  */
36826
36824
  static setNavigationBarTitle(object) {
36827
36825
  return __awaiter(this, void 0, void 0, function* () {
36828
- yield this.callNative(ACTION.CHANGE_TITLE_HEADER.name, {
36826
+ yield this.callNative(ACTION.CHANGE_TITLE_HEADER, {
36829
36827
  title: object.title
36830
36828
  }, {
36831
36829
  haveTimeout: false
@@ -36873,7 +36871,7 @@
36873
36871
  actionBarType = HIDE_ACTION_BAR;
36874
36872
  }
36875
36873
  this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { actionbarType: actionBarType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), dataConfig) })));
36876
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, Object.assign({}, this.getActionBarConfig()), {
36874
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, Object.assign({}, this.getActionBarConfig()), {
36877
36875
  haveTimeout: false
36878
36876
  });
36879
36877
  });
@@ -36917,7 +36915,7 @@
36917
36915
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
36918
36916
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
36919
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 }) })));
36920
- 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()), {
36921
36919
  haveTimeout: false
36922
36920
  });
36923
36921
  });
@@ -36959,7 +36957,7 @@
36959
36957
  */
36960
36958
  static setNavigationBarRightButton(object) {
36961
36959
  return __awaiter(this, void 0, void 0, function* () {
36962
- yield this.callNative(ACTION.CREATE_OPTIONS_MENU.name, {
36960
+ yield this.callNative(ACTION.CREATE_OPTIONS_MENU, {
36963
36961
  supportToolBar: object.supportToolBar,
36964
36962
  reset: object.reset,
36965
36963
  menuListItems: object.menuListItems,
@@ -36995,7 +36993,7 @@
36995
36993
  return __awaiter(this, void 0, void 0, function* () {
36996
36994
  if (lodash.isString(object.backgroundColor) &&
36997
36995
  object.backgroundColor.length > 0) {
36998
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, {
36996
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
36999
36997
  actionbarType: this.isShowNavBar ? 5 : 6,
37000
36998
  dataConfig: {
37001
36999
  backgroundColor: object.backgroundColor,
@@ -37107,7 +37105,7 @@
37107
37105
  */
37108
37106
  static setDeviceOrientation(object) {
37109
37107
  return __awaiter(this, void 0, void 0, function* () {
37110
- yield this.callNative(ACTION.CHANGE_AUTOROTATE.name, {
37108
+ yield this.callNative(ACTION.CHANGE_AUTOROTATE, {
37111
37109
  autoRotate: OrientationType[object.rotate]
37112
37110
  });
37113
37111
  });
@@ -37131,26 +37129,27 @@
37131
37129
  */
37132
37130
  static getNetworkType(object) {
37133
37131
  return __awaiter(this, void 0, void 0, function* () {
37134
- const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE.name, {
37132
+ const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE, {
37135
37133
  url: window.location.href,
37136
37134
  featureId: ''
37137
37135
  }).then((data) => {
37138
37136
  const network = data.network;
37139
37137
  let networkType;
37138
+ const isAndroid = checkPlatform().isAndroid;
37140
37139
  switch (network) {
37141
- case CONFIG.NETWORK_TYPE.NONE:
37140
+ case NETWORK_TYPE(isAndroid).NONE:
37142
37141
  networkType = NetworkType.none;
37143
37142
  break;
37144
- case CONFIG.NETWORK_TYPE.WIFI:
37143
+ case NETWORK_TYPE(isAndroid).WIFI:
37145
37144
  networkType = NetworkType.wifi;
37146
37145
  break;
37147
- case CONFIG.NETWORK_TYPE['2G']:
37146
+ case NETWORK_TYPE(isAndroid)['2G']:
37148
37147
  networkType = NetworkType.cellular;
37149
37148
  break;
37150
- case CONFIG.NETWORK_TYPE['3G']:
37149
+ case NETWORK_TYPE(isAndroid)['3G']:
37151
37150
  networkType = NetworkType.cellular;
37152
37151
  break;
37153
- case CONFIG.NETWORK_TYPE['4G']:
37152
+ case NETWORK_TYPE(isAndroid)['4G']:
37154
37153
  networkType = NetworkType.cellular;
37155
37154
  break;
37156
37155
  default:
@@ -37244,7 +37243,7 @@
37244
37243
  items: Array.isArray(object === null || object === void 0 ? void 0 : object.items) ? object === null || object === void 0 ? void 0 : object.items : []
37245
37244
  }
37246
37245
  };
37247
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37246
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37248
37247
  return true;
37249
37248
  });
37250
37249
  }
@@ -37263,7 +37262,7 @@
37263
37262
  const data = {
37264
37263
  subaction: 2
37265
37264
  };
37266
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37265
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37267
37266
  return true;
37268
37267
  });
37269
37268
  }
@@ -37284,7 +37283,7 @@
37284
37283
  const data = {
37285
37284
  subaction: 1
37286
37285
  };
37287
- const resData = yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data), {
37286
+ const resData = yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data), {
37288
37287
  isMultiCallback: true
37289
37288
  }).then((resData) => {
37290
37289
  const res = {
@@ -37326,7 +37325,9 @@
37326
37325
  */
37327
37326
  static stopBluetoothDevicesDiscovery() {
37328
37327
  return __awaiter(this, void 0, void 0, function* () {
37329
- return this.callNative('', {});
37328
+ return this.callNative({
37329
+ name: ''
37330
+ }, {});
37330
37331
  });
37331
37332
  }
37332
37333
  /**
@@ -37351,7 +37352,9 @@
37351
37352
  */
37352
37353
  static startBluetoothDevicesDiscovery(object) {
37353
37354
  return __awaiter(this, void 0, void 0, function* () {
37354
- return this.callNative('', Object.assign({}, object));
37355
+ return this.callNative({
37356
+ name: ''
37357
+ }, Object.assign({}, object));
37355
37358
  });
37356
37359
  }
37357
37360
  /**
@@ -37373,7 +37376,9 @@
37373
37376
  */
37374
37377
  static openBluetoothAdapter() {
37375
37378
  return __awaiter(this, void 0, void 0, function* () {
37376
- return this.callNative('', {});
37379
+ return this.callNative({
37380
+ name: ''
37381
+ }, {});
37377
37382
  });
37378
37383
  }
37379
37384
  /**
@@ -37391,7 +37396,9 @@
37391
37396
  */
37392
37397
  static onBluetoothDeviceFound() {
37393
37398
  return __awaiter(this, void 0, void 0, function* () {
37394
- return this.callNative('', {});
37399
+ return this.callNative({
37400
+ name: ''
37401
+ }, {});
37395
37402
  });
37396
37403
  }
37397
37404
  /**
@@ -37437,7 +37444,9 @@
37437
37444
  const data = {
37438
37445
  services: object.services || []
37439
37446
  };
37440
- return this.callNative('', data);
37447
+ return this.callNative({
37448
+ name: ''
37449
+ }, data);
37441
37450
  });
37442
37451
  }
37443
37452
  /**
@@ -37456,7 +37465,9 @@
37456
37465
  */
37457
37466
  static getBluetoothDevices() {
37458
37467
  return __awaiter(this, void 0, void 0, function* () {
37459
- return this.callNative('', {});
37468
+ return this.callNative({
37469
+ name: ''
37470
+ }, {});
37460
37471
  });
37461
37472
  }
37462
37473
  /**
@@ -37475,7 +37486,9 @@
37475
37486
  */
37476
37487
  static getBluetoothAdapterState() {
37477
37488
  return __awaiter(this, void 0, void 0, function* () {
37478
- return this.callNative('', {});
37489
+ return this.callNative({
37490
+ name: ''
37491
+ }, {});
37479
37492
  });
37480
37493
  }
37481
37494
  /**
@@ -37494,7 +37507,9 @@
37494
37507
  */
37495
37508
  static closeBluetoothAdapter() {
37496
37509
  return __awaiter(this, void 0, void 0, function* () {
37497
- return this.callNative('', {});
37510
+ return this.callNative({
37511
+ name: ''
37512
+ }, {});
37498
37513
  });
37499
37514
  }
37500
37515
  /**
@@ -37506,7 +37521,7 @@
37506
37521
  */
37507
37522
  static scanQRCode(object) {
37508
37523
  return __awaiter(this, void 0, void 0, function* () {
37509
- return yield this.callNative(ACTION.OPEN_QR.name, {
37524
+ return yield this.callNative(ACTION.OPEN_QR, {
37510
37525
  skipOpenLink: true
37511
37526
  });
37512
37527
  });
@@ -37520,7 +37535,7 @@
37520
37535
  */
37521
37536
  static showToast(object) {
37522
37537
  return __awaiter(this, void 0, void 0, function* () {
37523
- yield this.callNative(ACTION.SHOW_TOAST.name, {
37538
+ yield this.callNative(ACTION.SHOW_TOAST, {
37524
37539
  toast: object.message
37525
37540
  });
37526
37541
  });
@@ -37534,7 +37549,7 @@
37534
37549
  */
37535
37550
  static hideKeyboard(object) {
37536
37551
  return __awaiter(this, void 0, void 0, function* () {
37537
- yield this.callNative(ACTION.HIDE_KEYBOARD.name, {});
37552
+ yield this.callNative(ACTION.HIDE_KEYBOARD, {});
37538
37553
  });
37539
37554
  }
37540
37555
  /**
@@ -37546,7 +37561,7 @@
37546
37561
  */
37547
37562
  static openPhone(object) {
37548
37563
  return __awaiter(this, void 0, void 0, function* () {
37549
- yield this.callNative(ACTION.OPEN_PHONE.name, {
37564
+ yield this.callNative(ACTION.OPEN_PHONE, {
37550
37565
  phoneNum: object.phoneNumber,
37551
37566
  phoneCode: object.phoneNumber
37552
37567
  });
@@ -37561,7 +37576,7 @@
37561
37576
  */
37562
37577
  static openSMS(object) {
37563
37578
  return __awaiter(this, void 0, void 0, function* () {
37564
- yield this.callNative(ACTION.OPEN_SMS.name, {
37579
+ yield this.callNative(ACTION.OPEN_SMS, {
37565
37580
  content: object.content,
37566
37581
  phoneCode: object.phoneNumber
37567
37582
  });
@@ -37576,7 +37591,7 @@
37576
37591
  */
37577
37592
  static keepScreen(object) {
37578
37593
  return __awaiter(this, void 0, void 0, function* () {
37579
- return yield this.callNative(ACTION.KEEP_SCREEN.name, {
37594
+ return yield this.callNative(ACTION.KEEP_SCREEN, {
37580
37595
  data: {
37581
37596
  keep_screen_on: object.keepScreenOn ? 1 : 0
37582
37597
  }
@@ -37592,7 +37607,7 @@
37592
37607
  */
37593
37608
  static openBioAuthentication(object) {
37594
37609
  return __awaiter(this, void 0, void 0, function* () {
37595
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION.name, {
37610
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION, {
37596
37611
  secret_data: object.secretData,
37597
37612
  app_id: this.getZAppId(),
37598
37613
  ui: {
@@ -37631,7 +37646,7 @@
37631
37646
  */
37632
37647
  static checkStateBioAuthentication(object) {
37633
37648
  return __awaiter(this, void 0, void 0, function* () {
37634
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE.name, {}).then((data) => {
37649
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE, {}).then((data) => {
37635
37650
  return {
37636
37651
  bioState: data === null || data === void 0 ? void 0 : data.bio_state
37637
37652
  };
@@ -37647,7 +37662,7 @@
37647
37662
  */
37648
37663
  static vibrate(object) {
37649
37664
  return __awaiter(this, void 0, void 0, function* () {
37650
- return yield this.callNative(ACTION.INTERACTIVE_VIBRATION.name, {
37665
+ return yield this.callNative(ACTION.INTERACTIVE_VIBRATION, {
37651
37666
  type: VibrateType[object.type],
37652
37667
  vibrate_time: object.milliseconds
37653
37668
  });
@@ -37666,7 +37681,7 @@
37666
37681
  if (lodash.isString(object.password) && object.password.length > 0) {
37667
37682
  securityType = 'wpa_wpa2';
37668
37683
  }
37669
- return yield this.callNative(ACTION.MP_JOIN_WIFI.name, {
37684
+ return yield this.callNative(ACTION.MP_JOIN_WIFI, {
37670
37685
  ssid: object.SSID,
37671
37686
  securityType: securityType,
37672
37687
  password: object.password,
@@ -37694,7 +37709,7 @@
37694
37709
  __classPrivateFieldSet(this, _LocalResourceStorage_resourceInfo, {
37695
37710
  keys: new Set(),
37696
37711
  currentSize: 0,
37697
- limitSize: CONFIG.STORAGE_LIMIT
37712
+ limitSize: STORAGE_LIMIT
37698
37713
  });
37699
37714
  __classPrivateFieldSet(this, _LocalResourceStorage_prefix, prefix);
37700
37715
  this.findAllCurrentDataByApp(prefix);
@@ -37757,7 +37772,7 @@
37757
37772
  currentSize: lodash.isNumber(currentSize)
37758
37773
  ? Number((currentSize / 1024).toFixed(2))
37759
37774
  : 0,
37760
- limitSize: Number((CONFIG.STORAGE_LIMIT / 1024).toFixed(2))
37775
+ limitSize: Number((STORAGE_LIMIT / 1024).toFixed(2))
37761
37776
  };
37762
37777
  }
37763
37778
  remove(keys) {
@@ -37803,13 +37818,13 @@
37803
37818
  __classPrivateFieldSet(this, _NativeResourceStorage_resourceInfo, {
37804
37819
  keys: new Set(),
37805
37820
  currentSize: 0,
37806
- limitSize: CONFIG.STORAGE_LIMIT
37821
+ limitSize: STORAGE_LIMIT
37807
37822
  });
37808
37823
  __classPrivateFieldSet(this, _NativeResourceStorage_appId, appId);
37809
37824
  }
37810
37825
  get(keys) {
37811
37826
  return __awaiter(this, void 0, void 0, function* () {
37812
- return yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37827
+ return yield this.callNative(ACTION.ZBROWSER_MPDS, {
37813
37828
  mpds_action: 'mpds.get',
37814
37829
  mpds_data: {
37815
37830
  keys
@@ -37828,7 +37843,7 @@
37828
37843
  }
37829
37844
  set(data) {
37830
37845
  return __awaiter(this, void 0, void 0, function* () {
37831
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37846
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37832
37847
  mpds_action: 'mpds.set',
37833
37848
  mpds_data: {
37834
37849
  map: data
@@ -37848,7 +37863,7 @@
37848
37863
  }
37849
37864
  getInfo() {
37850
37865
  return __awaiter(this, void 0, void 0, function* () {
37851
- const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37866
+ const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37852
37867
  mpds_action: 'mpds.get.size',
37853
37868
  mpds_data: {},
37854
37869
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -37863,13 +37878,13 @@
37863
37878
  });
37864
37879
  return {
37865
37880
  currentSize: lodash.isNumber(currentSize) ? Number(currentSize / 1024) : 0,
37866
- limitSize: Number(CONFIG.STORAGE_LIMIT / 1024)
37881
+ limitSize: Number(STORAGE_LIMIT / 1024)
37867
37882
  };
37868
37883
  });
37869
37884
  }
37870
37885
  remove(keys) {
37871
37886
  return __awaiter(this, void 0, void 0, function* () {
37872
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37887
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37873
37888
  mpds_action: 'mpds.remove.key',
37874
37889
  mpds_data: {
37875
37890
  keys: keys
@@ -37889,7 +37904,7 @@
37889
37904
  }
37890
37905
  clear() {
37891
37906
  return __awaiter(this, void 0, void 0, function* () {
37892
- yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37907
+ yield this.callNative(ACTION.ZBROWSER_MPDS, {
37893
37908
  mpds_action: 'mpds.clear.appData',
37894
37909
  mpds_data: {},
37895
37910
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -38119,7 +38134,7 @@
38119
38134
  fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
38120
38135
  }
38121
38136
  const userInfo = yield axios
38122
- .get(CONFIG.APIS.GET_USER_INFO, {
38137
+ .get(APIS.GET_USER_INFO, {
38123
38138
  params: {
38124
38139
  fields: fields,
38125
38140
  access_token: accessToken
@@ -38152,7 +38167,7 @@
38152
38167
  */
38153
38168
  static getPhoneNumber(object) {
38154
38169
  return __awaiter(this, void 0, void 0, function* () {
38155
- return yield this.callNative(ACTION.MP_GET_NUMBER.name, {}, {
38170
+ return yield this.callNative(ACTION.MP_GET_NUMBER, {}, {
38156
38171
  isMultiCallback: true,
38157
38172
  callback: (nativeData, error) => {
38158
38173
  if (nativeData.error_code === 0) {
@@ -38182,7 +38197,7 @@
38182
38197
  */
38183
38198
  static closeApp(object) {
38184
38199
  return __awaiter(this, void 0, void 0, function* () {
38185
- yield this.callNative(ACTION.WINDOW_CLOSE.name, {});
38200
+ yield this.callNative(ACTION.WINDOW_CLOSE, {});
38186
38201
  });
38187
38202
  }
38188
38203
  /**
@@ -38202,10 +38217,12 @@
38202
38217
  return [key, value].join('=');
38203
38218
  })
38204
38219
  .join('&');
38205
- yield this.callNative(ACTION.OPEN_MP.name, {
38206
- 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 : ''}`,
38207
38223
  mpInfo: {
38208
- appId: appId
38224
+ appId: appId,
38225
+ appAvtUrl: appInfo.logoUrl || ''
38209
38226
  }
38210
38227
  });
38211
38228
  });
@@ -38220,7 +38237,7 @@
38220
38237
  */
38221
38238
  static openWebview(object) {
38222
38239
  return __awaiter(this, void 0, void 0, function* () {
38223
- yield this.callNative(ACTION.OPEN_INAPP.name, {
38240
+ yield this.callNative(ACTION.OPEN_INAPP, {
38224
38241
  url: object.url
38225
38242
  });
38226
38243
  });
@@ -38245,7 +38262,7 @@
38245
38262
  */
38246
38263
  static getLocation(object) {
38247
38264
  return __awaiter(this, void 0, void 0, function* () {
38248
- return yield this.callNative(ACTION.GET_LOCATION.name, {
38265
+ return yield this.callNative(ACTION.GET_LOCATION, {
38249
38266
  silent_request: false,
38250
38267
  permission_description: 'Cho phép Zalo truy cập vào vị trí của thiết bị này?'
38251
38268
  }, {
@@ -38284,7 +38301,7 @@
38284
38301
  */
38285
38302
  static sendLocation(object) {
38286
38303
  return __awaiter(this, void 0, void 0, function* () {
38287
- yield this.callNative(ACTION.QUERY_LOCATION_HIDE.name, {
38304
+ yield this.callNative(ACTION.QUERY_LOCATION_HIDE, {
38288
38305
  title: object.title,
38289
38306
  touserid: object.toUserId,
38290
38307
  zapp: this.getZAppId()
@@ -38304,7 +38321,7 @@
38304
38321
  */
38305
38322
  static requestCameraPermission(object) {
38306
38323
  return __awaiter(this, void 0, void 0, function* () {
38307
- return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA.name, {}, {
38324
+ return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
38308
38325
  callback: (nativeData, error) => {
38309
38326
  if (nativeData.error_code === -2 || nativeData.error_code >= 0) {
38310
38327
  return Promise.resolve({
@@ -38340,7 +38357,7 @@
38340
38357
  imageUrl: object.imageUrl
38341
38358
  };
38342
38359
  }
38343
- return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY.name, Object.assign({}, data));
38360
+ return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY, Object.assign({}, data));
38344
38361
  });
38345
38362
  }
38346
38363
  }
@@ -38355,7 +38372,7 @@
38355
38372
  */
38356
38373
  static viewOAQr(object) {
38357
38374
  return __awaiter(this, void 0, void 0, function* () {
38358
- yield this.callNative(ACTION.VIEW_MYQR.name, {
38375
+ yield this.callNative(ACTION.VIEW_MYQR, {
38359
38376
  dpn: object.displayName,
38360
38377
  uid: object.id,
38361
38378
  zapp: this.getZAppId()
@@ -38374,7 +38391,7 @@
38374
38391
  */
38375
38392
  static openProfile(object) {
38376
38393
  return __awaiter(this, void 0, void 0, function* () {
38377
- return yield this.callNative(ACTION.OPEN_PROFILE.name, {
38394
+ return yield this.callNative(ACTION.OPEN_PROFILE, {
38378
38395
  uId: object.id,
38379
38396
  type: ProfileType[object.type],
38380
38397
  zapp: this.getZAppId(),
@@ -38392,7 +38409,7 @@
38392
38409
  */
38393
38410
  static openChat(object) {
38394
38411
  return __awaiter(this, void 0, void 0, function* () {
38395
- return yield this.callNative(ACTION.OPEN_CHAT.name, {
38412
+ return yield this.callNative(ACTION.OPEN_CHAT, {
38396
38413
  uId: object.id,
38397
38414
  type: ChatType[object.type],
38398
38415
  zapp: this.getZAppId(),
@@ -38433,7 +38450,7 @@
38433
38450
  };
38434
38451
  break;
38435
38452
  }
38436
- 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) => {
38437
38454
  return {
38438
38455
  status: res.status,
38439
38456
  shareType: res.share_type,
@@ -38452,7 +38469,7 @@
38452
38469
  */
38453
38470
  static followOA(object) {
38454
38471
  return __awaiter(this, void 0, void 0, function* () {
38455
- yield this.callNative(ACTION.FOLLOW_OA.name, {
38472
+ yield this.callNative(ACTION.FOLLOW_OA, {
38456
38473
  uid: object.id,
38457
38474
  showDialogConfirm: true,
38458
38475
  zapp: this.getZAppId()
@@ -38471,7 +38488,7 @@
38471
38488
  */
38472
38489
  static unfollowOA(object) {
38473
38490
  return __awaiter(this, void 0, void 0, function* () {
38474
- yield this.callNative(ACTION.UNFOLLOW_OA.name, {
38491
+ yield this.callNative(ACTION.UNFOLLOW_OA, {
38475
38492
  uid: object.id,
38476
38493
  zapp: this.getZAppId()
38477
38494
  }, {
@@ -38551,7 +38568,7 @@
38551
38568
  object.type = 'link';
38552
38569
  }
38553
38570
  }
38554
- 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() }), {
38555
38572
  haveTimeout: false
38556
38573
  }).then((res) => {
38557
38574
  return {
@@ -38570,25 +38587,13 @@
38570
38587
  * @category Zalo
38571
38588
  *
38572
38589
  */
38573
- static createShortcut(object) {
38590
+ static createShortcut(url, title, icon) {
38574
38591
  return __awaiter(this, void 0, void 0, function* () {
38575
- const isIOS = checkPlatform().isIOS;
38576
- let iconURL = getMetaValue('og:image:url');
38577
- if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
38578
- iconURL = `https:${iconURL}`;
38579
- }
38580
- if (isIOS) {
38581
- const iosShortcutURL = `https://mini.zalo.me/shortcut.html?appId=${this.getAppId()}&appName=${document.title}&appIcon=${iconURL}`;
38582
- return yield this.callNative(ACTION.OPEN_OUTAPP.name, {
38583
- url: encodeURI(iosShortcutURL)
38584
- });
38585
- }
38586
- else
38587
- return yield this.callNative(ACTION.CREATE_SHORTCUT.name, {
38588
- url: `${CONFIG.MINI_APP_LINK}/${this.getAppId()}/`,
38589
- title: document.title,
38590
- iconUrl: iconURL
38591
- });
38592
+ return yield this.callNative(ACTION.CREATE_SHORTCUT, {
38593
+ url: url,
38594
+ title: title,
38595
+ iconUrl: icon
38596
+ });
38592
38597
  });
38593
38598
  }
38594
38599
  /**
@@ -38601,7 +38606,7 @@
38601
38606
  */
38602
38607
  static openProfilePicker(object) {
38603
38608
  return __awaiter(this, void 0, void 0, function* () {
38604
- return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER.name, {
38609
+ return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER, {
38605
38610
  maxProfile: object === null || object === void 0 ? void 0 : object.maxProfile
38606
38611
  }, {
38607
38612
  isMultiCallback: true,
@@ -38627,7 +38632,7 @@
38627
38632
  */
38628
38633
  static getActionsSupported(object) {
38629
38634
  return __awaiter(this, void 0, void 0, function* () {
38630
- return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS.name, {}, {
38635
+ return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS, {}, {
38631
38636
  isMultiCallback: false,
38632
38637
  callback: (nativeData, error) => {
38633
38638
  const platform = getPlatform();
@@ -38662,14 +38667,14 @@
38662
38667
  return __awaiter(this, void 0, void 0, function* () {
38663
38668
  const uploadSetting = {
38664
38669
  type: 0,
38665
- url: CONFIG.MEDIA_PICKER_UPLOAD_SERVER,
38666
- maxSize: CONFIG.MEDIA_PICKER_LIMIT
38670
+ url: MEDIA_PICKER_UPLOAD_SERVER,
38671
+ maxSize: MEDIA_PICKER_LIMIT
38667
38672
  };
38668
38673
  const defaultEditView = {
38669
38674
  enable: 1,
38670
38675
  aspect_ratio: '1:1'
38671
38676
  };
38672
- return yield this.callNative(ACTION.PICK_MEDIA.name, {
38677
+ return yield this.callNative(ACTION.PICK_MEDIA, {
38673
38678
  media_type: MediaPickerType[type],
38674
38679
  edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
38675
38680
  silent_request: silentRequest,
@@ -38691,6 +38696,21 @@
38691
38696
  });
38692
38697
  });
38693
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
+ }
38694
38714
  }
38695
38715
 
38696
38716
  class Routing {
@@ -38725,7 +38745,7 @@
38725
38745
  */
38726
38746
  static sendDataToPreviousMiniApp(object) {
38727
38747
  return __awaiter(this, void 0, void 0, function* () {
38728
- return yield this.callNative(ACTION.WEBVIEW_SET_RESULT.name, {
38748
+ return yield this.callNative(ACTION.WEBVIEW_SET_RESULT, {
38729
38749
  result: stringifyData(object.data)
38730
38750
  });
38731
38751
  });
@@ -38750,51 +38770,51 @@
38750
38770
  }
38751
38771
  }
38752
38772
 
38753
- var _ZaloMiniProgramSDK_zAppId, _ZaloMiniProgramSDK_appId, _ZaloMiniProgramSDK_appConfig, _ZaloMiniProgramSDK_zOAuth, _ZaloMiniProgramSDK_zOAuthVrf, _ZaloMiniProgramSDK_accessToken, _ZaloMiniProgramSDK_refreshToken, _ZaloMiniProgramSDK_cache, _ZaloMiniProgramSDK_prevGetTokenTimestamp, _ZaloMiniProgramSDK_tokenExpiresIn, _ZaloMiniProgramSDK_cookies, _ZaloMiniProgramSDK_actionBarConfig, _ZaloMiniProgramSDK_callJump, _ZaloMiniProgramSDK_setNavigationBarRightButton, _ZaloMiniProgramSDK_getActionsSupported;
38754
- class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38773
+ 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
+ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38755
38775
  constructor() {
38756
38776
  var _a, _b, _c, _d, _e, _f, _g, _h;
38757
38777
  super();
38758
- _ZaloMiniProgramSDK_zAppId.set(this, ZAPP_ID);
38759
- _ZaloMiniProgramSDK_appId.set(this, APP_ID);
38760
- _ZaloMiniProgramSDK_appConfig.set(this, APP_CONFIG);
38761
- _ZaloMiniProgramSDK_zOAuth.set(this, void 0);
38762
- _ZaloMiniProgramSDK_zOAuthVrf.set(this, void 0);
38763
- _ZaloMiniProgramSDK_accessToken.set(this, void 0);
38764
- _ZaloMiniProgramSDK_refreshToken.set(this, null);
38765
- _ZaloMiniProgramSDK_cache.set(this, {
38778
+ _ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
38779
+ _ZaloMiniProgramSDKService_appId.set(this, APP_ID);
38780
+ _ZaloMiniProgramSDKService_appConfig.set(this, APP_CONFIG);
38781
+ _ZaloMiniProgramSDKService_zOAuth.set(this, void 0);
38782
+ _ZaloMiniProgramSDKService_zOAuthVrf.set(this, void 0);
38783
+ _ZaloMiniProgramSDKService_accessToken.set(this, void 0);
38784
+ _ZaloMiniProgramSDKService_refreshToken.set(this, null);
38785
+ _ZaloMiniProgramSDKService_cache.set(this, {
38766
38786
  timer: {
38767
38787
  getToken: 0
38768
38788
  }
38769
38789
  });
38770
- _ZaloMiniProgramSDK_prevGetTokenTimestamp.set(this, void 0);
38771
- _ZaloMiniProgramSDK_tokenExpiresIn.set(this, void 0);
38772
- _ZaloMiniProgramSDK_cookies.set(this, null);
38790
+ _ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
38791
+ _ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
38792
+ _ZaloMiniProgramSDKService_cookies.set(this, null);
38773
38793
  this.events = ZMPEEmitter.getInstance();
38774
38794
  this.isIOS = checkPlatform().isIOS;
38775
- _ZaloMiniProgramSDK_actionBarConfig.set(this, void 0);
38795
+ _ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
38776
38796
  this.getActionBarConfig = () => {
38777
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_actionBarConfig);
38797
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_actionBarConfig);
38778
38798
  };
38779
38799
  this.setActionBarConfig = (setState) => {
38780
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_actionBarConfig, setState(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_actionBarConfig)));
38800
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, setState(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_actionBarConfig)));
38781
38801
  };
38782
- _ZaloMiniProgramSDK_callJump.set(this, () => {
38802
+ _ZaloMiniProgramSDKService_callJump.set(this, () => {
38783
38803
  return new Promise((resolve, reject) => {
38784
- if (!lodash.isUndefined(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies)) && !lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies))) {
38785
- resolve(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies));
38804
+ if (!lodash.isUndefined(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies)) && !lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies))) {
38805
+ resolve(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies));
38786
38806
  }
38787
38807
  else {
38788
- this.callNative('action.jump.login', {})
38808
+ this.callNative(ACTION.JUMP_LOGIN, {})
38789
38809
  .then((data) => {
38790
38810
  const cookies = (data && data.cookiesOAuthLogins) || [];
38791
- const jsToken = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.JS_TOKEN);
38811
+ const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
38792
38812
  if (jsToken) {
38793
38813
  this.setJSToken(jsToken.value);
38794
38814
  window.ZJSBridge.setJSToken &&
38795
38815
  window.ZJSBridge.setJSToken(jsToken.value);
38796
38816
  }
38797
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_cookies, cookies);
38817
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies);
38798
38818
  resolve(cookies);
38799
38819
  })
38800
38820
  .catch((error) => {
@@ -38803,7 +38823,7 @@
38803
38823
  }
38804
38824
  });
38805
38825
  });
38806
- _ZaloMiniProgramSDK_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
38826
+ _ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
38807
38827
  this.getVersion = Basics.getVersion;
38808
38828
  this.getSystemInfo = Basics.getSystemInfo;
38809
38829
  this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
@@ -38861,80 +38881,81 @@
38861
38881
  this.onCallbackData = Routing.onCallbackData;
38862
38882
  this.getPhoneNumber = OpenApi.getPhoneNumber;
38863
38883
  this.openProfilePicker = Zalo.openProfilePicker;
38864
- _ZaloMiniProgramSDK_getActionsSupported.set(this, Zalo.getActionsSupported);
38884
+ _ZaloMiniProgramSDKService_getActionsSupported.set(this, Zalo.getActionsSupported);
38865
38885
  this.connectWifi = Device.connectWifi;
38866
38886
  this.openMediaPicker = Zalo.openMediaPicker;
38867
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
38868
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38869
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
38887
+ this.openOutApp = Zalo.openOutApp;
38888
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, null);
38889
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null);
38890
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null);
38870
38891
  this.isShowNavBar = true;
38871
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, 0);
38872
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, 0);
38873
- const showHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' ||
38874
- ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
38892
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0);
38893
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0);
38894
+ const showHomeButton = ((_b = (_a = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.leftButton) === 'home' ||
38895
+ ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
38875
38896
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
38876
38897
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
38877
38898
  const currentUrl = new URL(location.href);
38878
- const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor) &&
38879
- __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor.length > 0
38899
+ const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
38900
+ __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
38880
38901
  ? SHOW_ACTION_BAR
38881
38902
  : HIDE_ACTION_BAR;
38882
- const leftButtonType = ((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.leftButton) === 'none' ||
38883
- ((_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.leftButton) === 'home'
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'
38884
38905
  ? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
38885
38906
  : ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
38886
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_actionBarConfig, {
38907
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
38887
38908
  actionbarType: actionBarType,
38888
38909
  buttonType: leftButtonType,
38889
38910
  dataConfig: {
38890
- backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor || '',
38891
- textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.textColor || '',
38911
+ backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
38912
+ textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
38892
38913
  viewInLeftType: leftButtonType,
38893
38914
  confirmToExit: 1
38894
38915
  },
38895
38916
  homeConfig: {
38896
38917
  enable: showHomeButton,
38897
- url: `${CONFIG.MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38918
+ url: `${MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38898
38919
  }
38899
38920
  });
38900
38921
  }
38901
38922
  static getInstance() {
38902
- if (!ZaloMiniProgramSDK.instance) {
38903
- ZaloMiniProgramSDK.instance = new ZaloMiniProgramSDK();
38923
+ if (!ZaloMiniProgramSDKService.instance) {
38924
+ ZaloMiniProgramSDKService.instance = new ZaloMiniProgramSDKService();
38904
38925
  }
38905
- return ZaloMiniProgramSDK.instance;
38926
+ return ZaloMiniProgramSDKService.instance;
38906
38927
  }
38907
38928
  getLoginStatus() {
38908
- return lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) && __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken).length > 0;
38929
+ return lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) && __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken).length > 0;
38909
38930
  }
38910
38931
  getAppId() {
38911
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId);
38932
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId);
38912
38933
  }
38913
38934
  getZAppId() {
38914
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zAppId);
38935
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId);
38915
38936
  }
38916
38937
  login(object) {
38917
38938
  return __awaiter(this, void 0, void 0, function* () {
38918
- const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDK_callJump).call(this);
38919
- const zOAuthCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH);
38920
- const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH_VRF);
38939
+ const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump).call(this);
38940
+ const zOAuthCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH);
38941
+ const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH_VRF);
38921
38942
  if (!lodash.isUndefined(zOAuthCookie) &&
38922
38943
  !lodash.isNull(zOAuthCookie) &&
38923
38944
  lodash.isString(zOAuthCookie.value)) {
38924
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, zOAuthCookie.value);
38945
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, zOAuthCookie.value);
38925
38946
  if (!lodash.isUndefined(zOAuthVrfCookie) &&
38926
38947
  !lodash.isNull(zOAuthVrfCookie) &&
38927
38948
  lodash.isString(zOAuthVrfCookie.value)) {
38928
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, zOAuthVrfCookie.value);
38949
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, zOAuthVrfCookie.value);
38929
38950
  yield this.loginZaloV4();
38930
38951
  }
38931
38952
  else {
38932
38953
  yield this.loginZaloV3();
38933
38954
  }
38934
- if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) {
38955
+ if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) {
38935
38956
  throw apiResponse.error.loginFailed();
38936
38957
  }
38937
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
38958
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
38938
38959
  }
38939
38960
  throw apiResponse.error.loginFailed();
38940
38961
  });
@@ -38942,25 +38963,25 @@
38942
38963
  loginZaloV3() {
38943
38964
  return __awaiter(this, void 0, void 0, function* () {
38944
38965
  return yield axios
38945
- .get(CONFIG.APIS.GET_ACCESS_TOKEN_V3, {
38966
+ .get(APIS.GET_ACCESS_TOKEN_V3, {
38946
38967
  params: {
38947
- app_id: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zAppId),
38948
- redirect_uri: `${CONFIG.MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId)}/`,
38949
- code: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuth),
38968
+ app_id: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId),
38969
+ redirect_uri: `${MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId)}/`,
38970
+ code: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuth),
38950
38971
  isSDK: true
38951
38972
  }
38952
38973
  })
38953
38974
  .then((response) => {
38954
38975
  let resData = response.data;
38955
38976
  if (resData.access_token) {
38956
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, resData.access_token);
38977
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, resData.access_token);
38957
38978
  const expiresIn = parseInt(resData.expires_in) * 1000;
38958
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, expiresIn);
38959
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, new Date().getTime());
38960
- this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
38979
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, expiresIn);
38980
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, new Date().getTime());
38981
+ this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
38961
38982
  window.ZJSBridge.setZAccSession &&
38962
- window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
38963
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
38983
+ window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
38984
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
38964
38985
  }
38965
38986
  return null;
38966
38987
  });
@@ -38969,15 +38990,15 @@
38969
38990
  loginZaloV4() {
38970
38991
  return __awaiter(this, void 0, void 0, function* () {
38971
38992
  const inputData = new URLSearchParams();
38972
- inputData.append('app_id', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId));
38973
- inputData.append('code', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuth) || '');
38974
- inputData.append('code_verifier', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuthVrf) || '');
38975
- if (lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_refreshToken))) {
38993
+ inputData.append('app_id', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId));
38994
+ inputData.append('code', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuth) || '');
38995
+ inputData.append('code_verifier', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuthVrf) || '');
38996
+ if (lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_refreshToken))) {
38976
38997
  inputData.append('grant_type', 'authorization_code');
38977
38998
  }
38978
38999
  else {
38979
39000
  inputData.append('grant_type', 'refresh_token');
38980
- inputData.append('refresh_token', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_refreshToken) || '');
39001
+ inputData.append('refresh_token', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_refreshToken) || '');
38981
39002
  }
38982
39003
  const config = {
38983
39004
  headers: {
@@ -38985,21 +39006,21 @@
38985
39006
  }
38986
39007
  };
38987
39008
  return yield axios
38988
- .post(CONFIG.APIS.GET_ACCESS_TOKEN, inputData, config)
39009
+ .post(APIS.GET_ACCESS_TOKEN, inputData, config)
38989
39010
  .then((response) => {
38990
39011
  const resData = response.data;
38991
39012
  if (resData.refresh_token) {
38992
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_refreshToken, resData.refresh_token);
39013
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_refreshToken, resData.refresh_token);
38993
39014
  }
38994
39015
  if (resData.access_token) {
38995
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, resData.access_token);
39016
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, resData.access_token);
38996
39017
  const expiresIn = parseInt(resData.expires_in) * 1000;
38997
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, expiresIn);
38998
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, new Date().getTime());
38999
- this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
39018
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, expiresIn);
39019
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, new Date().getTime());
39020
+ this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
39000
39021
  window.ZJSBridge.setZAccSession &&
39001
- window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
39002
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
39022
+ window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
39023
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
39003
39024
  }
39004
39025
  return null;
39005
39026
  });
@@ -39007,43 +39028,43 @@
39007
39028
  }
39008
39029
  getAccessToken(object) {
39009
39030
  return __awaiter(this, void 0, void 0, function* () {
39010
- const deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp);
39011
- if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) {
39031
+ const deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp);
39032
+ if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) {
39012
39033
  throw apiResponse.error.loginRequired();
39013
39034
  }
39014
- if (deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDK_tokenExpiresIn))
39015
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
39035
+ if (deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_tokenExpiresIn))
39036
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
39016
39037
  return yield this.login();
39017
39038
  });
39018
39039
  }
39019
39040
  }
39020
- _ZaloMiniProgramSDK_zAppId = new WeakMap(), _ZaloMiniProgramSDK_appId = new WeakMap(), _ZaloMiniProgramSDK_appConfig = new WeakMap(), _ZaloMiniProgramSDK_zOAuth = new WeakMap(), _ZaloMiniProgramSDK_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDK_accessToken = new WeakMap(), _ZaloMiniProgramSDK_refreshToken = new WeakMap(), _ZaloMiniProgramSDK_cache = new WeakMap(), _ZaloMiniProgramSDK_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDK_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDK_cookies = new WeakMap(), _ZaloMiniProgramSDK_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDK_callJump = new WeakMap(), _ZaloMiniProgramSDK_setNavigationBarRightButton = new WeakMap(), _ZaloMiniProgramSDK_getActionsSupported = new WeakMap();
39041
+ _ZaloMiniProgramSDKService_zAppId = new WeakMap(), _ZaloMiniProgramSDKService_appId = new WeakMap(), _ZaloMiniProgramSDKService_appConfig = new WeakMap(), _ZaloMiniProgramSDKService_zOAuth = new WeakMap(), _ZaloMiniProgramSDKService_zOAuthVrf = new WeakMap(), _ZaloMiniProgramSDKService_accessToken = new WeakMap(), _ZaloMiniProgramSDKService_refreshToken = new WeakMap(), _ZaloMiniProgramSDKService_cache = new WeakMap(), _ZaloMiniProgramSDKService_prevGetTokenTimestamp = new WeakMap(), _ZaloMiniProgramSDKService_tokenExpiresIn = new WeakMap(), _ZaloMiniProgramSDKService_cookies = new WeakMap(), _ZaloMiniProgramSDKService_actionBarConfig = new WeakMap(), _ZaloMiniProgramSDKService_callJump = new WeakMap(), _ZaloMiniProgramSDKService_setNavigationBarRightButton = new WeakMap(), _ZaloMiniProgramSDKService_getActionsSupported = new WeakMap();
39021
39042
 
39022
- var _MockSDK_appId, _MockSDK_appConfig, _MockSDK_zOAuth, _MockSDK_accessToken, _MockSDK_cache, _MockSDK_loggedId;
39023
- class MockSDK {
39043
+ var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
39044
+ class MockSDKService {
39024
39045
  constructor() {
39025
- _MockSDK_appId.set(this, ZAPP_ID);
39026
- _MockSDK_appConfig.set(this, APP_CONFIG);
39027
- _MockSDK_zOAuth.set(this, 'DEFAULT ZOAUTH');
39028
- _MockSDK_accessToken.set(this, 'DEFAULT ACCESS TOKEN');
39029
- _MockSDK_cache.set(this, {
39046
+ _MockSDKService_appId.set(this, ZAPP_ID);
39047
+ _MockSDKService_appConfig.set(this, APP_CONFIG);
39048
+ _MockSDKService_zOAuth.set(this, 'DEFAULT ZOAUTH');
39049
+ _MockSDKService_accessToken.set(this, 'DEFAULT ACCESS TOKEN');
39050
+ _MockSDKService_cache.set(this, {
39030
39051
  timer: {
39031
39052
  getToken: 0
39032
39053
  }
39033
39054
  });
39034
- _MockSDK_loggedId.set(this, false);
39055
+ _MockSDKService_loggedId.set(this, false);
39035
39056
  this.getLoginStatus = () => {
39036
- return __classPrivateFieldGet(this, _MockSDK_loggedId);
39057
+ return __classPrivateFieldGet(this, _MockSDKService_loggedId);
39037
39058
  };
39038
39059
  this.getAppId = () => {
39039
- return __classPrivateFieldGet(this, _MockSDK_appId);
39060
+ return __classPrivateFieldGet(this, _MockSDKService_appId);
39040
39061
  };
39041
39062
  this.login = () => {
39042
- __classPrivateFieldSet(this, _MockSDK_loggedId, true);
39043
- return Promise.resolve(__classPrivateFieldGet(this, _MockSDK_zOAuth));
39063
+ __classPrivateFieldSet(this, _MockSDKService_loggedId, true);
39064
+ return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth));
39044
39065
  };
39045
39066
  this.getAccessToken = () => {
39046
- return Promise.resolve(__classPrivateFieldGet(this, _MockSDK_accessToken));
39067
+ return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_accessToken));
39047
39068
  };
39048
39069
  this.getVersion = Basics.getVersion;
39049
39070
  this.getSystemInfo = Basics.getSystemInfo;
@@ -39330,6 +39351,10 @@
39330
39351
  console.warn('This api only works on zalo app');
39331
39352
  return Promise.resolve();
39332
39353
  };
39354
+ this.openOutApp = (url) => {
39355
+ location.href = url;
39356
+ return Promise.resolve();
39357
+ };
39333
39358
  }
39334
39359
  on(event, fn, context) {
39335
39360
  throw new Error('Method not implemented.');
@@ -39350,7 +39375,7 @@
39350
39375
  });
39351
39376
  }
39352
39377
  }
39353
- _MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap(), _MockSDK_loggedId = new WeakMap();
39378
+ _MockSDKService_appId = new WeakMap(), _MockSDKService_appConfig = new WeakMap(), _MockSDKService_zOAuth = new WeakMap(), _MockSDKService_accessToken = new WeakMap(), _MockSDKService_cache = new WeakMap(), _MockSDKService_loggedId = new WeakMap();
39354
39379
 
39355
39380
  /*! *****************************************************************************
39356
39381
  Copyright (C) Microsoft. All rights reserved.
@@ -40586,12 +40611,12 @@
40586
40611
  return descriptor;
40587
40612
  };
40588
40613
 
40589
- var _SDKCreator_sdkManager;
40614
+ var _SDKCreator_sdkService;
40590
40615
  class SDKCreator {
40591
40616
  constructor() {
40592
40617
  this.events = ZMPEEmitter.getInstance();
40593
- _SDKCreator_sdkManager.set(this, void 0);
40594
- __classPrivateFieldSet(this, _SDKCreator_sdkManager, this.getInstance());
40618
+ _SDKCreator_sdkService.set(this, void 0);
40619
+ __classPrivateFieldSet(this, _SDKCreator_sdkService, this.getServiceInstance());
40595
40620
  this.events.addListener = (event, fn, context) => {
40596
40621
  const stringifyEventName = event;
40597
40622
  return this.events.addListener(Events[stringifyEventName], fn, context);
@@ -40614,11 +40639,11 @@
40614
40639
  */
40615
40640
  login(object) {
40616
40641
  return __awaiter(this, void 0, void 0, function* () {
40617
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).login(object);
40642
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).login(object);
40618
40643
  });
40619
40644
  }
40620
40645
  getLoginStatus() {
40621
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getLoginStatus();
40646
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getLoginStatus();
40622
40647
  }
40623
40648
  /**
40624
40649
  * Get Access Token.
@@ -40637,248 +40662,266 @@
40637
40662
  */
40638
40663
  getAccessToken(object) {
40639
40664
  return __awaiter(this, void 0, void 0, function* () {
40640
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getAccessToken(object);
40665
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getAccessToken(object);
40641
40666
  });
40642
40667
  }
40643
40668
  getVersion() {
40644
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getVersion();
40669
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getVersion();
40645
40670
  }
40646
40671
  getSystemInfo() {
40647
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getSystemInfo();
40672
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getSystemInfo();
40648
40673
  }
40649
40674
  setNavigationBarTitle(object) {
40650
40675
  return __awaiter(this, void 0, void 0, function* () {
40651
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarTitle(object);
40676
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarTitle(object);
40652
40677
  });
40653
40678
  }
40654
40679
  setNavigationBarColor(object) {
40655
40680
  return __awaiter(this, void 0, void 0, function* () {
40656
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarColor(object);
40681
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarColor(object);
40657
40682
  });
40658
40683
  }
40659
40684
  setBackgroundColor(object) {
40660
40685
  return __awaiter(this, void 0, void 0, function* () {
40661
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setBackgroundColor(object);
40686
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setBackgroundColor(object);
40662
40687
  });
40663
40688
  }
40664
40689
  setNavigationBarLeftButton(object) {
40665
40690
  return __awaiter(this, void 0, void 0, function* () {
40666
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarLeftButton(object);
40691
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarLeftButton(object);
40667
40692
  });
40668
40693
  }
40669
40694
  setDeviceOrientation(object) {
40670
40695
  return __awaiter(this, void 0, void 0, function* () {
40671
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setDeviceOrientation(object);
40696
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setDeviceOrientation(object);
40672
40697
  });
40673
40698
  }
40674
40699
  setStorage(object) {
40675
40700
  return __awaiter(this, void 0, void 0, function* () {
40676
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setStorage(object);
40701
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setStorage(object);
40677
40702
  });
40678
40703
  }
40679
40704
  getStorage(object) {
40680
40705
  return __awaiter(this, void 0, void 0, function* () {
40681
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getStorage(object);
40706
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getStorage(object);
40682
40707
  });
40683
40708
  }
40684
40709
  getStorageInfo(object) {
40685
40710
  return __awaiter(this, void 0, void 0, function* () {
40686
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getStorageInfo(object);
40711
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getStorageInfo(object);
40687
40712
  });
40688
40713
  }
40689
40714
  removeStorage(object) {
40690
40715
  return __awaiter(this, void 0, void 0, function* () {
40691
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).removeStorage(object);
40716
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).removeStorage(object);
40692
40717
  });
40693
40718
  }
40694
40719
  clearStorage(object) {
40695
40720
  return __awaiter(this, void 0, void 0, function* () {
40696
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).clearStorage(object);
40721
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).clearStorage(object);
40697
40722
  });
40698
40723
  }
40699
40724
  getUserInfo(object) {
40700
40725
  return __awaiter(this, void 0, void 0, function* () {
40701
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getUserInfo(object);
40726
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getUserInfo(object);
40702
40727
  });
40703
40728
  }
40704
40729
  getNetworkType(object) {
40705
40730
  return __awaiter(this, void 0, void 0, function* () {
40706
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getNetworkType(object);
40731
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getNetworkType(object);
40707
40732
  });
40708
40733
  }
40709
40734
  onNetworkStatusChange(callback) {
40710
40735
  return __awaiter(this, void 0, void 0, function* () {
40711
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onNetworkStatusChange(callback);
40736
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onNetworkStatusChange(callback);
40712
40737
  });
40713
40738
  }
40714
40739
  startBeaconDiscovery(object) {
40715
40740
  return __awaiter(this, void 0, void 0, function* () {
40716
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).startBeaconDiscovery(object);
40741
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).startBeaconDiscovery(object);
40717
40742
  });
40718
40743
  }
40719
40744
  stopBeaconDiscovery(object) {
40720
40745
  return __awaiter(this, void 0, void 0, function* () {
40721
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).stopBeaconDiscovery(object);
40746
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).stopBeaconDiscovery(object);
40722
40747
  });
40723
40748
  }
40724
40749
  getBeacons(object) {
40725
40750
  return __awaiter(this, void 0, void 0, function* () {
40726
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBeacons(object);
40751
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBeacons(object);
40727
40752
  });
40728
40753
  }
40729
40754
  closeApp(object) {
40730
40755
  return __awaiter(this, void 0, void 0, function* () {
40731
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).closeApp(object);
40756
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeApp(object);
40732
40757
  });
40733
40758
  }
40734
40759
  getLocation(object) {
40735
40760
  return __awaiter(this, void 0, void 0, function* () {
40736
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getLocation(object);
40761
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getLocation(object);
40737
40762
  });
40738
40763
  }
40739
40764
  stopBluetoothDevicesDiscovery() {
40740
40765
  return __awaiter(this, void 0, void 0, function* () {
40741
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).stopBluetoothDevicesDiscovery();
40766
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).stopBluetoothDevicesDiscovery();
40742
40767
  });
40743
40768
  }
40744
40769
  startBluetoothDevicesDiscovery(object) {
40745
40770
  return __awaiter(this, void 0, void 0, function* () {
40746
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).startBluetoothDevicesDiscovery(object);
40771
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).startBluetoothDevicesDiscovery(object);
40747
40772
  });
40748
40773
  }
40749
40774
  openBluetoothAdapter() {
40750
40775
  return __awaiter(this, void 0, void 0, function* () {
40751
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openBluetoothAdapter();
40776
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openBluetoothAdapter();
40752
40777
  });
40753
40778
  }
40754
40779
  onBluetoothDeviceFound() {
40755
40780
  return __awaiter(this, void 0, void 0, function* () {
40756
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onBluetoothDeviceFound();
40781
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onBluetoothDeviceFound();
40757
40782
  });
40758
40783
  }
40759
40784
  onBluetoothAdapterStateChange() {
40760
40785
  return __awaiter(this, void 0, void 0, function* () {
40761
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onBluetoothAdapterStateChange();
40786
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onBluetoothAdapterStateChange();
40762
40787
  });
40763
40788
  }
40764
40789
  getConnectedBluetoothDevices(object) {
40765
40790
  return __awaiter(this, void 0, void 0, function* () {
40766
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getConnectedBluetoothDevices(object);
40791
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getConnectedBluetoothDevices(object);
40767
40792
  });
40768
40793
  }
40769
40794
  getBluetoothDevices() {
40770
40795
  return __awaiter(this, void 0, void 0, function* () {
40771
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBluetoothDevices();
40796
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBluetoothDevices();
40772
40797
  });
40773
40798
  }
40774
40799
  getBluetoothAdapterState() {
40775
40800
  return __awaiter(this, void 0, void 0, function* () {
40776
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBluetoothAdapterState();
40801
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBluetoothAdapterState();
40777
40802
  });
40778
40803
  }
40779
40804
  closeBluetoothAdapter() {
40780
40805
  return __awaiter(this, void 0, void 0, function* () {
40781
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).closeBluetoothAdapter();
40806
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeBluetoothAdapter();
40782
40807
  });
40783
40808
  }
40784
40809
  scanQRCode(object) {
40785
40810
  return __awaiter(this, void 0, void 0, function* () {
40786
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).scanQRCode(object);
40811
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).scanQRCode(object);
40787
40812
  });
40788
40813
  }
40789
40814
  openProfile(object) {
40790
40815
  return __awaiter(this, void 0, void 0, function* () {
40791
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfile(object);
40816
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openProfile(object);
40792
40817
  });
40793
40818
  }
40794
40819
  openChat(object) {
40795
40820
  return __awaiter(this, void 0, void 0, function* () {
40796
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openChat(object);
40821
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openChat(object);
40797
40822
  });
40798
40823
  }
40799
40824
  openPostFeed(object) {
40800
40825
  return __awaiter(this, void 0, void 0, function* () {
40801
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openPostFeed(object);
40826
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openPostFeed(object);
40802
40827
  });
40803
40828
  }
40804
40829
  followOA(object) {
40805
40830
  return __awaiter(this, void 0, void 0, function* () {
40806
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).followOA(object);
40831
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).followOA(object);
40807
40832
  });
40808
40833
  }
40809
40834
  unfollowOA(object) {
40810
40835
  return __awaiter(this, void 0, void 0, function* () {
40811
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).unFollowOA(object);
40836
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).unFollowOA(object);
40812
40837
  });
40813
40838
  }
40814
40839
  openShareSheet(object) {
40815
40840
  return __awaiter(this, void 0, void 0, function* () {
40816
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openShareSheet(object);
40841
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openShareSheet(object);
40817
40842
  });
40818
40843
  }
40819
40844
  requestCameraPermission(object) {
40820
40845
  return __awaiter(this, void 0, void 0, function* () {
40821
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).requestCameraPermission(object);
40846
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).requestCameraPermission(object);
40822
40847
  });
40823
40848
  }
40824
40849
  createShortcut(object) {
40825
40850
  return __awaiter(this, void 0, void 0, function* () {
40826
- 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
40859
+ ? new URLSearchParams(object.params)
40860
+ : new URLSearchParams();
40861
+ if (isIOS) {
40862
+ searchParams.append('appId', APP_ID);
40863
+ searchParams.append('appName', title);
40864
+ searchParams.append('appIcon', iconURL);
40865
+ const iosShortcutURL = `https://mini.zalo.me/shortcut.html?${searchParams.toString()}`;
40866
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openOutApp(encodeURI(iosShortcutURL));
40867
+ }
40868
+ else
40869
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).createShortcut(`${MINI_APP_LINK}/${APP_ID}/?${searchParams.toString()}`, title, iconURL);
40827
40870
  });
40828
40871
  }
40829
40872
  openBioAuthentication(object) {
40830
40873
  return __awaiter(this, void 0, void 0, function* () {
40831
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openBioAuthentication(object);
40874
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openBioAuthentication(object);
40832
40875
  });
40833
40876
  }
40834
40877
  checkStateBioAuthentication(object) {
40835
40878
  return __awaiter(this, void 0, void 0, function* () {
40836
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).checkStateBioAuthentication(object);
40879
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).checkStateBioAuthentication(object);
40837
40880
  });
40838
40881
  }
40839
40882
  sendLocation(object) {
40840
40883
  return __awaiter(this, void 0, void 0, function* () {
40841
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).sendLocation(object);
40884
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).sendLocation(object);
40842
40885
  });
40843
40886
  }
40844
40887
  showToast(object) {
40845
40888
  return __awaiter(this, void 0, void 0, function* () {
40846
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).showToast(object);
40889
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).showToast(object);
40847
40890
  });
40848
40891
  }
40849
40892
  hideKeyboard(object) {
40850
40893
  return __awaiter(this, void 0, void 0, function* () {
40851
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).hideKeyboard(object);
40894
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).hideKeyboard(object);
40852
40895
  });
40853
40896
  }
40854
40897
  openPhone(object) {
40855
40898
  return __awaiter(this, void 0, void 0, function* () {
40856
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openPhone(object);
40899
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openPhone(object);
40857
40900
  });
40858
40901
  }
40859
40902
  openSMS(object) {
40860
40903
  return __awaiter(this, void 0, void 0, function* () {
40861
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openSMS(object);
40904
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openSMS(object);
40862
40905
  });
40863
40906
  }
40864
40907
  viewOAQr(object) {
40865
40908
  return __awaiter(this, void 0, void 0, function* () {
40866
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).viewOAQr(object);
40909
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).viewOAQr(object);
40867
40910
  });
40868
40911
  }
40869
40912
  keepScreen(object) {
40870
40913
  return __awaiter(this, void 0, void 0, function* () {
40871
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).keepScreen(object);
40914
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).keepScreen(object);
40872
40915
  });
40873
40916
  }
40874
40917
  saveImageToGallery(object) {
40875
40918
  return __awaiter(this, void 0, void 0, function* () {
40876
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40919
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).saveImageToPhotosAlbum(object);
40877
40920
  });
40878
40921
  }
40879
40922
  saveImageToPhotosAlbum(object) {
40880
40923
  return __awaiter(this, void 0, void 0, function* () {
40881
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40924
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).saveImageToPhotosAlbum(object);
40882
40925
  });
40883
40926
  }
40884
40927
  openMiniApp(object) {
@@ -40893,46 +40936,46 @@
40893
40936
  });
40894
40937
  object.params = params;
40895
40938
  }
40896
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openMiniApp(object);
40939
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openMiniApp(object);
40897
40940
  });
40898
40941
  }
40899
40942
  vibrate(object) {
40900
40943
  return __awaiter(this, void 0, void 0, function* () {
40901
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).vibrate(object);
40944
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).vibrate(object);
40902
40945
  });
40903
40946
  }
40904
40947
  openWebview(object) {
40905
40948
  return __awaiter(this, void 0, void 0, function* () {
40906
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openWebview(object);
40949
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openWebview(object);
40907
40950
  });
40908
40951
  }
40909
40952
  getRouteParams() {
40910
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getRouteParams();
40953
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getRouteParams();
40911
40954
  }
40912
40955
  getAppInfo(object) {
40913
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getAppInfo();
40956
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getAppInfo();
40914
40957
  }
40915
40958
  sendDataToPreviousMiniApp(object) {
40916
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).sendDataToPreviousMiniApp(object);
40959
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).sendDataToPreviousMiniApp(object);
40917
40960
  }
40918
40961
  onCallbackData(callback) {
40919
40962
  return __awaiter(this, void 0, void 0, function* () {
40920
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onCallbackData(callback);
40963
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onCallbackData(callback);
40921
40964
  });
40922
40965
  }
40923
40966
  getPhoneNumber(object) {
40924
40967
  return __awaiter(this, void 0, void 0, function* () {
40925
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getPhoneNumber();
40968
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getPhoneNumber();
40926
40969
  });
40927
40970
  }
40928
40971
  openProfilePicker(object) {
40929
40972
  return __awaiter(this, void 0, void 0, function* () {
40930
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfilePicker(object);
40973
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openProfilePicker(object);
40931
40974
  });
40932
40975
  }
40933
40976
  connectWifi(object) {
40934
40977
  return __awaiter(this, void 0, void 0, function* () {
40935
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).connectWifi(object);
40978
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).connectWifi(object);
40936
40979
  });
40937
40980
  }
40938
40981
  openMediaPicker(object) {
@@ -40948,7 +40991,7 @@
40948
40991
  editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
40949
40992
  const silentRequest = object.silentRequest === true ? 1 : 0;
40950
40993
  const maxSelectItem = object.maxSelectItem;
40951
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
40994
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
40952
40995
  });
40953
40996
  }
40954
40997
  getShareableLink(object) {
@@ -40959,7 +41002,7 @@
40959
41002
  });
40960
41003
  }
40961
41004
  }
40962
- _SDKCreator_sdkManager = new WeakMap();
41005
+ _SDKCreator_sdkService = new WeakMap();
40963
41006
  __decorate([
40964
41007
  handleError
40965
41008
  ], SDKCreator.prototype, "login", null);
@@ -41365,13 +41408,13 @@
41365
41408
  }))
41366
41409
  ], SDKCreator.prototype, "getShareableLink", null);
41367
41410
  class ZaloMiniAppSDKCreator extends SDKCreator {
41368
- getInstance() {
41369
- return ZaloMiniProgramSDK.getInstance();
41411
+ getServiceInstance() {
41412
+ return ZaloMiniProgramSDKService.getInstance();
41370
41413
  }
41371
41414
  }
41372
41415
  class MockSDKCreator extends SDKCreator {
41373
- getInstance() {
41374
- return new MockSDK();
41416
+ getServiceInstance() {
41417
+ return new MockSDKService();
41375
41418
  }
41376
41419
  }
41377
41420