@koda-sl/baker-cli 0.393.0-dev.10b6da011 → 0.394.0-dev.d28cef496

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
@@ -876,7 +876,7 @@ Read the company's ChatGPT Ads account (OpenAI's ads inside ChatGPT conversation
876
876
  | `conversions` | Pixels (with the pixel id a landing page installs) and conversions, with the campaigns using each |
877
877
  | `insights` | Impressions, clicks, spend, CTR, CPC, CPM, conversions, CPA, ROAS — per `--level account\|campaign\|ad_group\|ad`, over `--days N` or `--since/--until`, `--granularity`, `--segment country\|device\|platform\|product` |
878
878
  | `campaigns create\|update\|pause\|resume\|archive` | Stage a campaign change: objective, daily or lifetime budget (currency units), schedule, countries and regions included and excluded, audiences, platforms, tracking template, status, the conversions it measures (`--conversion-event-ids`), a catalog (`--catalog-id`) |
879
- | `ad-groups create\|update\|pause\|resume\|archive` | Stage an ad group change: context hints, bid strategy, max bid, tracking template, product filters, status |
879
+ | `ad-groups create\|update\|pause\|resume\|archive` | Stage an ad group change: context hints, bid strategy, max bid, audience bid adjustments, tracking template, product filters, status |
880
880
  | `ads create\|update\|pause\|resume\|archive` | Stage a chat card: title, body, landing page, image and its crop, tracking template, status |
881
881
  | `ads create-product` | Stage a catalog ad group's product ad: a title template the catalog's products fill in |
882
882
  | `pixels create` | Stage a new website pixel |
package/dist/cli.js CHANGED
@@ -33531,6 +33531,21 @@ var campaignUpdateSchema4 = z31.strictObject({
33531
33531
  checkRunWindow2(p.startTime, p.endTime, ctx);
33532
33532
  checkTargeting(p, ctx);
33533
33533
  });
33534
+ var audienceBidMultipliersSchema = z31.array(
33535
+ z31.strictObject({
33536
+ audienceId: audienceIdSchema,
33537
+ multiplierMicros: z31.number().int().min(1e5, "a bid adjustment is 0.1\xD7 to 10\xD7 \u2014 100000 to 10000000 micros").max(1e7, "a bid adjustment is 0.1\xD7 to 10\xD7 \u2014 100000 to 10000000 micros")
33538
+ })
33539
+ ).max(100);
33540
+ function checkMultipliers(strategy, multipliers, ctx) {
33541
+ if (strategy !== void 0 && strategy !== "fixed_bid" && (multipliers?.length ?? 0) > 0) {
33542
+ ctx.addIssue({
33543
+ code: "custom",
33544
+ path: ["audienceBidMultipliers"],
33545
+ message: "an audience bid adjustment changes a fixed bid \u2014 Maximize Results sets the bid itself"
33546
+ });
33547
+ }
33548
+ }
33534
33549
  function checkBidPair2(strategy, maxBid, ctx) {
33535
33550
  if (strategy === "fixed_bid" && maxBid === void 0) {
33536
33551
  ctx.addIssue({ code: "custom", path: ["maxBidMicros"], message: "a fixed bid needs its amount" });
@@ -33558,8 +33573,12 @@ var adGroupCreateSchema2 = z31.strictObject({
33558
33573
  /** Only under a catalog campaign; which of its products this ad group may show. */
33559
33574
  productSet: productSetSchema.optional(),
33560
33575
  /** The campaign's catalog, filled in at stage time — the product set must name it. */
33561
- productFeedId: z31.string().trim().min(1).optional()
33562
- }).superRefine((p, ctx) => checkBidPair2(p.bidStrategy, p.maxBidMicros, ctx));
33576
+ productFeedId: z31.string().trim().min(1).optional(),
33577
+ audienceBidMultipliers: audienceBidMultipliersSchema.optional()
33578
+ }).superRefine((p, ctx) => {
33579
+ checkBidPair2(p.bidStrategy, p.maxBidMicros, ctx);
33580
+ checkMultipliers(p.bidStrategy, p.audienceBidMultipliers, ctx);
33581
+ });
33563
33582
  var adGroupUpdateSchema2 = z31.strictObject({
33564
33583
  name: nameSchema3.optional(),
33565
33584
  description: z31.string().trim().max(CHATGPT_LIMITS.nameMax).optional(),
@@ -33571,9 +33590,12 @@ var adGroupUpdateSchema2 = z31.strictObject({
33571
33590
  billingEvent: z31.enum(CHATGPT_BILLING_EVENTS).optional(),
33572
33591
  /** Replaces the whole product set; `{ filters: [] }` shows the whole catalog. */
33573
33592
  productSet: productSetSchema.optional(),
33574
- productFeedId: z31.string().trim().min(1).optional()
33593
+ productFeedId: z31.string().trim().min(1).optional(),
33594
+ /** Replaces the ad group's adjustments; an empty list clears them. */
33595
+ audienceBidMultipliers: audienceBidMultipliersSchema.optional()
33575
33596
  }).superRefine((p, ctx) => {
33576
33597
  noEmptyUpdate(p, ctx);
33598
+ checkMultipliers(p.bidStrategy, p.audienceBidMultipliers, ctx);
33577
33599
  checkBidPair2(p.bidStrategy, p.maxBidMicros, ctx);
33578
33600
  });
33579
33601
  var titleSchema = z31.string().trim().refine(
@@ -34363,7 +34385,7 @@ var SHARED_ARGS = {
34363
34385
  description: { type: "string", description: "Internal description" },
34364
34386
  "context-hints": {
34365
34387
  type: "string",
34366
- description: "When the ad would be useful, short phrases separated by commas \u2014 or by | when a phrase has a comma. ChatGPT's counterpart to keywords. On update it replaces the whole list; none clears it"
34388
+ description: "When the ad would be useful, short phrases separated by commas \u2014 or by | when a phrase has a comma. ChatGPT's counterpart to keywords, written in the language of the campaign's countries, as people ask ChatGPT. On update it replaces the whole list; none clears it"
34367
34389
  },
34368
34390
  "bid-strategy": {
34369
34391
  type: "string",
@@ -34374,6 +34396,10 @@ var SHARED_ARGS = {
34374
34396
  type: "string",
34375
34397
  description: "Query string added to this ad group's landing pages, e.g. utm_content={ad_group_id} \u2014 none clears"
34376
34398
  },
34399
+ "audience-bids": {
34400
+ type: "string",
34401
+ description: "Raise or lower the fixed bid for people in an audience: audience=multiplier pairs, 0.1 to 10, e.g. caud_123=1.5,caud_456=0.8. Audiences of ~25,000 people only; not in the EEA or Switzerland. On update it replaces them; none clears"
34402
+ },
34377
34403
  "product-filters": {
34378
34404
  type: "string",
34379
34405
  description: "Catalog campaigns only: which products it shows \u2014 e.g. brand in Acme; price lte 5000 (preview with `catalogs products`). On update it replaces the set; none shows the whole catalog"
@@ -34399,6 +34425,22 @@ function contextHintsArg(value) {
34399
34425
  const separator = value.includes("|") ? "|" : ",";
34400
34426
  return value.split(separator).map((hint) => hint.trim()).filter(Boolean);
34401
34427
  }
34428
+ function audienceBidsArg(value) {
34429
+ if (typeof value !== "string" || value.trim() === "") {
34430
+ return void 0;
34431
+ }
34432
+ if (value.trim().toLowerCase() === "none") {
34433
+ return [];
34434
+ }
34435
+ return value.split(",").map((pair) => pair.trim()).filter(Boolean).map((pair) => {
34436
+ const [audienceId = "", multiplier = ""] = pair.split("=").map((part) => part.trim());
34437
+ const times = Number(multiplier.replace(",", "."));
34438
+ if (!audienceId || !Number.isFinite(times)) {
34439
+ failWriteValidation(`"${pair}" is not an audience bid \u2014 write audience=multiplier, e.g. caud_123=1.5`);
34440
+ }
34441
+ return { audienceId, multiplierMicros: Math.round(times * 1e6) };
34442
+ });
34443
+ }
34402
34444
  function productSetArg(value) {
34403
34445
  const filters = productFiltersArg(value);
34404
34446
  return filters === void 0 ? void 0 : { filters };
@@ -34412,6 +34454,7 @@ function sharedPayload(args8) {
34412
34454
  maxBidMicros: microsFromArg(args8["max-bid"], "--max-bid"),
34413
34455
  trackingTemplate: clearableArg(args8["tracking-template"]),
34414
34456
  productSet: productSetArg(args8["product-filters"]),
34457
+ audienceBidMultipliers: audienceBidsArg(args8["audience-bids"]),
34415
34458
  status: lowerArg(args8.status)
34416
34459
  };
34417
34460
  }