@carrierllc/mcp 0.13.83 → 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-MIGP6YJH.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." };
@@ -2370,7 +2383,11 @@ async function publishHostedStorefront(input) {
2370
2383
  const plan = storefrontPlanBody(filled);
2371
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;
2376
2393
  if (planError) return withPlanError(withShopAddress(saved, input.slug), planError);
@@ -2448,6 +2465,8 @@ function hostedPublishInputFromFlags(flags) {
2448
2465
  legalName: flags.legalName,
2449
2466
  address: flags.address,
2450
2467
  locale,
2468
+ orderNotifyEmail: flags.orderNotifyEmail,
2469
+ orderNotifyWebhookUrl: flags.orderNotifyWebhookUrl,
2451
2470
  intro: flags.intro,
2452
2471
  ctaLabel: flags.ctaLabel,
2453
2472
  howHeading: flags.howHeading,
@@ -8076,7 +8095,7 @@ site.command("show").description("Show a hosted storefront and its plans' OCS ac
8076
8095
  `);
8077
8096
  if (!result.ok) process.exitCode = 1;
8078
8097
  });
8079
- 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) => {
8080
8099
  header();
8081
8100
  let brand = { ...CARRIER_BRAND };
8082
8101
  if (o.name || o.domain || o.accent) {
@@ -8102,9 +8121,17 @@ site.command("create [dir]").description("Scaffold a white-labeled storefront fr
8102
8121
  accentDark: o.accent ? deriveAccentDark(o.accent) : brand.colors.accentDark
8103
8122
  }
8104
8123
  };
8105
- } else if (!o.yes) {
8124
+ } else if (!o.yes && !o.tagline && !o.supportEmail && !o.legalName) {
8106
8125
  brand = await promptBrand(CARRIER_BRAND);
8107
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
+ }
8108
8135
  const target = resolve4(dir ?? "./storefront");
8109
8136
  if (await exists(target)) {
8110
8137
  const go = await p3.confirm({ message: `${target} exists \u2014 write into it anyway?`, initialValue: false });
@@ -8164,7 +8191,7 @@ site.command("deploy [dir]").description(
8164
8191
  p3.outro("");
8165
8192
  }
8166
8193
  );
8167
- 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) => {
8168
8195
  header();
8169
8196
  const built = hostedPublishInputFromFlags(o);
8170
8197
  if (!built.ok) {