@koda-sl/baker-cli 0.139.0 → 0.139.1

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/README.md CHANGED
@@ -672,6 +672,7 @@ baker ads meta campaigns create --account-id act_123 --name "Q3 Prospecting" -
672
672
  baker ads meta adsets create --account-id act_123 --campaign meta_temp_camp --name "US 25-54" \
673
673
  --optimization-goal OFFSITE_CONVERSIONS --billing-event IMPRESSIONS --pixel-id 111 --custom-event-type LEAD \
674
674
  --targeting-file targeting.json # → meta_temp_as
675
+ # lead-form goals (LEAD_GENERATION / QUALITY_LEAD) and PAGE_LIKES require --page-id (the Facebook Page), else Meta rejects the ad set
675
676
  baker ads meta creatives create --account-id act_123 --page 555 --instagram-user 777 \
676
677
  --message "Save money on pet insurance" --link https://example.com --headline "Best cover" \
677
678
  --image-ref meta_temp_img --cta SHOP_NOW --standard-enhancements on # → meta_temp_cr
package/dist/cli.js CHANGED
@@ -11365,6 +11365,11 @@ var OPTIMIZATION_GOALS = [
11365
11365
  "CONVERSATIONS",
11366
11366
  "DERIVED_EVENTS"
11367
11367
  ];
11368
+ var OPTIMIZATION_GOALS_REQUIRING_PAGE = [
11369
+ "LEAD_GENERATION",
11370
+ "QUALITY_LEAD",
11371
+ "PAGE_LIKES"
11372
+ ];
11368
11373
  var DESTINATION_TYPES = [
11369
11374
  "WEBSITE",
11370
11375
  "APP",
@@ -11582,8 +11587,18 @@ function validateAdSetBudgetAndBid(p, ctx) {
11582
11587
  ctx.addIssue({ code: "custom", path: ["end_time"], message: "end_time must be after start_time" });
11583
11588
  }
11584
11589
  }
11590
+ function validateAdSetPromotedObject(p, ctx) {
11591
+ if (p.optimization_goal && OPTIMIZATION_GOALS_REQUIRING_PAGE.includes(p.optimization_goal) && !p.promoted_object?.page_id) {
11592
+ ctx.addIssue({
11593
+ code: "custom",
11594
+ path: ["promoted_object", "page_id"],
11595
+ message: `optimization_goal ${p.optimization_goal} needs promoted_object.page_id \u2014 pass --page-id with the Facebook Page the leads/likes belong to`
11596
+ });
11597
+ }
11598
+ }
11585
11599
  var adSetCreateSchema = z14.object(adSetFields).superRefine((p, ctx) => {
11586
11600
  validateAdSetBudgetAndBid(p, ctx);
11601
+ validateAdSetPromotedObject(p, ctx);
11587
11602
  });
11588
11603
  var adSetUpdateSchema = z14.object({
11589
11604
  name: adSetFields.name.optional(),
@@ -11604,6 +11619,9 @@ var adSetUpdateSchema = z14.object({
11604
11619
  ctx.addIssue({ code: "custom", message: "update needs at least one field" });
11605
11620
  }
11606
11621
  validateAdSetBudgetAndBid(p, ctx);
11622
+ if (p.optimization_goal) {
11623
+ validateAdSetPromotedObject(p, ctx);
11624
+ }
11607
11625
  });
11608
11626
  var messageSchema = z14.string().min(1).max(META_LIMITS.creative.messageHardMax);
11609
11627
  var headlineSchema2 = z14.string().min(1).max(META_LIMITS.creative.headlineMax);
@@ -12191,7 +12209,10 @@ var adSetWriteArgs = {
12191
12209
  end: { type: "string", description: "End time" },
12192
12210
  "targeting-file": { type: "string", description: "JSON file with the full Meta targeting spec" },
12193
12211
  "promoted-object-file": { type: "string", description: "JSON file with the promoted_object" },
12194
- "page-id": { type: "string", description: "promoted_object.page_id shortcut" },
12212
+ "page-id": {
12213
+ type: "string",
12214
+ description: "promoted_object.page_id shortcut (required for LEAD_GENERATION / QUALITY_LEAD / PAGE_LIKES goals)"
12215
+ },
12195
12216
  "pixel-id": { type: "string", description: "promoted_object.pixel_id shortcut" },
12196
12217
  "custom-event-type": { type: "string", description: "promoted_object.custom_event_type (PURCHASE|LEAD|\u2026)" },
12197
12218
  file: { type: "string", description: "JSON file with the full payload; flags override" }
@@ -12201,6 +12222,7 @@ var adSetsCreateCommand = defineCommand54({
12201
12222
  name: "create",
12202
12223
  description: `Stage a new ad set. ${STAGED_NOTE2}
12203
12224
  Chain to a campaign with --campaign (real id or meta_temp_* ref).
12225
+ Lead-form goals (LEAD_GENERATION, QUALITY_LEAD) and PAGE_LIKES need --page-id (the Facebook Page the leads/likes belong to).
12204
12226
  Example: baker ads meta adsets create --campaign meta_temp_ab12 --name "US 25-54" --optimization-goal LINK_CLICKS --billing-event IMPRESSIONS --daily-budget 50 --targeting-file t.json`
12205
12227
  },
12206
12228
  args: { campaign: { type: "string", description: "Parent campaign id or meta_temp_* ref" }, ...adSetWriteArgs },
@@ -12214,6 +12236,7 @@ var adSetsUpdateCommand = defineCommand54({
12214
12236
  meta: {
12215
12237
  name: "update",
12216
12238
  description: `Stage changes to an ad set. ${STAGED_NOTE2}
12239
+ Switching --optimization-goal to a lead-form goal (LEAD_GENERATION, QUALITY_LEAD) or PAGE_LIKES needs --page-id in the same change.
12217
12240
  Example: baker ads meta adsets update 6123 --daily-budget 80`
12218
12241
  },
12219
12242
  args: { id: { type: "positional", description: "Ad set id or meta_temp_* ref", required: true }, ...adSetWriteArgs },