zmp-sdk 2.15.4 → 2.16.0-rc.0

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.
@@ -25878,7 +25878,7 @@
25878
25878
 
25879
25879
  /**
25880
25880
  * Selects a color for a debug namespace
25881
- * @param {String} namespace The namespace string for the for the debug instance to be colored
25881
+ * @param {String} namespace The namespace string for the debug instance to be colored
25882
25882
  * @return {Number|String} An ANSI color code for the given namespace
25883
25883
  * @api private
25884
25884
  */
@@ -34860,7 +34860,16 @@
34860
34860
  Events["AppResumed"] = "h5.event.resumed";
34861
34861
  Events["NetworkChanged"] = "h5.event.connection.changed";
34862
34862
  Events["OnDataCallback"] = "h5.event.webview.result";
34863
- })(Events || (Events = {}));
34863
+ Events["OpenApp"] = "h5.event.open.mp";
34864
+ })(Events || (Events = {}));
34865
+ var MediaPickerType;
34866
+ (function (MediaPickerType) {
34867
+ MediaPickerType[MediaPickerType["photo"] = 4] = "photo";
34868
+ MediaPickerType[MediaPickerType["video"] = 5] = "video";
34869
+ MediaPickerType[MediaPickerType["file"] = 6] = "file";
34870
+ MediaPickerType[MediaPickerType["multi_photo"] = 7] = "multi_photo";
34871
+ MediaPickerType[MediaPickerType["multi_video"] = 8] = "multi_video";
34872
+ })(MediaPickerType || (MediaPickerType = {}));
34864
34873
 
34865
34874
  const readCookie = (name) => {
34866
34875
  const ckString = document.cookie;
@@ -34921,6 +34930,9 @@
34921
34930
  return ck;
34922
34931
  };
34923
34932
 
34933
+ const ZAPP_ID = window.zAppID;
34934
+ const APP_ID = window.APP_ID;
34935
+ const APP_CONFIG = window.APP_CONFIG || {};
34924
34936
  const ACTION = {
34925
34937
  GET_DOWNLOADED_STICKER: {
34926
34938
  name: 'action.get.downloaded.sticker'
@@ -35210,6 +35222,16 @@
35210
35222
  GET_SUPPORTED_ACTIONS: {
35211
35223
  name: 'action.get.supported.actions',
35212
35224
  white_list: true
35225
+ },
35226
+ MP_JOIN_WIFI: {
35227
+ name: 'action.mp.join.wifi',
35228
+ version_live: { android: 0, iOS: 999 },
35229
+ have_permission: false,
35230
+ white_list: false
35231
+ },
35232
+ PICK_MEDIA: {
35233
+ name: 'action.pick.media',
35234
+ version_live: { iOS: 999 }
35213
35235
  }
35214
35236
  };
35215
35237
  const ACTION_HAVE_CALLBACK = [
@@ -35602,15 +35624,6 @@
35602
35624
  }
35603
35625
  return false;
35604
35626
  };
35605
- const isEmpty = (value) => {
35606
- return (
35607
- // null or undefined
35608
- value == null ||
35609
- // has length and it's zero
35610
- (value.hasOwnProperty('length') && value.length === 0) ||
35611
- // is an Object and has no keys
35612
- (value.constructor === Object && Object.keys(value).length === 0));
35613
- };
35614
35627
  const getToken = (name) => {
35615
35628
  return readCookieFallback(name);
35616
35629
  };
@@ -35732,24 +35745,13 @@
35732
35745
  const getZMPShareInfo = (appID, accessToken, shareTitle, shareDescription, shareThumbnail, sharePath) => __awaiter(void 0, void 0, void 0, function* () {
35733
35746
  const currentUrl = new URL(location.href);
35734
35747
  const params = new URLSearchParams();
35735
- const description = {
35736
- vi: '',
35737
- en: ''
35738
- };
35739
35748
  let path = `${currentUrl.pathname}${currentUrl.search}`;
35740
35749
  if (sharePath) {
35741
35750
  path = `/zapps/${appID}${sharePath[0] === '/' ? '' : '/'}${sharePath}`;
35742
35751
  }
35743
35752
  const validUrl = new URL(`https://zalo.me/app/link${path}`);
35744
- if (lodash.isString(shareDescription)) {
35745
- description.en = description.vi = shareDescription;
35746
- }
35747
- else if (lodash.isObject(shareDescription)) {
35748
- description.en = shareDescription.en || '';
35749
- description.vi = shareDescription.vi || '';
35750
- }
35751
35753
  params.append('title', shareTitle);
35752
- params.append('description', description.vi || description.en);
35754
+ params.append('description', shareDescription || '');
35753
35755
  params.append('thumbnail', shareThumbnail);
35754
35756
  params.append('url', validUrl.href);
35755
35757
  params.append('accessToken', accessToken || '');
@@ -35765,7 +35767,59 @@
35765
35767
  }
35766
35768
  validUrl.search = `${validUrl.search}&zshareId=${resData.data.shareId}`;
35767
35769
  return Object.assign(Object.assign({}, resData.data), { shareableLink: validUrl.href });
35768
- });
35770
+ });
35771
+ const checkData = (types, option) => (data) => {
35772
+ const validType = Array.isArray(types)
35773
+ ? types.some((type) => isType(data, type))
35774
+ : isType(data, types);
35775
+ if (!validType) {
35776
+ return {
35777
+ error: true,
35778
+ errorMessage: types
35779
+ };
35780
+ }
35781
+ if (option) {
35782
+ if (Array.isArray(option === null || option === void 0 ? void 0 : option.values)) {
35783
+ return {
35784
+ error: !(option === null || option === void 0 ? void 0 : option.values.includes(data)),
35785
+ errorMessage: option === null || option === void 0 ? void 0 : option.values.toString()
35786
+ };
35787
+ }
35788
+ if (lodash.isNumber(option === null || option === void 0 ? void 0 : option.maxLength)) {
35789
+ return {
35790
+ error: lodash.isString(data) && data.length > (option === null || option === void 0 ? void 0 : option.maxLength),
35791
+ errorMessage: `data length must <= ${option === null || option === void 0 ? void 0 : option.maxLength}`
35792
+ };
35793
+ }
35794
+ if (lodash.isNumber(option === null || option === void 0 ? void 0 : option.min) && lodash.isNumber(option === null || option === void 0 ? void 0 : option.max)) {
35795
+ return {
35796
+ error: data < (option === null || option === void 0 ? void 0 : option.min) || data > (option === null || option === void 0 ? void 0 : option.max),
35797
+ errorMessage: `data must be in between ${option === null || option === void 0 ? void 0 : option.min} and ${option === null || option === void 0 ? void 0 : option.max}`
35798
+ };
35799
+ }
35800
+ if (lodash.isNumber(option === null || option === void 0 ? void 0 : option.min)) {
35801
+ return {
35802
+ error: data < (option === null || option === void 0 ? void 0 : option.min),
35803
+ errorMessage: `data must >= ${option === null || option === void 0 ? void 0 : option.min}`
35804
+ };
35805
+ }
35806
+ if (lodash.isNumber(option === null || option === void 0 ? void 0 : option.max)) {
35807
+ return {
35808
+ error: data > (option === null || option === void 0 ? void 0 : option.max),
35809
+ errorMessage: `data must <= ${option === null || option === void 0 ? void 0 : option.max}`
35810
+ };
35811
+ }
35812
+ if (lodash.isRegExp(option === null || option === void 0 ? void 0 : option.regex)) {
35813
+ return {
35814
+ error: !option.regex.test(data),
35815
+ errorMessage: `data must valid`
35816
+ };
35817
+ }
35818
+ }
35819
+ return {
35820
+ error: false
35821
+ };
35822
+ };
35769
35823
 
35770
35824
  var eventemitter3 = createCommonjsModule(function (module) {
35771
35825
 
@@ -36164,7 +36218,9 @@
36164
36218
  '2G': device.isAndroid ? 2 : 2,
36165
36219
  '3G': device.isAndroid ? 15 : 2,
36166
36220
  '4G': device.isAndroid ? 13 : 2
36167
- }
36221
+ },
36222
+ MEDIA_PICKER_LIMIT: 1 * MB,
36223
+ MEDIA_PICKER_UPLOAD_SERVER: 'https://zapi-server.tungnt.xyz/upload/photos'
36168
36224
  };
36169
36225
  })();
36170
36226
 
@@ -36433,6 +36489,7 @@
36433
36489
  }
36434
36490
  onJSCall(key, data) {
36435
36491
  try {
36492
+ this.debug('onJSCall', key, data);
36436
36493
  const parsedData = parseJSON(data);
36437
36494
  if (this._jsCallFuncCallbacks[key]) {
36438
36495
  const callback = this._jsCallFuncCallbacks[key].callback;
@@ -36460,6 +36517,7 @@
36460
36517
  }
36461
36518
  onMultiJSCall(key, data) {
36462
36519
  try {
36520
+ this.debug('onMultiJSCall', key, data);
36463
36521
  const parsedData = parseJSON(data);
36464
36522
  if (this._jsCallFuncCallbacks[key]) {
36465
36523
  const callback = this._jsCallFuncCallbacks[key].callback;
@@ -36487,7 +36545,28 @@
36487
36545
  this.debug(`eventId: ${eventId}, eventName: ${eventName}, eventData: ${eventData}`);
36488
36546
  const data = stringToData(eventData);
36489
36547
  this.debug(data);
36490
- this.events.emit(eventName, eventId, data);
36548
+ const convertedData = this.handleEventData(eventName, data);
36549
+ this.events.emit(eventName, eventId, convertedData);
36550
+ }
36551
+ handleEventData(eventName, data) {
36552
+ try {
36553
+ switch (eventName) {
36554
+ case Events.OpenApp:
36555
+ const { url } = data;
36556
+ const validUrl = new URL(url);
36557
+ const path = validUrl.pathname.split(`/zapps/${APP_ID}`)[1];
36558
+ return {
36559
+ path: `${path ? path : '/'}${validUrl.search}`
36560
+ };
36561
+ break;
36562
+ default:
36563
+ return data;
36564
+ break;
36565
+ }
36566
+ }
36567
+ catch (error) {
36568
+ return data;
36569
+ }
36491
36570
  }
36492
36571
  defaultCallback(data) {
36493
36572
  if (data !== null && data !== undefined) {
@@ -36636,7 +36715,7 @@
36636
36715
  }
36637
36716
  _ZJSBridgeProvider_bridge = new WeakMap();
36638
36717
 
36639
- var version = "2.15.4";
36718
+ var version = "2.16.0-rc.0";
36640
36719
 
36641
36720
  class Basics {
36642
36721
  /**
@@ -37569,6 +37648,27 @@
37569
37648
  });
37570
37649
  });
37571
37650
  }
37651
+ /**
37652
+ * Connect Wifi.
37653
+ * @async
37654
+ * @function connectWifi
37655
+ * @category Device
37656
+ *
37657
+ */
37658
+ static connectWifi(object) {
37659
+ return __awaiter(this, void 0, void 0, function* () {
37660
+ let securityType = 'open';
37661
+ if (lodash.isString(object.password) && object.password.length > 0) {
37662
+ securityType = 'wpa_wpa2';
37663
+ }
37664
+ return yield this.callNative(ACTION.MP_JOIN_WIFI.name, {
37665
+ ssid: object.SSID,
37666
+ securityType: securityType,
37667
+ password: object.password,
37668
+ hiddenSsid: object.hiddenSSID
37669
+ });
37670
+ });
37671
+ }
37572
37672
  }
37573
37673
 
37574
37674
  var _LocalResourceStorage_storage, _LocalResourceStorage_prefix, _LocalResourceStorage_resourceInfo;
@@ -38224,10 +38324,14 @@
38224
38324
  return __awaiter(this, void 0, void 0, function* () {
38225
38325
  let data = {};
38226
38326
  if (!lodash.isEmpty(object.imageBase64Data)) {
38227
- data = Object.assign(Object.assign({}, data), { imageBase64Data: object.imageBase64Data });
38327
+ data = {
38328
+ imageBase64Data: object.imageBase64Data
38329
+ };
38228
38330
  }
38229
- else {
38230
- data = Object.assign(Object.assign({}, data), { imageUrl: object.imageUrl });
38331
+ else if (!lodash.isEmpty(object.imageUrl)) {
38332
+ data = {
38333
+ imageUrl: object.imageUrl
38334
+ };
38231
38335
  }
38232
38336
  return yield this.callNative(ACTION.SAVE_IMAGE_GALLERY.name, Object.assign({}, data));
38233
38337
  });
@@ -38414,17 +38518,25 @@
38414
38518
  break;
38415
38519
  case 'zmp':
38416
38520
  const accessToken = yield this.getAccessToken();
38417
- if (lodash.isString(object.data.description)) {
38418
- object.data.description;
38419
- }
38420
- else if (lodash.isObject(object.data.description)) {
38421
- object.data.description.en || '';
38422
- object.data.description.vi || '';
38423
- }
38424
38521
  const zmpShareableInfo = yield getZMPShareInfo(this.getAppId(), accessToken || '', object.data.title, object.data.description, object.data.thumbnail, object.data.path);
38425
- getZaloVersion();
38426
- checkPlatform();
38427
- {
38522
+ if (window.forceShareZMP) {
38523
+ reqData = {
38524
+ data: {
38525
+ ZInstantAPIInfo: {
38526
+ url: `${zmpShareableInfo.zinstantApi}`,
38527
+ zinstantdata_id: `templateId=11412&appId=${this.getAppId()}&shareId=${zmpShareableInfo.shareId}`
38528
+ },
38529
+ previewMsgText: {
38530
+ msg: {
38531
+ en: 'Mini App',
38532
+ vi: 'Chương trình nhỏ'
38533
+ }
38534
+ },
38535
+ enableReactions: 1
38536
+ }
38537
+ };
38538
+ }
38539
+ else {
38428
38540
  reqData = {
38429
38541
  link: zmpShareableInfo.shareableLink,
38430
38542
  chatOnly: object.data.chatOnly ? 1 : 0
@@ -38519,6 +38631,47 @@
38519
38631
  });
38520
38632
  });
38521
38633
  }
38634
+ /**
38635
+ * Cho phép ứng dụng mở giao diện chọn media và get về list media url
38636
+ *
38637
+ * @async
38638
+ * @function openMediaPicker
38639
+ * @category Zalo
38640
+ *
38641
+ */
38642
+ static openMediaPicker(type, editView, silentRequest, maxSelectItem) {
38643
+ return __awaiter(this, void 0, void 0, function* () {
38644
+ const uploadSetting = {
38645
+ type: 0,
38646
+ url: CONFIG.MEDIA_PICKER_UPLOAD_SERVER,
38647
+ maxSize: CONFIG.MEDIA_PICKER_LIMIT
38648
+ };
38649
+ const defaultEditView = {
38650
+ enable: 1,
38651
+ aspect_ratio: '1:1'
38652
+ };
38653
+ return yield this.callNative(ACTION.PICK_MEDIA.name, {
38654
+ media_type: MediaPickerType[type],
38655
+ edit_view: Object.assign(Object.assign({}, defaultEditView), editView),
38656
+ silent_request: silentRequest,
38657
+ upload: uploadSetting,
38658
+ max_select_item: maxSelectItem
38659
+ }, {
38660
+ isMultiCallback: true,
38661
+ callback: (nativeData, error) => {
38662
+ var _a, _b;
38663
+ if (nativeData.error_code === 0) {
38664
+ const resultContent = stringToData((_a = nativeData.data) === null || _a === void 0 ? void 0 : _a.result_content);
38665
+ const res = {
38666
+ urls: (_b = resultContent === null || resultContent === void 0 ? void 0 : resultContent.data) === null || _b === void 0 ? void 0 : _b.urls
38667
+ };
38668
+ return Promise.resolve(res);
38669
+ }
38670
+ return Promise.reject(error);
38671
+ }
38672
+ });
38673
+ });
38674
+ }
38522
38675
  }
38523
38676
 
38524
38677
  class Routing {
@@ -38583,9 +38736,9 @@
38583
38736
  constructor() {
38584
38737
  var _a, _b, _c, _d, _e, _f, _g, _h;
38585
38738
  super();
38586
- _ZaloMiniProgramSDK_zAppId.set(this, window.zAppID);
38587
- _ZaloMiniProgramSDK_appId.set(this, window.APP_ID);
38588
- _ZaloMiniProgramSDK_appConfig.set(this, window.APP_CONFIG || {});
38739
+ _ZaloMiniProgramSDK_zAppId.set(this, ZAPP_ID);
38740
+ _ZaloMiniProgramSDK_appId.set(this, APP_ID);
38741
+ _ZaloMiniProgramSDK_appConfig.set(this, APP_CONFIG);
38589
38742
  _ZaloMiniProgramSDK_zOAuth.set(this, void 0);
38590
38743
  _ZaloMiniProgramSDK_zOAuthVrf.set(this, void 0);
38591
38744
  _ZaloMiniProgramSDK_accessToken.set(this, void 0);
@@ -38689,6 +38842,8 @@
38689
38842
  this.getPhoneNumber = OpenApi.getPhoneNumber;
38690
38843
  this.openProfilePicker = Zalo.openProfilePicker;
38691
38844
  _ZaloMiniProgramSDK_getActionsSupported.set(this, Zalo.getActionsSupported);
38845
+ this.connectWifi = Device.connectWifi;
38846
+ this.openMediaPicker = Zalo.openMediaPicker;
38692
38847
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuth, null);
38693
38848
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_zOAuthVrf, null);
38694
38849
  __classPrivateFieldSet(this, _ZaloMiniProgramSDK_accessToken, null);
@@ -38847,8 +39002,8 @@
38847
39002
  var _MockSDK_appId, _MockSDK_appConfig, _MockSDK_zOAuth, _MockSDK_accessToken, _MockSDK_cache, _MockSDK_loggedId;
38848
39003
  class MockSDK {
38849
39004
  constructor() {
38850
- _MockSDK_appId.set(this, window.zAppID);
38851
- _MockSDK_appConfig.set(this, window.APP_CONFIG || {});
39005
+ _MockSDK_appId.set(this, ZAPP_ID);
39006
+ _MockSDK_appConfig.set(this, APP_CONFIG);
38852
39007
  _MockSDK_zOAuth.set(this, 'DEFAULT ZOAUTH');
38853
39008
  _MockSDK_accessToken.set(this, 'DEFAULT ACCESS TOKEN');
38854
39009
  _MockSDK_cache.set(this, {
@@ -39151,6 +39306,10 @@
39151
39306
  userIDs: []
39152
39307
  });
39153
39308
  };
39309
+ this.connectWifi = () => {
39310
+ console.warn('This api only works on zalo app');
39311
+ return Promise.resolve();
39312
+ };
39154
39313
  }
39155
39314
  on(event, fn, context) {
39156
39315
  throw new Error('Method not implemented.');
@@ -39164,6 +39323,12 @@
39164
39323
  removeAllListeners(event) {
39165
39324
  throw new Error('Method not implemented.');
39166
39325
  }
39326
+ openMediaPicker(type, editView, silentRequest, maxSelectItem) {
39327
+ console.warn('This api only works on zalo app');
39328
+ return Promise.resolve({
39329
+ urls: []
39330
+ });
39331
+ }
39167
39332
  }
39168
39333
  _MockSDK_appId = new WeakMap(), _MockSDK_appConfig = new WeakMap(), _MockSDK_zOAuth = new WeakMap(), _MockSDK_accessToken = new WeakMap(), _MockSDK_cache = new WeakMap(), _MockSDK_loggedId = new WeakMap();
39169
39334
 
@@ -40301,21 +40466,22 @@
40301
40466
 
40302
40467
  const requiredMetadataKey = Symbol('required');
40303
40468
  const checkTypeMetadataKey = Symbol('checkType');
40304
- const required = (...args) => (target, propertyKey, parameterIndex) => {
40469
+ const required = (fields, option) => (target, propertyKey, parameterIndex) => {
40305
40470
  let existingRequiredParameters = Reflect.getOwnMetadata(requiredMetadataKey, target, propertyKey) || [];
40306
40471
  existingRequiredParameters.push({
40307
40472
  parameterIndex: parameterIndex,
40308
- fields: args
40473
+ fields: fields,
40474
+ option
40309
40475
  });
40310
40476
  Reflect.defineMetadata(requiredMetadataKey, existingRequiredParameters, target, propertyKey);
40311
40477
  };
40312
- const checkType = (type, properties, key) => (target, propertyKey, parameterIndex) => {
40478
+ const checkType = (type, properties, defaultValue) => (target, propertyKey, parameterIndex) => {
40313
40479
  let existingTypeCheckParameters = Reflect.getOwnMetadata(checkTypeMetadataKey, target, propertyKey) || [];
40314
40480
  existingTypeCheckParameters.push({
40315
40481
  parameterIndex: parameterIndex,
40316
40482
  type: type,
40317
40483
  properties: properties,
40318
- key: key
40484
+ defaultValue: defaultValue
40319
40485
  });
40320
40486
  Reflect.defineMetadata(checkTypeMetadataKey, existingTypeCheckParameters, target, propertyKey);
40321
40487
  };
@@ -40335,18 +40501,9 @@
40335
40501
  const checkTypeParameters = Reflect.getOwnMetadata(checkTypeMetadataKey, target, propertyName);
40336
40502
  if (checkTypeParameters) {
40337
40503
  checkTypeParameters.forEach((parameter) => {
40338
- const { parameterIndex, type, properties, key } = parameter;
40504
+ const { parameterIndex, type, properties, defaultValue } = parameter;
40339
40505
  let argument = arguments[parameterIndex];
40340
40506
  let argumentName = argsName[parameterIndex];
40341
- if (!lodash.isEmpty(key)) {
40342
- const deepFields = key === null || key === void 0 ? void 0 : key.split('.');
40343
- if (Array.isArray(deepFields) && deepFields.length > 0) {
40344
- deepFields.forEach((level) => {
40345
- argument = argument[level];
40346
- argumentName = `${argumentName}.${level}`;
40347
- });
40348
- }
40349
- }
40350
40507
  const parameterType = typeof argument;
40351
40508
  if (!lodash.isUndefined(argument)) {
40352
40509
  if (!isType(argument, type)) {
@@ -40358,20 +40515,24 @@
40358
40515
  }
40359
40516
  if (type === 'object') {
40360
40517
  Object.entries(properties).forEach(([propKey, propType]) => {
40361
- const propField = argument[propKey];
40362
- if (!lodash.isUndefined(propField)) {
40363
- if (Array.isArray(propType) && !propType.includes(propField)) {
40364
- throw apiResponse.error.wrongTypeParam(`${argumentName}.${propKey}`, `${propType}`.replace(/,/g, '|'), `'${propField}'`);
40365
- }
40366
- else if (!Array.isArray(propType) &&
40367
- !isType(propField, propType)) {
40368
- throw apiResponse.error.wrongTypeParam(`${argumentName}.${propKey}`, propType, Array.isArray(propField)
40369
- ? 'array'
40370
- : propField === null
40371
- ? 'null'
40372
- : typeof propField);
40518
+ const key = propKey.split('?')[0];
40519
+ const propValue = lodash.get(argument, key);
40520
+ if (!lodash.isUndefined(propValue) && !lodash.isNull(propValue)) {
40521
+ if (lodash.isFunction(propType)) {
40522
+ const res = propType(propValue);
40523
+ if (res && res.error) {
40524
+ throw apiResponse.error.wrongTypeParam(`${argumentName}.${key}`, res.errorMessage, typeof propValue);
40525
+ }
40373
40526
  }
40374
40527
  }
40528
+ else if (!propKey.includes('?')) {
40529
+ throw apiResponse.error.missingParam(propKey);
40530
+ }
40531
+ else if (lodash.isObject(lodash.get(argument, key.split('.')[0])) &&
40532
+ defaultValue &&
40533
+ !lodash.isUndefined(lodash.get(defaultValue, key))) {
40534
+ lodash.set(arguments[parameterIndex], key, lodash.get(defaultValue, key));
40535
+ }
40375
40536
  });
40376
40537
  }
40377
40538
  }
@@ -40379,18 +40540,24 @@
40379
40540
  }
40380
40541
  if (requiredParameters) {
40381
40542
  requiredParameters.forEach((parameter) => {
40382
- const { parameterIndex, fields } = parameter;
40543
+ const { parameterIndex, option, fields } = parameter;
40383
40544
  const argument = arguments[parameterIndex];
40384
- const argumentName = argsName[parameterIndex];
40385
- const parameterType = typeof argument;
40386
- if (!Array.isArray(argument) &&
40387
- parameterType === 'object' &&
40388
- fields.some((field) => lodash.isUndefined(argument[field]))) {
40389
- throw apiResponse.error.missingParam(`${fields} in ${argumentName}`);
40545
+ const condition = option === null || option === void 0 ? void 0 : option.if;
40546
+ const defaultValue = option === null || option === void 0 ? void 0 : option.defaultValue;
40547
+ let isMeetCondition = true;
40548
+ if (condition) {
40549
+ isMeetCondition = Object.keys(condition).every((key) => lodash.get(argument, key) === condition[key]);
40390
40550
  }
40391
- else if (parameterType !== 'object' &&
40392
- (parameterIndex >= arguments.length || lodash.isUndefined(argument))) {
40393
- throw apiResponse.error.missingParam(argumentName);
40551
+ if (isMeetCondition) {
40552
+ fields.forEach((field) => {
40553
+ if (lodash.isEmpty(lodash.get(argument, field))) {
40554
+ if (!lodash.isUndefined(lodash.get(defaultValue, field))) {
40555
+ lodash.set(arguments[parameterIndex], field, lodash.get(defaultValue, field));
40556
+ }
40557
+ else
40558
+ throw apiResponse.error.missingParam(field);
40559
+ }
40560
+ });
40394
40561
  }
40395
40562
  });
40396
40563
  }
@@ -40611,26 +40778,6 @@
40611
40778
  }
40612
40779
  openPostFeed(object) {
40613
40780
  return __awaiter(this, void 0, void 0, function* () {
40614
- const type = object.type;
40615
- if (type === 'image' && isEmpty(object.data.imageUrl)) {
40616
- throw apiResponse.error.wrongTypeParam('object.data.imageUrl', 'valid url', 'invalid');
40617
- }
40618
- else if (type === 'link' &&
40619
- (isEmpty(object.data.link) || !isValidUrl(object.data.link))) {
40620
- throw apiResponse.error.wrongTypeParam('object.data.link', 'valid url', 'invalid');
40621
- }
40622
- else if (type === 'profile') {
40623
- if (isEmpty(object.data.id)) {
40624
- throw apiResponse.error.wrongTypeParam('object.data.id', 'valid id', 'empty');
40625
- }
40626
- else if (isEmpty(object.data.avatar) ||
40627
- !isValidUrl(object.data.avatar)) {
40628
- throw apiResponse.error.wrongTypeParam('object.data.avatar', 'valid url', 'invalid');
40629
- }
40630
- else if (isEmpty(object.data.displayName)) {
40631
- throw apiResponse.error.wrongTypeParam('object.data.displayName', 'valid displayName', 'empty');
40632
- }
40633
- }
40634
40781
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openPostFeed(object);
40635
40782
  });
40636
40783
  }
@@ -40646,61 +40793,6 @@
40646
40793
  }
40647
40794
  openShareSheet(object) {
40648
40795
  return __awaiter(this, void 0, void 0, function* () {
40649
- const type = object.type;
40650
- if (type === 'image' && isEmpty(object.data.imageUrl)) {
40651
- throw apiResponse.error.wrongTypeParam('object.data.imageUrl', 'valid url', 'invalid');
40652
- }
40653
- else if (type === 'gif' &&
40654
- (isEmpty(object.data.gifUrl) || !isValidUrl(object.data.gifUrl))) {
40655
- throw apiResponse.error.wrongTypeParam('object.data.gifUrl', 'valid url', 'invalid');
40656
- }
40657
- else if (type === 'video') {
40658
- if (isEmpty(object.data.videoThumb) ||
40659
- !isValidUrl(object.data.videoThumb)) {
40660
- throw apiResponse.error.wrongTypeParam('object.data.videoThumb', 'valid url', 'invalid');
40661
- }
40662
- else if (isEmpty(object.data.videoUrl) ||
40663
- !isValidUrl(object.data.videoUrl)) {
40664
- throw apiResponse.error.wrongTypeParam('object.data.videoUrl', 'valid url', 'invalid');
40665
- }
40666
- }
40667
- else if (type === 'link' &&
40668
- (isEmpty(object.data.link) || !isValidUrl(object.data.link))) {
40669
- throw apiResponse.error.wrongTypeParam('object.data.link', 'valid url', 'invalid');
40670
- }
40671
- else if (type === 'oa' && isEmpty(object.data.id)) {
40672
- throw apiResponse.error.wrongTypeParam('object.data.id', 'valid id', 'empty');
40673
- }
40674
- else if (type === 'zmp') {
40675
- if (lodash.isNull(object.data.title) || lodash.isNull(object.data.description)) {
40676
- throw apiResponse.error.missingParam([
40677
- 'data.title',
40678
- 'data.description'
40679
- ]);
40680
- }
40681
- else {
40682
- const title = object.data.title;
40683
- const description = {
40684
- vi: '',
40685
- en: ''
40686
- };
40687
- if (lodash.isString(object.data.description)) {
40688
- description.en = description.vi = object.data.description;
40689
- }
40690
- else if (lodash.isObject(object.data.description)) {
40691
- description.en = object.data.description.en || '';
40692
- description.vi = object.data.description.vi || '';
40693
- }
40694
- else {
40695
- throw apiResponse.error.wrongTypeParam('data.description', 'string | {vi: string, en: string}', typeof object.data.description);
40696
- }
40697
- if (title.length > 100 ||
40698
- description.vi.length > 400 ||
40699
- description.en.length > 400)
40700
- throw apiResponse.error.lengthInvalid(`'title' or 'description'`);
40701
- object.data.description = description;
40702
- }
40703
- }
40704
40796
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openShareSheet(object);
40705
40797
  });
40706
40798
  }
@@ -40715,20 +40807,7 @@
40715
40807
  });
40716
40808
  }
40717
40809
  openBioAuthentication(object) {
40718
- var _a;
40719
40810
  return __awaiter(this, void 0, void 0, function* () {
40720
- if (lodash.isUndefined(object.requireFingerprint)) {
40721
- object.requireFingerprint = true;
40722
- }
40723
- if (isEmpty((_a = object.ui) === null || _a === void 0 ? void 0 : _a.title)) {
40724
- object.ui = Object.assign(Object.assign({}, object.ui), { title: 'Xác thực' });
40725
- }
40726
- if (isEmpty(object.ui.subTitle)) {
40727
- object.ui = Object.assign(Object.assign({}, object.ui), { subTitle: 'Sử dụng sinh trắc học của bạn để xác thực' });
40728
- }
40729
- if (isEmpty(object.ui.negativeButtonText)) {
40730
- object.ui = Object.assign(Object.assign({}, object.ui), { negativeButtonText: 'Đóng' });
40731
- }
40732
40811
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openBioAuthentication(object);
40733
40812
  });
40734
40813
  }
@@ -40759,17 +40838,11 @@
40759
40838
  }
40760
40839
  openSMS(object) {
40761
40840
  return __awaiter(this, void 0, void 0, function* () {
40762
- if (!/^\+?\d+$/.test(object.phoneNumber)) {
40763
- throw apiResponse.error.wrongTypeParam('object.phoneNumber', 'valid phone', 'invalid');
40764
- }
40765
40841
  yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openSMS(object);
40766
40842
  });
40767
40843
  }
40768
40844
  viewOAQr(object) {
40769
40845
  return __awaiter(this, void 0, void 0, function* () {
40770
- if (lodash.isUndefined(object.displayName) || lodash.isNull(object.displayName)) {
40771
- object.displayName = '';
40772
- }
40773
40846
  yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).viewOAQr(object);
40774
40847
  });
40775
40848
  }
@@ -40778,14 +40851,13 @@
40778
40851
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).keepScreen(object);
40779
40852
  });
40780
40853
  }
40854
+ saveImageToGallery(object) {
40855
+ return __awaiter(this, void 0, void 0, function* () {
40856
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40857
+ });
40858
+ }
40781
40859
  saveImageToPhotosAlbum(object) {
40782
40860
  return __awaiter(this, void 0, void 0, function* () {
40783
- if (isEmpty(object.imageBase64Data) && isEmpty(object.imageUrl)) {
40784
- throw apiResponse.error.wrongTypeParam('object.imageBase64Data | object.imageUrl', 'valid data', 'invalid');
40785
- }
40786
- if (!isEmpty(object.imageUrl) && !isValidUrl(object.imageUrl)) {
40787
- throw apiResponse.error.wrongTypeParam('object.imageUrl', 'valid url', 'invalid');
40788
- }
40789
40861
  return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).saveImageToPhotosAlbum(object);
40790
40862
  });
40791
40863
  }
@@ -40806,12 +40878,6 @@
40806
40878
  }
40807
40879
  vibrate(object) {
40808
40880
  return __awaiter(this, void 0, void 0, function* () {
40809
- if (isEmpty(object.type)) {
40810
- object.type = 'oneShot';
40811
- }
40812
- if (isEmpty(object.milliseconds)) {
40813
- object.milliseconds = 500;
40814
- }
40815
40881
  yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).vibrate(object);
40816
40882
  });
40817
40883
  }
@@ -40840,41 +40906,33 @@
40840
40906
  });
40841
40907
  }
40842
40908
  openProfilePicker(object) {
40843
- if (lodash.isUndefined(object.maxProfile) || object.maxProfile < 1) {
40844
- object.maxProfile = 1;
40845
- }
40846
- else if (object.maxProfile > 10) {
40847
- throw apiResponse.error.badRequest('maxProfile must be in between 1 and 10');
40848
- }
40849
- return __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfilePicker(object);
40909
+ return __awaiter(this, void 0, void 0, function* () {
40910
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openProfilePicker(object);
40911
+ });
40850
40912
  }
40851
- getShareableLink(object) {
40913
+ connectWifi(object) {
40914
+ return __awaiter(this, void 0, void 0, function* () {
40915
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).connectWifi(object);
40916
+ });
40917
+ }
40918
+ openMediaPicker(object) {
40919
+ var _a, _b, _c;
40852
40920
  return __awaiter(this, void 0, void 0, function* () {
40853
- if (lodash.isNull(object.title) || lodash.isNull(object.description)) {
40854
- throw apiResponse.error.missingParam(['data.title', 'data.description']);
40921
+ const editView = {};
40922
+ if (lodash.isUndefined((_a = object.editView) === null || _a === void 0 ? void 0 : _a.enable) || ((_b = object.editView) === null || _b === void 0 ? void 0 : _b.enable)) {
40923
+ editView.enable = 1;
40855
40924
  }
40856
40925
  else {
40857
- const title = object.title;
40858
- const description = {
40859
- vi: '',
40860
- en: ''
40861
- };
40862
- if (lodash.isString(object.description)) {
40863
- description.en = description.vi = object.description;
40864
- }
40865
- else if (lodash.isObject(object.description)) {
40866
- description.en = object.description.en || '';
40867
- description.vi = object.description.vi || '';
40868
- }
40869
- else {
40870
- throw apiResponse.error.wrongTypeParam('data.description', 'string | {vi: string, en: string}', typeof object.description);
40871
- }
40872
- if (title.length > 100 ||
40873
- description.vi.length > 400 ||
40874
- description.en.length > 400)
40875
- throw apiResponse.error.lengthInvalid(`'title' or 'description'`);
40876
- object.description = description;
40926
+ editView.enable = 0;
40877
40927
  }
40928
+ editView.aspect_ratio = (_c = object.editView) === null || _c === void 0 ? void 0 : _c.aspectRatio;
40929
+ const silentRequest = object.silentRequest === true ? 1 : 0;
40930
+ const maxSelectItem = object.maxSelectItem;
40931
+ return yield __classPrivateFieldGet(this, _SDKCreator_sdkManager).openMediaPicker(object.type, editView, silentRequest, maxSelectItem);
40932
+ });
40933
+ }
40934
+ getShareableLink(object) {
40935
+ return __awaiter(this, void 0, void 0, function* () {
40878
40936
  const accessToken = yield this.getAccessToken();
40879
40937
  const zmpShareableInfo = yield getZMPShareInfo(window.APP_ID, accessToken || '', object.title, object.description, object.thumbnail, object.path);
40880
40938
  return zmpShareableInfo.shareableLink;
@@ -40901,60 +40959,53 @@
40901
40959
  handleError,
40902
40960
  validate,
40903
40961
  __param(0, checkType('object', {
40904
- title: 'string'
40905
- })),
40906
- __param(0, required('title'))
40962
+ title: checkData('string')
40963
+ }))
40907
40964
  ], SDKCreator.prototype, "setNavigationBarTitle", null);
40908
40965
  __decorate([
40909
40966
  handleError,
40910
40967
  validate,
40911
40968
  __param(0, checkType('object', {
40912
- color: 'string',
40913
- textColor: ['white', 'black'],
40914
- statusBarColor: 'string'
40915
- })),
40916
- __param(0, required('color'))
40969
+ color: checkData('string'),
40970
+ 'textColor?': checkData('string', { values: ['white', 'black'] }),
40971
+ 'statusBarColor?': checkData('string')
40972
+ }))
40917
40973
  ], SDKCreator.prototype, "setNavigationBarColor", null);
40918
40974
  __decorate([
40919
40975
  handleError,
40920
40976
  validate,
40921
40977
  __param(0, checkType('object', {
40922
- backgroundColor: 'string',
40923
- textColor: ['white', 'black']
40924
- })),
40925
- __param(0, required('backgroundColor'))
40978
+ backgroundColor: checkData('string'),
40979
+ 'textColor?': checkData('string', { values: ['white', 'black'] })
40980
+ }))
40926
40981
  ], SDKCreator.prototype, "setBackgroundColor", null);
40927
40982
  __decorate([
40928
40983
  handleError,
40929
40984
  validate,
40930
40985
  __param(0, checkType('object', {
40931
- type: ['none', 'back', 'home', 'both']
40932
- })),
40933
- __param(0, required('type'))
40986
+ type: checkData('string', { values: ['none', 'back', 'home', 'both'] })
40987
+ }))
40934
40988
  ], SDKCreator.prototype, "setNavigationBarLeftButton", null);
40935
40989
  __decorate([
40936
40990
  handleError,
40937
40991
  validate,
40938
40992
  __param(0, checkType('object', {
40939
- rotate: ['auto', 'portrait', 'landscape']
40940
- })),
40941
- __param(0, required('rotate'))
40993
+ rotate: checkData('string', { values: ['auto', 'portrait', 'landscape'] })
40994
+ }))
40942
40995
  ], SDKCreator.prototype, "setDeviceOrientation", null);
40943
40996
  __decorate([
40944
40997
  handleError,
40945
40998
  validate,
40946
40999
  __param(0, checkType('object', {
40947
- data: 'object'
40948
- })),
40949
- __param(0, required('data'))
41000
+ data: checkData('object')
41001
+ }))
40950
41002
  ], SDKCreator.prototype, "setStorage", null);
40951
41003
  __decorate([
40952
41004
  handleError,
40953
41005
  validate,
40954
41006
  __param(0, checkType('object', {
40955
- keys: 'array<string>'
40956
- })),
40957
- __param(0, required('keys'))
41007
+ keys: checkData('array<string>')
41008
+ }))
40958
41009
  ], SDKCreator.prototype, "getStorage", null);
40959
41010
  __decorate([
40960
41011
  handleError
@@ -40963,9 +41014,8 @@
40963
41014
  handleError,
40964
41015
  validate,
40965
41016
  __param(0, checkType('object', {
40966
- keys: 'array<string>'
40967
- })),
40968
- __param(0, required('keys'))
41017
+ keys: checkData('array<string>')
41018
+ }))
40969
41019
  ], SDKCreator.prototype, "removeStorage", null);
40970
41020
  __decorate([
40971
41021
  handleError
@@ -40974,7 +41024,9 @@
40974
41024
  handleError,
40975
41025
  validate,
40976
41026
  __param(0, checkType('object', {
40977
- avatarType: ['small', 'normal', 'large']
41027
+ 'avatarType?': checkData('string', {
41028
+ values: ['small', 'normal', 'large']
41029
+ })
40978
41030
  }))
40979
41031
  ], SDKCreator.prototype, "getUserInfo", null);
40980
41032
  __decorate([
@@ -41032,78 +41084,89 @@
41032
41084
  handleError,
41033
41085
  validate,
41034
41086
  __param(0, checkType('object', {
41035
- type: ['user', 'oa', 'aliasOA'],
41036
- id: 'string'
41037
- })),
41038
- __param(0, required('type', 'id'))
41087
+ type: checkData('string', { values: ['user', 'oa', 'aliasOA'] }),
41088
+ id: checkData('string')
41089
+ }))
41039
41090
  ], SDKCreator.prototype, "openProfile", null);
41040
41091
  __decorate([
41041
41092
  handleError,
41042
41093
  validate,
41043
41094
  __param(0, checkType('object', {
41044
- type: ['user', 'oa'],
41045
- id: 'string'
41046
- })),
41047
- __param(0, required('type', 'id'))
41095
+ type: checkData('string', { values: ['user', 'oa'] }),
41096
+ id: checkData('string')
41097
+ }))
41048
41098
  ], SDKCreator.prototype, "openChat", null);
41049
41099
  __decorate([
41050
41100
  handleError,
41051
41101
  validate,
41102
+ __param(0, required(['data.imageUrl'], { if: { type: 'image' } })),
41103
+ __param(0, required(['data.link'], { if: { type: 'link' } })),
41104
+ __param(0, required(['data.id'], { if: { type: 'profile' } })),
41052
41105
  __param(0, checkType('object', {
41053
- type: ['image', 'link', 'profile'],
41054
- data: 'object'
41055
- })),
41056
- __param(0, checkType('object', {
41057
- imageUrl: 'string',
41058
- link: 'string',
41059
- title: 'string',
41060
- thumb: 'string',
41061
- description: 'string',
41062
- avatar: 'string',
41063
- id: 'string',
41064
- displayName: 'string'
41065
- }, 'data')),
41066
- __param(0, required('type', 'data'))
41106
+ type: checkData('string', { values: ['image', 'link', 'profile'] }),
41107
+ data: checkData('object'),
41108
+ 'data.imageUrl?': checkData('url'),
41109
+ 'data.link?': checkData('url'),
41110
+ 'data.title?': checkData('string'),
41111
+ 'data.thumb?': checkData('url'),
41112
+ 'data.description?': checkData('string'),
41113
+ 'data.avatar?': checkData('url'),
41114
+ 'data.id?': checkData('string'),
41115
+ 'data.displayName?': checkData('string')
41116
+ }))
41067
41117
  ], SDKCreator.prototype, "openPostFeed", null);
41068
41118
  __decorate([
41069
41119
  handleError,
41070
41120
  validate,
41071
41121
  __param(0, checkType('object', {
41072
- id: 'string',
41073
- showDialogConfirm: 'boolean'
41074
- })),
41075
- __param(0, required('id'))
41122
+ id: checkData('string'),
41123
+ 'showDialogConfirm?': checkData('boolean')
41124
+ }))
41076
41125
  ], SDKCreator.prototype, "followOA", null);
41077
41126
  __decorate([
41078
41127
  handleError,
41079
41128
  validate,
41080
41129
  __param(0, checkType('object', {
41081
- id: 'string'
41082
- })),
41083
- __param(0, required('id'))
41130
+ id: checkData('string')
41131
+ }))
41084
41132
  ], SDKCreator.prototype, "unfollowOA", null);
41085
41133
  __decorate([
41086
41134
  handleError,
41087
41135
  validate,
41088
- __param(0, checkType('object', {
41089
- type: ['image', 'gif', 'video', 'link', 'oa', 'zmp'],
41090
- data: 'object'
41136
+ __param(0, required(['data.imageUrl'], { if: { type: 'image' } })),
41137
+ __param(0, required(['data.link'], { if: { type: 'link' } })),
41138
+ __param(0, required(['data.id'], { if: { type: 'oa' } })),
41139
+ __param(0, required(['data.gifUrl'], { if: { type: 'gif' } })),
41140
+ __param(0, required(['data.videoThumb', 'data.videoUrl'], { if: { type: 'video' } })),
41141
+ __param(0, required(['data.thumbnail', 'data.title', 'data.description'], {
41142
+ if: { type: 'zmp' },
41143
+ defaultValue: {
41144
+ data: {
41145
+ description: ''
41146
+ }
41147
+ }
41091
41148
  })),
41092
41149
  __param(0, checkType('object', {
41093
- imageUrl: 'string',
41094
- gifUrl: 'string',
41095
- width: 'number',
41096
- height: 'number',
41097
- videoThumb: 'string',
41098
- videoUrl: 'string',
41099
- link: 'string',
41100
- chatOnly: 'boolean',
41101
- id: 'string',
41102
- title: 'string',
41103
- thumbnail: 'url',
41104
- path: 'string'
41105
- }, 'data')),
41106
- __param(0, required('type', 'data'))
41150
+ type: checkData('string', {
41151
+ values: ['image', 'gif', 'video', 'link', 'oa', 'zmp']
41152
+ }),
41153
+ data: checkData('object'),
41154
+ 'data.imageUrl?': checkData('url'),
41155
+ 'data.gifUrl?': checkData('url'),
41156
+ 'data.width?': checkData('number'),
41157
+ 'data.height?': checkData('number'),
41158
+ 'data.videoThumb?': checkData('url'),
41159
+ 'data.videoUrl?': checkData('url'),
41160
+ 'data.link?': checkData('url'),
41161
+ 'data.chatOnly?': checkData('boolean'),
41162
+ 'data.id?': checkData('string'),
41163
+ 'data.thumbnail?': checkData('url'),
41164
+ 'data.path?': checkData('string'),
41165
+ 'data.title?': checkData('string', { maxLength: 100 }),
41166
+ 'data.description?': checkData(['string'], {
41167
+ maxLength: 400
41168
+ })
41169
+ }))
41107
41170
  ], SDKCreator.prototype, "openShareSheet", null);
41108
41171
  __decorate([
41109
41172
  handleError
@@ -41114,17 +41177,21 @@
41114
41177
  __decorate([
41115
41178
  handleError,
41116
41179
  validate,
41117
- __param(0, required('secretData')),
41118
- __param(0, checkType('object', {
41119
- secretData: 'string',
41120
- ui: 'object',
41121
- requireFingerprint: 'boolean'
41122
- })),
41123
41180
  __param(0, checkType('object', {
41124
- title: 'string',
41125
- subTitle: 'string',
41126
- negativeButtonText: 'string'
41127
- }, 'ui'))
41181
+ secretData: checkData('string'),
41182
+ 'ui?': checkData('object'),
41183
+ 'ui.title?': checkData('string'),
41184
+ 'ui.subTitle?': checkData('string'),
41185
+ 'ui.negativeButtonText?': checkData('string'),
41186
+ 'requireFingerprint?': checkData('boolean')
41187
+ }, {
41188
+ requireFingerprint: true,
41189
+ ui: {
41190
+ title: 'Xác thực',
41191
+ subTitle: 'Sử dụng sinh trắc học của bạn để xác thực',
41192
+ negativeButtonText: 'Đóng'
41193
+ }
41194
+ }))
41128
41195
  ], SDKCreator.prototype, "openBioAuthentication", null);
41129
41196
  __decorate([
41130
41197
  handleError
@@ -41132,12 +41199,17 @@
41132
41199
  __decorate([
41133
41200
  handleError,
41134
41201
  validate,
41135
- __param(0, required('toUserId'))
41202
+ __param(0, checkType('object', {
41203
+ toUserId: checkData('string'),
41204
+ 'title?': checkData('string')
41205
+ }))
41136
41206
  ], SDKCreator.prototype, "sendLocation", null);
41137
41207
  __decorate([
41138
41208
  handleError,
41139
41209
  validate,
41140
- __param(0, required('message'))
41210
+ __param(0, checkType('object', {
41211
+ message: checkData('string')
41212
+ }))
41141
41213
  ], SDKCreator.prototype, "showToast", null);
41142
41214
  __decorate([
41143
41215
  handleError
@@ -41145,27 +41217,26 @@
41145
41217
  __decorate([
41146
41218
  handleError,
41147
41219
  validate,
41148
- __param(0, required('phoneNumber')),
41149
41220
  __param(0, checkType('object', {
41150
- phoneNumber: 'string'
41221
+ phoneNumber: checkData('string')
41151
41222
  }))
41152
41223
  ], SDKCreator.prototype, "openPhone", null);
41153
41224
  __decorate([
41154
41225
  handleError,
41155
41226
  validate,
41156
- __param(0, required('content', 'phoneNumber')),
41157
41227
  __param(0, checkType('object', {
41158
- content: 'string',
41159
- phoneNumber: 'string'
41228
+ content: checkData('string'),
41229
+ phoneNumber: checkData('string', { regex: /^\+?\d+$/ })
41160
41230
  }))
41161
41231
  ], SDKCreator.prototype, "openSMS", null);
41162
41232
  __decorate([
41163
41233
  handleError,
41164
41234
  validate,
41165
- __param(0, required('id')),
41166
41235
  __param(0, checkType('object', {
41167
- id: 'string',
41168
- displayName: 'string'
41236
+ id: checkData('string'),
41237
+ 'displayName?': checkData('string')
41238
+ }, {
41239
+ displayName: ''
41169
41240
  }))
41170
41241
  ], SDKCreator.prototype, "viewOAQr", null);
41171
41242
  __decorate([
@@ -41175,34 +41246,42 @@
41175
41246
  handleError,
41176
41247
  validate,
41177
41248
  __param(0, checkType('object', {
41178
- imageBase64Data: 'string',
41179
- imageUrl: 'string',
41180
- type: 'string'
41249
+ 'imageBase64Data?': checkData('string'),
41250
+ 'imageUrl?': checkData('url')
41251
+ }))
41252
+ ], SDKCreator.prototype, "saveImageToGallery", null);
41253
+ __decorate([
41254
+ handleError,
41255
+ validate,
41256
+ __param(0, checkType('object', {
41257
+ 'imageBase64Data?': checkData('string'),
41258
+ 'imageUrl?': checkData('url')
41181
41259
  }))
41182
41260
  ], SDKCreator.prototype, "saveImageToPhotosAlbum", null);
41183
41261
  __decorate([
41184
41262
  handleError,
41185
41263
  validate,
41186
- __param(0, required('appId')),
41187
41264
  __param(0, checkType('object', {
41188
- appId: 'string',
41189
- params: 'object'
41265
+ appId: checkData('string'),
41266
+ 'params?': checkData('object')
41190
41267
  }))
41191
41268
  ], SDKCreator.prototype, "openMiniApp", null);
41192
41269
  __decorate([
41193
41270
  handleError,
41194
41271
  validate,
41195
41272
  __param(0, checkType('object', {
41196
- type: ['oneShot'],
41197
- milliseconds: 'number'
41273
+ 'type?': checkData('string', { values: ['oneShot'] }),
41274
+ 'milliseconds?': checkData('number')
41275
+ }, {
41276
+ type: 'oneShot',
41277
+ milliseconds: 500
41198
41278
  }))
41199
41279
  ], SDKCreator.prototype, "vibrate", null);
41200
41280
  __decorate([
41201
41281
  handleError,
41202
41282
  validate,
41203
- __param(0, required('url')),
41204
41283
  __param(0, checkType('object', {
41205
- url: 'string'
41284
+ url: checkData('string')
41206
41285
  }))
41207
41286
  ], SDKCreator.prototype, "openWebview", null);
41208
41287
  __decorate([
@@ -41224,16 +41303,47 @@
41224
41303
  handleError,
41225
41304
  validate,
41226
41305
  __param(0, checkType('object', {
41227
- maxProfile: 'number'
41306
+ 'maxProfile?': checkData('number', { min: 1, max: 10 })
41307
+ }, {
41308
+ maxProfile: 1
41228
41309
  }))
41229
41310
  ], SDKCreator.prototype, "openProfilePicker", null);
41230
41311
  __decorate([
41231
41312
  handleError,
41232
41313
  validate,
41233
41314
  __param(0, checkType('object', {
41234
- title: 'string',
41235
- thumbnail: 'url',
41236
- path: 'string'
41315
+ SSID: checkData('string'),
41316
+ 'password?': checkData('string'),
41317
+ 'hiddenSSID?': checkData('boolean')
41318
+ }))
41319
+ ], SDKCreator.prototype, "connectWifi", null);
41320
+ __decorate([
41321
+ handleError,
41322
+ validate,
41323
+ __param(0, checkType('object', {
41324
+ type: checkData('string', {
41325
+ values: ['photo', 'video', 'file', 'multi_photo', 'multi_video']
41326
+ }),
41327
+ 'editView?': checkData('object'),
41328
+ 'editView.enable?': checkData('boolean'),
41329
+ 'editView.aspectRatio?': checkData('string', { regex: /^\d+:\d+$/ }),
41330
+ 'silentRequest?': checkData('boolean'),
41331
+ 'maxSelectItem?': checkData('number', { min: 1 })
41332
+ }))
41333
+ ], SDKCreator.prototype, "openMediaPicker", null);
41334
+ __decorate([
41335
+ handleError,
41336
+ validate,
41337
+ __param(0, checkType('object', {
41338
+ title: checkData('string', { maxLength: 100 }),
41339
+ 'thumbnail?': checkData('url'),
41340
+ 'path?': checkData('url'),
41341
+ description: checkData(['string'], { maxLength: 400 }),
41342
+ }, {
41343
+ description: {
41344
+ vi: '',
41345
+ en: ''
41346
+ }
41237
41347
  }))
41238
41348
  ], SDKCreator.prototype, "getShareableLink", null);
41239
41349
  class ZaloMiniAppSDKCreator extends SDKCreator {