@carrierllc/mcp 0.13.74 → 0.13.77
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/{chunk-X7U4FBUH.js → chunk-WQYJ7M3Q.js} +2 -2
- package/dist/{chunk-X7U4FBUH.js.map → chunk-WQYJ7M3Q.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/storefront/src/app/activate/[orderId]/ActivateClient.tsx +4 -4
- package/templates/storefront/src/app/dashboard/EsimControls.tsx +6 -7
- package/templates/storefront/src/app/dashboard/page.tsx +2 -2
- package/templates/storefront/src/app/layout.tsx +4 -3
- package/templates/storefront/src/app/shop/ShopClient.tsx +2 -2
- package/templates/storefront/src/components/footer/StorefrontFooter.tsx +1 -1
- package/templates/storefront/src/components/nav/StorefrontNav.tsx +1 -1
- package/templates/storefront/src/lib/buyer-error.ts +1 -1
- package/templates/storefront/src/lib/order-reference.ts +10 -0
- package/templates/storefront/src/vendor/carrier/types.ts +2 -0
- package/templates/storefront/src/vendor/email/qr-delivery.ts +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrierllc/mcp",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.77",
|
|
4
4
|
"description": "Carrier MCP — natural-language control of MVNO/eSIM fleets via the network OCS. Stdio mode for direct integration with Claude Desktop, Cursor, Windsurf, and MCP-compatible clients. Ships the `carrier` CLI (plugin install + white-label eSIM storefront scaffold).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Carrier (Lifecycle Innovations Limited)",
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
directInstallUrl,
|
|
28
28
|
manualActivationCode,
|
|
29
29
|
} from "@/lib/esim-install";
|
|
30
|
-
import {
|
|
30
|
+
import { orderNumberLabel, supportOrderHref } from "@/lib/order-reference";
|
|
31
31
|
import type { EsimOrder } from "@/vendor/carrier/types";
|
|
32
32
|
|
|
33
33
|
interface Props {
|
|
@@ -203,8 +203,8 @@ export function ActivateClient({ orderId }: Props) {
|
|
|
203
203
|
throw new Error("phone");
|
|
204
204
|
}
|
|
205
205
|
setSubmitted(true);
|
|
206
|
-
} catch
|
|
207
|
-
setSaveError(buyerFacingError("phone"
|
|
206
|
+
} catch {
|
|
207
|
+
setSaveError(buyerFacingError("phone"));
|
|
208
208
|
} finally {
|
|
209
209
|
setSaving(false);
|
|
210
210
|
}
|
|
@@ -235,7 +235,7 @@ export function ActivateClient({ orderId }: Props) {
|
|
|
235
235
|
<h1 className="text-2xl font-bold text-sand-900 dark:text-sand-50">
|
|
236
236
|
{ready ? "Your eSIM is ready" : "Setting up your eSIM"}
|
|
237
237
|
</h1>
|
|
238
|
-
<p className="mt-2 text-sm text-sand-700 dark:text-sand-200">Reference {
|
|
238
|
+
<p className="mt-2 text-sm text-sand-700 dark:text-sand-200">Reference {orderNumberLabel(order, orderId)}</p>
|
|
239
239
|
</div>
|
|
240
240
|
|
|
241
241
|
<div className="rounded-2xl border border-sand-200 dark:border-sand-800 bg-white dark:bg-sand-900 p-8 text-center mb-8">
|
|
@@ -68,7 +68,7 @@ export function EsimControls({ orderId, cancelled: initiallyCancelled }: Props)
|
|
|
68
68
|
setUsage(
|
|
69
69
|
usageRes.value.ok && payload.usage
|
|
70
70
|
? { phase: "ready", value: payload.usage }
|
|
71
|
-
: { phase: "error", message: buyerFacingError("plan"
|
|
71
|
+
: { phase: "error", message: buyerFacingError("plan") },
|
|
72
72
|
);
|
|
73
73
|
} else {
|
|
74
74
|
setUsage({ phase: "error", message: buyerFacingError("plan") });
|
|
@@ -79,7 +79,7 @@ export function EsimControls({ orderId, cancelled: initiallyCancelled }: Props)
|
|
|
79
79
|
setTopUps(
|
|
80
80
|
topUpRes.value.ok && Array.isArray(payload.options)
|
|
81
81
|
? { phase: "ready", value: payload.options }
|
|
82
|
-
: { phase: "error", message: buyerFacingError("plan"
|
|
82
|
+
: { phase: "error", message: buyerFacingError("plan") },
|
|
83
83
|
);
|
|
84
84
|
} else {
|
|
85
85
|
setTopUps({ phase: "error", message: buyerFacingError("plan") });
|
|
@@ -107,9 +107,9 @@ export function EsimControls({ orderId, cancelled: initiallyCancelled }: Props)
|
|
|
107
107
|
const payload = await readJson<{ url?: string }>(res);
|
|
108
108
|
if (!res.ok || !payload.url) throw new Error("plan");
|
|
109
109
|
window.location.assign(payload.url);
|
|
110
|
-
} catch
|
|
110
|
+
} catch {
|
|
111
111
|
setBuying(null);
|
|
112
|
-
setTopUps({ phase: "error", message: buyerFacingError("plan"
|
|
112
|
+
setTopUps({ phase: "error", message: buyerFacingError("plan") });
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -117,13 +117,12 @@ export function EsimControls({ orderId, cancelled: initiallyCancelled }: Props)
|
|
|
117
117
|
setCancelState({ phase: "loading" });
|
|
118
118
|
try {
|
|
119
119
|
const res = await fetch(`${base}/cancel`, { method: "POST" });
|
|
120
|
-
const payload = await readJson<{ cancelledAt?: string }>(res);
|
|
121
120
|
if (!res.ok) throw new Error("plan");
|
|
122
121
|
setCancelled(true);
|
|
123
122
|
setConfirmingCancel(false);
|
|
124
123
|
setCancelState({ phase: "ready", value: true });
|
|
125
|
-
} catch
|
|
126
|
-
setCancelState({ phase: "error", message: buyerFacingError("plan"
|
|
124
|
+
} catch {
|
|
125
|
+
setCancelState({ phase: "error", message: buyerFacingError("plan") });
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
|
|
@@ -14,7 +14,7 @@ import { buyerUserId } from "@/lib/buyer-session";
|
|
|
14
14
|
import { listClaimedOrderIds } from "@/lib/checkout-order-claim";
|
|
15
15
|
import { fetchOrder } from "@/vendor/carrier/client";
|
|
16
16
|
import type { EsimOrder, OrderStatus } from "@/vendor/carrier/types";
|
|
17
|
-
import {
|
|
17
|
+
import { orderNumberLabel, supportOrderHref } from "@/lib/order-reference";
|
|
18
18
|
import { EsimControls } from "./EsimControls";
|
|
19
19
|
import brand from "@/brand.config";
|
|
20
20
|
|
|
@@ -70,7 +70,7 @@ function OrderRow({ orderId, order }: { orderId: string; order: EsimOrder | null
|
|
|
70
70
|
<span className="text-xs text-sand-700 dark:text-sand-200">{state.label}</span>
|
|
71
71
|
</div>
|
|
72
72
|
{state.detail ? <p className="mt-2 text-sm text-sand-700 dark:text-sand-200">{state.detail}</p> : null}
|
|
73
|
-
<p className="mt-1 text-xs text-sand-600">{
|
|
73
|
+
<p className="mt-1 text-xs text-sand-600">{orderNumberLabel(order, orderId)}</p>
|
|
74
74
|
{order?.iccid && <p className="mt-1 text-xs text-sand-700 dark:text-sand-200">ICCID {order.iccid}</p>}
|
|
75
75
|
{!order && (
|
|
76
76
|
<p className="mt-2 text-xs text-sand-700 dark:text-sand-200">
|
|
@@ -35,6 +35,7 @@ export const metadata: Metadata = {
|
|
|
35
35
|
export const viewport: Viewport = {
|
|
36
36
|
themeColor: brand.colors.accent,
|
|
37
37
|
colorScheme: "light dark",
|
|
38
|
+
viewportFit: "cover",
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
@@ -49,16 +50,16 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
49
50
|
<ThemeScript />
|
|
50
51
|
<BrandStyles />
|
|
51
52
|
</head>
|
|
52
|
-
<body className="overflow-x-clip">
|
|
53
|
+
<body className="overflow-x-clip pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]">
|
|
53
54
|
<Providers>
|
|
54
55
|
<a
|
|
55
56
|
href="#main-content"
|
|
56
|
-
className="sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-
|
|
57
|
+
className="sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-[calc(5rem+env(safe-area-inset-top))] focus:z-[100] focus:inline-flex focus:min-h-11 focus:items-center focus:rounded-lg focus:bg-[var(--brand-accent)] focus:px-4 focus:text-base focus:font-semibold focus:text-[var(--brand-on-accent)]"
|
|
57
58
|
>
|
|
58
59
|
Skip to main content
|
|
59
60
|
</a>
|
|
60
61
|
<StorefrontNav />
|
|
61
|
-
<main id="main-content" className="pt-
|
|
62
|
+
<main id="main-content" className="pt-[calc(4rem+env(safe-area-inset-top))]">
|
|
62
63
|
{children}
|
|
63
64
|
</main>
|
|
64
65
|
<StorefrontFooter />
|
|
@@ -66,7 +66,7 @@ export function ShopClient({ plans, country = "" }: { plans: SkuTemplate[]; coun
|
|
|
66
66
|
: formatPrice(selected.price_cents, selected.currency);
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
|
-
<div className="mx-auto max-w-6xl px-4 py-16 pb-
|
|
69
|
+
<div className="mx-auto max-w-6xl px-4 py-16 pb-[calc(7rem+env(safe-area-inset-bottom))] lg:pb-16">
|
|
70
70
|
<h1 className="text-4xl font-semibold tracking-tight text-sand-900 dark:text-sand-50">
|
|
71
71
|
Choose your plan
|
|
72
72
|
</h1>
|
|
@@ -167,7 +167,7 @@ export function ShopClient({ plans, country = "" }: { plans: SkuTemplate[]; coun
|
|
|
167
167
|
type="button"
|
|
168
168
|
onClick={handleContinue}
|
|
169
169
|
disabled={!selected || selected.price_unavailable === true}
|
|
170
|
-
className={`${filledAccentClass} fixed inset-
|
|
170
|
+
className={`${filledAccentClass} fixed bottom-[max(1rem,env(safe-area-inset-bottom))] left-[max(1rem,env(safe-area-inset-left))] right-[max(1rem,env(safe-area-inset-right))] z-30 disabled:cursor-not-allowed disabled:bg-sand-200 disabled:text-sand-700 lg:static lg:inset-auto lg:z-auto lg:mt-6 lg:w-full`}
|
|
171
171
|
>
|
|
172
172
|
{selected?.price_unavailable
|
|
173
173
|
? "Price unavailable"
|
|
@@ -18,7 +18,7 @@ const FOOTER_LINKS = {
|
|
|
18
18
|
|
|
19
19
|
export function StorefrontFooter() {
|
|
20
20
|
return (
|
|
21
|
-
<footer className="bg-sand-950 pb-
|
|
21
|
+
<footer className="bg-sand-950 pb-[calc(2rem+env(safe-area-inset-bottom))] pt-16 text-sand-400">
|
|
22
22
|
<div className="mx-auto max-w-6xl px-4">
|
|
23
23
|
<div className="mb-12 grid grid-cols-2 gap-8 md:grid-cols-4">
|
|
24
24
|
<div className="col-span-2">
|
|
@@ -21,7 +21,7 @@ export function StorefrontNav() {
|
|
|
21
21
|
const [open, setOpen] = useState(false);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<header className="fixed inset-x-0 top-0 z-50 border-b border-sand-200/80 bg-sand-50/80 backdrop-blur-md dark:border-sand-800 dark:bg-sand-950/80">
|
|
24
|
+
<header className="fixed inset-x-0 top-0 z-50 pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)] pt-[env(safe-area-inset-top)] border-b border-sand-200/80 bg-sand-50/80 backdrop-blur-md dark:border-sand-800 dark:bg-sand-950/80">
|
|
25
25
|
<div className="mx-auto flex h-16 max-w-6xl items-center justify-between px-4">
|
|
26
26
|
<Link href="/" className="flex items-center gap-2 text-base font-semibold tracking-tight text-sand-900 dark:text-sand-50">
|
|
27
27
|
<Image src="/brand/logo.svg" alt="" width={32} height={32} unoptimized className="size-8 rounded-lg" />
|
|
@@ -10,7 +10,7 @@ export const PHONE_UNSAVED =
|
|
|
10
10
|
|
|
11
11
|
export type BuyerErrorKind = "plan" | "phone";
|
|
12
12
|
|
|
13
|
-
export function buyerFacingError(kind: BuyerErrorKind
|
|
13
|
+
export function buyerFacingError(kind: BuyerErrorKind): string {
|
|
14
14
|
switch (kind) {
|
|
15
15
|
case "plan":
|
|
16
16
|
return PLAN_UNREACHABLE;
|
|
@@ -9,6 +9,16 @@ export function shortOrderReference(orderId: string): string {
|
|
|
9
9
|
return tail.length > 0 ? `Order ${tail}` : "Order";
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The number a buyer quotes. It is the one the API issued, the same on the
|
|
14
|
+
* dashboard, the activation page and the email. Only an older API that sends no
|
|
15
|
+
* `orderNumber` falls back to the short tail.
|
|
16
|
+
*/
|
|
17
|
+
export function orderNumberLabel(order: { orderNumber?: string } | null | undefined, orderId: string): string {
|
|
18
|
+
const issued = order?.orderNumber;
|
|
19
|
+
return typeof issued === "string" && issued.length > 0 ? issued : shortOrderReference(orderId);
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
/** The full checkout id stays in the subject. The link text does not include it. */
|
|
13
23
|
export function supportOrderHref(email: string, orderId: string): string {
|
|
14
24
|
return `mailto:${email}?subject=${encodeURIComponent(`Order ${orderId}`)}`;
|
|
@@ -59,6 +59,8 @@ export type OrderStatus = "pending" | "provisioning" | "ready" | "failed";
|
|
|
59
59
|
*/
|
|
60
60
|
export interface EsimOrder {
|
|
61
61
|
orderId: string;
|
|
62
|
+
/** The one number a buyer quotes, issued by the API (`CR-XXXXX-XXXXX`). Absent from an older API. */
|
|
63
|
+
orderNumber?: string;
|
|
62
64
|
status: OrderStatus;
|
|
63
65
|
templateId?: string;
|
|
64
66
|
planName?: string;
|
|
@@ -44,6 +44,8 @@ export interface QrDeliveryBrand {
|
|
|
44
44
|
|
|
45
45
|
export interface QrDeliveryOrder {
|
|
46
46
|
orderId: string;
|
|
47
|
+
/** The number the API issued. The email quotes this, never the checkout id. */
|
|
48
|
+
orderNumber?: string;
|
|
47
49
|
planName?: string;
|
|
48
50
|
iccid?: string;
|
|
49
51
|
activationCode?: string;
|
|
@@ -65,6 +67,17 @@ export interface QrDeliveryInput {
|
|
|
65
67
|
*/
|
|
66
68
|
export const QR_CONTENT_ID = "esim-qr";
|
|
67
69
|
|
|
70
|
+
/** The issued order number. Only an older API without one falls back to a short tail, never the full checkout id. */
|
|
71
|
+
function orderNumberOf(order: QrDeliveryOrder): string {
|
|
72
|
+
if (order.orderNumber) return order.orderNumber;
|
|
73
|
+
const tail = order.orderId
|
|
74
|
+
.replace(/^cs_(?:test_|live_)?/i, "")
|
|
75
|
+
.replace(/[^a-zA-Z0-9]/g, "")
|
|
76
|
+
.slice(-4)
|
|
77
|
+
.toUpperCase();
|
|
78
|
+
return tail || "-";
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
function escapeHtml(value: string): string {
|
|
69
82
|
return value
|
|
70
83
|
.replace(/&/g, "&")
|
|
@@ -207,7 +220,7 @@ export function buildQrDeliveryEmail(input: QrDeliveryInput): EmailMessage {
|
|
|
207
220
|
}
|
|
208
221
|
<p style="margin:0 0 6px;font-size:13px;color:#6b7280;">${supportLine}</p>
|
|
209
222
|
<p style="margin:0;font-size:12px;color:#9ca3af;">Order ${escapeHtml(
|
|
210
|
-
order
|
|
223
|
+
orderNumberOf(order),
|
|
211
224
|
)} · You are receiving this because you bought a plan from ${escapeHtml(
|
|
212
225
|
brand.name,
|
|
213
226
|
)}.</p>
|
|
@@ -239,7 +252,7 @@ export function buildQrDeliveryEmail(input: QrDeliveryInput): EmailMessage {
|
|
|
239
252
|
"",
|
|
240
253
|
activateUrl ? `Activation page: ${activateUrl}` : null,
|
|
241
254
|
brand.supportEmail ? `Questions? ${brand.supportEmail}` : null,
|
|
242
|
-
`Order ${order
|
|
255
|
+
`Order ${orderNumberOf(order)}`,
|
|
243
256
|
]
|
|
244
257
|
.filter((line) => line !== null)
|
|
245
258
|
.join("\n");
|