@redonvn/zalo-ads-sdk 0.1.0 → 0.2.0

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.mjs CHANGED
@@ -257,7 +257,9 @@ function decodePlaySessionJwt(playSessionCookie) {
257
257
  const base64Url = parts[1];
258
258
  const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
259
259
  const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
260
- const jsonStr = typeof Buffer !== "undefined" ? Buffer.from(padded, "base64").toString("utf8") : globalThis.atob(padded);
260
+ const binaryStr = globalThis.atob(padded);
261
+ const bytes = Uint8Array.from(binaryStr, (ch) => ch.charCodeAt(0));
262
+ const jsonStr = new TextDecoder("utf-8").decode(bytes);
261
263
  return JSON.parse(jsonStr);
262
264
  } catch {
263
265
  return void 0;
@@ -655,14 +657,23 @@ var ZaloAuthManager = class {
655
657
  formProfile = sessionJson.data;
656
658
  }
657
659
  } else if (domain === "profile.ads.zalo.me") {
658
- await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
660
+ const profileRes = await this.followOAuthRedirects("https://profile.ads.zalo.me/", cookies, false);
661
+ if (profileRes) {
662
+ const html = await profileRes.text().catch(() => "");
663
+ const csrfMatch = html.match(/CSRF_TOKEN\s*=\s*['"]([^'"]+)['"]/);
664
+ if (csrfMatch?.[1]) {
665
+ cookies["CSRF_TOKEN"] = csrfMatch[1];
666
+ }
667
+ }
668
+ headers["Origin"] = "https://profile.ads.zalo.me";
669
+ headers["Referer"] = "https://profile.ads.zalo.me/";
659
670
  } else if (domain === "api.widget.zalo.me" || domain === "widget.chat.zalo.me") {
660
671
  headers["Origin"] = "https://ads.zalo.me";
661
672
  headers["Referer"] = "https://ads.zalo.me/";
662
673
  }
663
- const xsrfToken = cookies["XSRF-TOKEN"];
664
- if (xsrfToken) {
665
- headers["x-xsrf-token"] = xsrfToken;
674
+ const xsrfToken = cookies["XSRF-TOKEN"] ?? cookies["CSRF_TOKEN"];
675
+ if (cookies["XSRF-TOKEN"]) {
676
+ headers["x-xsrf-token"] = cookies["XSRF-TOKEN"];
666
677
  }
667
678
  const bearerToken = formProfile?.token;
668
679
  if (bearerToken) {
@@ -695,7 +706,8 @@ var ZaloAuthManager = class {
695
706
  }
696
707
  async followOAuthRedirects(startUrl, cookies, stripSelectAccount) {
697
708
  let currentUrl = startUrl;
698
- for (let step = 1; step <= 6; step++) {
709
+ let lastResponse;
710
+ for (let step = 1; step <= 7; step++) {
699
711
  const res = await this.fetchImpl(currentUrl, {
700
712
  method: "GET",
701
713
  headers: {
@@ -705,9 +717,52 @@ var ZaloAuthManager = class {
705
717
  },
706
718
  redirect: "manual"
707
719
  });
720
+ lastResponse = res;
708
721
  this.mergeSetCookies(res, cookies);
709
722
  let location = res.headers.get("location");
710
- if (!location || res.status < 300 || res.status >= 400) {
723
+ if (!location && res.status === 200 && currentUrl.includes("oauth.zaloapp.com/v4/permission")) {
724
+ const html = await res.text().catch(() => "");
725
+ const csrfMatch = html.match(/name="csrf_token"[^>]*value="([^"]+)"/);
726
+ if (csrfMatch && html.includes("zid_consent_form")) {
727
+ const stateMatch = html.match(/name="state"[^>]*value="([^"]+)"/);
728
+ const parsedOAuthUrl = new URL(currentUrl);
729
+ const consentForm = new URLSearchParams({
730
+ csrf_token: csrfMatch[1],
731
+ app_id: parsedOAuthUrl.searchParams.get("app_id") ?? "",
732
+ redirect_uri: parsedOAuthUrl.searchParams.get("redirect_uri") ?? "",
733
+ bndl_id: "",
734
+ pkg_name: "",
735
+ sign_key: "",
736
+ wp_guid: "",
737
+ mac: "",
738
+ ref: "",
739
+ token_login_post: "",
740
+ state: stateMatch ? stateMatch[1] : parsedOAuthUrl.searchParams.get("state") ?? "",
741
+ ext_info: "",
742
+ enable_qgpf: ""
743
+ });
744
+ const consentRes = await this.fetchImpl(currentUrl, {
745
+ method: "POST",
746
+ headers: {
747
+ Cookie: this.formatCookieHeader(cookies),
748
+ "User-Agent": this.userAgent,
749
+ "Content-Type": "application/x-www-form-urlencoded",
750
+ Origin: "https://oauth.zaloapp.com",
751
+ Referer: currentUrl
752
+ },
753
+ body: consentForm.toString(),
754
+ redirect: "manual"
755
+ });
756
+ lastResponse = consentRes;
757
+ this.mergeSetCookies(consentRes, cookies);
758
+ location = consentRes.headers.get("location");
759
+ if (!location || consentRes.status < 300 || consentRes.status >= 400) {
760
+ break;
761
+ }
762
+ } else {
763
+ break;
764
+ }
765
+ } else if (!location || res.status < 300 || res.status >= 400) {
711
766
  break;
712
767
  }
713
768
  if (stripSelectAccount && location.includes("oauth.zaloapp.com") && location.includes("select_account=true")) {
@@ -718,6 +773,7 @@ var ZaloAuthManager = class {
718
773
  }
719
774
  currentUrl = location.startsWith("http") ? location : new URL(location, currentUrl).toString();
720
775
  }
776
+ return lastResponse;
721
777
  }
722
778
  mergeSetCookies(res, target) {
723
779
  const headersWithSetCookie = res.headers;
@@ -768,6 +824,7 @@ var DEFAULT_BASE_URLS = {
768
824
  ads: "https://ads.zalo.me",
769
825
  forms: "https://form.ads.zalo.me",
770
826
  instantPages: "https://page.ads.zalo.me",
827
+ profileAds: "https://profile.ads.zalo.me",
771
828
  widget: "https://api.widget.zalo.me",
772
829
  chatWidget: "https://widget.chat.zalo.me"
773
830
  };
@@ -977,6 +1034,18 @@ var OP_ZaloAdsCreateFlow = {
977
1034
  cookieFields: [],
978
1035
  bodyFields: ["oaId", "id", "name", "messages"]
979
1036
  };
1037
+ var OP_ZaloAdsUpdateFlow = {
1038
+ operationId: "ZaloAds_updateFlow",
1039
+ method: "POST",
1040
+ endpoint: "/api/flow/update",
1041
+ baseUrl: "https://ads.zalo.me",
1042
+ binaryFields: [],
1043
+ pathFields: [],
1044
+ queryFields: [],
1045
+ headerFields: [],
1046
+ cookieFields: [],
1047
+ bodyFields: ["oaId", "id", "name", "messages"]
1048
+ };
980
1049
  var OP_ZaloAdsUpdateVideoAd = {
981
1050
  operationId: "ZaloAds_updateVideoAd",
982
1051
  method: "POST",
@@ -1104,6 +1173,26 @@ var OP_ZaloAdsCreatePostCampaign = {
1104
1173
  "data"
1105
1174
  ]
1106
1175
  };
1176
+ var OP_ZaloAdsCreateConversion = {
1177
+ "operationId": "ZaloAds_createConversion",
1178
+ "method": "POST",
1179
+ "endpoint": "/api/conversion/add",
1180
+ "baseUrl": "https://ads.zalo.me",
1181
+ "binaryFields": [],
1182
+ "pathFields": [],
1183
+ "queryFields": [],
1184
+ "headerFields": [],
1185
+ "cookieFields": [],
1186
+ "bodyFields": [
1187
+ "name",
1188
+ "landingPage",
1189
+ "urlType",
1190
+ "labelId",
1191
+ "buttonIds",
1192
+ "elements",
1193
+ "keywords"
1194
+ ]
1195
+ };
1107
1196
  var OP_ZaloAdsDeleteConversion = {
1108
1197
  "operationId": "ZaloAds_deleteConversion",
1109
1198
  "method": "DELETE",
@@ -1139,7 +1228,9 @@ var OP_ZaloAdsGetAdById = {
1139
1228
  "baseUrl": "https://ads.zalo.me",
1140
1229
  "binaryFields": [],
1141
1230
  "pathFields": [],
1142
- "queryFields": [],
1231
+ "queryFields": [
1232
+ "adId"
1233
+ ],
1143
1234
  "headerFields": [],
1144
1235
  "cookieFields": [],
1145
1236
  "bodyFields": []
@@ -1375,8 +1466,14 @@ var OP_ZaloAdsGetReportapiV2Campaigns = {
1375
1466
  "endpoint": "/reportapi/v2/campaigns/{campaignId}",
1376
1467
  "baseUrl": "https://ads.zalo.me",
1377
1468
  "binaryFields": [],
1378
- "pathFields": [],
1379
- "queryFields": [],
1469
+ "pathFields": [
1470
+ "campaignId"
1471
+ ],
1472
+ "queryFields": [
1473
+ "startDate",
1474
+ "endDate",
1475
+ "refresh"
1476
+ ],
1380
1477
  "headerFields": [],
1381
1478
  "cookieFields": [],
1382
1479
  "bodyFields": []
@@ -1401,8 +1498,11 @@ var OP_ZaloAdsGetReportapiV3Campaigns = {
1401
1498
  "binaryFields": [],
1402
1499
  "pathFields": [],
1403
1500
  "queryFields": [
1501
+ "filter",
1404
1502
  "endDate",
1405
1503
  "refresh",
1504
+ "agencyId",
1505
+ "createdBy",
1406
1506
  "startDate"
1407
1507
  ],
1408
1508
  "headerFields": [],
@@ -1416,7 +1516,10 @@ var OP_ZaloAdsGetZaapiCampaignReportcampaign = {
1416
1516
  "baseUrl": "https://ads.zalo.me",
1417
1517
  "binaryFields": [],
1418
1518
  "pathFields": [],
1419
- "queryFields": [],
1519
+ "queryFields": [
1520
+ "campaignId",
1521
+ "campId"
1522
+ ],
1420
1523
  "headerFields": [],
1421
1524
  "cookieFields": [],
1422
1525
  "bodyFields": []
@@ -1428,7 +1531,10 @@ var OP_ZaloAdsGetZaapiCheckcamphasmanyads = {
1428
1531
  "baseUrl": "https://ads.zalo.me",
1429
1532
  "binaryFields": [],
1430
1533
  "pathFields": [],
1431
- "queryFields": [],
1534
+ "queryFields": [
1535
+ "campaignId",
1536
+ "campId"
1537
+ ],
1432
1538
  "headerFields": [],
1433
1539
  "cookieFields": [],
1434
1540
  "bodyFields": []
@@ -1440,7 +1546,10 @@ var OP_ZaloAdsGetZaapiGetadsfromcampaignid = {
1440
1546
  "baseUrl": "https://ads.zalo.me",
1441
1547
  "binaryFields": [],
1442
1548
  "pathFields": [],
1443
- "queryFields": [],
1549
+ "queryFields": [
1550
+ "campaignId",
1551
+ "campId"
1552
+ ],
1444
1553
  "headerFields": [],
1445
1554
  "cookieFields": [],
1446
1555
  "bodyFields": []
@@ -1464,7 +1573,10 @@ var OP_ZaloAdsGetZaapiGetownedarticles = {
1464
1573
  "baseUrl": "https://ads.zalo.me",
1465
1574
  "binaryFields": [],
1466
1575
  "pathFields": [],
1467
- "queryFields": [],
1576
+ "queryFields": [
1577
+ "pageId",
1578
+ "oaId"
1579
+ ],
1468
1580
  "headerFields": [],
1469
1581
  "cookieFields": [],
1470
1582
  "bodyFields": []
@@ -1609,10 +1721,14 @@ var OP_ZaloAdsPostZaapiDeletead = {
1609
1721
  "baseUrl": "https://ads.zalo.me",
1610
1722
  "binaryFields": [],
1611
1723
  "pathFields": [],
1612
- "queryFields": [],
1724
+ "queryFields": [
1725
+ "adId"
1726
+ ],
1613
1727
  "headerFields": [],
1614
1728
  "cookieFields": [],
1615
- "bodyFields": []
1729
+ "bodyFields": [
1730
+ "adId"
1731
+ ]
1616
1732
  };
1617
1733
  var OP_ZaloAdsRenameCampaign = {
1618
1734
  "operationId": "ZaloAds_renameCampaign",
@@ -1685,12 +1801,21 @@ var OP_ZaloAdsUpdateNewAds = {
1685
1801
  "method": "POST",
1686
1802
  "endpoint": "/zaapi/UploadCrop",
1687
1803
  "baseUrl": "https://ads.zalo.me",
1688
- "binaryFields": [],
1804
+ "binaryFields": [
1805
+ "File"
1806
+ ],
1689
1807
  "pathFields": [],
1690
1808
  "queryFields": [],
1691
1809
  "headerFields": [],
1692
1810
  "cookieFields": [],
1693
- "bodyFields": []
1811
+ "bodyFields": [
1812
+ "File",
1813
+ "x",
1814
+ "y",
1815
+ "width",
1816
+ "height",
1817
+ "scale"
1818
+ ]
1694
1819
  };
1695
1820
  var OP_ZaloAdsUpdateOfficialAccountAd = {
1696
1821
  "operationId": "ZaloAds_updateOfficialAccountAd",
@@ -1842,10 +1967,13 @@ var OP_ZaloAdsCreateAutomatedRule = {
1842
1967
  "headerFields": [],
1843
1968
  "cookieFields": [],
1844
1969
  "bodyFields": [
1970
+ "scope",
1845
1971
  "appliedTo",
1846
1972
  "ruleName",
1847
1973
  "action",
1848
1974
  "conditions",
1975
+ "frequency",
1976
+ "appliedIds",
1849
1977
  "schedule",
1850
1978
  "campaignIds",
1851
1979
  "adIds"
@@ -1876,7 +2004,7 @@ var OP_ZaloAdsUpdateAutomatedRule = {
1876
2004
  var OP_ZaloAdsChangeAutomatedRuleStatus = {
1877
2005
  "operationId": "ZaloAds_changeAutomatedRuleStatus",
1878
2006
  "method": "POST",
1879
- "endpoint": "/api/automatedrules/status",
2007
+ "endpoint": "/api/automatedrules/change-status",
1880
2008
  "baseUrl": "https://ads.zalo.me",
1881
2009
  "binaryFields": [],
1882
2010
  "pathFields": [],
@@ -1884,10 +2012,25 @@ var OP_ZaloAdsChangeAutomatedRuleStatus = {
1884
2012
  "headerFields": [],
1885
2013
  "cookieFields": [],
1886
2014
  "bodyFields": [
2015
+ "automatedRuleId",
1887
2016
  "automatedRuleIds",
1888
2017
  "status"
1889
2018
  ]
1890
2019
  };
2020
+ var OP_ZaloAdsGetAutomatedRuleHistory = {
2021
+ "operationId": "ZaloAds_getAutomatedRuleHistory",
2022
+ "method": "GET",
2023
+ "endpoint": "/api/automatedrules/history/{automatedRuleId}",
2024
+ "baseUrl": "https://ads.zalo.me",
2025
+ "binaryFields": [],
2026
+ "pathFields": [
2027
+ "automatedRuleId"
2028
+ ],
2029
+ "queryFields": [],
2030
+ "headerFields": [],
2031
+ "cookieFields": [],
2032
+ "bodyFields": []
2033
+ };
1891
2034
  var OP_ZaloAdsDeleteAutomatedRule = {
1892
2035
  "operationId": "ZaloAds_deleteAutomatedRule",
1893
2036
  "method": "POST",
@@ -1962,6 +2105,9 @@ var ZaloAdsService = class {
1962
2105
  createFlow(request, options) {
1963
2106
  return this.client.requestJson(OP_ZaloAdsCreateFlow, this.client.toTransportInput(OP_ZaloAdsCreateFlow, request), options);
1964
2107
  }
2108
+ updateFlow(request, options) {
2109
+ return this.client.requestJson(OP_ZaloAdsUpdateFlow, this.client.toTransportInput(OP_ZaloAdsUpdateFlow, request), options);
2110
+ }
1965
2111
  listFlowsByOfficialAccount(request, options) {
1966
2112
  return this.client.requestWithoutBody(OP_ZaloAdsListFlowsByOfficialAccount, this.client.toTransportInput(OP_ZaloAdsListFlowsByOfficialAccount, request), options);
1967
2113
  }
@@ -1993,6 +2139,10 @@ var ZaloAdsService = class {
1993
2139
  createEcommerceCampaign(request, options) {
1994
2140
  return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateEcommerceCampaign, this.client.toTransportInput(OP_ZaloAdsCreateEcommerceCampaign, request), options);
1995
2141
  }
2142
+ /** Alias theo tên tool chuẩn `zalo_ads_create_commerce_campaign` trong Project Schema Zalo ADS (`campaignType = 22`). */
2143
+ createCommerceCampaign(request, options) {
2144
+ return this.createEcommerceCampaign(request, options);
2145
+ }
1996
2146
  createForm(request, options) {
1997
2147
  return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateForm, this.client.toTransportInput(OP_ZaloAdsCreateForm, request), options);
1998
2148
  }
@@ -2005,9 +2155,17 @@ var ZaloAdsService = class {
2005
2155
  createOfficialAccountCampaign(request, options) {
2006
2156
  return this.client.requestFormUrlEncoded(OP_ZaloAdsCreateOfficialAccountCampaign, this.client.toTransportInput(OP_ZaloAdsCreateOfficialAccountCampaign, request), options);
2007
2157
  }
2158
+ /** Alias theo tên tool chuẩn `zalo_ads_create_oa_campaign` trong Project Schema Zalo ADS (`campaignType = 3`). */
2159
+ createOaCampaign(request, options) {
2160
+ return this.createOfficialAccountCampaign(request, options);
2161
+ }
2008
2162
  createPostCampaign(request, options) {
2009
2163
  return this.client.requestFormUrlEncoded(OP_ZaloAdsCreatePostCampaign, this.client.toTransportInput(OP_ZaloAdsCreatePostCampaign, request), options);
2010
2164
  }
2165
+ /** Alias theo tên tool chuẩn `zalo_ads_create_article_campaign` trong Project Schema Zalo ADS (`campaignType = 4`). */
2166
+ createArticleCampaign(request, options) {
2167
+ return this.createPostCampaign(request, options);
2168
+ }
2011
2169
  listAutomatedRules(request = {}, options) {
2012
2170
  const queryInput = { query_param: { ruleName: request.ruleName ?? "" } };
2013
2171
  return this.client.requestWithoutBody(OP_ZaloAdsListAutomatedRules, queryInput, options);
@@ -2021,16 +2179,22 @@ var ZaloAdsService = class {
2021
2179
  changeAutomatedRuleStatus(request, options) {
2022
2180
  return this.client.requestJson(OP_ZaloAdsChangeAutomatedRuleStatus, this.client.toTransportInput(OP_ZaloAdsChangeAutomatedRuleStatus, request), options);
2023
2181
  }
2182
+ getAutomatedRuleHistory(request, options) {
2183
+ return this.client.requestWithoutBody(OP_ZaloAdsGetAutomatedRuleHistory, this.client.toTransportInput(OP_ZaloAdsGetAutomatedRuleHistory, request), options);
2184
+ }
2024
2185
  deleteAutomatedRule(request, options) {
2025
2186
  return this.client.requestJson(OP_ZaloAdsDeleteAutomatedRule, this.client.toTransportInput(OP_ZaloAdsDeleteAutomatedRule, request), options);
2026
2187
  }
2188
+ createConversion(request, options) {
2189
+ return this.client.requestJson(OP_ZaloAdsCreateConversion, this.client.toTransportInput(OP_ZaloAdsCreateConversion, request), options);
2190
+ }
2027
2191
  deleteConversion(request, options) {
2028
2192
  return this.client.requestWithoutBody(OP_ZaloAdsDeleteConversion, this.client.toTransportInput(OP_ZaloAdsDeleteConversion, request), options);
2029
2193
  }
2030
2194
  deleteCustomAudience(request, options) {
2031
2195
  return this.client.requestWithoutBody(OP_ZaloAdsDeleteCustomAudience, this.client.toTransportInput(OP_ZaloAdsDeleteCustomAudience, request), options);
2032
2196
  }
2033
- getAdById(request, options) {
2197
+ getAdById(request = {}, options) {
2034
2198
  return this.client.requestWithoutBody(OP_ZaloAdsGetAdById, this.client.toTransportInput(OP_ZaloAdsGetAdById, request), options);
2035
2199
  }
2036
2200
  getAdChangeLog(request, options) {
@@ -2045,28 +2209,28 @@ var ZaloAdsService = class {
2045
2209
  getApiBaAccountAllgrantedmembers(request = {}, options) {
2046
2210
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, this.client.toTransportInput(OP_ZaloAdsGetApiBaAccountAllgrantedmembers, request), options);
2047
2211
  }
2048
- getApiConversionAll(request, options) {
2212
+ getApiConversionAll(request = {}, options) {
2049
2213
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionAll, this.client.toTransportInput(OP_ZaloAdsGetApiConversionAll, request), options);
2050
2214
  }
2051
2215
  getApiConversionStandardEvents(request = {}, options) {
2052
2216
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiConversionStandardEvents, this.client.toTransportInput(OP_ZaloAdsGetApiConversionStandardEvents, request), options);
2053
2217
  }
2054
- getApiCustomAudienceAll(request, options) {
2218
+ getApiCustomAudienceAll(request = {}, options) {
2055
2219
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiCustomAudienceAll, this.client.toTransportInput(OP_ZaloAdsGetApiCustomAudienceAll, request), options);
2056
2220
  }
2057
2221
  getApiFilegroups(request = {}, options) {
2058
2222
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiFilegroups, this.client.toTransportInput(OP_ZaloAdsGetApiFilegroups, request), options);
2059
2223
  }
2060
- getApiLpNews(request, options) {
2224
+ getApiLpNews(request = {}, options) {
2061
2225
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiLpNews, this.client.toTransportInput(OP_ZaloAdsGetApiLpNews, request), options);
2062
2226
  }
2063
2227
  getApiMediaItems(request, options) {
2064
2228
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiMediaItems, this.client.toTransportInput(OP_ZaloAdsGetApiMediaItems, request), options);
2065
2229
  }
2066
- getApiMemberFiles(request, options) {
2230
+ getApiMemberFiles(request = {}, options) {
2067
2231
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiMemberFiles, this.client.toTransportInput(OP_ZaloAdsGetApiMemberFiles, request), options);
2068
2232
  }
2069
- getApiNotifiesHeader(request, options) {
2233
+ getApiNotifiesHeader(request = {}, options) {
2070
2234
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiNotifiesHeader, this.client.toTransportInput(OP_ZaloAdsGetApiNotifiesHeader, request), options);
2071
2235
  }
2072
2236
  getApiPaymentTransactionHistory(request, options) {
@@ -2075,7 +2239,7 @@ var ZaloAdsService = class {
2075
2239
  getApiPlaceGetalldistricts(request = {}, options) {
2076
2240
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiPlaceGetalldistricts, this.client.toTransportInput(OP_ZaloAdsGetApiPlaceGetalldistricts, request), options);
2077
2241
  }
2078
- getApiSpellCheckV2(request, options) {
2242
+ getApiSpellCheckV2(request = {}, options) {
2079
2243
  return this.client.requestWithoutBody(OP_ZaloAdsGetApiSpellCheckV2, this.client.toTransportInput(OP_ZaloAdsGetApiSpellCheckV2, request), options);
2080
2244
  }
2081
2245
  getApiWhoami(request = {}, options) {
@@ -2084,22 +2248,27 @@ var ZaloAdsService = class {
2084
2248
  getReportapiV2Ads(request, options) {
2085
2249
  return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Ads, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Ads, request), options);
2086
2250
  }
2087
- getReportapiV2Campaigns(request, options) {
2251
+ getReportapiV2Campaigns(request = {}, options) {
2088
2252
  return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2Campaigns, request), options);
2089
2253
  }
2090
- getReportapiV2UniqueUser(request, options) {
2254
+ getReportapiV2UniqueUser(request = {}, options) {
2091
2255
  return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV2UniqueUser, this.client.toTransportInput(OP_ZaloAdsGetReportapiV2UniqueUser, request), options);
2092
2256
  }
2093
2257
  getReportapiV3Campaigns(request, options) {
2094
- return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, request), options);
2258
+ const normalized = {
2259
+ filter: "[]",
2260
+ agencyId: 0,
2261
+ ...request
2262
+ };
2263
+ return this.client.requestWithoutBody(OP_ZaloAdsGetReportapiV3Campaigns, this.client.toTransportInput(OP_ZaloAdsGetReportapiV3Campaigns, normalized), options);
2095
2264
  }
2096
- getZaapiCampaignReportcampaign(request, options) {
2265
+ getZaapiCampaignReportcampaign(request = {}, options) {
2097
2266
  return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCampaignReportcampaign, this.client.toTransportInput(OP_ZaloAdsGetZaapiCampaignReportcampaign, request), options);
2098
2267
  }
2099
- getZaapiCheckcamphasmanyads(request, options) {
2268
+ getZaapiCheckcamphasmanyads(request = {}, options) {
2100
2269
  return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiCheckcamphasmanyads, this.client.toTransportInput(OP_ZaloAdsGetZaapiCheckcamphasmanyads, request), options);
2101
2270
  }
2102
- getZaapiGetadsfromcampaignid(request, options) {
2271
+ getZaapiGetadsfromcampaignid(request = {}, options) {
2103
2272
  return this.client.requestWithoutBody(OP_ZaloAdsGetZaapiGetadsfromcampaignid, this.client.toTransportInput(OP_ZaloAdsGetZaapiGetadsfromcampaignid, request), options);
2104
2273
  }
2105
2274
  getZaapiGetallpages(request = {}, options) {
@@ -2135,7 +2304,7 @@ var ZaloAdsService = class {
2135
2304
  postApiMemberUploadImage(request, options) {
2136
2305
  return this.client.requestMultipart(OP_ZaloAdsPostApiMemberUploadImage, this.client.toTransportInput(OP_ZaloAdsPostApiMemberUploadImage, request), options);
2137
2306
  }
2138
- postZaapiDeletead(request, options) {
2307
+ postZaapiDeletead(request = {}, options) {
2139
2308
  return this.client.requestWithoutBody(OP_ZaloAdsPostZaapiDeletead, this.client.toTransportInput(OP_ZaloAdsPostZaapiDeletead, request), options);
2140
2309
  }
2141
2310
  renameCampaign(request, options) {
@@ -2144,6 +2313,10 @@ var ZaloAdsService = class {
2144
2313
  updateEcommerceAd(request, options) {
2145
2314
  return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateEcommerceAd, this.client.toTransportInput(OP_ZaloAdsUpdateEcommerceAd, request), options);
2146
2315
  }
2316
+ /** Alias theo tên tool chuẩn `zalo_ads_update_commerce_ad` trong Project Schema Zalo ADS (`Type = 23`, gắn `MiniPageId`). */
2317
+ updateCommerceAd(request, options) {
2318
+ return this.updateEcommerceAd(request, options);
2319
+ }
2147
2320
  updateFormAd(request, options) {
2148
2321
  return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateFormAd, this.client.toTransportInput(OP_ZaloAdsUpdateFormAd, request), options);
2149
2322
  }
@@ -2151,14 +2324,22 @@ var ZaloAdsService = class {
2151
2324
  return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateMessageAd, this.client.toTransportInput(OP_ZaloAdsUpdateMessageAd, request), options);
2152
2325
  }
2153
2326
  updateNewAds(request, options) {
2154
- return this.client.requestWithoutBody(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
2327
+ return this.client.requestMultipart(OP_ZaloAdsUpdateNewAds, this.client.toTransportInput(OP_ZaloAdsUpdateNewAds, request), options);
2155
2328
  }
2156
2329
  updateOfficialAccountAd(request, options) {
2157
2330
  return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdateOfficialAccountAd, this.client.toTransportInput(OP_ZaloAdsUpdateOfficialAccountAd, request), options);
2158
2331
  }
2332
+ /** Alias theo tên tool chuẩn `zalo_ads_update_oa_ad` trong Project Schema Zalo ADS (`Type = 2`, `Action = 6`). */
2333
+ updateOaAd(request, options) {
2334
+ return this.updateOfficialAccountAd(request, options);
2335
+ }
2159
2336
  updatePostAd(request, options) {
2160
2337
  return this.client.requestFormUrlEncoded(OP_ZaloAdsUpdatePostAd, this.client.toTransportInput(OP_ZaloAdsUpdatePostAd, request), options);
2161
2338
  }
2339
+ /** Alias theo tên tool chuẩn `zalo_ads_update_article_ad` trong Project Schema Zalo ADS (`Type = 3`, gắn `ZaloFeedId`). */
2340
+ updateArticleAd(request, options) {
2341
+ return this.updatePostAd(request, options);
2342
+ }
2162
2343
  uploadCustomAudiencePhoneList(request, options) {
2163
2344
  return this.client.requestMultipart(OP_ZaloAdsUploadCustomAudiencePhoneList, this.client.toTransportInput(OP_ZaloAdsUploadCustomAudiencePhoneList, request), options);
2164
2345
  }
@@ -2192,6 +2373,10 @@ var ZaloChatWidgetService = class {
2192
2373
  getChatWidgetLoginConfig(request, options) {
2193
2374
  return this.client.requestWithoutBody(OP_ZaloChatWidgetGetChatWidgetLoginConfig, this.client.toTransportInput(OP_ZaloChatWidgetGetChatWidgetLoginConfig, request), options);
2194
2375
  }
2376
+ /** Alias theo tên tool chuẩn `zalo_chat_widget_get_login_config` trong Project Schema Zalo ADS. */
2377
+ getLoginConfig(request, options) {
2378
+ return this.getChatWidgetLoginConfig(request, options);
2379
+ }
2195
2380
  };
2196
2381
 
2197
2382
  // src/services/forms.service.ts
@@ -2574,6 +2759,26 @@ var OP_ZaloInstantPagesListOfficialAccounts = {
2574
2759
  "cookieFields": [],
2575
2760
  "bodyFields": []
2576
2761
  };
2762
+ var OP_ZaloInstantPagesUpsertInstantPageForm = {
2763
+ "operationId": "ZaloInstantPages_upsertInstantPageForm",
2764
+ "method": "PUT",
2765
+ "endpoint": "/api/instant-pages/{instantPageId}/form",
2766
+ "baseUrl": "https://page.ads.zalo.me",
2767
+ "binaryFields": [],
2768
+ "pathFields": [
2769
+ "instantPageId"
2770
+ ],
2771
+ "queryFields": [],
2772
+ "headerFields": [],
2773
+ "cookieFields": [],
2774
+ "bodyFields": [
2775
+ "oaId",
2776
+ "formName",
2777
+ "questions",
2778
+ "useCustomConsent",
2779
+ "consentConfig"
2780
+ ]
2781
+ };
2577
2782
  var ZaloInstantPagesService = class {
2578
2783
  constructor(client) {
2579
2784
  this.client = client;
@@ -2614,6 +2819,126 @@ var ZaloInstantPagesService = class {
2614
2819
  listOfficialAccounts(request = {}, options) {
2615
2820
  return this.client.requestWithoutBody(OP_ZaloInstantPagesListOfficialAccounts, this.client.toTransportInput(OP_ZaloInstantPagesListOfficialAccounts, request), options);
2616
2821
  }
2822
+ upsertInstantPageForm(request, options) {
2823
+ return this.client.requestJson(OP_ZaloInstantPagesUpsertInstantPageForm, this.client.toTransportInput(OP_ZaloInstantPagesUpsertInstantPageForm, request), options);
2824
+ }
2825
+ };
2826
+
2827
+ // src/services/profile-ads.service.ts
2828
+ var OP_ZaloProfileAdsCreateOaPage = {
2829
+ "operationId": "ZaloProfileAds_createOaPage",
2830
+ "method": "POST",
2831
+ "endpoint": "/oa",
2832
+ "baseUrl": "https://profile.ads.zalo.me",
2833
+ "binaryFields": [],
2834
+ "pathFields": [],
2835
+ "queryFields": [
2836
+ "option",
2837
+ "crsf-token"
2838
+ ],
2839
+ "headerFields": [],
2840
+ "cookieFields": [],
2841
+ "bodyFields": [
2842
+ "typeId",
2843
+ "tier",
2844
+ "typeName",
2845
+ "categoryId",
2846
+ "subCategoryId",
2847
+ "oaName",
2848
+ "description",
2849
+ "contactName",
2850
+ "contactPhone",
2851
+ "coverId",
2852
+ "avatarId",
2853
+ "province",
2854
+ "district",
2855
+ "address",
2856
+ "agreeTerm"
2857
+ ]
2858
+ };
2859
+ var OP_ZaloProfileAdsUploadOaAvatar = {
2860
+ "operationId": "ZaloProfileAds_uploadOaAvatar",
2861
+ "method": "POST",
2862
+ "endpoint": "/ajax/avatar/upload",
2863
+ "baseUrl": "https://profile.ads.zalo.me",
2864
+ "binaryFields": [
2865
+ "avatar-file"
2866
+ ],
2867
+ "pathFields": [],
2868
+ "queryFields": [
2869
+ "option"
2870
+ ],
2871
+ "headerFields": [],
2872
+ "cookieFields": [],
2873
+ "bodyFields": [
2874
+ "avatar-file",
2875
+ "is-new"
2876
+ ]
2877
+ };
2878
+ var OP_ZaloProfileAdsUploadOaCover = {
2879
+ "operationId": "ZaloProfileAds_uploadOaCover",
2880
+ "method": "POST",
2881
+ "endpoint": "/ajax/cover/upload",
2882
+ "baseUrl": "https://profile.ads.zalo.me",
2883
+ "binaryFields": [
2884
+ "cover-file"
2885
+ ],
2886
+ "pathFields": [],
2887
+ "queryFields": [
2888
+ "option"
2889
+ ],
2890
+ "headerFields": [],
2891
+ "cookieFields": [],
2892
+ "bodyFields": [
2893
+ "cover-file",
2894
+ "is-new"
2895
+ ]
2896
+ };
2897
+ var ZaloProfileAdsService = class {
2898
+ constructor(client) {
2899
+ this.client = client;
2900
+ }
2901
+ async createOaPage(request, options) {
2902
+ let csrfToken = request["crsf-token"];
2903
+ if (!csrfToken && this.client.authManager) {
2904
+ const session = await this.client.authManager.getSession("profile.ads.zalo.me");
2905
+ csrfToken = session.cookies["CSRF_TOKEN"] ?? session.xsrfToken;
2906
+ }
2907
+ const normalizedRequest = {
2908
+ option: "createpage",
2909
+ ...request,
2910
+ ...csrfToken ? { "crsf-token": csrfToken } : {}
2911
+ };
2912
+ return this.client.requestFormUrlEncoded(
2913
+ OP_ZaloProfileAdsCreateOaPage,
2914
+ this.client.toTransportInput(OP_ZaloProfileAdsCreateOaPage, normalizedRequest),
2915
+ options
2916
+ );
2917
+ }
2918
+ uploadOaAvatar(request, options) {
2919
+ const normalizedRequest = {
2920
+ option: "update",
2921
+ "is-new": "true",
2922
+ ...request
2923
+ };
2924
+ return this.client.requestMultipart(
2925
+ OP_ZaloProfileAdsUploadOaAvatar,
2926
+ this.client.toTransportInput(OP_ZaloProfileAdsUploadOaAvatar, normalizedRequest),
2927
+ options
2928
+ );
2929
+ }
2930
+ uploadOaCover(request, options) {
2931
+ const normalizedRequest = {
2932
+ option: "update",
2933
+ "is-new": "true",
2934
+ ...request
2935
+ };
2936
+ return this.client.requestMultipart(
2937
+ OP_ZaloProfileAdsUploadOaCover,
2938
+ this.client.toTransportInput(OP_ZaloProfileAdsUploadOaCover, normalizedRequest),
2939
+ options
2940
+ );
2941
+ }
2617
2942
  };
2618
2943
 
2619
2944
  // src/services/widget.service.ts
@@ -2693,6 +3018,8 @@ var ZaloAdsSdk = class {
2693
3018
  ads;
2694
3019
  forms;
2695
3020
  instantPages;
3021
+ profileAds;
3022
+ profile;
2696
3023
  widget;
2697
3024
  chatWidget;
2698
3025
  constructor(options = {}) {
@@ -2701,6 +3028,8 @@ var ZaloAdsSdk = class {
2701
3028
  this.ads = new ZaloAdsService(this.client);
2702
3029
  this.forms = new ZaloFormsService(this.client);
2703
3030
  this.instantPages = new ZaloInstantPagesService(this.client);
3031
+ this.profileAds = new ZaloProfileAdsService(this.client);
3032
+ this.profile = this.profileAds;
2704
3033
  this.widget = new ZaloWidgetApiService(this.client);
2705
3034
  this.chatWidget = new ZaloChatWidgetService(this.client);
2706
3035
  }
@@ -2927,21 +3256,25 @@ var ZaloAdsFlowChildMessageDto = class {
2927
3256
  text;
2928
3257
  };
2929
3258
  var ZaloAdsFlowButtonDto = class {
2930
- /** 3: mở nhánh tin nhắn; 12: gọi hotline. */
3259
+ /** 3 = Gửi tin nhắn vào nhánh hội thoại; 10 = Mở website; 12 = Thực hiện cuộc gọi. */
2931
3260
  type;
2932
3261
  /** Nhãn nút hiển thị cho người dùng. */
2933
3262
  text;
3263
+ /** URL website; bắt buộc với type 10. */
3264
+ url;
3265
+ /** Cờ của nút website; dùng true với type 10. */
3266
+ editable;
2934
3267
  /** Số hotline, bắt buộc khi type là 12. */
2935
3268
  phone;
2936
- /** Nhánh tin nhắn, bắt buộc khi type là 3. */
3269
+ /** Nhánh tin nhắn, bắt buộc khi type là 3. Với type 10 hoặc 12, để null hoặc bỏ qua. */
2937
3270
  messages;
2938
3271
  };
2939
3272
  var ZaloAdsFlowMessageDto = class {
2940
- /** Mẫu đã xác minh dùng 1 cho tin nhắn văn bản chính. */
3273
+ /** 1 = Tin nhắn văn bản; 2 = Tin nhắn kèm hình ảnh. */
2941
3274
  type;
2942
- /** Nội dung tin nhắn; có thể dùng biến {{user_name}}. */
3275
+ /** Nội dung tin nhắn, tối đa 1961 ký tự. Hỗ trợ biến: {{user_name}}, {{page_name}}, {{user_gender}}, {{user_id}}, {{page_id}}, {{date}}, {{datetime}}. */
2943
3276
  text;
2944
- /** URL media hoặc null với tin nhắn văn bản thuần. */
3277
+ /** URL media hoặc null với tin nhắn văn bản thuần. Bắt buộc và không được null khi type = 2. */
2945
3278
  url;
2946
3279
  /** Các nút đi kèm tin nhắn. */
2947
3280
  buttons;
@@ -3043,6 +3376,7 @@ export {
3043
3376
  ZaloChatWidgetService,
3044
3377
  ZaloFormsService,
3045
3378
  ZaloInstantPagesService,
3379
+ ZaloProfileAdsService,
3046
3380
  ZaloSdkError,
3047
3381
  ZaloSdkHttpClient,
3048
3382
  ZaloWidgetApiService,