zmp-sdk 2.52.1-beta.3 → 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 -144
- 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 -145
- 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,84 +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
|
-
* Token để merchant gửi tin nhắn không tốn phí. Lấy từ callback
|
|
1476
|
-
* `onDataReceived` của `showFunctionButtonWidget`.
|
|
1477
|
-
*/
|
|
1478
|
-
interactToken?: string;
|
|
1479
|
-
/**
|
|
1480
|
-
* Tên khách hàng sở hữu; không truyền thì không hiển thị trên vé.
|
|
1481
|
-
*/
|
|
1482
|
-
ownerName?: string;
|
|
1483
|
-
/**
|
|
1484
|
-
* OA ID của merchant trên Zalo.
|
|
1485
|
-
*/
|
|
1486
|
-
merchantOaId: string;
|
|
1487
|
-
/**
|
|
1488
|
-
* Tên OA / thương hiệu phát hành voucher.
|
|
1489
|
-
*/
|
|
1490
|
-
merchantName: string;
|
|
1491
|
-
/**
|
|
1492
|
-
* Logo OA, dùng làm logo hiển thị trên voucher.
|
|
1493
|
-
*/
|
|
1494
|
-
merchantLogoUrl: string;
|
|
1495
|
-
/**
|
|
1496
|
-
* Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
1497
|
-
*/
|
|
1498
|
-
actions?: VoucherAction[];
|
|
1499
|
-
};
|
|
1500
|
-
type AddVoucherReturns = {
|
|
1501
|
-
/**
|
|
1502
|
-
* Token để merchant gửi tin nhắn OA cho người dùng; chuỗi rỗng nếu server
|
|
1503
|
-
* không trả về.
|
|
1504
|
-
*/
|
|
1505
|
-
oa_message_token: string;
|
|
1506
|
-
};
|
|
1507
1429
|
type TempFile = {
|
|
1508
1430
|
/**
|
|
1509
1431
|
* Đường dẫn các temp file đã chọn.
|
|
@@ -2758,11 +2680,14 @@ declare const checkoutPopupArgs: ZodObject<{
|
|
|
2758
2680
|
amount: ZodUnion<[ZodString, ZodNumber]>;
|
|
2759
2681
|
orderDescription: ZodString;
|
|
2760
2682
|
qrContent: ZodString;
|
|
2683
|
+
method: ZodOptional<ZodString>;
|
|
2761
2684
|
}, "strip", ZodTypeAny, {
|
|
2685
|
+
method?: string | undefined;
|
|
2762
2686
|
amount: string | number;
|
|
2763
2687
|
orderDescription: string;
|
|
2764
2688
|
qrContent: string;
|
|
2765
2689
|
}, {
|
|
2690
|
+
method?: string | undefined;
|
|
2766
2691
|
amount: string | number;
|
|
2767
2692
|
orderDescription: string;
|
|
2768
2693
|
qrContent: string;
|
|
@@ -5346,71 +5271,6 @@ declare function requestSendNotification(args?: AsyncVoidCallback): Promise<void
|
|
|
5346
5271
|
*/
|
|
5347
5272
|
declare function addRating(args?: AsyncVoidCallback): Promise<void>;
|
|
5348
5273
|
|
|
5349
|
-
/**
|
|
5350
|
-
* Lưu voucher vào Ví QR của người dùng.
|
|
5351
|
-
*
|
|
5352
|
-
* API này gửi dữ liệu voucher từ Mini App về server trung gian. Server trung gian
|
|
5353
|
-
* chịu trách nhiệm đăng nhập Ví QR, mã hoá dữ liệu bằng `secureKey`, sau đó trả về
|
|
5354
|
-
* deeplink thêm thẻ vào Ví QR. SDK sẽ tự mở deeplink này bằng `openWebview` để đưa
|
|
5355
|
-
* người dùng tới màn hình thêm thẻ; deeplink không được trả về cho bên gọi, chỉ
|
|
5356
|
-
* trả về `oa_message_token`.
|
|
5357
|
-
*
|
|
5358
|
-
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
5359
|
-
*
|
|
5360
|
-
* @param {string} name Tên voucher / ưu đãi.
|
|
5361
|
-
* @param {string} condition Điều kiện áp dụng (chính), hiển thị trên chi tiết vé.
|
|
5362
|
-
* @param {number} expiredAt Hạn sử dụng, epoch milliseconds.
|
|
5363
|
-
* @param {string} merchantOaId OA ID của merchant trên Zalo.
|
|
5364
|
-
* @param {string} merchantName Tên OA / thương hiệu phát hành voucher.
|
|
5365
|
-
* @param {string} merchantLogoUrl Logo OA, dùng làm logo hiển thị trên voucher.
|
|
5366
|
-
* @param {string} [conditionDetail] Điều kiện áp dụng chi tiết (phụ).
|
|
5367
|
-
* @param {number} [validAt] Thời gian bắt đầu hiệu lực, epoch milliseconds.
|
|
5368
|
-
* @param {string} [code] Mã voucher; không truyền thì tự sinh QR OA của merchant.
|
|
5369
|
-
* @param {"qr_code" | "bar_code"} [display="qr_code"] Loại mã hiển thị.
|
|
5370
|
-
* @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é.
|
|
5371
|
-
* @param {string} [interactToken] Token để merchant gửi tin nhắn không tốn phí.
|
|
5372
|
-
* Lấy từ callback `onDataReceived` của {@link showFunctionButtonWidget} khi
|
|
5373
|
-
* người dùng nhấn vào Function Button Widget.
|
|
5374
|
-
* @param {VoucherAction[]} [actions] Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
5375
|
-
*
|
|
5376
|
-
* @returns {Promise<AddVoucherReturns>} Promise resolve khi tạo thẻ thành công và
|
|
5377
|
-
* deeplink đã được mở, trả về `oa_message_token` (chuỗi rỗng nếu server không
|
|
5378
|
-
* trả về); reject kèm mã lỗi từ server nếu thất bại.
|
|
5379
|
-
*
|
|
5380
|
-
* @example Thêm voucher vào Ví QR:
|
|
5381
|
-
* ```ts
|
|
5382
|
-
* await addVoucher({
|
|
5383
|
-
* name: "Giảm 50% giá trị đơn hàng",
|
|
5384
|
-
* condition: "Áp dụng cho hóa đơn trên 200.000đ",
|
|
5385
|
-
* expiredAt: 1743440399000,
|
|
5386
|
-
* merchantOaId: "2646373759294038927",
|
|
5387
|
-
* merchantName: "The Face Shop",
|
|
5388
|
-
* merchantLogoUrl: "https://static.example.com/logo.png",
|
|
5389
|
-
* });
|
|
5390
|
-
* ```
|
|
5391
|
-
*
|
|
5392
|
-
* @example Gửi kèm `interactToken` lấy từ Function Button Widget:
|
|
5393
|
-
* ```ts
|
|
5394
|
-
* showFunctionButtonWidget({
|
|
5395
|
-
* id: "orderButton",
|
|
5396
|
-
* type: "ORDER",
|
|
5397
|
-
* text: "Tạo đơn hàng",
|
|
5398
|
-
* onDataReceived: async (interactToken) => {
|
|
5399
|
-
* await addVoucher({
|
|
5400
|
-
* name: "Giảm 50% giá trị đơn hàng",
|
|
5401
|
-
* condition: "Áp dụng cho hóa đơn trên 200.000đ",
|
|
5402
|
-
* expiredAt: 1743440399000,
|
|
5403
|
-
* merchantOaId: "2646373759294038927",
|
|
5404
|
-
* merchantName: "The Face Shop",
|
|
5405
|
-
* merchantLogoUrl: "https://static.example.com/logo.png",
|
|
5406
|
-
* interactToken,
|
|
5407
|
-
* });
|
|
5408
|
-
* },
|
|
5409
|
-
* });
|
|
5410
|
-
* ```
|
|
5411
|
-
*/
|
|
5412
|
-
declare function addVoucher(args: AsyncCallback<AddVoucherReturns> & AddVoucherData): Promise<AddVoucherReturns>;
|
|
5413
|
-
|
|
5414
5274
|
declare const interactOAArgs$1: ZodObject<{
|
|
5415
5275
|
oaId: ZodString;
|
|
5416
5276
|
}, "strip", ZodTypeAny, {
|
|
@@ -5928,6 +5788,70 @@ type ShowFunctionButtonWidgetArgs = Omit<ShowFunctionButtonWidgetValidatedArgs,
|
|
|
5928
5788
|
onDataReceived?: FunctionButtonWidgetOnDataReceived;
|
|
5929
5789
|
onError?: FunctionButtonWidgetOnError;
|
|
5930
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
|
+
*/
|
|
5931
5855
|
declare function showFunctionButtonWidget(args: AsyncVoidCallback & ShowFunctionButtonWidgetArgs): Promise<void>;
|
|
5932
5856
|
|
|
5933
5857
|
declare const scanNFCArgs: ZodObject<{
|
|
@@ -6297,7 +6221,6 @@ declare const otherApis: {
|
|
|
6297
6221
|
openGroupList: typeof openGroupList;
|
|
6298
6222
|
requestSendNotification: typeof requestSendNotification;
|
|
6299
6223
|
addRating: typeof addRating;
|
|
6300
|
-
addVoucher: typeof addVoucher;
|
|
6301
6224
|
interactOA: typeof interactOA;
|
|
6302
6225
|
interactOa: typeof interactOA;
|
|
6303
6226
|
isAllowedInteractWithOA: typeof checkIsAllowedInteractWithOA;
|
|
@@ -6364,4 +6287,4 @@ declare const otherApis: {
|
|
|
6364
6287
|
ZMACameraImp: typeof ZMACameraImp;
|
|
6365
6288
|
};
|
|
6366
6289
|
|
|
6367
|
-
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 };
|