/** * How a customer gets an eSIM onto a phone, in every form we can offer. * * This lives apart from the pages because the activate page and the delivery * email have to say exactly the same thing. They did not, in the product this * template grew out of: the page learned about one-tap install and the email * kept telling people to scan a QR code on the device they were reading it on. * Two copies of install instructions drift, and the copy that drifts is the one * the customer is holding. */ /** Both halves of the credential, as a phone's manual-entry form asks for them. */ export interface ManualInstallDetails { /** e.g. consumer.rsp.example.com — the "SM-DP+ address" field. */ smdpAddress?: string; /** e.g. K2-1A2B3C-4D5E6F — the "activation code" field. */ matchingId?: string; /** The whole LPA string, which is what a QR code encodes. */ activationCode?: string; } /** * The full LPA string, from whichever pieces the operator supplied. * * `LPA:1$$` is the format every modern handset accepts, so * either the operator hands it over whole or we can rebuild it. */ export function manualActivationCode(details: ManualInstallDetails): string | null { if (details.activationCode) return details.activationCode; if (details.smdpAddress && details.matchingId) { return `LPA:1$${details.smdpAddress}$${details.matchingId}`; } return null; } /** * Apple's universal eSIM install link — iOS 17.4 and later hand the activation * string straight to Settings, so the customer never types anything. * * Nothing equivalent exists on Android: install there is Settings → Network → * add eSIM → enter manually, which is what the written steps below are for. * The link is harmless on a phone that cannot use it; it opens a page that * explains the manual route. */ export function directInstallUrl(activationCode: string): string { return `https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=${encodeURIComponent( activationCode, )}`; } /** * The steps in words. * * A customer whose camera cannot reach a second screen, and whose phone is too * old for the one-tap link, otherwise has two credentials and no idea where to * type them. The SM-DP+ address and the activation code are named here exactly * as the handset names them, because "paste your activation string" does not * match any field on either operating system. */ export const IPHONE_INSTALL_STEPS: readonly string[] = [ "Open Settings, then Cellular (or Mobile Service).", "Tap Add eSIM, then Use QR Code.", "Tap Enter Details Manually.", "Paste the SM-DP+ address and activation code from above.", "Leave data roaming on — that is how the plan connects abroad.", ]; export const ANDROID_INSTALL_STEPS: readonly string[] = [ "Open Settings, then Network & internet.", "Tap SIMs, then Add SIM or Download a SIM instead.", "Choose Need help? then Enter it manually.", "Paste the activation code from above.", "Turn on roaming for this SIM once it appears.", ];