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.
package/dist/index.es.js CHANGED
@@ -34927,12 +34927,39 @@ const readCookieFallback = (name) => {
34927
34927
  return ck;
34928
34928
  };
34929
34929
 
34930
+ const Byte = 1;
34931
+ const KB = 1024 * Byte;
34932
+ const MB = 1024 * KB;
34930
34933
  const ZAPP_ID = window.zAppID;
34931
34934
  const APP_ID = window.APP_ID;
34932
34935
  const APP_CONFIG = window.APP_CONFIG || {};
34936
+ const MINI_APP_LINK = 'https://zalo.me/app/link/zapps';
34937
+ const MINI_APP_INTERNAL_LINK = 'https://h5.zdn.vn/zapps';
34938
+ const COOKIE_NAME = {
34939
+ ZOAUTH: `h5.zdn.vn_zoauth`,
34940
+ ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
34941
+ JS_TOKEN: `h5.zdn.vn_zlink3rd`,
34942
+ ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`
34943
+ };
34944
+ const APIS = {
34945
+ GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
34946
+ GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
34947
+ GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token'
34948
+ };
34949
+ const STORAGE_LIMIT = 5 * MB;
34950
+ const NETWORK_TYPE = (isAndroid) => ({
34951
+ NONE: isAndroid ? -2 : 0,
34952
+ WIFI: isAndroid ? 0 : 1,
34953
+ '2G': isAndroid ? 2 : 2,
34954
+ '3G': isAndroid ? 15 : 2,
34955
+ '4G': isAndroid ? 13 : 2
34956
+ });
34957
+ const MEDIA_PICKER_LIMIT = 1 * MB;
34958
+ const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
34933
34959
  const ACTION = {
34934
34960
  GET_DOWNLOADED_STICKER: {
34935
- name: 'action.get.downloaded.sticker'
34961
+ name: 'action.get.downloaded.sticker',
34962
+ have_callback: true
34936
34963
  },
34937
34964
  OPEN_SHARE_STICKER: {
34938
34965
  name: 'action.open.share.sticker'
@@ -35022,19 +35049,23 @@ const ACTION = {
35022
35049
  name: 'action.open.sendsticker'
35023
35050
  },
35024
35051
  REPORT_ABUSE: {
35025
- name: 'action.report.abuse'
35052
+ name: 'action.report.abuse',
35053
+ have_callback: true
35026
35054
  },
35027
35055
  FOLLOW_OA: {
35028
- name: 'action.follow.oa'
35056
+ name: 'action.follow.oa',
35057
+ have_callback: true
35029
35058
  },
35030
35059
  UNFOLLOW_OA: {
35031
- name: 'action.unfollow.oa'
35060
+ name: 'action.unfollow.oa',
35061
+ have_callback: true
35032
35062
  },
35033
35063
  OPEN_GAMEDETAIL: {
35034
35064
  name: 'action.open.gamedetail'
35035
35065
  },
35036
35066
  OPEN_SHARESHEET: {
35037
- name: 'action.open.sharesheet'
35067
+ name: 'action.open.sharesheet',
35068
+ have_callback: true
35038
35069
  },
35039
35070
  REQUEST_PERMISSION_CAMERA: {
35040
35071
  name: 'action.request.permission.camera'
@@ -35061,18 +35092,21 @@ const ACTION = {
35061
35092
  },
35062
35093
  CREATE_OPTIONS_MENU: {
35063
35094
  name: 'action.create.options.menu',
35064
- skip_jump: true
35095
+ skip_jump: true,
35096
+ have_callback: true
35065
35097
  },
35066
35098
  CREATE_SHORTCUT: {
35067
35099
  name: 'action.create.shortcut'
35068
35100
  },
35069
35101
  CHANGE_ACTIONBAR_LEFTBUTTON_TYPE: {
35070
35102
  name: 'action.change.actionbar.leftbutton.type',
35071
- skip_jump: true
35103
+ skip_jump: true,
35104
+ have_callback: true
35072
35105
  },
35073
35106
  WINDOW_CLOSE: {
35074
35107
  name: 'action.window.close',
35075
- skip_jump: true
35108
+ skip_jump: true,
35109
+ have_callback: true
35076
35110
  },
35077
35111
  WEBVIEW_CHECKRESERROR: {
35078
35112
  name: 'action.webview.checkResError'
@@ -35085,7 +35119,8 @@ const ACTION = {
35085
35119
  },
35086
35120
  ZBROWSER_JSBRIDGE: {
35087
35121
  name: 'action.zbrowser.jsbridge',
35088
- skip_jump: true
35122
+ skip_jump: true,
35123
+ have_callback: true
35089
35124
  },
35090
35125
  PROMPT_AUTHENTICATION: {
35091
35126
  name: 'action.prompt.authentication'
@@ -35101,13 +35136,16 @@ const ACTION = {
35101
35136
  name: 'action.open.appstore'
35102
35137
  },
35103
35138
  GET_LOCATION: {
35104
- name: 'action.get.location'
35139
+ name: 'action.get.location',
35140
+ have_callback: true
35105
35141
  },
35106
35142
  QUERY_LOCATION_HIDE: {
35107
- name: 'action.query.location.hide'
35143
+ name: 'action.query.location.hide',
35144
+ have_callback: true
35108
35145
  },
35109
35146
  SHOW_TOAST: {
35110
- name: 'action.show.toast'
35147
+ name: 'action.show.toast',
35148
+ have_callback: true
35111
35149
  },
35112
35150
  OPEN_APP: {
35113
35151
  name: 'action.open.app'
@@ -35125,10 +35163,12 @@ const ACTION = {
35125
35163
  name: 'action.open.sms'
35126
35164
  },
35127
35165
  VIEW_MYQR: {
35128
- name: 'action.view.myqr'
35166
+ name: 'action.view.myqr',
35167
+ have_callback: true
35129
35168
  },
35130
35169
  KEEP_SCREEN: {
35131
- name: 'action.keep.screen'
35170
+ name: 'action.keep.screen',
35171
+ have_callback: true
35132
35172
  },
35133
35173
  CHANGE_AUTOROTATE: {
35134
35174
  name: 'action.change.autorotate',
@@ -35147,25 +35187,31 @@ const ACTION = {
35147
35187
  name: 'action.open.inapprw'
35148
35188
  },
35149
35189
  ZALORUN_GETTRACKINGSTATUS: {
35150
- name: 'action.zalorun.getTrackingStatus'
35190
+ name: 'action.zalorun.getTrackingStatus',
35191
+ have_callback: true
35151
35192
  },
35152
35193
  ZALORUN_SETTRACKINGSTATUS: {
35153
- name: 'action.zalorun.setTrackingStatus'
35194
+ name: 'action.zalorun.setTrackingStatus',
35195
+ have_callback: true
35154
35196
  },
35155
35197
  ZALORUN_GETDAYSTEP: {
35156
- name: 'action.zalorun.getDayStep'
35198
+ name: 'action.zalorun.getDayStep',
35199
+ have_callback: true
35157
35200
  },
35158
35201
  ZALORUN_FORCESUBMITDATA: {
35159
- name: 'action.zalorun.forceSubmitData'
35202
+ name: 'action.zalorun.forceSubmitData',
35203
+ have_callback: true
35160
35204
  },
35161
35205
  ZALORUN_SETWEIGHT: {
35162
- name: 'action.zalorun.setWeight'
35206
+ name: 'action.zalorun.setWeight',
35207
+ have_callback: true
35163
35208
  },
35164
35209
  OPEN_PROFILE_EXT: {
35165
35210
  name: 'action.open.profile.ext'
35166
35211
  },
35167
35212
  DOWNLOAD_CATE: {
35168
- name: 'action.download.cate'
35213
+ name: 'action.download.cate',
35214
+ have_callback: true
35169
35215
  },
35170
35216
  JUMP_LOGIN: {
35171
35217
  name: 'action.jump.login',
@@ -35231,28 +35277,6 @@ const ACTION = {
35231
35277
  version_live: { iOS: 999 }
35232
35278
  }
35233
35279
  };
35234
- const ACTION_HAVE_CALLBACK = [
35235
- ACTION.GET_DOWNLOADED_STICKER.name,
35236
- ACTION.REPORT_ABUSE.name,
35237
- ACTION.FOLLOW_OA.name,
35238
- ACTION.UNFOLLOW_OA.name,
35239
- ACTION.OPEN_SHARESHEET.name,
35240
- ACTION.CREATE_OPTIONS_MENU.name,
35241
- ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name,
35242
- ACTION.WINDOW_CLOSE.name,
35243
- ACTION.ZBROWSER_JSBRIDGE.name,
35244
- ACTION.GET_LOCATION.name,
35245
- ACTION.QUERY_LOCATION_HIDE.name,
35246
- ACTION.SHOW_TOAST.name,
35247
- ACTION.VIEW_MYQR.name,
35248
- ACTION.KEEP_SCREEN.name,
35249
- ACTION.ZALORUN_GETTRACKINGSTATUS.name,
35250
- ACTION.ZALORUN_SETTRACKINGSTATUS.name,
35251
- ACTION.ZALORUN_GETDAYSTEP.name,
35252
- ACTION.ZALORUN_FORCESUBMITDATA.name,
35253
- ACTION.ZALORUN_SETWEIGHT.name,
35254
- ACTION.DOWNLOAD_CATE.name
35255
- ];
35256
35280
  const RESPONSE_CODE = {
35257
35281
  BAD_REQUEST: -1400,
35258
35282
  INTERNAL_SERVER_ERROR: -1500,
@@ -35508,6 +35532,96 @@ const apiResponse = {
35508
35532
  }
35509
35533
  };
35510
35534
 
35535
+ function encode(bag) {
35536
+ var pairs = [];
35537
+ for (var key in bag) {
35538
+ if (bag.hasOwnProperty(key)) {
35539
+ var value = bag[key];
35540
+ if (typeof value === "undefined") {
35541
+ return;
35542
+ }
35543
+ if (value === null) {
35544
+ pairs.push(key);
35545
+ return;
35546
+ }
35547
+ pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
35548
+ }
35549
+ }
35550
+ return pairs.join("&");
35551
+ }
35552
+ function decode(str, strict) {
35553
+ var data = {};
35554
+ if (str === "") {
35555
+ return data;
35556
+ }
35557
+ var pairs = str.split("&");
35558
+ for (var i = 0; i < pairs.length; i++) {
35559
+ var pair = pairs[i].split("=", 2);
35560
+ var key = decodeURIComponent(pair[0]);
35561
+ if (strict && Object.prototype.hasOwnProperty.call(data, key)) {
35562
+ throw new URIError("Duplicate key: " + key);
35563
+ }
35564
+ data[key] = pair.length === 2 ? decodeURIComponent(pair[1]) : null;
35565
+ }
35566
+ return data;
35567
+ }
35568
+ function appendToUrl(url, params) {
35569
+ return (url +
35570
+ (url.indexOf("?") !== -1 ? "&" : "?") +
35571
+ (typeof params === "string" ? params : QueryString.encode(params)));
35572
+ }
35573
+ function getParameterByName(name, url) {
35574
+ if (!url) {
35575
+ url = window.location.href;
35576
+ }
35577
+ name = name.replace(/[\[\]]/g, "\\$&");
35578
+ var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
35579
+ if (!results)
35580
+ return null;
35581
+ if (!results[2])
35582
+ return "";
35583
+ return decodeURIComponent(results[2].replace(/\+/g, " "));
35584
+ }
35585
+ function getParamsAsObject(query) {
35586
+ var params = {};
35587
+ if (!query)
35588
+ return params;
35589
+ var values = query.split("&");
35590
+ values.map(function (item) {
35591
+ var data = item.split("=");
35592
+ if (!data || data.length != 2)
35593
+ return;
35594
+ params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
35595
+ });
35596
+ return params;
35597
+ }
35598
+ function toQueryString(data) {
35599
+ if (!data)
35600
+ return "";
35601
+ if ((typeof data === "undefined" ? "undefined" : typeof (data)) != "object")
35602
+ return data;
35603
+ var key = Object.keys(data);
35604
+ var params = [];
35605
+ key.map(function (k) {
35606
+ var v = data[k];
35607
+ if ((typeof v === "undefined" ? "undefined" : typeof (v)) == "object")
35608
+ v = JSON.stringify(v);
35609
+ else
35610
+ v = encodeURIComponent(v);
35611
+ var item = [k, v].join("=");
35612
+ params.push(item);
35613
+ });
35614
+ return params.join("&");
35615
+ }
35616
+ const QueryString = {
35617
+ encode: encode,
35618
+ decode: decode,
35619
+ appendToUrl: appendToUrl,
35620
+ getParameterByName: getParameterByName,
35621
+ getParamsAsObject: getParamsAsObject,
35622
+ toQueryString: toQueryString,
35623
+ };
35624
+
35511
35625
  const REGEXP_SPECIAL_UNICODE = new RegExp('[\\u0300-\\u036f]', 'g');
35512
35626
  const REGEXP_ACCENT_D = new RegExp('[đ|Đ]', 'g');
35513
35627
  const REGEXP_SPACES = new RegExp('\\s', 'g');
@@ -35728,13 +35842,12 @@ const stringToData = (data) => {
35728
35842
  }
35729
35843
  };
35730
35844
  const checkIOSSupportAction = (action) => {
35731
- var _a, _b;
35732
- const key = action.slice(7, action.length).replace(/\./gi, '_').toUpperCase();
35845
+ var _a;
35733
35846
  const zaloIOSVersion = getZaloVersion();
35734
- const actionVersionLive = ((_b = (_a = ACTION[key]) === null || _a === void 0 ? void 0 : _a.version_live) === null || _b === void 0 ? void 0 : _b.iOS) || 0;
35847
+ const actionVersionLive = ((_a = action === null || action === void 0 ? void 0 : action.version_live) === null || _a === void 0 ? void 0 : _a.iOS) || 0;
35735
35848
  if (Array.isArray(window.ignoreCheckSupport) &&
35736
35849
  window.ignoreCheckSupport.length > 0 &&
35737
- window.ignoreCheckSupport.includes(action)) {
35850
+ window.ignoreCheckSupport.includes(action.name)) {
35738
35851
  return true;
35739
35852
  }
35740
35853
  return zaloIOSVersion >= actionVersionLive;
@@ -35816,7 +35929,36 @@ const checkData = (types, option) => (data) => {
35816
35929
  return {
35817
35930
  error: false
35818
35931
  };
35819
- };
35932
+ };
35933
+ const getAppInfo = (appId, versionStatus, currentVersion) => __awaiter(void 0, void 0, void 0, function* () {
35934
+ const inputData = {
35935
+ appId,
35936
+ versionStatus
35937
+ };
35938
+ if (!lodash.isUndefined(currentVersion)) {
35939
+ inputData.currentVersion = currentVersion;
35940
+ }
35941
+ const api = QueryString.appendToUrl(`${API_DOMAIN}${H5_API.GET_APP_INFO}`, inputData);
35942
+ const msgApi = yield fetch(api, {
35943
+ credentials: 'include'
35944
+ });
35945
+ if (msgApi.ok) {
35946
+ const appInfo = yield msgApi.json();
35947
+ if (appInfo.err < 0 || !appInfo.data) {
35948
+ throw new Error(appInfo);
35949
+ }
35950
+ const info = {
35951
+ name: appInfo.data.name,
35952
+ version: appInfo.data.version,
35953
+ description: appInfo.data.description,
35954
+ appUrl: appInfo.data.appUrl,
35955
+ qrCodeUrl: appInfo.data.qrCodeUrl,
35956
+ logoUrl: appInfo.data.logoUrl
35957
+ };
35958
+ return info;
35959
+ }
35960
+ throw new Error("Can't get app info");
35961
+ });
35820
35962
 
35821
35963
  var eventemitter3 = createCommonjsModule(function (module) {
35822
35964
 
@@ -36188,129 +36330,6 @@ class ZMPEEmitter extends eventemitter3 {
36188
36330
  }
36189
36331
  }
36190
36332
 
36191
- var CONFIG = (() => {
36192
- const Byte = 1;
36193
- const KB = 1024 * Byte;
36194
- const MB = 1024 * KB;
36195
- const device = checkPlatform();
36196
- return {
36197
- MINI_APP_LINK: 'https://zalo.me/app/link/zapps',
36198
- MINI_APP_INTERNAL_LINK: 'https://h5.zdn.vn/zapps',
36199
- COOKIE_NAME: {
36200
- ZOAUTH: `h5.zdn.vn_zoauth`,
36201
- ZACC_SESSiON: `h5.zdn.vn_zacc_session`,
36202
- JS_TOKEN: `h5.zdn.vn_zlink3rd`,
36203
- ZOAUTH_VRF: `h5.zdn.vn_zoauth_vrf`
36204
- },
36205
- APIS: {
36206
- GET_USER_INFO: 'https://graph.zalo.me/v2.0/me',
36207
- GET_ACCESS_TOKEN: 'https://h5.zalo.me/openapi/access_token',
36208
- GET_ACCESS_TOKEN_V3: 'https://oauth.zaloapp.com/v3/access_token'
36209
- },
36210
- STORAGE_DATA_LIMIT: 100 * KB,
36211
- STORAGE_LIMIT: 5 * MB,
36212
- NETWORK_TYPE: {
36213
- NONE: device.isAndroid ? -2 : 0,
36214
- WIFI: device.isAndroid ? 0 : 1,
36215
- '2G': device.isAndroid ? 2 : 2,
36216
- '3G': device.isAndroid ? 15 : 2,
36217
- '4G': device.isAndroid ? 13 : 2
36218
- },
36219
- MEDIA_PICKER_LIMIT: 1 * MB,
36220
- MEDIA_PICKER_UPLOAD_SERVER: 'https://zapi-server.tungnt.xyz/upload/photos'
36221
- };
36222
- })();
36223
-
36224
- function encode(bag) {
36225
- var pairs = [];
36226
- for (var key in bag) {
36227
- if (bag.hasOwnProperty(key)) {
36228
- var value = bag[key];
36229
- if (typeof value === "undefined") {
36230
- return;
36231
- }
36232
- if (value === null) {
36233
- pairs.push(key);
36234
- return;
36235
- }
36236
- pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
36237
- }
36238
- }
36239
- return pairs.join("&");
36240
- }
36241
- function decode(str, strict) {
36242
- var data = {};
36243
- if (str === "") {
36244
- return data;
36245
- }
36246
- var pairs = str.split("&");
36247
- for (var i = 0; i < pairs.length; i++) {
36248
- var pair = pairs[i].split("=", 2);
36249
- var key = decodeURIComponent(pair[0]);
36250
- if (strict && Object.prototype.hasOwnProperty.call(data, key)) {
36251
- throw new URIError("Duplicate key: " + key);
36252
- }
36253
- data[key] = pair.length === 2 ? decodeURIComponent(pair[1]) : null;
36254
- }
36255
- return data;
36256
- }
36257
- function appendToUrl(url, params) {
36258
- return (url +
36259
- (url.indexOf("?") !== -1 ? "&" : "?") +
36260
- (typeof params === "string" ? params : QueryString.encode(params)));
36261
- }
36262
- function getParameterByName(name, url) {
36263
- if (!url) {
36264
- url = window.location.href;
36265
- }
36266
- name = name.replace(/[\[\]]/g, "\\$&");
36267
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
36268
- if (!results)
36269
- return null;
36270
- if (!results[2])
36271
- return "";
36272
- return decodeURIComponent(results[2].replace(/\+/g, " "));
36273
- }
36274
- function getParamsAsObject(query) {
36275
- var params = {};
36276
- if (!query)
36277
- return params;
36278
- var values = query.split("&");
36279
- values.map(function (item) {
36280
- var data = item.split("=");
36281
- if (!data || data.length != 2)
36282
- return;
36283
- params[data[0]] = decodeURIComponent(data[1].replace(/\+/g, " "));
36284
- });
36285
- return params;
36286
- }
36287
- function toQueryString(data) {
36288
- if (!data)
36289
- return "";
36290
- if ((typeof data === "undefined" ? "undefined" : typeof (data)) != "object")
36291
- return data;
36292
- var key = Object.keys(data);
36293
- var params = [];
36294
- key.map(function (k) {
36295
- var v = data[k];
36296
- if ((typeof v === "undefined" ? "undefined" : typeof (v)) == "object")
36297
- v = JSON.stringify(v);
36298
- else
36299
- v = encodeURIComponent(v);
36300
- var item = [k, v].join("=");
36301
- params.push(item);
36302
- });
36303
- return params.join("&");
36304
- }
36305
- const QueryString = {
36306
- encode: encode,
36307
- decode: decode,
36308
- appendToUrl: appendToUrl,
36309
- getParameterByName: getParameterByName,
36310
- getParamsAsObject: getParamsAsObject,
36311
- toQueryString: toQueryString,
36312
- };
36313
-
36314
36333
  var wrappers = {};
36315
36334
  var WrapperFn = function wrapFunction(fn, type, source) {
36316
36335
  var t = type || 'default';
@@ -36572,8 +36591,9 @@ class ZaloJSBridge extends eventemitter3 {
36572
36591
  }
36573
36592
  jsCall(action, options, callback, isMultiCallback = false, nRetry = 3, haveTimeout = true) {
36574
36593
  try {
36575
- const key = generateUniqueString(action);
36576
- if (!this._device.isMobile || lodash.isEmpty(action)) {
36594
+ const actionName = action.name;
36595
+ const key = generateUniqueString(actionName);
36596
+ if (!this._device.isMobile || lodash.isEmpty(actionName)) {
36577
36597
  this.onJSCall(key, {
36578
36598
  error_code: -13,
36579
36599
  error_message: 'params invalid!',
@@ -36582,7 +36602,7 @@ class ZaloJSBridge extends eventemitter3 {
36582
36602
  jsToken: this._jsAccessTk,
36583
36603
  access_token: this._accessTk
36584
36604
  },
36585
- action: action
36605
+ action: actionName
36586
36606
  });
36587
36607
  return false;
36588
36608
  }
@@ -36596,11 +36616,11 @@ class ZaloJSBridge extends eventemitter3 {
36596
36616
  error_code: -14,
36597
36617
  error_message: 'Request Timeout!',
36598
36618
  data: {},
36599
- action: action
36619
+ action: actionName
36600
36620
  };
36601
36621
  this._jsCallFuncCallbacks[key] = {
36602
36622
  timeout: haveTimeout &&
36603
- ACTION_HAVE_CALLBACK.includes(action) &&
36623
+ action.have_callback &&
36604
36624
  setTimeout(() => {
36605
36625
  this.onJSCall(key, timeoutCallback);
36606
36626
  }, 8000),
@@ -36610,14 +36630,14 @@ class ZaloJSBridge extends eventemitter3 {
36610
36630
  options = serialize(options);
36611
36631
  if (isMultiCallback) {
36612
36632
  if (this._device.isIOS) {
36613
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, window.onMultiJSCall(key));
36633
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, window.onMultiJSCall(key));
36614
36634
  }
36615
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, `window.onMultiJSCall('${key}')`);
36635
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, `window.onMultiJSCall('${key}')`);
36616
36636
  }
36617
36637
  if (this._device.isIOS) {
36618
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, window.onJSCall(key));
36638
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, window.onJSCall(key));
36619
36639
  }
36620
- return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, action, this._accessTk, options, `window.onJSCall('${key}')`);
36640
+ return ZaloJavaScriptInterface.jsCall(this._jsAccessTk, actionName, this._accessTk, options, `window.onJSCall('${key}')`);
36621
36641
  }
36622
36642
  catch (error) {
36623
36643
  if (nRetry-- > 0) {
@@ -36635,7 +36655,7 @@ class ZaloJSBridge extends eventemitter3 {
36635
36655
  jsToken: this._jsAccessTk,
36636
36656
  access_token: this._accessTk
36637
36657
  },
36638
- action: action,
36658
+ action: actionName,
36639
36659
  js_error: error
36640
36660
  };
36641
36661
  this.onJSCall(key, errorCallback);
@@ -36666,7 +36686,7 @@ class ZJSBridgeProvider {
36666
36686
  __classPrivateFieldGet(this, _ZJSBridgeProvider_bridge).jsAccessTk = value;
36667
36687
  }
36668
36688
  callNative(action, data, option) {
36669
- this.debug(action, data);
36689
+ this.debug(action.name, data);
36670
36690
  return new Promise((resolve, reject) => {
36671
36691
  const fn = (cb) => __awaiter(this, void 0, void 0, function* () {
36672
36692
  try {
@@ -36682,7 +36702,7 @@ class ZJSBridgeProvider {
36682
36702
  else if (cb && cb.error_code < 0) {
36683
36703
  try {
36684
36704
  window.zmpSentry &&
36685
- window.zmpSentry.captureMessage(`${action}: call native fail`, {
36705
+ window.zmpSentry.captureMessage(`${action.name}: call native fail`, {
36686
36706
  extra: {
36687
36707
  data: data,
36688
36708
  rs: cb
@@ -36717,7 +36737,7 @@ class ZJSBridgeProvider {
36717
36737
  }
36718
36738
  _ZJSBridgeProvider_bridge = new WeakMap();
36719
36739
 
36720
- var version = "2.16.2";
36740
+ var version = "2.16.5";
36721
36741
 
36722
36742
  class Basics {
36723
36743
  /**
@@ -36759,31 +36779,9 @@ class Basics {
36759
36779
  */
36760
36780
  static getAppInfo() {
36761
36781
  return __awaiter(this, void 0, void 0, function* () {
36762
- let info = {};
36763
36782
  const appId = this.getAppId();
36764
36783
  const systemInfo = this.getSystemInfo();
36765
- const api = QueryString.appendToUrl(`${API_DOMAIN}${H5_API.GET_APP_INFO}`, {
36766
- appId,
36767
- versionStatus: 0,
36768
- currentVersion: systemInfo.version
36769
- });
36770
- const msgApi = yield fetch(api, {
36771
- credentials: 'include'
36772
- });
36773
- if (msgApi.ok) {
36774
- const appInfo = yield msgApi.json();
36775
- if (appInfo.err < 0 || !appInfo.data) {
36776
- throw new Error(appInfo);
36777
- }
36778
- info = {
36779
- name: appInfo.data.name,
36780
- version: appInfo.data.version,
36781
- description: appInfo.data.description,
36782
- appUrl: appInfo.data.appUrl,
36783
- qrCodeUrl: appInfo.data.qrCodeUrl
36784
- };
36785
- }
36786
- return info;
36784
+ return yield getAppInfo(appId, 0, systemInfo.version);
36787
36785
  });
36788
36786
  }
36789
36787
  }
@@ -36822,7 +36820,7 @@ class NavigationBar {
36822
36820
  */
36823
36821
  static setNavigationBarTitle(object) {
36824
36822
  return __awaiter(this, void 0, void 0, function* () {
36825
- yield this.callNative(ACTION.CHANGE_TITLE_HEADER.name, {
36823
+ yield this.callNative(ACTION.CHANGE_TITLE_HEADER, {
36826
36824
  title: object.title
36827
36825
  }, {
36828
36826
  haveTimeout: false
@@ -36870,7 +36868,7 @@ class NavigationBar {
36870
36868
  actionBarType = HIDE_ACTION_BAR;
36871
36869
  }
36872
36870
  this.setActionBarConfig((state) => (Object.assign(Object.assign({}, state), { actionbarType: actionBarType, dataConfig: Object.assign(Object.assign({}, state.dataConfig), dataConfig) })));
36873
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, Object.assign({}, this.getActionBarConfig()), {
36871
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, Object.assign({}, this.getActionBarConfig()), {
36874
36872
  haveTimeout: false
36875
36873
  });
36876
36874
  });
@@ -36914,7 +36912,7 @@ class NavigationBar {
36914
36912
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
36915
36913
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
36916
36914
  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 }) })));
36917
- yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE.name, Object.assign({}, this.getActionBarConfig()), {
36915
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR_LEFTBUTTON_TYPE, Object.assign({}, this.getActionBarConfig()), {
36918
36916
  haveTimeout: false
36919
36917
  });
36920
36918
  });
@@ -36956,7 +36954,7 @@ class NavigationBar {
36956
36954
  */
36957
36955
  static setNavigationBarRightButton(object) {
36958
36956
  return __awaiter(this, void 0, void 0, function* () {
36959
- yield this.callNative(ACTION.CREATE_OPTIONS_MENU.name, {
36957
+ yield this.callNative(ACTION.CREATE_OPTIONS_MENU, {
36960
36958
  supportToolBar: object.supportToolBar,
36961
36959
  reset: object.reset,
36962
36960
  menuListItems: object.menuListItems,
@@ -36992,7 +36990,7 @@ class Background {
36992
36990
  return __awaiter(this, void 0, void 0, function* () {
36993
36991
  if (lodash.isString(object.backgroundColor) &&
36994
36992
  object.backgroundColor.length > 0) {
36995
- yield this.callNative(ACTION.CHANGE_ACTIONBAR.name, {
36993
+ yield this.callNative(ACTION.CHANGE_ACTIONBAR, {
36996
36994
  actionbarType: this.isShowNavBar ? 5 : 6,
36997
36995
  dataConfig: {
36998
36996
  backgroundColor: object.backgroundColor,
@@ -37104,7 +37102,7 @@ class Device {
37104
37102
  */
37105
37103
  static setDeviceOrientation(object) {
37106
37104
  return __awaiter(this, void 0, void 0, function* () {
37107
- yield this.callNative(ACTION.CHANGE_AUTOROTATE.name, {
37105
+ yield this.callNative(ACTION.CHANGE_AUTOROTATE, {
37108
37106
  autoRotate: OrientationType[object.rotate]
37109
37107
  });
37110
37108
  });
@@ -37128,26 +37126,27 @@ class Device {
37128
37126
  */
37129
37127
  static getNetworkType(object) {
37130
37128
  return __awaiter(this, void 0, void 0, function* () {
37131
- const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE.name, {
37129
+ const resData = yield this.callNative(ACTION.WEBVIEW_NETWORKTYPE, {
37132
37130
  url: window.location.href,
37133
37131
  featureId: ''
37134
37132
  }).then((data) => {
37135
37133
  const network = data.network;
37136
37134
  let networkType;
37135
+ const isAndroid = checkPlatform().isAndroid;
37137
37136
  switch (network) {
37138
- case CONFIG.NETWORK_TYPE.NONE:
37137
+ case NETWORK_TYPE(isAndroid).NONE:
37139
37138
  networkType = NetworkType.none;
37140
37139
  break;
37141
- case CONFIG.NETWORK_TYPE.WIFI:
37140
+ case NETWORK_TYPE(isAndroid).WIFI:
37142
37141
  networkType = NetworkType.wifi;
37143
37142
  break;
37144
- case CONFIG.NETWORK_TYPE['2G']:
37143
+ case NETWORK_TYPE(isAndroid)['2G']:
37145
37144
  networkType = NetworkType.cellular;
37146
37145
  break;
37147
- case CONFIG.NETWORK_TYPE['3G']:
37146
+ case NETWORK_TYPE(isAndroid)['3G']:
37148
37147
  networkType = NetworkType.cellular;
37149
37148
  break;
37150
- case CONFIG.NETWORK_TYPE['4G']:
37149
+ case NETWORK_TYPE(isAndroid)['4G']:
37151
37150
  networkType = NetworkType.cellular;
37152
37151
  break;
37153
37152
  default:
@@ -37241,7 +37240,7 @@ class Device {
37241
37240
  items: Array.isArray(object === null || object === void 0 ? void 0 : object.items) ? object === null || object === void 0 ? void 0 : object.items : []
37242
37241
  }
37243
37242
  };
37244
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37243
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37245
37244
  return true;
37246
37245
  });
37247
37246
  }
@@ -37260,7 +37259,7 @@ class Device {
37260
37259
  const data = {
37261
37260
  subaction: 2
37262
37261
  };
37263
- yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data));
37262
+ yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data));
37264
37263
  return true;
37265
37264
  });
37266
37265
  }
@@ -37281,7 +37280,7 @@ class Device {
37281
37280
  const data = {
37282
37281
  subaction: 1
37283
37282
  };
37284
- const resData = yield this.callNative(ACTION.SCAN_IBEACON.name, Object.assign({}, data), {
37283
+ const resData = yield this.callNative(ACTION.SCAN_IBEACON, Object.assign({}, data), {
37285
37284
  isMultiCallback: true
37286
37285
  }).then((resData) => {
37287
37286
  const res = {
@@ -37323,7 +37322,9 @@ class Device {
37323
37322
  */
37324
37323
  static stopBluetoothDevicesDiscovery() {
37325
37324
  return __awaiter(this, void 0, void 0, function* () {
37326
- return this.callNative('', {});
37325
+ return this.callNative({
37326
+ name: ''
37327
+ }, {});
37327
37328
  });
37328
37329
  }
37329
37330
  /**
@@ -37348,7 +37349,9 @@ class Device {
37348
37349
  */
37349
37350
  static startBluetoothDevicesDiscovery(object) {
37350
37351
  return __awaiter(this, void 0, void 0, function* () {
37351
- return this.callNative('', Object.assign({}, object));
37352
+ return this.callNative({
37353
+ name: ''
37354
+ }, Object.assign({}, object));
37352
37355
  });
37353
37356
  }
37354
37357
  /**
@@ -37370,7 +37373,9 @@ class Device {
37370
37373
  */
37371
37374
  static openBluetoothAdapter() {
37372
37375
  return __awaiter(this, void 0, void 0, function* () {
37373
- return this.callNative('', {});
37376
+ return this.callNative({
37377
+ name: ''
37378
+ }, {});
37374
37379
  });
37375
37380
  }
37376
37381
  /**
@@ -37388,7 +37393,9 @@ class Device {
37388
37393
  */
37389
37394
  static onBluetoothDeviceFound() {
37390
37395
  return __awaiter(this, void 0, void 0, function* () {
37391
- return this.callNative('', {});
37396
+ return this.callNative({
37397
+ name: ''
37398
+ }, {});
37392
37399
  });
37393
37400
  }
37394
37401
  /**
@@ -37434,7 +37441,9 @@ class Device {
37434
37441
  const data = {
37435
37442
  services: object.services || []
37436
37443
  };
37437
- return this.callNative('', data);
37444
+ return this.callNative({
37445
+ name: ''
37446
+ }, data);
37438
37447
  });
37439
37448
  }
37440
37449
  /**
@@ -37453,7 +37462,9 @@ class Device {
37453
37462
  */
37454
37463
  static getBluetoothDevices() {
37455
37464
  return __awaiter(this, void 0, void 0, function* () {
37456
- return this.callNative('', {});
37465
+ return this.callNative({
37466
+ name: ''
37467
+ }, {});
37457
37468
  });
37458
37469
  }
37459
37470
  /**
@@ -37472,7 +37483,9 @@ class Device {
37472
37483
  */
37473
37484
  static getBluetoothAdapterState() {
37474
37485
  return __awaiter(this, void 0, void 0, function* () {
37475
- return this.callNative('', {});
37486
+ return this.callNative({
37487
+ name: ''
37488
+ }, {});
37476
37489
  });
37477
37490
  }
37478
37491
  /**
@@ -37491,7 +37504,9 @@ class Device {
37491
37504
  */
37492
37505
  static closeBluetoothAdapter() {
37493
37506
  return __awaiter(this, void 0, void 0, function* () {
37494
- return this.callNative('', {});
37507
+ return this.callNative({
37508
+ name: ''
37509
+ }, {});
37495
37510
  });
37496
37511
  }
37497
37512
  /**
@@ -37503,7 +37518,7 @@ class Device {
37503
37518
  */
37504
37519
  static scanQRCode(object) {
37505
37520
  return __awaiter(this, void 0, void 0, function* () {
37506
- return yield this.callNative(ACTION.OPEN_QR.name, {
37521
+ return yield this.callNative(ACTION.OPEN_QR, {
37507
37522
  skipOpenLink: true
37508
37523
  });
37509
37524
  });
@@ -37517,7 +37532,7 @@ class Device {
37517
37532
  */
37518
37533
  static showToast(object) {
37519
37534
  return __awaiter(this, void 0, void 0, function* () {
37520
- yield this.callNative(ACTION.SHOW_TOAST.name, {
37535
+ yield this.callNative(ACTION.SHOW_TOAST, {
37521
37536
  toast: object.message
37522
37537
  });
37523
37538
  });
@@ -37531,7 +37546,7 @@ class Device {
37531
37546
  */
37532
37547
  static hideKeyboard(object) {
37533
37548
  return __awaiter(this, void 0, void 0, function* () {
37534
- yield this.callNative(ACTION.HIDE_KEYBOARD.name, {});
37549
+ yield this.callNative(ACTION.HIDE_KEYBOARD, {});
37535
37550
  });
37536
37551
  }
37537
37552
  /**
@@ -37543,7 +37558,7 @@ class Device {
37543
37558
  */
37544
37559
  static openPhone(object) {
37545
37560
  return __awaiter(this, void 0, void 0, function* () {
37546
- yield this.callNative(ACTION.OPEN_PHONE.name, {
37561
+ yield this.callNative(ACTION.OPEN_PHONE, {
37547
37562
  phoneNum: object.phoneNumber,
37548
37563
  phoneCode: object.phoneNumber
37549
37564
  });
@@ -37558,7 +37573,7 @@ class Device {
37558
37573
  */
37559
37574
  static openSMS(object) {
37560
37575
  return __awaiter(this, void 0, void 0, function* () {
37561
- yield this.callNative(ACTION.OPEN_SMS.name, {
37576
+ yield this.callNative(ACTION.OPEN_SMS, {
37562
37577
  content: object.content,
37563
37578
  phoneCode: object.phoneNumber
37564
37579
  });
@@ -37573,7 +37588,7 @@ class Device {
37573
37588
  */
37574
37589
  static keepScreen(object) {
37575
37590
  return __awaiter(this, void 0, void 0, function* () {
37576
- return yield this.callNative(ACTION.KEEP_SCREEN.name, {
37591
+ return yield this.callNative(ACTION.KEEP_SCREEN, {
37577
37592
  data: {
37578
37593
  keep_screen_on: object.keepScreenOn ? 1 : 0
37579
37594
  }
@@ -37589,7 +37604,7 @@ class Device {
37589
37604
  */
37590
37605
  static openBioAuthentication(object) {
37591
37606
  return __awaiter(this, void 0, void 0, function* () {
37592
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION.name, {
37607
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION, {
37593
37608
  secret_data: object.secretData,
37594
37609
  app_id: this.getZAppId(),
37595
37610
  ui: {
@@ -37628,7 +37643,7 @@ class Device {
37628
37643
  */
37629
37644
  static checkStateBioAuthentication(object) {
37630
37645
  return __awaiter(this, void 0, void 0, function* () {
37631
- return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE.name, {}).then((data) => {
37646
+ return yield this.callNative(ACTION.PROMPT_AUTHENTICATION_CHECK_STATE, {}).then((data) => {
37632
37647
  return {
37633
37648
  bioState: data === null || data === void 0 ? void 0 : data.bio_state
37634
37649
  };
@@ -37644,7 +37659,7 @@ class Device {
37644
37659
  */
37645
37660
  static vibrate(object) {
37646
37661
  return __awaiter(this, void 0, void 0, function* () {
37647
- return yield this.callNative(ACTION.INTERACTIVE_VIBRATION.name, {
37662
+ return yield this.callNative(ACTION.INTERACTIVE_VIBRATION, {
37648
37663
  type: VibrateType[object.type],
37649
37664
  vibrate_time: object.milliseconds
37650
37665
  });
@@ -37663,7 +37678,7 @@ class Device {
37663
37678
  if (lodash.isString(object.password) && object.password.length > 0) {
37664
37679
  securityType = 'wpa_wpa2';
37665
37680
  }
37666
- return yield this.callNative(ACTION.MP_JOIN_WIFI.name, {
37681
+ return yield this.callNative(ACTION.MP_JOIN_WIFI, {
37667
37682
  ssid: object.SSID,
37668
37683
  securityType: securityType,
37669
37684
  password: object.password,
@@ -37691,7 +37706,7 @@ class LocalResourceStorage {
37691
37706
  __classPrivateFieldSet(this, _LocalResourceStorage_resourceInfo, {
37692
37707
  keys: new Set(),
37693
37708
  currentSize: 0,
37694
- limitSize: CONFIG.STORAGE_LIMIT
37709
+ limitSize: STORAGE_LIMIT
37695
37710
  });
37696
37711
  __classPrivateFieldSet(this, _LocalResourceStorage_prefix, prefix);
37697
37712
  this.findAllCurrentDataByApp(prefix);
@@ -37754,7 +37769,7 @@ class LocalResourceStorage {
37754
37769
  currentSize: lodash.isNumber(currentSize)
37755
37770
  ? Number((currentSize / 1024).toFixed(2))
37756
37771
  : 0,
37757
- limitSize: Number((CONFIG.STORAGE_LIMIT / 1024).toFixed(2))
37772
+ limitSize: Number((STORAGE_LIMIT / 1024).toFixed(2))
37758
37773
  };
37759
37774
  }
37760
37775
  remove(keys) {
@@ -37800,13 +37815,13 @@ class NativeResourceStorage extends ZJSBridgeProvider {
37800
37815
  __classPrivateFieldSet(this, _NativeResourceStorage_resourceInfo, {
37801
37816
  keys: new Set(),
37802
37817
  currentSize: 0,
37803
- limitSize: CONFIG.STORAGE_LIMIT
37818
+ limitSize: STORAGE_LIMIT
37804
37819
  });
37805
37820
  __classPrivateFieldSet(this, _NativeResourceStorage_appId, appId);
37806
37821
  }
37807
37822
  get(keys) {
37808
37823
  return __awaiter(this, void 0, void 0, function* () {
37809
- return yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37824
+ return yield this.callNative(ACTION.ZBROWSER_MPDS, {
37810
37825
  mpds_action: 'mpds.get',
37811
37826
  mpds_data: {
37812
37827
  keys
@@ -37825,7 +37840,7 @@ class NativeResourceStorage extends ZJSBridgeProvider {
37825
37840
  }
37826
37841
  set(data) {
37827
37842
  return __awaiter(this, void 0, void 0, function* () {
37828
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37843
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37829
37844
  mpds_action: 'mpds.set',
37830
37845
  mpds_data: {
37831
37846
  map: data
@@ -37845,7 +37860,7 @@ class NativeResourceStorage extends ZJSBridgeProvider {
37845
37860
  }
37846
37861
  getInfo() {
37847
37862
  return __awaiter(this, void 0, void 0, function* () {
37848
- const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37863
+ const currentSize = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37849
37864
  mpds_action: 'mpds.get.size',
37850
37865
  mpds_data: {},
37851
37866
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -37860,13 +37875,13 @@ class NativeResourceStorage extends ZJSBridgeProvider {
37860
37875
  });
37861
37876
  return {
37862
37877
  currentSize: lodash.isNumber(currentSize) ? Number(currentSize / 1024) : 0,
37863
- limitSize: Number(CONFIG.STORAGE_LIMIT / 1024)
37878
+ limitSize: Number(STORAGE_LIMIT / 1024)
37864
37879
  };
37865
37880
  });
37866
37881
  }
37867
37882
  remove(keys) {
37868
37883
  return __awaiter(this, void 0, void 0, function* () {
37869
- const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37884
+ const errorKeys = yield this.callNative(ACTION.ZBROWSER_MPDS, {
37870
37885
  mpds_action: 'mpds.remove.key',
37871
37886
  mpds_data: {
37872
37887
  keys: keys
@@ -37886,7 +37901,7 @@ class NativeResourceStorage extends ZJSBridgeProvider {
37886
37901
  }
37887
37902
  clear() {
37888
37903
  return __awaiter(this, void 0, void 0, function* () {
37889
- yield this.callNative(ACTION.ZBROWSER_MPDS.name, {
37904
+ yield this.callNative(ACTION.ZBROWSER_MPDS, {
37890
37905
  mpds_action: 'mpds.clear.appData',
37891
37906
  mpds_data: {},
37892
37907
  appId: __classPrivateFieldGet(this, _NativeResourceStorage_appId)
@@ -38116,7 +38131,7 @@ class OpenApi {
38116
38131
  fields = `${fields}.type(${object === null || object === void 0 ? void 0 : object.avatarType})`;
38117
38132
  }
38118
38133
  const userInfo = yield axios
38119
- .get(CONFIG.APIS.GET_USER_INFO, {
38134
+ .get(APIS.GET_USER_INFO, {
38120
38135
  params: {
38121
38136
  fields: fields,
38122
38137
  access_token: accessToken
@@ -38149,7 +38164,7 @@ class OpenApi {
38149
38164
  */
38150
38165
  static getPhoneNumber(object) {
38151
38166
  return __awaiter(this, void 0, void 0, function* () {
38152
- return yield this.callNative(ACTION.MP_GET_NUMBER.name, {}, {
38167
+ return yield this.callNative(ACTION.MP_GET_NUMBER, {}, {
38153
38168
  isMultiCallback: true,
38154
38169
  callback: (nativeData, error) => {
38155
38170
  if (nativeData.error_code === 0) {
@@ -38179,7 +38194,7 @@ class Window {
38179
38194
  */
38180
38195
  static closeApp(object) {
38181
38196
  return __awaiter(this, void 0, void 0, function* () {
38182
- yield this.callNative(ACTION.WINDOW_CLOSE.name, {});
38197
+ yield this.callNative(ACTION.WINDOW_CLOSE, {});
38183
38198
  });
38184
38199
  }
38185
38200
  /**
@@ -38199,10 +38214,12 @@ class Window {
38199
38214
  return [key, value].join('=');
38200
38215
  })
38201
38216
  .join('&');
38202
- yield this.callNative(ACTION.OPEN_MP.name, {
38203
- mpUrl: `${CONFIG.MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
38217
+ const appInfo = yield getAppInfo(appId, 0);
38218
+ yield this.callNative(ACTION.OPEN_MP, {
38219
+ mpUrl: `${MINI_APP_INTERNAL_LINK}/${appId}/${queryParamString.length > 0 ? '?' + queryParamString : ''}`,
38204
38220
  mpInfo: {
38205
- appId: appId
38221
+ appId: appId,
38222
+ appAvtUrl: appInfo.logoUrl || ''
38206
38223
  }
38207
38224
  });
38208
38225
  });
@@ -38217,7 +38234,7 @@ class Window {
38217
38234
  */
38218
38235
  static openWebview(object) {
38219
38236
  return __awaiter(this, void 0, void 0, function* () {
38220
- yield this.callNative(ACTION.OPEN_INAPP.name, {
38237
+ yield this.callNative(ACTION.OPEN_INAPP, {
38221
38238
  url: object.url
38222
38239
  });
38223
38240
  });
@@ -38242,7 +38259,7 @@ class Location {
38242
38259
  */
38243
38260
  static getLocation(object) {
38244
38261
  return __awaiter(this, void 0, void 0, function* () {
38245
- return yield this.callNative(ACTION.GET_LOCATION.name, {
38262
+ return yield this.callNative(ACTION.GET_LOCATION, {
38246
38263
  silent_request: false,
38247
38264
  permission_description: 'Cho phép Zalo truy cập vào vị trí của thiết bị này?'
38248
38265
  }, {
@@ -38281,7 +38298,7 @@ class Location {
38281
38298
  */
38282
38299
  static sendLocation(object) {
38283
38300
  return __awaiter(this, void 0, void 0, function* () {
38284
- yield this.callNative(ACTION.QUERY_LOCATION_HIDE.name, {
38301
+ yield this.callNative(ACTION.QUERY_LOCATION_HIDE, {
38285
38302
  title: object.title,
38286
38303
  touserid: object.toUserId,
38287
38304
  zapp: this.getZAppId()
@@ -38301,7 +38318,7 @@ class Media {
38301
38318
  */
38302
38319
  static requestCameraPermission(object) {
38303
38320
  return __awaiter(this, void 0, void 0, function* () {
38304
- return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA.name, {}, {
38321
+ return yield this.callNative(ACTION.REQUEST_PERMISSION_CAMERA, {}, {
38305
38322
  callback: (nativeData, error) => {
38306
38323
  if (nativeData.error_code === -2 || nativeData.error_code >= 0) {
38307
38324
  return Promise.resolve({
@@ -38337,7 +38354,7 @@ class Media {
38337
38354
  imageUrl: object.imageUrl
38338
38355
  };
38339
38356
  }
38340
- return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY.name, Object.assign({}, data));
38357
+ return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY, Object.assign({}, data));
38341
38358
  });
38342
38359
  }
38343
38360
  }
@@ -38352,7 +38369,7 @@ class Zalo {
38352
38369
  */
38353
38370
  static viewOAQr(object) {
38354
38371
  return __awaiter(this, void 0, void 0, function* () {
38355
- yield this.callNative(ACTION.VIEW_MYQR.name, {
38372
+ yield this.callNative(ACTION.VIEW_MYQR, {
38356
38373
  dpn: object.displayName,
38357
38374
  uid: object.id,
38358
38375
  zapp: this.getZAppId()
@@ -38371,7 +38388,7 @@ class Zalo {
38371
38388
  */
38372
38389
  static openProfile(object) {
38373
38390
  return __awaiter(this, void 0, void 0, function* () {
38374
- return yield this.callNative(ACTION.OPEN_PROFILE.name, {
38391
+ return yield this.callNative(ACTION.OPEN_PROFILE, {
38375
38392
  uId: object.id,
38376
38393
  type: ProfileType[object.type],
38377
38394
  zapp: this.getZAppId(),
@@ -38389,7 +38406,7 @@ class Zalo {
38389
38406
  */
38390
38407
  static openChat(object) {
38391
38408
  return __awaiter(this, void 0, void 0, function* () {
38392
- return yield this.callNative(ACTION.OPEN_CHAT.name, {
38409
+ return yield this.callNative(ACTION.OPEN_CHAT, {
38393
38410
  uId: object.id,
38394
38411
  type: ChatType[object.type],
38395
38412
  zapp: this.getZAppId(),
@@ -38430,7 +38447,7 @@ class Zalo {
38430
38447
  };
38431
38448
  break;
38432
38449
  }
38433
- return yield this.callNative(ACTION.OPEN_POSTFEED.name, Object.assign(Object.assign({ type: PostFeedType[object.type] }, reqData), { zapp: this.getZAppId() })).then((res) => {
38450
+ return yield this.callNative(ACTION.OPEN_POSTFEED, Object.assign(Object.assign({ type: PostFeedType[object.type] }, reqData), { zapp: this.getZAppId() })).then((res) => {
38434
38451
  return {
38435
38452
  status: res.status,
38436
38453
  shareType: res.share_type,
@@ -38449,7 +38466,7 @@ class Zalo {
38449
38466
  */
38450
38467
  static followOA(object) {
38451
38468
  return __awaiter(this, void 0, void 0, function* () {
38452
- yield this.callNative(ACTION.FOLLOW_OA.name, {
38469
+ yield this.callNative(ACTION.FOLLOW_OA, {
38453
38470
  uid: object.id,
38454
38471
  showDialogConfirm: true,
38455
38472
  zapp: this.getZAppId()
@@ -38468,7 +38485,7 @@ class Zalo {
38468
38485
  */
38469
38486
  static unfollowOA(object) {
38470
38487
  return __awaiter(this, void 0, void 0, function* () {
38471
- yield this.callNative(ACTION.UNFOLLOW_OA.name, {
38488
+ yield this.callNative(ACTION.UNFOLLOW_OA, {
38472
38489
  uid: object.id,
38473
38490
  zapp: this.getZAppId()
38474
38491
  }, {
@@ -38548,7 +38565,7 @@ class Zalo {
38548
38565
  object.type = 'link';
38549
38566
  }
38550
38567
  }
38551
- return yield this.callNative(ACTION.OPEN_SHARESHEET.name, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38568
+ return yield this.callNative(ACTION.OPEN_SHARESHEET, Object.assign(Object.assign({ type: ShareSheetType[object.type] }, reqData), { zapp: this.getZAppId() }), {
38552
38569
  haveTimeout: false
38553
38570
  }).then((res) => {
38554
38571
  return {
@@ -38567,25 +38584,13 @@ class Zalo {
38567
38584
  * @category Zalo
38568
38585
  *
38569
38586
  */
38570
- static createShortcut(object) {
38587
+ static createShortcut(url, title, icon) {
38571
38588
  return __awaiter(this, void 0, void 0, function* () {
38572
- const isIOS = checkPlatform().isIOS;
38573
- let iconURL = getMetaValue('og:image:url');
38574
- if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
38575
- iconURL = `https:${iconURL}`;
38576
- }
38577
- if (isIOS) {
38578
- const iosShortcutURL = `https://mini.zalo.me/shortcut.html?appId=${this.getAppId()}&appName=${document.title}&appIcon=${iconURL}`;
38579
- return yield this.callNative(ACTION.OPEN_OUTAPP.name, {
38580
- url: encodeURI(iosShortcutURL)
38581
- });
38582
- }
38583
- else
38584
- return yield this.callNative(ACTION.CREATE_SHORTCUT.name, {
38585
- url: `${CONFIG.MINI_APP_LINK}/${this.getAppId()}/`,
38586
- title: document.title,
38587
- iconUrl: iconURL
38588
- });
38589
+ return yield this.callNative(ACTION.CREATE_SHORTCUT, {
38590
+ url: url,
38591
+ title: title,
38592
+ iconUrl: icon
38593
+ });
38589
38594
  });
38590
38595
  }
38591
38596
  /**
@@ -38598,7 +38603,7 @@ class Zalo {
38598
38603
  */
38599
38604
  static openProfilePicker(object) {
38600
38605
  return __awaiter(this, void 0, void 0, function* () {
38601
- return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER.name, {
38606
+ return yield this.callNative(ACTION.MP_OPEN_PROFILE_PICKER, {
38602
38607
  maxProfile: object === null || object === void 0 ? void 0 : object.maxProfile
38603
38608
  }, {
38604
38609
  isMultiCallback: true,
@@ -38624,7 +38629,7 @@ class Zalo {
38624
38629
  */
38625
38630
  static getActionsSupported(object) {
38626
38631
  return __awaiter(this, void 0, void 0, function* () {
38627
- return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS.name, {}, {
38632
+ return yield this.callNative(ACTION.GET_SUPPORTED_ACTIONS, {}, {
38628
38633
  isMultiCallback: false,
38629
38634
  callback: (nativeData, error) => {
38630
38635
  const platform = getPlatform();
@@ -38659,14 +38664,14 @@ class Zalo {
38659
38664
  return __awaiter(this, void 0, void 0, function* () {
38660
38665
  const uploadSetting = {
38661
38666
  type: 0,
38662
- url: CONFIG.MEDIA_PICKER_UPLOAD_SERVER,
38663
- maxSize: CONFIG.MEDIA_PICKER_LIMIT
38667
+ url: MEDIA_PICKER_UPLOAD_SERVER,
38668
+ maxSize: MEDIA_PICKER_LIMIT
38664
38669
  };
38665
38670
  const defaultEditView = {
38666
38671
  enable: 1,
38667
38672
  aspect_ratio: '1:1'
38668
38673
  };
38669
- return yield this.callNative(ACTION.PICK_MEDIA.name, {
38674
+ return yield this.callNative(ACTION.PICK_MEDIA, {
38670
38675
  media_type: MediaPickerType[type],
38671
38676
  edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
38672
38677
  silent_request: silentRequest,
@@ -38688,6 +38693,21 @@ class Zalo {
38688
38693
  });
38689
38694
  });
38690
38695
  }
38696
+ /**
38697
+ * Mở url out app zalo
38698
+ *
38699
+ * @async
38700
+ * @function openOutApp
38701
+ * @category Zalo
38702
+ *
38703
+ */
38704
+ static openOutApp(url) {
38705
+ return __awaiter(this, void 0, void 0, function* () {
38706
+ return yield this.callNative(ACTION.OPEN_OUTAPP, {
38707
+ url: url
38708
+ });
38709
+ });
38710
+ }
38691
38711
  }
38692
38712
 
38693
38713
  class Routing {
@@ -38722,7 +38742,7 @@ class Routing {
38722
38742
  */
38723
38743
  static sendDataToPreviousMiniApp(object) {
38724
38744
  return __awaiter(this, void 0, void 0, function* () {
38725
- return yield this.callNative(ACTION.WEBVIEW_SET_RESULT.name, {
38745
+ return yield this.callNative(ACTION.WEBVIEW_SET_RESULT, {
38726
38746
  result: stringifyData(object.data)
38727
38747
  });
38728
38748
  });
@@ -38747,51 +38767,51 @@ class Routing {
38747
38767
  }
38748
38768
  }
38749
38769
 
38750
- 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;
38751
- class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38770
+ var _ZaloMiniProgramSDKService_zAppId, _ZaloMiniProgramSDKService_appId, _ZaloMiniProgramSDKService_appConfig, _ZaloMiniProgramSDKService_zOAuth, _ZaloMiniProgramSDKService_zOAuthVrf, _ZaloMiniProgramSDKService_accessToken, _ZaloMiniProgramSDKService_refreshToken, _ZaloMiniProgramSDKService_cache, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, _ZaloMiniProgramSDKService_tokenExpiresIn, _ZaloMiniProgramSDKService_cookies, _ZaloMiniProgramSDKService_actionBarConfig, _ZaloMiniProgramSDKService_callJump, _ZaloMiniProgramSDKService_setNavigationBarRightButton, _ZaloMiniProgramSDKService_getActionsSupported;
38771
+ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
38752
38772
  constructor() {
38753
38773
  var _a, _b, _c, _d, _e, _f, _g, _h;
38754
38774
  super();
38755
- _ZaloMiniProgramSDK_zAppId.set(this, ZAPP_ID);
38756
- _ZaloMiniProgramSDK_appId.set(this, APP_ID);
38757
- _ZaloMiniProgramSDK_appConfig.set(this, APP_CONFIG);
38758
- _ZaloMiniProgramSDK_zOAuth.set(this, void 0);
38759
- _ZaloMiniProgramSDK_zOAuthVrf.set(this, void 0);
38760
- _ZaloMiniProgramSDK_accessToken.set(this, void 0);
38761
- _ZaloMiniProgramSDK_refreshToken.set(this, null);
38762
- _ZaloMiniProgramSDK_cache.set(this, {
38775
+ _ZaloMiniProgramSDKService_zAppId.set(this, ZAPP_ID);
38776
+ _ZaloMiniProgramSDKService_appId.set(this, APP_ID);
38777
+ _ZaloMiniProgramSDKService_appConfig.set(this, APP_CONFIG);
38778
+ _ZaloMiniProgramSDKService_zOAuth.set(this, void 0);
38779
+ _ZaloMiniProgramSDKService_zOAuthVrf.set(this, void 0);
38780
+ _ZaloMiniProgramSDKService_accessToken.set(this, void 0);
38781
+ _ZaloMiniProgramSDKService_refreshToken.set(this, null);
38782
+ _ZaloMiniProgramSDKService_cache.set(this, {
38763
38783
  timer: {
38764
38784
  getToken: 0
38765
38785
  }
38766
38786
  });
38767
- _ZaloMiniProgramSDK_prevGetTokenTimestamp.set(this, void 0);
38768
- _ZaloMiniProgramSDK_tokenExpiresIn.set(this, void 0);
38769
- _ZaloMiniProgramSDK_cookies.set(this, null);
38787
+ _ZaloMiniProgramSDKService_prevGetTokenTimestamp.set(this, void 0);
38788
+ _ZaloMiniProgramSDKService_tokenExpiresIn.set(this, void 0);
38789
+ _ZaloMiniProgramSDKService_cookies.set(this, null);
38770
38790
  this.events = ZMPEEmitter.getInstance();
38771
38791
  this.isIOS = checkPlatform().isIOS;
38772
- _ZaloMiniProgramSDK_actionBarConfig.set(this, void 0);
38792
+ _ZaloMiniProgramSDKService_actionBarConfig.set(this, void 0);
38773
38793
  this.getActionBarConfig = () => {
38774
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_actionBarConfig);
38794
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_actionBarConfig);
38775
38795
  };
38776
38796
  this.setActionBarConfig = (setState) => {
38777
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_actionBarConfig, setState(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_actionBarConfig)));
38797
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, setState(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_actionBarConfig)));
38778
38798
  };
38779
- _ZaloMiniProgramSDK_callJump.set(this, () => {
38799
+ _ZaloMiniProgramSDKService_callJump.set(this, () => {
38780
38800
  return new Promise((resolve, reject) => {
38781
- if (!lodash.isUndefined(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies)) && !lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies))) {
38782
- resolve(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_cookies));
38801
+ if (!lodash.isUndefined(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies)) && !lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies))) {
38802
+ resolve(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_cookies));
38783
38803
  }
38784
38804
  else {
38785
- this.callNative('action.jump.login', {})
38805
+ this.callNative(ACTION.JUMP_LOGIN, {})
38786
38806
  .then((data) => {
38787
38807
  const cookies = (data && data.cookiesOAuthLogins) || [];
38788
- const jsToken = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.JS_TOKEN);
38808
+ const jsToken = cookies.find((cookie) => cookie.name === COOKIE_NAME.JS_TOKEN);
38789
38809
  if (jsToken) {
38790
38810
  this.setJSToken(jsToken.value);
38791
38811
  window.ZJSBridge.setJSToken &&
38792
38812
  window.ZJSBridge.setJSToken(jsToken.value);
38793
38813
  }
38794
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_cookies, cookies);
38814
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_cookies, cookies);
38795
38815
  resolve(cookies);
38796
38816
  })
38797
38817
  .catch((error) => {
@@ -38800,7 +38820,7 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38800
38820
  }
38801
38821
  });
38802
38822
  });
38803
- _ZaloMiniProgramSDK_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
38823
+ _ZaloMiniProgramSDKService_setNavigationBarRightButton.set(this, NavigationBar.setNavigationBarRightButton);
38804
38824
  this.getVersion = Basics.getVersion;
38805
38825
  this.getSystemInfo = Basics.getSystemInfo;
38806
38826
  this.setNavigationBarTitle = NavigationBar.setNavigationBarTitle;
@@ -38858,80 +38878,81 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38858
38878
  this.onCallbackData = Routing.onCallbackData;
38859
38879
  this.getPhoneNumber = OpenApi.getPhoneNumber;
38860
38880
  this.openProfilePicker = Zalo.openProfilePicker;
38861
- _ZaloMiniProgramSDK_getActionsSupported.set(this, Zalo.getActionsSupported);
38881
+ _ZaloMiniProgramSDKService_getActionsSupported.set(this, Zalo.getActionsSupported);
38862
38882
  this.connectWifi = Device.connectWifi;
38863
38883
  this.openMediaPicker = Zalo.openMediaPicker;
38864
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
38865
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38866
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
38884
+ this.openOutApp = Zalo.openOutApp;
38885
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, null);
38886
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null);
38887
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null);
38867
38888
  this.isShowNavBar = true;
38868
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, 0);
38869
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, 0);
38870
- 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' ||
38871
- ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
38889
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, 0);
38890
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, 0);
38891
+ 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' ||
38892
+ ((_d = (_c = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.leftButton) === 'both'
38872
38893
  ? ACTION_LEFT_BUTTON_TYPE.SHOW_HOME
38873
38894
  : ACTION_LEFT_BUTTON_TYPE.HIDE_HOME;
38874
38895
  const currentUrl = new URL(location.href);
38875
- const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor) &&
38876
- __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor.length > 0
38896
+ const actionBarType = lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor) &&
38897
+ __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor.length > 0
38877
38898
  ? SHOW_ACTION_BAR
38878
38899
  : HIDE_ACTION_BAR;
38879
- 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' ||
38880
- ((_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.leftButton) === 'home'
38900
+ const leftButtonType = ((_f = (_e = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _e === void 0 ? void 0 : _e.app) === null || _f === void 0 ? void 0 : _f.leftButton) === 'none' ||
38901
+ ((_h = (_g = __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig)) === null || _g === void 0 ? void 0 : _g.app) === null || _h === void 0 ? void 0 : _h.leftButton) === 'home'
38881
38902
  ? ACTION_LEFT_BUTTON_TYPE.HIDE_BACK
38882
38903
  : ACTION_LEFT_BUTTON_TYPE.SHOW_BACK;
38883
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_actionBarConfig, {
38904
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_actionBarConfig, {
38884
38905
  actionbarType: actionBarType,
38885
38906
  buttonType: leftButtonType,
38886
38907
  dataConfig: {
38887
- backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.headerColor || '',
38888
- textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appConfig).app.textColor || '',
38908
+ backgroundColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.headerColor || '',
38909
+ textColor: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appConfig).app.textColor || '',
38889
38910
  viewInLeftType: leftButtonType,
38890
38911
  confirmToExit: 1
38891
38912
  },
38892
38913
  homeConfig: {
38893
38914
  enable: showHomeButton,
38894
- url: `${CONFIG.MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38915
+ url: `${MINI_APP_INTERNAL_LINK}/${this.getAppId()}/${currentUrl.search}`
38895
38916
  }
38896
38917
  });
38897
38918
  }
38898
38919
  static getInstance() {
38899
- if (!ZaloMiniProgramSDK.instance) {
38900
- ZaloMiniProgramSDK.instance = new ZaloMiniProgramSDK();
38920
+ if (!ZaloMiniProgramSDKService.instance) {
38921
+ ZaloMiniProgramSDKService.instance = new ZaloMiniProgramSDKService();
38901
38922
  }
38902
- return ZaloMiniProgramSDK.instance;
38923
+ return ZaloMiniProgramSDKService.instance;
38903
38924
  }
38904
38925
  getLoginStatus() {
38905
- return lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) && __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken).length > 0;
38926
+ return lodash.isString(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) && __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken).length > 0;
38906
38927
  }
38907
38928
  getAppId() {
38908
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId);
38929
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId);
38909
38930
  }
38910
38931
  getZAppId() {
38911
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zAppId);
38932
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId);
38912
38933
  }
38913
38934
  login(object) {
38914
38935
  return __awaiter(this, void 0, void 0, function* () {
38915
- const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDK_callJump).call(this);
38916
- const zOAuthCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH);
38917
- const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === CONFIG.COOKIE_NAME.ZOAUTH_VRF);
38936
+ const cookies = yield __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_callJump).call(this);
38937
+ const zOAuthCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH);
38938
+ const zOAuthVrfCookie = cookies.find((cookie) => cookie.name === COOKIE_NAME.ZOAUTH_VRF);
38918
38939
  if (!lodash.isUndefined(zOAuthCookie) &&
38919
38940
  !lodash.isNull(zOAuthCookie) &&
38920
38941
  lodash.isString(zOAuthCookie.value)) {
38921
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, zOAuthCookie.value);
38942
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, zOAuthCookie.value);
38922
38943
  if (!lodash.isUndefined(zOAuthVrfCookie) &&
38923
38944
  !lodash.isNull(zOAuthVrfCookie) &&
38924
38945
  lodash.isString(zOAuthVrfCookie.value)) {
38925
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, zOAuthVrfCookie.value);
38946
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, zOAuthVrfCookie.value);
38926
38947
  yield this.loginZaloV4();
38927
38948
  }
38928
38949
  else {
38929
38950
  yield this.loginZaloV3();
38930
38951
  }
38931
- if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) {
38952
+ if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) {
38932
38953
  throw apiResponse.error.loginFailed();
38933
38954
  }
38934
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
38955
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
38935
38956
  }
38936
38957
  throw apiResponse.error.loginFailed();
38937
38958
  });
@@ -38939,25 +38960,25 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38939
38960
  loginZaloV3() {
38940
38961
  return __awaiter(this, void 0, void 0, function* () {
38941
38962
  return yield axios
38942
- .get(CONFIG.APIS.GET_ACCESS_TOKEN_V3, {
38963
+ .get(APIS.GET_ACCESS_TOKEN_V3, {
38943
38964
  params: {
38944
- app_id: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zAppId),
38945
- redirect_uri: `${CONFIG.MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId)}/`,
38946
- code: __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuth),
38965
+ app_id: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zAppId),
38966
+ redirect_uri: `${MINI_APP_INTERNAL_LINK}/${__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId)}/`,
38967
+ code: __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuth),
38947
38968
  isSDK: true
38948
38969
  }
38949
38970
  })
38950
38971
  .then((response) => {
38951
38972
  let resData = response.data;
38952
38973
  if (resData.access_token) {
38953
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, resData.access_token);
38974
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, resData.access_token);
38954
38975
  const expiresIn = parseInt(resData.expires_in) * 1000;
38955
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, expiresIn);
38956
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, new Date().getTime());
38957
- this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
38976
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, expiresIn);
38977
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, new Date().getTime());
38978
+ this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
38958
38979
  window.ZJSBridge.setZAccSession &&
38959
- window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
38960
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
38980
+ window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
38981
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
38961
38982
  }
38962
38983
  return null;
38963
38984
  });
@@ -38966,15 +38987,15 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38966
38987
  loginZaloV4() {
38967
38988
  return __awaiter(this, void 0, void 0, function* () {
38968
38989
  const inputData = new URLSearchParams();
38969
- inputData.append('app_id', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_appId));
38970
- inputData.append('code', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuth) || '');
38971
- inputData.append('code_verifier', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_zOAuthVrf) || '');
38972
- if (lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_refreshToken))) {
38990
+ inputData.append('app_id', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_appId));
38991
+ inputData.append('code', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuth) || '');
38992
+ inputData.append('code_verifier', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_zOAuthVrf) || '');
38993
+ if (lodash.isNull(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_refreshToken))) {
38973
38994
  inputData.append('grant_type', 'authorization_code');
38974
38995
  }
38975
38996
  else {
38976
38997
  inputData.append('grant_type', 'refresh_token');
38977
- inputData.append('refresh_token', __classPrivateFieldGet(this, _ZaloMiniProgramSDK_refreshToken) || '');
38998
+ inputData.append('refresh_token', __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_refreshToken) || '');
38978
38999
  }
38979
39000
  const config = {
38980
39001
  headers: {
@@ -38982,21 +39003,21 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
38982
39003
  }
38983
39004
  };
38984
39005
  return yield axios
38985
- .post(CONFIG.APIS.GET_ACCESS_TOKEN, inputData, config)
39006
+ .post(APIS.GET_ACCESS_TOKEN, inputData, config)
38986
39007
  .then((response) => {
38987
39008
  const resData = response.data;
38988
39009
  if (resData.refresh_token) {
38989
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_refreshToken, resData.refresh_token);
39010
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_refreshToken, resData.refresh_token);
38990
39011
  }
38991
39012
  if (resData.access_token) {
38992
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, resData.access_token);
39013
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, resData.access_token);
38993
39014
  const expiresIn = parseInt(resData.expires_in) * 1000;
38994
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_tokenExpiresIn, expiresIn);
38995
- __classPrivateFieldSet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp, new Date().getTime());
38996
- this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
39015
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_tokenExpiresIn, expiresIn);
39016
+ __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp, new Date().getTime());
39017
+ this.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
38997
39018
  window.ZJSBridge.setZAccSession &&
38998
- window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken) || '');
38999
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
39019
+ window.ZJSBridge.setZAccSession(__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken) || '');
39020
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
39000
39021
  }
39001
39022
  return null;
39002
39023
  });
@@ -39004,43 +39025,43 @@ class ZaloMiniProgramSDK extends ZJSBridgeProvider {
39004
39025
  }
39005
39026
  getAccessToken(object) {
39006
39027
  return __awaiter(this, void 0, void 0, function* () {
39007
- const deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDK_prevGetTokenTimestamp);
39008
- if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken)) {
39028
+ const deltaTime = new Date().getTime() - __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_prevGetTokenTimestamp);
39029
+ if (!__classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken)) {
39009
39030
  throw apiResponse.error.loginRequired();
39010
39031
  }
39011
- if (deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDK_tokenExpiresIn))
39012
- return __classPrivateFieldGet(this, _ZaloMiniProgramSDK_accessToken);
39032
+ if (deltaTime < __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_tokenExpiresIn))
39033
+ return __classPrivateFieldGet(this, _ZaloMiniProgramSDKService_accessToken);
39013
39034
  return yield this.login();
39014
39035
  });
39015
39036
  }
39016
39037
  }
39017
- _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();
39038
+ _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();
39018
39039
 
39019
- var _MockSDK_appId, _MockSDK_appConfig, _MockSDK_zOAuth, _MockSDK_accessToken, _MockSDK_cache, _MockSDK_loggedId;
39020
- class MockSDK {
39040
+ var _MockSDKService_appId, _MockSDKService_appConfig, _MockSDKService_zOAuth, _MockSDKService_accessToken, _MockSDKService_cache, _MockSDKService_loggedId;
39041
+ class MockSDKService {
39021
39042
  constructor() {
39022
- _MockSDK_appId.set(this, ZAPP_ID);
39023
- _MockSDK_appConfig.set(this, APP_CONFIG);
39024
- _MockSDK_zOAuth.set(this, 'DEFAULT ZOAUTH');
39025
- _MockSDK_accessToken.set(this, 'DEFAULT ACCESS TOKEN');
39026
- _MockSDK_cache.set(this, {
39043
+ _MockSDKService_appId.set(this, ZAPP_ID);
39044
+ _MockSDKService_appConfig.set(this, APP_CONFIG);
39045
+ _MockSDKService_zOAuth.set(this, 'DEFAULT ZOAUTH');
39046
+ _MockSDKService_accessToken.set(this, 'DEFAULT ACCESS TOKEN');
39047
+ _MockSDKService_cache.set(this, {
39027
39048
  timer: {
39028
39049
  getToken: 0
39029
39050
  }
39030
39051
  });
39031
- _MockSDK_loggedId.set(this, false);
39052
+ _MockSDKService_loggedId.set(this, false);
39032
39053
  this.getLoginStatus = () => {
39033
- return __classPrivateFieldGet(this, _MockSDK_loggedId);
39054
+ return __classPrivateFieldGet(this, _MockSDKService_loggedId);
39034
39055
  };
39035
39056
  this.getAppId = () => {
39036
- return __classPrivateFieldGet(this, _MockSDK_appId);
39057
+ return __classPrivateFieldGet(this, _MockSDKService_appId);
39037
39058
  };
39038
39059
  this.login = () => {
39039
- __classPrivateFieldSet(this, _MockSDK_loggedId, true);
39040
- return Promise.resolve(__classPrivateFieldGet(this, _MockSDK_zOAuth));
39060
+ __classPrivateFieldSet(this, _MockSDKService_loggedId, true);
39061
+ return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_zOAuth));
39041
39062
  };
39042
39063
  this.getAccessToken = () => {
39043
- return Promise.resolve(__classPrivateFieldGet(this, _MockSDK_accessToken));
39064
+ return Promise.resolve(__classPrivateFieldGet(this, _MockSDKService_accessToken));
39044
39065
  };
39045
39066
  this.getVersion = Basics.getVersion;
39046
39067
  this.getSystemInfo = Basics.getSystemInfo;
@@ -39327,6 +39348,10 @@ class MockSDK {
39327
39348
  console.warn('This api only works on zalo app');
39328
39349
  return Promise.resolve();
39329
39350
  };
39351
+ this.openOutApp = (url) => {
39352
+ location.href = url;
39353
+ return Promise.resolve();
39354
+ };
39330
39355
  }
39331
39356
  on(event, fn, context) {
39332
39357
  throw new Error('Method not implemented.');
@@ -39347,7 +39372,7 @@ class MockSDK {
39347
39372
  });
39348
39373
  }
39349
39374
  }
39350
- _MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap(), _MockSDK_loggedId = new WeakMap();
39375
+ _MockSDKService_appId = new WeakMap(), _MockSDKService_appConfig = new WeakMap(), _MockSDKService_zOAuth = new WeakMap(), _MockSDKService_accessToken = new WeakMap(), _MockSDKService_cache = new WeakMap(), _MockSDKService_loggedId = new WeakMap();
39351
39376
 
39352
39377
  /*! *****************************************************************************
39353
39378
  Copyright (C) Microsoft. All rights reserved.
@@ -40583,12 +40608,12 @@ const validate = (target, propertyName, descriptor) => {
40583
40608
  return descriptor;
40584
40609
  };
40585
40610
 
40586
- var _SDKCreator_sdkManager;
40611
+ var _SDKCreator_sdkService;
40587
40612
  class SDKCreator {
40588
40613
  constructor() {
40589
40614
  this.events = ZMPEEmitter.getInstance();
40590
- _SDKCreator_sdkManager.set(this, void 0);
40591
- __classPrivateFieldSet(this, _SDKCreator_sdkManager, this.getInstance());
40615
+ _SDKCreator_sdkService.set(this, void 0);
40616
+ __classPrivateFieldSet(this, _SDKCreator_sdkService, this.getServiceInstance());
40592
40617
  this.events.addListener = (event, fn, context) => {
40593
40618
  const stringifyEventName = event;
40594
40619
  return this.events.addListener(Events[stringifyEventName], fn, context);
@@ -40611,11 +40636,11 @@ class SDKCreator {
40611
40636
  */
40612
40637
  login(object) {
40613
40638
  return __awaiter(this, void 0, void 0, function* () {
40614
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).login(object);
40639
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).login(object);
40615
40640
  });
40616
40641
  }
40617
40642
  getLoginStatus() {
40618
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getLoginStatus();
40643
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getLoginStatus();
40619
40644
  }
40620
40645
  /**
40621
40646
  * Get Access Token.
@@ -40634,248 +40659,266 @@ class SDKCreator {
40634
40659
  */
40635
40660
  getAccessToken(object) {
40636
40661
  return __awaiter(this, void 0, void 0, function* () {
40637
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getAccessToken(object);
40662
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getAccessToken(object);
40638
40663
  });
40639
40664
  }
40640
40665
  getVersion() {
40641
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getVersion();
40666
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getVersion();
40642
40667
  }
40643
40668
  getSystemInfo() {
40644
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getSystemInfo();
40669
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getSystemInfo();
40645
40670
  }
40646
40671
  setNavigationBarTitle(object) {
40647
40672
  return __awaiter(this, void 0, void 0, function* () {
40648
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarTitle(object);
40673
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarTitle(object);
40649
40674
  });
40650
40675
  }
40651
40676
  setNavigationBarColor(object) {
40652
40677
  return __awaiter(this, void 0, void 0, function* () {
40653
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarColor(object);
40678
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarColor(object);
40654
40679
  });
40655
40680
  }
40656
40681
  setBackgroundColor(object) {
40657
40682
  return __awaiter(this, void 0, void 0, function* () {
40658
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setBackgroundColor(object);
40683
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setBackgroundColor(object);
40659
40684
  });
40660
40685
  }
40661
40686
  setNavigationBarLeftButton(object) {
40662
40687
  return __awaiter(this, void 0, void 0, function* () {
40663
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setNavigationBarLeftButton(object);
40688
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setNavigationBarLeftButton(object);
40664
40689
  });
40665
40690
  }
40666
40691
  setDeviceOrientation(object) {
40667
40692
  return __awaiter(this, void 0, void 0, function* () {
40668
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setDeviceOrientation(object);
40693
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setDeviceOrientation(object);
40669
40694
  });
40670
40695
  }
40671
40696
  setStorage(object) {
40672
40697
  return __awaiter(this, void 0, void 0, function* () {
40673
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).setStorage(object);
40698
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).setStorage(object);
40674
40699
  });
40675
40700
  }
40676
40701
  getStorage(object) {
40677
40702
  return __awaiter(this, void 0, void 0, function* () {
40678
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getStorage(object);
40703
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getStorage(object);
40679
40704
  });
40680
40705
  }
40681
40706
  getStorageInfo(object) {
40682
40707
  return __awaiter(this, void 0, void 0, function* () {
40683
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getStorageInfo(object);
40708
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getStorageInfo(object);
40684
40709
  });
40685
40710
  }
40686
40711
  removeStorage(object) {
40687
40712
  return __awaiter(this, void 0, void 0, function* () {
40688
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).removeStorage(object);
40713
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).removeStorage(object);
40689
40714
  });
40690
40715
  }
40691
40716
  clearStorage(object) {
40692
40717
  return __awaiter(this, void 0, void 0, function* () {
40693
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).clearStorage(object);
40718
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).clearStorage(object);
40694
40719
  });
40695
40720
  }
40696
40721
  getUserInfo(object) {
40697
40722
  return __awaiter(this, void 0, void 0, function* () {
40698
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getUserInfo(object);
40723
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getUserInfo(object);
40699
40724
  });
40700
40725
  }
40701
40726
  getNetworkType(object) {
40702
40727
  return __awaiter(this, void 0, void 0, function* () {
40703
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getNetworkType(object);
40728
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getNetworkType(object);
40704
40729
  });
40705
40730
  }
40706
40731
  onNetworkStatusChange(callback) {
40707
40732
  return __awaiter(this, void 0, void 0, function* () {
40708
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onNetworkStatusChange(callback);
40733
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onNetworkStatusChange(callback);
40709
40734
  });
40710
40735
  }
40711
40736
  startBeaconDiscovery(object) {
40712
40737
  return __awaiter(this, void 0, void 0, function* () {
40713
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).startBeaconDiscovery(object);
40738
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).startBeaconDiscovery(object);
40714
40739
  });
40715
40740
  }
40716
40741
  stopBeaconDiscovery(object) {
40717
40742
  return __awaiter(this, void 0, void 0, function* () {
40718
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).stopBeaconDiscovery(object);
40743
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).stopBeaconDiscovery(object);
40719
40744
  });
40720
40745
  }
40721
40746
  getBeacons(object) {
40722
40747
  return __awaiter(this, void 0, void 0, function* () {
40723
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBeacons(object);
40748
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBeacons(object);
40724
40749
  });
40725
40750
  }
40726
40751
  closeApp(object) {
40727
40752
  return __awaiter(this, void 0, void 0, function* () {
40728
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).closeApp(object);
40753
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeApp(object);
40729
40754
  });
40730
40755
  }
40731
40756
  getLocation(object) {
40732
40757
  return __awaiter(this, void 0, void 0, function* () {
40733
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getLocation(object);
40758
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getLocation(object);
40734
40759
  });
40735
40760
  }
40736
40761
  stopBluetoothDevicesDiscovery() {
40737
40762
  return __awaiter(this, void 0, void 0, function* () {
40738
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).stopBluetoothDevicesDiscovery();
40763
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).stopBluetoothDevicesDiscovery();
40739
40764
  });
40740
40765
  }
40741
40766
  startBluetoothDevicesDiscovery(object) {
40742
40767
  return __awaiter(this, void 0, void 0, function* () {
40743
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).startBluetoothDevicesDiscovery(object);
40768
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).startBluetoothDevicesDiscovery(object);
40744
40769
  });
40745
40770
  }
40746
40771
  openBluetoothAdapter() {
40747
40772
  return __awaiter(this, void 0, void 0, function* () {
40748
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openBluetoothAdapter();
40773
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openBluetoothAdapter();
40749
40774
  });
40750
40775
  }
40751
40776
  onBluetoothDeviceFound() {
40752
40777
  return __awaiter(this, void 0, void 0, function* () {
40753
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onBluetoothDeviceFound();
40778
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onBluetoothDeviceFound();
40754
40779
  });
40755
40780
  }
40756
40781
  onBluetoothAdapterStateChange() {
40757
40782
  return __awaiter(this, void 0, void 0, function* () {
40758
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onBluetoothAdapterStateChange();
40783
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onBluetoothAdapterStateChange();
40759
40784
  });
40760
40785
  }
40761
40786
  getConnectedBluetoothDevices(object) {
40762
40787
  return __awaiter(this, void 0, void 0, function* () {
40763
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getConnectedBluetoothDevices(object);
40788
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getConnectedBluetoothDevices(object);
40764
40789
  });
40765
40790
  }
40766
40791
  getBluetoothDevices() {
40767
40792
  return __awaiter(this, void 0, void 0, function* () {
40768
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBluetoothDevices();
40793
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBluetoothDevices();
40769
40794
  });
40770
40795
  }
40771
40796
  getBluetoothAdapterState() {
40772
40797
  return __awaiter(this, void 0, void 0, function* () {
40773
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getBluetoothAdapterState();
40798
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getBluetoothAdapterState();
40774
40799
  });
40775
40800
  }
40776
40801
  closeBluetoothAdapter() {
40777
40802
  return __awaiter(this, void 0, void 0, function* () {
40778
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).closeBluetoothAdapter();
40803
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).closeBluetoothAdapter();
40779
40804
  });
40780
40805
  }
40781
40806
  scanQRCode(object) {
40782
40807
  return __awaiter(this, void 0, void 0, function* () {
40783
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).scanQRCode(object);
40808
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).scanQRCode(object);
40784
40809
  });
40785
40810
  }
40786
40811
  openProfile(object) {
40787
40812
  return __awaiter(this, void 0, void 0, function* () {
40788
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfile(object);
40813
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openProfile(object);
40789
40814
  });
40790
40815
  }
40791
40816
  openChat(object) {
40792
40817
  return __awaiter(this, void 0, void 0, function* () {
40793
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openChat(object);
40818
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openChat(object);
40794
40819
  });
40795
40820
  }
40796
40821
  openPostFeed(object) {
40797
40822
  return __awaiter(this, void 0, void 0, function* () {
40798
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openPostFeed(object);
40823
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openPostFeed(object);
40799
40824
  });
40800
40825
  }
40801
40826
  followOA(object) {
40802
40827
  return __awaiter(this, void 0, void 0, function* () {
40803
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).followOA(object);
40828
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).followOA(object);
40804
40829
  });
40805
40830
  }
40806
40831
  unfollowOA(object) {
40807
40832
  return __awaiter(this, void 0, void 0, function* () {
40808
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).unFollowOA(object);
40833
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).unFollowOA(object);
40809
40834
  });
40810
40835
  }
40811
40836
  openShareSheet(object) {
40812
40837
  return __awaiter(this, void 0, void 0, function* () {
40813
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openShareSheet(object);
40838
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openShareSheet(object);
40814
40839
  });
40815
40840
  }
40816
40841
  requestCameraPermission(object) {
40817
40842
  return __awaiter(this, void 0, void 0, function* () {
40818
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).requestCameraPermission(object);
40843
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).requestCameraPermission(object);
40819
40844
  });
40820
40845
  }
40821
40846
  createShortcut(object) {
40822
40847
  return __awaiter(this, void 0, void 0, function* () {
40823
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).createShortcut(object);
40848
+ const isIOS = checkPlatform().isIOS;
40849
+ let iconURL = getMetaValue('og:image:url') || '';
40850
+ iconURL = iconURL.replace(/^zbrowser?:/, '');
40851
+ if (!(iconURL === null || iconURL === void 0 ? void 0 : iconURL.includes('https'))) {
40852
+ iconURL = `https:${iconURL}`;
40853
+ }
40854
+ const title = document.title;
40855
+ const searchParams = object.params
40856
+ ? new URLSearchParams(object.params)
40857
+ : new URLSearchParams();
40858
+ if (isIOS) {
40859
+ searchParams.append('appId', APP_ID);
40860
+ searchParams.append('appName', title);
40861
+ searchParams.append('appIcon', iconURL);
40862
+ const iosShortcutURL = `https://mini.zalo.me/shortcut.html?${searchParams.toString()}`;
40863
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openOutApp(encodeURI(iosShortcutURL));
40864
+ }
40865
+ else
40866
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).createShortcut(`${MINI_APP_LINK}/${APP_ID}/?${searchParams.toString()}`, title, iconURL);
40824
40867
  });
40825
40868
  }
40826
40869
  openBioAuthentication(object) {
40827
40870
  return __awaiter(this, void 0, void 0, function* () {
40828
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openBioAuthentication(object);
40871
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openBioAuthentication(object);
40829
40872
  });
40830
40873
  }
40831
40874
  checkStateBioAuthentication(object) {
40832
40875
  return __awaiter(this, void 0, void 0, function* () {
40833
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).checkStateBioAuthentication(object);
40876
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).checkStateBioAuthentication(object);
40834
40877
  });
40835
40878
  }
40836
40879
  sendLocation(object) {
40837
40880
  return __awaiter(this, void 0, void 0, function* () {
40838
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).sendLocation(object);
40881
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).sendLocation(object);
40839
40882
  });
40840
40883
  }
40841
40884
  showToast(object) {
40842
40885
  return __awaiter(this, void 0, void 0, function* () {
40843
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).showToast(object);
40886
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).showToast(object);
40844
40887
  });
40845
40888
  }
40846
40889
  hideKeyboard(object) {
40847
40890
  return __awaiter(this, void 0, void 0, function* () {
40848
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).hideKeyboard(object);
40891
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).hideKeyboard(object);
40849
40892
  });
40850
40893
  }
40851
40894
  openPhone(object) {
40852
40895
  return __awaiter(this, void 0, void 0, function* () {
40853
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openPhone(object);
40896
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openPhone(object);
40854
40897
  });
40855
40898
  }
40856
40899
  openSMS(object) {
40857
40900
  return __awaiter(this, void 0, void 0, function* () {
40858
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openSMS(object);
40901
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openSMS(object);
40859
40902
  });
40860
40903
  }
40861
40904
  viewOAQr(object) {
40862
40905
  return __awaiter(this, void 0, void 0, function* () {
40863
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).viewOAQr(object);
40906
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).viewOAQr(object);
40864
40907
  });
40865
40908
  }
40866
40909
  keepScreen(object) {
40867
40910
  return __awaiter(this, void 0, void 0, function* () {
40868
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).keepScreen(object);
40911
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).keepScreen(object);
40869
40912
  });
40870
40913
  }
40871
40914
  saveImageToGallery(object) {
40872
40915
  return __awaiter(this, void 0, void 0, function* () {
40873
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40916
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).saveImageToPhotosAlbum(object);
40874
40917
  });
40875
40918
  }
40876
40919
  saveImageToPhotosAlbum(object) {
40877
40920
  return __awaiter(this, void 0, void 0, function* () {
40878
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40921
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).saveImageToPhotosAlbum(object);
40879
40922
  });
40880
40923
  }
40881
40924
  openMiniApp(object) {
@@ -40890,46 +40933,46 @@ class SDKCreator {
40890
40933
  });
40891
40934
  object.params = params;
40892
40935
  }
40893
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openMiniApp(object);
40936
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openMiniApp(object);
40894
40937
  });
40895
40938
  }
40896
40939
  vibrate(object) {
40897
40940
  return __awaiter(this, void 0, void 0, function* () {
40898
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).vibrate(object);
40941
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).vibrate(object);
40899
40942
  });
40900
40943
  }
40901
40944
  openWebview(object) {
40902
40945
  return __awaiter(this, void 0, void 0, function* () {
40903
- yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openWebview(object);
40946
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openWebview(object);
40904
40947
  });
40905
40948
  }
40906
40949
  getRouteParams() {
40907
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getRouteParams();
40950
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getRouteParams();
40908
40951
  }
40909
40952
  getAppInfo(object) {
40910
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).getAppInfo();
40953
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).getAppInfo();
40911
40954
  }
40912
40955
  sendDataToPreviousMiniApp(object) {
40913
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).sendDataToPreviousMiniApp(object);
40956
+ return __classPrivateFieldGet(this, _SDKCreator_sdkService).sendDataToPreviousMiniApp(object);
40914
40957
  }
40915
40958
  onCallbackData(callback) {
40916
40959
  return __awaiter(this, void 0, void 0, function* () {
40917
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).onCallbackData(callback);
40960
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).onCallbackData(callback);
40918
40961
  });
40919
40962
  }
40920
40963
  getPhoneNumber(object) {
40921
40964
  return __awaiter(this, void 0, void 0, function* () {
40922
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).getPhoneNumber();
40965
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).getPhoneNumber();
40923
40966
  });
40924
40967
  }
40925
40968
  openProfilePicker(object) {
40926
40969
  return __awaiter(this, void 0, void 0, function* () {
40927
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfilePicker(object);
40970
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openProfilePicker(object);
40928
40971
  });
40929
40972
  }
40930
40973
  connectWifi(object) {
40931
40974
  return __awaiter(this, void 0, void 0, function* () {
40932
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).connectWifi(object);
40975
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).connectWifi(object);
40933
40976
  });
40934
40977
  }
40935
40978
  openMediaPicker(object) {
@@ -40945,7 +40988,7 @@ class SDKCreator {
40945
40988
  editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
40946
40989
  const silentRequest = object.silentRequest === true ? 1 : 0;
40947
40990
  const maxSelectItem = object.maxSelectItem;
40948
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
40991
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService).openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
40949
40992
  });
40950
40993
  }
40951
40994
  getShareableLink(object) {
@@ -40956,7 +40999,7 @@ class SDKCreator {
40956
40999
  });
40957
41000
  }
40958
41001
  }
40959
- _SDKCreator_sdkManager = new WeakMap();
41002
+ _SDKCreator_sdkService = new WeakMap();
40960
41003
  __decorate([
40961
41004
  handleError
40962
41005
  ], SDKCreator.prototype, "login", null);
@@ -41362,13 +41405,13 @@ __decorate([
41362
41405
  }))
41363
41406
  ], SDKCreator.prototype, "getShareableLink", null);
41364
41407
  class ZaloMiniAppSDKCreator extends SDKCreator {
41365
- getInstance() {
41366
- return ZaloMiniProgramSDK.getInstance();
41408
+ getServiceInstance() {
41409
+ return ZaloMiniProgramSDKService.getInstance();
41367
41410
  }
41368
41411
  }
41369
41412
  class MockSDKCreator extends SDKCreator {
41370
- getInstance() {
41371
- return new MockSDK();
41413
+ getServiceInstance() {
41414
+ return new MockSDKService();
41372
41415
  }
41373
41416
  }
41374
41417