zmp-sdk 2.18.0 → 2.18.3

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.
@@ -19689,7 +19689,7 @@
19689
19689
  })(PostFeedType || (PostFeedType = {}));
19690
19690
  var ShareSheetType;
19691
19691
  (function (ShareSheetType) {
19692
- ShareSheetType[ShareSheetType["image"] = 21] = "image";
19692
+ ShareSheetType[ShareSheetType["image"] = 1] = "image";
19693
19693
  ShareSheetType[ShareSheetType["gif"] = 11] = "gif";
19694
19694
  ShareSheetType[ShareSheetType["video"] = 12] = "video";
19695
19695
  ShareSheetType[ShareSheetType["link"] = 4] = "link";
@@ -21616,7 +21616,7 @@
21616
21616
  }
21617
21617
  _ZJSBridgeProvider_bridge = new WeakMap();
21618
21618
 
21619
- var version = "2.18.0";
21619
+ var version = "2.18.3";
21620
21620
 
21621
21621
  class Basics {
21622
21622
  /**
@@ -23405,8 +23405,16 @@
23405
23405
  let reqData = {};
23406
23406
  switch (object.type) {
23407
23407
  case 'image':
23408
+ let photoUrls = [];
23409
+ if (Array.isArray(object.data.imageUrls) && object.data.imageUrls.length > 0) {
23410
+ photoUrls = object.data.imageUrls;
23411
+ }
23412
+ else {
23413
+ photoUrls.push(object.data.imageUrl);
23414
+ }
23408
23415
  reqData = {
23409
- photoUrls: object.data.imageUrls,
23416
+ photoUrls: photoUrls,
23417
+ photoUrl: object.data.imageUrl,
23410
23418
  caption: object.data.caption
23411
23419
  };
23412
23420
  break;
@@ -24358,13 +24366,22 @@
24358
24366
  isMeetCondition = Object.keys(condition).every((key) => lodash.get(argument, key) === condition[key]);
24359
24367
  }
24360
24368
  if (isMeetCondition) {
24361
- fields.forEach((field) => {
24362
- if (lodash.isEmpty(lodash.get(argument, field))) {
24363
- if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
24364
- lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
24369
+ fields.forEach((item) => {
24370
+ const isInValidField = (field) => {
24371
+ let isInValid = false;
24372
+ if (lodash.isEmpty(lodash.get(argument, field))) {
24373
+ if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
24374
+ lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
24375
+ }
24376
+ isInValid = true;
24365
24377
  }
24366
- else
24367
- throw apiResponse.error.missingParam(field);
24378
+ return isInValid;
24379
+ };
24380
+ if (Array.isArray(item) && item.length > 0 && item.every(isInValidField)) {
24381
+ throw apiResponse.error.missingParam(item.join(' or '));
24382
+ }
24383
+ else if (lodash.isString(item) && isInValidField(item)) {
24384
+ throw apiResponse.error.missingParam(item);
24368
24385
  }
24369
24386
  });
24370
24387
  }
@@ -25018,7 +25035,7 @@
25018
25035
  __decorate([
25019
25036
  handleError,
25020
25037
  validate,
25021
- __param(0, required(['data.imageUrls'], { if: { type: 'image' } })),
25038
+ __param(0, required([['data.imageUrl', 'data.imageUrls']], { if: { type: 'image' } })),
25022
25039
  __param(0, required(['data.link'], { if: { type: 'link' } })),
25023
25040
  __param(0, required(['data.id'], { if: { type: 'oa' } })),
25024
25041
  __param(0, required(['data.gifUrl'], { if: { type: 'gif' } })),
@@ -25246,7 +25263,6 @@
25246
25263
  }
25247
25264
  }
25248
25265
 
25249
- var _a;
25250
25266
  // Zalo Mini App API
25251
25267
  const platform = checkPlatform();
25252
25268
  let app;
@@ -25260,11 +25276,8 @@
25260
25276
  ZaloJSBridge.getInstance().onMultiJSCall(key, data);
25261
25277
  };
25262
25278
  };
25263
- const zalo_h5_event_handler = (_a = window === null || window === void 0 ? void 0 : window.zaloJSV2) === null || _a === void 0 ? void 0 : _a.zalo_h5_event_handler;
25264
25279
  window.zaloJSV2 = {
25265
25280
  zalo_h5_event_handler: function (eventId, eventName, eventData) {
25266
- typeof zalo_h5_event_handler === 'function' &&
25267
- zalo_h5_event_handler(eventId, eventName, eventData);
25268
25281
  ZaloJSBridge.getInstance().nativeEventHandler(eventId, eventName, eventData);
25269
25282
  }
25270
25283
  };
package/dist/index.es.js CHANGED
@@ -19686,7 +19686,7 @@ var PostFeedType;
19686
19686
  })(PostFeedType || (PostFeedType = {}));
19687
19687
  var ShareSheetType;
19688
19688
  (function (ShareSheetType) {
19689
- ShareSheetType[ShareSheetType["image"] = 21] = "image";
19689
+ ShareSheetType[ShareSheetType["image"] = 1] = "image";
19690
19690
  ShareSheetType[ShareSheetType["gif"] = 11] = "gif";
19691
19691
  ShareSheetType[ShareSheetType["video"] = 12] = "video";
19692
19692
  ShareSheetType[ShareSheetType["link"] = 4] = "link";
@@ -21613,7 +21613,7 @@ class ZJSBridgeProvider {
21613
21613
  }
21614
21614
  _ZJSBridgeProvider_bridge = new WeakMap();
21615
21615
 
21616
- var version = "2.18.0";
21616
+ var version = "2.18.3";
21617
21617
 
21618
21618
  class Basics {
21619
21619
  /**
@@ -23402,8 +23402,16 @@ class Zalo {
23402
23402
  let reqData = {};
23403
23403
  switch (object.type) {
23404
23404
  case 'image':
23405
+ let photoUrls = [];
23406
+ if (Array.isArray(object.data.imageUrls) && object.data.imageUrls.length > 0) {
23407
+ photoUrls = object.data.imageUrls;
23408
+ }
23409
+ else {
23410
+ photoUrls.push(object.data.imageUrl);
23411
+ }
23405
23412
  reqData = {
23406
- photoUrls: object.data.imageUrls,
23413
+ photoUrls: photoUrls,
23414
+ photoUrl: object.data.imageUrl,
23407
23415
  caption: object.data.caption
23408
23416
  };
23409
23417
  break;
@@ -25487,13 +25495,22 @@ const validate = (target, propertyName, descriptor) => {
25487
25495
  isMeetCondition = Object.keys(condition).every((key) => lodash.get(argument, key) === condition[key]);
25488
25496
  }
25489
25497
  if (isMeetCondition) {
25490
- fields.forEach((field) => {
25491
- if (lodash.isEmpty(lodash.get(argument, field))) {
25492
- if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
25493
- lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
25498
+ fields.forEach((item) => {
25499
+ const isInValidField = (field) => {
25500
+ let isInValid = false;
25501
+ if (lodash.isEmpty(lodash.get(argument, field))) {
25502
+ if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
25503
+ lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
25504
+ }
25505
+ isInValid = true;
25494
25506
  }
25495
- else
25496
- throw apiResponse.error.missingParam(field);
25507
+ return isInValid;
25508
+ };
25509
+ if (Array.isArray(item) && item.length > 0 && item.every(isInValidField)) {
25510
+ throw apiResponse.error.missingParam(item.join(' or '));
25511
+ }
25512
+ else if (lodash.isString(item) && isInValidField(item)) {
25513
+ throw apiResponse.error.missingParam(item);
25497
25514
  }
25498
25515
  });
25499
25516
  }
@@ -26147,7 +26164,7 @@ __decorate([
26147
26164
  __decorate([
26148
26165
  handleError,
26149
26166
  validate,
26150
- __param(0, required(['data.imageUrls'], { if: { type: 'image' } })),
26167
+ __param(0, required([['data.imageUrl', 'data.imageUrls']], { if: { type: 'image' } })),
26151
26168
  __param(0, required(['data.link'], { if: { type: 'link' } })),
26152
26169
  __param(0, required(['data.id'], { if: { type: 'oa' } })),
26153
26170
  __param(0, required(['data.gifUrl'], { if: { type: 'gif' } })),
@@ -26375,7 +26392,6 @@ class MockSDKCreator extends SDKCreator {
26375
26392
  }
26376
26393
  }
26377
26394
 
26378
- var _a;
26379
26395
  // Zalo Mini App API
26380
26396
  const platform = checkPlatform();
26381
26397
  let app;
@@ -26389,11 +26405,8 @@ window.onMultiJSCall = (key) => {
26389
26405
  ZaloJSBridge.getInstance().onMultiJSCall(key, data);
26390
26406
  };
26391
26407
  };
26392
- const zalo_h5_event_handler = (_a = window === null || window === void 0 ? void 0 : window.zaloJSV2) === null || _a === void 0 ? void 0 : _a.zalo_h5_event_handler;
26393
26408
  window.zaloJSV2 = {
26394
26409
  zalo_h5_event_handler: function (eventId, eventName, eventData) {
26395
- typeof zalo_h5_event_handler === 'function' &&
26396
- zalo_h5_event_handler(eventId, eventName, eventData);
26397
26410
  ZaloJSBridge.getInstance().nativeEventHandler(eventId, eventName, eventData);
26398
26411
  }
26399
26412
  };