@burdenoff/microfe-subscriberbot 2026.1103.2 → 2026.1105.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/stories/Accessibility.stories.d.ts +13 -0
- package/dist/stories/Accessibility.stories.d.ts.map +1 -0
- package/dist/stories/pages/AgentNewPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts +1 -0
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/DashboardPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/InboxPage.stories.d.ts.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.js +168 -168
- package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js +116 -116
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js +211 -211
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
- package/dist/subscriberbot/components/Modal.d.ts.map +1 -1
- package/dist/subscriberbot/components/Modal.js +43 -33
- package/dist/subscriberbot/components/Modal.js.map +1 -1
- package/dist/subscriberbot/components/PageLayout.d.ts +6 -0
- package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -1
- package/dist/subscriberbot/components/PageLayout.js +2 -1
- package/dist/subscriberbot/components/PageLayout.js.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.js +10 -10
- package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
- package/dist/subscriberbot/components/StateViews.d.ts +2 -0
- package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
- package/dist/subscriberbot/components/StateViews.js +46 -37
- package/dist/subscriberbot/components/StateViews.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.js +6 -6
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionBanners.js +6 -6
- package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionCard.js +149 -147
- package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +143 -135
- package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +114 -114
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts +3 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.js +5 -3
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +4 -4
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +11 -11
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js +29 -29
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +43 -43
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +4 -4
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementThread.js +14 -14
- package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.js +242 -237
- package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
- package/dist/subscriberbot/components/viz.d.ts +1 -0
- package/dist/subscriberbot/components/viz.d.ts.map +1 -1
- package/dist/subscriberbot/components/viz.js +100 -101
- package/dist/subscriberbot/components/viz.js.map +1 -1
- package/dist/subscriberbot/hooks/index.js +1 -1
- package/dist/subscriberbot/hooks/useFormError.d.ts +7 -0
- package/dist/subscriberbot/hooks/useFormError.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useFormError.js +28 -0
- package/dist/subscriberbot/hooks/useFormError.js.map +1 -0
- package/dist/subscriberbot/hooks/useFormatters.d.ts +11 -0
- package/dist/subscriberbot/hooks/useFormatters.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useFormatters.js +13 -0
- package/dist/subscriberbot/hooks/useFormatters.js.map +1 -0
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +371 -370
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useTr.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useTr.js +1 -1
- package/dist/subscriberbot/hooks/useTr.js.map +1 -1
- package/dist/subscriberbot/index.js +1 -1
- package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/AssetVaultPage.js +124 -124
- package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.d.ts +0 -10
- package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.js +115 -98
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.d.ts +0 -10
- package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.js +421 -402
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.js +130 -121
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.d.ts +0 -12
- package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.js +237 -215
- package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.js +303 -295
- package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.js +57 -57
- package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts +0 -13
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.js +202 -196
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +0 -18
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js +283 -275
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +0 -6
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.js +85 -77
- package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +0 -9
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.js +136 -136
- package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +0 -9
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +272 -260
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +0 -10
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +96 -96
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +0 -11
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js +46 -46
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +0 -11
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +181 -171
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +0 -9
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +164 -164
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +0 -9
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +197 -181
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +0 -8
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +79 -79
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +0 -9
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +147 -147
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +0 -10
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +204 -188
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +0 -9
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js +80 -80
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +0 -10
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +484 -458
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +0 -8
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js +146 -136
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +0 -10
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js +88 -87
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +0 -11
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +520 -490
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +0 -8
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +112 -91
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +0 -8
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +97 -96
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +76 -74
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +5 -3
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +26 -25
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
- package/dist/subscriberbot/utils/formatters.d.ts +16 -5
- package/dist/subscriberbot/utils/formatters.d.ts.map +1 -1
- package/dist/subscriberbot/utils/formatters.js +57 -25
- package/dist/subscriberbot/utils/formatters.js.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts +2 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.js +21 -21
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileDashboard.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileDashboard.tsx"],"sourcesContent":["/**\n * Mobile overview\n * @module subscriberbot/components/mobile\n *\n * The phone overview from `sb-24-mobile-app.jpg`: total recurring spend in the\n * hero, then card-first sections for upcoming renewals, what needs action in\n * the Universal Inbox, open AI recommendations, and quick actions. Every\n * number comes from the same real queries the desktop dashboard uses — the\n * page computes once and hands the results down.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport {\n AlertTriangle,\n ArrowRight,\n Bot,\n ChevronRight,\n Inbox,\n Lightbulb,\n PiggyBank,\n Plus,\n ShieldCheck,\n} from 'lucide-react';\nimport { StatusBadge } from '../StatusBadge';\nimport { MobileScreen, MobileSection } from './MobileScreen';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { RECOMMENDATION_LABEL } from '../decisions/decisionModel';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatIntervalSuffix } from '../../utils/formatters';\nimport {\n daysUntil,\n renewalCountdown,\n type RecurringSpend,\n type UpcomingRenewal,\n} from '../../utils/portfolio';\nimport type { SubDecision, SubInboxMessage } from '../../types';\n\nexport interface MobileDashboardProps {\n greetingName?: string;\n spend: RecurringSpend;\n upcoming: UpcomingRenewal[];\n actionMessages: SubInboxMessage[];\n /** PROPOSED AI decisions, newest first. */\n decisions: SubDecision[];\n relationshipLabel: (relationshipId: string) => string | undefined;\n openInvoiceCount: number;\n openInvoiceTotal: number;\n navigateTo: (relativePath: string) => void;\n}\n\nconst cardCls =\n 'flex w-full items-center gap-3 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left shadow-sm transition-colors active:bg-bg-sunken';\n\nconst linkCls = 'inline-flex items-center gap-0.5 text-sm font-medium text-text-link';\n\nexport const MobileDashboard: FC<MobileDashboardProps> = ({\n greetingName,\n spend,\n upcoming,\n actionMessages,\n decisions,\n relationshipLabel,\n openInvoiceCount,\n openInvoiceTotal,\n navigateTo,\n}) => {\n const tr = useTr();\n\n const quickActions: Array<{ id: string; label: string; icon: ReactNode; path: string }> = [\n {\n id: 'add',\n label: tr('mobile.dashboard.quick.add', 'Add subscription'),\n icon: <Plus className=\"h-5 w-5\" />,\n path: '/relationships/new',\n },\n {\n id: 'inbox',\n label: tr('mobile.dashboard.quick.inbox', 'Inbox'),\n icon: <Inbox className=\"h-5 w-5\" />,\n path: '/inbox',\n },\n {\n id: 'savings',\n label: tr('mobile.dashboard.quick.savings', 'Savings'),\n icon: <PiggyBank className=\"h-5 w-5\" />,\n path: '/savings',\n },\n {\n id: 'agents',\n label: tr('mobile.dashboard.quick.agents', 'Agents'),\n icon: <Bot className=\"h-5 w-5\" />,\n path: '/agents',\n },\n ];\n\n return (\n <MobileScreen\n testId=\"sb-mobile-dashboard\"\n title={tr('dashboard.title', 'Overview')}\n eyebrow={\n greetingName\n ? tr('mobile.dashboard.greeting', 'Hi, {{name}}', { name: greetingName })\n : undefined\n }\n hero={\n <div>\n <p className=\"text-sm opacity-80\">\n {tr('mobile.dashboard.totalSpend', 'Total recurring spend')}\n </p>\n <p className=\"mt-1 font-bold tabular-nums\" data-testid=\"sb-mobile-total-spend\">\n <span className=\"text-4xl\">{formatCurrency(spend.monthly, spend.currency)}</span>\n <span className=\"text-base font-medium opacity-80\">\n {tr('mobile.dashboard.perMonth', '/month')}\n </span>\n </p>\n <p className=\"mt-1 text-xs opacity-80\">\n {tr(\n spend.activeCount === 1\n ? 'mobile.dashboard.activeCountOne'\n : 'mobile.dashboard.activeCount',\n spend.activeCount === 1\n ? '{{count}} active subscription'\n : '{{count}} active subscriptions',\n { count: spend.activeCount }\n )}\n </p>\n </div>\n }\n >\n <MobileSection\n title={tr('dashboard.renewals.title', 'Upcoming renewals')}\n action={\n upcoming.length > 0 ? (\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/relationships')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n ) : undefined\n }\n >\n {upcoming.length === 0 ? (\n <div className={cn(cardCls, 'text-sm text-text-secondary')}>\n {tr(\n 'dashboard.renewals.emptyDescription',\n 'Renewals you track will appear here ahead of time.'\n )}\n </div>\n ) : (\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-renewals\">\n {upcoming.slice(0, 5).map((u) => {\n const days = daysUntil(u.when);\n const countdown = days == null ? null : renewalCountdown(days);\n return (\n <li key={u.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/relationships/${u.relationshipId}`)}\n >\n <RelationshipGlyph kind={u.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {u.title}\n </span>\n {u.amount != null && (\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(u.amount, u.currency ?? spend.currency)}\n {u.interval ? formatIntervalSuffix(u.interval) : ''}\n </span>\n )}\n {countdown && (\n <span\n className={cn(\n 'block text-sm',\n countdown.tone === 'later'\n ? 'text-text-secondary'\n : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n <ChevronRight className=\"h-4 w-4 shrink-0 text-text-secondary\" />\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </MobileSection>\n\n <MobileSection\n title={tr('mobile.dashboard.needsAction', 'Needs action')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/inbox')}>\n {tr('dashboard.needsAttention.openInbox', 'Open inbox')}{' '}\n <ChevronRight className=\"h-4 w-4\" />\n </button>\n }\n >\n {actionMessages.length === 0 ? (\n <div className={cardCls}>\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-status-success-bg-subtle text-status-success-text\">\n <ShieldCheck className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {tr('dashboard.needsAttention.allCaughtUp', \"You're all caught up\")}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(\n 'dashboard.needsAttention.allCaughtUpDescription',\n 'Required actions across your channels will surface here.'\n )}\n </span>\n </span>\n </div>\n ) : (\n <ul className=\"space-y-3\">\n {actionMessages.slice(0, 3).map((m) => (\n <li key={m.id}>\n <button type=\"button\" className={cardCls} onClick={() => navigateTo('/inbox')}>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {m.subject || tr('dashboard.needsAttention.noSubject', '(no subject)')}\n </span>\n {m.preview && (\n <span className=\"block truncate text-sm text-text-secondary\">\n {m.preview}\n </span>\n )}\n </span>\n <StatusBadge status={m.category} className=\"shrink-0\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </MobileSection>\n\n {decisions.length > 0 && (\n <MobileSection\n title={tr('mobile.dashboard.recommendations', 'AI recommendations')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/decisions')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"h-4 w-4\" />\n </button>\n }\n >\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-decisions\">\n {decisions.slice(0, 3).map((d) => {\n const rec = RECOMMENDATION_LABEL[d.recommendation];\n return (\n <li key={d.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/decisions/${d.id}`)}\n >\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary\">\n <Lightbulb className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {rec ? tr(rec.key, rec.fallback) : d.recommendation}\n </span>\n <span className=\"block truncate text-sm text-text-secondary\">\n {relationshipLabel(d.relationshipId) ?? d.rationale}\n </span>\n </span>\n {d.estimatedSavings > 0 && (\n <span className=\"shrink-0 text-sm font-semibold tabular-nums text-status-success-text\">\n {tr('mobile.dashboard.savesPerYear', 'Save {{amount}}/yr', {\n amount: formatCurrency(d.estimatedSavings, d.currency, {\n maximumFractionDigits: 0,\n }),\n })}\n </span>\n )}\n </button>\n </li>\n );\n })}\n </ul>\n </MobileSection>\n )}\n\n {openInvoiceCount > 0 && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/invoices')}\n className=\"mt-6 flex w-full items-center justify-between gap-3 rounded-2xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-4 py-3 text-left\"\n >\n <span className=\"flex items-center gap-3\">\n <AlertTriangle className=\"h-5 w-5 shrink-0 text-status-warning-text\" />\n <span className=\"text-sm font-medium text-status-warning-text\">\n {tr(\n 'dashboard.openInvoices.label',\n '{{count}} open invoice · {{amount}} outstanding',\n {\n count: openInvoiceCount,\n amount: formatCurrency(openInvoiceTotal, spend.currency),\n }\n )}\n </span>\n </span>\n <ArrowRight className=\"h-4 w-4 shrink-0 text-status-warning-text\" />\n </button>\n )}\n\n <MobileSection title={tr('dashboard.quickActions.title', 'Quick actions')}>\n <div className=\"grid grid-cols-2 gap-3\">\n {quickActions.map((qa) => (\n <button\n key={qa.id}\n type=\"button\"\n onClick={() => navigateTo(qa.path)}\n className=\"flex min-h-20 flex-col items-start justify-between gap-2 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-left active:bg-bg-sunken\"\n >\n <span className=\"flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n {qa.icon}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">{qa.label}</span>\n </button>\n ))}\n </div>\n </MobileSection>\n </MobileScreen>\n );\n};\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AAU;eACZ,EAAa,KAAK,MACjB,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe,EAAW,EAAG,IAAI;MACjC,WAAU;gBAJZ,CAME,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAG;MACA,CAAA,GACN,kBAAC,QAAD;OAAM,WAAU;iBAAyC,EAAG;MAAY,CAAA,CAClE;QATD,EAAG,EASF,CACT;IACE,CAAA;GACQ,CAAA;EACH;;AAElB"}
|
|
1
|
+
{"version":3,"file":"MobileDashboard.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileDashboard.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Mobile overview\n * @module subscriberbot/components/mobile\n *\n * The phone overview from `sb-24-mobile-app.jpg`: total recurring spend in the\n * hero, then card-first sections for upcoming renewals, what needs action in\n * the Universal Inbox, open AI recommendations, and quick actions. Every\n * number comes from the same real queries the desktop dashboard uses — the\n * page computes once and hands the results down.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport {\n AlertTriangle,\n ArrowRight,\n Bot,\n ChevronRight,\n Inbox,\n Lightbulb,\n PiggyBank,\n Plus,\n ShieldCheck,\n} from 'lucide-react';\nimport { StatusBadge } from '../StatusBadge';\nimport { MobileScreen, MobileSection } from './MobileScreen';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { RECOMMENDATION_LABEL } from '../decisions/decisionModel';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport {\n daysUntil,\n renewalCountdown,\n type RecurringSpend,\n type UpcomingRenewal,\n} from '../../utils/portfolio';\nimport type { SubDecision, SubInboxMessage } from '../../types';\n\nexport interface MobileDashboardProps {\n greetingName?: string;\n spend: RecurringSpend;\n upcoming: UpcomingRenewal[];\n actionMessages: SubInboxMessage[];\n /** PROPOSED AI decisions, newest first. */\n decisions: SubDecision[];\n relationshipLabel: (relationshipId: string) => string | undefined;\n openInvoiceCount: number;\n openInvoiceTotal: number;\n navigateTo: (relativePath: string) => void;\n}\n\nconst cardCls =\n 'flex w-full items-center gap-3 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-start shadow-sm transition-colors active:bg-bg-sunken';\n\nconst linkCls = 'inline-flex items-center gap-0.5 text-sm font-medium text-text-link';\n\nexport const MobileDashboard: FC<MobileDashboardProps> = ({\n greetingName,\n spend,\n upcoming,\n actionMessages,\n decisions,\n relationshipLabel,\n openInvoiceCount,\n openInvoiceTotal,\n navigateTo,\n}) => {\n const { formatCurrency, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n\n const quickActions: Array<{ id: string; label: string; icon: ReactNode; path: string }> = [\n {\n id: 'add',\n label: tr('mobile.dashboard.quick.add', 'Add subscription'),\n icon: <Plus className=\"h-5 w-5\" />,\n path: '/relationships/new',\n },\n {\n id: 'inbox',\n label: tr('mobile.dashboard.quick.inbox', 'Inbox'),\n icon: <Inbox className=\"h-5 w-5\" />,\n path: '/inbox',\n },\n {\n id: 'savings',\n label: tr('mobile.dashboard.quick.savings', 'Savings'),\n icon: <PiggyBank className=\"h-5 w-5\" />,\n path: '/savings',\n },\n {\n id: 'agents',\n label: tr('mobile.dashboard.quick.agents', 'Agents'),\n icon: <Bot className=\"h-5 w-5\" />,\n path: '/agents',\n },\n ];\n\n return (\n <MobileScreen\n dataTour=\"subscriberbot-home\"\n testId=\"sb-mobile-dashboard\"\n title={tr('dashboard.title', 'Overview')}\n eyebrow={\n greetingName\n ? tr('mobile.dashboard.greeting', 'Hi, {{name}}', { name: greetingName })\n : undefined\n }\n hero={\n <div data-tour=\"subscriberbot-home-metrics\">\n <p className=\"text-sm\">{tr('mobile.dashboard.totalSpend', 'Total recurring spend')}</p>\n <p className=\"mt-1 font-bold tabular-nums\" data-testid=\"sb-mobile-total-spend\">\n <span className=\"text-4xl\">{formatCurrency(spend.monthly, spend.currency)}</span>\n <span className=\"text-base font-medium\">\n {tr('mobile.dashboard.perMonth', '/month')}\n </span>\n </p>\n <p className=\"mt-1 text-xs\" data-tour=\"subscriberbot-home-portfolio\">\n {tr(\n spend.activeCount === 1\n ? 'mobile.dashboard.activeCountOne'\n : 'mobile.dashboard.activeCount',\n spend.activeCount === 1\n ? '{{count}} active subscription'\n : '{{count}} active subscriptions',\n { count: spend.activeCount }\n )}\n </p>\n </div>\n }\n >\n <MobileSection\n dataTour=\"subscriberbot-home-renewals\"\n title={tr('dashboard.renewals.title', 'Upcoming renewals')}\n action={\n upcoming.length > 0 ? (\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/relationships')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"rtl:rotate-180 h-4 w-4\" />\n </button>\n ) : undefined\n }\n >\n {upcoming.length === 0 ? (\n <div className={cn(cardCls, 'text-sm text-text-secondary')}>\n {tr(\n 'dashboard.renewals.emptyDescription',\n 'Renewals you track will appear here ahead of time.'\n )}\n </div>\n ) : (\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-renewals\">\n {upcoming.slice(0, 5).map((u) => {\n const days = daysUntil(u.when);\n const countdown = days == null ? null : renewalCountdown(days);\n return (\n <li key={u.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/relationships/${u.relationshipId}`)}\n >\n <RelationshipGlyph kind={u.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {u.title}\n </span>\n {u.amount != null && (\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(u.amount, u.currency ?? spend.currency)}\n {u.interval ? formatIntervalSuffix(u.interval) : ''}\n </span>\n )}\n {countdown && (\n <span\n className={cn(\n 'block text-sm',\n countdown.tone === 'later'\n ? 'text-text-secondary'\n : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n <ChevronRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-text-secondary\" />\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </MobileSection>\n\n <MobileSection\n dataTour=\"subscriberbot-home-needs-attention\"\n title={tr('mobile.dashboard.needsAction', 'Needs action')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/inbox')}>\n {tr('dashboard.needsAttention.openInbox', 'Open inbox')}{' '}\n <ChevronRight className=\"rtl:rotate-180 h-4 w-4\" />\n </button>\n }\n >\n {actionMessages.length === 0 ? (\n <div className={cardCls}>\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-status-success-bg-subtle text-status-success-text\">\n <ShieldCheck className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {tr('dashboard.needsAttention.allCaughtUp', \"You're all caught up\")}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(\n 'dashboard.needsAttention.allCaughtUpDescription',\n 'Required actions across your channels will surface here.'\n )}\n </span>\n </span>\n </div>\n ) : (\n <ul className=\"space-y-3\">\n {actionMessages.slice(0, 3).map((m) => (\n <li key={m.id}>\n <button type=\"button\" className={cardCls} onClick={() => navigateTo('/inbox')}>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {m.subject || tr('dashboard.needsAttention.noSubject', '(no subject)')}\n </span>\n {m.preview && (\n <span className=\"block truncate text-sm text-text-secondary\">\n {m.preview}\n </span>\n )}\n </span>\n <StatusBadge status={m.category} className=\"shrink-0\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </MobileSection>\n\n {decisions.length > 0 && (\n <MobileSection\n title={tr('mobile.dashboard.recommendations', 'AI recommendations')}\n action={\n <button type=\"button\" className={linkCls} onClick={() => navigateTo('/decisions')}>\n {tr('common.viewAll', 'View all')} <ChevronRight className=\"rtl:rotate-180 h-4 w-4\" />\n </button>\n }\n >\n <ul className=\"space-y-3\" data-testid=\"sb-mobile-decisions\">\n {decisions.slice(0, 3).map((d) => {\n const rec = RECOMMENDATION_LABEL[d.recommendation];\n return (\n <li key={d.id}>\n <button\n type=\"button\"\n className={cardCls}\n onClick={() => navigateTo(`/decisions/${d.id}`)}\n >\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary\">\n <Lightbulb className=\"h-5 w-5\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">\n {rec ? tr(rec.key, rec.fallback) : d.recommendation}\n </span>\n <span className=\"block truncate text-sm text-text-secondary\">\n {relationshipLabel(d.relationshipId) ?? d.rationale}\n </span>\n </span>\n {d.estimatedSavings > 0 && (\n <span className=\"shrink-0 text-sm font-semibold tabular-nums text-status-success-text\">\n {tr('mobile.dashboard.savesPerYear', 'Save {{amount}}/yr', {\n amount: formatCurrency(d.estimatedSavings, d.currency, {\n maximumFractionDigits: 0,\n }),\n })}\n </span>\n )}\n </button>\n </li>\n );\n })}\n </ul>\n </MobileSection>\n )}\n\n {openInvoiceCount > 0 && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/invoices')}\n className=\"mt-6 flex w-full items-center justify-between gap-3 rounded-2xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-4 py-3 text-start\"\n >\n <span className=\"flex items-center gap-3\">\n <AlertTriangle className=\"h-5 w-5 shrink-0 text-status-warning-text\" />\n <span className=\"text-sm font-medium text-status-warning-text\">\n {tr(\n 'dashboard.openInvoices.label',\n '{{count}} open invoice · {{amount}} outstanding',\n {\n count: openInvoiceCount,\n amount: formatCurrency(openInvoiceTotal, spend.currency),\n }\n )}\n </span>\n </span>\n <ArrowRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-status-warning-text\" />\n </button>\n )}\n\n <MobileSection\n title={tr('dashboard.quickActions.title', 'Quick actions')}\n dataTour=\"subscriberbot-home-quick-actions\"\n >\n <div className=\"grid grid-cols-2 gap-3\">\n {quickActions.map((qa) => (\n <button\n key={qa.id}\n type=\"button\"\n onClick={() => navigateTo(qa.path)}\n className=\"flex min-h-20 flex-col items-start justify-between gap-2 rounded-2xl border border-border-subtle bg-bg-surface p-4 text-start active:bg-bg-sunken\"\n >\n <span className=\"flex size-9 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n {qa.icon}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">{qa.label}</span>\n </button>\n ))}\n </div>\n </MobileSection>\n </MobileScreen>\n );\n};\n"],"mappings":";;;;;;;;;;;AAoDA,IAAM,IACJ,uJAEI,IAAU,uEAEH,KAA6C,EACxD,iBACA,UACA,aACA,mBACA,cACA,sBACA,qBACA,qBACA,oBACI;CACJ,IAAM,EAAE,mBAAgB,4BAAyB,EAAc,GAEzD,IAAK,EAAM,GAEX,IAAoF;EACxF;GACE,IAAI;GACJ,OAAO,EAAG,8BAA8B,kBAAkB;GAC1D,MAAM,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;GACjC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,gCAAgC,OAAO;GACjD,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;GAClC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,kCAAkC,SAAS;GACrD,MAAM,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;GACtC,MAAM;EACR;EACA;GACE,IAAI;GACJ,OAAO,EAAG,iCAAiC,QAAQ;GACnD,MAAM,kBAAC,GAAD,EAAK,WAAU,UAAW,CAAA;GAChC,MAAM;EACR;CACF;CAEA,OACE,kBAAC,GAAD;EACE,UAAS;EACT,QAAO;EACP,OAAO,EAAG,mBAAmB,UAAU;EACvC,SACE,IACI,EAAG,6BAA6B,gBAAgB,EAAE,MAAM,EAAa,CAAC,IACtE,KAAA;EAEN,MACE,kBAAC,OAAD;GAAK,aAAU;aAAf;IACE,kBAAC,KAAD;KAAG,WAAU;eAAW,EAAG,+BAA+B,uBAAuB;IAAK,CAAA;IACtF,kBAAC,KAAD;KAAG,WAAU;KAA8B,eAAY;eAAvD,CACE,kBAAC,QAAD;MAAM,WAAU;gBAAY,EAAe,EAAM,SAAS,EAAM,QAAQ;KA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CAAA,GACtE,kBAAC,QAAD;MAAM,WAAU;gBACb,EACC,gCACA,mDACA;OACE,OAAO;OACP,QAAQ,EAAe,GAAkB,EAAM,QAAQ;MACzD,CACF;KACI,CAAA,CACF;QACN,kBAAC,GAAD,EAAY,WAAU,2DAA4D,CAAA,CAC5E;;GAGV,kBAAC,GAAD;IACE,OAAO,EAAG,gCAAgC,eAAe;IACzD,UAAS;cAET,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAa,KAAK,MACjB,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe,EAAW,EAAG,IAAI;MACjC,WAAU;gBAJZ,CAME,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAG;MACA,CAAA,GACN,kBAAC,QAAD;OAAM,WAAU;iBAAyC,EAAG;MAAY,CAAA,CAClE;QATD,EAAG,EASF,CACT;IACE,CAAA;GACQ,CAAA;EACH;;AAElB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileRelationshipList.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MobileRelationshipList.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAkCf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqCnD,UAAU,2BAA2B;IACnC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CA8IlE,CAAC"}
|
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../../hooks/useTr.js";
|
|
2
|
+
import { useFormatters as t } from "../../hooks/useFormatters.js";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
3
4
|
import { StatusBadge as r } from "../StatusBadge.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { AlertDialog as T, AlertDialogAction as E, AlertDialogCancel as D, AlertDialogContent as O, AlertDialogDescription as k, AlertDialogFooter as A, AlertDialogHeader as j, AlertDialogTitle as M, BottomSheet as N, BottomSheetContent as P, BottomSheetDescription as F, BottomSheetHeader as I, BottomSheetTitle as L } from "@burdenoff/fe-libs/ui";
|
|
5
|
+
import { useCancelRelationship as i, useTransitionRelationship as a } from "../../hooks/useSubscriberBotApi.js";
|
|
6
|
+
import { daysUntil as o, isSwipeTrailingClick as s, quickActionsFor as c, renewalCountdown as l, swipeClickDeadline as u, swipeOffset as d, swipeSettlesOpen as f } from "../../utils/portfolio.js";
|
|
7
|
+
import { RelationshipGlyph as p } from "./RelationshipGlyph.js";
|
|
8
|
+
import { useRef as m, useState as h } from "react";
|
|
9
|
+
import { Ban as g, ChevronRight as _, MoreHorizontal as v, Pause as y, Play as b } from "lucide-react";
|
|
10
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
11
|
+
import { AlertDialog as w, AlertDialogAction as T, AlertDialogCancel as E, AlertDialogContent as D, AlertDialogDescription as O, AlertDialogFooter as k, AlertDialogHeader as A, AlertDialogTitle as j, BottomSheet as M, BottomSheetContent as N, BottomSheetDescription as P, BottomSheetHeader as F, BottomSheetTitle as I } from "@burdenoff/fe-libs/ui";
|
|
12
12
|
//#region src/subscriberbot/components/mobile/MobileRelationshipList.tsx
|
|
13
|
-
var
|
|
13
|
+
var L = 84, R = 8, z = {
|
|
14
14
|
activate: {
|
|
15
15
|
key: "relationships.detail.actions.activate",
|
|
16
16
|
fallback: "Activate",
|
|
17
|
-
icon:
|
|
17
|
+
icon: b,
|
|
18
18
|
tone: "bg-status-success-bg-subtle text-status-success-text"
|
|
19
19
|
},
|
|
20
20
|
resume: {
|
|
21
21
|
key: "mobile.relationships.resume",
|
|
22
22
|
fallback: "Resume",
|
|
23
|
-
icon:
|
|
23
|
+
icon: b,
|
|
24
24
|
tone: "bg-status-success-bg-subtle text-status-success-text"
|
|
25
25
|
},
|
|
26
26
|
pause: {
|
|
27
27
|
key: "relationships.detail.actions.pause",
|
|
28
28
|
fallback: "Pause",
|
|
29
|
-
icon:
|
|
29
|
+
icon: y,
|
|
30
30
|
tone: "bg-status-warning-bg-subtle text-status-warning-text"
|
|
31
31
|
},
|
|
32
32
|
cancel: {
|
|
33
33
|
key: "relationships.detail.actions.cancel",
|
|
34
34
|
fallback: "Cancel",
|
|
35
|
-
icon:
|
|
35
|
+
icon: g,
|
|
36
36
|
tone: "bg-status-error-bg-subtle text-status-error-text"
|
|
37
37
|
}
|
|
38
|
-
},
|
|
39
|
-
let
|
|
40
|
-
if (
|
|
41
|
-
|
|
38
|
+
}, B = ({ items: r, navigateTo: o }) => {
|
|
39
|
+
let { formatCurrency: s, formatIntervalSuffix: l } = t(), u = e(), d = a(), f = i(), [p, m] = h(null), [g, v] = h(null), [y, b] = h(null), [L, R] = h(null), B = d.isPending || f.isPending, H = (e) => R(e instanceof Error ? e.message : u("mobile.relationships.actionFailed", "That action could not be completed.")), U = (e, t) => {
|
|
40
|
+
if (m(null), v(null), R(null), t.destructive) {
|
|
41
|
+
b(e);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
d.mutate({
|
|
45
45
|
id: e.id,
|
|
46
46
|
status: t.target
|
|
47
|
-
}, { onError:
|
|
47
|
+
}, { onError: H });
|
|
48
48
|
};
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
49
|
+
return /* @__PURE__ */ C(x, { children: [
|
|
50
|
+
L && /* @__PURE__ */ S("div", {
|
|
51
51
|
role: "alert",
|
|
52
52
|
className: "mt-4 rounded-xl border border-status-error-text/30 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
53
|
-
children:
|
|
53
|
+
children: L
|
|
54
54
|
}),
|
|
55
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ S("ul", {
|
|
56
56
|
className: "mt-4 space-y-3",
|
|
57
57
|
"data-testid": "sb-mobile-relationship-list",
|
|
58
|
-
children: r.map((e) => /* @__PURE__ */
|
|
58
|
+
children: r.map((e) => /* @__PURE__ */ S(V, {
|
|
59
59
|
relationship: e,
|
|
60
|
-
open:
|
|
61
|
-
busy:
|
|
62
|
-
onOpenChange: (t) =>
|
|
63
|
-
onSelect: () =>
|
|
60
|
+
open: p === e.id,
|
|
61
|
+
busy: B,
|
|
62
|
+
onOpenChange: (t) => m(t ? e.id : null),
|
|
63
|
+
onSelect: () => o(`/relationships/${e.id}`),
|
|
64
64
|
onMore: () => {
|
|
65
|
-
|
|
65
|
+
m(null), v(e);
|
|
66
66
|
},
|
|
67
|
-
onAction: (t) =>
|
|
67
|
+
onAction: (t) => U(e, t)
|
|
68
68
|
}, e.id))
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
open:
|
|
72
|
-
onOpenChange: (e) => !e &&
|
|
73
|
-
children: /* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ S(M, {
|
|
71
|
+
open: g != null,
|
|
72
|
+
onOpenChange: (e) => !e && v(null),
|
|
73
|
+
children: /* @__PURE__ */ S(N, {
|
|
74
74
|
"data-testid": "sb-mobile-relationship-actions",
|
|
75
|
-
children:
|
|
75
|
+
children: g && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C(F, { children: [/* @__PURE__ */ S(I, { children: g.label }), /* @__PURE__ */ C(P, { children: [s(g.amount, g.currency), l(g.interval)] })] }), /* @__PURE__ */ C("div", {
|
|
76
76
|
className: "flex flex-col gap-2 py-2",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ C("button", {
|
|
78
78
|
type: "button",
|
|
79
|
-
className: "flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-
|
|
79
|
+
className: "flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-start text-sm font-medium text-text-primary active:bg-bg-sunken",
|
|
80
80
|
onClick: () => {
|
|
81
|
-
let e =
|
|
82
|
-
|
|
81
|
+
let e = g.id;
|
|
82
|
+
v(null), o(`/relationships/${e}`);
|
|
83
83
|
},
|
|
84
|
-
children: [
|
|
85
|
-
}),
|
|
86
|
-
let
|
|
87
|
-
return /* @__PURE__ */
|
|
84
|
+
children: [u("mobile.relationships.viewDetails", "View details"), /* @__PURE__ */ S(_, { className: "rtl:rotate-180 h-4 w-4 text-text-secondary" })]
|
|
85
|
+
}), c(g.status).map((e) => {
|
|
86
|
+
let t = z[e.id], r = t.icon;
|
|
87
|
+
return /* @__PURE__ */ C("button", {
|
|
88
88
|
type: "button",
|
|
89
|
-
disabled:
|
|
90
|
-
className:
|
|
91
|
-
onClick: () =>
|
|
89
|
+
disabled: B,
|
|
90
|
+
className: n("flex min-h-12 items-center gap-3 rounded-xl px-4 text-start text-sm font-medium disabled:opacity-50", t.tone),
|
|
91
|
+
onClick: () => U(g, e),
|
|
92
92
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ S(r, { className: "h-4 w-4" }),
|
|
94
94
|
" ",
|
|
95
|
-
|
|
95
|
+
u(t.key, t.fallback)
|
|
96
96
|
]
|
|
97
|
-
},
|
|
97
|
+
}, e.id);
|
|
98
98
|
})]
|
|
99
99
|
})] })
|
|
100
100
|
})
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
open:
|
|
104
|
-
onOpenChange: (e) => !e &&
|
|
105
|
-
children: /* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ S(w, {
|
|
103
|
+
open: y != null,
|
|
104
|
+
onOpenChange: (e) => !e && b(null),
|
|
105
|
+
children: /* @__PURE__ */ C(D, { children: [/* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: u("mobile.relationships.cancelTitle", "Cancel {{label}}?", { label: y?.label ?? "" }) }), /* @__PURE__ */ S(O, { children: u("mobile.relationships.cancelDescription", "This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.") })] }), /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(E, { children: u("mobile.relationships.keep", "Keep it") }), /* @__PURE__ */ S(T, {
|
|
106
106
|
onClick: () => {
|
|
107
|
-
if (!
|
|
108
|
-
let e =
|
|
109
|
-
|
|
107
|
+
if (!y) return;
|
|
108
|
+
let e = y.id;
|
|
109
|
+
b(null), f.mutate(e, { onError: H });
|
|
110
110
|
},
|
|
111
|
-
children:
|
|
111
|
+
children: u("mobile.relationships.confirmCancel", "Cancel relationship")
|
|
112
112
|
})] })] })
|
|
113
113
|
})
|
|
114
114
|
] });
|
|
115
|
-
},
|
|
116
|
-
let T =
|
|
117
|
-
|
|
115
|
+
}, V = ({ relationship: i, open: a, busy: g, onOpenChange: _, onSelect: y, onMore: b, onAction: x }) => {
|
|
116
|
+
let { formatCurrency: w, formatIntervalSuffix: T } = t(), E = e(), D = c(i.status), O = D.length * L, [k, A] = h(null), j = m(null), M = m(0), N = k ?? (a ? -O : 0), P = o(i.renewsAt), F = P != null && (i.status === "ACTIVE" || i.status === "TRIAL") ? l(P) : null, I = (e) => {
|
|
117
|
+
O === 0 || e.pointerType === "mouse" || (j.current = {
|
|
118
118
|
x: e.clientX,
|
|
119
119
|
y: e.clientY,
|
|
120
120
|
swiping: !1,
|
|
121
121
|
moved: !1
|
|
122
122
|
});
|
|
123
|
-
},
|
|
124
|
-
let t =
|
|
123
|
+
}, B = (e) => {
|
|
124
|
+
let t = j.current;
|
|
125
125
|
if (!t) return;
|
|
126
126
|
let n = e.clientX - t.x, r = e.clientY - t.y;
|
|
127
127
|
if (!t.swiping) {
|
|
128
|
-
if (Math.abs(r) >
|
|
129
|
-
|
|
128
|
+
if (Math.abs(r) > R && Math.abs(r) > Math.abs(n)) {
|
|
129
|
+
j.current = null;
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
if (Math.abs(n) <
|
|
132
|
+
if (Math.abs(n) < R) return;
|
|
133
133
|
t.swiping = !0, e.currentTarget.setPointerCapture(e.pointerId);
|
|
134
134
|
}
|
|
135
|
-
t.moved = !0,
|
|
136
|
-
},
|
|
137
|
-
let e =
|
|
138
|
-
|
|
135
|
+
t.moved = !0, A(d(n, a, O));
|
|
136
|
+
}, V = () => {
|
|
137
|
+
let e = j.current;
|
|
138
|
+
j.current = null, e?.swiping && k != null && _(f(k, O)), A(null), e?.moved && (M.current = u(Date.now()));
|
|
139
139
|
};
|
|
140
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ C("li", {
|
|
141
141
|
className: "relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken",
|
|
142
142
|
"data-testid": "sb-mobile-relationship-row",
|
|
143
|
-
"data-relationship-id":
|
|
144
|
-
children: [
|
|
143
|
+
"data-relationship-id": i.id,
|
|
144
|
+
children: [D.length > 0 && /* @__PURE__ */ S("div", {
|
|
145
145
|
className: "absolute inset-y-0 right-0 flex",
|
|
146
|
-
style: { width:
|
|
147
|
-
"aria-hidden": !
|
|
148
|
-
children:
|
|
149
|
-
let
|
|
150
|
-
return /* @__PURE__ */
|
|
146
|
+
style: { width: O },
|
|
147
|
+
"aria-hidden": !a,
|
|
148
|
+
children: D.map((e) => {
|
|
149
|
+
let t = z[e.id], r = t.icon;
|
|
150
|
+
return /* @__PURE__ */ C("button", {
|
|
151
151
|
type: "button",
|
|
152
|
-
tabIndex:
|
|
153
|
-
disabled:
|
|
154
|
-
onClick: () =>
|
|
155
|
-
className:
|
|
156
|
-
style: { width:
|
|
157
|
-
children: [/* @__PURE__ */
|
|
158
|
-
},
|
|
152
|
+
tabIndex: a ? 0 : -1,
|
|
153
|
+
disabled: g,
|
|
154
|
+
onClick: () => x(e),
|
|
155
|
+
className: n("flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50", t.tone),
|
|
156
|
+
style: { width: L },
|
|
157
|
+
children: [/* @__PURE__ */ S(r, { className: "h-5 w-5" }), E(t.key, t.fallback)]
|
|
158
|
+
}, e.id);
|
|
159
159
|
})
|
|
160
|
-
}), /* @__PURE__ */
|
|
161
|
-
className:
|
|
162
|
-
style: { transform: `translateX(${
|
|
163
|
-
onPointerDown:
|
|
164
|
-
onPointerMove:
|
|
165
|
-
onPointerUp:
|
|
166
|
-
onPointerCancel:
|
|
160
|
+
}), /* @__PURE__ */ C("div", {
|
|
161
|
+
className: n("relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4", k == null && "transition-transform duration-200 ease-out"),
|
|
162
|
+
style: { transform: `translateX(${N}px)` },
|
|
163
|
+
onPointerDown: I,
|
|
164
|
+
onPointerMove: B,
|
|
165
|
+
onPointerUp: V,
|
|
166
|
+
onPointerCancel: V,
|
|
167
167
|
onClickCapture: (e) => {
|
|
168
|
-
|
|
168
|
+
s(Date.now(), M.current) && (M.current = 0, e.preventDefault(), e.stopPropagation());
|
|
169
169
|
},
|
|
170
|
-
children: [/* @__PURE__ */
|
|
170
|
+
children: [/* @__PURE__ */ C("button", {
|
|
171
171
|
type: "button",
|
|
172
172
|
onClick: () => {
|
|
173
|
-
if (
|
|
174
|
-
|
|
173
|
+
if (a) {
|
|
174
|
+
_(!1);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
y();
|
|
178
178
|
},
|
|
179
|
-
className: "flex min-w-0 flex-1 items-center gap-3 text-
|
|
180
|
-
children: [/* @__PURE__ */
|
|
179
|
+
className: "flex min-w-0 flex-1 items-center gap-3 text-start",
|
|
180
|
+
children: [/* @__PURE__ */ S(p, { kind: i.kind }), /* @__PURE__ */ C("span", {
|
|
181
181
|
className: "min-w-0 flex-1",
|
|
182
182
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ S("span", {
|
|
184
184
|
className: "block truncate font-semibold text-text-primary",
|
|
185
|
-
children:
|
|
185
|
+
children: i.label
|
|
186
186
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ C("span", {
|
|
188
188
|
className: "block text-base tabular-nums text-text-primary",
|
|
189
|
-
children: [
|
|
189
|
+
children: [w(i.amount, i.currency), /* @__PURE__ */ S("span", {
|
|
190
190
|
className: "text-sm text-text-secondary",
|
|
191
|
-
children:
|
|
191
|
+
children: T(i.interval)
|
|
192
192
|
})]
|
|
193
193
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ C("span", {
|
|
195
195
|
className: "mt-0.5 flex items-center gap-2",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
197
|
-
className:
|
|
198
|
-
children:
|
|
196
|
+
children: [/* @__PURE__ */ S(r, { status: i.status }), F && /* @__PURE__ */ S("span", {
|
|
197
|
+
className: n("truncate text-xs", F.tone === "later" ? "text-text-secondary" : "text-status-warning-text"),
|
|
198
|
+
children: E(F.key, F.fallback, F.params)
|
|
199
199
|
})]
|
|
200
200
|
})
|
|
201
201
|
]
|
|
202
202
|
})]
|
|
203
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ S("button", {
|
|
204
204
|
type: "button",
|
|
205
|
-
onClick:
|
|
206
|
-
"aria-label":
|
|
205
|
+
onClick: b,
|
|
206
|
+
"aria-label": E("mobile.relationships.moreActions", "More actions for {{label}}", { label: i.label }),
|
|
207
207
|
className: "flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken",
|
|
208
208
|
"data-testid": "sb-mobile-relationship-more",
|
|
209
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ S(v, { className: "h-5 w-5" })
|
|
210
210
|
})]
|
|
211
211
|
})]
|
|
212
212
|
});
|
|
213
213
|
};
|
|
214
214
|
//#endregion
|
|
215
|
-
export {
|
|
215
|
+
export { B as MobileRelationshipList };
|
|
216
216
|
|
|
217
217
|
//# sourceMappingURL=MobileRelationshipList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileRelationshipList.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"sourcesContent":["/**\n * Mobile relationship list\n * @module subscriberbot/components/mobile\n *\n * Card rows for phone widths. Each row opens the relationship on tap, reveals\n * its lifecycle actions on a left swipe, and offers the same actions through\n * an overflow (⋯) button that opens a bottom sheet — so the actions stay\n * reachable without the gesture (keyboard, screen readers, desktop browsers\n * resized to phone width). Actions are filtered through the svc state machine\n * (`quickActionsFor`); cancelling asks for confirmation first.\n */\n\nimport {\n useRef,\n useState,\n type FC,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n} from 'react';\nimport { Ban, ChevronRight, MoreHorizontal, Pause, Play, type LucideIcon } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n BottomSheet,\n BottomSheetContent,\n BottomSheetDescription,\n BottomSheetHeader,\n BottomSheetTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../StatusBadge';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { useCancelRelationship, useTransitionRelationship } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatIntervalSuffix } from '../../utils/formatters';\nimport {\n daysUntil,\n isSwipeTrailingClick,\n quickActionsFor,\n renewalCountdown,\n swipeClickDeadline,\n swipeOffset,\n swipeSettlesOpen,\n type QuickAction,\n type QuickActionId,\n} from '../../utils/portfolio';\nimport type { SubRelationship } from '../../types';\n\n/** Width of one revealed action button. */\nconst ACTION_WIDTH = 84;\n/** Horizontal travel before a touch counts as a swipe rather than a tap/scroll. */\nconst SWIPE_SLOP = 8;\n\nconst ACTION_META: Record<\n QuickActionId,\n { key: string; fallback: string; icon: LucideIcon; tone: string }\n> = {\n activate: {\n key: 'relationships.detail.actions.activate',\n fallback: 'Activate',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n resume: {\n key: 'mobile.relationships.resume',\n fallback: 'Resume',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n pause: {\n key: 'relationships.detail.actions.pause',\n fallback: 'Pause',\n icon: Pause,\n tone: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n cancel: {\n key: 'relationships.detail.actions.cancel',\n fallback: 'Cancel',\n icon: Ban,\n tone: 'bg-status-error-bg-subtle text-status-error-text',\n },\n};\n\ninterface MobileRelationshipListProps {\n items: SubRelationship[];\n navigateTo: (relativePath: string) => void;\n}\n\nexport const MobileRelationshipList: FC<MobileRelationshipListProps> = ({ items, navigateTo }) => {\n const tr = useTr();\n const transition = useTransitionRelationship();\n const cancel = useCancelRelationship();\n const [openRowId, setOpenRowId] = useState<string | null>(null);\n const [sheetFor, setSheetFor] = useState<SubRelationship | null>(null);\n const [confirmCancel, setConfirmCancel] = useState<SubRelationship | null>(null);\n const [error, setError] = useState<string | null>(null);\n const busy = transition.isPending || cancel.isPending;\n\n const onError = (e: unknown) =>\n setError(\n e instanceof Error\n ? e.message\n : tr('mobile.relationships.actionFailed', 'That action could not be completed.')\n );\n\n const run = (relationship: SubRelationship, action: QuickAction) => {\n setOpenRowId(null);\n setSheetFor(null);\n setError(null);\n if (action.destructive) {\n setConfirmCancel(relationship);\n return;\n }\n transition.mutate({ id: relationship.id, status: action.target }, { onError });\n };\n\n const confirmCancellation = () => {\n if (!confirmCancel) return;\n const id = confirmCancel.id;\n setConfirmCancel(null);\n cancel.mutate(id, { onError });\n };\n\n return (\n <>\n {error && (\n <div\n role=\"alert\"\n className=\"mt-4 rounded-xl 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\n <ul className=\"mt-4 space-y-3\" data-testid=\"sb-mobile-relationship-list\">\n {items.map((r) => (\n <SwipeRow\n key={r.id}\n relationship={r}\n open={openRowId === r.id}\n busy={busy}\n onOpenChange={(open) => setOpenRowId(open ? r.id : null)}\n onSelect={() => navigateTo(`/relationships/${r.id}`)}\n onMore={() => {\n setOpenRowId(null);\n setSheetFor(r);\n }}\n onAction={(action) => run(r, action)}\n />\n ))}\n </ul>\n\n <BottomSheet open={sheetFor != null} onOpenChange={(open) => !open && setSheetFor(null)}>\n <BottomSheetContent data-testid=\"sb-mobile-relationship-actions\">\n {sheetFor && (\n <>\n <BottomSheetHeader>\n <BottomSheetTitle>{sheetFor.label}</BottomSheetTitle>\n <BottomSheetDescription>\n {formatCurrency(sheetFor.amount, sheetFor.currency)}\n {formatIntervalSuffix(sheetFor.interval)}\n </BottomSheetDescription>\n </BottomSheetHeader>\n <div className=\"flex flex-col gap-2 py-2\">\n <button\n type=\"button\"\n className=\"flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-left text-sm font-medium text-text-primary active:bg-bg-sunken\"\n onClick={() => {\n const id = sheetFor.id;\n setSheetFor(null);\n navigateTo(`/relationships/${id}`);\n }}\n >\n {tr('mobile.relationships.viewDetails', 'View details')}\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </button>\n {quickActionsFor(sheetFor.status).map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n disabled={busy}\n className={cn(\n 'flex min-h-12 items-center gap-3 rounded-xl px-4 text-left text-sm font-medium disabled:opacity-50',\n meta.tone\n )}\n onClick={() => run(sheetFor, action)}\n >\n <Icon className=\"h-4 w-4\" /> {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n </>\n )}\n </BottomSheetContent>\n </BottomSheet>\n\n <AlertDialog\n open={confirmCancel != null}\n onOpenChange={(open) => !open && setConfirmCancel(null)}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr('mobile.relationships.cancelTitle', 'Cancel {{label}}?', {\n label: confirmCancel?.label ?? '',\n })}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n 'mobile.relationships.cancelDescription',\n 'This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.'\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>{tr('mobile.relationships.keep', 'Keep it')}</AlertDialogCancel>\n <AlertDialogAction onClick={confirmCancellation}>\n {tr('mobile.relationships.confirmCancel', 'Cancel relationship')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n};\n\ninterface SwipeRowProps {\n relationship: SubRelationship;\n open: boolean;\n busy: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: () => void;\n onMore: () => void;\n onAction: (action: QuickAction) => void;\n}\n\nconst SwipeRow: FC<SwipeRowProps> = ({\n relationship: r,\n open,\n busy,\n onOpenChange,\n onSelect,\n onMore,\n onAction,\n}) => {\n const tr = useTr();\n const actions = quickActionsFor(r.status);\n const revealWidth = actions.length * ACTION_WIDTH;\n const [dragOffset, setDragOffset] = useState<number | null>(null);\n const gesture = useRef<{ x: number; y: number; swiping: boolean; moved: boolean } | null>(null);\n\n // A swipe ends with a synthetic click. While the pointer is captured that\n // click targets the capturing card element rather than the inner button,\n // so it is swallowed in the card's capture phase, and only within a short\n // window after the gesture — a later deliberate tap always goes through,\n // and a cancelled swipe (which dispatches no click) leaves nothing pending.\n const swipeClickUntil = useRef(0);\n\n const offset = dragOffset ?? (open ? -revealWidth : 0);\n const days = daysUntil(r.renewsAt);\n const countdown =\n days != null && (r.status === 'ACTIVE' || r.status === 'TRIAL') ? renewalCountdown(days) : null;\n\n const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (revealWidth === 0 || e.pointerType === 'mouse') return;\n gesture.current = { x: e.clientX, y: e.clientY, swiping: false, moved: false };\n };\n\n const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {\n const g = gesture.current;\n if (!g) return;\n const dx = e.clientX - g.x;\n const dy = e.clientY - g.y;\n if (!g.swiping) {\n if (Math.abs(dy) > SWIPE_SLOP && Math.abs(dy) > Math.abs(dx)) {\n // Vertical scroll — let the page have it.\n gesture.current = null;\n return;\n }\n if (Math.abs(dx) < SWIPE_SLOP) return;\n g.swiping = true;\n e.currentTarget.setPointerCapture(e.pointerId);\n }\n g.moved = true;\n setDragOffset(swipeOffset(dx, open, revealWidth));\n };\n\n const endGesture = () => {\n const g = gesture.current;\n gesture.current = null;\n if (g?.swiping && dragOffset != null) {\n onOpenChange(swipeSettlesOpen(dragOffset, revealWidth));\n }\n setDragOffset(null);\n if (g?.moved) swipeClickUntil.current = swipeClickDeadline(Date.now());\n };\n\n const onClickCapture = (e: ReactMouseEvent<HTMLDivElement>) => {\n if (!isSwipeTrailingClick(Date.now(), swipeClickUntil.current)) return;\n swipeClickUntil.current = 0;\n e.preventDefault();\n e.stopPropagation();\n };\n\n const handleSelect = () => {\n if (open) {\n onOpenChange(false);\n return;\n }\n onSelect();\n };\n\n return (\n <li\n className=\"relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-row\"\n data-relationship-id={r.id}\n >\n {/* Action tray, revealed under the card by a left swipe. Hidden from\n assistive tech and the tab order while closed — the ⋯ sheet is the\n accessible path to the same actions. */}\n {actions.length > 0 && (\n <div\n className=\"absolute inset-y-0 right-0 flex\"\n style={{ width: revealWidth }}\n aria-hidden={!open}\n >\n {actions.map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n tabIndex={open ? 0 : -1}\n disabled={busy}\n onClick={() => onAction(action)}\n className={cn(\n 'flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50',\n meta.tone\n )}\n style={{ width: ACTION_WIDTH }}\n >\n <Icon className=\"h-5 w-5\" />\n {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n )}\n\n <div\n className={cn(\n 'relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4',\n dragOffset == null && 'transition-transform duration-200 ease-out'\n )}\n style={{ transform: `translateX(${offset}px)` }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onClickCapture={onClickCapture}\n >\n <button\n type=\"button\"\n onClick={handleSelect}\n className=\"flex min-w-0 flex-1 items-center gap-3 text-left\"\n >\n <RelationshipGlyph kind={r.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">{r.label}</span>\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n <span className=\"text-sm text-text-secondary\">\n {formatIntervalSuffix(r.interval)}\n </span>\n </span>\n <span className=\"mt-0.5 flex items-center gap-2\">\n <StatusBadge status={r.status} />\n {countdown && (\n <span\n className={cn(\n 'truncate text-xs',\n countdown.tone === 'later' ? 'text-text-secondary' : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={onMore}\n aria-label={tr('mobile.relationships.moreActions', 'More actions for {{label}}', {\n label: r.label,\n })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-more\"\n >\n <MoreHorizontal className=\"h-5 w-5\" />\n </button>\n </div>\n </li>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAuDA,IAAM,IAAe,IAEf,IAAa,GAEb,IAGF;CACF,UAAU;EACR,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;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,IAAI,GAAM;MACR,EAAa,EAAK;MAClB;KACF;KACA,EAAS;IACX;IAwDQ,WAAU;cAHZ,CAKE,kBAAC,GAAD,EAAmB,MAAM,EAAE,KAAO,CAAA,GAClC,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,QAAD;OAAM,WAAU;iBAAkD,EAAE;MAAY,CAAA;MAChF,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACG,EAAe,EAAE,QAAQ,EAAE,QAAQ,GACpC,kBAAC,QAAD;QAAM,WAAU;kBACb,EAAqB,EAAE,QAAQ;OAC5B,CAAA,CACF;;MACN,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACE,kBAAC,GAAD,EAAa,QAAQ,EAAE,OAAS,CAAA,GAC/B,KACC,kBAAC,QAAD;QACE,WAAW,EACT,oBACA,EAAU,SAAS,UAAU,wBAAwB,0BACvD;kBAEC,EAAG,EAAU,KAAK,EAAU,UAAU,EAAU,MAAM;OACnD,CAAA,CAEJ;;KACF;MACA;OACR,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAG,oCAAoC,8BAA8B,EAC/E,OAAO,EAAE,MACX,CAAC;IACD,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;GAC/B,CAAA,CACL;IACH;;AAER"}
|
|
1
|
+
{"version":3,"file":"MobileRelationshipList.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileRelationshipList.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Mobile relationship list\n * @module subscriberbot/components/mobile\n *\n * Card rows for phone widths. Each row opens the relationship on tap, reveals\n * its lifecycle actions on a left swipe, and offers the same actions through\n * an overflow (⋯) button that opens a bottom sheet — so the actions stay\n * reachable without the gesture (keyboard, screen readers, desktop browsers\n * resized to phone width). Actions are filtered through the svc state machine\n * (`quickActionsFor`); cancelling asks for confirmation first.\n */\n\nimport {\n useRef,\n useState,\n type FC,\n type MouseEvent as ReactMouseEvent,\n type PointerEvent as ReactPointerEvent,\n} from 'react';\nimport { Ban, ChevronRight, MoreHorizontal, Pause, Play, type LucideIcon } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n BottomSheet,\n BottomSheetContent,\n BottomSheetDescription,\n BottomSheetHeader,\n BottomSheetTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../StatusBadge';\nimport { RelationshipGlyph } from './RelationshipGlyph';\nimport { useCancelRelationship, useTransitionRelationship } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport {\n daysUntil,\n isSwipeTrailingClick,\n quickActionsFor,\n renewalCountdown,\n swipeClickDeadline,\n swipeOffset,\n swipeSettlesOpen,\n type QuickAction,\n type QuickActionId,\n} from '../../utils/portfolio';\nimport type { SubRelationship } from '../../types';\n\n/** Width of one revealed action button. */\nconst ACTION_WIDTH = 84;\n/** Horizontal travel before a touch counts as a swipe rather than a tap/scroll. */\nconst SWIPE_SLOP = 8;\n\nconst ACTION_META: Record<\n QuickActionId,\n { key: string; fallback: string; icon: LucideIcon; tone: string }\n> = {\n activate: {\n key: 'relationships.detail.actions.activate',\n fallback: 'Activate',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n resume: {\n key: 'mobile.relationships.resume',\n fallback: 'Resume',\n icon: Play,\n tone: 'bg-status-success-bg-subtle text-status-success-text',\n },\n pause: {\n key: 'relationships.detail.actions.pause',\n fallback: 'Pause',\n icon: Pause,\n tone: 'bg-status-warning-bg-subtle text-status-warning-text',\n },\n cancel: {\n key: 'relationships.detail.actions.cancel',\n fallback: 'Cancel',\n icon: Ban,\n tone: 'bg-status-error-bg-subtle text-status-error-text',\n },\n};\n\ninterface MobileRelationshipListProps {\n items: SubRelationship[];\n navigateTo: (relativePath: string) => void;\n}\n\nexport const MobileRelationshipList: FC<MobileRelationshipListProps> = ({ items, navigateTo }) => {\n const { formatCurrency, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const transition = useTransitionRelationship();\n const cancel = useCancelRelationship();\n const [openRowId, setOpenRowId] = useState<string | null>(null);\n const [sheetFor, setSheetFor] = useState<SubRelationship | null>(null);\n const [confirmCancel, setConfirmCancel] = useState<SubRelationship | null>(null);\n const [error, setError] = useState<string | null>(null);\n const busy = transition.isPending || cancel.isPending;\n\n const onError = (e: unknown) =>\n setError(\n e instanceof Error\n ? e.message\n : tr('mobile.relationships.actionFailed', 'That action could not be completed.')\n );\n\n const run = (relationship: SubRelationship, action: QuickAction) => {\n setOpenRowId(null);\n setSheetFor(null);\n setError(null);\n if (action.destructive) {\n setConfirmCancel(relationship);\n return;\n }\n transition.mutate({ id: relationship.id, status: action.target }, { onError });\n };\n\n const confirmCancellation = () => {\n if (!confirmCancel) return;\n const id = confirmCancel.id;\n setConfirmCancel(null);\n cancel.mutate(id, { onError });\n };\n\n return (\n <>\n {error && (\n <div\n role=\"alert\"\n className=\"mt-4 rounded-xl 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\n <ul className=\"mt-4 space-y-3\" data-testid=\"sb-mobile-relationship-list\">\n {items.map((r) => (\n <SwipeRow\n key={r.id}\n relationship={r}\n open={openRowId === r.id}\n busy={busy}\n onOpenChange={(open) => setOpenRowId(open ? r.id : null)}\n onSelect={() => navigateTo(`/relationships/${r.id}`)}\n onMore={() => {\n setOpenRowId(null);\n setSheetFor(r);\n }}\n onAction={(action) => run(r, action)}\n />\n ))}\n </ul>\n\n <BottomSheet open={sheetFor != null} onOpenChange={(open) => !open && setSheetFor(null)}>\n <BottomSheetContent data-testid=\"sb-mobile-relationship-actions\">\n {sheetFor && (\n <>\n <BottomSheetHeader>\n <BottomSheetTitle>{sheetFor.label}</BottomSheetTitle>\n <BottomSheetDescription>\n {formatCurrency(sheetFor.amount, sheetFor.currency)}\n {formatIntervalSuffix(sheetFor.interval)}\n </BottomSheetDescription>\n </BottomSheetHeader>\n <div className=\"flex flex-col gap-2 py-2\">\n <button\n type=\"button\"\n className=\"flex min-h-12 items-center justify-between rounded-xl bg-bg-surface px-4 text-start text-sm font-medium text-text-primary active:bg-bg-sunken\"\n onClick={() => {\n const id = sheetFor.id;\n setSheetFor(null);\n navigateTo(`/relationships/${id}`);\n }}\n >\n {tr('mobile.relationships.viewDetails', 'View details')}\n <ChevronRight className=\"rtl:rotate-180 h-4 w-4 text-text-secondary\" />\n </button>\n {quickActionsFor(sheetFor.status).map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n disabled={busy}\n className={cn(\n 'flex min-h-12 items-center gap-3 rounded-xl px-4 text-start text-sm font-medium disabled:opacity-50',\n meta.tone\n )}\n onClick={() => run(sheetFor, action)}\n >\n <Icon className=\"h-4 w-4\" /> {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n </>\n )}\n </BottomSheetContent>\n </BottomSheet>\n\n <AlertDialog\n open={confirmCancel != null}\n onOpenChange={(open) => !open && setConfirmCancel(null)}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tr('mobile.relationships.cancelTitle', 'Cancel {{label}}?', {\n label: confirmCancel?.label ?? '',\n })}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tr(\n 'mobile.relationships.cancelDescription',\n 'This marks the relationship as cancelled in Subscriber Bot. A cancelled relationship cannot be reactivated.'\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>{tr('mobile.relationships.keep', 'Keep it')}</AlertDialogCancel>\n <AlertDialogAction onClick={confirmCancellation}>\n {tr('mobile.relationships.confirmCancel', 'Cancel relationship')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </>\n );\n};\n\ninterface SwipeRowProps {\n relationship: SubRelationship;\n open: boolean;\n busy: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: () => void;\n onMore: () => void;\n onAction: (action: QuickAction) => void;\n}\n\nconst SwipeRow: FC<SwipeRowProps> = ({\n relationship: r,\n open,\n busy,\n onOpenChange,\n onSelect,\n onMore,\n onAction,\n}) => {\n const { formatCurrency, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const actions = quickActionsFor(r.status);\n const revealWidth = actions.length * ACTION_WIDTH;\n const [dragOffset, setDragOffset] = useState<number | null>(null);\n const gesture = useRef<{ x: number; y: number; swiping: boolean; moved: boolean } | null>(null);\n\n // A swipe ends with a synthetic click. While the pointer is captured that\n // click targets the capturing card element rather than the inner button,\n // so it is swallowed in the card's capture phase, and only within a short\n // window after the gesture — a later deliberate tap always goes through,\n // and a cancelled swipe (which dispatches no click) leaves nothing pending.\n const swipeClickUntil = useRef(0);\n\n const offset = dragOffset ?? (open ? -revealWidth : 0);\n const days = daysUntil(r.renewsAt);\n const countdown =\n days != null && (r.status === 'ACTIVE' || r.status === 'TRIAL') ? renewalCountdown(days) : null;\n\n const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {\n if (revealWidth === 0 || e.pointerType === 'mouse') return;\n gesture.current = { x: e.clientX, y: e.clientY, swiping: false, moved: false };\n };\n\n const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {\n const g = gesture.current;\n if (!g) return;\n const dx = e.clientX - g.x;\n const dy = e.clientY - g.y;\n if (!g.swiping) {\n if (Math.abs(dy) > SWIPE_SLOP && Math.abs(dy) > Math.abs(dx)) {\n // Vertical scroll — let the page have it.\n gesture.current = null;\n return;\n }\n if (Math.abs(dx) < SWIPE_SLOP) return;\n g.swiping = true;\n e.currentTarget.setPointerCapture(e.pointerId);\n }\n g.moved = true;\n setDragOffset(swipeOffset(dx, open, revealWidth));\n };\n\n const endGesture = () => {\n const g = gesture.current;\n gesture.current = null;\n if (g?.swiping && dragOffset != null) {\n onOpenChange(swipeSettlesOpen(dragOffset, revealWidth));\n }\n setDragOffset(null);\n if (g?.moved) swipeClickUntil.current = swipeClickDeadline(Date.now());\n };\n\n const onClickCapture = (e: ReactMouseEvent<HTMLDivElement>) => {\n if (!isSwipeTrailingClick(Date.now(), swipeClickUntil.current)) return;\n swipeClickUntil.current = 0;\n e.preventDefault();\n e.stopPropagation();\n };\n\n const handleSelect = () => {\n if (open) {\n onOpenChange(false);\n return;\n }\n onSelect();\n };\n\n return (\n <li\n className=\"relative overflow-hidden rounded-2xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-row\"\n data-relationship-id={r.id}\n >\n {/* Action tray, revealed under the card by a left swipe. Hidden from\n assistive tech and the tab order while closed — the ⋯ sheet is the\n accessible path to the same actions. */}\n {actions.length > 0 && (\n <div\n className=\"absolute inset-y-0 right-0 flex\"\n style={{ width: revealWidth }}\n aria-hidden={!open}\n >\n {actions.map((action) => {\n const meta = ACTION_META[action.id];\n const Icon = meta.icon;\n return (\n <button\n key={action.id}\n type=\"button\"\n tabIndex={open ? 0 : -1}\n disabled={busy}\n onClick={() => onAction(action)}\n className={cn(\n 'flex h-full flex-col items-center justify-center gap-1 text-xs font-medium disabled:opacity-50',\n meta.tone\n )}\n style={{ width: ACTION_WIDTH }}\n >\n <Icon className=\"h-5 w-5\" />\n {tr(meta.key, meta.fallback)}\n </button>\n );\n })}\n </div>\n )}\n\n <div\n className={cn(\n 'relative flex touch-pan-y items-center gap-3 bg-bg-surface p-4',\n dragOffset == null && 'transition-transform duration-200 ease-out'\n )}\n style={{ transform: `translateX(${offset}px)` }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endGesture}\n onPointerCancel={endGesture}\n onClickCapture={onClickCapture}\n >\n <button\n type=\"button\"\n onClick={handleSelect}\n className=\"flex min-w-0 flex-1 items-center gap-3 text-start\"\n >\n <RelationshipGlyph kind={r.kind} />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-semibold text-text-primary\">{r.label}</span>\n <span className=\"block text-base tabular-nums text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n <span className=\"text-sm text-text-secondary\">\n {formatIntervalSuffix(r.interval)}\n </span>\n </span>\n <span className=\"mt-0.5 flex items-center gap-2\">\n <StatusBadge status={r.status} />\n {countdown && (\n <span\n className={cn(\n 'truncate text-xs',\n countdown.tone === 'later' ? 'text-text-secondary' : 'text-status-warning-text'\n )}\n >\n {tr(countdown.key, countdown.fallback, countdown.params)}\n </span>\n )}\n </span>\n </span>\n </button>\n <button\n type=\"button\"\n onClick={onMore}\n aria-label={tr('mobile.relationships.moreActions', 'More actions for {{label}}', {\n label: r.label,\n })}\n className=\"flex size-11 shrink-0 items-center justify-center rounded-full text-text-secondary active:bg-bg-sunken\"\n data-testid=\"sb-mobile-relationship-more\"\n >\n <MoreHorizontal className=\"h-5 w-5\" />\n </button>\n </div>\n </li>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAwDA,IAAM,IAAe,IAEf,IAAa,GAEb,IAGF;CACF,UAAU;EACR,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,OAAO;EACL,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;CACA,QAAQ;EACN,KAAK;EACL,UAAU;EACV,MAAM;EACN,MAAM;CACR;AACF,GAOa,KAA2D,EAAE,UAAO,oBAAiB;CAChG,IAAM,EAAE,mBAAgB,4BAAyB,EAAc,GAEzD,IAAK,EAAM,GACX,IAAa,EAA0B,GACvC,IAAS,EAAsB,GAC/B,CAAC,GAAW,KAAgB,EAAwB,IAAI,GACxD,CAAC,GAAU,KAAe,EAAiC,IAAI,GAC/D,CAAC,GAAe,KAAoB,EAAiC,IAAI,GACzE,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,IAAO,EAAW,aAAa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AAM,WAAU;iBAAhB,CACE,kBAAC,GAAD,EAAa,QAAQ,EAAE,OAAS,CAAA,GAC/B,KACC,kBAAC,QAAD;QACE,WAAW,EACT,oBACA,EAAU,SAAS,UAAU,wBAAwB,0BACvD;kBAEC,EAAG,EAAU,KAAK,EAAU,UAAU,EAAU,MAAM;OACnD,CAAA,CAEJ;;KACF;MACA;OACR,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAG,oCAAoC,8BAA8B,EAC/E,OAAO,EAAE,MACX,CAAC;IACD,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;GAC/B,CAAA,CACL;IACH;;AAER"}
|
|
@@ -12,6 +12,8 @@ interface MobileScreenProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
/** Stable hook for Playwright and the assistant page context. */
|
|
14
14
|
testId?: string;
|
|
15
|
+
/** Product-tour prefix; the header renders `{dataTour}-header`. */
|
|
16
|
+
dataTour?: string;
|
|
15
17
|
}
|
|
16
18
|
export declare const MobileScreen: FC<MobileScreenProps>;
|
|
17
19
|
interface MobileSectionProps {
|
|
@@ -19,6 +21,7 @@ interface MobileSectionProps {
|
|
|
19
21
|
action?: ReactNode;
|
|
20
22
|
children: ReactNode;
|
|
21
23
|
className?: string;
|
|
24
|
+
dataTour?: string;
|
|
22
25
|
}
|
|
23
26
|
/** A titled group on the mobile sheet ("Upcoming renewals", "Needs action"). */
|
|
24
27
|
export declare const MobileSection: FC<MobileSectionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileScreen.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3C,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"MobileScreen.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG3C,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA0B9C,CAAC;AAEF,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,gFAAgF;AAChF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAchD,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/subscriberbot/components/mobile/MobileScreen.tsx
|
|
4
|
-
var r = ({ title: r, eyebrow: i, hero: a, action: o, children: s, className: c, testId: l }) => /* @__PURE__ */ n("div", {
|
|
4
|
+
var r = ({ title: r, eyebrow: i, hero: a, action: o, children: s, className: c, testId: l, dataTour: u }) => /* @__PURE__ */ n("div", {
|
|
5
5
|
className: e("flex min-h-full flex-col", c),
|
|
6
6
|
"data-testid": l,
|
|
7
7
|
children: [/* @__PURE__ */ n("header", {
|
|
8
8
|
className: "bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text",
|
|
9
|
+
"data-tour": u ? `${u}-header` : void 0,
|
|
9
10
|
children: [/* @__PURE__ */ n("div", {
|
|
10
11
|
className: "flex items-start justify-between gap-3",
|
|
11
12
|
children: [/* @__PURE__ */ n("div", {
|
|
12
13
|
className: "min-w-0",
|
|
13
14
|
children: [i ? /* @__PURE__ */ t("p", {
|
|
14
|
-
className: "text-sm
|
|
15
|
+
className: "text-sm",
|
|
15
16
|
children: i
|
|
16
17
|
}) : null, /* @__PURE__ */ t("h1", {
|
|
17
18
|
className: "text-2xl font-bold tracking-tight",
|
|
@@ -29,9 +30,10 @@ var r = ({ title: r, eyebrow: i, hero: a, action: o, children: s, className: c,
|
|
|
29
30
|
className: "-mt-6 flex-1 rounded-t-3xl bg-bg-canvas px-4 pb-6 pt-5",
|
|
30
31
|
children: s
|
|
31
32
|
})]
|
|
32
|
-
}), i = ({ title: r, action: i, children: a, className: o }) => /* @__PURE__ */ n("section", {
|
|
33
|
+
}), i = ({ title: r, action: i, children: a, className: o, dataTour: s }) => /* @__PURE__ */ n("section", {
|
|
33
34
|
className: e("mt-6 first:mt-0", o),
|
|
34
35
|
"aria-label": r,
|
|
36
|
+
"data-tour": s,
|
|
35
37
|
children: [/* @__PURE__ */ n("div", {
|
|
36
38
|
className: "mb-3 flex items-center justify-between gap-3",
|
|
37
39
|
children: [/* @__PURE__ */ t("h2", {
|