@adkit/cli 1.12.26 → 1.12.27

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.
Files changed (2) hide show
  1. package/dist/cli.js +16 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2827,7 +2827,7 @@ var AD_GROUP_LIST_FLAGS2 = ["campaign-ids", "fields", "limit", "offset"];
2827
2827
  var AD_GROUP_CREATE_FLAGS = ["campaign", "name", "status", "budget-daily", "budget-lifetime", "billing-event", "bid-strategy", "optimization", "start-date", "end-date", "pacing", "bid-amount", "event-type", "pixel", "placement", PLATFORM_OVERRIDE_FLAG];
2828
2828
  var AD_GROUP_UPDATE_FLAGS = ["name", "status", "budget-daily", "budget-lifetime", "billing-event", "optimization", "start-date", "end-date", "pacing", "bid-amount", "event-type", "pixel", PLATFORM_OVERRIDE_FLAG];
2829
2829
  var AD_LIST_FLAGS2 = ["ad-group-ids", "campaign-ids", "fields", "limit", "offset"];
2830
- var AD_CREATE_FLAGS = ["ad-group", "name", "status", "media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
2830
+ var AD_CREATE_FLAGS = ["ad-group", "name", "status", "media-id", "existing-post-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
2831
2831
  var AD_UPDATE_FLAGS = ["ad-group", "name", "status", "media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel", PLATFORM_OVERRIDE_FLAG];
2832
2832
  var RESULTS_FLAGS = ["level", "fields", "breakdowns", "from", "to", "sort", "sort-direction", "limit", "offset"];
2833
2833
  function readSingleFlagValue2(flags, key, duplicateHint) {
@@ -2941,7 +2941,8 @@ function buildTikTokBudget(flags) {
2941
2941
  function readTikTokPlacementFlag(flags) {
2942
2942
  const value = readSingleFlagValue2(flags, "placement", "Use comma-separated TikTok placement IDs, or switch to --data for full targeting");
2943
2943
  if (value === void 0) return void 0;
2944
- const placements = value.split(",").map((entry) => entry.trim()).filter(Boolean);
2944
+ const rawParts = value.split(",");
2945
+ const placements = rawParts.map((entry) => entry.trim()).filter(Boolean);
2945
2946
  if (placements.length === 0) throw new CliError("INVALID_VALUE", "--placement must contain at least one placement ID", "Example: --placement PLACEMENT_TIKTOK");
2946
2947
  return placements;
2947
2948
  }
@@ -2994,14 +2995,20 @@ function buildTikTokAdGroupPayload(flags, mode) {
2994
2995
  return payload;
2995
2996
  }
2996
2997
  function buildTikTokAdCreative(flags) {
2998
+ const isSparkAd = typeof flags["existing-post-id"] === "string";
2999
+ if (isSparkAd && flags["media-id"] !== void 0) throw new CliError("INVALID_VALUE", "Use --existing-post-id or --media-id, not both", "Spark Ads promote an existing post; drop --media-id, or drop --existing-post-id to upload a video");
2997
3000
  const hasCreativeFlag = ["media-id", "ad-text", "url", "cta", "display-name", "identity-id", "identity-type", "tracking-pixel"].some((key) => flags[key] !== void 0);
2998
- if (!hasCreativeFlag) return void 0;
2999
- const mediaId = requireFlag(flags, "media-id", "Run: adkit manage tiktok ads create --media-id <uploaded-video-id>");
3001
+ if (!hasCreativeFlag && !isSparkAd) return void 0;
3000
3002
  const creative = {
3001
- adText: requireFlag(flags, "ad-text", "Provide the TikTok ad text"),
3002
- media: [{ id: mediaId, role: "video" }],
3003
3003
  url: requireFlag(flags, "url", "Provide the destination URL for the ad")
3004
3004
  };
3005
+ if (isSparkAd) {
3006
+ if (typeof flags["ad-text"] === "string") creative.adText = flags["ad-text"];
3007
+ } else {
3008
+ const mediaId = requireFlag(flags, "media-id", "Run: adkit manage tiktok ads create --media-id <uploaded-video-id>");
3009
+ creative.adText = requireFlag(flags, "ad-text", "Provide the TikTok ad text");
3010
+ creative.media = [{ id: mediaId, role: "video" }];
3011
+ }
3005
3012
  if (typeof flags.cta === "string") creative.cta = flags.cta;
3006
3013
  if (typeof flags["display-name"] === "string") creative.displayName = flags["display-name"];
3007
3014
  if (typeof flags["identity-id"] === "string") creative.identityId = flags["identity-id"];
@@ -3017,6 +3024,7 @@ function buildTikTokAdPayload(flags, mode) {
3017
3024
  if (typeof flags.name === "string") payload.name = flags.name;
3018
3025
  if (typeof flags.status === "string") payload.status = flags.status;
3019
3026
  payload.adType = "video";
3027
+ if (typeof flags["existing-post-id"] === "string") payload.existingPostId = flags["existing-post-id"];
3020
3028
  const creative = buildTikTokAdCreative(flags);
3021
3029
  if (creative) payload.creative = creative;
3022
3030
  if (platformOverrides) payload.platformOverrides = platformOverrides;
@@ -5607,6 +5615,7 @@ ${FLAG.data}
5607
5615
  --name <name> Ad name
5608
5616
  --status <s> active, paused
5609
5617
  --media-id <id> TikTok video ID from tiktok media upload
5618
+ --existing-post-id <id> Spark Ad: promote an existing organic post instead of an uploaded video (needs a BC_AUTH_TT identity)
5610
5619
  --ad-text <text> Ad text
5611
5620
  --url <url> Destination URL
5612
5621
  --cta <type> learn_more, shop_now, sign_up, download, contact_us, apply_now, book_now
@@ -5615,6 +5624,7 @@ ${FLAG.data}
5615
5624
 
5616
5625
  Examples:
5617
5626
  adkit manage tiktok ads create --ad-group 1770 --name "Hero video" --media-id v123 --ad-text "Try it today" --url https://example.com --cta learn_more
5627
+ adkit manage tiktok ads create --ad-group 1770 --name "Spark Ad" --existing-post-id 7412 --url https://example.com --cta learn_more
5618
5628
  adkit manage tiktok ads update 1770000000000000000 --status paused --publish`.trim(),
5619
5629
  "tiktok results": `adkit manage tiktok results \u2014 TikTok performance reporting
5620
5630
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adkit/cli",
3
- "version": "1.12.26",
3
+ "version": "1.12.27",
4
4
  "description": "The Ads CLI for AI agents — manage Meta & Google ad campaigns, browse the ad library, and generate creatives from your terminal.",
5
5
  "keywords": [
6
6
  "ads cli",