zmp-sdk 2.52.1-beta.1 → 2.52.1-beta.2
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/addVoucher.js +1 -1
- package/apis/common/apis/general/addVoucher.js +1 -1
- package/apis/index.d.ts +41 -55
- package/apis/package.json.js +1 -1
- package/browser.min.js +2 -2
- package/index.d.ts +41 -55
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +2 -2
- package/package.json +1 -1
package/apis/apis/addVoucher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import n,{object as e,string as r,number as i}from'./../external/zod/lib/index.mjs.js';import t from"../appEnv/index.js";import a from"../common/notFound.js";import{functionHandler as m}from"../utils/decorator.js";import s from"../common/apis/general/addVoucher.js";import{__generator as c}from'./../external/tslib/tslib.es6.js';var p=e({type:n.enum(["url","phone"]),value:r().min(1),cta:r().min(1)}),u=[e({name:r().min(1).max(200),condition:r().min(1).max(500),conditionDetail:r().min(1).max(2e3).optional(),validAt:i().int().nonnegative().optional(),expiredAt:i().int().positive(),code:r().min(1).max(140).optional(),display:n.enum(["qr_code","bar_code"]).default("qr_code").optional(),remindBefore:i().int().positive(),ownerName:r().min(1).max(100).optional(),merchantOaId:r().min(1).max(50),merchantName:r().min(1).max(100),merchantLogoUrl:r().url().max(500),actions:n.array(p).max(2).optional()})];function d(o){return l.apply(this,arguments)}function l(){return l=o((function(n){return c(this,(function(e){return[2,m("addVoucher",u,[n],(r=o((function(o,n){var e;return c(this,(function(r){switch(r.label){case 0:return e=n||o,t.isMp?[4,s(e)]:[3,2];case 1:return[2,r.sent()];case 2:return t.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(a("addVoucher",{}))]}}))})),function(o,n){return r.apply(this,arguments)}))];var r}))})),l.apply(this,arguments)}export{d as addVoucher};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from"../../token.js";import{RESPONSE_CODE as n,MESSAGES as t,QRCARD_APIS as o}from"../../../constants.js";import{AppError as
|
|
1
|
+
import e from'./../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import r from"../../token.js";import{RESPONSE_CODE as n,MESSAGES as t,QRCARD_APIS as o}from"../../../constants.js";import{AppError as i}from"../../../utils/errorHandler.js";import a from"./openWebview.js";import{__generator as s}from'./../../../external/tslib/tslib.es6.js';var d,c=(d=e((function(e){var d,c,m,l,u,E,p;return s(this,(function(s){switch(s.label){case 0:return[4,r.jumpAndGetToken()];case 1:if(s.sent(),!(m=null===(d=r.miniProgramConfig)||void 0===d?void 0:d.jwt))throw new i(n.UNAUTHORIZED,t.LOGIN_REQUIRED);return(l=new URLSearchParams).append("data",JSON.stringify(function(e){return{name:e.name,condition:e.condition,conditionDetail:e.conditionDetail,validAt:e.validAt,expiredAt:e.expiredAt,code:e.code,display:e.display||"qr_code",remindBefore:e.remindBefore,ownerName:e.ownerName,merchantOaId:e.merchantOaId,merchantName:e.merchantName,merchantLogoUrl:e.merchantLogoUrl,actions:e.actions}}(e))),[4,fetch(o.ADD_VOUCHER,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer ".concat(m)},body:l})];case 2:u=s.sent(),s.label=3;case 3:return s.trys.push([3,5,,6]),[4,u.json()];case 4:return E=s.sent(),[3,6];case 5:throw s.sent(),new i(n.VOUCHER_CREATE_FAILED,t.VOUCHER_CREATE_FAILED);case 6:if(0!==(null==E?void 0:E.err))throw new i("number"==typeof(null==E?void 0:E.err)?E.err:n.VOUCHER_CREATE_FAILED,function(e){var r="string"==typeof(null==e?void 0:e.msg)?e.msg.trim():"";return r||(-1===(null==e?void 0:e.err)?"Unknown exception":t.VOUCHER_CREATE_FAILED)}(E));if(!(p=null===(c=E.data)||void 0===c?void 0:c.deeplink))throw new i(n.VOUCHER_CREATE_FAILED,t.VOUCHER_CREATE_FAILED);return[4,a(p)];case 7:return s.sent(),[2]}}))})),function(e){return d.apply(this,arguments)});export{c as default};
|
package/apis/index.d.ts
CHANGED
|
@@ -1305,72 +1305,56 @@ type VoucherAction = {
|
|
|
1305
1305
|
cta: string;
|
|
1306
1306
|
};
|
|
1307
1307
|
type AddVoucherData = {
|
|
1308
|
-
/**
|
|
1309
|
-
* Tiêu đề hiển thị trên card.
|
|
1310
|
-
*/
|
|
1311
|
-
title: string;
|
|
1312
|
-
/**
|
|
1313
|
-
* Nội dung encode vào QR hoặc barcode.
|
|
1314
|
-
*/
|
|
1315
|
-
code: string;
|
|
1316
|
-
/**
|
|
1317
|
-
* Loại mã hiển thị. Mặc định là `qr_code`.
|
|
1318
|
-
*/
|
|
1319
|
-
display?: VoucherDisplayType;
|
|
1320
1308
|
/**
|
|
1321
1309
|
* Tên voucher / ưu đãi.
|
|
1322
1310
|
*/
|
|
1323
1311
|
name: string;
|
|
1324
1312
|
/**
|
|
1325
|
-
*
|
|
1313
|
+
* Điều kiện áp dụng (chính), hiển thị trên chi tiết vé.
|
|
1326
1314
|
*/
|
|
1327
|
-
|
|
1315
|
+
condition: string;
|
|
1328
1316
|
/**
|
|
1329
|
-
*
|
|
1317
|
+
* Điều kiện áp dụng chi tiết (phụ).
|
|
1330
1318
|
*/
|
|
1331
|
-
|
|
1319
|
+
conditionDetail?: string;
|
|
1332
1320
|
/**
|
|
1333
|
-
*
|
|
1321
|
+
* Thời gian bắt đầu hiệu lực, epoch milliseconds.
|
|
1334
1322
|
*/
|
|
1335
|
-
|
|
1323
|
+
validAt?: number;
|
|
1336
1324
|
/**
|
|
1337
|
-
*
|
|
1325
|
+
* Hạn sử dụng, epoch milliseconds.
|
|
1338
1326
|
*/
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
* OA ID của merchant trên Zalo.
|
|
1342
|
-
*/
|
|
1343
|
-
merchantOaId: string;
|
|
1327
|
+
expiredAt: number;
|
|
1344
1328
|
/**
|
|
1345
|
-
*
|
|
1329
|
+
* Mã voucher; không truyền thì tự sinh QR OA của merchant.
|
|
1346
1330
|
*/
|
|
1347
|
-
|
|
1331
|
+
code?: string;
|
|
1348
1332
|
/**
|
|
1349
|
-
*
|
|
1333
|
+
* Loại mã hiển thị. Mặc định là `qr_code`.
|
|
1350
1334
|
*/
|
|
1351
|
-
|
|
1335
|
+
display?: VoucherDisplayType;
|
|
1352
1336
|
/**
|
|
1353
|
-
*
|
|
1337
|
+
* Khoảng thời gian trước hạn để gửi nhắc, tính bằng milliseconds.
|
|
1354
1338
|
*/
|
|
1355
|
-
|
|
1339
|
+
remindBefore: number;
|
|
1356
1340
|
/**
|
|
1357
|
-
*
|
|
1341
|
+
* Tên khách hàng sở hữu; không truyền thì không hiển thị trên vé.
|
|
1358
1342
|
*/
|
|
1359
|
-
|
|
1343
|
+
ownerName?: string;
|
|
1360
1344
|
/**
|
|
1361
|
-
*
|
|
1345
|
+
* OA ID của merchant trên Zalo.
|
|
1362
1346
|
*/
|
|
1363
|
-
|
|
1347
|
+
merchantOaId: string;
|
|
1364
1348
|
/**
|
|
1365
|
-
*
|
|
1349
|
+
* Tên OA / thương hiệu phát hành voucher.
|
|
1366
1350
|
*/
|
|
1367
|
-
|
|
1351
|
+
merchantName: string;
|
|
1368
1352
|
/**
|
|
1369
|
-
*
|
|
1353
|
+
* Logo OA, dùng làm logo hiển thị trên voucher.
|
|
1370
1354
|
*/
|
|
1371
|
-
|
|
1355
|
+
merchantLogoUrl: string;
|
|
1372
1356
|
/**
|
|
1373
|
-
* Danh sách CTA hiển thị trên
|
|
1357
|
+
* Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
1374
1358
|
*/
|
|
1375
1359
|
actions?: VoucherAction[];
|
|
1376
1360
|
};
|
|
@@ -4960,15 +4944,18 @@ declare function addRating(args?: AsyncVoidCallback): Promise<void>;
|
|
|
4960
4944
|
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
4961
4945
|
*
|
|
4962
4946
|
* @param {string} name Tên voucher / ưu đãi.
|
|
4963
|
-
* @param {string}
|
|
4964
|
-
* @param {
|
|
4965
|
-
* @param {
|
|
4947
|
+
* @param {string} condition Điều kiện áp dụng (chính), hiển thị trên chi tiết vé.
|
|
4948
|
+
* @param {number} expiredAt Hạn sử dụng, epoch milliseconds.
|
|
4949
|
+
* @param {number} remindBefore Khoảng thời gian trước hạn để gửi nhắc, tính bằng milliseconds.
|
|
4966
4950
|
* @param {string} merchantOaId OA ID của merchant trên Zalo.
|
|
4967
|
-
* @param {string}
|
|
4968
|
-
* @param {string}
|
|
4969
|
-
* @param {
|
|
4970
|
-
* @param {number} [
|
|
4971
|
-
* @param {
|
|
4951
|
+
* @param {string} merchantName Tên OA / thương hiệu phát hành voucher.
|
|
4952
|
+
* @param {string} merchantLogoUrl Logo OA, dùng làm logo hiển thị trên voucher.
|
|
4953
|
+
* @param {string} [conditionDetail] Điều kiện áp dụng chi tiết (phụ).
|
|
4954
|
+
* @param {number} [validAt] Thời gian bắt đầu hiệu lực, epoch milliseconds.
|
|
4955
|
+
* @param {string} [code] Mã voucher; không truyền thì tự sinh QR OA của merchant.
|
|
4956
|
+
* @param {"qr_code" | "bar_code"} [display="qr_code"] Loại mã hiển thị.
|
|
4957
|
+
* @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é.
|
|
4958
|
+
* @param {VoucherAction[]} [actions] Danh sách CTA hiển thị trên thẻ (tối đa 2).
|
|
4972
4959
|
*
|
|
4973
4960
|
* @returns {Promise<void>} Promise resolve khi tạo thẻ thành công và deeplink đã
|
|
4974
4961
|
* được mở; reject kèm mã lỗi từ server nếu thất bại.
|
|
@@ -4976,14 +4963,13 @@ declare function addRating(args?: AsyncVoidCallback): Promise<void>;
|
|
|
4976
4963
|
* @example Thêm voucher vào Ví QR:
|
|
4977
4964
|
* ```ts
|
|
4978
4965
|
* await addVoucher({
|
|
4979
|
-
* name: "Giảm
|
|
4980
|
-
*
|
|
4981
|
-
*
|
|
4982
|
-
*
|
|
4983
|
-
*
|
|
4984
|
-
*
|
|
4985
|
-
*
|
|
4986
|
-
* remindAt: 1751212800000,
|
|
4966
|
+
* name: "Giảm 50% giá trị đơn hàng",
|
|
4967
|
+
* condition: "Áp dụng cho hóa đơn trên 200.000đ",
|
|
4968
|
+
* expiredAt: 1743440399000,
|
|
4969
|
+
* remindBefore: 3600000,
|
|
4970
|
+
* merchantOaId: "2646373759294038927",
|
|
4971
|
+
* merchantName: "The Face Shop",
|
|
4972
|
+
* merchantLogoUrl: "https://static.example.com/logo.png",
|
|
4987
4973
|
* });
|
|
4988
4974
|
* ```
|
|
4989
4975
|
*/
|
package/apis/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="2.52.1-beta.
|
|
1
|
+
var a="2.52.1-beta.2";export{a as version};
|