diff --git a/package-lock.json b/package-lock.json index 575924c..56f261b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "framer-motion": "^11.18.2", - "html2canvas": "^1.4.1", + "jszip": "^3.10.2", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.26.2", @@ -1252,15 +1252,6 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, - "node_modules/base64-arraybuffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", - "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/baseline-browser-mapping": { "version": "2.10.40", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.40.tgz", @@ -1336,14 +1327,11 @@ "dev": true, "license": "MIT" }, - "node_modules/css-line-break": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", - "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", - "license": "MIT", - "dependencies": { - "utrie": "^1.0.2" - } + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" }, "node_modules/csstype": { "version": "3.2.3", @@ -1584,19 +1572,6 @@ "node": ">=6.9.0" } }, - "node_modules/html2canvas": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", - "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", - "license": "MIT", - "dependencies": { - "css-line-break": "^2.1.0", - "text-segmentation": "^1.0.3" - }, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/htmlparser2": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-12.0.0.tgz", @@ -1619,6 +1594,18 @@ "node": ">=20.19.0" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "license": "MIT" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, "node_modules/is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", @@ -1628,6 +1615,12 @@ "node": ">=0.10.0" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1660,6 +1653,18 @@ "node": ">=6" } }, + "node_modules/jszip": { + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.2.tgz", + "integrity": "sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==", + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, "node_modules/launder": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/launder/-/launder-1.7.1.tgz", @@ -1669,6 +1674,15 @@ "dayjs": "^1.11.7" } }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -1741,6 +1755,12 @@ "node": ">=18" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "license": "(MIT AND Zlib)" + }, "node_modules/parse-srcset": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", @@ -1781,6 +1801,12 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -1848,6 +1874,21 @@ "react-dom": ">=16.8" } }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, "node_modules/rollup": { "version": "4.62.2", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", @@ -1893,6 +1934,12 @@ "fsevents": "~2.3.2" } }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, "node_modules/sanitize-html": { "version": "2.17.7", "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.17.7.tgz", @@ -1930,6 +1977,12 @@ "semver": "bin/semver.js" } }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "license": "MIT" + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -1939,13 +1992,13 @@ "node": ">=0.10.0" } }, - "node_modules/text-segmentation": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", - "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "license": "MIT", "dependencies": { - "utrie": "^1.0.2" + "safe-buffer": "~5.1.0" } }, "node_modules/tslib": { @@ -1999,14 +2052,11 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/utrie": { + "node_modules/util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", - "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", - "license": "MIT", - "dependencies": { - "base64-arraybuffer": "^1.0.2" - } + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" }, "node_modules/vite": { "version": "5.4.21", diff --git a/package.json b/package.json index 44cce9b..7f16e92 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "framer-motion": "^11.18.2", - "html2canvas": "^1.4.1", + "jszip": "^3.10.2", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.26.2", diff --git a/public/roi/deck/BlackDice_Strategy_Deck.pptx b/public/roi/deck/BlackDice_Strategy_Deck.pptx new file mode 100644 index 0000000..73ed3c0 Binary files /dev/null and b/public/roi/deck/BlackDice_Strategy_Deck.pptx differ diff --git a/public/roi/slides/slide-01.jpg b/public/roi/slides/slide-01.jpg new file mode 100644 index 0000000..6da5e60 Binary files /dev/null and b/public/roi/slides/slide-01.jpg differ diff --git a/public/roi/slides/slide-02.jpg b/public/roi/slides/slide-02.jpg new file mode 100644 index 0000000..b3ccd48 Binary files /dev/null and b/public/roi/slides/slide-02.jpg differ diff --git a/public/roi/slides/slide-03.jpg b/public/roi/slides/slide-03.jpg new file mode 100644 index 0000000..a99fc57 Binary files /dev/null and b/public/roi/slides/slide-03.jpg differ diff --git a/public/roi/slides/slide-04.jpg b/public/roi/slides/slide-04.jpg new file mode 100644 index 0000000..090982d Binary files /dev/null and b/public/roi/slides/slide-04.jpg differ diff --git a/public/roi/slides/slide-05.jpg b/public/roi/slides/slide-05.jpg new file mode 100644 index 0000000..24383be Binary files /dev/null and b/public/roi/slides/slide-05.jpg differ diff --git a/public/roi/slides/slide-06.jpg b/public/roi/slides/slide-06.jpg new file mode 100644 index 0000000..3d411b7 Binary files /dev/null and b/public/roi/slides/slide-06.jpg differ diff --git a/public/roi/slides/slide-07.jpg b/public/roi/slides/slide-07.jpg new file mode 100644 index 0000000..6adc007 Binary files /dev/null and b/public/roi/slides/slide-07.jpg differ diff --git a/public/roi/slides/slide-08.jpg b/public/roi/slides/slide-08.jpg new file mode 100644 index 0000000..46b87ae Binary files /dev/null and b/public/roi/slides/slide-08.jpg differ diff --git a/public/roi/slides/slide-09.jpg b/public/roi/slides/slide-09.jpg new file mode 100644 index 0000000..006987d Binary files /dev/null and b/public/roi/slides/slide-09.jpg differ diff --git a/public/roi/slides/slide-10.jpg b/public/roi/slides/slide-10.jpg new file mode 100644 index 0000000..253e82e Binary files /dev/null and b/public/roi/slides/slide-10.jpg differ diff --git a/public/roi/slides/slide-11.jpg b/public/roi/slides/slide-11.jpg new file mode 100644 index 0000000..9d367dc Binary files /dev/null and b/public/roi/slides/slide-11.jpg differ diff --git a/public/roi/slides/slide-12.jpg b/public/roi/slides/slide-12.jpg new file mode 100644 index 0000000..c3e38e2 Binary files /dev/null and b/public/roi/slides/slide-12.jpg differ diff --git a/public/roi/slides/slide-13.jpg b/public/roi/slides/slide-13.jpg new file mode 100644 index 0000000..ffe0d11 Binary files /dev/null and b/public/roi/slides/slide-13.jpg differ diff --git a/public/roi/slides/slide-14.jpg b/public/roi/slides/slide-14.jpg new file mode 100644 index 0000000..db5168e Binary files /dev/null and b/public/roi/slides/slide-14.jpg differ diff --git a/public/roi/slides/slide-15.jpg b/public/roi/slides/slide-15.jpg new file mode 100644 index 0000000..baed2cc Binary files /dev/null and b/public/roi/slides/slide-15.jpg differ diff --git a/src/site/roi/RoiCalculator.tsx b/src/site/roi/RoiCalculator.tsx index 41e844c..3742449 100644 --- a/src/site/roi/RoiCalculator.tsx +++ b/src/site/roi/RoiCalculator.tsx @@ -1,521 +1,57 @@ -import { useEffect, useMemo, useState } from 'react' +import { useState } from 'react' import './roiCalculator.css' -import { - calculate, - ddosCostFromSlider, - fmt, - fmtRange, - formatForDeck, - INPUTS_KEY, - loadInputs, - REGIONS, - regionLabel, -} from './calc.js' -import RoiSlide from './RoiSlide' +import { INPUTS_KEY } from './calc.js' +import RoiLanding, { type Registrant } from './RoiLanding' +import RoiToolkit from './RoiToolkit' import { submitLead } from '../../cms/api' -const Icon = { - globe: ( - - - - - ), - phone: ( - - - - ), - users: ( - - - - - - ), - server: ( - - - - - - - ), - shield: ( - - - - ), - slide: ( - - - - - ), -} +const REG_KEY = 'bd_roi_registrant' -function CardHeader({ - icon, - green, - num, - title, - subtitle, -}: { - icon: React.ReactNode - green?: boolean - num: string - title: string - subtitle: string -}) { - return ( -
-
{icon}
-
-
{num}
-
{title}
-
{subtitle}
-
-
- ) -} - -const rangePct = (val: number, min: number, max: number) => `${(((val - min) / (max - min)) * 100).toFixed(1)}%` - -/** Plain-text summary of a visitor's inputs and results, stored as the enquiry's message. */ -function buildRoiSummary(i: Record, r: ReturnType) { - return [ - `Active subscribers: ${i.subs ? Number(i.subs).toLocaleString('en-US') : '—'}`, - `Region: ${i.region === 'custom' ? `Custom ($${i.customPrice || 0}/GB)` : regionLabel(i.region)}`, - `Bandwidth scenario: ${i.scenario}`, - `Support calls per 1,000 subs/month: ${i.callsPer1000}`, - `Average cost per call: $${i.callCost}`, - `Security-related calls: ${i.securityPct}%`, - `Monthly ARPU: ${i.arpu ? `$${i.arpu}` : '—'}`, - `Annual churn rate: ${i.churn ? `${i.churn}%` : '—'}`, - `Annual network infrastructure OpEx: ${i.netOpex ? `$${Number(i.netOpex).toLocaleString('en-US')}` : '—'}`, - `DDoS incidents per year: ${i.ddos || 0}`, - '', - `Total estimated annual savings: ${fmtRange(r.total.lo, r.total.hi) || '—'}`, - ` Bandwidth savings: ${fmtRange(r.bw.lo, r.bw.hi) || '—'}`, - ` Support call reduction: ${fmtRange(r.calls.lo, r.calls.hi) || '—'}`, - ` Churn reduction: ${fmtRange(r.churn.lo, r.churn.hi) || '—'}`, - ` Network equipment: ${fmtRange(r.equip.lo, r.equip.hi) || '—'}`, - ` DDoS avoided costs: ${fmtRange(r.ddos.lo, r.ddos.hi) || '—'}`, - ].join('\n') +function loadRegistrant(): Registrant | null { + try { + return JSON.parse(localStorage.getItem(REG_KEY) || 'null') + } catch { + return null + } } export default function RoiCalculator() { - const [i, setI] = useState(loadInputs) - const [showAssump, setShowAssump] = useState(false) - const [showSlide, setShowSlide] = useState(false) - const [lead, setLead] = useState({ name: '', email: '', company: '' }) - const [leadState, setLeadState] = useState<'idle' | 'sending' | 'sent' | 'error'>('idle') + const [registrant, setRegistrant] = useState(loadRegistrant) - const update = (patch: Record) => { - setI((s: typeof i) => ({ ...s, ...patch })) - setShowSlide(false) - } - const set = (k: string) => (e: React.ChangeEvent) => update({ [k]: e.target.value }) - - const r = useMemo(() => calculate(i), [i]) - - const submitRoiLead = async (e: React.FormEvent) => { - e.preventDefault() - if (!lead.email.trim() || leadState === 'sending') return - setLeadState('sending') + async function handleRegister(reg: Registrant) { + submitLead({ + form: 'roi-toolkit-registration', + name: `${reg.first} ${reg.last}`.trim(), + email: reg.email, + company: reg.company, + page: '/roi-calculator', + message: [ + `Job title: ${reg.title}`, + reg.region && `Region: ${reg.region}`, + reg.subscribers && `Active subscribers: ${Number(reg.subscribers).toLocaleString('en-US')}`, + ] + .filter(Boolean) + .join('\n'), + }).catch(() => {}) try { - await submitLead({ - form: 'roi-calculator', - name: lead.name.trim(), - email: lead.email.trim(), - company: lead.company.trim(), - page: '/roi-calculator', - message: buildRoiSummary(i, r), - }) - setLeadState('sent') - } catch { - setLeadState('error') - } - } - - // Remember inputs for this visitor (survives refresh) - useEffect(() => { - try { - localStorage.setItem(INPUTS_KEY, JSON.stringify(i)) + localStorage.setItem(REG_KEY, JSON.stringify(reg)) } catch { /* storage unavailable */ } - }, [i]) + setRegistrant(reg) + window.scrollTo({ top: 0, behavior: 'smooth' }) + } - const rows: [string, string, string, string][] = [ - ['bw', 'dot-grey', '① Bandwidth savings', 'Enter subscriber count and region'], - ['calls', 'dot-green', '② Support call reduction', 'Enter subscriber count and call volume'], - ['churn', 'dot-teal', '③ Churn reduction', 'Enter ARPU and churn rate'], - ['equip', 'dot-blue', '④ Network equipment', 'Enter infrastructure OpEx (optional)'], - ['ddos', 'dot-orange', '⑤ DDoS avoided costs', 'No incidents entered'], - ] + function handleReset() { + try { + localStorage.removeItem(REG_KEY) + localStorage.removeItem(INPUTS_KEY) + } catch { + /* ignore */ + } + setRegistrant(null) + window.scrollTo({ top: 0 }) + } - return ( -
-
-
-

Network Protection ROI Calculator

-

Enter your operator data below. Results update in real time. Once complete, view your personalised results slide.

-
- -
-
- Savings by section - {['Bandwidth', 'Support calls', 'Churn reduction', 'Network equipment', 'DDoS (optional)'].map((t, n) => ( - - {n > 0 && ›} - - {n + 1} {t} - - - ))} -
-
- -
-
- {/* CARD 1 */} -
- -
-
- - -
Total active mobile and broadband subscribers
-
-
- - -
-
- {i.region === 'custom' && ( -
- -
- $ - -
-
Source: TeleGeography IP transit pricing. Use your actual wholesale price for the most accurate result.
-
- )} -
- -
- {( - [ - ['cautious', 'Cautious', 15], - ['expected', 'Expected', 37], - ['optimistic', 'Optimistic', 80], - ] as const - ).map(([k, t, kb]) => ( - - ))} -
-
- Based on BlackDice customer data: 8,000 blocks/subscriber/month across adverts, trackers, malware and phishing. Traffic per block varies by - mix. Lead with Expected, show Cautious as the proven floor. Source: BlackDice internal methodology, September 2026. -
-
-
- - {/* CARD 2 */} -
- -
-
- - -
Industry average: 15–25 calls per 1,000 subs/month
-
-
- -
- $ - -
-
Telecoms average: $5–$15 per call
-
-
-
- -
{i.securityPct}%
- -
- 5% - 60% -
-
- BlackDice blocks malware, phishing and advert-hammering: the main sources of unexplained slow device complaints and failed connection - calls. Adjust to reflect your own support call categorisation. -
-
-
- - {/* CARD 3 */} -
- -
-
- -
- $ - -
-
Average revenue per user per month
-
-
- -
- - % -
-
Annual subscriber churn as a percentage
-
-
-
- How this is calculated: Network protection is associated with a 0.3–0.6% reduction in - annual churn (customers are less likely to blame their operator for bad experiences caused by malware, fraud calls and ad-hammered devices). - Each retained subscriber is worth ARPU × 12 months. -
-
- - {/* CARD 4 */} -
- -
- Malware and tracker traffic consists of millions of tiny connections rather than large downloads. The stateful connection-tracking equipment - that handles this is expensive to run and scale. Reducing junk connections typically lowers utilisation by 2–4%, deferring capacity upgrades. -
-
- -
- $ - -
-
Leave blank to exclude this category from your total
-
-
- - {/* CARD 5 */} -
- -
-
- - -
-
- -
${Math.round(ddosCostFromSlider(i.ddosSlider) / 1000)}K per incident
- -
- $408K - $1.2M -
-
-
-
Industry range $408K–$1.2M per incident (Forrester / Ponemon Institute). Results show the full low–high range regardless of this setting.
-
-
- - {/* RESULTS */} -
-
-
-
-

Estimated annual savings

-

Updates in real time as you enter your figures

-
-
-
-
Total potential savings
-
- {r.complete ? ( - <> - {fmt(r.total.lo)} - to - {fmt(r.total.hi)} - - ) : ( - — - )} -
-
{r.complete ? 'estimated annual savings range' : 'Enter your network details above'}
-
- -
- {rows.map(([k, dot, name, empty]) => { - const txt = fmtRange((r as any)[k].lo, (r as any)[k].hi) - return ( -
- -
-
{name}
-
{txt ? {txt} : {empty}}
-
-
- ) - })} -
- -
- -
- Bandwidth -
- 8,000 blocks/subscriber/month (BlackDice customer data) -
- Traffic per block: 15 KB (cautious) / 37 KB (expected) / 80 KB (optimistic) -
- Regional pricing: TeleGeography IP transit pricing, Q2 2026 -
- Busy-hour factor: 2.5× daily average (standard mobile) -
-
- Support calls -
- Reduction rate: 60–70% of security-related calls eliminated -
- Industry call volume: 15–25 calls per 1,000 subs/month -
- Average call cost: $5–$15 (telecoms industry) -
-
- Churn -
- Protection-linked churn reduction: 0.3–0.6% annually -
- McKinsey B2B Telco Survey 2025; GSMA Intelligence 2024 -
-
- Network equipment -
- Junk traffic reduction lowers equipment utilisation by 2–4% -
-
- DDoS -
- $408K–$1.2M per incident (Forrester / Ponemon Institute) -
-
- All figures are indicative. Actual savings will vary by network architecture, traffic mix, and existing controls. -
-
-
-
-
-
- -
- Important: This calculator provides indicative estimates based on BlackDice internal customer data, TeleGeography IP transit - pricing (Q2 2026), the Communications Fraud Control Association, Forrester Research, Ponemon Institute, McKinsey B2B Telco Survey 2025, and GSMA - Intelligence. Bandwidth savings represent capacity the operator never has to carry, not a guaranteed reduction in existing contracted wholesale - costs. Figures should be used as a starting point for commercial conversations, not as a guarantee of savings. Operator-specific results will - depend on network architecture, traffic mix, subscriber behaviour, and existing security controls. -
- - {r.complete && ( -
-
-

Send these results to your team

- {leadState === 'sent' ? ( -

Thanks — your results have been recorded. We'll follow up shortly.

- ) : ( -
- setLead((s) => ({ ...s, name: e.target.value }))} - /> - setLead((s) => ({ ...s, email: e.target.value }))} - /> - setLead((s) => ({ ...s, company: e.target.value }))} - /> - -
- )} - {leadState === 'error' &&

Something went wrong — please try again.

} -
-
- )} - -
-
-

Your personalised ROI slide

-

A clean, presentation-style summary of your operator's estimated annual saving across all five categories, ready to screenshot or share.

-

- {r.complete ? 'Your personalised slide is ready to view.' : 'Complete the calculator above to unlock your personalised slide.'} -

-
- -
- - {showSlide && r.complete && } -
-
- ) + return
{registrant ? : }
} diff --git a/src/site/roi/RoiCalculatorTab.tsx b/src/site/roi/RoiCalculatorTab.tsx new file mode 100644 index 0000000..864a671 --- /dev/null +++ b/src/site/roi/RoiCalculatorTab.tsx @@ -0,0 +1,493 @@ +import { useEffect, useMemo, useState } from 'react' +import { + calculate, + ddosCostFromSlider, + fmt, + fmtRange, + formatForDeck, + INPUTS_KEY, + loadInputs, + REGIONS, + regionLabel, +} from './calc.js' +import { buildPersonalisedDeck, prefetchTemplate, triggerDownload } from './pptxReport.js' +import { submitLead } from '../../cms/api' +import type { Registrant } from './RoiLanding' + +const Icon = { + globe: ( + + + + + ), + phone: ( + + + + ), + users: ( + + + + + + ), + server: ( + + + + + + + ), + shield: ( + + + + ), + download: ( + + + + + + ), +} + +function CardHeader({ + icon, + green, + num, + title, + subtitle, +}: { + icon: React.ReactNode + green?: boolean + num: string + title: string + subtitle: string +}) { + return ( +
+
{icon}
+
+
{num}
+
{title}
+
{subtitle}
+
+
+ ) +} + +const rangePct = (val: number, min: number, max: number) => `${(((val - min) / (max - min)) * 100).toFixed(1)}%` + +/** Plain-text summary of a visitor's inputs and results, stored as the enquiry's message. */ +function buildRoiSummary(i: Record, r: ReturnType) { + return [ + `Active subscribers: ${i.subs ? Number(i.subs).toLocaleString('en-US') : '—'}`, + `Region: ${i.region === 'custom' ? `Custom ($${i.customPrice || 0}/GB)` : regionLabel(i.region)}`, + `Bandwidth scenario: ${i.scenario}`, + `Support calls per 1,000 subs/month: ${i.callsPer1000}`, + `Average cost per call: $${i.callCost}`, + `Security-related calls: ${i.securityPct}%`, + `Monthly ARPU: ${i.arpu ? `$${i.arpu}` : '—'}`, + `Annual churn rate: ${i.churn ? `${i.churn}%` : '—'}`, + `Annual network infrastructure OpEx: ${i.netOpex ? `$${Number(i.netOpex).toLocaleString('en-US')}` : '—'}`, + `DDoS incidents per year: ${i.ddos || 0}`, + '', + `Total estimated annual savings: ${fmtRange(r.total.lo, r.total.hi) || '—'}`, + ` Bandwidth savings: ${fmtRange(r.bw.lo, r.bw.hi) || '—'}`, + ` Support call reduction: ${fmtRange(r.calls.lo, r.calls.hi) || '—'}`, + ` Churn reduction: ${fmtRange(r.churn.lo, r.churn.hi) || '—'}`, + ` Network equipment: ${fmtRange(r.equip.lo, r.equip.hi) || '—'}`, + ` DDoS avoided costs: ${fmtRange(r.ddos.lo, r.ddos.hi) || '—'}`, + ].join('\n') +} + +export default function RoiCalculatorTab({ registrant, active }: { registrant: Registrant; active: boolean }) { + const [i, setI] = useState(() => loadInputs(registrant)) + const [showAssump, setShowAssump] = useState(false) + const [report, setReport] = useState<{ state: 'idle' | 'busy' | 'done' | 'error'; msg: string }>({ state: 'idle', msg: '' }) + + const update = (patch: Record) => { + setI((s: typeof i) => ({ ...s, ...patch, touched: true })) + setReport((s) => (s.state === 'busy' ? s : { state: 'idle', msg: '' })) + } + const set = (k: string) => (e: React.ChangeEvent) => update({ [k]: e.target.value }) + + const r = useMemo(() => calculate(i), [i]) + + // Remember inputs for this visitor (survives refresh) + useEffect(() => { + try { + localStorage.setItem(INPUTS_KEY, JSON.stringify(i)) + } catch { + /* storage unavailable */ + } + }, [i]) + + // Warm the template cache while the user fills in the calculator + useEffect(() => { + if (active) prefetchTemplate().catch(() => {}) + }, [active]) + + const rows: [string, string, string, string][] = [ + ['bw', 'dot-grey', '① Bandwidth savings', 'Enter subscriber count and region'], + ['calls', 'dot-green', '② Support call reduction', 'Enter subscriber count and call volume'], + ['churn', 'dot-teal', '③ Churn reduction', 'Enter ARPU and churn rate'], + ['equip', 'dot-blue', '④ Network equipment', 'Enter infrastructure OpEx (optional)'], + ['ddos', 'dot-orange', '⑤ DDoS avoided costs', 'No incidents entered'], + ] + + async function downloadReport() { + if (!r.complete || report.state === 'busy') return + setReport({ state: 'busy', msg: 'Building your personalised deck…' }) + + const formatted = formatForDeck(i, r, registrant) + const company = registrant?.company || 'Your Company' + + submitLead({ + form: 'roi-toolkit-report', + name: `${registrant.first} ${registrant.last}`.trim(), + email: registrant.email, + company, + page: '/roi-calculator', + message: buildRoiSummary(i, r), + }).catch(() => {}) + + try { + const blob = await buildPersonalisedDeck(formatted, { company }) + triggerDownload(blob, `BlackDice_ROI_Report_${company.replace(/[^a-z0-9]+/gi, '_')}.pptx`) + setReport({ state: 'done', msg: 'Your personalised report has downloaded. Your figures are on slide 12.' }) + } catch (err) { + console.error(err) + setReport({ state: 'error', msg: "Sorry, we couldn't build your report. Please try again in a moment." }) + } + } + + const reportNote = report.msg || (r.complete ? 'Your personalised report is ready to download.' : 'Complete the calculator above to unlock your personalised report.') + + return ( +
+
+

Network Protection ROI Calculator

+

Enter your operator data below. Results update in real time. Once complete, download your personalised report.

+
+ +
+
+ Savings by section + {['Bandwidth', 'Support calls', 'Churn reduction', 'Network equipment', 'DDoS (optional)'].map((t, n) => ( + + {n > 0 && ›} + + {n + 1} {t} + + + ))} +
+
+ +
+
+ {/* CARD 1 */} +
+ +
+
+ + +
Total active mobile and broadband subscribers
+
+
+ + +
+
+ {i.region === 'custom' && ( +
+ +
+ $ + +
+
Source: TeleGeography IP transit pricing. Use your actual wholesale price for the most accurate result.
+
+ )} +
+ +
+ {( + [ + ['cautious', 'Cautious', 15], + ['expected', 'Expected', 37], + ['optimistic', 'Optimistic', 80], + ] as const + ).map(([k, t, kb]) => ( + + ))} +
+
+ Based on BlackDice customer data: 8,000 blocks/subscriber/month across adverts, trackers, malware and phishing. Traffic per block varies by + mix. Lead with Expected, show Cautious as the proven floor. Source: BlackDice internal methodology, September 2026. +
+
+
+ + {/* CARD 2 */} +
+ +
+
+ + +
Industry average: 15–25 calls per 1,000 subs/month
+
+
+ +
+ $ + +
+
Telecoms average: $5–$15 per call
+
+
+
+ +
{i.securityPct}%
+ +
+ 5% + 60% +
+
+ BlackDice blocks malware, phishing and advert-hammering: the main sources of unexplained slow device complaints and failed connection + calls. Adjust to reflect your own support call categorisation. +
+
+
+ + {/* CARD 3 */} +
+ +
+
+ +
+ $ + +
+
Average revenue per user per month
+
+
+ +
+ + % +
+
Annual subscriber churn as a percentage
+
+
+
+ How this is calculated: Network protection is associated with a 0.3–0.6% reduction in + annual churn (customers are less likely to blame their operator for bad experiences caused by malware, fraud calls and ad-hammered devices). + Each retained subscriber is worth ARPU × 12 months. +
+
+ + {/* CARD 4 */} +
+ +
+ Malware and tracker traffic consists of millions of tiny connections rather than large downloads. The stateful connection-tracking equipment + that handles this is expensive to run and scale. Reducing junk connections typically lowers utilisation by 2–4%, deferring capacity upgrades. +
+
+ +
+ $ + +
+
Leave blank to exclude this category from your total
+
+
+ + {/* CARD 5 */} +
+ +
+
+ + +
+
+ +
${Math.round(ddosCostFromSlider(i.ddosSlider) / 1000)}K per incident
+ +
+ $408K + $1.2M +
+
+
+
Industry range $408K–$1.2M per incident (Forrester / Ponemon Institute). Results show the full low–high range regardless of this setting.
+
+
+ + {/* RESULTS */} +
+
+
+
+

Estimated annual savings

+

Updates in real time as you enter your figures

+
+
+
+
Total potential savings
+
+ {r.complete ? ( + <> + {fmt(r.total.lo)} + to + {fmt(r.total.hi)} + + ) : ( + — + )} +
+
{r.complete ? 'estimated annual savings range' : 'Enter your network details above'}
+
+ +
+ {rows.map(([k, dot, name, empty]) => { + const txt = fmtRange((r as any)[k].lo, (r as any)[k].hi) + return ( +
+ +
+
{name}
+
{txt ? {txt} : {empty}}
+
+
+ ) + })} +
+ +
+ +
+ Bandwidth +
+ 8,000 blocks/subscriber/month (BlackDice customer data) +
+ Traffic per block: 15 KB (cautious) / 37 KB (expected) / 80 KB (optimistic) +
+ Regional pricing: TeleGeography IP transit pricing, Q2 2026 +
+ Busy-hour factor: 2.5× daily average (standard mobile) +
+
+ Support calls +
+ Reduction rate: 60–70% of security-related calls eliminated +
+ Industry call volume: 15–25 calls per 1,000 subs/month +
+ Average call cost: $5–$15 (telecoms industry) +
+
+ Churn +
+ Protection-linked churn reduction: 0.3–0.6% annually +
+ McKinsey B2B Telco Survey 2025; GSMA Intelligence 2024 +
+
+ Network equipment +
+ Junk traffic reduction lowers equipment utilisation by 2–4% +
+
+ DDoS +
+ $408K–$1.2M per incident (Forrester / Ponemon Institute) +
+
+ All figures are indicative. Actual savings will vary by network architecture, traffic mix, and existing controls. +
+
+
+
+
+
+ +
+ Important: This calculator provides indicative estimates based on BlackDice internal customer data, TeleGeography IP transit + pricing (Q2 2026), the Communications Fraud Control Association, Forrester Research, Ponemon Institute, McKinsey B2B Telco Survey 2025, and GSMA + Intelligence. Bandwidth savings represent capacity the operator never has to carry, not a guaranteed reduction in existing contracted wholesale + costs. Figures should be used as a starting point for commercial conversations, not as a guarantee of savings. Operator-specific results will + depend on network architecture, traffic mix, subscriber behaviour, and existing security controls. +
+ +
+
+

Download your personalised ROI report

+

A branded PowerPoint deck with your operator's estimated annual saving across all five categories, ready to share with your finance or commercial team.

+

+ {reportNote} +

+
+ +
+
+ ) +} diff --git a/src/site/roi/RoiDeckViewer.tsx b/src/site/roi/RoiDeckViewer.tsx new file mode 100644 index 0000000..b269229 --- /dev/null +++ b/src/site/roi/RoiDeckViewer.tsx @@ -0,0 +1,109 @@ +import { useEffect, useRef, useState } from 'react' +import { calculate, formatForDeck, loadInputs } from './calc.js' +import { buildPersonalisedDeck, getExampleDeck, prefetchTemplate, triggerDownload } from './pptxReport.js' +import type { Registrant } from './RoiLanding' + +const SLIDE_COUNT = 15 +const slides = Array.from({ length: SLIDE_COUNT }, (_, i) => `/roi/slides/slide-${String(i + 1).padStart(2, '0')}.jpg`) + +export default function RoiDeckViewer({ active, registrant }: { active: boolean; registrant: Registrant }) { + const [cur, setCur] = useState(0) + const [busy, setBusy] = useState(false) + const thumbsRef = useRef(null) + const go = (n: number) => setCur(Math.max(0, Math.min(SLIDE_COUNT - 1, n))) + + async function downloadDeck() { + if (busy) return + setBusy(true) + try { + const i: any = loadInputs(registrant) + const r = calculate(i) + const values = formatForDeck(i, r, registrant) + const meta = { company: registrant?.company || 'Your Company' } + // Slide 3 shows their device count (from the form) straight away. Slide 12 keeps the + // example figures until they've entered their own numbers in the calculator. + const blob = i.touched && r.complete ? await buildPersonalisedDeck(values, meta) : values.subs ? await buildPersonalisedDeck(values, meta, { roi: false }) : await getExampleDeck() + triggerDownload(blob, 'BlackDice_Turn_Network_Protection_Strategy_Deck.pptx') + } catch (err) { + console.error(err) + } finally { + setBusy(false) + } + } + + // Warm the template cache while the deck is being viewed + useEffect(() => { + if (active) prefetchTemplate().catch(() => {}) + }, [active]) + + useEffect(() => { + if (!active) return + const onKey = (e: KeyboardEvent) => { + const tag = (e.target as HTMLElement)?.tagName + if (['INPUT', 'SELECT', 'TEXTAREA'].includes(tag)) return + if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { + e.preventDefault() + setCur((c) => Math.min(SLIDE_COUNT - 1, c + 1)) + } + if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { + e.preventDefault() + setCur((c) => Math.max(0, c - 1)) + } + } + document.addEventListener('keydown', onKey) + return () => document.removeEventListener('keydown', onKey) + }, [active]) + + useEffect(() => { + const thumb = thumbsRef.current?.children[cur] as HTMLElement | undefined + thumb?.scrollIntoView({ block: 'nearest', inline: 'center', behavior: 'smooth' }) + }, [cur]) + + // Preload the next slide for snappy navigation + useEffect(() => { + if (cur + 1 < SLIDE_COUNT) new Image().src = slides[cur + 1] + }, [cur]) + + return ( +
+
+
+
Turn Network Protection into Competitive Advantage
+
15 slides · Use arrow keys or click to navigate · Click thumbnails to jump to any slide
+
+ +
+ +
+
+ + {`Slide + +
+
+
+ {cur + 1} / {SLIDE_COUNT} +
+
+ {slides.map((src, i) => ( + + ))} +
+
+
+
+ ) +} diff --git a/src/site/roi/RoiLanding.tsx b/src/site/roi/RoiLanding.tsx new file mode 100644 index 0000000..a197ce8 --- /dev/null +++ b/src/site/roi/RoiLanding.tsx @@ -0,0 +1,258 @@ +import { useState } from 'react' +import { fmtCount } from './calc.js' + +const REGIONS = ['United Kingdom', 'Western Europe', 'North America', 'Latin America', 'Sub-Saharan Africa', 'Asia Pacific', 'Middle East', 'Other'] +// "The devices on your network" dropdown. `deck` is how the choice appears as the big +// number on slide 3; the label is what's recorded as the operator's subscriber base. +const DEVICE_OPTIONS = [ + { value: 'Under 500k', deck: '<500k' }, + { value: '500k to 2M', deck: '500k–2m' }, + { value: '2M to 10M', deck: '2m–10m' }, + { value: '10M to 50M', deck: '10m–50m' }, + { value: '50M+', deck: '50m+' }, +] +const EXACT = 'exact' + +// Common free-mail domains — the form asks for a *business* email. +const BLOCK_FREE_MAIL = true +const FREE_MAIL = /@(gmail|googlemail|yahoo|hotmail|outlook|live|aol|icloud|me|proton|protonmail|gmx|mail|yandex)\./i + +export type Registrant = { + first: string + last: string + company: string + title: string + email: string + region: string + subscribers: string + deviceLabel: string +} + +function WhatYouGet() { + return ( +
+
+
Inside the toolkit
+
Two tools. One clear commercial case.
+

+ Built for operators evaluating network-level malicious traffic blocking, from initial business case to personalised ROI. +

+
+
+
+ Strategy Deck +
+
+
Strategy Deck · 15 Slides
+

Turn network protection into competitive advantage

+

+ A concise, evidence-led deck that frames the commercial cost of malicious traffic and makes the case for operator-level + blocking, ready to share internally or use in a board presentation. +

+
    +
  • Global fraud context with GSMA and McKinsey data
  • +
  • Five commercial savings categories explained
  • +
  • Discover three BlackDice protection deployment paths
  • +
  • ROI model and commercial summary
  • +
+
+
+ +
+
+
+
① Your network
+
+
Active subscribers
+
Region / pricing
+
+
+ ② Support calls +
+
+
Calls per 1,000/mo
+
Cost per call
+
+
+
Estimated annual saving
+
Calculate your numbers
+
+
+
+
+
Interactive Calculator
+

Network protection ROI calculator

+

+ Enter your operator data: subscriber base, support call volume, ARPU and churn rate, and get a personalised annual saving + across five categories with a downloadable results report. +

+
    +
  • Bandwidth savings by region (TeleGeography data)
  • +
  • Support call reduction based on your actual call cost
  • +
  • Churn reduction and ARPU protection
  • +
  • DDoS avoided costs and equipment savings
  • +
+
+
+
+
+
+ ) +} + +const EMPTY = { first: '', last: '', company: '', title: '', email: '', region: '', devices: '', subscribers: '', website: '' } + +function RegistrationForm({ onRegister }: { onRegister: (reg: Registrant) => void | Promise }) { + const [f, setF] = useState(EMPTY) + const [error, setError] = useState('') + const [busy, setBusy] = useState(false) + const set = (k: keyof typeof EMPTY) => (e: React.ChangeEvent) => setF((s) => ({ ...s, [k]: e.target.value })) + + async function handleSubmit(e: React.FormEvent) { + e.preventDefault() + const t = Object.fromEntries(Object.entries(f).map(([k, v]) => [k, v.trim()])) as typeof EMPTY + + if (!t.first || !t.last || !t.company || !t.title || !t.email) { + return setError('Please complete all required fields before continuing.') + } + if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t.email)) { + return setError('Please enter a valid business email address.') + } + if (BLOCK_FREE_MAIL && FREE_MAIL.test(t.email)) { + return setError('Please use your business email address rather than a personal one.') + } + // Device count: a band from the dropdown, or an exact number + let exact = 0 + if (t.devices === EXACT) { + exact = Math.round(parseFloat(t.subscribers.replace(/[,\s]/g, '')) || 0) + if (exact <= 0) return setError('Please enter the number of devices on your network, e.g. 5,000,000.') + } + const band = DEVICE_OPTIONS.find((o) => o.value === t.devices) + setError('') + + // Honeypot: bots fill the hidden "website" field. Silently drop the submission. + if (t.website) return + const { website: _hp, devices: _d, ...lead } = t + setBusy(true) + await onRegister({ + ...lead, + subscribers: exact ? String(exact) : '', // exact count (pre-fills the calculator) + deviceLabel: band ? band.deck : fmtCount(exact), // big number on slide 3 + }) + setBusy(false) + } + + return ( +
+
+
+
Get free access to the toolkit
+

Complete the form below to view and download the strategy deck and unlock the personalised ROI calculator.

+ {error && ( + + )} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + {f.devices === EXACT && ( + + )} + Shown on slide 3 of your strategy deck. An exact number is also pre-filled in the ROI calculator. +
+ {/* honeypot — hidden from humans */} + +
+ +

+ By submitting this form you agree to BlackDice's{' '} + + Privacy Policy + + . We will not share your details with third parties. +

+
+
+
+
+ ) +} + +export default function RoiLanding({ onRegister }: { onRegister: (reg: Registrant) => void | Promise }) { + return ( +
+ + +
+ ) +} diff --git a/src/site/roi/RoiSlide.tsx b/src/site/roi/RoiSlide.tsx deleted file mode 100644 index 86d21dc..0000000 --- a/src/site/roi/RoiSlide.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { useRef, useState } from 'react' -import './roiSlide.css' -import hexMotif from './hexMotif.svg?raw' - -type DeckValues = { - total: string - bw: string - calls: string - churn: string - equip: string - ddos: string - subs: string -} - -type Range = { lo: number; hi: number } -type Results = { - bw: Range - calls: Range - churn: Range - equip: Range - ddos: Range -} - -// Fixed categorical order — validated (CVD + contrast) against this card's dark -// teal surface via the data-viz skill's validator. Never reorder or cycle in a 6th. -const CATS: { key: keyof DeckValues & keyof Results; label: string; color: string }[] = [ - { key: 'bw', label: 'Bandwidth savings', color: '#3987e5' }, - { key: 'calls', label: 'Support call reduction', color: '#d95926' }, - { key: 'churn', label: 'Churn reduction', color: '#199e70' }, - { key: 'equip', label: 'Network equipment', color: '#c98500' }, - { key: 'ddos', label: 'DDoS avoided costs', color: '#d55181' }, -] - -export default function RoiSlide({ values, results }: { values: DeckValues; results: Results }) { - const today = new Date().toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' }) - - const mids = CATS.map((c) => Math.max(0, (results[c.key].lo + results[c.key].hi) / 2)) - const totalMid = mids.reduce((a, b) => a + b, 0) - - const cardRef = useRef(null) - const [downloading, setDownloading] = useState(false) - - const download = async () => { - if (!cardRef.current || downloading) return - setDownloading(true) - try { - const { default: html2canvas } = await import('html2canvas') - const canvas = await html2canvas(cardRef.current, { backgroundColor: null, scale: 2 }) - const a = document.createElement('a') - a.download = `blackdice-roi-savings-${new Date().toISOString().slice(0, 10)}.png` - a.href = canvas.toDataURL('image/png') - a.click() - } catch { - /* best effort — leave the slide visible either way */ - } finally { - setDownloading(false) - } - } - - return ( -
-
- -
-
-
- BlackDice - {today} -
-
Network protection ROI
-

Total estimated annual savings

-
{values.total}
- - {totalMid > 0 && ( -
- {CATS.map((c, idx) => - mids[idx] > 0 ? ( -
- ) : null, - )} -
- )} - -
- {CATS.map((c) => ( -
-
- - {values[c.key]} -
-
{c.label}
-
- ))} -
-
- {values.subs !== '—' ? `${values.subs} subscribers` : 'Operator estimate'} - BlackDice Cyber · Network Protection ROI Calculator -
-
-
-
- ) -} diff --git a/src/site/roi/RoiToolkit.tsx b/src/site/roi/RoiToolkit.tsx new file mode 100644 index 0000000..b07c693 --- /dev/null +++ b/src/site/roi/RoiToolkit.tsx @@ -0,0 +1,61 @@ +import { useState } from 'react' +import RoiDeckViewer from './RoiDeckViewer' +import RoiCalculatorTab from './RoiCalculatorTab' +import type { Registrant } from './RoiLanding' + +export default function RoiToolkit({ registrant, onReset }: { registrant: Registrant; onReset: () => void }) { + const [tab, setTab] = useState<'deck' | 'calc'>('deck') + + return ( +
+
+
+
+ + + +
+
+

Welcome {registrant.first}. You now have full access to the operator ROI toolkit.

+

+ Use the tabs below to view the strategy deck online or calculate your personalised ROI. + +

+
+
+
+ +
+
+ + +
+
+ + {/* Both tabs stay mounted so calculator inputs survive tab switches */} +
+ +
+
+ +
+
+ ) +} diff --git a/src/site/roi/calc.js b/src/site/roi/calc.js index 0447c2b..f4c598b 100644 --- a/src/site/roi/calc.js +++ b/src/site/roi/calc.js @@ -54,6 +54,7 @@ export const DEFAULT_INPUTS = { netOpex: '', ddos: '0', ddosSlider: 50, + touched: false, }; const num = (x) => parseFloat(x) || 0; @@ -142,28 +143,61 @@ export function fmtRange(lo, hi, sep = ' – ') { // ── Shared with the deck-building code ── export const INPUTS_KEY = 'bd_roi_calc_inputs'; -/** Loads this visitor's calculator inputs, however the page was reached. */ -export function loadInputs() { +/** + * Loads this visitor's calculator inputs, however the page was reached. + * If they haven't entered a subscriber count yet, it is pre-filled from the + * "devices on your network" field on the registration form. + * `touched` is true once the visitor has changed anything in the calculator. + */ +export function loadInputs(registrant) { + let i = DEFAULT_INPUTS; try { - return { ...DEFAULT_INPUTS, ...JSON.parse(localStorage.getItem(INPUTS_KEY) || '{}') }; + i = { ...DEFAULT_INPUTS, ...JSON.parse(localStorage.getItem(INPUTS_KEY) || '{}') }; } catch { - return DEFAULT_INPUTS; + /* storage unavailable */ } + if (!i.subs && registrant?.subscribers) i = { ...i, subs: registrant.subscribers }; + return i; } /** Value written into the PowerPoint when a category has no data. */ export const NOT_INCLUDED = 'Not included'; const pptRange = (r) => fmtRange(r.lo, r.hi, ' to ') || NOT_INCLUDED; -/** Values written into the PowerPoint ROI + device-count slides. */ -export function formatForDeck(i, r) { +/** Deck house style: "$65k", "$3.60m", "$1.20bn" (lower-case, matching the example figures in the deck). */ +export function fmtDeck(n) { + const s = fmt(n); + return s && s.replace(/B$/, 'bn').replace(/M$/, 'm').replace(/K$/, 'k'); +} +const pptDeckRange = (r) => { + if (!fmt(r.lo) && !fmt(r.hi)) return NOT_INCLUDED; + if (r.lo === r.hi || !r.hi) return fmtDeck(r.lo); + return `${fmtDeck(r.lo)} to ${fmtDeck(r.hi)}`; +}; + +/** Subscriber count in the deck's big-number style: 25000000 → "25m", 5500000 → "5.5m", 850000 → "850k". */ +export function fmtCount(n) { + if (!n || n <= 0) return ''; + const short = (v, unit) => (v >= 100 ? Math.round(v) : parseFloat(v.toFixed(1))) + unit; + if (n >= 1e9) return short(n / 1e9, 'bn'); + if (n >= 1e6) return short(n / 1e6, 'm'); + if (n >= 1e3) return short(n / 1e3, 'k'); + return String(Math.round(n)); +} + +/** + * Values written into the PowerPoint ROI + device-count slides. + * @param registrant optional: if the calculator has no subscriber count, slide 3 falls back + * to the "devices on your network" choice from the registration form. + */ +export function formatForDeck(i, r, registrant) { return { - total: pptRange(r.total), - bw: pptRange(r.bw), - calls: pptRange(r.calls), - churn: pptRange(r.churn), - equip: pptRange(r.equip), - ddos: pptRange(r.ddos), - subs: i.subs ? Number(i.subs).toLocaleString('en-US') : '—', + total: pptDeckRange(r.total), + bw: pptDeckRange(r.bw), + calls: pptDeckRange(r.calls), + churn: pptDeckRange(r.churn), + equip: pptDeckRange(r.equip), + ddos: pptDeckRange(r.ddos), + subs: fmtCount(num(i.subs)) || registrant?.deviceLabel || '', }; } diff --git a/src/site/roi/hexMotif.svg b/src/site/roi/hexMotif.svg deleted file mode 100644 index dfbc2dc..0000000 --- a/src/site/roi/hexMotif.svg +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/site/roi/pptxReport.js b/src/site/roi/pptxReport.js new file mode 100644 index 0000000..a9d874e --- /dev/null +++ b/src/site/roi/pptxReport.js @@ -0,0 +1,95 @@ +// Builds the personalised ROI deck entirely in the browser: +// fetch template .pptx → patch the ROI slide XML → zip → download. +// +// The template is the strategy deck. Its ROI slide carries EXAMPLE figures, so the +// unmodified file doubles as the "example" deck for visitors who haven't used the +// calculator yet (see getExampleDeck). + +// JSZip is loaded on demand so it doesn't weigh down the first page load. +import { personaliseDeviceSlideXml, personaliseSlideXml } from './slideXml.js' + +export const DECK_URL = '/roi/deck/BlackDice_Strategy_Deck.pptx' +// The ROI slide ("Total estimate annual savings") — slide 12 in the deck. +const ROI_SLIDE = 'ppt/slides/slide12.xml' +// The stats slide ("Your customers are in the crosshairs") — slide 3: active subscribers go in the "DeviceCount" box. +const DEVICE_SLIDE = 'ppt/slides/slide3.xml' +const PPTX_MIME = 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + +let templatePromise = null + +/** Start downloading the template early (e.g. when the deck/calculator tab opens). */ +export function prefetchTemplate() { + if (!templatePromise) { + templatePromise = fetch(DECK_URL).then((r) => { + if (!r.ok) throw new Error(`Could not load deck template (${r.status})`) + return r.arrayBuffer() + }) + templatePromise.catch(() => (templatePromise = null)) // allow retry + } + return templatePromise +} + +/** + * @param {object} values { total, bw, calls, churn, equip, ddos, subs } — display strings + * @param {object} meta { company, date } + * @param {object} [opts] { roi: false } → leave slide 12's example figures alone and only + * personalise slide 3 (used before the visitor has run the calculator) + * @returns {Promise} + */ +export async function buildPersonalisedDeck(values, meta = {}, { roi = true } = {}) { + const buf = await prefetchTemplate() + const { default: JSZip } = await import('jszip') + const zip = await JSZip.loadAsync(buf) + + if (roi) { + const file = zip.file(ROI_SLIDE) + if (!file) throw new Error(`ROI slide not found in template (${ROI_SLIDE})`) + const xml = await file.async('string') + + // Keep the subtitle on one line: cap very long company names. + const co = meta.company && meta.company.length > 40 ? meta.company.slice(0, 39).trim() + '…' : meta.company + const prefix = co ? `Prepared for ${co} · ` : '' + const { xml: patched, replaced } = personaliseSlideXml(xml, values, prefix) + if (replaced === 0) throw new Error('ROI value boxes (TextBox 4, 10–14) not found on the ROI slide') + zip.file(ROI_SLIDE, patched) + } + + // Slide 3: the operator's active subscribers above "The device on your network". + const deviceFile = zip.file(DEVICE_SLIDE) + if (deviceFile) { + const dxml = await deviceFile.async('string') + const { xml: dpatched, replaced: dreplaced } = personaliseDeviceSlideXml(dxml, values.subs) + if (dreplaced) zip.file(DEVICE_SLIDE, dpatched) + } + + // Stamp document properties so the file is identifiable in the recipient's Files/SharePoint. + const core = zip.file('docProps/core.xml') + if (core && meta.company) { + const esc = (s) => s.replace(/&/g, '&').replace(//g, '>') + let c = await core.async('string') + const title = esc(`Network Protection ROI – ${meta.company}`) + c = /.*?<\/dc:title>/s.test(c) + ? c.replace(/.*?<\/dc:title>/s, `${title}`) + : c.replace('', `${title}`) + zip.file('docProps/core.xml', c) + } + + return zip.generateAsync({ type: 'blob', mimeType: PPTX_MIME, compression: 'DEFLATE' }) +} + +/** The deck exactly as published, with the example figures on the ROI slide. */ +export async function getExampleDeck() { + const buf = await prefetchTemplate() + return new Blob([buf], { type: PPTX_MIME }) +} + +export function triggerDownload(blob, filename) { + const url = URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = url + a.download = filename + document.body.appendChild(a) + a.click() + a.remove() + setTimeout(() => URL.revokeObjectURL(url), 10000) +} diff --git a/src/site/roi/roiCalculator.css b/src/site/roi/roiCalculator.css index 68a7b66..811e528 100644 --- a/src/site/roi/roiCalculator.css +++ b/src/site/roi/roiCalculator.css @@ -574,32 +574,6 @@ margin-top: 8px; } -/* Lead capture form */ -.roi-calc .roi-lead-form { - display: flex; - gap: 10px; - flex-wrap: wrap; - margin-top: 12px; -} -.roi-calc .roi-lead-form input { - flex: 1 1 160px; - padding: 10px 13px; - border: 1.5px solid #c8dde3; - border-radius: 8px; - font-family: 'Ubuntu', sans-serif; - font-size: 13px; - color: var(--roi-text); - background: var(--roi-white); - outline: none; - transition: border-color 0.2s, box-shadow 0.2s; -} -.roi-calc .roi-lead-form input:focus { - border-color: var(--roi-green); - box-shadow: 0 0 0 3px rgba(53, 184, 136, 0.15); -} -.roi-calc .roi-lead-form .report-dl-btn { - flex: 0 0 auto; -} @media (max-width: 960px) { .roi-calc .main { grid-template-columns: 1fr; @@ -615,3 +589,580 @@ align-items: flex-start; } } + +/* ═══════════════════════════════════════ + GATED TOOLKIT — registration landing, tabs, deck viewer + Ported from the BlackDice Operator ROI Toolkit. +═══════════════════════════════════════ */ + +/* "Inside the toolkit" explainer */ +.roi-calc .lp-what { + background: #f8fafb; + border: 1px solid #e2ecef; + border-radius: 14px; + padding: 48px 0; + margin-bottom: 32px; +} +.roi-calc .lp-what-inner { + max-width: 1000px; + margin: 0 auto; + padding: 0 32px; +} +.roi-calc .lp-section-label { + text-align: center; + font-size: 0.72rem; + font-weight: 700; + letter-spacing: 0.12em; + text-transform: uppercase; + color: var(--roi-green); + margin-bottom: 12px; +} +.roi-calc .lp-section-title { + text-align: center; + font-size: 1.5rem; + font-weight: 700; + color: var(--roi-teal); + margin-bottom: 8px; +} +.roi-calc .lp-section-sub { + text-align: center; + font-size: 0.92rem; + color: #556; + margin-bottom: 40px; +} +.roi-calc .lp-assets { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 24px; +} +.roi-calc .lp-asset-card { + background: white; + border: 1px solid #dde8eb; + border-radius: 12px; + overflow: hidden; + box-shadow: 0 2px 12px rgba(1, 59, 73, 0.06); +} +.roi-calc .lp-asset-preview { + background: var(--roi-teal); + padding: 24px 24px 0; + min-height: 210px; + overflow: hidden; +} +.roi-calc .lp-asset-preview-calc { + background: #f4f9fb; + padding: 20px 20px 0; + min-height: 210px; + border-bottom: 1px solid #dde8eb; +} +.roi-calc .lp-slide-thumb { + border-radius: 4px 4px 0 0; + width: 100%; + display: block; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); +} +.roi-calc .calc-mock { + background: white; + border-radius: 8px 8px 0 0; + padding: 16px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); +} +.roi-calc .calc-mock-header { + background: var(--roi-teal); + color: white; + padding: 10px 14px; + border-radius: 6px; + font-size: 0.75rem; + font-weight: 600; + margin-bottom: 10px; +} +.roi-calc .calc-mock-row { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 6px; + margin-bottom: 6px; +} +.roi-calc .calc-mock-field { + background: #f4f9fb; + border: 1px solid #dde; + border-radius: 4px; + padding: 7px 10px; + font-size: 0.7rem; + color: #667; +} +.roi-calc .calc-mock-result { + background: linear-gradient(135deg, var(--roi-teal), var(--roi-teal2)); + border-radius: 6px; + padding: 10px 14px; + margin-top: 8px; +} +.roi-calc .calc-mock-result-label { + font-size: 0.65rem; + color: var(--roi-lgrey); + margin-bottom: 2px; +} +.roi-calc .calc-mock-result-val { + font-size: 1.1rem; + font-weight: 700; + color: var(--roi-green); +} +.roi-calc .lp-asset-info { + padding: 24px; +} +.roi-calc .lp-asset-tag { + display: inline-block; + font-size: 0.65rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.1em; + color: var(--roi-green); + background: rgba(53, 184, 136, 0.1); + border: 1px solid rgba(53, 184, 136, 0.2); + padding: 3px 8px; + border-radius: 3px; + margin-bottom: 10px; +} +.roi-calc .lp-asset-info h3 { + font-size: 1.05rem; + font-weight: 700; + color: var(--roi-teal); + margin-bottom: 8px; +} +.roi-calc .lp-asset-info p { + font-size: 0.87rem; + color: #556; + line-height: 1.6; + margin-bottom: 16px; +} +.roi-calc .lp-asset-bullets { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 6px; +} +.roi-calc .lp-asset-bullets li { + font-size: 0.82rem; + color: #445; + display: flex; + align-items: flex-start; + gap: 8px; +} +.roi-calc .lp-asset-bullets li::before { + content: ''; + width: 6px; + height: 6px; + background: var(--roi-green); + border-radius: 50%; + margin-top: 5px; + flex-shrink: 0; +} + +/* Registration form */ +.roi-calc .lp-reg { + background: white; + border: 1px solid #dde8eb; + border-radius: 16px; +} +.roi-calc .lp-reg-inner { + max-width: 760px; + margin: 0 auto; +} +.roi-calc .lp-reg-box { + padding: 40px 48px; +} +.roi-calc .lp-reg-title { + font-size: 1.4rem; + font-weight: 700; + color: var(--roi-teal); + margin-bottom: 8px; + text-align: center; +} +.roi-calc .lp-reg-sub { + text-align: center; + font-size: 0.9rem; + color: #667; + margin-bottom: 32px; +} +.roi-calc .lp-form-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 16px; + margin-bottom: 16px; +} +.roi-calc .lp-form-full { + grid-column: 1 / -1; +} +.roi-calc .lp-field { + display: flex; + flex-direction: column; + gap: 5px; +} +.roi-calc .lp-field label { + font-size: 0.78rem; + font-weight: 600; + color: var(--roi-teal); + text-transform: uppercase; + letter-spacing: 0.05em; +} +.roi-calc .lp-field input, +.roi-calc .lp-field select { + padding: 11px 14px; + border: 1.5px solid #ccd8dc; + border-radius: 7px; + font-family: 'Ubuntu', sans-serif; + font-size: 0.9rem; + color: #334; + background: white; + outline: none; + transition: border-color 0.15s; +} +.roi-calc .lp-field input:focus, +.roi-calc .lp-field select:focus { + border-color: var(--roi-teal); + box-shadow: 0 0 0 3px rgba(1, 59, 73, 0.08); +} +.roi-calc .lp-field-hint { + font-size: 0.75rem; + color: #889; + line-height: 1.5; +} +.roi-calc .lp-submit { + width: 100%; + padding: 14px; + background: var(--roi-green); + color: white; + font-family: 'Ubuntu', sans-serif; + font-size: 1rem; + font-weight: 700; + border: none; + border-radius: 8px; + cursor: pointer; + margin-top: 8px; + transition: background 0.15s, transform 0.1s; +} +.roi-calc .lp-submit:hover { + background: var(--roi-green2); + transform: translateY(-1px); +} +.roi-calc .lp-submit:disabled { + opacity: 0.6; + cursor: wait; + transform: none; +} +.roi-calc .lp-privacy { + text-align: center; + font-size: 0.75rem; + color: #889; + margin-top: 16px; +} +.roi-calc .lp-privacy a { + color: var(--roi-mgrey); +} +.roi-calc #form-error { + background: #fff0f0; + border: 1px solid #fcc; + color: #c00; + padding: 10px 14px; + border-radius: 6px; + font-size: 0.85rem; + margin-bottom: 12px; +} +.roi-calc .lp-hp { + position: absolute !important; + left: -9999px !important; + width: 1px; + height: 1px; + overflow: hidden; +} + +/* Post-registration welcome bar */ +.roi-calc .access-welcome { + background: linear-gradient(135deg, var(--roi-teal) 0%, var(--roi-teal2) 100%); + border-radius: 14px 14px 0 0; +} +.roi-calc .access-welcome-inner { + padding: 22px 32px; + display: flex; + align-items: center; + gap: 20px; + width: 100%; +} +.roi-calc .access-welcome-icon { + width: 44px; + height: 44px; + background: rgba(53, 184, 136, 0.2); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} +.roi-calc .access-welcome-icon svg { + width: 22px; + height: 22px; + stroke: var(--roi-green); + fill: none; + stroke-width: 2.5; +} +.roi-calc .access-welcome-text h2 { + font-size: 1.05rem; + font-weight: 700; + color: white; + margin-bottom: 2px; +} +.roi-calc .access-welcome-text p { + font-size: 0.85rem; + color: var(--roi-lgrey); +} +.roi-calc .welcome-reset { + background: none; + border: none; + color: var(--roi-green); + font-family: 'Ubuntu', sans-serif; + font-size: 0.8rem; + cursor: pointer; + padding: 0; + margin-left: 6px; + text-decoration: underline; +} + +/* Tab navigation */ +.roi-calc .roi-tabs-bg { + background: #f4f8fa; +} +.roi-calc .lp-tabs { + padding: 0 32px; + display: flex; + gap: 0; + border-bottom: 2px solid #dde8eb; +} +.roi-calc .lp-tab { + padding: 14px 28px 14px; + font-family: 'Ubuntu', sans-serif; + font-size: 0.95rem; + font-weight: 600; + color: #778; + border: none; + background: none; + cursor: pointer; + border-bottom: 3px solid transparent; + margin-bottom: -2px; + transition: color 0.15s, border-color 0.15s; + display: flex; + align-items: center; + gap: 8px; +} +.roi-calc .lp-tab svg { + width: 16px; + height: 16px; + stroke: currentColor; + fill: none; + stroke-width: 2; +} +.roi-calc .lp-tab.active { + color: var(--roi-teal); + border-bottom-color: var(--roi-green); +} +.roi-calc .lp-tab:hover:not(.active) { + color: var(--roi-teal); +} +.roi-calc .lp-tab-content { + display: none; +} +.roi-calc .lp-tab-content.active { + display: block; +} + +/* Deck viewer */ +.roi-calc .deck-viewer-wrap { + padding: 32px; +} +.roi-calc .deck-viewer-top { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; + gap: 16px; + flex-wrap: wrap; +} +.roi-calc .deck-viewer-title { + font-size: 1.1rem; + font-weight: 700; + color: var(--roi-teal); +} +.roi-calc .deck-viewer-sub { + font-size: 0.85rem; + color: #667; + margin-top: 2px; +} +.roi-calc .deck-dl-btn { + display: inline-flex; + align-items: center; + gap: 8px; + background: var(--roi-teal); + color: white; + text-decoration: none; + border: none; + padding: 11px 22px; + border-radius: 8px; + font-family: 'Ubuntu', sans-serif; + font-weight: 700; + font-size: 0.88rem; + cursor: pointer; + transition: background 0.15s; + flex-shrink: 0; +} +.roi-calc .deck-dl-btn:hover:not(:disabled) { + background: var(--roi-teal2); +} +.roi-calc .deck-dl-btn:disabled { + opacity: 0.6; + cursor: wait; +} +.roi-calc .deck-dl-btn svg { + width: 15px; + height: 15px; + stroke: currentColor; + fill: none; + stroke-width: 2.5; +} +.roi-calc .slide-viewer { + background: #1a1a2e; + border-radius: 12px; + overflow: hidden; + box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3); +} +.roi-calc .slide-display { + position: relative; + background: #111; + display: flex; + align-items: center; + justify-content: center; + min-height: 400px; +} +.roi-calc .slide-display img { + width: 100%; + max-height: 600px; + object-fit: contain; + display: block; +} +.roi-calc .slide-nav-btn { + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 44px; + height: 44px; + background: rgba(0, 0, 0, 0.55); + color: white; + border: 1px solid rgba(255, 255, 255, 0.15); + border-radius: 50%; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + transition: background 0.15s; + z-index: 2; + font-family: 'Ubuntu', sans-serif; + font-size: 1.1rem; +} +.roi-calc .slide-nav-btn:hover { + background: rgba(0, 0, 0, 0.8); +} +.roi-calc .slide-nav-btn.prev { + left: 14px; +} +.roi-calc .slide-nav-btn.next { + right: 14px; +} +.roi-calc .slide-nav-btn:disabled { + opacity: 0.25; + cursor: default; +} +.roi-calc .slide-controls { + background: #13131f; + padding: 14px 20px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 16px; +} +.roi-calc .slide-counter { + font-size: 0.85rem; + font-weight: 600; + color: #aaa; + min-width: 60px; +} +.roi-calc .slide-thumbs { + display: flex; + gap: 6px; + overflow-x: auto; + padding: 4px 0; + flex: 1; + justify-content: center; + scrollbar-width: thin; + scrollbar-color: #444 #13131f; +} +.roi-calc .slide-thumb-btn { + width: 52px; + height: 32px; + flex-shrink: 0; + border-radius: 3px; + overflow: hidden; + cursor: pointer; + border: 2px solid transparent; + padding: 0; + transition: border-color 0.15s, opacity 0.15s; + opacity: 0.5; +} +.roi-calc .slide-thumb-btn.active { + border-color: var(--roi-green); + opacity: 1; +} +.roi-calc .slide-thumb-btn:hover { + opacity: 0.85; +} +.roi-calc .slide-thumb-btn img { + width: 100%; + height: 100%; + object-fit: cover; + display: block; +} + +/* Calculator tab, inside the gated toolkit, needs its own padding (no longer the + outermost element — rank-bar/disclaimer no longer need the alignment overrides + the ungated page used). */ +.roi-calc .calc-tab-wrap { + padding: 32px; +} +.roi-calc .report-error { + color: #c00; +} +.roi-calc .report-dl-btn.busy { + cursor: wait; +} + +@media (max-width: 900px) { + .roi-calc .lp-what-inner { + padding: 0 20px; + } + .roi-calc .lp-assets { + grid-template-columns: 1fr; + } + .roi-calc .lp-form-grid { + grid-template-columns: 1fr; + } + .roi-calc .lp-reg-box { + padding: 28px 24px; + } + .roi-calc .lp-tabs { + padding: 0 20px; + } + .roi-calc .deck-viewer-wrap, + .roi-calc .calc-tab-wrap { + padding: 20px; + } + .roi-calc .access-welcome-inner { + padding: 18px 20px; + } +} diff --git a/src/site/roi/roiSlide.css b/src/site/roi/roiSlide.css deleted file mode 100644 index 0af3a46..0000000 --- a/src/site/roi/roiSlide.css +++ /dev/null @@ -1,225 +0,0 @@ -/* ROI slide — a presentation-style summary card shown instead of a PPTX download. - Scoped under .roi-slide so it shares nothing with the rest of the site's CSS. */ - -.roi-slide { - --rs-teal: #013b49; - --rs-teal2: #0e4f63; - --rs-teal3: #1a6070; - --rs-green: #35b888; - --rs-lgrey: #b0c8ce; - --rs-mgrey: #6b9ba8; - margin-top: 20px; - display: flex; - justify-content: center; -} - -.roi-slide-card-wrap { - position: relative; - width: 100%; - max-width: 860px; -} - -.roi-slide-download { - position: absolute; - top: -14px; - right: -14px; - z-index: 2; - display: inline-flex; - align-items: center; - justify-content: center; - width: 34px; - height: 34px; - border-radius: 50%; - border: 1px solid rgba(255, 255, 255, 0.25); - background: var(--rs-teal2); - box-shadow: 0 4px 14px rgba(1, 59, 73, 0.4); - color: #fff; - cursor: pointer; - transition: background 0.15s, opacity 0.15s; -} -.roi-slide-download:hover:not(:disabled) { - background: var(--rs-teal3); -} -.roi-slide-download:disabled { - opacity: 0.5; - cursor: wait; -} -.roi-slide-download svg { - width: 16px; - height: 16px; - stroke: currentColor; - fill: none; - stroke-width: 2; - stroke-linecap: round; - stroke-linejoin: round; -} -.roi-slide-download:disabled svg { - animation: roi-slide-spin 0.8s linear infinite; -} -@keyframes roi-slide-spin { - to { - transform: rotate(360deg); - } -} - -.roi-slide-card { - width: 100%; - aspect-ratio: 16 / 9; - background: linear-gradient(135deg, var(--rs-teal) 0%, var(--rs-teal2) 60%, var(--rs-teal3) 100%); - border-radius: 16px; - box-shadow: 0 20px 60px rgba(1, 59, 73, 0.35); - padding: 32px 40px; - display: flex; - flex-direction: column; - font-family: 'Ubuntu', sans-serif; - color: #fff; - position: relative; - overflow: hidden; -} -.roi-slide-hex { - position: absolute; - top: 50%; - left: 50%; - width: 900px; - height: 900px; - transform: translate(-50%, -50%); - opacity: 0.5; - pointer-events: none; - z-index: 0; -} -.roi-slide-card::after { - content: ''; - position: absolute; - top: -30%; - right: -10%; - width: 55%; - height: 160%; - background: radial-gradient(circle, rgba(53, 184, 136, 0.18) 0%, transparent 70%); - pointer-events: none; -} - -.roi-slide-top { - display: flex; - align-items: center; - justify-content: space-between; - position: relative; - z-index: 1; -} -.roi-slide-logo { - height: 20px; - width: auto; - filter: brightness(0) invert(1); - opacity: 0.9; -} -.roi-slide-date { - font-size: 12px; - color: var(--rs-lgrey); -} - -.roi-slide-eyebrow { - margin-top: 20px; - font-size: 11px; - font-weight: 700; - letter-spacing: 0.14em; - text-transform: uppercase; - color: var(--rs-green); - position: relative; - z-index: 1; -} -.roi-slide-title { - margin-top: 4px; - font-size: clamp(18px, 2.4vw, 26px); - font-weight: 700; - color: #fff; - position: relative; - z-index: 1; -} -.roi-slide-total { - margin-top: 10px; - font-size: clamp(32px, 5vw, 52px); - font-weight: 700; - color: var(--rs-green); - letter-spacing: -0.5px; - line-height: 1.1; - position: relative; - z-index: 1; -} - -.roi-slide-bar { - margin-top: 16px; - display: flex; - gap: 2px; - height: 14px; - border-radius: 7px; - overflow: hidden; - position: relative; - z-index: 1; -} -.roi-slide-seg { - height: 100%; -} - -.roi-slide-grid { - margin-top: auto; - padding-top: 16px; - display: grid; - grid-template-columns: repeat(5, 1fr); - gap: 10px; - position: relative; - z-index: 1; -} -.roi-slide-cell { - background: rgba(255, 255, 255, 0.06); - border: 1px solid rgba(176, 200, 206, 0.15); - border-radius: 10px; - padding: 10px 8px; - text-align: center; -} -.roi-slide-cell-val { - display: flex; - align-items: center; - justify-content: center; - gap: 5px; - font-size: 13px; - font-weight: 700; - color: #fff; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -.roi-slide-dot { - width: 7px; - height: 7px; - border-radius: 50%; - flex-shrink: 0; -} -.roi-slide-cell-label { - margin-top: 3px; - font-size: 9.5px; - color: var(--rs-lgrey); - line-height: 1.3; -} - -.roi-slide-foot { - margin-top: 16px; - display: flex; - justify-content: space-between; - font-size: 11px; - color: var(--rs-mgrey); - position: relative; - z-index: 1; -} - -@media (max-width: 640px) { - .roi-slide-card { - aspect-ratio: auto; - padding: 24px; - } - .roi-slide-grid { - grid-template-columns: repeat(2, 1fr); - } - .roi-slide-foot { - flex-direction: column; - gap: 4px; - } -} diff --git a/src/site/roi/slideXml.js b/src/site/roi/slideXml.js new file mode 100644 index 0000000..61ab454 --- /dev/null +++ b/src/site/roi/slideXml.js @@ -0,0 +1,129 @@ +// Pure string-level edits to the deck XML (no DOM needed → testable in Node). +// +// ROI slide (slide 12): each result box is a named text box with two lines — +// a label ("1. Bandwidth savings") and a value. The launch deck (V4) ships with +// EXAMPLE values in those boxes (e.g. "$65k to $365k"); older decks used a +// "$XX to $XX" placeholder. Either way we overwrite the value line (the last +// text run in the box), so the plain deck shows the example and the +// personalised deck shows the operator's own figures. + +export const PLACEHOLDER = '$XX to $XX'; + +// Slide 3 ("Your customers are in the crosshairs") — third column. A big-number +// box named "DeviceCount" sits above "The device on your network" and shows the +// operator's active subscribers (example "25m" in the published deck). +export const DEVICE_COUNT_SHAPE = 'DeviceCount'; + +// Shape name in PowerPoint (Home → Arrange → Selection Pane) → result key +export const SHAPE_MAP = [ + ['TextBox 4', 'total'], + ['TextBox 10', 'bw'], + ['TextBox 11', 'calls'], + ['TextBox 12', 'churn'], + ['TextBox 13', 'equip'], + ['TextBox 14', 'ddos'], +]; +const SUBTITLE_SHAPE = 'TextBox 5'; + +export const escapeXml = (s) => + String(s).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, '''); +const unescapeXml = (s) => + s.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); + +const PH_TAG = `${escapeXml(PLACEHOLDER)}`; +const RUN_RE = /([^<]*)<\/a:t>/g; + +/** Return [start, end) of the element whose cNvPr name matches exactly. */ +function findShape(xml, name) { + const marker = `name="${escapeXml(name)}"`; + const at = xml.indexOf(marker); + if (at < 0) return null; + const start = xml.lastIndexOf('', at); + const end = xml.indexOf('', at); + if (start < 0 || end < 0) return null; + return [start, end + ''.length]; +} + +/** Replace the text of the LAST run in a shape segment (the value line). */ +function replaceLastRun(seg, text) { + const runs = [...seg.matchAll(RUN_RE)]; + if (runs.length < 2) return null; // need label + value + const last = runs[runs.length - 1]; + return seg.slice(0, last.index) + `${escapeXml(text)}` + seg.slice(last.index + last[0].length); +} + +/** + * @param {string} xml slide XML + * @param {object} values { total, bw, calls, churn, equip, ddos } — display strings + * @param {string} [subtitlePrefix] optional text prepended to the slide subtitle + * @returns {{xml: string, replaced: number}} + */ +export function personaliseSlideXml(xml, values, subtitlePrefix) { + let out = xml; + let replaced = 0; + const used = new Set(); + + // 1) by shape name — overwrite the value line (example figures or placeholder) + for (const [shape, key] of SHAPE_MAP) { + const r = findShape(out, shape); + if (!r) continue; + const next = replaceLastRun(out.slice(r[0], r[1]), values[key]); + if (next === null) continue; + out = out.slice(0, r[0]) + next + out.slice(r[1]); + replaced++; + used.add(key); + } + + // 2) fallback for renamed boxes in an older placeholder deck: fill any + // remaining "$XX to $XX" in document order. + if (out.includes(PH_TAG)) { + const order = SHAPE_MAP.map(([, k]) => k).filter((k) => !used.has(k)); + let i = 0; + out = out.split(PH_TAG).reduce((acc, part, idx) => { + if (idx === 0) return part; + const key = order[i++]; + replaced++; + return acc + `${escapeXml(key ? values[key] : '—')}` + part; + }); + } + + // 3) Subtitle: drop the leading "Example" and add "Prepared for …". + // PowerPoint often splits a line into several runs ("E" + "xample e" + …), + // so we rebuild it into the first run and empty the rest. + const r = findShape(out, SUBTITLE_SHAPE); + if (r) { + const seg = out.slice(r[0], r[1]); + const runs = [...seg.matchAll(RUN_RE)]; + if (runs.length) { + let text = unescapeXml(runs.map((m) => m[1]).join('')); + text = text.replace(/^\s*example\s+/i, ''); + text = text.charAt(0).toUpperCase() + text.slice(1); + text = (subtitlePrefix || '') + text; + let n = 0; + const next = seg.replace(RUN_RE, () => (n++ === 0 ? `${escapeXml(text)}` : '')); + out = out.slice(0, r[0]) + next + out.slice(r[1]); + } + } + + return { xml: out, replaced }; +} + +/** + * Writes the active-subscriber figure into the "DeviceCount" box on slide 3. + * @param {string} xml slide XML + * @param {string} deviceCount display string, e.g. "5m" ("" leaves the box blank) + * @returns {{xml: string, replaced: number}} + */ +export function personaliseDeviceSlideXml(xml, deviceCount) { + const r = findShape(xml, DEVICE_COUNT_SHAPE); + if (!r) return { xml, replaced: 0 }; + const seg = xml.slice(r[0], r[1]); + const runs = [...seg.matchAll(RUN_RE)]; + if (!runs.length) return { xml, replaced: 0 }; + const last = runs[runs.length - 1]; + let next = seg.slice(0, last.index) + `${escapeXml(deviceCount)}` + seg.slice(last.index + last[0].length); + // Ranges from the form dropdown ("10m–50m") are wider than a single figure: drop from + // 44pt to 36pt so they stay on one line in the column. + if (String(deviceCount).length > 6) next = next.replace(/sz="4400"/, 'sz="3600"'); + return { xml: xml.slice(0, r[0]) + next + xml.slice(r[1]), replaced: 1 }; +}