@carrierllc/mcp 0.13.82 → 0.13.84

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
@@ -45,7 +45,7 @@ import {
45
45
  verifyStorefront,
46
46
  walletScreen,
47
47
  which
48
- } from "./chunk-FKHHZ7V2.js";
48
+ } from "./chunk-6OIGVT3U.js";
49
49
  import {
50
50
  copyTree,
51
51
  exists,
@@ -2165,6 +2165,12 @@ function storefrontBrandPatch(input, existing) {
2165
2165
  ...copy ? { copy } : {}
2166
2166
  };
2167
2167
  }
2168
+ function storefrontNotificationPatch(input) {
2169
+ return {
2170
+ ...input.orderNotifyEmail !== void 0 ? { order_notify_email: input.orderNotifyEmail } : {},
2171
+ ...input.orderNotifyWebhookUrl !== void 0 ? { order_notify_webhook_url: input.orderNotifyWebhookUrl } : {}
2172
+ };
2173
+ }
2168
2174
  function completePlanInput(input, plans) {
2169
2175
  if ((input.productId?.trim() ?? "") !== "") return input;
2170
2176
  const touched = [
@@ -2246,8 +2252,15 @@ function storefrontPlanBody(input) {
2246
2252
  input.stripePriceMode
2247
2253
  ].some((value) => value !== void 0);
2248
2254
  if (!touched) return null;
2249
- if (!input.slug || !input.name || input.priceCents === void 0 || !input.currency || input.templateId === void 0) {
2250
- return { error: "A plan needs a slug, name, price in minor units, currency, and OCS template id." };
2255
+ const missing = [];
2256
+ if (!input.slug) missing.push("a slug");
2257
+ if (!input.name) missing.push("a name");
2258
+ if (input.priceCents === void 0) missing.push("a price in minor units");
2259
+ if (!input.currency) missing.push("a currency");
2260
+ if (input.templateId === void 0) missing.push("an OCS template id");
2261
+ if (missing.length > 0) {
2262
+ const list = missing.length === 1 ? missing[0] : `${missing.slice(0, -1).join(", ")} and ${missing[missing.length - 1]}`;
2263
+ return { error: `A plan needs ${list}.` };
2251
2264
  }
2252
2265
  if (input.dataGb !== void 0 && input.dataGb <= 0 && input.unlimited !== true) {
2253
2266
  return { error: "data_gb of 0 is refused. Send unlimited: true to sell an unlimited plan." };
@@ -2368,16 +2381,21 @@ async function publishHostedStorefront(input) {
2368
2381
  }
2369
2382
  const filled = completePlanInput(planInput(input), existing?.plans ?? []);
2370
2383
  const plan = storefrontPlanBody(filled);
2371
- if (isStorefrontPlanError(plan)) return { ok: false, text: plan.error };
2384
+ const planError = isStorefrontPlanError(plan) ? plan.error : null;
2372
2385
  const brand = storefrontBrandPatch(input, existing ?? void 0);
2373
- const record2 = { slug: input.slug, name: input.name, status: input.status, ...brand };
2386
+ const notify = storefrontNotificationPatch({
2387
+ orderNotifyEmail: input.orderNotifyEmail,
2388
+ orderNotifyWebhookUrl: input.orderNotifyWebhookUrl
2389
+ });
2390
+ const record2 = { slug: input.slug, name: input.name, status: input.status, ...brand, ...notify };
2374
2391
  const saved = existing ? await callRestEndpoint("PATCH", "/v1/storefronts/{id}", { id: existing.id, ...record2 }) : await callRestEndpoint("POST", "/v1/storefronts", record2, { idempotencyKey: `site-publish:${input.slug}` });
2375
2392
  if (!saved.ok) return saved;
2393
+ if (planError) return withPlanError(withShopAddress(saved, input.slug), planError);
2376
2394
  if (!plan) return withShopAddress(saved, input.slug);
2377
2395
  const id = existing?.id ?? readId(saved.text);
2378
2396
  if (!id) return { ok: false, text: "The store was saved but its id was missing, so the plan was not written." };
2379
2397
  const planned = await callRestEndpoint("POST", "/v1/storefronts/{id}/plans", { id, ...plan });
2380
- return planned.ok ? withShopAddress(planned, input.slug) : planned;
2398
+ return planned.ok ? withShopAddress(planned, input.slug) : withPlanError(withShopAddress(saved, input.slug), planned.text);
2381
2399
  }
2382
2400
  function firstPublishCopy(input) {
2383
2401
  const hero = input.hero?.trim() ?? "";
@@ -2391,6 +2409,10 @@ function firstPublishCopy(input) {
2391
2409
  if (legalName === "" || legalName === "Lifecycle Innovations Limited") return "Enter a legal name.";
2392
2410
  return null;
2393
2411
  }
2412
+ function withPlanError(result, message) {
2413
+ return { ok: true, text: `${result.text}
2414
+ Plan not added: ${message}` };
2415
+ }
2394
2416
  function withShopAddress(result, slug2) {
2395
2417
  const address = hostedStorefrontUrl(slug2);
2396
2418
  if (result.text.includes(address)) return result;
@@ -2443,6 +2465,8 @@ function hostedPublishInputFromFlags(flags) {
2443
2465
  legalName: flags.legalName,
2444
2466
  address: flags.address,
2445
2467
  locale,
2468
+ orderNotifyEmail: flags.orderNotifyEmail,
2469
+ orderNotifyWebhookUrl: flags.orderNotifyWebhookUrl,
2446
2470
  intro: flags.intro,
2447
2471
  ctaLabel: flags.ctaLabel,
2448
2472
  howHeading: flags.howHeading,
@@ -8071,7 +8095,7 @@ site.command("show").description("Show a hosted storefront and its plans' OCS ac
8071
8095
  `);
8072
8096
  if (!result.ok) process.exitCode = 1;
8073
8097
  });
8074
- site.command("create [dir]").description("Scaffold a white-labeled storefront from the bundled template.").option("--name <name>", "Brand name").option("--domain <domain>", "Domain").option("--accent <hex>", "Accent color").option("--yes", "Carrier defaults, no prompts").action(async (dir, o) => {
8098
+ site.command("create [dir]").description("Scaffold a white-labeled storefront from the bundled template.").option("--name <name>", "Brand name").option("--domain <domain>", "Domain").option("--accent <hex>", "Accent color").option("--tagline <text>", "Tagline (defaults from the brand name)").option("--support-email <email>", "Support address (defaults from the domain)").option("--legal-name <name>", "Legal name (defaults to the brand name)").option("--yes", "Carrier defaults, no prompts").action(async (dir, o) => {
8075
8099
  header();
8076
8100
  let brand = { ...CARRIER_BRAND };
8077
8101
  if (o.name || o.domain || o.accent) {
@@ -8097,9 +8121,17 @@ site.command("create [dir]").description("Scaffold a white-labeled storefront fr
8097
8121
  accentDark: o.accent ? deriveAccentDark(o.accent) : brand.colors.accentDark
8098
8122
  }
8099
8123
  };
8100
- } else if (!o.yes) {
8124
+ } else if (!o.yes && !o.tagline && !o.supportEmail && !o.legalName) {
8101
8125
  brand = await promptBrand(CARRIER_BRAND);
8102
8126
  }
8127
+ if (o.tagline || o.supportEmail || o.legalName) {
8128
+ brand = {
8129
+ ...brand,
8130
+ ...o.tagline ? { tagline: o.tagline } : {},
8131
+ ...o.supportEmail ? { supportEmail: o.supportEmail } : {},
8132
+ ...o.legalName ? { legalName: o.legalName } : {}
8133
+ };
8134
+ }
8103
8135
  const target = resolve4(dir ?? "./storefront");
8104
8136
  if (await exists(target)) {
8105
8137
  const go = await p3.confirm({ message: `${target} exists \u2014 write into it anyway?`, initialValue: false });
@@ -8159,7 +8191,7 @@ site.command("deploy [dir]").description(
8159
8191
  p3.outro("");
8160
8192
  }
8161
8193
  );
8162
- site.command("publish").description("Publish a Carrier-hosted storefront. Does not deploy a self-hosted copy.").requiredOption("--slug <slug>", "Shop address, such as acme or Acme Mobile").requiredOption("--name <name>", "Brand name").option("--status <status>", "draft or published", "published").option("--accent <hex>", "Accent color, such as #112233").option("--accent-dark <hex>", "Darker accent").option("--bg <hex>", "Page background").option("--text <hex>", "Body text color").option("--logo <url-or-file>", "https logo address, or a PNG, JPEG, WebP, or GIF under 70 KB").option("--hero <text>", "Shop headline").option("--tagline <text>", "Line under the headline").option("--support-email <email>", "Support address").option("--legal-name <name>", "Legal name in the footer").option("--address <text>", "Seller address in the footer").option("--locale <locale>", "Storefront language: en or nl").option("--cta-label <text>", "Hero primary button text").option("--plans-heading <text>", "Heading for the plans section").option("--buy-label <text>", "Button text on each plan card").option("--product <id>", "Connectivity plan id. Copies its template, price, and allowance.").option("--plan <slug>", "Plan slug, such as eu-1gb").option("--plan-name <name>", "Plan name on the shop").option("--price <amount>", "Retail price, such as 9.00").option("--price-cents <cents>", "Retail price in minor units").option("--currency <code>", "Three-letter currency code").option("--template-id <id>", "OCS package template id").option("--ocs-account-id <id>", "Owned OCS account override; omit for automatic resolution").option("--data-gb <gb>", "Data allowance, such as 1 or 1 GB, or the text Unlimited").option("--unlimited", "The only way to sell an unlimited plan. A 0 or missing --data-gb without this is refused.").option("--validity-days <days>", "Validity, such as 7 or 7 days").option("--countries <names>", "Country names or codes, such as France, DE").option("--plan-text <text>", "Buyer-facing sentence. Omit to leave the saved text unchanged.").option("--inactive", "Keep the plan off the shop").option("--plan-sort-order <n>", "Plan display order on the shop (ascending, default 0)").option("--plan-group <label>", "Optional section/group label on the storefront (e.g. Uitwedstrijden)").option("--available-from <iso>", "Optional ISO-8601 start timestamp from which the plan is visible").option("--available-until <iso>", "Optional ISO-8601 end timestamp until which the plan is visible").option("--stripe-price-id <id>", "Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with --stripe-price-mode.").option("--stripe-price-mode <mode>", "test or live. Set with --stripe-price-id.").action(async (o) => {
8194
+ site.command("publish").description("Publish a Carrier-hosted storefront. Does not deploy a self-hosted copy.").requiredOption("--slug <slug>", "Shop address, such as acme or Acme Mobile").requiredOption("--name <name>", "Brand name").option("--status <status>", "draft or published", "published").option("--accent <hex>", "Accent color, such as #112233").option("--accent-dark <hex>", "Darker accent").option("--bg <hex>", "Page background").option("--text <hex>", "Body text color").option("--logo <url-or-file>", "https logo address, or a PNG, JPEG, WebP, or GIF under 70 KB").option("--hero <text>", "Shop headline (required when publishing a new shop)").option("--tagline <text>", "Line under the headline (required when publishing a new shop)").option("--support-email <email>", "Support address (required when publishing a new shop)").option("--legal-name <name>", "Legal name in the footer (required when publishing a new shop)").option("--address <text>", "Seller address in the footer").option("--locale <locale>", "Storefront language: en or nl").option("--order-notify-email <email>", "Email that receives each order notification").option("--order-notify-webhook-url <url>", "Webhook URL that receives each order notification").option("--cta-label <text>", "Hero primary button text").option("--plans-heading <text>", "Heading for the plans section").option("--buy-label <text>", "Button text on each plan card").option("--product <id>", "Connectivity plan id. Copies its template, price, and allowance.").option("--plan <slug>", "Plan slug, such as eu-1gb").option("--plan-name <name>", "Plan name on the shop").option("--price <amount>", "Retail price in major units, such as 9.00 (converted to minor units)").option("--price-cents <cents>", "Retail price in minor units, such as 900; use this or --price").option("--currency <code>", "Three-letter currency code").option("--template-id <id>", "OCS package template id").option("--ocs-account-id <id>", "Owned OCS account override; omit for automatic resolution").option("--data-gb <gb>", "Data allowance, such as 1 or 1 GB, or the text Unlimited").option("--unlimited", "The only way to sell an unlimited plan. A 0 or missing --data-gb without this is refused.").option("--validity-days <days>", "Validity, such as 7 or 7 days").option("--countries <names>", "Country names or codes, such as France, DE").option("--plan-text <text>", "Buyer-facing sentence. Omit to leave the saved text unchanged.").option("--inactive", "Keep the plan off the shop").option("--plan-sort-order <n>", "Plan display order on the shop (ascending, default 0)").option("--plan-group <label>", "Optional section/group label on the storefront (e.g. Uitwedstrijden)").option("--available-from <iso>", "Optional ISO-8601 start timestamp from which the plan is visible").option("--available-until <iso>", "Optional ISO-8601 end timestamp until which the plan is visible").option("--stripe-price-id <id>", "Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with --stripe-price-mode.").option("--stripe-price-mode <mode>", "test or live. Set with --stripe-price-id.").action(async (o) => {
8163
8195
  header();
8164
8196
  const built = hostedPublishInputFromFlags(o);
8165
8197
  if (!built.ok) {