@redonvn/zalo-ads-sdk 0.2.2 → 0.2.7

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,23 @@ __export(index_exports, {
50
51
  ZaloAdsUpdateMessageAdResponse: () => ZaloAdsUpdateMessageAdResponse,
51
52
  ZaloAdsUpdateVideoAdRequest: () => ZaloAdsUpdateVideoAdRequest,
52
53
  ZaloAdsUpdateVideoAdResponse: () => ZaloAdsUpdateVideoAdResponse,
54
+ ZaloAudiencesService: () => ZaloAudiencesService,
55
+ ZaloAudiencesValidator: () => ZaloAudiencesValidator,
53
56
  ZaloAuthManager: () => ZaloAuthManager,
57
+ ZaloAutomatedRulesService: () => ZaloAutomatedRulesService,
58
+ ZaloCampaignsService: () => ZaloCampaignsService,
54
59
  ZaloChatWidgetService: () => ZaloChatWidgetService,
60
+ ZaloConversionsService: () => ZaloConversionsService,
61
+ ZaloFlowsService: () => ZaloFlowsService,
62
+ ZaloFlowsValidator: () => ZaloFlowsValidator,
55
63
  ZaloFormsService: () => ZaloFormsService,
64
+ ZaloFormsValidator: () => ZaloFormsValidator,
65
+ ZaloInstantPageBlockType: () => ZaloInstantPageBlockType,
56
66
  ZaloInstantPagesService: () => ZaloInstantPagesService,
67
+ ZaloInstantPagesValidator: () => ZaloInstantPagesValidator,
68
+ ZaloMediaService: () => ZaloMediaService,
57
69
  ZaloProfileAdsService: () => ZaloProfileAdsService,
70
+ ZaloReportsService: () => ZaloReportsService,
58
71
  ZaloSdkError: () => ZaloSdkError,
59
72
  ZaloSdkHttpClient: () => ZaloSdkHttpClient,
60
73
  ZaloWidgetApiService: () => ZaloWidgetApiService,
@@ -64,7 +77,33 @@ __export(index_exports, {
64
77
  default: () => ZaloAdsSdk,
65
78
  defaultSharedMemorySessionStore: () => defaultSharedMemorySessionStore,
66
79
  deriveAccountKeyFromZpsid: () => deriveAccountKeyFromZpsid,
67
- parseZaloCookieInput: () => parseZaloCookieInput
80
+ parseZaloCookieInput: () => parseZaloCookieInput,
81
+ validateCloneInstantPageRequest: () => validateCloneInstantPageRequest,
82
+ validateCreateFlowRequest: () => validateCreateFlowRequest,
83
+ validateCreateFormEventAudienceRequest: () => validateCreateFormEventAudienceRequest,
84
+ validateCreateFormRequest: () => validateCreateFormRequest,
85
+ validateCreateLookalikeAudienceRequest: () => validateCreateLookalikeAudienceRequest,
86
+ validateCreateMessageOaEventAudienceRequest: () => validateCreateMessageOaEventAudienceRequest,
87
+ validateCreateMessagePersonalEventAudienceRequest: () => validateCreateMessagePersonalEventAudienceRequest,
88
+ validateCreatePhoneAudienceRequest: () => validateCreatePhoneAudienceRequest,
89
+ validateCreateSavedAudienceRequest: () => validateCreateSavedAudienceRequest,
90
+ validateEstimateAudienceRequest: () => validateEstimateAudienceRequest,
91
+ validateGetInstantPageDetailRequest: () => validateGetInstantPageDetailRequest,
92
+ validateGetInstantPageSharedUserRequest: () => validateGetInstantPageSharedUserRequest,
93
+ validateListFlowsByOfficialAccountRequest: () => validateListFlowsByOfficialAccountRequest,
94
+ validateListFormLeadsRequest: () => validateListFormLeadsRequest,
95
+ validateListFormsByOfficialAccountRequest: () => validateListFormsByOfficialAccountRequest,
96
+ validateListInstantPageEditHistoryRequest: () => validateListInstantPageEditHistoryRequest,
97
+ validateListInstantPageFormRecordsRequest: () => validateListInstantPageFormRecordsRequest,
98
+ validateListInstantPageLeadsRequest: () => validateListInstantPageLeadsRequest,
99
+ validateListInstantPageSharesRequest: () => validateListInstantPageSharesRequest,
100
+ validateListInstantPageUsersRequest: () => validateListInstantPageUsersRequest,
101
+ validateListMiniPageTemplatesRequest: () => validateListMiniPageTemplatesRequest,
102
+ validateListOfficialAccountsRequest: () => validateListOfficialAccountsRequest,
103
+ validateSearchInstantPagesRequest: () => validateSearchInstantPagesRequest,
104
+ validateUpdateFlowRequest: () => validateUpdateFlowRequest,
105
+ validateUpdateInstantPageRequest: () => validateUpdateInstantPageRequest,
106
+ validateUpsertInstantPageFormRequest: () => validateUpsertInstantPageFormRequest
68
107
  });
69
108
  module.exports = __toCommonJS(index_exports);
70
109
 
@@ -73,7 +112,7 @@ var ZaloSdkError = class extends Error {
73
112
  status;
74
113
  operationId;
75
114
  responseBody;
76
- constructor(message, status, operationId, responseBody) {
115
+ constructor(message, status = 500, operationId = "unknown", responseBody = null) {
77
116
  super(message);
78
117
  this.name = "ZaloSdkError";
79
118
  this.status = status;
@@ -1108,43 +1147,7 @@ async function resolveCookies(auth, context) {
1108
1147
  return { ...auth?.cookies ?? {}, ...await auth?.getCookies?.(context) ?? {} };
1109
1148
  }
1110
1149
 
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
- };
1150
+ // src/services/campaigns.service.ts
1148
1151
  var OP_ZaloAdsUpdateVideoAd = {
1149
1152
  operationId: "ZaloAds_updateVideoAd",
1150
1153
  method: "POST",
@@ -1172,22 +1175,6 @@ var OP_ZaloAdsChangeCampaignStatus = {
1172
1175
  "campaignId"
1173
1176
  ]
1174
1177
  };
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
1178
  var OP_ZaloAdsCreateEcommerceCampaign = {
1192
1179
  "operationId": "ZaloAds_createEcommerceCampaign",
1193
1180
  "method": "POST",
@@ -1272,54 +1259,6 @@ var OP_ZaloAdsCreatePostCampaign = {
1272
1259
  "data"
1273
1260
  ]
1274
1261
  };
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
1262
  var OP_ZaloAdsGetAdById = {
1324
1263
  "operationId": "ZaloAds_getAdById",
1325
1264
  "method": "GET",
@@ -1350,10 +1289,10 @@ var OP_ZaloAdsGetAdChangeLog = {
1350
1289
  "cookieFields": [],
1351
1290
  "bodyFields": []
1352
1291
  };
1353
- var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1354
- "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
1292
+ var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1293
+ "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1355
1294
  "method": "GET",
1356
- "endpoint": "/api/ad/getListAdAdvanceTargeting",
1295
+ "endpoint": "/api/place/getAllDistricts",
1357
1296
  "baseUrl": "https://ads.zalo.me",
1358
1297
  "binaryFields": [],
1359
1298
  "pathFields": [],
@@ -1362,48 +1301,54 @@ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
1362
1301
  "cookieFields": [],
1363
1302
  "bodyFields": []
1364
1303
  };
1365
- var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1366
- "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1304
+ var OP_ZaloAdsGetApiSpellCheckV2 = {
1305
+ "operationId": "ZaloAds_getApiSpellCheckV2",
1367
1306
  "method": "GET",
1368
- "endpoint": "/api/ba/account/allAccessors",
1307
+ "endpoint": "/api/spell-check/v2",
1369
1308
  "baseUrl": "https://ads.zalo.me",
1370
1309
  "binaryFields": [],
1371
1310
  "pathFields": [],
1372
1311
  "queryFields": [
1373
- "isShowAll"
1312
+ "text"
1374
1313
  ],
1375
1314
  "headerFields": [],
1376
1315
  "cookieFields": [],
1377
1316
  "bodyFields": []
1378
1317
  };
1379
- var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1380
- "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1318
+ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1319
+ "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1381
1320
  "method": "GET",
1382
- "endpoint": "/api/ba/account/allGrantedMembers",
1321
+ "endpoint": "/zaapi/checkCampHasManyAds",
1383
1322
  "baseUrl": "https://ads.zalo.me",
1384
1323
  "binaryFields": [],
1385
1324
  "pathFields": [],
1386
- "queryFields": [],
1325
+ "queryFields": [
1326
+ "campaignId",
1327
+ "campId"
1328
+ ],
1387
1329
  "headerFields": [],
1388
1330
  "cookieFields": [],
1389
1331
  "bodyFields": []
1390
1332
  };
1391
- var OP_ZaloAdsGetApiConversionAll = {
1392
- "operationId": "ZaloAds_getApiConversionAll",
1333
+ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1334
+ "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1393
1335
  "method": "GET",
1394
- "endpoint": "/api/conversion/all",
1336
+ "endpoint": "/zaapi/getAdsFromCampaignId",
1395
1337
  "baseUrl": "https://ads.zalo.me",
1396
1338
  "binaryFields": [],
1397
1339
  "pathFields": [],
1398
- "queryFields": [],
1340
+ "queryFields": [
1341
+ "campaignId",
1342
+ "campId"
1343
+ ],
1399
1344
  "headerFields": [],
1400
1345
  "cookieFields": [],
1401
1346
  "bodyFields": []
1402
1347
  };
1403
- var OP_ZaloAdsGetApiConversionStandardEvents = {
1404
- "operationId": "ZaloAds_getApiConversionStandardEvents",
1348
+ var OP_ZaloAdsGetZaapiGetallpages = {
1349
+ "operationId": "ZaloAds_getZaapiGetallpages",
1405
1350
  "method": "GET",
1406
- "endpoint": "/api/conversion/standard-events",
1351
+ "endpoint": "/zaapi/getAllPages",
1407
1352
  "baseUrl": "https://ads.zalo.me",
1408
1353
  "binaryFields": [],
1409
1354
  "pathFields": [],
@@ -1412,24 +1357,24 @@ var OP_ZaloAdsGetApiConversionStandardEvents = {
1412
1357
  "cookieFields": [],
1413
1358
  "bodyFields": []
1414
1359
  };
1415
- var OP_ZaloAdsGetApiCustomAudienceAll = {
1416
- "operationId": "ZaloAds_getApiCustomAudienceAll",
1360
+ var OP_ZaloAdsGetZaapiGetownedarticles = {
1361
+ "operationId": "ZaloAds_getZaapiGetownedarticles",
1417
1362
  "method": "GET",
1418
- "endpoint": "/api/custom-audience/all",
1363
+ "endpoint": "/zaapi/getOwnedArticles",
1419
1364
  "baseUrl": "https://ads.zalo.me",
1420
1365
  "binaryFields": [],
1421
1366
  "pathFields": [],
1422
1367
  "queryFields": [
1423
- "newWard"
1368
+ "pageId"
1424
1369
  ],
1425
1370
  "headerFields": [],
1426
1371
  "cookieFields": [],
1427
1372
  "bodyFields": []
1428
1373
  };
1429
- var OP_ZaloAdsGetApiFilegroups = {
1430
- "operationId": "ZaloAds_getApiFilegroups",
1374
+ var OP_ZaloAdsGetZaapiGetownedpages = {
1375
+ "operationId": "ZaloAds_getZaapiGetownedpages",
1431
1376
  "method": "GET",
1432
- "endpoint": "/api/filegroups",
1377
+ "endpoint": "/zaapi/getOwnedPages",
1433
1378
  "baseUrl": "https://ads.zalo.me",
1434
1379
  "binaryFields": [],
1435
1380
  "pathFields": [],
@@ -1438,324 +1383,1026 @@ var OP_ZaloAdsGetApiFilegroups = {
1438
1383
  "cookieFields": [],
1439
1384
  "bodyFields": []
1440
1385
  };
1441
- var OP_ZaloAdsGetApiLpNews = {
1442
- "operationId": "ZaloAds_getApiLpNews",
1386
+ var OP_ZaloAdsListFormsByOfficialAccount = {
1387
+ "operationId": "ZaloAds_listFormsByOfficialAccount",
1443
1388
  "method": "GET",
1444
- "endpoint": "/api/lp-news",
1389
+ "endpoint": "/api/form/getByOaId",
1445
1390
  "baseUrl": "https://ads.zalo.me",
1446
1391
  "binaryFields": [],
1447
1392
  "pathFields": [],
1448
- "queryFields": [],
1393
+ "queryFields": [
1394
+ "oaId",
1395
+ "isAll"
1396
+ ],
1449
1397
  "headerFields": [],
1450
1398
  "cookieFields": [],
1451
1399
  "bodyFields": []
1452
1400
  };
1453
- var OP_ZaloAdsGetApiMediaItems = {
1454
- "operationId": "ZaloAds_getApiMediaItems",
1401
+ var OP_ZaloAdsListMiniPagesByTemplate = {
1402
+ "operationId": "ZaloAds_listMiniPagesByTemplate",
1455
1403
  "method": "GET",
1456
- "endpoint": "/api/media/items",
1404
+ "endpoint": "/api/mini-pages",
1457
1405
  "baseUrl": "https://ads.zalo.me",
1458
1406
  "binaryFields": [],
1459
1407
  "pathFields": [],
1460
1408
  "queryFields": [
1461
- "endDate",
1462
- "startDate"
1409
+ "templateIds"
1463
1410
  ],
1464
1411
  "headerFields": [],
1465
1412
  "cookieFields": [],
1466
1413
  "bodyFields": []
1467
1414
  };
1468
- var OP_ZaloAdsGetApiMemberFiles = {
1469
- "operationId": "ZaloAds_getApiMemberFiles",
1470
- "method": "GET",
1471
- "endpoint": "/api/member/files",
1415
+ var OP_ZaloAdsPostZaapiDeletead = {
1416
+ "operationId": "ZaloAds_postZaapiDeletead",
1417
+ "method": "POST",
1418
+ "endpoint": "/zaapi/deleteAd",
1472
1419
  "baseUrl": "https://ads.zalo.me",
1473
1420
  "binaryFields": [],
1474
1421
  "pathFields": [],
1475
- "queryFields": [],
1422
+ "queryFields": [
1423
+ "adId"
1424
+ ],
1476
1425
  "headerFields": [],
1477
1426
  "cookieFields": [],
1478
- "bodyFields": []
1427
+ "bodyFields": [
1428
+ "adId"
1429
+ ]
1479
1430
  };
1480
- var OP_ZaloAdsGetApiNotifiesHeader = {
1481
- "operationId": "ZaloAds_getApiNotifiesHeader",
1482
- "method": "GET",
1483
- "endpoint": "/api/notifies/header",
1431
+ var OP_ZaloAdsRenameCampaign = {
1432
+ "operationId": "ZaloAds_renameCampaign",
1433
+ "method": "POST",
1434
+ "endpoint": "/api/campaign/change-name",
1484
1435
  "baseUrl": "https://ads.zalo.me",
1485
1436
  "binaryFields": [],
1486
1437
  "pathFields": [],
1487
1438
  "queryFields": [],
1488
1439
  "headerFields": [],
1489
1440
  "cookieFields": [],
1490
- "bodyFields": []
1441
+ "bodyFields": [
1442
+ "campid",
1443
+ "newname"
1444
+ ]
1491
1445
  };
1492
- var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1493
- "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1494
- "method": "GET",
1495
- "endpoint": "/api/payment/transaction-history",
1446
+ var OP_ZaloAdsUpdateEcommerceAd = {
1447
+ "operationId": "ZaloAds_updateEcommerceAd",
1448
+ "method": "POST",
1449
+ "endpoint": "/zaapi/UpdateAd",
1496
1450
  "baseUrl": "https://ads.zalo.me",
1497
1451
  "binaryFields": [],
1498
1452
  "pathFields": [],
1499
- "queryFields": [
1500
- "to",
1501
- "from",
1502
- "memberId"
1503
- ],
1453
+ "queryFields": [],
1504
1454
  "headerFields": [],
1505
1455
  "cookieFields": [],
1506
- "bodyFields": []
1456
+ "bodyFields": [
1457
+ "est",
1458
+ "stt",
1459
+ "data",
1460
+ "isBoostAd"
1461
+ ]
1507
1462
  };
1508
- var OP_ZaloAdsGetApiPlaceGetalldistricts = {
1509
- "operationId": "ZaloAds_getApiPlaceGetalldistricts",
1510
- "method": "GET",
1511
- "endpoint": "/api/place/getAllDistricts",
1463
+ var OP_ZaloAdsUpdateFormAd = {
1464
+ "operationId": "ZaloAds_updateFormAd",
1465
+ "method": "POST",
1466
+ "endpoint": "/zaapi/UpdateAd",
1512
1467
  "baseUrl": "https://ads.zalo.me",
1513
1468
  "binaryFields": [],
1514
1469
  "pathFields": [],
1515
1470
  "queryFields": [],
1516
1471
  "headerFields": [],
1517
1472
  "cookieFields": [],
1518
- "bodyFields": []
1473
+ "bodyFields": [
1474
+ "est",
1475
+ "stt",
1476
+ "data",
1477
+ "isBoostAd"
1478
+ ]
1519
1479
  };
1520
- var OP_ZaloAdsGetApiSpellCheckV2 = {
1521
- "operationId": "ZaloAds_getApiSpellCheckV2",
1522
- "method": "GET",
1523
- "endpoint": "/api/spell-check/v2",
1480
+ var OP_ZaloAdsUpdateMessageAd = {
1481
+ "operationId": "ZaloAds_updateMessageAd",
1482
+ "method": "POST",
1483
+ "endpoint": "/zaapi/UpdateAd",
1524
1484
  "baseUrl": "https://ads.zalo.me",
1525
1485
  "binaryFields": [],
1526
1486
  "pathFields": [],
1527
- "queryFields": [
1528
- "text"
1529
- ],
1487
+ "queryFields": [],
1530
1488
  "headerFields": [],
1531
1489
  "cookieFields": [],
1532
- "bodyFields": []
1490
+ "bodyFields": [
1491
+ "est",
1492
+ "stt",
1493
+ "data",
1494
+ "isBoostAd"
1495
+ ]
1533
1496
  };
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}",
1497
+ var OP_ZaloAdsUpdateNewAds = {
1498
+ "operationId": "ZaloAds_UpdateNewAds",
1499
+ "method": "POST",
1500
+ "endpoint": "/zaapi/UploadCrop",
1570
1501
  "baseUrl": "https://ads.zalo.me",
1571
- "binaryFields": [],
1572
- "pathFields": [
1573
- "campaignId"
1574
- ],
1575
- "queryFields": [
1576
- "startDate",
1577
- "endDate",
1578
- "refresh"
1502
+ "binaryFields": [
1503
+ "File"
1579
1504
  ],
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
1505
  "pathFields": [],
1591
1506
  "queryFields": [],
1592
1507
  "headerFields": [],
1593
1508
  "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": []
1509
+ "bodyFields": [
1510
+ "File",
1511
+ "x",
1512
+ "y",
1513
+ "width",
1514
+ "height",
1515
+ "scale"
1516
+ ]
1629
1517
  };
1630
- var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1631
- "operationId": "ZaloAds_getZaapiCheckcamphasmanyads",
1632
- "method": "GET",
1633
- "endpoint": "/zaapi/checkCampHasManyAds",
1518
+ var OP_ZaloAdsUpdateOfficialAccountAd = {
1519
+ "operationId": "ZaloAds_updateOfficialAccountAd",
1520
+ "method": "POST",
1521
+ "endpoint": "/zaapi/UpdateAd",
1634
1522
  "baseUrl": "https://ads.zalo.me",
1635
1523
  "binaryFields": [],
1636
1524
  "pathFields": [],
1637
- "queryFields": [
1638
- "campaignId",
1639
- "campId"
1640
- ],
1525
+ "queryFields": [],
1641
1526
  "headerFields": [],
1642
1527
  "cookieFields": [],
1643
- "bodyFields": []
1528
+ "bodyFields": [
1529
+ "est",
1530
+ "stt",
1531
+ "data",
1532
+ "isBoostAd"
1533
+ ]
1644
1534
  };
1645
- var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1646
- "operationId": "ZaloAds_getZaapiGetadsfromcampaignid",
1647
- "method": "GET",
1648
- "endpoint": "/zaapi/getAdsFromCampaignId",
1535
+ var OP_ZaloAdsUpdatePostAd = {
1536
+ "operationId": "ZaloAds_updatePostAd",
1537
+ "method": "POST",
1538
+ "endpoint": "/zaapi/UpdateAd",
1649
1539
  "baseUrl": "https://ads.zalo.me",
1650
1540
  "binaryFields": [],
1651
1541
  "pathFields": [],
1652
- "queryFields": [
1653
- "campaignId",
1654
- "campId"
1655
- ],
1542
+ "queryFields": [],
1656
1543
  "headerFields": [],
1657
1544
  "cookieFields": [],
1658
- "bodyFields": []
1545
+ "bodyFields": [
1546
+ "est",
1547
+ "stt",
1548
+ "data",
1549
+ "isBoostAd"
1550
+ ]
1659
1551
  };
1660
- var OP_ZaloAdsGetZaapiGetallpages = {
1661
- "operationId": "ZaloAds_getZaapiGetallpages",
1662
- "method": "GET",
1663
- "endpoint": "/zaapi/getAllPages",
1552
+ var OP_ZaloAdsCreateWebsiteCampaign = {
1553
+ "operationId": "ZaloAds_createWebsiteCampaign",
1554
+ "method": "POST",
1555
+ "endpoint": "/zaapi/addNewCamp",
1664
1556
  "baseUrl": "https://ads.zalo.me",
1665
1557
  "binaryFields": [],
1666
1558
  "pathFields": [],
1667
1559
  "queryFields": [],
1668
1560
  "headerFields": [],
1669
1561
  "cookieFields": [],
1670
- "bodyFields": []
1562
+ "bodyFields": [
1563
+ "data"
1564
+ ]
1671
1565
  };
1672
- var OP_ZaloAdsGetZaapiGetownedarticles = {
1673
- "operationId": "ZaloAds_getZaapiGetownedarticles",
1674
- "method": "GET",
1675
- "endpoint": "/zaapi/getOwnedArticles",
1566
+ var OP_ZaloAdsUpdateWebsiteAd = {
1567
+ "operationId": "ZaloAds_updateWebsiteAd",
1568
+ "method": "POST",
1569
+ "endpoint": "/zaapi/UpdateAd",
1676
1570
  "baseUrl": "https://ads.zalo.me",
1677
1571
  "binaryFields": [],
1678
1572
  "pathFields": [],
1679
- "queryFields": [
1680
- "pageId"
1681
- ],
1573
+ "queryFields": [],
1682
1574
  "headerFields": [],
1683
1575
  "cookieFields": [],
1684
- "bodyFields": []
1576
+ "bodyFields": [
1577
+ "est",
1578
+ "stt",
1579
+ "data",
1580
+ "isBoostAd"
1581
+ ]
1685
1582
  };
1686
- var OP_ZaloAdsGetZaapiGetownedpages = {
1687
- "operationId": "ZaloAds_getZaapiGetownedpages",
1688
- "method": "GET",
1689
- "endpoint": "/zaapi/getOwnedPages",
1583
+ var OP_ZaloAdsCreateDisplayCampaign = {
1584
+ "operationId": "ZaloAds_createDisplayCampaign",
1585
+ "method": "POST",
1586
+ "endpoint": "/zaapi/addNewCamp",
1690
1587
  "baseUrl": "https://ads.zalo.me",
1691
1588
  "binaryFields": [],
1692
1589
  "pathFields": [],
1693
1590
  "queryFields": [],
1694
1591
  "headerFields": [],
1695
1592
  "cookieFields": [],
1696
- "bodyFields": []
1593
+ "bodyFields": [
1594
+ "data"
1595
+ ]
1697
1596
  };
1698
- var OP_ZaloAdsListAgencyCustomersWithBudget = {
1699
- "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1700
- "method": "GET",
1701
- "endpoint": "/api/ba/agency/customersWithBudget",
1597
+ var OP_ZaloAdsUpdateDisplayAd = {
1598
+ "operationId": "ZaloAds_updateDisplayAd",
1599
+ "method": "POST",
1600
+ "endpoint": "/zaapi/UpdateAd",
1702
1601
  "baseUrl": "https://ads.zalo.me",
1703
1602
  "binaryFields": [],
1704
1603
  "pathFields": [],
1705
- "queryFields": [
1706
- "limit",
1707
- "offset",
1708
- "joinDateAsc"
1709
- ],
1604
+ "queryFields": [],
1710
1605
  "headerFields": [],
1711
1606
  "cookieFields": [],
1712
- "bodyFields": []
1607
+ "bodyFields": [
1608
+ "est",
1609
+ "stt",
1610
+ "data",
1611
+ "isBoostAd"
1612
+ ]
1713
1613
  };
1714
- var OP_ZaloAdsListCustomReports = {
1715
- "operationId": "ZaloAds_listCustomReports",
1716
- "method": "GET",
1717
- "endpoint": "/reportapi/custom-report/list",
1614
+ var OP_ZaloAdsCreateVideoCampaign = {
1615
+ "operationId": "ZaloAds_createVideoCampaign",
1616
+ "method": "POST",
1617
+ "endpoint": "/zaapi/addNewCamp",
1718
1618
  "baseUrl": "https://ads.zalo.me",
1719
1619
  "binaryFields": [],
1720
1620
  "pathFields": [],
1721
1621
  "queryFields": [],
1722
1622
  "headerFields": [],
1723
1623
  "cookieFields": [],
1724
- "bodyFields": []
1624
+ "bodyFields": [
1625
+ "data"
1626
+ ]
1725
1627
  };
1726
- var OP_ZaloAdsListFormsByOfficialAccount = {
1727
- "operationId": "ZaloAds_listFormsByOfficialAccount",
1728
- "method": "GET",
1729
- "endpoint": "/api/form/getByOaId",
1628
+ var OP_ZaloAdsDeleteCampaign = {
1629
+ "operationId": "ZaloAds_deleteCampaign",
1630
+ "method": "POST",
1631
+ "endpoint": "/api/campaign/change-status",
1730
1632
  "baseUrl": "https://ads.zalo.me",
1731
1633
  "binaryFields": [],
1732
1634
  "pathFields": [],
1733
- "queryFields": [
1734
- "oaId",
1735
- "isAll"
1736
- ],
1635
+ "queryFields": [],
1737
1636
  "headerFields": [],
1738
1637
  "cookieFields": [],
1739
- "bodyFields": []
1638
+ "bodyFields": [
1639
+ "campaignId",
1640
+ "status"
1641
+ ]
1740
1642
  };
1741
- var OP_ZaloAdsListMiniPagesByTemplate = {
1742
- "operationId": "ZaloAds_listMiniPagesByTemplate",
1743
- "method": "GET",
1744
- "endpoint": "/api/mini-pages",
1745
- "baseUrl": "https://ads.zalo.me",
1746
- "binaryFields": [],
1747
- "pathFields": [],
1748
- "queryFields": [
1749
- "templateIds"
1750
- ],
1751
- "headerFields": [],
1752
- "cookieFields": [],
1753
- "bodyFields": []
1643
+ var OP_ZaloAdsCreateSpellCheckV3Job = {
1644
+ operationId: "zalo_ads_create_spell_check_v3_job",
1645
+ method: "POST",
1646
+ endpoint: "/api/spell-check/v3",
1647
+ baseUrl: "https://ads.zalo.me",
1648
+ binaryFields: [],
1649
+ pathFields: [],
1650
+ queryFields: [],
1651
+ headerFields: [],
1652
+ cookieFields: [],
1653
+ bodyFields: ["title", "caption"]
1754
1654
  };
1755
- var OP_ZaloAdsListPersonalPixelLabels = {
1756
- "operationId": "ZaloAds_listPersonalPixelLabels",
1655
+ var OP_ZaloAdsGetSpellCheckV3Job = {
1656
+ operationId: "zalo_ads_get_spell_check_v3_job",
1657
+ method: "GET",
1658
+ endpoint: "/api/spell-check/v3/{jobId}",
1659
+ baseUrl: "https://ads.zalo.me",
1660
+ binaryFields: [],
1661
+ pathFields: ["jobId"],
1662
+ queryFields: [],
1663
+ headerFields: [],
1664
+ cookieFields: [],
1665
+ bodyFields: []
1666
+ };
1667
+ var ZaloCampaignsService = class {
1668
+ constructor(client) {
1669
+ this.client = client;
1670
+ }
1671
+ updateVideoAd(request, options) {
1672
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
1673
+ }
1674
+ changeCampaignStatus(request, options) {
1675
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
1676
+ }
1677
+ deleteCampaign(request, options) {
1678
+ const payload = { campaignId: request.campaignId, status: request.status ?? -2 };
1679
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsDeleteCampaign, this.client.toTransportInput(OP_ZaloAdsDeleteCampaign, payload), options);
1680
+ }
1681
+ createWebsiteCampaign(request, options) {
1682
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
1683
+ }
1684
+ updateWebsiteAd(request, options) {
1685
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
1686
+ }
1687
+ createDisplayCampaign(request, options) {
1688
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
1689
+ }
1690
+ updateDisplayAd(request, options) {
1691
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
1692
+ }
1693
+ createVideoCampaign(request, options) {
1694
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, request), options);
1695
+ }
1696
+ createEcommerceCampaign(request, options) {
1697
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
1698
+ }
1699
+ /** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
1700
+ createCommerceCampaign(request, options) {
1701
+ return this.createEcommerceCampaign(request, options);
1702
+ }
1703
+ createForm(request, options) {
1704
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
1705
+ }
1706
+ createFormCampaign(request, options) {
1707
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
1708
+ }
1709
+ createMessageCampaign(request, options) {
1710
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
1711
+ }
1712
+ createOfficialAccountCampaign(request, options) {
1713
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
1714
+ }
1715
+ /** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
1716
+ createOaCampaign(request, options) {
1717
+ return this.createOfficialAccountCampaign(request, options);
1718
+ }
1719
+ createPostCampaign(request, options) {
1720
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
1721
+ }
1722
+ /** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
1723
+ createArticleCampaign(request, options) {
1724
+ return this.createPostCampaign(request, options);
1725
+ }
1726
+ getAdById(request = {}, options) {
1727
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
1728
+ }
1729
+ getAdChangeLog(request, options) {
1730
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
1731
+ }
1732
+ getApiPlaceGetalldistricts(request = {}, options) {
1733
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
1734
+ }
1735
+ getApiSpellCheckV2(request, options) {
1736
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
1737
+ }
1738
+ getZaapiCheckcamphasmanyads(request = {}, options) {
1739
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
1740
+ }
1741
+ getZaapiGetadsfromcampaignid(request = {}, options) {
1742
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
1743
+ }
1744
+ getZaapiGetallpages(request = {}, options) {
1745
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
1746
+ }
1747
+ getAllPages(request = {}, options) {
1748
+ return this.getZaapiGetallpages(request, options);
1749
+ }
1750
+ getZaapiGetownedarticles(request, options) {
1751
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
1752
+ }
1753
+ getOwnedArticles(request, options) {
1754
+ return this.getZaapiGetownedarticles(request, options);
1755
+ }
1756
+ getZaapiGetownedpages(request = {}, options) {
1757
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
1758
+ }
1759
+ getOwnedPages(request = {}, options) {
1760
+ return this.getZaapiGetownedpages(request, options);
1761
+ }
1762
+ listFormsByOfficialAccount(request, options) {
1763
+ return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
1764
+ }
1765
+ listMiniPagesByTemplate(request, options) {
1766
+ return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, request), options);
1767
+ }
1768
+ postZaapiDeletead(request = {}, options) {
1769
+ return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
1770
+ }
1771
+ renameCampaign(request, options) {
1772
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
1773
+ }
1774
+ updateEcommerceAd(request, options) {
1775
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
1776
+ }
1777
+ /** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
1778
+ updateCommerceAd(request, options) {
1779
+ return this.updateEcommerceAd(request, options);
1780
+ }
1781
+ updateFormAd(request, options) {
1782
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
1783
+ }
1784
+ updateMessageAd(request, options) {
1785
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
1786
+ }
1787
+ updateNewAds(request, options) {
1788
+ return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
1789
+ }
1790
+ updateOfficialAccountAd(request, options) {
1791
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
1792
+ }
1793
+ /** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
1794
+ updateOaAd(request, options) {
1795
+ return this.updateOfficialAccountAd(request, options);
1796
+ }
1797
+ updatePostAd(request, options) {
1798
+ return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
1799
+ }
1800
+ /** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
1801
+ updateArticleAd(request, options) {
1802
+ return this.updatePostAd(request, options);
1803
+ }
1804
+ /** Xóa quảng cáo */
1805
+ deleteAd(...args) {
1806
+ return this.postZaapiDeletead(...args);
1807
+ }
1808
+ /** Danh sách quận/huyện để nhắm mục tiêu */
1809
+ getAllDistricts(...args) {
1810
+ return this.getApiPlaceGetalldistricts(...args);
1811
+ }
1812
+ /** Kiểm tra chính tả văn bản quảng cáo */
1813
+ getSpellCheckV2(...args) {
1814
+ return this.getApiSpellCheckV2(...args);
1815
+ }
1816
+ /**
1817
+ * Khởi tạo tác vụ kiểm tra chính tả và vi phạm quy chuẩn quảng cáo AI V3 (POST /api/spell-check/v3).
1818
+ */
1819
+ createSpellCheckV3Job(request, options) {
1820
+ return this.client.requestJson(
1821
+ OP_ZaloAdsCreateSpellCheckV3Job,
1822
+ this.client.toTransportInput(OP_ZaloAdsCreateSpellCheckV3Job, request),
1823
+ options
1824
+ );
1825
+ }
1826
+ /**
1827
+ * Lấy kết quả kiểm tra chính tả AI V3 theo jobId (GET /api/spell-check/v3/{jobId}).
1828
+ */
1829
+ getSpellCheckV3Job(request, options) {
1830
+ return this.client.requestWithoutBody(
1831
+ OP_ZaloAdsGetSpellCheckV3Job,
1832
+ this.client.toTransportInput(OP_ZaloAdsGetSpellCheckV3Job, request),
1833
+ options
1834
+ );
1835
+ }
1836
+ /**
1837
+ * Helper kiểm tra chính tả AI V3 trọn gói: Gửi kiểm tra và tự động polling cho đến khi hoàn thành (hoặc timeout).
1838
+ * @param request Tiêu đề (title) và chú thích (caption) cần kiểm tra.
1839
+ * @param pollIntervalMs Chu kỳ polling kiểm tra trạng thái (mặc định: 600ms).
1840
+ * @param timeoutMs Thời gian chờ tối đa (mặc định: 15.000ms = 15 giây).
1841
+ */
1842
+ async checkSpellV3AndWait(request, pollIntervalMs = 600, timeoutMs = 15e3, options) {
1843
+ const jobRes = await this.createSpellCheckV3Job(request, options);
1844
+ const jobId = jobRes?.data?.jobId;
1845
+ if (!jobId) {
1846
+ throw new Error(`[SpellCheckV3] Kh\xF4ng nh\u1EADn \u0111\u01B0\u1EE3c jobId t\u1EEB Zalo Ads (code: ${jobRes?.code})`);
1847
+ }
1848
+ const startTime = Date.now();
1849
+ while (Date.now() - startTime < timeoutMs) {
1850
+ await new Promise((r) => setTimeout(r, pollIntervalMs));
1851
+ const res = await this.getSpellCheckV3Job({ jobId }, options);
1852
+ if (res?.data?.status === "COMPLETED") {
1853
+ return res;
1854
+ }
1855
+ }
1856
+ throw new Error(`[SpellCheckV3] Qu\xE1 th\u1EDDi gian ch\u1EDD (${timeoutMs}ms) cho t\xE1c v\u1EE5 ki\u1EC3m tra ch\xEDnh t\u1EA3 jobId: ${jobId}`);
1857
+ }
1858
+ };
1859
+
1860
+ // src/services/account.service.ts
1861
+ var OP_ZaloAdsGetApiWhoami = {
1862
+ "operationId": "ZaloAds_getApiWhoami",
1757
1863
  "method": "GET",
1758
- "endpoint": "/api/conversion/support-personal-pixel-labels",
1864
+ "endpoint": "/api/whoami",
1865
+ "baseUrl": "https://ads.zalo.me",
1866
+ "binaryFields": [],
1867
+ "pathFields": [],
1868
+ "queryFields": [],
1869
+ "headerFields": [],
1870
+ "cookieFields": [],
1871
+ "bodyFields": []
1872
+ };
1873
+ var OP_ZaloAdsGetApiPaymentTransactionHistory = {
1874
+ "operationId": "ZaloAds_getApiPaymentTransactionHistory",
1875
+ "method": "GET",
1876
+ "endpoint": "/api/payment/transaction-history",
1877
+ "baseUrl": "https://ads.zalo.me",
1878
+ "binaryFields": [],
1879
+ "pathFields": [],
1880
+ "queryFields": [
1881
+ "to",
1882
+ "from",
1883
+ "memberId"
1884
+ ],
1885
+ "headerFields": [],
1886
+ "cookieFields": [],
1887
+ "bodyFields": []
1888
+ };
1889
+ var OP_ZaloAdsGetApiBaAccountAllaccessors = {
1890
+ "operationId": "ZaloAds_getApiBaAccountAllaccessors",
1891
+ "method": "GET",
1892
+ "endpoint": "/api/ba/account/allAccessors",
1893
+ "baseUrl": "https://ads.zalo.me",
1894
+ "binaryFields": [],
1895
+ "pathFields": [],
1896
+ "queryFields": [
1897
+ "isShowAll"
1898
+ ],
1899
+ "headerFields": [],
1900
+ "cookieFields": [],
1901
+ "bodyFields": []
1902
+ };
1903
+ var OP_ZaloAdsGetApiBaAccountAllgrantedmembers = {
1904
+ "operationId": "ZaloAds_getApiBaAccountAllgrantedmembers",
1905
+ "method": "GET",
1906
+ "endpoint": "/api/ba/account/allGrantedMembers",
1907
+ "baseUrl": "https://ads.zalo.me",
1908
+ "binaryFields": [],
1909
+ "pathFields": [],
1910
+ "queryFields": [],
1911
+ "headerFields": [],
1912
+ "cookieFields": [],
1913
+ "bodyFields": []
1914
+ };
1915
+ var OP_ZaloAdsListAgencyCustomersWithBudget = {
1916
+ "operationId": "ZaloAds_listAgencyCustomersWithBudget",
1917
+ "method": "GET",
1918
+ "endpoint": "/api/ba/agency/customersWithBudget",
1919
+ "baseUrl": "https://ads.zalo.me",
1920
+ "binaryFields": [],
1921
+ "pathFields": [],
1922
+ "queryFields": [
1923
+ "limit",
1924
+ "offset",
1925
+ "joinDateAsc"
1926
+ ],
1927
+ "headerFields": [],
1928
+ "cookieFields": [],
1929
+ "bodyFields": []
1930
+ };
1931
+ var OP_ZaloAdsGetApiNotifiesHeader = {
1932
+ "operationId": "ZaloAds_getApiNotifiesHeader",
1933
+ "method": "GET",
1934
+ "endpoint": "/api/notifies/header",
1935
+ "baseUrl": "https://ads.zalo.me",
1936
+ "binaryFields": [],
1937
+ "pathFields": [],
1938
+ "queryFields": [],
1939
+ "headerFields": [],
1940
+ "cookieFields": [],
1941
+ "bodyFields": []
1942
+ };
1943
+ var OP_ZaloAdsGetApiLpNews = {
1944
+ "operationId": "ZaloAds_getApiLpNews",
1945
+ "method": "GET",
1946
+ "endpoint": "/api/lp-news",
1947
+ "baseUrl": "https://ads.zalo.me",
1948
+ "binaryFields": [],
1949
+ "pathFields": [],
1950
+ "queryFields": [],
1951
+ "headerFields": [],
1952
+ "cookieFields": [],
1953
+ "bodyFields": []
1954
+ };
1955
+ var ZaloAccountService = class {
1956
+ constructor(client) {
1957
+ this.client = client;
1958
+ }
1959
+ getApiWhoami(request = {}, options) {
1960
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiWhoami, this.client.toTransportInput(OP_ZaloAdsGetApiWhoami, request), options);
1961
+ }
1962
+ getApiPaymentTransactionHistory(request, options) {
1963
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiPaymentTransactionHistory, this.client.toTransportInput(OP_ZaloAdsGetApiPaymentTransactionHistory, request), options);
1964
+ }
1965
+ getApiBaAccountAllaccessors(request = {}, options) {
1966
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
1967
+ }
1968
+ getApiBaAccountAllgrantedmembers(request = {}, options) {
1969
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
1970
+ }
1971
+ listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
1972
+ const normalized = {
1973
+ limit: 15,
1974
+ offset: 0,
1975
+ joinDateAsc: true,
1976
+ ...request
1977
+ };
1978
+ return this.client.requestWithoutBody(OP_ZaloAdsListAgencyCustomersWithBudget, this.client.toTransportInput(OP_ZaloAdsListAgencyCustomersWithBudget, normalized), options);
1979
+ }
1980
+ getApiNotifiesHeader(request = {}, options) {
1981
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
1982
+ }
1983
+ getApiLpNews(request = {}, options) {
1984
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
1985
+ }
1986
+ /** Lấy thông tin tài khoản đang đăng nhập */
1987
+ getWhoami(...args) {
1988
+ return this.getApiWhoami(...args);
1989
+ }
1990
+ /** Lịch sử giao dịch thanh toán */
1991
+ getPaymentTransactionHistory(...args) {
1992
+ return this.getApiPaymentTransactionHistory(...args);
1993
+ }
1994
+ /** Danh sách accessor tài khoản BA */
1995
+ getBaAccountAllAccessors(...args) {
1996
+ return this.getApiBaAccountAllaccessors(...args);
1997
+ }
1998
+ /** Danh sách thành viên được cấp quyền BA */
1999
+ getBaAccountAllGrantedMembers(...args) {
2000
+ return this.getApiBaAccountAllgrantedmembers(...args);
2001
+ }
2002
+ /** Thông báo trên thanh tiêu đề */
2003
+ getNotifiesHeader(...args) {
2004
+ return this.getApiNotifiesHeader(...args);
2005
+ }
2006
+ /** Tin tức landing page / bảng tin */
2007
+ getLpNews(...args) {
2008
+ return this.getApiLpNews(...args);
2009
+ }
2010
+ };
2011
+
2012
+ // src/validators/audiences.validator.ts
2013
+ function validateCreateSavedAudienceRequest(input) {
2014
+ const errors = [];
2015
+ if (!input || typeof input !== "object") {
2016
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2017
+ }
2018
+ const raw = input;
2019
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2020
+ if (!name) {
2021
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' l\xE0 b\u1EAFt bu\u1ED9c.");
2022
+ } else if (name.length < 2 || name.length > 255) {
2023
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2024
+ }
2025
+ let targetingObj;
2026
+ if (typeof raw.targeting === "string") {
2027
+ try {
2028
+ targetingObj = JSON.parse(raw.targeting);
2029
+ } catch {
2030
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2031
+ targetingObj = {};
2032
+ }
2033
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2034
+ targetingObj = raw.targeting;
2035
+ } else {
2036
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 b\u1EAFt bu\u1ED9c (chu\u1ED7i JSON ho\u1EB7c Object c\u1EA5u h\xECnh targeting).");
2037
+ targetingObj = {};
2038
+ }
2039
+ const gender = typeof targetingObj.Gender === "number" ? targetingObj.Gender : 0;
2040
+ if (![0, 1, 2].includes(gender)) {
2041
+ errors.push("Tr\u01B0\u1EDDng 'Gender' ph\u1EA3i l\xE0 0 (T\u1EA5t c\u1EA3), 1 (Nam), ho\u1EB7c 2 (N\u1EEF).");
2042
+ }
2043
+ const VALID_AGE_RANGES = [10282, 10283, 10284, 10285, 10286, 10287, 10288];
2044
+ const newAgeRanges = Array.isArray(targetingObj.NewAgeRanges) && targetingObj.NewAgeRanges.length > 0 ? targetingObj.NewAgeRanges.map(Number) : VALID_AGE_RANGES;
2045
+ for (const age of newAgeRanges) {
2046
+ if (!VALID_AGE_RANGES.includes(age)) {
2047
+ errors.push(`M\xE3 \u0111\u1ED9 tu\u1ED5i '${age}' kh\xF4ng h\u1EE3p l\u1EC7. C\xE1c m\xE3 cho ph\xE9p: ${VALID_AGE_RANGES.join(", ")}.`);
2048
+ }
2049
+ }
2050
+ const VALID_OS = [0, 1, 2, 3];
2051
+ const os = Array.isArray(targetingObj.Os) && targetingObj.Os.length > 0 ? targetingObj.Os.map(Number) : [0, 1, 3];
2052
+ for (const o of os) {
2053
+ if (!VALID_OS.includes(o)) {
2054
+ errors.push(`M\xE3 h\u1EC7 \u0111i\u1EC1u h\xE0nh '${o}' kh\xF4ng h\u1EE3p l\u1EC7 (0: Android, 1: iOS, 2: Windows Phone, 3: PC).`);
2055
+ }
2056
+ }
2057
+ let location = targetingObj.Location;
2058
+ if (!location || typeof location !== "object") {
2059
+ location = {
2060
+ Addresses: [],
2061
+ Cities: [],
2062
+ WardTargeting: { Includes: [], Excludes: [] }
2063
+ };
2064
+ } else {
2065
+ location = {
2066
+ Addresses: Array.isArray(location.Addresses) ? location.Addresses : [],
2067
+ Cities: Array.isArray(location.Cities) ? location.Cities : [],
2068
+ WardTargeting: location.WardTargeting && typeof location.WardTargeting === "object" ? location.WardTargeting : { Includes: [], Excludes: [] }
2069
+ };
2070
+ if (location.WardTargeting.Includes && !Array.isArray(location.WardTargeting.Includes)) {
2071
+ errors.push("Tr\u01B0\u1EDDng 'Location.WardTargeting.Includes' ph\u1EA3i l\xE0 m\u1ED9t m\u1EA3ng khu v\u1EF1c.");
2072
+ } else if (Array.isArray(location.WardTargeting.Includes)) {
2073
+ for (const inc of location.WardTargeting.Includes) {
2074
+ if (![1, 2, 3].includes(Number(inc.Id))) {
2075
+ errors.push(`M\xE3 v\xF9ng mi\u1EC1n Id='${inc.Id}' kh\xF4ng h\u1EE3p l\u1EC7 (1: Mi\u1EC1n B\u1EAFc, 2: Mi\u1EC1n Trung, 3: Mi\u1EC1n Nam).`);
2076
+ }
2077
+ if (inc.Provinces && !Array.isArray(inc.Provinces)) {
2078
+ errors.push(`Tr\u01B0\u1EDDng 'Provinces' trong v\xF9ng mi\u1EC1n Id=${inc.Id} ph\u1EA3i l\xE0 m\u1ED9t m\u1EA3ng t\u1EC9nh/th\xE0nh.`);
2079
+ }
2080
+ }
2081
+ }
2082
+ }
2083
+ const finalTargeting = {
2084
+ ...targetingObj,
2085
+ CustomAudienceId: 0,
2086
+ Gender: gender,
2087
+ NewAgeRanges: newAgeRanges,
2088
+ Os: os,
2089
+ Location: location
2090
+ };
2091
+ return {
2092
+ isValid: errors.length === 0,
2093
+ errors,
2094
+ data: errors.length === 0 ? {
2095
+ name,
2096
+ caType: 1,
2097
+ targeting: JSON.stringify(finalTargeting)
2098
+ } : void 0
2099
+ };
2100
+ }
2101
+ function validateCreatePhoneAudienceRequest(input) {
2102
+ const errors = [];
2103
+ if (!input || typeof input !== "object") {
2104
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2105
+ }
2106
+ const raw = input;
2107
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2108
+ if (!name || name.length < 2 || name.length > 255) {
2109
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2110
+ }
2111
+ let targetingObj = {};
2112
+ if (typeof raw.targeting === "string") {
2113
+ try {
2114
+ targetingObj = JSON.parse(raw.targeting);
2115
+ } catch {
2116
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2117
+ }
2118
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2119
+ targetingObj = raw.targeting;
2120
+ } else {
2121
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 b\u1EAFt bu\u1ED9c.");
2122
+ }
2123
+ const path = typeof targetingObj.Path === "string" ? targetingObj.Path.trim() : "";
2124
+ if (!path) {
2125
+ errors.push("Tr\u01B0\u1EDDng 'Path' (URL file .txt sau khi upload) l\xE0 b\u1EAFt bu\u1ED9c.");
2126
+ }
2127
+ const total = typeof targetingObj.Total === "number" ? targetingObj.Total : 0;
2128
+ if (total <= 0) {
2129
+ errors.push("Tr\u01B0\u1EDDng 'Total' (s\u1ED1 l\u01B0\u1EE3ng S\u0110T trong file) ph\u1EA3i l\u1EDBn h\u01A1n 0.");
2130
+ }
2131
+ return {
2132
+ isValid: errors.length === 0,
2133
+ errors,
2134
+ data: errors.length === 0 ? {
2135
+ name,
2136
+ caType: 3,
2137
+ targeting: JSON.stringify({
2138
+ Name: String(targetingObj.Name || "phones.txt"),
2139
+ Path: path,
2140
+ Total: total,
2141
+ ZaloId: Number(targetingObj.ZaloId || 0),
2142
+ OriginAudience: 0
2143
+ })
2144
+ } : void 0
2145
+ };
2146
+ }
2147
+ function validateCreateLookalikeAudienceRequest(input) {
2148
+ const errors = [];
2149
+ if (!input || typeof input !== "object") {
2150
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2151
+ }
2152
+ const raw = input;
2153
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2154
+ if (!name || name.length < 2 || name.length > 255) {
2155
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2156
+ }
2157
+ let targetingObj = {};
2158
+ if (typeof raw.targeting === "string") {
2159
+ try {
2160
+ targetingObj = JSON.parse(raw.targeting);
2161
+ } catch {
2162
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2163
+ }
2164
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2165
+ targetingObj = raw.targeting;
2166
+ } else {
2167
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 b\u1EAFt bu\u1ED9c.");
2168
+ }
2169
+ const originAudience = Number(targetingObj.OriginAudience);
2170
+ if (!originAudience || originAudience <= 0) {
2171
+ errors.push("Tr\u01B0\u1EDDng 'OriginAudience' (ID nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng S\u0110T g\u1ED1c) l\xE0 b\u1EAFt bu\u1ED9c.");
2172
+ }
2173
+ const total = Number(targetingObj.Total);
2174
+ if (![1e6, 15e5, 2e6].includes(total)) {
2175
+ errors.push("Tr\u01B0\u1EDDng 'Total' c\u1EE7a Lookalike ch\u1EC9 ch\u1EA5p nh\u1EADn c\xE1c m\u1ED1c: 1.000.000, 1.500.000 ho\u1EB7c 2.000.000.");
2176
+ }
2177
+ return {
2178
+ isValid: errors.length === 0,
2179
+ errors,
2180
+ data: errors.length === 0 ? {
2181
+ name,
2182
+ caType: 6,
2183
+ targeting: JSON.stringify({
2184
+ OriginAudience: originAudience,
2185
+ Total: total,
2186
+ Name: String(targetingObj.Name || "Lookalike Audience"),
2187
+ Path: String(targetingObj.Path || "")
2188
+ })
2189
+ } : void 0
2190
+ };
2191
+ }
2192
+ function validateCreateFormEventAudienceRequest(input) {
2193
+ const errors = [];
2194
+ if (!input || typeof input !== "object") {
2195
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2196
+ }
2197
+ const raw = input;
2198
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2199
+ if (!name || name.length < 2 || name.length > 255) {
2200
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2201
+ }
2202
+ let targetingObj = {};
2203
+ if (typeof raw.targeting === "string") {
2204
+ try {
2205
+ targetingObj = JSON.parse(raw.targeting);
2206
+ } catch {
2207
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2208
+ }
2209
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2210
+ targetingObj = raw.targeting;
2211
+ }
2212
+ const eventType = Number(targetingObj.EventType);
2213
+ if (![1, 2, 3, 4].includes(eventType)) {
2214
+ errors.push("Tr\u01B0\u1EDDng 'EventType' ph\u1EA3i l\xE0 1 (\u0110\xE3 xem ch\u01B0a g\u1EEDi), 2 (\u0110\xE3 xem & g\u1EEDi), 3 (\u0110\xE3 xem), ho\u1EB7c 4 (M\u1EDF chat t\u1EEB Form).");
2215
+ }
2216
+ const oaId = typeof targetingObj.OaId === "string" ? targetingObj.OaId.trim() : String(targetingObj.OaId || "");
2217
+ if (!oaId) {
2218
+ errors.push("Tr\u01B0\u1EDDng 'OaId' (d\u1EA1ng chu\u1ED7i c\u1EE7a pageId ho\u1EB7c noisedId) l\xE0 b\u1EAFt bu\u1ED9c.");
2219
+ }
2220
+ const numDays = Number(targetingObj.NumDays);
2221
+ if (isNaN(numDays) || numDays < 1 || numDays > 90) {
2222
+ errors.push("Tr\u01B0\u1EDDng 'NumDays' ph\u1EA3i n\u1EB1m trong kho\u1EA3ng t\u1EEB 1 \u0111\u1EBFn 90 ng\xE0y.");
2223
+ }
2224
+ const formIds = Array.isArray(targetingObj.FormIds) ? targetingObj.FormIds : [];
2225
+ if (formIds.length === 0) {
2226
+ errors.push("Tr\u01B0\u1EDDng 'FormIds' ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t 1 ID Form.");
2227
+ }
2228
+ return {
2229
+ isValid: errors.length === 0,
2230
+ errors,
2231
+ data: errors.length === 0 ? {
2232
+ name,
2233
+ caType: 12,
2234
+ targeting: JSON.stringify({
2235
+ EventType: eventType,
2236
+ OaId: oaId,
2237
+ NumDays: numDays,
2238
+ FormIds: formIds
2239
+ })
2240
+ } : void 0
2241
+ };
2242
+ }
2243
+ function validateCreateMessageOaEventAudienceRequest(input) {
2244
+ const errors = [];
2245
+ if (!input || typeof input !== "object") {
2246
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2247
+ }
2248
+ const raw = input;
2249
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2250
+ if (!name || name.length < 2 || name.length > 255) {
2251
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2252
+ }
2253
+ let targetingObj = {};
2254
+ if (typeof raw.targeting === "string") {
2255
+ try {
2256
+ targetingObj = JSON.parse(raw.targeting);
2257
+ } catch {
2258
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2259
+ }
2260
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2261
+ targetingObj = raw.targeting;
2262
+ }
2263
+ const eventId = Number(targetingObj.EventId ?? targetingObj.EventType ?? 1);
2264
+ const oaId = typeof targetingObj.OaId === "string" ? targetingObj.OaId.trim() : String(targetingObj.OaId || "");
2265
+ if (!oaId) {
2266
+ errors.push("Tr\u01B0\u1EDDng 'OaId' (chu\u1ED7i pageId ho\u1EB7c noisedId c\u1EE7a OA) l\xE0 b\u1EAFt bu\u1ED9c.");
2267
+ }
2268
+ const numDays = Number(targetingObj.NumDays);
2269
+ if (isNaN(numDays) || numDays < 1 || numDays > 90) {
2270
+ errors.push("Tr\u01B0\u1EDDng 'NumDays' ph\u1EA3i n\u1EB1m trong kho\u1EA3ng t\u1EEB 1 \u0111\u1EBFn 90 ng\xE0y.");
2271
+ }
2272
+ return {
2273
+ isValid: errors.length === 0,
2274
+ errors,
2275
+ data: errors.length === 0 ? {
2276
+ name,
2277
+ caType: 11,
2278
+ targeting: JSON.stringify({
2279
+ EventId: eventId,
2280
+ OaId: oaId,
2281
+ NumDays: numDays
2282
+ })
2283
+ } : void 0
2284
+ };
2285
+ }
2286
+ function validateCreateMessagePersonalEventAudienceRequest(input) {
2287
+ const errors = [];
2288
+ if (!input || typeof input !== "object") {
2289
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2290
+ }
2291
+ const raw = input;
2292
+ const name = typeof raw.name === "string" ? raw.name.trim() : "";
2293
+ if (!name || name.length < 2 || name.length > 255) {
2294
+ errors.push("T\xEAn nh\xF3m \u0111\u1ED1i t\u01B0\u1EE3ng 'name' ph\u1EA3i t\u1EEB 2 \u0111\u1EBFn 255 k\xFD t\u1EF1.");
2295
+ }
2296
+ let targetingObj = {};
2297
+ if (typeof raw.targeting === "string") {
2298
+ try {
2299
+ targetingObj = JSON.parse(raw.targeting);
2300
+ } catch {
2301
+ errors.push("Tr\u01B0\u1EDDng 'targeting' l\xE0 chu\u1ED7i JSON kh\xF4ng h\u1EE3p l\u1EC7.");
2302
+ }
2303
+ } else if (raw.targeting && typeof raw.targeting === "object") {
2304
+ targetingObj = raw.targeting;
2305
+ }
2306
+ const eventId = Number(targetingObj.EventId ?? targetingObj.EventType ?? 1);
2307
+ if (![1, 2, 3].includes(eventId)) {
2308
+ errors.push("Tr\u01B0\u1EDDng 'EventId' ph\u1EA3i l\xE0 1 (\u0110\xE3 li\xEAn h\u1EC7), 2 (\u0110\xE3 xem kh\xF4ng li\xEAn h\u1EC7), ho\u1EB7c 3 (Xem carousel kh\xF4ng li\xEAn h\u1EC7).");
2309
+ }
2310
+ const numDays = Number(targetingObj.NumDays);
2311
+ if (isNaN(numDays) || numDays < 1 || numDays > 90) {
2312
+ errors.push("Tr\u01B0\u1EDDng 'NumDays' ph\u1EA3i n\u1EB1m trong kho\u1EA3ng t\u1EEB 1 \u0111\u1EBFn 90 ng\xE0y.");
2313
+ }
2314
+ const pageIds = Array.isArray(targetingObj.PageIds) ? targetingObj.PageIds.map(String) : [];
2315
+ if (pageIds.length === 0) {
2316
+ errors.push("Tr\u01B0\u1EDDng 'PageIds' ph\u1EA3i ch\u1EE9a \xEDt nh\u1EA5t 1 ID trang c\xE1 nh\xE2n.");
2317
+ }
2318
+ return {
2319
+ isValid: errors.length === 0,
2320
+ errors,
2321
+ data: errors.length === 0 ? {
2322
+ name,
2323
+ caType: 14,
2324
+ targeting: JSON.stringify({
2325
+ EventId: eventId,
2326
+ NumDays: numDays,
2327
+ PageIds: pageIds
2328
+ })
2329
+ } : void 0
2330
+ };
2331
+ }
2332
+ function validateEstimateAudienceRequest(input) {
2333
+ const errors = [];
2334
+ if (!input || typeof input !== "object") {
2335
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
2336
+ }
2337
+ const raw = input;
2338
+ const gender = typeof raw.gender === "number" ? raw.gender : 0;
2339
+ if (![0, 1, 2].includes(gender)) {
2340
+ errors.push("Tr\u01B0\u1EDDng 'gender' ph\u1EA3i l\xE0 0, 1 ho\u1EB7c 2.");
2341
+ }
2342
+ const ageRanges = Array.isArray(raw.ageRanges) && raw.ageRanges.length > 0 ? raw.ageRanges.map(Number) : [10283, 10284, 10285, 10286, 10287];
2343
+ const platforms = Array.isArray(raw.platforms) && raw.platforms.length > 0 ? raw.platforms.map(Number) : [0, 1, 3];
2344
+ const priceType = typeof raw.priceType === "number" ? raw.priceType : 2;
2345
+ const wardsTargeting = typeof raw.wardsTargeting === "string" && raw.wardsTargeting.trim() ? raw.wardsTargeting.trim() : JSON.stringify({ Includes: [], Excludes: [] });
2346
+ return {
2347
+ isValid: errors.length === 0,
2348
+ errors,
2349
+ data: errors.length === 0 ? {
2350
+ gender,
2351
+ ageRanges,
2352
+ platforms,
2353
+ locations: typeof raw.locations === "string" ? raw.locations : "",
2354
+ provinces: Array.isArray(raw.provinces) ? raw.provinces.map(Number) : [],
2355
+ wardsTargeting,
2356
+ priceType,
2357
+ number: typeof raw.number === "string" ? raw.number : String(raw.number || "0")
2358
+ } : void 0
2359
+ };
2360
+ }
2361
+ var ZaloAudiencesValidator = {
2362
+ createSavedAudience: validateCreateSavedAudienceRequest,
2363
+ createPhoneAudience: validateCreatePhoneAudienceRequest,
2364
+ createLookalikeAudience: validateCreateLookalikeAudienceRequest,
2365
+ createFormEventAudience: validateCreateFormEventAudienceRequest,
2366
+ createMessageOaEventAudience: validateCreateMessageOaEventAudienceRequest,
2367
+ createMessagePersonalEventAudience: validateCreateMessagePersonalEventAudienceRequest,
2368
+ estimateAudience: validateEstimateAudienceRequest
2369
+ };
2370
+
2371
+ // src/services/audiences.service.ts
2372
+ var OP_ZaloAdsCreateCustomAudience = {
2373
+ "operationId": "ZaloAds_createCustomAudience",
2374
+ "method": "POST",
2375
+ "endpoint": "/api/ad/audience",
2376
+ "baseUrl": "https://ads.zalo.me",
2377
+ "binaryFields": [],
2378
+ "pathFields": [],
2379
+ "queryFields": [],
2380
+ "headerFields": [],
2381
+ "cookieFields": [],
2382
+ "bodyFields": [
2383
+ "name",
2384
+ "caType",
2385
+ "targeting"
2386
+ ]
2387
+ };
2388
+ var OP_ZaloAdsDeleteCustomAudience = {
2389
+ "operationId": "ZaloAds_deleteCustomAudience",
2390
+ "method": "DELETE",
2391
+ "endpoint": "/api/ad/audience/{customAudienceId}",
2392
+ "baseUrl": "https://ads.zalo.me",
2393
+ "binaryFields": [],
2394
+ "pathFields": [
2395
+ "customAudienceId"
2396
+ ],
2397
+ "queryFields": [],
2398
+ "headerFields": [],
2399
+ "cookieFields": [],
2400
+ "bodyFields": []
2401
+ };
2402
+ var OP_ZaloAdsGetApiAdGetlistadadvancetargeting = {
2403
+ "operationId": "ZaloAds_getApiAdGetlistadadvancetargeting",
2404
+ "method": "GET",
2405
+ "endpoint": "/api/ad/getListAdAdvanceTargeting",
1759
2406
  "baseUrl": "https://ads.zalo.me",
1760
2407
  "binaryFields": [],
1761
2408
  "pathFields": [],
@@ -1764,6 +2411,20 @@ var OP_ZaloAdsListPersonalPixelLabels = {
1764
2411
  "cookieFields": [],
1765
2412
  "bodyFields": []
1766
2413
  };
2414
+ var OP_ZaloAdsGetApiCustomAudienceAll = {
2415
+ "operationId": "ZaloAds_getApiCustomAudienceAll",
2416
+ "method": "GET",
2417
+ "endpoint": "/api/custom-audience/all",
2418
+ "baseUrl": "https://ads.zalo.me",
2419
+ "binaryFields": [],
2420
+ "pathFields": [],
2421
+ "queryFields": [
2422
+ "newWard"
2423
+ ],
2424
+ "headerFields": [],
2425
+ "cookieFields": [],
2426
+ "bodyFields": []
2427
+ };
1767
2428
  var OP_ZaloAdsPostApiAdEstimateaudience = {
1768
2429
  "operationId": "ZaloAds_postApiAdEstimateaudience",
1769
2430
  "method": "POST",
@@ -1786,177 +2447,302 @@ var OP_ZaloAdsPostApiAdEstimateaudience = {
1786
2447
  "districtsTargeting"
1787
2448
  ]
1788
2449
  };
1789
- var OP_ZaloAdsPostApiMediaSave = {
1790
- "operationId": "ZaloAds_postApiMediaSave",
2450
+ var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2451
+ "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
1791
2452
  "method": "POST",
1792
- "endpoint": "/api/media/save",
2453
+ "endpoint": "/zaapi/uploadPhoneList",
1793
2454
  "baseUrl": "https://ads.zalo.me",
1794
- "binaryFields": [],
2455
+ "binaryFields": [
2456
+ "File"
2457
+ ],
1795
2458
  "pathFields": [],
1796
2459
  "queryFields": [],
1797
2460
  "headerFields": [],
1798
2461
  "cookieFields": [],
1799
2462
  "bodyFields": [
1800
- "data"
2463
+ "File",
2464
+ "isHash"
1801
2465
  ]
1802
2466
  };
1803
- var OP_ZaloAdsPostApiMemberUploadImage = {
1804
- "operationId": "ZaloAds_postApiMemberUploadImage",
1805
- "method": "POST",
1806
- "endpoint": "/api/member/upload-image",
2467
+ var ZaloAudiencesService = class {
2468
+ constructor(client) {
2469
+ this.client = client;
2470
+ }
2471
+ static validator = ZaloAudiencesValidator;
2472
+ postApiAdEstimateaudience(request, options) {
2473
+ return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
2474
+ }
2475
+ getApiAdGetlistadadvancetargeting(request = {}, options) {
2476
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
2477
+ }
2478
+ getApiCustomAudienceAll(request = {}, options) {
2479
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
2480
+ }
2481
+ createCustomAudience(request, options) {
2482
+ return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
2483
+ }
2484
+ deleteCustomAudience(request, options) {
2485
+ return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
2486
+ }
2487
+ uploadCustomAudiencePhoneList(request, options) {
2488
+ return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
2489
+ }
2490
+ /** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
2491
+ createSavedAudience(request, options) {
2492
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2493
+ return this.createCustomAudience(
2494
+ {
2495
+ name: request.name,
2496
+ caType: 1,
2497
+ targeting: targetingStr
2498
+ },
2499
+ options
2500
+ );
2501
+ }
2502
+ /** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
2503
+ createPhoneAudience(request, options) {
2504
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2505
+ return this.createCustomAudience({ name: request.name, caType: 3, targeting: targetingStr }, options);
2506
+ }
2507
+ /** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
2508
+ createLookalikeAudience(request, options) {
2509
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2510
+ return this.createCustomAudience({ name: request.name, caType: 6, targeting: targetingStr }, options);
2511
+ }
2512
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
2513
+ createFormEventAudience(request, options) {
2514
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2515
+ return this.createCustomAudience({ name: request.name, caType: 12, targeting: targetingStr }, options);
2516
+ }
2517
+ /** 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`). */
2518
+ createMessageOaEventAudience(request, options) {
2519
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2520
+ return this.createCustomAudience({ name: request.name, caType: 11, targeting: targetingStr }, options);
2521
+ }
2522
+ /** 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`). */
2523
+ createMessagePersonalEventAudience(request, options) {
2524
+ let targetingObj;
2525
+ if (typeof request.targeting === "string") {
2526
+ try {
2527
+ targetingObj = JSON.parse(request.targeting);
2528
+ } catch {
2529
+ targetingObj = null;
2530
+ }
2531
+ } else if (request.targeting && typeof request.targeting === "object") {
2532
+ targetingObj = { ...request.targeting };
2533
+ }
2534
+ if (targetingObj && typeof targetingObj === "object") {
2535
+ if (targetingObj.EventId === void 0 && targetingObj.EventType !== void 0) {
2536
+ targetingObj.EventId = targetingObj.EventType;
2537
+ }
2538
+ }
2539
+ const targetingStr = targetingObj ? JSON.stringify(targetingObj) : typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2540
+ return this.createCustomAudience({ name: request.name, caType: 14, targeting: targetingStr }, options);
2541
+ }
2542
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
2543
+ createFormLeadAudience(request, options) {
2544
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2545
+ return this.createCustomAudience({ name: request.name, caType: 10, targeting: targetingStr }, options);
2546
+ }
2547
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
2548
+ createCommerceFormAudience(request, options) {
2549
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2550
+ return this.createCustomAudience({ name: request.name, caType: 15, targeting: targetingStr }, options);
2551
+ }
2552
+ /** 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`). */
2553
+ createMessageOaLeadAudience(request, options) {
2554
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2555
+ return this.createCustomAudience({ name: request.name, caType: 13, targeting: targetingStr }, options);
2556
+ }
2557
+ /** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
2558
+ createLeadSignalAudience(request, options) {
2559
+ const targetingStr = typeof request.targeting === "string" ? request.targeting : JSON.stringify(request.targeting);
2560
+ return this.createCustomAudience({ name: request.name, caType: 16, targeting: targetingStr }, options);
2561
+ }
2562
+ /** Ước tính quy mô đối tượng tiếp cận */
2563
+ estimateAudience(...args) {
2564
+ return this.postApiAdEstimateaudience(...args);
2565
+ }
2566
+ /** Danh sách toàn bộ nhóm đối tượng tùy chỉnh */
2567
+ listCustomAudiences(...args) {
2568
+ return this.getApiCustomAudienceAll(...args);
2569
+ }
2570
+ /** Danh sách cấu hình nhắm mục tiêu nâng cao */
2571
+ getListAdAdvanceTargeting(...args) {
2572
+ return this.getApiAdGetlistadadvancetargeting(...args);
2573
+ }
2574
+ };
2575
+
2576
+ // src/services/reports.service.ts
2577
+ var OP_ZaloAdsGetReportapiV2Ads = {
2578
+ "operationId": "ZaloAds_getReportapiV2Ads",
2579
+ "method": "GET",
2580
+ "endpoint": "/reportapi/v2/ads",
1807
2581
  "baseUrl": "https://ads.zalo.me",
1808
- "binaryFields": [
1809
- "File"
1810
- ],
2582
+ "binaryFields": [],
1811
2583
  "pathFields": [],
1812
- "queryFields": [],
2584
+ "queryFields": [
2585
+ "to",
2586
+ "from",
2587
+ "filter",
2588
+ "endDate",
2589
+ "refresh",
2590
+ "breakdown",
2591
+ "startDate"
2592
+ ],
1813
2593
  "headerFields": [],
1814
2594
  "cookieFields": [],
1815
- "bodyFields": [
1816
- "File"
1817
- ]
2595
+ "bodyFields": []
1818
2596
  };
1819
- var OP_ZaloAdsPostZaapiDeletead = {
1820
- "operationId": "ZaloAds_postZaapiDeletead",
1821
- "method": "POST",
1822
- "endpoint": "/zaapi/deleteAd",
2597
+ var OP_ZaloAdsGetReportapiV2Campaigns = {
2598
+ "operationId": "ZaloAds_getReportapiV2Campaigns",
2599
+ "method": "GET",
2600
+ "endpoint": "/reportapi/v2/campaigns/{campaignId}",
2601
+ "baseUrl": "https://ads.zalo.me",
2602
+ "binaryFields": [],
2603
+ "pathFields": [
2604
+ "campaignId"
2605
+ ],
2606
+ "queryFields": [
2607
+ "startDate",
2608
+ "endDate",
2609
+ "refresh"
2610
+ ],
2611
+ "headerFields": [],
2612
+ "cookieFields": [],
2613
+ "bodyFields": []
2614
+ };
2615
+ var OP_ZaloAdsGetReportapiV2UniqueUser = {
2616
+ "operationId": "ZaloAds_getReportapiV2UniqueUser",
2617
+ "method": "GET",
2618
+ "endpoint": "/reportapi/v2/unique-user",
1823
2619
  "baseUrl": "https://ads.zalo.me",
1824
2620
  "binaryFields": [],
1825
2621
  "pathFields": [],
1826
2622
  "queryFields": [
2623
+ "start",
2624
+ "end",
2625
+ "campaignId",
1827
2626
  "adId"
1828
2627
  ],
1829
2628
  "headerFields": [],
1830
2629
  "cookieFields": [],
1831
- "bodyFields": [
1832
- "adId"
1833
- ]
2630
+ "bodyFields": []
1834
2631
  };
1835
- var OP_ZaloAdsRenameCampaign = {
1836
- "operationId": "ZaloAds_renameCampaign",
1837
- "method": "POST",
1838
- "endpoint": "/api/campaign/change-name",
2632
+ var OP_ZaloAdsGetReportapiV3Campaigns = {
2633
+ "operationId": "ZaloAds_getReportapiV3Campaigns",
2634
+ "method": "GET",
2635
+ "endpoint": "/reportapi/v3/campaigns",
1839
2636
  "baseUrl": "https://ads.zalo.me",
1840
2637
  "binaryFields": [],
1841
2638
  "pathFields": [],
1842
- "queryFields": [],
2639
+ "queryFields": [
2640
+ "filter",
2641
+ "endDate",
2642
+ "refresh",
2643
+ "agencyId",
2644
+ "createdBy",
2645
+ "startDate"
2646
+ ],
1843
2647
  "headerFields": [],
1844
2648
  "cookieFields": [],
1845
- "bodyFields": [
1846
- "campid",
1847
- "newname"
1848
- ]
2649
+ "bodyFields": []
1849
2650
  };
1850
- var OP_ZaloAdsUpdateEcommerceAd = {
1851
- "operationId": "ZaloAds_updateEcommerceAd",
1852
- "method": "POST",
1853
- "endpoint": "/zaapi/UpdateAd",
2651
+ var OP_ZaloAdsGetReportOverview = {
2652
+ "operationId": "ZaloAds_getReportOverview",
2653
+ "method": "GET",
2654
+ "endpoint": "/reportapi/report/overview",
1854
2655
  "baseUrl": "https://ads.zalo.me",
1855
2656
  "binaryFields": [],
1856
2657
  "pathFields": [],
1857
- "queryFields": [],
2658
+ "queryFields": [
2659
+ "data"
2660
+ ],
1858
2661
  "headerFields": [],
1859
2662
  "cookieFields": [],
1860
- "bodyFields": [
1861
- "est",
1862
- "stt",
1863
- "data",
1864
- "isBoostAd"
1865
- ]
2663
+ "bodyFields": []
1866
2664
  };
1867
- var OP_ZaloAdsUpdateFormAd = {
1868
- "operationId": "ZaloAds_updateFormAd",
1869
- "method": "POST",
1870
- "endpoint": "/zaapi/UpdateAd",
2665
+ var OP_ZaloAdsGetDemographicsReport = {
2666
+ "operationId": "ZaloAds_getDemographicsReport",
2667
+ "method": "GET",
2668
+ "endpoint": "/api/demographics/report",
1871
2669
  "baseUrl": "https://ads.zalo.me",
1872
2670
  "binaryFields": [],
1873
2671
  "pathFields": [],
1874
- "queryFields": [],
2672
+ "queryFields": [
2673
+ "campaignId",
2674
+ "adId",
2675
+ "startDate",
2676
+ "endDate",
2677
+ "agencyId",
2678
+ "from",
2679
+ "to"
2680
+ ],
1875
2681
  "headerFields": [],
1876
2682
  "cookieFields": [],
1877
- "bodyFields": [
1878
- "est",
1879
- "stt",
1880
- "data",
1881
- "isBoostAd"
1882
- ]
2683
+ "bodyFields": []
1883
2684
  };
1884
- var OP_ZaloAdsUpdateMessageAd = {
1885
- "operationId": "ZaloAds_updateMessageAd",
2685
+ var OP_ZaloAdsDeleteCustomReport = {
2686
+ "operationId": "ZaloAds_deleteCustomReport",
1886
2687
  "method": "POST",
1887
- "endpoint": "/zaapi/UpdateAd",
2688
+ "endpoint": "/reportapi/custom-report/delete/{id}",
1888
2689
  "baseUrl": "https://ads.zalo.me",
1889
2690
  "binaryFields": [],
1890
- "pathFields": [],
2691
+ "pathFields": [
2692
+ "id"
2693
+ ],
1891
2694
  "queryFields": [],
1892
2695
  "headerFields": [],
1893
2696
  "cookieFields": [],
1894
- "bodyFields": [
1895
- "est",
1896
- "stt",
1897
- "data",
1898
- "isBoostAd"
1899
- ]
2697
+ "bodyFields": []
1900
2698
  };
1901
- var OP_ZaloAdsUpdateNewAds = {
1902
- "operationId": "ZaloAds_UpdateNewAds",
1903
- "method": "POST",
1904
- "endpoint": "/zaapi/UploadCrop",
2699
+ var OP_ZaloAdsListReportFilters = {
2700
+ "operationId": "ZaloAds_listReportFilters",
2701
+ "method": "GET",
2702
+ "endpoint": "/reportapi/api/filter/list",
1905
2703
  "baseUrl": "https://ads.zalo.me",
1906
- "binaryFields": [
1907
- "File"
1908
- ],
2704
+ "binaryFields": [],
1909
2705
  "pathFields": [],
1910
- "queryFields": [],
2706
+ "queryFields": [
2707
+ "model"
2708
+ ],
1911
2709
  "headerFields": [],
1912
2710
  "cookieFields": [],
1913
- "bodyFields": [
1914
- "File",
1915
- "x",
1916
- "y",
1917
- "width",
1918
- "height",
1919
- "scale"
1920
- ]
2711
+ "bodyFields": []
1921
2712
  };
1922
- var OP_ZaloAdsUpdateOfficialAccountAd = {
1923
- "operationId": "ZaloAds_updateOfficialAccountAd",
1924
- "method": "POST",
1925
- "endpoint": "/zaapi/UpdateAd",
2713
+ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
2714
+ "operationId": "ZaloAds_getZaapiCampaignReportcampaign",
2715
+ "method": "GET",
2716
+ "endpoint": "/zaapi/Campaign/reportCampaign",
1926
2717
  "baseUrl": "https://ads.zalo.me",
1927
2718
  "binaryFields": [],
1928
2719
  "pathFields": [],
1929
- "queryFields": [],
2720
+ "queryFields": [
2721
+ "campaignId",
2722
+ "campId",
2723
+ "from",
2724
+ "to"
2725
+ ],
1930
2726
  "headerFields": [],
1931
2727
  "cookieFields": [],
1932
- "bodyFields": [
1933
- "est",
1934
- "stt",
1935
- "data",
1936
- "isBoostAd"
1937
- ]
2728
+ "bodyFields": []
1938
2729
  };
1939
- var OP_ZaloAdsUpdatePostAd = {
1940
- "operationId": "ZaloAds_updatePostAd",
1941
- "method": "POST",
1942
- "endpoint": "/zaapi/UpdateAd",
2730
+ var OP_ZaloAdsListCustomReports = {
2731
+ "operationId": "ZaloAds_listCustomReports",
2732
+ "method": "GET",
2733
+ "endpoint": "/reportapi/custom-report/list",
1943
2734
  "baseUrl": "https://ads.zalo.me",
1944
2735
  "binaryFields": [],
1945
2736
  "pathFields": [],
1946
2737
  "queryFields": [],
1947
2738
  "headerFields": [],
1948
2739
  "cookieFields": [],
1949
- "bodyFields": [
1950
- "est",
1951
- "stt",
1952
- "data",
1953
- "isBoostAd"
1954
- ]
2740
+ "bodyFields": []
1955
2741
  };
1956
- var OP_ZaloAdsCreateWebsiteCampaign = {
1957
- "operationId": "ZaloAds_createWebsiteCampaign",
2742
+ var OP_ZaloAdsUpsertCustomReport = {
2743
+ "operationId": "ZaloAds_upsertCustomReport",
1958
2744
  "method": "POST",
1959
- "endpoint": "/zaapi/addNewCamp",
2745
+ "endpoint": "/reportapi/custom-report/update",
1960
2746
  "baseUrl": "https://ads.zalo.me",
1961
2747
  "binaryFields": [],
1962
2748
  "pathFields": [],
@@ -1964,13 +2750,81 @@ var OP_ZaloAdsCreateWebsiteCampaign = {
1964
2750
  "headerFields": [],
1965
2751
  "cookieFields": [],
1966
2752
  "bodyFields": [
1967
- "data"
2753
+ "id",
2754
+ "name",
2755
+ "settings",
2756
+ "isDefault"
1968
2757
  ]
1969
2758
  };
1970
- var OP_ZaloAdsUpdateWebsiteAd = {
1971
- "operationId": "ZaloAds_updateWebsiteAd",
2759
+ var ZaloReportsService = class {
2760
+ constructor(client) {
2761
+ this.client = client;
2762
+ }
2763
+ getReportapiV2Ads(request, options) {
2764
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
2765
+ }
2766
+ getReportapiV2Campaigns(request = {}, options) {
2767
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
2768
+ }
2769
+ getReportapiV2UniqueUser(request, options) {
2770
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
2771
+ }
2772
+ getReportapiV3Campaigns(request, options) {
2773
+ const normalized = {
2774
+ filter: "[]",
2775
+ agencyId: 0,
2776
+ ...request
2777
+ };
2778
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
2779
+ }
2780
+ getReportOverview(request, options) {
2781
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportOverview, this.client.toTransportInput(OP_ZaloAdsGetReportOverview, request), options);
2782
+ }
2783
+ getDemographicsReport(request, options) {
2784
+ return this.client.requestWithoutBody(OP_ZaloAdsGetDemographicsReport, this.client.toTransportInput(OP_ZaloAdsGetDemographicsReport, request), options);
2785
+ }
2786
+ getZaapiCampaignReportcampaign(request, options) {
2787
+ return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
2788
+ }
2789
+ listCustomReports(request = {}, options) {
2790
+ return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
2791
+ }
2792
+ upsertCustomReport(request, options) {
2793
+ return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
2794
+ }
2795
+ deleteCustomReport(request, options) {
2796
+ return this.client.requestJson(OP_ZaloAdsDeleteCustomReport, this.client.toTransportInput(OP_ZaloAdsDeleteCustomReport, request), options);
2797
+ }
2798
+ listReportFilters(request, options) {
2799
+ return this.client.requestWithoutBody(OP_ZaloAdsListReportFilters, this.client.toTransportInput(OP_ZaloAdsListReportFilters, request), options);
2800
+ }
2801
+ /** Báo cáo hiệu quả chiến dịch (API V3 - Khuyên dùng) */
2802
+ getCampaignReportV3(...args) {
2803
+ return this.getReportapiV3Campaigns(...args);
2804
+ }
2805
+ /** Báo cáo hiệu quả chiến dịch (API V2) */
2806
+ getCampaignReportV2(...args) {
2807
+ return this.getReportapiV2Campaigns(...args);
2808
+ }
2809
+ /** Báo cáo hiệu quả quảng cáo (API V2) */
2810
+ getAdsReportV2(...args) {
2811
+ return this.getReportapiV2Ads(...args);
2812
+ }
2813
+ /** Báo cáo người dùng tiếp cận duy nhất (Unique Reach) */
2814
+ getUniqueUserReport(...args) {
2815
+ return this.getReportapiV2UniqueUser(...args);
2816
+ }
2817
+ /** Báo cáo chiến dịch theo ngày/tháng (Legacy ZAAPI) */
2818
+ getCampaignReportLegacy(...args) {
2819
+ return this.getZaapiCampaignReportcampaign(...args);
2820
+ }
2821
+ };
2822
+
2823
+ // src/services/conversions.service.ts
2824
+ var OP_ZaloAdsCreateConversion = {
2825
+ "operationId": "ZaloAds_createConversion",
1972
2826
  "method": "POST",
1973
- "endpoint": "/zaapi/UpdateAd",
2827
+ "endpoint": "/api/conversion/add",
1974
2828
  "baseUrl": "https://ads.zalo.me",
1975
2829
  "binaryFields": [],
1976
2830
  "pathFields": [],
@@ -1978,72 +2832,138 @@ var OP_ZaloAdsUpdateWebsiteAd = {
1978
2832
  "headerFields": [],
1979
2833
  "cookieFields": [],
1980
2834
  "bodyFields": [
1981
- "est",
1982
- "stt",
1983
- "data",
1984
- "isBoostAd"
2835
+ "name",
2836
+ "landingPage",
2837
+ "urlType",
2838
+ "labelId",
2839
+ "buttonIds",
2840
+ "elements",
2841
+ "keywords"
1985
2842
  ]
1986
2843
  };
1987
- var OP_ZaloAdsCreateDisplayCampaign = {
1988
- "operationId": "ZaloAds_createDisplayCampaign",
1989
- "method": "POST",
1990
- "endpoint": "/zaapi/addNewCamp",
2844
+ var OP_ZaloAdsDeleteConversion = {
2845
+ "operationId": "ZaloAds_deleteConversion",
2846
+ "method": "DELETE",
2847
+ "endpoint": "/api/conversion/delete/{conversionId}",
1991
2848
  "baseUrl": "https://ads.zalo.me",
1992
2849
  "binaryFields": [],
1993
- "pathFields": [],
2850
+ "pathFields": [
2851
+ "conversionId"
2852
+ ],
1994
2853
  "queryFields": [],
1995
2854
  "headerFields": [],
1996
2855
  "cookieFields": [],
1997
- "bodyFields": [
1998
- "data"
1999
- ]
2856
+ "bodyFields": []
2000
2857
  };
2001
- var OP_ZaloAdsUpdateDisplayAd = {
2002
- "operationId": "ZaloAds_updateDisplayAd",
2003
- "method": "POST",
2004
- "endpoint": "/zaapi/UpdateAd",
2858
+ var OP_ZaloAdsGetApiConversionAll = {
2859
+ "operationId": "ZaloAds_getApiConversionAll",
2860
+ "method": "GET",
2861
+ "endpoint": "/api/conversion/all",
2005
2862
  "baseUrl": "https://ads.zalo.me",
2006
2863
  "binaryFields": [],
2007
2864
  "pathFields": [],
2008
2865
  "queryFields": [],
2009
2866
  "headerFields": [],
2010
2867
  "cookieFields": [],
2011
- "bodyFields": [
2012
- "est",
2013
- "stt",
2014
- "data",
2015
- "isBoostAd"
2016
- ]
2868
+ "bodyFields": []
2017
2869
  };
2018
- var OP_ZaloAdsCreateVideoCampaign = {
2019
- "operationId": "ZaloAds_createVideoCampaign",
2020
- "method": "POST",
2021
- "endpoint": "/zaapi/addNewCamp",
2870
+ var OP_ZaloAdsGetApiConversionStandardEvents = {
2871
+ "operationId": "ZaloAds_getApiConversionStandardEvents",
2872
+ "method": "GET",
2873
+ "endpoint": "/api/conversion/standard-events",
2022
2874
  "baseUrl": "https://ads.zalo.me",
2023
2875
  "binaryFields": [],
2024
2876
  "pathFields": [],
2025
2877
  "queryFields": [],
2026
2878
  "headerFields": [],
2027
2879
  "cookieFields": [],
2028
- "bodyFields": [
2029
- "data"
2030
- ]
2880
+ "bodyFields": []
2031
2881
  };
2032
- var OP_ZaloAdsDeleteCampaign = {
2033
- "operationId": "ZaloAds_deleteCampaign",
2034
- "method": "POST",
2035
- "endpoint": "/api/campaign/change-status",
2882
+ var OP_ZaloAdsListPersonalPixelLabels = {
2883
+ "operationId": "ZaloAds_listPersonalPixelLabels",
2884
+ "method": "GET",
2885
+ "endpoint": "/api/conversion/support-personal-pixel-labels",
2036
2886
  "baseUrl": "https://ads.zalo.me",
2037
2887
  "binaryFields": [],
2038
2888
  "pathFields": [],
2039
2889
  "queryFields": [],
2040
2890
  "headerFields": [],
2041
2891
  "cookieFields": [],
2042
- "bodyFields": [
2043
- "campaignId",
2044
- "status"
2045
- ]
2892
+ "bodyFields": []
2893
+ };
2894
+ var ZaloConversionsService = class {
2895
+ constructor(client) {
2896
+ this.client = client;
2897
+ }
2898
+ createConversion(request, options) {
2899
+ return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
2900
+ }
2901
+ deleteConversion(request, options) {
2902
+ return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
2903
+ }
2904
+ getApiConversionAll(request = {}, options) {
2905
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
2906
+ }
2907
+ getApiConversionStandardEvents(request = {}, options) {
2908
+ return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
2909
+ }
2910
+ listPersonalPixelLabels(request = {}, options) {
2911
+ return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, request), options);
2912
+ }
2913
+ /** 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`). */
2914
+ listLeadSignalOas(options) {
2915
+ return this.client.requestWithoutBody(
2916
+ {
2917
+ operationId: "ZaloAds_listLeadSignalOas",
2918
+ method: "GET",
2919
+ endpoint: "/api/ad/audience/leadSignal/oas",
2920
+ baseUrl: "https://ads.zalo.me",
2921
+ binaryFields: [],
2922
+ pathFields: [],
2923
+ queryFields: [],
2924
+ headerFields: [],
2925
+ cookieFields: [],
2926
+ bodyFields: []
2927
+ },
2928
+ void 0,
2929
+ options
2930
+ );
2931
+ }
2932
+ /** 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`). */
2933
+ listConversionNames(request = {}, options) {
2934
+ const op = {
2935
+ operationId: "ZaloAds_listConversionNames",
2936
+ method: "GET",
2937
+ endpoint: "/api/conversion/names",
2938
+ baseUrl: "https://ads.zalo.me",
2939
+ binaryFields: [],
2940
+ pathFields: [],
2941
+ queryFields: [],
2942
+ headerFields: [],
2943
+ cookieFields: [],
2944
+ bodyFields: []
2945
+ };
2946
+ return this.client.requestWithoutBody(
2947
+ op,
2948
+ this.client.toTransportInput(op, request),
2949
+ options
2950
+ );
2951
+ }
2952
+ /** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
2953
+ getApiConversionNames(request = {}, options) {
2954
+ return this.listConversionNames(request, options);
2955
+ }
2956
+ /** Danh sách toàn bộ sự kiện chuyển đổi */
2957
+ listConversions(...args) {
2958
+ return this.getApiConversionAll(...args);
2959
+ }
2960
+ /** Danh sách sự kiện chuyển đổi tiêu chuẩn */
2961
+ getConversionStandardEvents(...args) {
2962
+ return this.getApiConversionStandardEvents(...args);
2963
+ }
2046
2964
  };
2965
+
2966
+ // src/services/automated-rules.service.ts
2047
2967
  var OP_ZaloAdsListAutomatedRules = {
2048
2968
  "operationId": "ZaloAds_listAutomatedRules",
2049
2969
  "method": "GET",
@@ -2147,62 +3067,310 @@ var OP_ZaloAdsDeleteAutomatedRule = {
2147
3067
  "automatedRuleIds"
2148
3068
  ]
2149
3069
  };
2150
- var OP_ZaloAdsUploadCustomAudiencePhoneList = {
2151
- "operationId": "ZaloAds_uploadCustomAudiencePhoneList",
2152
- "method": "POST",
2153
- "endpoint": "/zaapi/uploadPhoneList",
2154
- "baseUrl": "https://ads.zalo.me",
2155
- "binaryFields": [
2156
- "File"
2157
- ],
2158
- "pathFields": [],
2159
- "queryFields": [],
2160
- "headerFields": [],
2161
- "cookieFields": [],
2162
- "bodyFields": [
2163
- "File",
2164
- "isHash"
2165
- ]
3070
+ var ZaloAutomatedRulesService = class {
3071
+ constructor(client) {
3072
+ this.client = client;
3073
+ }
3074
+ listAutomatedRules(request = {}, options) {
3075
+ const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
3076
+ return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
3077
+ }
3078
+ createAutomatedRule(request, options) {
3079
+ return this.client.requestJson(OP_ZaloAdsCreateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsCreateAutomatedRule, request), options);
3080
+ }
3081
+ updateAutomatedRule(request, options) {
3082
+ return this.client.requestJson(OP_ZaloAdsUpdateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsUpdateAutomatedRule, request), options);
3083
+ }
3084
+ changeAutomatedRuleStatus(request, options) {
3085
+ return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
3086
+ }
3087
+ getAutomatedRuleHistory(request, options) {
3088
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
3089
+ }
3090
+ deleteAutomatedRule(request, options) {
3091
+ return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
3092
+ }
2166
3093
  };
2167
- var OP_ZaloAdsUploadVideo = {
2168
- "operationId": "ZaloAds_uploadVideo",
2169
- "method": "POST",
2170
- "endpoint": "/api/member/upload-video",
2171
- "baseUrl": "https://ads.zalo.me",
2172
- "binaryFields": [
2173
- "File"
2174
- ],
2175
- "pathFields": [],
2176
- "queryFields": [],
2177
- "headerFields": [],
2178
- "cookieFields": [],
2179
- "bodyFields": [
2180
- "File"
2181
- ]
3094
+
3095
+ // src/validators/flows.validator.ts
3096
+ var MAX_INT_32 = 2147483647;
3097
+ function is32BitPositiveInteger(val) {
3098
+ if (typeof val === "number") {
3099
+ return Number.isInteger(val) && val > 0 && val <= MAX_INT_32;
3100
+ }
3101
+ if (typeof val === "string" && val.trim() !== "") {
3102
+ const num = Number(val);
3103
+ return Number.isInteger(num) && num > 0 && num <= MAX_INT_32;
3104
+ }
3105
+ return false;
3106
+ }
3107
+ function isPositiveInteger(val) {
3108
+ if (typeof val === "number") return Number.isInteger(val) && val > 0;
3109
+ if (typeof val === "string" && val.trim() !== "") {
3110
+ const num = Number(val);
3111
+ return Number.isInteger(num) && num > 0;
3112
+ }
3113
+ return false;
3114
+ }
3115
+ function isNonNegativeInteger(val) {
3116
+ if (typeof val === "number") return Number.isInteger(val) && val >= 0;
3117
+ if (typeof val === "string" && val.trim() !== "") {
3118
+ const num = Number(val);
3119
+ return Number.isInteger(num) && num >= 0;
3120
+ }
3121
+ return false;
3122
+ }
3123
+ function toPositiveInteger(val) {
3124
+ return typeof val === "number" ? Math.floor(val) : parseInt(String(val), 10);
3125
+ }
3126
+ function validateFlowButtons(buttons, errors, prefix) {
3127
+ if (!Array.isArray(buttons)) {
3128
+ errors.push(`${prefix}: Tr\u01B0\u1EDDng 'buttons' ph\u1EA3i l\xE0 m\u1ED9t m\u1EA3ng.`);
3129
+ return [];
3130
+ }
3131
+ const cleanButtons = [];
3132
+ buttons.forEach((btn, idx) => {
3133
+ const btnPrefix = `${prefix}.buttons[${idx}]`;
3134
+ if (!btn || typeof btn !== "object") {
3135
+ errors.push(`${btnPrefix}: N\xFAt b\u1EA5m ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
3136
+ return;
3137
+ }
3138
+ const b = btn;
3139
+ if (typeof b.text !== "string" || b.text.trim() === "") {
3140
+ errors.push(`${btnPrefix}: Nh\xE3n n\xFAt 'text' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.`);
3141
+ }
3142
+ const btnType = Number(b.type);
3143
+ if (![3, 10, 12].includes(btnType)) {
3144
+ errors.push(`${btnPrefix}: Lo\u1EA1i n\xFAt 'type' ph\u1EA3i l\xE0 3 (nh\xE1nh h\u1ED9i tho\u1EA1i), 10 (m\u1EDF website), ho\u1EB7c 12 (g\u1ECDi hotline).`);
3145
+ }
3146
+ const cleanBtn = {
3147
+ type: btnType,
3148
+ text: String(b.text ?? "").trim(),
3149
+ editable: b.editable !== false
3150
+ };
3151
+ if (btnType === 10) {
3152
+ if (typeof b.url !== "string" || b.url.trim() === "") {
3153
+ errors.push(`${btnPrefix}: N\xFAt lo\u1EA1i 10 (m\u1EDF website) b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 tr\u01B0\u1EDDng 'url' h\u1EE3p l\u1EC7.`);
3154
+ } else {
3155
+ cleanBtn.url = b.url.trim();
3156
+ }
3157
+ } else if (btnType === 12) {
3158
+ if (typeof b.phone !== "string" || b.phone.trim() === "") {
3159
+ errors.push(`${btnPrefix}: N\xFAt lo\u1EA1i 12 (g\u1ECDi hotline) b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 tr\u01B0\u1EDDng 'phone' h\u1EE3p l\u1EC7.`);
3160
+ } else {
3161
+ cleanBtn.phone = b.phone.trim();
3162
+ }
3163
+ } else if (btnType === 3) {
3164
+ if (!Array.isArray(b.messages) || b.messages.length === 0) {
3165
+ errors.push(`${btnPrefix}: N\xFAt lo\u1EA1i 3 (nh\xE1nh h\u1ED9i tho\u1EA1i) b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 m\u1EA3ng 'messages' ch\u1EE9a \xEDt nh\u1EA5t 1 tin nh\u1EAFn con ph\u1EA3n h\u1ED3i.`);
3166
+ } else {
3167
+ const cleanChildMsgs = [];
3168
+ b.messages.forEach((child, cIdx) => {
3169
+ const childPrefix = `${btnPrefix}.messages[${cIdx}]`;
3170
+ if (!child || typeof child !== "object") {
3171
+ errors.push(`${childPrefix}: Tin nh\u1EAFn con ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
3172
+ return;
3173
+ }
3174
+ const c = child;
3175
+ if (typeof c.text !== "string" || c.text.trim() === "") {
3176
+ errors.push(`${childPrefix}: N\u1ED9i dung tin nh\u1EAFn con 'text' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.`);
3177
+ } else if (c.text.length > 1961) {
3178
+ errors.push(`${childPrefix}: N\u1ED9i dung tin nh\u1EAFn con v\u01B0\u1EE3t qu\xE1 1961 k\xFD t\u1EF1 (hi\u1EC7n c\xF3 ${c.text.length} k\xFD t\u1EF1).`);
3179
+ }
3180
+ cleanChildMsgs.push({
3181
+ type: 8,
3182
+ text: String(c.text ?? "").trim()
3183
+ });
3184
+ });
3185
+ cleanBtn.messages = cleanChildMsgs;
3186
+ }
3187
+ }
3188
+ cleanButtons.push(cleanBtn);
3189
+ });
3190
+ return cleanButtons;
3191
+ }
3192
+ function validateFlowMessages(messages, errors) {
3193
+ if (!Array.isArray(messages)) {
3194
+ errors.push("Tr\u01B0\u1EDDng 'messages' ph\u1EA3i l\xE0 m\u1ED9t m\u1EA3ng ch\u1EE9a tin nh\u1EAFn k\u1ECBch b\u1EA3n.");
3195
+ return [];
3196
+ }
3197
+ if (messages.length !== 1) {
3198
+ errors.push(`Zalo Ads ch\u1EC9 cho ph\xE9p k\u1ECBch b\u1EA3n ch\u1EE9a DUY NH\u1EA4T 1 tin nh\u1EAFn ch\xE0o m\u1EEBng c\u1EA5p cao (hi\u1EC7n c\xF3 ${messages.length} tin nh\u1EAFn). C\xE1c nh\xE1nh h\u1ED9i tho\u1EA1i ti\u1EBFp theo ph\u1EA3i c\u1EA5u h\xECnh b\xEAn trong n\xFAt b\u1EA5m lo\u1EA1i 3 (type=3).`);
3199
+ return [];
3200
+ }
3201
+ const msg = messages[0];
3202
+ if (!msg || typeof msg !== "object") {
3203
+ errors.push("Tin nh\u1EAFn k\u1ECBch b\u1EA3n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.");
3204
+ return [];
3205
+ }
3206
+ const m = msg;
3207
+ const msgType = Number(m.type);
3208
+ if (![1, 2].includes(msgType)) {
3209
+ errors.push("Lo\u1EA1i tin nh\u1EAFn 'type' ph\u1EA3i l\xE0 1 (v\u0103n b\u1EA3n) ho\u1EB7c 2 (k\xE8m h\xECnh \u1EA3nh).");
3210
+ }
3211
+ if (typeof m.text !== "string" || m.text.trim() === "") {
3212
+ errors.push("N\u1ED9i dung tin nh\u1EAFn 'text' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
3213
+ } else if (m.text.length > 1961) {
3214
+ errors.push(`N\u1ED9i dung tin nh\u1EAFn v\u01B0\u1EE3t qu\xE1 1961 k\xFD t\u1EF1 (hi\u1EC7n c\xF3 ${m.text.length} k\xFD t\u1EF1).`);
3215
+ }
3216
+ const cleanMsg = {
3217
+ type: msgType,
3218
+ text: String(m.text ?? "").trim()
3219
+ };
3220
+ if (msgType === 2) {
3221
+ if (typeof m.url !== "string" || m.url.trim() === "") {
3222
+ errors.push("Tin nh\u1EAFn lo\u1EA1i 2 (k\xE8m \u1EA3nh) b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 tr\u01B0\u1EDDng 'url' ch\u1EE9a \u0111\u01B0\u1EDDng d\u1EABn h\xECnh \u1EA3nh.");
3223
+ } else {
3224
+ cleanMsg.url = m.url.trim();
3225
+ }
3226
+ }
3227
+ if (m.buttons !== void 0 && m.buttons !== null) {
3228
+ cleanMsg.buttons = validateFlowButtons(m.buttons, errors, "messages[0]");
3229
+ }
3230
+ return [cleanMsg];
3231
+ }
3232
+ function validateListFlowsByOfficialAccountRequest(input) {
3233
+ const errors = [];
3234
+ if (!input || typeof input !== "object") {
3235
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u l\u1EA5y danh s\xE1ch k\u1ECBch b\u1EA3n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
3236
+ }
3237
+ const obj = input;
3238
+ if (!is32BitPositiveInteger(obj.oaId)) {
3239
+ errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 m\xE3 pageId n\u1ED9i b\u1ED9 ki\u1EC3u s\u1ED1 nguy\xEAn 32-bit (<= 2,147,483,647). Kh\xF4ng truy\u1EC1n chu\u1ED7i noisedId c\xF4ng khai (18 ch\u1EEF s\u1ED1) v\xEC backend Play Framework s\u1EBD t\u1EEB ch\u1ED1i.");
3240
+ }
3241
+ if (!isPositiveInteger(obj.limit)) {
3242
+ errors.push("Tr\u01B0\u1EDDng 'limit' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3243
+ }
3244
+ if (obj.offset !== void 0 && obj.offset !== null && !isNonNegativeInteger(obj.offset)) {
3245
+ errors.push("Tr\u01B0\u1EDDng 'offset' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn kh\xF4ng \xE2m (>= 0).");
3246
+ }
3247
+ if (obj.flowId !== void 0 && obj.flowId !== null && !isPositiveInteger(obj.flowId)) {
3248
+ errors.push("Tr\u01B0\u1EDDng 'flowId' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3249
+ }
3250
+ const cleanData = {
3251
+ oaId: toPositiveInteger(obj.oaId),
3252
+ limit: toPositiveInteger(obj.limit)
3253
+ };
3254
+ if (obj.offset !== void 0 && obj.offset !== null) cleanData.offset = toPositiveInteger(obj.offset);
3255
+ if (obj.flowId !== void 0 && obj.flowId !== null) cleanData.flowId = toPositiveInteger(obj.flowId);
3256
+ return {
3257
+ isValid: errors.length === 0,
3258
+ errors,
3259
+ data: errors.length === 0 ? cleanData : void 0
3260
+ };
3261
+ }
3262
+ function validateCreateFlowRequest(input) {
3263
+ const errors = [];
3264
+ if (!input || typeof input !== "object") {
3265
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u t\u1EA1o k\u1ECBch b\u1EA3n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
3266
+ }
3267
+ const obj = input;
3268
+ if (!is32BitPositiveInteger(obj.oaId)) {
3269
+ errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 m\xE3 pageId n\u1ED9i b\u1ED9 ki\u1EC3u s\u1ED1 nguy\xEAn 32-bit (<= 2,147,483,647).");
3270
+ }
3271
+ if (typeof obj.name !== "string" || obj.name.trim() === "") {
3272
+ errors.push("Tr\u01B0\u1EDDng 'name' (t\xEAn k\u1ECBch b\u1EA3n) l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
3273
+ } else if (obj.name.trim().length > 50) {
3274
+ errors.push(`T\xEAn k\u1ECBch b\u1EA3n kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 50 k\xFD t\u1EF1 (hi\u1EC7n c\xF3 ${obj.name.trim().length} k\xFD t\u1EF1).`);
3275
+ }
3276
+ const cleanMessages = validateFlowMessages(obj.messages, errors);
3277
+ const cleanData = {
3278
+ oaId: toPositiveInteger(obj.oaId),
3279
+ id: null,
3280
+ name: String(obj.name ?? "").trim(),
3281
+ messages: cleanMessages
3282
+ };
3283
+ return {
3284
+ isValid: errors.length === 0,
3285
+ errors,
3286
+ data: errors.length === 0 ? cleanData : void 0
3287
+ };
3288
+ }
3289
+ function validateUpdateFlowRequest(input) {
3290
+ const errors = [];
3291
+ if (!input || typeof input !== "object") {
3292
+ return { isValid: false, errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u c\u1EADp nh\u1EADt k\u1ECBch b\u1EA3n ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng."] };
3293
+ }
3294
+ const obj = input;
3295
+ if (!isPositiveInteger(obj.id)) {
3296
+ errors.push("Tr\u01B0\u1EDDng 'id' (ID Flow c\u1EA7n c\u1EADp nh\u1EADt) l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
3297
+ }
3298
+ if (!is32BitPositiveInteger(obj.oaId)) {
3299
+ errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 m\xE3 pageId n\u1ED9i b\u1ED9 ki\u1EC3u s\u1ED1 nguy\xEAn 32-bit (<= 2,147,483,647).");
3300
+ }
3301
+ if (typeof obj.name !== "string" || obj.name.trim() === "") {
3302
+ errors.push("Tr\u01B0\u1EDDng 'name' (t\xEAn k\u1ECBch b\u1EA3n) l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
3303
+ } else if (obj.name.trim().length > 50) {
3304
+ errors.push(`T\xEAn k\u1ECBch b\u1EA3n kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 50 k\xFD t\u1EF1 (hi\u1EC7n c\xF3 ${obj.name.trim().length} k\xFD t\u1EF1).`);
3305
+ }
3306
+ const cleanMessages = validateFlowMessages(obj.messages, errors);
3307
+ const cleanData = {
3308
+ id: toPositiveInteger(obj.id),
3309
+ oaId: toPositiveInteger(obj.oaId),
3310
+ name: String(obj.name ?? "").trim(),
3311
+ messages: cleanMessages
3312
+ };
3313
+ return {
3314
+ isValid: errors.length === 0,
3315
+ errors,
3316
+ data: errors.length === 0 ? cleanData : void 0
3317
+ };
3318
+ }
3319
+ var ZaloFlowsValidator = {
3320
+ listFlowsByOfficialAccount: validateListFlowsByOfficialAccountRequest,
3321
+ createFlow: validateCreateFlowRequest,
3322
+ updateFlow: validateUpdateFlowRequest
2182
3323
  };
2183
- var OP_ZaloAdsUpsertCustomReport = {
2184
- "operationId": "ZaloAds_upsertCustomReport",
2185
- "method": "POST",
2186
- "endpoint": "/reportapi/custom-report/update",
2187
- "baseUrl": "https://ads.zalo.me",
2188
- "binaryFields": [],
2189
- "pathFields": [],
2190
- "queryFields": [],
2191
- "headerFields": [],
2192
- "cookieFields": [],
2193
- "bodyFields": [
2194
- "id",
2195
- "name",
2196
- "settings",
2197
- "isDefault"
2198
- ]
3324
+
3325
+ // src/services/flows.service.ts
3326
+ var OP_ZaloAdsListFlowsByOfficialAccount = {
3327
+ operationId: "ZaloAds_listFlowsByOfficialAccount",
3328
+ method: "GET",
3329
+ endpoint: "/api/flow/getByOaId",
3330
+ baseUrl: "https://ads.zalo.me",
3331
+ binaryFields: [],
3332
+ pathFields: [],
3333
+ queryFields: ["oaId", "limit", "offset", "flowId"],
3334
+ headerFields: [],
3335
+ cookieFields: [],
3336
+ bodyFields: []
3337
+ };
3338
+ var OP_ZaloAdsCreateFlow = {
3339
+ operationId: "ZaloAds_createFlow",
3340
+ method: "POST",
3341
+ endpoint: "/api/flow/create",
3342
+ baseUrl: "https://ads.zalo.me",
3343
+ binaryFields: [],
3344
+ pathFields: [],
3345
+ queryFields: [],
3346
+ headerFields: [],
3347
+ cookieFields: [],
3348
+ bodyFields: ["oaId", "id", "name", "messages"]
3349
+ };
3350
+ var OP_ZaloAdsUpdateFlow = {
3351
+ operationId: "ZaloAds_updateFlow",
3352
+ method: "POST",
3353
+ endpoint: "/api/flow/update",
3354
+ baseUrl: "https://ads.zalo.me",
3355
+ binaryFields: [],
3356
+ pathFields: [],
3357
+ queryFields: [],
3358
+ headerFields: [],
3359
+ cookieFields: [],
3360
+ bodyFields: ["oaId", "id", "name", "messages"]
2199
3361
  };
2200
- var ZaloAdsService = class {
3362
+ var ZaloFlowsService = class {
2201
3363
  constructor(client) {
2202
3364
  this.client = client;
2203
3365
  }
2204
- updateVideoAd(request, options) {
2205
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateVideoAd, this.client.toTransportInput(OP_ZaloAdsUpdateVideoAd, request), options);
3366
+ /**
3367
+ * Bộ công cụ kiểm tra tính hợp lệ dữ liệu (Standalone Validators) cho Message Flows APIs.
3368
+ * Dùng để validate dữ liệu đầu vào trước khi lưu DB hoặc gọi Zalo Ads.
3369
+ */
3370
+ static validator = ZaloFlowsValidator;
3371
+ validator = ZaloFlowsValidator;
3372
+ listFlowsByOfficialAccount(request, options) {
3373
+ return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
2206
3374
  }
2207
3375
  createFlow(request, options) {
2208
3376
  return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
@@ -2210,269 +3378,879 @@ var ZaloAdsService = class {
2210
3378
  updateFlow(request, options) {
2211
3379
  return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
2212
3380
  }
2213
- listFlowsByOfficialAccount(request, options) {
2214
- return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
3381
+ };
3382
+
3383
+ // src/services/media.service.ts
3384
+ var OP_ZaloAdsGetApiMediaItems = {
3385
+ operationId: "ZaloAds_getApiMediaItems",
3386
+ method: "GET",
3387
+ endpoint: "/api/media/items",
3388
+ baseUrl: "https://ads.zalo.me",
3389
+ binaryFields: [],
3390
+ pathFields: [],
3391
+ queryFields: ["endDate", "startDate"],
3392
+ headerFields: [],
3393
+ cookieFields: [],
3394
+ bodyFields: []
3395
+ };
3396
+ var OP_ZaloAdsGetApiMemberFiles = {
3397
+ operationId: "ZaloAds_getApiMemberFiles",
3398
+ method: "GET",
3399
+ endpoint: "/api/member/files",
3400
+ baseUrl: "https://ads.zalo.me",
3401
+ binaryFields: [],
3402
+ pathFields: [],
3403
+ queryFields: [],
3404
+ headerFields: [],
3405
+ cookieFields: [],
3406
+ bodyFields: []
3407
+ };
3408
+ var OP_ZaloAdsGetApiFilegroups = {
3409
+ operationId: "ZaloAds_getApiFilegroups",
3410
+ method: "GET",
3411
+ endpoint: "/api/filegroups",
3412
+ baseUrl: "https://ads.zalo.me",
3413
+ binaryFields: [],
3414
+ pathFields: [],
3415
+ queryFields: [],
3416
+ headerFields: [],
3417
+ cookieFields: [],
3418
+ bodyFields: []
3419
+ };
3420
+ var OP_ZaloAdsPostApiMediaSave = {
3421
+ operationId: "ZaloAds_postApiMediaSave",
3422
+ method: "POST",
3423
+ endpoint: "/api/media/save",
3424
+ baseUrl: "https://ads.zalo.me",
3425
+ binaryFields: [],
3426
+ pathFields: [],
3427
+ queryFields: [],
3428
+ headerFields: [],
3429
+ cookieFields: [],
3430
+ bodyFields: ["data"]
3431
+ };
3432
+ var OP_ZaloAdsPostApiMemberUploadImage = {
3433
+ operationId: "ZaloAds_postApiMemberUploadImage",
3434
+ method: "POST",
3435
+ endpoint: "/api/member/upload-image",
3436
+ baseUrl: "https://ads.zalo.me",
3437
+ binaryFields: ["File"],
3438
+ pathFields: [],
3439
+ queryFields: [],
3440
+ headerFields: [],
3441
+ cookieFields: [],
3442
+ bodyFields: ["File"]
3443
+ };
3444
+ var OP_ZaloAdsUploadVideo = {
3445
+ operationId: "ZaloAds_uploadVideo",
3446
+ method: "POST",
3447
+ endpoint: "/api/member/upload-video",
3448
+ baseUrl: "https://ads.zalo.me",
3449
+ binaryFields: ["File"],
3450
+ pathFields: [],
3451
+ queryFields: [],
3452
+ headerFields: [],
3453
+ cookieFields: [],
3454
+ bodyFields: ["File"]
3455
+ };
3456
+ var OP_ZaloAdsUpdateNewAds2 = {
3457
+ operationId: "ZaloAds_UpdateNewAds",
3458
+ method: "POST",
3459
+ endpoint: "/zaapi/UploadCrop",
3460
+ baseUrl: "https://ads.zalo.me",
3461
+ binaryFields: ["File"],
3462
+ pathFields: [],
3463
+ queryFields: [],
3464
+ headerFields: [],
3465
+ cookieFields: [],
3466
+ bodyFields: ["File", "x", "y", "width", "height", "scale"]
3467
+ };
3468
+ function extractJpegDimensions(buffer) {
3469
+ let i = 2;
3470
+ while (i < buffer.length - 8) {
3471
+ if (buffer[i] !== 255) {
3472
+ i++;
3473
+ continue;
3474
+ }
3475
+ const marker = buffer[i + 1];
3476
+ if (marker === 192 || marker === 193 || marker === 194) {
3477
+ const height = buffer[i + 5] << 8 | buffer[i + 6];
3478
+ const width = buffer[i + 7] << 8 | buffer[i + 8];
3479
+ return { width, height };
3480
+ }
3481
+ const len = buffer[i + 2] << 8 | buffer[i + 3];
3482
+ i += 2 + len;
2215
3483
  }
2216
- changeCampaignStatus(request, options) {
2217
- return this.client.requestFormUrlEncoded(OP_ZaloAdsChangeCampaignStatus, this.client.toTransportInput(OP_ZaloAdsChangeCampaignStatus, request), options);
3484
+ return null;
3485
+ }
3486
+ function extractPngDimensions(buffer) {
3487
+ if (buffer.length >= 24 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71) {
3488
+ const width = buffer[16] << 24 | buffer[17] << 16 | buffer[18] << 8 | buffer[19];
3489
+ const height = buffer[20] << 24 | buffer[21] << 16 | buffer[22] << 8 | buffer[23];
3490
+ return { width, height };
2218
3491
  }
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);
3492
+ return null;
3493
+ }
3494
+ function isUint8Array(val) {
3495
+ if (val instanceof Uint8Array) {
3496
+ return true;
2222
3497
  }
2223
- createCustomAudience(request, options) {
2224
- return this.client.requestJson(OP_ZaloAdsCreateCustomAudience, this.client.toTransportInput(OP_ZaloAdsCreateCustomAudience, request), options);
3498
+ if (typeof val === "object" && val !== null && typeof val.constructor?.isBuffer === "function") {
3499
+ return val.constructor.isBuffer(val);
2225
3500
  }
2226
- createWebsiteCampaign(request, options) {
2227
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateWebsiteCampaign, this.client.toTransportInput(OP_ZaloAdsCreateWebsiteCampaign, request), options);
3501
+ return false;
3502
+ }
3503
+ function resolveFileName(input, defaultPrefix = "media") {
3504
+ if (typeof input === "string") {
3505
+ const clean = input.split(/[?#]/)[0];
3506
+ const match = clean.match(/[^/\\]+$/);
3507
+ if (match && match[0]) return match[0];
3508
+ }
3509
+ if (input && typeof input === "object") {
3510
+ const record = input;
3511
+ if (typeof record.name === "string" && record.name) return record.name;
3512
+ if (typeof record.originalname === "string" && record.originalname) return record.originalname;
3513
+ if (typeof record.fileName === "string" && record.fileName) return record.fileName;
3514
+ }
3515
+ return `${defaultPrefix}_${Date.now()}.jpg`;
3516
+ }
3517
+ var ZaloMediaService = class {
3518
+ constructor(client) {
3519
+ this.client = client;
2228
3520
  }
2229
- updateWebsiteAd(request, options) {
2230
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateWebsiteAd, this.client.toTransportInput(OP_ZaloAdsUpdateWebsiteAd, request), options);
3521
+ // ==========================================================================
3522
+ // 1. RAW API METHODS (Chuẩn theo OpenAPI spec media-and-assets, không validate)
3523
+ // ==========================================================================
3524
+ /**
3525
+ * Lấy danh sách ảnh, video trong thư viện Zalo Ads theo khoảng thời gian (`GET /api/media/items`).
3526
+ */
3527
+ getApiMediaItems(request, options) {
3528
+ return this.client.requestWithoutBody(
3529
+ OP_ZaloAdsGetApiMediaItems,
3530
+ this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request),
3531
+ options
3532
+ );
2231
3533
  }
2232
- createDisplayCampaign(request, options) {
2233
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateDisplayCampaign, this.client.toTransportInput(OP_ZaloAdsCreateDisplayCampaign, request), options);
3534
+ /**
3535
+ * Alias cho `getApiMediaItems`.
3536
+ */
3537
+ listMediaItems(request, options) {
3538
+ return this.getApiMediaItems(request, options);
3539
+ }
3540
+ /**
3541
+ * 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`).
3542
+ */
3543
+ getApiMemberFiles(request = {}, options) {
3544
+ return this.client.requestWithoutBody(
3545
+ OP_ZaloAdsGetApiMemberFiles,
3546
+ this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request),
3547
+ options
3548
+ );
2234
3549
  }
2235
- updateDisplayAd(request, options) {
2236
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateDisplayAd, this.client.toTransportInput(OP_ZaloAdsUpdateDisplayAd, request), options);
3550
+ /**
3551
+ * Alias cho `getApiMemberFiles`.
3552
+ */
3553
+ listMemberFiles(request = {}, options) {
3554
+ return this.getApiMemberFiles(request, options);
2237
3555
  }
2238
- createVideoCampaign(request, options) {
2239
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateVideoCampaign, this.client.toTransportInput(OP_ZaloAdsCreateVideoCampaign, request), options);
3556
+ /**
3557
+ * Lấy danh sách nhóm tệp trong kho media (`GET /api/filegroups`).
3558
+ */
3559
+ getApiFilegroups(request = {}, options) {
3560
+ return this.client.requestWithoutBody(
3561
+ OP_ZaloAdsGetApiFilegroups,
3562
+ this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request),
3563
+ options
3564
+ );
2240
3565
  }
2241
- createEcommerceCampaign(request, options) {
2242
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
3566
+ /**
3567
+ * Alias cho `getApiFilegroups`.
3568
+ */
3569
+ listFilegroups(request = {}, options) {
3570
+ return this.getApiFilegroups(request, options);
2243
3571
  }
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);
3572
+ /**
3573
+ * 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`).
3574
+ * Phản hồi trả về `{ code: 0, data: <MediaId> }`.
3575
+ */
3576
+ postApiMediaSave(request, options) {
3577
+ const normalized = {
3578
+ ...request,
3579
+ data: typeof request.data === "string" ? request.data : JSON.stringify(request.data)
3580
+ };
3581
+ return this.client.requestFormUrlEncoded(
3582
+ OP_ZaloAdsPostApiMediaSave,
3583
+ this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, normalized),
3584
+ options
3585
+ );
2247
3586
  }
2248
- createForm(request, options) {
2249
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
3587
+ /**
3588
+ * Alias cho `postApiMediaSave`.
3589
+ */
3590
+ saveMedia(request, options) {
3591
+ return this.postApiMediaSave(request, options);
2250
3592
  }
2251
- createFormCampaign(request, options) {
2252
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateFormCampaign, this.client.toTransportInput(OP_ZaloAdsCreateFormCampaign, request), options);
3593
+ /**
3594
+ * Tải ảnh lên kho media của tài khoản quảng cáo (`POST /api/member/upload-image`).
3595
+ * Sử dụng multipart/form-data với trường `File` (chữ hoa). Trả về URL CDN Adtima.
3596
+ */
3597
+ postApiMemberUploadImage(request, options) {
3598
+ const file = request.File ?? request.file;
3599
+ if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
3600
+ throw new ZaloSdkError(
3601
+ "\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).",
3602
+ 400,
3603
+ "postApiMemberUploadImage",
3604
+ null
3605
+ );
3606
+ }
3607
+ const normalized = {
3608
+ File: file
3609
+ };
3610
+ return this.client.requestMultipart(
3611
+ OP_ZaloAdsPostApiMemberUploadImage,
3612
+ this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, normalized),
3613
+ options
3614
+ );
2253
3615
  }
2254
- createMessageCampaign(request, options) {
2255
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateMessageCampaign, this.client.toTransportInput(OP_ZaloAdsCreateMessageCampaign, request), options);
3616
+ /**
3617
+ * Alias cho `postApiMemberUploadImage`.
3618
+ */
3619
+ uploadImage(request, options) {
3620
+ return this.postApiMemberUploadImage(request, options);
2256
3621
  }
2257
- createOfficialAccountCampaign(request, options) {
2258
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
3622
+ /**
3623
+ * Tải video lên kho media của tài khoản quảng cáo (`POST /api/member/upload-video`).
3624
+ * Định dạng chuẩn .MP4 (H.264), tối đa 150MB. Trả về URL video trên Adtima CDN.
3625
+ */
3626
+ uploadVideo(request, options) {
3627
+ const file = request.File ?? request.file;
3628
+ if (typeof file === "string" && !/^(https?:|data:)/i.test(file)) {
3629
+ throw new ZaloSdkError(
3630
+ "\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).",
3631
+ 400,
3632
+ "uploadVideo",
3633
+ null
3634
+ );
3635
+ }
3636
+ const normalized = {
3637
+ File: file
3638
+ };
3639
+ return this.client.requestMultipart(
3640
+ OP_ZaloAdsUploadVideo,
3641
+ this.client.toTransportInput(OP_ZaloAdsUploadVideo, normalized),
3642
+ options
3643
+ );
2259
3644
  }
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);
3645
+ /**
3646
+ * 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`).
3647
+ */
3648
+ updateNewAds(request, options) {
3649
+ return this.client.requestMultipart(
3650
+ OP_ZaloAdsUpdateNewAds2,
3651
+ this.client.toTransportInput(OP_ZaloAdsUpdateNewAds2, request),
3652
+ options
3653
+ );
2263
3654
  }
2264
- createPostCampaign(request, options) {
2265
- return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
3655
+ /**
3656
+ * Alias cho `updateNewAds` (`POST /zaapi/UploadCrop`).
3657
+ */
3658
+ uploadCrop(request, options) {
3659
+ return this.updateNewAds(request, options);
2266
3660
  }
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);
3661
+ // ==========================================================================
3662
+ // 2. CONVENIENCE CUSTOM METHODS: UPLOAD + SAVE TRỌN GÓI
3663
+ // ==========================================================================
3664
+ /**
3665
+ * Method tiện ích trọn gói: Tự động tải ảnh lên CDN (`/api/member/upload-image`)
3666
+ * VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) trong cùng 1 lời gọi duy nhất.
3667
+ *
3668
+ * Trả về MediaId, URL CDN và kích thước để gắn ngay vào Creative/Quảng cáo.
3669
+ */
3670
+ async uploadAndSaveImage(request, options) {
3671
+ if (!request.file) {
3672
+ throw new ZaloSdkError(
3673
+ "ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveImage.",
3674
+ 400,
3675
+ "uploadAndSaveImage",
3676
+ null
3677
+ );
3678
+ }
3679
+ if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
3680
+ throw new ZaloSdkError(
3681
+ "\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).",
3682
+ 400,
3683
+ "uploadAndSaveImage",
3684
+ null
3685
+ );
3686
+ }
3687
+ const fileName = request.fileName || resolveFileName(request.file, "image");
3688
+ let width = request.width;
3689
+ let height = request.height;
3690
+ if ((!width || !height) && isUint8Array(request.file)) {
3691
+ const dims = extractJpegDimensions(request.file) || extractPngDimensions(request.file);
3692
+ if (dims) {
3693
+ width = width || dims.width;
3694
+ height = height || dims.height;
3695
+ }
3696
+ }
3697
+ const resolvedWidth = width && width > 0 ? width : 1200;
3698
+ const resolvedHeight = height && height > 0 ? height : 710;
3699
+ const uploadRes = await this.postApiMemberUploadImage({ File: request.file }, options);
3700
+ if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
3701
+ throw new ZaloSdkError(
3702
+ uploadRes?.msg || "T\u1EA3i \u1EA3nh l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
3703
+ uploadRes?.code || 500,
3704
+ "uploadAndSaveImage_upload",
3705
+ uploadRes
3706
+ );
3707
+ }
3708
+ const cdnUrl = uploadRes.data;
3709
+ const mediaType = request.type !== void 0 ? request.type : 1;
3710
+ const savePayload = {
3711
+ Name: fileName,
3712
+ Type: mediaType,
3713
+ Settings: {
3714
+ Url: cdnUrl,
3715
+ Width: resolvedWidth,
3716
+ Height: resolvedHeight,
3717
+ ...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
3718
+ }
3719
+ };
3720
+ const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
3721
+ if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
3722
+ throw new ZaloSdkError(
3723
+ "L\u01B0u \u1EA3nh v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
3724
+ saveRes?.code || 500,
3725
+ "uploadAndSaveImage_save",
3726
+ saveRes
3727
+ );
3728
+ }
3729
+ return {
3730
+ code: 0,
3731
+ mediaId: saveRes.data,
3732
+ cdnUrl,
3733
+ name: fileName,
3734
+ width: resolvedWidth,
3735
+ height: resolvedHeight,
3736
+ type: mediaType,
3737
+ rawUploadResponse: uploadRes,
3738
+ rawSaveResponse: saveRes
3739
+ };
2270
3740
  }
2271
- listAutomatedRules(request = {}, options) {
2272
- const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
2273
- return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
3741
+ /**
3742
+ * Method tiện ích trọn gói cho Video: Tự động tải video lên CDN (`/api/member/upload-video`)
3743
+ * VÀ lưu vào Thư viện Zalo Ads (`/api/media/save`) để cấp MediaId.
3744
+ */
3745
+ async uploadAndSaveVideo(request, options) {
3746
+ if (!request.file) {
3747
+ throw new ZaloSdkError(
3748
+ "ZaloMediaService: `file` l\xE0 tham s\u1ED1 b\u1EAFt bu\u1ED9c trong uploadAndSaveVideo.",
3749
+ 400,
3750
+ "uploadAndSaveVideo",
3751
+ null
3752
+ );
3753
+ }
3754
+ if (typeof request.file === "string" && !/^(https?:|data:)/i.test(request.file)) {
3755
+ throw new ZaloSdkError(
3756
+ "\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).",
3757
+ 400,
3758
+ "uploadAndSaveVideo",
3759
+ null
3760
+ );
3761
+ }
3762
+ const fileName = request.fileName || resolveFileName(request.file, "video");
3763
+ const width = request.width || 1920;
3764
+ const height = request.height || 1080;
3765
+ const duration = request.duration || 30;
3766
+ const uploadRes = await this.uploadVideo({ File: request.file }, options);
3767
+ if (!uploadRes || uploadRes.code !== 0 || !uploadRes.data) {
3768
+ throw new ZaloSdkError(
3769
+ uploadRes?.msg || "T\u1EA3i video l\xEAn Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc upload CDN.",
3770
+ uploadRes?.code || 500,
3771
+ "uploadAndSaveVideo_upload",
3772
+ uploadRes
3773
+ );
3774
+ }
3775
+ const cdnUrl = uploadRes.data;
3776
+ const savePayload = {
3777
+ Name: fileName,
3778
+ Type: 2,
3779
+ // 2 = Video
3780
+ Settings: {
3781
+ Url: cdnUrl,
3782
+ Width: width,
3783
+ Height: height,
3784
+ Duration: duration,
3785
+ ...request.thumbUrl ? { ThumbUrl: request.thumbUrl } : {}
3786
+ }
3787
+ };
3788
+ const saveRes = await this.postApiMediaSave({ data: savePayload }, options);
3789
+ if (!saveRes || saveRes.code !== 0 || typeof saveRes.data !== "number") {
3790
+ throw new ZaloSdkError(
3791
+ "L\u01B0u video v\xE0o Th\u01B0 vi\u1EC7n Media Zalo Ads th\u1EA5t b\u1EA1i \u1EDF b\u01B0\u1EDBc save.",
3792
+ saveRes?.code || 500,
3793
+ "uploadAndSaveVideo_save",
3794
+ saveRes
3795
+ );
3796
+ }
3797
+ return {
3798
+ code: 0,
3799
+ mediaId: saveRes.data,
3800
+ cdnUrl,
3801
+ name: fileName,
3802
+ width,
3803
+ height,
3804
+ duration,
3805
+ type: 2,
3806
+ rawUploadResponse: uploadRes,
3807
+ rawSaveResponse: saveRes
3808
+ };
2274
3809
  }
2275
- createAutomatedRule(request, options) {
2276
- return this.client.requestJson(OP_ZaloAdsCreateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsCreateAutomatedRule, request), options);
3810
+ // ==========================================================================
3811
+ // 3. STANDALONE VALIDATION METHODS (Cho Backend sử dụng độc lập, không chặn API)
3812
+ // ==========================================================================
3813
+ /**
3814
+ * Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads:
3815
+ * - "No file chosen": Bắt buộc phải có tệp.
3816
+ * - Dung lượng: Tối đa 2MB (2 * 1024 * 1024 bytes).
3817
+ * - Kích thước: Tối thiểu 150x150 pixels.
3818
+ * - Định dạng: Hỗ trợ .JPG, .JPEG, .PNG.
3819
+ *
3820
+ * Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
3821
+ */
3822
+ validateImage(input) {
3823
+ const errors = [];
3824
+ let sizeBytes = input.sizeBytes;
3825
+ let fileName = input.fileName;
3826
+ let format = input.format;
3827
+ let width = input.width;
3828
+ let height = input.height;
3829
+ const file = input.file;
3830
+ const hasFile = Boolean(
3831
+ file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
3832
+ );
3833
+ if (!hasFile && sizeBytes === void 0) {
3834
+ errors.push("No file chosen");
3835
+ return {
3836
+ isValid: false,
3837
+ status: "INVALID",
3838
+ errors,
3839
+ metadata: { fileDetected: false }
3840
+ };
3841
+ }
3842
+ if (file && typeof file === "object") {
3843
+ const rec = file;
3844
+ if (typeof rec.size === "number" && sizeBytes === void 0) {
3845
+ sizeBytes = rec.size;
3846
+ }
3847
+ if (typeof rec.originalname === "string" && !fileName) {
3848
+ fileName = rec.originalname;
3849
+ }
3850
+ if (typeof rec.mimetype === "string" && !format) {
3851
+ format = rec.mimetype;
3852
+ }
3853
+ if (isUint8Array(rec.buffer)) {
3854
+ if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
3855
+ const dims = extractJpegDimensions(rec.buffer) || extractPngDimensions(rec.buffer);
3856
+ if (dims) {
3857
+ width = width || dims.width;
3858
+ height = height || dims.height;
3859
+ }
3860
+ } else if (isUint8Array(file)) {
3861
+ if (sizeBytes === void 0) sizeBytes = file.byteLength;
3862
+ const dims = extractJpegDimensions(file) || extractPngDimensions(file);
3863
+ if (dims) {
3864
+ width = width || dims.width;
3865
+ height = height || dims.height;
3866
+ }
3867
+ }
3868
+ } else if (typeof file === "string" && !fileName) {
3869
+ fileName = resolveFileName(file);
3870
+ }
3871
+ if (sizeBytes !== void 0 && sizeBytes <= 0) {
3872
+ errors.push("No file chosen");
3873
+ }
3874
+ const MAX_IMAGE_BYTES = 2 * 1024 * 1024;
3875
+ if (sizeBytes !== void 0 && sizeBytes > MAX_IMAGE_BYTES) {
3876
+ const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
3877
+ 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).`);
3878
+ }
3879
+ if (width !== void 0 && height !== void 0) {
3880
+ if (width < 150 || height < 150) {
3881
+ 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).`);
3882
+ }
3883
+ }
3884
+ const nameToCheck = (fileName || format || "").toLowerCase();
3885
+ if (nameToCheck) {
3886
+ const isAllowedFormat = nameToCheck.endsWith(".jpg") || nameToCheck.endsWith(".jpeg") || nameToCheck.endsWith(".png") || nameToCheck.includes("image/jpeg") || nameToCheck.includes("image/jpg") || nameToCheck.includes("image/png");
3887
+ if (!isAllowedFormat) {
3888
+ 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.");
3889
+ }
3890
+ }
3891
+ const isValid = errors.length === 0;
3892
+ return {
3893
+ isValid,
3894
+ status: isValid ? "VALID" : "INVALID",
3895
+ errors,
3896
+ metadata: {
3897
+ fileDetected: true,
3898
+ sizeBytes,
3899
+ width,
3900
+ height,
3901
+ format: format || (fileName ? fileName.split(".").pop() : void 0)
3902
+ }
3903
+ };
2277
3904
  }
2278
- updateAutomatedRule(request, options) {
2279
- return this.client.requestJson(OP_ZaloAdsUpdateAutomatedRule, this.client.toTransportInput(OP_ZaloAdsUpdateAutomatedRule, request), options);
3905
+ /**
3906
+ * Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads:
3907
+ * - "No file chosen": Bắt buộc phải có tệp.
3908
+ * - Định dạng: .MP4 H.264.
3909
+ * - Dung lượng: Tối đa 150MB (150 * 1024 * 1024 bytes).
3910
+ * - Thời lượng: Tối đa 60 giây.
3911
+ * - Tỉ lệ khung hình: 16:9, 9:16 hoặc 1:1.
3912
+ *
3913
+ * Trả về `{ isValid: boolean, status: 'VALID' | 'INVALID', errors: string[], metadata: {...} }`.
3914
+ */
3915
+ validateVideo(input) {
3916
+ const errors = [];
3917
+ let sizeBytes = input.sizeBytes;
3918
+ let fileName = input.fileName;
3919
+ let format = input.format;
3920
+ const durationSeconds = input.durationSeconds;
3921
+ const width = input.width;
3922
+ const height = input.height;
3923
+ const file = input.file;
3924
+ const hasFile = Boolean(
3925
+ file !== null && file !== void 0 && (typeof file !== "string" || file.trim() !== "")
3926
+ );
3927
+ if (!hasFile && sizeBytes === void 0) {
3928
+ errors.push("No file chosen");
3929
+ return {
3930
+ isValid: false,
3931
+ status: "INVALID",
3932
+ errors,
3933
+ metadata: { fileDetected: false }
3934
+ };
3935
+ }
3936
+ if (file && typeof file === "object") {
3937
+ const rec = file;
3938
+ if (typeof rec.size === "number" && sizeBytes === void 0) {
3939
+ sizeBytes = rec.size;
3940
+ }
3941
+ if (typeof rec.originalname === "string" && !fileName) {
3942
+ fileName = rec.originalname;
3943
+ }
3944
+ if (typeof rec.mimetype === "string" && !format) {
3945
+ format = rec.mimetype;
3946
+ }
3947
+ if (isUint8Array(rec.buffer)) {
3948
+ if (sizeBytes === void 0) sizeBytes = rec.buffer.byteLength;
3949
+ } else if (isUint8Array(file)) {
3950
+ if (sizeBytes === void 0) sizeBytes = file.byteLength;
3951
+ }
3952
+ } else if (typeof file === "string" && !fileName) {
3953
+ fileName = resolveFileName(file);
3954
+ }
3955
+ if (sizeBytes !== void 0 && sizeBytes <= 0) {
3956
+ errors.push("No file chosen");
3957
+ }
3958
+ const nameToCheck = (fileName || format || "").toLowerCase();
3959
+ if (nameToCheck) {
3960
+ const isMp4 = nameToCheck.endsWith(".mp4") || nameToCheck.includes("video/mp4") || nameToCheck.includes("h264");
3961
+ if (!isMp4) {
3962
+ errors.push("\u0110\u1ECBnh d\u1EA1ng video kh\xF4ng h\u1EE3p l\u1EC7, y\xEAu c\u1EA7u \u0111\u1ECBnh d\u1EA1ng .MP4 (H.264).");
3963
+ }
3964
+ }
3965
+ const MAX_VIDEO_BYTES = 150 * 1024 * 1024;
3966
+ if (sizeBytes !== void 0 && sizeBytes > MAX_VIDEO_BYTES) {
3967
+ const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
3968
+ 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).`);
3969
+ }
3970
+ if (durationSeconds !== void 0 && durationSeconds > 60) {
3971
+ 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).`);
3972
+ }
3973
+ let ratioLabel;
3974
+ if (width !== void 0 && height !== void 0 && width > 0 && height > 0) {
3975
+ const ratio = width / height;
3976
+ const is16_9 = Math.abs(ratio - 16 / 9) <= 0.06;
3977
+ const is9_16 = Math.abs(ratio - 9 / 16) <= 0.04;
3978
+ const is1_1 = Math.abs(ratio - 1) <= 0.05;
3979
+ if (is16_9) ratioLabel = "16:9";
3980
+ else if (is9_16) ratioLabel = "9:16";
3981
+ else if (is1_1) ratioLabel = "1:1";
3982
+ else {
3983
+ ratioLabel = `${width}:${height} (~${ratio.toFixed(2)})`;
3984
+ 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}).`);
3985
+ }
3986
+ }
3987
+ const isValid = errors.length === 0;
3988
+ return {
3989
+ isValid,
3990
+ status: isValid ? "VALID" : "INVALID",
3991
+ errors,
3992
+ metadata: {
3993
+ fileDetected: true,
3994
+ sizeBytes,
3995
+ width,
3996
+ height,
3997
+ durationSeconds,
3998
+ format: format || (fileName ? fileName.split(".").pop() : void 0),
3999
+ aspectRatio: ratioLabel
4000
+ }
4001
+ };
2280
4002
  }
2281
- changeAutomatedRuleStatus(request, options) {
2282
- return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
4003
+ };
4004
+
4005
+ // src/services/ads.service.ts
4006
+ var ZaloAdsService = class extends ZaloCampaignsService {
4007
+ account;
4008
+ audiences;
4009
+ targeting;
4010
+ reports;
4011
+ conversions;
4012
+ pixel;
4013
+ automatedRules;
4014
+ rules;
4015
+ flows;
4016
+ media;
4017
+ campaigns;
4018
+ constructor(client) {
4019
+ super(client);
4020
+ this.account = new ZaloAccountService(client);
4021
+ this.audiences = new ZaloAudiencesService(client);
4022
+ this.targeting = this.audiences;
4023
+ this.reports = new ZaloReportsService(client);
4024
+ this.conversions = new ZaloConversionsService(client);
4025
+ this.pixel = this.conversions;
4026
+ this.automatedRules = new ZaloAutomatedRulesService(client);
4027
+ this.rules = this.automatedRules;
4028
+ this.flows = new ZaloFlowsService(client);
4029
+ this.media = new ZaloMediaService(client);
4030
+ this.campaigns = this;
4031
+ }
4032
+ // =========================================================================
4033
+ // Delegations -> this.account
4034
+ // =========================================================================
4035
+ getApiWhoami(request = {}, options) {
4036
+ return this.account.getApiWhoami(request, options);
2283
4037
  }
2284
- getAutomatedRuleHistory(request, options) {
2285
- return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
4038
+ getApiPaymentTransactionHistory(request, options) {
4039
+ return this.account.getApiPaymentTransactionHistory(request, options);
2286
4040
  }
2287
- deleteAutomatedRule(request, options) {
2288
- return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
4041
+ getApiBaAccountAllaccessors(request = {}, options) {
4042
+ return this.account.getApiBaAccountAllaccessors(request, options);
2289
4043
  }
2290
- createConversion(request, options) {
2291
- return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
4044
+ getApiBaAccountAllgrantedmembers(request = {}, options) {
4045
+ return this.account.getApiBaAccountAllgrantedmembers(request, options);
2292
4046
  }
2293
- deleteConversion(request, options) {
2294
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
4047
+ listAgencyCustomersWithBudget(request = { limit: 15, offset: 0, joinDateAsc: true }, options) {
4048
+ return this.account.listAgencyCustomersWithBudget(request, options);
2295
4049
  }
2296
- deleteCustomAudience(request, options) {
2297
- return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
4050
+ getApiNotifiesHeader(request = {}, options) {
4051
+ return this.account.getApiNotifiesHeader(request, options);
2298
4052
  }
2299
- getAdById(request = {}, options) {
2300
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
4053
+ getApiLpNews(request = {}, options) {
4054
+ return this.account.getApiLpNews(request, options);
2301
4055
  }
2302
- getAdChangeLog(request, options) {
2303
- return this.client.requestWithoutBody(OP_ZaloAdsGetAdChangeLog, this.client.toTransportInput(OP_ZaloAdsGetAdChangeLog, request), options);
4056
+ // =========================================================================
4057
+ // Delegations -> this.audiences
4058
+ // =========================================================================
4059
+ postApiAdEstimateaudience(request, options) {
4060
+ return this.audiences.postApiAdEstimateaudience(request, options);
2304
4061
  }
2305
4062
  getApiAdGetlistadadvancetargeting(request = {}, options) {
2306
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, this.client.toTransportInput(OP_ZaloAdsGetApiAdGetlistadadvancetargeting, request), options);
4063
+ return this.audiences.getApiAdGetlistadadvancetargeting(request, options);
2307
4064
  }
2308
- getApiBaAccountAllaccessors(request = {}, options) {
2309
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllaccessors, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllaccessors, request), options);
4065
+ getApiCustomAudienceAll(request = {}, options) {
4066
+ return this.audiences.getApiCustomAudienceAll(request, options);
2310
4067
  }
2311
- getApiBaAccountAllgrantedmembers(request = {}, options) {
2312
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
4068
+ createCustomAudience(request, options) {
4069
+ return this.audiences.createCustomAudience(request, options);
2313
4070
  }
2314
- getApiConversionAll(request = {}, options) {
2315
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
4071
+ deleteCustomAudience(request, options) {
4072
+ return this.audiences.deleteCustomAudience(request, options);
2316
4073
  }
2317
- getApiConversionStandardEvents(request = {}, options) {
2318
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
4074
+ uploadCustomAudiencePhoneList(request, options) {
4075
+ return this.audiences.uploadCustomAudiencePhoneList(request, options);
2319
4076
  }
2320
- getApiCustomAudienceAll(request = {}, options) {
2321
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
4077
+ /** Tạo mới 'Nhóm đối tượng đã lưu' (`caType = 1` - `DEFAULT`) trên Zalo Ads (`POST /api/ad/audience`). */
4078
+ createSavedAudience(request, options) {
4079
+ return this.audiences.createSavedAudience(request, options);
2322
4080
  }
2323
- getApiFilegroups(request = {}, options) {
2324
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiFilegroups, this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request), options);
4081
+ /** Tạo mới Nhóm đối tượng từ danh sách Số điện thoại (`caType = 3` - `PHONE_LIST`). */
4082
+ createPhoneAudience(request, options) {
4083
+ return this.audiences.createPhoneAudience(request, options);
2325
4084
  }
2326
- getApiLpNews(request = {}, options) {
2327
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
4085
+ /** Tạo mới Nhóm đối tượng tương tự Lookalike (`caType = 6` - `LOOKALIKE`). */
4086
+ createLookalikeAudience(request, options) {
4087
+ return this.audiences.createLookalikeAudience(request, options);
2328
4088
  }
2329
- getApiMediaItems(request, options) {
2330
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiMediaItems, this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request), options);
4089
+ /** Tạo mới Nhóm đối tượng phát sinh sự kiện trên Zalo Form (`caType = 12` - `FORM_EVENT_AUDIENCE`). */
4090
+ createFormEventAudience(request, options) {
4091
+ return this.audiences.createFormEventAudience(request, options);
2331
4092
  }
2332
- getApiMemberFiles(request = {}, options) {
2333
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiMemberFiles, this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request), options);
4093
+ /** 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`). */
4094
+ createMessageOaEventAudience(request, options) {
4095
+ return this.audiences.createMessageOaEventAudience(request, options);
2334
4096
  }
2335
- getApiNotifiesHeader(request = {}, options) {
2336
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
4097
+ /** 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`). */
4098
+ createMessagePersonalEventAudience(request, options) {
4099
+ return this.audiences.createMessagePersonalEventAudience(request, options);
2337
4100
  }
2338
- getApiPaymentTransactionHistory(request, options) {
2339
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiPaymentTransactionHistory, this.client.toTransportInput(OP_ZaloAdsGetApiPaymentTransactionHistory, request), options);
4101
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Zalo Form (`caType = 10` - `FORM_AUDIENCE`). */
4102
+ createFormLeadAudience(request, options) {
4103
+ return this.audiences.createFormLeadAudience(request, options);
2340
4104
  }
2341
- getApiPlaceGetalldistricts(request = {}, options) {
2342
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
4105
+ /** Tạo mới Nhóm đối tượng từ Trung tâm Lead - Commerce Form (`caType = 15` - `COMMERCE_FORM_AUDIENCE`). */
4106
+ createCommerceFormAudience(request, options) {
4107
+ return this.audiences.createCommerceFormAudience(request, options);
2343
4108
  }
2344
- getApiSpellCheckV2(request, options) {
2345
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
4109
+ /** 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`). */
4110
+ createMessageOaLeadAudience(request, options) {
4111
+ return this.audiences.createMessageOaLeadAudience(request, options);
2346
4112
  }
2347
- getApiWhoami(request = {}, options) {
2348
- return this.client.requestWithoutBody(OP_ZaloAdsGetApiWhoami, this.client.toTransportInput(OP_ZaloAdsGetApiWhoami, request), options);
4113
+ /** Tạo mới Nhóm đối tượng từ Dữ liệu chuyển đổi Lead Signal (`caType = 16` - `LEAD_SIGNAL_AUDIENCE`). */
4114
+ createLeadSignalAudience(request, options) {
4115
+ return this.audiences.createLeadSignalAudience(request, options);
2349
4116
  }
4117
+ // =========================================================================
4118
+ // Delegations -> this.reports
4119
+ // =========================================================================
2350
4120
  getReportapiV2Ads(request, options) {
2351
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
4121
+ return this.reports.getReportapiV2Ads(request, options);
2352
4122
  }
2353
4123
  getReportapiV2Campaigns(request = {}, options) {
2354
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
4124
+ return this.reports.getReportapiV2Campaigns(request, options);
2355
4125
  }
2356
- getReportapiV2UniqueUser(request = {}, options) {
2357
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
4126
+ getReportapiV2UniqueUser(request, options) {
4127
+ return this.reports.getReportapiV2UniqueUser(request, options);
2358
4128
  }
2359
4129
  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);
2366
- }
2367
- getZaapiCampaignReportcampaign(request = {}, options) {
2368
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
2369
- }
2370
- getZaapiCheckcamphasmanyads(request = {}, options) {
2371
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
2372
- }
2373
- getZaapiGetadsfromcampaignid(request = {}, options) {
2374
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
2375
- }
2376
- getZaapiGetallpages(request = {}, options) {
2377
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetallpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetallpages, request), options);
4130
+ return this.reports.getReportapiV3Campaigns(request, options);
2378
4131
  }
2379
- getAllPages(request = {}, options) {
2380
- return this.getZaapiGetallpages(request, options);
2381
- }
2382
- getZaapiGetownedarticles(request, options) {
2383
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedarticles, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedarticles, request), options);
4132
+ getReportOverview(request, options) {
4133
+ return this.reports.getReportOverview(request, options);
2384
4134
  }
2385
- getOwnedArticles(request, options) {
2386
- return this.getZaapiGetownedarticles(request, options);
4135
+ getDemographicsReport(request, options) {
4136
+ return this.reports.getDemographicsReport(request, options);
2387
4137
  }
2388
- getZaapiGetownedpages(request = {}, options) {
2389
- return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetownedpages, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetownedpages, request), options);
4138
+ getZaapiCampaignReportcampaign(request, options) {
4139
+ return this.reports.getZaapiCampaignReportcampaign(request, options);
2390
4140
  }
2391
- getOwnedPages(request = {}, options) {
2392
- return this.getZaapiGetownedpages(request, options);
4141
+ listCustomReports(request = {}, options) {
4142
+ return this.reports.listCustomReports(request, options);
2393
4143
  }
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);
4144
+ upsertCustomReport(request, options) {
4145
+ return this.reports.upsertCustomReport(request, options);
2402
4146
  }
2403
- listCustomReports(request = {}, options) {
2404
- return this.client.requestWithoutBody(OP_ZaloAdsListCustomReports, this.client.toTransportInput(OP_ZaloAdsListCustomReports, request), options);
4147
+ deleteCustomReport(request, options) {
4148
+ return this.reports.deleteCustomReport(request, options);
2405
4149
  }
2406
- listFormsByOfficialAccount(request, options) {
2407
- return this.client.requestWithoutBody(OP_ZaloAdsListFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount, request), options);
4150
+ listReportFilters(request, options) {
4151
+ return this.reports.listReportFilters(request, options);
2408
4152
  }
2409
- listMiniPagesByTemplate(request, options) {
2410
- return this.client.requestWithoutBody(OP_ZaloAdsListMiniPagesByTemplate, this.client.toTransportInput(OP_ZaloAdsListMiniPagesByTemplate, request), options);
4153
+ // =========================================================================
4154
+ // Delegations -> this.conversions
4155
+ // =========================================================================
4156
+ createConversion(request, options) {
4157
+ return this.conversions.createConversion(request, options);
4158
+ }
4159
+ deleteConversion(request, options) {
4160
+ return this.conversions.deleteConversion(request, options);
4161
+ }
4162
+ getApiConversionAll(request = {}, options) {
4163
+ return this.conversions.getApiConversionAll(request, options);
4164
+ }
4165
+ getApiConversionStandardEvents(request = {}, options) {
4166
+ return this.conversions.getApiConversionStandardEvents(request, options);
2411
4167
  }
2412
4168
  listPersonalPixelLabels(request = {}, options) {
2413
- return this.client.requestWithoutBody(OP_ZaloAdsListPersonalPixelLabels, this.client.toTransportInput(OP_ZaloAdsListPersonalPixelLabels, request), options);
4169
+ return this.conversions.listPersonalPixelLabels(request, options);
2414
4170
  }
2415
- postApiAdEstimateaudience(request, options) {
2416
- return this.client.requestJson(OP_ZaloAdsPostApiAdEstimateaudience, this.client.toTransportInput(OP_ZaloAdsPostApiAdEstimateaudience, request), options);
4171
+ /** 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`). */
4172
+ listLeadSignalOas(options) {
4173
+ return this.conversions.listLeadSignalOas(options);
2417
4174
  }
2418
- postApiMediaSave(request, options) {
2419
- return this.client.requestFormUrlEncoded(OP_ZaloAdsPostApiMediaSave, this.client.toTransportInput(OP_ZaloAdsPostApiMediaSave, request), options);
4175
+ /** 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`). */
4176
+ listConversionNames(request = {}, options) {
4177
+ return this.conversions.listConversionNames(request, options);
2420
4178
  }
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);
4179
+ /** Alias cho `listConversionNames` (`GET /api/conversion/names`). */
4180
+ getApiConversionNames(request = {}, options) {
4181
+ return this.conversions.getApiConversionNames(request, options);
2427
4182
  }
2428
- /** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
2429
- uploadImage(request, options) {
2430
- return this.postApiMemberUploadImage(request, options);
4183
+ // =========================================================================
4184
+ // Delegations -> this.automatedRules
4185
+ // =========================================================================
4186
+ listAutomatedRules(request = {}, options) {
4187
+ return this.automatedRules.listAutomatedRules(request, options);
2431
4188
  }
2432
- postZaapiDeletead(request = {}, options) {
2433
- return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
4189
+ createAutomatedRule(request, options) {
4190
+ return this.automatedRules.createAutomatedRule(request, options);
2434
4191
  }
2435
- renameCampaign(request, options) {
2436
- return this.client.requestFormUrlEncoded(OP_ZaloAdsRenameCampaign, this.client.toTransportInput(OP_ZaloAdsRenameCampaign, request), options);
4192
+ updateAutomatedRule(request, options) {
4193
+ return this.automatedRules.updateAutomatedRule(request, options);
2437
4194
  }
2438
- updateEcommerceAd(request, options) {
2439
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
4195
+ changeAutomatedRuleStatus(request, options) {
4196
+ return this.automatedRules.changeAutomatedRuleStatus(request, options);
2440
4197
  }
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);
4198
+ getAutomatedRuleHistory(request, options) {
4199
+ return this.automatedRules.getAutomatedRuleHistory(request, options);
2444
4200
  }
2445
- updateFormAd(request, options) {
2446
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
4201
+ deleteAutomatedRule(request, options) {
4202
+ return this.automatedRules.deleteAutomatedRule(request, options);
2447
4203
  }
2448
- updateMessageAd(request, options) {
2449
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
4204
+ // =========================================================================
4205
+ // Delegations -> this.flows
4206
+ // =========================================================================
4207
+ listFlowsByOfficialAccount(request, options) {
4208
+ return this.flows.listFlowsByOfficialAccount(request, options);
2450
4209
  }
2451
- updateNewAds(request, options) {
2452
- return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
4210
+ createFlow(request, options) {
4211
+ return this.flows.createFlow(request, options);
2453
4212
  }
2454
- updateOfficialAccountAd(request, options) {
2455
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
4213
+ updateFlow(request, options) {
4214
+ return this.flows.updateFlow(request, options);
2456
4215
  }
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);
4216
+ // =========================================================================
4217
+ // Delegations -> this.media
4218
+ // =========================================================================
4219
+ getApiFilegroups(request = {}, options) {
4220
+ return this.media.getApiFilegroups(request, options);
2460
4221
  }
2461
- updatePostAd(request, options) {
2462
- return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
4222
+ getApiMediaItems(request, options) {
4223
+ return this.media.getApiMediaItems(request, options);
2463
4224
  }
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);
4225
+ getApiMemberFiles(request = {}, options) {
4226
+ return this.media.getApiMemberFiles(request, options);
2467
4227
  }
2468
- uploadCustomAudiencePhoneList(request, options) {
2469
- return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
4228
+ postApiMediaSave(request, options) {
4229
+ return this.media.postApiMediaSave(request, options);
4230
+ }
4231
+ postApiMemberUploadImage(request, options) {
4232
+ return this.media.postApiMemberUploadImage(request, options);
4233
+ }
4234
+ /** Alias tiện lợi cho `postApiMemberUploadImage` (`POST /api/member/upload-image`). */
4235
+ uploadImage(request, options) {
4236
+ return this.media.uploadImage(request, options);
2470
4237
  }
2471
4238
  uploadVideo(request, options) {
2472
- return this.client.requestMultipart(OP_ZaloAdsUploadVideo, this.client.toTransportInput(OP_ZaloAdsUploadVideo, request), options);
4239
+ return this.media.uploadVideo(request, options);
2473
4240
  }
2474
- upsertCustomReport(request, options) {
2475
- return this.client.requestJson(OP_ZaloAdsUpsertCustomReport, this.client.toTransportInput(OP_ZaloAdsUpsertCustomReport, request), options);
4241
+ /**
4242
+ * Kiểm tra tính hợp lệ của tệp Ảnh theo quy chuẩn Zalo Ads (độc lập cho backend).
4243
+ * 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.
4244
+ */
4245
+ validateImage(input) {
4246
+ return this.media.validateImage(input);
4247
+ }
4248
+ /**
4249
+ * Kiểm tra tính hợp lệ của tệp Video theo quy chuẩn Zalo Ads (độc lập cho backend).
4250
+ * 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.
4251
+ */
4252
+ validateVideo(input) {
4253
+ return this.media.validateVideo(input);
2476
4254
  }
2477
4255
  };
2478
4256
 
@@ -2504,7 +4282,301 @@ var ZaloChatWidgetService = class {
2504
4282
  }
2505
4283
  };
2506
4284
 
4285
+ // src/validators/forms.validator.ts
4286
+ function isValidUrl(val) {
4287
+ if (typeof val !== "string" || val.trim() === "") return false;
4288
+ try {
4289
+ const url = new URL(val);
4290
+ return url.protocol === "http:" || url.protocol === "https:";
4291
+ } catch {
4292
+ return false;
4293
+ }
4294
+ }
4295
+ function validateCreateFormRequest(input) {
4296
+ const errors = [];
4297
+ if (!input || typeof input !== "object") {
4298
+ return {
4299
+ isValid: false,
4300
+ errors: ["D\u1EEF li\u1EC7u y\xEAu c\u1EA7u t\u1EA1o Form ph\u1EA3i l\xE0 m\u1ED9t object."],
4301
+ data: void 0
4302
+ };
4303
+ }
4304
+ let raw = input;
4305
+ if (typeof input.data === "string") {
4306
+ try {
4307
+ raw = JSON.parse(input.data);
4308
+ } catch {
4309
+ errors.push("Tr\u01B0\u1EDDng 'data' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7.");
4310
+ return { isValid: false, errors, data: void 0 };
4311
+ }
4312
+ } else if (typeof input.data === "object" && input.data !== null) {
4313
+ raw = input.data;
4314
+ }
4315
+ const oaIdRaw = raw.oaId;
4316
+ let cleanOaId = "";
4317
+ if (typeof oaIdRaw === "string" && /^[0-9]+$/.test(oaIdRaw.trim())) {
4318
+ cleanOaId = oaIdRaw.trim();
4319
+ } else if (typeof oaIdRaw === "number" && Number.isInteger(oaIdRaw) && oaIdRaw > 0) {
4320
+ cleanOaId = String(oaIdRaw);
4321
+ } else {
4322
+ errors.push("Tr\u01B0\u1EDDng 'oaId' b\u1EAFt bu\u1ED9c ph\u1EA3i l\xE0 chu\u1ED7i s\u1ED1 nguy\xEAn d\u01B0\u01A1ng \u0111\u1EA1i di\u1EC7n cho pageId n\u1ED9i b\u1ED9 c\u1EE7a OA (v\xED d\u1EE5: '429753475').");
4323
+ }
4324
+ const title = typeof raw.title === "string" ? raw.title.trim() : "";
4325
+ if (!title) {
4326
+ errors.push("Tr\u01B0\u1EDDng 'title' (ti\xEAu \u0111\u1EC1 form) l\xE0 b\u1EAFt bu\u1ED9c.");
4327
+ } else if (title.length < 2 || title.length > 40) {
4328
+ errors.push(`Tr\u01B0\u1EDDng 'title' ph\u1EA3i c\xF3 \u0111\u1ED9 d\xE0i t\u1EEB 2 \u0111\u1EBFn 40 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${title.length} k\xFD t\u1EF1).`);
4329
+ }
4330
+ const formName = typeof raw.formName === "string" ? raw.formName.trim() : "";
4331
+ if (!formName) {
4332
+ errors.push("Tr\u01B0\u1EDDng 'formName' (t\xEAn qu\u1EA3n tr\u1ECB form) l\xE0 b\u1EAFt bu\u1ED9c.");
4333
+ } else if (formName.length < 2 || formName.length > 100) {
4334
+ errors.push(`Tr\u01B0\u1EDDng 'formName' ph\u1EA3i c\xF3 \u0111\u1ED9 d\xE0i t\u1EEB 2 \u0111\u1EBFn 100 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${formName.length} k\xFD t\u1EF1).`);
4335
+ }
4336
+ let cleanDescription = void 0;
4337
+ if (raw.description !== void 0 && raw.description !== null) {
4338
+ const desc = String(raw.description).trim();
4339
+ if (desc.length > 600) {
4340
+ errors.push(`Tr\u01B0\u1EDDng 'description' kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 600 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${desc.length} k\xFD t\u1EF1).`);
4341
+ } else {
4342
+ cleanDescription = desc;
4343
+ }
4344
+ }
4345
+ const coverPhoto = typeof raw.coverPhoto === "string" ? raw.coverPhoto.trim() : "";
4346
+ if (!coverPhoto) {
4347
+ errors.push("Tr\u01B0\u1EDDng 'coverPhoto' (\u1EA3nh b\xECa form) l\xE0 b\u1EAFt bu\u1ED9c.");
4348
+ } else if (!isValidUrl(coverPhoto)) {
4349
+ errors.push(`Tr\u01B0\u1EDDng 'coverPhoto' ph\u1EA3i l\xE0 URL h\u1EE3p l\u1EC7 (http:// ho\u1EB7c https://).`);
4350
+ }
4351
+ const submitTitle = typeof raw.submitTitle === "string" && raw.submitTitle.trim() !== "" ? raw.submitTitle.trim() : "G\u1EEDi th\xF4ng tin th\xE0nh c\xF4ng";
4352
+ if (submitTitle.length > 90) {
4353
+ errors.push(`Tr\u01B0\u1EDDng 'submitTitle' kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 90 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${submitTitle.length} k\xFD t\u1EF1).`);
4354
+ }
4355
+ const thanks = typeof raw.thanks === "string" && raw.thanks.trim() !== "" ? raw.thanks.trim() : "C\u1EA3m \u01A1n b\u1EA1n \u0111\xE3 g\u1EEDi th\xF4ng tin. Ch\xFAng t\xF4i s\u1EBD li\xEAn h\u1EC7 trong th\u1EDDi gian s\u1EDBm nh\u1EA5t.";
4356
+ if (thanks.length > 255) {
4357
+ errors.push(`Tr\u01B0\u1EDDng 'thanks' kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${thanks.length} k\xFD t\u1EF1).`);
4358
+ }
4359
+ const gotoActionType = raw.gotoActionType === 0 ? 0 : 1;
4360
+ const gotoText = typeof raw.gotoText === "string" && raw.gotoText.trim() !== "" ? raw.gotoText.trim() : gotoActionType === 1 ? "Xem trang Web" : "\u0110\xF3ng l\u1EA1i";
4361
+ let cleanWebsite = void 0;
4362
+ if (gotoActionType === 1) {
4363
+ if (!raw.website || !isValidUrl(raw.website)) {
4364
+ errors.push("Khi 'gotoActionType' = 1 (m\u1EDF website), tr\u01B0\u1EDDng 'website' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 ph\u1EA3i l\xE0 URL h\u1EE3p l\u1EC7.");
4365
+ } else {
4366
+ cleanWebsite = String(raw.website).trim();
4367
+ }
4368
+ }
4369
+ const useCustomConsent = Boolean(raw.useCustomConsent);
4370
+ let cleanConsentName = void 0;
4371
+ let cleanConsentUrl = void 0;
4372
+ if (useCustomConsent) {
4373
+ const cName = typeof raw.consentName === "string" ? raw.consentName.trim() : "";
4374
+ if (!cName) {
4375
+ errors.push("Khi 'useCustomConsent' = true, tr\u01B0\u1EDDng 'consentName' (ti\xEAu \u0111\u1EC1 \u0111i\u1EC1u kho\u1EA3n) l\xE0 b\u1EAFt bu\u1ED9c.");
4376
+ } else if (cName.length > 255) {
4377
+ errors.push(`Tr\u01B0\u1EDDng 'consentName' kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 255 k\xFD t\u1EF1 (hi\u1EC7n t\u1EA1i: ${cName.length} k\xFD t\u1EF1).`);
4378
+ } else {
4379
+ cleanConsentName = cName;
4380
+ }
4381
+ if (!raw.consentUrl || !isValidUrl(raw.consentUrl)) {
4382
+ errors.push("Khi 'useCustomConsent' = true, tr\u01B0\u1EDDng 'consentUrl' ph\u1EA3i l\xE0 URL h\u1EE3p l\u1EC7 ch\u1EE9a ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt.");
4383
+ } else {
4384
+ cleanConsentUrl = String(raw.consentUrl).trim();
4385
+ }
4386
+ }
4387
+ if (!Array.isArray(raw.questions) || raw.questions.length === 0) {
4388
+ errors.push("Bi\u1EC3u m\u1EABu b\u1EAFt bu\u1ED9c ph\u1EA3i c\xF3 \xEDt nh\u1EA5t 1 c\xE2u h\u1ECFi trong m\u1EA3ng 'questions'.");
4389
+ }
4390
+ const cleanQuestions = [];
4391
+ let hasPhonePrimary = false;
4392
+ let hasPhoneSecondary = false;
4393
+ if (Array.isArray(raw.questions)) {
4394
+ raw.questions.forEach((q, idx) => {
4395
+ const qPrefix = `C\xE2u h\u1ECFi [${idx}]`;
4396
+ if (!q || typeof q !== "object") {
4397
+ errors.push(`${qPrefix} ph\u1EA3i l\xE0 m\u1ED9t object.`);
4398
+ return;
4399
+ }
4400
+ const qTitle = typeof q.title === "string" ? q.title.trim() : "";
4401
+ if (qTitle.length < 2 || qTitle.length > 180) {
4402
+ errors.push(`${qPrefix}: Ti\xEAu \u0111\u1EC1 'title' ph\u1EA3i c\xF3 \u0111\u1ED9 d\xE0i t\u1EEB 2 \u0111\u1EBFn 180 k\xFD t\u1EF1.`);
4403
+ }
4404
+ if (!Array.isArray(q.answers) || q.answers.length === 0) {
4405
+ errors.push(`${qPrefix}: Ph\u1EA3i c\xF3 \xEDt nh\u1EA5t 1 \u0111\xE1p \xE1n trong m\u1EA3ng 'answers'.`);
4406
+ return;
4407
+ }
4408
+ const cleanAnswers = [];
4409
+ q.answers.forEach((ans, aIdx) => {
4410
+ const aType = Number(ans?.type);
4411
+ if (![2, 7, 13].includes(aType)) {
4412
+ errors.push(`${qPrefix} \u0111\xE1p \xE1n [${aIdx}]: 'type' ph\u1EA3i l\xE0 7 (H\u1ECD t\xEAn), 13 (S\u0110T chu\u1EA9n), ho\u1EB7c 2 (S\u0110T ph\u1EE5).`);
4413
+ }
4414
+ if (aType === 13) hasPhonePrimary = true;
4415
+ if (aType === 2) hasPhoneSecondary = true;
4416
+ cleanAnswers.push({
4417
+ type: aType,
4418
+ placeHolder: ans?.placeHolder ? String(ans.placeHolder).trim() : void 0,
4419
+ value: ans?.value ? String(ans.value).trim() : null,
4420
+ priority: typeof ans?.priority === "number" ? ans.priority : 500
4421
+ });
4422
+ });
4423
+ cleanQuestions.push({
4424
+ title: qTitle,
4425
+ type: typeof q.type === "number" ? q.type : 1,
4426
+ isRequired: q.isRequired !== void 0 ? Boolean(q.isRequired) : true,
4427
+ editDisabled: Boolean(q.editDisabled),
4428
+ priority: typeof q.priority === "number" ? q.priority : (idx + 1) * 100,
4429
+ answers: cleanAnswers
4430
+ });
4431
+ });
4432
+ }
4433
+ if (hasPhoneSecondary) {
4434
+ cleanQuestions.forEach((q) => {
4435
+ if (q.answers.some((a) => a.type === 13)) {
4436
+ q.editDisabled = true;
4437
+ }
4438
+ });
4439
+ }
4440
+ const cleanSections = [];
4441
+ if (Array.isArray(raw.sections)) {
4442
+ raw.sections.forEach((sec, sIdx) => {
4443
+ const sPrefix = `Section [${sIdx}]`;
4444
+ const sType = Number(sec?.type);
4445
+ if (isNaN(sType) || sType < 0 || sType > 4) {
4446
+ errors.push(`${sPrefix}: 'type' ph\u1EA3i l\xE0 s\u1ED1 t\u1EEB 0 \u0111\u1EBFn 4 (0=t\u1ED5ng quan, 1=chi ti\u1EBFt, 2=b\u1EA3ng gi\xE1, 3=\u01B0u \u0111i\u1EC3m, 4=\u01B0u \u0111\xE3i).`);
4447
+ }
4448
+ const sTitle = typeof sec?.title === "string" ? sec.title.trim() : "";
4449
+ if (sTitle.length > 60) {
4450
+ errors.push(`${sPrefix}: 'title' kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 60 k\xFD t\u1EF1.`);
4451
+ }
4452
+ cleanSections.push({
4453
+ type: sType,
4454
+ title: sTitle,
4455
+ disable: Boolean(sec?.disable),
4456
+ expand: Boolean(sec?.expand),
4457
+ content: sec?.content ? sec.content : {}
4458
+ });
4459
+ });
4460
+ }
4461
+ const cleanData = {
4462
+ oaId: cleanOaId,
4463
+ title,
4464
+ formName,
4465
+ description: cleanDescription,
4466
+ coverPhoto,
4467
+ submitTitle,
4468
+ thanks,
4469
+ gotoActionType,
4470
+ gotoText,
4471
+ website: cleanWebsite,
4472
+ reviewSubmit: raw.reviewSubmit !== void 0 ? Boolean(raw.reviewSubmit) : true,
4473
+ questions: cleanQuestions,
4474
+ sections: cleanSections.length > 0 ? cleanSections : void 0,
4475
+ useCustomConsent,
4476
+ consentName: cleanConsentName,
4477
+ consentUrl: cleanConsentUrl
4478
+ };
4479
+ return {
4480
+ isValid: errors.length === 0,
4481
+ errors,
4482
+ data: errors.length === 0 ? cleanData : void 0
4483
+ };
4484
+ }
4485
+ function validateListFormsByOfficialAccountRequest(input) {
4486
+ const errors = [];
4487
+ if (!input || typeof input !== "object") {
4488
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
4489
+ }
4490
+ const raw = input;
4491
+ let cleanOaId = "";
4492
+ if (typeof raw.oaId === "string" && /^[0-9]+$/.test(raw.oaId.trim())) {
4493
+ cleanOaId = raw.oaId.trim();
4494
+ } else if (typeof raw.oaId === "number" && Number.isInteger(raw.oaId) && raw.oaId > 0) {
4495
+ cleanOaId = String(raw.oaId);
4496
+ } else {
4497
+ errors.push("Tr\u01B0\u1EDDng 'oaId' b\u1EAFt bu\u1ED9c ph\u1EA3i l\xE0 chu\u1ED7i s\u1ED1 nguy\xEAn d\u01B0\u01A1ng \u0111\u1EA1i di\u1EC7n cho pageId c\u1EE7a OA.");
4498
+ }
4499
+ return {
4500
+ isValid: errors.length === 0,
4501
+ errors,
4502
+ data: errors.length === 0 ? { oaId: cleanOaId, isAll: raw.isAll !== void 0 ? Boolean(raw.isAll) : true } : void 0
4503
+ };
4504
+ }
4505
+ function validateListFormLeadsRequest(input) {
4506
+ const errors = [];
4507
+ if (!input || typeof input !== "object") {
4508
+ return { isValid: false, errors: ["Input ph\u1EA3i l\xE0 m\u1ED9t object."], data: void 0 };
4509
+ }
4510
+ const raw = input;
4511
+ const oaId = typeof raw.oaId === "string" ? raw.oaId.trim() : "";
4512
+ if (!oaId) {
4513
+ errors.push("Tr\u01B0\u1EDDng 'oaId' l\xE0 b\u1EAFt bu\u1ED9c (m\xE3 ch\u1EEF t\u1EEB getAuthSession, v\xED d\u1EE5 'J4UB9MRE497YDQKKK').");
4514
+ } else if (/^[0-9]+$/.test(oaId)) {
4515
+ errors.push("Tr\u01B0\u1EDDng 'oaId' tr\xEAn Lead Center ph\u1EA3i l\xE0 m\xE3 ch\u1EEF alphanumeric t\u1EEB getAuthSession, kh\xF4ng d\xF9ng chu\u1ED7i s\u1ED1 pageId (s\u1EBD b\u1ECB l\u1ED7i 403 Forbidden).");
4516
+ }
4517
+ const type = Number(raw.type);
4518
+ if (![1, 5].includes(type)) {
4519
+ errors.push("Tr\u01B0\u1EDDng 'type' ph\u1EA3i l\xE0 1 (ZALOFORM) ho\u1EB7c 5 (COMMERCE).");
4520
+ }
4521
+ const limit = typeof raw.limit === "number" && raw.limit > 0 ? Math.floor(raw.limit) : 20;
4522
+ const offset = typeof raw.offset === "number" && raw.offset >= 0 ? Math.floor(raw.offset) : 0;
4523
+ const status = typeof raw.status === "string" && raw.status.trim() !== "" ? raw.status.trim() : "2,6,1,0,7,4,5,3";
4524
+ const now = Math.floor(Date.now() / 1e3);
4525
+ const fromTime = typeof raw.fromTime === "number" && raw.fromTime >= 0 ? Math.floor(raw.fromTime) : now - 90 * 86400;
4526
+ const toTime = typeof raw.toTime === "number" && raw.toTime >= 0 ? Math.floor(raw.toTime) : now;
4527
+ if (toTime < fromTime) {
4528
+ errors.push("M\u1ED1c th\u1EDDi gian k\u1EBFt th\xFAc 'toTime' ph\u1EA3i l\u1EDBn h\u01A1n ho\u1EB7c b\u1EB1ng 'fromTime'.");
4529
+ }
4530
+ return {
4531
+ isValid: errors.length === 0,
4532
+ errors,
4533
+ data: errors.length === 0 ? {
4534
+ oaId,
4535
+ type,
4536
+ limit,
4537
+ offset,
4538
+ status,
4539
+ fromTime,
4540
+ toTime,
4541
+ formIds: raw.formIds ? String(raw.formIds).trim() : void 0,
4542
+ keyword: raw.keyword ? String(raw.keyword).trim() : void 0,
4543
+ reason: raw.reason ? String(raw.reason).trim() : void 0,
4544
+ labelIds: raw.labelIds ? String(raw.labelIds).trim() : void 0,
4545
+ isCommerce: raw.isCommerce !== void 0 ? Boolean(raw.isCommerce) : false
4546
+ } : void 0
4547
+ };
4548
+ }
4549
+ var ZaloFormsValidator = {
4550
+ createForm: validateCreateFormRequest,
4551
+ listFormsByOfficialAccount: validateListFormsByOfficialAccountRequest,
4552
+ listFormLeads: validateListFormLeadsRequest
4553
+ };
4554
+
2507
4555
  // src/services/forms.service.ts
4556
+ var OP_ZaloAdsCreateForm2 = {
4557
+ operationId: "zalo_ads_create_form",
4558
+ method: "POST",
4559
+ endpoint: "/api/form/create",
4560
+ baseUrl: "https://ads.zalo.me",
4561
+ binaryFields: [],
4562
+ pathFields: [],
4563
+ queryFields: [],
4564
+ headerFields: [],
4565
+ cookieFields: [],
4566
+ bodyFields: ["data"]
4567
+ };
4568
+ var OP_ZaloAdsListFormsByOfficialAccount2 = {
4569
+ operationId: "zalo_ads_list_forms_by_official_account",
4570
+ method: "GET",
4571
+ endpoint: "/api/form/getByOaId",
4572
+ baseUrl: "https://ads.zalo.me",
4573
+ binaryFields: [],
4574
+ pathFields: [],
4575
+ queryFields: ["oaId", "isAll"],
4576
+ headerFields: [],
4577
+ cookieFields: [],
4578
+ bodyFields: []
4579
+ };
2508
4580
  var OP_ZaloFormsDisableFormLeadNotification = {
2509
4581
  "operationId": "ZaloForms_disableFormLeadNotification",
2510
4582
  "method": "POST",
@@ -2578,7 +4650,8 @@ var OP_ZaloFormsListConversationLeads = {
2578
4650
  "keyword",
2579
4651
  "fromTime",
2580
4652
  "labelIds",
2581
- "sceneIds"
4653
+ "sceneIds",
4654
+ "reason"
2582
4655
  ],
2583
4656
  "headerFields": [],
2584
4657
  "cookieFields": [],
@@ -2602,7 +4675,8 @@ var OP_ZaloFormsListFormLeads = {
2602
4675
  "keyword",
2603
4676
  "fromTime",
2604
4677
  "labelIds",
2605
- "isCommerce"
4678
+ "isCommerce",
4679
+ "reason"
2606
4680
  ],
2607
4681
  "headerFields": [],
2608
4682
  "cookieFields": [],
@@ -2642,6 +4716,20 @@ var OP_ZaloFormsListSimpleFormsByOfficialAccount = {
2642
4716
  "cookieFields": [],
2643
4717
  "bodyFields": []
2644
4718
  };
4719
+ var OP_ZaloFormsListScenariosByOfficialAccount = {
4720
+ "operationId": "ZaloForms_listScenariosByOfficialAccount",
4721
+ "method": "GET",
4722
+ "endpoint": "/client/manage/api/manageConversation/getScenariosByOaId",
4723
+ "baseUrl": "https://form.ads.zalo.me",
4724
+ "binaryFields": [],
4725
+ "pathFields": [],
4726
+ "queryFields": [
4727
+ "oaId"
4728
+ ],
4729
+ "headerFields": [],
4730
+ "cookieFields": [],
4731
+ "bodyFields": []
4732
+ };
2645
4733
  var OP_ZaloFormsUpdateFormLeadNotificationInterval = {
2646
4734
  "operationId": "ZaloForms_updateFormLeadNotificationInterval",
2647
4735
  "method": "POST",
@@ -2670,10 +4758,59 @@ var OP_ZaloFormsGetAuthSession = {
2670
4758
  "cookieFields": [],
2671
4759
  "bodyFields": []
2672
4760
  };
4761
+ var OP_ZaloFormsTrackManageFormEvent = {
4762
+ operationId: "zalo_forms_track_manage_form_event",
4763
+ method: "GET",
4764
+ endpoint: "/client/manage/api/manageForm/tracking",
4765
+ baseUrl: "https://form.ads.zalo.me",
4766
+ binaryFields: [],
4767
+ pathFields: [],
4768
+ queryFields: ["eventId", "oaId", "formId"],
4769
+ headerFields: [],
4770
+ cookieFields: [],
4771
+ bodyFields: []
4772
+ };
2673
4773
  var ZaloFormsService = class {
2674
4774
  constructor(client) {
2675
4775
  this.client = client;
2676
4776
  }
4777
+ validator = ZaloFormsValidator;
4778
+ static validator = ZaloFormsValidator;
4779
+ /**
4780
+ * Tạo biểu mẫu mới gắn với Official Account (POST https://ads.zalo.me/api/form/create).
4781
+ * Hỗ trợ truyền thẳng Typed Payload (tự động validate qua ZaloFormsValidator và mã hóa urlencoded)
4782
+ * hoặc object dạng `{ data: JSON.stringify(...) }`.
4783
+ */
4784
+ async createForm(request, options) {
4785
+ let payloadStr;
4786
+ if (typeof request.data === "string") {
4787
+ payloadStr = request.data;
4788
+ } else {
4789
+ const val = ZaloFormsValidator.createForm(request);
4790
+ if (!val.isValid || !val.data) {
4791
+ throw new Error(`[ZaloFormsValidator] D\u1EEF li\u1EC7u t\u1EA1o form kh\xF4ng h\u1EE3p l\u1EC7:
4792
+ - ${val.errors.join("\n - ")}`);
4793
+ }
4794
+ payloadStr = JSON.stringify(val.data);
4795
+ }
4796
+ return this.client.requestFormUrlEncoded(
4797
+ OP_ZaloAdsCreateForm2,
4798
+ this.client.toTransportInput(OP_ZaloAdsCreateForm2, { data: payloadStr }),
4799
+ options
4800
+ );
4801
+ }
4802
+ /**
4803
+ * Lấy danh sách biểu mẫu Zalo Ads theo Official Account (GET https://ads.zalo.me/api/form/getByOaId).
4804
+ */
4805
+ listFormsByOfficialAccount(request, options) {
4806
+ const val = ZaloFormsValidator.listFormsByOfficialAccount(request);
4807
+ const cleanInput = val.isValid && val.data ? val.data : request;
4808
+ return this.client.requestWithoutBody(
4809
+ OP_ZaloAdsListFormsByOfficialAccount2,
4810
+ this.client.toTransportInput(OP_ZaloAdsListFormsByOfficialAccount2, cleanInput),
4811
+ options
4812
+ );
4813
+ }
2677
4814
  getAuthSession(options) {
2678
4815
  return this.client.requestWithoutBody(OP_ZaloFormsGetAuthSession, void 0, options);
2679
4816
  }
@@ -2701,9 +4838,411 @@ var ZaloFormsService = class {
2701
4838
  listSimpleFormsByOfficialAccount(request, options) {
2702
4839
  return this.client.requestWithoutBody(OP_ZaloFormsListSimpleFormsByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListSimpleFormsByOfficialAccount, request), options);
2703
4840
  }
4841
+ listScenariosByOfficialAccount(request, options) {
4842
+ return this.client.requestWithoutBody(OP_ZaloFormsListScenariosByOfficialAccount, this.client.toTransportInput(OP_ZaloFormsListScenariosByOfficialAccount, request), options);
4843
+ }
2704
4844
  updateFormLeadNotificationInterval(request, options) {
2705
4845
  return this.client.requestJson(OP_ZaloFormsUpdateFormLeadNotificationInterval, this.client.toTransportInput(OP_ZaloFormsUpdateFormLeadNotificationInterval, request), options);
2706
4846
  }
4847
+ /**
4848
+ * Ghi nhận sự kiện tương tác trên Lead Center (GET /client/manage/api/manageForm/tracking).
4849
+ */
4850
+ trackManageFormEvent(request, options) {
4851
+ return this.client.requestWithoutBody(
4852
+ OP_ZaloFormsTrackManageFormEvent,
4853
+ this.client.toTransportInput(OP_ZaloFormsTrackManageFormEvent, request),
4854
+ options
4855
+ );
4856
+ }
4857
+ };
4858
+
4859
+ // src/validators/instant-pages.validator.ts
4860
+ function isPositiveInteger2(val) {
4861
+ if (typeof val === "number") return Number.isInteger(val) && val > 0;
4862
+ if (typeof val === "string" && val.trim() !== "") {
4863
+ const num = Number(val);
4864
+ return Number.isInteger(num) && num > 0;
4865
+ }
4866
+ return false;
4867
+ }
4868
+ function toPositiveInteger2(val) {
4869
+ return typeof val === "number" ? Math.floor(val) : parseInt(String(val), 10);
4870
+ }
4871
+ function validateCloneInstantPageRequest(input) {
4872
+ const errors = [];
4873
+ if (!input || typeof input !== "object") {
4874
+ 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)."] };
4875
+ }
4876
+ const obj = input;
4877
+ if (!isPositiveInteger2(obj.instantPageId)) {
4878
+ 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).");
4879
+ }
4880
+ return {
4881
+ isValid: errors.length === 0,
4882
+ errors,
4883
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger2(obj.instantPageId) } : void 0
4884
+ };
4885
+ }
4886
+ function validateGetInstantPageDetailRequest(input) {
4887
+ const errors = [];
4888
+ if (!input || typeof input !== "object") {
4889
+ 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)."] };
4890
+ }
4891
+ const obj = input;
4892
+ if (!isPositiveInteger2(obj.instantPageId)) {
4893
+ 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).");
4894
+ }
4895
+ return {
4896
+ isValid: errors.length === 0,
4897
+ errors,
4898
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger2(obj.instantPageId) } : void 0
4899
+ };
4900
+ }
4901
+ function validateGetInstantPageSharedUserRequest(input) {
4902
+ const errors = [];
4903
+ if (!input || typeof input !== "object") {
4904
+ 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)."] };
4905
+ }
4906
+ const obj = input;
4907
+ if (!isPositiveInteger2(obj.instantPageId)) {
4908
+ 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).");
4909
+ }
4910
+ if (!isPositiveInteger2(obj.userId)) {
4911
+ 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).");
4912
+ }
4913
+ return {
4914
+ isValid: errors.length === 0,
4915
+ errors,
4916
+ data: errors.length === 0 ? {
4917
+ instantPageId: toPositiveInteger2(obj.instantPageId),
4918
+ userId: toPositiveInteger2(obj.userId)
4919
+ } : void 0
4920
+ };
4921
+ }
4922
+ function validateListInstantPageEditHistoryRequest(input) {
4923
+ const errors = [];
4924
+ if (!input || typeof input !== "object") {
4925
+ 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)."] };
4926
+ }
4927
+ const obj = input;
4928
+ if (!isPositiveInteger2(obj.instantPageId)) {
4929
+ 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).");
4930
+ }
4931
+ let limit = void 0;
4932
+ if (obj.limit !== void 0 && obj.limit !== null) {
4933
+ if (!isPositiveInteger2(obj.limit)) {
4934
+ errors.push("Tr\u01B0\u1EDDng 'limit' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 1.");
4935
+ } else {
4936
+ limit = toPositiveInteger2(obj.limit);
4937
+ }
4938
+ }
4939
+ let offset = void 0;
4940
+ if (obj.offset !== void 0 && obj.offset !== null) {
4941
+ const num = Number(obj.offset);
4942
+ if (!Number.isInteger(num) || num < 0) {
4943
+ errors.push("Tr\u01B0\u1EDDng 'offset' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn >= 0.");
4944
+ } else {
4945
+ offset = num;
4946
+ }
4947
+ }
4948
+ return {
4949
+ isValid: errors.length === 0,
4950
+ errors,
4951
+ data: errors.length === 0 ? {
4952
+ instantPageId: toPositiveInteger2(obj.instantPageId),
4953
+ ...limit !== void 0 ? { limit } : {},
4954
+ ...offset !== void 0 ? { offset } : {}
4955
+ } : void 0
4956
+ };
4957
+ }
4958
+ function validateListInstantPageFormRecordsRequest(input) {
4959
+ const errors = [];
4960
+ if (!input || typeof input !== "object") {
4961
+ 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)."] };
4962
+ }
4963
+ const obj = input;
4964
+ if (!isPositiveInteger2(obj.instantPageId)) {
4965
+ 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).");
4966
+ }
4967
+ return {
4968
+ isValid: errors.length === 0,
4969
+ errors,
4970
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger2(obj.instantPageId) } : void 0
4971
+ };
4972
+ }
4973
+ function validateListInstantPageSharesRequest(input) {
4974
+ const errors = [];
4975
+ if (!input || typeof input !== "object") {
4976
+ 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)."] };
4977
+ }
4978
+ const obj = input;
4979
+ if (!isPositiveInteger2(obj.instantPageId)) {
4980
+ 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).");
4981
+ }
4982
+ return {
4983
+ isValid: errors.length === 0,
4984
+ errors,
4985
+ data: errors.length === 0 ? { instantPageId: toPositiveInteger2(obj.instantPageId) } : void 0
4986
+ };
4987
+ }
4988
+ function validateListInstantPageUsersRequest(input) {
4989
+ if (input !== void 0 && input !== null && typeof input !== "object") {
4990
+ 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."] };
4991
+ }
4992
+ return { isValid: true, errors: [], data: {} };
4993
+ }
4994
+ function validateListMiniPageTemplatesRequest(input) {
4995
+ if (input !== void 0 && input !== null && typeof input !== "object") {
4996
+ 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."] };
4997
+ }
4998
+ return { isValid: true, errors: [], data: {} };
4999
+ }
5000
+ function validateSearchInstantPagesRequest(input) {
5001
+ const errors = [];
5002
+ if (input === void 0 || input === null) {
5003
+ return { isValid: true, errors: [], data: {} };
5004
+ }
5005
+ if (typeof input !== "object") {
5006
+ 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."] };
5007
+ }
5008
+ const obj = input;
5009
+ const data = {};
5010
+ if (obj.id !== void 0 && obj.id !== null && obj.id !== "") {
5011
+ if (!isPositiveInteger2(obj.id)) {
5012
+ errors.push("B\u1ED9 l\u1ECDc 'id' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn d\u01B0\u01A1ng (> 0).");
5013
+ } else {
5014
+ data.id = toPositiveInteger2(obj.id);
5015
+ }
5016
+ }
5017
+ if (obj.name !== void 0 && obj.name !== null) {
5018
+ if (typeof obj.name !== "string") {
5019
+ errors.push("B\u1ED9 l\u1ECDc 'name' n\u1EBFu c\xF3 ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
5020
+ } else {
5021
+ data.name = obj.name;
5022
+ }
5023
+ }
5024
+ if (obj.group !== void 0 && obj.group !== null && obj.group !== "") {
5025
+ const grp = Number(obj.group);
5026
+ if (grp !== 1 && grp !== 2) {
5027
+ 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).");
5028
+ } else {
5029
+ data.group = grp;
5030
+ }
5031
+ }
5032
+ return {
5033
+ isValid: errors.length === 0,
5034
+ errors,
5035
+ data: errors.length === 0 ? data : void 0
5036
+ };
5037
+ }
5038
+ function validateUpdateInstantPageRequest(input) {
5039
+ const errors = [];
5040
+ if (!input || typeof input !== "object") {
5041
+ 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)."] };
5042
+ }
5043
+ const obj = input;
5044
+ const instantPageId = obj.instantPageId ?? obj.id;
5045
+ if (!isPositiveInteger2(instantPageId)) {
5046
+ 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).");
5047
+ }
5048
+ const numericId = toPositiveInteger2(instantPageId);
5049
+ const data = {
5050
+ instantPageId: numericId,
5051
+ id: numericId
5052
+ };
5053
+ if (obj.name !== void 0 && obj.name !== null) {
5054
+ if (typeof obj.name !== "string") {
5055
+ errors.push("Tr\u01B0\u1EDDng 'name' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1.");
5056
+ } else {
5057
+ data.name = obj.name;
5058
+ }
5059
+ }
5060
+ if (obj.oaId !== void 0 && obj.oaId !== null) {
5061
+ if (typeof obj.oaId !== "string") {
5062
+ errors.push(`Tr\u01B0\u1EDDng 'oaId' ph\u1EA3i l\xE0 chu\u1ED7i k\xFD t\u1EF1 (ho\u1EB7c chu\u1ED7i r\u1ED7ng "").`);
5063
+ } else {
5064
+ data.oaId = obj.oaId;
5065
+ }
5066
+ }
5067
+ if (obj.active !== void 0 && obj.active !== null) {
5068
+ if (typeof obj.active === "boolean") {
5069
+ 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.");
5070
+ } else if (obj.active !== 0 && obj.active !== 1) {
5071
+ 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).");
5072
+ } else {
5073
+ data.active = obj.active;
5074
+ }
5075
+ }
5076
+ if (obj.status !== void 0 && obj.status !== null) {
5077
+ const st = Number(obj.status);
5078
+ if (![0, 1, 2, 3].includes(st)) {
5079
+ 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).");
5080
+ } else {
5081
+ data.status = st;
5082
+ }
5083
+ }
5084
+ if (obj.draft !== void 0 && obj.draft !== null) {
5085
+ if (typeof obj.draft !== "string") {
5086
+ errors.push("Tr\u01B0\u1EDDng 'draft' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
5087
+ } else if (obj.draft.trim() !== "") {
5088
+ try {
5089
+ JSON.parse(obj.draft);
5090
+ data.draft = obj.draft;
5091
+ } catch (err) {
5092
+ errors.push(`Tr\u01B0\u1EDDng 'draft' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
5093
+ }
5094
+ } else {
5095
+ data.draft = "";
5096
+ }
5097
+ }
5098
+ if (obj.content !== void 0 && obj.content !== null) {
5099
+ if (typeof obj.content !== "string") {
5100
+ errors.push("Tr\u01B0\u1EDDng 'content' ph\u1EA3i l\xE0 chu\u1ED7i JSON (JSON-encoded string).");
5101
+ } else if (obj.content.trim() !== "") {
5102
+ try {
5103
+ JSON.parse(obj.content);
5104
+ data.content = obj.content;
5105
+ } catch (err) {
5106
+ errors.push(`Tr\u01B0\u1EDDng 'content' kh\xF4ng ph\u1EA3i l\xE0 chu\u1ED7i JSON h\u1EE3p l\u1EC7: ${err.message}`);
5107
+ }
5108
+ } else {
5109
+ data.content = "";
5110
+ }
5111
+ }
5112
+ 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;
5113
+ if (!hasUpdateField) {
5114
+ 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'.");
5115
+ }
5116
+ return {
5117
+ isValid: errors.length === 0,
5118
+ errors,
5119
+ data: errors.length === 0 ? data : void 0
5120
+ };
5121
+ }
5122
+ function validateListInstantPageLeadsRequest(input) {
5123
+ const errors = [];
5124
+ if (!input || typeof input !== "object") {
5125
+ 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."] };
5126
+ }
5127
+ const obj = input;
5128
+ let idsString = "";
5129
+ if (typeof obj.ids === "string" && obj.ids.trim() !== "") {
5130
+ idsString = obj.ids.trim();
5131
+ } else if (Array.isArray(obj.ids) && obj.ids.length > 0) {
5132
+ idsString = obj.ids.join(",");
5133
+ } else {
5134
+ 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.");
5135
+ }
5136
+ if (idsString) {
5137
+ const idParts = idsString.split(",").map((s) => s.trim()).filter(Boolean);
5138
+ if (idParts.length === 0) {
5139
+ errors.push("Tr\u01B0\u1EDDng 'ids' kh\xF4ng ch\u1EE9a b\u1EA5t k\u1EF3 ID h\u1EE3p l\u1EC7 n\xE0o.");
5140
+ } else {
5141
+ for (const id of idParts) {
5142
+ if (!isPositiveInteger2(id)) {
5143
+ 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.`);
5144
+ }
5145
+ }
5146
+ }
5147
+ }
5148
+ return {
5149
+ isValid: errors.length === 0,
5150
+ errors,
5151
+ data: errors.length === 0 ? { ids: idsString } : void 0
5152
+ };
5153
+ }
5154
+ function validateListOfficialAccountsRequest(input) {
5155
+ if (input !== void 0 && input !== null && typeof input !== "object") {
5156
+ 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."] };
5157
+ }
5158
+ return { isValid: true, errors: [], data: {} };
5159
+ }
5160
+ function validateUpsertInstantPageFormRequest(input) {
5161
+ const errors = [];
5162
+ if (!input || typeof input !== "object") {
5163
+ 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."] };
5164
+ }
5165
+ const obj = input;
5166
+ if (!isPositiveInteger2(obj.instantPageId)) {
5167
+ 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).");
5168
+ }
5169
+ if (!obj.oaId || typeof obj.oaId !== "string" || !/^\d+$/.test(obj.oaId.trim())) {
5170
+ 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.");
5171
+ }
5172
+ if (!obj.formName || typeof obj.formName !== "string" || obj.formName.trim() === "") {
5173
+ errors.push("Tr\u01B0\u1EDDng 'formName' l\xE0 b\u1EAFt bu\u1ED9c v\xE0 kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.");
5174
+ }
5175
+ if (!Array.isArray(obj.questions) || obj.questions.length === 0) {
5176
+ 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).");
5177
+ } else {
5178
+ obj.questions.forEach((q, idx) => {
5179
+ if (!q || typeof q !== "object") {
5180
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1} ph\u1EA3i l\xE0 m\u1ED9t \u0111\u1ED1i t\u01B0\u1EE3ng.`);
5181
+ return;
5182
+ }
5183
+ const question = q;
5184
+ if (question.type !== 1 && question.type !== 2) {
5185
+ 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).`);
5186
+ }
5187
+ if (!question.title || typeof question.title !== "string" || question.title.trim() === "") {
5188
+ errors.push(`C\xE2u h\u1ECFi s\u1ED1 ${idx + 1}: Tr\u01B0\u1EDDng 'title' kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng.`);
5189
+ }
5190
+ if (!Array.isArray(question.answers) || question.answers.length === 0) {
5191
+ 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.`);
5192
+ } else {
5193
+ question.answers.forEach((ans, ansIdx) => {
5194
+ if (!ans || typeof ans !== "object") {
5195
+ 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.`);
5196
+ return;
5197
+ }
5198
+ const answer = ans;
5199
+ if (answer.type === void 0 || typeof answer.type !== "number") {
5200
+ 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.`);
5201
+ }
5202
+ });
5203
+ }
5204
+ });
5205
+ }
5206
+ const useCustomConsent = typeof obj.useCustomConsent === "boolean" ? obj.useCustomConsent : false;
5207
+ let consentConfig = obj.consentConfig;
5208
+ if (useCustomConsent) {
5209
+ if (!consentConfig || typeof consentConfig !== "object") {
5210
+ errors.push("Khi 'useCustomConsent' = true, tr\u01B0\u1EDDng 'consentConfig' l\xE0 b\u1EAFt bu\u1ED9c.");
5211
+ } else {
5212
+ 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.");
5213
+ 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.");
5214
+ 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.");
5215
+ 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.");
5216
+ }
5217
+ }
5218
+ const data = {
5219
+ instantPageId: toPositiveInteger2(obj.instantPageId),
5220
+ oaId: String(obj.oaId).trim(),
5221
+ formName: String(obj.formName).trim(),
5222
+ questions: obj.questions ?? [],
5223
+ useCustomConsent,
5224
+ consentConfig
5225
+ };
5226
+ return {
5227
+ isValid: errors.length === 0,
5228
+ errors,
5229
+ data: errors.length === 0 ? data : void 0
5230
+ };
5231
+ }
5232
+ var ZaloInstantPagesValidator = {
5233
+ validateCloneInstantPage: validateCloneInstantPageRequest,
5234
+ validateGetInstantPageDetail: validateGetInstantPageDetailRequest,
5235
+ validateGetInstantPageSharedUser: validateGetInstantPageSharedUserRequest,
5236
+ validateListInstantPageEditHistory: validateListInstantPageEditHistoryRequest,
5237
+ validateListInstantPageFormRecords: validateListInstantPageFormRecordsRequest,
5238
+ validateListInstantPageShares: validateListInstantPageSharesRequest,
5239
+ validateListInstantPageUsers: validateListInstantPageUsersRequest,
5240
+ validateListMiniPageTemplates: validateListMiniPageTemplatesRequest,
5241
+ validateSearchInstantPages: validateSearchInstantPagesRequest,
5242
+ validateUpdateInstantPage: validateUpdateInstantPageRequest,
5243
+ validateListInstantPageLeads: validateListInstantPageLeadsRequest,
5244
+ validateListOfficialAccounts: validateListOfficialAccountsRequest,
5245
+ validateUpsertInstantPageForm: validateUpsertInstantPageFormRequest
2707
5246
  };
2708
5247
 
2709
5248
  // src/services/instant-pages.service.ts
@@ -2908,8 +5447,13 @@ var ZaloInstantPagesService = class {
2908
5447
  constructor(client) {
2909
5448
  this.client = client;
2910
5449
  }
5450
+ /**
5451
+ * Bộ công cụ kiểm tra tính hợp lệ dữ liệu (Standalone Validators) cho 13 API Instant Pages.
5452
+ * Dùng ở backend (NestJS/Express/Fastify), middleware hoặc AI Agent để verify payload trước khi gọi SDK.
5453
+ */
5454
+ static validator = ZaloInstantPagesValidator;
2911
5455
  cloneInstantPage(request, options) {
2912
- return this.client.requestWithoutBody(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
5456
+ return this.client.requestJson(OP_ZaloInstantPagesCloneInstantPage, this.client.toTransportInput(OP_ZaloInstantPagesCloneInstantPage, request), options);
2913
5457
  }
2914
5458
  getInstantPageDetail(request, options) {
2915
5459
  return this.client.requestWithoutBody(OP_ZaloInstantPagesGetInstantPageDetail, this.client.toTransportInput(OP_ZaloInstantPagesGetInstantPageDetail, request), options);
@@ -3186,6 +5730,17 @@ var ZaloWidgetApiService = class {
3186
5730
  var ZaloAdsSdk = class {
3187
5731
  client;
3188
5732
  ads;
5733
+ campaigns;
5734
+ account;
5735
+ audiences;
5736
+ targeting;
5737
+ reports;
5738
+ conversions;
5739
+ pixel;
5740
+ automatedRules;
5741
+ rules;
5742
+ flows;
5743
+ media;
3189
5744
  forms;
3190
5745
  instantPages;
3191
5746
  profileAds;
@@ -3196,6 +5751,17 @@ var ZaloAdsSdk = class {
3196
5751
  const resolvedOptions = typeof options === "string" ? { zpsid: options } : options;
3197
5752
  this.client = new ZaloSdkHttpClient(resolvedOptions);
3198
5753
  this.ads = new ZaloAdsService(this.client);
5754
+ this.campaigns = this.ads;
5755
+ this.account = this.ads.account;
5756
+ this.audiences = this.ads.audiences;
5757
+ this.targeting = this.ads.audiences;
5758
+ this.reports = this.ads.reports;
5759
+ this.conversions = this.ads.conversions;
5760
+ this.pixel = this.ads.conversions;
5761
+ this.automatedRules = this.ads.automatedRules;
5762
+ this.rules = this.ads.automatedRules;
5763
+ this.flows = this.ads.flows;
5764
+ this.media = this.ads.media;
3199
5765
  this.forms = new ZaloFormsService(this.client);
3200
5766
  this.instantPages = new ZaloInstantPagesService(this.client);
3201
5767
  this.profileAds = new ZaloProfileAdsService(this.client);
@@ -3460,8 +6026,10 @@ var ZaloAdsCreateFlowRequest = class {
3460
6026
  messages;
3461
6027
  };
3462
6028
  var ZaloAdsCreateFlowResponse = class {
3463
- /** 0 khi tạo thành công. */
6029
+ /** 0 khi tạo thành công; 1 khi lỗi (ví dụ: đã tới hạn mức 20 kịch bản). */
3464
6030
  code;
6031
+ /** Thông báo lỗi từ Zalo Ads khi code khác 0. */
6032
+ msg;
3465
6033
  /** ID kịch bản mới, truyền vào data.ZaloFlowId khi cập nhật quảng cáo Tin nhắn. */
3466
6034
  data;
3467
6035
  };
@@ -3521,12 +6089,36 @@ var ZaloAdsUpdateMessageAdResponse = class {
3521
6089
  code;
3522
6090
  data;
3523
6091
  };
6092
+
6093
+ // src/dtos/instant-pages.dto.ts
6094
+ var ZaloInstantPageBlockType = /* @__PURE__ */ ((ZaloInstantPageBlockType2) => {
6095
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CAROUSEL_SLIDER"] = 1] = "CAROUSEL_SLIDER";
6096
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["COUNTDOWN"] = 2] = "COUNTDOWN";
6097
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["RICH_TEXT"] = 4] = "RICH_TEXT";
6098
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["HERO_IMAGE"] = 6] = "HERO_IMAGE";
6099
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_NAME"] = 7] = "FORM_NAME";
6100
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["ORDER_CTA_BUTTON"] = 8] = "ORDER_CTA_BUTTON";
6101
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_PHONE"] = 9] = "FORM_PHONE";
6102
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_ADDRESS"] = 10] = "FORM_ADDRESS";
6103
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FOOTER"] = 14] = "FOOTER";
6104
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["FORM_QUANTITY"] = 16] = "FORM_QUANTITY";
6105
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_VARIANT"] = 18] = "PRODUCT_VARIANT";
6106
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["PRODUCT_TITLE_PRICE"] = 19] = "PRODUCT_TITLE_PRICE";
6107
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["QUICK_QUESTIONS"] = 20] = "QUICK_QUESTIONS";
6108
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["MESSAGE_CTA_BUTTON"] = 21] = "MESSAGE_CTA_BUTTON";
6109
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["SECTION_HEADING"] = 22] = "SECTION_HEADING";
6110
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CALL_HOTLINE_BUTTON"] = 23] = "CALL_HOTLINE_BUTTON";
6111
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["KEY_VALUE_TABLE"] = 25] = "KEY_VALUE_TABLE";
6112
+ ZaloInstantPageBlockType2[ZaloInstantPageBlockType2["CONSENT_NOTICE"] = 27] = "CONSENT_NOTICE";
6113
+ return ZaloInstantPageBlockType2;
6114
+ })(ZaloInstantPageBlockType || {});
3524
6115
  // Annotate the CommonJS export names for ESM import in node:
3525
6116
  0 && (module.exports = {
3526
6117
  ALL_ZALO_ADS_DOMAINS,
3527
6118
  MemoryZaloSessionStore,
3528
6119
  RedisZaloSessionStore,
3529
6120
  TieredZaloSessionStore,
6121
+ ZaloAccountService,
3530
6122
  ZaloAdsAccountPool,
3531
6123
  ZaloAdsCreateFlowRequest,
3532
6124
  ZaloAdsCreateFlowResponse,
@@ -3543,11 +6135,23 @@ var ZaloAdsUpdateMessageAdResponse = class {
3543
6135
  ZaloAdsUpdateMessageAdResponse,
3544
6136
  ZaloAdsUpdateVideoAdRequest,
3545
6137
  ZaloAdsUpdateVideoAdResponse,
6138
+ ZaloAudiencesService,
6139
+ ZaloAudiencesValidator,
3546
6140
  ZaloAuthManager,
6141
+ ZaloAutomatedRulesService,
6142
+ ZaloCampaignsService,
3547
6143
  ZaloChatWidgetService,
6144
+ ZaloConversionsService,
6145
+ ZaloFlowsService,
6146
+ ZaloFlowsValidator,
3548
6147
  ZaloFormsService,
6148
+ ZaloFormsValidator,
6149
+ ZaloInstantPageBlockType,
3549
6150
  ZaloInstantPagesService,
6151
+ ZaloInstantPagesValidator,
6152
+ ZaloMediaService,
3550
6153
  ZaloProfileAdsService,
6154
+ ZaloReportsService,
3551
6155
  ZaloSdkError,
3552
6156
  ZaloSdkHttpClient,
3553
6157
  ZaloWidgetApiService,
@@ -3556,6 +6160,32 @@ var ZaloAdsUpdateMessageAdResponse = class {
3556
6160
  decodePlaySessionJwt,
3557
6161
  defaultSharedMemorySessionStore,
3558
6162
  deriveAccountKeyFromZpsid,
3559
- parseZaloCookieInput
6163
+ parseZaloCookieInput,
6164
+ validateCloneInstantPageRequest,
6165
+ validateCreateFlowRequest,
6166
+ validateCreateFormEventAudienceRequest,
6167
+ validateCreateFormRequest,
6168
+ validateCreateLookalikeAudienceRequest,
6169
+ validateCreateMessageOaEventAudienceRequest,
6170
+ validateCreateMessagePersonalEventAudienceRequest,
6171
+ validateCreatePhoneAudienceRequest,
6172
+ validateCreateSavedAudienceRequest,
6173
+ validateEstimateAudienceRequest,
6174
+ validateGetInstantPageDetailRequest,
6175
+ validateGetInstantPageSharedUserRequest,
6176
+ validateListFlowsByOfficialAccountRequest,
6177
+ validateListFormLeadsRequest,
6178
+ validateListFormsByOfficialAccountRequest,
6179
+ validateListInstantPageEditHistoryRequest,
6180
+ validateListInstantPageFormRecordsRequest,
6181
+ validateListInstantPageLeadsRequest,
6182
+ validateListInstantPageSharesRequest,
6183
+ validateListInstantPageUsersRequest,
6184
+ validateListMiniPageTemplatesRequest,
6185
+ validateListOfficialAccountsRequest,
6186
+ validateSearchInstantPagesRequest,
6187
+ validateUpdateFlowRequest,
6188
+ validateUpdateInstantPageRequest,
6189
+ validateUpsertInstantPageFormRequest
3560
6190
  });
3561
6191
  //# sourceMappingURL=index.js.map