@carrierllc/mcp 0.13.47 → 0.13.48

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
@@ -44,7 +44,7 @@ import {
44
44
  verifyStorefront,
45
45
  walletScreen,
46
46
  which
47
- } from "./chunk-4XUAUQ3U.js";
47
+ } from "./chunk-H77A3SME.js";
48
48
  import {
49
49
  copyTree,
50
50
  exists,
@@ -2144,7 +2144,17 @@ var COPY_FIELDS = [
2144
2144
  ["hero", "hero"],
2145
2145
  ["tagline", "tagline"],
2146
2146
  ["supportEmail", "supportEmail"],
2147
- ["legalName", "legalName"]
2147
+ ["legalName", "legalName"],
2148
+ ["address", "address"],
2149
+ ["locale", "locale"],
2150
+ ["intro", "intro"],
2151
+ ["ctaLabel", "ctaLabel"],
2152
+ ["howHeading", "howHeading"],
2153
+ ["plansHeading", "plansHeading"],
2154
+ ["buyLabel", "buyLabel"],
2155
+ ["emptyPlansText", "emptyPlansText"],
2156
+ ["searchHeading", "searchHeading"],
2157
+ ["searchPlaceholder", "searchPlaceholder"]
2148
2158
  ];
2149
2159
  function storefrontBrandPatch(input, existing) {
2150
2160
  const theme = overlay(existing?.theme, input, THEME_FIELDS);
@@ -2170,6 +2180,9 @@ function completePlanInput(input, plans) {
2170
2180
  input.description,
2171
2181
  input.active,
2172
2182
  input.sortOrder,
2183
+ input.group,
2184
+ input.availableFrom,
2185
+ input.availableUntil,
2173
2186
  input.stripePriceId,
2174
2187
  input.stripePriceMode
2175
2188
  ].some((value) => value !== void 0);
@@ -2200,6 +2213,8 @@ function storefrontPlanBody(input) {
2200
2213
  }
2201
2214
  const stripe = stripePriceFields(input.stripePriceId, input.stripePriceMode);
2202
2215
  if (stripe && "error" in stripe) return stripe;
2216
+ const windowFields = planWindowFields(input);
2217
+ if (windowFields && "error" in windowFields) return windowFields;
2203
2218
  const productId = input.productId?.trim() ?? "";
2204
2219
  if (productId !== "") {
2205
2220
  const body2 = { product_id: productId };
@@ -2207,7 +2222,7 @@ function storefrontPlanBody(input) {
2207
2222
  if (input.priceCents !== void 0) body2.price_cents = input.priceCents;
2208
2223
  if (input.active !== void 0) body2.active = input.active;
2209
2224
  if (input.sortOrder !== void 0) body2.sort_order = input.sortOrder;
2210
- return stripe ? { ...body2, ...stripe } : body2;
2225
+ return { ...body2, ...windowFields ?? {}, ...stripe ?? {} };
2211
2226
  }
2212
2227
  const touched = [
2213
2228
  input.slug,
@@ -2223,6 +2238,9 @@ function storefrontPlanBody(input) {
2223
2238
  input.description,
2224
2239
  input.active,
2225
2240
  input.sortOrder,
2241
+ input.group,
2242
+ input.availableFrom,
2243
+ input.availableUntil,
2226
2244
  input.stripePriceId,
2227
2245
  input.stripePriceMode
2228
2246
  ].some((value) => value !== void 0);
@@ -2248,7 +2266,41 @@ function storefrontPlanBody(input) {
2248
2266
  if (input.description !== void 0) body.description = input.description;
2249
2267
  if (input.active !== void 0) body.active = input.active;
2250
2268
  if (input.sortOrder !== void 0) body.sort_order = input.sortOrder;
2251
- return stripe ? { ...body, ...stripe } : body;
2269
+ return { ...body, ...windowFields ?? {}, ...stripe ?? {} };
2270
+ }
2271
+ function planWindowFields(input) {
2272
+ const out = {};
2273
+ let touched = false;
2274
+ if (input.group !== void 0) {
2275
+ out.group = input.group === null || input.group.trim() === "" ? null : input.group.trim().slice(0, 80);
2276
+ touched = true;
2277
+ }
2278
+ if (input.availableFrom !== void 0) {
2279
+ if (input.availableFrom === null || input.availableFrom.trim() === "") {
2280
+ out.available_from = null;
2281
+ } else {
2282
+ const ms = Date.parse(input.availableFrom.trim());
2283
+ if (!Number.isFinite(ms)) return { error: "available_from must be an ISO-8601 date or timestamp." };
2284
+ out.available_from = new Date(ms).toISOString();
2285
+ }
2286
+ touched = true;
2287
+ }
2288
+ if (input.availableUntil !== void 0) {
2289
+ if (input.availableUntil === null || input.availableUntil.trim() === "") {
2290
+ out.available_until = null;
2291
+ } else {
2292
+ const trimmed = input.availableUntil.trim();
2293
+ const expanded = /^\d{4}-\d{2}-\d{2}$/.test(trimmed) ? `${trimmed}T23:59:59.999Z` : trimmed;
2294
+ const ms = Date.parse(expanded);
2295
+ if (!Number.isFinite(ms)) return { error: "available_until must be an ISO-8601 date or timestamp." };
2296
+ out.available_until = new Date(ms).toISOString();
2297
+ }
2298
+ touched = true;
2299
+ }
2300
+ if (out.available_from && out.available_until && Date.parse(out.available_from) > Date.parse(out.available_until)) {
2301
+ return { error: "available_from must not be after available_until." };
2302
+ }
2303
+ return touched ? out : void 0;
2252
2304
  }
2253
2305
  function stripePriceFields(id, mode) {
2254
2306
  if (id === void 0 && mode === void 0) return void 0;
@@ -2369,6 +2421,10 @@ function hostedPublishInputFromFlags(flags) {
2369
2421
  if (stripeMode !== void 0 && stripeMode !== "test" && stripeMode !== "live") {
2370
2422
  return { ok: false, text: "stripe_price_mode must be test or live." };
2371
2423
  }
2424
+ const locale = flags.locale === void 0 ? void 0 : flags.locale.trim().toLowerCase();
2425
+ if (locale !== void 0 && locale !== "en" && locale !== "nl") {
2426
+ return { ok: false, text: "Locale must be en or nl." };
2427
+ }
2372
2428
  return {
2373
2429
  ok: true,
2374
2430
  input: {
@@ -2384,6 +2440,16 @@ function hostedPublishInputFromFlags(flags) {
2384
2440
  tagline: flags.tagline,
2385
2441
  supportEmail: flags.supportEmail,
2386
2442
  legalName: flags.legalName,
2443
+ address: flags.address,
2444
+ locale,
2445
+ intro: flags.intro,
2446
+ ctaLabel: flags.ctaLabel,
2447
+ howHeading: flags.howHeading,
2448
+ plansHeading: flags.plansHeading,
2449
+ buyLabel: flags.buyLabel,
2450
+ emptyPlansText: flags.emptyPlansText,
2451
+ searchHeading: flags.searchHeading,
2452
+ searchPlaceholder: flags.searchPlaceholder,
2387
2453
  productId: flags.product,
2388
2454
  planSlug: flags.plan,
2389
2455
  planName: flags.planName,
@@ -2398,6 +2464,9 @@ function hostedPublishInputFromFlags(flags) {
2398
2464
  description: flags.planText,
2399
2465
  planActive: flags.inactive ? false : void 0,
2400
2466
  planSortOrder: sortOrder.value,
2467
+ planGroup: flags.planGroup,
2468
+ availableFrom: flags.availableFrom,
2469
+ availableUntil: flags.availableUntil,
2401
2470
  stripePriceId: flags.stripePriceId,
2402
2471
  stripePriceMode: stripeMode
2403
2472
  }
@@ -2461,6 +2530,9 @@ function planInput(input) {
2461
2530
  description: input.description,
2462
2531
  active: input.planActive,
2463
2532
  sortOrder: input.planSortOrder,
2533
+ group: input.planGroup,
2534
+ availableFrom: input.availableFrom,
2535
+ availableUntil: input.availableUntil,
2464
2536
  stripePriceId: input.stripePriceId,
2465
2537
  stripePriceMode: input.stripePriceMode
2466
2538
  };
@@ -7281,7 +7353,7 @@ site.command("deploy [dir]").description("Build + deploy a storefront to whichev
7281
7353
  p3.outro("");
7282
7354
  }
7283
7355
  );
7284
- 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("--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("--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) => {
7356
+ 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) => {
7285
7357
  header();
7286
7358
  const built = hostedPublishInputFromFlags(o);
7287
7359
  if (!built.ok) {