@carrierllc/mcp 0.13.40 → 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 (69) hide show
  1. package/dist/{chunk-WVXII7ZR.js → chunk-4XUAUQ3U.js} +67 -7
  2. package/dist/chunk-4XUAUQ3U.js.map +1 -0
  3. package/dist/cli.js +56 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.js +71 -17
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/plugin/carrier/skills/wallet/SKILL.md +1 -1
  9. package/templates/storefront/CLERK.md +23 -0
  10. package/templates/storefront/src/app/activate/[orderId]/ActivateClient.tsx +29 -22
  11. package/templates/storefront/src/app/activate/[orderId]/page.tsx +2 -2
  12. package/templates/storefront/src/app/api/checkout/claim/route.ts +7 -6
  13. package/templates/storefront/src/app/api/checkout/guest/route.ts +72 -17
  14. package/templates/storefront/src/app/api/orders/[orderId]/route.ts +2 -2
  15. package/templates/storefront/src/app/checkout/[templateId]/CheckoutClient.tsx +51 -25
  16. package/templates/storefront/src/app/checkout/success/CheckoutSuccessClient.tsx +165 -131
  17. package/templates/storefront/src/app/checkout/success/FocusHeading.tsx +20 -0
  18. package/templates/storefront/src/app/checkout/success/page.tsx +136 -15
  19. package/templates/storefront/src/app/dashboard/EsimControls.tsx +20 -24
  20. package/templates/storefront/src/app/dashboard/page.tsx +43 -23
  21. package/templates/storefront/src/app/globals.css +44 -5
  22. package/templates/storefront/src/app/help/page.tsx +2 -2
  23. package/templates/storefront/src/app/layout.tsx +5 -3
  24. package/templates/storefront/src/app/page.tsx +27 -7
  25. package/templates/storefront/src/app/shop/ShopClient.tsx +106 -72
  26. package/templates/storefront/src/app/shop/page.tsx +7 -2
  27. package/templates/storefront/src/app/sign-in/[[...sign-in]]/StorefrontSignInClient.tsx +297 -0
  28. package/templates/storefront/src/app/sign-in/[[...sign-in]]/page.tsx +13 -14
  29. package/templates/storefront/src/app/sign-up/[[...sign-up]]/StorefrontSignUpClient.tsx +31 -28
  30. package/templates/storefront/src/app/sign-up/[[...sign-up]]/page.tsx +5 -2
  31. package/templates/storefront/src/brand.config.ts +16 -0
  32. package/templates/storefront/src/components/Providers.tsx +20 -1
  33. package/templates/storefront/src/components/faq/FaqSection.tsx +2 -2
  34. package/templates/storefront/src/components/footer/StorefrontFooter.tsx +7 -7
  35. package/templates/storefront/src/components/landing/FinalCTA.tsx +4 -9
  36. package/templates/storefront/src/components/landing/HeroSection.tsx +4 -7
  37. package/templates/storefront/src/components/landing/HowItWorks.tsx +1 -1
  38. package/templates/storefront/src/components/landing/PlanCard.tsx +23 -13
  39. package/templates/storefront/src/components/landing/TierPlanBoard.tsx +237 -0
  40. package/templates/storefront/src/components/nav/StorefrontNav.tsx +8 -11
  41. package/templates/storefront/src/components/shop/CountrySearch.tsx +94 -0
  42. package/templates/storefront/src/components/theme/BrandStyles.tsx +2 -2
  43. package/templates/storefront/src/components/theme/ThemeToggle.tsx +1 -1
  44. package/templates/storefront/src/components/theme/brand-accent-css.ts +21 -0
  45. package/templates/storefront/src/components/theme/brand-style.ts +88 -0
  46. package/templates/storefront/src/components/theme/clerk-appearance.ts +18 -2
  47. package/templates/storefront/src/lib/buyer-auth-copy.ts +83 -0
  48. package/templates/storefront/src/lib/buyer-error.ts +32 -0
  49. package/templates/storefront/src/lib/buyer-session.ts +41 -0
  50. package/templates/storefront/src/lib/catalog-countries.ts +179 -0
  51. package/templates/storefront/src/lib/checkout-client-error.ts +28 -0
  52. package/templates/storefront/src/lib/checkout-copy.ts +89 -0
  53. package/templates/storefront/src/lib/checkout-order-claim.ts +8 -7
  54. package/templates/storefront/src/lib/checkout-return.ts +18 -0
  55. package/templates/storefront/src/lib/clerk-instance.ts +89 -0
  56. package/templates/storefront/src/lib/order-reference.ts +15 -0
  57. package/templates/storefront/src/lib/request-origin.ts +28 -0
  58. package/templates/storefront/src/lib/sanitize-auth-redirect.ts +20 -4
  59. package/templates/storefront/src/lib/tap-target.ts +17 -0
  60. package/templates/storefront/src/lib/verify-checkout-session.ts +118 -19
  61. package/templates/storefront/src/middleware.ts +11 -0
  62. package/templates/storefront/src/vendor/carrier/catalog-guard.ts +9 -5
  63. package/templates/storefront/src/vendor/carrier/client.ts +22 -4
  64. package/templates/storefront/src/vendor/carrier/country-offers.ts +106 -0
  65. package/templates/storefront/src/vendor/carrier/stripe-price.ts +134 -0
  66. package/templates/storefront/src/vendor/carrier/tiers.ts +161 -0
  67. package/templates/storefront/src/vendor/carrier/types.ts +22 -0
  68. package/templates/storefront/src/vendor/geo/index.ts +15 -4
  69. package/dist/chunk-WVXII7ZR.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-WVXII7ZR.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
  );
@@ -6545,6 +6560,9 @@ function denyUnlessScoped(props2, toolName, scopes) {
6545
6560
 
6546
6561
  // src/wallet-tools.ts
6547
6562
  var PACKS = [
6563
+ { id: "pack_25", eurCents: 2500, bonusPct: 0 },
6564
+ { id: "pack_50", eurCents: 5e3, bonusPct: 0 },
6565
+ { id: "pack_100", eurCents: 1e4, bonusPct: 0 },
6548
6566
  { id: "pack_500", eurCents: 5e4, bonusPct: 0 },
6549
6567
  { id: "pack_1000", eurCents: 1e5, bonusPct: 3 },
6550
6568
  { id: "pack_2500", eurCents: 25e4, bonusPct: 6 },
@@ -6799,10 +6817,10 @@ function registerWalletTools(server2, ctx) {
6799
6817
  "wallet_topup_checkout",
6800
6818
  {
6801
6819
  title: "Wallet Top-up Checkout",
6802
- description: "Create a Stripe Checkout link so a human can top up the Carrier prepaid wallet by card. This tool charges nothing itself: it returns a hosted URL, and the wallet is credited (pack amount + bonus) only after someone completes the payment in a browser. Params: `pack` (optional \u2014 pack id `pack_500`/`pack_1000`/`pack_2500`/`pack_5000`, or an exact EUR-cents amount matching a catalog pack; omit to list the packs and their bonuses without creating a session). Returns: { pack_id, pack_eur_cents, bonus_eur_cents, checkout_session_id, checkout_url } \u2014 amounts in EUR cents. Do NOT use this when the wallet must be funded now with no human in the loop \u2014 use `wallet_auto_topup`, which charges the saved card immediately. Do NOT use this to move money in OCS \u2014 `modify_account_balance` and `modify_subscriber_balance` are unrelated ledgers.",
6820
+ description: "Create a Stripe Checkout link so a human can top up the Carrier prepaid wallet by card. This tool charges nothing itself: it returns a hosted URL, and the wallet is credited (pack amount + bonus) only after someone completes the payment in a browser. Params: `pack` (optional \u2014 pack id `pack_25`/`pack_50`/`pack_100`/`pack_500`/`pack_1000`/`pack_2500`/`pack_5000`, or an exact EUR-cents amount matching a catalog pack; omit to list the packs and their bonuses without creating a session). Returns: { pack_id, pack_eur_cents, bonus_eur_cents, checkout_session_id, checkout_url } \u2014 amounts in EUR cents. Do NOT use this when the wallet must be funded now with no human in the loop \u2014 use `wallet_auto_topup`, which charges the saved card immediately. Do NOT use this to move money in OCS \u2014 `modify_account_balance` and `modify_subscriber_balance` are unrelated ledgers.",
6803
6821
  inputSchema: {
6804
6822
  pack: z7.string().optional().describe(
6805
- "Pack id (pack_500/pack_1000/pack_2500/pack_5000) or exact EUR-cents amount. Omit to list packs."
6823
+ "Pack id (pack_25/pack_50/pack_100/pack_500/pack_1000/pack_2500/pack_5000) or exact EUR-cents amount. Omit to list packs."
6806
6824
  )
6807
6825
  },
6808
6826
  /**
@@ -7832,12 +7850,19 @@ function registerStorefrontDeployTools(server2, props2) {
7832
7850
  import { z as z11 } from "zod";
7833
7851
 
7834
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
+ }
7835
7858
  function storefrontPlanUpdate(input) {
7836
7859
  if (input.accountId !== void 0 && (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)) {
7837
7860
  return { ok: false, message: "OCS account id must be a positive integer." };
7838
7861
  }
7839
- if (input.priceCents === void 0 && input.active === void 0 && input.sortOrder === void 0 && input.accountId === void 0) {
7840
- 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." };
7841
7866
  }
7842
7867
  if (input.priceCents !== void 0 && (!Number.isSafeInteger(input.priceCents) || input.priceCents <= 0)) {
7843
7868
  return { ok: false, message: "Price must be a positive number of minor units." };
@@ -7850,8 +7875,28 @@ function storefrontPlanUpdate(input) {
7850
7875
  if (input.priceCents !== void 0) body2.price_cents = input.priceCents;
7851
7876
  if (input.active !== void 0) body2.active = input.active;
7852
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
+ }
7853
7882
  return { ok: true, body: body2 };
7854
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
+ }
7855
7900
 
7856
7901
  // src/tools-storefront-plan.ts
7857
7902
  var STOREFRONT_PLAN_TOOL_SCOPES = {
@@ -7925,21 +7970,30 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
7925
7970
  "update_storefront_plan",
7926
7971
  {
7927
7972
  title: "Update Storefront Plan",
7928
- 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.",
7929
7974
  inputSchema: {
7930
7975
  ocs_account_id: z11.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
7931
7976
  storefront_id: z11.string().min(1).describe("Id of the hosted storefront"),
7932
7977
  slug: z11.string().min(1).describe("Plan slug, such as eu-1gb"),
7933
7978
  price_cents: z11.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
7934
7979
  active: z11.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
7935
- 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.")
7936
7983
  },
7937
7984
  annotations: annotationsFor("update_storefront_plan", "write")
7938
7985
  },
7939
- 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 }) => {
7940
7987
  const denied = denyUnlessScoped(props2, "update_storefront_plan", STOREFRONT_PLAN_TOOL_SCOPES);
7941
7988
  if (denied) return denied;
7942
- 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
+ });
7943
7997
  if (!update.ok) return err5(update.message);
7944
7998
  try {
7945
7999
  const result2 = await call(`${storefront_id}/${slug}`, update.body);