@burdenoff/microfe-subscriberbot 2026.1105.1 → 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/stories/pages/DashboardPage.stories.d.ts.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/StateViews.d.ts +2 -0
- package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
- package/dist/subscriberbot/components/StateViews.js +2 -1
- package/dist/subscriberbot/components/StateViews.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +29 -21
- package/dist/subscriberbot/components/mobile/MobileDashboard.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 +4 -2
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.js +8 -0
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +5 -0
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +8 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/pages/DashboardPage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAMxE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAQpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardPage.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/pages/DashboardPage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAMxE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAQpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAiBnC,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAMlC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KASnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAQhC,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,KAqB5B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,KAQ5C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAazB,CAAC"}
|
|
@@ -17,6 +17,12 @@ interface PageLayoutProps {
|
|
|
17
17
|
* never moves content; auto-static under reduced motion.
|
|
18
18
|
*/
|
|
19
19
|
aurora?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Stable product-tour anchor prefix (BOFF-3358). Renders
|
|
22
|
+
* `data-tour="{dataTour}-header"` on the page header so seeded tours in
|
|
23
|
+
* global-tours-svc can target it. Use `subscriberbot-{page}`.
|
|
24
|
+
*/
|
|
25
|
+
dataTour?: string;
|
|
20
26
|
}
|
|
21
27
|
export declare const PageLayout: FC<PageLayoutProps>;
|
|
22
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/PageLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,UAAU,eAAe;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageLayout.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/PageLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,UAAU,eAAe;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAyC1C,CAAC"}
|
|
@@ -2,9 +2,10 @@ import { cn as e } from "../utils/cn.js";
|
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import { AuroraBackground as r, GradientText as i } from "@burdenoff/fe-libs/ui";
|
|
4
4
|
//#region src/subscriberbot/components/PageLayout.tsx
|
|
5
|
-
var a = ({ title: a, description: o, actions: s, children: c, className: l, titleGradient: u = !1, aurora: d = !1 }) => /* @__PURE__ */ n("div", {
|
|
5
|
+
var a = ({ title: a, description: o, actions: s, children: c, className: l, titleGradient: u = !1, aurora: d = !1, dataTour: f }) => /* @__PURE__ */ n("div", {
|
|
6
6
|
className: e("flex flex-col h-full", l),
|
|
7
7
|
children: [/* @__PURE__ */ n("div", {
|
|
8
|
+
"data-tour": f ? `${f}-header` : void 0,
|
|
8
9
|
className: e("relative flex flex-col items-start gap-3 px-4 py-4 border-b border-border-seam sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-6", d ? "overflow-hidden bg-gloss-card" : "bg-bg-surface"),
|
|
9
10
|
children: [
|
|
10
11
|
d && /* @__PURE__ */ t(r, { intensity: "subtle" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/subscriberbot/components/PageLayout.tsx"],"sourcesContent":["/**\n * Page Layout Component\n * @module subscriberbot/components\n *\n * Boff UI 2.0 page wrapper. Supports a living-glass {@link AuroraBackground}\n * hero backdrop and a gradient hero title for the MFE's primary page.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AuroraBackground, GradientText } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n title: ReactNode;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n className?: string;\n /**\n * Render the title as a gradient hero heading (Boff UI 2.0). Reserve for the\n * ONE primary page of the MFE so it stays a hero accent, never body copy.\n */\n titleGradient?: boolean;\n /**\n * Drop a subtle living-glass {@link AuroraBackground} behind the header.\n * Use on the MFE's primary page only (one aurora per MFE). Sits at -z-10 and\n * never moves content; auto-static under reduced motion.\n */\n aurora?: boolean;\n}\n\nexport const PageLayout: FC<PageLayoutProps> = ({\n title,\n description,\n actions,\n children,\n className,\n titleGradient = false,\n aurora = false,\n}) => {\n return (\n <div className={cn('flex flex-col h-full', className)}>\n {/* Page Header — optionally on a living-glass aurora hero backdrop. The\n aurora layer sits at -z-10 and never moves content. */}\n <div\n className={cn(\n // Phones stack the actions under the title so long titles and\n // action buttons never squeeze each other at 375px (BOFF-4010).\n 'relative flex flex-col items-start gap-3 px-4 py-4 border-b border-border-seam sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-6',\n aurora ? 'overflow-hidden bg-gloss-card' : 'bg-bg-surface'\n )}\n >\n {aurora && <AuroraBackground intensity=\"subtle\" />}\n <div className=\"min-w-0\">\n {titleGradient && typeof title === 'string' ? (\n <GradientText as=\"h1\" className=\"text-2xl font-semibold tracking-tight\">\n {title}\n </GradientText>\n ) : (\n <h1 className=\"text-2xl font-semibold text-text-primary\">{title}</h1>\n )}\n {description && <p className=\"mt-1 text-sm text-text-secondary\">{description}</p>}\n </div>\n {actions && <div className=\"flex flex-wrap items-center gap-3 shrink-0\">{actions}</div>}\n </div>\n\n {/* Page Content */}\n <div className=\"flex-1 overflow-auto p-4 sm:p-6\">{children}</div>\n </div>\n );\n};\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/subscriberbot/components/PageLayout.tsx"],"sourcesContent":["/**\n * Page Layout Component\n * @module subscriberbot/components\n *\n * Boff UI 2.0 page wrapper. Supports a living-glass {@link AuroraBackground}\n * hero backdrop and a gradient hero title for the MFE's primary page.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AuroraBackground, GradientText } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n title: ReactNode;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n className?: string;\n /**\n * Render the title as a gradient hero heading (Boff UI 2.0). Reserve for the\n * ONE primary page of the MFE so it stays a hero accent, never body copy.\n */\n titleGradient?: boolean;\n /**\n * Drop a subtle living-glass {@link AuroraBackground} behind the header.\n * Use on the MFE's primary page only (one aurora per MFE). Sits at -z-10 and\n * never moves content; auto-static under reduced motion.\n */\n aurora?: boolean;\n /**\n * Stable product-tour anchor prefix (BOFF-3358). Renders\n * `data-tour=\"{dataTour}-header\"` on the page header so seeded tours in\n * global-tours-svc can target it. Use `subscriberbot-{page}`.\n */\n dataTour?: string;\n}\n\nexport const PageLayout: FC<PageLayoutProps> = ({\n title,\n description,\n actions,\n children,\n className,\n titleGradient = false,\n aurora = false,\n dataTour,\n}) => {\n return (\n <div className={cn('flex flex-col h-full', className)}>\n {/* Page Header — optionally on a living-glass aurora hero backdrop. The\n aurora layer sits at -z-10 and never moves content. */}\n <div\n data-tour={dataTour ? `${dataTour}-header` : undefined}\n className={cn(\n // Phones stack the actions under the title so long titles and\n // action buttons never squeeze each other at 375px (BOFF-4010).\n 'relative flex flex-col items-start gap-3 px-4 py-4 border-b border-border-seam sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-6',\n aurora ? 'overflow-hidden bg-gloss-card' : 'bg-bg-surface'\n )}\n >\n {aurora && <AuroraBackground intensity=\"subtle\" />}\n <div className=\"min-w-0\">\n {titleGradient && typeof title === 'string' ? (\n <GradientText as=\"h1\" className=\"text-2xl font-semibold tracking-tight\">\n {title}\n </GradientText>\n ) : (\n <h1 className=\"text-2xl font-semibold text-text-primary\">{title}</h1>\n )}\n {description && <p className=\"mt-1 text-sm text-text-secondary\">{description}</p>}\n </div>\n {actions && <div className=\"flex flex-wrap items-center gap-3 shrink-0\">{actions}</div>}\n </div>\n\n {/* Page Content */}\n <div className=\"flex-1 overflow-auto p-4 sm:p-6\">{children}</div>\n </div>\n );\n};\n"],"mappings":";;;;AAqCA,IAAa,KAAmC,EAC9C,UACA,gBACA,YACA,aACA,cACA,mBAAgB,IAChB,YAAS,IACT,kBAGE,kBAAC,OAAD;CAAK,WAAW,EAAG,wBAAwB,CAAS;WAApD,CAGE,kBAAC,OAAD;EACE,aAAW,IAAW,GAAG,EAAS,WAAW,KAAA;EAC7C,WAAW,EAGT,kJACA,IAAS,kCAAkC,eAC7C;YAPF;GASG,KAAU,kBAAC,GAAD,EAAkB,WAAU,SAAU,CAAA;GACjD,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,KAAiB,OAAO,KAAU,WACjC,kBAAC,GAAD;KAAc,IAAG;KAAK,WAAU;eAC7B;IACW,CAAA,IAEd,kBAAC,MAAD;KAAI,WAAU;eAA4C;IAAU,CAAA,GAErE,KAAe,kBAAC,KAAD;KAAG,WAAU;eAAoC;IAAe,CAAA,CAC7E;;GACJ,KAAW,kBAAC,OAAD;IAAK,WAAU;cAA8C;GAAa,CAAA;EACnF;KAGL,kBAAC,OAAD;EAAK,WAAU;EAAmC;CAAc,CAAA,CAC7D"}
|
|
@@ -18,6 +18,8 @@ interface SectionProps {
|
|
|
18
18
|
action?: ReactNode;
|
|
19
19
|
children: ReactNode;
|
|
20
20
|
className?: string;
|
|
21
|
+
/** Stable product-tour anchor rendered as `data-tour` (BOFF-3358). */
|
|
22
|
+
dataTour?: string;
|
|
21
23
|
}
|
|
22
24
|
export declare const Section: FC<SectionProps>;
|
|
23
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateViews.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StateViews.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM3C,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,M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AC;IACnB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAkBpC,CAAC"}
|
|
@@ -35,8 +35,9 @@ var o = ({ label: n, className: o }) => {
|
|
|
35
35
|
})
|
|
36
36
|
]
|
|
37
37
|
});
|
|
38
|
-
}, c = ({ title: e, description: n, action: a, children: o, className: s }) => /* @__PURE__ */ i("section", {
|
|
38
|
+
}, c = ({ title: e, description: n, action: a, children: o, className: s, dataTour: c }) => /* @__PURE__ */ i("section", {
|
|
39
39
|
className: t("mt-8 first:mt-0", s),
|
|
40
|
+
"data-tour": c,
|
|
40
41
|
children: [/* @__PURE__ */ i("div", {
|
|
41
42
|
className: "mb-3 flex items-end justify-between gap-3",
|
|
42
43
|
children: [/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("h2", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateViews.js","names":[],"sources":["../../../src/subscriberbot/components/StateViews.tsx"],"sourcesContent":["/**\n * Shared loading / error state views\n * @module subscriberbot/components\n *\n * Small reusable building blocks so every page renders consistent\n * loading / error / empty states without re-implementing them.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\n\ninterface LoadingViewProps {\n label?: string;\n className?: string;\n}\n\nexport const LoadingView: FC<LoadingViewProps> = ({ label, className }) => {\n const tr = useTr();\n return (\n <div className={cn('flex min-h-[40vh] flex-col items-center justify-center gap-3', className)}>\n <Spinner size=\"lg\" />\n <p className=\"text-sm text-text-secondary\">{label ?? tr('common.loading', 'Loading…')}</p>\n </div>\n );\n};\n\ninterface ErrorViewProps {\n title?: string;\n message?: string;\n onRetry?: () => void;\n className?: string;\n}\n\nexport const ErrorView: FC<ErrorViewProps> = ({ title, message, onRetry, className }) => {\n const tr = useTr();\n return (\n <div\n role=\"alert\"\n className={cn(\n 'flex min-h-[40vh] flex-col items-center justify-center gap-4 text-center',\n className\n )}\n >\n <AlertCircle className=\"h-10 w-10 text-status-error-text\" />\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {title ?? tr('common.somethingWentWrong', 'Something went wrong')}\n </h2>\n {message && <p className=\"mt-1 max-w-md text-sm text-text-secondary\">{message}</p>}\n </div>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\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('common.retry', 'Retry')}\n </button>\n )}\n </div>\n );\n};\n\ninterface SectionProps {\n title: string;\n description?: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\nexport const Section: FC<SectionProps> = ({
|
|
1
|
+
{"version":3,"file":"StateViews.js","names":[],"sources":["../../../src/subscriberbot/components/StateViews.tsx"],"sourcesContent":["/**\n * Shared loading / error state views\n * @module subscriberbot/components\n *\n * Small reusable building blocks so every page renders consistent\n * loading / error / empty states without re-implementing them.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\n\ninterface LoadingViewProps {\n label?: string;\n className?: string;\n}\n\nexport const LoadingView: FC<LoadingViewProps> = ({ label, className }) => {\n const tr = useTr();\n return (\n <div className={cn('flex min-h-[40vh] flex-col items-center justify-center gap-3', className)}>\n <Spinner size=\"lg\" />\n <p className=\"text-sm text-text-secondary\">{label ?? tr('common.loading', 'Loading…')}</p>\n </div>\n );\n};\n\ninterface ErrorViewProps {\n title?: string;\n message?: string;\n onRetry?: () => void;\n className?: string;\n}\n\nexport const ErrorView: FC<ErrorViewProps> = ({ title, message, onRetry, className }) => {\n const tr = useTr();\n return (\n <div\n role=\"alert\"\n className={cn(\n 'flex min-h-[40vh] flex-col items-center justify-center gap-4 text-center',\n className\n )}\n >\n <AlertCircle className=\"h-10 w-10 text-status-error-text\" />\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {title ?? tr('common.somethingWentWrong', 'Something went wrong')}\n </h2>\n {message && <p className=\"mt-1 max-w-md text-sm text-text-secondary\">{message}</p>}\n </div>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\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('common.retry', 'Retry')}\n </button>\n )}\n </div>\n );\n};\n\ninterface SectionProps {\n title: string;\n description?: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Stable product-tour anchor rendered as `data-tour` (BOFF-3358). */\n dataTour?: string;\n}\n\nexport const Section: FC<SectionProps> = ({\n title,\n description,\n action,\n children,\n className,\n dataTour,\n}) => (\n <section className={cn('mt-8 first:mt-0', className)} data-tour={dataTour}>\n <div className=\"mb-3 flex items-end justify-between gap-3\">\n <div>\n <h2 className=\"text-base font-semibold text-text-primary\">{title}</h2>\n {description && <p className=\"mt-0.5 text-sm text-text-secondary\">{description}</p>}\n </div>\n {action && <div className=\"shrink-0\">{action}</div>}\n </div>\n {children}\n </section>\n);\n"],"mappings":";;;;;;AAmBA,IAAa,KAAqC,EAAE,UAAO,mBAAgB;CACzE,IAAM,IAAK,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAW,EAAG,gEAAgE,CAAS;YAA5F,CACE,kBAAC,GAAD,EAAS,MAAK,KAAM,CAAA,GACpB,kBAAC,KAAD;GAAG,WAAU;aAA+B,KAAS,EAAG,kBAAkB,UAAU;EAAK,CAAA,CACtF;;AAET,GASa,KAAiC,EAAE,UAAO,YAAS,YAAS,mBAAgB;CACvF,IAAM,IAAK,EAAM;CACjB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAW,EACT,4EACA,CACF;YALF;GAOE,kBAAC,GAAD,EAAa,WAAU,mCAAoC,CAAA;GAC3D,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cACX,KAAS,EAAG,6BAA6B,sBAAsB;GAC9D,CAAA,GACH,KAAW,kBAAC,KAAD;IAAG,WAAU;cAA6C;GAAW,CAAA,CAC9E,EAAA,CAAA;GACJ,KACC,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,WAAU;cAET,EAAG,gBAAgB,OAAO;GACrB,CAAA;EAEP;;AAET,GAYa,KAA6B,EACxC,UACA,gBACA,WACA,aACA,cACA,kBAEA,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;CAAG,aAAW;WAAjE,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;aAA6C;EAAU,CAAA,GACpE,KAAe,kBAAC,KAAD;GAAG,WAAU;aAAsC;EAAe,CAAA,CAC/E,EAAA,CAAA,GACJ,KAAU,kBAAC,OAAD;GAAK,WAAU;aAAY;EAAY,CAAA,CAC/C;KACJ,CACM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileDashboard.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileDashboard.tsx"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAmB3C,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,2CAA2C;IAC3C,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAClE,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAOD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"MobileDashboard.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/mobile/MobileDashboard.tsx"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAmB3C,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,2CAA2C;IAC3C,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAClE,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAOD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwRpD,CAAC"}
|
|
@@ -37,32 +37,38 @@ var x = "flex w-full items-center gap-3 rounded-2xl border border-border-subtle
|
|
|
37
37
|
}
|
|
38
38
|
];
|
|
39
39
|
return /* @__PURE__ */ b(o, {
|
|
40
|
+
dataTour: "subscriberbot-home",
|
|
40
41
|
testId: "sb-mobile-dashboard",
|
|
41
42
|
title: P("dashboard.title", "Overview"),
|
|
42
43
|
eyebrow: C ? P("mobile.dashboard.greeting", "Hi, {{name}}", { name: C }) : void 0,
|
|
43
|
-
hero: /* @__PURE__ */ b("div", {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
hero: /* @__PURE__ */ b("div", {
|
|
45
|
+
"data-tour": "subscriberbot-home-metrics",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ y("p", {
|
|
48
|
+
className: "text-sm",
|
|
49
|
+
children: P("mobile.dashboard.totalSpend", "Total recurring spend")
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ b("p", {
|
|
52
|
+
className: "mt-1 font-bold tabular-nums",
|
|
53
|
+
"data-testid": "sb-mobile-total-spend",
|
|
54
|
+
children: [/* @__PURE__ */ y("span", {
|
|
55
|
+
className: "text-4xl",
|
|
56
|
+
children: M(w.monthly, w.currency)
|
|
57
|
+
}), /* @__PURE__ */ y("span", {
|
|
58
|
+
className: "text-base font-medium",
|
|
59
|
+
children: P("mobile.dashboard.perMonth", "/month")
|
|
60
|
+
})]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ y("p", {
|
|
63
|
+
className: "mt-1 text-xs",
|
|
64
|
+
"data-tour": "subscriberbot-home-portfolio",
|
|
65
|
+
children: P(w.activeCount === 1 ? "mobile.dashboard.activeCountOne" : "mobile.dashboard.activeCount", w.activeCount === 1 ? "{{count}} active subscription" : "{{count}} active subscriptions", { count: w.activeCount })
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}),
|
|
64
69
|
children: [
|
|
65
70
|
/* @__PURE__ */ y(s, {
|
|
71
|
+
dataTour: "subscriberbot-home-renewals",
|
|
66
72
|
title: P("dashboard.renewals.title", "Upcoming renewals"),
|
|
67
73
|
action: T.length > 0 ? /* @__PURE__ */ b("button", {
|
|
68
74
|
type: "button",
|
|
@@ -112,6 +118,7 @@ var x = "flex w-full items-center gap-3 rounded-2xl border border-border-subtle
|
|
|
112
118
|
})
|
|
113
119
|
}),
|
|
114
120
|
/* @__PURE__ */ y(s, {
|
|
121
|
+
dataTour: "subscriberbot-home-needs-attention",
|
|
115
122
|
title: P("mobile.dashboard.needsAction", "Needs action"),
|
|
116
123
|
action: /* @__PURE__ */ b("button", {
|
|
117
124
|
type: "button",
|
|
@@ -222,6 +229,7 @@ var x = "flex w-full items-center gap-3 rounded-2xl border border-border-subtle
|
|
|
222
229
|
}),
|
|
223
230
|
/* @__PURE__ */ y(s, {
|
|
224
231
|
title: P("dashboard.quickActions.title", "Quick actions"),
|
|
232
|
+
dataTour: "subscriberbot-home-quick-actions",
|
|
225
233
|
children: /* @__PURE__ */ y("div", {
|
|
226
234
|
className: "grid grid-cols-2 gap-3",
|
|
227
235
|
children: F.map((e) => /* @__PURE__ */ b("button", {
|
|
@@ -1 +1 @@
|
|
|
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 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\">{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\">\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=\"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 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 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-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,QAAO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,EAAe,EAAE,kBAAkB,EAAE,UAAU,EACrD,uBAAuB,EACzB,CAAC,EACH,CAAC;QACG,CAAA;OAEF;SACN,GA3BK,EAAE,EA2BP;KAER,CAAC;IACC,CAAA;GACS,CAAA;GAGhB,IAAmB,KAClB,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,EAAW,WAAW;IACrC,WAAU;cAHZ,CAKE,kBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,kBAAC,GAAD,EAAe,WAAU,4CAA6C,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;IAAe,OAAO,EAAG,gCAAgC,eAAe;cACtE,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
|
+
{"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,SA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BAAC,QAAD;UAAM,WAAU;oBACb,IAAM,EAAG,EAAI,KAAK,EAAI,QAAQ,IAAI,EAAE;SACjC,CAAA,GACN,kBAAC,QAAD;UAAM,WAAU;oBACb,EAAkB,EAAE,cAAc,KAAK,EAAE;SACtC,CAAA,CACF;;QACL,EAAE,mBAAmB,KACpB,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAG,iCAAiC,sBAAsB,EACzD,QAAQ,EAAe,EAAE,kBAAkB,EAAE,UAAU,EACrD,uBAAuB,EACzB,CAAC,EACH,CAAC;QACG,CAAA;OAEF;SACN,GA3BK,EAAE,EA2BP;KAER,CAAC;IACC,CAAA;GACS,CAAA;GAGhB,IAAmB,KAClB,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,EAAW,WAAW;IACrC,WAAU;cAHZ,CAKE,kBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,kBAAC,GAAD,EAAe,WAAU,4CAA6C,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"}
|
|
@@ -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,11 +1,12 @@
|
|
|
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", {
|
|
@@ -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", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileScreen.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"sourcesContent":["/**\n * Mobile screen frame\n * @module subscriberbot/components/mobile\n *\n * The phone layout from the approved mobile mock (`sb-24-mobile-app.jpg`): a\n * brand-coloured hero band carrying the screen title (and, on the overview,\n * the headline number), with the content on a rounded sheet that overlaps the\n * band. Used below the `md` breakpoint only; desktop pages keep PageLayout.\n *\n * Semantic tokens only — the hero uses the product's action-primary pairing\n * so it follows the active brand and colour mode.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MobileScreenProps {\n title: string;\n /** Small line above the title (e.g. the greeting). */\n eyebrow?: ReactNode;\n /** Optional hero content under the title (e.g. the recurring-spend figure). */\n hero?: ReactNode;\n /** Optional trailing control in the hero (e.g. an add button). */\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Stable hook for Playwright and the assistant page context. */\n testId?: string;\n}\n\nexport const MobileScreen: FC<MobileScreenProps> = ({\n title,\n eyebrow,\n hero,\n action,\n children,\n className,\n testId,\n}) => (\n <div className={cn('flex min-h-full flex-col', className)} data-testid={testId}>\n <header
|
|
1
|
+
{"version":3,"file":"MobileScreen.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/MobileScreen.tsx"],"sourcesContent":["/**\n * Mobile screen frame\n * @module subscriberbot/components/mobile\n *\n * The phone layout from the approved mobile mock (`sb-24-mobile-app.jpg`): a\n * brand-coloured hero band carrying the screen title (and, on the overview,\n * the headline number), with the content on a rounded sheet that overlaps the\n * band. Used below the `md` breakpoint only; desktop pages keep PageLayout.\n *\n * Semantic tokens only — the hero uses the product's action-primary pairing\n * so it follows the active brand and colour mode.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\n\ninterface MobileScreenProps {\n title: string;\n /** Small line above the title (e.g. the greeting). */\n eyebrow?: ReactNode;\n /** Optional hero content under the title (e.g. the recurring-spend figure). */\n hero?: ReactNode;\n /** Optional trailing control in the hero (e.g. an add button). */\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n /** Stable hook for Playwright and the assistant page context. */\n testId?: string;\n /** Product-tour prefix; the header renders `{dataTour}-header`. */\n dataTour?: string;\n}\n\nexport const MobileScreen: FC<MobileScreenProps> = ({\n title,\n eyebrow,\n hero,\n action,\n children,\n className,\n testId,\n dataTour,\n}) => (\n <div className={cn('flex min-h-full flex-col', className)} data-testid={testId}>\n <header\n className=\"bg-action-primary-bg px-4 pb-10 pt-5 text-action-primary-text\"\n data-tour={dataTour ? `${dataTour}-header` : undefined}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n {eyebrow ? <p className=\"text-sm\">{eyebrow}</p> : null}\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n </div>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n {hero ? <div className=\"mt-4\">{hero}</div> : null}\n </header>\n <div className=\"-mt-6 flex-1 rounded-t-3xl bg-bg-canvas px-4 pb-6 pt-5\">{children}</div>\n </div>\n);\n\ninterface MobileSectionProps {\n title: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n dataTour?: string;\n}\n\n/** A titled group on the mobile sheet (\"Upcoming renewals\", \"Needs action\"). */\nexport const MobileSection: FC<MobileSectionProps> = ({\n title,\n action,\n children,\n className,\n dataTour,\n}) => (\n <section className={cn('mt-6 first:mt-0', className)} aria-label={title} data-tour={dataTour}>\n <div className=\"mb-3 flex items-center justify-between gap-3\">\n <h2 className=\"text-lg font-semibold text-text-primary\">{title}</h2>\n {action}\n </div>\n {children}\n </section>\n);\n"],"mappings":";;;AAgCA,IAAa,KAAuC,EAClD,UACA,YACA,SACA,WACA,aACA,cACA,WACA,kBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,4BAA4B,CAAS;CAAG,eAAa;WAAxE,CACE,kBAAC,UAAD;EACE,WAAU;EACV,aAAW,IAAW,GAAG,EAAS,WAAW,KAAA;YAF/C,CAIE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,IAAU,kBAAC,KAAD;KAAG,WAAU;eAAW;IAAW,CAAA,IAAI,MAClD,kBAAC,MAAD;KAAI,WAAU;eAAqC;IAAU,CAAA,CAC1D;OACJ,IAAS,kBAAC,OAAD;IAAK,WAAU;cAAY;GAAY,CAAA,IAAI,IAClD;MACJ,IAAO,kBAAC,OAAD;GAAK,WAAU;aAAQ;EAAU,CAAA,IAAI,IACvC;KACR,kBAAC,OAAD;EAAK,WAAU;EAA0D;CAAc,CAAA,CACpF;IAYM,KAAyC,EACpD,UACA,WACA,aACA,cACA,kBAEA,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;CAAG,cAAY;CAAO,aAAW;WAApF,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,MAAD;GAAI,WAAU;aAA2C;EAAU,CAAA,GAClE,CACE;KACJ,CACM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/pages/DashboardPage.tsx"],"names":[],"mappings":"AAuDA,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/pages/DashboardPage.tsx"],"names":[],"mappings":"AAuDA,wBAAgB,aAAa,gCAsc5B"}
|
|
@@ -69,11 +69,13 @@ function j() {
|
|
|
69
69
|
N
|
|
70
70
|
]), Q = v(() => G.filter((e) => e.actionRequired), [G]), oe = L.isLoading || R.isLoading || z.isLoading || B.isLoading, se = L.isError && R.isError && z.isError && B.isError;
|
|
71
71
|
if (oe) return /* @__PURE__ */ D(r, {
|
|
72
|
+
dataTour: "subscriberbot-home",
|
|
72
73
|
title: I("dashboard.title", "Overview"),
|
|
73
74
|
description: I("dashboard.description", "Your recurring digital relationships at a glance"),
|
|
74
75
|
children: /* @__PURE__ */ D(te, { label: I("dashboard.loading", "Loading your subscription portfolio…") })
|
|
75
76
|
});
|
|
76
77
|
if (se) return /* @__PURE__ */ D(r, {
|
|
78
|
+
dataTour: "subscriberbot-home",
|
|
77
79
|
title: I("dashboard.title", "Overview"),
|
|
78
80
|
description: I("dashboard.description", "Your recurring digital relationships at a glance"),
|
|
79
81
|
children: /* @__PURE__ */ D(ee, {
|
|
@@ -134,6 +136,7 @@ function j() {
|
|
|
134
136
|
}
|
|
135
137
|
];
|
|
136
138
|
return /* @__PURE__ */ O(r, {
|
|
139
|
+
dataTour: "subscriberbot-home",
|
|
137
140
|
title: $ ? I("dashboard.welcomeBack", "Welcome back, {{name}}", { name: $ }) : I("dashboard.title", "Overview"),
|
|
138
141
|
description: I("dashboard.description", "Everything you pay for on repeat — in one intelligent console."),
|
|
139
142
|
children: [
|
|
@@ -143,6 +146,7 @@ function j() {
|
|
|
143
146
|
}),
|
|
144
147
|
/* @__PURE__ */ O("div", {
|
|
145
148
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
149
|
+
"data-tour": "subscriberbot-home-metrics",
|
|
146
150
|
children: [
|
|
147
151
|
/* @__PURE__ */ D(i, {
|
|
148
152
|
featured: !0,
|
|
@@ -176,6 +180,7 @@ function j() {
|
|
|
176
180
|
title: I("dashboard.renewals.title", "Upcoming renewals"),
|
|
177
181
|
description: I("dashboard.renewals.description", "What's charging next across your portfolio"),
|
|
178
182
|
className: "mt-0",
|
|
183
|
+
dataTour: "subscriberbot-home-renewals",
|
|
179
184
|
action: /* @__PURE__ */ O("button", {
|
|
180
185
|
type: "button",
|
|
181
186
|
onClick: () => P("/relationships"),
|
|
@@ -202,6 +207,7 @@ function j() {
|
|
|
202
207
|
title: I("dashboard.portfolio.title", "Portfolio by status"),
|
|
203
208
|
description: I("dashboard.portfolio.description", "Where your relationships stand"),
|
|
204
209
|
className: "mt-0",
|
|
210
|
+
dataTour: "subscriberbot-home-portfolio",
|
|
205
211
|
children: /* @__PURE__ */ D(k, {
|
|
206
212
|
treatment: "glass",
|
|
207
213
|
className: "p-5",
|
|
@@ -234,6 +240,7 @@ function j() {
|
|
|
234
240
|
title: I("dashboard.needsAttention.title", "Needs attention"),
|
|
235
241
|
description: I("dashboard.needsAttention.description", "Required actions from the Universal Inbox"),
|
|
236
242
|
className: "mt-0",
|
|
243
|
+
dataTour: "subscriberbot-home-needs-attention",
|
|
237
244
|
action: /* @__PURE__ */ D("button", {
|
|
238
245
|
type: "button",
|
|
239
246
|
onClick: () => P("/inbox"),
|
|
@@ -301,6 +308,7 @@ function j() {
|
|
|
301
308
|
/* @__PURE__ */ D(s, {
|
|
302
309
|
title: I("dashboard.quickActions.title", "Quick actions"),
|
|
303
310
|
description: I("dashboard.quickActions.description", "Jump straight into your workflow"),
|
|
311
|
+
dataTour: "subscriberbot-home-quick-actions",
|
|
304
312
|
children: /* @__PURE__ */ D("div", {
|
|
305
313
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
306
314
|
children: ce.map((e) => /* @__PURE__ */ O("button", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/subscriberbot/pages/DashboardPage.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Dashboard / Overview\n * @module subscriberbot/pages\n *\n * The Subscriber Bot landing page: a premium fintech console over every\n * recurring digital relationship — total recurring spend, portfolio-by-status,\n * upcoming renewals, the action-required inbox, and outstanding invoices. Every\n * number and chart is COMPUTED from real data returned by\n * `wspace-subscriberbot-svc` — nothing is mocked.\n */\n\nimport { useMemo } from 'react';\nimport {\n Repeat2,\n Wallet,\n CalendarClock,\n Inbox,\n AlertTriangle,\n ArrowRight,\n ArrowUpRight,\n Sparkles,\n Bot,\n ShieldCheck,\n} from 'lucide-react';\nimport { PagePurpose, GlassCard } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n MetricsCard,\n StatusBadge,\n EmptyState,\n LoadingView,\n ErrorView,\n Section,\n Donut,\n Legend,\n Timeline,\n type Segment,\n type TimelineItem,\n} from '../components';\nimport { useSubscriberBot } from '../context/SubscriberBotContext';\nimport {\n useRelationships,\n useInvoices,\n useInboxMessages,\n useRenewalEvents,\n useDecisions,\n} from '../hooks/useSubscriberBotApi';\nimport { useTr } from '../hooks/useTr';\n\nimport { buildUpcomingRenewals, recurringSpend } from '../utils/portfolio';\nimport { useCompactViewport } from '../hooks/useCompactViewport';\nimport { MobileDashboard } from '../components/mobile';\nimport type { SubRelationship } from '../types';\n\nexport function DashboardPage() {\n const { formatCurrency, formatEnumLabel, formatRelativeTime } = useFormatters();\n\n const { navigateTo, currentUser } = useSubscriberBot();\n const tr = useTr();\n\n const relationshipsQ = useRelationships({ pagination: { limit: 100, offset: 0 } });\n const invoicesQ = useInvoices({ pagination: { limit: 50, offset: 0 } });\n const inboxQ = useInboxMessages({ pagination: { limit: 50, offset: 0 } });\n const renewalsQ = useRenewalEvents({ upcomingOnly: true });\n // Phone layout (BOFF-4010) also surfaces open AI recommendations; the\n // desktop console keeps them on the dedicated decisions page, so only\n // fetch them when the mobile overview will render them.\n const compact = useCompactViewport();\n const decisionsQ = useDecisions({ status: 'PROPOSED' }, { enabled: compact });\n\n const relationships = useMemo(() => relationshipsQ.data?.items ?? [], [relationshipsQ.data]);\n const invoices = useMemo(() => invoicesQ.data?.items ?? [], [invoicesQ.data]);\n const messages = useMemo(() => inboxQ.data?.items ?? [], [inboxQ.data]);\n const renewals = useMemo(() => renewalsQ.data ?? [], [renewalsQ.data]);\n\n // Fast label lookup so mobile AI-recommendation rows can name their relationship.\n const relationshipById = useMemo(() => {\n const map = new Map<string, SubRelationship>();\n relationships.forEach((r) => map.set(r.id, r));\n return map;\n }, [relationships]);\n\n const stats = useMemo(() => {\n const spend = recurringSpend(relationships);\n // BOFF-8660 — KPI must match the Universal Inbox \"need action\" counter\n // and the on-page Needs-attention list, both of which count by\n // `actionRequired` alone (read state is irrelevant). The previous\n // `&& !m.isRead` clause made the tile show 0 the moment the user read\n // the only action-required message, contradicting the surfaces below.\n const actionRequired = messages.filter((m) => m.actionRequired).length;\n const openInvoices = invoices.filter(\n (i) => i.status === 'ISSUED' || i.status === 'OVERDUE' || i.status === 'FAILED'\n );\n const openInvoiceTotal = openInvoices.reduce((sum, i) => sum + i.total, 0);\n const atRisk = relationships.filter(\n (r) => r.status === 'PAST_DUE' || r.status === 'LAPSED'\n ).length;\n\n return {\n activeCount: spend.activeCount,\n totalCount: relationships.length,\n monthlySpend: spend.monthly,\n primaryCurrency: spend.currency,\n actionRequired,\n openInvoiceCount: openInvoices.length,\n openInvoiceTotal,\n atRisk,\n };\n }, [relationships, messages, invoices]);\n\n // Portfolio-by-status → donut segments (grouped from real relationships).\n const statusSegments = useMemo<Segment[]>(() => {\n const counts = new Map<string, number>();\n relationships.forEach((r) => counts.set(r.status, (counts.get(r.status) ?? 0) + 1));\n return Array.from(counts.entries())\n .sort((a, b) => b[1] - a[1])\n .map(([status, value]) => ({ label: formatEnumLabel(status), value }));\n }, [relationships, formatEnumLabel]);\n\n // Upcoming renewals, soonest first: real renewal events when present,\n // otherwise each relationship's own future `renewsAt` (shared with mobile).\n const upcoming = useMemo(\n () => buildUpcomingRenewals(relationships, renewals, (eventType) => formatEnumLabel(eventType)),\n [relationships, renewals, formatEnumLabel]\n );\n\n const timelineItems = useMemo<TimelineItem[]>(\n () =>\n upcoming.slice(0, 6).map((u) => ({\n title: u.title,\n sub: formatRelativeTime(u.when),\n tone: u.soon ? 'warning' : 'default',\n meta:\n u.amount != null\n ? formatCurrency(u.amount, u.currency ?? stats.primaryCurrency, {\n maximumFractionDigits: 0,\n })\n : undefined,\n })),\n [upcoming, stats.primaryCurrency, formatCurrency, formatRelativeTime]\n );\n\n const actionMessages = useMemo(() => messages.filter((m) => m.actionRequired), [messages]);\n\n const isLoading =\n relationshipsQ.isLoading || invoicesQ.isLoading || inboxQ.isLoading || renewalsQ.isLoading;\n const isError =\n relationshipsQ.isError && invoicesQ.isError && inboxQ.isError && renewalsQ.isError;\n\n if (isLoading) {\n return (\n <PageLayout\n title={tr('dashboard.title', 'Overview')}\n description={tr(\n 'dashboard.description',\n 'Your recurring digital relationships at a glance'\n )}\n >\n <LoadingView label={tr('dashboard.loading', 'Loading your subscription portfolio…')} />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout\n title={tr('dashboard.title', 'Overview')}\n description={tr(\n 'dashboard.description',\n 'Your recurring digital relationships at a glance'\n )}\n >\n <ErrorView\n message={tr(\n 'dashboard.error',\n \"We couldn't reach the Subscriber Bot service. Please try again.\"\n )}\n onRetry={() => {\n void relationshipsQ.refetch();\n void invoicesQ.refetch();\n void inboxQ.refetch();\n void renewalsQ.refetch();\n }}\n />\n </PageLayout>\n );\n }\n\n const greetingName = currentUser?.firstName || currentUser?.name?.split(' ')[0];\n\n if (compact) {\n return (\n <MobileDashboard\n greetingName={greetingName || undefined}\n spend={{\n monthly: stats.monthlySpend,\n currency: stats.primaryCurrency,\n activeCount: stats.activeCount,\n }}\n upcoming={upcoming}\n actionMessages={actionMessages}\n decisions={decisionsQ.data?.items ?? []}\n relationshipLabel={(id) => relationshipById.get(id)?.label}\n openInvoiceCount={stats.openInvoiceCount}\n openInvoiceTotal={stats.openInvoiceTotal}\n navigateTo={navigateTo}\n />\n );\n }\n\n const quickActions = [\n {\n labelKey: 'dashboard.quickActions.addRelationship.label',\n descriptionKey: 'dashboard.quickActions.addRelationship.description',\n fallbackLabel: 'Add a relationship',\n fallbackDescription: 'Track a new subscription',\n icon: <Repeat2 className=\"h-5 w-5\" />,\n path: '/relationships/new',\n },\n {\n labelKey: 'dashboard.quickActions.discoverProviders.label',\n descriptionKey: 'dashboard.quickActions.discoverProviders.description',\n fallbackLabel: 'Discover providers',\n fallbackDescription: 'Browse the registry',\n icon: <Sparkles className=\"h-5 w-5\" />,\n path: '/providers',\n },\n {\n labelKey: 'dashboard.quickActions.openInbox.label',\n descriptionKey: 'dashboard.quickActions.openInbox.description',\n fallbackLabel: 'Open inbox',\n fallbackDescription: 'Merged communications',\n icon: <Inbox className=\"h-5 w-5\" />,\n path: '/inbox',\n },\n {\n labelKey: 'dashboard.quickActions.configureAgents.label',\n descriptionKey: 'dashboard.quickActions.configureAgents.description',\n fallbackLabel: 'Configure agents',\n fallbackDescription: 'Automate your portfolio',\n icon: <Bot className=\"h-5 w-5\" />,\n path: '/agents',\n },\n ];\n\n return (\n <PageLayout\n title={\n greetingName\n ? tr('dashboard.welcomeBack', 'Welcome back, {{name}}', { name: greetingName })\n : tr('dashboard.title', 'Overview')\n }\n description={tr(\n 'dashboard.description',\n 'Everything you pay for on repeat — in one intelligent console.'\n )}\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'dashboard.purpose',\n 'Subscriber Bot is your system of record for every recurring digital relationship. See total recurring spend, what renews next, what needs action, and what to optimize — all from real data across your providers.'\n )}\n </PagePurpose>\n\n {/* KPI tiles */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <MetricsCard\n featured\n icon={<Wallet />}\n value={formatCurrency(stats.monthlySpend, stats.primaryCurrency, {\n maximumFractionDigits: 0,\n })}\n label={tr('dashboard.metrics.recurringSpend', 'Recurring spend / month')}\n />\n <MetricsCard\n icon={<Repeat2 />}\n value={stats.activeCount}\n label={tr('dashboard.metrics.activeRelationships', 'Active relationships')}\n />\n <MetricsCard\n icon={<CalendarClock />}\n value={upcoming.length}\n label={tr('dashboard.metrics.upcomingRenewals', 'Upcoming renewals')}\n />\n <MetricsCard\n icon={<AlertTriangle />}\n value={stats.actionRequired}\n label={tr('dashboard.metrics.needsAction', 'Need your action')}\n trend={stats.actionRequired > 0 ? 'down' : undefined}\n />\n </div>\n\n {/* Main console: renewals (left) + portfolio donut & needs-attention (right) */}\n <div className=\"mt-8 grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Upcoming renewals timeline — spans two columns on desktop */}\n <div className=\"lg:col-span-2\">\n <Section\n title={tr('dashboard.renewals.title', 'Upcoming renewals')}\n description={tr(\n 'dashboard.renewals.description',\n \"What's charging next across your portfolio\"\n )}\n className=\"mt-0\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\n className=\"inline-flex items-center gap-1 text-sm font-medium text-text-link hover:underline\"\n >\n {tr('common.viewAll', 'View all')} <ArrowUpRight className=\"h-3.5 w-3.5\" />\n </button>\n }\n >\n <GlassCard treatment=\"plain\" className=\"p-5\">\n {timelineItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-calendar\"\n title={tr('dashboard.renewals.emptyTitle', 'No upcoming renewals')}\n description={tr(\n 'dashboard.renewals.emptyDescription',\n 'Renewals you track will appear here ahead of time.'\n )}\n />\n ) : (\n <Timeline items={timelineItems} />\n )}\n </GlassCard>\n </Section>\n </div>\n\n {/* Right rail: portfolio-by-status donut + needs-attention panel */}\n <div className=\"flex flex-col gap-6\">\n <Section\n title={tr('dashboard.portfolio.title', 'Portfolio by status')}\n description={tr('dashboard.portfolio.description', 'Where your relationships stand')}\n className=\"mt-0\"\n >\n <GlassCard treatment=\"glass\" className=\"p-5\">\n {statusSegments.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('dashboard.portfolio.emptyTitle', 'No relationships yet')}\n description={tr(\n 'dashboard.portfolio.emptyDescription',\n 'Add your first subscription to see the breakdown.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships/new')}\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('dashboard.portfolio.addRelationship', 'Add relationship')}\n </button>\n }\n />\n ) : (\n <div className=\"flex flex-col items-center gap-5 sm:flex-row sm:items-center lg:flex-col xl:flex-row\">\n <Donut\n data={statusSegments}\n size={148}\n thickness={20}\n centerLabel={String(stats.totalCount)}\n centerSub={tr(\n stats.totalCount === 1\n ? 'dashboard.portfolio.relationshipSingular'\n : 'dashboard.portfolio.relationshipPlural',\n stats.totalCount === 1 ? 'relationship' : 'relationships'\n )}\n className=\"shrink-0\"\n />\n <Legend data={statusSegments} className=\"w-full min-w-0 flex-1\" />\n </div>\n )}\n </GlassCard>\n </Section>\n\n <Section\n title={tr('dashboard.needsAttention.title', 'Needs attention')}\n description={tr(\n 'dashboard.needsAttention.description',\n 'Required actions from the Universal Inbox'\n )}\n className=\"mt-0\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/inbox')}\n className=\"text-sm font-medium text-text-link hover:underline\"\n >\n {tr('dashboard.needsAttention.openInbox', 'Open inbox')}\n </button>\n }\n >\n <GlassCard treatment=\"plain\" className=\"p-3\">\n {actionMessages.length === 0 ? (\n <div className=\"flex items-center gap-3 px-2 py-4\">\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-lg bg-status-success-bg-subtle text-status-success-text\">\n <ShieldCheck className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium text-text-primary\">\n {tr('dashboard.needsAttention.allCaughtUp', \"You're all caught up\")}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'dashboard.needsAttention.allCaughtUpDescription',\n 'Required actions across your channels will surface here.'\n )}\n </p>\n </div>\n </div>\n ) : (\n <ul className=\"space-y-1\">\n {actionMessages.slice(0, 5).map((message) => (\n <li key={message.id}>\n <button\n type=\"button\"\n onClick={() => navigateTo('/inbox')}\n className=\"flex w-full items-center gap-3 rounded-lg border-l-2 border-status-warning-text/60 bg-status-warning-bg-subtle/50 p-3 text-start transition-colors hover:bg-status-warning-bg-subtle\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {message.subject ||\n tr('dashboard.needsAttention.noSubject', '(no subject)')}\n </p>\n {message.preview && (\n <p className=\"truncate text-xs text-text-secondary\">\n {message.preview}\n </p>\n )}\n </div>\n <StatusBadge status={message.category} className=\"shrink-0\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </GlassCard>\n </Section>\n </div>\n </div>\n\n {/* Open-invoice call-out (only when there is real outstanding balance) */}\n {stats.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-xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-5 py-4 text-start transition-shadow hover:shadow-md\"\n >\n <div 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: stats.openInvoiceCount,\n amount: formatCurrency(stats.openInvoiceTotal, stats.primaryCurrency),\n }\n )}\n </span>\n </div>\n <ArrowRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-status-warning-text\" />\n </button>\n )}\n\n {/* Quick actions */}\n <Section\n title={tr('dashboard.quickActions.title', 'Quick actions')}\n description={tr('dashboard.quickActions.description', 'Jump straight into your workflow')}\n >\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {quickActions.map((qa) => (\n <button\n key={qa.path}\n type=\"button\"\n onClick={() => navigateTo(qa.path)}\n className=\"group flex items-center gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 text-start transition-all hover:-translate-y-0.5 hover:border-border-seam hover:shadow-md\"\n >\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n {qa.icon}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {tr(qa.labelKey, qa.fallbackLabel)}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(qa.descriptionKey, qa.fallbackDescription)}\n </span>\n </span>\n <ArrowRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-text-secondary transition-transform group-hover:translate-x-0.5\" />\n </button>\n ))}\n </div>\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,mBAAgB,oBAAiB,0BAAuB,EAAc,GAExE,EAAE,eAAY,mBAAgB,EAAiB,GAC/C,IAAK,EAAM,GAEX,IAAiB,EAAiB,EAAE,YAAY;EAAE,OAAO;EAAK,QAAQ;CAAE,EAAE,CAAC,GAC3E,IAAY,EAAY,EAAE,YAAY;EAAE,OAAO;EAAI,QAAQ;CAAE,EAAE,CAAC,GAChE,IAAS,EAAiB,EAAE,YAAY;EAAE,OAAO;EAAI,QAAQ;CAAE,EAAE,CAAC,GAClE,IAAY,EAAiB,EAAE,cAAc,GAAK,CAAC,GAInD,IAAU,EAAmB,GAC7B,IAAa,EAAa,EAAE,QAAQ,WAAW,GAAG,EAAE,SAAS,EAAQ,CAAC,GAEtE,IAAgB,QAAc,EAAe,MAAM,SAAS,CAAC,GAAG,CAAC,EAAe,IAAI,CAAC,GACrF,IAAW,QAAc,EAAU,MAAM,SAAS,CAAC,GAAG,CAAC,EAAU,IAAI,CAAC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EAAQ;UAAU,WAAU;SAAY,CAAA,CACvD;WACN,GAnBK,EAAQ,EAmBb,CACL;OACC,CAAA;MAEG,CAAA;KACJ,CAAA,CACN;MACF;;GAGJ,EAAM,mBAAmB,KACxB,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,EAAW,WAAW;IACrC,WAAU;cAHZ,CAKE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAAe,WAAU,4CAA6C,CAAA,GACtE,kBAAC,QAAD;MAAM,WAAU;gBACb,EACC,gCACA,mDACA;OACE,OAAO,EAAM;OACb,QAAQ,EAAe,EAAM,kBAAkB,EAAM,eAAe;MACtE,CACF;KACI,CAAA,CACH;QACL,kBAAC,GAAD,EAAY,WAAU,2DAA4D,CAAA,CAC5E;;GAIV,kBAAC,GAAD;IACE,OAAO,EAAG,gCAAgC,eAAe;IACzD,aAAa,EAAG,sCAAsC,kCAAkC;cAExF,kBAAC,OAAD;KAAK,WAAU;eACZ,GAAa,KAAK,MACjB,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe,EAAW,EAAG,IAAI;MACjC,WAAU;gBAJZ;OAME,kBAAC,QAAD;QAAM,WAAU;kBACb,EAAG;OACA,CAAA;OACN,kBAAC,QAAD;QAAM,WAAU;kBAAhB,CACE,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAG,EAAG,UAAU,EAAG,aAAa;QAC7B,CAAA,GACN,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAG,EAAG,gBAAgB,EAAG,mBAAmB;QACzC,CAAA,CACF;;OACN,kBAAC,GAAD,EAAY,WAAU,uGAAwG,CAAA;MACxH;QAjBD,EAAG,IAiBF,CACT;IACE,CAAA;GACE,CAAA;EACC;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"DashboardPage.js","names":[],"sources":["../../../src/subscriberbot/pages/DashboardPage.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Dashboard / Overview\n * @module subscriberbot/pages\n *\n * The Subscriber Bot landing page: a premium fintech console over every\n * recurring digital relationship — total recurring spend, portfolio-by-status,\n * upcoming renewals, the action-required inbox, and outstanding invoices. Every\n * number and chart is COMPUTED from real data returned by\n * `wspace-subscriberbot-svc` — nothing is mocked.\n */\n\nimport { useMemo } from 'react';\nimport {\n Repeat2,\n Wallet,\n CalendarClock,\n Inbox,\n AlertTriangle,\n ArrowRight,\n ArrowUpRight,\n Sparkles,\n Bot,\n ShieldCheck,\n} from 'lucide-react';\nimport { PagePurpose, GlassCard } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n MetricsCard,\n StatusBadge,\n EmptyState,\n LoadingView,\n ErrorView,\n Section,\n Donut,\n Legend,\n Timeline,\n type Segment,\n type TimelineItem,\n} from '../components';\nimport { useSubscriberBot } from '../context/SubscriberBotContext';\nimport {\n useRelationships,\n useInvoices,\n useInboxMessages,\n useRenewalEvents,\n useDecisions,\n} from '../hooks/useSubscriberBotApi';\nimport { useTr } from '../hooks/useTr';\n\nimport { buildUpcomingRenewals, recurringSpend } from '../utils/portfolio';\nimport { useCompactViewport } from '../hooks/useCompactViewport';\nimport { MobileDashboard } from '../components/mobile';\nimport type { SubRelationship } from '../types';\n\nexport function DashboardPage() {\n const { formatCurrency, formatEnumLabel, formatRelativeTime } = useFormatters();\n\n const { navigateTo, currentUser } = useSubscriberBot();\n const tr = useTr();\n\n const relationshipsQ = useRelationships({ pagination: { limit: 100, offset: 0 } });\n const invoicesQ = useInvoices({ pagination: { limit: 50, offset: 0 } });\n const inboxQ = useInboxMessages({ pagination: { limit: 50, offset: 0 } });\n const renewalsQ = useRenewalEvents({ upcomingOnly: true });\n // Phone layout (BOFF-4010) also surfaces open AI recommendations; the\n // desktop console keeps them on the dedicated decisions page, so only\n // fetch them when the mobile overview will render them.\n const compact = useCompactViewport();\n const decisionsQ = useDecisions({ status: 'PROPOSED' }, { enabled: compact });\n\n const relationships = useMemo(() => relationshipsQ.data?.items ?? [], [relationshipsQ.data]);\n const invoices = useMemo(() => invoicesQ.data?.items ?? [], [invoicesQ.data]);\n const messages = useMemo(() => inboxQ.data?.items ?? [], [inboxQ.data]);\n const renewals = useMemo(() => renewalsQ.data ?? [], [renewalsQ.data]);\n\n // Fast label lookup so mobile AI-recommendation rows can name their relationship.\n const relationshipById = useMemo(() => {\n const map = new Map<string, SubRelationship>();\n relationships.forEach((r) => map.set(r.id, r));\n return map;\n }, [relationships]);\n\n const stats = useMemo(() => {\n const spend = recurringSpend(relationships);\n // BOFF-8660 — KPI must match the Universal Inbox \"need action\" counter\n // and the on-page Needs-attention list, both of which count by\n // `actionRequired` alone (read state is irrelevant). The previous\n // `&& !m.isRead` clause made the tile show 0 the moment the user read\n // the only action-required message, contradicting the surfaces below.\n const actionRequired = messages.filter((m) => m.actionRequired).length;\n const openInvoices = invoices.filter(\n (i) => i.status === 'ISSUED' || i.status === 'OVERDUE' || i.status === 'FAILED'\n );\n const openInvoiceTotal = openInvoices.reduce((sum, i) => sum + i.total, 0);\n const atRisk = relationships.filter(\n (r) => r.status === 'PAST_DUE' || r.status === 'LAPSED'\n ).length;\n\n return {\n activeCount: spend.activeCount,\n totalCount: relationships.length,\n monthlySpend: spend.monthly,\n primaryCurrency: spend.currency,\n actionRequired,\n openInvoiceCount: openInvoices.length,\n openInvoiceTotal,\n atRisk,\n };\n }, [relationships, messages, invoices]);\n\n // Portfolio-by-status → donut segments (grouped from real relationships).\n const statusSegments = useMemo<Segment[]>(() => {\n const counts = new Map<string, number>();\n relationships.forEach((r) => counts.set(r.status, (counts.get(r.status) ?? 0) + 1));\n return Array.from(counts.entries())\n .sort((a, b) => b[1] - a[1])\n .map(([status, value]) => ({ label: formatEnumLabel(status), value }));\n }, [relationships, formatEnumLabel]);\n\n // Upcoming renewals, soonest first: real renewal events when present,\n // otherwise each relationship's own future `renewsAt` (shared with mobile).\n const upcoming = useMemo(\n () => buildUpcomingRenewals(relationships, renewals, (eventType) => formatEnumLabel(eventType)),\n [relationships, renewals, formatEnumLabel]\n );\n\n const timelineItems = useMemo<TimelineItem[]>(\n () =>\n upcoming.slice(0, 6).map((u) => ({\n title: u.title,\n sub: formatRelativeTime(u.when),\n tone: u.soon ? 'warning' : 'default',\n meta:\n u.amount != null\n ? formatCurrency(u.amount, u.currency ?? stats.primaryCurrency, {\n maximumFractionDigits: 0,\n })\n : undefined,\n })),\n [upcoming, stats.primaryCurrency, formatCurrency, formatRelativeTime]\n );\n\n const actionMessages = useMemo(() => messages.filter((m) => m.actionRequired), [messages]);\n\n const isLoading =\n relationshipsQ.isLoading || invoicesQ.isLoading || inboxQ.isLoading || renewalsQ.isLoading;\n const isError =\n relationshipsQ.isError && invoicesQ.isError && inboxQ.isError && renewalsQ.isError;\n\n if (isLoading) {\n return (\n <PageLayout\n dataTour=\"subscriberbot-home\"\n title={tr('dashboard.title', 'Overview')}\n description={tr(\n 'dashboard.description',\n 'Your recurring digital relationships at a glance'\n )}\n >\n <LoadingView label={tr('dashboard.loading', 'Loading your subscription portfolio…')} />\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout\n dataTour=\"subscriberbot-home\"\n title={tr('dashboard.title', 'Overview')}\n description={tr(\n 'dashboard.description',\n 'Your recurring digital relationships at a glance'\n )}\n >\n <ErrorView\n message={tr(\n 'dashboard.error',\n \"We couldn't reach the Subscriber Bot service. Please try again.\"\n )}\n onRetry={() => {\n void relationshipsQ.refetch();\n void invoicesQ.refetch();\n void inboxQ.refetch();\n void renewalsQ.refetch();\n }}\n />\n </PageLayout>\n );\n }\n\n const greetingName = currentUser?.firstName || currentUser?.name?.split(' ')[0];\n\n if (compact) {\n return (\n <MobileDashboard\n greetingName={greetingName || undefined}\n spend={{\n monthly: stats.monthlySpend,\n currency: stats.primaryCurrency,\n activeCount: stats.activeCount,\n }}\n upcoming={upcoming}\n actionMessages={actionMessages}\n decisions={decisionsQ.data?.items ?? []}\n relationshipLabel={(id) => relationshipById.get(id)?.label}\n openInvoiceCount={stats.openInvoiceCount}\n openInvoiceTotal={stats.openInvoiceTotal}\n navigateTo={navigateTo}\n />\n );\n }\n\n const quickActions = [\n {\n labelKey: 'dashboard.quickActions.addRelationship.label',\n descriptionKey: 'dashboard.quickActions.addRelationship.description',\n fallbackLabel: 'Add a relationship',\n fallbackDescription: 'Track a new subscription',\n icon: <Repeat2 className=\"h-5 w-5\" />,\n path: '/relationships/new',\n },\n {\n labelKey: 'dashboard.quickActions.discoverProviders.label',\n descriptionKey: 'dashboard.quickActions.discoverProviders.description',\n fallbackLabel: 'Discover providers',\n fallbackDescription: 'Browse the registry',\n icon: <Sparkles className=\"h-5 w-5\" />,\n path: '/providers',\n },\n {\n labelKey: 'dashboard.quickActions.openInbox.label',\n descriptionKey: 'dashboard.quickActions.openInbox.description',\n fallbackLabel: 'Open inbox',\n fallbackDescription: 'Merged communications',\n icon: <Inbox className=\"h-5 w-5\" />,\n path: '/inbox',\n },\n {\n labelKey: 'dashboard.quickActions.configureAgents.label',\n descriptionKey: 'dashboard.quickActions.configureAgents.description',\n fallbackLabel: 'Configure agents',\n fallbackDescription: 'Automate your portfolio',\n icon: <Bot className=\"h-5 w-5\" />,\n path: '/agents',\n },\n ];\n\n return (\n <PageLayout\n dataTour=\"subscriberbot-home\"\n title={\n greetingName\n ? tr('dashboard.welcomeBack', 'Welcome back, {{name}}', { name: greetingName })\n : tr('dashboard.title', 'Overview')\n }\n description={tr(\n 'dashboard.description',\n 'Everything you pay for on repeat — in one intelligent console.'\n )}\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'dashboard.purpose',\n 'Subscriber Bot is your system of record for every recurring digital relationship. See total recurring spend, what renews next, what needs action, and what to optimize — all from real data across your providers.'\n )}\n </PagePurpose>\n\n {/* KPI tiles */}\n <div\n className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\"\n data-tour=\"subscriberbot-home-metrics\"\n >\n <MetricsCard\n featured\n icon={<Wallet />}\n value={formatCurrency(stats.monthlySpend, stats.primaryCurrency, {\n maximumFractionDigits: 0,\n })}\n label={tr('dashboard.metrics.recurringSpend', 'Recurring spend / month')}\n />\n <MetricsCard\n icon={<Repeat2 />}\n value={stats.activeCount}\n label={tr('dashboard.metrics.activeRelationships', 'Active relationships')}\n />\n <MetricsCard\n icon={<CalendarClock />}\n value={upcoming.length}\n label={tr('dashboard.metrics.upcomingRenewals', 'Upcoming renewals')}\n />\n <MetricsCard\n icon={<AlertTriangle />}\n value={stats.actionRequired}\n label={tr('dashboard.metrics.needsAction', 'Need your action')}\n trend={stats.actionRequired > 0 ? 'down' : undefined}\n />\n </div>\n\n {/* Main console: renewals (left) + portfolio donut & needs-attention (right) */}\n <div className=\"mt-8 grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Upcoming renewals timeline — spans two columns on desktop */}\n <div className=\"lg:col-span-2\">\n <Section\n title={tr('dashboard.renewals.title', 'Upcoming renewals')}\n description={tr(\n 'dashboard.renewals.description',\n \"What's charging next across your portfolio\"\n )}\n className=\"mt-0\"\n dataTour=\"subscriberbot-home-renewals\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\n className=\"inline-flex items-center gap-1 text-sm font-medium text-text-link hover:underline\"\n >\n {tr('common.viewAll', 'View all')} <ArrowUpRight className=\"h-3.5 w-3.5\" />\n </button>\n }\n >\n <GlassCard treatment=\"plain\" className=\"p-5\">\n {timelineItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-calendar\"\n title={tr('dashboard.renewals.emptyTitle', 'No upcoming renewals')}\n description={tr(\n 'dashboard.renewals.emptyDescription',\n 'Renewals you track will appear here ahead of time.'\n )}\n />\n ) : (\n <Timeline items={timelineItems} />\n )}\n </GlassCard>\n </Section>\n </div>\n\n {/* Right rail: portfolio-by-status donut + needs-attention panel */}\n <div className=\"flex flex-col gap-6\">\n <Section\n title={tr('dashboard.portfolio.title', 'Portfolio by status')}\n description={tr('dashboard.portfolio.description', 'Where your relationships stand')}\n className=\"mt-0\"\n dataTour=\"subscriberbot-home-portfolio\"\n >\n <GlassCard treatment=\"glass\" className=\"p-5\">\n {statusSegments.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('dashboard.portfolio.emptyTitle', 'No relationships yet')}\n description={tr(\n 'dashboard.portfolio.emptyDescription',\n 'Add your first subscription to see the breakdown.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships/new')}\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('dashboard.portfolio.addRelationship', 'Add relationship')}\n </button>\n }\n />\n ) : (\n <div className=\"flex flex-col items-center gap-5 sm:flex-row sm:items-center lg:flex-col xl:flex-row\">\n <Donut\n data={statusSegments}\n size={148}\n thickness={20}\n centerLabel={String(stats.totalCount)}\n centerSub={tr(\n stats.totalCount === 1\n ? 'dashboard.portfolio.relationshipSingular'\n : 'dashboard.portfolio.relationshipPlural',\n stats.totalCount === 1 ? 'relationship' : 'relationships'\n )}\n className=\"shrink-0\"\n />\n <Legend data={statusSegments} className=\"w-full min-w-0 flex-1\" />\n </div>\n )}\n </GlassCard>\n </Section>\n\n <Section\n title={tr('dashboard.needsAttention.title', 'Needs attention')}\n description={tr(\n 'dashboard.needsAttention.description',\n 'Required actions from the Universal Inbox'\n )}\n className=\"mt-0\"\n dataTour=\"subscriberbot-home-needs-attention\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/inbox')}\n className=\"text-sm font-medium text-text-link hover:underline\"\n >\n {tr('dashboard.needsAttention.openInbox', 'Open inbox')}\n </button>\n }\n >\n <GlassCard treatment=\"plain\" className=\"p-3\">\n {actionMessages.length === 0 ? (\n <div className=\"flex items-center gap-3 px-2 py-4\">\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-lg bg-status-success-bg-subtle text-status-success-text\">\n <ShieldCheck className=\"h-5 w-5\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium text-text-primary\">\n {tr('dashboard.needsAttention.allCaughtUp', \"You're all caught up\")}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'dashboard.needsAttention.allCaughtUpDescription',\n 'Required actions across your channels will surface here.'\n )}\n </p>\n </div>\n </div>\n ) : (\n <ul className=\"space-y-1\">\n {actionMessages.slice(0, 5).map((message) => (\n <li key={message.id}>\n <button\n type=\"button\"\n onClick={() => navigateTo('/inbox')}\n className=\"flex w-full items-center gap-3 rounded-lg border-l-2 border-status-warning-text/60 bg-status-warning-bg-subtle/50 p-3 text-start transition-colors hover:bg-status-warning-bg-subtle\"\n >\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {message.subject ||\n tr('dashboard.needsAttention.noSubject', '(no subject)')}\n </p>\n {message.preview && (\n <p className=\"truncate text-xs text-text-secondary\">\n {message.preview}\n </p>\n )}\n </div>\n <StatusBadge status={message.category} className=\"shrink-0\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </GlassCard>\n </Section>\n </div>\n </div>\n\n {/* Open-invoice call-out (only when there is real outstanding balance) */}\n {stats.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-xl border border-status-warning-text/30 bg-status-warning-bg-subtle px-5 py-4 text-start transition-shadow hover:shadow-md\"\n >\n <div 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: stats.openInvoiceCount,\n amount: formatCurrency(stats.openInvoiceTotal, stats.primaryCurrency),\n }\n )}\n </span>\n </div>\n <ArrowRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-status-warning-text\" />\n </button>\n )}\n\n {/* Quick actions */}\n <Section\n title={tr('dashboard.quickActions.title', 'Quick actions')}\n description={tr('dashboard.quickActions.description', 'Jump straight into your workflow')}\n dataTour=\"subscriberbot-home-quick-actions\"\n >\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {quickActions.map((qa) => (\n <button\n key={qa.path}\n type=\"button\"\n onClick={() => navigateTo(qa.path)}\n className=\"group flex items-center gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 text-start transition-all hover:-translate-y-0.5 hover:border-border-seam hover:shadow-md\"\n >\n <span className=\"flex size-10 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n {qa.icon}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block text-sm font-medium text-text-primary\">\n {tr(qa.labelKey, qa.fallbackLabel)}\n </span>\n <span className=\"block text-xs text-text-secondary\">\n {tr(qa.descriptionKey, qa.fallbackDescription)}\n </span>\n </span>\n <ArrowRight className=\"rtl:rotate-180 h-4 w-4 shrink-0 text-text-secondary transition-transform group-hover:translate-x-0.5\" />\n </button>\n ))}\n </div>\n </Section>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,mBAAgB,oBAAiB,0BAAuB,EAAc,GAExE,EAAE,eAAY,mBAAgB,EAAiB,GAC/C,IAAK,EAAM,GAEX,IAAiB,EAAiB,EAAE,YAAY;EAAE,OAAO;EAAK,QAAQ;CAAE,EAAE,CAAC,GAC3E,IAAY,EAAY,EAAE,YAAY;EAAE,OAAO;EAAI,QAAQ;CAAE,EAAE,CAAC,GAChE,IAAS,EAAiB,EAAE,YAAY;EAAE,OAAO;EAAI,QAAQ;CAAE,EAAE,CAAC,GAClE,IAAY,EAAiB,EAAE,cAAc,GAAK,CAAC,GAInD,IAAU,EAAmB,GAC7B,IAAa,EAAa,EAAE,QAAQ,WAAW,GAAG,EAAE,SAAS,EAAQ,CAAC,GAEtE,IAAgB,QAAc,EAAe,MAAM,SAAS,CAAC,GAAG,CAAC,EAAe,IAAI,CAAC,GACrF,IAAW,QAAc,EAAU,MAA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
|
-
{"version":3,"file":"BankConnectionsPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/banking/BankConnectionsPage.tsx"],"names":[],"mappings":"AAsFA,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"BankConnectionsPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/banking/BankConnectionsPage.tsx"],"names":[],"mappings":"AAsFA,wBAAgB,mBAAmB,gCAqdlC"}
|
|
@@ -114,6 +114,7 @@ function z() {
|
|
|
114
114
|
}
|
|
115
115
|
}, Ce = /* @__PURE__ */ j("div", {
|
|
116
116
|
className: "flex flex-wrap gap-2",
|
|
117
|
+
"data-tour": "subscriberbot-banking-connect",
|
|
117
118
|
children: [/* @__PURE__ */ j("button", {
|
|
118
119
|
type: "button",
|
|
119
120
|
className: P,
|
|
@@ -139,6 +140,7 @@ function z() {
|
|
|
139
140
|
})]
|
|
140
141
|
});
|
|
141
142
|
return /* @__PURE__ */ j(ee, {
|
|
143
|
+
dataTour: "subscriberbot-banking",
|
|
142
144
|
title: M("banking.title", "Bank & card connections"),
|
|
143
145
|
description: M("banking.description", "Find every subscription in your bank and card transactions."),
|
|
144
146
|
actions: Ce,
|
|
@@ -163,6 +165,7 @@ function z() {
|
|
|
163
165
|
}),
|
|
164
166
|
/* @__PURE__ */ j("div", {
|
|
165
167
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
168
|
+
"data-tour": "subscriberbot-banking-metrics",
|
|
166
169
|
children: [
|
|
167
170
|
/* @__PURE__ */ A(i, {
|
|
168
171
|
icon: /* @__PURE__ */ A(D, { className: "h-5 w-5" }),
|
|
@@ -187,6 +190,7 @@ function z() {
|
|
|
187
190
|
]
|
|
188
191
|
}),
|
|
189
192
|
/* @__PURE__ */ j(u, {
|
|
193
|
+
dataTour: "subscriberbot-banking-charges",
|
|
190
194
|
title: M("banking.charges.title", "Recurring charges found"),
|
|
191
195
|
description: M("banking.charges.description", "Charges from the same merchant at a steady amount and rhythm."),
|
|
192
196
|
children: [/* @__PURE__ */ A("div", {
|
|
@@ -279,6 +283,7 @@ function z() {
|
|
|
279
283
|
})]
|
|
280
284
|
}),
|
|
281
285
|
/* @__PURE__ */ A(u, {
|
|
286
|
+
dataTour: "subscriberbot-banking-connections",
|
|
282
287
|
title: M("banking.connections.title", "Your connections"),
|
|
283
288
|
description: M("banking.connections.description", "Disconnecting deletes the accounts and transactions from Subscriber Bot."),
|
|
284
289
|
children: K.isLoading ? /* @__PURE__ */ A(l, { label: M("banking.connections.loading", "Loading connections…") }) : K.isError ? /* @__PURE__ */ A(c, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BankConnectionsPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/banking/BankConnectionsPage.tsx"],"sourcesContent":["import { useFormError } from '../../hooks/useFormError';\nimport { useFormatters } from '../../hooks/useFormatters';\n/**\n * Bank & card connections\n * @module subscriberbot/pages/banking\n *\n * `/subscriberbot/banking` — link a bank or card through Plaid, or import a\n * statement export (CSV) from any bank, and review the recurring charges\n * Subscriber Bot found in the transactions: track each as a subscription or\n * dismiss it (BOFF-4161). Everything here belongs to the signed-in user only.\n */\n\nimport { useMemo, useState, type FormEvent } from 'react';\nimport {\n CalendarClock,\n FileUp,\n Landmark,\n Link2,\n RefreshCw,\n Repeat,\n ShieldCheck,\n Trash2,\n} from 'lucide-react';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n EmptyState,\n ErrorView,\n LoadingView,\n MetricsCard,\n Modal,\n PageLayout,\n Section,\n StatusBadge,\n} from '../../components';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useBankAggregators,\n useBankConnections,\n useCompleteBankLink,\n useCreateBankLinkSession,\n useDismissRecurringCharge,\n useImportBankStatement,\n useRecurringCharges,\n useRemoveBankConnection,\n useRestoreRecurringCharge,\n useSyncBankConnection,\n useTrackRecurringCharge,\n} from '../../hooks/useBankingApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport { openPlaidLink } from '../../utils/plaidLink';\nimport type {\n SubBankConnection,\n SubBankSyncResult,\n SubRecurringCharge,\n SubRecurringChargeStatus,\n SubStatementAmountConvention,\n SubStatementDateFormat,\n} from '../../types/banking';\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 primaryBtn =\n 'inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\nconst secondaryBtn =\n '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 disabled:opacity-50';\nconst smallBtn =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nconst CHARGE_FILTERS: SubRecurringChargeStatus[] = ['DETECTED', 'TRACKED', 'DISMISSED'];\nconst CHARGE_FILTER_LABEL: Record<SubRecurringChargeStatus, { key: string; fallback: string }> = {\n DETECTED: { key: 'banking.charges.detected', fallback: 'To review' },\n TRACKED: { key: 'banking.charges.tracked', fallback: 'Tracked' },\n DISMISSED: { key: 'banking.charges.dismissed', fallback: 'Dismissed' },\n};\nconst MAX_FILE_BYTES = 2_000_000;\n\nconst errorText = (error: unknown, tr: ReturnType<typeof useTr>): string =>\n error instanceof Error ? error.message : tr('common.somethingWentWrong', 'Something went wrong');\n\ninterface Notice {\n tone: 'success' | 'error';\n text: string;\n}\n\nexport function BankConnectionsPage() {\n const { formatCurrency, formatDate, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const [filter, setFilter] = useState<SubRecurringChargeStatus>('DETECTED');\n const [importOpen, setImportOpen] = useState(false);\n const [notice, setNotice] = useState<Notice | null>(null);\n const [linking, setLinking] = useState(false);\n\n const aggregators = useBankAggregators();\n const connections = useBankConnections();\n const charges = useRecurringCharges(filter);\n const detected = useRecurringCharges('DETECTED');\n const tracked = useRecurringCharges('TRACKED');\n\n const createLink = useCreateBankLinkSession();\n const completeLink = useCompleteBankLink();\n const sync = useSyncBankConnection();\n const remove = useRemoveBankConnection();\n const track = useTrackRecurringCharge();\n const dismiss = useDismissRecurringCharge();\n const restore = useRestoreRecurringCharge();\n\n const plaid = aggregators.data?.find((a) => a.aggregator === 'PLAID');\n const connectionItems = connections.data?.items ?? [];\n const chargeItems = charges.data?.items ?? [];\n\n const detectedYearly = useMemo(() => {\n const totals = new Map<string, number>();\n for (const c of detected.data?.items ?? []) {\n totals.set(c.currency, (totals.get(c.currency) ?? 0) + c.annualCost);\n }\n return [...totals.entries()]\n .map(([currency, amount]) => formatCurrency(amount, currency))\n .join(' + ');\n }, [detected.data, formatCurrency]);\n\n const summarise = (result: SubBankSyncResult): string =>\n tr(\n 'banking.notice.synced',\n '{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.',\n {\n added: result.added,\n institution: result.connection.institutionName,\n recurring: result.recurringDetected,\n }\n );\n\n const connectBank = async () => {\n setNotice(null);\n setLinking(true);\n try {\n const session = await createLink.mutateAsync({ aggregator: 'PLAID' });\n const linked = await openPlaidLink(session.linkToken, tr);\n if (!linked) return;\n const result = await completeLink.mutateAsync({\n input: {\n aggregator: 'PLAID',\n publicToken: linked.publicToken,\n institutionId: linked.institutionId,\n institutionName: linked.institutionName,\n },\n });\n setNotice({ tone: 'success', text: summarise(result) });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n } finally {\n setLinking(false);\n }\n };\n\n const runSync = async (connection: SubBankConnection) => {\n setNotice(null);\n try {\n setNotice({\n tone: 'success',\n text: summarise(await sync.mutateAsync({ id: connection.id })),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const disconnect = async (connection: SubBankConnection) => {\n const confirmed = window.confirm(\n tr(\n 'banking.disconnect.confirm',\n 'Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.',\n { institution: connection.institutionName }\n )\n );\n if (!confirmed) return;\n setNotice(null);\n try {\n await remove.mutateAsync({ id: connection.id });\n setNotice({\n tone: 'success',\n text: tr('banking.notice.disconnected', '{{institution}} was disconnected.', {\n institution: connection.institutionName,\n }),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const decide = async (action: 'track' | 'dismiss' | 'restore', charge: SubRecurringCharge) => {\n setNotice(null);\n try {\n const mutation = { track, dismiss, restore }[action];\n const updated = await mutation.mutateAsync({ id: charge.id });\n if (action === 'track') {\n setNotice({\n tone: 'success',\n text: tr('banking.notice.tracked', '{{name}} is now tracked as a subscription.', {\n name: updated.displayName,\n }),\n });\n }\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const actions = (\n <div className=\"flex flex-wrap gap-2\">\n <button type=\"button\" className={secondaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden /> {tr('banking.import.open', 'Import a statement')}\n </button>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void connectBank()}\n disabled={!plaid?.available || linking}\n title={\n plaid?.available\n ? undefined\n : tr(\n 'banking.plaid.unavailable',\n 'Bank linking is not switched on yet. Import a statement instead.'\n )\n }\n >\n <Link2 className=\"h-4 w-4\" aria-hidden />\n {linking\n ? tr('banking.plaid.linking', 'Connecting…')\n : tr('banking.plaid.connect', 'Connect a bank')}\n </button>\n </div>\n );\n\n return (\n <PageLayout\n title={tr('banking.title', 'Bank & card connections')}\n description={tr(\n 'banking.description',\n 'Find every subscription in your bank and card transactions.'\n )}\n actions={actions}\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'banking.purpose',\n 'Connect a US bank or card through Plaid, or import the CSV export any bank lets you download. Subscriber Bot spots the charges that repeat every week, month, quarter or year so you can track them or wave them off. Your bank password is never shared with Subscriber Bot, and only you can see these accounts.'\n )}\n </PagePurpose>\n\n {plaid && !plaid.available && (\n <p\n className=\"mb-4 flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-secondary\"\n data-testid=\"plaid-unavailable\"\n >\n <ShieldCheck className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden />\n {tr(\n 'banking.plaid.unavailableLong',\n 'Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.'\n )}\n </p>\n )}\n\n {notice && (\n <p\n role={notice.tone === 'error' ? 'alert' : 'status'}\n className={cn(\n 'mb-4 rounded-lg px-3 py-2 text-sm',\n notice.tone === 'error'\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-status-success-bg-subtle text-status-success-text'\n )}\n data-testid=\"banking-notice\"\n >\n {notice.text}\n </p>\n )}\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <MetricsCard\n icon={<Landmark className=\"h-5 w-5\" />}\n value={connections.isLoading ? '—' : connectionItems.length}\n label={tr('banking.metrics.connections', 'Connected accounts')}\n />\n <MetricsCard\n icon={<Repeat className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : (detected.data?.items.length ?? 0)}\n label={tr('banking.metrics.detected', 'Charges to review')}\n />\n <MetricsCard\n icon={<CalendarClock className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : detectedYearly || formatCurrency(0, 'USD')}\n label={tr('banking.metrics.yearly', 'Yearly cost to review')}\n />\n <MetricsCard\n icon={<ShieldCheck className=\"h-5 w-5\" />}\n value={tracked.isLoading ? '—' : (tracked.data?.items.length ?? 0)}\n label={tr('banking.metrics.tracked', 'Tracked from your bank')}\n />\n </div>\n\n <Section\n title={tr('banking.charges.title', 'Recurring charges found')}\n description={tr(\n 'banking.charges.description',\n 'Charges from the same merchant at a steady amount and rhythm.'\n )}\n >\n <div\n role=\"tablist\"\n aria-label={tr('banking.charges.filter', 'Charge status')}\n className=\"mb-3 flex gap-1.5\"\n >\n {CHARGE_FILTERS.map((f) => (\n <button\n key={f}\n type=\"button\"\n role=\"tab\"\n aria-selected={filter === f}\n onClick={() => setFilter(f)}\n className={cn(\n 'rounded-lg px-3 py-1.5 text-xs font-medium',\n filter === f\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'border border-border-subtle text-text-primary hover:bg-bg-sunken'\n )}\n >\n {tr(CHARGE_FILTER_LABEL[f].key, CHARGE_FILTER_LABEL[f].fallback)}\n </button>\n ))}\n </div>\n\n {charges.isLoading ? (\n <LoadingView label={tr('banking.charges.loading', 'Loading recurring charges…')} />\n ) : charges.isError ? (\n <ErrorView\n message={errorText(charges.error, tr)}\n onRetry={() => void charges.refetch()}\n />\n ) : chargeItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.charges.empty.title', 'Nothing here yet')}\n description={tr(\n 'banking.charges.empty.description',\n 'Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.'\n )}\n />\n ) : (\n <ul className=\"grid grid-cols-1 gap-3 lg:grid-cols-2\" data-testid=\"recurring-charge-list\">\n {chargeItems.map((charge) => (\n <li\n key={charge.id}\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\"\n data-testid=\"recurring-charge\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {charge.displayName}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {tr(\n 'banking.charges.meta',\n '{{count}} charges since {{first}} · {{confidence}}% sure',\n {\n count: charge.occurrences,\n first: formatDate(charge.firstChargedOn),\n confidence: charge.confidence,\n }\n )}\n </p>\n </div>\n <span className=\"shrink-0 text-sm font-semibold text-text-primary\">\n {formatCurrency(charge.lastAmount, charge.currency)}\n {formatIntervalSuffix(charge.interval)}\n </span>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr('banking.charges.dates', 'Last charged {{last}}', {\n last: formatDate(charge.lastChargedOn),\n })}\n {charge.nextExpectedOn &&\n ` · ${tr('banking.charges.next', 'next expected {{next}}', {\n next: formatDate(charge.nextExpectedOn),\n })}`}\n {` · ${tr('banking.charges.yearly', '{{amount}} a year', {\n amount: formatCurrency(charge.annualCost, charge.currency),\n })}`}\n </p>\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {charge.status === 'DETECTED' && (\n <>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void decide('track', charge)}\n disabled={track.isPending}\n >\n {tr('banking.charges.track', 'Track as subscription')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('dismiss', charge)}\n disabled={dismiss.isPending}\n >\n {tr('banking.charges.dismiss', 'Not a subscription')}\n </button>\n </>\n )}\n {charge.status === 'TRACKED' && charge.relationshipId && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => navigateTo(`/relationships/${charge.relationshipId}`)}\n >\n {tr('banking.charges.view', 'View subscription')}\n </button>\n )}\n {charge.status === 'DISMISSED' && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('restore', charge)}\n disabled={restore.isPending}\n >\n {tr('banking.charges.restore', 'Review again')}\n </button>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n <Section\n title={tr('banking.connections.title', 'Your connections')}\n description={tr(\n 'banking.connections.description',\n 'Disconnecting deletes the accounts and transactions from Subscriber Bot.'\n )}\n >\n {connections.isLoading ? (\n <LoadingView label={tr('banking.connections.loading', 'Loading connections…')} />\n ) : connections.isError ? (\n <ErrorView\n message={errorText(connections.error, tr)}\n onRetry={() => void connections.refetch()}\n />\n ) : connectionItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.connections.empty.title', 'No bank or card connected')}\n description={tr(\n 'banking.connections.empty.description',\n 'Download a CSV of your transactions from your bank or card website and import it, or connect a bank.'\n )}\n action={\n <button type=\"button\" className={primaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden />{' '}\n {tr('banking.import.open', 'Import a statement')}\n </button>\n }\n />\n ) : (\n <ul className=\"space-y-3\" data-testid=\"bank-connection-list\">\n {connectionItems.map((connection) => (\n <li\n key={connection.id}\n className=\"flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\"\n data-testid=\"bank-connection\"\n >\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {connection.institutionName}\n </p>\n <StatusBadge status={connection.status} />\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {connection.aggregator === 'PLAID'\n ? tr('banking.connections.viaPlaid', 'Linked with Plaid')\n : tr('banking.connections.viaImport', 'Statement import')}\n {' · '}\n {connection.accounts\n .map((a) => (a.mask ? `${a.name} ••${a.mask}` : a.name))\n .join(', ') || tr('banking.connections.noAccounts', 'no accounts yet')}\n {' · '}\n {tr('banking.connections.count', '{{count}} transactions', {\n count: connection.transactionCount,\n })}\n {connection.lastSyncedAt &&\n ` · ${tr('banking.connections.synced', 'updated {{date}}', {\n date: formatDate(connection.lastSyncedAt),\n })}`}\n </p>\n {connection.lastSyncError && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {connection.lastSyncError}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 gap-2\">\n {connection.aggregator === 'PLAID' && (\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void runSync(connection)}\n disabled={sync.isPending || !plaid?.available}\n >\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.sync', 'Sync')}\n </button>\n )}\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void disconnect(connection)}\n disabled={remove.isPending}\n >\n <Trash2 className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.disconnect', 'Disconnect')}\n </button>\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n {importOpen && (\n <ImportStatementModal\n connections={connectionItems.filter((c) => c.aggregator === 'STATEMENT_IMPORT')}\n onClose={() => setImportOpen(false)}\n onImported={(result) => {\n setImportOpen(false);\n setFilter('DETECTED');\n setNotice({ tone: 'success', text: summarise(result) });\n }}\n />\n )}\n </PageLayout>\n );\n}\n\ninterface ImportStatementModalProps {\n connections: SubBankConnection[];\n onClose: () => void;\n onImported: (result: SubBankSyncResult) => void;\n}\n\nfunction ImportStatementModal({ connections, onClose, onImported }: ImportStatementModalProps) {\n const tr = useTr();\n const importStatement = useImportBankStatement();\n const [connectionId, setConnectionId] = useState('');\n const [institutionName, setInstitutionName] = useState('');\n const [accountName, setAccountName] = useState('');\n const [accountMask, setAccountMask] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [convention, setConvention] = useState<SubStatementAmountConvention>('OUTFLOW_NEGATIVE');\n const [dateFormat, setDateFormat] = useState<SubStatementDateFormat>('MDY');\n const [csv, setCsv] = useState('');\n const [error, setError, fieldErrorProps, formErrorId] = useFormError();\n\n const onFile = async (file: File | undefined) => {\n setError(null);\n // A new selection always replaces the previous statement, so a rejected\n // replacement can never leave the earlier file's rows ready to import.\n setCsv('');\n if (!file) return;\n if (file.size > MAX_FILE_BYTES) {\n setError(\n tr(\n 'banking.import.tooLarge',\n 'That file is larger than 2 MB. Export a shorter date range.'\n ),\n 'statement-file'\n );\n return;\n }\n setCsv(await file.text());\n };\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n setError(null);\n if (!csv.trim()) {\n setError(tr('banking.import.required', 'Choose a CSV file or paste the statement.'), [\n 'statement-csv',\n 'statement-file',\n ]);\n return;\n }\n try {\n const result = await importStatement.mutateAsync({\n input: {\n connectionId: connectionId || null,\n institutionName: connectionId ? null : institutionName || null,\n accountName: accountName || null,\n accountMask: accountMask || null,\n currency: currency || 'USD',\n csv,\n amountConvention: convention,\n dateFormat,\n },\n });\n onImported(result);\n } catch (err) {\n setError(errorText(err, tr));\n }\n };\n\n return (\n <Modal\n title={tr('banking.import.title', 'Import a bank or card statement')}\n description={tr(\n 'banking.import.description',\n 'Download your transactions as CSV from your bank or card website (two months or more works best).'\n )}\n onClose={onClose}\n maxWidthClassName=\"max-w-xl\"\n >\n <form\n onSubmit={(e) => void submit(e)}\n className=\"space-y-3\"\n data-testid=\"import-statement-form\"\n >\n {connections.length > 0 && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.target', 'Add to')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={connectionId}\n onChange={(e) => setConnectionId(e.target.value)}\n >\n <option value=\"\">{tr('banking.import.newConnection', 'A new connection')}</option>\n {connections.map((c) => (\n <option key={c.id} value={c.id}>\n {c.institutionName}\n </option>\n ))}\n </select>\n </label>\n )}\n {!connectionId && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.institution', 'Bank or card issuer')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={institutionName}\n onChange={(e) => setInstitutionName(e.target.value)}\n placeholder={tr('banking.import.institutionPlaceholder', 'e.g. Chase')}\n maxLength={255}\n />\n </label>\n )}\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary sm:col-span-2\">\n {tr('banking.import.account', 'Account name')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountName}\n onChange={(e) => setAccountName(e.target.value)}\n placeholder={tr('banking.import.accountPlaceholder', 'e.g. Sapphire card')}\n maxLength={255}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.mask', 'Last 4 digits')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountMask}\n onChange={(e) => setAccountMask(e.target.value.replace(/\\D/g, '').slice(-4))}\n inputMode=\"numeric\"\n maxLength={4}\n />\n </label>\n </div>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.currency', 'Currency')}\n <input\n className={cn(inputCls, 'mt-1 uppercase')}\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase().slice(0, 3))}\n maxLength={3}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.convention', 'Money out is')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={convention}\n onChange={(e) => setConvention(e.target.value as SubStatementAmountConvention)}\n >\n <option value=\"OUTFLOW_NEGATIVE\">\n {tr('banking.import.negative', 'Negative (bank)')}\n </option>\n <option value=\"OUTFLOW_POSITIVE\">\n {tr('banking.import.positive', 'Positive (card)')}\n </option>\n </select>\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.dateFormat', 'Date format')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={dateFormat}\n onChange={(e) => setDateFormat(e.target.value as SubStatementDateFormat)}\n >\n <option value=\"MDY\">MM/DD/YYYY</option>\n <option value=\"DMY\">DD/MM/YYYY</option>\n <option value=\"YMD\">YYYY-MM-DD</option>\n </select>\n </label>\n </div>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.file', 'CSV file')}\n <input\n type=\"file\"\n accept=\".csv,text/csv,text/plain\"\n className={cn(inputCls, 'mt-1')}\n onChange={(e) => void onFile(e.target.files?.[0])}\n id=\"statement-file\"\n {...fieldErrorProps('statement-file')}\n data-testid=\"import-statement-file\"\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.paste', 'Or paste the statement')}\n <textarea\n className={cn(inputCls, 'mt-1 h-32 font-mono text-xs')}\n value={csv}\n onChange={(e) => setCsv(e.target.value)}\n placeholder={'Date,Description,Amount\\n10/05/2026,NETFLIX.COM,-15.49'}\n id=\"statement-csv\"\n {...fieldErrorProps('statement-csv')}\n data-testid=\"import-statement-csv\"\n />\n </label>\n {error && (\n <p id={formErrorId} tabIndex={-1} role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <div className=\"flex justify-end gap-2 pt-1\">\n <button type=\"button\" className={secondaryBtn} onClick={onClose}>\n {tr('common.cancel', 'Cancel')}\n </button>\n <button type=\"submit\" className={primaryBtn} disabled={importStatement.isPending}>\n {importStatement.isPending\n ? tr('banking.import.submitting', 'Importing…')\n : tr('banking.import.submit', 'Import and find subscriptions')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6DA,IAAM,IACJ,wMACI,IACJ,8JACI,IACJ,gKACI,IACJ,sKAEI,KAA6C;CAAC;CAAY;CAAW;AAAW,GAChF,IAA2F;CAC/F,UAAU;EAAE,KAAK;EAA4B,UAAU;CAAY;CACnE,SAAS;EAAE,KAAK;EAA2B,UAAU;CAAU;CAC/D,WAAW;EAAE,KAAK;EAA6B,UAAU;CAAY;AACvE,GACM,IAAiB,KAEjB,KAAa,GAAgB,MACjC,aAAiB,QAAQ,EAAM,UAAU,EAAG,6BAA6B,sBAAsB;AAOjG,SAAgB,IAAsB;CACpC,IAAM,EAAE,mBAAgB,eAAY,4BAAyB,EAAc,GAErE,IAAK,EAAM,GACX,EAAE,kBAAe,EAAiB,GAClC,CAAC,GAAQ,KAAa,EAAmC,UAAU,GACnE,CAAC,IAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAQ,KAAa,EAAwB,IAAI,GAClD,CAAC,GAAS,KAAc,EAAS,EAAK,GAEtC,KAAc,EAAmB,GACjC,IAAc,EAAmB,GACjC,IAAU,EAAoB,CAAM,GACpC,IAAW,EAAoB,UAAU,GACzC,KAAU,EAAoB,SAAS,GAEvC,KAAa,EAAyB,GACtC,KAAe,EAAoB,GACnC,KAAO,EAAsB,GAC7B,KAAS,EAAwB,GACjC,KAAQ,EAAwB,GAChC,IAAU,EAA0B,GACpC,KAAU,GAA0B,GAEpC,IAAQ,GAAY,MAAM,MAAM,MAAM,EAAE,eAAe,OAAO,GAC9D,IAAkB,EAAY,MAAM,SAAS,CAAC,GAC9C,KAAc,EAAQ,MAAM,SAA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pages/banking/BankConnectionsPage.tsx"],"sourcesContent":["import { useFormError } from '../../hooks/useFormError';\nimport { useFormatters } from '../../hooks/useFormatters';\n/**\n * Bank & card connections\n * @module subscriberbot/pages/banking\n *\n * `/subscriberbot/banking` — link a bank or card through Plaid, or import a\n * statement export (CSV) from any bank, and review the recurring charges\n * Subscriber Bot found in the transactions: track each as a subscription or\n * dismiss it (BOFF-4161). Everything here belongs to the signed-in user only.\n */\n\nimport { useMemo, useState, type FormEvent } from 'react';\nimport {\n CalendarClock,\n FileUp,\n Landmark,\n Link2,\n RefreshCw,\n Repeat,\n ShieldCheck,\n Trash2,\n} from 'lucide-react';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n EmptyState,\n ErrorView,\n LoadingView,\n MetricsCard,\n Modal,\n PageLayout,\n Section,\n StatusBadge,\n} from '../../components';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useBankAggregators,\n useBankConnections,\n useCompleteBankLink,\n useCreateBankLinkSession,\n useDismissRecurringCharge,\n useImportBankStatement,\n useRecurringCharges,\n useRemoveBankConnection,\n useRestoreRecurringCharge,\n useSyncBankConnection,\n useTrackRecurringCharge,\n} from '../../hooks/useBankingApi';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport { openPlaidLink } from '../../utils/plaidLink';\nimport type {\n SubBankConnection,\n SubBankSyncResult,\n SubRecurringCharge,\n SubRecurringChargeStatus,\n SubStatementAmountConvention,\n SubStatementDateFormat,\n} from '../../types/banking';\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 primaryBtn =\n 'inline-flex items-center gap-2 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\nconst secondaryBtn =\n '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 disabled:opacity-50';\nconst smallBtn =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-2.5 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nconst CHARGE_FILTERS: SubRecurringChargeStatus[] = ['DETECTED', 'TRACKED', 'DISMISSED'];\nconst CHARGE_FILTER_LABEL: Record<SubRecurringChargeStatus, { key: string; fallback: string }> = {\n DETECTED: { key: 'banking.charges.detected', fallback: 'To review' },\n TRACKED: { key: 'banking.charges.tracked', fallback: 'Tracked' },\n DISMISSED: { key: 'banking.charges.dismissed', fallback: 'Dismissed' },\n};\nconst MAX_FILE_BYTES = 2_000_000;\n\nconst errorText = (error: unknown, tr: ReturnType<typeof useTr>): string =>\n error instanceof Error ? error.message : tr('common.somethingWentWrong', 'Something went wrong');\n\ninterface Notice {\n tone: 'success' | 'error';\n text: string;\n}\n\nexport function BankConnectionsPage() {\n const { formatCurrency, formatDate, formatIntervalSuffix } = useFormatters();\n\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const [filter, setFilter] = useState<SubRecurringChargeStatus>('DETECTED');\n const [importOpen, setImportOpen] = useState(false);\n const [notice, setNotice] = useState<Notice | null>(null);\n const [linking, setLinking] = useState(false);\n\n const aggregators = useBankAggregators();\n const connections = useBankConnections();\n const charges = useRecurringCharges(filter);\n const detected = useRecurringCharges('DETECTED');\n const tracked = useRecurringCharges('TRACKED');\n\n const createLink = useCreateBankLinkSession();\n const completeLink = useCompleteBankLink();\n const sync = useSyncBankConnection();\n const remove = useRemoveBankConnection();\n const track = useTrackRecurringCharge();\n const dismiss = useDismissRecurringCharge();\n const restore = useRestoreRecurringCharge();\n\n const plaid = aggregators.data?.find((a) => a.aggregator === 'PLAID');\n const connectionItems = connections.data?.items ?? [];\n const chargeItems = charges.data?.items ?? [];\n\n const detectedYearly = useMemo(() => {\n const totals = new Map<string, number>();\n for (const c of detected.data?.items ?? []) {\n totals.set(c.currency, (totals.get(c.currency) ?? 0) + c.annualCost);\n }\n return [...totals.entries()]\n .map(([currency, amount]) => formatCurrency(amount, currency))\n .join(' + ');\n }, [detected.data, formatCurrency]);\n\n const summarise = (result: SubBankSyncResult): string =>\n tr(\n 'banking.notice.synced',\n '{{added}} new transaction(s) from {{institution}}; {{recurring}} recurring charge(s) found.',\n {\n added: result.added,\n institution: result.connection.institutionName,\n recurring: result.recurringDetected,\n }\n );\n\n const connectBank = async () => {\n setNotice(null);\n setLinking(true);\n try {\n const session = await createLink.mutateAsync({ aggregator: 'PLAID' });\n const linked = await openPlaidLink(session.linkToken, tr);\n if (!linked) return;\n const result = await completeLink.mutateAsync({\n input: {\n aggregator: 'PLAID',\n publicToken: linked.publicToken,\n institutionId: linked.institutionId,\n institutionName: linked.institutionName,\n },\n });\n setNotice({ tone: 'success', text: summarise(result) });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n } finally {\n setLinking(false);\n }\n };\n\n const runSync = async (connection: SubBankConnection) => {\n setNotice(null);\n try {\n setNotice({\n tone: 'success',\n text: summarise(await sync.mutateAsync({ id: connection.id })),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const disconnect = async (connection: SubBankConnection) => {\n const confirmed = window.confirm(\n tr(\n 'banking.disconnect.confirm',\n 'Disconnect {{institution}}? Its accounts and transactions are deleted from Subscriber Bot. Subscriptions you already track stay.',\n { institution: connection.institutionName }\n )\n );\n if (!confirmed) return;\n setNotice(null);\n try {\n await remove.mutateAsync({ id: connection.id });\n setNotice({\n tone: 'success',\n text: tr('banking.notice.disconnected', '{{institution}} was disconnected.', {\n institution: connection.institutionName,\n }),\n });\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const decide = async (action: 'track' | 'dismiss' | 'restore', charge: SubRecurringCharge) => {\n setNotice(null);\n try {\n const mutation = { track, dismiss, restore }[action];\n const updated = await mutation.mutateAsync({ id: charge.id });\n if (action === 'track') {\n setNotice({\n tone: 'success',\n text: tr('banking.notice.tracked', '{{name}} is now tracked as a subscription.', {\n name: updated.displayName,\n }),\n });\n }\n } catch (error) {\n setNotice({ tone: 'error', text: errorText(error, tr) });\n }\n };\n\n const actions = (\n <div className=\"flex flex-wrap gap-2\" data-tour=\"subscriberbot-banking-connect\">\n <button type=\"button\" className={secondaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden /> {tr('banking.import.open', 'Import a statement')}\n </button>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void connectBank()}\n disabled={!plaid?.available || linking}\n title={\n plaid?.available\n ? undefined\n : tr(\n 'banking.plaid.unavailable',\n 'Bank linking is not switched on yet. Import a statement instead.'\n )\n }\n >\n <Link2 className=\"h-4 w-4\" aria-hidden />\n {linking\n ? tr('banking.plaid.linking', 'Connecting…')\n : tr('banking.plaid.connect', 'Connect a bank')}\n </button>\n </div>\n );\n\n return (\n <PageLayout\n dataTour=\"subscriberbot-banking\"\n title={tr('banking.title', 'Bank & card connections')}\n description={tr(\n 'banking.description',\n 'Find every subscription in your bank and card transactions.'\n )}\n actions={actions}\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'banking.purpose',\n 'Connect a US bank or card through Plaid, or import the CSV export any bank lets you download. Subscriber Bot spots the charges that repeat every week, month, quarter or year so you can track them or wave them off. Your bank password is never shared with Subscriber Bot, and only you can see these accounts.'\n )}\n </PagePurpose>\n\n {plaid && !plaid.available && (\n <p\n className=\"mb-4 flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken px-3 py-2 text-sm text-text-secondary\"\n data-testid=\"plaid-unavailable\"\n >\n <ShieldCheck className=\"mt-0.5 h-4 w-4 shrink-0\" aria-hidden />\n {tr(\n 'banking.plaid.unavailableLong',\n 'Direct bank linking is being switched on. Until then, import a statement export: it finds the same recurring charges.'\n )}\n </p>\n )}\n\n {notice && (\n <p\n role={notice.tone === 'error' ? 'alert' : 'status'}\n className={cn(\n 'mb-4 rounded-lg px-3 py-2 text-sm',\n notice.tone === 'error'\n ? 'bg-status-error-bg-subtle text-status-error-text'\n : 'bg-status-success-bg-subtle text-status-success-text'\n )}\n data-testid=\"banking-notice\"\n >\n {notice.text}\n </p>\n )}\n\n <div\n className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\"\n data-tour=\"subscriberbot-banking-metrics\"\n >\n <MetricsCard\n icon={<Landmark className=\"h-5 w-5\" />}\n value={connections.isLoading ? '—' : connectionItems.length}\n label={tr('banking.metrics.connections', 'Connected accounts')}\n />\n <MetricsCard\n icon={<Repeat className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : (detected.data?.items.length ?? 0)}\n label={tr('banking.metrics.detected', 'Charges to review')}\n />\n <MetricsCard\n icon={<CalendarClock className=\"h-5 w-5\" />}\n value={detected.isLoading ? '—' : detectedYearly || formatCurrency(0, 'USD')}\n label={tr('banking.metrics.yearly', 'Yearly cost to review')}\n />\n <MetricsCard\n icon={<ShieldCheck className=\"h-5 w-5\" />}\n value={tracked.isLoading ? '—' : (tracked.data?.items.length ?? 0)}\n label={tr('banking.metrics.tracked', 'Tracked from your bank')}\n />\n </div>\n\n <Section\n dataTour=\"subscriberbot-banking-charges\"\n title={tr('banking.charges.title', 'Recurring charges found')}\n description={tr(\n 'banking.charges.description',\n 'Charges from the same merchant at a steady amount and rhythm.'\n )}\n >\n <div\n role=\"tablist\"\n aria-label={tr('banking.charges.filter', 'Charge status')}\n className=\"mb-3 flex gap-1.5\"\n >\n {CHARGE_FILTERS.map((f) => (\n <button\n key={f}\n type=\"button\"\n role=\"tab\"\n aria-selected={filter === f}\n onClick={() => setFilter(f)}\n className={cn(\n 'rounded-lg px-3 py-1.5 text-xs font-medium',\n filter === f\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'border border-border-subtle text-text-primary hover:bg-bg-sunken'\n )}\n >\n {tr(CHARGE_FILTER_LABEL[f].key, CHARGE_FILTER_LABEL[f].fallback)}\n </button>\n ))}\n </div>\n\n {charges.isLoading ? (\n <LoadingView label={tr('banking.charges.loading', 'Loading recurring charges…')} />\n ) : charges.isError ? (\n <ErrorView\n message={errorText(charges.error, tr)}\n onRetry={() => void charges.refetch()}\n />\n ) : chargeItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.charges.empty.title', 'Nothing here yet')}\n description={tr(\n 'banking.charges.empty.description',\n 'Import a statement with at least two months of transactions, or connect a bank, and repeating charges show up here.'\n )}\n />\n ) : (\n <ul className=\"grid grid-cols-1 gap-3 lg:grid-cols-2\" data-testid=\"recurring-charge-list\">\n {chargeItems.map((charge) => (\n <li\n key={charge.id}\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\"\n data-testid=\"recurring-charge\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {charge.displayName}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {tr(\n 'banking.charges.meta',\n '{{count}} charges since {{first}} · {{confidence}}% sure',\n {\n count: charge.occurrences,\n first: formatDate(charge.firstChargedOn),\n confidence: charge.confidence,\n }\n )}\n </p>\n </div>\n <span className=\"shrink-0 text-sm font-semibold text-text-primary\">\n {formatCurrency(charge.lastAmount, charge.currency)}\n {formatIntervalSuffix(charge.interval)}\n </span>\n </div>\n <p className=\"mt-2 text-xs text-text-secondary\">\n {tr('banking.charges.dates', 'Last charged {{last}}', {\n last: formatDate(charge.lastChargedOn),\n })}\n {charge.nextExpectedOn &&\n ` · ${tr('banking.charges.next', 'next expected {{next}}', {\n next: formatDate(charge.nextExpectedOn),\n })}`}\n {` · ${tr('banking.charges.yearly', '{{amount}} a year', {\n amount: formatCurrency(charge.annualCost, charge.currency),\n })}`}\n </p>\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {charge.status === 'DETECTED' && (\n <>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={() => void decide('track', charge)}\n disabled={track.isPending}\n >\n {tr('banking.charges.track', 'Track as subscription')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('dismiss', charge)}\n disabled={dismiss.isPending}\n >\n {tr('banking.charges.dismiss', 'Not a subscription')}\n </button>\n </>\n )}\n {charge.status === 'TRACKED' && charge.relationshipId && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => navigateTo(`/relationships/${charge.relationshipId}`)}\n >\n {tr('banking.charges.view', 'View subscription')}\n </button>\n )}\n {charge.status === 'DISMISSED' && (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => void decide('restore', charge)}\n disabled={restore.isPending}\n >\n {tr('banking.charges.restore', 'Review again')}\n </button>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n <Section\n dataTour=\"subscriberbot-banking-connections\"\n title={tr('banking.connections.title', 'Your connections')}\n description={tr(\n 'banking.connections.description',\n 'Disconnecting deletes the accounts and transactions from Subscriber Bot.'\n )}\n >\n {connections.isLoading ? (\n <LoadingView label={tr('banking.connections.loading', 'Loading connections…')} />\n ) : connections.isError ? (\n <ErrorView\n message={errorText(connections.error, tr)}\n onRetry={() => void connections.refetch()}\n />\n ) : connectionItems.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title={tr('banking.connections.empty.title', 'No bank or card connected')}\n description={tr(\n 'banking.connections.empty.description',\n 'Download a CSV of your transactions from your bank or card website and import it, or connect a bank.'\n )}\n action={\n <button type=\"button\" className={primaryBtn} onClick={() => setImportOpen(true)}>\n <FileUp className=\"h-4 w-4\" aria-hidden />{' '}\n {tr('banking.import.open', 'Import a statement')}\n </button>\n }\n />\n ) : (\n <ul className=\"space-y-3\" data-testid=\"bank-connection-list\">\n {connectionItems.map((connection) => (\n <li\n key={connection.id}\n className=\"flex flex-col gap-3 rounded-xl border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\"\n data-testid=\"bank-connection\"\n >\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-semibold text-text-primary\">\n {connection.institutionName}\n </p>\n <StatusBadge status={connection.status} />\n </div>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {connection.aggregator === 'PLAID'\n ? tr('banking.connections.viaPlaid', 'Linked with Plaid')\n : tr('banking.connections.viaImport', 'Statement import')}\n {' · '}\n {connection.accounts\n .map((a) => (a.mask ? `${a.name} ••${a.mask}` : a.name))\n .join(', ') || tr('banking.connections.noAccounts', 'no accounts yet')}\n {' · '}\n {tr('banking.connections.count', '{{count}} transactions', {\n count: connection.transactionCount,\n })}\n {connection.lastSyncedAt &&\n ` · ${tr('banking.connections.synced', 'updated {{date}}', {\n date: formatDate(connection.lastSyncedAt),\n })}`}\n </p>\n {connection.lastSyncError && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {connection.lastSyncError}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 gap-2\">\n {connection.aggregator === 'PLAID' && (\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void runSync(connection)}\n disabled={sync.isPending || !plaid?.available}\n >\n <RefreshCw className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.sync', 'Sync')}\n </button>\n )}\n <button\n type=\"button\"\n className={smallBtn}\n onClick={() => void disconnect(connection)}\n disabled={remove.isPending}\n >\n <Trash2 className=\"h-3.5 w-3.5\" aria-hidden />{' '}\n {tr('banking.connections.disconnect', 'Disconnect')}\n </button>\n </div>\n </li>\n ))}\n </ul>\n )}\n </Section>\n\n {importOpen && (\n <ImportStatementModal\n connections={connectionItems.filter((c) => c.aggregator === 'STATEMENT_IMPORT')}\n onClose={() => setImportOpen(false)}\n onImported={(result) => {\n setImportOpen(false);\n setFilter('DETECTED');\n setNotice({ tone: 'success', text: summarise(result) });\n }}\n />\n )}\n </PageLayout>\n );\n}\n\ninterface ImportStatementModalProps {\n connections: SubBankConnection[];\n onClose: () => void;\n onImported: (result: SubBankSyncResult) => void;\n}\n\nfunction ImportStatementModal({ connections, onClose, onImported }: ImportStatementModalProps) {\n const tr = useTr();\n const importStatement = useImportBankStatement();\n const [connectionId, setConnectionId] = useState('');\n const [institutionName, setInstitutionName] = useState('');\n const [accountName, setAccountName] = useState('');\n const [accountMask, setAccountMask] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [convention, setConvention] = useState<SubStatementAmountConvention>('OUTFLOW_NEGATIVE');\n const [dateFormat, setDateFormat] = useState<SubStatementDateFormat>('MDY');\n const [csv, setCsv] = useState('');\n const [error, setError, fieldErrorProps, formErrorId] = useFormError();\n\n const onFile = async (file: File | undefined) => {\n setError(null);\n // A new selection always replaces the previous statement, so a rejected\n // replacement can never leave the earlier file's rows ready to import.\n setCsv('');\n if (!file) return;\n if (file.size > MAX_FILE_BYTES) {\n setError(\n tr(\n 'banking.import.tooLarge',\n 'That file is larger than 2 MB. Export a shorter date range.'\n ),\n 'statement-file'\n );\n return;\n }\n setCsv(await file.text());\n };\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n setError(null);\n if (!csv.trim()) {\n setError(tr('banking.import.required', 'Choose a CSV file or paste the statement.'), [\n 'statement-csv',\n 'statement-file',\n ]);\n return;\n }\n try {\n const result = await importStatement.mutateAsync({\n input: {\n connectionId: connectionId || null,\n institutionName: connectionId ? null : institutionName || null,\n accountName: accountName || null,\n accountMask: accountMask || null,\n currency: currency || 'USD',\n csv,\n amountConvention: convention,\n dateFormat,\n },\n });\n onImported(result);\n } catch (err) {\n setError(errorText(err, tr));\n }\n };\n\n return (\n <Modal\n title={tr('banking.import.title', 'Import a bank or card statement')}\n description={tr(\n 'banking.import.description',\n 'Download your transactions as CSV from your bank or card website (two months or more works best).'\n )}\n onClose={onClose}\n maxWidthClassName=\"max-w-xl\"\n >\n <form\n onSubmit={(e) => void submit(e)}\n className=\"space-y-3\"\n data-testid=\"import-statement-form\"\n >\n {connections.length > 0 && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.target', 'Add to')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={connectionId}\n onChange={(e) => setConnectionId(e.target.value)}\n >\n <option value=\"\">{tr('banking.import.newConnection', 'A new connection')}</option>\n {connections.map((c) => (\n <option key={c.id} value={c.id}>\n {c.institutionName}\n </option>\n ))}\n </select>\n </label>\n )}\n {!connectionId && (\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.institution', 'Bank or card issuer')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={institutionName}\n onChange={(e) => setInstitutionName(e.target.value)}\n placeholder={tr('banking.import.institutionPlaceholder', 'e.g. Chase')}\n maxLength={255}\n />\n </label>\n )}\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary sm:col-span-2\">\n {tr('banking.import.account', 'Account name')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountName}\n onChange={(e) => setAccountName(e.target.value)}\n placeholder={tr('banking.import.accountPlaceholder', 'e.g. Sapphire card')}\n maxLength={255}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.mask', 'Last 4 digits')}\n <input\n className={cn(inputCls, 'mt-1')}\n value={accountMask}\n onChange={(e) => setAccountMask(e.target.value.replace(/\\D/g, '').slice(-4))}\n inputMode=\"numeric\"\n maxLength={4}\n />\n </label>\n </div>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.currency', 'Currency')}\n <input\n className={cn(inputCls, 'mt-1 uppercase')}\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase().slice(0, 3))}\n maxLength={3}\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.convention', 'Money out is')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={convention}\n onChange={(e) => setConvention(e.target.value as SubStatementAmountConvention)}\n >\n <option value=\"OUTFLOW_NEGATIVE\">\n {tr('banking.import.negative', 'Negative (bank)')}\n </option>\n <option value=\"OUTFLOW_POSITIVE\">\n {tr('banking.import.positive', 'Positive (card)')}\n </option>\n </select>\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.dateFormat', 'Date format')}\n <select\n className={cn(inputCls, 'mt-1')}\n value={dateFormat}\n onChange={(e) => setDateFormat(e.target.value as SubStatementDateFormat)}\n >\n <option value=\"MDY\">MM/DD/YYYY</option>\n <option value=\"DMY\">DD/MM/YYYY</option>\n <option value=\"YMD\">YYYY-MM-DD</option>\n </select>\n </label>\n </div>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.file', 'CSV file')}\n <input\n type=\"file\"\n accept=\".csv,text/csv,text/plain\"\n className={cn(inputCls, 'mt-1')}\n onChange={(e) => void onFile(e.target.files?.[0])}\n id=\"statement-file\"\n {...fieldErrorProps('statement-file')}\n data-testid=\"import-statement-file\"\n />\n </label>\n <label className=\"block text-sm text-text-primary\">\n {tr('banking.import.paste', 'Or paste the statement')}\n <textarea\n className={cn(inputCls, 'mt-1 h-32 font-mono text-xs')}\n value={csv}\n onChange={(e) => setCsv(e.target.value)}\n placeholder={'Date,Description,Amount\\n10/05/2026,NETFLIX.COM,-15.49'}\n id=\"statement-csv\"\n {...fieldErrorProps('statement-csv')}\n data-testid=\"import-statement-csv\"\n />\n </label>\n {error && (\n <p id={formErrorId} tabIndex={-1} role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <div className=\"flex justify-end gap-2 pt-1\">\n <button type=\"button\" className={secondaryBtn} onClick={onClose}>\n {tr('common.cancel', 'Cancel')}\n </button>\n <button type=\"submit\" className={primaryBtn} disabled={importStatement.isPending}>\n {importStatement.isPending\n ? tr('banking.import.submitting', 'Importing…')\n : tr('banking.import.submit', 'Import and find subscriptions')}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6DA,IAAM,IACJ,wMACI,IACJ,8JACI,IACJ,gKACI,IACJ,sKAEI,KAA6C;CAAC;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kBAAC,SAAD;KAAO,WAAU;eAAjB,CACG,EAAG,uBAAuB,UAAU,GACrC,kBAAC,SAAD;MACE,MAAK;MACL,QAAO;MACP,WAAW,EAAG,GAAU,MAAM;MAC9B,WAAW,MAAM,KAAK,GAAO,EAAE,OAAO,QAAQ,EAAE;MAChD,IAAG;MACH,GAAI,EAAgB,gBAAgB;MACpC,eAAY;KACb,CAAA,CACI;;IACP,kBAAC,SAAD;KAAO,WAAU;eAAjB,CACG,EAAG,wBAAwB,wBAAwB,GACpD,kBAAC,YAAD;MACE,WAAW,EAAG,GAAU,6BAA6B;MACrD,OAAO;MACP,WAAW,MAAM,EAAO,EAAE,OAAO,KAAK;MACtC,aAAa;MACb,IAAG;MACH,GAAI,EAAgB,eAAe;MACnC,eAAY;KACb,CAAA,CACI;;IACN,KACC,kBAAC,KAAD;KAAG,IAAI;KAAa,UAAU;KAAI,MAAK;KAAQ,WAAU;eACtD;IACA,CAAA;IAEL,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MAAQ,MAAK;MAAS,WAAW;MAAc,SAAS;gBACrD,EAAG,iBAAiB,QAAQ;KACvB,CAAA,GACR,kBAAC,UAAD;MAAQ,MAAK;MAAS,WAAW;MAAY,UAAU,EAAgB;gBACpE,EAAgB,YACb,EAAG,6BAA6B,YAAY,IAC5C,EAAG,yBAAyB,+BAA+B;KACzD,CAAA,CACL;;GACD;;CACD,CAAA;AAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipNewPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/relationships/RelationshipNewPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RelationshipNewPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/relationships/RelationshipNewPage.tsx"],"names":[],"mappings":"AA8FA,wBAAgB,mBAAmB,gCAiYlC"}
|
|
@@ -38,10 +38,11 @@ var v = [
|
|
|
38
38
|
ENROLLMENT: "relationships.kinds.enrollment",
|
|
39
39
|
TRIAL: "relationships.kinds.trial"
|
|
40
40
|
}, x = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", S = "mb-1.5 block text-xs font-medium text-text-secondary";
|
|
41
|
-
function C({ icon: e, title: t, description: n, children: r }) {
|
|
41
|
+
function C({ icon: e, title: t, description: n, children: r, dataTour: i }) {
|
|
42
42
|
return /* @__PURE__ */ h(g, {
|
|
43
43
|
treatment: "metric",
|
|
44
44
|
className: "p-5 sm:p-6",
|
|
45
|
+
"data-tour": i,
|
|
45
46
|
children: [/* @__PURE__ */ h("div", {
|
|
46
47
|
className: "flex items-start gap-3",
|
|
47
48
|
children: [/* @__PURE__ */ m("span", {
|
|
@@ -69,12 +70,14 @@ function w() {
|
|
|
69
70
|
offset: 0
|
|
70
71
|
} }), [O, k] = c(""), [A, j] = c("SUBSCRIPTION"), [M, N] = c(""), [P, F] = c(""), [I, L] = c(""), [R, z] = c("USD"), [B, V] = c("MONTHLY"), [H, U] = c(""), [W, G] = c(!0), [K, q] = c(""), [J, Y] = c(""), [X, Z, Q, te] = ee(), ne = o(M || void 0), re = D.data?.items ?? [], $ = ne.data ?? [];
|
|
71
72
|
return D.isError ? /* @__PURE__ */ m(r, {
|
|
73
|
+
dataTour: "subscriberbot-relationship-new",
|
|
72
74
|
title: w("relationships.new.title", "Add relationship"),
|
|
73
75
|
children: /* @__PURE__ */ m(i, {
|
|
74
76
|
message: w("relationships.new.providerError", "Could not load the provider registry."),
|
|
75
77
|
onRetry: () => void D.refetch()
|
|
76
78
|
})
|
|
77
79
|
}) : /* @__PURE__ */ h(r, {
|
|
80
|
+
dataTour: "subscriberbot-relationship-new",
|
|
78
81
|
title: w("relationships.new.title", "Add relationship"),
|
|
79
82
|
description: w("relationships.new.description", "Track a new recurring digital relationship"),
|
|
80
83
|
actions: /* @__PURE__ */ h("button", {
|
|
@@ -125,6 +128,7 @@ function w() {
|
|
|
125
128
|
}),
|
|
126
129
|
/* @__PURE__ */ m(C, {
|
|
127
130
|
icon: /* @__PURE__ */ m(f, { className: "h-4 w-4" }),
|
|
131
|
+
dataTour: "subscriberbot-relationship-new-basics",
|
|
128
132
|
title: w("relationships.new.basics.title", "Basics"),
|
|
129
133
|
description: w("relationships.new.basics.description", "Name this relationship and choose what kind it is."),
|
|
130
134
|
children: /* @__PURE__ */ h("div", {
|
|
@@ -191,6 +195,7 @@ function w() {
|
|
|
191
195
|
}),
|
|
192
196
|
/* @__PURE__ */ m(C, {
|
|
193
197
|
icon: /* @__PURE__ */ m(u, { className: "h-4 w-4" }),
|
|
198
|
+
dataTour: "subscriberbot-relationship-new-provider-plan",
|
|
194
199
|
title: w("relationships.new.providerPlan.title", "Provider & plan"),
|
|
195
200
|
description: w("relationships.new.providerPlan.description", "Link this relationship to a provider and plan from the registry (optional)."),
|
|
196
201
|
children: /* @__PURE__ */ h("div", {
|
|
@@ -237,6 +242,7 @@ function w() {
|
|
|
237
242
|
}),
|
|
238
243
|
/* @__PURE__ */ m(C, {
|
|
239
244
|
icon: /* @__PURE__ */ m(p, { className: "h-4 w-4" }),
|
|
245
|
+
dataTour: "subscriberbot-relationship-new-pricing",
|
|
240
246
|
title: w("relationships.new.pricing.title", "Pricing & billing"),
|
|
241
247
|
description: w("relationships.new.pricing.description", "Set the price, cadence and next renewal so Subscriber Bot can track it."),
|
|
242
248
|
children: /* @__PURE__ */ h("div", {
|
|
@@ -334,6 +340,7 @@ function w() {
|
|
|
334
340
|
}),
|
|
335
341
|
/* @__PURE__ */ h("div", {
|
|
336
342
|
className: "flex flex-col gap-3 sm:flex-row",
|
|
343
|
+
"data-tour": "subscriberbot-relationship-new-actions",
|
|
337
344
|
children: [/* @__PURE__ */ m("button", {
|
|
338
345
|
type: "submit",
|
|
339
346
|
disabled: E.isPending,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipNewPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/relationships/RelationshipNewPage.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport { useFormError } from '../../hooks/useFormError';\n/**\n * Create relationship\n * @module subscriberbot/pages/relationships\n *\n * Manual-add form for a recurring relationship AI can't auto-detect.\n * Writes `subCreateRelationship`. Provider + plan are optional pickers\n * sourced from the real registry (`subListProviders` / `subListPlans`).\n */\n\nimport { useState, type ReactNode } from 'react';\nimport { ArrowLeft, Tag, Building2, Wallet, StickyNote } from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { ErrorView } from '../../components/StateViews';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useCreateRelationship, useProviders, usePlans } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubBillingInterval,\n SubCreateRelationshipInput,\n SubRelationshipKind,\n} from '../../types';\n\nconst KINDS: SubRelationshipKind[] = [\n 'SUBSCRIPTION',\n 'MEMBERSHIP',\n 'LICENSE',\n 'CONTRACT',\n 'NEWSLETTER',\n 'RECURRING_PAYMENT',\n 'ENROLLMENT',\n 'TRIAL',\n];\n\nconst INTERVALS: SubBillingInterval[] = [\n 'MONTHLY',\n 'YEARLY',\n 'QUARTERLY',\n 'WEEKLY',\n 'DAILY',\n 'USAGE_BASED',\n 'LIFETIME',\n 'FREE',\n];\n\nconst KIND_KEY: Record<SubRelationshipKind, string> = {\n SUBSCRIPTION: 'relationships.kinds.subscription',\n MEMBERSHIP: 'relationships.kinds.membership',\n LICENSE: 'relationships.kinds.license',\n CONTRACT: 'relationships.kinds.contract',\n NEWSLETTER: 'relationships.kinds.newsletter',\n RECURRING_PAYMENT: 'relationships.kinds.recurringPayment',\n ENROLLMENT: 'relationships.kinds.enrollment',\n TRIAL: 'relationships.kinds.trial',\n};\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 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.5 block text-xs font-medium text-text-secondary';\n\n/** Grouped form section on a glass surface. */\nfunction FormSection({\n icon,\n title,\n description,\n children,\n}: {\n icon: ReactNode;\n title: string;\n description: string;\n children: ReactNode;\n}) {\n return (\n <GlassCard treatment=\"metric\" className=\"p-5 sm:p-6\">\n <div className=\"flex items-start gap-3\">\n <span className=\"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary\">\n {icon}\n </span>\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-text-primary\">{title}</h2>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{description}</p>\n </div>\n </div>\n <div className=\"mt-4\">{children}</div>\n </GlassCard>\n );\n}\n\nexport function RelationshipNewPage() {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const create = useCreateRelationship();\n const providersQ = useProviders({ pagination: { limit: 100, offset: 0 } });\n\n const [label, setLabel] = useState('');\n const [kind, setKind] = useState<SubRelationshipKind>('SUBSCRIPTION');\n const [providerId, setProviderId] = useState('');\n const [planId, setPlanId] = useState('');\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [interval, setInterval] = useState<SubBillingInterval>('MONTHLY');\n const [renewsAt, setRenewsAt] = useState('');\n const [autoRenew, setAutoRenew] = useState(true);\n const [notes, setNotes] = useState('');\n const [department, setDepartment] = useState('');\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const plansQ = usePlans(providerId || undefined);\n const providers = providersQ.data?.items ?? [];\n const plans = plansQ.data ?? [];\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!label.trim()) {\n setFormError(\n tr('relationships.new.basics.labelRequired', 'A label is required.'),\n 'rel-label'\n );\n return;\n }\n const input: SubCreateRelationshipInput = {\n label: label.trim(),\n kind,\n interval,\n autoRenew,\n currency: currency.trim() || 'USD',\n ...(providerId ? { providerId } : {}),\n ...(planId ? { planId } : {}),\n ...(amount ? { amount: Number(amount) } : {}),\n ...(renewsAt ? { renewsAt: new Date(renewsAt).toISOString() } : {}),\n ...(notes.trim() ? { notes: notes.trim() } : {}),\n ...(department.trim() ? { department: department.trim() } : {}),\n };\n create.mutate(input, {\n onSuccess: (rel) => navigateTo(`/relationships/${rel.id}`),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('relationships.new.error', 'Could not create relationship.')\n ),\n });\n };\n\n if (providersQ.isError) {\n return (\n <PageLayout title={tr('relationships.new.title', 'Add relationship')}>\n <ErrorView\n message={tr('relationships.new.providerError', 'Could not load the provider registry.')}\n onRetry={() => void providersQ.refetch()}\n />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={tr('relationships.new.title', 'Add relationship')}\n description={tr(\n 'relationships.new.description',\n 'Track a new recurring digital relationship'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\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('relationships.new.back', 'Back')}\n </button>\n }\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'relationships.new.purpose',\n 'Manually add a subscription, membership, license or contract. Link it to a provider and plan from the registry, set the price and renewal date, and Subscriber Bot will track its lifecycle from here.'\n )}\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"max-w-3xl space-y-5\">\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\n {/* Basics */}\n <FormSection\n icon={<Tag className=\"h-4 w-4\" />}\n title={tr('relationships.new.basics.title', 'Basics')}\n description={tr(\n 'relationships.new.basics.description',\n 'Name this relationship and choose what kind it is.'\n )}\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"rel-label\" className={labelCls}>\n {tr('relationships.new.basics.labelLabel', 'Label')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('rel-label')}\n id=\"rel-label\"\n type=\"text\"\n value={label}\n onChange={(e) => setLabel(e.target.value)}\n placeholder={tr(\n 'relationships.new.basics.labelPlaceholder',\n 'e.g. Netflix Premium, AWS Production'\n )}\n className={inputCls}\n required\n />\n </div>\n <div className=\"max-w-xs\">\n <label htmlFor=\"rel-kind\" className={labelCls}>\n {tr('relationships.new.basics.kindLabel', 'Kind')}\n </label>\n <select\n {...fieldErrorProps('rel-kind')}\n id=\"rel-kind\"\n value={kind}\n onChange={(e) => setKind(e.target.value as SubRelationshipKind)}\n className={inputCls}\n >\n {KINDS.map((k) => (\n <option key={k} value={k}>\n {tr(KIND_KEY[k], formatEnumLabel(k))}\n </option>\n ))}\n </select>\n </div>\n <div className=\"max-w-xs\">\n <label htmlFor=\"rel-department\" className={labelCls}>\n {tr('relationships.new.basics.departmentLabel', 'Department or team')}\n </label>\n <input\n {...fieldErrorProps('rel-department')}\n id=\"rel-department\"\n type=\"text\"\n maxLength={120}\n value={department}\n onChange={(e) => setDepartment(e.target.value)}\n placeholder={tr(\n 'relationships.new.basics.departmentPlaceholder',\n 'e.g. Engineering, Marketing'\n )}\n className={inputCls}\n />\n </div>\n </div>\n </FormSection>\n\n {/* Provider & plan */}\n <FormSection\n icon={<Building2 className=\"h-4 w-4\" />}\n title={tr('relationships.new.providerPlan.title', 'Provider & plan')}\n description={tr(\n 'relationships.new.providerPlan.description',\n 'Link this relationship to a provider and plan from the registry (optional).'\n )}\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"rel-provider\" className={labelCls}>\n {tr('relationships.new.providerPlan.providerLabel', 'Provider')}\n </label>\n <select\n {...fieldErrorProps('rel-provider')}\n id=\"rel-provider\"\n value={providerId}\n onChange={(e) => {\n setProviderId(e.target.value);\n setPlanId('');\n }}\n className={inputCls}\n >\n <option value=\"\">\n {tr('relationships.new.providerPlan.providerNone', '— None —')}\n </option>\n {providers.map((p) => (\n <option key={p.id} value={p.id}>\n {p.name}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"rel-plan\" className={labelCls}>\n {tr('relationships.new.providerPlan.planLabel', 'Plan')}\n </label>\n <select\n {...fieldErrorProps('rel-plan')}\n id=\"rel-plan\"\n value={planId}\n onChange={(e) => setPlanId(e.target.value)}\n className={inputCls}\n disabled={!providerId || plans.length === 0}\n >\n <option value=\"\">\n {providerId\n ? plans.length === 0\n ? tr('relationships.new.providerPlan.noPlans', 'No plans available')\n : tr('relationships.new.providerPlan.planNone', '— None —')\n : tr(\n 'relationships.new.providerPlan.selectProviderFirst',\n 'Select a provider first'\n )}\n </option>\n {plans.map((pl) => (\n <option key={pl.id} value={pl.id}>\n {pl.name}\n </option>\n ))}\n </select>\n </div>\n </div>\n </FormSection>\n\n {/* Pricing & billing */}\n <FormSection\n icon={<Wallet className=\"h-4 w-4\" />}\n title={tr('relationships.new.pricing.title', 'Pricing & billing')}\n description={tr(\n 'relationships.new.pricing.description',\n 'Set the price, cadence and next renewal so Subscriber Bot can track it.'\n )}\n >\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"rel-amount\" className={labelCls}>\n {tr('relationships.new.pricing.amountLabel', 'Amount')}\n </label>\n <input\n {...fieldErrorProps('rel-amount')}\n id=\"rel-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n placeholder={tr('relationships.new.pricing.amountPlaceholder', '0.00')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"rel-currency\" className={labelCls}>\n {tr('relationships.new.pricing.currencyLabel', 'Currency')}\n </label>\n <input\n {...fieldErrorProps('rel-currency')}\n id=\"rel-currency\"\n type=\"text\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n placeholder={tr('relationships.new.pricing.currencyPlaceholder', 'USD')}\n maxLength={3}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"rel-interval\" className={labelCls}>\n {tr('relationships.new.pricing.intervalLabel', 'Billing interval')}\n </label>\n <select\n {...fieldErrorProps('rel-interval')}\n id=\"rel-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 className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"rel-renews\" className={labelCls}>\n {tr('relationships.new.pricing.renewsOnLabel', 'Renews on')}\n </label>\n <input\n {...fieldErrorProps('rel-renews')}\n id=\"rel-renews\"\n type=\"date\"\n value={renewsAt}\n onChange={(e) => setRenewsAt(e.target.value)}\n className={inputCls}\n />\n </div>\n <label className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 sm:mt-6\">\n <input\n type=\"checkbox\"\n checked={autoRenew}\n onChange={(e) => setAutoRenew(e.target.checked)}\n className=\"size-4 rounded border-border-subtle\"\n />\n <span className=\"text-sm text-text-primary\">\n {tr('relationships.new.pricing.autoRenews', 'Auto-renews')}\n </span>\n </label>\n </div>\n </div>\n </FormSection>\n\n {/* Notes */}\n <FormSection\n icon={<StickyNote className=\"h-4 w-4\" />}\n title={tr('relationships.new.notes.title', 'Notes')}\n description={tr(\n 'relationships.new.notes.description',\n 'Anything worth remembering about this relationship.'\n )}\n >\n <textarea\n {...fieldErrorProps('rel-notes')}\n id=\"rel-notes\"\n aria-label={tr('relationships.new.notes.title', 'Notes')}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n rows={3}\n placeholder={tr(\n 'relationships.new.notes.placeholder',\n 'Anything worth remembering about this relationship…'\n )}\n className={inputCls}\n />\n </FormSection>\n\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n <button\n type=\"submit\"\n disabled={create.isPending}\n className=\"rounded-lg bg-action-primary-bg px-5 py-2.5 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {create.isPending\n ? tr('relationships.new.creating', 'Creating…')\n : tr('relationships.new.submit', 'Create relationship')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\n className=\"rounded-lg border border-border-subtle px-5 py-2.5 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('relationships.new.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAM,IAA+B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAkC;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAgD;CACpD,cAAc;CACd,YAAY;CACZ,SAAS;CACT,UAAU;CACV,YAAY;CACZ,mBAAmB;CACnB,YAAY;CACZ,OAAO;AACT,GAEM,IACJ,0MACI,IAAW;AAGjB,SAAS,EAAY,EACnB,SACA,UACA,gBACA,eAMC;CACD,OACE,kBAAC,GAAD;EAAW,WAAU;EAAS,WAAU;YAAxC,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,QAAD;IAAM,WAAU;cACb;GACG,CAAA,GACN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAA2C;IAAU,CAAA,GACnE,kBAAC,KAAD;KAAG,WAAU;eAAsC;IAAe,CAAA,CAC/D;KACF;MACL,kBAAC,OAAD;GAAK,WAAU;GAAQ;EAAc,CAAA,CAC5B;;AAEf;AAEA,SAAgB,IAAsB;CACpC,IA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;SACT,WAAW,MAAM,EAAa,EAAE,OAAO,OAAO;SAC9C,WAAU;QACX,CAAA,GACD,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAG,wCAAwC,aAAa;QACrD,CAAA,CACD;SACJ;QACF;;IACM,CAAA;IAGb,kBAAC,GAAD;KACE,MAAM,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA;KACvC,OAAO,EAAG,iCAAiC,OAAO;KAClD,aAAa,EACX,uCACA,qDACF;eAEA,kBAAC,YAAD;MACE,GAAI,EAAgB,WAAW;MAC/B,IAAG;MACH,cAAY,EAAG,iCAAiC,OAAO;MACvD,OAAO;MACP,WAAW,MAAM,EAAS,EAAE,OAAO,KAAK;MACxC,MAAM;MACN,aAAa,EACX,uCACA,qDACF;MACA,WAAW;KACZ,CAAA;IACU,CAAA;IAEb,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,UAAU,EAAO;MACjB,WAAU;gBAET,EAAO,YACJ,EAAG,8BAA8B,WAAW,IAC5C,EAAG,4BAA4B,qBAAqB;KAClD,CAAA,GACR,kBAAC,UAAD;MACE,MAAK;MACL,eAAe,EAAW,gBAAgB;MAC1C,WAAU;gBAET,EAAG,4BAA4B,QAAQ;KAClC,CAAA,CACL;;GACD;IACI;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"RelationshipNewPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/relationships/RelationshipNewPage.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport { useFormError } from '../../hooks/useFormError';\n/**\n * Create relationship\n * @module subscriberbot/pages/relationships\n *\n * Manual-add form for a recurring relationship AI can't auto-detect.\n * Writes `subCreateRelationship`. Provider + plan are optional pickers\n * sourced from the real registry (`subListProviders` / `subListPlans`).\n */\n\nimport { useState, type ReactNode } from 'react';\nimport { ArrowLeft, Tag, Building2, Wallet, StickyNote } from 'lucide-react';\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { ErrorView } from '../../components/StateViews';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useCreateRelationship, useProviders, usePlans } from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubBillingInterval,\n SubCreateRelationshipInput,\n SubRelationshipKind,\n} from '../../types';\n\nconst KINDS: SubRelationshipKind[] = [\n 'SUBSCRIPTION',\n 'MEMBERSHIP',\n 'LICENSE',\n 'CONTRACT',\n 'NEWSLETTER',\n 'RECURRING_PAYMENT',\n 'ENROLLMENT',\n 'TRIAL',\n];\n\nconst INTERVALS: SubBillingInterval[] = [\n 'MONTHLY',\n 'YEARLY',\n 'QUARTERLY',\n 'WEEKLY',\n 'DAILY',\n 'USAGE_BASED',\n 'LIFETIME',\n 'FREE',\n];\n\nconst KIND_KEY: Record<SubRelationshipKind, string> = {\n SUBSCRIPTION: 'relationships.kinds.subscription',\n MEMBERSHIP: 'relationships.kinds.membership',\n LICENSE: 'relationships.kinds.license',\n CONTRACT: 'relationships.kinds.contract',\n NEWSLETTER: 'relationships.kinds.newsletter',\n RECURRING_PAYMENT: 'relationships.kinds.recurringPayment',\n ENROLLMENT: 'relationships.kinds.enrollment',\n TRIAL: 'relationships.kinds.trial',\n};\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 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.5 block text-xs font-medium text-text-secondary';\n\n/** Grouped form section on a glass surface. */\nfunction FormSection({\n icon,\n title,\n description,\n children,\n dataTour,\n}: {\n icon: ReactNode;\n title: string;\n description: string;\n children: ReactNode;\n /** Stable product-tour anchor rendered as `data-tour` (BOFF-3358). */\n dataTour?: string;\n}) {\n return (\n <GlassCard treatment=\"metric\" className=\"p-5 sm:p-6\" data-tour={dataTour}>\n <div className=\"flex items-start gap-3\">\n <span className=\"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary\">\n {icon}\n </span>\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-text-primary\">{title}</h2>\n <p className=\"mt-0.5 text-xs text-text-secondary\">{description}</p>\n </div>\n </div>\n <div className=\"mt-4\">{children}</div>\n </GlassCard>\n );\n}\n\nexport function RelationshipNewPage() {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const create = useCreateRelationship();\n const providersQ = useProviders({ pagination: { limit: 100, offset: 0 } });\n\n const [label, setLabel] = useState('');\n const [kind, setKind] = useState<SubRelationshipKind>('SUBSCRIPTION');\n const [providerId, setProviderId] = useState('');\n const [planId, setPlanId] = useState('');\n const [amount, setAmount] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [interval, setInterval] = useState<SubBillingInterval>('MONTHLY');\n const [renewsAt, setRenewsAt] = useState('');\n const [autoRenew, setAutoRenew] = useState(true);\n const [notes, setNotes] = useState('');\n const [department, setDepartment] = useState('');\n const [formError, setFormError, fieldErrorProps, formErrorId] = useFormError();\n\n const plansQ = usePlans(providerId || undefined);\n const providers = providersQ.data?.items ?? [];\n const plans = plansQ.data ?? [];\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n setFormError(null);\n if (!label.trim()) {\n setFormError(\n tr('relationships.new.basics.labelRequired', 'A label is required.'),\n 'rel-label'\n );\n return;\n }\n const input: SubCreateRelationshipInput = {\n label: label.trim(),\n kind,\n interval,\n autoRenew,\n currency: currency.trim() || 'USD',\n ...(providerId ? { providerId } : {}),\n ...(planId ? { planId } : {}),\n ...(amount ? { amount: Number(amount) } : {}),\n ...(renewsAt ? { renewsAt: new Date(renewsAt).toISOString() } : {}),\n ...(notes.trim() ? { notes: notes.trim() } : {}),\n ...(department.trim() ? { department: department.trim() } : {}),\n };\n create.mutate(input, {\n onSuccess: (rel) => navigateTo(`/relationships/${rel.id}`),\n onError: (err) =>\n setFormError(\n err instanceof Error\n ? err.message\n : tr('relationships.new.error', 'Could not create relationship.')\n ),\n });\n };\n\n if (providersQ.isError) {\n return (\n <PageLayout\n dataTour=\"subscriberbot-relationship-new\"\n title={tr('relationships.new.title', 'Add relationship')}\n >\n <ErrorView\n message={tr('relationships.new.providerError', 'Could not load the provider registry.')}\n onRetry={() => void providersQ.refetch()}\n />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n dataTour=\"subscriberbot-relationship-new\"\n title={tr('relationships.new.title', 'Add relationship')}\n description={tr(\n 'relationships.new.description',\n 'Track a new recurring digital relationship'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\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('relationships.new.back', 'Back')}\n </button>\n }\n >\n <PagePurpose className=\"mb-6\">\n {tr(\n 'relationships.new.purpose',\n 'Manually add a subscription, membership, license or contract. Link it to a provider and plan from the registry, set the price and renewal date, and Subscriber Bot will track its lifecycle from here.'\n )}\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"max-w-3xl space-y-5\">\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\n {/* Basics */}\n <FormSection\n icon={<Tag className=\"h-4 w-4\" />}\n dataTour=\"subscriberbot-relationship-new-basics\"\n title={tr('relationships.new.basics.title', 'Basics')}\n description={tr(\n 'relationships.new.basics.description',\n 'Name this relationship and choose what kind it is.'\n )}\n >\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"rel-label\" className={labelCls}>\n {tr('relationships.new.basics.labelLabel', 'Label')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n {...fieldErrorProps('rel-label')}\n id=\"rel-label\"\n type=\"text\"\n value={label}\n onChange={(e) => setLabel(e.target.value)}\n placeholder={tr(\n 'relationships.new.basics.labelPlaceholder',\n 'e.g. Netflix Premium, AWS Production'\n )}\n className={inputCls}\n required\n />\n </div>\n <div className=\"max-w-xs\">\n <label htmlFor=\"rel-kind\" className={labelCls}>\n {tr('relationships.new.basics.kindLabel', 'Kind')}\n </label>\n <select\n {...fieldErrorProps('rel-kind')}\n id=\"rel-kind\"\n value={kind}\n onChange={(e) => setKind(e.target.value as SubRelationshipKind)}\n className={inputCls}\n >\n {KINDS.map((k) => (\n <option key={k} value={k}>\n {tr(KIND_KEY[k], formatEnumLabel(k))}\n </option>\n ))}\n </select>\n </div>\n <div className=\"max-w-xs\">\n <label htmlFor=\"rel-department\" className={labelCls}>\n {tr('relationships.new.basics.departmentLabel', 'Department or team')}\n </label>\n <input\n {...fieldErrorProps('rel-department')}\n id=\"rel-department\"\n type=\"text\"\n maxLength={120}\n value={department}\n onChange={(e) => setDepartment(e.target.value)}\n placeholder={tr(\n 'relationships.new.basics.departmentPlaceholder',\n 'e.g. Engineering, Marketing'\n )}\n className={inputCls}\n />\n </div>\n </div>\n </FormSection>\n\n {/* Provider & plan */}\n <FormSection\n icon={<Building2 className=\"h-4 w-4\" />}\n dataTour=\"subscriberbot-relationship-new-provider-plan\"\n title={tr('relationships.new.providerPlan.title', 'Provider & plan')}\n description={tr(\n 'relationships.new.providerPlan.description',\n 'Link this relationship to a provider and plan from the registry (optional).'\n )}\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"rel-provider\" className={labelCls}>\n {tr('relationships.new.providerPlan.providerLabel', 'Provider')}\n </label>\n <select\n {...fieldErrorProps('rel-provider')}\n id=\"rel-provider\"\n value={providerId}\n onChange={(e) => {\n setProviderId(e.target.value);\n setPlanId('');\n }}\n className={inputCls}\n >\n <option value=\"\">\n {tr('relationships.new.providerPlan.providerNone', '— None —')}\n </option>\n {providers.map((p) => (\n <option key={p.id} value={p.id}>\n {p.name}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"rel-plan\" className={labelCls}>\n {tr('relationships.new.providerPlan.planLabel', 'Plan')}\n </label>\n <select\n {...fieldErrorProps('rel-plan')}\n id=\"rel-plan\"\n value={planId}\n onChange={(e) => setPlanId(e.target.value)}\n className={inputCls}\n disabled={!providerId || plans.length === 0}\n >\n <option value=\"\">\n {providerId\n ? plans.length === 0\n ? tr('relationships.new.providerPlan.noPlans', 'No plans available')\n : tr('relationships.new.providerPlan.planNone', '— None —')\n : tr(\n 'relationships.new.providerPlan.selectProviderFirst',\n 'Select a provider first'\n )}\n </option>\n {plans.map((pl) => (\n <option key={pl.id} value={pl.id}>\n {pl.name}\n </option>\n ))}\n </select>\n </div>\n </div>\n </FormSection>\n\n {/* Pricing & billing */}\n <FormSection\n icon={<Wallet className=\"h-4 w-4\" />}\n dataTour=\"subscriberbot-relationship-new-pricing\"\n title={tr('relationships.new.pricing.title', 'Pricing & billing')}\n description={tr(\n 'relationships.new.pricing.description',\n 'Set the price, cadence and next renewal so Subscriber Bot can track it.'\n )}\n >\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div>\n <label htmlFor=\"rel-amount\" className={labelCls}>\n {tr('relationships.new.pricing.amountLabel', 'Amount')}\n </label>\n <input\n {...fieldErrorProps('rel-amount')}\n id=\"rel-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n placeholder={tr('relationships.new.pricing.amountPlaceholder', '0.00')}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"rel-currency\" className={labelCls}>\n {tr('relationships.new.pricing.currencyLabel', 'Currency')}\n </label>\n <input\n {...fieldErrorProps('rel-currency')}\n id=\"rel-currency\"\n type=\"text\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value.toUpperCase())}\n placeholder={tr('relationships.new.pricing.currencyPlaceholder', 'USD')}\n maxLength={3}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"rel-interval\" className={labelCls}>\n {tr('relationships.new.pricing.intervalLabel', 'Billing interval')}\n </label>\n <select\n {...fieldErrorProps('rel-interval')}\n id=\"rel-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 className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"rel-renews\" className={labelCls}>\n {tr('relationships.new.pricing.renewsOnLabel', 'Renews on')}\n </label>\n <input\n {...fieldErrorProps('rel-renews')}\n id=\"rel-renews\"\n type=\"date\"\n value={renewsAt}\n onChange={(e) => setRenewsAt(e.target.value)}\n className={inputCls}\n />\n </div>\n <label className=\"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2.5 sm:mt-6\">\n <input\n type=\"checkbox\"\n checked={autoRenew}\n onChange={(e) => setAutoRenew(e.target.checked)}\n className=\"size-4 rounded border-border-subtle\"\n />\n <span className=\"text-sm text-text-primary\">\n {tr('relationships.new.pricing.autoRenews', 'Auto-renews')}\n </span>\n </label>\n </div>\n </div>\n </FormSection>\n\n {/* Notes */}\n <FormSection\n icon={<StickyNote className=\"h-4 w-4\" />}\n title={tr('relationships.new.notes.title', 'Notes')}\n description={tr(\n 'relationships.new.notes.description',\n 'Anything worth remembering about this relationship.'\n )}\n >\n <textarea\n {...fieldErrorProps('rel-notes')}\n id=\"rel-notes\"\n aria-label={tr('relationships.new.notes.title', 'Notes')}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n rows={3}\n placeholder={tr(\n 'relationships.new.notes.placeholder',\n 'Anything worth remembering about this relationship…'\n )}\n className={inputCls}\n />\n </FormSection>\n\n <div\n className=\"flex flex-col gap-3 sm:flex-row\"\n data-tour=\"subscriberbot-relationship-new-actions\"\n >\n <button\n type=\"submit\"\n disabled={create.isPending}\n className=\"rounded-lg bg-action-primary-bg px-5 py-2.5 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {create.isPending\n ? tr('relationships.new.creating', 'Creating…')\n : tr('relationships.new.submit', 'Create relationship')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/relationships')}\n className=\"rounded-lg border border-border-subtle px-5 py-2.5 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n {tr('relationships.new.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAM,IAA+B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAkC;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAgD;CACpD,cAAc;CACd,YAAY;CACZ,SAAS;CACT,UAAU;CACV,YAAY;CACZ,mBAAmB;CACnB,YAAY;CACZ,OAAO;AACT,GAEM,IACJ,0MACI,IAAW;AAGjB,SAAS,EAAY,EACnB,SACA,UACA,gBACA,aACA,eAQC;CACD,OACE,kBAAC,GAAD;EAAW,WAAU;EAAS,WAAU;EAAa,aAAW;YAAhE,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,QAAD;IAAM,WAAU;cACb;GACG,CAAA,GACN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAA2C;IAAU,CAAA,GACnE,kBAAC,KAAD;KAAG,WAAU;eAAsC;IAAe,CAAA,CAC/D;KACF;MACL,kBAAC,OAAD;GAAK,WAAU;GAAQ;EAAc,CAAA,CAC5B;;AAEf;AAEA,SAAgB,IAAsB;CACpC,IAAM,EAAE,uBAAoB,EAAc,GAEpC,IAAK,EAAM,GACX,EAAE,kBAAe,EAAiB,GAClC,IAAS,EAAsB,GAC/B,IAAa,E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