@koda-sl/baker-cli 0.179.0 → 0.180.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/README.md CHANGED
@@ -508,6 +508,10 @@ baker ads google campaigns create --customer-id 1234567890 --name "Brand — Sea
508
508
  # locations) or PRESENCE_OR_INTEREST (also people interested in them). Google applies
509
509
  # PRESENCE_OR_INTEREST when the flag is omitted, so pass PRESENCE for local/in-store/service-area
510
510
  # campaigns; --negative-geo-target-type does the same for excluded locations.
511
+ # --networks search|search-partners|display|partner-search (comma-separated) sets which networks
512
+ # the campaign serves on; every network not listed is turned OFF. A SEARCH campaign staged
513
+ # without --networks publishes on Google Search only — Google's own default would add Search
514
+ # partners and the Display network. Other channel types keep Google's behaviour.
511
515
  # Campaign URL options stage on create and update: --final-url-suffix (bare query params),
512
516
  # --tracking-template "https://tracker.example/?url={lpurl}" (must carry {lpurl}), and
513
517
  # --custom-param key=value (repeatable, up to 8; --clear-custom-params empties the set).
package/dist/cli.js CHANGED
@@ -5910,7 +5910,7 @@ var biddingConfigSchema = z15.object({
5910
5910
  ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
5911
5911
  }
5912
5912
  });
5913
- var networkSettingsSchema = z15.object({
5913
+ var networkSettingsSchema = z15.strictObject({
5914
5914
  targetGoogleSearch: z15.boolean().optional(),
5915
5915
  targetSearchNetwork: z15.boolean().optional(),
5916
5916
  targetContentNetwork: z15.boolean().optional(),
@@ -9755,6 +9755,56 @@ function geoTargetTypeFromFlags(args) {
9755
9755
  Object.entries({ positiveGeoTargetType, negativeGeoTargetType }).filter(([, v]) => v !== void 0)
9756
9756
  );
9757
9757
  }
9758
+ var NETWORK_SETTING_KEYS = [
9759
+ "targetGoogleSearch",
9760
+ "targetSearchNetwork",
9761
+ "targetContentNetwork",
9762
+ "targetPartnerSearchNetwork"
9763
+ ];
9764
+ var NETWORK_FLAG_VALUES = {
9765
+ search: "targetGoogleSearch",
9766
+ "search-partners": "targetSearchNetwork",
9767
+ partners: "targetSearchNetwork",
9768
+ display: "targetContentNetwork",
9769
+ "partner-search": "targetPartnerSearchNetwork"
9770
+ };
9771
+ var networksArg = {
9772
+ networks: {
9773
+ type: "string",
9774
+ description: `Networks to serve on, comma-separated: search | search-partners | display | partner-search. Every network you do not list is turned OFF, so state the whole set. Start here: --networks search \u2014 a new Search campaign left unset publishes on Google Search only, because Google's own default adds Search partners and the Display network, which spends the same budget on surfaces the advertiser did not pick. Sets the same "Networks" as the Google Ads UI.`
9775
+ }
9776
+ };
9777
+ function networkSettingsFromFlags(args) {
9778
+ const raw = args.networks;
9779
+ if (typeof raw !== "string") {
9780
+ return void 0;
9781
+ }
9782
+ const names = raw.split(",").map((n) => n.trim().toLowerCase()).filter((n) => n.length > 0);
9783
+ const allowed = Object.keys(NETWORK_FLAG_VALUES).join(" | ");
9784
+ if (names.length === 0) {
9785
+ failWriteValidation(`--networks needs at least one of ${allowed}`);
9786
+ }
9787
+ const settings = Object.fromEntries(NETWORK_SETTING_KEYS.map((k) => [k, false]));
9788
+ for (const name of names) {
9789
+ const key = NETWORK_FLAG_VALUES[name];
9790
+ if (!key) {
9791
+ failWriteValidation(`--networks must list only ${allowed}`);
9792
+ }
9793
+ settings[key] = true;
9794
+ }
9795
+ return settings;
9796
+ }
9797
+ function networksHints(payload) {
9798
+ if (payload.networkSettings !== void 0) {
9799
+ return [];
9800
+ }
9801
+ if (payload.channelType !== "SEARCH") {
9802
+ return [];
9803
+ }
9804
+ return [
9805
+ "No --networks set, so this campaign publishes on Google Search only \u2014 Search partners and the Display network are off. Re-stage with --networks search,search-partners (or add display) to widen it, and tell the user which networks this campaign serves on."
9806
+ ];
9807
+ }
9758
9808
  function geoTargetTypeHints(payload) {
9759
9809
  if (payload.geoTargetTypeSetting !== void 0) {
9760
9810
  return [];
@@ -9808,6 +9858,7 @@ var campaignsCommand = defineCommand30({
9808
9858
  ...finalUrlSuffixArg,
9809
9859
  ...urlOptionsArgs,
9810
9860
  ...geoTargetTypeArgs,
9861
+ ...networksArg,
9811
9862
  objective: { type: "string", description: "Advisory UI objective (SALES, LEADS, \u2026)" },
9812
9863
  "start-date": { type: "string", description: "YYYY-MM-DD" },
9813
9864
  "end-date": { type: "string", description: "YYYY-MM-DD" },
@@ -9826,6 +9877,7 @@ var campaignsCommand = defineCommand30({
9826
9877
  budget: args["budget-ref"],
9827
9878
  bidding: biddingFromFlags(args),
9828
9879
  geoTargetTypeSetting: geoTargetTypeFromFlags(args),
9880
+ networkSettings: networkSettingsFromFlags(args),
9829
9881
  finalUrlSuffix: args["final-url-suffix"],
9830
9882
  trackingUrlTemplate: args["tracking-template"],
9831
9883
  urlCustomParameters: urlCustomParametersFromFlags(args),
@@ -9835,7 +9887,10 @@ var campaignsCommand = defineCommand30({
9835
9887
  euPoliticalAds: args["eu-political-ads"],
9836
9888
  status: args.status
9837
9889
  });
9838
- await stageCreate("google.campaign.create", customerId, payload, geoTargetTypeHints(payload));
9890
+ await stageCreate("google.campaign.create", customerId, payload, [
9891
+ ...geoTargetTypeHints(payload),
9892
+ ...networksHints(payload)
9893
+ ]);
9839
9894
  }
9840
9895
  }),
9841
9896
  update: defineCommand30({
@@ -9852,6 +9907,7 @@ var campaignsCommand = defineCommand30({
9852
9907
  ...finalUrlSuffixArg,
9853
9908
  ...urlOptionsArgs,
9854
9909
  ...geoTargetTypeArgs,
9910
+ ...networksArg,
9855
9911
  "eu-political-ads": {
9856
9912
  type: "boolean",
9857
9913
  description: "Corrects the campaign's EU political advertising declaration: --eu-political-ads if it contains EU political ads, --eu-political-ads=false if it does not. Existing campaigns without a declaration block location-targeting changes until one is set."
@@ -9877,6 +9933,7 @@ var campaignsCommand = defineCommand30({
9877
9933
  budget: args["budget-ref"],
9878
9934
  bidding: biddingFromFlags(args),
9879
9935
  geoTargetTypeSetting: geoTargetTypeFromFlags(args),
9936
+ networkSettings: networkSettingsFromFlags(args),
9880
9937
  finalUrlSuffix: args["final-url-suffix"],
9881
9938
  trackingUrlTemplate: args["tracking-template"],
9882
9939
  urlCustomParameters: urlCustomParametersFromFlags(args),