zmp-sdk 2.19.0-rc.7 → 2.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -3085,7 +3085,8 @@ const parseJSON = (str) => {
3085
3085
  const formattedStr = str
3086
3086
  .replace(/\n/g, '\\n')
3087
3087
  .replace(/\r/g, '\\r')
3088
- .replace(/\t/g, '\\t');
3088
+ .replace(/\t/g, '\\t')
3089
+ .replace(/\x00/g, '');
3089
3090
  return JSON.parse(formattedStr, (key, value) => {
3090
3091
  return value;
3091
3092
  });
@@ -4058,7 +4059,7 @@ class ZJSBridgeProvider {
4058
4059
  }
4059
4060
  _ZJSBridgeProvider_bridge = new WeakMap();
4060
4061
 
4061
- var version$1 = "2.19.0-rc.7";
4062
+ var version$1 = "2.19.2";
4062
4063
 
4063
4064
  class Basics {
4064
4065
  /**
@@ -5009,6 +5010,18 @@ class Device {
5009
5010
  });
5010
5011
  });
5011
5012
  }
5013
+ /**
5014
+ * Open App Store.
5015
+ * @async
5016
+ * @function openAppStore
5017
+ * @category Device
5018
+ *
5019
+ */
5020
+ static openAppStore(object) {
5021
+ return __awaiter(this, void 0, void 0, function* () {
5022
+ return yield this.callNative(ACTION.OPEN_APPSTORE, object);
5023
+ });
5024
+ }
5012
5025
  }
5013
5026
 
5014
5027
  var _LocalResourceStorage_storage, _LocalResourceStorage_prefix, _LocalResourceStorage_resourceInfo;
@@ -6027,15 +6040,14 @@ class Zalo {
6027
6040
  edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
6028
6041
  silent_request: silentRequest,
6029
6042
  upload: uploadSetting,
6030
- max_select_item: maxSelectItem
6043
+ max_select_items: maxSelectItem
6031
6044
  }, {
6032
6045
  isMultiCallback: true,
6033
6046
  callback: (nativeData, error) => {
6034
- var _a, _b;
6047
+ var _a;
6035
6048
  if (nativeData.error_code === 0) {
6036
- const resultContent = stringToData((_a = nativeData.data) === null || _a === void 0 ? void 0 : _a.result_content);
6037
6049
  const res = {
6038
- urls: (_b = resultContent === null || resultContent === void 0 ? void 0 : resultContent.data) === null || _b === void 0 ? void 0 : _b.urls
6050
+ data: (_a = nativeData.data) === null || _a === void 0 ? void 0 : _a.result_content
6039
6051
  };
6040
6052
  return Promise.resolve(res);
6041
6053
  }
@@ -6234,6 +6246,7 @@ class ZaloMiniProgramSDKService extends ZJSBridgeProvider {
6234
6246
  this.openMediaPicker = Zalo.openMediaPicker;
6235
6247
  this.openOutApp = Zalo.openOutApp;
6236
6248
  this.closeLoading = Window.closeLoading;
6249
+ this.openAppStore = Device.openAppStore;
6237
6250
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuth, null, "f");
6238
6251
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_zOAuthVrf, null, "f");
6239
6252
  __classPrivateFieldSet(this, _ZaloMiniProgramSDKService_accessToken, null, "f");
@@ -6694,6 +6707,9 @@ class MockSDKService {
6694
6707
  this.closeLoading = (when) => {
6695
6708
  return Promise.resolve();
6696
6709
  };
6710
+ this.openAppStore = (data) => {
6711
+ return Promise.resolve();
6712
+ };
6697
6713
  }
6698
6714
  on(event, fn, context) {
6699
6715
  throw new Error('Method not implemented.');
@@ -6710,9 +6726,10 @@ class MockSDKService {
6710
6726
  openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
6711
6727
  console.warn('This api only works on zalo app');
6712
6728
  return Promise.resolve({
6713
- urls: []
6729
+ data: ""
6714
6730
  });
6715
6731
  }
6732
+ ;
6716
6733
  }
6717
6734
  _MockSDKService_appId = new WeakMap(), _MockSDKService_appConfig = new WeakMap(), _MockSDKService_zOAuth = new WeakMap(), _MockSDKService_accessToken = new WeakMap(), _MockSDKService_cache = new WeakMap(), _MockSDKService_loggedId = new WeakMap();
6718
6735
 
@@ -6942,8 +6959,6 @@ var browser$1 = {
6942
6959
  uptime: uptime
6943
6960
  };
6944
6961
 
6945
- var process$1 = browser$1;
6946
-
6947
6962
  /*! *****************************************************************************
6948
6963
  Copyright (C) Microsoft. All rights reserved.
6949
6964
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -7009,7 +7024,7 @@ var Reflect$1;
7009
7024
  };
7010
7025
  // Load global or shim versions of Map, Set, and WeakMap
7011
7026
  var functionPrototype = Object.getPrototypeOf(Function);
7012
- var usePolyfill = typeof process$1 === "object" && process$1.env && process$1.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
7027
+ var usePolyfill = typeof browser$1 === "object" && browser$1.env && browser$1.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
7013
7028
  var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
7014
7029
  var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
7015
7030
  var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
@@ -8525,9 +8540,9 @@ class SDKCreator {
8525
8540
  openWebview(object) {
8526
8541
  return __awaiter(this, void 0, void 0, function* () {
8527
8542
  const url = new URL(object.url);
8528
- const typeInapp = url.searchParams.get("typeInapp");
8543
+ const typeInapp = url.searchParams.get('typeInapp');
8529
8544
  if (_.isEmpty(typeInapp)) {
8530
- url.searchParams.set("typeInapp", "1");
8545
+ url.searchParams.set('typeInapp', '1');
8531
8546
  }
8532
8547
  yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(url.href);
8533
8548
  });
@@ -8587,7 +8602,7 @@ class SDKCreator {
8587
8602
  users = uIds.map((item) => {
8588
8603
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
8589
8604
  return {
8590
- id: ((_b = (_a = resData.data[item]) === null || _a === void 0 ? void 0 : _a.user_info) === null || _b === void 0 ? void 0 : _b.user_id_by_app) || "",
8605
+ id: ((_b = (_a = resData.data[item]) === null || _a === void 0 ? void 0 : _a.user_info) === null || _b === void 0 ? void 0 : _b.user_id_by_app) || '',
8591
8606
  profile: {
8592
8607
  name: (_d = (_c = resData.data[item]) === null || _c === void 0 ? void 0 : _c.user_info) === null || _d === void 0 ? void 0 : _d.name,
8593
8608
  avatar: (_h = (_g = (_f = (_e = resData.data[item]) === null || _e === void 0 ? void 0 : _e.user_info) === null || _f === void 0 ? void 0 : _f.picture) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.url
@@ -8655,6 +8670,14 @@ class SDKCreator {
8655
8670
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").closeLoading('user action');
8656
8671
  });
8657
8672
  }
8673
+ requestUpdateZalo(object) {
8674
+ return __awaiter(this, void 0, void 0, function* () {
8675
+ const appStoreURL = checkPlatform().isIOS
8676
+ ? 'https://apps.apple.com/vn/app/zalo/id579523206'
8677
+ : 'https://play.google.com/store/apps/details?id=com.zing.zalo';
8678
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openOutApp(appStoreURL);
8679
+ });
8680
+ }
8658
8681
  }
8659
8682
  _SDKCreator_sdkService = new WeakMap();
8660
8683
  __decorate([
@@ -9042,9 +9065,9 @@ __decorate([
9042
9065
  validate,
9043
9066
  __param(0, checkType('object', {
9044
9067
  type: checkData('string', {
9045
- values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
9068
+ values: ['photo', 'video', 'file']
9046
9069
  }),
9047
- 'serverUploadUrl': checkData('url'),
9070
+ serverUploadUrl: checkData('url'),
9048
9071
  'maxItemSize?': checkData('number', { min: 0 }),
9049
9072
  'editView?': checkData('object'),
9050
9073
  'editView.enable?': checkData('boolean'),
@@ -9069,6 +9092,10 @@ __decorate([
9069
9092
  handleError,
9070
9093
  validate
9071
9094
  ], SDKCreator.prototype, "closeLoading", null);
9095
+ __decorate([
9096
+ handleError,
9097
+ validate
9098
+ ], SDKCreator.prototype, "requestUpdateZalo", null);
9072
9099
  class ZaloMiniAppSDKCreator extends SDKCreator {
9073
9100
  getServiceInstance() {
9074
9101
  return ZaloMiniProgramSDKService.getInstance();
@@ -9348,4 +9375,5 @@ else {
9348
9375
  }
9349
9376
  window.ZaloMiniAppSDK = app;
9350
9377
 
9351
- export { ChatType, Events, MediaPickerType, NativeCode, NetworkType, OrientationType, payment as Payment, PlatformType, PostFeedType, ProfileType, SDKCreator, ShareSheetType, VibrateType, app as default };
9378
+ export default app;
9379
+ export { ChatType, Events, MediaPickerType, NativeCode, NetworkType, OrientationType, payment as Payment, PlatformType, PostFeedType, ProfileType, SDKCreator, ShareSheetType, VibrateType };