@koda-sl/baker-cli 0.179.0 → 0.180.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/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  toModelSafeImage,
37
37
  ulid,
38
38
  validateCanvasDeep
39
- } from "./chunk-P2T3IZRE.js";
39
+ } from "./chunk-QPVJGKV7.js";
40
40
  import {
41
41
  csvOrJson,
42
42
  daysAgoIso,
@@ -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),
@@ -35059,8 +35116,11 @@ Then stage changes (nothing is sent to Tag Manager until publish):
35059
35116
  baker tag-manager tag create --json '{"name":"GA4 Quote","type":"gaawe","firingTriggerId":["gtm_temp_trigger_..."]}'
35060
35117
  baker tag-manager draft list \u2014 review everything staged
35061
35118
 
35062
- On publish, staged changes are written into a new Tag Manager version that is NOT published.
35063
- Tell the user to publish that version in Tag Manager to make it live.
35119
+ On publish, staged changes are written into the container and closed as a new Tag Manager
35120
+ version, and a clean run PUBLISHES that version \u2014 so the changes go live on the user's site.
35121
+ Say they go live when the user publishes the chat; never that they are live already, and never
35122
+ that someone still has to approve them inside Tag Manager. (If the publish call itself fails the
35123
+ version stands unpublished, and \`draft list\` says so and what is left to do.)
35064
35124
 
35065
35125
  This owns the CONTENTS of the container. Installing the container snippet on the site is a
35066
35126
  different job \u2014 that is \`baker tags\` with the googleTagManager tag.