@burdenoff/microfe-subscriberbot 2026.1113.1 → 2026.1123.1

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 (41) hide show
  1. package/dist/subscriberbot/components/InfiniteScrollSentinel.d.ts +24 -0
  2. package/dist/subscriberbot/components/InfiniteScrollSentinel.js +44 -0
  3. package/dist/subscriberbot/components/InfiniteScrollSentinel.js.map +1 -0
  4. package/dist/subscriberbot/components/index.d.ts +4 -0
  5. package/dist/subscriberbot/components/index.js +5 -2
  6. package/dist/subscriberbot/components/tags/EntityTagPicker.d.ts +25 -0
  7. package/dist/subscriberbot/components/tags/EntityTagPicker.js +205 -0
  8. package/dist/subscriberbot/components/tags/EntityTagPicker.js.map +1 -0
  9. package/dist/subscriberbot/components/tags/index.d.ts +2 -0
  10. package/dist/subscriberbot/components/tags/index.js +1 -0
  11. package/dist/subscriberbot/hooks/index.d.ts +2 -2
  12. package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts +53 -1
  13. package/dist/subscriberbot/hooks/useSubscriberBotApi.js +664 -373
  14. package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
  15. package/dist/subscriberbot/pages/AssetVaultPage.js +192 -147
  16. package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
  17. package/dist/subscriberbot/pages/DashboardPage.js +9 -9
  18. package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
  19. package/dist/subscriberbot/pages/InboxPage.js +264 -281
  20. package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
  21. package/dist/subscriberbot/pages/InsightsPage.js +8 -8
  22. package/dist/subscriberbot/pages/InvoicesPage.js +62 -78
  23. package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
  24. package/dist/subscriberbot/pages/agents/AgentDetailPage.js +1 -1
  25. package/dist/subscriberbot/pages/agents/AgentsListPage.js +5 -5
  26. package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +81 -81
  27. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +326 -314
  28. package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
  29. package/dist/subscriberbot/pages/providers/ProviderInsights.js +17 -17
  30. package/dist/subscriberbot/pages/providers/ProviderNewPage.js +153 -140
  31. package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
  32. package/dist/subscriberbot/pages/providers/ProvidersListPage.js +135 -146
  33. package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
  34. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +482 -437
  35. package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
  36. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +59 -46
  37. package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
  38. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +104 -111
  39. package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
  40. package/dist/subscriberbot/types/index.d.ts +40 -1
  41. package/package.json +12 -9
@@ -1 +1 @@
1
- {"version":3,"file":"ProviderDetailPage.js","names":["_Fragment","EmptyState","Gauge","EmptyState$1","Gauge$1","Fragment$1","inputCls","labelCls","CATEGORIES","CATEGORY_KEY","STATUSES","INTERVALS","healthMeta","score","tr","churnMeta","ProviderEditModal","useFormatters","useTr","update","useUpdateProvider","name","setName","useState","provider","category","setCategory","status","setStatus","description","setDescription","industry","setIndustry","region","setRegion","language","setLanguage","websiteUrl","setWebsiteUrl","churnRiskScore","setChurnRiskScore","vendorHealthScore","setVendorHealthScore","tags","setTags","formError","setFormError","fieldErrorProps","formErrorId","useFormError","Modal","parsedTags","t","input","onClose","err","c","formatEnumLabel","s","AddPlanModal","create","useCreatePlan","amount","setAmount","currency","setCurrency","interval","setInterval","features","setFeatures","isActive","setIsActive","parsedFeatures","f","i","ArchiveProviderModal","useSubscriberBot","archive","useArchiveProvider","error","setError","navigateTo","ProviderPriceHistory","useBenchmarkDataPoints","slug","series","useMemo","ordered","data","point","a","b","latest","scoped","amounts","GlassCard","LineChart","isLoading","LoadingView","isError","ErrorView","refetch","formatCurrency","formatIntervalSuffix","formatDate","Sparkline","ProviderDetailPage","useParams","useProvider","id","showEdit","setShowEdit","showAddPlan","setShowAddPlan","showArchive","setShowArchive","PageLayout","p","safeWebsiteUrl","bestValuePlanId","pl","min","Pencil","Archive","ArrowLeft","Building2","StatusBadge","Globe","Tag","tag","Section","Plus","isBestValue","plan","Sparkles","Check","ProviderPaidPriceHistory","ProviderAlternatives","ShieldCheck","cn","TrendingDown","MiniProgress","Layers"],"sources":["../../../../src/subscriberbot/pages/providers/ProviderDetailPage.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport { useFormError } from '../../hooks/useFormError';\n/**\n * Provider detail\n * @module subscriberbot/pages/providers\n *\n * A provider profile from the registry: category, status, region, scores,\n * tags and its published plans. Reads `subProvider(id)`,\n * `subProviderPriceHistory` + `subProviderAlternatives` (what this workspace\n * has paid the provider over time and which registry providers could replace\n * it, BOFF-4003) and `subListBenchmarkDataPoints` (the shared market price\n * points behind the \"Market benchmark\" card); writes `subUpdateProvider`,\n * `subArchiveProvider`, `subCreatePlan`.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n ArrowLeft,\n Building2,\n Globe,\n ShieldCheck,\n TrendingDown,\n Tag,\n Pencil,\n Plus,\n Archive,\n Check,\n Sparkles,\n Layers,\n LineChart,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { Modal } from '../../components/Modal';\nimport { LoadingView, ErrorView, Section } from '../../components/StateViews';\nimport { ProviderAlternatives, ProviderPaidPriceHistory } from './ProviderInsights';\nimport { Gauge, MiniProgress, Sparkline } from '../../components';\nimport { useParams } from 'react-router';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useProvider,\n useUpdateProvider,\n useArchiveProvider,\n useCreatePlan,\n useBenchmarkDataPoints,\n} from '../../hooks/useSubscriberBotApi';\n\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type {\n SubBenchmarkDataPoint,\n SubBillingInterval,\n SubPlan,\n SubProvider,\n SubProviderCategory,\n SubProviderStatus,\n SubUpdateProviderInput,\n} from '../../types';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\nconst CATEGORIES: SubProviderCategory[] = [\n 'SAAS',\n 'AI_SERVICE',\n 'STREAMING',\n 'NEWSLETTER',\n 'NEWS_DIGEST',\n 'MEMBERSHIP',\n 'COMMUNITY',\n 'EDUCATION',\n 'FINANCIAL',\n 'INSURANCE',\n 'TELECOM',\n 'UTILITY',\n 'ASSOCIATION',\n 'LICENSE',\n 'CONTRACT',\n 'OTHER',\n];\n\nconst CATEGORY_KEY: Record<SubProviderCategory, string> = {\n SAAS: 'providers.categories.saas',\n AI_SERVICE: 'providers.categories.aiService',\n STREAMING: 'providers.categories.streaming',\n NEWSLETTER: 'providers.categories.newsletter',\n NEWS_DIGEST: 'providers.categories.newsDigest',\n MEMBERSHIP: 'providers.categories.membership',\n COMMUNITY: 'providers.categories.community',\n EDUCATION: 'providers.categories.education',\n FINANCIAL: 'providers.categories.financial',\n INSURANCE: 'providers.categories.insurance',\n TELECOM: 'providers.categories.telecom',\n UTILITY: 'providers.categories.utility',\n ASSOCIATION: 'providers.categories.association',\n LICENSE: 'providers.categories.license',\n CONTRACT: 'providers.categories.contract',\n OTHER: 'providers.categories.other',\n};\n\nconst STATUSES: SubProviderStatus[] = ['UNVERIFIED', 'VERIFIED', 'CLAIMED', 'DEPRECATED'];\n\nconst INTERVALS: SubBillingInterval[] = [\n 'MONTHLY',\n 'YEARLY',\n 'QUARTERLY',\n 'WEEKLY',\n 'DAILY',\n 'USAGE_BASED',\n 'LIFETIME',\n 'FREE',\n];\n\n/** Vendor-health 0–100 → label + semantic chip classes. Higher is healthier. */\nfunction healthMeta(score: number, tr: ReturnType<typeof useTr>): { label: string; cls: string } {\n if (score >= 70)\n return {\n label: tr('providers.detail.healthy', 'Healthy'),\n cls: 'bg-status-success-bg-subtle text-status-success-text',\n };\n if (score >= 45)\n return {\n label: tr('providers.detail.fair', 'Fair'),\n cls: 'bg-status-warning-bg-subtle text-status-warning-text',\n };\n return {\n label: tr('providers.detail.atRisk', 'At risk'),\n cls: 'bg-status-error-bg-subtle text-status-error-text',\n };\n}\n\n/** Churn-risk 0–100 → label + tone. Higher is worse. */\nfunction churnMeta(\n score: number,\n tr: ReturnType<typeof useTr>\n): {\n label: string;\n chip: string;\n tone: 'positive' | 'warning' | 'negative';\n} {\n if (score >= 67)\n return {\n label: tr('providers.detail.churnHigh', 'High'),\n chip: 'bg-status-error-bg-subtle text-status-error-text',\n tone: 'negative',\n };\n if (score >= 34)\n return {\n label: tr('providers.detail.churnModerate', 'Moderate'),\n chip: 'bg-status-warning-bg-subtle text-status-warning-text',\n tone: 'warning',\n };\n return {\n label: tr('providers.detail.churnLow', 'Low'),\n chip: 'bg-status-success-bg-subtle text-status-success-text',\n tone: 'positive',\n };\n}\n\n// ---------------------------------------------------------------------------\n// Edit provider modal → subUpdateProvider\n// ---------------------------------------------------------------------------\n\nfunction ProviderEditModal({ provider, onClose }: { provider: SubProvider; onClose: () => void }) {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const update = useUpdateProvider();\n const [name, setName] = useState(provider.name);\n const [category, setCategory] = useState<SubProviderCategory>(provider.category);\n const [status, setStatus] = useState<SubProviderStatus>(provider.status);\n const [description, setDescription] = useState(provider.description ?? '');\n const [industry, setIndustry] = useState(provider.industry ?? '');\n const [region, setRegion] = useState(provider.region ?? '');\n const [language, setLanguage] = useState(provider.language ?? '');\n const [websiteUrl, setWebsiteUrl] = useState(provider.websiteUrl ?? '');\n const [churnRiskScore, setChurnRiskScore] = useState(\n provider.churnRiskScore != null ? String(provider.churnRiskScore) : ''\n );\n const [vendorHealthScore, setVendorHealthScore] = useState(\n provider.vendorHealthScore != null ? String(provider.vendorHealthScore) : ''\n );\n const [tags, setTags] = useState(provider.tags.join(', '));\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!name.trim()) {\n setFormError(\n tr('providers.new.nameRequired', 'A provider name is required.'),\n 'prov-edit-name'\n );\n return;\n }\n const parsedTags = tags\n .split(',')\n .map((t) => t.trim())\n .filter(Boolean);\n const input: SubUpdateProviderInput = {\n name: name.trim(),\n category,\n status,\n description: description.trim(),\n tags: parsedTags,\n ...(industry.trim() ? { industry: industry.trim() } : {}),\n ...(region.trim() ? { region: region.trim() } : {}),\n ...(language.trim() ? { language: language.trim() } : {}),\n ...(websiteUrl.trim() ? { websiteUrl: websiteUrl.trim() } : {}),\n ...(churnRiskScore.trim() ? { churnRiskScore: Number(churnRiskScore) } : {}),\n ...(vendorHealthScore.trim() ? { vendorHealthScore: Number(vendorHealthScore) } : {}),\n };\n update.mutate(\n { id: provider.id, input },\n {\n onSuccess: () => onClose(),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.editModal.error', 'Could not update provider.')\n ),\n }\n );\n };\n\n return (\n <Modal\n title={tr('providers.detail.editModal.title', 'Edit provider')}\n onClose={onClose}\n maxWidthClassName=\"max-w-2xl\"\n >\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n {formError && (\n <div\n id={formErrorId}\n tabIndex={-1}\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {formError}\n </div>\n )}\n <div>\n <label htmlFor=\"prov-edit-name\" className={labelCls}>\n {tr('providers.detail.editModal.nameLabel', 'Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('prov-edit-name')}\n id=\"prov-edit-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className={inputCls}\n required\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"prov-edit-category\" className={labelCls}>\n {tr('providers.detail.editModal.categoryLabel', 'Category')}\n </label>\n <select\n {...fieldErrorProps('prov-edit-category')}\n id=\"prov-edit-category\"\n value={category}\n onChange={(e) => setCategory(e.target.value as SubProviderCategory)}\n className={inputCls}\n >\n {CATEGORIES.map((c) => (\n <option key={c} value={c}>\n {tr(CATEGORY_KEY[c], formatEnumLabel(c))}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"prov-edit-status\" className={labelCls}>\n {tr('providers.detail.editModal.statusLabel', 'Status')}\n </label>\n <select\n {...fieldErrorProps('prov-edit-status')}\n id=\"prov-edit-status\"\n value={status}\n onChange={(e) => setStatus(e.target.value as SubProviderStatus)}\n className={inputCls}\n >\n {STATUSES.map((s) => (\n <option key={s} value={s}>\n {formatEnumLabel(s)}\n </option>\n ))}\n </select>\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"prov-edit-industry\" className={labelCls}>\n {tr('providers.detail.editModal.industryLabel', 'Industry')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-industry')}\n id=\"prov-edit-industry\"\n type=\"text\"\n value={industry}\n onChange={(e) => setIndustry(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-region\" className={labelCls}>\n {tr('providers.detail.editModal.regionLabel', 'Region')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-region')}\n id=\"prov-edit-region\"\n type=\"text\"\n value={region}\n onChange={(e) => setRegion(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-language\" className={labelCls}>\n {tr('providers.detail.editModal.languageLabel', 'Language')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-language')}\n id=\"prov-edit-language\"\n type=\"text\"\n value={language}\n onChange={(e) => setLanguage(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n <div>\n <label htmlFor=\"prov-edit-website\" className={labelCls}>\n {tr('providers.detail.editModal.websiteLabel', 'Website')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-website')}\n id=\"prov-edit-website\"\n type=\"url\"\n value={websiteUrl}\n onChange={(e) => setWebsiteUrl(e.target.value)}\n placeholder={tr('providers.detail.editModal.websitePlaceholder', 'https://…')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-desc\" className={labelCls}>\n {tr('providers.detail.editModal.descriptionLabel', 'Description')}\n </label>\n <textarea\n {...fieldErrorProps('prov-edit-desc')}\n id=\"prov-edit-desc\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={3}\n className={inputCls}\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"prov-edit-churn\" className={labelCls}>\n {tr('providers.detail.editModal.churnRiskLabel', 'Churn risk (0–100)')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-churn')}\n id=\"prov-edit-churn\"\n type=\"number\"\n min=\"0\"\n max=\"100\"\n value={churnRiskScore}\n onChange={(e) => setChurnRiskScore(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-health\" className={labelCls}>\n {tr('providers.detail.editModal.vendorHealthLabel', 'Vendor health (0–100)')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-health')}\n id=\"prov-edit-health\"\n type=\"number\"\n min=\"0\"\n max=\"100\"\n value={vendorHealthScore}\n onChange={(e) => setVendorHealthScore(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n <div>\n <label htmlFor=\"prov-edit-tags\" className={labelCls}>\n {tr('providers.detail.editModal.tagsLabel', 'Tags')}{' '}\n <span className=\"text-text-secondary\">\n ({tr('providers.detail.editModal.tagsHint', 'comma-separated')})\n </span>\n </label>\n <input\n {...fieldErrorProps('prov-edit-tags')}\n id=\"prov-edit-tags\"\n type=\"text\"\n value={tags}\n onChange={(e) => setTags(e.target.value)}\n className={inputCls}\n />\n </div>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.editModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={update.isPending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {update.isPending\n ? tr('providers.detail.editModal.saving', 'Saving…')\n : tr('providers.detail.editModal.submit', 'Save changes')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Add plan modal → subCreatePlan\n// ---------------------------------------------------------------------------\n\nfunction AddPlanModal({ providerId, onClose }: { providerId: string; onClose: () => void }) {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const create = useCreatePlan();\n const [name, setName] = useState('');\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [interval, setInterval] = useState<SubBillingInterval>('MONTHLY');\n const [description, setDescription] = useState('');\n const [features, setFeatures] = useState('');\n const [isActive, setIsActive] = useState(true);\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!name.trim()) {\n setFormError(\n tr('providers.detail.addPlanModal.nameRequired', 'A plan name is required.'),\n 'plan-name'\n );\n return;\n }\n const parsedFeatures = features\n .split('\\n')\n .map((f) => f.trim())\n .filter(Boolean);\n create.mutate(\n {\n providerId,\n name: name.trim(),\n interval,\n currency: currency.trim() || 'USD',\n ...(amount.trim() ? { amount: Number(amount) } : {}),\n ...(description.trim() ? { description: description.trim() } : {}),\n ...(parsedFeatures.length ? { features: parsedFeatures } : {}),\n },\n {\n onSuccess: () => onClose(),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.addPlanModal.error', 'Could not add plan.')\n ),\n }\n );\n };\n\n return (\n <Modal\n title={tr('providers.detail.addPlanModal.title', 'Add plan')}\n onClose={onClose}\n maxWidthClassName=\"max-w-xl\"\n >\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n {formError && (\n <div\n id={formErrorId}\n tabIndex={-1}\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {formError}\n </div>\n )}\n <div>\n <label htmlFor=\"plan-name\" className={labelCls}>\n {tr('providers.detail.addPlanModal.nameLabel', 'Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('plan-name')}\n id=\"plan-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder={tr(\n 'providers.detail.addPlanModal.namePlaceholder',\n 'e.g. Pro, Team, Enterprise'\n )}\n className={inputCls}\n required\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"plan-amount\" className={labelCls}>\n {tr('providers.detail.addPlanModal.amountLabel', 'Amount')}\n </label>\n <input\n {...fieldErrorProps('plan-amount')}\n id=\"plan-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n placeholder={tr('providers.detail.addPlanModal.amountPlaceholder', '0.00')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-currency\" className={labelCls}>\n {tr('providers.detail.addPlanModal.currencyLabel', 'Currency')}\n </label>\n <input\n {...fieldErrorProps('plan-currency')}\n id=\"plan-currency\"\n type=\"text\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n maxLength={3}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-interval\" className={labelCls}>\n {tr('providers.detail.addPlanModal.intervalLabel', 'Interval')}\n </label>\n <select\n {...fieldErrorProps('plan-interval')}\n id=\"plan-interval\"\n value={interval}\n onChange={(e) => setInterval(e.target.value as SubBillingInterval)}\n className={inputCls}\n >\n {INTERVALS.map((i) => (\n <option key={i} value={i}>\n {formatEnumLabel(i)}\n </option>\n ))}\n </select>\n </div>\n </div>\n <div>\n <label htmlFor=\"plan-desc\" className={labelCls}>\n {tr('providers.detail.addPlanModal.descriptionLabel', 'Description')}\n </label>\n <textarea\n {...fieldErrorProps('plan-desc')}\n id=\"plan-desc\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={2}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-features\" className={labelCls}>\n {tr('providers.detail.addPlanModal.featuresLabel', 'Features')}{' '}\n <span className=\"text-text-secondary\">\n ({tr('providers.detail.addPlanModal.featuresHint', 'one per line')})\n </span>\n </label>\n <textarea\n {...fieldErrorProps('plan-features')}\n id=\"plan-features\"\n value={features}\n onChange={(e) => setFeatures(e.target.value)}\n rows={3}\n placeholder={tr(\n 'providers.detail.addPlanModal.featuresPlaceholder',\n 'Unlimited projects\\nPriority support\\nSSO'\n )}\n className={inputCls}\n />\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={isActive}\n onChange={(e) => setIsActive(e.target.checked)}\n className=\"size-4 rounded border-border-subtle\"\n />\n {tr('providers.detail.addPlanModal.active', 'Active')}\n </label>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.addPlanModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={create.isPending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {create.isPending\n ? tr('providers.detail.addPlanModal.adding', 'Adding…')\n : tr('providers.detail.addPlanModal.submit', 'Add plan')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Archive confirmation modal → subArchiveProvider\n// ---------------------------------------------------------------------------\n\nfunction ArchiveProviderModal({\n provider,\n onClose,\n}: {\n provider: SubProvider;\n onClose: () => void;\n}) {\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const archive = useArchiveProvider();\n const [error, setError] = useState<string | null>(null);\n\n const handleArchive = () => {\n setError(null);\n archive.mutate(provider.id, {\n onSuccess: () => navigateTo('/providers'),\n onError: (err) =>\n setError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.archiveModal.error', 'Could not archive this provider.')\n ),\n });\n };\n\n return (\n <Modal title={tr('providers.detail.archiveModal.title', 'Archive provider')} onClose={onClose}>\n <div className=\"space-y-4\">\n {error && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {error}\n </div>\n )}\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'providers.detail.archiveModal.description',\n 'Archive {{name}}? It will be removed from the active registry. This can be reversed by an administrator.',\n { name: provider.name }\n )}\n </p>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.archiveModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"button\"\n onClick={handleArchive}\n disabled={archive.isPending}\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm font-medium text-status-error-text hover:opacity-90 disabled:opacity-50\"\n >\n {archive.isPending\n ? tr('providers.detail.archiveModal.archiving', 'Archiving…')\n : tr('providers.detail.archiveModal.submit', 'Archive provider')}\n </button>\n </div>\n </div>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Price history — real observed price points for this provider from the shared\n// benchmark dataset (`subListBenchmarkDataPoints`).\n//\n// A provider's data points span several plans, regions, currencies and billing\n// intervals. Plotting them in one line would draw price moves that never\n// happened (a $20/mo Basic point next to a $240/yr Enterprise point reads as a\n// 12× hike). The series is therefore narrowed to the exact\n// (plan, region, currency, interval) tuple of the most recent observation, and\n// the card names that tuple so the reader knows what the line describes.\n// ---------------------------------------------------------------------------\nfunction ProviderPriceHistory({ slug }: { slug: string | null }) {\n const { formatCurrency, formatDate, formatEnumLabel, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const { data, isLoading, isError, refetch } = useBenchmarkDataPoints(slug);\n\n const series = useMemo(() => {\n const ordered = [...(data ?? [])]\n .filter((point) => Number.isFinite(point.amount))\n .sort((a, b) => new Date(a.observedAt).getTime() - new Date(b.observedAt).getTime());\n const latest = ordered[ordered.length - 1];\n if (!latest) return null;\n const scoped: SubBenchmarkDataPoint[] = ordered.filter(\n (point) =>\n point.planName === latest.planName &&\n point.region === latest.region &&\n point.currency === latest.currency &&\n point.interval === latest.interval\n );\n const amounts = scoped.map((point) => point.amount);\n return {\n points: scoped,\n latest,\n amounts,\n min: Math.min(...amounts),\n max: Math.max(...amounts),\n first: amounts[0] ?? latest.amount,\n };\n }, [data]);\n\n return (\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <LineChart className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.marketBenchmark', 'Market benchmark')}\n </span>\n\n {!slug ? (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr(\n 'providers.detail.priceHistoryNoSlug',\n 'Add a slug to this provider to match it against the shared price benchmark dataset.'\n )}\n </p>\n ) : isLoading ? (\n <LoadingView\n className=\"min-h-[8rem]\"\n label={tr('providers.detail.priceHistoryLoading', 'Loading price history…')}\n />\n ) : isError ? (\n <ErrorView\n className=\"min-h-[8rem]\"\n title={tr('providers.detail.priceHistoryErrorTitle', 'Price history unavailable')}\n message={tr(\n 'providers.detail.priceHistoryError',\n 'Could not load observed prices for this provider.'\n )}\n onRetry={() => void refetch()}\n />\n ) : !series ? (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr(\n 'providers.detail.priceHistoryEmpty',\n 'No price observations recorded for this provider yet.'\n )}\n </p>\n ) : (\n <>\n <p className=\"mt-3 text-2xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(series.latest.amount, series.latest.currency)}\n <span className=\"text-sm font-normal text-text-secondary\">\n {formatIntervalSuffix(series.latest.interval)}\n </span>\n </p>\n <p className=\"text-xs text-text-secondary\">\n {series.latest.planName} · {series.latest.region} ·{' '}\n {tr('providers.detail.observed', 'observed')} {formatDate(series.latest.observedAt)}\n </p>\n <Sparkline\n className=\"mt-3 w-full\"\n points={series.amounts}\n positive={series.latest.amount <= series.first}\n />\n <dl className=\"mt-3 space-y-2 border-t border-border-subtle pt-3 text-xs\">\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.observedRange', 'Observed range')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {formatCurrency(series.min, series.latest.currency)} –{' '}\n {formatCurrency(series.max, series.latest.currency)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.observations', 'Observations')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">{series.points.length}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.latestSource', 'Latest source')}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {series.latest.sourceLabel ?? formatEnumLabel(series.latest.sourceKind)}\n </dd>\n </div>\n </dl>\n </>\n )}\n </GlassCard>\n );\n}\n\nexport function ProviderDetailPage() {\n const { formatCurrency, formatEnumLabel, formatIntervalSuffix } = useFormatters();\n\n const { id } = useParams<{ id: string }>();\n const { navigateTo } = useSubscriberBot();\n const { data: provider, isLoading, isError, refetch } = useProvider(id);\n const [showEdit, setShowEdit] = useState(false);\n const [showAddPlan, setShowAddPlan] = useState(false);\n const [showArchive, setShowArchive] = useState(false);\n const tr = useTr();\n\n if (isLoading) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <LoadingView label={tr('providers.detail.loading', 'Loading provider…')} />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <ErrorView\n message={tr('providers.detail.error', 'Could not load this provider.')}\n onRetry={() => void refetch()}\n />\n </PageLayout>\n );\n }\n\n if (!provider) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <EmptyState\n illustration=\"empty-data\"\n title={tr('providers.detail.notFoundTitle', 'Provider not found')}\n description={tr(\n 'providers.detail.notFoundDescription',\n 'It may have been removed, or you may not have access to it.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/providers')}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n {tr('providers.detail.backToProviders', 'Back to providers')}\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const p = provider;\n // Only render the website as a link when it is a safe http(s) URL — websiteUrl\n // is user-controlled, so guard against javascript:/data: schemes and add\n // rel=\"noopener noreferrer\" to the target=\"_blank\" anchor.\n const safeWebsiteUrl = p.websiteUrl && /^https?:\\/\\//i.test(p.websiteUrl) ? p.websiteUrl : null;\n\n // Highlight the cheapest active priced plan as \"Best value\" (derived from real\n // plan data — guard for the no-plans / all-free case).\n const bestValuePlanId =\n p.plans && p.plans.length > 1\n ? (p.plans\n .filter((pl) => pl.isActive && pl.amount > 0)\n .reduce<SubPlan | null>(\n (min, pl) => (min === null || pl.amount < min.amount ? pl : min),\n null\n )?.id ?? null)\n : null;\n\n return (\n <PageLayout\n title={p.name}\n description={tr(CATEGORY_KEY[p.category], formatEnumLabel(p.category))}\n actions={\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowEdit(true)}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Pencil className=\"h-4 w-4\" /> {tr('providers.detail.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowArchive(true)}\n className=\"inline-flex items-center gap-2 rounded-lg border border-status-error-text/30 px-3 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Archive className=\"h-4 w-4\" /> {tr('providers.detail.archive', 'Archive')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/providers')}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"rtl:rotate-180 h-4 w-4\" /> {tr('providers.detail.back', 'Back')}\n </button>\n </div>\n }\n >\n {/* Identity row */}\n <div className=\"flex flex-wrap items-center gap-3\">\n <span className=\"flex size-11 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary\">\n <Building2 className=\"h-5 w-5\" />\n </span>\n <StatusBadge status={p.status} />\n {p.industry && <span className=\"text-sm text-text-secondary\">{p.industry}</span>}\n {p.region && <span className=\"text-sm text-text-secondary\">· {p.region}</span>}\n {safeWebsiteUrl && (\n <a\n href={safeWebsiteUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-sm text-text-link hover:underline\"\n >\n <Globe className=\"h-3.5 w-3.5\" /> {tr('providers.detail.website', 'Website')}\n </a>\n )}\n </div>\n\n {p.description && (\n <p className=\"mt-4 max-w-3xl text-sm leading-relaxed text-text-secondary\">\n {p.description}\n </p>\n )}\n\n {p.tags.length > 0 && (\n <div className=\"mt-4 flex flex-wrap items-center gap-2\">\n <Tag className=\"h-3.5 w-3.5 text-text-secondary\" />\n {p.tags.map((tag) => (\n <span\n key={tag}\n className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n )}\n\n <div className=\"mt-6 grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Plans — tier cards */}\n <div className=\"lg:col-span-2\">\n <Section\n title={tr('providers.detail.plans', 'Plans')}\n description={tr('providers.detail.plansDescription', 'Pricing this provider publishes')}\n action={\n <button\n type=\"button\"\n onClick={() => setShowAddPlan(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Plus className=\"h-3.5 w-3.5\" /> {tr('providers.detail.addPlan', 'Add plan')}\n </button>\n }\n >\n {!p.plans || p.plans.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('providers.detail.noPlansTitle', 'No published plans')}\n description={tr(\n 'providers.detail.noPlansDescription',\n \"When this provider publishes plans, they'll appear here.\"\n )}\n action={\n <button\n type=\"button\"\n onClick={() => setShowAddPlan(true)}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n {tr('providers.detail.addPlan', 'Add plan')}\n </button>\n }\n />\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n {p.plans.map((plan) => {\n const isBestValue = plan.id === bestValuePlanId && p.plans!.length > 1;\n return (\n <GlassCard\n key={plan.id}\n treatment={isBestValue ? 'insight' : 'metric'}\n glow={isBestValue}\n className=\"flex flex-col p-5\"\n >\n <div className=\"flex items-start justify-between gap-2\">\n <p className=\"text-sm font-semibold text-text-primary\">{plan.name}</p>\n {isBestValue ? (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[11px] font-medium text-status-success-text\">\n <Sparkles className=\"h-3 w-3\" />{' '}\n {tr('providers.detail.bestValue', 'Best value')}\n </span>\n ) : (\n <StatusBadge status={plan.isActive ? 'ACTIVE' : 'DISABLED'} />\n )}\n </div>\n <p className=\"mt-3 text-2xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(plan.amount, plan.currency)}\n <span className=\"text-sm font-normal text-text-secondary\">\n {formatIntervalSuffix(plan.interval)}\n </span>\n </p>\n {plan.description && (\n <p className=\"mt-2 text-xs leading-relaxed text-text-secondary\">\n {plan.description}\n </p>\n )}\n {plan.features.length > 0 && (\n <ul className=\"mt-4 space-y-2 border-t border-border-subtle pt-4\">\n {plan.features.slice(0, 6).map((f) => (\n <li\n key={f}\n className=\"flex items-start gap-2 text-xs text-text-secondary\"\n >\n <Check className=\"mt-0.5 h-3.5 w-3.5 shrink-0 text-status-success-text\" />\n <span>{f}</span>\n </li>\n ))}\n {plan.features.length > 6 && (\n <li className=\"ps-6 text-[11px] text-text-secondary\">\n {tr('providers.detail.moreFeatures', '+{{count}} more', {\n count: plan.features.length - 6,\n })}\n </li>\n )}\n </ul>\n )}\n </GlassCard>\n );\n })}\n </div>\n )}\n </Section>\n\n <ProviderPaidPriceHistory providerId={p.id} />\n <ProviderAlternatives providerId={p.id} />\n </div>\n\n {/* Sidebar — vendor health, churn risk, at-a-glance */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <ShieldCheck className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.vendorHealth', 'Vendor health')}\n </span>\n {p.vendorHealthScore != null && (\n <span\n className={cn(\n 'rounded-full px-2 py-0.5 text-[11px] font-medium',\n healthMeta(p.vendorHealthScore, tr).cls\n )}\n >\n {healthMeta(p.vendorHealthScore, tr).label}\n </span>\n )}\n </div>\n {p.vendorHealthScore != null ? (\n <div className=\"mt-2 flex flex-col items-center\">\n <Gauge\n value={p.vendorHealthScore}\n max={100}\n size={168}\n label={tr('providers.detail.outOf100', 'out of 100')}\n />\n </div>\n ) : (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr('providers.detail.noHealthScore', 'No health score yet.')}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <TrendingDown className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.churnRisk', 'Churn risk')}\n </span>\n {p.churnRiskScore != null && (\n <span\n className={cn(\n 'rounded-full px-2 py-0.5 text-[11px] font-medium',\n churnMeta(p.churnRiskScore, tr).chip\n )}\n >\n {churnMeta(p.churnRiskScore, tr).label}\n </span>\n )}\n </div>\n {p.churnRiskScore != null ? (\n <>\n <div className=\"mt-3 flex items-baseline justify-between\">\n <span className=\"text-2xl font-bold tabular-nums text-text-primary\">\n {p.churnRiskScore}\n </span>\n <span className=\"text-xs text-text-secondary\">/ 100</span>\n </div>\n <MiniProgress\n label={tr('common.healthScore', 'Health score')}\n value={p.churnRiskScore}\n tone={churnMeta(p.churnRiskScore, tr).tone}\n className=\"mt-2\"\n />\n </>\n ) : (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr('providers.detail.noChurnSignal', 'No churn signal yet.')}\n </p>\n )}\n </GlassCard>\n\n <ProviderPriceHistory slug={p.slug} />\n\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <Layers className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.atAGlance', 'At a glance')}\n </span>\n <dl className=\"mt-3 space-y-2.5 text-sm\">\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.category', 'Category')}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {tr(CATEGORY_KEY[p.category], formatEnumLabel(p.category))}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.industry', 'Industry')}\n </dt>\n <dd className=\"font-medium text-text-primary\">{p.industry ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">{tr('providers.detail.region', 'Region')}</dt>\n <dd className=\"font-medium text-text-primary\">{p.region ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.language', 'Language')}\n </dt>\n <dd className=\"font-medium text-text-primary\">{p.language ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.publishedPlans', 'Published plans')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {p.plans?.length ?? 0}\n </dd>\n </div>\n </dl>\n </GlassCard>\n </div>\n </div>\n\n {showEdit && <ProviderEditModal provider={p} onClose={() => setShowEdit(false)} />}\n {showAddPlan && <AddPlanModal providerId={p.id} onClose={() => setShowAddPlan(false)} />}\n {showArchive && <ArchiveProviderModal provider={p} onClose={() => setShowArchive(false)} />}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6DA,IAAMM,IACJ,wMACIC,IAAW,sDAEXC,IAAoC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAoD;CACxD,MAAM;CACN,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,SAAS;CACT,SAAS;CACT,aAAa;CACb,SAAS;CACT,UAAU;CACV,OAAO;AACT,GAEMC,IAAgC;CAAC;CAAc;CAAY;CAAW;AAAY,GAElFC,IAAkC;C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,GACJ,kBAAC,MAAD;WAAI,WAAU;WAAiC,UAAAuG,EAAE,YAAY;UAAQ,CAAA,CAClE;;SACL,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAvG,EAAG,mCAAmC,iBAAiB;UACtD,CAAA,GACJ,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAuG,EAAE,OAAO,UAAU;UAClB,CAAA,CACD;;QACH;OACK,CAAA,CAAA;;KACR;IACF,CAAA,CAAA;;GAEJP,KAAY,kBAAC9F,GAAD;IAAmB,UAAUqG;IAAG,eAAeN,EAAY,EAAK;GAAI,CAAA;GAChFC,KAAe,kBAACrD,IAAD;IAAc,YAAY0D,EAAE;IAAI,eAAeJ,EAAe,EAAK;GAAI,CAAA;GACtFC,KAAe,kBAACvC,IAAD;IAAsB,UAAU0C;IAAG,eAAeF,EAAe,EAAK;GAAI,CAAA;EAChF;;AAEhB"}
1
+ {"version":3,"file":"ProviderDetailPage.js","names":["_Fragment","EmptyState","Gauge","EmptyState$1","Gauge$1","Fragment$1","inputCls","labelCls","CATEGORIES","CATEGORY_KEY","STATUSES","INTERVALS","healthMeta","score","tr","churnMeta","ProviderEditModal","useFormatters","useTr","update","useUpdateProvider","name","setName","useState","provider","category","setCategory","status","setStatus","description","setDescription","industry","setIndustry","region","setRegion","language","setLanguage","websiteUrl","setWebsiteUrl","churnRiskScore","setChurnRiskScore","vendorHealthScore","setVendorHealthScore","tags","setTags","formError","setFormError","fieldErrorProps","formErrorId","useFormError","Modal","parsedTags","t","input","onClose","err","c","formatEnumLabel","s","EntityTagPicker","AddPlanModal","create","useCreatePlan","amount","setAmount","currency","setCurrency","interval","setInterval","features","setFeatures","isActive","setIsActive","parsedFeatures","f","i","ArchiveProviderModal","useSubscriberBot","archive","useArchiveProvider","error","setError","navigateTo","ProviderPriceHistory","useBenchmarkDataPoints","slug","series","useMemo","ordered","data","point","a","b","latest","scoped","amounts","GlassCard","LineChart","isLoading","LoadingView","isError","ErrorView","refetch","formatCurrency","formatIntervalSuffix","formatDate","Sparkline","ProviderDetailPage","useParams","useProvider","id","showEdit","setShowEdit","showAddPlan","setShowAddPlan","showArchive","setShowArchive","PageLayout","p","safeWebsiteUrl","bestValuePlanId","pl","min","Pencil","Archive","ArrowLeft","Building2","StatusBadge","Globe","Tag","tag","Section","Plus","isBestValue","plan","Sparkles","Check","ProviderPaidPriceHistory","ProviderAlternatives","ShieldCheck","cn","TrendingDown","MiniProgress","Layers"],"sources":["../../../../src/subscriberbot/pages/providers/ProviderDetailPage.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport { useFormError } from '../../hooks/useFormError';\n/**\n * Provider detail\n * @module subscriberbot/pages/providers\n *\n * A provider profile from the registry: category, status, region, scores,\n * tags and its published plans. Reads `subProvider(id)`,\n * `subProviderPriceHistory` + `subProviderAlternatives` (what this workspace\n * has paid the provider over time and which registry providers could replace\n * it, BOFF-4003) and `subListBenchmarkDataPoints` (the shared market price\n * points behind the \"Market benchmark\" card); writes `subUpdateProvider`,\n * `subArchiveProvider`, `subCreatePlan`.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n ArrowLeft,\n Building2,\n Globe,\n ShieldCheck,\n TrendingDown,\n Tag,\n Pencil,\n Plus,\n Archive,\n Check,\n Sparkles,\n Layers,\n LineChart,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { Modal } from '../../components/Modal';\nimport { LoadingView, ErrorView, Section } from '../../components/StateViews';\nimport { ProviderAlternatives, ProviderPaidPriceHistory } from './ProviderInsights';\nimport { Gauge, MiniProgress, Sparkline, EntityTagPicker } from '../../components';\nimport { useParams } from 'react-router';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useProvider,\n useUpdateProvider,\n useArchiveProvider,\n useCreatePlan,\n useBenchmarkDataPoints,\n} from '../../hooks/useSubscriberBotApi';\n\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type {\n SubBenchmarkDataPoint,\n SubBillingInterval,\n SubPlan,\n SubProvider,\n SubProviderCategory,\n SubProviderStatus,\n SubUpdateProviderInput,\n} from '../../types';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\nconst CATEGORIES: SubProviderCategory[] = [\n 'SAAS',\n 'AI_SERVICE',\n 'STREAMING',\n 'NEWSLETTER',\n 'NEWS_DIGEST',\n 'MEMBERSHIP',\n 'COMMUNITY',\n 'EDUCATION',\n 'FINANCIAL',\n 'INSURANCE',\n 'TELECOM',\n 'UTILITY',\n 'ASSOCIATION',\n 'LICENSE',\n 'CONTRACT',\n 'OTHER',\n];\n\nconst CATEGORY_KEY: Record<SubProviderCategory, string> = {\n SAAS: 'providers.categories.saas',\n AI_SERVICE: 'providers.categories.aiService',\n STREAMING: 'providers.categories.streaming',\n NEWSLETTER: 'providers.categories.newsletter',\n NEWS_DIGEST: 'providers.categories.newsDigest',\n MEMBERSHIP: 'providers.categories.membership',\n COMMUNITY: 'providers.categories.community',\n EDUCATION: 'providers.categories.education',\n FINANCIAL: 'providers.categories.financial',\n INSURANCE: 'providers.categories.insurance',\n TELECOM: 'providers.categories.telecom',\n UTILITY: 'providers.categories.utility',\n ASSOCIATION: 'providers.categories.association',\n LICENSE: 'providers.categories.license',\n CONTRACT: 'providers.categories.contract',\n OTHER: 'providers.categories.other',\n};\n\nconst STATUSES: SubProviderStatus[] = ['UNVERIFIED', 'VERIFIED', 'CLAIMED', 'DEPRECATED'];\n\nconst INTERVALS: SubBillingInterval[] = [\n 'MONTHLY',\n 'YEARLY',\n 'QUARTERLY',\n 'WEEKLY',\n 'DAILY',\n 'USAGE_BASED',\n 'LIFETIME',\n 'FREE',\n];\n\n/** Vendor-health 0–100 → label + semantic chip classes. Higher is healthier. */\nfunction healthMeta(score: number, tr: ReturnType<typeof useTr>): { label: string; cls: string } {\n if (score >= 70)\n return {\n label: tr('providers.detail.healthy', 'Healthy'),\n cls: 'bg-status-success-bg-subtle text-status-success-text',\n };\n if (score >= 45)\n return {\n label: tr('providers.detail.fair', 'Fair'),\n cls: 'bg-status-warning-bg-subtle text-status-warning-text',\n };\n return {\n label: tr('providers.detail.atRisk', 'At risk'),\n cls: 'bg-status-error-bg-subtle text-status-error-text',\n };\n}\n\n/** Churn-risk 0–100 → label + tone. Higher is worse. */\nfunction churnMeta(\n score: number,\n tr: ReturnType<typeof useTr>\n): {\n label: string;\n chip: string;\n tone: 'positive' | 'warning' | 'negative';\n} {\n if (score >= 67)\n return {\n label: tr('providers.detail.churnHigh', 'High'),\n chip: 'bg-status-error-bg-subtle text-status-error-text',\n tone: 'negative',\n };\n if (score >= 34)\n return {\n label: tr('providers.detail.churnModerate', 'Moderate'),\n chip: 'bg-status-warning-bg-subtle text-status-warning-text',\n tone: 'warning',\n };\n return {\n label: tr('providers.detail.churnLow', 'Low'),\n chip: 'bg-status-success-bg-subtle text-status-success-text',\n tone: 'positive',\n };\n}\n\n// ---------------------------------------------------------------------------\n// Edit provider modal → subUpdateProvider\n// ---------------------------------------------------------------------------\n\nfunction ProviderEditModal({ provider, onClose }: { provider: SubProvider; onClose: () => void }) {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const update = useUpdateProvider();\n const [name, setName] = useState(provider.name);\n const [category, setCategory] = useState<SubProviderCategory>(provider.category);\n const [status, setStatus] = useState<SubProviderStatus>(provider.status);\n const [description, setDescription] = useState(provider.description ?? '');\n const [industry, setIndustry] = useState(provider.industry ?? '');\n const [region, setRegion] = useState(provider.region ?? '');\n const [language, setLanguage] = useState(provider.language ?? '');\n const [websiteUrl, setWebsiteUrl] = useState(provider.websiteUrl ?? '');\n const [churnRiskScore, setChurnRiskScore] = useState(\n provider.churnRiskScore != null ? String(provider.churnRiskScore) : ''\n );\n const [vendorHealthScore, setVendorHealthScore] = useState(\n provider.vendorHealthScore != null ? String(provider.vendorHealthScore) : ''\n );\n const [tags, setTags] = useState(provider.tags.join(', '));\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!name.trim()) {\n setFormError(\n tr('providers.new.nameRequired', 'A provider name is required.'),\n 'prov-edit-name'\n );\n return;\n }\n const parsedTags = tags\n .split(',')\n .map((t) => t.trim())\n .filter(Boolean);\n const input: SubUpdateProviderInput = {\n name: name.trim(),\n category,\n status,\n description: description.trim(),\n tags: parsedTags,\n ...(industry.trim() ? { industry: industry.trim() } : {}),\n ...(region.trim() ? { region: region.trim() } : {}),\n ...(language.trim() ? { language: language.trim() } : {}),\n ...(websiteUrl.trim() ? { websiteUrl: websiteUrl.trim() } : {}),\n ...(churnRiskScore.trim() ? { churnRiskScore: Number(churnRiskScore) } : {}),\n ...(vendorHealthScore.trim() ? { vendorHealthScore: Number(vendorHealthScore) } : {}),\n };\n update.mutate(\n { id: provider.id, input },\n {\n onSuccess: () => onClose(),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.editModal.error', 'Could not update provider.')\n ),\n }\n );\n };\n\n return (\n <Modal\n title={tr('providers.detail.editModal.title', 'Edit provider')}\n onClose={onClose}\n maxWidthClassName=\"max-w-2xl\"\n >\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n {formError && (\n <div\n id={formErrorId}\n tabIndex={-1}\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {formError}\n </div>\n )}\n <div>\n <label htmlFor=\"prov-edit-name\" className={labelCls}>\n {tr('providers.detail.editModal.nameLabel', 'Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('prov-edit-name')}\n id=\"prov-edit-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className={inputCls}\n required\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"prov-edit-category\" className={labelCls}>\n {tr('providers.detail.editModal.categoryLabel', 'Category')}\n </label>\n <select\n {...fieldErrorProps('prov-edit-category')}\n id=\"prov-edit-category\"\n value={category}\n onChange={(e) => setCategory(e.target.value as SubProviderCategory)}\n className={inputCls}\n >\n {CATEGORIES.map((c) => (\n <option key={c} value={c}>\n {tr(CATEGORY_KEY[c], formatEnumLabel(c))}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"prov-edit-status\" className={labelCls}>\n {tr('providers.detail.editModal.statusLabel', 'Status')}\n </label>\n <select\n {...fieldErrorProps('prov-edit-status')}\n id=\"prov-edit-status\"\n value={status}\n onChange={(e) => setStatus(e.target.value as SubProviderStatus)}\n className={inputCls}\n >\n {STATUSES.map((s) => (\n <option key={s} value={s}>\n {formatEnumLabel(s)}\n </option>\n ))}\n </select>\n </div>\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"prov-edit-industry\" className={labelCls}>\n {tr('providers.detail.editModal.industryLabel', 'Industry')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-industry')}\n id=\"prov-edit-industry\"\n type=\"text\"\n value={industry}\n onChange={(e) => setIndustry(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-region\" className={labelCls}>\n {tr('providers.detail.editModal.regionLabel', 'Region')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-region')}\n id=\"prov-edit-region\"\n type=\"text\"\n value={region}\n onChange={(e) => setRegion(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-language\" className={labelCls}>\n {tr('providers.detail.editModal.languageLabel', 'Language')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-language')}\n id=\"prov-edit-language\"\n type=\"text\"\n value={language}\n onChange={(e) => setLanguage(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n <div>\n <label htmlFor=\"prov-edit-website\" className={labelCls}>\n {tr('providers.detail.editModal.websiteLabel', 'Website')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-website')}\n id=\"prov-edit-website\"\n type=\"url\"\n value={websiteUrl}\n onChange={(e) => setWebsiteUrl(e.target.value)}\n placeholder={tr('providers.detail.editModal.websitePlaceholder', 'https://…')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-desc\" className={labelCls}>\n {tr('providers.detail.editModal.descriptionLabel', 'Description')}\n </label>\n <textarea\n {...fieldErrorProps('prov-edit-desc')}\n id=\"prov-edit-desc\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={3}\n className={inputCls}\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"prov-edit-churn\" className={labelCls}>\n {tr('providers.detail.editModal.churnRiskLabel', 'Churn risk (0–100)')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-churn')}\n id=\"prov-edit-churn\"\n type=\"number\"\n min=\"0\"\n max=\"100\"\n value={churnRiskScore}\n onChange={(e) => setChurnRiskScore(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"prov-edit-health\" className={labelCls}>\n {tr('providers.detail.editModal.vendorHealthLabel', 'Vendor health (0–100)')}\n </label>\n <input\n {...fieldErrorProps('prov-edit-health')}\n id=\"prov-edit-health\"\n type=\"number\"\n min=\"0\"\n max=\"100\"\n value={vendorHealthScore}\n onChange={(e) => setVendorHealthScore(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n <EntityTagPicker entityType=\"SUBSCRIBERBOT_PROVIDER\" entityId={provider.id} />\n <div>\n <label htmlFor=\"prov-edit-tags\" className={labelCls}>\n {tr('providers.detail.editModal.tagsLabel', 'Legacy keyword tags')}{' '}\n <span className=\"text-text-secondary\">\n ({tr('providers.detail.editModal.tagsHint', 'comma-separated')})\n </span>\n </label>\n <input\n {...fieldErrorProps('prov-edit-tags')}\n id=\"prov-edit-tags\"\n type=\"text\"\n value={tags}\n onChange={(e) => setTags(e.target.value)}\n className={inputCls}\n />\n </div>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.editModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={update.isPending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {update.isPending\n ? tr('providers.detail.editModal.saving', 'Saving…')\n : tr('providers.detail.editModal.submit', 'Save changes')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Add plan modal → subCreatePlan\n// ---------------------------------------------------------------------------\n\nfunction AddPlanModal({ providerId, onClose }: { providerId: string; onClose: () => void }) {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const create = useCreatePlan();\n const [name, setName] = useState('');\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [interval, setInterval] = useState<SubBillingInterval>('MONTHLY');\n const [description, setDescription] = useState('');\n const [features, setFeatures] = useState('');\n const [isActive, setIsActive] = useState(true);\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!name.trim()) {\n setFormError(\n tr('providers.detail.addPlanModal.nameRequired', 'A plan name is required.'),\n 'plan-name'\n );\n return;\n }\n const parsedFeatures = features\n .split('\\n')\n .map((f) => f.trim())\n .filter(Boolean);\n create.mutate(\n {\n providerId,\n name: name.trim(),\n interval,\n currency: currency.trim() || 'USD',\n ...(amount.trim() ? { amount: Number(amount) } : {}),\n ...(description.trim() ? { description: description.trim() } : {}),\n ...(parsedFeatures.length ? { features: parsedFeatures } : {}),\n },\n {\n onSuccess: () => onClose(),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.addPlanModal.error', 'Could not add plan.')\n ),\n }\n );\n };\n\n return (\n <Modal\n title={tr('providers.detail.addPlanModal.title', 'Add plan')}\n onClose={onClose}\n maxWidthClassName=\"max-w-xl\"\n >\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n {formError && (\n <div\n id={formErrorId}\n tabIndex={-1}\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {formError}\n </div>\n )}\n <div>\n <label htmlFor=\"plan-name\" className={labelCls}>\n {tr('providers.detail.addPlanModal.nameLabel', 'Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('plan-name')}\n id=\"plan-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder={tr(\n 'providers.detail.addPlanModal.namePlaceholder',\n 'e.g. Pro, Team, Enterprise'\n )}\n className={inputCls}\n required\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"plan-amount\" className={labelCls}>\n {tr('providers.detail.addPlanModal.amountLabel', 'Amount')}\n </label>\n <input\n {...fieldErrorProps('plan-amount')}\n id=\"plan-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n placeholder={tr('providers.detail.addPlanModal.amountPlaceholder', '0.00')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-currency\" className={labelCls}>\n {tr('providers.detail.addPlanModal.currencyLabel', 'Currency')}\n </label>\n <input\n {...fieldErrorProps('plan-currency')}\n id=\"plan-currency\"\n type=\"text\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n maxLength={3}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-interval\" className={labelCls}>\n {tr('providers.detail.addPlanModal.intervalLabel', 'Interval')}\n </label>\n <select\n {...fieldErrorProps('plan-interval')}\n id=\"plan-interval\"\n value={interval}\n onChange={(e) => setInterval(e.target.value as SubBillingInterval)}\n className={inputCls}\n >\n {INTERVALS.map((i) => (\n <option key={i} value={i}>\n {formatEnumLabel(i)}\n </option>\n ))}\n </select>\n </div>\n </div>\n <div>\n <label htmlFor=\"plan-desc\" className={labelCls}>\n {tr('providers.detail.addPlanModal.descriptionLabel', 'Description')}\n </label>\n <textarea\n {...fieldErrorProps('plan-desc')}\n id=\"plan-desc\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={2}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"plan-features\" className={labelCls}>\n {tr('providers.detail.addPlanModal.featuresLabel', 'Features')}{' '}\n <span className=\"text-text-secondary\">\n ({tr('providers.detail.addPlanModal.featuresHint', 'one per line')})\n </span>\n </label>\n <textarea\n {...fieldErrorProps('plan-features')}\n id=\"plan-features\"\n value={features}\n onChange={(e) => setFeatures(e.target.value)}\n rows={3}\n placeholder={tr(\n 'providers.detail.addPlanModal.featuresPlaceholder',\n 'Unlimited projects\\nPriority support\\nSSO'\n )}\n className={inputCls}\n />\n </div>\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={isActive}\n onChange={(e) => setIsActive(e.target.checked)}\n className=\"size-4 rounded border-border-subtle\"\n />\n {tr('providers.detail.addPlanModal.active', 'Active')}\n </label>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.addPlanModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={create.isPending}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {create.isPending\n ? tr('providers.detail.addPlanModal.adding', 'Adding…')\n : tr('providers.detail.addPlanModal.submit', 'Add plan')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Archive confirmation modal → subArchiveProvider\n// ---------------------------------------------------------------------------\n\nfunction ArchiveProviderModal({\n provider,\n onClose,\n}: {\n provider: SubProvider;\n onClose: () => void;\n}) {\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const archive = useArchiveProvider();\n const [error, setError] = useState<string | null>(null);\n\n const handleArchive = () => {\n setError(null);\n archive.mutate(provider.id, {\n onSuccess: () => navigateTo('/providers'),\n onError: (err) =>\n setError(\n err instanceof Error\n ? err.message\n : tr('providers.detail.archiveModal.error', 'Could not archive this provider.')\n ),\n });\n };\n\n return (\n <Modal title={tr('providers.detail.archiveModal.title', 'Archive provider')} onClose={onClose}>\n <div className=\"space-y-4\">\n {error && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text\"\n >\n {error}\n </div>\n )}\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'providers.detail.archiveModal.description',\n 'Archive {{name}}? It will be removed from the active registry. This can be reversed by an administrator.',\n { name: provider.name }\n )}\n </p>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('providers.detail.archiveModal.cancel', 'Cancel')}\n </button>\n <button\n type=\"button\"\n onClick={handleArchive}\n disabled={archive.isPending}\n className=\"rounded-lg border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm font-medium text-status-error-text hover:opacity-90 disabled:opacity-50\"\n >\n {archive.isPending\n ? tr('providers.detail.archiveModal.archiving', 'Archiving…')\n : tr('providers.detail.archiveModal.submit', 'Archive provider')}\n </button>\n </div>\n </div>\n </Modal>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Price history — real observed price points for this provider from the shared\n// benchmark dataset (`subListBenchmarkDataPoints`).\n//\n// A provider's data points span several plans, regions, currencies and billing\n// intervals. Plotting them in one line would draw price moves that never\n// happened (a $20/mo Basic point next to a $240/yr Enterprise point reads as a\n// 12× hike). The series is therefore narrowed to the exact\n// (plan, region, currency, interval) tuple of the most recent observation, and\n// the card names that tuple so the reader knows what the line describes.\n// ---------------------------------------------------------------------------\nfunction ProviderPriceHistory({ slug }: { slug: string | null }) {\n const { formatCurrency, formatDate, formatEnumLabel, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const { data, isLoading, isError, refetch } = useBenchmarkDataPoints(slug);\n\n const series = useMemo(() => {\n const ordered = [...(data ?? [])]\n .filter((point) => Number.isFinite(point.amount))\n .sort((a, b) => new Date(a.observedAt).getTime() - new Date(b.observedAt).getTime());\n const latest = ordered[ordered.length - 1];\n if (!latest) return null;\n const scoped: SubBenchmarkDataPoint[] = ordered.filter(\n (point) =>\n point.planName === latest.planName &&\n point.region === latest.region &&\n point.currency === latest.currency &&\n point.interval === latest.interval\n );\n const amounts = scoped.map((point) => point.amount);\n return {\n points: scoped,\n latest,\n amounts,\n min: Math.min(...amounts),\n max: Math.max(...amounts),\n first: amounts[0] ?? latest.amount,\n };\n }, [data]);\n\n return (\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <LineChart className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.marketBenchmark', 'Market benchmark')}\n </span>\n\n {!slug ? (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr(\n 'providers.detail.priceHistoryNoSlug',\n 'Add a slug to this provider to match it against the shared price benchmark dataset.'\n )}\n </p>\n ) : isLoading ? (\n <LoadingView\n className=\"min-h-[8rem]\"\n label={tr('providers.detail.priceHistoryLoading', 'Loading price history…')}\n />\n ) : isError ? (\n <ErrorView\n className=\"min-h-[8rem]\"\n title={tr('providers.detail.priceHistoryErrorTitle', 'Price history unavailable')}\n message={tr(\n 'providers.detail.priceHistoryError',\n 'Could not load observed prices for this provider.'\n )}\n onRetry={() => void refetch()}\n />\n ) : !series ? (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr(\n 'providers.detail.priceHistoryEmpty',\n 'No price observations recorded for this provider yet.'\n )}\n </p>\n ) : (\n <>\n <p className=\"mt-3 text-2xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(series.latest.amount, series.latest.currency)}\n <span className=\"text-sm font-normal text-text-secondary\">\n {formatIntervalSuffix(series.latest.interval)}\n </span>\n </p>\n <p className=\"text-xs text-text-secondary\">\n {series.latest.planName} · {series.latest.region} ·{' '}\n {tr('providers.detail.observed', 'observed')} {formatDate(series.latest.observedAt)}\n </p>\n <Sparkline\n className=\"mt-3 w-full\"\n points={series.amounts}\n positive={series.latest.amount <= series.first}\n />\n <dl className=\"mt-3 space-y-2 border-t border-border-subtle pt-3 text-xs\">\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.observedRange', 'Observed range')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {formatCurrency(series.min, series.latest.currency)} –{' '}\n {formatCurrency(series.max, series.latest.currency)}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.observations', 'Observations')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">{series.points.length}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.latestSource', 'Latest source')}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {series.latest.sourceLabel ?? formatEnumLabel(series.latest.sourceKind)}\n </dd>\n </div>\n </dl>\n </>\n )}\n </GlassCard>\n );\n}\n\nexport function ProviderDetailPage() {\n const { formatCurrency, formatEnumLabel, formatIntervalSuffix } = useFormatters();\n\n const { id } = useParams<{ id: string }>();\n const { navigateTo } = useSubscriberBot();\n const { data: provider, isLoading, isError, refetch } = useProvider(id);\n const [showEdit, setShowEdit] = useState(false);\n const [showAddPlan, setShowAddPlan] = useState(false);\n const [showArchive, setShowArchive] = useState(false);\n const tr = useTr();\n\n if (isLoading) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <LoadingView label={tr('providers.detail.loading', 'Loading provider…')} />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <ErrorView\n message={tr('providers.detail.error', 'Could not load this provider.')}\n onRetry={() => void refetch()}\n />\n </PageLayout>\n );\n }\n\n if (!provider) {\n return (\n <PageLayout title={tr('providers.detail.loadingTitle', 'Provider')}>\n <EmptyState\n illustration=\"empty-data\"\n title={tr('providers.detail.notFoundTitle', 'Provider not found')}\n description={tr(\n 'providers.detail.notFoundDescription',\n 'It may have been removed, or you may not have access to it.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/providers')}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n {tr('providers.detail.backToProviders', 'Back to providers')}\n </button>\n }\n />\n </PageLayout>\n );\n }\n\n const p = provider;\n // Only render the website as a link when it is a safe http(s) URL — websiteUrl\n // is user-controlled, so guard against javascript:/data: schemes and add\n // rel=\"noopener noreferrer\" to the target=\"_blank\" anchor.\n const safeWebsiteUrl = p.websiteUrl && /^https?:\\/\\//i.test(p.websiteUrl) ? p.websiteUrl : null;\n\n // Highlight the cheapest active priced plan as \"Best value\" (derived from real\n // plan data — guard for the no-plans / all-free case).\n const bestValuePlanId =\n p.plans && p.plans.length > 1\n ? (p.plans\n .filter((pl) => pl.isActive && pl.amount > 0)\n .reduce<SubPlan | null>(\n (min, pl) => (min === null || pl.amount < min.amount ? pl : min),\n null\n )?.id ?? null)\n : null;\n\n return (\n <PageLayout\n title={p.name}\n description={tr(CATEGORY_KEY[p.category], formatEnumLabel(p.category))}\n actions={\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowEdit(true)}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Pencil className=\"h-4 w-4\" /> {tr('providers.detail.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowArchive(true)}\n className=\"inline-flex items-center gap-2 rounded-lg border border-status-error-text/30 px-3 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Archive className=\"h-4 w-4\" /> {tr('providers.detail.archive', 'Archive')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/providers')}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"rtl:rotate-180 h-4 w-4\" /> {tr('providers.detail.back', 'Back')}\n </button>\n </div>\n }\n >\n {/* Identity row */}\n <div className=\"flex flex-wrap items-center gap-3\">\n <span className=\"flex size-11 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary\">\n <Building2 className=\"h-5 w-5\" />\n </span>\n <StatusBadge status={p.status} />\n {p.industry && <span className=\"text-sm text-text-secondary\">{p.industry}</span>}\n {p.region && <span className=\"text-sm text-text-secondary\">· {p.region}</span>}\n {safeWebsiteUrl && (\n <a\n href={safeWebsiteUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-sm text-text-link hover:underline\"\n >\n <Globe className=\"h-3.5 w-3.5\" /> {tr('providers.detail.website', 'Website')}\n </a>\n )}\n </div>\n\n {p.description && (\n <p className=\"mt-4 max-w-3xl text-sm leading-relaxed text-text-secondary\">\n {p.description}\n </p>\n )}\n\n <div className=\"mt-4\">\n <EntityTagPicker entityType=\"SUBSCRIBERBOT_PROVIDER\" entityId={p.id} />\n </div>\n\n {p.tags.length > 0 && (\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <Tag className=\"h-3.5 w-3.5 text-text-secondary\" />\n {p.tags.map((tag) => (\n <span\n key={tag}\n className=\"rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary\"\n >\n {tag}\n </span>\n ))}\n </div>\n )}\n\n <div className=\"mt-6 grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Plans — tier cards */}\n <div className=\"lg:col-span-2\">\n <Section\n title={tr('providers.detail.plans', 'Plans')}\n description={tr('providers.detail.plansDescription', 'Pricing this provider publishes')}\n action={\n <button\n type=\"button\"\n onClick={() => setShowAddPlan(true)}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <Plus className=\"h-3.5 w-3.5\" /> {tr('providers.detail.addPlan', 'Add plan')}\n </button>\n }\n >\n {!p.plans || p.plans.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('providers.detail.noPlansTitle', 'No published plans')}\n description={tr(\n 'providers.detail.noPlansDescription',\n \"When this provider publishes plans, they'll appear here.\"\n )}\n action={\n <button\n type=\"button\"\n onClick={() => setShowAddPlan(true)}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n {tr('providers.detail.addPlan', 'Add plan')}\n </button>\n }\n />\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n {p.plans.map((plan) => {\n const isBestValue = plan.id === bestValuePlanId && p.plans!.length > 1;\n return (\n <GlassCard\n key={plan.id}\n treatment={isBestValue ? 'insight' : 'metric'}\n glow={isBestValue}\n className=\"flex flex-col p-5\"\n >\n <div className=\"flex items-start justify-between gap-2\">\n <p className=\"text-sm font-semibold text-text-primary\">{plan.name}</p>\n {isBestValue ? (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle px-2 py-0.5 text-[11px] font-medium text-status-success-text\">\n <Sparkles className=\"h-3 w-3\" />{' '}\n {tr('providers.detail.bestValue', 'Best value')}\n </span>\n ) : (\n <StatusBadge status={plan.isActive ? 'ACTIVE' : 'DISABLED'} />\n )}\n </div>\n <p className=\"mt-3 text-2xl font-bold tabular-nums text-text-primary\">\n {formatCurrency(plan.amount, plan.currency)}\n <span className=\"text-sm font-normal text-text-secondary\">\n {formatIntervalSuffix(plan.interval)}\n </span>\n </p>\n {plan.description && (\n <p className=\"mt-2 text-xs leading-relaxed text-text-secondary\">\n {plan.description}\n </p>\n )}\n {plan.features.length > 0 && (\n <ul className=\"mt-4 space-y-2 border-t border-border-subtle pt-4\">\n {plan.features.slice(0, 6).map((f) => (\n <li\n key={f}\n className=\"flex items-start gap-2 text-xs text-text-secondary\"\n >\n <Check className=\"mt-0.5 h-3.5 w-3.5 shrink-0 text-status-success-text\" />\n <span>{f}</span>\n </li>\n ))}\n {plan.features.length > 6 && (\n <li className=\"ps-6 text-[11px] text-text-secondary\">\n {tr('providers.detail.moreFeatures', '+{{count}} more', {\n count: plan.features.length - 6,\n })}\n </li>\n )}\n </ul>\n )}\n </GlassCard>\n );\n })}\n </div>\n )}\n </Section>\n\n <ProviderPaidPriceHistory providerId={p.id} />\n <ProviderAlternatives providerId={p.id} />\n </div>\n\n {/* Sidebar — vendor health, churn risk, at-a-glance */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <ShieldCheck className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.vendorHealth', 'Vendor health')}\n </span>\n {p.vendorHealthScore != null && (\n <span\n className={cn(\n 'rounded-full px-2 py-0.5 text-[11px] font-medium',\n healthMeta(p.vendorHealthScore, tr).cls\n )}\n >\n {healthMeta(p.vendorHealthScore, tr).label}\n </span>\n )}\n </div>\n {p.vendorHealthScore != null ? (\n <div className=\"mt-2 flex flex-col items-center\">\n <Gauge\n value={p.vendorHealthScore}\n max={100}\n size={168}\n label={tr('providers.detail.outOf100', 'out of 100')}\n />\n </div>\n ) : (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr('providers.detail.noHealthScore', 'No health score yet.')}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <TrendingDown className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.churnRisk', 'Churn risk')}\n </span>\n {p.churnRiskScore != null && (\n <span\n className={cn(\n 'rounded-full px-2 py-0.5 text-[11px] font-medium',\n churnMeta(p.churnRiskScore, tr).chip\n )}\n >\n {churnMeta(p.churnRiskScore, tr).label}\n </span>\n )}\n </div>\n {p.churnRiskScore != null ? (\n <>\n <div className=\"mt-3 flex items-baseline justify-between\">\n <span className=\"text-2xl font-bold tabular-nums text-text-primary\">\n {p.churnRiskScore}\n </span>\n <span className=\"text-xs text-text-secondary\">/ 100</span>\n </div>\n <MiniProgress\n label={tr('common.healthScore', 'Health score')}\n value={p.churnRiskScore}\n tone={churnMeta(p.churnRiskScore, tr).tone}\n className=\"mt-2\"\n />\n </>\n ) : (\n <p className=\"mt-4 text-sm text-text-secondary\">\n {tr('providers.detail.noChurnSignal', 'No churn signal yet.')}\n </p>\n )}\n </GlassCard>\n\n <ProviderPriceHistory slug={p.slug} />\n\n <GlassCard treatment=\"metric\" className=\"p-5\">\n <span className=\"inline-flex items-center gap-2 text-sm font-medium text-text-primary\">\n <Layers className=\"h-4 w-4 text-text-secondary\" />{' '}\n {tr('providers.detail.atAGlance', 'At a glance')}\n </span>\n <dl className=\"mt-3 space-y-2.5 text-sm\">\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.category', 'Category')}\n </dt>\n <dd className=\"font-medium text-text-primary\">\n {tr(CATEGORY_KEY[p.category], formatEnumLabel(p.category))}\n </dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.industry', 'Industry')}\n </dt>\n <dd className=\"font-medium text-text-primary\">{p.industry ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">{tr('providers.detail.region', 'Region')}</dt>\n <dd className=\"font-medium text-text-primary\">{p.region ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.language', 'Language')}\n </dt>\n <dd className=\"font-medium text-text-primary\">{p.language ?? '—'}</dd>\n </div>\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-text-secondary\">\n {tr('providers.detail.publishedPlans', 'Published plans')}\n </dt>\n <dd className=\"font-medium tabular-nums text-text-primary\">\n {p.plans?.length ?? 0}\n </dd>\n </div>\n </dl>\n </GlassCard>\n </div>\n </div>\n\n {showEdit && <ProviderEditModal provider={p} onClose={() => setShowEdit(false)} />}\n {showAddPlan && <AddPlanModal providerId={p.id} onClose={() => setShowAddPlan(false)} />}\n {showArchive && <ArchiveProviderModal provider={p} onClose={() => setShowArchive(false)} />}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6DA,IAAMM,IACJ,wMACIC,IAAW,sDAEXC,IAAoC;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEMC,IAAoD;CACxD,MAAM;CACN,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,SAAS;CACT,SAAS;CACT,aAAa;CACb,SAAS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,UAAA,CACE,kBAAC,MAAD;WAAI,WAAU;WAAuB,UAAAxG,EAAG,2BAA2B,QAAQ;UAAM,CAAA,GACjF,kBAAC,MAAD;WAAI,WAAU;WAAiC,UAAAwG,EAAE,UAAU;UAAQ,CAAA,CAChE;;SACL,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAxG,EAAG,6BAA6B,UAAU;UACzC,CAAA,GACJ,kBAAC,MAAD;WAAI,WAAU;WAAiC,UAAAwG,EAAE,YAAY;UAAQ,CAAA,CAClE;;SACL,kBAAC,OAAD;UAAK,WAAU;UAAf,UAAA,CACE,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAxG,EAAG,mCAAmC,iBAAiB;UACtD,CAAA,GACJ,kBAAC,MAAD;WAAI,WAAU;WACX,UAAAwG,EAAE,OAAO,UAAU;UAClB,CAAA,CACD;;QACH;OACK,CAAA,CAAA;;KACR;IACF,CAAA,CAAA;;GAEJP,KAAY,kBAAC/F,IAAD;IAAmB,UAAUsG;IAAG,eAAeN,EAAY,EAAK;GAAI,CAAA;GAChFC,KAAe,kBAACrD,IAAD;IAAc,YAAY0D,EAAE;IAAI,eAAeJ,EAAe,EAAK;GAAI,CAAA;GACtFC,KAAe,kBAACvC,IAAD;IAAsB,UAAU0C;IAAG,eAAeF,EAAe,EAAK;GAAI,CAAA;EAChF;;AAEhB"}
@@ -5,8 +5,8 @@ import "../../components/index.js";
5
5
  import { useSubscriberBot as a } from "../../context/SubscriberBotContext.js";
6
6
  import { useProviderAlternatives as o, useProviderPriceHistory as s } from "../../hooks/useSubscriberBotApi.js";
7
7
  import { useTr as c } from "../../hooks/useTr.js";
8
- import { PriceHistoryChart as l } from "../../components/viz.js";
9
- import { formatCurrency as u, formatDate as d, formatEnumLabel as f, formatIntervalSuffix as p } from "../../utils/formatters.js";
8
+ import { formatCurrency as l, formatDate as u, formatEnumLabel as d, formatIntervalSuffix as f } from "../../utils/formatters.js";
9
+ import { PriceHistoryChart as p } from "../../components/viz.js";
10
10
  import { cn as m } from "../../utils/cn.js";
11
11
  import { useMemo as h } from "react";
12
12
  import { ArrowRight as g, Shuffle as _ } from "lucide-react";
@@ -33,7 +33,7 @@ function T(e, t) {
33
33
  let n = e.points.filter((t) => e.source !== "INVOICE" || t.monthlyAmount !== null).map((e) => ({
34
34
  at: e.observedAt,
35
35
  value: e.monthlyAmount,
36
- title: `${d(e.observedAt)} · ${u(e.amount, e.currency)}${p(e.interval)}`
36
+ title: `${u(e.observedAt)} · ${l(e.amount, e.currency)}${f(e.interval)}`
37
37
  }));
38
38
  if (e.source === "RELATIONSHIP" && e.relationshipId) for (let t of r.get(e.relationshipId) ?? []) n.push({
39
39
  at: t,
@@ -48,7 +48,7 @@ function T(e, t) {
48
48
  }).filter((e) => e.points.some((e) => e.value !== null));
49
49
  }
50
50
  function E({ providerId: i }) {
51
- let o = c(), { navigateTo: f } = a(), { data: g, isLoading: _, isError: E, refetch: D } = s(i), O = h(() => g ? T(g, o) : [], [g, o]), k = h(() => g ? [...g.points].reverse().slice(0, S) : [], [g]), A = g?.summary ?? null, j = A?.currency ?? "USD", M = h(() => {
51
+ let o = c(), { navigateTo: d } = a(), { data: g, isLoading: _, isError: E, refetch: D } = s(i), O = h(() => g ? T(g, o) : [], [g, o]), k = h(() => g ? [...g.points].reverse().slice(0, S) : [], [g]), A = g?.summary ?? null, j = A?.currency ?? "USD", M = h(() => {
52
52
  let e = /* @__PURE__ */ new Map();
53
53
  for (let t of g?.series ?? []) {
54
54
  let n = t.points[t.points.length - 1];
@@ -95,7 +95,7 @@ function E({ providerId: i }) {
95
95
  children: M && M.count > 1 ? o("providers.insights.latestMonthlyTotal", "Latest monthly price across {{count}} relationships", { count: M.count }) : o("providers.insights.latestMonthly", "Latest monthly price")
96
96
  }), /* @__PURE__ */ b("p", {
97
97
  className: "text-2xl font-bold tabular-nums text-text-primary",
98
- children: [M ? u(M.amount, j) : "—", /* @__PURE__ */ y("span", {
98
+ children: [M ? l(M.amount, j) : "—", /* @__PURE__ */ y("span", {
99
99
  className: "text-sm font-normal text-text-secondary",
100
100
  children: "/mo"
101
101
  })]
@@ -105,7 +105,7 @@ function E({ providerId: i }) {
105
105
  children: o("providers.insights.range", "Range paid")
106
106
  }), /* @__PURE__ */ y("p", {
107
107
  className: "text-sm font-medium tabular-nums text-text-primary",
108
- children: A.minMonthlyAmount != null && A.maxMonthlyAmount != null ? `${u(A.minMonthlyAmount, j)} – ${u(A.maxMonthlyAmount, j)}` : "—"
108
+ children: A.minMonthlyAmount != null && A.maxMonthlyAmount != null ? `${l(A.minMonthlyAmount, j)} – ${l(A.maxMonthlyAmount, j)}` : "—"
109
109
  })] }),
110
110
  /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("p", {
111
111
  className: "text-xs text-text-secondary",
@@ -119,20 +119,20 @@ function E({ providerId: i }) {
119
119
  children: o("providers.insights.latestChange", "Latest change")
120
120
  }), /* @__PURE__ */ b("span", {
121
121
  className: m("mt-0.5 inline-block rounded-full px-2 py-0.5 text-xs font-medium tabular-nums", C(A.latestChangePercent)),
122
- children: [w(A.latestChangePercent), A.latestChangeAt && ` · ${d(A.latestChangeAt)}`]
122
+ children: [w(A.latestChangePercent), A.latestChangeAt && ` · ${u(A.latestChangeAt)}`]
123
123
  })] })
124
124
  ]
125
125
  }),
126
- O.length > 0 ? /* @__PURE__ */ y(l, {
126
+ O.length > 0 ? /* @__PURE__ */ y(p, {
127
127
  className: "mt-4",
128
128
  series: O,
129
129
  now: /* @__PURE__ */ new Date(),
130
130
  ariaLabel: o("providers.insights.chartLabel", "Monthly price paid over time, in {{currency}}", { currency: j }),
131
- valueFormat: (e, t) => u(e, j, {
131
+ valueFormat: (e, t) => l(e, j, {
132
132
  minimumFractionDigits: t,
133
133
  maximumFractionDigits: t
134
134
  }),
135
- dateFormat: (e) => d(e, {
135
+ dateFormat: (e) => u(e, {
136
136
  day: void 0,
137
137
  month: "short",
138
138
  year: "numeric"
@@ -150,11 +150,11 @@ function E({ providerId: i }) {
150
150
  children: [
151
151
  /* @__PURE__ */ y("span", {
152
152
  className: "w-24 shrink-0 tabular-nums text-text-secondary",
153
- children: d(e.observedAt)
153
+ children: u(e.observedAt)
154
154
  }),
155
155
  e.relationshipId ? /* @__PURE__ */ y("button", {
156
156
  type: "button",
157
- onClick: () => f(`/relationships/${e.relationshipId}`),
157
+ onClick: () => d(`/relationships/${e.relationshipId}`),
158
158
  className: "truncate text-text-link hover:underline",
159
159
  children: e.label ?? o("providers.insights.untitled", "Untitled")
160
160
  }) : /* @__PURE__ */ y("span", {
@@ -168,9 +168,9 @@ function E({ providerId: i }) {
168
168
  ]
169
169
  }), /* @__PURE__ */ b("span", {
170
170
  className: "font-medium tabular-nums text-text-primary",
171
- children: [u(e.amount, e.currency), /* @__PURE__ */ y("span", {
171
+ children: [l(e.amount, e.currency), /* @__PURE__ */ y("span", {
172
172
  className: "text-xs font-normal text-text-secondary",
173
- children: p(e.interval)
173
+ children: f(e.interval)
174
174
  })]
175
175
  })]
176
176
  }, e.id))
@@ -180,7 +180,7 @@ function E({ providerId: i }) {
180
180
  });
181
181
  }
182
182
  function D({ range: e }) {
183
- let t = c(), n = e.minMonthlyAmount === e.maxMonthlyAmount ? u(e.minMonthlyAmount, e.currency) : `${u(e.minMonthlyAmount, e.currency)} – ${u(e.maxMonthlyAmount, e.currency)}`;
183
+ let t = c(), n = e.minMonthlyAmount === e.maxMonthlyAmount ? l(e.minMonthlyAmount, e.currency) : `${l(e.minMonthlyAmount, e.currency)} – ${l(e.maxMonthlyAmount, e.currency)}`;
184
184
  return /* @__PURE__ */ b("span", {
185
185
  className: "tabular-nums",
186
186
  children: [
@@ -225,7 +225,7 @@ function O({ alt: e }) {
225
225
  }),
226
226
  e.capabilities.map((t) => /* @__PURE__ */ y("span", {
227
227
  className: m("rounded-full px-2 py-0.5 text-[11px]", e.sharedCapabilities.includes(t) ? "bg-[var(--color-accent-soft)] font-medium text-text-primary" : "bg-bg-sunken text-text-secondary"),
228
- children: f(t.replace(/-/g, "_"))
228
+ children: d(t.replace(/-/g, "_"))
229
229
  }, t))
230
230
  ]
231
231
  })]
@@ -255,7 +255,7 @@ function O({ alt: e }) {
255
255
  }),
256
256
  /* @__PURE__ */ b("span", {
257
257
  className: "tabular-nums text-text-secondary",
258
- children: [u(e.amount, e.currency), p(e.interval)]
258
+ children: [l(e.amount, e.currency), f(e.interval)]
259
259
  }),
260
260
  /* @__PURE__ */ y(i, { status: e.status })
261
261
  ]