@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.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -44,6 +54,7 @@ __export(index_exports, {
|
|
|
44
54
|
ZaloChatWidgetService: () => ZaloChatWidgetService,
|
|
45
55
|
ZaloFormsService: () => ZaloFormsService,
|
|
46
56
|
ZaloInstantPagesService: () => ZaloInstantPagesService,
|
|
57
|
+
ZaloProfileAdsService: () => ZaloProfileAdsService,
|
|
47
58
|
ZaloSdkError: () => ZaloSdkError,
|
|
48
59
|
ZaloSdkHttpClient: () => ZaloSdkHttpClient,
|
|
49
60
|
ZaloWidgetApiService: () => ZaloWidgetApiService,
|
|
@@ -316,7 +327,9 @@ function decodePlaySessionJwt(playSessionCookie) {
|
|
|
316
327
|
const base64Url = parts[1];
|
|
317
328
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
318
329
|
const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
|
|
319
|
-
const
|
|
330
|
+
const binaryStr = globalThis.atob(padded);
|
|
331
|
+
const bytes = Uint8Array.from(binaryStr, (ch) => ch.charCodeAt(0));
|
|
332
|
+
const jsonStr = new TextDecoder("utf-8").decode(bytes);
|
|
320
333
|
return JSON.parse(jsonStr);
|
|
321
334
|
} catch {
|
|
322
335
|
return void 0;
|
|
@@ -714,14 +727,23 @@ var ZaloAuthManager = class {
|
|
|
714
727
|
formProfile = sessionJson.data;
|
|
715
728
|
}
|
|
716
729
|
} else if (domain === "profile.ads.zalo.me") {
|
|
717
|
-
await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
|
|
730
|
+
const profileRes = await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
|
|
731
|
+
if (profileRes) {
|
|
732
|
+
const html = await profileRes.text().catch(() => "");
|
|
733
|
+
const csrfMatch = html.match(/CSRF_TOKEN\s*=\s*['"]([^'"]+)['"]/);
|
|
734
|
+
if (csrfMatch?.[1]) {
|
|
735
|
+
cookies["CSRF_TOKEN"] = csrfMatch[1];
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
headers["Origin"] = "https://profile.ads.zalo.me";
|
|
739
|
+
headers["Referer"] = "https://profile.ads.zalo.me/";
|
|
718
740
|
} else if (domain === "api.widget.zalo.me" || domain === "widget.chat.zalo.me") {
|
|
719
741
|
headers["Origin"] = "https://ads.zalo.me";
|
|
720
742
|
headers["Referer"] = "https://ads.zalo.me/";
|
|
721
743
|
}
|
|
722
|
-
const xsrfToken = cookies["XSRF-TOKEN"];
|
|
723
|
-
if (
|
|
724
|
-
headers["x-xsrf-token"] =
|
|
744
|
+
const xsrfToken = cookies["XSRF-TOKEN"] ?? cookies["CSRF_TOKEN"];
|
|
745
|
+
if (cookies["XSRF-TOKEN"]) {
|
|
746
|
+
headers["x-xsrf-token"] = cookies["XSRF-TOKEN"];
|
|
725
747
|
}
|
|
726
748
|
const bearerToken = formProfile?.token;
|
|
727
749
|
if (bearerToken) {
|
|
@@ -754,7 +776,8 @@ var ZaloAuthManager = class {
|
|
|
754
776
|
}
|
|
755
777
|
async followOAuthRedirects(startUrl, cookies, stripSelectAccount) {
|
|
756
778
|
let currentUrl = startUrl;
|
|
757
|
-
|
|
779
|
+
let lastResponse;
|
|
780
|
+
for (let step = 1; step <= 7; step++) {
|
|
758
781
|
const res = await this.fetchImpl(currentUrl, {
|
|
759
782
|
method: "GET",
|
|
760
783
|
headers: {
|
|
@@ -764,9 +787,52 @@ var ZaloAuthManager = class {
|
|
|
764
787
|
},
|
|
765
788
|
redirect: "manual"
|
|
766
789
|
});
|
|
790
|
+
lastResponse = res;
|
|
767
791
|
this.mergeSetCookies(res, cookies);
|
|
768
792
|
let location = res.headers.get("location");
|
|
769
|
-
if (!location
|
|
793
|
+
if (!location && res.status === 200 && currentUrl.includes("oauth.zaloapp.com/v4/permission")) {
|
|
794
|
+
const html = await res.text().catch(() => "");
|
|
795
|
+
const csrfMatch = html.match(/name="csrf_token"[^>]*value="([^"]+)"/);
|
|
796
|
+
if (csrfMatch && html.includes("zid_consent_form")) {
|
|
797
|
+
const stateMatch = html.match(/name="state"[^>]*value="([^"]+)"/);
|
|
798
|
+
const parsedOAuthUrl = new URL(currentUrl);
|
|
799
|
+
const consentForm = new URLSearchParams({
|
|
800
|
+
csrf_token: csrfMatch[1],
|
|
801
|
+
app_id: parsedOAuthUrl.searchParams.get("app_id") ?? "",
|
|
802
|
+
redirect_uri: parsedOAuthUrl.searchParams.get("redirect_uri") ?? "",
|
|
803
|
+
bndl_id: "",
|
|
804
|
+
pkg_name: "",
|
|
805
|
+
sign_key: "",
|
|
806
|
+
wp_guid: "",
|
|
807
|
+
mac: "",
|
|
808
|
+
ref: "",
|
|
809
|
+
token_login_post: "",
|
|
810
|
+
state: stateMatch ? stateMatch[1] : parsedOAuthUrl.searchParams.get("state") ?? "",
|
|
811
|
+
ext_info: "",
|
|
812
|
+
enable_qgpf: ""
|
|
813
|
+
});
|
|
814
|
+
const consentRes = await this.fetchImpl(currentUrl, {
|
|
815
|
+
method: "POST",
|
|
816
|
+
headers: {
|
|
817
|
+
Cookie: this.formatCookieHeader(cookies),
|
|
818
|
+
"User-Agent": this.userAgent,
|
|
819
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
820
|
+
Origin: "https://oauth.zaloapp.com",
|
|
821
|
+
Referer: currentUrl
|
|
822
|
+
},
|
|
823
|
+
body: consentForm.toString(),
|
|
824
|
+
redirect: "manual"
|
|
825
|
+
});
|
|
826
|
+
lastResponse = consentRes;
|
|
827
|
+
this.mergeSetCookies(consentRes, cookies);
|
|
828
|
+
location = consentRes.headers.get("location");
|
|
829
|
+
if (!location || consentRes.status < 300 || consentRes.status >= 400) {
|
|
830
|
+
break;
|
|
831
|
+
}
|
|
832
|
+
} else {
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
} else if (!location || res.status < 300 || res.status >= 400) {
|
|
770
836
|
break;
|
|
771
837
|
}
|
|
772
838
|
if (stripSelectAccount && location.includes("oauth.zaloapp.com") && location.includes("select_account=true")) {
|
|
@@ -777,6 +843,7 @@ var ZaloAuthManager = class {
|
|
|
777
843
|
}
|
|
778
844
|
currentUrl = location.startsWith("http") ? location : new URL(location, currentUrl).toString();
|
|
779
845
|
}
|
|
846
|
+
return lastResponse;
|
|
780
847
|
}
|
|
781
848
|
mergeSetCookies(res, target) {
|
|
782
849
|
const headersWithSetCookie = res.headers;
|
|
@@ -827,6 +894,7 @@ var DEFAULT_BASE_URLS = {
|
|
|
827
894
|
ads: "https://ads.zalo.me",
|
|
828
895
|
forms: "https://form.ads.zalo.me",
|
|
829
896
|
instantPages: "https://page.ads.zalo.me",
|
|
897
|
+
profileAds: "https://profile.ads.zalo.me",
|
|
830
898
|
widget: "https://api.widget.zalo.me",
|
|
831
899
|
chatWidget: "https://widget.chat.zalo.me"
|
|
832
900
|
};
|
|
@@ -972,9 +1040,16 @@ var ZaloSdkHttpClient = class {
|
|
|
972
1040
|
}
|
|
973
1041
|
async resolveFile(input) {
|
|
974
1042
|
if (typeof input === "string") {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1043
|
+
if (/^(https?:|data:)/i.test(input)) {
|
|
1044
|
+
const response = await this.fetchImpl(input);
|
|
1045
|
+
if (!response.ok) throw new Error(`Cannot download upload file URL: HTTP ${response.status}.`);
|
|
1046
|
+
return response.blob();
|
|
1047
|
+
}
|
|
1048
|
+
const fs = await import("fs/promises");
|
|
1049
|
+
const bytes2 = await fs.readFile(input);
|
|
1050
|
+
const copy = new Uint8Array(bytes2.byteLength);
|
|
1051
|
+
copy.set(bytes2);
|
|
1052
|
+
return new Blob([copy.buffer], { type: inferMimeType(input) });
|
|
978
1053
|
}
|
|
979
1054
|
if (input instanceof Blob) return input;
|
|
980
1055
|
if (input instanceof ArrayBuffer) return new Blob([input]);
|
|
@@ -996,14 +1071,36 @@ function appendQuery(params, key, value) {
|
|
|
996
1071
|
}
|
|
997
1072
|
function fileNameFrom(value) {
|
|
998
1073
|
if (typeof value === "string") {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1074
|
+
if (/^https?:/i.test(value)) {
|
|
1075
|
+
try {
|
|
1076
|
+
return new URL(value).pathname.split("/").pop() || "upload";
|
|
1077
|
+
} catch {
|
|
1078
|
+
return "upload";
|
|
1079
|
+
}
|
|
1003
1080
|
}
|
|
1081
|
+
const base = value.split(/[\\/]/).pop();
|
|
1082
|
+
return base || "upload";
|
|
1083
|
+
}
|
|
1084
|
+
if (value && typeof value === "object" && "name" in value && typeof value.name === "string") {
|
|
1085
|
+
return value.name;
|
|
1086
|
+
}
|
|
1087
|
+
if (value instanceof Blob && value.type) {
|
|
1088
|
+
const ext = value.type.split("/")[1]?.replace("jpeg", "jpg");
|
|
1089
|
+
if (ext) return `upload.${ext}`;
|
|
1004
1090
|
}
|
|
1005
1091
|
return "upload";
|
|
1006
1092
|
}
|
|
1093
|
+
function inferMimeType(filePath) {
|
|
1094
|
+
const lower = filePath.toLowerCase();
|
|
1095
|
+
if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "image/jpeg";
|
|
1096
|
+
if (lower.endsWith(".png")) return "image/png";
|
|
1097
|
+
if (lower.endsWith(".gif")) return "image/gif";
|
|
1098
|
+
if (lower.endsWith(".webp")) return "image/webp";
|
|
1099
|
+
if (lower.endsWith(".mp4")) return "video/mp4";
|
|
1100
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
1101
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
1102
|
+
return "application/octet-stream";
|
|
1103
|
+
}
|
|
1007
1104
|
async function resolveHeaders(auth, context) {
|
|
1008
1105
|
return { ...auth?.headers ?? {}, ...await auth?.getHeaders?.(context) ?? {} };
|
|
1009
1106
|
}
|
|
@@ -1036,6 +1133,18 @@ var OP_ZaloAdsCreateFlow = {
|
|
|
1036
1133
|
cookieFields: [],
|
|
1037
1134
|
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1038
1135
|
};
|
|
1136
|
+
var OP_ZaloAdsUpdateFlow = {
|
|
1137
|
+
operationId: "ZaloAds_updateFlow",
|
|
1138
|
+
method: "POST",
|
|
1139
|
+
endpoint: "/api/flow/update",
|
|
1140
|
+
baseUrl: "https://ads.zalo.me",
|
|
1141
|
+
binaryFields: [],
|
|
1142
|
+
pathFields: [],
|
|
1143
|
+
queryFields: [],
|
|
1144
|
+
headerFields: [],
|
|
1145
|
+
cookieFields: [],
|
|
1146
|
+
bodyFields: ["oaId", "id", "name", "messages"]
|
|
1147
|
+
};
|
|
1039
1148
|
var OP_ZaloAdsUpdateVideoAd = {
|
|
1040
1149
|
operationId: "ZaloAds_updateVideoAd",
|
|
1041
1150
|
method: "POST",
|
|
@@ -1163,6 +1272,26 @@ var OP_ZaloAdsCreatePostCampaign = {
|
|
|
1163
1272
|
"data"
|
|
1164
1273
|
]
|
|
1165
1274
|
};
|
|
1275
|
+
var OP_ZaloAdsCreateConversion = {
|
|
1276
|
+
"operationId": "ZaloAds_createConversion",
|
|
1277
|
+
"method": "POST",
|
|
1278
|
+
"endpoint": "/api/conversion/add",
|
|
1279
|
+
"baseUrl": "https://ads.zalo.me",
|
|
1280
|
+
"binaryFields": [],
|
|
1281
|
+
"pathFields": [],
|
|
1282
|
+
"queryFields": [],
|
|
1283
|
+
"headerFields": [],
|
|
1284
|
+
"cookieFields": [],
|
|
1285
|
+
"bodyFields": [
|
|
1286
|
+
"name",
|
|
1287
|
+
"landingPage",
|
|
1288
|
+
"urlType",
|
|
1289
|
+
"labelId",
|
|
1290
|
+
"buttonIds",
|
|
1291
|
+
"elements",
|
|
1292
|
+
"keywords"
|
|
1293
|
+
]
|
|
1294
|
+
};
|
|
1166
1295
|
var OP_ZaloAdsDeleteConversion = {
|
|
1167
1296
|
"operationId": "ZaloAds_deleteConversion",
|
|
1168
1297
|
"method": "DELETE",
|
|
@@ -1198,7 +1327,9 @@ var OP_ZaloAdsGetAdById = {
|
|
|
1198
1327
|
"baseUrl": "https://ads.zalo.me",
|
|
1199
1328
|
"binaryFields": [],
|
|
1200
1329
|
"pathFields": [],
|
|
1201
|
-
"queryFields": [
|
|
1330
|
+
"queryFields": [
|
|
1331
|
+
"adId"
|
|
1332
|
+
],
|
|
1202
1333
|
"headerFields": [],
|
|
1203
1334
|
"cookieFields": [],
|
|
1204
1335
|
"bodyFields": []
|
|
@@ -1238,7 +1369,9 @@ var OP_ZaloAdsGetApiBaAccountAllaccessors = {
|
|
|
1238
1369
|
"baseUrl": "https://ads.zalo.me",
|
|
1239
1370
|
"binaryFields": [],
|
|
1240
1371
|
"pathFields": [],
|
|
1241
|
-
"queryFields": [
|
|
1372
|
+
"queryFields": [
|
|
1373
|
+
"isShowAll"
|
|
1374
|
+
],
|
|
1242
1375
|
"headerFields": [],
|
|
1243
1376
|
"cookieFields": [],
|
|
1244
1377
|
"bodyFields": []
|
|
@@ -1391,7 +1524,9 @@ var OP_ZaloAdsGetApiSpellCheckV2 = {
|
|
|
1391
1524
|
"baseUrl": "https://ads.zalo.me",
|
|
1392
1525
|
"binaryFields": [],
|
|
1393
1526
|
"pathFields": [],
|
|
1394
|
-
"queryFields": [
|
|
1527
|
+
"queryFields": [
|
|
1528
|
+
"text"
|
|
1529
|
+
],
|
|
1395
1530
|
"headerFields": [],
|
|
1396
1531
|
"cookieFields": [],
|
|
1397
1532
|
"bodyFields": []
|
|
@@ -1434,8 +1569,14 @@ var OP_ZaloAdsGetReportapiV2Campaigns = {
|
|
|
1434
1569
|
"endpoint": "/reportapi/v2/campaigns/{campaignId}",
|
|
1435
1570
|
"baseUrl": "https://ads.zalo.me",
|
|
1436
1571
|
"binaryFields": [],
|
|
1437
|
-
"pathFields": [
|
|
1438
|
-
|
|
1572
|
+
"pathFields": [
|
|
1573
|
+
"campaignId"
|
|
1574
|
+
],
|
|
1575
|
+
"queryFields": [
|
|
1576
|
+
"startDate",
|
|
1577
|
+
"endDate",
|
|
1578
|
+
"refresh"
|
|
1579
|
+
],
|
|
1439
1580
|
"headerFields": [],
|
|
1440
1581
|
"cookieFields": [],
|
|
1441
1582
|
"bodyFields": []
|
|
@@ -1460,8 +1601,11 @@ var OP_ZaloAdsGetReportapiV3Campaigns = {
|
|
|
1460
1601
|
"binaryFields": [],
|
|
1461
1602
|
"pathFields": [],
|
|
1462
1603
|
"queryFields": [
|
|
1604
|
+
"filter",
|
|
1463
1605
|
"endDate",
|
|
1464
1606
|
"refresh",
|
|
1607
|
+
"agencyId",
|
|
1608
|
+
"createdBy",
|
|
1465
1609
|
"startDate"
|
|
1466
1610
|
],
|
|
1467
1611
|
"headerFields": [],
|
|
@@ -1475,7 +1619,10 @@ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
|
|
|
1475
1619
|
"baseUrl": "https://ads.zalo.me",
|
|
1476
1620
|
"binaryFields": [],
|
|
1477
1621
|
"pathFields": [],
|
|
1478
|
-
"queryFields": [
|
|
1622
|
+
"queryFields": [
|
|
1623
|
+
"campaignId",
|
|
1624
|
+
"campId"
|
|
1625
|
+
],
|
|
1479
1626
|
"headerFields": [],
|
|
1480
1627
|
"cookieFields": [],
|
|
1481
1628
|
"bodyFields": []
|
|
@@ -1487,7 +1634,10 @@ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
|
|
|
1487
1634
|
"baseUrl": "https://ads.zalo.me",
|
|
1488
1635
|
"binaryFields": [],
|
|
1489
1636
|
"pathFields": [],
|
|
1490
|
-
"queryFields": [
|
|
1637
|
+
"queryFields": [
|
|
1638
|
+
"campaignId",
|
|
1639
|
+
"campId"
|
|
1640
|
+
],
|
|
1491
1641
|
"headerFields": [],
|
|
1492
1642
|
"cookieFields": [],
|
|
1493
1643
|
"bodyFields": []
|
|
@@ -1499,7 +1649,10 @@ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
|
|
|
1499
1649
|
"baseUrl": "https://ads.zalo.me",
|
|
1500
1650
|
"binaryFields": [],
|
|
1501
1651
|
"pathFields": [],
|
|
1502
|
-
"queryFields": [
|
|
1652
|
+
"queryFields": [
|
|
1653
|
+
"campaignId",
|
|
1654
|
+
"campId"
|
|
1655
|
+
],
|
|
1503
1656
|
"headerFields": [],
|
|
1504
1657
|
"cookieFields": [],
|
|
1505
1658
|
"bodyFields": []
|
|
@@ -1523,7 +1676,9 @@ var OP_ZaloAdsGetZaapiGetownedarticles = {
|
|
|
1523
1676
|
"baseUrl": "https://ads.zalo.me",
|
|
1524
1677
|
"binaryFields": [],
|
|
1525
1678
|
"pathFields": [],
|
|
1526
|
-
"queryFields": [
|
|
1679
|
+
"queryFields": [
|
|
1680
|
+
"pageId"
|
|
1681
|
+
],
|
|
1527
1682
|
"headerFields": [],
|
|
1528
1683
|
"cookieFields": [],
|
|
1529
1684
|
"bodyFields": []
|
|
@@ -1651,14 +1806,14 @@ var OP_ZaloAdsPostApiMemberUploadImage = {
|
|
|
1651
1806
|
"endpoint": "/api/member/upload-image",
|
|
1652
1807
|
"baseUrl": "https://ads.zalo.me",
|
|
1653
1808
|
"binaryFields": [
|
|
1654
|
-
"
|
|
1809
|
+
"File"
|
|
1655
1810
|
],
|
|
1656
1811
|
"pathFields": [],
|
|
1657
1812
|
"queryFields": [],
|
|
1658
1813
|
"headerFields": [],
|
|
1659
1814
|
"cookieFields": [],
|
|
1660
1815
|
"bodyFields": [
|
|
1661
|
-
"
|
|
1816
|
+
"File"
|
|
1662
1817
|
]
|
|
1663
1818
|
};
|
|
1664
1819
|
var OP_ZaloAdsPostZaapiDeletead = {
|
|
@@ -1668,10 +1823,14 @@ var OP_ZaloAdsPostZaapiDeletead = {
|
|
|
1668
1823
|
"baseUrl": "https://ads.zalo.me",
|
|
1669
1824
|
"binaryFields": [],
|
|
1670
1825
|
"pathFields": [],
|
|
1671
|
-
"queryFields": [
|
|
1826
|
+
"queryFields": [
|
|
1827
|
+
"adId"
|
|
1828
|
+
],
|
|
1672
1829
|
"headerFields": [],
|
|
1673
1830
|
"cookieFields": [],
|
|
1674
|
-
"bodyFields": [
|
|
1831
|
+
"bodyFields": [
|
|
1832
|
+
"adId"
|
|
1833
|
+
]
|
|
1675
1834
|
};
|
|
1676
1835
|
var OP_ZaloAdsRenameCampaign = {
|
|
1677
1836
|
"operationId": "ZaloAds_renameCampaign",
|
|
@@ -1744,12 +1903,21 @@ var OP_ZaloAdsUpdateNewAds = {
|
|
|
1744
1903
|
"method": "POST",
|
|
1745
1904
|
"endpoint": "/zaapi/UploadCrop",
|
|
1746
1905
|
"baseUrl": "https://ads.zalo.me",
|
|
1747
|
-
"binaryFields": [
|
|
1906
|
+
"binaryFields": [
|
|
1907
|
+
"File"
|
|
1908
|
+
],
|
|
1748
1909
|
"pathFields": [],
|
|
1749
1910
|
"queryFields": [],
|
|
1750
1911
|
"headerFields": [],
|
|
1751
1912
|
"cookieFields": [],
|
|
1752
|
-
"bodyFields": [
|
|
1913
|
+
"bodyFields": [
|
|
1914
|
+
"File",
|
|
1915
|
+
"x",
|
|
1916
|
+
"y",
|
|
1917
|
+
"width",
|
|
1918
|
+
"height",
|
|
1919
|
+
"scale"
|
|
1920
|
+
]
|
|
1753
1921
|
};
|
|
1754
1922
|
var OP_ZaloAdsUpdateOfficialAccountAd = {
|
|
1755
1923
|
"operationId": "ZaloAds_updateOfficialAccountAd",
|
|
@@ -1901,10 +2069,13 @@ var OP_ZaloAdsCreateAutomatedRule = {
|
|
|
1901
2069
|
"headerFields": [],
|
|
1902
2070
|
"cookieFields": [],
|
|
1903
2071
|
"bodyFields": [
|
|
2072
|
+
"scope",
|
|
1904
2073
|
"appliedTo",
|
|
1905
2074
|
"ruleName",
|
|
1906
2075
|
"action",
|
|
1907
2076
|
"conditions",
|
|
2077
|
+
"frequency",
|
|
2078
|
+
"appliedIds",
|
|
1908
2079
|
"schedule",
|
|
1909
2080
|
"campaignIds",
|
|
1910
2081
|
"adIds"
|
|
@@ -1935,7 +2106,7 @@ var OP_ZaloAdsUpdateAutomatedRule = {
|
|
|
1935
2106
|
var OP_ZaloAdsChangeAutomatedRuleStatus = {
|
|
1936
2107
|
"operationId": "ZaloAds_changeAutomatedRuleStatus",
|
|
1937
2108
|
"method": "POST",
|
|
1938
|
-
"endpoint": "/api/automatedrules/status",
|
|
2109
|
+
"endpoint": "/api/automatedrules/change-status",
|
|
1939
2110
|
"baseUrl": "https://ads.zalo.me",
|
|
1940
2111
|
"binaryFields": [],
|
|
1941
2112
|
"pathFields": [],
|
|
@@ -1943,10 +2114,25 @@ var OP_ZaloAdsChangeAutomatedRuleStatus = {
|
|
|
1943
2114
|
"headerFields": [],
|
|
1944
2115
|
"cookieFields": [],
|
|
1945
2116
|
"bodyFields": [
|
|
2117
|
+
"automatedRuleId",
|
|
1946
2118
|
"automatedRuleIds",
|
|
1947
2119
|
"status"
|
|
1948
2120
|
]
|
|
1949
2121
|
};
|
|
2122
|
+
var OP_ZaloAdsGetAutomatedRuleHistory = {
|
|
2123
|
+
"operationId": "ZaloAds_getAutomatedRuleHistory",
|
|
2124
|
+
"method": "GET",
|
|
2125
|
+
"endpoint": "/api/automatedrules/history/{automatedRuleId}",
|
|
2126
|
+
"baseUrl": "https://ads.zalo.me",
|
|
2127
|
+
"binaryFields": [],
|
|
2128
|
+
"pathFields": [
|
|
2129
|
+
"automatedRuleId"
|
|
2130
|
+
],
|
|
2131
|
+
"queryFields": [],
|
|
2132
|
+
"headerFields": [],
|
|
2133
|
+
"cookieFields": [],
|
|
2134
|
+
"bodyFields": []
|
|
2135
|
+
};
|
|
1950
2136
|
var OP_ZaloAdsDeleteAutomatedRule = {
|
|
1951
2137
|
"operationId": "ZaloAds_deleteAutomatedRule",
|
|
1952
2138
|
"method": "POST",
|
|
@@ -2021,6 +2207,9 @@ var ZaloAdsService = class {
|
|
|
2021
2207
|
createFlow(request, options) {
|
|
2022
2208
|
return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
|
|
2023
2209
|
}
|
|
2210
|
+
updateFlow(request, options) {
|
|
2211
|
+
return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
|
|
2212
|
+
}
|
|
2024
2213
|
listFlowsByOfficialAccount(request, options) {
|
|
2025
2214
|
return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
|
|
2026
2215
|
}
|
|
@@ -2052,6 +2241,10 @@ var ZaloAdsService = class {
|
|
|
2052
2241
|
createEcommerceCampaign(request, options) {
|
|
2053
2242
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
|
|
2054
2243
|
}
|
|
2244
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
|
|
2245
|
+
createCommerceCampaign(request, options) {
|
|
2246
|
+
return this.createEcommerceCampaign(request, options);
|
|
2247
|
+
}
|
|
2055
2248
|
createForm(request, options) {
|
|
2056
2249
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
|
|
2057
2250
|
}
|
|
@@ -2064,9 +2257,17 @@ var ZaloAdsService = class {
|
|
|
2064
2257
|
createOfficialAccountCampaign(request, options) {
|
|
2065
2258
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
|
|
2066
2259
|
}
|
|
2260
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
|
|
2261
|
+
createOaCampaign(request, options) {
|
|
2262
|
+
return this.createOfficialAccountCampaign(request, options);
|
|
2263
|
+
}
|
|
2067
2264
|
createPostCampaign(request, options) {
|
|
2068
2265
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
|
|
2069
2266
|
}
|
|
2267
|
+
/** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
|
|
2268
|
+
createArticleCampaign(request, options) {
|
|
2269
|
+
return this.createPostCampaign(request, options);
|
|
2270
|
+
}
|
|
2070
2271
|
listAutomatedRules(request = {}, options) {
|
|
2071
2272
|
const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
|
|
2072
2273
|
return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
|
|
@@ -2080,16 +2281,22 @@ var ZaloAdsService = class {
|
|
|
2080
2281
|
changeAutomatedRuleStatus(request, options) {
|
|
2081
2282
|
return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
|
|
2082
2283
|
}
|
|
2284
|
+
getAutomatedRuleHistory(request, options) {
|
|
2285
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
|
|
2286
|
+
}
|
|
2083
2287
|
deleteAutomatedRule(request, options) {
|
|
2084
2288
|
return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
|
|
2085
2289
|
}
|
|
2290
|
+
createConversion(request, options) {
|
|
2291
|
+
return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
|
|
2292
|
+
}
|
|
2086
2293
|
deleteConversion(request, options) {
|
|
2087
2294
|
return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
|
|
2088
2295
|
}
|
|
2089
2296
|
deleteCustomAudience(request, options) {
|
|
2090
2297
|
return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
|
|
2091
2298
|
}
|
|
2092
|
-
getAdById(request, options) {
|
|
2299
|
+
getAdById(request = {}, options) {
|
|
2093
2300
|
return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
|
|
2094
2301
|
}
|
|
2095
2302
|
getAdChangeLog(request, options) {
|
|
@@ -2104,28 +2311,28 @@ var ZaloAdsService = class {
|
|
|
2104
2311
|
getApiBaAccountAllgrantedmembers(request = {}, options) {
|
|
2105
2312
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
|
|
2106
2313
|
}
|
|
2107
|
-
getApiConversionAll(request, options) {
|
|
2314
|
+
getApiConversionAll(request = {}, options) {
|
|
2108
2315
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
|
|
2109
2316
|
}
|
|
2110
2317
|
getApiConversionStandardEvents(request = {}, options) {
|
|
2111
2318
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
|
|
2112
2319
|
}
|
|
2113
|
-
getApiCustomAudienceAll(request, options) {
|
|
2320
|
+
getApiCustomAudienceAll(request = {}, options) {
|
|
2114
2321
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
|
|
2115
2322
|
}
|
|
2116
2323
|
getApiFilegroups(request = {}, options) {
|
|
2117
2324
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiFilegroups, this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request), options);
|
|
2118
2325
|
}
|
|
2119
|
-
getApiLpNews(request, options) {
|
|
2326
|
+
getApiLpNews(request = {}, options) {
|
|
2120
2327
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
|
|
2121
2328
|
}
|
|
2122
2329
|
getApiMediaItems(request, options) {
|
|
2123
2330
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiMediaItems, this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request), options);
|
|
2124
2331
|
}
|
|
2125
|
-
getApiMemberFiles(request, options) {
|
|
2332
|
+
getApiMemberFiles(request = {}, options) {
|
|
2126
2333
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiMemberFiles, this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request), options);
|
|
2127
2334
|
}
|
|
2128
|
-
getApiNotifiesHeader(request, options) {
|
|
2335
|
+
getApiNotifiesHeader(request = {}, options) {
|
|
2129
2336
|
return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
|
|
2130
2337
|
}
|
|
2131
2338
|
getApiPaymentTransactionHistory(request, options) {
|
|
@@ -2143,35 +2350,55 @@ var ZaloAdsService = class {
|
|
|
2143
2350
|
getReportapiV2Ads(request, options) {
|
|
2144
2351
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
|
|
2145
2352
|
}
|
|
2146
|
-
getReportapiV2Campaigns(request, options) {
|
|
2353
|
+
getReportapiV2Campaigns(request = {}, options) {
|
|
2147
2354
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
|
|
2148
2355
|
}
|
|
2149
|
-
getReportapiV2UniqueUser(request, options) {
|
|
2356
|
+
getReportapiV2UniqueUser(request = {}, options) {
|
|
2150
2357
|
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
|
|
2151
2358
|
}
|
|
2152
2359
|
getReportapiV3Campaigns(request, options) {
|
|
2153
|
-
|
|
2360
|
+
const normalized = {
|
|
2361
|
+
filter: "[]",
|
|
2362
|
+
agencyId: 0,
|
|
2363
|
+
...request
|
|
2364
|
+
};
|
|
2365
|
+
return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
|
|
2154
2366
|
}
|
|
2155
|
-
getZaapiCampaignReportcampaign(request, options) {
|
|
2367
|
+
getZaapiCampaignReportcampaign(request = {}, options) {
|
|
2156
2368
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
|
|
2157
2369
|
}
|
|
2158
|
-
getZaapiCheckcamphasmanyads(request, options) {
|
|
2370
|
+
getZaapiCheckcamphasmanyads(request = {}, options) {
|
|
2159
2371
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
|
|
2160
2372
|
}
|
|
2161
|
-
getZaapiGetadsfromcampaignid(request, options) {
|
|
2373
|
+
getZaapiGetadsfromcampaignid(request = {}, options) {
|
|
2162
2374
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
|
|
2163
2375
|
}
|
|
2164
2376
|
getZaapiGetallpages(request = {}, options) {
|
|
2165
2377
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
|
|
2166
2378
|
}
|
|
2167
|
-
|
|
2379
|
+
getAllPages(request = {}, options) {
|
|
2380
|
+
return this.getZaapiGetallpages(request, options);
|
|
2381
|
+
}
|
|
2382
|
+
getZaapiGetownedarticles(request, options) {
|
|
2168
2383
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
|
|
2169
2384
|
}
|
|
2385
|
+
getOwnedArticles(request, options) {
|
|
2386
|
+
return this.getZaapiGetownedarticles(request, options);
|
|
2387
|
+
}
|
|
2170
2388
|
getZaapiGetownedpages(request = {}, options) {
|
|
2171
2389
|
return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
|
|
2172
2390
|
}
|
|
2173
|
-
|
|
2174
|
-
return this.
|
|
2391
|
+
getOwnedPages(request = {}, options) {
|
|
2392
|
+
return this.getZaapiGetownedpages(request, options);
|
|
2393
|
+
}
|
|
2394
|
+
listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
|
|
2395
|
+
const normalized = {
|
|
2396
|
+
limit: 15,
|
|
2397
|
+
offset: 0,
|
|
2398
|
+
joinDateAsc: true,
|
|
2399
|
+
...request
|
|
2400
|
+
};
|
|
2401
|
+
return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
|
|
2175
2402
|
}
|
|
2176
2403
|
listCustomReports(request = {}, options) {
|
|
2177
2404
|
return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
|
|
@@ -2192,9 +2419,17 @@ var ZaloAdsService = class {
|
|
|
2192
2419
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsPostApiMediaSave, this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, request), options);
|
|
2193
2420
|
}
|
|
2194
2421
|
postApiMemberUploadImage(request, options) {
|
|
2195
|
-
|
|
2422
|
+
const normalized = {
|
|
2423
|
+
...request,
|
|
2424
|
+
File: request.File ?? request.file
|
|
2425
|
+
};
|
|
2426
|
+
return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized), options);
|
|
2427
|
+
}
|
|
2428
|
+
/** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
|
|
2429
|
+
uploadImage(request, options) {
|
|
2430
|
+
return this.postApiMemberUploadImage(request, options);
|
|
2196
2431
|
}
|
|
2197
|
-
postZaapiDeletead(request, options) {
|
|
2432
|
+
postZaapiDeletead(request = {}, options) {
|
|
2198
2433
|
return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
|
|
2199
2434
|
}
|
|
2200
2435
|
renameCampaign(request, options) {
|
|
@@ -2203,6 +2438,10 @@ var ZaloAdsService = class {
|
|
|
2203
2438
|
updateEcommerceAd(request, options) {
|
|
2204
2439
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
|
|
2205
2440
|
}
|
|
2441
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
|
|
2442
|
+
updateCommerceAd(request, options) {
|
|
2443
|
+
return this.updateEcommerceAd(request, options);
|
|
2444
|
+
}
|
|
2206
2445
|
updateFormAd(request, options) {
|
|
2207
2446
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
|
|
2208
2447
|
}
|
|
@@ -2210,14 +2449,22 @@ var ZaloAdsService = class {
|
|
|
2210
2449
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
|
|
2211
2450
|
}
|
|
2212
2451
|
updateNewAds(request, options) {
|
|
2213
|
-
return this.client.
|
|
2452
|
+
return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
|
|
2214
2453
|
}
|
|
2215
2454
|
updateOfficialAccountAd(request, options) {
|
|
2216
2455
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
|
|
2217
2456
|
}
|
|
2457
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
|
|
2458
|
+
updateOaAd(request, options) {
|
|
2459
|
+
return this.updateOfficialAccountAd(request, options);
|
|
2460
|
+
}
|
|
2218
2461
|
updatePostAd(request, options) {
|
|
2219
2462
|
return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
|
|
2220
2463
|
}
|
|
2464
|
+
/** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
|
|
2465
|
+
updateArticleAd(request, options) {
|
|
2466
|
+
return this.updatePostAd(request, options);
|
|
2467
|
+
}
|
|
2221
2468
|
uploadCustomAudiencePhoneList(request, options) {
|
|
2222
2469
|
return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
|
|
2223
2470
|
}
|
|
@@ -2251,6 +2498,10 @@ var ZaloChatWidgetService = class {
|
|
|
2251
2498
|
getChatWidgetLoginConfig(request, options) {
|
|
2252
2499
|
return this.client.requestWithoutBody(OP_ZaloChatWidgetGetChatWidgetLoginConfig, this.client.toTransportInput(OP_ZaloChatWidgetGetChatWidgetLoginConfig, request), options);
|
|
2253
2500
|
}
|
|
2501
|
+
/** Alias theo tên tool chuẩn `zalo_chat_widget_get_login_config` trong Project Schema Zalo ADS. */
|
|
2502
|
+
getLoginConfig(request, options) {
|
|
2503
|
+
return this.getChatWidgetLoginConfig(request, options);
|
|
2504
|
+
}
|
|
2254
2505
|
};
|
|
2255
2506
|
|
|
2256
2507
|
// src/services/forms.service.ts
|
|
@@ -2633,6 +2884,26 @@ var OP_ZaloInstantPagesListOfficialAccounts = {
|
|
|
2633
2884
|
"cookieFields": [],
|
|
2634
2885
|
"bodyFields": []
|
|
2635
2886
|
};
|
|
2887
|
+
var OP_ZaloInstantPagesUpsertInstantPageForm = {
|
|
2888
|
+
"operationId": "ZaloInstantPages_upsertInstantPageForm",
|
|
2889
|
+
"method": "PUT",
|
|
2890
|
+
"endpoint": "/api/instant-pages/{instantPageId}/form",
|
|
2891
|
+
"baseUrl": "https://page.ads.zalo.me",
|
|
2892
|
+
"binaryFields": [],
|
|
2893
|
+
"pathFields": [
|
|
2894
|
+
"instantPageId"
|
|
2895
|
+
],
|
|
2896
|
+
"queryFields": [],
|
|
2897
|
+
"headerFields": [],
|
|
2898
|
+
"cookieFields": [],
|
|
2899
|
+
"bodyFields": [
|
|
2900
|
+
"oaId",
|
|
2901
|
+
"formName",
|
|
2902
|
+
"questions",
|
|
2903
|
+
"useCustomConsent",
|
|
2904
|
+
"consentConfig"
|
|
2905
|
+
]
|
|
2906
|
+
};
|
|
2636
2907
|
var ZaloInstantPagesService = class {
|
|
2637
2908
|
constructor(client) {
|
|
2638
2909
|
this.client = client;
|
|
@@ -2673,6 +2944,171 @@ var ZaloInstantPagesService = class {
|
|
|
2673
2944
|
listOfficialAccounts(request = {}, options) {
|
|
2674
2945
|
return this.client.requestWithoutBody(OP_ZaloInstantPagesListOfficialAccounts, this.client.toTransportInput(OP_ZaloInstantPagesListOfficialAccounts, request), options);
|
|
2675
2946
|
}
|
|
2947
|
+
upsertInstantPageForm(request, options) {
|
|
2948
|
+
return this.client.requestJson(OP_ZaloInstantPagesUpsertInstantPageForm, this.client.toTransportInput(OP_ZaloInstantPagesUpsertInstantPageForm, request), options);
|
|
2949
|
+
}
|
|
2950
|
+
};
|
|
2951
|
+
|
|
2952
|
+
// src/services/profile-ads.service.ts
|
|
2953
|
+
var OP_ZaloProfileAdsCreateOaPage = {
|
|
2954
|
+
"operationId": "ZaloProfileAds_createOaPage",
|
|
2955
|
+
"method": "POST",
|
|
2956
|
+
"endpoint": "/oa",
|
|
2957
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2958
|
+
"binaryFields": [],
|
|
2959
|
+
"pathFields": [],
|
|
2960
|
+
"queryFields": [
|
|
2961
|
+
"option",
|
|
2962
|
+
"crsf-token"
|
|
2963
|
+
],
|
|
2964
|
+
"headerFields": [],
|
|
2965
|
+
"cookieFields": [],
|
|
2966
|
+
"bodyFields": [
|
|
2967
|
+
"typeId",
|
|
2968
|
+
"tier",
|
|
2969
|
+
"typeName",
|
|
2970
|
+
"categoryId",
|
|
2971
|
+
"subCategoryId",
|
|
2972
|
+
"oaName",
|
|
2973
|
+
"description",
|
|
2974
|
+
"contactName",
|
|
2975
|
+
"contactPhone",
|
|
2976
|
+
"coverId",
|
|
2977
|
+
"avatarId",
|
|
2978
|
+
"province",
|
|
2979
|
+
"district",
|
|
2980
|
+
"address",
|
|
2981
|
+
"agreeTerm"
|
|
2982
|
+
]
|
|
2983
|
+
};
|
|
2984
|
+
var OP_ZaloProfileAdsUploadOaAvatar = {
|
|
2985
|
+
"operationId": "ZaloProfileAds_uploadOaAvatar",
|
|
2986
|
+
"method": "POST",
|
|
2987
|
+
"endpoint": "/ajax/avatar/upload",
|
|
2988
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
2989
|
+
"binaryFields": [
|
|
2990
|
+
"avatar-file"
|
|
2991
|
+
],
|
|
2992
|
+
"pathFields": [],
|
|
2993
|
+
"queryFields": [
|
|
2994
|
+
"option"
|
|
2995
|
+
],
|
|
2996
|
+
"headerFields": [],
|
|
2997
|
+
"cookieFields": [],
|
|
2998
|
+
"bodyFields": [
|
|
2999
|
+
"avatar-file",
|
|
3000
|
+
"is-new"
|
|
3001
|
+
]
|
|
3002
|
+
};
|
|
3003
|
+
var OP_ZaloProfileAdsUploadOaCover = {
|
|
3004
|
+
"operationId": "ZaloProfileAds_uploadOaCover",
|
|
3005
|
+
"method": "POST",
|
|
3006
|
+
"endpoint": "/ajax/cover/upload",
|
|
3007
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
3008
|
+
"binaryFields": [
|
|
3009
|
+
"cover-file"
|
|
3010
|
+
],
|
|
3011
|
+
"pathFields": [],
|
|
3012
|
+
"queryFields": [
|
|
3013
|
+
"option"
|
|
3014
|
+
],
|
|
3015
|
+
"headerFields": [],
|
|
3016
|
+
"cookieFields": [],
|
|
3017
|
+
"bodyFields": [
|
|
3018
|
+
"cover-file",
|
|
3019
|
+
"is-new"
|
|
3020
|
+
]
|
|
3021
|
+
};
|
|
3022
|
+
var OP_ZaloProfileAdsGetProvinces = {
|
|
3023
|
+
"operationId": "ZaloProfileAds_getProvinces",
|
|
3024
|
+
"method": "GET",
|
|
3025
|
+
"endpoint": "/ajax/get-province",
|
|
3026
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
3027
|
+
"binaryFields": [],
|
|
3028
|
+
"pathFields": [],
|
|
3029
|
+
"queryFields": [],
|
|
3030
|
+
"headerFields": [],
|
|
3031
|
+
"cookieFields": [],
|
|
3032
|
+
"bodyFields": []
|
|
3033
|
+
};
|
|
3034
|
+
var OP_ZaloProfileAdsGetDistricts = {
|
|
3035
|
+
"operationId": "ZaloProfileAds_getDistricts",
|
|
3036
|
+
"method": "GET",
|
|
3037
|
+
"endpoint": "/ajax/get-district",
|
|
3038
|
+
"baseUrl": "https://profile.ads.zalo.me",
|
|
3039
|
+
"binaryFields": [],
|
|
3040
|
+
"pathFields": [],
|
|
3041
|
+
"queryFields": [
|
|
3042
|
+
"provinceId"
|
|
3043
|
+
],
|
|
3044
|
+
"headerFields": [],
|
|
3045
|
+
"cookieFields": [],
|
|
3046
|
+
"bodyFields": []
|
|
3047
|
+
};
|
|
3048
|
+
var ZaloProfileAdsService = class {
|
|
3049
|
+
constructor(client) {
|
|
3050
|
+
this.client = client;
|
|
3051
|
+
}
|
|
3052
|
+
async createOaPage(request, options) {
|
|
3053
|
+
let csrfToken = request["crsf-token"];
|
|
3054
|
+
if (!csrfToken && this.client.authManager) {
|
|
3055
|
+
const session = await this.client.authManager.getSession("profile.ads.zalo.me");
|
|
3056
|
+
csrfToken = session.cookies["CSRF_TOKEN"] ?? session.xsrfToken;
|
|
3057
|
+
}
|
|
3058
|
+
const normalizedRequest = {
|
|
3059
|
+
option: "createpage",
|
|
3060
|
+
typeId: 2,
|
|
3061
|
+
tier: 0,
|
|
3062
|
+
typeName: "store",
|
|
3063
|
+
categoryId: 10003,
|
|
3064
|
+
agreeTerm: true,
|
|
3065
|
+
...request,
|
|
3066
|
+
...csrfToken ? { "crsf-token": csrfToken } : {}
|
|
3067
|
+
};
|
|
3068
|
+
return this.client.requestFormUrlEncoded(
|
|
3069
|
+
OP_ZaloProfileAdsCreateOaPage,
|
|
3070
|
+
this.client.toTransportInput(OP_ZaloProfileAdsCreateOaPage, normalizedRequest),
|
|
3071
|
+
options
|
|
3072
|
+
);
|
|
3073
|
+
}
|
|
3074
|
+
uploadOaAvatar(request, options) {
|
|
3075
|
+
const normalizedRequest = {
|
|
3076
|
+
option: "update",
|
|
3077
|
+
"is-new": "true",
|
|
3078
|
+
...request
|
|
3079
|
+
};
|
|
3080
|
+
return this.client.requestMultipart(
|
|
3081
|
+
OP_ZaloProfileAdsUploadOaAvatar,
|
|
3082
|
+
this.client.toTransportInput(OP_ZaloProfileAdsUploadOaAvatar, normalizedRequest),
|
|
3083
|
+
options
|
|
3084
|
+
);
|
|
3085
|
+
}
|
|
3086
|
+
uploadOaCover(request, options) {
|
|
3087
|
+
const normalizedRequest = {
|
|
3088
|
+
option: "update",
|
|
3089
|
+
"is-new": "true",
|
|
3090
|
+
...request
|
|
3091
|
+
};
|
|
3092
|
+
return this.client.requestMultipart(
|
|
3093
|
+
OP_ZaloProfileAdsUploadOaCover,
|
|
3094
|
+
this.client.toTransportInput(OP_ZaloProfileAdsUploadOaCover, normalizedRequest),
|
|
3095
|
+
options
|
|
3096
|
+
);
|
|
3097
|
+
}
|
|
3098
|
+
getProvinces(options) {
|
|
3099
|
+
return this.client.requestWithoutBody(
|
|
3100
|
+
OP_ZaloProfileAdsGetProvinces,
|
|
3101
|
+
{},
|
|
3102
|
+
options
|
|
3103
|
+
);
|
|
3104
|
+
}
|
|
3105
|
+
getDistricts(request, options) {
|
|
3106
|
+
return this.client.requestWithoutBody(
|
|
3107
|
+
OP_ZaloProfileAdsGetDistricts,
|
|
3108
|
+
this.client.toTransportInput(OP_ZaloProfileAdsGetDistricts, request),
|
|
3109
|
+
options
|
|
3110
|
+
);
|
|
3111
|
+
}
|
|
2676
3112
|
};
|
|
2677
3113
|
|
|
2678
3114
|
// src/services/widget.service.ts
|
|
@@ -2752,6 +3188,8 @@ var ZaloAdsSdk = class {
|
|
|
2752
3188
|
ads;
|
|
2753
3189
|
forms;
|
|
2754
3190
|
instantPages;
|
|
3191
|
+
profileAds;
|
|
3192
|
+
profile;
|
|
2755
3193
|
widget;
|
|
2756
3194
|
chatWidget;
|
|
2757
3195
|
constructor(options = {}) {
|
|
@@ -2760,6 +3198,8 @@ var ZaloAdsSdk = class {
|
|
|
2760
3198
|
this.ads = new ZaloAdsService(this.client);
|
|
2761
3199
|
this.forms = new ZaloFormsService(this.client);
|
|
2762
3200
|
this.instantPages = new ZaloInstantPagesService(this.client);
|
|
3201
|
+
this.profileAds = new ZaloProfileAdsService(this.client);
|
|
3202
|
+
this.profile = this.profileAds;
|
|
2763
3203
|
this.widget = new ZaloWidgetApiService(this.client);
|
|
2764
3204
|
this.chatWidget = new ZaloChatWidgetService(this.client);
|
|
2765
3205
|
}
|
|
@@ -2986,21 +3426,25 @@ var ZaloAdsFlowChildMessageDto = class {
|
|
|
2986
3426
|
text;
|
|
2987
3427
|
};
|
|
2988
3428
|
var ZaloAdsFlowButtonDto = class {
|
|
2989
|
-
/** 3
|
|
3429
|
+
/** 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. */
|
|
2990
3430
|
type;
|
|
2991
3431
|
/** Nhãn nút hiển thị cho người dùng. */
|
|
2992
3432
|
text;
|
|
3433
|
+
/** URL website; bắt buộc với type 10. */
|
|
3434
|
+
url;
|
|
3435
|
+
/** Cờ của nút website; dùng true với type 10. */
|
|
3436
|
+
editable;
|
|
2993
3437
|
/** Số hotline, bắt buộc khi type là 12. */
|
|
2994
3438
|
phone;
|
|
2995
|
-
/** Nhánh tin nhắn, bắt buộc khi type là 3. */
|
|
3439
|
+
/** 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. */
|
|
2996
3440
|
messages;
|
|
2997
3441
|
};
|
|
2998
3442
|
var ZaloAdsFlowMessageDto = class {
|
|
2999
|
-
/**
|
|
3443
|
+
/** 1 = Tin nhắn văn bản; 2 = Tin nhắn kèm hình ảnh. */
|
|
3000
3444
|
type;
|
|
3001
|
-
/** Nội dung tin nhắn
|
|
3445
|
+
/** 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}}. */
|
|
3002
3446
|
text;
|
|
3003
|
-
/** URL media hoặc null với tin nhắn văn bản thuần. */
|
|
3447
|
+
/** 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. */
|
|
3004
3448
|
url;
|
|
3005
3449
|
/** Các nút đi kèm tin nhắn. */
|
|
3006
3450
|
buttons;
|
|
@@ -3103,6 +3547,7 @@ var ZaloAdsUpdateMessageAdResponse = class {
|
|
|
3103
3547
|
ZaloChatWidgetService,
|
|
3104
3548
|
ZaloFormsService,
|
|
3105
3549
|
ZaloInstantPagesService,
|
|
3550
|
+
ZaloProfileAdsService,
|
|
3106
3551
|
ZaloSdkError,
|
|
3107
3552
|
ZaloSdkHttpClient,
|
|
3108
3553
|
ZaloWidgetApiService,
|