zmp-sdk 2.18.9 → 2.18.10

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.
@@ -2260,7 +2260,6 @@
2260
2260
  '4G': isAndroid ? 13 : 2
2261
2261
  });
2262
2262
  const MEDIA_PICKER_LIMIT = 1 * MB;
2263
- const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
2264
2263
  const ACTION = {
2265
2264
  GET_DOWNLOADED_STICKER: {
2266
2265
  name: 'action.get.downloaded.sticker',
@@ -2579,7 +2578,7 @@
2579
2578
  },
2580
2579
  PICK_MEDIA: {
2581
2580
  name: 'action.pick.media',
2582
- version_live: { iOS: 452 }
2581
+ version_live: { iOS: 440 }
2583
2582
  },
2584
2583
  MP_CLOSE_LOADINGVIEW: {
2585
2584
  name: 'action.mp.close.loadingview'
@@ -4055,7 +4054,7 @@
4055
4054
  }
4056
4055
  _ZJSBridgeProvider_bridge = new WeakMap();
4057
4056
 
4058
- var version = "2.18.9";
4057
+ var version = "2.18.10";
4059
4058
 
4060
4059
  class Basics {
4061
4060
  /**
@@ -5557,10 +5556,10 @@
5557
5556
  * @category Window
5558
5557
  *
5559
5558
  */
5560
- static openWebview(object) {
5559
+ static openWebview(url) {
5561
5560
  return __awaiter(this, void 0, void 0, function* () {
5562
5561
  yield this.callNative(ACTION.OPEN_INAPP, {
5563
- url: object.url
5562
+ url: url
5564
5563
  });
5565
5564
  });
5566
5565
  }
@@ -6008,12 +6007,12 @@
6008
6007
  * @category Zalo
6009
6008
  *
6010
6009
  */
6011
- static openMediaPicker(type, editView, silentRequest, maxSelectItem) {
6010
+ static openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
6012
6011
  return __awaiter(this, void 0, void 0, function* () {
6013
6012
  const uploadSetting = {
6014
6013
  type: 0,
6015
- url: MEDIA_PICKER_UPLOAD_SERVER,
6016
- maxSize: MEDIA_PICKER_LIMIT
6014
+ url: serverUpload,
6015
+ maxSize: maxItemSize || MEDIA_PICKER_LIMIT
6017
6016
  };
6018
6017
  const defaultEditView = {
6019
6018
  enable: 1,
@@ -6646,8 +6645,8 @@
6646
6645
  this.vibrate = () => {
6647
6646
  return Promise.resolve();
6648
6647
  };
6649
- this.openWebview = (object) => {
6650
- location.replace(object.url);
6648
+ this.openWebview = (url) => {
6649
+ location.replace(url);
6651
6650
  return Promise.resolve();
6652
6651
  };
6653
6652
  this.getRouteParams = Routing.getRouteParams;
@@ -6704,7 +6703,7 @@
6704
6703
  removeAllListeners(event) {
6705
6704
  throw new Error('Method not implemented.');
6706
6705
  }
6707
- openMediaPicker(type, editView, silentRequest, maxSelectItem) {
6706
+ openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
6708
6707
  console.warn('This api only works on zalo app');
6709
6708
  return Promise.resolve({
6710
6709
  urls: []
@@ -7161,7 +7160,12 @@
7161
7160
  }
7162
7161
  openWebview(object) {
7163
7162
  return __awaiter(this, void 0, void 0, function* () {
7164
- yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(object);
7163
+ const url = new URL(object.url);
7164
+ const typeInapp = url.searchParams.get("typeInapp");
7165
+ if (_.isEmpty(typeInapp)) {
7166
+ url.searchParams.set("typeInapp", "1");
7167
+ }
7168
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(url.href);
7165
7169
  });
7166
7170
  }
7167
7171
  getRouteParams() {
@@ -7272,7 +7276,7 @@
7272
7276
  editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
7273
7277
  const silentRequest = object.silentRequest === true ? 1 : 0;
7274
7278
  const maxSelectItem = object.maxSelectItem;
7275
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
7279
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, object.serverUploadUrl, object.maxItemSize, editView, silentRequest, maxSelectItem);
7276
7280
  });
7277
7281
  }
7278
7282
  getShareableLink(object) {
@@ -7632,7 +7636,7 @@
7632
7636
  handleError,
7633
7637
  validate,
7634
7638
  __param(0, checkType('object', {
7635
- url: checkData('string')
7639
+ url: checkData('url')
7636
7640
  }))
7637
7641
  ], SDKCreator.prototype, "openWebview", null);
7638
7642
  __decorate([
@@ -7676,6 +7680,8 @@
7676
7680
  type: checkData('string', {
7677
7681
  values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
7678
7682
  }),
7683
+ 'serverUploadUrl': checkData('url'),
7684
+ 'maxItemSize?': checkData('number', { min: 0 }),
7679
7685
  'editView?': checkData('object'),
7680
7686
  'editView.enable?': checkData('boolean'),
7681
7687
  'editView.aspectRatio?': checkData('string', { regex: /^\d+:\d+$/ }),
package/dist/index.es.js CHANGED
@@ -2257,7 +2257,6 @@ const NETWORK_TYPE = (isAndroid) => ({
2257
2257
  '4G': isAndroid ? 13 : 2
2258
2258
  });
2259
2259
  const MEDIA_PICKER_LIMIT = 1 * MB;
2260
- const MEDIA_PICKER_UPLOAD_SERVER = 'https://zapi-server.tungnt.xyz/upload/photos';
2261
2260
  const ACTION = {
2262
2261
  GET_DOWNLOADED_STICKER: {
2263
2262
  name: 'action.get.downloaded.sticker',
@@ -2576,7 +2575,7 @@ const ACTION = {
2576
2575
  },
2577
2576
  PICK_MEDIA: {
2578
2577
  name: 'action.pick.media',
2579
- version_live: { iOS: 452 }
2578
+ version_live: { iOS: 440 }
2580
2579
  },
2581
2580
  MP_CLOSE_LOADINGVIEW: {
2582
2581
  name: 'action.mp.close.loadingview'
@@ -4052,7 +4051,7 @@ class ZJSBridgeProvider {
4052
4051
  }
4053
4052
  _ZJSBridgeProvider_bridge = new WeakMap();
4054
4053
 
4055
- var version$1 = "2.18.9";
4054
+ var version$1 = "2.18.10";
4056
4055
 
4057
4056
  class Basics {
4058
4057
  /**
@@ -5554,10 +5553,10 @@ class Window {
5554
5553
  * @category Window
5555
5554
  *
5556
5555
  */
5557
- static openWebview(object) {
5556
+ static openWebview(url) {
5558
5557
  return __awaiter(this, void 0, void 0, function* () {
5559
5558
  yield this.callNative(ACTION.OPEN_INAPP, {
5560
- url: object.url
5559
+ url: url
5561
5560
  });
5562
5561
  });
5563
5562
  }
@@ -6005,12 +6004,12 @@ class Zalo {
6005
6004
  * @category Zalo
6006
6005
  *
6007
6006
  */
6008
- static openMediaPicker(type, editView, silentRequest, maxSelectItem) {
6007
+ static openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
6009
6008
  return __awaiter(this, void 0, void 0, function* () {
6010
6009
  const uploadSetting = {
6011
6010
  type: 0,
6012
- url: MEDIA_PICKER_UPLOAD_SERVER,
6013
- maxSize: MEDIA_PICKER_LIMIT
6011
+ url: serverUpload,
6012
+ maxSize: maxItemSize || MEDIA_PICKER_LIMIT
6014
6013
  };
6015
6014
  const defaultEditView = {
6016
6015
  enable: 1,
@@ -6643,8 +6642,8 @@ class MockSDKService {
6643
6642
  this.vibrate = () => {
6644
6643
  return Promise.resolve();
6645
6644
  };
6646
- this.openWebview = (object) => {
6647
- location.replace(object.url);
6645
+ this.openWebview = (url) => {
6646
+ location.replace(url);
6648
6647
  return Promise.resolve();
6649
6648
  };
6650
6649
  this.getRouteParams = Routing.getRouteParams;
@@ -6701,7 +6700,7 @@ class MockSDKService {
6701
6700
  removeAllListeners(event) {
6702
6701
  throw new Error('Method not implemented.');
6703
6702
  }
6704
- openMediaPicker(type, editView, silentRequest, maxSelectItem) {
6703
+ openMediaPicker(type, serverUpload, maxItemSize, editView, silentRequest, maxSelectItem) {
6705
6704
  console.warn('This api only works on zalo app');
6706
6705
  return Promise.resolve({
6707
6706
  urls: []
@@ -8516,7 +8515,12 @@ class SDKCreator {
8516
8515
  }
8517
8516
  openWebview(object) {
8518
8517
  return __awaiter(this, void 0, void 0, function* () {
8519
- yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(object);
8518
+ const url = new URL(object.url);
8519
+ const typeInapp = url.searchParams.get("typeInapp");
8520
+ if (_.isEmpty(typeInapp)) {
8521
+ url.searchParams.set("typeInapp", "1");
8522
+ }
8523
+ yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openWebview(url.href);
8520
8524
  });
8521
8525
  }
8522
8526
  getRouteParams() {
@@ -8627,7 +8631,7 @@ class SDKCreator {
8627
8631
  editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
8628
8632
  const silentRequest = object.silentRequest === true ? 1 : 0;
8629
8633
  const maxSelectItem = object.maxSelectItem;
8630
- return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
8634
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkService, "f").openMediaPicker(object.type, object.serverUploadUrl, object.maxItemSize, editView, silentRequest, maxSelectItem);
8631
8635
  });
8632
8636
  }
8633
8637
  getShareableLink(object) {
@@ -8987,7 +8991,7 @@ __decorate([
8987
8991
  handleError,
8988
8992
  validate,
8989
8993
  __param(0, checkType('object', {
8990
- url: checkData('string')
8994
+ url: checkData('url')
8991
8995
  }))
8992
8996
  ], SDKCreator.prototype, "openWebview", null);
8993
8997
  __decorate([
@@ -9031,6 +9035,8 @@ __decorate([
9031
9035
  type: checkData('string', {
9032
9036
  values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
9033
9037
  }),
9038
+ 'serverUploadUrl': checkData('url'),
9039
+ 'maxItemSize?': checkData('number', { min: 0 }),
9034
9040
  'editView?': checkData('object'),
9035
9041
  'editView.enable?': checkData('boolean'),
9036
9042
  'editView.aspectRatio?': checkData('string', { regex: /^\d+:\d+$/ }),