@carrierllc/mcp 0.13.41 → 0.13.47

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.
Files changed (68) hide show
  1. package/dist/{chunk-6OAZJBLA.js → chunk-4XUAUQ3U.js} +67 -7
  2. package/dist/chunk-4XUAUQ3U.js.map +1 -0
  3. package/dist/cli.js +55 -9
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.js +66 -15
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/templates/storefront/CLERK.md +23 -0
  9. package/templates/storefront/src/app/activate/[orderId]/ActivateClient.tsx +29 -22
  10. package/templates/storefront/src/app/activate/[orderId]/page.tsx +2 -2
  11. package/templates/storefront/src/app/api/checkout/claim/route.ts +7 -6
  12. package/templates/storefront/src/app/api/checkout/guest/route.ts +72 -17
  13. package/templates/storefront/src/app/api/orders/[orderId]/route.ts +2 -2
  14. package/templates/storefront/src/app/checkout/[templateId]/CheckoutClient.tsx +51 -25
  15. package/templates/storefront/src/app/checkout/success/CheckoutSuccessClient.tsx +165 -131
  16. package/templates/storefront/src/app/checkout/success/FocusHeading.tsx +20 -0
  17. package/templates/storefront/src/app/checkout/success/page.tsx +136 -15
  18. package/templates/storefront/src/app/dashboard/EsimControls.tsx +20 -24
  19. package/templates/storefront/src/app/dashboard/page.tsx +43 -23
  20. package/templates/storefront/src/app/globals.css +44 -5
  21. package/templates/storefront/src/app/help/page.tsx +2 -2
  22. package/templates/storefront/src/app/layout.tsx +5 -3
  23. package/templates/storefront/src/app/page.tsx +27 -7
  24. package/templates/storefront/src/app/shop/ShopClient.tsx +106 -72
  25. package/templates/storefront/src/app/shop/page.tsx +7 -2
  26. package/templates/storefront/src/app/sign-in/[[...sign-in]]/StorefrontSignInClient.tsx +297 -0
  27. package/templates/storefront/src/app/sign-in/[[...sign-in]]/page.tsx +13 -14
  28. package/templates/storefront/src/app/sign-up/[[...sign-up]]/StorefrontSignUpClient.tsx +31 -28
  29. package/templates/storefront/src/app/sign-up/[[...sign-up]]/page.tsx +5 -2
  30. package/templates/storefront/src/brand.config.ts +16 -0
  31. package/templates/storefront/src/components/Providers.tsx +20 -1
  32. package/templates/storefront/src/components/faq/FaqSection.tsx +2 -2
  33. package/templates/storefront/src/components/footer/StorefrontFooter.tsx +7 -7
  34. package/templates/storefront/src/components/landing/FinalCTA.tsx +4 -9
  35. package/templates/storefront/src/components/landing/HeroSection.tsx +4 -7
  36. package/templates/storefront/src/components/landing/HowItWorks.tsx +1 -1
  37. package/templates/storefront/src/components/landing/PlanCard.tsx +23 -13
  38. package/templates/storefront/src/components/landing/TierPlanBoard.tsx +237 -0
  39. package/templates/storefront/src/components/nav/StorefrontNav.tsx +8 -11
  40. package/templates/storefront/src/components/shop/CountrySearch.tsx +94 -0
  41. package/templates/storefront/src/components/theme/BrandStyles.tsx +2 -2
  42. package/templates/storefront/src/components/theme/ThemeToggle.tsx +1 -1
  43. package/templates/storefront/src/components/theme/brand-accent-css.ts +21 -0
  44. package/templates/storefront/src/components/theme/brand-style.ts +88 -0
  45. package/templates/storefront/src/components/theme/clerk-appearance.ts +18 -2
  46. package/templates/storefront/src/lib/buyer-auth-copy.ts +83 -0
  47. package/templates/storefront/src/lib/buyer-error.ts +32 -0
  48. package/templates/storefront/src/lib/buyer-session.ts +41 -0
  49. package/templates/storefront/src/lib/catalog-countries.ts +179 -0
  50. package/templates/storefront/src/lib/checkout-client-error.ts +28 -0
  51. package/templates/storefront/src/lib/checkout-copy.ts +89 -0
  52. package/templates/storefront/src/lib/checkout-order-claim.ts +8 -7
  53. package/templates/storefront/src/lib/checkout-return.ts +18 -0
  54. package/templates/storefront/src/lib/clerk-instance.ts +89 -0
  55. package/templates/storefront/src/lib/order-reference.ts +15 -0
  56. package/templates/storefront/src/lib/request-origin.ts +28 -0
  57. package/templates/storefront/src/lib/sanitize-auth-redirect.ts +20 -4
  58. package/templates/storefront/src/lib/tap-target.ts +17 -0
  59. package/templates/storefront/src/lib/verify-checkout-session.ts +118 -19
  60. package/templates/storefront/src/middleware.ts +11 -0
  61. package/templates/storefront/src/vendor/carrier/catalog-guard.ts +9 -5
  62. package/templates/storefront/src/vendor/carrier/client.ts +22 -4
  63. package/templates/storefront/src/vendor/carrier/country-offers.ts +106 -0
  64. package/templates/storefront/src/vendor/carrier/stripe-price.ts +134 -0
  65. package/templates/storefront/src/vendor/carrier/tiers.ts +161 -0
  66. package/templates/storefront/src/vendor/carrier/types.ts +22 -0
  67. package/templates/storefront/src/vendor/geo/index.ts +15 -4
  68. package/dist/chunk-6OAZJBLA.js.map +0 -1
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  locationZoneCreateParams,
42
42
  mccToIso,
43
43
  mergeEnvLocal,
44
+ modifySubscriberContactInfoFromTool,
44
45
  modifySubscriberStatusParams,
45
46
  networkDefaultKey,
46
47
  networkDefaultPartition,
@@ -80,7 +81,7 @@ import {
80
81
  verifyStorefront,
81
82
  withOcsListSummary,
82
83
  withTemplateResellerId
83
- } from "./chunk-6OAZJBLA.js";
84
+ } from "./chunk-4XUAUQ3U.js";
84
85
  import "./chunk-SHKKVIIA.js";
85
86
 
86
87
  // src/index.ts
@@ -1837,14 +1838,28 @@ function registerAllTools(server2, ctx) {
1837
1838
  "modifySubscriberContactInfo",
1838
1839
  TOOL_SCOPES["modify_subscriber_contact_info"],
1839
1840
  ctx,
1840
- async ({ iccid, firstName, lastName, company, email, phoneNumber }, token2) => {
1841
- const params = { subscriber: iccid };
1842
- const nameParts = [firstName, lastName].filter(Boolean);
1843
- if (nameParts.length > 0) params.name = nameParts.join(" ");
1844
- if (company !== void 0) params.company = company;
1845
- if (phoneNumber !== void 0) params.phone = phoneNumber;
1846
- if (email !== void 0) params.mail = email;
1847
- return ocsCall(ctx.env, token2, "modifySubscriberContactInfo", params);
1841
+ async ({ iccid, firstName, lastName, company, email, phoneNumber }, token2) => ocsCall(
1842
+ ctx.env,
1843
+ token2,
1844
+ "modifySubscriberContactInfo",
1845
+ modifySubscriberContactInfoFromTool({
1846
+ iccid,
1847
+ firstName,
1848
+ lastName,
1849
+ company,
1850
+ email,
1851
+ phoneNumber
1852
+ })
1853
+ ),
1854
+ {
1855
+ dryRunPayload: ({ iccid, firstName, lastName, company, email, phoneNumber }) => modifySubscriberContactInfoFromTool({
1856
+ iccid,
1857
+ firstName,
1858
+ lastName,
1859
+ company,
1860
+ email,
1861
+ phoneNumber
1862
+ })
1848
1863
  }
1849
1864
  )
1850
1865
  );
@@ -7835,12 +7850,19 @@ function registerStorefrontDeployTools(server2, props2) {
7835
7850
  import { z as z11 } from "zod";
7836
7851
 
7837
7852
  // src/lib/storefront-plan-update.ts
7853
+ var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
7854
+ var STRIPE_PRICE_ID_MAX_LENGTH = 255;
7855
+ function stripePriceIdOk(value) {
7856
+ return value.length >= 1 && value.length <= STRIPE_PRICE_ID_MAX_LENGTH && STRIPE_PRICE_ID_RE.test(value);
7857
+ }
7838
7858
  function storefrontPlanUpdate(input) {
7839
7859
  if (input.accountId !== void 0 && (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)) {
7840
7860
  return { ok: false, message: "OCS account id must be a positive integer." };
7841
7861
  }
7842
- if (input.priceCents === void 0 && input.active === void 0 && input.sortOrder === void 0 && input.accountId === void 0) {
7843
- return { ok: false, message: "Send a price, whether the plan is for sale, a sort order, or an OCS account id." };
7862
+ const stripe = stripeFields(input.stripePriceId, input.stripePriceMode);
7863
+ if (stripe && !stripe.ok) return stripe;
7864
+ if (input.priceCents === void 0 && input.active === void 0 && input.sortOrder === void 0 && input.accountId === void 0 && input.stripePriceId === void 0 && input.stripePriceMode === void 0) {
7865
+ return { ok: false, message: "Send a price, whether the plan is for sale, a sort order, an OCS account id, or a Stripe price." };
7844
7866
  }
7845
7867
  if (input.priceCents !== void 0 && (!Number.isSafeInteger(input.priceCents) || input.priceCents <= 0)) {
7846
7868
  return { ok: false, message: "Price must be a positive number of minor units." };
@@ -7853,8 +7875,28 @@ function storefrontPlanUpdate(input) {
7853
7875
  if (input.priceCents !== void 0) body2.price_cents = input.priceCents;
7854
7876
  if (input.active !== void 0) body2.active = input.active;
7855
7877
  if (input.sortOrder !== void 0) body2.sort_order = input.sortOrder;
7878
+ if (stripe?.ok) {
7879
+ body2.stripe_price_id = stripe.id;
7880
+ body2.stripe_price_mode = stripe.mode;
7881
+ }
7856
7882
  return { ok: true, body: body2 };
7857
7883
  }
7884
+ function stripeFields(id, mode) {
7885
+ if (id === void 0 && mode === void 0) return void 0;
7886
+ if (typeof id === "string" && !stripePriceIdOk(id)) {
7887
+ return { ok: false, message: "stripe_price_id must look like price_\u2026 and be 1-255 characters." };
7888
+ }
7889
+ if (id === null || mode === null) {
7890
+ if (id !== void 0 && id !== null || mode !== void 0 && mode !== null) {
7891
+ return { ok: false, message: "Sending null clears both stripe_price_id and stripe_price_mode." };
7892
+ }
7893
+ return { ok: true, id: null, mode: null };
7894
+ }
7895
+ if (id === void 0 || mode === void 0) {
7896
+ return { ok: false, message: "stripe_price_id and stripe_price_mode must be set together." };
7897
+ }
7898
+ return { ok: true, id, mode };
7899
+ }
7858
7900
 
7859
7901
  // src/tools-storefront-plan.ts
7860
7902
  var STOREFRONT_PLAN_TOOL_SCOPES = {
@@ -7928,21 +7970,30 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
7928
7970
  "update_storefront_plan",
7929
7971
  {
7930
7972
  title: "Update Storefront Plan",
7931
- description: "Change the retail price, whether a plan is for sale, its OCS account, or its display order on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. A plan on another storefront is not found and is left unchanged. This writes the shop's own price. It does not create or change a Stripe price.",
7973
+ description: "Change the retail price, whether a plan is for sale, its OCS account, its display order, or the stored Stripe Price on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. stripe_price_id and stripe_price_mode are set together; null clears both. The id must look like price_\u2026 and be 1-255 characters. A plan on another storefront is not found and is left unchanged. The Price is stored, not yet charged. This does not create a Stripe Price, and a buyer cannot set one. The later checkout must verify the Price on the connected account.",
7932
7974
  inputSchema: {
7933
7975
  ocs_account_id: z11.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
7934
7976
  storefront_id: z11.string().min(1).describe("Id of the hosted storefront"),
7935
7977
  slug: z11.string().min(1).describe("Plan slug, such as eu-1gb"),
7936
7978
  price_cents: z11.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
7937
7979
  active: z11.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
7938
- sort_order: z11.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it.")
7980
+ sort_order: z11.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
7981
+ stripe_price_id: z11.string().regex(/^price_[A-Za-z0-9_]+$/).max(255).nullable().optional().describe("Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with stripe_price_mode. Null clears both. Omit to leave them."),
7982
+ stripe_price_mode: z11.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
7939
7983
  },
7940
7984
  annotations: annotationsFor("update_storefront_plan", "write")
7941
7985
  },
7942
- async ({ storefront_id, slug, price_cents, active, sort_order, ocs_account_id }) => {
7986
+ async ({ storefront_id, slug, price_cents, active, sort_order, ocs_account_id, stripe_price_id, stripe_price_mode }) => {
7943
7987
  const denied = denyUnlessScoped(props2, "update_storefront_plan", STOREFRONT_PLAN_TOOL_SCOPES);
7944
7988
  if (denied) return denied;
7945
- const update = storefrontPlanUpdate({ priceCents: price_cents, active, sortOrder: sort_order, accountId: ocs_account_id });
7989
+ const update = storefrontPlanUpdate({
7990
+ priceCents: price_cents,
7991
+ active,
7992
+ sortOrder: sort_order,
7993
+ accountId: ocs_account_id,
7994
+ stripePriceId: stripe_price_id,
7995
+ stripePriceMode: stripe_price_mode
7996
+ });
7946
7997
  if (!update.ok) return err5(update.message);
7947
7998
  try {
7948
7999
  const result2 = await call(`${storefront_id}/${slug}`, update.body);