@redonvn/zalo-ads-sdk 0.2.0 → 0.2.4

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.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
@@ -24,6 +34,7 @@ __export(index_exports, {
24
34
  MemoryZaloSessionStore: () => MemoryZaloSessionStore,
25
35
  RedisZaloSessionStore: () => RedisZaloSessionStore,
26
36
  TieredZaloSessionStore: () => TieredZaloSessionStore,
37
+ ZaloAccountService: () => ZaloAccountService,
27
38
  ZaloAdsAccountPool: () => ZaloAdsIntegrationManager,
28
39
  ZaloAdsCreateFlowRequest: () => ZaloAdsCreateFlowRequest,
29
40
  ZaloAdsCreateFlowResponse: () => ZaloAdsCreateFlowResponse,
@@ -40,11 +51,20 @@ __export(index_exports, {
40
51
  ZaloAdsUpdateMessageAdResponse: () => ZaloAdsUpdateMessageAdResponse,
41
52
  ZaloAdsUpdateVideoAdRequest: () => ZaloAdsUpdateVideoAdRequest,
42
53
  ZaloAdsUpdateVideoAdResponse: () => ZaloAdsUpdateVideoAdResponse,
54
+ ZaloAudiencesService: () => ZaloAudiencesService,
43
55
  ZaloAuthManager: () => ZaloAuthManager,
56
+ ZaloAutomatedRulesService: () => ZaloAutomatedRulesService,
57
+ ZaloCampaignsService: () => ZaloCampaignsService,
44
58
  ZaloChatWidgetService: () => ZaloChatWidgetService,
59
+ ZaloConversionsService: () => ZaloConversionsService,
60
+ ZaloFlowsService: () => ZaloFlowsService,
45
61
  ZaloFormsService: () => ZaloFormsService,
62
+ ZaloInstantPageBlockType: () => ZaloInstantPageBlockType,
46
63
  ZaloInstantPagesService: () => ZaloInstantPagesService,
64
+ ZaloInstantPagesValidator: () => ZaloInstantPagesValidator,
65
+ ZaloMediaService: () => ZaloMediaService,
47
66
  ZaloProfileAdsService: () => ZaloProfileAdsService,
67
+ ZaloReportsService: () => ZaloReportsService,
48
68
  ZaloSdkError: () => ZaloSdkError,
49
69
  ZaloSdkHttpClient: () => ZaloSdkHttpClient,
50
70
  ZaloWidgetApiService: () => ZaloWidgetApiService,
@@ -54,7 +74,20 @@ __export(index_exports, {
54
74
  default: () => ZaloAdsSdk,
55
75
  defaultSharedMemorySessionStore: () => defaultSharedMemorySessionStore,
56
76
  deriveAccountKeyFromZpsid: () => deriveAccountKeyFromZpsid,
57
- parseZaloCookieInput: () => parseZaloCookieInput
77
+ parseZaloCookieInput: () => parseZaloCookieInput,
78
+ validateCloneInstantPageRequest: () => validateCloneInstantPageRequest,
79
+ validateGetInstantPageDetailRequest: () => validateGetInstantPageDetailRequest,
80
+ validateGetInstantPageSharedUserRequest: () => validateGetInstantPageSharedUserRequest,
81
+ validateListInstantPageEditHistoryRequest: () => validateListInstantPageEditHistoryRequest,
82
+ validateListInstantPageFormRecordsRequest: () => validateListInstantPageFormRecordsRequest,
83
+ validateListInstantPageLeadsRequest: () => validateListInstantPageLeadsRequest,
84
+ validateListInstantPageSharesRequest: () => validateListInstantPageSharesRequest,
85
+ validateListInstantPageUsersRequest: () => validateListInstantPageUsersRequest,
86
+ validateListMiniPageTemplatesRequest: () => validateListMiniPageTemplatesRequest,
87
+ validateListOfficialAccountsRequest: () => validateListOfficialAccountsRequest,
88
+ validateSearchInstantPagesRequest: () => validateSearchInstantPagesRequest,
89
+ validateUpdateInstantPageRequest: () => validateUpdateInstantPageRequest,
90
+ validateUpsertInstantPageFormRequest: () => validateUpsertInstantPageFormRequest
58
91
  });
59
92
  module.exports = __toCommonJS(index_exports);
60
93
 
@@ -63,7 +96,7 @@ var ZaloSdkError = class extends Error {
63
96
  status;
64
97
  operationId;
65
98
  responseBody;
66
- constructor(message, status, operationId, responseBody) {
99
+ constructor(message, status = 500, operationId = "unknown", responseBody = null) {
67
100
  super(message);
68
101
  this.name = "ZaloSdkError";
69
102
  this.status = status;
@@ -1030,9 +1063,16 @@ var ZaloSdkHttpClient = class {
1030
1063
  }
1031
1064
  async resolveFile(input) {
1032
1065
  if (typeof input === "string") {
1033
- const response = await this.fetchImpl(input);
1034
- if (!response.ok) throw new Error(`Cannot download upload file URL: HTTP ${response.status}.`);
1035
- return response.blob();
1066
+ if (/^(https?:|data:)/i.test(input)) {
1067
+ const response = await this.fetchImpl(input);
1068
+ if (!response.ok) throw new Error(`Cannot download upload file URL: HTTP ${response.status}.`);
1069
+ return response.blob();
1070
+ }
1071
+ const fs = await import("fs/promises");
1072
+ const bytes2 = await fs.readFile(input);
1073
+ const copy = new Uint8Array(bytes2.byteLength);
1074
+ copy.set(bytes2);
1075
+ return new Blob([copy.buffer], { type: inferMimeType(input) });
1036
1076
  }
1037
1077
  if (input instanceof Blob) return input;
1038
1078
  if (input instanceof ArrayBuffer) return new Blob([input]);
@@ -1054,14 +1094,36 @@ function appendQuery(params, key, value) {
1054
1094
  }
1055
1095
  function fileNameFrom(value) {
1056
1096
  if (typeof value === "string") {
1057
- try {
1058
- return new URL(value).pathname.split("/").pop() || "upload";
1059
- } catch {
1060
- return "upload";
1097
+ if (/^https?:/i.test(value)) {
1098
+ try {
1099
+ return new URL(value).pathname.split("/").pop() || "upload";
1100
+ } catch {
1101
+ return "upload";
1102
+ }
1061
1103
  }
1104
+ const base = value.split(/[\\/]/).pop();
1105
+ return base || "upload";
1106
+ }
1107
+ if (value && typeof value === "object" && "name" in value && typeof value.name === "string") {
1108
+ return value.name;
1109
+ }
1110
+ if (value instanceof Blob && value.type) {
1111
+ const ext = value.type.split("/")[1]?.replace("jpeg", "jpg");
1112
+ if (ext) return `upload.${ext}`;
1062
1113
  }
1063
1114
  return "upload";
1064
1115
  }
1116
+ function inferMimeType(filePath) {
1117
+ const lower = filePath.toLowerCase();
1118
+ if (lower.endsWith(".jpg") || lower.endsWith(".jpeg")) return "image/jpeg";
1119
+ if (lower.endsWith(".png")) return "image/png";
1120
+ if (lower.endsWith(".gif")) return "image/gif";
1121
+ if (lower.endsWith(".webp")) return "image/webp";
1122
+ if (lower.endsWith(".mp4")) return "video/mp4";
1123
+ if (lower.endsWith(".txt")) return "text/plain";
1124
+ if (lower.endsWith(".csv")) return "text/csv";
1125
+ return "application/octet-stream";
1126
+ }
1065
1127
  async function resolveHeaders(auth, context) {
1066
1128
  return { ...auth?.headers ?? {}, ...await auth?.getHeaders?.(context) ?? {} };
1067
1129
  }
@@ -1069,43 +1131,7 @@ async function resolveCookies(auth, context) {
1069
1131
  return { ...auth?.cookies ?? {}, ...await auth?.getCookies?.(context) ?? {} };
1070
1132
  }
1071
1133
 
1072
- // src/services/ads.service.ts
1073
- var OP_ZaloAdsListFlowsByOfficialAccount = {
1074
- operationId: "ZaloAds_listFlowsByOfficialAccount",
1075
- method: "GET",
1076
- endpoint: "/api/flow/getByOaId",
1077
- baseUrl: "https://ads.zalo.me",
1078
- binaryFields: [],
1079
- pathFields: [],
1080
- queryFields: ["oaId", "limit", "offset", "flowId"],
1081
- headerFields: [],
1082
- cookieFields: [],
1083
- bodyFields: []
1084
- };
1085
- var OP_ZaloAdsCreateFlow = {
1086
- operationId: "ZaloAds_createFlow",
1087
- method: "POST",
1088
- endpoint: "/api/flow/create",
1089
- baseUrl: "https://ads.zalo.me",
1090
- binaryFields: [],
1091
- pathFields: [],
1092
- queryFields: [],
1093
- headerFields: [],
1094
- cookieFields: [],
1095
- bodyFields: ["oaId", "id", "name", "messages"]
1096
- };
1097
- var OP_ZaloAdsUpdateFlow = {
1098
- operationId: "ZaloAds_updateFlow",
1099
- method: "POST",
1100
- endpoint: "/api/flow/update",
1101
- baseUrl: "https://ads.zalo.me",
1102
- binaryFields: [],
1103
- pathFields: [],
1104
- queryFields: [],
1105
- headerFields: [],
1106
- cookieFields: [],
1107
- bodyFields: ["oaId", "id", "name", "messages"]
1108
- };
1134
+ // src/services/campaigns.service.ts
1109
1135
  var OP_ZaloAdsUpdateVideoAd = {
1110
1136
  operationId: "ZaloAds_updateVideoAd",
1111
1137
  method: "POST",
@@ -1133,22 +1159,6 @@ var OP_ZaloAdsChangeCampaignStatus = {
1133
1159
  "campaignId"
1134
1160
  ]
1135
1161
  };
1136
- var OP_ZaloAdsCreateCustomAudience = {
1137
- "operationId": "ZaloAds_createCustomAudience",
1138
- "method": "POST",
1139
- "endpoint": "/api/ad/audience",
1140
- "baseUrl": "https://ads.zalo.me",
1141
- "binaryFields": [],
1142
- "pathFields": [],
1143
- "queryFields": [],
1144
- "headerFields": [],
1145
- "cookieFields": [],
1146
- "bodyFields": [
1147
- "name",
1148
- "caType",
1149
- "targeting"
1150
- ]
1151
- };
1152
1162
  var OP_ZaloAdsCreateEcommerceCampaign = {
1153
1163
  "operationId": "ZaloAds_createEcommerceCampaign",
1154
1164
  "method": "POST",
@@ -1233,54 +1243,6 @@ var OP_ZaloAdsCreatePostCampaign = {
1233
1243
  "data"
1234
1244
  ]
1235
1245
  };
1236
- var OP_ZaloAdsCreateConversion = {
1237
- "operationId": "ZaloAds_createConversion",
1238
- "method": "POST",
1239
- "endpoint": "/api/conversion/add",
1240
- "baseUrl": "https://ads.zalo.me",
1241
- "binaryFields": [],
1242
- "pathFields": [],
1243
- "queryFields": [],
1244
- "headerFields": [],
1245
- "cookieFields": [],
1246
- "bodyFields": [
1247
- "name",
1248
- "landingPage",
1249
- "urlType",
1250
- "labelId",
1251
- "buttonIds",
1252
- "elements",
1253
- "keywords"
1254
- ]
1255
- };
1256
- var OP_ZaloAdsDeleteConversion = {
1257
- "operationId": "ZaloAds_deleteConversion",
1258
- "method": "DELETE",
1259
- "endpoint": "/api/conversion/delete/{conversionId}",
1260
- "baseUrl": "https://ads.zalo.me",
1261
- "binaryFields": [],
1262
- "pathFields": [
1263
- "conversionId"
1264
- ],
1265
- "queryFields": [],
1266
- "headerFields": [],
1267
- "cookieFields": [],
1268
- "bodyFields": []
1269
- };
1270
- var OP_ZaloAdsDeleteCustomAudience = {
1271
- "operationId": "ZaloAds_deleteCustomAudience",
1272
- "method": "DELETE",
1273
- "endpoint": "/api/ad/audience/{customAudienceId}",
1274
- "baseUrl": "https://ads.zalo.me",
1275
- "binaryFields": [],
1276
- "pathFields": [
1277
- "customAudienceId"
1278
- ],
1279
- "queryFields": [],
1280
- "headerFields": [],
1281
- "cookieFields": [],
1282
- "bodyFields": []
1283
- };
1284
1246
  var OP_ZaloAdsGetAdById = {
1285
1247
  "operationId": "ZaloAds_getAdById",
1286
1248
  "method": "GET",
@@ -1311,10 +1273,10 @@ var OP_ZaloAdsGetAdChangeLog = {
1311
1273
  "cookieFields": [],
1312
1274
  "bodyFields": []
1313
1275
  };
1314
- var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1315
- "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
1276
+ var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1277
+ "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1316
1278
  "method": "GET",
1317
- "endpoint": "/api/ad/getListAdAdvanceTargeting",
1279
+ "endpoint": "/api/place/getAllDistricts",
1318
1280
  "baseUrl": "https://ads.zalo.me",
1319
1281
  "binaryFields": [],
1320
1282
  "pathFields": [],
@@ -1323,46 +1285,54 @@ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1323
1285
  "cookieFields": [],
1324
1286
  "bodyFields": []
1325
1287
  };
1326
- var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1327
- "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1288
+ var OP_ZaloAdsGetApiSpellCheckV2 = {
1289
+ "operationId": "ZaloAds_getApiSpellCheckV2",
1328
1290
  "method": "GET",
1329
- "endpoint": "/api/ba/account/allAccessors",
1291
+ "endpoint": "/api/spell-check/v2",
1330
1292
  "baseUrl": "https://ads.zalo.me",
1331
1293
  "binaryFields": [],
1332
1294
  "pathFields": [],
1333
- "queryFields": [],
1295
+ "queryFields": [
1296
+ "text"
1297
+ ],
1334
1298
  "headerFields": [],
1335
1299
  "cookieFields": [],
1336
1300
  "bodyFields": []
1337
1301
  };
1338
- var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1339
- "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1302
+ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1303
+ "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1340
1304
  "method": "GET",
1341
- "endpoint": "/api/ba/account/allGrantedMembers",
1305
+ "endpoint": "/zaapi/checkCampHasManyAds",
1342
1306
  "baseUrl": "https://ads.zalo.me",
1343
1307
  "binaryFields": [],
1344
1308
  "pathFields": [],
1345
- "queryFields": [],
1309
+ "queryFields": [
1310
+ "campaignId",
1311
+ "campId"
1312
+ ],
1346
1313
  "headerFields": [],
1347
1314
  "cookieFields": [],
1348
1315
  "bodyFields": []
1349
1316
  };
1350
- var OP_ZaloAdsGetApiConversionAll = {
1351
- "operationId": "ZaloAds_getApiConversionAll",
1317
+ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1318
+ "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1352
1319
  "method": "GET",
1353
- "endpoint": "/api/conversion/all",
1320
+ "endpoint": "/zaapi/getAdsFromCampaignId",
1354
1321
  "baseUrl": "https://ads.zalo.me",
1355
1322
  "binaryFields": [],
1356
1323
  "pathFields": [],
1357
- "queryFields": [],
1324
+ "queryFields": [
1325
+ "campaignId",
1326
+ "campId"
1327
+ ],
1358
1328
  "headerFields": [],
1359
1329
  "cookieFields": [],
1360
1330
  "bodyFields": []
1361
1331
  };
1362
- var OP_ZaloAdsGetApiConversionStandardEvents = {
1363
- "operationId": "ZaloAds_getApiConversionStandardEvents",
1332
+ var OP_ZaloAdsGetZaapiGetallpages = {
1333
+ "operationId": "ZaloAds_getZaapiGetallpages",
1364
1334
  "method": "GET",
1365
- "endpoint": "/api/conversion/standard-events",
1335
+ "endpoint": "/zaapi/getAllPages",
1366
1336
  "baseUrl": "https://ads.zalo.me",
1367
1337
  "binaryFields": [],
1368
1338
  "pathFields": [],
@@ -1371,24 +1341,24 @@ var OP_ZaloAdsGetApiConversionStandardEvents = {
1371
1341
  "cookieFields": [],
1372
1342
  "bodyFields": []
1373
1343
  };
1374
- var OP_ZaloAdsGetApiCustomAudienceAll = {
1375
- "operationId": "ZaloAds_getApiCustomAudienceAll",
1344
+ var OP_ZaloAdsGetZaapiGetownedarticles = {
1345
+ "operationId": "ZaloAds_getZaapiGetownedarticles",
1376
1346
  "method": "GET",
1377
- "endpoint": "/api/custom-audience/all",
1347
+ "endpoint": "/zaapi/getOwnedArticles",
1378
1348
  "baseUrl": "https://ads.zalo.me",
1379
1349
  "binaryFields": [],
1380
1350
  "pathFields": [],
1381
1351
  "queryFields": [
1382
- "newWard"
1352
+ "pageId"
1383
1353
  ],
1384
1354
  "headerFields": [],
1385
1355
  "cookieFields": [],
1386
1356
  "bodyFields": []
1387
1357
  };
1388
- var OP_ZaloAdsGetApiFilegroups = {
1389
- "operationId": "ZaloAds_getApiFilegroups",
1358
+ var OP_ZaloAdsGetZaapiGetownedpages = {
1359
+ "operationId": "ZaloAds_getZaapiGetownedpages",
1390
1360
  "method": "GET",
1391
- "endpoint": "/api/filegroups",
1361
+ "endpoint": "/zaapi/getOwnedPages",
1392
1362
  "baseUrl": "https://ads.zalo.me",
1393
1363
  "binaryFields": [],
1394
1364
  "pathFields": [],
@@ -1397,323 +1367,419 @@ var OP_ZaloAdsGetApiFilegroups = {
1397
1367
  "cookieFields": [],
1398
1368
  "bodyFields": []
1399
1369
  };
1400
- var OP_ZaloAdsGetApiLpNews = {
1401
- "operationId": "ZaloAds_getApiLpNews",
1370
+ var OP_ZaloAdsListFormsByOfficialAccount = {
1371
+ "operationId": "ZaloAds_listFormsByOfficialAccount",
1402
1372
  "method": "GET",
1403
- "endpoint": "/api/lp-news",
1373
+ "endpoint": "/api/form/getByOaId",
1404
1374
  "baseUrl": "https://ads.zalo.me",
1405
1375
  "binaryFields": [],
1406
1376
  "pathFields": [],
1407
- "queryFields": [],
1377
+ "queryFields": [
1378
+ "oaId",
1379
+ "isAll"
1380
+ ],
1408
1381
  "headerFields": [],
1409
1382
  "cookieFields": [],
1410
1383
  "bodyFields": []
1411
1384
  };
1412
- var OP_ZaloAdsGetApiMediaItems = {
1413
- "operationId": "ZaloAds_getApiMediaItems",
1385
+ var OP_ZaloAdsListMiniPagesByTemplate = {
1386
+ "operationId": "ZaloAds_listMiniPagesByTemplate",
1414
1387
  "method": "GET",
1415
- "endpoint": "/api/media/items",
1388
+ "endpoint": "/api/mini-pages",
1416
1389
  "baseUrl": "https://ads.zalo.me",
1417
1390
  "binaryFields": [],
1418
1391
  "pathFields": [],
1419
1392
  "queryFields": [
1420
- "endDate",
1421
- "startDate"
1393
+ "templateIds"
1422
1394
  ],
1423
1395
  "headerFields": [],
1424
1396
  "cookieFields": [],
1425
1397
  "bodyFields": []
1426
1398
  };
1427
- var OP_ZaloAdsGetApiMemberFiles = {
1428
- "operationId": "ZaloAds_getApiMemberFiles",
1429
- "method": "GET",
1430
- "endpoint": "/api/member/files",
1399
+ var OP_ZaloAdsPostZaapiDeletead = {
1400
+ "operationId": "ZaloAds_postZaapiDeletead",
1401
+ "method": "POST",
1402
+ "endpoint": "/zaapi/deleteAd",
1431
1403
  "baseUrl": "https://ads.zalo.me",
1432
1404
  "binaryFields": [],
1433
1405
  "pathFields": [],
1434
- "queryFields": [],
1406
+ "queryFields": [
1407
+ "adId"
1408
+ ],
1435
1409
  "headerFields": [],
1436
1410
  "cookieFields": [],
1437
- "bodyFields": []
1411
+ "bodyFields": [
1412
+ "adId"
1413
+ ]
1438
1414
  };
1439
- var OP_ZaloAdsGetApiNotifiesHeader = {
1440
- "operationId": "ZaloAds_getApiNotifiesHeader",
1441
- "method": "GET",
1442
- "endpoint": "/api/notifies/header",
1415
+ var OP_ZaloAdsRenameCampaign = {
1416
+ "operationId": "ZaloAds_renameCampaign",
1417
+ "method": "POST",
1418
+ "endpoint": "/api/campaign/change-name",
1443
1419
  "baseUrl": "https://ads.zalo.me",
1444
1420
  "binaryFields": [],
1445
1421
  "pathFields": [],
1446
1422
  "queryFields": [],
1447
1423
  "headerFields": [],
1448
1424
  "cookieFields": [],
1449
- "bodyFields": []
1425
+ "bodyFields": [
1426
+ "campid",
1427
+ "newname"
1428
+ ]
1450
1429
  };
1451
- var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1452
- "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1453
- "method": "GET",
1454
- "endpoint": "/api/payment/transaction-history",
1430
+ var OP_ZaloAdsUpdateEcommerceAd = {
1431
+ "operationId": "ZaloAds_updateEcommerceAd",
1432
+ "method": "POST",
1433
+ "endpoint": "/zaapi/UpdateAd",
1455
1434
  "baseUrl": "https://ads.zalo.me",
1456
1435
  "binaryFields": [],
1457
1436
  "pathFields": [],
1458
- "queryFields": [
1459
- "to",
1460
- "from",
1461
- "memberId"
1462
- ],
1437
+ "queryFields": [],
1463
1438
  "headerFields": [],
1464
1439
  "cookieFields": [],
1465
- "bodyFields": []
1440
+ "bodyFields": [
1441
+ "est",
1442
+ "stt",
1443
+ "data",
1444
+ "isBoostAd"
1445
+ ]
1466
1446
  };
1467
- var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1468
- "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1469
- "method": "GET",
1470
- "endpoint": "/api/place/getAllDistricts",
1447
+ var OP_ZaloAdsUpdateFormAd = {
1448
+ "operationId": "ZaloAds_updateFormAd",
1449
+ "method": "POST",
1450
+ "endpoint": "/zaapi/UpdateAd",
1471
1451
  "baseUrl": "https://ads.zalo.me",
1472
1452
  "binaryFields": [],
1473
1453
  "pathFields": [],
1474
1454
  "queryFields": [],
1475
1455
  "headerFields": [],
1476
1456
  "cookieFields": [],
1477
- "bodyFields": []
1457
+ "bodyFields": [
1458
+ "est",
1459
+ "stt",
1460
+ "data",
1461
+ "isBoostAd"
1462
+ ]
1478
1463
  };
1479
- var OP_ZaloAdsGetApiSpellCheckV2 = {
1480
- "operationId": "ZaloAds_getApiSpellCheckV2",
1481
- "method": "GET",
1482
- "endpoint": "/api/spell-check/v2",
1464
+ var OP_ZaloAdsUpdateMessageAd = {
1465
+ "operationId": "ZaloAds_updateMessageAd",
1466
+ "method": "POST",
1467
+ "endpoint": "/zaapi/UpdateAd",
1483
1468
  "baseUrl": "https://ads.zalo.me",
1484
1469
  "binaryFields": [],
1485
1470
  "pathFields": [],
1486
1471
  "queryFields": [],
1487
1472
  "headerFields": [],
1488
1473
  "cookieFields": [],
1489
- "bodyFields": []
1490
- };
1491
- var OP_ZaloAdsGetApiWhoami = {
1492
- "operationId": "ZaloAds_getApiWhoami",
1493
- "method": "GET",
1494
- "endpoint": "/api/whoami",
1495
- "baseUrl": "https://ads.zalo.me",
1496
- "binaryFields": [],
1497
- "pathFields": [],
1498
- "queryFields": [],
1499
- "headerFields": [],
1500
- "cookieFields": [],
1501
- "bodyFields": []
1502
- };
1503
- var OP_ZaloAdsGetReportapiV2Ads = {
1504
- "operationId": "ZaloAds_getReportapiV2Ads",
1505
- "method": "GET",
1506
- "endpoint": "/reportapi/v2/ads",
1507
- "baseUrl": "https://ads.zalo.me",
1508
- "binaryFields": [],
1509
- "pathFields": [],
1510
- "queryFields": [
1511
- "to",
1512
- "from",
1513
- "filter",
1514
- "endDate",
1515
- "refresh",
1516
- "breakdown",
1517
- "startDate"
1518
- ],
1519
- "headerFields": [],
1520
- "cookieFields": [],
1521
- "bodyFields": []
1474
+ "bodyFields": [
1475
+ "est",
1476
+ "stt",
1477
+ "data",
1478
+ "isBoostAd"
1479
+ ]
1522
1480
  };
1523
- var OP_ZaloAdsGetReportapiV2Campaigns = {
1524
- "operationId": "ZaloAds_getReportapiV2Campaigns",
1525
- "method": "GET",
1526
- "endpoint": "/reportapi/v2/campaigns/{campaignId}",
1481
+ var OP_ZaloAdsUpdateNewAds = {
1482
+ "operationId": "ZaloAds_UpdateNewAds",
1483
+ "method": "POST",
1484
+ "endpoint": "/zaapi/UploadCrop",
1527
1485
  "baseUrl": "https://ads.zalo.me",
1528
- "binaryFields": [],
1529
- "pathFields": [
1530
- "campaignId"
1531
- ],
1532
- "queryFields": [
1533
- "startDate",
1534
- "endDate",
1535
- "refresh"
1486
+ "binaryFields": [
1487
+ "File"
1536
1488
  ],
1537
- "headerFields": [],
1538
- "cookieFields": [],
1539
- "bodyFields": []
1540
- };
1541
- var OP_ZaloAdsGetReportapiV2UniqueUser = {
1542
- "operationId": "ZaloAds_getReportapiV2UniqueUser",
1543
- "method": "GET",
1544
- "endpoint": "/reportapi/v2/unique-user",
1545
- "baseUrl": "https://ads.zalo.me",
1546
- "binaryFields": [],
1547
1489
  "pathFields": [],
1548
1490
  "queryFields": [],
1549
1491
  "headerFields": [],
1550
1492
  "cookieFields": [],
1551
- "bodyFields": []
1552
- };
1553
- var OP_ZaloAdsGetReportapiV3Campaigns = {
1554
- "operationId": "ZaloAds_getReportapiV3Campaigns",
1555
- "method": "GET",
1556
- "endpoint": "/reportapi/v3/campaigns",
1557
- "baseUrl": "https://ads.zalo.me",
1558
- "binaryFields": [],
1559
- "pathFields": [],
1560
- "queryFields": [
1561
- "filter",
1562
- "endDate",
1563
- "refresh",
1564
- "agencyId",
1565
- "createdBy",
1566
- "startDate"
1567
- ],
1568
- "headerFields": [],
1569
- "cookieFields": [],
1570
- "bodyFields": []
1571
- };
1572
- var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
1573
- "operationId": "ZaloAds_getZaapiCampaignReportcampaign",
1574
- "method": "GET",
1575
- "endpoint": "/zaapi/Campaign/reportCampaign",
1576
- "baseUrl": "https://ads.zalo.me",
1577
- "binaryFields": [],
1578
- "pathFields": [],
1579
- "queryFields": [
1580
- "campaignId",
1581
- "campId"
1582
- ],
1583
- "headerFields": [],
1584
- "cookieFields": [],
1585
- "bodyFields": []
1586
- };
1587
- var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1588
- "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1589
- "method": "GET",
1590
- "endpoint": "/zaapi/checkCampHasManyAds",
1591
- "baseUrl": "https://ads.zalo.me",
1592
- "binaryFields": [],
1593
- "pathFields": [],
1594
- "queryFields": [
1595
- "campaignId",
1596
- "campId"
1597
- ],
1598
- "headerFields": [],
1599
- "cookieFields": [],
1600
- "bodyFields": []
1493
+ "bodyFields": [
1494
+ "File",
1495
+ "x",
1496
+ "y",
1497
+ "width",
1498
+ "height",
1499
+ "scale"
1500
+ ]
1601
1501
  };
1602
- var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1603
- "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1604
- "method": "GET",
1605
- "endpoint": "/zaapi/getAdsFromCampaignId",
1502
+ var OP_ZaloAdsUpdateOfficialAccountAd = {
1503
+ "operationId": "ZaloAds_updateOfficialAccountAd",
1504
+ "method": "POST",
1505
+ "endpoint": "/zaapi/UpdateAd",
1606
1506
  "baseUrl": "https://ads.zalo.me",
1607
1507
  "binaryFields": [],
1608
1508
  "pathFields": [],
1609
- "queryFields": [
1610
- "campaignId",
1611
- "campId"
1612
- ],
1509
+ "queryFields": [],
1613
1510
  "headerFields": [],
1614
1511
  "cookieFields": [],
1615
- "bodyFields": []
1512
+ "bodyFields": [
1513
+ "est",
1514
+ "stt",
1515
+ "data",
1516
+ "isBoostAd"
1517
+ ]
1616
1518
  };
1617
- var OP_ZaloAdsGetZaapiGetallpages = {
1618
- "operationId": "ZaloAds_getZaapiGetallpages",
1619
- "method": "GET",
1620
- "endpoint": "/zaapi/getAllPages",
1519
+ var OP_ZaloAdsUpdatePostAd = {
1520
+ "operationId": "ZaloAds_updatePostAd",
1521
+ "method": "POST",
1522
+ "endpoint": "/zaapi/UpdateAd",
1621
1523
  "baseUrl": "https://ads.zalo.me",
1622
1524
  "binaryFields": [],
1623
1525
  "pathFields": [],
1624
1526
  "queryFields": [],
1625
1527
  "headerFields": [],
1626
1528
  "cookieFields": [],
1627
- "bodyFields": []
1529
+ "bodyFields": [
1530
+ "est",
1531
+ "stt",
1532
+ "data",
1533
+ "isBoostAd"
1534
+ ]
1628
1535
  };
1629
- var OP_ZaloAdsGetZaapiGetownedarticles = {
1630
- "operationId": "ZaloAds_getZaapiGetownedarticles",
1631
- "method": "GET",
1632
- "endpoint": "/zaapi/getOwnedArticles",
1536
+ var OP_ZaloAdsCreateWebsiteCampaign = {
1537
+ "operationId": "ZaloAds_createWebsiteCampaign",
1538
+ "method": "POST",
1539
+ "endpoint": "/zaapi/addNewCamp",
1633
1540
  "baseUrl": "https://ads.zalo.me",
1634
1541
  "binaryFields": [],
1635
1542
  "pathFields": [],
1636
- "queryFields": [
1637
- "pageId",
1638
- "oaId"
1639
- ],
1543
+ "queryFields": [],
1640
1544
  "headerFields": [],
1641
1545
  "cookieFields": [],
1642
- "bodyFields": []
1546
+ "bodyFields": [
1547
+ "data"
1548
+ ]
1643
1549
  };
1644
- var OP_ZaloAdsGetZaapiGetownedpages = {
1645
- "operationId": "ZaloAds_getZaapiGetownedpages",
1646
- "method": "GET",
1647
- "endpoint": "/zaapi/getOwnedPages",
1550
+ var OP_ZaloAdsUpdateWebsiteAd = {
1551
+ "operationId": "ZaloAds_updateWebsiteAd",
1552
+ "method": "POST",
1553
+ "endpoint": "/zaapi/UpdateAd",
1648
1554
  "baseUrl": "https://ads.zalo.me",
1649
1555
  "binaryFields": [],
1650
1556
  "pathFields": [],
1651
1557
  "queryFields": [],
1652
1558
  "headerFields": [],
1653
1559
  "cookieFields": [],
1654
- "bodyFields": []
1560
+ "bodyFields": [
1561
+ "est",
1562
+ "stt",
1563
+ "data",
1564
+ "isBoostAd"
1565
+ ]
1655
1566
  };
1656
- var OP_ZaloAdsListAgencyCustomersWithBudget = {
1657
- "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1658
- "method": "GET",
1659
- "endpoint": "/api/ba/agency/customersWithBudget",
1567
+ var OP_ZaloAdsCreateDisplayCampaign = {
1568
+ "operationId": "ZaloAds_createDisplayCampaign",
1569
+ "method": "POST",
1570
+ "endpoint": "/zaapi/addNewCamp",
1660
1571
  "baseUrl": "https://ads.zalo.me",
1661
1572
  "binaryFields": [],
1662
1573
  "pathFields": [],
1663
- "queryFields": [
1664
- "limit",
1665
- "offset",
1666
- "joinDateAsc"
1667
- ],
1574
+ "queryFields": [],
1668
1575
  "headerFields": [],
1669
1576
  "cookieFields": [],
1670
- "bodyFields": []
1577
+ "bodyFields": [
1578
+ "data"
1579
+ ]
1671
1580
  };
1672
- var OP_ZaloAdsListCustomReports = {
1673
- "operationId": "ZaloAds_listCustomReports",
1674
- "method": "GET",
1675
- "endpoint": "/reportapi/custom-report/list",
1581
+ var OP_ZaloAdsUpdateDisplayAd = {
1582
+ "operationId": "ZaloAds_updateDisplayAd",
1583
+ "method": "POST",
1584
+ "endpoint": "/zaapi/UpdateAd",
1676
1585
  "baseUrl": "https://ads.zalo.me",
1677
1586
  "binaryFields": [],
1678
1587
  "pathFields": [],
1679
1588
  "queryFields": [],
1680
1589
  "headerFields": [],
1681
1590
  "cookieFields": [],
1682
- "bodyFields": []
1591
+ "bodyFields": [
1592
+ "est",
1593
+ "stt",
1594
+ "data",
1595
+ "isBoostAd"
1596
+ ]
1683
1597
  };
1684
- var OP_ZaloAdsListFormsByOfficialAccount = {
1685
- "operationId": "ZaloAds_listFormsByOfficialAccount",
1686
- "method": "GET",
1687
- "endpoint": "/api/form/getByOaId",
1598
+ var OP_ZaloAdsCreateVideoCampaign = {
1599
+ "operationId": "ZaloAds_createVideoCampaign",
1600
+ "method": "POST",
1601
+ "endpoint": "/zaapi/addNewCamp",
1688
1602
  "baseUrl": "https://ads.zalo.me",
1689
1603
  "binaryFields": [],
1690
1604
  "pathFields": [],
1691
- "queryFields": [
1692
- "oaId",
1693
- "isAll"
1694
- ],
1605
+ "queryFields": [],
1695
1606
  "headerFields": [],
1696
1607
  "cookieFields": [],
1697
- "bodyFields": []
1608
+ "bodyFields": [
1609
+ "data"
1610
+ ]
1698
1611
  };
1699
- var OP_ZaloAdsListMiniPagesByTemplate = {
1700
- "operationId": "ZaloAds_listMiniPagesByTemplate",
1701
- "method": "GET",
1702
- "endpoint": "/api/mini-pages",
1612
+ var OP_ZaloAdsDeleteCampaign = {
1613
+ "operationId": "ZaloAds_deleteCampaign",
1614
+ "method": "POST",
1615
+ "endpoint": "/api/campaign/change-status",
1703
1616
  "baseUrl": "https://ads.zalo.me",
1704
1617
  "binaryFields": [],
1705
1618
  "pathFields": [],
1706
- "queryFields": [
1707
- "templateIds"
1708
- ],
1619
+ "queryFields": [],
1709
1620
  "headerFields": [],
1710
1621
  "cookieFields": [],
1711
- "bodyFields": []
1622
+ "bodyFields": [
1623
+ "campaignId",
1624
+ "status"
1625
+ ]
1712
1626
  };
1713
- var OP_ZaloAdsListPersonalPixelLabels = {
1714
- "operationId": "ZaloAds_listPersonalPixelLabels",
1627
+ var ZaloCampaignsService = class {
1628
+ constructor(client) {
1629
+ this.client = client;
1630
+ }
1631
+ updateVideoAd(request, options) {
1632
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
1633
+ }
1634
+ changeCampaignStatus(request, options) {
1635
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
1636
+ }
1637
+ deleteCampaign(request, options) {
1638
+ const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
1639
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
1640
+ }
1641
+ createWebsiteCampaign(request, options) {
1642
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
1643
+ }
1644
+ updateWebsiteAd(request, options) {
1645
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
1646
+ }
1647
+ createDisplayCampaign(request, options) {
1648
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
1649
+ }
1650
+ updateDisplayAd(request, options) {
1651
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
1652
+ }
1653
+ createVideoCampaign(request, options) {
1654
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, request), options);
1655
+ }
1656
+ createEcommerceCampaign(request, options) {
1657
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
1658
+ }
1659
+ /** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
1660
+ createCommerceCampaign(request, options) {
1661
+ return this.createEcommerceCampaign(request, options);
1662
+ }
1663
+ createForm(request, options) {
1664
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
1665
+ }
1666
+ createFormCampaign(request, options) {
1667
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
1668
+ }
1669
+ createMessageCampaign(request, options) {
1670
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
1671
+ }
1672
+ createOfficialAccountCampaign(request, options) {
1673
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
1674
+ }
1675
+ /** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
1676
+ createOaCampaign(request, options) {
1677
+ return this.createOfficialAccountCampaign(request, options);
1678
+ }
1679
+ createPostCampaign(request, options) {
1680
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
1681
+ }
1682
+ /** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
1683
+ createArticleCampaign(request, options) {
1684
+ return this.createPostCampaign(request, options);
1685
+ }
1686
+ getAdById(request = {}, options) {
1687
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
1688
+ }
1689
+ getAdChangeLog(request, options) {
1690
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
1691
+ }
1692
+ getApiPlaceGetalldistricts(request = {}, options) {
1693
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
1694
+ }
1695
+ getApiSpellCheckV2(request, options) {
1696
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
1697
+ }
1698
+ getZaapiCheckcamphasmanyads(request = {}, options) {
1699
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
1700
+ }
1701
+ getZaapiGetadsfromcampaignid(request = {}, options) {
1702
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
1703
+ }
1704
+ getZaapiGetallpages(request = {}, options) {
1705
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
1706
+ }
1707
+ getAllPages(request = {}, options) {
1708
+ return this.getZaapiGetallpages(request, options);
1709
+ }
1710
+ getZaapiGetownedarticles(request, options) {
1711
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
1712
+ }
1713
+ getOwnedArticles(request, options) {
1714
+ return this.getZaapiGetownedarticles(request, options);
1715
+ }
1716
+ getZaapiGetownedpages(request = {}, options) {
1717
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
1718
+ }
1719
+ getOwnedPages(request = {}, options) {
1720
+ return this.getZaapiGetownedpages(request, options);
1721
+ }
1722
+ listFormsByOfficialAccount(request, options) {
1723
+ return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
1724
+ }
1725
+ listMiniPagesByTemplate(request, options) {
1726
+ return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, request), options);
1727
+ }
1728
+ postZaapiDeletead(request = {}, options) {
1729
+ return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
1730
+ }
1731
+ renameCampaign(request, options) {
1732
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
1733
+ }
1734
+ updateEcommerceAd(request, options) {
1735
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
1736
+ }
1737
+ /** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
1738
+ updateCommerceAd(request, options) {
1739
+ return this.updateEcommerceAd(request, options);
1740
+ }
1741
+ updateFormAd(request, options) {
1742
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
1743
+ }
1744
+ updateMessageAd(request, options) {
1745
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
1746
+ }
1747
+ updateNewAds(request, options) {
1748
+ return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
1749
+ }
1750
+ updateOfficialAccountAd(request, options) {
1751
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
1752
+ }
1753
+ /** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
1754
+ updateOaAd(request, options) {
1755
+ return this.updateOfficialAccountAd(request, options);
1756
+ }
1757
+ updatePostAd(request, options) {
1758
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
1759
+ }
1760
+ /** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
1761
+ updateArticleAd(request, options) {
1762
+ return this.updatePostAd(request, options);
1763
+ }
1764
+ /** Xóa quảng cáo */
1765
+ deleteAd(...args) {
1766
+ return this.postZaapiDeletead(...args);
1767
+ }
1768
+ /** Danh sách quận/huyện để nhắm mục tiêu */
1769
+ getAllDistricts(...args) {
1770
+ return this.getApiPlaceGetalldistricts(...args);
1771
+ }
1772
+ /** Kiểm tra chính tả văn bản quảng cáo */
1773
+ getSpellCheckV2(...args) {
1774
+ return this.getApiSpellCheckV2(...args);
1775
+ }
1776
+ };
1777
+
1778
+ // src/services/account.service.ts
1779
+ var OP_ZaloAdsGetApiWhoami = {
1780
+ "operationId": "ZaloAds_getApiWhoami",
1715
1781
  "method": "GET",
1716
- "endpoint": "/api/conversion/support-personal-pixel-labels",
1782
+ "endpoint": "/api/whoami",
1717
1783
  "baseUrl": "https://ads.zalo.me",
1718
1784
  "binaryFields": [],
1719
1785
  "pathFields": [],
@@ -1722,165 +1788,150 @@ var OP_ZaloAdsListPersonalPixelLabels = {
1722
1788
  "cookieFields": [],
1723
1789
  "bodyFields": []
1724
1790
  };
1725
- var OP_ZaloAdsPostApiAdEstimateaudience = {
1726
- "operationId": "ZaloAds_postApiAdEstimateaudience",
1727
- "method": "POST",
1728
- "endpoint": "/api/ad/estimateAudience",
1729
- "baseUrl": "https://ads.zalo.me",
1730
- "binaryFields": [],
1731
- "pathFields": [],
1732
- "queryFields": [],
1733
- "headerFields": [],
1734
- "cookieFields": [],
1735
- "bodyFields": [
1736
- "gender",
1737
- "number",
1738
- "ageRanges",
1739
- "locations",
1740
- "platforms",
1741
- "priceType",
1742
- "provinces",
1743
- "wardsTargeting",
1744
- "districtsTargeting"
1745
- ]
1746
- };
1747
- var OP_ZaloAdsPostApiMediaSave = {
1748
- "operationId": "ZaloAds_postApiMediaSave",
1749
- "method": "POST",
1750
- "endpoint": "/api/media/save",
1791
+ var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1792
+ "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1793
+ "method": "GET",
1794
+ "endpoint": "/api/payment/transaction-history",
1751
1795
  "baseUrl": "https://ads.zalo.me",
1752
1796
  "binaryFields": [],
1753
1797
  "pathFields": [],
1754
- "queryFields": [],
1755
- "headerFields": [],
1756
- "cookieFields": [],
1757
- "bodyFields": [
1758
- "data"
1759
- ]
1760
- };
1761
- var OP_ZaloAdsPostApiMemberUploadImage = {
1762
- "operationId": "ZaloAds_postApiMemberUploadImage",
1763
- "method": "POST",
1764
- "endpoint": "/api/member/upload-image",
1765
- "baseUrl": "https://ads.zalo.me",
1766
- "binaryFields": [
1767
- "file"
1798
+ "queryFields": [
1799
+ "to",
1800
+ "from",
1801
+ "memberId"
1768
1802
  ],
1769
- "pathFields": [],
1770
- "queryFields": [],
1771
1803
  "headerFields": [],
1772
1804
  "cookieFields": [],
1773
- "bodyFields": [
1774
- "file"
1775
- ]
1805
+ "bodyFields": []
1776
1806
  };
1777
- var OP_ZaloAdsPostZaapiDeletead = {
1778
- "operationId": "ZaloAds_postZaapiDeletead",
1779
- "method": "POST",
1780
- "endpoint": "/zaapi/deleteAd",
1807
+ var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1808
+ "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1809
+ "method": "GET",
1810
+ "endpoint": "/api/ba/account/allAccessors",
1781
1811
  "baseUrl": "https://ads.zalo.me",
1782
1812
  "binaryFields": [],
1783
1813
  "pathFields": [],
1784
1814
  "queryFields": [
1785
- "adId"
1815
+ "isShowAll"
1786
1816
  ],
1787
1817
  "headerFields": [],
1788
1818
  "cookieFields": [],
1789
- "bodyFields": [
1790
- "adId"
1791
- ]
1819
+ "bodyFields": []
1792
1820
  };
1793
- var OP_ZaloAdsRenameCampaign = {
1794
- "operationId": "ZaloAds_renameCampaign",
1795
- "method": "POST",
1796
- "endpoint": "/api/campaign/change-name",
1821
+ var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1822
+ "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1823
+ "method": "GET",
1824
+ "endpoint": "/api/ba/account/allGrantedMembers",
1797
1825
  "baseUrl": "https://ads.zalo.me",
1798
1826
  "binaryFields": [],
1799
1827
  "pathFields": [],
1800
1828
  "queryFields": [],
1801
1829
  "headerFields": [],
1802
1830
  "cookieFields": [],
1803
- "bodyFields": [
1804
- "campid",
1805
- "newname"
1806
- ]
1831
+ "bodyFields": []
1807
1832
  };
1808
- var OP_ZaloAdsUpdateEcommerceAd = {
1809
- "operationId": "ZaloAds_updateEcommerceAd",
1810
- "method": "POST",
1811
- "endpoint": "/zaapi/UpdateAd",
1833
+ var OP_ZaloAdsListAgencyCustomersWithBudget = {
1834
+ "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1835
+ "method": "GET",
1836
+ "endpoint": "/api/ba/agency/customersWithBudget",
1812
1837
  "baseUrl": "https://ads.zalo.me",
1813
1838
  "binaryFields": [],
1814
1839
  "pathFields": [],
1815
- "queryFields": [],
1840
+ "queryFields": [
1841
+ "limit",
1842
+ "offset",
1843
+ "joinDateAsc"
1844
+ ],
1816
1845
  "headerFields": [],
1817
1846
  "cookieFields": [],
1818
- "bodyFields": [
1819
- "est",
1820
- "stt",
1821
- "data",
1822
- "isBoostAd"
1823
- ]
1847
+ "bodyFields": []
1824
1848
  };
1825
- var OP_ZaloAdsUpdateFormAd = {
1826
- "operationId": "ZaloAds_updateFormAd",
1827
- "method": "POST",
1828
- "endpoint": "/zaapi/UpdateAd",
1849
+ var OP_ZaloAdsGetApiNotifiesHeader = {
1850
+ "operationId": "ZaloAds_getApiNotifiesHeader",
1851
+ "method": "GET",
1852
+ "endpoint": "/api/notifies/header",
1829
1853
  "baseUrl": "https://ads.zalo.me",
1830
1854
  "binaryFields": [],
1831
1855
  "pathFields": [],
1832
1856
  "queryFields": [],
1833
1857
  "headerFields": [],
1834
1858
  "cookieFields": [],
1835
- "bodyFields": [
1836
- "est",
1837
- "stt",
1838
- "data",
1839
- "isBoostAd"
1840
- ]
1859
+ "bodyFields": []
1841
1860
  };
1842
- var OP_ZaloAdsUpdateMessageAd = {
1843
- "operationId": "ZaloAds_updateMessageAd",
1844
- "method": "POST",
1845
- "endpoint": "/zaapi/UpdateAd",
1861
+ var OP_ZaloAdsGetApiLpNews = {
1862
+ "operationId": "ZaloAds_getApiLpNews",
1863
+ "method": "GET",
1864
+ "endpoint": "/api/lp-news",
1846
1865
  "baseUrl": "https://ads.zalo.me",
1847
1866
  "binaryFields": [],
1848
1867
  "pathFields": [],
1849
1868
  "queryFields": [],
1850
1869
  "headerFields": [],
1851
1870
  "cookieFields": [],
1852
- "bodyFields": [
1853
- "est",
1854
- "stt",
1855
- "data",
1856
- "isBoostAd"
1857
- ]
1871
+ "bodyFields": []
1858
1872
  };
1859
- var OP_ZaloAdsUpdateNewAds = {
1860
- "operationId": "ZaloAds_UpdateNewAds",
1861
- "method": "POST",
1862
- "endpoint": "/zaapi/UploadCrop",
1863
- "baseUrl": "https://ads.zalo.me",
1864
- "binaryFields": [
1865
- "File"
1866
- ],
1867
- "pathFields": [],
1868
- "queryFields": [],
1869
- "headerFields": [],
1870
- "cookieFields": [],
1871
- "bodyFields": [
1872
- "File",
1873
- "x",
1874
- "y",
1875
- "width",
1876
- "height",
1877
- "scale"
1878
- ]
1873
+ var ZaloAccountService = class {
1874
+ constructor(client) {
1875
+ this.client = client;
1876
+ }
1877
+ getApiWhoami(request = {}, options) {
1878
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiWhoami, this.client.toTransportInput(OP_ZaloAdsGetApiWhoami, request), options);
1879
+ }
1880
+ getApiPaymentTransactionHistory(request, options) {
1881
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiPaymentTransactionHistory, this.client.toTransportInput(OP_ZaloAdsGetApiPaymentTransactionHistory, request), options);
1882
+ }
1883
+ getApiBaAccountAllaccessors(request = {}, options) {
1884
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
1885
+ }
1886
+ getApiBaAccountAllgrantedmembers(request = {}, options) {
1887
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
1888
+ }
1889
+ listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
1890
+ const normalized = {
1891
+ limit: 15,
1892
+ offset: 0,
1893
+ joinDateAsc: true,
1894
+ ...request
1895
+ };
1896
+ return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
1897
+ }
1898
+ getApiNotifiesHeader(request = {}, options) {
1899
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
1900
+ }
1901
+ getApiLpNews(request = {}, options) {
1902
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
1903
+ }
1904
+ /** Lấy thông tin tài khoản đang đăng nhập */
1905
+ getWhoami(...args) {
1906
+ return this.getApiWhoami(...args);
1907
+ }
1908
+ /** Lịch sử giao dịch thanh toán */
1909
+ getPaymentTransactionHistory(...args) {
1910
+ return this.getApiPaymentTransactionHistory(...args);
1911
+ }
1912
+ /** Danh sách accessor tài khoản BA */
1913
+ getBaAccountAllAccessors(...args) {
1914
+ return this.getApiBaAccountAllaccessors(...args);
1915
+ }
1916
+ /** Danh sách thành viên được cấp quyền BA */
1917
+ getBaAccountAllGrantedMembers(...args) {
1918
+ return this.getApiBaAccountAllgrantedmembers(...args);
1919
+ }
1920
+ /** Thông báo trên thanh tiêu đề */
1921
+ getNotifiesHeader(...args) {
1922
+ return this.getApiNotifiesHeader(...args);
1923
+ }
1924
+ /** Tin tức landing page / bảng tin */
1925
+ getLpNews(...args) {
1926
+ return this.getApiLpNews(...args);
1927
+ }
1879
1928
  };
1880
- var OP_ZaloAdsUpdateOfficialAccountAd = {
1881
- "operationId": "ZaloAds_updateOfficialAccountAd",
1929
+
1930
+ // src/services/audiences.service.ts
1931
+ var OP_ZaloAdsCreateCustomAudience = {
1932
+ "operationId": "ZaloAds_createCustomAudience",
1882
1933
  "method": "POST",
1883
- "endpoint": "/zaapi/UpdateAd",
1934
+ "endpoint": "/api/ad/audience",
1884
1935
  "baseUrl": "https://ads.zalo.me",
1885
1936
  "binaryFields": [],
1886
1937
  "pathFields": [],
@@ -1888,64 +1939,55 @@ var OP_ZaloAdsUpdateOfficialAccountAd = {
1888
1939
  "headerFields": [],
1889
1940
  "cookieFields": [],
1890
1941
  "bodyFields": [
1891
- "est",
1892
- "stt",
1893
- "data",
1894
- "isBoostAd"
1942
+ "name",
1943
+ "caType",
1944
+ "targeting"
1895
1945
  ]
1896
1946
  };
1897
- var OP_ZaloAdsUpdatePostAd = {
1898
- "operationId": "ZaloAds_updatePostAd",
1899
- "method": "POST",
1900
- "endpoint": "/zaapi/UpdateAd",
1947
+ var OP_ZaloAdsDeleteCustomAudience = {
1948
+ "operationId": "ZaloAds_deleteCustomAudience",
1949
+ "method": "DELETE",
1950
+ "endpoint": "/api/ad/audience/{customAudienceId}",
1901
1951
  "baseUrl": "https://ads.zalo.me",
1902
1952
  "binaryFields": [],
1903
- "pathFields": [],
1953
+ "pathFields": [
1954
+ "customAudienceId"
1955
+ ],
1904
1956
  "queryFields": [],
1905
1957
  "headerFields": [],
1906
1958
  "cookieFields": [],
1907
- "bodyFields": [
1908
- "est",
1909
- "stt",
1910
- "data",
1911
- "isBoostAd"
1912
- ]
1959
+ "bodyFields": []
1913
1960
  };
1914
- var OP_ZaloAdsCreateWebsiteCampaign = {
1915
- "operationId": "ZaloAds_createWebsiteCampaign",
1916
- "method": "POST",
1917
- "endpoint": "/zaapi/addNewCamp",
1961
+ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1962
+ "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
1963
+ "method": "GET",
1964
+ "endpoint": "/api/ad/getListAdAdvanceTargeting",
1918
1965
  "baseUrl": "https://ads.zalo.me",
1919
1966
  "binaryFields": [],
1920
1967
  "pathFields": [],
1921
1968
  "queryFields": [],
1922
1969
  "headerFields": [],
1923
1970
  "cookieFields": [],
1924
- "bodyFields": [
1925
- "data"
1926
- ]
1971
+ "bodyFields": []
1927
1972
  };
1928
- var OP_ZaloAdsUpdateWebsiteAd = {
1929
- "operationId": "ZaloAds_updateWebsiteAd",
1930
- "method": "POST",
1931
- "endpoint": "/zaapi/UpdateAd",
1973
+ var OP_ZaloAdsGetApiCustomAudienceAll = {
1974
+ "operationId": "ZaloAds_getApiCustomAudienceAll",
1975
+ "method": "GET",
1976
+ "endpoint": "/api/custom-audience/all",
1932
1977
  "baseUrl": "https://ads.zalo.me",
1933
1978
  "binaryFields": [],
1934
1979
  "pathFields": [],
1935
- "queryFields": [],
1980
+ "queryFields": [
1981
+ "newWard"
1982
+ ],
1936
1983
  "headerFields": [],
1937
1984
  "cookieFields": [],
1938
- "bodyFields": [
1939
- "est",
1940
- "stt",
1941
- "data",
1942
- "isBoostAd"
1943
- ]
1985
+ "bodyFields": []
1944
1986
  };
1945
- var OP_ZaloAdsCreateDisplayCampaign = {
1946
- "operationId": "ZaloAds_createDisplayCampaign",
1987
+ var OP_ZaloAdsPostApiAdEstimateaudience = {
1988
+ "operationId": "ZaloAds_postApiAdEstimateaudience",
1947
1989
  "method": "POST",
1948
- "endpoint": "/zaapi/addNewCamp",
1990
+ "endpoint": "/api/ad/estimateAudience",
1949
1991
  "baseUrl": "https://ads.zalo.me",
1950
1992
  "binaryFields": [],
1951
1993
  "pathFields": [],
@@ -1953,190 +1995,292 @@ var OP_ZaloAdsCreateDisplayCampaign = {
1953
1995
  "headerFields": [],
1954
1996
  "cookieFields": [],
1955
1997
  "bodyFields": [
1956
- "data"
1998
+ "gender",
1999
+ "number",
2000
+ "ageRanges",
2001
+ "locations",
2002
+ "platforms",
2003
+ "priceType",
2004
+ "provinces",
2005
+ "wardsTargeting",
2006
+ "districtsTargeting"
1957
2007
  ]
1958
2008
  };
1959
- var OP_ZaloAdsUpdateDisplayAd = {
1960
- "operationId": "ZaloAds_updateDisplayAd",
2009
+ var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2010
+ "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
1961
2011
  "method": "POST",
1962
- "endpoint": "/zaapi/UpdateAd",
2012
+ "endpoint": "/zaapi/uploadPhoneList",
1963
2013
  "baseUrl": "https://ads.zalo.me",
1964
- "binaryFields": [],
2014
+ "binaryFields": [
2015
+ "File"
2016
+ ],
1965
2017
  "pathFields": [],
1966
2018
  "queryFields": [],
1967
2019
  "headerFields": [],
1968
2020
  "cookieFields": [],
1969
2021
  "bodyFields": [
1970
- "est",
1971
- "stt",
1972
- "data",
1973
- "isBoostAd"
2022
+ "File",
2023
+ "isHash"
1974
2024
  ]
1975
2025
  };
1976
- var OP_ZaloAdsCreateVideoCampaign = {
1977
- "operationId": "ZaloAds_createVideoCampaign",
1978
- "method": "POST",
1979
- "endpoint": "/zaapi/addNewCamp",
2026
+ var ZaloAudiencesService = class {
2027
+ constructor(client) {
2028
+ this.client = client;
2029
+ }
2030
+ postApiAdEstimateaudience(request, options) {
2031
+ return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
2032
+ }
2033
+ getApiAdGetlistadadvancetargeting(request = {}, options) {
2034
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
2035
+ }
2036
+ getApiCustomAudienceAll(request = {}, options) {
2037
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
2038
+ }
2039
+ createCustomAudience(request, options) {
2040
+ return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
2041
+ }
2042
+ deleteCustomAudience(request, options) {
2043
+ return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
2044
+ }
2045
+ uploadCustomAudiencePhoneList(request, options) {
2046
+ return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
2047
+ }
2048
+ /** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
2049
+ createSavedAudience(request, options) {
2050
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2051
+ return this.createCustomAudience(
2052
+ {
2053
+ name: request.name,
2054
+ caType: 1,
2055
+ targeting: targetingStr
2056
+ },
2057
+ options
2058
+ );
2059
+ }
2060
+ /** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
2061
+ createPhoneAudience(request, options) {
2062
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2063
+ return this.createCustomAudience({ name: request.name, caType: 3, targeting: targetingStr }, options);
2064
+ }
2065
+ /** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
2066
+ createLookalikeAudience(request, options) {
2067
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2068
+ return this.createCustomAudience({ name: request.name, caType: 6, targeting: targetingStr }, options);
2069
+ }
2070
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
2071
+ createFormEventAudience(request, options) {
2072
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2073
+ return this.createCustomAudience({ name: request.name, caType: 12, targeting: targetingStr }, options);
2074
+ }
2075
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn OA (`caType = 11` - `MESSAGE_AUDIENCE`). */
2076
+ createMessageOaEventAudience(request, options) {
2077
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2078
+ return this.createCustomAudience({ name: request.name, caType: 11, targeting: targetingStr }, options);
2079
+ }
2080
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn cá nhân (`caType = 14` - `MESSAGE_PERSONAL_EVENT_AUDIENCE`). */
2081
+ createMessagePersonalEventAudience(request, options) {
2082
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2083
+ return this.createCustomAudience({ name: request.name, caType: 14, targeting: targetingStr }, options);
2084
+ }
2085
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
2086
+ createFormLeadAudience(request, options) {
2087
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2088
+ return this.createCustomAudience({ name: request.name, caType: 10, targeting: targetingStr }, options);
2089
+ }
2090
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
2091
+ createCommerceFormAudience(request, options) {
2092
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2093
+ return this.createCustomAudience({ name: request.name, caType: 15, targeting: targetingStr }, options);
2094
+ }
2095
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Kịch bản Tin nhắn OA (`caType = 13` - `MESSAGE_OA_AUDIENCE`). */
2096
+ createMessageOaLeadAudience(request, options) {
2097
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2098
+ return this.createCustomAudience({ name: request.name, caType: 13, targeting: targetingStr }, options);
2099
+ }
2100
+ /** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
2101
+ createLeadSignalAudience(request, options) {
2102
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2103
+ return this.createCustomAudience({ name: request.name, caType: 16, targeting: targetingStr }, options);
2104
+ }
2105
+ /** Ước tính quy mô đối tượng tiếp cận */
2106
+ estimateAudience(...args) {
2107
+ return this.postApiAdEstimateaudience(...args);
2108
+ }
2109
+ /** Danh sách toàn bộ nhóm đối tượng tùy chỉnh */
2110
+ listCustomAudiences(...args) {
2111
+ return this.getApiCustomAudienceAll(...args);
2112
+ }
2113
+ /** Danh sách cấu hình nhắm mục tiêu nâng cao */
2114
+ getListAdAdvanceTargeting(...args) {
2115
+ return this.getApiAdGetlistadadvancetargeting(...args);
2116
+ }
2117
+ };
2118
+
2119
+ // src/services/reports.service.ts
2120
+ var OP_ZaloAdsGetReportapiV2Ads = {
2121
+ "operationId": "ZaloAds_getReportapiV2Ads",
2122
+ "method": "GET",
2123
+ "endpoint": "/reportapi/v2/ads",
1980
2124
  "baseUrl": "https://ads.zalo.me",
1981
2125
  "binaryFields": [],
1982
2126
  "pathFields": [],
1983
- "queryFields": [],
2127
+ "queryFields": [
2128
+ "to",
2129
+ "from",
2130
+ "filter",
2131
+ "endDate",
2132
+ "refresh",
2133
+ "breakdown",
2134
+ "startDate"
2135
+ ],
1984
2136
  "headerFields": [],
1985
2137
  "cookieFields": [],
1986
- "bodyFields": [
1987
- "data"
1988
- ]
2138
+ "bodyFields": []
1989
2139
  };
1990
- var OP_ZaloAdsDeleteCampaign = {
1991
- "operationId": "ZaloAds_deleteCampaign",
1992
- "method": "POST",
1993
- "endpoint": "/api/campaign/change-status",
2140
+ var OP_ZaloAdsGetReportapiV2Campaigns = {
2141
+ "operationId": "ZaloAds_getReportapiV2Campaigns",
2142
+ "method": "GET",
2143
+ "endpoint": "/reportapi/v2/campaigns/{campaignId}",
1994
2144
  "baseUrl": "https://ads.zalo.me",
1995
2145
  "binaryFields": [],
1996
- "pathFields": [],
1997
- "queryFields": [],
2146
+ "pathFields": [
2147
+ "campaignId"
2148
+ ],
2149
+ "queryFields": [
2150
+ "startDate",
2151
+ "endDate",
2152
+ "refresh"
2153
+ ],
1998
2154
  "headerFields": [],
1999
2155
  "cookieFields": [],
2000
- "bodyFields": [
2001
- "campaignId",
2002
- "status"
2003
- ]
2156
+ "bodyFields": []
2004
2157
  };
2005
- var OP_ZaloAdsListAutomatedRules = {
2006
- "operationId": "ZaloAds_listAutomatedRules",
2158
+ var OP_ZaloAdsGetReportapiV2UniqueUser = {
2159
+ "operationId": "ZaloAds_getReportapiV2UniqueUser",
2007
2160
  "method": "GET",
2008
- "endpoint": "/api/automatedrules/list",
2161
+ "endpoint": "/reportapi/v2/unique-user",
2009
2162
  "baseUrl": "https://ads.zalo.me",
2010
2163
  "binaryFields": [],
2011
2164
  "pathFields": [],
2012
2165
  "queryFields": [
2013
- "ruleName"
2166
+ "start",
2167
+ "end",
2168
+ "campaignId",
2169
+ "adId"
2014
2170
  ],
2015
2171
  "headerFields": [],
2016
2172
  "cookieFields": [],
2017
2173
  "bodyFields": []
2018
2174
  };
2019
- var OP_ZaloAdsCreateAutomatedRule = {
2020
- "operationId": "ZaloAds_createAutomatedRule",
2021
- "method": "POST",
2022
- "endpoint": "/api/automatedrules/create",
2175
+ var OP_ZaloAdsGetReportapiV3Campaigns = {
2176
+ "operationId": "ZaloAds_getReportapiV3Campaigns",
2177
+ "method": "GET",
2178
+ "endpoint": "/reportapi/v3/campaigns",
2023
2179
  "baseUrl": "https://ads.zalo.me",
2024
2180
  "binaryFields": [],
2025
2181
  "pathFields": [],
2026
- "queryFields": [],
2027
- "headerFields": [],
2182
+ "queryFields": [
2183
+ "filter",
2184
+ "endDate",
2185
+ "refresh",
2186
+ "agencyId",
2187
+ "createdBy",
2188
+ "startDate"
2189
+ ],
2190
+ "headerFields": [],
2028
2191
  "cookieFields": [],
2029
- "bodyFields": [
2030
- "scope",
2031
- "appliedTo",
2032
- "ruleName",
2033
- "action",
2034
- "conditions",
2035
- "frequency",
2036
- "appliedIds",
2037
- "schedule",
2038
- "campaignIds",
2039
- "adIds"
2040
- ]
2192
+ "bodyFields": []
2041
2193
  };
2042
- var OP_ZaloAdsUpdateAutomatedRule = {
2043
- "operationId": "ZaloAds_updateAutomatedRule",
2044
- "method": "POST",
2045
- "endpoint": "/api/automatedrules/update",
2194
+ var OP_ZaloAdsGetReportOverview = {
2195
+ "operationId": "ZaloAds_getReportOverview",
2196
+ "method": "GET",
2197
+ "endpoint": "/reportapi/report/overview",
2046
2198
  "baseUrl": "https://ads.zalo.me",
2047
2199
  "binaryFields": [],
2048
2200
  "pathFields": [],
2049
- "queryFields": [],
2201
+ "queryFields": [
2202
+ "data"
2203
+ ],
2050
2204
  "headerFields": [],
2051
2205
  "cookieFields": [],
2052
- "bodyFields": [
2053
- "automatedRuleId",
2054
- "rowVersion",
2055
- "appliedTo",
2056
- "ruleName",
2057
- "action",
2058
- "conditions",
2059
- "schedule",
2060
- "campaignIds",
2061
- "adIds"
2062
- ]
2206
+ "bodyFields": []
2063
2207
  };
2064
- var OP_ZaloAdsChangeAutomatedRuleStatus = {
2065
- "operationId": "ZaloAds_changeAutomatedRuleStatus",
2066
- "method": "POST",
2067
- "endpoint": "/api/automatedrules/change-status",
2208
+ var OP_ZaloAdsGetDemographicsReport = {
2209
+ "operationId": "ZaloAds_getDemographicsReport",
2210
+ "method": "GET",
2211
+ "endpoint": "/api/demographics/report",
2068
2212
  "baseUrl": "https://ads.zalo.me",
2069
2213
  "binaryFields": [],
2070
2214
  "pathFields": [],
2071
- "queryFields": [],
2215
+ "queryFields": [
2216
+ "campaignId",
2217
+ "adId",
2218
+ "startDate",
2219
+ "endDate",
2220
+ "agencyId",
2221
+ "from",
2222
+ "to"
2223
+ ],
2072
2224
  "headerFields": [],
2073
2225
  "cookieFields": [],
2074
- "bodyFields": [
2075
- "automatedRuleId",
2076
- "automatedRuleIds",
2077
- "status"
2078
- ]
2226
+ "bodyFields": []
2079
2227
  };
2080
- var OP_ZaloAdsGetAutomatedRuleHistory = {
2081
- "operationId": "ZaloAds_getAutomatedRuleHistory",
2082
- "method": "GET",
2083
- "endpoint": "/api/automatedrules/history/{automatedRuleId}",
2228
+ var OP_ZaloAdsDeleteCustomReport = {
2229
+ "operationId": "ZaloAds_deleteCustomReport",
2230
+ "method": "POST",
2231
+ "endpoint": "/reportapi/custom-report/delete/{id}",
2084
2232
  "baseUrl": "https://ads.zalo.me",
2085
2233
  "binaryFields": [],
2086
2234
  "pathFields": [
2087
- "automatedRuleId"
2235
+ "id"
2088
2236
  ],
2089
2237
  "queryFields": [],
2090
2238
  "headerFields": [],
2091
2239
  "cookieFields": [],
2092
2240
  "bodyFields": []
2093
2241
  };
2094
- var OP_ZaloAdsDeleteAutomatedRule = {
2095
- "operationId": "ZaloAds_deleteAutomatedRule",
2096
- "method": "POST",
2097
- "endpoint": "/api/automatedrules/delete",
2242
+ var OP_ZaloAdsListReportFilters = {
2243
+ "operationId": "ZaloAds_listReportFilters",
2244
+ "method": "GET",
2245
+ "endpoint": "/reportapi/api/filter/list",
2098
2246
  "baseUrl": "https://ads.zalo.me",
2099
2247
  "binaryFields": [],
2100
2248
  "pathFields": [],
2101
- "queryFields": [],
2249
+ "queryFields": [
2250
+ "model"
2251
+ ],
2102
2252
  "headerFields": [],
2103
2253
  "cookieFields": [],
2104
- "bodyFields": [
2105
- "automatedRuleIds"
2106
- ]
2254
+ "bodyFields": []
2107
2255
  };
2108
- var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2109
- "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
2110
- "method": "POST",
2111
- "endpoint": "/zaapi/uploadPhoneList",
2256
+ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
2257
+ "operationId": "ZaloAds_getZaapiCampaignReportcampaign",
2258
+ "method": "GET",
2259
+ "endpoint": "/zaapi/Campaign/reportCampaign",
2112
2260
  "baseUrl": "https://ads.zalo.me",
2113
- "binaryFields": [
2114
- "File"
2115
- ],
2261
+ "binaryFields": [],
2116
2262
  "pathFields": [],
2117
- "queryFields": [],
2263
+ "queryFields": [
2264
+ "campaignId",
2265
+ "campId",
2266
+ "from",
2267
+ "to"
2268
+ ],
2118
2269
  "headerFields": [],
2119
2270
  "cookieFields": [],
2120
- "bodyFields": [
2121
- "File",
2122
- "isHash"
2123
- ]
2271
+ "bodyFields": []
2124
2272
  };
2125
- var OP_ZaloAdsUploadVideo = {
2126
- "operationId": "ZaloAds_uploadVideo",
2127
- "method": "POST",
2128
- "endpoint": "/api/member/upload-video",
2273
+ var OP_ZaloAdsListCustomReports = {
2274
+ "operationId": "ZaloAds_listCustomReports",
2275
+ "method": "GET",
2276
+ "endpoint": "/reportapi/custom-report/list",
2129
2277
  "baseUrl": "https://ads.zalo.me",
2130
- "binaryFields": [
2131
- "File"
2132
- ],
2278
+ "binaryFields": [],
2133
2279
  "pathFields": [],
2134
2280
  "queryFields": [],
2135
2281
  "headerFields": [],
2136
2282
  "cookieFields": [],
2137
- "bodyFields": [
2138
- "File"
2139
- ]
2283
+ "bodyFields": []
2140
2284
  };
2141
2285
  var OP_ZaloAdsUpsertCustomReport = {
2142
2286
  "operationId": "ZaloAds_upsertCustomReport",
@@ -2155,76 +2299,320 @@ var OP_ZaloAdsUpsertCustomReport = {
2155
2299
  "isDefault"
2156
2300
  ]
2157
2301
  };
2158
- var ZaloAdsService = class {
2302
+ var ZaloReportsService = class {
2159
2303
  constructor(client) {
2160
2304
  this.client = client;
2161
2305
  }
2162
- updateVideoAd(request, options) {
2163
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
2306
+ getReportapiV2Ads(request, options) {
2307
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
2164
2308
  }
2165
- createFlow(request, options) {
2166
- return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
2309
+ getReportapiV2Campaigns(request = {}, options) {
2310
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
2167
2311
  }
2168
- updateFlow(request, options) {
2169
- return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
2312
+ getReportapiV2UniqueUser(request, options) {
2313
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
2170
2314
  }
2171
- listFlowsByOfficialAccount(request, options) {
2172
- return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
2315
+ getReportapiV3Campaigns(request, options) {
2316
+ const normalized = {
2317
+ filter: "[]",
2318
+ agencyId: 0,
2319
+ ...request
2320
+ };
2321
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
2173
2322
  }
2174
- changeCampaignStatus(request, options) {
2175
- return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
2323
+ getReportOverview(request, options) {
2324
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportOverview, this.client.toTransportInput(OP_ZaloAdsGetReportOverview, request), options);
2176
2325
  }
2177
- deleteCampaign(request, options) {
2178
- const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
2179
- return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
2326
+ getDemographicsReport(request, options) {
2327
+ return this.client.requestWithoutBody(OP_ZaloAdsGetDemographicsReport, this.client.toTransportInput(OP_ZaloAdsGetDemographicsReport, request), options);
2180
2328
  }
2181
- createCustomAudience(request, options) {
2182
- return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
2329
+ getZaapiCampaignReportcampaign(request, options) {
2330
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
2183
2331
  }
2184
- createWebsiteCampaign(request, options) {
2185
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
2332
+ listCustomReports(request = {}, options) {
2333
+ return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
2186
2334
  }
2187
- updateWebsiteAd(request, options) {
2188
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
2335
+ upsertCustomReport(request, options) {
2336
+ return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
2189
2337
  }
2190
- createDisplayCampaign(request, options) {
2191
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
2338
+ deleteCustomReport(request, options) {
2339
+ return this.client.requestJson(OP_ZaloAdsDeleteCustomReport, this.client.toTransportInput(OP_ZaloAdsDeleteCustomReport, request), options);
2192
2340
  }
2193
- updateDisplayAd(request, options) {
2194
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
2341
+ listReportFilters(request, options) {
2342
+ return this.client.requestWithoutBody(OP_ZaloAdsListReportFilters, this.client.toTransportInput(OP_ZaloAdsListReportFilters, request), options);
2195
2343
  }
2196
- createVideoCampaign(request, options) {
2197
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, request), options);
2344
+ /** Báo cáo hiệu quả chiến dịch (API V3 - Khuyên dùng) */
2345
+ getCampaignReportV3(...args) {
2346
+ return this.getReportapiV3Campaigns(...args);
2198
2347
  }
2199
- createEcommerceCampaign(request, options) {
2200
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
2348
+ /** Báo cáo hiệu quả chiến dịch (API V2) */
2349
+ getCampaignReportV2(...args) {
2350
+ return this.getReportapiV2Campaigns(...args);
2201
2351
  }
2202
- /** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
2203
- createCommerceCampaign(request, options) {
2204
- return this.createEcommerceCampaign(request, options);
2352
+ /** Báo cáo hiệu quả quảng cáo (API V2) */
2353
+ getAdsReportV2(...args) {
2354
+ return this.getReportapiV2Ads(...args);
2205
2355
  }
2206
- createForm(request, options) {
2207
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
2356
+ /** Báo cáo người dùng tiếp cận duy nhất (Unique Reach) */
2357
+ getUniqueUserReport(...args) {
2358
+ return this.getReportapiV2UniqueUser(...args);
2208
2359
  }
2209
- createFormCampaign(request, options) {
2210
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
2360
+ /** Báo cáo chiến dịch theo ngày/tháng (Legacy ZAAPI) */
2361
+ getCampaignReportLegacy(...args) {
2362
+ return this.getZaapiCampaignReportcampaign(...args);
2211
2363
  }
2212
- createMessageCampaign(request, options) {
2213
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
2364
+ };
2365
+
2366
+ // src/services/conversions.service.ts
2367
+ var OP_ZaloAdsCreateConversion = {
2368
+ "operationId": "ZaloAds_createConversion",
2369
+ "method": "POST",
2370
+ "endpoint": "/api/conversion/add",
2371
+ "baseUrl": "https://ads.zalo.me",
2372
+ "binaryFields": [],
2373
+ "pathFields": [],
2374
+ "queryFields": [],
2375
+ "headerFields": [],
2376
+ "cookieFields": [],
2377
+ "bodyFields": [
2378
+ "name",
2379
+ "landingPage",
2380
+ "urlType",
2381
+ "labelId",
2382
+ "buttonIds",
2383
+ "elements",
2384
+ "keywords"
2385
+ ]
2386
+ };
2387
+ var OP_ZaloAdsDeleteConversion = {
2388
+ "operationId": "ZaloAds_deleteConversion",
2389
+ "method": "DELETE",
2390
+ "endpoint": "/api/conversion/delete/{conversionId}",
2391
+ "baseUrl": "https://ads.zalo.me",
2392
+ "binaryFields": [],
2393
+ "pathFields": [
2394
+ "conversionId"
2395
+ ],
2396
+ "queryFields": [],
2397
+ "headerFields": [],
2398
+ "cookieFields": [],
2399
+ "bodyFields": []
2400
+ };
2401
+ var OP_ZaloAdsGetApiConversionAll = {
2402
+ "operationId": "ZaloAds_getApiConversionAll",
2403
+ "method": "GET",
2404
+ "endpoint": "/api/conversion/all",
2405
+ "baseUrl": "https://ads.zalo.me",
2406
+ "binaryFields": [],
2407
+ "pathFields": [],
2408
+ "queryFields": [],
2409
+ "headerFields": [],
2410
+ "cookieFields": [],
2411
+ "bodyFields": []
2412
+ };
2413
+ var OP_ZaloAdsGetApiConversionStandardEvents = {
2414
+ "operationId": "ZaloAds_getApiConversionStandardEvents",
2415
+ "method": "GET",
2416
+ "endpoint": "/api/conversion/standard-events",
2417
+ "baseUrl": "https://ads.zalo.me",
2418
+ "binaryFields": [],
2419
+ "pathFields": [],
2420
+ "queryFields": [],
2421
+ "headerFields": [],
2422
+ "cookieFields": [],
2423
+ "bodyFields": []
2424
+ };
2425
+ var OP_ZaloAdsListPersonalPixelLabels = {
2426
+ "operationId": "ZaloAds_listPersonalPixelLabels",
2427
+ "method": "GET",
2428
+ "endpoint": "/api/conversion/support-personal-pixel-labels",
2429
+ "baseUrl": "https://ads.zalo.me",
2430
+ "binaryFields": [],
2431
+ "pathFields": [],
2432
+ "queryFields": [],
2433
+ "headerFields": [],
2434
+ "cookieFields": [],
2435
+ "bodyFields": []
2436
+ };
2437
+ var ZaloConversionsService = class {
2438
+ constructor(client) {
2439
+ this.client = client;
2214
2440
  }
2215
- createOfficialAccountCampaign(request, options) {
2216
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
2441
+ createConversion(request, options) {
2442
+ return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
2217
2443
  }
2218
- /** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
2219
- createOaCampaign(request, options) {
2220
- return this.createOfficialAccountCampaign(request, options);
2444
+ deleteConversion(request, options) {
2445
+ return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
2221
2446
  }
2222
- createPostCampaign(request, options) {
2223
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
2447
+ getApiConversionAll(request = {}, options) {
2448
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
2224
2449
  }
2225
- /** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
2226
- createArticleCampaign(request, options) {
2227
- return this.createPostCampaign(request, options);
2450
+ getApiConversionStandardEvents(request = {}, options) {
2451
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
2452
+ }
2453
+ listPersonalPixelLabels(request = {}, options) {
2454
+ return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, request), options);
2455
+ }
2456
+ /** Lấy danh sách tài khoản Zalo Official Account (OA) có dữ liệu chuyển đổi (Lead Signal) (`GET /api/ad/audience/leadSignal/oas`). */
2457
+ listLeadSignalOas(options) {
2458
+ return this.client.requestWithoutBody(
2459
+ {
2460
+ operationId: "ZaloAds_listLeadSignalOas",
2461
+ method: "GET",
2462
+ endpoint: "/api/ad/audience/leadSignal/oas",
2463
+ baseUrl: "https://ads.zalo.me",
2464
+ binaryFields: [],
2465
+ pathFields: [],
2466
+ queryFields: [],
2467
+ headerFields: [],
2468
+ cookieFields: [],
2469
+ bodyFields: []
2470
+ },
2471
+ void 0,
2472
+ options
2473
+ );
2474
+ }
2475
+ /** Lấy danh sách rút gọn gồm ID và tên của toàn bộ các sự kiện chuyển đổi (Conversion) đã tạo trên tài khoản quảng cáo Zalo Ads (`GET /api/conversion/names`). */
2476
+ listConversionNames(request = {}, options) {
2477
+ const op = {
2478
+ operationId: "ZaloAds_listConversionNames",
2479
+ method: "GET",
2480
+ endpoint: "/api/conversion/names",
2481
+ baseUrl: "https://ads.zalo.me",
2482
+ binaryFields: [],
2483
+ pathFields: [],
2484
+ queryFields: [],
2485
+ headerFields: [],
2486
+ cookieFields: [],
2487
+ bodyFields: []
2488
+ };
2489
+ return this.client.requestWithoutBody(
2490
+ op,
2491
+ this.client.toTransportInput(op, request),
2492
+ options
2493
+ );
2494
+ }
2495
+ /** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
2496
+ getApiConversionNames(request = {}, options) {
2497
+ return this.listConversionNames(request, options);
2498
+ }
2499
+ /** Danh sách toàn bộ sự kiện chuyển đổi */
2500
+ listConversions(...args) {
2501
+ return this.getApiConversionAll(...args);
2502
+ }
2503
+ /** Danh sách sự kiện chuyển đổi tiêu chuẩn */
2504
+ getConversionStandardEvents(...args) {
2505
+ return this.getApiConversionStandardEvents(...args);
2506
+ }
2507
+ };
2508
+
2509
+ // src/services/automated-rules.service.ts
2510
+ var OP_ZaloAdsListAutomatedRules = {
2511
+ "operationId": "ZaloAds_listAutomatedRules",
2512
+ "method": "GET",
2513
+ "endpoint": "/api/automatedrules/list",
2514
+ "baseUrl": "https://ads.zalo.me",
2515
+ "binaryFields": [],
2516
+ "pathFields": [],
2517
+ "queryFields": [
2518
+ "ruleName"
2519
+ ],
2520
+ "headerFields": [],
2521
+ "cookieFields": [],
2522
+ "bodyFields": []
2523
+ };
2524
+ var OP_ZaloAdsCreateAutomatedRule = {
2525
+ "operationId": "ZaloAds_createAutomatedRule",
2526
+ "method": "POST",
2527
+ "endpoint": "/api/automatedrules/create",
2528
+ "baseUrl": "https://ads.zalo.me",
2529
+ "binaryFields": [],
2530
+ "pathFields": [],
2531
+ "queryFields": [],
2532
+ "headerFields": [],
2533
+ "cookieFields": [],
2534
+ "bodyFields": [
2535
+ "scope",
2536
+ "appliedTo",
2537
+ "ruleName",
2538
+ "action",
2539
+ "conditions",
2540
+ "frequency",
2541
+ "appliedIds",
2542
+ "schedule",
2543
+ "campaignIds",
2544
+ "adIds"
2545
+ ]
2546
+ };
2547
+ var OP_ZaloAdsUpdateAutomatedRule = {
2548
+ "operationId": "ZaloAds_updateAutomatedRule",
2549
+ "method": "POST",
2550
+ "endpoint": "/api/automatedrules/update",
2551
+ "baseUrl": "https://ads.zalo.me",
2552
+ "binaryFields": [],
2553
+ "pathFields": [],
2554
+ "queryFields": [],
2555
+ "headerFields": [],
2556
+ "cookieFields": [],
2557
+ "bodyFields": [
2558
+ "automatedRuleId",
2559
+ "rowVersion",
2560
+ "appliedTo",
2561
+ "ruleName",
2562
+ "action",
2563
+ "conditions",
2564
+ "schedule",
2565
+ "campaignIds",
2566
+ "adIds"
2567
+ ]
2568
+ };
2569
+ var OP_ZaloAdsChangeAutomatedRuleStatus = {
2570
+ "operationId": "ZaloAds_changeAutomatedRuleStatus",
2571
+ "method": "POST",
2572
+ "endpoint": "/api/automatedrules/change-status",
2573
+ "baseUrl": "https://ads.zalo.me",
2574
+ "binaryFields": [],
2575
+ "pathFields": [],
2576
+ "queryFields": [],
2577
+ "headerFields": [],
2578
+ "cookieFields": [],
2579
+ "bodyFields": [
2580
+ "automatedRuleId",
2581
+ "automatedRuleIds",
2582
+ "status"
2583
+ ]
2584
+ };
2585
+ var OP_ZaloAdsGetAutomatedRuleHistory = {
2586
+ "operationId": "ZaloAds_getAutomatedRuleHistory",
2587
+ "method": "GET",
2588
+ "endpoint": "/api/automatedrules/history/{automatedRuleId}",
2589
+ "baseUrl": "https://ads.zalo.me",
2590
+ "binaryFields": [],
2591
+ "pathFields": [
2592
+ "automatedRuleId"
2593
+ ],
2594
+ "queryFields": [],
2595
+ "headerFields": [],
2596
+ "cookieFields": [],
2597
+ "bodyFields": []
2598
+ };
2599
+ var OP_ZaloAdsDeleteAutomatedRule = {
2600
+ "operationId": "ZaloAds_deleteAutomatedRule",
2601
+ "method": "POST",
2602
+ "endpoint": "/api/automatedrules/delete",
2603
+ "baseUrl": "https://ads.zalo.me",
2604
+ "binaryFields": [],
2605
+ "pathFields": [],
2606
+ "queryFields": [],
2607
+ "headerFields": [],
2608
+ "cookieFields": [],
2609
+ "bodyFields": [
2610
+ "automatedRuleIds"
2611
+ ]
2612
+ };
2613
+ var ZaloAutomatedRulesService = class {
2614
+ constructor(client) {
2615
+ this.client = client;
2228
2616
  }
2229
2617
  listAutomatedRules(request = {}, options) {
2230
2618
  const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
@@ -2239,175 +2627,937 @@ var ZaloAdsService = class {
2239
2627
  changeAutomatedRuleStatus(request, options) {
2240
2628
  return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
2241
2629
  }
2242
- getAutomatedRuleHistory(request, options) {
2243
- return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
2630
+ getAutomatedRuleHistory(request, options) {
2631
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
2632
+ }
2633
+ deleteAutomatedRule(request, options) {
2634
+ return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
2635
+ }
2636
+ };
2637
+
2638
+ // src/services/flows.service.ts
2639
+ var OP_ZaloAdsListFlowsByOfficialAccount = {
2640
+ operationId: "ZaloAds_listFlowsByOfficialAccount",
2641
+ method: "GET",
2642
+ endpoint: "/api/flow/getByOaId",
2643
+ baseUrl: "https://ads.zalo.me",
2644
+ binaryFields: [],
2645
+ pathFields: [],
2646
+ queryFields: ["oaId", "limit", "offset", "flowId"],
2647
+ headerFields: [],
2648
+ cookieFields: [],
2649
+ bodyFields: []
2650
+ };
2651
+ var OP_ZaloAdsCreateFlow = {
2652
+ operationId: "ZaloAds_createFlow",
2653
+ method: "POST",
2654
+ endpoint: "/api/flow/create",
2655
+ baseUrl: "https://ads.zalo.me",
2656
+ binaryFields: [],
2657
+ pathFields: [],
2658
+ queryFields: [],
2659
+ headerFields: [],
2660
+ cookieFields: [],
2661
+ bodyFields: ["oaId", "id", "name", "messages"]
2662
+ };
2663
+ var OP_ZaloAdsUpdateFlow = {
2664
+ operationId: "ZaloAds_updateFlow",
2665
+ method: "POST",
2666
+ endpoint: "/api/flow/update",
2667
+ baseUrl: "https://ads.zalo.me",
2668
+ binaryFields: [],
2669
+ pathFields: [],
2670
+ queryFields: [],
2671
+ headerFields: [],
2672
+ cookieFields: [],
2673
+ bodyFields: ["oaId", "id", "name", "messages"]
2674
+ };
2675
+ var ZaloFlowsService = class {
2676
+ constructor(client) {
2677
+ this.client = client;
2678
+ }
2679
+ listFlowsByOfficialAccount(request, options) {
2680
+ return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
2681
+ }
2682
+ createFlow(request, options) {
2683
+ return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
2684
+ }
2685
+ updateFlow(request, options) {
2686
+ return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
2687
+ }
2688
+ };
2689
+
2690
+ // src/services/media.service.ts
2691
+ var OP_ZaloAdsGetApiMediaItems = {
2692
+ operationId: "ZaloAds_getApiMediaItems",
2693
+ method: "GET",
2694
+ endpoint: "/api/media/items",
2695
+ baseUrl: "https://ads.zalo.me",
2696
+ binaryFields: [],
2697
+ pathFields: [],
2698
+ queryFields: ["endDate", "startDate"],
2699
+ headerFields: [],
2700
+ cookieFields: [],
2701
+ bodyFields: []
2702
+ };
2703
+ var OP_ZaloAdsGetApiMemberFiles = {
2704
+ operationId: "ZaloAds_getApiMemberFiles",
2705
+ method: "GET",
2706
+ endpoint: "/api/member/files",
2707
+ baseUrl: "https://ads.zalo.me",
2708
+ binaryFields: [],
2709
+ pathFields: [],
2710
+ queryFields: [],
2711
+ headerFields: [],
2712
+ cookieFields: [],
2713
+ bodyFields: []
2714
+ };
2715
+ var OP_ZaloAdsGetApiFilegroups = {
2716
+ operationId: "ZaloAds_getApiFilegroups",
2717
+ method: "GET",
2718
+ endpoint: "/api/filegroups",
2719
+ baseUrl: "https://ads.zalo.me",
2720
+ binaryFields: [],
2721
+ pathFields: [],
2722
+ queryFields: [],
2723
+ headerFields: [],
2724
+ cookieFields: [],
2725
+ bodyFields: []
2726
+ };
2727
+ var OP_ZaloAdsPostApiMediaSave = {
2728
+ operationId: "ZaloAds_postApiMediaSave",
2729
+ method: "POST",
2730
+ endpoint: "/api/media/save",
2731
+ baseUrl: "https://ads.zalo.me",
2732
+ binaryFields: [],
2733
+ pathFields: [],
2734
+ queryFields: [],
2735
+ headerFields: [],
2736
+ cookieFields: [],
2737
+ bodyFields: ["data"]
2738
+ };
2739
+ var OP_ZaloAdsPostApiMemberUploadImage = {
2740
+ operationId: "ZaloAds_postApiMemberUploadImage",
2741
+ method: "POST",
2742
+ endpoint: "/api/member/upload-image",
2743
+ baseUrl: "https://ads.zalo.me",
2744
+ binaryFields: ["File"],
2745
+ pathFields: [],
2746
+ queryFields: [],
2747
+ headerFields: [],
2748
+ cookieFields: [],
2749
+ bodyFields: ["File"]
2750
+ };
2751
+ var OP_ZaloAdsUploadVideo = {
2752
+ operationId: "ZaloAds_uploadVideo",
2753
+ method: "POST",
2754
+ endpoint: "/api/member/upload-video",
2755
+ baseUrl: "https://ads.zalo.me",
2756
+ binaryFields: ["File"],
2757
+ pathFields: [],
2758
+ queryFields: [],
2759
+ headerFields: [],
2760
+ cookieFields: [],
2761
+ bodyFields: ["File"]
2762
+ };
2763
+ var OP_ZaloAdsUpdateNewAds2 = {
2764
+ operationId: "ZaloAds_UpdateNewAds",
2765
+ method: "POST",
2766
+ endpoint: "/zaapi/UploadCrop",
2767
+ baseUrl: "https://ads.zalo.me",
2768
+ binaryFields: ["File"],
2769
+ pathFields: [],
2770
+ queryFields: [],
2771
+ headerFields: [],
2772
+ cookieFields: [],
2773
+ bodyFields: ["File", "x", "y", "width", "height", "scale"]
2774
+ };
2775
+ function extractJpegDimensions(buffer) {
2776
+ let i = 2;
2777
+ while (i < buffer.length - 8) {
2778
+ if (buffer[i] !== 255) {
2779
+ i++;
2780
+ continue;
2781
+ }
2782
+ const marker = buffer[i + 1];
2783
+ if (marker === 192 || marker === 193 || marker === 194) {
2784
+ const height = buffer[i + 5] << 8 | buffer[i + 6];
2785
+ const width = buffer[i + 7] << 8 | buffer[i + 8];
2786
+ return { width, height };
2787
+ }
2788
+ const len = buffer[i + 2] << 8 | buffer[i + 3];
2789
+ i += 2 + len;
2790
+ }
2791
+ return null;
2792
+ }
2793
+ function extractPngDimensions(buffer) {
2794
+ if (buffer.length >= 24 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71) {
2795
+ const width = buffer[16] << 24 | buffer[17] << 16 | buffer[18] << 8 | buffer[19];
2796
+ const height = buffer[20] << 24 | buffer[21] << 16 | buffer[22] << 8 | buffer[23];
2797
+ return { width, height };
2798
+ }
2799
+ return null;
2800
+ }
2801
+ function isUint8Array(val) {
2802
+ if (val instanceof Uint8Array) {
2803
+ return true;
2804
+ }
2805
+ if (typeof val === "object" && val !== null && typeof val.constructor?.isBuffer === "function") {
2806
+ return val.constructor.isBuffer(val);
2807
+ }
2808
+ return false;
2809
+ }
2810
+ function resolveFileName(input, defaultPrefix = "media") {
2811
+ if (typeof input === "string") {
2812
+ const clean = input.split(/[?#]/)[0];
2813
+ const match = clean.match(/[^/\\]+$/);
2814
+ if (match && match[0]) return match[0];
2815
+ }
2816
+ if (input && typeof input === "object") {
2817
+ const record = input;
2818
+ if (typeof record.name === "string" && record.name) return record.name;
2819
+ if (typeof record.originalname === "string" && record.originalname) return record.originalname;
2820
+ if (typeof record.fileName === "string" && record.fileName) return record.fileName;
2821
+ }
2822
+ return `${defaultPrefix}_${Date.now()}.jpg`;
2823
+ }
2824
+ var ZaloMediaService = class {
2825
+ constructor(client) {
2826
+ this.client = client;
2827
+ }
2828
+ // ==========================================================================
2829
+ // 1. RAW API METHODS (Chuẩn theo OpenAPI spec media-and-assets, không validate)
2830
+ // ==========================================================================
2831
+ /**
2832
+ * Lấy danh sách ảnh, video trong thư viện Zalo Ads theo khoảng thời gian (`GET /api/media/items`).
2833
+ */
2834
+ getApiMediaItems(request, options) {
2835
+ return this.client.requestWithoutBody(
2836
+ OP_ZaloAdsGetApiMediaItems,
2837
+ this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request),
2838
+ options
2839
+ );
2840
+ }
2841
+ /**
2842
+ * Alias cho `getApiMediaItems`.
2843
+ */
2844
+ listMediaItems(request, options) {
2845
+ return this.getApiMediaItems(request, options);
2846
+ }
2847
+ /**
2848
+ * Lấy các tệp do thành viên hiện tại quản lý trong tài khoản quảng cáo (`GET /api/member/files`).
2849
+ */
2850
+ getApiMemberFiles(request = {}, options) {
2851
+ return this.client.requestWithoutBody(
2852
+ OP_ZaloAdsGetApiMemberFiles,
2853
+ this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request),
2854
+ options
2855
+ );
2856
+ }
2857
+ /**
2858
+ * Alias cho `getApiMemberFiles`.
2859
+ */
2860
+ listMemberFiles(request = {}, options) {
2861
+ return this.getApiMemberFiles(request, options);
2862
+ }
2863
+ /**
2864
+ * Lấy danh sách nhóm tệp trong kho media (`GET /api/filegroups`).
2865
+ */
2866
+ getApiFilegroups(request = {}, options) {
2867
+ return this.client.requestWithoutBody(
2868
+ OP_ZaloAdsGetApiFilegroups,
2869
+ this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request),
2870
+ options
2871
+ );
2872
+ }
2873
+ /**
2874
+ * Alias cho `getApiFilegroups`.
2875
+ */
2876
+ listFilegroups(request = {}, options) {
2877
+ return this.getApiFilegroups(request, options);
2878
+ }
2879
+ /**
2880
+ * Lưu tài nguyên media vào thư viện Zalo Ads sau khi đã có URL ảnh/video và metadata (`POST /api/media/save`).
2881
+ * Phản hồi trả về `{ code: 0, data: <MediaId> }`.
2882
+ */
2883
+ postApiMediaSave(request, options) {
2884
+ const normalized = {
2885
+ ...request,
2886
+ data: typeof request.data === "string" ? request.data : JSON.stringify(request.data)
2887
+ };
2888
+ return this.client.requestFormUrlEncoded(
2889
+ OP_ZaloAdsPostApiMediaSave,
2890
+ this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, normalized),
2891
+ options
2892
+ );
2893
+ }
2894
+ /**
2895
+ * Alias cho `postApiMediaSave`.
2896
+ */
2897
+ saveMedia(request, options) {
2898
+ return this.postApiMediaSave(request, options);
2899
+ }
2900
+ /**
2901
+ * Tải ảnh lên kho media của tài khoản quảng cáo (`POST /api/member/upload-image`).
2902
+ * Sử dụng multipart/form-data với trường `File` (chữ hoa). Trả về URL CDN Adtima.
2903
+ */
2904
+ postApiMemberUploadImage(request, options) {
2905
+ const file = request.File ?? request.file;
2906
+ if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
2907
+ throw new ZaloSdkError(
2908
+ "\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer t\u1EEB Multer), Web Blob/File ho\u1EB7c URL \u1EA3nh c\xF4ng khai (http/https).",
2909
+ 400,
2910
+ "postApiMemberUploadImage",
2911
+ null
2912
+ );
2913
+ }
2914
+ const normalized = {
2915
+ File: file
2916
+ };
2917
+ return this.client.requestMultipart(
2918
+ OP_ZaloAdsPostApiMemberUploadImage,
2919
+ this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized),
2920
+ options
2921
+ );
2922
+ }
2923
+ /**
2924
+ * Alias cho `postApiMemberUploadImage`.
2925
+ */
2926
+ uploadImage(request, options) {
2927
+ return this.postApiMemberUploadImage(request, options);
2928
+ }
2929
+ /**
2930
+ * Tải video lên kho media của tài khoản quảng cáo (`POST /api/member/upload-video`).
2931
+ * Định dạng chuẩn .MP4 (H.264), tối đa 150MB. Trả về URL video trên Adtima CDN.
2932
+ */
2933
+ uploadVideo(request, options) {
2934
+ const file = request.File ?? request.file;
2935
+ if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
2936
+ throw new ZaloSdkError(
2937
+ "\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer), Web Blob/File ho\u1EB7c URL video c\xF4ng khai (http/https).",
2938
+ 400,
2939
+ "uploadVideo",
2940
+ null
2941
+ );
2942
+ }
2943
+ const normalized = {
2944
+ File: file
2945
+ };
2946
+ return this.client.requestMultipart(
2947
+ OP_ZaloAdsUploadVideo,
2948
+ this.client.toTransportInput(OP_ZaloAdsUploadVideo, normalized),
2949
+ options
2950
+ );
2951
+ }
2952
+ /**
2953
+ * Tải ảnh và thiết lập vùng crop tạo asset dùng cho quảng cáo Zalo Ads (`POST /zaapi/UploadCrop`).
2954
+ */
2955
+ updateNewAds(request, options) {
2956
+ return this.client.requestMultipart(
2957
+ OP_ZaloAdsUpdateNewAds2,
2958
+ this.client.toTransportInput(OP_ZaloAdsUpdateNewAds2, request),
2959
+ options
2960
+ );
2961
+ }
2962
+ /**
2963
+ * Alias cho `updateNewAds` (`POST /zaapi/UploadCrop`).
2964
+ */
2965
+ uploadCrop(request, options) {
2966
+ return this.updateNewAds(request, options);
2967
+ }
2968
+ // ==========================================================================
2969
+ // 2. CONVENIENCE CUSTOM METHODS: UPLOAD + SAVE TRỌN GÓI
2970
+ // ==========================================================================
2971
+ /**
2972
+ * Method tiện ích trọn gói: Tự động tải ảnh lên CDN (`/api/member/upload-image`)
2973
+ * VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) trong cùng 1 lời gọi duy nhất.
2974
+ *
2975
+ * Trả về MediaId, URL CDN và kích thước để gắn ngay vào Creative/Quảng cáo.
2976
+ */
2977
+ async uploadAndSaveImage(request, options) {
2978
+ if (!request.file) {
2979
+ throw new ZaloSdkError(
2980
+ "ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveImage.",
2981
+ 400,
2982
+ "uploadAndSaveImage",
2983
+ null
2984
+ );
2985
+ }
2986
+ if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
2987
+ throw new ZaloSdkError(
2988
+ "\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array (v\xED d\u1EE5: req.file.buffer t\u1EEB Multer), Web Blob/File ho\u1EB7c URL \u1EA3nh c\xF4ng khai (http/https).",
2989
+ 400,
2990
+ "uploadAndSaveImage",
2991
+ null
2992
+ );
2993
+ }
2994
+ const fileName = request.fileName || resolveFileName(request.file, "image");
2995
+ let width = request.width;
2996
+ let height = request.height;
2997
+ if ((!width || !height) && isUint8Array(request.file)) {
2998
+ const dims = extractJpegDimensions(request.file) || extractPngDimensions(request.file);
2999
+ if (dims) {
3000
+ width = width || dims.width;
3001
+ height = height || dims.height;
3002
+ }
3003
+ }
3004
+ const resolvedWidth = width && width > 0 ? width : 1200;
3005
+ const resolvedHeight = height && height > 0 ? height : 710;
3006
+ const uploadRes = await this.postApiMemberUploadImage({ File: request.file }, options);
3007
+ if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
3008
+ throw new ZaloSdkError(
3009
+ uploadRes?.msg || "T\u1EA3i \u1EA3nh l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
3010
+ uploadRes?.code || 500,
3011
+ "uploadAndSaveImage_upload",
3012
+ uploadRes
3013
+ );
3014
+ }
3015
+ const cdnUrl = uploadRes.data;
3016
+ const mediaType = request.type !== void 0 ? request.type : 1;
3017
+ const savePayload = {
3018
+ Name: fileName,
3019
+ Type: mediaType,
3020
+ Settings: {
3021
+ Url: cdnUrl,
3022
+ Width: resolvedWidth,
3023
+ Height: resolvedHeight,
3024
+ ...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
3025
+ }
3026
+ };
3027
+ const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
3028
+ if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
3029
+ throw new ZaloSdkError(
3030
+ "L\u01B0u \u1EA3nh v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
3031
+ saveRes?.code || 500,
3032
+ "uploadAndSaveImage_save",
3033
+ saveRes
3034
+ );
3035
+ }
3036
+ return {
3037
+ code: 0,
3038
+ mediaId: saveRes.data,
3039
+ cdnUrl,
3040
+ name: fileName,
3041
+ width: resolvedWidth,
3042
+ height: resolvedHeight,
3043
+ type: mediaType,
3044
+ rawUploadResponse: uploadRes,
3045
+ rawSaveResponse: saveRes
3046
+ };
3047
+ }
3048
+ /**
3049
+ * Method tiện ích trọn gói cho Video: Tự động tải video lên CDN (`/api/member/upload-video`)
3050
+ * VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) để cấp MediaId.
3051
+ */
3052
+ async uploadAndSaveVideo(request, options) {
3053
+ if (!request.file) {
3054
+ throw new ZaloSdkError(
3055
+ "ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveVideo.",
3056
+ 400,
3057
+ "uploadAndSaveVideo",
3058
+ null
3059
+ );
3060
+ }
3061
+ if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
3062
+ throw new ZaloSdkError(
3063
+ "\u0110\u01B0\u1EDDng d\u1EABn t\u1EC7p c\u1EE5c b\u1ED9 tr\xEAn \u1ED5 c\u1EE9ng kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3. Vui l\xF2ng truy\u1EC1n Buffer/Uint8Array, Web Blob/File ho\u1EB7c URL video c\xF4ng khai (http/https).",
3064
+ 400,
3065
+ "uploadAndSaveVideo",
3066
+ null
3067
+ );
3068
+ }
3069
+ const fileName = request.fileName || resolveFileName(request.file, "video");
3070
+ const width = request.width || 1920;
3071
+ const height = request.height || 1080;
3072
+ const duration = request.duration || 30;
3073
+ const uploadRes = await this.uploadVideo({ File: request.file }, options);
3074
+ if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
3075
+ throw new ZaloSdkError(
3076
+ uploadRes?.msg || "T\u1EA3i video l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
3077
+ uploadRes?.code || 500,
3078
+ "uploadAndSaveVideo_upload",
3079
+ uploadRes
3080
+ );
3081
+ }
3082
+ const cdnUrl = uploadRes.data;
3083
+ const savePayload = {
3084
+ Name: fileName,
3085
+ Type: 2,
3086
+ // 2 = Video
3087
+ Settings: {
3088
+ Url: cdnUrl,
3089
+ Width: width,
3090
+ Height: height,
3091
+ Duration: duration,
3092
+ ...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
3093
+ }
3094
+ };
3095
+ const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
3096
+ if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
3097
+ throw new ZaloSdkError(
3098
+ "L\u01B0u video v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
3099
+ saveRes?.code || 500,
3100
+ "uploadAndSaveVideo_save",
3101
+ saveRes
3102
+ );
3103
+ }
3104
+ return {
3105
+ code: 0,
3106
+ mediaId: saveRes.data,
3107
+ cdnUrl,
3108
+ name: fileName,
3109
+ width,
3110
+ height,
3111
+ duration,
3112
+ type: 2,
3113
+ rawUploadResponse: uploadRes,
3114
+ rawSaveResponse: saveRes
3115
+ };
3116
+ }
3117
+ // ==========================================================================
3118
+ // 3. STANDALONE VALIDATION METHODS (Cho Backend sử dụng độc lập, không chặn API)
3119
+ // ==========================================================================
3120
+ /**
3121
+ * Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads:
3122
+ * - "No file chosen": Bắt buộc phải có tệp.
3123
+ * - Dung lượng: Tối đa 2MB (2 * 1024 * 1024 bytes).
3124
+ * - Kích thước: Tối thiểu 150x150 pixels.
3125
+ * - Định dạng: Hỗ trợ .JPG, .JPEG, .PNG.
3126
+ *
3127
+ * Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
3128
+ */
3129
+ validateImage(input) {
3130
+ const errors = [];
3131
+ let sizeBytes = input.sizeBytes;
3132
+ let fileName = input.fileName;
3133
+ let format = input.format;
3134
+ let width = input.width;
3135
+ let height = input.height;
3136
+ const file = input.file;
3137
+ const hasFile = Boolean(
3138
+ file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
3139
+ );
3140
+ if (!hasFile && sizeBytes === void 0) {
3141
+ errors.push("No file chosen");
3142
+ return {
3143
+ isValid: false,
3144
+ status: "INVALID",
3145
+ errors,
3146
+ metadata: { fileDetected: false }
3147
+ };
3148
+ }
3149
+ if (file && typeof file === "object") {
3150
+ const rec = file;
3151
+ if (typeof rec.size === "number" && sizeBytes === void 0) {
3152
+ sizeBytes = rec.size;
3153
+ }
3154
+ if (typeof rec.originalname === "string" && !fileName) {
3155
+ fileName = rec.originalname;
3156
+ }
3157
+ if (typeof rec.mimetype === "string" && !format) {
3158
+ format = rec.mimetype;
3159
+ }
3160
+ if (isUint8Array(rec.buffer)) {
3161
+ if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
3162
+ const dims = extractJpegDimensions(rec.buffer) || extractPngDimensions(rec.buffer);
3163
+ if (dims) {
3164
+ width = width || dims.width;
3165
+ height = height || dims.height;
3166
+ }
3167
+ } else if (isUint8Array(file)) {
3168
+ if (sizeBytes === void 0) sizeBytes = file.byteLength;
3169
+ const dims = extractJpegDimensions(file) || extractPngDimensions(file);
3170
+ if (dims) {
3171
+ width = width || dims.width;
3172
+ height = height || dims.height;
3173
+ }
3174
+ }
3175
+ } else if (typeof file === "string" && !fileName) {
3176
+ fileName = resolveFileName(file);
3177
+ }
3178
+ if (sizeBytes !== void 0 && sizeBytes <= 0) {
3179
+ errors.push("No file chosen");
3180
+ }
3181
+ const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
3182
+ if (sizeBytes !== void 0 && sizeBytes > MAX_IMAGE_BYTES) {
3183
+ const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
3184
+ errors.push(`Dung l\u01B0\u1EE3ng \u1EA3nh v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 2MB (dung l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${sizeMB}MB).`);
3185
+ }
3186
+ if (width !== void 0 && height !== void 0) {
3187
+ if (width < 150 || height < 150) {
3188
+ errors.push(`K\xEDch th\u01B0\u1EDBc \u1EA3nh t\u1ED1i thi\u1EC3u 150x150 (k\xEDch th\u01B0\u1EDBc hi\u1EC7n t\u1EA1i: ${width}x${height} pixels).`);
3189
+ }
3190
+ }
3191
+ const nameToCheck = (fileName || format || "").toLowerCase();
3192
+ if (nameToCheck) {
3193
+ const isAllowedFormat = nameToCheck.endsWith(".jpg") || nameToCheck.endsWith(".jpeg") || nameToCheck.endsWith(".png") || nameToCheck.includes("image/jpeg") || nameToCheck.includes("image/jpg") || nameToCheck.includes("image/png");
3194
+ if (!isAllowedFormat) {
3195
+ errors.push("\u0110\u1ECBnh d\u1EA1ng \u1EA3nh kh\xF4ng h\u1EE3p l\u1EC7, y\xEAu c\u1EA7u \u0111\u1ECBnh d\u1EA1ng .JPG, .JPEG ho\u1EB7c .PNG.");
3196
+ }
3197
+ }
3198
+ const isValid = errors.length === 0;
3199
+ return {
3200
+ isValid,
3201
+ status: isValid ? "VALID" : "INVALID",
3202
+ errors,
3203
+ metadata: {
3204
+ fileDetected: true,
3205
+ sizeBytes,
3206
+ width,
3207
+ height,
3208
+ format: format || (fileName ? fileName.split(".").pop() : void 0)
3209
+ }
3210
+ };
3211
+ }
3212
+ /**
3213
+ * Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads:
3214
+ * - "No file chosen": Bắt buộc phải có tệp.
3215
+ * - Định dạng: .MP4 H.264.
3216
+ * - Dung lượng: Tối đa 150MB (150 * 1024 * 1024 bytes).
3217
+ * - Thời lượng: Tối đa 60 giây.
3218
+ * - Tỉ lệ khung hình: 16:9, 9:16 hoặc 1:1.
3219
+ *
3220
+ * Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
3221
+ */
3222
+ validateVideo(input) {
3223
+ const errors = [];
3224
+ let sizeBytes = input.sizeBytes;
3225
+ let fileName = input.fileName;
3226
+ let format = input.format;
3227
+ const durationSeconds = input.durationSeconds;
3228
+ const width = input.width;
3229
+ const height = input.height;
3230
+ const file = input.file;
3231
+ const hasFile = Boolean(
3232
+ file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
3233
+ );
3234
+ if (!hasFile && sizeBytes === void 0) {
3235
+ errors.push("No file chosen");
3236
+ return {
3237
+ isValid: false,
3238
+ status: "INVALID",
3239
+ errors,
3240
+ metadata: { fileDetected: false }
3241
+ };
3242
+ }
3243
+ if (file && typeof file === "object") {
3244
+ const rec = file;
3245
+ if (typeof rec.size === "number" && sizeBytes === void 0) {
3246
+ sizeBytes = rec.size;
3247
+ }
3248
+ if (typeof rec.originalname === "string" && !fileName) {
3249
+ fileName = rec.originalname;
3250
+ }
3251
+ if (typeof rec.mimetype === "string" && !format) {
3252
+ format = rec.mimetype;
3253
+ }
3254
+ if (isUint8Array(rec.buffer)) {
3255
+ if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
3256
+ } else if (isUint8Array(file)) {
3257
+ if (sizeBytes === void 0) sizeBytes = file.byteLength;
3258
+ }
3259
+ } else if (typeof file === "string" && !fileName) {
3260
+ fileName = resolveFileName(file);
3261
+ }
3262
+ if (sizeBytes !== void 0 && sizeBytes <= 0) {
3263
+ errors.push("No file chosen");
3264
+ }
3265
+ const nameToCheck = (fileName || format || "").toLowerCase();
3266
+ if (nameToCheck) {
3267
+ const isMp4 = nameToCheck.endsWith(".mp4") || nameToCheck.includes("video/mp4") || nameToCheck.includes("h264");
3268
+ if (!isMp4) {
3269
+ errors.push("\u0110\u1ECBnh d\u1EA1ng video kh\xF4ng h\u1EE3p l\u1EC7, y\xEAu c\u1EA7u \u0111\u1ECBnh d\u1EA1ng .MP4 (H.264).");
3270
+ }
3271
+ }
3272
+ const MAX_VIDEO_BYTES = 150 * 1024 * 1024;
3273
+ if (sizeBytes !== void 0 && sizeBytes > MAX_VIDEO_BYTES) {
3274
+ const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
3275
+ errors.push(`Dung l\u01B0\u1EE3ng video v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 150MB (dung l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${sizeMB}MB).`);
3276
+ }
3277
+ if (durationSeconds !== void 0 && durationSeconds > 60) {
3278
+ errors.push(`Th\u1EDDi l\u01B0\u1EE3ng video v\u01B0\u1EE3t qu\xE1 gi\u1EDBi h\u1EA1n t\u1ED1i \u0111a 60 gi\xE2y (th\u1EDDi l\u01B0\u1EE3ng hi\u1EC7n t\u1EA1i: ${durationSeconds} gi\xE2y).`);
3279
+ }
3280
+ let ratioLabel;
3281
+ if (width !== void 0 && height !== void 0 && width > 0 && height > 0) {
3282
+ const ratio = width / height;
3283
+ const is16_9 = Math.abs(ratio - 16 / 9) <= 0.06;
3284
+ const is9_16 = Math.abs(ratio - 9 / 16) <= 0.04;
3285
+ const is1_1 = Math.abs(ratio - 1) <= 0.05;
3286
+ if (is16_9) ratioLabel = "16:9";
3287
+ else if (is9_16) ratioLabel = "9:16";
3288
+ else if (is1_1) ratioLabel = "1:1";
3289
+ else {
3290
+ ratioLabel = `${width}:${height} (~${ratio.toFixed(2)})`;
3291
+ errors.push(`T\u1EC9 l\u1EC7 khung h\xECnh video ph\u1EA3i l\xE0 16:9, 9:16 ho\u1EB7c 1:1 (t\u1EC9 l\u1EC7 hi\u1EC7n t\u1EA1i: ${width}x${height} - ${ratioLabel}).`);
3292
+ }
3293
+ }
3294
+ const isValid = errors.length === 0;
3295
+ return {
3296
+ isValid,
3297
+ status: isValid ? "VALID" : "INVALID",
3298
+ errors,
3299
+ metadata: {
3300
+ fileDetected: true,
3301
+ sizeBytes,
3302
+ width,
3303
+ height,
3304
+ durationSeconds,
3305
+ format: format || (fileName ? fileName.split(".").pop() : void 0),
3306
+ aspectRatio: ratioLabel
3307
+ }
3308
+ };
3309
+ }
3310
+ };
3311
+
3312
+ // src/services/ads.service.ts
3313
+ var ZaloAdsService = class extends ZaloCampaignsService {
3314
+ account;
3315
+ audiences;
3316
+ targeting;
3317
+ reports;
3318
+ conversions;
3319
+ pixel;
3320
+ automatedRules;
3321
+ rules;
3322
+ flows;
3323
+ media;
3324
+ campaigns;
3325
+ constructor(client) {
3326
+ super(client);
3327
+ this.account = new ZaloAccountService(client);
3328
+ this.audiences = new ZaloAudiencesService(client);
3329
+ this.targeting = this.audiences;
3330
+ this.reports = new ZaloReportsService(client);
3331
+ this.conversions = new ZaloConversionsService(client);
3332
+ this.pixel = this.conversions;
3333
+ this.automatedRules = new ZaloAutomatedRulesService(client);
3334
+ this.rules = this.automatedRules;
3335
+ this.flows = new ZaloFlowsService(client);
3336
+ this.media = new ZaloMediaService(client);
3337
+ this.campaigns = this;
3338
+ }
3339
+ // =========================================================================
3340
+ // Delegations -> this.account
3341
+ // =========================================================================
3342
+ getApiWhoami(request = {}, options) {
3343
+ return this.account.getApiWhoami(request, options);
3344
+ }
3345
+ getApiPaymentTransactionHistory(request, options) {
3346
+ return this.account.getApiPaymentTransactionHistory(request, options);
2244
3347
  }
2245
- deleteAutomatedRule(request, options) {
2246
- return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
3348
+ getApiBaAccountAllaccessors(request = {}, options) {
3349
+ return this.account.getApiBaAccountAllaccessors(request, options);
2247
3350
  }
2248
- createConversion(request, options) {
2249
- return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
3351
+ getApiBaAccountAllgrantedmembers(request = {}, options) {
3352
+ return this.account.getApiBaAccountAllgrantedmembers(request, options);
2250
3353
  }
2251
- deleteConversion(request, options) {
2252
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
3354
+ listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
3355
+ return this.account.listAgencyCustomersWithBudget(request, options);
2253
3356
  }
2254
- deleteCustomAudience(request, options) {
2255
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
3357
+ getApiNotifiesHeader(request = {}, options) {
3358
+ return this.account.getApiNotifiesHeader(request, options);
2256
3359
  }
2257
- getAdById(request = {}, options) {
2258
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
3360
+ getApiLpNews(request = {}, options) {
3361
+ return this.account.getApiLpNews(request, options);
2259
3362
  }
2260
- getAdChangeLog(request, options) {
2261
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
3363
+ // =========================================================================
3364
+ // Delegations -> this.audiences
3365
+ // =========================================================================
3366
+ postApiAdEstimateaudience(request, options) {
3367
+ return this.audiences.postApiAdEstimateaudience(request, options);
2262
3368
  }
2263
3369
  getApiAdGetlistadadvancetargeting(request = {}, options) {
2264
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
3370
+ return this.audiences.getApiAdGetlistadadvancetargeting(request, options);
2265
3371
  }
2266
- getApiBaAccountAllaccessors(request = {}, options) {
2267
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
3372
+ getApiCustomAudienceAll(request = {}, options) {
3373
+ return this.audiences.getApiCustomAudienceAll(request, options);
2268
3374
  }
2269
- getApiBaAccountAllgrantedmembers(request = {}, options) {
2270
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
3375
+ createCustomAudience(request, options) {
3376
+ return this.audiences.createCustomAudience(request, options);
2271
3377
  }
2272
- getApiConversionAll(request = {}, options) {
2273
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
3378
+ deleteCustomAudience(request, options) {
3379
+ return this.audiences.deleteCustomAudience(request, options);
2274
3380
  }
2275
- getApiConversionStandardEvents(request = {}, options) {
2276
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
3381
+ uploadCustomAudiencePhoneList(request, options) {
3382
+ return this.audiences.uploadCustomAudiencePhoneList(request, options);
2277
3383
  }
2278
- getApiCustomAudienceAll(request = {}, options) {
2279
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
3384
+ /** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
3385
+ createSavedAudience(request, options) {
3386
+ return this.audiences.createSavedAudience(request, options);
2280
3387
  }
2281
- getApiFilegroups(request = {}, options) {
2282
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiFilegroups, this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request), options);
3388
+ /** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
3389
+ createPhoneAudience(request, options) {
3390
+ return this.audiences.createPhoneAudience(request, options);
2283
3391
  }
2284
- getApiLpNews(request = {}, options) {
2285
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
3392
+ /** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
3393
+ createLookalikeAudience(request, options) {
3394
+ return this.audiences.createLookalikeAudience(request, options);
2286
3395
  }
2287
- getApiMediaItems(request, options) {
2288
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiMediaItems, this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request), options);
3396
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
3397
+ createFormEventAudience(request, options) {
3398
+ return this.audiences.createFormEventAudience(request, options);
2289
3399
  }
2290
- getApiMemberFiles(request = {}, options) {
2291
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiMemberFiles, this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request), options);
3400
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn OA (`caType = 11` - `MESSAGE_AUDIENCE`). */
3401
+ createMessageOaEventAudience(request, options) {
3402
+ return this.audiences.createMessageOaEventAudience(request, options);
2292
3403
  }
2293
- getApiNotifiesHeader(request = {}, options) {
2294
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
3404
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Kịch bản Tin nhắn cá nhân (`caType = 14` - `MESSAGE_PERSONAL_EVENT_AUDIENCE`). */
3405
+ createMessagePersonalEventAudience(request, options) {
3406
+ return this.audiences.createMessagePersonalEventAudience(request, options);
2295
3407
  }
2296
- getApiPaymentTransactionHistory(request, options) {
2297
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiPaymentTransactionHistory, this.client.toTransportInput(OP_ZaloAdsGetApiPaymentTransactionHistory, request), options);
3408
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
3409
+ createFormLeadAudience(request, options) {
3410
+ return this.audiences.createFormLeadAudience(request, options);
2298
3411
  }
2299
- getApiPlaceGetalldistricts(request = {}, options) {
2300
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
3412
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
3413
+ createCommerceFormAudience(request, options) {
3414
+ return this.audiences.createCommerceFormAudience(request, options);
2301
3415
  }
2302
- getApiSpellCheckV2(request = {}, options) {
2303
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
3416
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Kịch bản Tin nhắn OA (`caType = 13` - `MESSAGE_OA_AUDIENCE`). */
3417
+ createMessageOaLeadAudience(request, options) {
3418
+ return this.audiences.createMessageOaLeadAudience(request, options);
2304
3419
  }
2305
- getApiWhoami(request = {}, options) {
2306
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiWhoami, this.client.toTransportInput(OP_ZaloAdsGetApiWhoami, request), options);
3420
+ /** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
3421
+ createLeadSignalAudience(request, options) {
3422
+ return this.audiences.createLeadSignalAudience(request, options);
2307
3423
  }
3424
+ // =========================================================================
3425
+ // Delegations -> this.reports
3426
+ // =========================================================================
2308
3427
  getReportapiV2Ads(request, options) {
2309
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
3428
+ return this.reports.getReportapiV2Ads(request, options);
2310
3429
  }
2311
3430
  getReportapiV2Campaigns(request = {}, options) {
2312
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
3431
+ return this.reports.getReportapiV2Campaigns(request, options);
2313
3432
  }
2314
- getReportapiV2UniqueUser(request = {}, options) {
2315
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
3433
+ getReportapiV2UniqueUser(request, options) {
3434
+ return this.reports.getReportapiV2UniqueUser(request, options);
2316
3435
  }
2317
3436
  getReportapiV3Campaigns(request, options) {
2318
- const normalized = {
2319
- filter: "[]",
2320
- agencyId: 0,
2321
- ...request
2322
- };
2323
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
3437
+ return this.reports.getReportapiV3Campaigns(request, options);
2324
3438
  }
2325
- getZaapiCampaignReportcampaign(request = {}, options) {
2326
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
3439
+ getReportOverview(request, options) {
3440
+ return this.reports.getReportOverview(request, options);
2327
3441
  }
2328
- getZaapiCheckcamphasmanyads(request = {}, options) {
2329
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
3442
+ getDemographicsReport(request, options) {
3443
+ return this.reports.getDemographicsReport(request, options);
2330
3444
  }
2331
- getZaapiGetadsfromcampaignid(request = {}, options) {
2332
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
3445
+ getZaapiCampaignReportcampaign(request, options) {
3446
+ return this.reports.getZaapiCampaignReportcampaign(request, options);
2333
3447
  }
2334
- getZaapiGetallpages(request = {}, options) {
2335
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
3448
+ listCustomReports(request = {}, options) {
3449
+ return this.reports.listCustomReports(request, options);
2336
3450
  }
2337
- getZaapiGetownedarticles(request = {}, options) {
2338
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
3451
+ upsertCustomReport(request, options) {
3452
+ return this.reports.upsertCustomReport(request, options);
2339
3453
  }
2340
- getZaapiGetownedpages(request = {}, options) {
2341
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
3454
+ deleteCustomReport(request, options) {
3455
+ return this.reports.deleteCustomReport(request, options);
2342
3456
  }
2343
- listAgencyCustomersWithBudget(request, options) {
2344
- return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, request), options);
3457
+ listReportFilters(request, options) {
3458
+ return this.reports.listReportFilters(request, options);
2345
3459
  }
2346
- listCustomReports(request = {}, options) {
2347
- return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
3460
+ // =========================================================================
3461
+ // Delegations -> this.conversions
3462
+ // =========================================================================
3463
+ createConversion(request, options) {
3464
+ return this.conversions.createConversion(request, options);
2348
3465
  }
2349
- listFormsByOfficialAccount(request, options) {
2350
- return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
3466
+ deleteConversion(request, options) {
3467
+ return this.conversions.deleteConversion(request, options);
2351
3468
  }
2352
- listMiniPagesByTemplate(request, options) {
2353
- return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, request), options);
3469
+ getApiConversionAll(request = {}, options) {
3470
+ return this.conversions.getApiConversionAll(request, options);
3471
+ }
3472
+ getApiConversionStandardEvents(request = {}, options) {
3473
+ return this.conversions.getApiConversionStandardEvents(request, options);
2354
3474
  }
2355
3475
  listPersonalPixelLabels(request = {}, options) {
2356
- return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, request), options);
3476
+ return this.conversions.listPersonalPixelLabels(request, options);
2357
3477
  }
2358
- postApiAdEstimateaudience(request, options) {
2359
- return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
3478
+ /** Lấy danh sách tài khoản Zalo Official Account (OA) có dữ liệu chuyển đổi (Lead Signal) (`GET /api/ad/audience/leadSignal/oas`). */
3479
+ listLeadSignalOas(options) {
3480
+ return this.conversions.listLeadSignalOas(options);
2360
3481
  }
2361
- postApiMediaSave(request, options) {
2362
- return this.client.requestFormUrlEncoded(OP_ZaloAdsPostApiMediaSave, this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, request), options);
3482
+ /** Lấy danh sách rút gọn gồm ID và tên của toàn bộ các sự kiện chuyển đổi (Conversion) đã tạo trên tài khoản quảng cáo Zalo Ads (`GET /api/conversion/names`). */
3483
+ listConversionNames(request = {}, options) {
3484
+ return this.conversions.listConversionNames(request, options);
2363
3485
  }
2364
- postApiMemberUploadImage(request, options) {
2365
- return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, request), options);
3486
+ /** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
3487
+ getApiConversionNames(request = {}, options) {
3488
+ return this.conversions.getApiConversionNames(request, options);
2366
3489
  }
2367
- postZaapiDeletead(request = {}, options) {
2368
- return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
3490
+ // =========================================================================
3491
+ // Delegations -> this.automatedRules
3492
+ // =========================================================================
3493
+ listAutomatedRules(request = {}, options) {
3494
+ return this.automatedRules.listAutomatedRules(request, options);
2369
3495
  }
2370
- renameCampaign(request, options) {
2371
- return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
3496
+ createAutomatedRule(request, options) {
3497
+ return this.automatedRules.createAutomatedRule(request, options);
2372
3498
  }
2373
- updateEcommerceAd(request, options) {
2374
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
3499
+ updateAutomatedRule(request, options) {
3500
+ return this.automatedRules.updateAutomatedRule(request, options);
2375
3501
  }
2376
- /** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
2377
- updateCommerceAd(request, options) {
2378
- return this.updateEcommerceAd(request, options);
3502
+ changeAutomatedRuleStatus(request, options) {
3503
+ return this.automatedRules.changeAutomatedRuleStatus(request, options);
2379
3504
  }
2380
- updateFormAd(request, options) {
2381
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
3505
+ getAutomatedRuleHistory(request, options) {
3506
+ return this.automatedRules.getAutomatedRuleHistory(request, options);
2382
3507
  }
2383
- updateMessageAd(request, options) {
2384
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
3508
+ deleteAutomatedRule(request, options) {
3509
+ return this.automatedRules.deleteAutomatedRule(request, options);
2385
3510
  }
2386
- updateNewAds(request, options) {
2387
- return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
3511
+ // =========================================================================
3512
+ // Delegations -> this.flows
3513
+ // =========================================================================
3514
+ listFlowsByOfficialAccount(request, options) {
3515
+ return this.flows.listFlowsByOfficialAccount(request, options);
2388
3516
  }
2389
- updateOfficialAccountAd(request, options) {
2390
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
3517
+ createFlow(request, options) {
3518
+ return this.flows.createFlow(request, options);
2391
3519
  }
2392
- /** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
2393
- updateOaAd(request, options) {
2394
- return this.updateOfficialAccountAd(request, options);
3520
+ updateFlow(request, options) {
3521
+ return this.flows.updateFlow(request, options);
2395
3522
  }
2396
- updatePostAd(request, options) {
2397
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
3523
+ // =========================================================================
3524
+ // Delegations -> this.media
3525
+ // =========================================================================
3526
+ getApiFilegroups(request = {}, options) {
3527
+ return this.media.getApiFilegroups(request, options);
2398
3528
  }
2399
- /** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
2400
- updateArticleAd(request, options) {
2401
- return this.updatePostAd(request, options);
3529
+ getApiMediaItems(request, options) {
3530
+ return this.media.getApiMediaItems(request, options);
2402
3531
  }
2403
- uploadCustomAudiencePhoneList(request, options) {
2404
- return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
3532
+ getApiMemberFiles(request = {}, options) {
3533
+ return this.media.getApiMemberFiles(request, options);
3534
+ }
3535
+ postApiMediaSave(request, options) {
3536
+ return this.media.postApiMediaSave(request, options);
3537
+ }
3538
+ postApiMemberUploadImage(request, options) {
3539
+ return this.media.postApiMemberUploadImage(request, options);
3540
+ }
3541
+ /** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
3542
+ uploadImage(request, options) {
3543
+ return this.media.uploadImage(request, options);
2405
3544
  }
2406
3545
  uploadVideo(request, options) {
2407
- return this.client.requestMultipart(OP_ZaloAdsUploadVideo, this.client.toTransportInput(OP_ZaloAdsUploadVideo, request), options);
3546
+ return this.media.uploadVideo(request, options);
2408
3547
  }
2409
- upsertCustomReport(request, options) {
2410
- return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
3548
+ /**
3549
+ * Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads (độc lập cho backend).
3550
+ * Tiêu chí: Có file, Dung lượng tối đa 2MB, Kích thước tối thiểu 150x150, Định dạng JPG/PNG.
3551
+ */
3552
+ validateImage(input) {
3553
+ return this.media.validateImage(input);
3554
+ }
3555
+ /**
3556
+ * Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads (độc lập cho backend).
3557
+ * Tiêu chí: Có file, Định dạng .MP4 H.264, Dung lượng tối đa 150MB, Thời lượng tối đa 60s, Tỉ lệ 16:9, 9:16 hoặc 1:1.
3558
+ */
3559
+ validateVideo(input) {
3560
+ return this.media.validateVideo(input);
2411
3561
  }
2412
3562
  };
2413
3563
 
@@ -2577,6 +3727,20 @@ var OP_ZaloFormsListSimpleFormsByOfficialAccount = {
2577
3727
  "cookieFields": [],
2578
3728
  "bodyFields": []
2579
3729
  };
3730
+ var OP_ZaloFormsListScenariosByOfficialAccount = {
3731
+ "operationId": "ZaloForms_listScenariosByOfficialAccount",
3732
+ "method": "GET",
3733
+ "endpoint": "/client/manage/api/manageConversation/getScenariosByOaId",
3734
+ "baseUrl": "https://form.ads.zalo.me",
3735
+ "binaryFields": [],
3736
+ "pathFields": [],
3737
+ "queryFields": [
3738
+ "oaId"
3739
+ ],
3740
+ "headerFields": [],
3741
+ "cookieFields": [],
3742
+ "bodyFields": []
3743
+ };
2580
3744
  var OP_ZaloFormsUpdateFormLeadNotificationInterval = {
2581
3745
  "operationId": "ZaloForms_updateFormLeadNotificationInterval",
2582
3746
  "method": "POST",
@@ -2636,11 +3800,403 @@ var ZaloFormsService = class {
2636
3800
  listSimpleFormsByOfficialAccount(request, options) {
2637
3801
  return this.client.requestWithoutBody(OP_ZaloFormsListSimpleFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListSimpleFormsByOfficialAccount, request), options);
2638
3802
  }
3803
+ listScenariosByOfficialAccount(request, options) {
3804
+ return this.client.requestWithoutBody(OP_ZaloFormsListScenariosByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListScenariosByOfficialAccount, request), options);
3805
+ }
2639
3806
  updateFormLeadNotificationInterval(request, options) {
2640
3807
  return this.client.requestJson(OP_ZaloFormsUpdateFormLeadNotificationInterval, this.client.toTransportInput(OP_ZaloFormsUpdateFormLeadNotificationInterval, request), options);
2641
3808
  }
2642
3809
  };
2643
3810
 
3811
+ // src/validators/instant-pages.validator.ts
3812
+ function isPositiveInteger(val) {
3813
+ if (typeof val === "number") return Number.isInteger(val) && val > 0;
3814
+ if (typeof val === "string" && val.trim() !== "") {
3815
+ const num = Number(val);
3816
+ return Number.isInteger(num) && num > 0;
3817
+ }
3818
+ return false;
3819
+ }
3820
+ function toPositiveInteger(val) {
3821
+ return typeof val === "number" ? Math.floor(val) : parseInt(String(val), 10);
3822
+ }
3823
+ function validateCloneInstantPageRequest(input) {
3824
+ const errors = [];
3825
+ if (!input || typeof input !== "object") {
3826
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u sao ch\xE9p Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3827
+ }
3828
+ const obj = input;
3829
+ if (!isPositiveInteger(obj.instantPageId)) {
3830
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3831
+ }
3832
+ return {
3833
+ isValid: errors.length === 0,
3834
+ errors,
3835
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
3836
+ };
3837
+ }
3838
+ function validateGetInstantPageDetailRequest(input) {
3839
+ const errors = [];
3840
+ if (!input || typeof input !== "object") {
3841
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y chi ti\u1EBFt Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3842
+ }
3843
+ const obj = input;
3844
+ if (!isPositiveInteger(obj.instantPageId)) {
3845
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3846
+ }
3847
+ return {
3848
+ isValid: errors.length === 0,
3849
+ errors,
3850
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
3851
+ };
3852
+ }
3853
+ function validateGetInstantPageSharedUserRequest(input) {
3854
+ const errors = [];
3855
+ if (!input || typeof input !== "object") {
3856
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y th\xF4ng tin ng\u01B0\u1EDDi d\xF9ng chia s\u1EBB ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3857
+ }
3858
+ const obj = input;
3859
+ if (!isPositiveInteger(obj.instantPageId)) {
3860
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3861
+ }
3862
+ if (!isPositiveInteger(obj.userId)) {
3863
+ errors.push("Tr\u01B0\u1EDDng 'userId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3864
+ }
3865
+ return {
3866
+ isValid: errors.length === 0,
3867
+ errors,
3868
+ data: errors.length === 0 ? {
3869
+ instantPageId: toPositiveInteger(obj.instantPageId),
3870
+ userId: toPositiveInteger(obj.userId)
3871
+ } : void 0
3872
+ };
3873
+ }
3874
+ function validateListInstantPageEditHistoryRequest(input) {
3875
+ const errors = [];
3876
+ if (!input || typeof input !== "object") {
3877
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y l\u1ECBch s\u1EED ch\u1EC9nh s\u1EEDa ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3878
+ }
3879
+ const obj = input;
3880
+ if (!isPositiveInteger(obj.instantPageId)) {
3881
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3882
+ }
3883
+ let limit = void 0;
3884
+ if (obj.limit !== void 0 && obj.limit !== null) {
3885
+ if (!isPositiveInteger(obj.limit)) {
3886
+ errors.push("Tr\u01B0\u1EDDng 'limit' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 1.");
3887
+ } else {
3888
+ limit = toPositiveInteger(obj.limit);
3889
+ }
3890
+ }
3891
+ let offset = void 0;
3892
+ if (obj.offset !== void 0 && obj.offset !== null) {
3893
+ const num = Number(obj.offset);
3894
+ if (!Number.isInteger(num) || num < 0) {
3895
+ errors.push("Tr\u01B0\u1EDDng 'offset' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 0.");
3896
+ } else {
3897
+ offset = num;
3898
+ }
3899
+ }
3900
+ return {
3901
+ isValid: errors.length === 0,
3902
+ errors,
3903
+ data: errors.length === 0 ? {
3904
+ instantPageId: toPositiveInteger(obj.instantPageId),
3905
+ ...limit !== void 0 ? { limit } : {},
3906
+ ...offset !== void 0 ? { offset } : {}
3907
+ } : void 0
3908
+ };
3909
+ }
3910
+ function validateListInstantPageFormRecordsRequest(input) {
3911
+ const errors = [];
3912
+ if (!input || typeof input !== "object") {
3913
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u t\u1EA3i b\u1EA3n ghi form ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3914
+ }
3915
+ const obj = input;
3916
+ if (!isPositiveInteger(obj.instantPageId)) {
3917
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3918
+ }
3919
+ return {
3920
+ isValid: errors.length === 0,
3921
+ errors,
3922
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
3923
+ };
3924
+ }
3925
+ function validateListInstantPageSharesRequest(input) {
3926
+ const errors = [];
3927
+ if (!input || typeof input !== "object") {
3928
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch ng\u01B0\u1EDDi \u0111\u01B0\u1EE3c chia s\u1EBB ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3929
+ }
3930
+ const obj = input;
3931
+ if (!isPositiveInteger(obj.instantPageId)) {
3932
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3933
+ }
3934
+ return {
3935
+ isValid: errors.length === 0,
3936
+ errors,
3937
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger(obj.instantPageId) } : void 0
3938
+ };
3939
+ }
3940
+ function validateListInstantPageUsersRequest(input) {
3941
+ if (input !== void 0 && input !== null && typeof input !== "object") {
3942
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch ng\u01B0\u1EDDi d\xF9ng ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
3943
+ }
3944
+ return { isValid: true, errors: [], data: {} };
3945
+ }
3946
+ function validateListMiniPageTemplatesRequest(input) {
3947
+ if (input !== void 0 && input !== null && typeof input !== "object") {
3948
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y m\u1EABu giao di\u1EC7n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
3949
+ }
3950
+ return { isValid: true, errors: [], data: {} };
3951
+ }
3952
+ function validateSearchInstantPagesRequest(input) {
3953
+ const errors = [];
3954
+ if (input === void 0 || input === null) {
3955
+ return { isValid: true, errors: [], data: {} };
3956
+ }
3957
+ if (typeof input !== "object") {
3958
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u t\xECm ki\u1EBFm Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
3959
+ }
3960
+ const obj = input;
3961
+ const data = {};
3962
+ if (obj.id !== void 0 && obj.id !== null && obj.id !== "") {
3963
+ if (!isPositiveInteger(obj.id)) {
3964
+ errors.push("B\u1ED9 l\u1ECDc 'id' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3965
+ } else {
3966
+ data.id = toPositiveInteger(obj.id);
3967
+ }
3968
+ }
3969
+ if (obj.name !== void 0 && obj.name !== null) {
3970
+ if (typeof obj.name !== "string") {
3971
+ errors.push("B\u1ED9 l\u1ECDc 'name' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
3972
+ } else {
3973
+ data.name = obj.name;
3974
+ }
3975
+ }
3976
+ if (obj.group !== void 0 && obj.group !== null && obj.group !== "") {
3977
+ const grp = Number(obj.group);
3978
+ if (grp !== 1 && grp !== 2) {
3979
+ errors.push("B\u1ED9 l\u1ECDc 'group' ch\u1EC9 nh\u1EADn gi\xE1 tr\u1ECB 1 (Trang s\u1EA3n ph\u1EA9m) ho\u1EB7c 2 (K\u1ECBch b\u1EA3n tin nh\u1EAFn).");
3980
+ } else {
3981
+ data.group = grp;
3982
+ }
3983
+ }
3984
+ return {
3985
+ isValid: errors.length === 0,
3986
+ errors,
3987
+ data: errors.length === 0 ? data : void 0
3988
+ };
3989
+ }
3990
+ function validateUpdateInstantPageRequest(input) {
3991
+ const errors = [];
3992
+ if (!input || typeof input !== "object") {
3993
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u c\u1EADp nh\u1EADt Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng (object)."] };
3994
+ }
3995
+ const obj = input;
3996
+ const instantPageId = obj.instantPageId ?? obj.id;
3997
+ if (!isPositiveInteger(instantPageId)) {
3998
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' (ho\u1EB7c 'id') l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3999
+ }
4000
+ const numericId = toPositiveInteger(instantPageId);
4001
+ const data = {
4002
+ instantPageId: numericId,
4003
+ id: numericId
4004
+ };
4005
+ if (obj.name !== void 0 && obj.name !== null) {
4006
+ if (typeof obj.name !== "string") {
4007
+ errors.push("Tr\u01B0\u1EDDng 'name' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
4008
+ } else {
4009
+ data.name = obj.name;
4010
+ }
4011
+ }
4012
+ if (obj.oaId !== void 0 && obj.oaId !== null) {
4013
+ if (typeof obj.oaId !== "string") {
4014
+ errors.push(`Tr\u01B0\u1EDDng 'oaId' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1 (ho\u1EB7c chu\u1ED7i r\u1ED7ng "").`);
4015
+ } else {
4016
+ data.oaId = obj.oaId;
4017
+ }
4018
+ }
4019
+ if (obj.active !== void 0 && obj.active !== null) {
4020
+ if (typeof obj.active === "boolean") {
4021
+ errors.push("Tr\u01B0\u1EDDng 'active' b\u1EAFt bu\u1ED9c l\xE0 s\u1ED1 nguy\xEAn 0 (T\u1EAFt) ho\u1EB7c 1 (B\u1EADt), kh\xF4ng \u0111\u01B0\u1EE3c truy\u1EC1n ki\u1EC3u boolean (true/false) v\xEC Zalo Ads API s\u1EBD tr\u1EA3 v\u1EC1 l\u1ED7i HTTP 400.");
4022
+ } else if (obj.active !== 0 && obj.active !== 1) {
4023
+ errors.push("Tr\u01B0\u1EDDng 'active' ch\u1EC9 nh\u1EADn gi\xE1 tr\u1ECB s\u1ED1 nguy\xEAn 0 (T\u1EAFt) ho\u1EB7c 1 (B\u1EADt).");
4024
+ } else {
4025
+ data.active = obj.active;
4026
+ }
4027
+ }
4028
+ if (obj.status !== void 0 && obj.status !== null) {
4029
+ const st = Number(obj.status);
4030
+ if (![0, 1, 2, 3].includes(st)) {
4031
+ errors.push("Tr\u01B0\u1EDDng 'status' ph\u1EA3i l\xE0 m\u1ED9t trong c\xE1c m\xE3: 0 (B\u1EA3n sao m\u1EDBi), 1 (B\u1EA3n nh\xE1p), 2 (\u0110\xE3 xu\u1EA5t b\u1EA3n), 3 (L\u01B0u tr\u1EEF).");
4032
+ } else {
4033
+ data.status = st;
4034
+ }
4035
+ }
4036
+ if (obj.draft !== void 0 && obj.draft !== null) {
4037
+ if (typeof obj.draft !== "string") {
4038
+ errors.push("Tr\u01B0\u1EDDng 'draft' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
4039
+ } else if (obj.draft.trim() !== "") {
4040
+ try {
4041
+ JSON.parse(obj.draft);
4042
+ data.draft = obj.draft;
4043
+ } catch (err) {
4044
+ errors.push(`Tr\u01B0\u1EDDng 'draft' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
4045
+ }
4046
+ } else {
4047
+ data.draft = "";
4048
+ }
4049
+ }
4050
+ if (obj.content !== void 0 && obj.content !== null) {
4051
+ if (typeof obj.content !== "string") {
4052
+ errors.push("Tr\u01B0\u1EDDng 'content' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
4053
+ } else if (obj.content.trim() !== "") {
4054
+ try {
4055
+ JSON.parse(obj.content);
4056
+ data.content = obj.content;
4057
+ } catch (err) {
4058
+ errors.push(`Tr\u01B0\u1EDDng 'content' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
4059
+ }
4060
+ } else {
4061
+ data.content = "";
4062
+ }
4063
+ }
4064
+ const hasUpdateField = data.name !== void 0 || data.oaId !== void 0 || data.active !== void 0 || data.status !== void 0 || data.draft !== void 0 || data.content !== void 0;
4065
+ if (!hasUpdateField) {
4066
+ errors.push("Y\xEAu c\u1EA7u c\u1EADp nh\u1EADt Instant Page ph\u1EA3i c\xF3 \xEDt nh\u1EA5t m\u1ED9t tr\u01B0\u1EDDng thay \u0111\u1ED5i: 'name', 'oaId', 'active', 'status', 'draft', ho\u1EB7c 'content'.");
4067
+ }
4068
+ return {
4069
+ isValid: errors.length === 0,
4070
+ errors,
4071
+ data: errors.length === 0 ? data : void 0
4072
+ };
4073
+ }
4074
+ function validateListInstantPageLeadsRequest(input) {
4075
+ const errors = [];
4076
+ if (!input || typeof input !== "object") {
4077
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y th\u1ED1ng k\xEA leads ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
4078
+ }
4079
+ const obj = input;
4080
+ let idsString = "";
4081
+ if (typeof obj.ids === "string" && obj.ids.trim() !== "") {
4082
+ idsString = obj.ids.trim();
4083
+ } else if (Array.isArray(obj.ids) && obj.ids.length > 0) {
4084
+ idsString = obj.ids.join(",");
4085
+ } else {
4086
+ errors.push("Tr\u01B0\u1EDDng 'ids' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 chu\u1ED7i c\xE1c ID ph\xE2n t\xE1ch b\u1EB1ng d\u1EA5u ph\u1EA9y (v\xED d\u1EE5: '81433,76292') ho\u1EB7c m\u1EA3ng c\xE1c ID.");
4087
+ }
4088
+ if (idsString) {
4089
+ const idParts = idsString.split(",").map((s) => s.trim()).filter(Boolean);
4090
+ if (idParts.length === 0) {
4091
+ errors.push("Tr\u01B0\u1EDDng 'ids' kh\xF4ng ch\u1EE9a b\u1EA5t k\u1EF3 ID h\u1EE3p l\u1EC7 n\xE0o.");
4092
+ } else {
4093
+ for (const id of idParts) {
4094
+ if (!isPositiveInteger(id)) {
4095
+ errors.push(`M\xE3 trang '${id}' trong danh s\xE1ch 'ids' kh\xF4ng ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng h\u1EE3p l\u1EC7.`);
4096
+ }
4097
+ }
4098
+ }
4099
+ }
4100
+ return {
4101
+ isValid: errors.length === 0,
4102
+ errors,
4103
+ data: errors.length === 0 ? { ids: idsString } : void 0
4104
+ };
4105
+ }
4106
+ function validateListOfficialAccountsRequest(input) {
4107
+ if (input !== void 0 && input !== null && typeof input !== "object") {
4108
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch Official Accounts ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng ho\u1EB7c \u0111\u1EC3 tr\u1ED1ng."] };
4109
+ }
4110
+ return { isValid: true, errors: [], data: {} };
4111
+ }
4112
+ function validateUpsertInstantPageFormRequest(input) {
4113
+ const errors = [];
4114
+ if (!input || typeof input !== "object") {
4115
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u c\u1EA5u h\xECnh bi\u1EC3u m\u1EABu Instant Page ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
4116
+ }
4117
+ const obj = input;
4118
+ if (!isPositiveInteger(obj.instantPageId)) {
4119
+ errors.push("Tr\u01B0\u1EDDng 'instantPageId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
4120
+ }
4121
+ if (!obj.oaId || typeof obj.oaId !== "string" || !/^\d+$/.test(obj.oaId.trim())) {
4122
+ errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 chu\u1ED7i s\u1ED1 \u0111\u1ECBnh danh Zalo Official Account.");
4123
+ }
4124
+ if (!obj.formName || typeof obj.formName !== "string" || obj.formName.trim() === "") {
4125
+ errors.push("Tr\u01B0\u1EDDng 'formName' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
4126
+ }
4127
+ if (!Array.isArray(obj.questions) || obj.questions.length === 0) {
4128
+ errors.push("Tr\u01B0\u1EDDng 'questions' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t m\u1ED9t c\xE2u h\u1ECFi (minItems: 1).");
4129
+ } else {
4130
+ obj.questions.forEach((q, idx) => {
4131
+ if (!q || typeof q !== "object") {
4132
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1} ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
4133
+ return;
4134
+ }
4135
+ const question = q;
4136
+ if (question.type !== 1 && question.type !== 2) {
4137
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'type' b\u1EAFt bu\u1ED9c l\xE0 1 (nh\u1EADp li\u1EC7u) ho\u1EB7c 2 (l\u1EF1a ch\u1ECDn ph\u01B0\u01A1ng \xE1n).`);
4138
+ }
4139
+ if (!question.title || typeof question.title !== "string" || question.title.trim() === "") {
4140
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'title' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.`);
4141
+ }
4142
+ if (!Array.isArray(question.answers) || question.answers.length === 0) {
4143
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'answers' ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t m\u1ED9t ph\u01B0\u01A1ng \xE1n/\xF4 nh\u1EADp li\u1EC7u.`);
4144
+ } else {
4145
+ question.answers.forEach((ans, ansIdx) => {
4146
+ if (!ans || typeof ans !== "object") {
4147
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}, ph\u01B0\u01A1ng \xE1n ${ansIdx + 1}: Ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
4148
+ return;
4149
+ }
4150
+ const answer = ans;
4151
+ if (answer.type === void 0 || typeof answer.type !== "number") {
4152
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}, ph\u01B0\u01A1ng \xE1n ${ansIdx + 1}: Tr\u01B0\u1EDDng 'type' b\u1EAFt bu\u1ED9c l\xE0 s\u1ED1 nguy\xEAn.`);
4153
+ }
4154
+ });
4155
+ }
4156
+ });
4157
+ }
4158
+ const useCustomConsent = typeof obj.useCustomConsent === "boolean" ? obj.useCustomConsent : false;
4159
+ let consentConfig = obj.consentConfig;
4160
+ if (useCustomConsent) {
4161
+ if (!consentConfig || typeof consentConfig !== "object") {
4162
+ errors.push("Khi 'useCustomConsent' = true, tr\u01B0\u1EDDng 'consentConfig' l\xE0 b\u1EAFt bu\u1ED9c.");
4163
+ } else {
4164
+ if (!consentConfig.address || typeof consentConfig.address !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'address' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
4165
+ if (!consentConfig.ownerName || typeof consentConfig.ownerName !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerName' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
4166
+ if (!consentConfig.ownerEmail || typeof consentConfig.ownerEmail !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerEmail' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
4167
+ if (!consentConfig.ownerPhone || typeof consentConfig.ownerPhone !== "string") errors.push("C\u1EA5u h\xECnh \u0111i\u1EC1u kho\u1EA3n: 'ownerPhone' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
4168
+ }
4169
+ }
4170
+ const data = {
4171
+ instantPageId: toPositiveInteger(obj.instantPageId),
4172
+ oaId: String(obj.oaId).trim(),
4173
+ formName: String(obj.formName).trim(),
4174
+ questions: obj.questions ?? [],
4175
+ useCustomConsent,
4176
+ consentConfig
4177
+ };
4178
+ return {
4179
+ isValid: errors.length === 0,
4180
+ errors,
4181
+ data: errors.length === 0 ? data : void 0
4182
+ };
4183
+ }
4184
+ var ZaloInstantPagesValidator = {
4185
+ validateCloneInstantPage: validateCloneInstantPageRequest,
4186
+ validateGetInstantPageDetail: validateGetInstantPageDetailRequest,
4187
+ validateGetInstantPageSharedUser: validateGetInstantPageSharedUserRequest,
4188
+ validateListInstantPageEditHistory: validateListInstantPageEditHistoryRequest,
4189
+ validateListInstantPageFormRecords: validateListInstantPageFormRecordsRequest,
4190
+ validateListInstantPageShares: validateListInstantPageSharesRequest,
4191
+ validateListInstantPageUsers: validateListInstantPageUsersRequest,
4192
+ validateListMiniPageTemplates: validateListMiniPageTemplatesRequest,
4193
+ validateSearchInstantPages: validateSearchInstantPagesRequest,
4194
+ validateUpdateInstantPage: validateUpdateInstantPageRequest,
4195
+ validateListInstantPageLeads: validateListInstantPageLeadsRequest,
4196
+ validateListOfficialAccounts: validateListOfficialAccountsRequest,
4197
+ validateUpsertInstantPageForm: validateUpsertInstantPageFormRequest
4198
+ };
4199
+
2644
4200
  // src/services/instant-pages.service.ts
2645
4201
  var OP_ZaloInstantPagesCloneInstantPage = {
2646
4202
  "operationId": "ZaloInstantPages_cloneInstantPage",
@@ -2843,8 +4399,13 @@ var ZaloInstantPagesService = class {
2843
4399
  constructor(client) {
2844
4400
  this.client = client;
2845
4401
  }
4402
+ /**
4403
+ * Bộ công cụ kiểm tra tính hợp lệ dữ liệu (Standalone Validators) cho 13 API Instant Pages.
4404
+ * Dùng ở backend (NestJS/Express/Fastify), middleware hoặc AI Agent để verify payload trước khi gọi SDK.
4405
+ */
4406
+ static validator = ZaloInstantPagesValidator;
2846
4407
  cloneInstantPage(request, options) {
2847
- return this.client.requestWithoutBody(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
4408
+ return this.client.requestJson(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
2848
4409
  }
2849
4410
  getInstantPageDetail(request, options) {
2850
4411
  return this.client.requestWithoutBody(OP_ZaloInstantPagesGetInstantPageDetail, this.client.toTransportInput(OP_ZaloInstantPagesGetInstantPageDetail, request), options);
@@ -2954,6 +4515,32 @@ var OP_ZaloProfileAdsUploadOaCover = {
2954
4515
  "is-new"
2955
4516
  ]
2956
4517
  };
4518
+ var OP_ZaloProfileAdsGetProvinces = {
4519
+ "operationId": "ZaloProfileAds_getProvinces",
4520
+ "method": "GET",
4521
+ "endpoint": "/ajax/get-province",
4522
+ "baseUrl": "https://profile.ads.zalo.me",
4523
+ "binaryFields": [],
4524
+ "pathFields": [],
4525
+ "queryFields": [],
4526
+ "headerFields": [],
4527
+ "cookieFields": [],
4528
+ "bodyFields": []
4529
+ };
4530
+ var OP_ZaloProfileAdsGetDistricts = {
4531
+ "operationId": "ZaloProfileAds_getDistricts",
4532
+ "method": "GET",
4533
+ "endpoint": "/ajax/get-district",
4534
+ "baseUrl": "https://profile.ads.zalo.me",
4535
+ "binaryFields": [],
4536
+ "pathFields": [],
4537
+ "queryFields": [
4538
+ "provinceId"
4539
+ ],
4540
+ "headerFields": [],
4541
+ "cookieFields": [],
4542
+ "bodyFields": []
4543
+ };
2957
4544
  var ZaloProfileAdsService = class {
2958
4545
  constructor(client) {
2959
4546
  this.client = client;
@@ -2966,6 +4553,11 @@ var ZaloProfileAdsService = class {
2966
4553
  }
2967
4554
  const normalizedRequest = {
2968
4555
  option: "createpage",
4556
+ typeId: 2,
4557
+ tier: 0,
4558
+ typeName: "store",
4559
+ categoryId: 10003,
4560
+ agreeTerm: true,
2969
4561
  ...request,
2970
4562
  ...csrfToken ? { "crsf-token": csrfToken } : {}
2971
4563
  };
@@ -2999,6 +4591,20 @@ var ZaloProfileAdsService = class {
2999
4591
  options
3000
4592
  );
3001
4593
  }
4594
+ getProvinces(options) {
4595
+ return this.client.requestWithoutBody(
4596
+ OP_ZaloProfileAdsGetProvinces,
4597
+ {},
4598
+ options
4599
+ );
4600
+ }
4601
+ getDistricts(request, options) {
4602
+ return this.client.requestWithoutBody(
4603
+ OP_ZaloProfileAdsGetDistricts,
4604
+ this.client.toTransportInput(OP_ZaloProfileAdsGetDistricts, request),
4605
+ options
4606
+ );
4607
+ }
3002
4608
  };
3003
4609
 
3004
4610
  // src/services/widget.service.ts
@@ -3076,6 +4682,17 @@ var ZaloWidgetApiService = class {
3076
4682
  var ZaloAdsSdk = class {
3077
4683
  client;
3078
4684
  ads;
4685
+ campaigns;
4686
+ account;
4687
+ audiences;
4688
+ targeting;
4689
+ reports;
4690
+ conversions;
4691
+ pixel;
4692
+ automatedRules;
4693
+ rules;
4694
+ flows;
4695
+ media;
3079
4696
  forms;
3080
4697
  instantPages;
3081
4698
  profileAds;
@@ -3086,6 +4703,17 @@ var ZaloAdsSdk = class {
3086
4703
  const resolvedOptions = typeof options === "string" ? { zpsid: options } : options;
3087
4704
  this.client = new ZaloSdkHttpClient(resolvedOptions);
3088
4705
  this.ads = new ZaloAdsService(this.client);
4706
+ this.campaigns = this.ads;
4707
+ this.account = this.ads.account;
4708
+ this.audiences = this.ads.audiences;
4709
+ this.targeting = this.ads.audiences;
4710
+ this.reports = this.ads.reports;
4711
+ this.conversions = this.ads.conversions;
4712
+ this.pixel = this.ads.conversions;
4713
+ this.automatedRules = this.ads.automatedRules;
4714
+ this.rules = this.ads.automatedRules;
4715
+ this.flows = this.ads.flows;
4716
+ this.media = this.ads.media;
3089
4717
  this.forms = new ZaloFormsService(this.client);
3090
4718
  this.instantPages = new ZaloInstantPagesService(this.client);
3091
4719
  this.profileAds = new ZaloProfileAdsService(this.client);
@@ -3411,12 +5039,36 @@ var ZaloAdsUpdateMessageAdResponse = class {
3411
5039
  code;
3412
5040
  data;
3413
5041
  };
5042
+
5043
+ // src/dtos/instant-pages.dto.ts
5044
+ var ZaloInstantPageBlockType = /* @__PURE__ */ ((ZaloInstantPageBlockType2) => {
5045
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CAROUSEL_SLIDER"] = 1] = "CAROUSEL_SLIDER";
5046
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["COUNTDOWN"] = 2] = "COUNTDOWN";
5047
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["RICH_TEXT"] = 4] = "RICH_TEXT";
5048
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["HERO_IMAGE"] = 6] = "HERO_IMAGE";
5049
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_NAME"] = 7] = "FORM_NAME";
5050
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["ORDER_CTA_BUTTON"] = 8] = "ORDER_CTA_BUTTON";
5051
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_PHONE"] = 9] = "FORM_PHONE";
5052
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_ADDRESS"] = 10] = "FORM_ADDRESS";
5053
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FOOTER"] = 14] = "FOOTER";
5054
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_QUANTITY"] = 16] = "FORM_QUANTITY";
5055
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_VARIANT"] = 18] = "PRODUCT_VARIANT";
5056
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_TITLE_PRICE"] = 19] = "PRODUCT_TITLE_PRICE";
5057
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["QUICK_QUESTIONS"] = 20] = "QUICK_QUESTIONS";
5058
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["MESSAGE_CTA_BUTTON"] = 21] = "MESSAGE_CTA_BUTTON";
5059
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SECTION_HEADING"] = 22] = "SECTION_HEADING";
5060
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CALL_HOTLINE_BUTTON"] = 23] = "CALL_HOTLINE_BUTTON";
5061
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["KEY_VALUE_TABLE"] = 25] = "KEY_VALUE_TABLE";
5062
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CONSENT_NOTICE"] = 27] = "CONSENT_NOTICE";
5063
+ return ZaloInstantPageBlockType2;
5064
+ })(ZaloInstantPageBlockType || {});
3414
5065
  // Annotate the CommonJS export names for ESM import in node:
3415
5066
  0 && (module.exports = {
3416
5067
  ALL_ZALO_ADS_DOMAINS,
3417
5068
  MemoryZaloSessionStore,
3418
5069
  RedisZaloSessionStore,
3419
5070
  TieredZaloSessionStore,
5071
+ ZaloAccountService,
3420
5072
  ZaloAdsAccountPool,
3421
5073
  ZaloAdsCreateFlowRequest,
3422
5074
  ZaloAdsCreateFlowResponse,
@@ -3433,11 +5085,20 @@ var ZaloAdsUpdateMessageAdResponse = class {
3433
5085
  ZaloAdsUpdateMessageAdResponse,
3434
5086
  ZaloAdsUpdateVideoAdRequest,
3435
5087
  ZaloAdsUpdateVideoAdResponse,
5088
+ ZaloAudiencesService,
3436
5089
  ZaloAuthManager,
5090
+ ZaloAutomatedRulesService,
5091
+ ZaloCampaignsService,
3437
5092
  ZaloChatWidgetService,
5093
+ ZaloConversionsService,
5094
+ ZaloFlowsService,
3438
5095
  ZaloFormsService,
5096
+ ZaloInstantPageBlockType,
3439
5097
  ZaloInstantPagesService,
5098
+ ZaloInstantPagesValidator,
5099
+ ZaloMediaService,
3440
5100
  ZaloProfileAdsService,
5101
+ ZaloReportsService,
3441
5102
  ZaloSdkError,
3442
5103
  ZaloSdkHttpClient,
3443
5104
  ZaloWidgetApiService,
@@ -3446,6 +5107,19 @@ var ZaloAdsUpdateMessageAdResponse = class {
3446
5107
  decodePlaySessionJwt,
3447
5108
  defaultSharedMemorySessionStore,
3448
5109
  deriveAccountKeyFromZpsid,
3449
- parseZaloCookieInput
5110
+ parseZaloCookieInput,
5111
+ validateCloneInstantPageRequest,
5112
+ validateGetInstantPageDetailRequest,
5113
+ validateGetInstantPageSharedUserRequest,
5114
+ validateListInstantPageEditHistoryRequest,
5115
+ validateListInstantPageFormRecordsRequest,
5116
+ validateListInstantPageLeadsRequest,
5117
+ validateListInstantPageSharesRequest,
5118
+ validateListInstantPageUsersRequest,
5119
+ validateListMiniPageTemplatesRequest,
5120
+ validateListOfficialAccountsRequest,
5121
+ validateSearchInstantPagesRequest,
5122
+ validateUpdateInstantPageRequest,
5123
+ validateUpsertInstantPageFormRequest
3450
5124
  });
3451
5125
  //# sourceMappingURL=index.js.map