@carrierllc/mcp 0.13.83 → 0.13.85

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-LF5NVSIU.js";
49
49
  import {
50
50
  copyTree,
51
51
  exists,
@@ -2155,7 +2155,10 @@ var COPY_FIELDS = [
2155
2155
  ["buyLabel", "buyLabel"],
2156
2156
  ["emptyPlansText", "emptyPlansText"],
2157
2157
  ["searchHeading", "searchHeading"],
2158
- ["searchPlaceholder", "searchPlaceholder"]
2158
+ ["searchPlaceholder", "searchPlaceholder"],
2159
+ ["metaTitle", "metaTitle"],
2160
+ ["metaDescription", "metaDescription"],
2161
+ ["socialImageUrl", "socialImageUrl"]
2159
2162
  ];
2160
2163
  function storefrontBrandPatch(input, existing) {
2161
2164
  const theme = overlay(existing?.theme, input, THEME_FIELDS);
@@ -2165,6 +2168,12 @@ function storefrontBrandPatch(input, existing) {
2165
2168
  ...copy ? { copy } : {}
2166
2169
  };
2167
2170
  }
2171
+ function storefrontNotificationPatch(input) {
2172
+ return {
2173
+ ...input.orderNotifyEmail !== void 0 ? { order_notify_email: input.orderNotifyEmail } : {},
2174
+ ...input.orderNotifyWebhookUrl !== void 0 ? { order_notify_webhook_url: input.orderNotifyWebhookUrl } : {}
2175
+ };
2176
+ }
2168
2177
  function completePlanInput(input, plans) {
2169
2178
  if ((input.productId?.trim() ?? "") !== "") return input;
2170
2179
  const touched = [
@@ -2246,8 +2255,15 @@ function storefrontPlanBody(input) {
2246
2255
  input.stripePriceMode
2247
2256
  ].some((value) => value !== void 0);
2248
2257
  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." };
2258
+ const missing = [];
2259
+ if (!input.slug) missing.push("a slug");
2260
+ if (!input.name) missing.push("a name");
2261
+ if (input.priceCents === void 0) missing.push("a price in minor units");
2262
+ if (!input.currency) missing.push("a currency");
2263
+ if (input.templateId === void 0) missing.push("an OCS template id");
2264
+ if (missing.length > 0) {
2265
+ const list = missing.length === 1 ? missing[0] : `${missing.slice(0, -1).join(", ")} and ${missing[missing.length - 1]}`;
2266
+ return { error: `A plan needs ${list}.` };
2251
2267
  }
2252
2268
  if (input.dataGb !== void 0 && input.dataGb <= 0 && input.unlimited !== true) {
2253
2269
  return { error: "data_gb of 0 is refused. Send unlimited: true to sell an unlimited plan." };
@@ -2370,7 +2386,11 @@ async function publishHostedStorefront(input) {
2370
2386
  const plan = storefrontPlanBody(filled);
2371
2387
  const planError = isStorefrontPlanError(plan) ? plan.error : null;
2372
2388
  const brand = storefrontBrandPatch(input, existing ?? void 0);
2373
- const record2 = { slug: input.slug, name: input.name, status: input.status, ...brand };
2389
+ const notify = storefrontNotificationPatch({
2390
+ orderNotifyEmail: input.orderNotifyEmail,
2391
+ orderNotifyWebhookUrl: input.orderNotifyWebhookUrl
2392
+ });
2393
+ const record2 = { slug: input.slug, name: input.name, status: input.status, ...brand, ...notify };
2374
2394
  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
2395
  if (!saved.ok) return saved;
2376
2396
  if (planError) return withPlanError(withShopAddress(saved, input.slug), planError);
@@ -2448,6 +2468,8 @@ function hostedPublishInputFromFlags(flags) {
2448
2468
  legalName: flags.legalName,
2449
2469
  address: flags.address,
2450
2470
  locale,
2471
+ orderNotifyEmail: flags.orderNotifyEmail,
2472
+ orderNotifyWebhookUrl: flags.orderNotifyWebhookUrl,
2451
2473
  intro: flags.intro,
2452
2474
  ctaLabel: flags.ctaLabel,
2453
2475
  howHeading: flags.howHeading,
@@ -2456,6 +2478,9 @@ function hostedPublishInputFromFlags(flags) {
2456
2478
  emptyPlansText: flags.emptyPlansText,
2457
2479
  searchHeading: flags.searchHeading,
2458
2480
  searchPlaceholder: flags.searchPlaceholder,
2481
+ metaTitle: flags.metaTitle,
2482
+ metaDescription: flags.metaDescription,
2483
+ socialImageUrl: flags.socialImageUrl,
2459
2484
  productId: flags.product,
2460
2485
  planSlug: flags.plan,
2461
2486
  planName: flags.planName,
@@ -8076,7 +8101,7 @@ site.command("show").description("Show a hosted storefront and its plans' OCS ac
8076
8101
  `);
8077
8102
  if (!result.ok) process.exitCode = 1;
8078
8103
  });
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) => {
8104
+ 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
8105
  header();
8081
8106
  let brand = { ...CARRIER_BRAND };
8082
8107
  if (o.name || o.domain || o.accent) {
@@ -8102,9 +8127,17 @@ site.command("create [dir]").description("Scaffold a white-labeled storefront fr
8102
8127
  accentDark: o.accent ? deriveAccentDark(o.accent) : brand.colors.accentDark
8103
8128
  }
8104
8129
  };
8105
- } else if (!o.yes) {
8130
+ } else if (!o.yes && !o.tagline && !o.supportEmail && !o.legalName) {
8106
8131
  brand = await promptBrand(CARRIER_BRAND);
8107
8132
  }
8133
+ if (o.tagline || o.supportEmail || o.legalName) {
8134
+ brand = {
8135
+ ...brand,
8136
+ ...o.tagline ? { tagline: o.tagline } : {},
8137
+ ...o.supportEmail ? { supportEmail: o.supportEmail } : {},
8138
+ ...o.legalName ? { legalName: o.legalName } : {}
8139
+ };
8140
+ }
8108
8141
  const target = resolve4(dir ?? "./storefront");
8109
8142
  if (await exists(target)) {
8110
8143
  const go = await p3.confirm({ message: `${target} exists \u2014 write into it anyway?`, initialValue: false });
@@ -8164,7 +8197,7 @@ site.command("deploy [dir]").description(
8164
8197
  p3.outro("");
8165
8198
  }
8166
8199
  );
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) => {
8200
+ 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("--meta-title <text>", "Page and share-card title (default: the shop name)").option("--meta-description <text>", "Meta and share-card description (default: the tagline)").option("--social-image-url <url>", "https share-card image address (default: the generated card)").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
8201
  header();
8169
8202
  const built = hostedPublishInputFromFlags(o);
8170
8203
  if (!built.ok) {