@adkit/cli 1.12.26 → 1.12.28
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/cli.js +23 -10
- 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
|
|
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,23 @@ 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
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
url
|
|
3004
|
-
}
|
|
3001
|
+
if (!hasCreativeFlag && !isSparkAd) return void 0;
|
|
3002
|
+
const creative = {};
|
|
3003
|
+
if (isSparkAd) {
|
|
3004
|
+
if (typeof flags.url === "string" && flags.url.trim()) creative.url = flags.url.trim();
|
|
3005
|
+
} else {
|
|
3006
|
+
creative.url = requireFlag(flags, "url", "Provide the destination URL for the ad");
|
|
3007
|
+
}
|
|
3008
|
+
if (isSparkAd) {
|
|
3009
|
+
if (typeof flags["ad-text"] === "string") creative.adText = flags["ad-text"];
|
|
3010
|
+
} else {
|
|
3011
|
+
const mediaId = requireFlag(flags, "media-id", "Run: adkit manage tiktok ads create --media-id <uploaded-video-id>");
|
|
3012
|
+
creative.adText = requireFlag(flags, "ad-text", "Provide the TikTok ad text");
|
|
3013
|
+
creative.media = [{ id: mediaId, role: "video" }];
|
|
3014
|
+
}
|
|
3005
3015
|
if (typeof flags.cta === "string") creative.cta = flags.cta;
|
|
3006
3016
|
if (typeof flags["display-name"] === "string") creative.displayName = flags["display-name"];
|
|
3007
3017
|
if (typeof flags["identity-id"] === "string") creative.identityId = flags["identity-id"];
|
|
@@ -3017,6 +3027,7 @@ function buildTikTokAdPayload(flags, mode) {
|
|
|
3017
3027
|
if (typeof flags.name === "string") payload.name = flags.name;
|
|
3018
3028
|
if (typeof flags.status === "string") payload.status = flags.status;
|
|
3019
3029
|
payload.adType = "video";
|
|
3030
|
+
if (typeof flags["existing-post-id"] === "string") payload.existingPostId = flags["existing-post-id"];
|
|
3020
3031
|
const creative = buildTikTokAdCreative(flags);
|
|
3021
3032
|
if (creative) payload.creative = creative;
|
|
3022
3033
|
if (platformOverrides) payload.platformOverrides = platformOverrides;
|
|
@@ -5607,14 +5618,16 @@ ${FLAG.data}
|
|
|
5607
5618
|
--name <name> Ad name
|
|
5608
5619
|
--status <s> active, paused
|
|
5609
5620
|
--media-id <id> TikTok video ID from tiktok media upload
|
|
5621
|
+
--existing-post-id <id> Spark Ad: promote an existing organic post instead of an uploaded video (needs a BC_AUTH_TT identity)
|
|
5610
5622
|
--ad-text <text> Ad text
|
|
5611
|
-
--url <url> Destination URL
|
|
5623
|
+
--url <url> Destination URL (required with --media-id; optional with --existing-post-id)
|
|
5612
5624
|
--cta <type> learn_more, shop_now, sign_up, download, contact_us, apply_now, book_now
|
|
5613
5625
|
--identity-id <id> TikTok profile/identity ID (falls back to account default)
|
|
5614
5626
|
--identity-type <t> TikTok identity type
|
|
5615
5627
|
|
|
5616
5628
|
Examples:
|
|
5617
5629
|
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
|
|
5630
|
+
adkit manage tiktok ads create --ad-group 1770 --name "Spark Ad" --existing-post-id 7412
|
|
5618
5631
|
adkit manage tiktok ads update 1770000000000000000 --status paused --publish`.trim(),
|
|
5619
5632
|
"tiktok results": `adkit manage tiktok results \u2014 TikTok performance reporting
|
|
5620
5633
|
|
package/package.json
CHANGED