@redonvn/zalo-ads-sdk 0.1.0 → 0.2.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/dist/index.d.mts +1313 -444
- package/dist/index.d.ts +1313 -444
- package/dist/index.js +498 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +487 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -257,7 +257,9 @@ function decodePlaySessionJwt(playSessionCookie) {
|
|
|
257
257
|
const base64Url = parts[1];
|
|
258
258
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
259
259
|
const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
|
|
260
|
-
const
|
|
260
|
+
const binaryStr = globalThis.atob(padded);
|
|
261
|
+
const bytes = Uint8Array.from(binaryStr, (ch) => ch.charCodeAt(0));
|
|
262
|
+
const jsonStr = new TextDecoder("utf-8").decode(bytes);
|
|
261
263
|
return JSON.parse(jsonStr);
|
|
262
264
|
} catch {
|
|
263
265
|
return void 0;
|
|
@@ -655,14 +657,23 @@ var ZaloAuthManager = class {
|
|
|
655
657
|
formProfile = sessionJson.data;
|
|
656
658
|
}
|
|
657
659
|
} else if (domain === "profile.ads.zalo.me") {
|
|
658
|
-
await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
|
|
660
|
+
const profileRes = await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
|
|
661
|
+
if (profileRes) {
|
|
662
|
+
const html = await profileRes.text().catch(() => "");
|
|
663
|
+
const csrfMatch = html.match(/CSRF_TOKEN\s*=\s*['"]([^'"]+)['"]/);
|
|
664
|
+
if (csrfMatch?.[1]) {
|
|
665
|
+
cookies["CSRF_TOKEN"] = csrfMatch[1];
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
headers["Origin"] = "https://profile.ads.zalo.me";
|
|
669
|
+
headers["Referer"] = "https://profile.ads.zalo.me/";
|
|
659
670
|
} else if (domain === "api.widget.zalo.me" || domain === "widget.chat.zalo.me") {
|
|
660
671
|
headers["Origin"] = "https://ads.zalo.me";
|
|
661
672
|
headers["Referer"] = "https://ads.zalo.me/";
|
|
662
673
|
}
|
|
663
|
-
const xsrfToken = cookies["XSRF-TOKEN"];
|
|
664
|
-
if (
|
|
665
|
-
headers["x-xsrf-token"] =
|
|
674
|
+
const xsrfToken = cookies["XSRF-TOKEN"] ?? cookies["CSRF_TOKEN"];
|
|
675
|
+
if (cookies["XSRF-TOKEN"]) {
|
|
676
|
+
headers["x-xsrf-token"] = cookies["XSRF-TOKEN"];
|
|
666
677
|
}
|
|
667
678
|
const bearerToken = formProfile?.token;
|
|
668
679
|
if (bearerToken) {
|
|
@@ -695,7 +706,8 @@ var ZaloAuthManager = class {
|
|
|
695
706
|
}
|
|
696
707
|
async followOAuthRedirects(startUrl, cookies, stripSelectAccount) {
|
|
697
708
|
let currentUrl = startUrl;
|
|
698
|
-
|
|
709
|
+
let lastResponse;
|
|
710
|
+
for (let step = 1; step <= 7; step++) {
|
|
699
711
|
const res = await this.fetchImpl(currentUrl, {
|
|
700
712
|
method: "GET",
|
|
701
713
|
headers: {
|
|
@@ -705,9 +717,52 @@ var ZaloAuthManager = class {
|
|
|
705
717
|
},
|
|
706
718
|
redirect: "manual"
|
|
707
719
|
});
|
|
720
|
+
lastResponse = res;
|
|
708
721
|
this.mergeSetCookies(res, cookies);
|
|
709
722
|
let location = res.headers.get("location");
|
|
710
|
-
if (!location
|
|
723
|
+
if (!location && res.status === 200 && currentUrl.includes("oauth.zaloapp.com/v4/permission")) {
|
|
724
|
+
const html = await res.text().catch(() => "");
|
|
725
|
+
const csrfMatch = html.match(/name="csrf_token"[^>]*value="([^"]+)"/);
|
|
726
|
+
if (csrfMatch && html.includes("zid_consent_form")) {
|
|
727
|
+
const stateMatch = html.match(/name="state"[^>]*value="([^"]+)"/);
|
|
728
|
+
const parsedOAuthUrl = new URL(currentUrl);
|
|
729
|
+
const consentForm = new URLSearchParams({
|
|
730
|
+
csrf_token: csrfMatch[1],
|
|
731
|
+
app_id: parsedOAuthUrl.searchParams.get("app_id") ?? "",
|
|
732
|
+
redirect_uri: parsedOAuthUrl.searchParams.get("redirect_uri") ?? "",
|
|
733
|
+
bndl_id: "",
|
|
734
|
+
pkg_name: "",
|
|
735
|
+
sign_key: "",
|
|
736
|
+
wp_guid: "",
|
|
737
|
+
mac: "",
|
|
738
|
+
ref: "",
|
|
739
|
+
token_login_post: "",
|
|
740
|
+
state: stateMatch ? stateMatch[1] : parsedOAuthUrl.searchParams.get("state") ?? "",
|
|
741
|
+
ext_info: "",
|
|
742
|
+
enable_qgpf: ""
|
|
743
|
+
});
|
|
744
|
+
const consentRes = await this.fetchImpl(currentUrl, {
|
|
745
|
+
method: "POST",
|
|
746
|
+
headers: {
|
|
747
|
+
Cookie: this.formatCookieHeader(cookies),
|
|
748
|
+
"User-Agent": this.userAgent,
|
|
749
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
750
|
+
Origin: "https://oauth.zaloapp.com",
|
|
751
|
+
Referer: currentUrl
|
|
752
|
+
},
|
|
753
|
+
body: consentForm.toString(),
|
|
754
|
+
redirect: "manual"
|
|
755
|
+
});
|
|
756
|
+
lastResponse = consentRes;
|
|
757
|
+
this.mergeSetCookies(consentRes, cookies);
|
|
758
|
+
location = consentRes.headers.get("location");
|
|
759
|
+
if (!location || consentRes.status < 300 || consentRes.status >= 400) {
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
} else {
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
} else if (!location || res.status < 300 || res.status >= 400) {
|
|
711
766
|
break;
|
|
712
767
|
}
|
|
713
768
|
if (stripSelectAccount && location.includes("oauth.zaloapp.com") && location.includes("select_account=true")) {
|
|
@@ -718,6 +773,7 @@ var ZaloAuthManager = class {
|
|
|
718
773
|
}
|
|
719
774
|
currentUrl = location.startsWith("http") ? location : new URL(location, currentUrl).toString();
|
|
720
775
|
}
|
|
776
|
+
return lastResponse;
|
|
721
777
|
}
|
|
722
778
|
mergeSetCookies(res, target) {
|
|
723
779
|
const headersWithSetCookie = res.headers;
|
|
@@ -768,6 +824,7 @@ var DEFAULT_BASE_URLS = {
|
|
|
768
824
|
ads: "https://ads.zalo.me",
|
|
769
825
|
forms: "https://form.ads.zalo.me",
|
|
770
826
|
instantPages: "https://page.ads.zalo.me",
|
|
827
|
+
profileAds: "https://profile.ads.zalo.me",
|
|
771
828
|
widget: "https://api.widget.zalo.me",
|
|
772
829
|
chatWidget: "https://widget.chat.zalo.me"
|
|
773
830
|
};
|
|
@@ -913,9 +970,16 @@ var ZaloSdkHttpClient = class {
|
|
|
913
970
|
}
|
|
914
971
|
async resolveFile(input) {
|
|
915
972
|
if (typeof input === "string") {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
973
|
+
if (/^(https?:|data:)/i.test(input)) {
|
|
974
|
+
const response = await this.fetchImpl(input);
|
|
975
|
+
if (!response.ok) throw new Error(`Cannot download upload file URL: HTTP ${response.status}.`);
|
|
976
|
+
return response.blob();
|
|
977
|
+
}
|
|
978
|
+
const fs = await import("fs/promises");
|
|
979
|
+
const bytes2 = await fs.readFile(input);
|
|
980
|
+
const copy = new Uint8Array(bytes2.byteLength);
|
|
981
|
+
copy.set(bytes2);
|
|
982
|
+
return new Blob([copy.buffer], { type: inferMimeType(input) });
|
|
919
983
|
}
|
|
920
984
|
if (input instanceof Blob) return input;
|
|
921
985
|
if (input instanceof ArrayBuffer) return new Blob([input]);
|
|
@@ -937,14 +1001,36 @@ function appendQuery(params, key, value) {
|
|
|
937
1001
|
}
|
|
938
1002
|
function fileNameFrom(value) {
|
|
939
1003
|
if (typeof value === "string") {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1004
|
+
if (/^https?:/i.test(value)) {
|
|
1005
|
+
try {
|
|
1006
|
+
return new URL(value).pathname.split("/").pop() || "upload";
|
|
1007
|
+
} catch {
|
|
1008
|
+
return "upload";
|
|
1009
|
+
}
|
|
944
1010
|
}
|
|
1011
|
+
const base = value.split(/[\\/]/).pop();
|
|
1012
|
+
return base || "upload";
|
|
1013
|
+
}
|
|
1014
|
+
if (value && typeof value === "object" && "name" in value && typeof value.name === "string") {
|
|
1015
|
+
return value.name;
|
|
1016
|
+
}
|
|
1017
|
+
if (value instanceof Blob && value.type) {
|
|
1018
|
+
const ext = value.type.split("/")[1]?.replace("jpeg", "jpg");
|
|
1019
|
+
if (ext) return `upload.${ext}`;
|
|
945
1020
|
}
|
|
946
1021
|
return "upload";
|
|
947
1022
|
}
|
|
1023
|
+
function inferMimeType(filePath) {
|
|
1024
|
+
const lower = filePath.toLowerCase();
|
|
1025
|
+
if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "image/jpeg";
|
|
1026
|
+
if (lower.endsWith(".png")) return "image/png";
|
|
1027
|
+
if (lower.endsWith(".gif")) return "image/gif";
|
|
1028
|
+
if (lower.endsWith(".webp")) return "image/webp";
|
|
1029
|
+
if (lower.endsWith(".mp4")) return "video/mp4";
|
|
1030
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
1031
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
1032
|
+
return "application/octet-stream";
|
|
1033
|
+
}
|
|
948
1034
|
async function resolveHeaders(auth, context) {
|
|
949
1035
|
return { ...auth?.headers ?? {}, ...await auth?.getHeaders?.(context) ?? {} };
|
|
950
1036
|
}
|
|
@@ -977,6 +1063,18 @@ var OP_ZaloAdsCreateFlow = {
|
|
|
977
1063
|
cookieFields: [],
|
|
978
1064
|
bodyFields: ["oaId", "id", "name", "messages"]
|
|
979
1065
|
};
|
|
1066
|
+
var OP_ZaloAdsUpdateFlow = {
|
|
1067
|
+
operationId: "ZaloAds_updateFlow",
|
|
1068
|
+
method: "POST",
|
|
1069
|
+
endpoint: "/api/flow/update",
|
|
1070
|
+
baseUrl: "https://ads.zalo.me",
|
|
1071
|
+
binaryFields: [],
|
|
1072
|
+
pathFields: [],
|
|
1073
|
+
queryFields: [],
|
|
1074
|
+
headerFields: [],
|
|
1075
|
+
cookieFields: [],
|
|
1076
|
+
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1077
|
+
};
|
|
980
1078
|
var OP_ZaloAdsUpdateVideoAd = {
|
|
981
1079
|
operationId: "ZaloAds_updateVideoAd",
|
|
982
1080
|
method: "POST",
|
|
@@ -1104,6 +1202,26 @@ var OP_ZaloAdsCreatePostCampaign = {
|
|
|
1104
1202
|
"data"
|
|
1105
1203
|
]
|
|
1106
1204
|
};
|
|
1205
|
+
var OP_ZaloAdsCreateConversion = {
|
|
1206
|
+
"operationId": "ZaloAds_createConversion",
|
|
1207
|
+
"method": "POST",
|
|
1208
|
+
"endpoint": "/api/conversion/add",
|
|
1209
|
+
"baseUrl": "https://ads.zalo.me",
|
|
1210
|
+
"binaryFields": [],
|
|
1211
|
+
"pathFields": [],
|
|
1212
|
+
"queryFields": [],
|
|
1213
|
+
"headerFields": [],
|
|
1214
|
+
"cookieFields": [],
|
|
1215
|
+
"bodyFields": [
|
|
1216
|
+
"name",
|
|
1217
|
+
"landingPage",
|
|
1218
|
+
"urlType",
|
|
1219
|
+
"labelId",
|
|
1220
|
+
"buttonIds",
|
|
1221
|
+
"elements",
|
|
1222
|
+
"keywords"
|
|
1223
|
+
]
|
|
1224
|
+
};
|
|
1107
1225
|
var OP_ZaloAdsDeleteConversion = {
|
|
1108
1226
|
"operationId": "ZaloAds_deleteConversion",
|
|
1109
1227
|
"method": "DELETE",
|
|
@@ -1139,7 +1257,9 @@ var OP_ZaloAdsGetAdById = {
|
|
|
1139
1257
|
"baseUrl": "https://ads.zalo.me",
|
|
1140
1258
|
"binaryFields": [],
|
|
1141
1259
|
"pathFields": [],
|
|
1142
|
-
"queryFields": [
|
|
1260
|
+
"queryFields": [
|
|
1261
|
+
"adId"
|
|
1262
|
+
],
|
|
1143
1263
|
"headerFields": [],
|
|
1144
1264
|
"cookieFields": [],
|
|
1145
1265
|
"bodyFields": []
|
|
@@ -1179,7 +1299,9 @@ var OP_ZaloAdsGetApiBaAccountAllaccessors = {
|
|
|
1179
1299
|
"baseUrl": "https://ads.zalo.me",
|
|
1180
1300
|
"binaryFields": [],
|
|
1181
1301
|
"pathFields": [],
|
|
1182
|
-
"queryFields": [
|
|
1302
|
+
"queryFields": [
|
|
1303
|
+
"isShowAll"
|
|
1304
|
+
],
|
|
1183
1305
|
"headerFields": [],
|
|
1184
1306
|
"cookieFields": [],
|
|
1185
1307
|
"bodyFields": []
|
|
@@ -1332,7 +1454,9 @@ var OP_ZaloAdsGetApiSpellCheckV2 = {
|
|
|
1332
1454
|
"baseUrl": "https://ads.zalo.me",
|
|
1333
1455
|
"binaryFields": [],
|
|
1334
1456
|
"pathFields": [],
|
|
1335
|
-
"queryFields": [
|
|
1457
|
+
"queryFields": [
|
|
1458
|
+
"text"
|
|
1459
|
+
],
|
|
1336
1460
|
"headerFields": [],
|
|
1337
1461
|
"cookieFields": [],
|
|
1338
1462
|
"bodyFields": []
|
|
@@ -1375,8 +1499,14 @@ var OP_ZaloAdsGetReportapiV2Campaigns = {
|
|
|
1375
1499
|
"endpoint": "/reportapi/v2/campaigns/{campaignId}",
|
|
1376
1500
|
"baseUrl": "https://ads.zalo.me",
|
|
1377
1501
|
"binaryFields": [],
|
|
1378
|
-
"pathFields": [
|
|
1379
|
-
|
|
1502
|
+
"pathFields": [
|
|
1503
|
+
"campaignId"
|
|
1504
|
+
],
|
|
1505
|
+
"queryFields": [
|
|
1506
|
+
"startDate",
|
|
1507
|
+
"endDate",
|
|
1508
|
+
"refresh"
|
|
1509
|
+
],
|
|
1380
1510
|
"headerFields": [],
|
|
1381
1511
|
"cookieFields": [],
|
|
1382
1512
|
"bodyFields": []
|
|
@@ -1401,8 +1531,11 @@ var OP_ZaloAdsGetReportapiV3Campaigns = {
|
|
|
1401
1531
|
"binaryFields": [],
|
|
1402
1532
|
"pathFields": [],
|
|
1403
1533
|
"queryFields": [
|
|
1534
|
+
"filter",
|
|
1404
1535
|
"endDate",
|
|
1405
1536
|
"refresh",
|
|
1537
|
+
"agencyId",
|
|
1538
|
+
"createdBy",
|
|
1406
1539
|
"startDate"
|
|
1407
1540
|
],
|
|
1408
1541
|
"headerFields": [],
|
|
@@ -1416,7 +1549,10 @@ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
|
1416
1549
|
"baseUrl": "https://ads.zalo.me",
|
|
1417
1550
|
"binaryFields": [],
|
|
1418
1551
|
"pathFields": [],
|
|
1419
|
-
"queryFields": [
|
|
1552
|
+
"queryFields": [
|
|
1553
|
+
"campaignId",
|
|
1554
|
+
"campId"
|
|
1555
|
+
],
|
|
1420
1556
|
"headerFields": [],
|
|
1421
1557
|
"cookieFields": [],
|
|
1422
1558
|
"bodyFields": []
|
|
@@ -1428,7 +1564,10 @@ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
|
1428
1564
|
"baseUrl": "https://ads.zalo.me",
|
|
1429
1565
|
"binaryFields": [],
|
|
1430
1566
|
"pathFields": [],
|
|
1431
|
-
"queryFields": [
|
|
1567
|
+
"queryFields": [
|
|
1568
|
+
"campaignId",
|
|
1569
|
+
"campId"
|
|
1570
|
+
],
|
|
1432
1571
|
"headerFields": [],
|
|
1433
1572
|
"cookieFields": [],
|
|
1434
1573
|
"bodyFields": []
|
|
@@ -1440,7 +1579,10 @@ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
|
|
|
1440
1579
|
"baseUrl": "https://ads.zalo.me",
|
|
1441
1580
|
"binaryFields": [],
|
|
1442
1581
|
"pathFields": [],
|
|
1443
|
-
"queryFields": [
|
|
1582
|
+
"queryFields": [
|
|
1583
|
+
"campaignId",
|
|
1584
|
+
"campId"
|
|
1585
|
+
],
|
|
1444
1586
|
"headerFields": [],
|
|
1445
1587
|
"cookieFields": [],
|
|
1446
1588
|
"bodyFields": []
|
|
@@ -1464,7 +1606,9 @@ var OP_ZaloAdsGetZaapiGetownedarticles = {
|
|
|
1464
1606
|
"baseUrl": "https://ads.zalo.me",
|
|
1465
1607
|
"binaryFields": [],
|
|
1466
1608
|
"pathFields": [],
|
|
1467
|
-
"queryFields": [
|
|
1609
|
+
"queryFields": [
|
|
1610
|
+
"pageId"
|
|
1611
|
+
],
|
|
1468
1612
|
"headerFields": [],
|
|
1469
1613
|
"cookieFields": [],
|
|
1470
1614
|
"bodyFields": []
|
|
@@ -1592,14 +1736,14 @@ var OP_ZaloAdsPostApiMemberUploadImage = {
|
|
|
1592
1736
|
"endpoint": "/api/member/upload-image",
|
|
1593
1737
|
"baseUrl": "https://ads.zalo.me",
|
|
1594
1738
|
"binaryFields": [
|
|
1595
|
-
"
|
|
1739
|
+
"File"
|
|
1596
1740
|
],
|
|
1597
1741
|
"pathFields": [],
|
|
1598
1742
|
"queryFields": [],
|
|
1599
1743
|
"headerFields": [],
|
|
1600
1744
|
"cookieFields": [],
|
|
1601
1745
|
"bodyFields": [
|
|
1602
|
-
"
|
|
1746
|
+
"File"
|
|
1603
1747
|
]
|
|
1604
1748
|
};
|
|
1605
1749
|
var OP_ZaloAdsPostZaapiDeletead = {
|
|
@@ -1609,10 +1753,14 @@ var OP_ZaloAdsPostZaapiDeletead = {
|
|
|
1609
1753
|
"baseUrl": "https://ads.zalo.me",
|
|
1610
1754
|
"binaryFields": [],
|
|
1611
1755
|
"pathFields": [],
|
|
1612
|
-
"queryFields": [
|
|
1756
|
+
"queryFields": [
|
|
1757
|
+
"adId"
|
|
1758
|
+
],
|
|
1613
1759
|
"headerFields": [],
|
|
1614
1760
|
"cookieFields": [],
|
|
1615
|
-
"bodyFields": [
|
|
1761
|
+
"bodyFields": [
|
|
1762
|
+
"adId"
|
|
1763
|
+
]
|
|
1616
1764
|
};
|
|
1617
1765
|
var OP_ZaloAdsRenameCampaign = {
|
|
1618
1766
|
"operationId": "ZaloAds_renameCampaign",
|
|
@@ -1685,12 +1833,21 @@ var OP_ZaloAdsUpdateNewAds = {
|
|
|
1685
1833
|
"method": "POST",
|
|
1686
1834
|
"endpoint": "/zaapi/UploadCrop",
|
|
1687
1835
|
"baseUrl": "https://ads.zalo.me",
|
|
1688
|
-
"binaryFields": [
|
|
1836
|
+
"binaryFields": [
|
|
1837
|
+
"File"
|
|
1838
|
+
],
|
|
1689
1839
|
"pathFields": [],
|
|
1690
1840
|
"queryFields": [],
|
|
1691
1841
|
"headerFields": [],
|
|
1692
1842
|
"cookieFields": [],
|
|
1693
|
-
"bodyFields": [
|
|
1843
|
+
"bodyFields": [
|
|
1844
|
+
"File",
|
|
1845
|
+
"x",
|
|
1846
|
+
"y",
|
|
1847
|
+
"width",
|
|
1848
|
+
"height",
|
|
1849
|
+
"scale"
|
|
1850
|
+
]
|
|
1694
1851
|
};
|
|
1695
1852
|
var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
1696
1853
|
"operationId": "ZaloAds_updateOfficialAccountAd",
|
|
@@ -1842,10 +1999,13 @@ var OP_ZaloAdsCreateAutomatedRule = {
|
|
|
1842
1999
|
"headerFields": [],
|
|
1843
2000
|
"cookieFields": [],
|
|
1844
2001
|
"bodyFields": [
|
|
2002
|
+
"scope",
|
|
1845
2003
|
"appliedTo",
|
|
1846
2004
|
"ruleName",
|
|
1847
2005
|
"action",
|
|
1848
2006
|
"conditions",
|
|
2007
|
+
"frequency",
|
|
2008
|
+
"appliedIds",
|
|
1849
2009
|
"schedule",
|
|
1850
2010
|
"campaignIds",
|
|
1851
2011
|
"adIds"
|
|
@@ -1876,7 +2036,7 @@ var OP_ZaloAdsUpdateAutomatedRule = {
|
|
|
1876
2036
|
var OP_ZaloAdsChangeAutomatedRuleStatus = {
|
|
1877
2037
|
"operationId": "ZaloAds_changeAutomatedRuleStatus",
|
|
1878
2038
|
"method": "POST",
|
|
1879
|
-
"endpoint": "/api/automatedrules/status",
|
|
2039
|
+
"endpoint": "/api/automatedrules/change-status",
|
|
1880
2040
|
"baseUrl": "https://ads.zalo.me",
|
|
1881
2041
|
"binaryFields": [],
|
|
1882
2042
|
"pathFields": [],
|
|
@@ -1884,10 +2044,25 @@ var OP_ZaloAdsChangeAutomatedRuleStatus = {
|
|
|
1884
2044
|
"headerFields": [],
|
|
1885
2045
|
"cookieFields": [],
|
|
1886
2046
|
"bodyFields": [
|
|
2047
|
+
"automatedRuleId",
|
|
1887
2048
|
"automatedRuleIds",
|
|
1888
2049
|
"status"
|
|
1889
2050
|
]
|
|
1890
2051
|
};
|
|
2052
|
+
var OP_ZaloAdsGetAutomatedRuleHistory = {
|
|
2053
|
+
"operationId": "ZaloAds_getAutomatedRuleHistory",
|
|
2054
|
+
"method": "GET",
|
|
2055
|
+
"endpoint": "/api/automatedrules/history/{automatedRuleId}",
|
|
2056
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2057
|
+
"binaryFields": [],
|
|
2058
|
+
"pathFields": [
|
|
2059
|
+
"automatedRuleId"
|
|
2060
|
+
],
|
|
2061
|
+
"queryFields": [],
|
|
2062
|
+
"headerFields": [],
|
|
2063
|
+
"cookieFields": [],
|
|
2064
|
+
"bodyFields": []
|
|
2065
|
+
};
|
|
1891
2066
|
var OP_ZaloAdsDeleteAutomatedRule = {
|
|
1892
2067
|
"operationId": "ZaloAds_deleteAutomatedRule",
|
|
1893
2068
|
"method": "POST",
|
|
@@ -1962,6 +2137,9 @@ var ZaloAdsService = class {
|
|
|
1962
2137
|
createFlow(request, options) {
|
|
1963
2138
|
return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
|
|
1964
2139
|
}
|
|
2140
|
+
updateFlow(request, options) {
|
|
2141
|
+
return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
|
|
2142
|
+
}
|
|
1965
2143
|
listFlowsByOfficialAccount(request, options) {
|
|
1966
2144
|
return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
|
|
1967
2145
|
}
|
|
@@ -1993,6 +2171,10 @@ var ZaloAdsService = class {
|
|
|
1993
2171
|
createEcommerceCampaign(request, options) {
|
|
1994
2172
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
|
|
1995
2173
|
}
|
|
2174
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
|
|
2175
|
+
createCommerceCampaign(request, options) {
|
|
2176
|
+
return this.createEcommerceCampaign(request, options);
|
|
2177
|
+
}
|
|
1996
2178
|
createForm(request, options) {
|
|
1997
2179
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
|
|
1998
2180
|
}
|
|
@@ -2005,9 +2187,17 @@ var ZaloAdsService = class {
|
|
|
2005
2187
|
createOfficialAccountCampaign(request, options) {
|
|
2006
2188
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
|
|
2007
2189
|
}
|
|
2190
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
|
|
2191
|
+
createOaCampaign(request, options) {
|
|
2192
|
+
return this.createOfficialAccountCampaign(request, options);
|
|
2193
|
+
}
|
|
2008
2194
|
createPostCampaign(request, options) {
|
|
2009
2195
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
|
|
2010
2196
|
}
|
|
2197
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
|
|
2198
|
+
createArticleCampaign(request, options) {
|
|
2199
|
+
return this.createPostCampaign(request, options);
|
|
2200
|
+
}
|
|
2011
2201
|
listAutomatedRules(request = {}, options) {
|
|
2012
2202
|
const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
|
|
2013
2203
|
return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
|
|
@@ -2021,16 +2211,22 @@ var ZaloAdsService = class {
|
|
|
2021
2211
|
changeAutomatedRuleStatus(request, options) {
|
|
2022
2212
|
return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
|
|
2023
2213
|
}
|
|
2214
|
+
getAutomatedRuleHistory(request, options) {
|
|
2215
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
|
|
2216
|
+
}
|
|
2024
2217
|
deleteAutomatedRule(request, options) {
|
|
2025
2218
|
return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
|
|
2026
2219
|
}
|
|
2220
|
+
createConversion(request, options) {
|
|
2221
|
+
return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
|
|
2222
|
+
}
|
|
2027
2223
|
deleteConversion(request, options) {
|
|
2028
2224
|
return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
|
|
2029
2225
|
}
|
|
2030
2226
|
deleteCustomAudience(request, options) {
|
|
2031
2227
|
return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
|
|
2032
2228
|
}
|
|
2033
|
-
getAdById(request, options) {
|
|
2229
|
+
getAdById(request = {}, options) {
|
|
2034
2230
|
return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
|
|
2035
2231
|
}
|
|
2036
2232
|
getAdChangeLog(request, options) {
|
|
@@ -2045,28 +2241,28 @@ var ZaloAdsService = class {
|
|
|
2045
2241
|
getApiBaAccountAllgrantedmembers(request = {}, options) {
|
|
2046
2242
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
|
|
2047
2243
|
}
|
|
2048
|
-
getApiConversionAll(request, options) {
|
|
2244
|
+
getApiConversionAll(request = {}, options) {
|
|
2049
2245
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
|
|
2050
2246
|
}
|
|
2051
2247
|
getApiConversionStandardEvents(request = {}, options) {
|
|
2052
2248
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
|
|
2053
2249
|
}
|
|
2054
|
-
getApiCustomAudienceAll(request, options) {
|
|
2250
|
+
getApiCustomAudienceAll(request = {}, options) {
|
|
2055
2251
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
|
|
2056
2252
|
}
|
|
2057
2253
|
getApiFilegroups(request = {}, options) {
|
|
2058
2254
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiFilegroups, this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request), options);
|
|
2059
2255
|
}
|
|
2060
|
-
getApiLpNews(request, options) {
|
|
2256
|
+
getApiLpNews(request = {}, options) {
|
|
2061
2257
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
|
|
2062
2258
|
}
|
|
2063
2259
|
getApiMediaItems(request, options) {
|
|
2064
2260
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiMediaItems, this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request), options);
|
|
2065
2261
|
}
|
|
2066
|
-
getApiMemberFiles(request, options) {
|
|
2262
|
+
getApiMemberFiles(request = {}, options) {
|
|
2067
2263
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiMemberFiles, this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request), options);
|
|
2068
2264
|
}
|
|
2069
|
-
getApiNotifiesHeader(request, options) {
|
|
2265
|
+
getApiNotifiesHeader(request = {}, options) {
|
|
2070
2266
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
|
|
2071
2267
|
}
|
|
2072
2268
|
getApiPaymentTransactionHistory(request, options) {
|
|
@@ -2084,35 +2280,55 @@ var ZaloAdsService = class {
|
|
|
2084
2280
|
getReportapiV2Ads(request, options) {
|
|
2085
2281
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
|
|
2086
2282
|
}
|
|
2087
|
-
getReportapiV2Campaigns(request, options) {
|
|
2283
|
+
getReportapiV2Campaigns(request = {}, options) {
|
|
2088
2284
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
|
|
2089
2285
|
}
|
|
2090
|
-
getReportapiV2UniqueUser(request, options) {
|
|
2286
|
+
getReportapiV2UniqueUser(request = {}, options) {
|
|
2091
2287
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
|
|
2092
2288
|
}
|
|
2093
2289
|
getReportapiV3Campaigns(request, options) {
|
|
2094
|
-
|
|
2290
|
+
const normalized = {
|
|
2291
|
+
filter: "[]",
|
|
2292
|
+
agencyId: 0,
|
|
2293
|
+
...request
|
|
2294
|
+
};
|
|
2295
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
|
|
2095
2296
|
}
|
|
2096
|
-
getZaapiCampaignReportcampaign(request, options) {
|
|
2297
|
+
getZaapiCampaignReportcampaign(request = {}, options) {
|
|
2097
2298
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
|
|
2098
2299
|
}
|
|
2099
|
-
getZaapiCheckcamphasmanyads(request, options) {
|
|
2300
|
+
getZaapiCheckcamphasmanyads(request = {}, options) {
|
|
2100
2301
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
|
|
2101
2302
|
}
|
|
2102
|
-
getZaapiGetadsfromcampaignid(request, options) {
|
|
2303
|
+
getZaapiGetadsfromcampaignid(request = {}, options) {
|
|
2103
2304
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
|
|
2104
2305
|
}
|
|
2105
2306
|
getZaapiGetallpages(request = {}, options) {
|
|
2106
2307
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
|
|
2107
2308
|
}
|
|
2108
|
-
|
|
2309
|
+
getAllPages(request = {}, options) {
|
|
2310
|
+
return this.getZaapiGetallpages(request, options);
|
|
2311
|
+
}
|
|
2312
|
+
getZaapiGetownedarticles(request, options) {
|
|
2109
2313
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
|
|
2110
2314
|
}
|
|
2315
|
+
getOwnedArticles(request, options) {
|
|
2316
|
+
return this.getZaapiGetownedarticles(request, options);
|
|
2317
|
+
}
|
|
2111
2318
|
getZaapiGetownedpages(request = {}, options) {
|
|
2112
2319
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
|
|
2113
2320
|
}
|
|
2114
|
-
|
|
2115
|
-
return this.
|
|
2321
|
+
getOwnedPages(request = {}, options) {
|
|
2322
|
+
return this.getZaapiGetownedpages(request, options);
|
|
2323
|
+
}
|
|
2324
|
+
listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
|
|
2325
|
+
const normalized = {
|
|
2326
|
+
limit: 15,
|
|
2327
|
+
offset: 0,
|
|
2328
|
+
joinDateAsc: true,
|
|
2329
|
+
...request
|
|
2330
|
+
};
|
|
2331
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
|
|
2116
2332
|
}
|
|
2117
2333
|
listCustomReports(request = {}, options) {
|
|
2118
2334
|
return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
|
|
@@ -2133,9 +2349,17 @@ var ZaloAdsService = class {
|
|
|
2133
2349
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsPostApiMediaSave, this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, request), options);
|
|
2134
2350
|
}
|
|
2135
2351
|
postApiMemberUploadImage(request, options) {
|
|
2136
|
-
|
|
2352
|
+
const normalized = {
|
|
2353
|
+
...request,
|
|
2354
|
+
File: request.File ?? request.file
|
|
2355
|
+
};
|
|
2356
|
+
return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized), options);
|
|
2357
|
+
}
|
|
2358
|
+
/** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
|
|
2359
|
+
uploadImage(request, options) {
|
|
2360
|
+
return this.postApiMemberUploadImage(request, options);
|
|
2137
2361
|
}
|
|
2138
|
-
postZaapiDeletead(request, options) {
|
|
2362
|
+
postZaapiDeletead(request = {}, options) {
|
|
2139
2363
|
return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
|
|
2140
2364
|
}
|
|
2141
2365
|
renameCampaign(request, options) {
|
|
@@ -2144,6 +2368,10 @@ var ZaloAdsService = class {
|
|
|
2144
2368
|
updateEcommerceAd(request, options) {
|
|
2145
2369
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
|
|
2146
2370
|
}
|
|
2371
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
|
|
2372
|
+
updateCommerceAd(request, options) {
|
|
2373
|
+
return this.updateEcommerceAd(request, options);
|
|
2374
|
+
}
|
|
2147
2375
|
updateFormAd(request, options) {
|
|
2148
2376
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
|
|
2149
2377
|
}
|
|
@@ -2151,14 +2379,22 @@ var ZaloAdsService = class {
|
|
|
2151
2379
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
|
|
2152
2380
|
}
|
|
2153
2381
|
updateNewAds(request, options) {
|
|
2154
|
-
return this.client.
|
|
2382
|
+
return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
|
|
2155
2383
|
}
|
|
2156
2384
|
updateOfficialAccountAd(request, options) {
|
|
2157
2385
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
|
|
2158
2386
|
}
|
|
2387
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
|
|
2388
|
+
updateOaAd(request, options) {
|
|
2389
|
+
return this.updateOfficialAccountAd(request, options);
|
|
2390
|
+
}
|
|
2159
2391
|
updatePostAd(request, options) {
|
|
2160
2392
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
|
|
2161
2393
|
}
|
|
2394
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
|
|
2395
|
+
updateArticleAd(request, options) {
|
|
2396
|
+
return this.updatePostAd(request, options);
|
|
2397
|
+
}
|
|
2162
2398
|
uploadCustomAudiencePhoneList(request, options) {
|
|
2163
2399
|
return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
|
|
2164
2400
|
}
|
|
@@ -2192,6 +2428,10 @@ var ZaloChatWidgetService = class {
|
|
|
2192
2428
|
getChatWidgetLoginConfig(request, options) {
|
|
2193
2429
|
return this.client.requestWithoutBody(OP_ZaloChatWidgetGetChatWidgetLoginConfig, this.client.toTransportInput(OP_ZaloChatWidgetGetChatWidgetLoginConfig, request), options);
|
|
2194
2430
|
}
|
|
2431
|
+
/** Alias theo tên tool chuẩn `zalo_chat_widget_get_login_config` trong Project Schema Zalo ADS. */
|
|
2432
|
+
getLoginConfig(request, options) {
|
|
2433
|
+
return this.getChatWidgetLoginConfig(request, options);
|
|
2434
|
+
}
|
|
2195
2435
|
};
|
|
2196
2436
|
|
|
2197
2437
|
// src/services/forms.service.ts
|
|
@@ -2574,6 +2814,26 @@ var OP_ZaloInstantPagesListOfficialAccounts = {
|
|
|
2574
2814
|
"cookieFields": [],
|
|
2575
2815
|
"bodyFields": []
|
|
2576
2816
|
};
|
|
2817
|
+
var OP_ZaloInstantPagesUpsertInstantPageForm = {
|
|
2818
|
+
"operationId": "ZaloInstantPages_upsertInstantPageForm",
|
|
2819
|
+
"method": "PUT",
|
|
2820
|
+
"endpoint": "/api/instant-pages/{instantPageId}/form",
|
|
2821
|
+
"baseUrl": "https://page.ads.zalo.me",
|
|
2822
|
+
"binaryFields": [],
|
|
2823
|
+
"pathFields": [
|
|
2824
|
+
"instantPageId"
|
|
2825
|
+
],
|
|
2826
|
+
"queryFields": [],
|
|
2827
|
+
"headerFields": [],
|
|
2828
|
+
"cookieFields": [],
|
|
2829
|
+
"bodyFields": [
|
|
2830
|
+
"oaId",
|
|
2831
|
+
"formName",
|
|
2832
|
+
"questions",
|
|
2833
|
+
"useCustomConsent",
|
|
2834
|
+
"consentConfig"
|
|
2835
|
+
]
|
|
2836
|
+
};
|
|
2577
2837
|
var ZaloInstantPagesService = class {
|
|
2578
2838
|
constructor(client) {
|
|
2579
2839
|
this.client = client;
|
|
@@ -2614,6 +2874,171 @@ var ZaloInstantPagesService = class {
|
|
|
2614
2874
|
listOfficialAccounts(request = {}, options) {
|
|
2615
2875
|
return this.client.requestWithoutBody(OP_ZaloInstantPagesListOfficialAccounts, this.client.toTransportInput(OP_ZaloInstantPagesListOfficialAccounts, request), options);
|
|
2616
2876
|
}
|
|
2877
|
+
upsertInstantPageForm(request, options) {
|
|
2878
|
+
return this.client.requestJson(OP_ZaloInstantPagesUpsertInstantPageForm, this.client.toTransportInput(OP_ZaloInstantPagesUpsertInstantPageForm, request), options);
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
// src/services/profile-ads.service.ts
|
|
2883
|
+
var OP_ZaloProfileAdsCreateOaPage = {
|
|
2884
|
+
"operationId": "ZaloProfileAds_createOaPage",
|
|
2885
|
+
"method": "POST",
|
|
2886
|
+
"endpoint": "/oa",
|
|
2887
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2888
|
+
"binaryFields": [],
|
|
2889
|
+
"pathFields": [],
|
|
2890
|
+
"queryFields": [
|
|
2891
|
+
"option",
|
|
2892
|
+
"crsf-token"
|
|
2893
|
+
],
|
|
2894
|
+
"headerFields": [],
|
|
2895
|
+
"cookieFields": [],
|
|
2896
|
+
"bodyFields": [
|
|
2897
|
+
"typeId",
|
|
2898
|
+
"tier",
|
|
2899
|
+
"typeName",
|
|
2900
|
+
"categoryId",
|
|
2901
|
+
"subCategoryId",
|
|
2902
|
+
"oaName",
|
|
2903
|
+
"description",
|
|
2904
|
+
"contactName",
|
|
2905
|
+
"contactPhone",
|
|
2906
|
+
"coverId",
|
|
2907
|
+
"avatarId",
|
|
2908
|
+
"province",
|
|
2909
|
+
"district",
|
|
2910
|
+
"address",
|
|
2911
|
+
"agreeTerm"
|
|
2912
|
+
]
|
|
2913
|
+
};
|
|
2914
|
+
var OP_ZaloProfileAdsUploadOaAvatar = {
|
|
2915
|
+
"operationId": "ZaloProfileAds_uploadOaAvatar",
|
|
2916
|
+
"method": "POST",
|
|
2917
|
+
"endpoint": "/ajax/avatar/upload",
|
|
2918
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2919
|
+
"binaryFields": [
|
|
2920
|
+
"avatar-file"
|
|
2921
|
+
],
|
|
2922
|
+
"pathFields": [],
|
|
2923
|
+
"queryFields": [
|
|
2924
|
+
"option"
|
|
2925
|
+
],
|
|
2926
|
+
"headerFields": [],
|
|
2927
|
+
"cookieFields": [],
|
|
2928
|
+
"bodyFields": [
|
|
2929
|
+
"avatar-file",
|
|
2930
|
+
"is-new"
|
|
2931
|
+
]
|
|
2932
|
+
};
|
|
2933
|
+
var OP_ZaloProfileAdsUploadOaCover = {
|
|
2934
|
+
"operationId": "ZaloProfileAds_uploadOaCover",
|
|
2935
|
+
"method": "POST",
|
|
2936
|
+
"endpoint": "/ajax/cover/upload",
|
|
2937
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2938
|
+
"binaryFields": [
|
|
2939
|
+
"cover-file"
|
|
2940
|
+
],
|
|
2941
|
+
"pathFields": [],
|
|
2942
|
+
"queryFields": [
|
|
2943
|
+
"option"
|
|
2944
|
+
],
|
|
2945
|
+
"headerFields": [],
|
|
2946
|
+
"cookieFields": [],
|
|
2947
|
+
"bodyFields": [
|
|
2948
|
+
"cover-file",
|
|
2949
|
+
"is-new"
|
|
2950
|
+
]
|
|
2951
|
+
};
|
|
2952
|
+
var OP_ZaloProfileAdsGetProvinces = {
|
|
2953
|
+
"operationId": "ZaloProfileAds_getProvinces",
|
|
2954
|
+
"method": "GET",
|
|
2955
|
+
"endpoint": "/ajax/get-province",
|
|
2956
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2957
|
+
"binaryFields": [],
|
|
2958
|
+
"pathFields": [],
|
|
2959
|
+
"queryFields": [],
|
|
2960
|
+
"headerFields": [],
|
|
2961
|
+
"cookieFields": [],
|
|
2962
|
+
"bodyFields": []
|
|
2963
|
+
};
|
|
2964
|
+
var OP_ZaloProfileAdsGetDistricts = {
|
|
2965
|
+
"operationId": "ZaloProfileAds_getDistricts",
|
|
2966
|
+
"method": "GET",
|
|
2967
|
+
"endpoint": "/ajax/get-district",
|
|
2968
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2969
|
+
"binaryFields": [],
|
|
2970
|
+
"pathFields": [],
|
|
2971
|
+
"queryFields": [
|
|
2972
|
+
"provinceId"
|
|
2973
|
+
],
|
|
2974
|
+
"headerFields": [],
|
|
2975
|
+
"cookieFields": [],
|
|
2976
|
+
"bodyFields": []
|
|
2977
|
+
};
|
|
2978
|
+
var ZaloProfileAdsService = class {
|
|
2979
|
+
constructor(client) {
|
|
2980
|
+
this.client = client;
|
|
2981
|
+
}
|
|
2982
|
+
async createOaPage(request, options) {
|
|
2983
|
+
let csrfToken = request["crsf-token"];
|
|
2984
|
+
if (!csrfToken && this.client.authManager) {
|
|
2985
|
+
const session = await this.client.authManager.getSession("profile.ads.zalo.me");
|
|
2986
|
+
csrfToken = session.cookies["CSRF_TOKEN"] ?? session.xsrfToken;
|
|
2987
|
+
}
|
|
2988
|
+
const normalizedRequest = {
|
|
2989
|
+
option: "createpage",
|
|
2990
|
+
typeId: 2,
|
|
2991
|
+
tier: 0,
|
|
2992
|
+
typeName: "store",
|
|
2993
|
+
categoryId: 10003,
|
|
2994
|
+
agreeTerm: true,
|
|
2995
|
+
...request,
|
|
2996
|
+
...csrfToken ? { "crsf-token": csrfToken } : {}
|
|
2997
|
+
};
|
|
2998
|
+
return this.client.requestFormUrlEncoded(
|
|
2999
|
+
OP_ZaloProfileAdsCreateOaPage,
|
|
3000
|
+
this.client.toTransportInput(OP_ZaloProfileAdsCreateOaPage, normalizedRequest),
|
|
3001
|
+
options
|
|
3002
|
+
);
|
|
3003
|
+
}
|
|
3004
|
+
uploadOaAvatar(request, options) {
|
|
3005
|
+
const normalizedRequest = {
|
|
3006
|
+
option: "update",
|
|
3007
|
+
"is-new": "true",
|
|
3008
|
+
...request
|
|
3009
|
+
};
|
|
3010
|
+
return this.client.requestMultipart(
|
|
3011
|
+
OP_ZaloProfileAdsUploadOaAvatar,
|
|
3012
|
+
this.client.toTransportInput(OP_ZaloProfileAdsUploadOaAvatar, normalizedRequest),
|
|
3013
|
+
options
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
uploadOaCover(request, options) {
|
|
3017
|
+
const normalizedRequest = {
|
|
3018
|
+
option: "update",
|
|
3019
|
+
"is-new": "true",
|
|
3020
|
+
...request
|
|
3021
|
+
};
|
|
3022
|
+
return this.client.requestMultipart(
|
|
3023
|
+
OP_ZaloProfileAdsUploadOaCover,
|
|
3024
|
+
this.client.toTransportInput(OP_ZaloProfileAdsUploadOaCover, normalizedRequest),
|
|
3025
|
+
options
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
getProvinces(options) {
|
|
3029
|
+
return this.client.requestWithoutBody(
|
|
3030
|
+
OP_ZaloProfileAdsGetProvinces,
|
|
3031
|
+
{},
|
|
3032
|
+
options
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
getDistricts(request, options) {
|
|
3036
|
+
return this.client.requestWithoutBody(
|
|
3037
|
+
OP_ZaloProfileAdsGetDistricts,
|
|
3038
|
+
this.client.toTransportInput(OP_ZaloProfileAdsGetDistricts, request),
|
|
3039
|
+
options
|
|
3040
|
+
);
|
|
3041
|
+
}
|
|
2617
3042
|
};
|
|
2618
3043
|
|
|
2619
3044
|
// src/services/widget.service.ts
|
|
@@ -2693,6 +3118,8 @@ var ZaloAdsSdk = class {
|
|
|
2693
3118
|
ads;
|
|
2694
3119
|
forms;
|
|
2695
3120
|
instantPages;
|
|
3121
|
+
profileAds;
|
|
3122
|
+
profile;
|
|
2696
3123
|
widget;
|
|
2697
3124
|
chatWidget;
|
|
2698
3125
|
constructor(options = {}) {
|
|
@@ -2701,6 +3128,8 @@ var ZaloAdsSdk = class {
|
|
|
2701
3128
|
this.ads = new ZaloAdsService(this.client);
|
|
2702
3129
|
this.forms = new ZaloFormsService(this.client);
|
|
2703
3130
|
this.instantPages = new ZaloInstantPagesService(this.client);
|
|
3131
|
+
this.profileAds = new ZaloProfileAdsService(this.client);
|
|
3132
|
+
this.profile = this.profileAds;
|
|
2704
3133
|
this.widget = new ZaloWidgetApiService(this.client);
|
|
2705
3134
|
this.chatWidget = new ZaloChatWidgetService(this.client);
|
|
2706
3135
|
}
|
|
@@ -2927,21 +3356,25 @@ var ZaloAdsFlowChildMessageDto = class {
|
|
|
2927
3356
|
text;
|
|
2928
3357
|
};
|
|
2929
3358
|
var ZaloAdsFlowButtonDto = class {
|
|
2930
|
-
/** 3
|
|
3359
|
+
/** 3 = Gửi tin nhắn vào nhánh hội thoại; 10 = Mở website; 12 = Thực hiện cuộc gọi. */
|
|
2931
3360
|
type;
|
|
2932
3361
|
/** Nhãn nút hiển thị cho người dùng. */
|
|
2933
3362
|
text;
|
|
3363
|
+
/** URL website; bắt buộc với type 10. */
|
|
3364
|
+
url;
|
|
3365
|
+
/** Cờ của nút website; dùng true với type 10. */
|
|
3366
|
+
editable;
|
|
2934
3367
|
/** Số hotline, bắt buộc khi type là 12. */
|
|
2935
3368
|
phone;
|
|
2936
|
-
/** Nhánh tin nhắn, bắt buộc khi type là 3. */
|
|
3369
|
+
/** Nhánh tin nhắn, bắt buộc khi type là 3. Với type 10 hoặc 12, để null hoặc bỏ qua. */
|
|
2937
3370
|
messages;
|
|
2938
3371
|
};
|
|
2939
3372
|
var ZaloAdsFlowMessageDto = class {
|
|
2940
|
-
/**
|
|
3373
|
+
/** 1 = Tin nhắn văn bản; 2 = Tin nhắn kèm hình ảnh. */
|
|
2941
3374
|
type;
|
|
2942
|
-
/** Nội dung tin nhắn
|
|
3375
|
+
/** Nội dung tin nhắn, tối đa 1961 ký tự. Hỗ trợ biến: {{user_name}}, {{page_name}}, {{user_gender}}, {{user_id}}, {{page_id}}, {{date}}, {{datetime}}. */
|
|
2943
3376
|
text;
|
|
2944
|
-
/** URL media hoặc null với tin nhắn văn bản thuần. */
|
|
3377
|
+
/** URL media hoặc null với tin nhắn văn bản thuần. Bắt buộc và không được null khi type = 2. */
|
|
2945
3378
|
url;
|
|
2946
3379
|
/** Các nút đi kèm tin nhắn. */
|
|
2947
3380
|
buttons;
|
|
@@ -3043,6 +3476,7 @@ export {
|
|
|
3043
3476
|
ZaloChatWidgetService,
|
|
3044
3477
|
ZaloFormsService,
|
|
3045
3478
|
ZaloInstantPagesService,
|
|
3479
|
+
ZaloProfileAdsService,
|
|
3046
3480
|
ZaloSdkError,
|
|
3047
3481
|
ZaloSdkHttpClient,
|
|
3048
3482
|
ZaloWidgetApiService,
|