zmp-sdk 2.18.0 → 2.18.1

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.
@@ -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.1";
21620
21620
 
21621
21621
  class Basics {
21622
21622
  /**
@@ -23405,8 +23405,15 @@
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,
23410
23417
  caption: object.data.caption
23411
23418
  };
23412
23419
  break;
@@ -24358,13 +24365,22 @@
24358
24365
  isMeetCondition = Object.keys(condition).every((key) => lodash.get(argument, key) === condition[key]);
24359
24366
  }
24360
24367
  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));
24368
+ fields.forEach((item) => {
24369
+ const isInValidField = (field) => {
24370
+ let isInValid = false;
24371
+ if (lodash.isEmpty(lodash.get(argument, field))) {
24372
+ if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
24373
+ lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
24374
+ }
24375
+ isInValid = true;
24365
24376
  }
24366
- else
24367
- throw apiResponse.error.missingParam(field);
24377
+ return isInValid;
24378
+ };
24379
+ if (Array.isArray(item) && item.length > 0 && item.every(isInValidField)) {
24380
+ throw apiResponse.error.missingParam(item.join(' or '));
24381
+ }
24382
+ else if (lodash.isString(item) && isInValidField(item)) {
24383
+ throw apiResponse.error.missingParam(item);
24368
24384
  }
24369
24385
  });
24370
24386
  }
@@ -25018,7 +25034,7 @@
25018
25034
  __decorate([
25019
25035
  handleError,
25020
25036
  validate,
25021
- __param(0, required(['data.imageUrls'], { if: { type: 'image' } })),
25037
+ __param(0, required([['data.imageUrl', 'data.imageUrls']], { if: { type: 'image' } })),
25022
25038
  __param(0, required(['data.link'], { if: { type: 'link' } })),
25023
25039
  __param(0, required(['data.id'], { if: { type: 'oa' } })),
25024
25040
  __param(0, required(['data.gifUrl'], { if: { type: 'gif' } })),
package/dist/index.es.js CHANGED
@@ -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.1";
21617
21617
 
21618
21618
  class Basics {
21619
21619
  /**
@@ -23402,8 +23402,15 @@ 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,
23407
23414
  caption: object.data.caption
23408
23415
  };
23409
23416
  break;
@@ -25487,13 +25494,22 @@ const validate = (target, propertyName, descriptor) => {
25487
25494
  isMeetCondition = Object.keys(condition).every((key) => lodash.get(argument, key) === condition[key]);
25488
25495
  }
25489
25496
  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));
25497
+ fields.forEach((item) => {
25498
+ const isInValidField = (field) => {
25499
+ let isInValid = false;
25500
+ if (lodash.isEmpty(lodash.get(argument, field))) {
25501
+ if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
25502
+ lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
25503
+ }
25504
+ isInValid = true;
25494
25505
  }
25495
- else
25496
- throw apiResponse.error.missingParam(field);
25506
+ return isInValid;
25507
+ };
25508
+ if (Array.isArray(item) && item.length > 0 && item.every(isInValidField)) {
25509
+ throw apiResponse.error.missingParam(item.join(' or '));
25510
+ }
25511
+ else if (lodash.isString(item) && isInValidField(item)) {
25512
+ throw apiResponse.error.missingParam(item);
25497
25513
  }
25498
25514
  });
25499
25515
  }
@@ -26147,7 +26163,7 @@ __decorate([
26147
26163
  __decorate([
26148
26164
  handleError,
26149
26165
  validate,
26150
- __param(0, required(['data.imageUrls'], { if: { type: 'image' } })),
26166
+ __param(0, required([['data.imageUrl', 'data.imageUrls']], { if: { type: 'image' } })),
26151
26167
  __param(0, required(['data.link'], { if: { type: 'link' } })),
26152
26168
  __param(0, required(['data.id'], { if: { type: 'oa' } })),
26153
26169
  __param(0, required(['data.gifUrl'], { if: { type: 'gif' } })),