zmp-sdk 2.51.6 → 2.52.0-beta.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.
package/index.d.ts CHANGED
@@ -1426,6 +1426,98 @@ type GetZPITokenReturns = {
1426
1426
  zpp: string;
1427
1427
  zpt: string;
1428
1428
  };
1429
+ type VoucherDisplayType = "qr_code" | "bar_code";
1430
+ type VoucherActionType = "url" | "phone";
1431
+ type VoucherAction = {
1432
+ /**
1433
+ * Loại CTA hiển thị trên thẻ voucher.
1434
+ */
1435
+ type: VoucherActionType;
1436
+ /**
1437
+ * URL khi `type=url`, hoặc số điện thoại khi `type=phone`.
1438
+ */
1439
+ value: string;
1440
+ /**
1441
+ * Nội dung hiển thị trên button CTA.
1442
+ */
1443
+ cta: string;
1444
+ };
1445
+ type AddVoucherData = {
1446
+ /**
1447
+ * Tiêu đề hiển thị trên card.
1448
+ */
1449
+ title: string;
1450
+ /**
1451
+ * Tên voucher / ưu đãi.
1452
+ */
1453
+ name: string;
1454
+ /**
1455
+ * Tên chủ thẻ hiển thị phụ dưới tên voucher. Mặc định dùng `ownerName`.
1456
+ */
1457
+ desc?: string;
1458
+ /**
1459
+ * Logo hiển thị trên card. Mặc định dùng `merchantLogoUrl`.
1460
+ */
1461
+ avatarUrl?: string;
1462
+ /**
1463
+ * Nội dung encode vào QR hoặc barcode.
1464
+ */
1465
+ code: string;
1466
+ /**
1467
+ * Loại mã hiển thị. Mặc định là `qr_code`.
1468
+ */
1469
+ display?: VoucherDisplayType;
1470
+ /**
1471
+ * Nguồn phát hành voucher.
1472
+ */
1473
+ partner?: string;
1474
+ /**
1475
+ * Tên thương hiệu / cửa hàng phát hành voucher.
1476
+ */
1477
+ merchantName: string;
1478
+ /**
1479
+ * OA ID của merchant trên Zalo.
1480
+ */
1481
+ merchantOaId: string;
1482
+ /**
1483
+ * Logo merchant.
1484
+ */
1485
+ merchantLogoUrl?: string;
1486
+ /**
1487
+ * Tên người nhận voucher.
1488
+ */
1489
+ ownerName: string;
1490
+ /**
1491
+ * Điều kiện sử dụng tóm tắt.
1492
+ */
1493
+ condition: string;
1494
+ /**
1495
+ * Điều kiện sử dụng đầy đủ.
1496
+ */
1497
+ conditionDetail?: string;
1498
+ /**
1499
+ * Thời điểm bắt đầu hiệu lực, epoch milliseconds.
1500
+ */
1501
+ validAt?: number;
1502
+ /**
1503
+ * Thời điểm hết hạn, epoch milliseconds.
1504
+ */
1505
+ expiredAt: number;
1506
+ /**
1507
+ * Thời điểm gửi nhắc hạn, epoch milliseconds.
1508
+ */
1509
+ remindAt?: number;
1510
+ /**
1511
+ * Danh sách CTA hiển thị trên thẻ.
1512
+ */
1513
+ actions?: VoucherAction[];
1514
+ };
1515
+ type AddVoucherReturns = {
1516
+ /**
1517
+ * ID thẻ voucher trong Ví QR.
1518
+ */
1519
+ id: string | number;
1520
+ };
1429
1521
  type TempFile = {
1430
1522
  /**
1431
1523
  * Đường dẫn các temp file đã chọn.
@@ -5268,6 +5360,46 @@ declare function requestSendNotification(args?: AsyncVoidCallback): Promise<void
5268
5360
  */
5269
5361
  declare function addRating(args?: AsyncVoidCallback): Promise<void>;
5270
5362
 
5363
+ /**
5364
+ * Lưu voucher vào Ví QR của người dùng.
5365
+ *
5366
+ * API này gửi dữ liệu voucher từ Mini App về server trung gian. Server trung gian
5367
+ * chịu trách nhiệm đăng nhập Ví QR, mã hoá dữ liệu bằng `secureKey`, sau đó trả về
5368
+ * deeplink thêm thẻ vào Ví QR. SDK sẽ tự mở deeplink này bằng `openWebview` để đưa
5369
+ * người dùng tới màn hình thêm thẻ; deeplink không được trả về cho bên gọi.
5370
+ *
5371
+ * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
5372
+ *
5373
+ * @param {string} name Tên voucher / ưu đãi.
5374
+ * @param {string} code Nội dung encode vào QR hoặc barcode.
5375
+ * @param {"qr_code" | "bar_code"} [display="qr_code"] Loại mã hiển thị.
5376
+ * @param {string} merchantName Tên thương hiệu / cửa hàng phát hành voucher.
5377
+ * @param {string} merchantOaId OA ID của merchant trên Zalo.
5378
+ * @param {string} ownerName Tên người nhận voucher.
5379
+ * @param {string} condition Điều kiện sử dụng tóm tắt.
5380
+ * @param {number} expiredAt Thời điểm hết hạn, epoch milliseconds.
5381
+ * @param {number} [remindAt] Thời điểm gửi nhắc hạn, epoch milliseconds.
5382
+ * @param {VoucherAction[]} [actions] Danh sách CTA hiển thị trên thẻ.
5383
+ *
5384
+ * @returns {Promise<void>} Promise resolve khi tạo thẻ thành công và deeplink đã
5385
+ * được mở; reject kèm mã lỗi từ server nếu thất bại.
5386
+ *
5387
+ * @example Thêm voucher vào Ví QR:
5388
+ * ```ts
5389
+ * await addVoucher({
5390
+ * name: "Giảm 50k cho đơn từ 150k",
5391
+ * code: "SPFOOD50K",
5392
+ * merchantName: "Shopee Food",
5393
+ * merchantOaId: "2712772826697148176",
5394
+ * ownerName: "Nguyễn Văn A",
5395
+ * condition: "Áp dụng cho đơn từ 150.000đ.",
5396
+ * expiredAt: 1751299200000,
5397
+ * remindAt: 1751212800000,
5398
+ * });
5399
+ * ```
5400
+ */
5401
+ declare function addVoucher(args: AsyncCallback<void> & AddVoucherData): Promise<void>;
5402
+
5271
5403
  declare const interactOAArgs$1: ZodObject<{
5272
5404
  oaId: ZodString;
5273
5405
  }, "strip", ZodTypeAny, {
@@ -6154,6 +6286,7 @@ declare const otherApis: {
6154
6286
  openGroupList: typeof openGroupList;
6155
6287
  requestSendNotification: typeof requestSendNotification;
6156
6288
  addRating: typeof addRating;
6289
+ addVoucher: typeof addVoucher;
6157
6290
  interactOA: typeof interactOA;
6158
6291
  interactOa: typeof interactOA;
6159
6292
  isAllowedInteractWithOA: typeof checkIsAllowedInteractWithOA;
@@ -6220,4 +6353,4 @@ declare const otherApis: {
6220
6353
  ZMACameraImp: typeof ZMACameraImp;
6221
6354
  };
6222
6355
 
6223
- export { Action, AndroidBottomNavigationBarType, AppError, AsyncCallback, AsyncCallbackFailObject, AsyncProgressCallback, AsyncVoidCallback, AuthorizeType, CameraEvents, CameraParams, ChatType, CheckStateBioAuthenticationReturns, CheckTransactionReturns, CheckZaloCameraPermissionReturns, CheckoutKit, CheckoutPopupOpenParams, CheckoutPopupResponseData, CheckoutSDK, ChooseImageReturns, Common, ContextInfo, CreateOrderIAPReturns, CreateOrderReturns, Events as EventName, Events, FacingMode, FileInfo, FunctionProps, GetAppInfoReturns, GetAuthCodeReturns, GetBeaconDiscoveryReturns, GetDeviceInfoReturn, GetFileInfoReturns, GetLocationReturns, GetNetworkTypeReturns, GetPhoneNumberReturns, GetSettingReturn, GetStorageReturns, GetUserInfoReturns, GetZPITokenReturns, IAPMethodType, IAPPayType, IAPPayTypeType, IOSSafeAreaBottomType, IsSupportReturns, JumpStatus, KeepScreenReturns, LFSStorage, ListFile, LogData, MediaConstraints, MediaDevice, MediaPickerType, NativeCallBackData, NetworkType, OpenBioAuthenticationReturns, OpenMediaPickerReturns, OpenPostFeedReturns, OpenProfilePickerReturns, OpenProfilePickerType, OpenShareSheetReturns, OpenWebviewReturns, OrientationType, Payment, PhotoConstraint, PhotoFormat, PhotoFrame, PhotoQuality, PickAttr, PickedProfile, PlatformType, PostFeedType, ProfileInfo, ProfileType, ProrationMode, ProrationModeType, RemoveStorageReturns, RequestCameraPermissionReturns, SaveFileReturns, ScanNFCType, ScanQRCodeReturns, SelectPaymentMethodReturns, SetStorageReturns, ShareSheetType, StatusBarType, StorageInfo, StreamType, SystemInfo, TempFile, TextAlignType, UserInfo, VibrateType, ZMACamera, ZMACameraImp, addRating, authorize, checkNFC, checkStateBioAuthentication, checkTransaction, checkZaloCameraPermission, chooseImage, clearStorage, closeApp, closeLoading, configAppView, connectWifi, createCameraContext, createOrder, createOrderIAP, createShortcut, otherApis as default, displayAd, downloadFile, events, favoriteApp, followOA, getAccessToken, getAppInfo, getAuthCode, getBeacons, getContext, getContextAsync, getDeviceId, getDeviceIdAsync, getDeviceInfo, getEntrySource, getIDToken, getLocation, getNetworkType, getPhoneNumber, getRouteParams, getSetting, getShareableLink, getStorage, getStorageInfo, getSystemInfo, getUserID, getUserInfo, getVersion, getZPIToken, hideKeyboard, iBeaconInfo, interactOA, interactOA as interactOa, checkIsAllowedInteractWithOA as isAllowedInteractWithOA, keepScreen, loadAd, login, minimizeApp, nativeStorage, offConfirmToExit, offKeepScreen, onCallbackData, onConfirmToExit, onKeepScreen, onNetworkStatusChange, openBioAuthentication, openChat, openDocument, openGroupList, openMediaPicker, openMiniApp, openOutApp, openPermissionSetting, openPhone, openPostFeed, openProfile, openProfilePicker, openSMS, openShareSheet, openWebview, purchase, refreshAd, removeStorage, requestCameraPermission, requestSendNotification, requestUpdateZalo, saveImageToGallery, saveVideoToGallery, scanNFC, scanQRCode, selectPaymentMethod, sendDataToPreviousMiniApp, setAccessToken, setAndroidBottomNavigationBar, setIOSBottomSafeArea, setNavigationBarColor, setNavigationBarLeftButton, setNavigationBarTitle, setStatusBar, setStorage, setupAd, showCustomOAWidget, showFunctionButtonWidget, showOAWidget, showToast, startBeaconDiscovery, stopBeaconDiscovery, trackingManager, unfollowOA, vibrate, viewOAQr };
6356
+ export { Action, AddVoucherData, AddVoucherReturns, AndroidBottomNavigationBarType, AppError, AsyncCallback, AsyncCallbackFailObject, AsyncProgressCallback, AsyncVoidCallback, AuthorizeType, CameraEvents, CameraParams, ChatType, CheckStateBioAuthenticationReturns, CheckTransactionReturns, CheckZaloCameraPermissionReturns, CheckoutKit, CheckoutPopupOpenParams, CheckoutPopupResponseData, CheckoutSDK, ChooseImageReturns, Common, ContextInfo, CreateOrderIAPReturns, CreateOrderReturns, Events as EventName, Events, FacingMode, FileInfo, FunctionProps, GetAppInfoReturns, GetAuthCodeReturns, GetBeaconDiscoveryReturns, GetDeviceInfoReturn, GetFileInfoReturns, GetLocationReturns, GetNetworkTypeReturns, GetPhoneNumberReturns, GetSettingReturn, GetStorageReturns, GetUserInfoReturns, GetZPITokenReturns, IAPMethodType, IAPPayType, IAPPayTypeType, IOSSafeAreaBottomType, IsSupportReturns, JumpStatus, KeepScreenReturns, LFSStorage, ListFile, LogData, MediaConstraints, MediaDevice, MediaPickerType, NativeCallBackData, NetworkType, OpenBioAuthenticationReturns, OpenMediaPickerReturns, OpenPostFeedReturns, OpenProfilePickerReturns, OpenProfilePickerType, OpenShareSheetReturns, OpenWebviewReturns, OrientationType, Payment, PhotoConstraint, PhotoFormat, PhotoFrame, PhotoQuality, PickAttr, PickedProfile, PlatformType, PostFeedType, ProfileInfo, ProfileType, ProrationMode, ProrationModeType, RemoveStorageReturns, RequestCameraPermissionReturns, SaveFileReturns, ScanNFCType, ScanQRCodeReturns, SelectPaymentMethodReturns, SetStorageReturns, ShareSheetType, StatusBarType, StorageInfo, StreamType, SystemInfo, TempFile, TextAlignType, UserInfo, VibrateType, VoucherAction, VoucherActionType, VoucherDisplayType, ZMACamera, ZMACameraImp, addRating, addVoucher, authorize, checkNFC, checkStateBioAuthentication, checkTransaction, checkZaloCameraPermission, chooseImage, clearStorage, closeApp, closeLoading, configAppView, connectWifi, createCameraContext, createOrder, createOrderIAP, createShortcut, otherApis as default, displayAd, downloadFile, events, favoriteApp, followOA, getAccessToken, getAppInfo, getAuthCode, getBeacons, getContext, getContextAsync, getDeviceId, getDeviceIdAsync, getDeviceInfo, getEntrySource, getIDToken, getLocation, getNetworkType, getPhoneNumber, getRouteParams, getSetting, getShareableLink, getStorage, getStorageInfo, getSystemInfo, getUserID, getUserInfo, getVersion, getZPIToken, hideKeyboard, iBeaconInfo, interactOA, interactOA as interactOa, checkIsAllowedInteractWithOA as isAllowedInteractWithOA, keepScreen, loadAd, login, minimizeApp, nativeStorage, offConfirmToExit, offKeepScreen, onCallbackData, onConfirmToExit, onKeepScreen, onNetworkStatusChange, openBioAuthentication, openChat, openDocument, openGroupList, openMediaPicker, openMiniApp, openOutApp, openPermissionSetting, openPhone, openPostFeed, openProfile, openProfilePicker, openSMS, openShareSheet, openWebview, purchase, refreshAd, removeStorage, requestCameraPermission, requestSendNotification, requestUpdateZalo, saveImageToGallery, saveVideoToGallery, scanNFC, scanQRCode, selectPaymentMethod, sendDataToPreviousMiniApp, setAccessToken, setAndroidBottomNavigationBar, setIOSBottomSafeArea, setNavigationBarColor, setNavigationBarLeftButton, setNavigationBarTitle, setStatusBar, setStorage, setupAd, showCustomOAWidget, showFunctionButtonWidget, showOAWidget, showToast, startBeaconDiscovery, stopBeaconDiscovery, trackingManager, unfollowOA, vibrate, viewOAQr };