@redonvn/zalo-ads-sdk 0.2.2 → 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
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  MemoryZaloSessionStore: () => MemoryZaloSessionStore,
35
35
  RedisZaloSessionStore: () => RedisZaloSessionStore,
36
36
  TieredZaloSessionStore: () => TieredZaloSessionStore,
37
+ ZaloAccountService: () => ZaloAccountService,
37
38
  ZaloAdsAccountPool: () => ZaloAdsIntegrationManager,
38
39
  ZaloAdsCreateFlowRequest: () => ZaloAdsCreateFlowRequest,
39
40
  ZaloAdsCreateFlowResponse: () => ZaloAdsCreateFlowResponse,
@@ -50,11 +51,20 @@ __export(index_exports, {
50
51
  ZaloAdsUpdateMessageAdResponse: () => ZaloAdsUpdateMessageAdResponse,
51
52
  ZaloAdsUpdateVideoAdRequest: () => ZaloAdsUpdateVideoAdRequest,
52
53
  ZaloAdsUpdateVideoAdResponse: () => ZaloAdsUpdateVideoAdResponse,
54
+ ZaloAudiencesService: () => ZaloAudiencesService,
53
55
  ZaloAuthManager: () => ZaloAuthManager,
56
+ ZaloAutomatedRulesService: () => ZaloAutomatedRulesService,
57
+ ZaloCampaignsService: () => ZaloCampaignsService,
54
58
  ZaloChatWidgetService: () => ZaloChatWidgetService,
59
+ ZaloConversionsService: () => ZaloConversionsService,
60
+ ZaloFlowsService: () => ZaloFlowsService,
55
61
  ZaloFormsService: () => ZaloFormsService,
62
+ ZaloInstantPageBlockType: () => ZaloInstantPageBlockType,
56
63
  ZaloInstantPagesService: () => ZaloInstantPagesService,
64
+ ZaloInstantPagesValidator: () => ZaloInstantPagesValidator,
65
+ ZaloMediaService: () => ZaloMediaService,
57
66
  ZaloProfileAdsService: () => ZaloProfileAdsService,
67
+ ZaloReportsService: () => ZaloReportsService,
58
68
  ZaloSdkError: () => ZaloSdkError,
59
69
  ZaloSdkHttpClient: () => ZaloSdkHttpClient,
60
70
  ZaloWidgetApiService: () => ZaloWidgetApiService,
@@ -64,7 +74,20 @@ __export(index_exports, {
64
74
  default: () => ZaloAdsSdk,
65
75
  defaultSharedMemorySessionStore: () => defaultSharedMemorySessionStore,
66
76
  deriveAccountKeyFromZpsid: () => deriveAccountKeyFromZpsid,
67
- 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
68
91
  });
69
92
  module.exports = __toCommonJS(index_exports);
70
93
 
@@ -73,7 +96,7 @@ var ZaloSdkError = class extends Error {
73
96
  status;
74
97
  operationId;
75
98
  responseBody;
76
- constructor(message, status, operationId, responseBody) {
99
+ constructor(message, status = 500, operationId = "unknown", responseBody = null) {
77
100
  super(message);
78
101
  this.name = "ZaloSdkError";
79
102
  this.status = status;
@@ -1108,43 +1131,7 @@ async function resolveCookies(auth, context) {
1108
1131
  return { ...auth?.cookies ?? {}, ...await auth?.getCookies?.(context) ?? {} };
1109
1132
  }
1110
1133
 
1111
- // src/services/ads.service.ts
1112
- var OP_ZaloAdsListFlowsByOfficialAccount = {
1113
- operationId: "ZaloAds_listFlowsByOfficialAccount",
1114
- method: "GET",
1115
- endpoint: "/api/flow/getByOaId",
1116
- baseUrl: "https://ads.zalo.me",
1117
- binaryFields: [],
1118
- pathFields: [],
1119
- queryFields: ["oaId", "limit", "offset", "flowId"],
1120
- headerFields: [],
1121
- cookieFields: [],
1122
- bodyFields: []
1123
- };
1124
- var OP_ZaloAdsCreateFlow = {
1125
- operationId: "ZaloAds_createFlow",
1126
- method: "POST",
1127
- endpoint: "/api/flow/create",
1128
- baseUrl: "https://ads.zalo.me",
1129
- binaryFields: [],
1130
- pathFields: [],
1131
- queryFields: [],
1132
- headerFields: [],
1133
- cookieFields: [],
1134
- bodyFields: ["oaId", "id", "name", "messages"]
1135
- };
1136
- var OP_ZaloAdsUpdateFlow = {
1137
- operationId: "ZaloAds_updateFlow",
1138
- method: "POST",
1139
- endpoint: "/api/flow/update",
1140
- baseUrl: "https://ads.zalo.me",
1141
- binaryFields: [],
1142
- pathFields: [],
1143
- queryFields: [],
1144
- headerFields: [],
1145
- cookieFields: [],
1146
- bodyFields: ["oaId", "id", "name", "messages"]
1147
- };
1134
+ // src/services/campaigns.service.ts
1148
1135
  var OP_ZaloAdsUpdateVideoAd = {
1149
1136
  operationId: "ZaloAds_updateVideoAd",
1150
1137
  method: "POST",
@@ -1172,22 +1159,6 @@ var OP_ZaloAdsChangeCampaignStatus = {
1172
1159
  "campaignId"
1173
1160
  ]
1174
1161
  };
1175
- var OP_ZaloAdsCreateCustomAudience = {
1176
- "operationId": "ZaloAds_createCustomAudience",
1177
- "method": "POST",
1178
- "endpoint": "/api/ad/audience",
1179
- "baseUrl": "https://ads.zalo.me",
1180
- "binaryFields": [],
1181
- "pathFields": [],
1182
- "queryFields": [],
1183
- "headerFields": [],
1184
- "cookieFields": [],
1185
- "bodyFields": [
1186
- "name",
1187
- "caType",
1188
- "targeting"
1189
- ]
1190
- };
1191
1162
  var OP_ZaloAdsCreateEcommerceCampaign = {
1192
1163
  "operationId": "ZaloAds_createEcommerceCampaign",
1193
1164
  "method": "POST",
@@ -1272,54 +1243,6 @@ var OP_ZaloAdsCreatePostCampaign = {
1272
1243
  "data"
1273
1244
  ]
1274
1245
  };
1275
- var OP_ZaloAdsCreateConversion = {
1276
- "operationId": "ZaloAds_createConversion",
1277
- "method": "POST",
1278
- "endpoint": "/api/conversion/add",
1279
- "baseUrl": "https://ads.zalo.me",
1280
- "binaryFields": [],
1281
- "pathFields": [],
1282
- "queryFields": [],
1283
- "headerFields": [],
1284
- "cookieFields": [],
1285
- "bodyFields": [
1286
- "name",
1287
- "landingPage",
1288
- "urlType",
1289
- "labelId",
1290
- "buttonIds",
1291
- "elements",
1292
- "keywords"
1293
- ]
1294
- };
1295
- var OP_ZaloAdsDeleteConversion = {
1296
- "operationId": "ZaloAds_deleteConversion",
1297
- "method": "DELETE",
1298
- "endpoint": "/api/conversion/delete/{conversionId}",
1299
- "baseUrl": "https://ads.zalo.me",
1300
- "binaryFields": [],
1301
- "pathFields": [
1302
- "conversionId"
1303
- ],
1304
- "queryFields": [],
1305
- "headerFields": [],
1306
- "cookieFields": [],
1307
- "bodyFields": []
1308
- };
1309
- var OP_ZaloAdsDeleteCustomAudience = {
1310
- "operationId": "ZaloAds_deleteCustomAudience",
1311
- "method": "DELETE",
1312
- "endpoint": "/api/ad/audience/{customAudienceId}",
1313
- "baseUrl": "https://ads.zalo.me",
1314
- "binaryFields": [],
1315
- "pathFields": [
1316
- "customAudienceId"
1317
- ],
1318
- "queryFields": [],
1319
- "headerFields": [],
1320
- "cookieFields": [],
1321
- "bodyFields": []
1322
- };
1323
1246
  var OP_ZaloAdsGetAdById = {
1324
1247
  "operationId": "ZaloAds_getAdById",
1325
1248
  "method": "GET",
@@ -1350,10 +1273,10 @@ var OP_ZaloAdsGetAdChangeLog = {
1350
1273
  "cookieFields": [],
1351
1274
  "bodyFields": []
1352
1275
  };
1353
- var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1354
- "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
1276
+ var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1277
+ "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1355
1278
  "method": "GET",
1356
- "endpoint": "/api/ad/getListAdAdvanceTargeting",
1279
+ "endpoint": "/api/place/getAllDistricts",
1357
1280
  "baseUrl": "https://ads.zalo.me",
1358
1281
  "binaryFields": [],
1359
1282
  "pathFields": [],
@@ -1362,48 +1285,54 @@ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1362
1285
  "cookieFields": [],
1363
1286
  "bodyFields": []
1364
1287
  };
1365
- var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1366
- "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1288
+ var OP_ZaloAdsGetApiSpellCheckV2 = {
1289
+ "operationId": "ZaloAds_getApiSpellCheckV2",
1367
1290
  "method": "GET",
1368
- "endpoint": "/api/ba/account/allAccessors",
1291
+ "endpoint": "/api/spell-check/v2",
1369
1292
  "baseUrl": "https://ads.zalo.me",
1370
1293
  "binaryFields": [],
1371
1294
  "pathFields": [],
1372
1295
  "queryFields": [
1373
- "isShowAll"
1296
+ "text"
1374
1297
  ],
1375
1298
  "headerFields": [],
1376
1299
  "cookieFields": [],
1377
1300
  "bodyFields": []
1378
1301
  };
1379
- var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1380
- "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1302
+ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1303
+ "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1381
1304
  "method": "GET",
1382
- "endpoint": "/api/ba/account/allGrantedMembers",
1305
+ "endpoint": "/zaapi/checkCampHasManyAds",
1383
1306
  "baseUrl": "https://ads.zalo.me",
1384
1307
  "binaryFields": [],
1385
1308
  "pathFields": [],
1386
- "queryFields": [],
1309
+ "queryFields": [
1310
+ "campaignId",
1311
+ "campId"
1312
+ ],
1387
1313
  "headerFields": [],
1388
1314
  "cookieFields": [],
1389
1315
  "bodyFields": []
1390
1316
  };
1391
- var OP_ZaloAdsGetApiConversionAll = {
1392
- "operationId": "ZaloAds_getApiConversionAll",
1317
+ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1318
+ "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1393
1319
  "method": "GET",
1394
- "endpoint": "/api/conversion/all",
1320
+ "endpoint": "/zaapi/getAdsFromCampaignId",
1395
1321
  "baseUrl": "https://ads.zalo.me",
1396
1322
  "binaryFields": [],
1397
1323
  "pathFields": [],
1398
- "queryFields": [],
1324
+ "queryFields": [
1325
+ "campaignId",
1326
+ "campId"
1327
+ ],
1399
1328
  "headerFields": [],
1400
1329
  "cookieFields": [],
1401
1330
  "bodyFields": []
1402
1331
  };
1403
- var OP_ZaloAdsGetApiConversionStandardEvents = {
1404
- "operationId": "ZaloAds_getApiConversionStandardEvents",
1332
+ var OP_ZaloAdsGetZaapiGetallpages = {
1333
+ "operationId": "ZaloAds_getZaapiGetallpages",
1405
1334
  "method": "GET",
1406
- "endpoint": "/api/conversion/standard-events",
1335
+ "endpoint": "/zaapi/getAllPages",
1407
1336
  "baseUrl": "https://ads.zalo.me",
1408
1337
  "binaryFields": [],
1409
1338
  "pathFields": [],
@@ -1412,24 +1341,24 @@ var OP_ZaloAdsGetApiConversionStandardEvents = {
1412
1341
  "cookieFields": [],
1413
1342
  "bodyFields": []
1414
1343
  };
1415
- var OP_ZaloAdsGetApiCustomAudienceAll = {
1416
- "operationId": "ZaloAds_getApiCustomAudienceAll",
1344
+ var OP_ZaloAdsGetZaapiGetownedarticles = {
1345
+ "operationId": "ZaloAds_getZaapiGetownedarticles",
1417
1346
  "method": "GET",
1418
- "endpoint": "/api/custom-audience/all",
1347
+ "endpoint": "/zaapi/getOwnedArticles",
1419
1348
  "baseUrl": "https://ads.zalo.me",
1420
1349
  "binaryFields": [],
1421
1350
  "pathFields": [],
1422
1351
  "queryFields": [
1423
- "newWard"
1352
+ "pageId"
1424
1353
  ],
1425
1354
  "headerFields": [],
1426
1355
  "cookieFields": [],
1427
1356
  "bodyFields": []
1428
1357
  };
1429
- var OP_ZaloAdsGetApiFilegroups = {
1430
- "operationId": "ZaloAds_getApiFilegroups",
1358
+ var OP_ZaloAdsGetZaapiGetownedpages = {
1359
+ "operationId": "ZaloAds_getZaapiGetownedpages",
1431
1360
  "method": "GET",
1432
- "endpoint": "/api/filegroups",
1361
+ "endpoint": "/zaapi/getOwnedPages",
1433
1362
  "baseUrl": "https://ads.zalo.me",
1434
1363
  "binaryFields": [],
1435
1364
  "pathFields": [],
@@ -1438,336 +1367,252 @@ var OP_ZaloAdsGetApiFilegroups = {
1438
1367
  "cookieFields": [],
1439
1368
  "bodyFields": []
1440
1369
  };
1441
- var OP_ZaloAdsGetApiLpNews = {
1442
- "operationId": "ZaloAds_getApiLpNews",
1370
+ var OP_ZaloAdsListFormsByOfficialAccount = {
1371
+ "operationId": "ZaloAds_listFormsByOfficialAccount",
1443
1372
  "method": "GET",
1444
- "endpoint": "/api/lp-news",
1373
+ "endpoint": "/api/form/getByOaId",
1445
1374
  "baseUrl": "https://ads.zalo.me",
1446
1375
  "binaryFields": [],
1447
1376
  "pathFields": [],
1448
- "queryFields": [],
1377
+ "queryFields": [
1378
+ "oaId",
1379
+ "isAll"
1380
+ ],
1449
1381
  "headerFields": [],
1450
1382
  "cookieFields": [],
1451
1383
  "bodyFields": []
1452
1384
  };
1453
- var OP_ZaloAdsGetApiMediaItems = {
1454
- "operationId": "ZaloAds_getApiMediaItems",
1385
+ var OP_ZaloAdsListMiniPagesByTemplate = {
1386
+ "operationId": "ZaloAds_listMiniPagesByTemplate",
1455
1387
  "method": "GET",
1456
- "endpoint": "/api/media/items",
1388
+ "endpoint": "/api/mini-pages",
1457
1389
  "baseUrl": "https://ads.zalo.me",
1458
1390
  "binaryFields": [],
1459
1391
  "pathFields": [],
1460
1392
  "queryFields": [
1461
- "endDate",
1462
- "startDate"
1393
+ "templateIds"
1463
1394
  ],
1464
1395
  "headerFields": [],
1465
1396
  "cookieFields": [],
1466
1397
  "bodyFields": []
1467
1398
  };
1468
- var OP_ZaloAdsGetApiMemberFiles = {
1469
- "operationId": "ZaloAds_getApiMemberFiles",
1470
- "method": "GET",
1471
- "endpoint": "/api/member/files",
1399
+ var OP_ZaloAdsPostZaapiDeletead = {
1400
+ "operationId": "ZaloAds_postZaapiDeletead",
1401
+ "method": "POST",
1402
+ "endpoint": "/zaapi/deleteAd",
1472
1403
  "baseUrl": "https://ads.zalo.me",
1473
1404
  "binaryFields": [],
1474
1405
  "pathFields": [],
1475
- "queryFields": [],
1406
+ "queryFields": [
1407
+ "adId"
1408
+ ],
1476
1409
  "headerFields": [],
1477
1410
  "cookieFields": [],
1478
- "bodyFields": []
1411
+ "bodyFields": [
1412
+ "adId"
1413
+ ]
1479
1414
  };
1480
- var OP_ZaloAdsGetApiNotifiesHeader = {
1481
- "operationId": "ZaloAds_getApiNotifiesHeader",
1482
- "method": "GET",
1483
- "endpoint": "/api/notifies/header",
1415
+ var OP_ZaloAdsRenameCampaign = {
1416
+ "operationId": "ZaloAds_renameCampaign",
1417
+ "method": "POST",
1418
+ "endpoint": "/api/campaign/change-name",
1484
1419
  "baseUrl": "https://ads.zalo.me",
1485
1420
  "binaryFields": [],
1486
1421
  "pathFields": [],
1487
1422
  "queryFields": [],
1488
1423
  "headerFields": [],
1489
1424
  "cookieFields": [],
1490
- "bodyFields": []
1425
+ "bodyFields": [
1426
+ "campid",
1427
+ "newname"
1428
+ ]
1491
1429
  };
1492
- var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1493
- "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1494
- "method": "GET",
1495
- "endpoint": "/api/payment/transaction-history",
1430
+ var OP_ZaloAdsUpdateEcommerceAd = {
1431
+ "operationId": "ZaloAds_updateEcommerceAd",
1432
+ "method": "POST",
1433
+ "endpoint": "/zaapi/UpdateAd",
1496
1434
  "baseUrl": "https://ads.zalo.me",
1497
1435
  "binaryFields": [],
1498
1436
  "pathFields": [],
1499
- "queryFields": [
1500
- "to",
1501
- "from",
1502
- "memberId"
1503
- ],
1437
+ "queryFields": [],
1504
1438
  "headerFields": [],
1505
1439
  "cookieFields": [],
1506
- "bodyFields": []
1440
+ "bodyFields": [
1441
+ "est",
1442
+ "stt",
1443
+ "data",
1444
+ "isBoostAd"
1445
+ ]
1507
1446
  };
1508
- var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1509
- "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1510
- "method": "GET",
1511
- "endpoint": "/api/place/getAllDistricts",
1447
+ var OP_ZaloAdsUpdateFormAd = {
1448
+ "operationId": "ZaloAds_updateFormAd",
1449
+ "method": "POST",
1450
+ "endpoint": "/zaapi/UpdateAd",
1512
1451
  "baseUrl": "https://ads.zalo.me",
1513
1452
  "binaryFields": [],
1514
1453
  "pathFields": [],
1515
1454
  "queryFields": [],
1516
1455
  "headerFields": [],
1517
1456
  "cookieFields": [],
1518
- "bodyFields": []
1457
+ "bodyFields": [
1458
+ "est",
1459
+ "stt",
1460
+ "data",
1461
+ "isBoostAd"
1462
+ ]
1519
1463
  };
1520
- var OP_ZaloAdsGetApiSpellCheckV2 = {
1521
- "operationId": "ZaloAds_getApiSpellCheckV2",
1522
- "method": "GET",
1523
- "endpoint": "/api/spell-check/v2",
1464
+ var OP_ZaloAdsUpdateMessageAd = {
1465
+ "operationId": "ZaloAds_updateMessageAd",
1466
+ "method": "POST",
1467
+ "endpoint": "/zaapi/UpdateAd",
1524
1468
  "baseUrl": "https://ads.zalo.me",
1525
1469
  "binaryFields": [],
1526
1470
  "pathFields": [],
1527
- "queryFields": [
1528
- "text"
1529
- ],
1471
+ "queryFields": [],
1530
1472
  "headerFields": [],
1531
1473
  "cookieFields": [],
1532
- "bodyFields": []
1474
+ "bodyFields": [
1475
+ "est",
1476
+ "stt",
1477
+ "data",
1478
+ "isBoostAd"
1479
+ ]
1533
1480
  };
1534
- var OP_ZaloAdsGetApiWhoami = {
1535
- "operationId": "ZaloAds_getApiWhoami",
1536
- "method": "GET",
1537
- "endpoint": "/api/whoami",
1538
- "baseUrl": "https://ads.zalo.me",
1539
- "binaryFields": [],
1540
- "pathFields": [],
1541
- "queryFields": [],
1542
- "headerFields": [],
1543
- "cookieFields": [],
1544
- "bodyFields": []
1545
- };
1546
- var OP_ZaloAdsGetReportapiV2Ads = {
1547
- "operationId": "ZaloAds_getReportapiV2Ads",
1548
- "method": "GET",
1549
- "endpoint": "/reportapi/v2/ads",
1550
- "baseUrl": "https://ads.zalo.me",
1551
- "binaryFields": [],
1552
- "pathFields": [],
1553
- "queryFields": [
1554
- "to",
1555
- "from",
1556
- "filter",
1557
- "endDate",
1558
- "refresh",
1559
- "breakdown",
1560
- "startDate"
1561
- ],
1562
- "headerFields": [],
1563
- "cookieFields": [],
1564
- "bodyFields": []
1565
- };
1566
- var OP_ZaloAdsGetReportapiV2Campaigns = {
1567
- "operationId": "ZaloAds_getReportapiV2Campaigns",
1568
- "method": "GET",
1569
- "endpoint": "/reportapi/v2/campaigns/{campaignId}",
1481
+ var OP_ZaloAdsUpdateNewAds = {
1482
+ "operationId": "ZaloAds_UpdateNewAds",
1483
+ "method": "POST",
1484
+ "endpoint": "/zaapi/UploadCrop",
1570
1485
  "baseUrl": "https://ads.zalo.me",
1571
- "binaryFields": [],
1572
- "pathFields": [
1573
- "campaignId"
1574
- ],
1575
- "queryFields": [
1576
- "startDate",
1577
- "endDate",
1578
- "refresh"
1486
+ "binaryFields": [
1487
+ "File"
1579
1488
  ],
1580
- "headerFields": [],
1581
- "cookieFields": [],
1582
- "bodyFields": []
1583
- };
1584
- var OP_ZaloAdsGetReportapiV2UniqueUser = {
1585
- "operationId": "ZaloAds_getReportapiV2UniqueUser",
1586
- "method": "GET",
1587
- "endpoint": "/reportapi/v2/unique-user",
1588
- "baseUrl": "https://ads.zalo.me",
1589
- "binaryFields": [],
1590
1489
  "pathFields": [],
1591
1490
  "queryFields": [],
1592
1491
  "headerFields": [],
1593
1492
  "cookieFields": [],
1594
- "bodyFields": []
1595
- };
1596
- var OP_ZaloAdsGetReportapiV3Campaigns = {
1597
- "operationId": "ZaloAds_getReportapiV3Campaigns",
1598
- "method": "GET",
1599
- "endpoint": "/reportapi/v3/campaigns",
1600
- "baseUrl": "https://ads.zalo.me",
1601
- "binaryFields": [],
1602
- "pathFields": [],
1603
- "queryFields": [
1604
- "filter",
1605
- "endDate",
1606
- "refresh",
1607
- "agencyId",
1608
- "createdBy",
1609
- "startDate"
1610
- ],
1611
- "headerFields": [],
1612
- "cookieFields": [],
1613
- "bodyFields": []
1614
- };
1615
- var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
1616
- "operationId": "ZaloAds_getZaapiCampaignReportcampaign",
1617
- "method": "GET",
1618
- "endpoint": "/zaapi/Campaign/reportCampaign",
1619
- "baseUrl": "https://ads.zalo.me",
1620
- "binaryFields": [],
1621
- "pathFields": [],
1622
- "queryFields": [
1623
- "campaignId",
1624
- "campId"
1625
- ],
1626
- "headerFields": [],
1627
- "cookieFields": [],
1628
- "bodyFields": []
1629
- };
1630
- var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1631
- "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1632
- "method": "GET",
1633
- "endpoint": "/zaapi/checkCampHasManyAds",
1634
- "baseUrl": "https://ads.zalo.me",
1635
- "binaryFields": [],
1636
- "pathFields": [],
1637
- "queryFields": [
1638
- "campaignId",
1639
- "campId"
1640
- ],
1641
- "headerFields": [],
1642
- "cookieFields": [],
1643
- "bodyFields": []
1644
- };
1645
- var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1646
- "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1647
- "method": "GET",
1648
- "endpoint": "/zaapi/getAdsFromCampaignId",
1649
- "baseUrl": "https://ads.zalo.me",
1650
- "binaryFields": [],
1651
- "pathFields": [],
1652
- "queryFields": [
1653
- "campaignId",
1654
- "campId"
1655
- ],
1656
- "headerFields": [],
1657
- "cookieFields": [],
1658
- "bodyFields": []
1493
+ "bodyFields": [
1494
+ "File",
1495
+ "x",
1496
+ "y",
1497
+ "width",
1498
+ "height",
1499
+ "scale"
1500
+ ]
1659
1501
  };
1660
- var OP_ZaloAdsGetZaapiGetallpages = {
1661
- "operationId": "ZaloAds_getZaapiGetallpages",
1662
- "method": "GET",
1663
- "endpoint": "/zaapi/getAllPages",
1502
+ var OP_ZaloAdsUpdateOfficialAccountAd = {
1503
+ "operationId": "ZaloAds_updateOfficialAccountAd",
1504
+ "method": "POST",
1505
+ "endpoint": "/zaapi/UpdateAd",
1664
1506
  "baseUrl": "https://ads.zalo.me",
1665
1507
  "binaryFields": [],
1666
1508
  "pathFields": [],
1667
1509
  "queryFields": [],
1668
1510
  "headerFields": [],
1669
1511
  "cookieFields": [],
1670
- "bodyFields": []
1512
+ "bodyFields": [
1513
+ "est",
1514
+ "stt",
1515
+ "data",
1516
+ "isBoostAd"
1517
+ ]
1671
1518
  };
1672
- var OP_ZaloAdsGetZaapiGetownedarticles = {
1673
- "operationId": "ZaloAds_getZaapiGetownedarticles",
1674
- "method": "GET",
1675
- "endpoint": "/zaapi/getOwnedArticles",
1519
+ var OP_ZaloAdsUpdatePostAd = {
1520
+ "operationId": "ZaloAds_updatePostAd",
1521
+ "method": "POST",
1522
+ "endpoint": "/zaapi/UpdateAd",
1676
1523
  "baseUrl": "https://ads.zalo.me",
1677
1524
  "binaryFields": [],
1678
1525
  "pathFields": [],
1679
- "queryFields": [
1680
- "pageId"
1681
- ],
1526
+ "queryFields": [],
1682
1527
  "headerFields": [],
1683
1528
  "cookieFields": [],
1684
- "bodyFields": []
1529
+ "bodyFields": [
1530
+ "est",
1531
+ "stt",
1532
+ "data",
1533
+ "isBoostAd"
1534
+ ]
1685
1535
  };
1686
- var OP_ZaloAdsGetZaapiGetownedpages = {
1687
- "operationId": "ZaloAds_getZaapiGetownedpages",
1688
- "method": "GET",
1689
- "endpoint": "/zaapi/getOwnedPages",
1536
+ var OP_ZaloAdsCreateWebsiteCampaign = {
1537
+ "operationId": "ZaloAds_createWebsiteCampaign",
1538
+ "method": "POST",
1539
+ "endpoint": "/zaapi/addNewCamp",
1690
1540
  "baseUrl": "https://ads.zalo.me",
1691
1541
  "binaryFields": [],
1692
1542
  "pathFields": [],
1693
1543
  "queryFields": [],
1694
1544
  "headerFields": [],
1695
1545
  "cookieFields": [],
1696
- "bodyFields": []
1546
+ "bodyFields": [
1547
+ "data"
1548
+ ]
1697
1549
  };
1698
- var OP_ZaloAdsListAgencyCustomersWithBudget = {
1699
- "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1700
- "method": "GET",
1701
- "endpoint": "/api/ba/agency/customersWithBudget",
1550
+ var OP_ZaloAdsUpdateWebsiteAd = {
1551
+ "operationId": "ZaloAds_updateWebsiteAd",
1552
+ "method": "POST",
1553
+ "endpoint": "/zaapi/UpdateAd",
1702
1554
  "baseUrl": "https://ads.zalo.me",
1703
1555
  "binaryFields": [],
1704
1556
  "pathFields": [],
1705
- "queryFields": [
1706
- "limit",
1707
- "offset",
1708
- "joinDateAsc"
1709
- ],
1557
+ "queryFields": [],
1710
1558
  "headerFields": [],
1711
1559
  "cookieFields": [],
1712
- "bodyFields": []
1560
+ "bodyFields": [
1561
+ "est",
1562
+ "stt",
1563
+ "data",
1564
+ "isBoostAd"
1565
+ ]
1713
1566
  };
1714
- var OP_ZaloAdsListCustomReports = {
1715
- "operationId": "ZaloAds_listCustomReports",
1716
- "method": "GET",
1717
- "endpoint": "/reportapi/custom-report/list",
1567
+ var OP_ZaloAdsCreateDisplayCampaign = {
1568
+ "operationId": "ZaloAds_createDisplayCampaign",
1569
+ "method": "POST",
1570
+ "endpoint": "/zaapi/addNewCamp",
1718
1571
  "baseUrl": "https://ads.zalo.me",
1719
1572
  "binaryFields": [],
1720
1573
  "pathFields": [],
1721
1574
  "queryFields": [],
1722
1575
  "headerFields": [],
1723
1576
  "cookieFields": [],
1724
- "bodyFields": []
1577
+ "bodyFields": [
1578
+ "data"
1579
+ ]
1725
1580
  };
1726
- var OP_ZaloAdsListFormsByOfficialAccount = {
1727
- "operationId": "ZaloAds_listFormsByOfficialAccount",
1728
- "method": "GET",
1729
- "endpoint": "/api/form/getByOaId",
1581
+ var OP_ZaloAdsUpdateDisplayAd = {
1582
+ "operationId": "ZaloAds_updateDisplayAd",
1583
+ "method": "POST",
1584
+ "endpoint": "/zaapi/UpdateAd",
1730
1585
  "baseUrl": "https://ads.zalo.me",
1731
1586
  "binaryFields": [],
1732
1587
  "pathFields": [],
1733
- "queryFields": [
1734
- "oaId",
1735
- "isAll"
1736
- ],
1588
+ "queryFields": [],
1737
1589
  "headerFields": [],
1738
1590
  "cookieFields": [],
1739
- "bodyFields": []
1591
+ "bodyFields": [
1592
+ "est",
1593
+ "stt",
1594
+ "data",
1595
+ "isBoostAd"
1596
+ ]
1740
1597
  };
1741
- var OP_ZaloAdsListMiniPagesByTemplate = {
1742
- "operationId": "ZaloAds_listMiniPagesByTemplate",
1743
- "method": "GET",
1744
- "endpoint": "/api/mini-pages",
1598
+ var OP_ZaloAdsCreateVideoCampaign = {
1599
+ "operationId": "ZaloAds_createVideoCampaign",
1600
+ "method": "POST",
1601
+ "endpoint": "/zaapi/addNewCamp",
1745
1602
  "baseUrl": "https://ads.zalo.me",
1746
1603
  "binaryFields": [],
1747
1604
  "pathFields": [],
1748
- "queryFields": [
1749
- "templateIds"
1750
- ],
1605
+ "queryFields": [],
1751
1606
  "headerFields": [],
1752
1607
  "cookieFields": [],
1753
- "bodyFields": []
1608
+ "bodyFields": [
1609
+ "data"
1610
+ ]
1754
1611
  };
1755
- var OP_ZaloAdsListPersonalPixelLabels = {
1756
- "operationId": "ZaloAds_listPersonalPixelLabels",
1757
- "method": "GET",
1758
- "endpoint": "/api/conversion/support-personal-pixel-labels",
1759
- "baseUrl": "https://ads.zalo.me",
1760
- "binaryFields": [],
1761
- "pathFields": [],
1762
- "queryFields": [],
1763
- "headerFields": [],
1764
- "cookieFields": [],
1765
- "bodyFields": []
1766
- };
1767
- var OP_ZaloAdsPostApiAdEstimateaudience = {
1768
- "operationId": "ZaloAds_postApiAdEstimateaudience",
1769
- "method": "POST",
1770
- "endpoint": "/api/ad/estimateAudience",
1612
+ var OP_ZaloAdsDeleteCampaign = {
1613
+ "operationId": "ZaloAds_deleteCampaign",
1614
+ "method": "POST",
1615
+ "endpoint": "/api/campaign/change-status",
1771
1616
  "baseUrl": "https://ads.zalo.me",
1772
1617
  "binaryFields": [],
1773
1618
  "pathFields": [],
@@ -1775,154 +1620,318 @@ var OP_ZaloAdsPostApiAdEstimateaudience = {
1775
1620
  "headerFields": [],
1776
1621
  "cookieFields": [],
1777
1622
  "bodyFields": [
1778
- "gender",
1779
- "number",
1780
- "ageRanges",
1781
- "locations",
1782
- "platforms",
1783
- "priceType",
1784
- "provinces",
1785
- "wardsTargeting",
1786
- "districtsTargeting"
1623
+ "campaignId",
1624
+ "status"
1787
1625
  ]
1788
1626
  };
1789
- var OP_ZaloAdsPostApiMediaSave = {
1790
- "operationId": "ZaloAds_postApiMediaSave",
1791
- "method": "POST",
1792
- "endpoint": "/api/media/save",
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",
1781
+ "method": "GET",
1782
+ "endpoint": "/api/whoami",
1793
1783
  "baseUrl": "https://ads.zalo.me",
1794
1784
  "binaryFields": [],
1795
1785
  "pathFields": [],
1796
1786
  "queryFields": [],
1797
1787
  "headerFields": [],
1798
1788
  "cookieFields": [],
1799
- "bodyFields": [
1800
- "data"
1801
- ]
1789
+ "bodyFields": []
1802
1790
  };
1803
- var OP_ZaloAdsPostApiMemberUploadImage = {
1804
- "operationId": "ZaloAds_postApiMemberUploadImage",
1805
- "method": "POST",
1806
- "endpoint": "/api/member/upload-image",
1791
+ var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1792
+ "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1793
+ "method": "GET",
1794
+ "endpoint": "/api/payment/transaction-history",
1807
1795
  "baseUrl": "https://ads.zalo.me",
1808
- "binaryFields": [
1809
- "File"
1810
- ],
1796
+ "binaryFields": [],
1811
1797
  "pathFields": [],
1812
- "queryFields": [],
1798
+ "queryFields": [
1799
+ "to",
1800
+ "from",
1801
+ "memberId"
1802
+ ],
1813
1803
  "headerFields": [],
1814
1804
  "cookieFields": [],
1815
- "bodyFields": [
1816
- "File"
1817
- ]
1805
+ "bodyFields": []
1818
1806
  };
1819
- var OP_ZaloAdsPostZaapiDeletead = {
1820
- "operationId": "ZaloAds_postZaapiDeletead",
1821
- "method": "POST",
1822
- "endpoint": "/zaapi/deleteAd",
1807
+ var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1808
+ "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1809
+ "method": "GET",
1810
+ "endpoint": "/api/ba/account/allAccessors",
1823
1811
  "baseUrl": "https://ads.zalo.me",
1824
1812
  "binaryFields": [],
1825
1813
  "pathFields": [],
1826
1814
  "queryFields": [
1827
- "adId"
1815
+ "isShowAll"
1828
1816
  ],
1829
1817
  "headerFields": [],
1830
1818
  "cookieFields": [],
1831
- "bodyFields": [
1832
- "adId"
1833
- ]
1819
+ "bodyFields": []
1834
1820
  };
1835
- var OP_ZaloAdsRenameCampaign = {
1836
- "operationId": "ZaloAds_renameCampaign",
1837
- "method": "POST",
1838
- "endpoint": "/api/campaign/change-name",
1821
+ var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1822
+ "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1823
+ "method": "GET",
1824
+ "endpoint": "/api/ba/account/allGrantedMembers",
1839
1825
  "baseUrl": "https://ads.zalo.me",
1840
1826
  "binaryFields": [],
1841
1827
  "pathFields": [],
1842
1828
  "queryFields": [],
1843
1829
  "headerFields": [],
1844
1830
  "cookieFields": [],
1845
- "bodyFields": [
1846
- "campid",
1847
- "newname"
1848
- ]
1831
+ "bodyFields": []
1849
1832
  };
1850
- var OP_ZaloAdsUpdateEcommerceAd = {
1851
- "operationId": "ZaloAds_updateEcommerceAd",
1852
- "method": "POST",
1853
- "endpoint": "/zaapi/UpdateAd",
1833
+ var OP_ZaloAdsListAgencyCustomersWithBudget = {
1834
+ "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1835
+ "method": "GET",
1836
+ "endpoint": "/api/ba/agency/customersWithBudget",
1854
1837
  "baseUrl": "https://ads.zalo.me",
1855
1838
  "binaryFields": [],
1856
1839
  "pathFields": [],
1857
- "queryFields": [],
1840
+ "queryFields": [
1841
+ "limit",
1842
+ "offset",
1843
+ "joinDateAsc"
1844
+ ],
1858
1845
  "headerFields": [],
1859
1846
  "cookieFields": [],
1860
- "bodyFields": [
1861
- "est",
1862
- "stt",
1863
- "data",
1864
- "isBoostAd"
1865
- ]
1847
+ "bodyFields": []
1866
1848
  };
1867
- var OP_ZaloAdsUpdateFormAd = {
1868
- "operationId": "ZaloAds_updateFormAd",
1869
- "method": "POST",
1870
- "endpoint": "/zaapi/UpdateAd",
1849
+ var OP_ZaloAdsGetApiNotifiesHeader = {
1850
+ "operationId": "ZaloAds_getApiNotifiesHeader",
1851
+ "method": "GET",
1852
+ "endpoint": "/api/notifies/header",
1871
1853
  "baseUrl": "https://ads.zalo.me",
1872
1854
  "binaryFields": [],
1873
1855
  "pathFields": [],
1874
1856
  "queryFields": [],
1875
1857
  "headerFields": [],
1876
1858
  "cookieFields": [],
1877
- "bodyFields": [
1878
- "est",
1879
- "stt",
1880
- "data",
1881
- "isBoostAd"
1882
- ]
1859
+ "bodyFields": []
1883
1860
  };
1884
- var OP_ZaloAdsUpdateMessageAd = {
1885
- "operationId": "ZaloAds_updateMessageAd",
1886
- "method": "POST",
1887
- "endpoint": "/zaapi/UpdateAd",
1861
+ var OP_ZaloAdsGetApiLpNews = {
1862
+ "operationId": "ZaloAds_getApiLpNews",
1863
+ "method": "GET",
1864
+ "endpoint": "/api/lp-news",
1888
1865
  "baseUrl": "https://ads.zalo.me",
1889
1866
  "binaryFields": [],
1890
1867
  "pathFields": [],
1891
1868
  "queryFields": [],
1892
1869
  "headerFields": [],
1893
1870
  "cookieFields": [],
1894
- "bodyFields": [
1895
- "est",
1896
- "stt",
1897
- "data",
1898
- "isBoostAd"
1899
- ]
1871
+ "bodyFields": []
1900
1872
  };
1901
- var OP_ZaloAdsUpdateNewAds = {
1902
- "operationId": "ZaloAds_UpdateNewAds",
1903
- "method": "POST",
1904
- "endpoint": "/zaapi/UploadCrop",
1905
- "baseUrl": "https://ads.zalo.me",
1906
- "binaryFields": [
1907
- "File"
1908
- ],
1909
- "pathFields": [],
1910
- "queryFields": [],
1911
- "headerFields": [],
1912
- "cookieFields": [],
1913
- "bodyFields": [
1914
- "File",
1915
- "x",
1916
- "y",
1917
- "width",
1918
- "height",
1919
- "scale"
1920
- ]
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
+ }
1921
1928
  };
1922
- var OP_ZaloAdsUpdateOfficialAccountAd = {
1923
- "operationId": "ZaloAds_updateOfficialAccountAd",
1929
+
1930
+ // src/services/audiences.service.ts
1931
+ var OP_ZaloAdsCreateCustomAudience = {
1932
+ "operationId": "ZaloAds_createCustomAudience",
1924
1933
  "method": "POST",
1925
- "endpoint": "/zaapi/UpdateAd",
1934
+ "endpoint": "/api/ad/audience",
1926
1935
  "baseUrl": "https://ads.zalo.me",
1927
1936
  "binaryFields": [],
1928
1937
  "pathFields": [],
@@ -1930,64 +1939,55 @@ var OP_ZaloAdsUpdateOfficialAccountAd = {
1930
1939
  "headerFields": [],
1931
1940
  "cookieFields": [],
1932
1941
  "bodyFields": [
1933
- "est",
1934
- "stt",
1935
- "data",
1936
- "isBoostAd"
1942
+ "name",
1943
+ "caType",
1944
+ "targeting"
1937
1945
  ]
1938
1946
  };
1939
- var OP_ZaloAdsUpdatePostAd = {
1940
- "operationId": "ZaloAds_updatePostAd",
1941
- "method": "POST",
1942
- "endpoint": "/zaapi/UpdateAd",
1947
+ var OP_ZaloAdsDeleteCustomAudience = {
1948
+ "operationId": "ZaloAds_deleteCustomAudience",
1949
+ "method": "DELETE",
1950
+ "endpoint": "/api/ad/audience/{customAudienceId}",
1943
1951
  "baseUrl": "https://ads.zalo.me",
1944
1952
  "binaryFields": [],
1945
- "pathFields": [],
1953
+ "pathFields": [
1954
+ "customAudienceId"
1955
+ ],
1946
1956
  "queryFields": [],
1947
1957
  "headerFields": [],
1948
1958
  "cookieFields": [],
1949
- "bodyFields": [
1950
- "est",
1951
- "stt",
1952
- "data",
1953
- "isBoostAd"
1954
- ]
1959
+ "bodyFields": []
1955
1960
  };
1956
- var OP_ZaloAdsCreateWebsiteCampaign = {
1957
- "operationId": "ZaloAds_createWebsiteCampaign",
1958
- "method": "POST",
1959
- "endpoint": "/zaapi/addNewCamp",
1961
+ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1962
+ "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
1963
+ "method": "GET",
1964
+ "endpoint": "/api/ad/getListAdAdvanceTargeting",
1960
1965
  "baseUrl": "https://ads.zalo.me",
1961
1966
  "binaryFields": [],
1962
1967
  "pathFields": [],
1963
1968
  "queryFields": [],
1964
1969
  "headerFields": [],
1965
1970
  "cookieFields": [],
1966
- "bodyFields": [
1967
- "data"
1968
- ]
1971
+ "bodyFields": []
1969
1972
  };
1970
- var OP_ZaloAdsUpdateWebsiteAd = {
1971
- "operationId": "ZaloAds_updateWebsiteAd",
1972
- "method": "POST",
1973
- "endpoint": "/zaapi/UpdateAd",
1973
+ var OP_ZaloAdsGetApiCustomAudienceAll = {
1974
+ "operationId": "ZaloAds_getApiCustomAudienceAll",
1975
+ "method": "GET",
1976
+ "endpoint": "/api/custom-audience/all",
1974
1977
  "baseUrl": "https://ads.zalo.me",
1975
1978
  "binaryFields": [],
1976
1979
  "pathFields": [],
1977
- "queryFields": [],
1980
+ "queryFields": [
1981
+ "newWard"
1982
+ ],
1978
1983
  "headerFields": [],
1979
1984
  "cookieFields": [],
1980
- "bodyFields": [
1981
- "est",
1982
- "stt",
1983
- "data",
1984
- "isBoostAd"
1985
- ]
1985
+ "bodyFields": []
1986
1986
  };
1987
- var OP_ZaloAdsCreateDisplayCampaign = {
1988
- "operationId": "ZaloAds_createDisplayCampaign",
1987
+ var OP_ZaloAdsPostApiAdEstimateaudience = {
1988
+ "operationId": "ZaloAds_postApiAdEstimateaudience",
1989
1989
  "method": "POST",
1990
- "endpoint": "/zaapi/addNewCamp",
1990
+ "endpoint": "/api/ad/estimateAudience",
1991
1991
  "baseUrl": "https://ads.zalo.me",
1992
1992
  "binaryFields": [],
1993
1993
  "pathFields": [],
@@ -1995,190 +1995,292 @@ var OP_ZaloAdsCreateDisplayCampaign = {
1995
1995
  "headerFields": [],
1996
1996
  "cookieFields": [],
1997
1997
  "bodyFields": [
1998
- "data"
1998
+ "gender",
1999
+ "number",
2000
+ "ageRanges",
2001
+ "locations",
2002
+ "platforms",
2003
+ "priceType",
2004
+ "provinces",
2005
+ "wardsTargeting",
2006
+ "districtsTargeting"
1999
2007
  ]
2000
2008
  };
2001
- var OP_ZaloAdsUpdateDisplayAd = {
2002
- "operationId": "ZaloAds_updateDisplayAd",
2009
+ var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2010
+ "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
2003
2011
  "method": "POST",
2004
- "endpoint": "/zaapi/UpdateAd",
2012
+ "endpoint": "/zaapi/uploadPhoneList",
2005
2013
  "baseUrl": "https://ads.zalo.me",
2006
- "binaryFields": [],
2014
+ "binaryFields": [
2015
+ "File"
2016
+ ],
2007
2017
  "pathFields": [],
2008
2018
  "queryFields": [],
2009
2019
  "headerFields": [],
2010
2020
  "cookieFields": [],
2011
2021
  "bodyFields": [
2012
- "est",
2013
- "stt",
2014
- "data",
2015
- "isBoostAd"
2022
+ "File",
2023
+ "isHash"
2016
2024
  ]
2017
2025
  };
2018
- var OP_ZaloAdsCreateVideoCampaign = {
2019
- "operationId": "ZaloAds_createVideoCampaign",
2020
- "method": "POST",
2021
- "endpoint": "/zaapi/addNewCamp",
2022
- "baseUrl": "https://ads.zalo.me",
2023
- "binaryFields": [],
2024
- "pathFields": [],
2025
- "queryFields": [],
2026
- "headerFields": [],
2027
- "cookieFields": [],
2028
- "bodyFields": [
2029
- "data"
2030
- ]
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
+ }
2031
2117
  };
2032
- var OP_ZaloAdsDeleteCampaign = {
2033
- "operationId": "ZaloAds_deleteCampaign",
2034
- "method": "POST",
2035
- "endpoint": "/api/campaign/change-status",
2118
+
2119
+ // src/services/reports.service.ts
2120
+ var OP_ZaloAdsGetReportapiV2Ads = {
2121
+ "operationId": "ZaloAds_getReportapiV2Ads",
2122
+ "method": "GET",
2123
+ "endpoint": "/reportapi/v2/ads",
2036
2124
  "baseUrl": "https://ads.zalo.me",
2037
2125
  "binaryFields": [],
2038
2126
  "pathFields": [],
2039
- "queryFields": [],
2127
+ "queryFields": [
2128
+ "to",
2129
+ "from",
2130
+ "filter",
2131
+ "endDate",
2132
+ "refresh",
2133
+ "breakdown",
2134
+ "startDate"
2135
+ ],
2040
2136
  "headerFields": [],
2041
2137
  "cookieFields": [],
2042
- "bodyFields": [
2043
- "campaignId",
2044
- "status"
2045
- ]
2138
+ "bodyFields": []
2046
2139
  };
2047
- var OP_ZaloAdsListAutomatedRules = {
2048
- "operationId": "ZaloAds_listAutomatedRules",
2140
+ var OP_ZaloAdsGetReportapiV2Campaigns = {
2141
+ "operationId": "ZaloAds_getReportapiV2Campaigns",
2049
2142
  "method": "GET",
2050
- "endpoint": "/api/automatedrules/list",
2143
+ "endpoint": "/reportapi/v2/campaigns/{campaignId}",
2051
2144
  "baseUrl": "https://ads.zalo.me",
2052
2145
  "binaryFields": [],
2053
- "pathFields": [],
2146
+ "pathFields": [
2147
+ "campaignId"
2148
+ ],
2054
2149
  "queryFields": [
2055
- "ruleName"
2150
+ "startDate",
2151
+ "endDate",
2152
+ "refresh"
2056
2153
  ],
2057
2154
  "headerFields": [],
2058
2155
  "cookieFields": [],
2059
2156
  "bodyFields": []
2060
2157
  };
2061
- var OP_ZaloAdsCreateAutomatedRule = {
2062
- "operationId": "ZaloAds_createAutomatedRule",
2063
- "method": "POST",
2064
- "endpoint": "/api/automatedrules/create",
2158
+ var OP_ZaloAdsGetReportapiV2UniqueUser = {
2159
+ "operationId": "ZaloAds_getReportapiV2UniqueUser",
2160
+ "method": "GET",
2161
+ "endpoint": "/reportapi/v2/unique-user",
2065
2162
  "baseUrl": "https://ads.zalo.me",
2066
2163
  "binaryFields": [],
2067
2164
  "pathFields": [],
2068
- "queryFields": [],
2165
+ "queryFields": [
2166
+ "start",
2167
+ "end",
2168
+ "campaignId",
2169
+ "adId"
2170
+ ],
2069
2171
  "headerFields": [],
2070
2172
  "cookieFields": [],
2071
- "bodyFields": [
2072
- "scope",
2073
- "appliedTo",
2074
- "ruleName",
2075
- "action",
2076
- "conditions",
2077
- "frequency",
2078
- "appliedIds",
2079
- "schedule",
2080
- "campaignIds",
2081
- "adIds"
2082
- ]
2173
+ "bodyFields": []
2083
2174
  };
2084
- var OP_ZaloAdsUpdateAutomatedRule = {
2085
- "operationId": "ZaloAds_updateAutomatedRule",
2086
- "method": "POST",
2087
- "endpoint": "/api/automatedrules/update",
2175
+ var OP_ZaloAdsGetReportapiV3Campaigns = {
2176
+ "operationId": "ZaloAds_getReportapiV3Campaigns",
2177
+ "method": "GET",
2178
+ "endpoint": "/reportapi/v3/campaigns",
2088
2179
  "baseUrl": "https://ads.zalo.me",
2089
2180
  "binaryFields": [],
2090
2181
  "pathFields": [],
2091
- "queryFields": [],
2182
+ "queryFields": [
2183
+ "filter",
2184
+ "endDate",
2185
+ "refresh",
2186
+ "agencyId",
2187
+ "createdBy",
2188
+ "startDate"
2189
+ ],
2092
2190
  "headerFields": [],
2093
2191
  "cookieFields": [],
2094
- "bodyFields": [
2095
- "automatedRuleId",
2096
- "rowVersion",
2097
- "appliedTo",
2098
- "ruleName",
2099
- "action",
2100
- "conditions",
2101
- "schedule",
2102
- "campaignIds",
2103
- "adIds"
2104
- ]
2192
+ "bodyFields": []
2105
2193
  };
2106
- var OP_ZaloAdsChangeAutomatedRuleStatus = {
2107
- "operationId": "ZaloAds_changeAutomatedRuleStatus",
2108
- "method": "POST",
2109
- "endpoint": "/api/automatedrules/change-status",
2194
+ var OP_ZaloAdsGetReportOverview = {
2195
+ "operationId": "ZaloAds_getReportOverview",
2196
+ "method": "GET",
2197
+ "endpoint": "/reportapi/report/overview",
2110
2198
  "baseUrl": "https://ads.zalo.me",
2111
2199
  "binaryFields": [],
2112
2200
  "pathFields": [],
2113
- "queryFields": [],
2201
+ "queryFields": [
2202
+ "data"
2203
+ ],
2114
2204
  "headerFields": [],
2115
2205
  "cookieFields": [],
2116
- "bodyFields": [
2117
- "automatedRuleId",
2118
- "automatedRuleIds",
2119
- "status"
2120
- ]
2206
+ "bodyFields": []
2121
2207
  };
2122
- var OP_ZaloAdsGetAutomatedRuleHistory = {
2123
- "operationId": "ZaloAds_getAutomatedRuleHistory",
2208
+ var OP_ZaloAdsGetDemographicsReport = {
2209
+ "operationId": "ZaloAds_getDemographicsReport",
2124
2210
  "method": "GET",
2125
- "endpoint": "/api/automatedrules/history/{automatedRuleId}",
2211
+ "endpoint": "/api/demographics/report",
2126
2212
  "baseUrl": "https://ads.zalo.me",
2127
2213
  "binaryFields": [],
2128
- "pathFields": [
2129
- "automatedRuleId"
2214
+ "pathFields": [],
2215
+ "queryFields": [
2216
+ "campaignId",
2217
+ "adId",
2218
+ "startDate",
2219
+ "endDate",
2220
+ "agencyId",
2221
+ "from",
2222
+ "to"
2130
2223
  ],
2131
- "queryFields": [],
2132
2224
  "headerFields": [],
2133
2225
  "cookieFields": [],
2134
2226
  "bodyFields": []
2135
2227
  };
2136
- var OP_ZaloAdsDeleteAutomatedRule = {
2137
- "operationId": "ZaloAds_deleteAutomatedRule",
2228
+ var OP_ZaloAdsDeleteCustomReport = {
2229
+ "operationId": "ZaloAds_deleteCustomReport",
2138
2230
  "method": "POST",
2139
- "endpoint": "/api/automatedrules/delete",
2231
+ "endpoint": "/reportapi/custom-report/delete/{id}",
2140
2232
  "baseUrl": "https://ads.zalo.me",
2141
2233
  "binaryFields": [],
2142
- "pathFields": [],
2234
+ "pathFields": [
2235
+ "id"
2236
+ ],
2143
2237
  "queryFields": [],
2144
2238
  "headerFields": [],
2145
2239
  "cookieFields": [],
2146
- "bodyFields": [
2147
- "automatedRuleIds"
2148
- ]
2240
+ "bodyFields": []
2149
2241
  };
2150
- var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2151
- "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
2152
- "method": "POST",
2153
- "endpoint": "/zaapi/uploadPhoneList",
2242
+ var OP_ZaloAdsListReportFilters = {
2243
+ "operationId": "ZaloAds_listReportFilters",
2244
+ "method": "GET",
2245
+ "endpoint": "/reportapi/api/filter/list",
2154
2246
  "baseUrl": "https://ads.zalo.me",
2155
- "binaryFields": [
2156
- "File"
2157
- ],
2247
+ "binaryFields": [],
2158
2248
  "pathFields": [],
2159
- "queryFields": [],
2249
+ "queryFields": [
2250
+ "model"
2251
+ ],
2160
2252
  "headerFields": [],
2161
2253
  "cookieFields": [],
2162
- "bodyFields": [
2163
- "File",
2164
- "isHash"
2165
- ]
2254
+ "bodyFields": []
2166
2255
  };
2167
- var OP_ZaloAdsUploadVideo = {
2168
- "operationId": "ZaloAds_uploadVideo",
2169
- "method": "POST",
2170
- "endpoint": "/api/member/upload-video",
2256
+ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
2257
+ "operationId": "ZaloAds_getZaapiCampaignReportcampaign",
2258
+ "method": "GET",
2259
+ "endpoint": "/zaapi/Campaign/reportCampaign",
2171
2260
  "baseUrl": "https://ads.zalo.me",
2172
- "binaryFields": [
2173
- "File"
2261
+ "binaryFields": [],
2262
+ "pathFields": [],
2263
+ "queryFields": [
2264
+ "campaignId",
2265
+ "campId",
2266
+ "from",
2267
+ "to"
2174
2268
  ],
2269
+ "headerFields": [],
2270
+ "cookieFields": [],
2271
+ "bodyFields": []
2272
+ };
2273
+ var OP_ZaloAdsListCustomReports = {
2274
+ "operationId": "ZaloAds_listCustomReports",
2275
+ "method": "GET",
2276
+ "endpoint": "/reportapi/custom-report/list",
2277
+ "baseUrl": "https://ads.zalo.me",
2278
+ "binaryFields": [],
2175
2279
  "pathFields": [],
2176
2280
  "queryFields": [],
2177
2281
  "headerFields": [],
2178
2282
  "cookieFields": [],
2179
- "bodyFields": [
2180
- "File"
2181
- ]
2283
+ "bodyFields": []
2182
2284
  };
2183
2285
  var OP_ZaloAdsUpsertCustomReport = {
2184
2286
  "operationId": "ZaloAds_upsertCustomReport",
@@ -2197,282 +2299,1265 @@ var OP_ZaloAdsUpsertCustomReport = {
2197
2299
  "isDefault"
2198
2300
  ]
2199
2301
  };
2200
- var ZaloAdsService = class {
2302
+ var ZaloReportsService = class {
2201
2303
  constructor(client) {
2202
2304
  this.client = client;
2203
2305
  }
2204
- updateVideoAd(request, options) {
2205
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
2206
- }
2207
- createFlow(request, options) {
2208
- return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
2209
- }
2210
- updateFlow(request, options) {
2211
- return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
2212
- }
2213
- listFlowsByOfficialAccount(request, options) {
2214
- return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
2215
- }
2216
- changeCampaignStatus(request, options) {
2217
- return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
2218
- }
2219
- deleteCampaign(request, options) {
2220
- const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
2221
- return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
2222
- }
2223
- createCustomAudience(request, options) {
2224
- return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
2225
- }
2226
- createWebsiteCampaign(request, options) {
2227
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
2228
- }
2229
- updateWebsiteAd(request, options) {
2230
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
2306
+ getReportapiV2Ads(request, options) {
2307
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
2231
2308
  }
2232
- createDisplayCampaign(request, options) {
2233
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
2309
+ getReportapiV2Campaigns(request = {}, options) {
2310
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
2234
2311
  }
2235
- updateDisplayAd(request, options) {
2236
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
2312
+ getReportapiV2UniqueUser(request, options) {
2313
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
2237
2314
  }
2238
- createVideoCampaign(request, options) {
2239
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, 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);
2240
2322
  }
2241
- createEcommerceCampaign(request, options) {
2242
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
2323
+ getReportOverview(request, options) {
2324
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportOverview, this.client.toTransportInput(OP_ZaloAdsGetReportOverview, request), options);
2243
2325
  }
2244
- /** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
2245
- createCommerceCampaign(request, options) {
2246
- return this.createEcommerceCampaign(request, options);
2326
+ getDemographicsReport(request, options) {
2327
+ return this.client.requestWithoutBody(OP_ZaloAdsGetDemographicsReport, this.client.toTransportInput(OP_ZaloAdsGetDemographicsReport, request), options);
2247
2328
  }
2248
- createForm(request, options) {
2249
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
2329
+ getZaapiCampaignReportcampaign(request, options) {
2330
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
2250
2331
  }
2251
- createFormCampaign(request, options) {
2252
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
2332
+ listCustomReports(request = {}, options) {
2333
+ return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
2253
2334
  }
2254
- createMessageCampaign(request, options) {
2255
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
2335
+ upsertCustomReport(request, options) {
2336
+ return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
2256
2337
  }
2257
- createOfficialAccountCampaign(request, options) {
2258
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
2338
+ deleteCustomReport(request, options) {
2339
+ return this.client.requestJson(OP_ZaloAdsDeleteCustomReport, this.client.toTransportInput(OP_ZaloAdsDeleteCustomReport, request), options);
2259
2340
  }
2260
- /** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
2261
- createOaCampaign(request, options) {
2262
- return this.createOfficialAccountCampaign(request, options);
2341
+ listReportFilters(request, options) {
2342
+ return this.client.requestWithoutBody(OP_ZaloAdsListReportFilters, this.client.toTransportInput(OP_ZaloAdsListReportFilters, request), options);
2263
2343
  }
2264
- createPostCampaign(request, options) {
2265
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, 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);
2266
2347
  }
2267
- /** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
2268
- createArticleCampaign(request, options) {
2269
- return this.createPostCampaign(request, options);
2348
+ /** Báo cáo hiệu quả chiến dịch (API V2) */
2349
+ getCampaignReportV2(...args) {
2350
+ return this.getReportapiV2Campaigns(...args);
2270
2351
  }
2271
- listAutomatedRules(request = {}, options) {
2272
- const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
2273
- return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
2352
+ /** Báo cáo hiệu quả quảng cáo (API V2) */
2353
+ getAdsReportV2(...args) {
2354
+ return this.getReportapiV2Ads(...args);
2274
2355
  }
2275
- createAutomatedRule(request, options) {
2276
- return this.client.requestJson(OP_ZaloAdsCreateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsCreateAutomatedRule, 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);
2277
2359
  }
2278
- updateAutomatedRule(request, options) {
2279
- return this.client.requestJson(OP_ZaloAdsUpdateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsUpdateAutomatedRule, 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);
2280
2363
  }
2281
- changeAutomatedRuleStatus(request, options) {
2282
- return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, 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;
2440
+ }
2441
+ createConversion(request, options) {
2442
+ return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
2443
+ }
2444
+ deleteConversion(request, options) {
2445
+ return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
2446
+ }
2447
+ getApiConversionAll(request = {}, options) {
2448
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
2449
+ }
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;
2616
+ }
2617
+ listAutomatedRules(request = {}, options) {
2618
+ const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
2619
+ return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
2620
+ }
2621
+ createAutomatedRule(request, options) {
2622
+ return this.client.requestJson(OP_ZaloAdsCreateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsCreateAutomatedRule, request), options);
2623
+ }
2624
+ updateAutomatedRule(request, options) {
2625
+ return this.client.requestJson(OP_ZaloAdsUpdateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsUpdateAutomatedRule, request), options);
2626
+ }
2627
+ changeAutomatedRuleStatus(request, options) {
2628
+ return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
2629
+ }
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
+ };
2283
3309
  }
2284
- getAutomatedRuleHistory(request, options) {
2285
- return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
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);
2286
3344
  }
2287
- deleteAutomatedRule(request, options) {
2288
- return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
3345
+ getApiPaymentTransactionHistory(request, options) {
3346
+ return this.account.getApiPaymentTransactionHistory(request, options);
2289
3347
  }
2290
- createConversion(request, options) {
2291
- return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
3348
+ getApiBaAccountAllaccessors(request = {}, options) {
3349
+ return this.account.getApiBaAccountAllaccessors(request, options);
2292
3350
  }
2293
- deleteConversion(request, options) {
2294
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
3351
+ getApiBaAccountAllgrantedmembers(request = {}, options) {
3352
+ return this.account.getApiBaAccountAllgrantedmembers(request, options);
2295
3353
  }
2296
- deleteCustomAudience(request, options) {
2297
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
3354
+ listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
3355
+ return this.account.listAgencyCustomersWithBudget(request, options);
2298
3356
  }
2299
- getAdById(request = {}, options) {
2300
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
3357
+ getApiNotifiesHeader(request = {}, options) {
3358
+ return this.account.getApiNotifiesHeader(request, options);
2301
3359
  }
2302
- getAdChangeLog(request, options) {
2303
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
3360
+ getApiLpNews(request = {}, options) {
3361
+ return this.account.getApiLpNews(request, options);
3362
+ }
3363
+ // =========================================================================
3364
+ // Delegations -> this.audiences
3365
+ // =========================================================================
3366
+ postApiAdEstimateaudience(request, options) {
3367
+ return this.audiences.postApiAdEstimateaudience(request, options);
2304
3368
  }
2305
3369
  getApiAdGetlistadadvancetargeting(request = {}, options) {
2306
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
3370
+ return this.audiences.getApiAdGetlistadadvancetargeting(request, options);
2307
3371
  }
2308
- getApiBaAccountAllaccessors(request = {}, options) {
2309
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
3372
+ getApiCustomAudienceAll(request = {}, options) {
3373
+ return this.audiences.getApiCustomAudienceAll(request, options);
2310
3374
  }
2311
- getApiBaAccountAllgrantedmembers(request = {}, options) {
2312
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
3375
+ createCustomAudience(request, options) {
3376
+ return this.audiences.createCustomAudience(request, options);
2313
3377
  }
2314
- getApiConversionAll(request = {}, options) {
2315
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
3378
+ deleteCustomAudience(request, options) {
3379
+ return this.audiences.deleteCustomAudience(request, options);
2316
3380
  }
2317
- getApiConversionStandardEvents(request = {}, options) {
2318
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
3381
+ uploadCustomAudiencePhoneList(request, options) {
3382
+ return this.audiences.uploadCustomAudiencePhoneList(request, options);
2319
3383
  }
2320
- getApiCustomAudienceAll(request = {}, options) {
2321
- 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);
2322
3387
  }
2323
- getApiFilegroups(request = {}, options) {
2324
- 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);
2325
3391
  }
2326
- getApiLpNews(request = {}, options) {
2327
- 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);
2328
3395
  }
2329
- getApiMediaItems(request, options) {
2330
- 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);
2331
3399
  }
2332
- getApiMemberFiles(request = {}, options) {
2333
- 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);
2334
3403
  }
2335
- getApiNotifiesHeader(request = {}, options) {
2336
- 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);
2337
3407
  }
2338
- getApiPaymentTransactionHistory(request, options) {
2339
- 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);
2340
3411
  }
2341
- getApiPlaceGetalldistricts(request = {}, options) {
2342
- 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);
2343
3415
  }
2344
- getApiSpellCheckV2(request, options) {
2345
- 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);
2346
3419
  }
2347
- getApiWhoami(request = {}, options) {
2348
- 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);
2349
3423
  }
3424
+ // =========================================================================
3425
+ // Delegations -> this.reports
3426
+ // =========================================================================
2350
3427
  getReportapiV2Ads(request, options) {
2351
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
3428
+ return this.reports.getReportapiV2Ads(request, options);
2352
3429
  }
2353
3430
  getReportapiV2Campaigns(request = {}, options) {
2354
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
3431
+ return this.reports.getReportapiV2Campaigns(request, options);
2355
3432
  }
2356
- getReportapiV2UniqueUser(request = {}, options) {
2357
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
3433
+ getReportapiV2UniqueUser(request, options) {
3434
+ return this.reports.getReportapiV2UniqueUser(request, options);
2358
3435
  }
2359
3436
  getReportapiV3Campaigns(request, options) {
2360
- const normalized = {
2361
- filter: "[]",
2362
- agencyId: 0,
2363
- ...request
2364
- };
2365
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
3437
+ return this.reports.getReportapiV3Campaigns(request, options);
2366
3438
  }
2367
- getZaapiCampaignReportcampaign(request = {}, options) {
2368
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
3439
+ getReportOverview(request, options) {
3440
+ return this.reports.getReportOverview(request, options);
2369
3441
  }
2370
- getZaapiCheckcamphasmanyads(request = {}, options) {
2371
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
3442
+ getDemographicsReport(request, options) {
3443
+ return this.reports.getDemographicsReport(request, options);
2372
3444
  }
2373
- getZaapiGetadsfromcampaignid(request = {}, options) {
2374
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
3445
+ getZaapiCampaignReportcampaign(request, options) {
3446
+ return this.reports.getZaapiCampaignReportcampaign(request, options);
2375
3447
  }
2376
- getZaapiGetallpages(request = {}, options) {
2377
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
3448
+ listCustomReports(request = {}, options) {
3449
+ return this.reports.listCustomReports(request, options);
2378
3450
  }
2379
- getAllPages(request = {}, options) {
2380
- return this.getZaapiGetallpages(request, options);
3451
+ upsertCustomReport(request, options) {
3452
+ return this.reports.upsertCustomReport(request, options);
2381
3453
  }
2382
- getZaapiGetownedarticles(request, options) {
2383
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
3454
+ deleteCustomReport(request, options) {
3455
+ return this.reports.deleteCustomReport(request, options);
2384
3456
  }
2385
- getOwnedArticles(request, options) {
2386
- return this.getZaapiGetownedarticles(request, options);
3457
+ listReportFilters(request, options) {
3458
+ return this.reports.listReportFilters(request, options);
2387
3459
  }
2388
- getZaapiGetownedpages(request = {}, options) {
2389
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
3460
+ // =========================================================================
3461
+ // Delegations -> this.conversions
3462
+ // =========================================================================
3463
+ createConversion(request, options) {
3464
+ return this.conversions.createConversion(request, options);
2390
3465
  }
2391
- getOwnedPages(request = {}, options) {
2392
- return this.getZaapiGetownedpages(request, options);
3466
+ deleteConversion(request, options) {
3467
+ return this.conversions.deleteConversion(request, options);
2393
3468
  }
2394
- listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
2395
- const normalized = {
2396
- limit: 15,
2397
- offset: 0,
2398
- joinDateAsc: true,
2399
- ...request
2400
- };
2401
- return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
3469
+ getApiConversionAll(request = {}, options) {
3470
+ return this.conversions.getApiConversionAll(request, options);
2402
3471
  }
2403
- listCustomReports(request = {}, options) {
2404
- return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
3472
+ getApiConversionStandardEvents(request = {}, options) {
3473
+ return this.conversions.getApiConversionStandardEvents(request, options);
2405
3474
  }
2406
- listFormsByOfficialAccount(request, options) {
2407
- return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
3475
+ listPersonalPixelLabels(request = {}, options) {
3476
+ return this.conversions.listPersonalPixelLabels(request, options);
2408
3477
  }
2409
- listMiniPagesByTemplate(request, options) {
2410
- return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, 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);
2411
3481
  }
2412
- listPersonalPixelLabels(request = {}, options) {
2413
- return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, 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);
2414
3485
  }
2415
- postApiAdEstimateaudience(request, options) {
2416
- return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
3486
+ /** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
3487
+ getApiConversionNames(request = {}, options) {
3488
+ return this.conversions.getApiConversionNames(request, options);
2417
3489
  }
2418
- postApiMediaSave(request, options) {
2419
- return this.client.requestFormUrlEncoded(OP_ZaloAdsPostApiMediaSave, this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, request), options);
3490
+ // =========================================================================
3491
+ // Delegations -> this.automatedRules
3492
+ // =========================================================================
3493
+ listAutomatedRules(request = {}, options) {
3494
+ return this.automatedRules.listAutomatedRules(request, options);
2420
3495
  }
2421
- postApiMemberUploadImage(request, options) {
2422
- const normalized = {
2423
- ...request,
2424
- File: request.File ?? request.file
2425
- };
2426
- return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized), options);
3496
+ createAutomatedRule(request, options) {
3497
+ return this.automatedRules.createAutomatedRule(request, options);
2427
3498
  }
2428
- /** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
2429
- uploadImage(request, options) {
2430
- return this.postApiMemberUploadImage(request, options);
3499
+ updateAutomatedRule(request, options) {
3500
+ return this.automatedRules.updateAutomatedRule(request, options);
2431
3501
  }
2432
- postZaapiDeletead(request = {}, options) {
2433
- return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
3502
+ changeAutomatedRuleStatus(request, options) {
3503
+ return this.automatedRules.changeAutomatedRuleStatus(request, options);
2434
3504
  }
2435
- renameCampaign(request, options) {
2436
- return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
3505
+ getAutomatedRuleHistory(request, options) {
3506
+ return this.automatedRules.getAutomatedRuleHistory(request, options);
2437
3507
  }
2438
- updateEcommerceAd(request, options) {
2439
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
3508
+ deleteAutomatedRule(request, options) {
3509
+ return this.automatedRules.deleteAutomatedRule(request, options);
2440
3510
  }
2441
- /** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
2442
- updateCommerceAd(request, options) {
2443
- return this.updateEcommerceAd(request, options);
3511
+ // =========================================================================
3512
+ // Delegations -> this.flows
3513
+ // =========================================================================
3514
+ listFlowsByOfficialAccount(request, options) {
3515
+ return this.flows.listFlowsByOfficialAccount(request, options);
2444
3516
  }
2445
- updateFormAd(request, options) {
2446
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
3517
+ createFlow(request, options) {
3518
+ return this.flows.createFlow(request, options);
2447
3519
  }
2448
- updateMessageAd(request, options) {
2449
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
3520
+ updateFlow(request, options) {
3521
+ return this.flows.updateFlow(request, options);
2450
3522
  }
2451
- updateNewAds(request, options) {
2452
- return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
3523
+ // =========================================================================
3524
+ // Delegations -> this.media
3525
+ // =========================================================================
3526
+ getApiFilegroups(request = {}, options) {
3527
+ return this.media.getApiFilegroups(request, options);
2453
3528
  }
2454
- updateOfficialAccountAd(request, options) {
2455
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
3529
+ getApiMediaItems(request, options) {
3530
+ return this.media.getApiMediaItems(request, options);
2456
3531
  }
2457
- /** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
2458
- updateOaAd(request, options) {
2459
- return this.updateOfficialAccountAd(request, options);
3532
+ getApiMemberFiles(request = {}, options) {
3533
+ return this.media.getApiMemberFiles(request, options);
2460
3534
  }
2461
- updatePostAd(request, options) {
2462
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
3535
+ postApiMediaSave(request, options) {
3536
+ return this.media.postApiMediaSave(request, options);
2463
3537
  }
2464
- /** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
2465
- updateArticleAd(request, options) {
2466
- return this.updatePostAd(request, options);
3538
+ postApiMemberUploadImage(request, options) {
3539
+ return this.media.postApiMemberUploadImage(request, options);
2467
3540
  }
2468
- uploadCustomAudiencePhoneList(request, options) {
2469
- return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
3541
+ /** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
3542
+ uploadImage(request, options) {
3543
+ return this.media.uploadImage(request, options);
2470
3544
  }
2471
3545
  uploadVideo(request, options) {
2472
- return this.client.requestMultipart(OP_ZaloAdsUploadVideo, this.client.toTransportInput(OP_ZaloAdsUploadVideo, request), options);
3546
+ return this.media.uploadVideo(request, options);
2473
3547
  }
2474
- upsertCustomReport(request, options) {
2475
- 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);
2476
3561
  }
2477
3562
  };
2478
3563
 
@@ -2642,6 +3727,20 @@ var OP_ZaloFormsListSimpleFormsByOfficialAccount = {
2642
3727
  "cookieFields": [],
2643
3728
  "bodyFields": []
2644
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
+ };
2645
3744
  var OP_ZaloFormsUpdateFormLeadNotificationInterval = {
2646
3745
  "operationId": "ZaloForms_updateFormLeadNotificationInterval",
2647
3746
  "method": "POST",
@@ -2701,11 +3800,403 @@ var ZaloFormsService = class {
2701
3800
  listSimpleFormsByOfficialAccount(request, options) {
2702
3801
  return this.client.requestWithoutBody(OP_ZaloFormsListSimpleFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListSimpleFormsByOfficialAccount, request), options);
2703
3802
  }
3803
+ listScenariosByOfficialAccount(request, options) {
3804
+ return this.client.requestWithoutBody(OP_ZaloFormsListScenariosByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListScenariosByOfficialAccount, request), options);
3805
+ }
2704
3806
  updateFormLeadNotificationInterval(request, options) {
2705
3807
  return this.client.requestJson(OP_ZaloFormsUpdateFormLeadNotificationInterval, this.client.toTransportInput(OP_ZaloFormsUpdateFormLeadNotificationInterval, request), options);
2706
3808
  }
2707
3809
  };
2708
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
+
2709
4200
  // src/services/instant-pages.service.ts
2710
4201
  var OP_ZaloInstantPagesCloneInstantPage = {
2711
4202
  "operationId": "ZaloInstantPages_cloneInstantPage",
@@ -2908,8 +4399,13 @@ var ZaloInstantPagesService = class {
2908
4399
  constructor(client) {
2909
4400
  this.client = client;
2910
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;
2911
4407
  cloneInstantPage(request, options) {
2912
- 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);
2913
4409
  }
2914
4410
  getInstantPageDetail(request, options) {
2915
4411
  return this.client.requestWithoutBody(OP_ZaloInstantPagesGetInstantPageDetail, this.client.toTransportInput(OP_ZaloInstantPagesGetInstantPageDetail, request), options);
@@ -3186,6 +4682,17 @@ var ZaloWidgetApiService = class {
3186
4682
  var ZaloAdsSdk = class {
3187
4683
  client;
3188
4684
  ads;
4685
+ campaigns;
4686
+ account;
4687
+ audiences;
4688
+ targeting;
4689
+ reports;
4690
+ conversions;
4691
+ pixel;
4692
+ automatedRules;
4693
+ rules;
4694
+ flows;
4695
+ media;
3189
4696
  forms;
3190
4697
  instantPages;
3191
4698
  profileAds;
@@ -3196,6 +4703,17 @@ var ZaloAdsSdk = class {
3196
4703
  const resolvedOptions = typeof options === "string" ? { zpsid: options } : options;
3197
4704
  this.client = new ZaloSdkHttpClient(resolvedOptions);
3198
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;
3199
4717
  this.forms = new ZaloFormsService(this.client);
3200
4718
  this.instantPages = new ZaloInstantPagesService(this.client);
3201
4719
  this.profileAds = new ZaloProfileAdsService(this.client);
@@ -3521,12 +5039,36 @@ var ZaloAdsUpdateMessageAdResponse = class {
3521
5039
  code;
3522
5040
  data;
3523
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 || {});
3524
5065
  // Annotate the CommonJS export names for ESM import in node:
3525
5066
  0 && (module.exports = {
3526
5067
  ALL_ZALO_ADS_DOMAINS,
3527
5068
  MemoryZaloSessionStore,
3528
5069
  RedisZaloSessionStore,
3529
5070
  TieredZaloSessionStore,
5071
+ ZaloAccountService,
3530
5072
  ZaloAdsAccountPool,
3531
5073
  ZaloAdsCreateFlowRequest,
3532
5074
  ZaloAdsCreateFlowResponse,
@@ -3543,11 +5085,20 @@ var ZaloAdsUpdateMessageAdResponse = class {
3543
5085
  ZaloAdsUpdateMessageAdResponse,
3544
5086
  ZaloAdsUpdateVideoAdRequest,
3545
5087
  ZaloAdsUpdateVideoAdResponse,
5088
+ ZaloAudiencesService,
3546
5089
  ZaloAuthManager,
5090
+ ZaloAutomatedRulesService,
5091
+ ZaloCampaignsService,
3547
5092
  ZaloChatWidgetService,
5093
+ ZaloConversionsService,
5094
+ ZaloFlowsService,
3548
5095
  ZaloFormsService,
5096
+ ZaloInstantPageBlockType,
3549
5097
  ZaloInstantPagesService,
5098
+ ZaloInstantPagesValidator,
5099
+ ZaloMediaService,
3550
5100
  ZaloProfileAdsService,
5101
+ ZaloReportsService,
3551
5102
  ZaloSdkError,
3552
5103
  ZaloSdkHttpClient,
3553
5104
  ZaloWidgetApiService,
@@ -3556,6 +5107,19 @@ var ZaloAdsUpdateMessageAdResponse = class {
3556
5107
  decodePlaySessionJwt,
3557
5108
  defaultSharedMemorySessionStore,
3558
5109
  deriveAccountKeyFromZpsid,
3559
- 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
3560
5124
  });
3561
5125
  //# sourceMappingURL=index.js.map