zmp-sdk 2.52.1-beta.2 → 2.52.2-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/apis/apis/payment/openCheckoutPopup.js +1 -1
- package/apis/apis/requestUpdateZalo.js +1 -1
- package/apis/apis/showFunctionButtonWidget.js +1 -1
- package/apis/common/apis/general/openProfilePicker.js +1 -1
- package/apis/common/apis/general/payment/openCheckoutPopup.js +1 -1
- package/apis/common/apis/general/payment/purchase.js +1 -1
- package/apis/constants.js +1 -1
- package/apis/index.d.ts +68 -113
- package/apis/index.es.js +1 -1
- package/apis/index.js +1 -1
- package/apis/package.json.js +1 -1
- package/browser.min.js +2 -2
- package/index.d.ts +68 -120
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +3 -3
- package/package.json +1 -1
- package/apis/apis/addVoucher.js +0 -1
- package/apis/common/apis/general/addVoucher.js +0 -1
package/index.d.ts
CHANGED
|
@@ -1426,82 +1426,6 @@ 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
|
-
* Tên voucher / ưu đãi.
|
|
1448
|
-
*/
|
|
1449
|
-
name: string;
|
|
1450
|
-
/**
|
|
1451
|
-
* Điều kiện áp dụng (chính), hiển thị trên chi tiết vé.
|
|
1452
|
-
*/
|
|
1453
|
-
condition: string;
|
|
1454
|
-
/**
|
|
1455
|
-
* Điều kiện áp dụng chi tiết (phụ).
|
|
1456
|
-
*/
|
|
1457
|
-
conditionDetail?: string;
|
|
1458
|
-
/**
|
|
1459
|
-
* Thời gian bắt đầu hiệu lực, epoch milliseconds.
|
|
1460
|
-
*/
|
|
1461
|
-
validAt?: number;
|
|
1462
|
-
/**
|
|
1463
|
-
* Hạn sử dụng, epoch milliseconds.
|
|
1464
|
-
*/
|
|
1465
|
-
expiredAt: number;
|
|
1466
|
-
/**
|
|
1467
|
-
* Mã voucher; không truyền thì tự sinh QR OA của merchant.
|
|
1468
|
-
*/
|
|
1469
|
-
code?: string;
|
|
1470
|
-
/**
|
|
1471
|
-
* Loại mã hiển thị. Mặc định là `qr_code`.
|
|
1472
|
-
*/
|
|
1473
|
-
display?: VoucherDisplayType;
|
|
1474
|
-
/**
|
|
1475
|
-
* Khoảng thời gian trước hạn để gửi nhắc, tính bằng milliseconds.
|
|
1476
|
-
*/
|
|
1477
|
-
remindBefore: number;
|
|
1478
|
-
/**
|
|
1479
|
-
* Tên khách hàng sở hữu; không truyền thì không hiển thị trên vé.
|
|
1480
|
-
*/
|
|
1481
|
-
ownerName?: string;
|
|
1482
|
-
/**
|
|
1483
|
-
* OA ID của merchant trên Zalo.
|
|
1484
|
-
*/
|
|
1485
|
-
merchantOaId: string;
|
|
1486
|
-
/**
|
|
1487
|
-
* Tên OA / thương hiệu phát hành voucher.
|
|
1488
|
-
*/
|
|
1489
|
-
merchantName: string;
|
|
1490
|
-
/**
|
|
1491
|
-
* Logo OA, dùng làm logo hiển thị trên voucher.
|
|
1492
|
-
*/
|
|
1493
|
-
merchantLogoUrl: string;
|
|
1494
|
-
/**
|
|
1495
|
-
* Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
1496
|
-
*/
|
|
1497
|
-
actions?: VoucherAction[];
|
|
1498
|
-
};
|
|
1499
|
-
type AddVoucherReturns = {
|
|
1500
|
-
/**
|
|
1501
|
-
* ID thẻ voucher trong Ví QR.
|
|
1502
|
-
*/
|
|
1503
|
-
id: string | number;
|
|
1504
|
-
};
|
|
1505
1429
|
type TempFile = {
|
|
1506
1430
|
/**
|
|
1507
1431
|
* Đường dẫn các temp file đã chọn.
|
|
@@ -2756,11 +2680,14 @@ declare const checkoutPopupArgs: ZodObject<{
|
|
|
2756
2680
|
amount: ZodUnion<[ZodString, ZodNumber]>;
|
|
2757
2681
|
orderDescription: ZodString;
|
|
2758
2682
|
qrContent: ZodString;
|
|
2683
|
+
method: ZodOptional<ZodString>;
|
|
2759
2684
|
}, "strip", ZodTypeAny, {
|
|
2685
|
+
method?: string | undefined;
|
|
2760
2686
|
amount: string | number;
|
|
2761
2687
|
orderDescription: string;
|
|
2762
2688
|
qrContent: string;
|
|
2763
2689
|
}, {
|
|
2690
|
+
method?: string | undefined;
|
|
2764
2691
|
amount: string | number;
|
|
2765
2692
|
orderDescription: string;
|
|
2766
2693
|
qrContent: string;
|
|
@@ -5344,48 +5271,6 @@ declare function requestSendNotification(args?: AsyncVoidCallback): Promise<void
|
|
|
5344
5271
|
*/
|
|
5345
5272
|
declare function addRating(args?: AsyncVoidCallback): Promise<void>;
|
|
5346
5273
|
|
|
5347
|
-
/**
|
|
5348
|
-
* Lưu voucher vào Ví QR của người dùng.
|
|
5349
|
-
*
|
|
5350
|
-
* API này gửi dữ liệu voucher từ Mini App về server trung gian. Server trung gian
|
|
5351
|
-
* chịu trách nhiệm đăng nhập Ví QR, mã hoá dữ liệu bằng `secureKey`, sau đó trả về
|
|
5352
|
-
* deeplink thêm thẻ vào Ví QR. SDK sẽ tự mở deeplink này bằng `openWebview` để đưa
|
|
5353
|
-
* người dùng tới màn hình thêm thẻ; deeplink không được trả về cho bên gọi.
|
|
5354
|
-
*
|
|
5355
|
-
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
5356
|
-
*
|
|
5357
|
-
* @param {string} name Tên voucher / ưu đãi.
|
|
5358
|
-
* @param {string} condition Điều kiện áp dụng (chính), hiển thị trên chi tiết vé.
|
|
5359
|
-
* @param {number} expiredAt Hạn sử dụng, epoch milliseconds.
|
|
5360
|
-
* @param {number} remindBefore Khoảng thời gian trước hạn để gửi nhắc, tính bằng milliseconds.
|
|
5361
|
-
* @param {string} merchantOaId OA ID của merchant trên Zalo.
|
|
5362
|
-
* @param {string} merchantName Tên OA / thương hiệu phát hành voucher.
|
|
5363
|
-
* @param {string} merchantLogoUrl Logo OA, dùng làm logo hiển thị trên voucher.
|
|
5364
|
-
* @param {string} [conditionDetail] Điều kiện áp dụng chi tiết (phụ).
|
|
5365
|
-
* @param {number} [validAt] Thời gian bắt đầu hiệu lực, epoch milliseconds.
|
|
5366
|
-
* @param {string} [code] Mã voucher; không truyền thì tự sinh QR OA của merchant.
|
|
5367
|
-
* @param {"qr_code" | "bar_code"} [display="qr_code"] Loại mã hiển thị.
|
|
5368
|
-
* @param {string} [ownerName] Tên khách hàng sở hữu; không truyền thì không hiển thị trên vé.
|
|
5369
|
-
* @param {VoucherAction[]} [actions] Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
5370
|
-
*
|
|
5371
|
-
* @returns {Promise<void>} Promise resolve khi tạo thẻ thành công và deeplink đã
|
|
5372
|
-
* được mở; reject kèm mã lỗi từ server nếu thất bại.
|
|
5373
|
-
*
|
|
5374
|
-
* @example Thêm voucher vào Ví QR:
|
|
5375
|
-
* ```ts
|
|
5376
|
-
* await addVoucher({
|
|
5377
|
-
* name: "Giảm 50% giá trị đơn hàng",
|
|
5378
|
-
* condition: "Áp dụng cho hóa đơn trên 200.000đ",
|
|
5379
|
-
* expiredAt: 1743440399000,
|
|
5380
|
-
* remindBefore: 3600000,
|
|
5381
|
-
* merchantOaId: "2646373759294038927",
|
|
5382
|
-
* merchantName: "The Face Shop",
|
|
5383
|
-
* merchantLogoUrl: "https://static.example.com/logo.png",
|
|
5384
|
-
* });
|
|
5385
|
-
* ```
|
|
5386
|
-
*/
|
|
5387
|
-
declare function addVoucher(args: AsyncCallback<void> & AddVoucherData): Promise<void>;
|
|
5388
|
-
|
|
5389
5274
|
declare const interactOAArgs$1: ZodObject<{
|
|
5390
5275
|
oaId: ZodString;
|
|
5391
5276
|
}, "strip", ZodTypeAny, {
|
|
@@ -5903,6 +5788,70 @@ type ShowFunctionButtonWidgetArgs = Omit<ShowFunctionButtonWidgetValidatedArgs,
|
|
|
5903
5788
|
onDataReceived?: FunctionButtonWidgetOnDataReceived;
|
|
5904
5789
|
onError?: FunctionButtonWidgetOnError;
|
|
5905
5790
|
};
|
|
5791
|
+
/**
|
|
5792
|
+
* Widget Function Button: Khi người dùng nhấn vào button này, Mini App sẽ nhận được 1 interact token để Merchant Server gửi kèm khi gọi Checkout SDK updateOrderStatus (https://mini.zalo.me/documents/checkout-sdk/updateOrderStatus/).
|
|
5793
|
+
*
|
|
5794
|
+
* @minimumVersion 2.39.0
|
|
5795
|
+
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
5796
|
+
*
|
|
5797
|
+
* @param {string} id ID của element, nơi cần hiển thị widget.
|
|
5798
|
+
* @param {"ORDER"} type Loại nút, hiện tại chỉ hỗ trợ giá trị: `ORDER`.
|
|
5799
|
+
* @param {"Thanh toán" |"Đặt món" |"Đặt xe" |"Đặt hàng" |"Mua vé" |"Booking" |"Đặt chỗ" |"Tạo đơn hàng" |"Đặt trước" |"Mua hàng" |"Đặt lịch" |"Tra cứu" |"Kiểm tra"} text Chuỗi hiển thị trong button. Phải là một trong các giá trị được cho phép:
|
|
5800
|
+
* - Thanh toán
|
|
5801
|
+
* - Đặt món
|
|
5802
|
+
* - Đặt xe
|
|
5803
|
+
* - Đặt hàng
|
|
5804
|
+
* - Mua vé
|
|
5805
|
+
* - Booking
|
|
5806
|
+
* - Đặt chỗ
|
|
5807
|
+
* - Tạo đơn hàng
|
|
5808
|
+
* - Đặt trước
|
|
5809
|
+
* - Mua hàng
|
|
5810
|
+
* - Đặt lịch
|
|
5811
|
+
* - Tra cứu
|
|
5812
|
+
* - Kiểm tra
|
|
5813
|
+
* @param {string} [fontSize="16px"] Kích thước font chữ. Giá trị nhỏ nhất là 14px.
|
|
5814
|
+
* @param {string} [color="#0068FF"] Màu chủ đạo của widget. Giá trị phải là chuỗi hex.
|
|
5815
|
+
* @param {string} [textColor="#FFFFFF"] Màu chữ trong button. Giá trị phải là chuỗi hex.
|
|
5816
|
+
* @param {string} [borderRadius="48px"] Bo góc (bo tròn các góc của button).
|
|
5817
|
+
* @param {(interactToken: string, type: string, context: { callAction: (actionName: string, actionData: any) => void }) => void} [onDataReceived] Callback được gọi khi người dùng nhấn vào widget. Callback này chứa `interactToken` để Merchant Server gửi kèm khi gọi Checkout SDK updateOrderStatus (https://mini.zalo.me/documents/checkout-sdk/updateOrderStatus/).
|
|
5818
|
+
* @param {(error: AppError) => void} [onError] Callback được gọi khi có lỗi xảy ra khi người dùng nhấn vào widget. Callback này chứa `error` là thông tin về lỗi.
|
|
5819
|
+
*
|
|
5820
|
+
* @example Hiển thị Widget Function Button:
|
|
5821
|
+
* ```ts
|
|
5822
|
+
* import React, { useEffect } from "react";
|
|
5823
|
+
* import { showFunctionButtonWidget } from "zmp-sdk/apis";
|
|
5824
|
+
*
|
|
5825
|
+
* function HomePage() {
|
|
5826
|
+
* useEffect(() => {
|
|
5827
|
+
* showFunctionButtonWidget({
|
|
5828
|
+
* id: "orderButton",
|
|
5829
|
+
* type: "ORDER",
|
|
5830
|
+
* text: "Đặt hàng",
|
|
5831
|
+
* color: "#0068FF",
|
|
5832
|
+
* textColor: "#FFFFFF",
|
|
5833
|
+
* borderRadius: "48px",
|
|
5834
|
+
* onDataReceived: (interactToken, type) => {
|
|
5835
|
+
* console.log(interactToken);
|
|
5836
|
+
* },
|
|
5837
|
+
* onError: (error) => {
|
|
5838
|
+
* console.error("onError:", error.code, error.message);
|
|
5839
|
+
* },
|
|
5840
|
+
* });
|
|
5841
|
+
* }, []);
|
|
5842
|
+
*
|
|
5843
|
+
* return (
|
|
5844
|
+
* <>
|
|
5845
|
+
* ...
|
|
5846
|
+
* <div id="orderButton" />
|
|
5847
|
+
* ...
|
|
5848
|
+
* </>
|
|
5849
|
+
* );
|
|
5850
|
+
* }
|
|
5851
|
+
*
|
|
5852
|
+
* export default HomePage;
|
|
5853
|
+
* ```
|
|
5854
|
+
*/
|
|
5906
5855
|
declare function showFunctionButtonWidget(args: AsyncVoidCallback & ShowFunctionButtonWidgetArgs): Promise<void>;
|
|
5907
5856
|
|
|
5908
5857
|
declare const scanNFCArgs: ZodObject<{
|
|
@@ -6272,7 +6221,6 @@ declare const otherApis: {
|
|
|
6272
6221
|
openGroupList: typeof openGroupList;
|
|
6273
6222
|
requestSendNotification: typeof requestSendNotification;
|
|
6274
6223
|
addRating: typeof addRating;
|
|
6275
|
-
addVoucher: typeof addVoucher;
|
|
6276
6224
|
interactOA: typeof interactOA;
|
|
6277
6225
|
interactOa: typeof interactOA;
|
|
6278
6226
|
isAllowedInteractWithOA: typeof checkIsAllowedInteractWithOA;
|
|
@@ -6339,4 +6287,4 @@ declare const otherApis: {
|
|
|
6339
6287
|
ZMACameraImp: typeof ZMACameraImp;
|
|
6340
6288
|
};
|
|
6341
6289
|
|
|
6342
|
-
export { Action,
|
|
6290
|
+
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 };
|