@burdenoff/microfe-housingvista 2026.1031.2 → 2026.1102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/housingvista/components/ContactOwnerDialog.d.ts +6 -0
  2. package/dist/housingvista/components/ContactOwnerDialog.d.ts.map +1 -1
  3. package/dist/housingvista/components/ContactOwnerDialog.js +39 -29
  4. package/dist/housingvista/components/ContactOwnerDialog.js.map +1 -1
  5. package/dist/housingvista/pages/finance/HomeLoanDetailPage.d.ts.map +1 -1
  6. package/dist/housingvista/pages/finance/HomeLoanDetailPage.js +161 -152
  7. package/dist/housingvista/pages/finance/HomeLoanDetailPage.js.map +1 -1
  8. package/dist/housingvista/pages/finance/HomeLoansPage.d.ts.map +1 -1
  9. package/dist/housingvista/pages/finance/HomeLoansPage.js +147 -139
  10. package/dist/housingvista/pages/finance/HomeLoansPage.js.map +1 -1
  11. package/dist/housingvista/pages/legal/LegalPage.d.ts.map +1 -1
  12. package/dist/housingvista/pages/legal/LegalPage.js +6 -1
  13. package/dist/housingvista/pages/legal/LegalPage.js.map +1 -1
  14. package/dist/housingvista/pages/marketplace/MarketplacePage.d.ts.map +1 -1
  15. package/dist/housingvista/pages/marketplace/MarketplacePage.js +6 -1
  16. package/dist/housingvista/pages/marketplace/MarketplacePage.js.map +1 -1
  17. package/dist/housingvista/pages/properties/PropertyDetailPage.d.ts.map +1 -1
  18. package/dist/housingvista/pages/properties/PropertyDetailPage.js +275 -264
  19. package/dist/housingvista/pages/properties/PropertyDetailPage.js.map +1 -1
  20. package/dist/housingvista/utils/loanApplyContext.d.ts +42 -0
  21. package/dist/housingvista/utils/loanApplyContext.d.ts.map +1 -0
  22. package/dist/housingvista/utils/loanApplyContext.js +40 -0
  23. package/dist/housingvista/utils/loanApplyContext.js.map +1 -0
  24. package/package.json +1 -1
@@ -19,6 +19,12 @@ interface ContactOwnerDialogProps {
19
19
  /** Dialog heading, defaults to "Contact". */
20
20
  heading?: string;
21
21
  description?: string;
22
+ /**
23
+ * Prefills the message box the first time the dialog opens on an empty
24
+ * conversation (e.g. a summary of the loan the buyer modelled). Never
25
+ * overwrites what the user already typed, and is not sent automatically.
26
+ */
27
+ initialMessage?: string;
22
28
  /**
23
29
  * Controlled-open mode. When `open`/`onOpenChange` are provided the parent
24
30
  * owns the state and the internal trigger button is not rendered — the
@@ -1 +1 @@
1
- {"version":3,"file":"ContactOwnerDialog.d.ts","sourceRoot":"","sources":["../../../src/housingvista/components/ContactOwnerDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA+B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7E,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,uBAAuB,CAAC;AAa/B,UAAU,uBAAuB;IAC/B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,sDAAsD;IACtD,cAAc,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAmJ1D,CAAC"}
1
+ {"version":3,"file":"ContactOwnerDialog.d.ts","sourceRoot":"","sources":["../../../src/housingvista/components/ContactOwnerDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA+B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG7E,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,uBAAuB,CAAC;AAa/B,UAAU,uBAAuB;IAC/B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,sDAAsD;IACtD,cAAc,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA4J1D,CAAC"}
@@ -16,68 +16,78 @@ function x(e) {
16
16
  minute: "2-digit"
17
17
  });
18
18
  }
19
- var S = ({ entityId: S, entityType: C, title: w, pagePath: T, triggerContent: E, triggerVariant: D = "outline", triggerClassName: O, heading: k = "Contact", description: A, open: j, onOpenChange: M }) => {
20
- let { currentUser: N } = e(), { openConversation: P, loading: F } = n(), { sendMessage: I, loading: L } = i(), R = j !== void 0, [z, B] = c(!1), V = R ? j : z, H = (e) => R ? M?.(e) : B(e), [U, W] = c(), [G, K] = c(""), { data: q, loading: J } = r(U), Y = s(null);
19
+ var S = ({ entityId: S, entityType: C, title: w, pagePath: T, triggerContent: E, triggerVariant: D = "outline", triggerClassName: O, heading: k = "Contact", description: A, initialMessage: j, open: M, onOpenChange: N }) => {
20
+ let { currentUser: P } = e(), { openConversation: F, loading: I } = n(), { sendMessage: L, loading: R } = i(), z = M !== void 0, [B, V] = c(!1), H = z ? M : B, U = (e) => z ? N?.(e) : V(e), [W, G] = c(), [K, q] = c(""), { data: J, loading: Y } = r(W), X = s(null);
21
21
  o(() => {
22
- if (!V || U) return;
22
+ if (!H || W) return;
23
23
  let e = !1;
24
- return P({
24
+ return F({
25
25
  entityId: S,
26
26
  entityType: C,
27
27
  title: w,
28
28
  contextHref: T,
29
29
  pagePath: T
30
30
  }).then((t) => {
31
- e || W(t.id);
31
+ e || G(t.id);
32
32
  }).catch((e) => a.error("Could not open the conversation", e.message)), () => {
33
33
  e = !0;
34
34
  };
35
35
  }, [
36
- V,
37
- U,
38
- P,
36
+ H,
37
+ W,
38
+ F,
39
39
  S,
40
40
  C,
41
41
  w,
42
42
  T
43
43
  ]), o(() => {
44
- Y.current?.scrollTo({ top: Y.current.scrollHeight });
45
- }, [q]);
46
- let X = async () => {
47
- let e = G.trim();
48
- if (!(!e || !U)) try {
49
- await I(U, e), K("");
44
+ X.current?.scrollTo({ top: X.current.scrollHeight });
45
+ }, [J]);
46
+ let Z = s(!1);
47
+ o(() => {
48
+ !j || Z.current || !W || I || Y || (Z.current = !0, J.length === 0 && q((e) => e || j));
49
+ }, [
50
+ j,
51
+ W,
52
+ I,
53
+ Y,
54
+ J.length
55
+ ]);
56
+ let Q = async () => {
57
+ let e = K.trim();
58
+ if (!(!e || !W)) try {
59
+ await L(W, e), q("");
50
60
  } catch (e) {
51
61
  a.error("Message not sent", e.message);
52
62
  }
53
- }, Z = N?.id ?? "";
54
- return /* @__PURE__ */ p(d, { children: [!R && /* @__PURE__ */ f(m, {
63
+ }, $ = P?.id ?? "";
64
+ return /* @__PURE__ */ p(d, { children: [!z && /* @__PURE__ */ f(m, {
55
65
  type: "button",
56
66
  variant: D,
57
67
  className: O,
58
- onClick: () => H(!0),
68
+ onClick: () => U(!0),
59
69
  children: E
60
70
  }), b(/* @__PURE__ */ f(h, {
61
- open: V,
62
- onOpenChange: H,
71
+ open: H,
72
+ onOpenChange: U,
63
73
  children: /* @__PURE__ */ p(g, {
64
74
  className: "sm:max-w-lg",
65
75
  children: [
66
76
  /* @__PURE__ */ p(v, { children: [/* @__PURE__ */ f(y, { children: k }), /* @__PURE__ */ f(_, { children: A ?? `Start a conversation about ${w}. Messages are saved and delivered in your inbox.` })] }),
67
77
  /* @__PURE__ */ f("div", {
68
- ref: Y,
78
+ ref: X,
69
79
  className: "max-h-72 min-h-40 space-y-2 overflow-y-auto rounded-md border border-border-subtle bg-bg-sunken p-3",
70
- children: F || J ? /* @__PURE__ */ f("p", {
80
+ children: I || Y ? /* @__PURE__ */ f("p", {
71
81
  className: "py-8 text-center text-sm text-text-secondary",
72
82
  children: "Loading conversation…"
73
- }) : q.length === 0 ? /* @__PURE__ */ p("div", {
83
+ }) : J.length === 0 ? /* @__PURE__ */ p("div", {
74
84
  className: "flex flex-col items-center gap-2 py-8 text-center",
75
85
  children: [/* @__PURE__ */ f(l, { className: "h-8 w-8 text-text-secondary" }), /* @__PURE__ */ f("p", {
76
86
  className: "text-sm text-text-secondary",
77
87
  children: "No messages yet. Say hello to get the conversation started."
78
88
  })]
79
- }) : q.map((e) => {
80
- let n = e.authorId === Z;
89
+ }) : J.map((e) => {
90
+ let n = e.authorId === $;
81
91
  return /* @__PURE__ */ f("div", {
82
92
  className: t("flex", n ? "justify-end" : "justify-start"),
83
93
  children: /* @__PURE__ */ p("div", {
@@ -96,18 +106,18 @@ var S = ({ entityId: S, entityType: C, title: w, pagePath: T, triggerContent: E,
96
106
  /* @__PURE__ */ p("div", {
97
107
  className: "mt-3 flex items-end gap-2",
98
108
  children: [/* @__PURE__ */ f("textarea", {
99
- value: G,
100
- onChange: (e) => K(e.target.value),
109
+ value: K,
110
+ onChange: (e) => q(e.target.value),
101
111
  onKeyDown: (e) => {
102
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
112
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Q());
103
113
  },
104
114
  rows: 2,
105
115
  placeholder: "Write a message…",
106
116
  className: "min-h-10 flex-1 resize-none rounded-md 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)]"
107
117
  }), /* @__PURE__ */ p(m, {
108
118
  type: "button",
109
- onClick: X,
110
- disabled: !G.trim() || !U || L,
119
+ onClick: Q,
120
+ disabled: !K.trim() || !W || R,
111
121
  children: [/* @__PURE__ */ f(u, { className: "h-4 w-4" }), /* @__PURE__ */ f("span", {
112
122
  className: "ml-1",
113
123
  children: "Send"
@@ -1 +1 @@
1
- {"version":3,"file":"ContactOwnerDialog.js","names":[],"sources":["../../../src/housingvista/components/ContactOwnerDialog.tsx"],"sourcesContent":["/**\n * Real messaging surface backed by wspace-conversations-svc. Any \"Contact /\n * Message / Apply / Contact Owner\" CTA renders this: it resolves (get-or-create)\n * the entity's conversation, shows the persisted thread, and posts messages via\n * `sendMessage`. No stub, no dead-end — everything is persisted server-side.\n * @module housingvista\n */\n\nimport { useEffect, useRef, useState, type FC, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { MessageSquare, Send } from 'lucide-react';\nimport {\n Button,\n type ButtonProps,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n} from '@burdenoff/fe-libs/ui';\nimport { useContactConversation, useConversationMessages, useSendMessage } from '../hooks';\nimport { useHousingVista } from '../context/HousingVistaContext';\nimport { notify } from '../lib/toast';\nimport { cn } from '../utils/helpers';\n\n/** Short local time (e.g. \"2:30 PM\") for a message bubble timestamp. */\nfunction formatMessageTime(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return '';\n return date.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' });\n}\n\ninterface ContactOwnerDialogProps {\n /** Stable id of the thing being discussed (property/service/listing id). */\n entityId: string;\n /** e.g. `housingvista-property`, `housingvista-marketplace-service`. */\n entityType: string;\n /** Title used when the conversation is first created. */\n title: string;\n /** Router path back into this surface (deep link). */\n pagePath: string;\n /** Inner content of the trigger button (icon + label). Omit in controlled mode. */\n triggerContent?: ReactNode;\n /** Trigger button variant (defaults to `outline`). */\n triggerVariant?: ButtonProps['variant'];\n /** Extra classes for the trigger button. */\n triggerClassName?: string;\n /** Dialog heading, defaults to \"Contact\". */\n heading?: string;\n description?: string;\n /**\n * Controlled-open mode. When `open`/`onOpenChange` are provided the parent\n * owns the state and the internal trigger button is not rendered — the\n * caller renders its own trigger. This is the pattern the in-page dialogs\n * (e.g. Make Offer) use, and it renders the dialog reliably at page root.\n */\n open?: boolean;\n onOpenChange?: (next: boolean) => void;\n}\n\nexport const ContactOwnerDialog: FC<ContactOwnerDialogProps> = ({\n entityId,\n entityType,\n title,\n pagePath,\n triggerContent,\n triggerVariant = 'outline',\n triggerClassName,\n heading = 'Contact',\n description,\n open: openProp,\n onOpenChange,\n}) => {\n const { currentUser } = useHousingVista();\n const { openConversation, loading: opening } = useContactConversation();\n const { sendMessage, loading: sending } = useSendMessage();\n const controlled = openProp !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const open = controlled ? openProp : internalOpen;\n const setOpen = (next: boolean) => (controlled ? onOpenChange?.(next) : setInternalOpen(next));\n const [conversationId, setConversationId] = useState<string | undefined>();\n const [draft, setDraft] = useState('');\n const { data: messages, loading: loadingMessages } = useConversationMessages(conversationId);\n const scrollRef = useRef<HTMLDivElement>(null);\n\n // Resolve the conversation the first time the dialog opens.\n useEffect(() => {\n if (!open || conversationId) return;\n let cancelled = false;\n openConversation({\n entityId,\n entityType,\n title,\n contextHref: pagePath,\n pagePath,\n })\n .then((res) => {\n if (!cancelled) setConversationId(res.id);\n })\n .catch((err: Error) => notify.error('Could not open the conversation', err.message));\n return () => {\n cancelled = true;\n };\n }, [open, conversationId, openConversation, entityId, entityType, title, pagePath]);\n\n useEffect(() => {\n scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight });\n }, [messages]);\n\n const handleSend = async () => {\n const text = draft.trim();\n if (!text || !conversationId) return;\n try {\n await sendMessage(conversationId, text);\n setDraft('');\n } catch (err) {\n notify.error('Message not sent', (err as Error).message);\n }\n };\n\n const currentUserId = currentUser?.id ?? '';\n\n // Render the trigger as a real Button with a direct onClick — the exact\n // controlled-open pattern the in-page dialogs (e.g. Make Offer) use. Passing a\n // pre-built element through ResponsiveDialogTrigger asChild / cloneElement /\n // a display:contents wrapper all failed to forward the click in production.\n return (\n <>\n {!controlled && (\n <Button type=\"button\" variant={triggerVariant} className={triggerClassName} onClick={() => setOpen(true)}>\n {triggerContent}\n </Button>\n )}\n {createPortal(\n <ResponsiveDialog open={open} onOpenChange={setOpen}>\n <ResponsiveDialogContent className=\"sm:max-w-lg\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>{heading}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {description ?? `Start a conversation about ${title}. Messages are saved and delivered in your inbox.`}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <div\n ref={scrollRef}\n className=\"max-h-72 min-h-40 space-y-2 overflow-y-auto rounded-md border border-border-subtle bg-bg-sunken p-3\"\n >\n {opening || loadingMessages ? (\n <p className=\"py-8 text-center text-sm text-text-secondary\">Loading conversation…</p>\n ) : messages.length === 0 ? (\n <div className=\"flex flex-col items-center gap-2 py-8 text-center\">\n <MessageSquare className=\"h-8 w-8 text-text-secondary\" />\n <p className=\"text-sm text-text-secondary\">\n No messages yet. Say hello to get the conversation started.\n </p>\n </div>\n ) : (\n messages.map((message) => {\n const mine = message.authorId === currentUserId;\n return (\n <div key={message.id} className={cn('flex', mine ? 'justify-end' : 'justify-start')}>\n <div className={cn('max-w-[80%]', mine ? 'items-end' : 'items-start')}>\n <div\n className={cn(\n 'rounded-2xl px-3.5 py-2 text-sm',\n mine\n ? 'rounded-br-sm bg-action-primary-bg text-action-primary-text'\n : 'rounded-bl-sm border border-border-subtle bg-bg-surface text-text-primary'\n )}\n >\n {message.text}\n </div>\n <div className={cn('mt-1 px-1 text-[0.65rem] text-text-secondary', mine && 'text-right')}>\n {formatMessageTime(message.createdAt)}\n </div>\n </div>\n </div>\n );\n })\n )}\n </div>\n\n <div className=\"mt-3 flex items-end gap-2\">\n <textarea\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n void handleSend();\n }\n }}\n rows={2}\n placeholder=\"Write a message…\"\n className=\"min-h-10 flex-1 resize-none rounded-md 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)]\"\n />\n <Button type=\"button\" onClick={handleSend} disabled={!draft.trim() || !conversationId || sending}>\n <Send className=\"h-4 w-4\" />\n <span className=\"ml-1\">Send</span>\n </Button>\n </div>\n </ResponsiveDialogContent>\n </ResponsiveDialog>,\n document.body\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;AA0BA,SAAS,EAAkB,GAAqB;CAC9C,IAAM,IAAO,IAAI,KAAK,EAAI;AAE1B,QADI,OAAO,MAAM,EAAK,SAAS,CAAC,GAAS,KAClC,EAAK,mBAAmB,SAAS;EAAE,MAAM;EAAW,QAAQ;EAAW,CAAC;;AA+BjF,IAAa,KAAmD,EAC9D,aACA,eACA,UACA,aACA,mBACA,oBAAiB,WACjB,qBACA,aAAU,WACV,gBACA,MAAM,GACN,sBACI;CACJ,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,qBAAkB,SAAS,MAAY,GAAwB,EACjE,EAAE,gBAAa,SAAS,MAAY,GAAgB,EACpD,IAA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QACL;;IACkB;;EACT,CAAA,EACnB,SAAS,KACV,CACA,EAAA,CAAA"}
1
+ {"version":3,"file":"ContactOwnerDialog.js","names":[],"sources":["../../../src/housingvista/components/ContactOwnerDialog.tsx"],"sourcesContent":["/**\n * Real messaging surface backed by wspace-conversations-svc. Any \"Contact /\n * Message / Apply / Contact Owner\" CTA renders this: it resolves (get-or-create)\n * the entity's conversation, shows the persisted thread, and posts messages via\n * `sendMessage`. No stub, no dead-end — everything is persisted server-side.\n * @module housingvista\n */\n\nimport { useEffect, useRef, useState, type FC, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { MessageSquare, Send } from 'lucide-react';\nimport {\n Button,\n type ButtonProps,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n} from '@burdenoff/fe-libs/ui';\nimport { useContactConversation, useConversationMessages, useSendMessage } from '../hooks';\nimport { useHousingVista } from '../context/HousingVistaContext';\nimport { notify } from '../lib/toast';\nimport { cn } from '../utils/helpers';\n\n/** Short local time (e.g. \"2:30 PM\") for a message bubble timestamp. */\nfunction formatMessageTime(iso: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return '';\n return date.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' });\n}\n\ninterface ContactOwnerDialogProps {\n /** Stable id of the thing being discussed (property/service/listing id). */\n entityId: string;\n /** e.g. `housingvista-property`, `housingvista-marketplace-service`. */\n entityType: string;\n /** Title used when the conversation is first created. */\n title: string;\n /** Router path back into this surface (deep link). */\n pagePath: string;\n /** Inner content of the trigger button (icon + label). Omit in controlled mode. */\n triggerContent?: ReactNode;\n /** Trigger button variant (defaults to `outline`). */\n triggerVariant?: ButtonProps['variant'];\n /** Extra classes for the trigger button. */\n triggerClassName?: string;\n /** Dialog heading, defaults to \"Contact\". */\n heading?: string;\n description?: string;\n /**\n * Prefills the message box the first time the dialog opens on an empty\n * conversation (e.g. a summary of the loan the buyer modelled). Never\n * overwrites what the user already typed, and is not sent automatically.\n */\n initialMessage?: string;\n /**\n * Controlled-open mode. When `open`/`onOpenChange` are provided the parent\n * owns the state and the internal trigger button is not rendered — the\n * caller renders its own trigger. This is the pattern the in-page dialogs\n * (e.g. Make Offer) use, and it renders the dialog reliably at page root.\n */\n open?: boolean;\n onOpenChange?: (next: boolean) => void;\n}\n\nexport const ContactOwnerDialog: FC<ContactOwnerDialogProps> = ({\n entityId,\n entityType,\n title,\n pagePath,\n triggerContent,\n triggerVariant = 'outline',\n triggerClassName,\n heading = 'Contact',\n description,\n initialMessage,\n open: openProp,\n onOpenChange,\n}) => {\n const { currentUser } = useHousingVista();\n const { openConversation, loading: opening } = useContactConversation();\n const { sendMessage, loading: sending } = useSendMessage();\n const controlled = openProp !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const open = controlled ? openProp : internalOpen;\n const setOpen = (next: boolean) => (controlled ? onOpenChange?.(next) : setInternalOpen(next));\n const [conversationId, setConversationId] = useState<string | undefined>();\n const [draft, setDraft] = useState('');\n const { data: messages, loading: loadingMessages } = useConversationMessages(conversationId);\n const scrollRef = useRef<HTMLDivElement>(null);\n\n // Resolve the conversation the first time the dialog opens.\n useEffect(() => {\n if (!open || conversationId) return;\n let cancelled = false;\n openConversation({\n entityId,\n entityType,\n title,\n contextHref: pagePath,\n pagePath,\n })\n .then((res) => {\n if (!cancelled) setConversationId(res.id);\n })\n .catch((err: Error) => notify.error('Could not open the conversation', err.message));\n return () => {\n cancelled = true;\n };\n }, [open, conversationId, openConversation, entityId, entityType, title, pagePath]);\n\n useEffect(() => {\n scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight });\n }, [messages]);\n\n // Seed the draft once, after the conversation has loaded and turned out empty.\n const seededRef = useRef(false);\n useEffect(() => {\n if (!initialMessage || seededRef.current || !conversationId || opening || loadingMessages) return;\n seededRef.current = true;\n if (messages.length === 0) setDraft((current) => current || initialMessage);\n }, [initialMessage, conversationId, opening, loadingMessages, messages.length]);\n\n const handleSend = async () => {\n const text = draft.trim();\n if (!text || !conversationId) return;\n try {\n await sendMessage(conversationId, text);\n setDraft('');\n } catch (err) {\n notify.error('Message not sent', (err as Error).message);\n }\n };\n\n const currentUserId = currentUser?.id ?? '';\n\n // Render the trigger as a real Button with a direct onClick — the exact\n // controlled-open pattern the in-page dialogs (e.g. Make Offer) use. Passing a\n // pre-built element through ResponsiveDialogTrigger asChild / cloneElement /\n // a display:contents wrapper all failed to forward the click in production.\n return (\n <>\n {!controlled && (\n <Button type=\"button\" variant={triggerVariant} className={triggerClassName} onClick={() => setOpen(true)}>\n {triggerContent}\n </Button>\n )}\n {createPortal(\n <ResponsiveDialog open={open} onOpenChange={setOpen}>\n <ResponsiveDialogContent className=\"sm:max-w-lg\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>{heading}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {description ?? `Start a conversation about ${title}. Messages are saved and delivered in your inbox.`}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <div\n ref={scrollRef}\n className=\"max-h-72 min-h-40 space-y-2 overflow-y-auto rounded-md border border-border-subtle bg-bg-sunken p-3\"\n >\n {opening || loadingMessages ? (\n <p className=\"py-8 text-center text-sm text-text-secondary\">Loading conversation…</p>\n ) : messages.length === 0 ? (\n <div className=\"flex flex-col items-center gap-2 py-8 text-center\">\n <MessageSquare className=\"h-8 w-8 text-text-secondary\" />\n <p className=\"text-sm text-text-secondary\">\n No messages yet. Say hello to get the conversation started.\n </p>\n </div>\n ) : (\n messages.map((message) => {\n const mine = message.authorId === currentUserId;\n return (\n <div key={message.id} className={cn('flex', mine ? 'justify-end' : 'justify-start')}>\n <div className={cn('max-w-[80%]', mine ? 'items-end' : 'items-start')}>\n <div\n className={cn(\n 'rounded-2xl px-3.5 py-2 text-sm',\n mine\n ? 'rounded-br-sm bg-action-primary-bg text-action-primary-text'\n : 'rounded-bl-sm border border-border-subtle bg-bg-surface text-text-primary'\n )}\n >\n {message.text}\n </div>\n <div className={cn('mt-1 px-1 text-[0.65rem] text-text-secondary', mine && 'text-right')}>\n {formatMessageTime(message.createdAt)}\n </div>\n </div>\n </div>\n );\n })\n )}\n </div>\n\n <div className=\"mt-3 flex items-end gap-2\">\n <textarea\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n void handleSend();\n }\n }}\n rows={2}\n placeholder=\"Write a message…\"\n className=\"min-h-10 flex-1 resize-none rounded-md 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)]\"\n />\n <Button type=\"button\" onClick={handleSend} disabled={!draft.trim() || !conversationId || sending}>\n <Send className=\"h-4 w-4\" />\n <span className=\"ml-1\">Send</span>\n </Button>\n </div>\n </ResponsiveDialogContent>\n </ResponsiveDialog>,\n document.body\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;AA0BA,SAAS,EAAkB,GAAqB;CAC9C,IAAM,IAAO,IAAI,KAAK,EAAI;AAE1B,QADI,OAAO,MAAM,EAAK,SAAS,CAAC,GAAS,KAClC,EAAK,mBAAmB,SAAS;EAAE,MAAM;EAAW,QAAQ;EAAW,CAAC;;AAqCjF,IAAa,KAAmD,EAC9D,aACA,eACA,UACA,aACA,mBACA,oBAAiB,WACjB,qBACA,aAAU,WACV,gBACA,mBACA,MAAM,GACN,sBACI;CACJ,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,qBAAkB,SAAS,MAAY,GAAwB,EACjE,EAAE,gBAAa,SAAS,MAAY,GAAgB,EACpD,IAAa,MAAa,KAAA,GAC1B,CAAC,GAAc,KAAmB,EAAS,GAAM,EACjD,IAAO,IAAa,IAAW,GAC/B,KAAW,MAAmB,IAAa,IAAe,EAAK,GAAG,EAAgB,EAAK,EACvF,CAAC,GAAgB,KAAqB,GAA8B,EACpE,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C,QAAD;OAAM,WAAU;iBAAO;OAAW,CAAA,CAC3B;QACL;;IACkB;;EACT,CAAA,EACnB,SAAS,KACV,CACA,EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"HomeLoanDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/housingvista/pages/finance/HomeLoanDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8CH,wBAAgB,kBAAkB,gCAyQjC"}
1
+ {"version":3,"file":"HomeLoanDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/housingvista/pages/finance/HomeLoanDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyDH,wBAAgB,kBAAkB,gCAoSjC"}