@flamingo-stack/openframe-frontend-core 0.0.644 → 0.0.645
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/README.md +2 -2
- package/dist/{chunk-FOSIR4QF.js → chunk-3DWDJ54N.js} +5 -5
- package/dist/{chunk-CBXZSTAG.cjs → chunk-3J7YNAYI.cjs} +973 -793
- package/dist/chunk-3J7YNAYI.cjs.map +1 -0
- package/dist/{chunk-3DGRXC74.js → chunk-3PGYHT67.js} +5 -5
- package/dist/{chunk-YB6FI2G3.js → chunk-3SMLYVM2.js} +1 -1
- package/dist/{chunk-YB6FI2G3.js.map → chunk-3SMLYVM2.js.map} +1 -1
- package/dist/{chunk-DCCY54LU.cjs → chunk-46G4WFA7.cjs} +14 -14
- package/dist/{chunk-DCCY54LU.cjs.map → chunk-46G4WFA7.cjs.map} +1 -1
- package/dist/{chunk-OMSUWB6A.cjs → chunk-4A4DQSTI.cjs} +118 -118
- package/dist/{chunk-OMSUWB6A.cjs.map → chunk-4A4DQSTI.cjs.map} +1 -1
- package/dist/{chunk-4EEUB62O.js → chunk-4HVWGYHI.js} +2 -2
- package/dist/{chunk-UKV52KAP.cjs → chunk-56FDKQ7R.cjs} +44 -44
- package/dist/{chunk-UKV52KAP.cjs.map → chunk-56FDKQ7R.cjs.map} +1 -1
- package/dist/{chunk-G5U4JP45.js → chunk-5ONM3FHQ.js} +4 -4
- package/dist/{chunk-PFV4DAX5.js → chunk-6PMUA6JW.js} +10 -10
- package/dist/{chunk-GELNUDBT.cjs → chunk-77BLJHKI.cjs} +10 -10
- package/dist/{chunk-GELNUDBT.cjs.map → chunk-77BLJHKI.cjs.map} +1 -1
- package/dist/{chunk-KJWPAJRT.js → chunk-7EI3NES7.js} +3 -3
- package/dist/{chunk-3IXDZI3R.cjs → chunk-DOVVKQMZ.cjs} +3 -3
- package/dist/{chunk-3IXDZI3R.cjs.map → chunk-DOVVKQMZ.cjs.map} +1 -1
- package/dist/{chunk-KOQCA5X5.cjs → chunk-DWJREJRA.cjs} +5 -5
- package/dist/{chunk-KOQCA5X5.cjs.map → chunk-DWJREJRA.cjs.map} +1 -1
- package/dist/{chunk-S2KMNFFN.js → chunk-EI3SLIWL.js} +7 -7
- package/dist/{chunk-7R2DIGG4.cjs → chunk-EX5PJGVA.cjs} +76 -76
- package/dist/{chunk-7R2DIGG4.cjs.map → chunk-EX5PJGVA.cjs.map} +1 -1
- package/dist/{chunk-GBEUGDZG.cjs → chunk-F6U2H42L.cjs} +23 -23
- package/dist/{chunk-GBEUGDZG.cjs.map → chunk-F6U2H42L.cjs.map} +1 -1
- package/dist/{chunk-KEKN76JR.js → chunk-FRQ2DE5Z.js} +5 -5
- package/dist/{chunk-3UBT2OIX.cjs → chunk-GPZ6Q2NP.cjs} +74 -74
- package/dist/{chunk-3UBT2OIX.cjs.map → chunk-GPZ6Q2NP.cjs.map} +1 -1
- package/dist/{chunk-JOV64HW5.js → chunk-GRBZC5N3.js} +3 -3
- package/dist/{chunk-CHIHYC7Q.cjs → chunk-GSD62VAY.cjs} +21 -21
- package/dist/{chunk-CHIHYC7Q.cjs.map → chunk-GSD62VAY.cjs.map} +1 -1
- package/dist/{chunk-UEXIMEVU.js → chunk-GSNX2GDA.js} +10 -10
- package/dist/{chunk-LPMDCQLL.js → chunk-H3EJDISW.js} +2 -2
- package/dist/{chunk-RNMGKAS6.js → chunk-HDCIDJSP.js} +15 -15
- package/dist/{chunk-7Q5XXPCB.js → chunk-HHE7UNGR.js} +14 -14
- package/dist/{chunk-KOLVBEW5.js → chunk-IWISVG4P.js} +3 -3
- package/dist/{chunk-GNKM6R55.cjs → chunk-JH5P72AF.cjs} +25 -25
- package/dist/{chunk-GNKM6R55.cjs.map → chunk-JH5P72AF.cjs.map} +1 -1
- package/dist/{chunk-LCK7T2RM.cjs → chunk-JU6SBF3C.cjs} +13 -13
- package/dist/{chunk-LCK7T2RM.cjs.map → chunk-JU6SBF3C.cjs.map} +1 -1
- package/dist/{chunk-27RD5XTP.js → chunk-JZVSQT2V.js} +5 -5
- package/dist/{chunk-F2KBCLUG.js → chunk-KKSSA4CS.js} +2 -2
- package/dist/{chunk-MRIOYSXH.js → chunk-KYIOOOQY.js} +5 -5
- package/dist/{chunk-FKBM6U43.js → chunk-LZLT67PE.js} +2 -2
- package/dist/{chunk-LZYPSDFE.cjs → chunk-M2MTAES4.cjs} +90 -90
- package/dist/{chunk-LZYPSDFE.cjs.map → chunk-M2MTAES4.cjs.map} +1 -1
- package/dist/{chunk-B3Z3RJRW.js → chunk-M4AD2PHE.js} +5 -5
- package/dist/{chunk-BVQEU5JB.js → chunk-MT5A25AX.js} +2 -2
- package/dist/{chunk-TTVOBWAH.js → chunk-MTC6DWVH.js} +5 -5
- package/dist/{chunk-OVXYX47B.cjs → chunk-N4Q5GKBN.cjs} +19 -19
- package/dist/{chunk-OVXYX47B.cjs.map → chunk-N4Q5GKBN.cjs.map} +1 -1
- package/dist/{chunk-FAD5WURS.cjs → chunk-OGBM3JPR.cjs} +124 -124
- package/dist/{chunk-FAD5WURS.cjs.map → chunk-OGBM3JPR.cjs.map} +1 -1
- package/dist/chunk-OXB6LRBK.js +20 -0
- package/dist/chunk-OXB6LRBK.js.map +1 -0
- package/dist/{chunk-TGUA3C4U.cjs → chunk-Q7XUKTBB.cjs} +9 -9
- package/dist/{chunk-TGUA3C4U.cjs.map → chunk-Q7XUKTBB.cjs.map} +1 -1
- package/dist/{chunk-RFFF2EYD.cjs → chunk-QXML4X4W.cjs} +15 -15
- package/dist/{chunk-RFFF2EYD.cjs.map → chunk-QXML4X4W.cjs.map} +1 -1
- package/dist/{chunk-HOGOQA2X.js → chunk-R3CH2ASE.js} +3 -3
- package/dist/{chunk-SKABQX44.js → chunk-RUC2V3VH.js} +7 -7
- package/dist/{chunk-MCQAOIUK.cjs → chunk-SID5YPKF.cjs} +37 -37
- package/dist/{chunk-MCQAOIUK.cjs.map → chunk-SID5YPKF.cjs.map} +1 -1
- package/dist/{chunk-HPWLIYRL.js → chunk-T36DLNMO.js} +14 -14
- package/dist/{chunk-UPKZU6QU.cjs → chunk-U2YLMFJK.cjs} +1 -1
- package/dist/{chunk-UPKZU6QU.cjs.map → chunk-U2YLMFJK.cjs.map} +1 -1
- package/dist/{chunk-B5IFXCRF.cjs → chunk-UF7AUQ3M.cjs} +41 -41
- package/dist/{chunk-B5IFXCRF.cjs.map → chunk-UF7AUQ3M.cjs.map} +1 -1
- package/dist/{chunk-IXD6SHQ6.js → chunk-ULJNU46H.js} +6 -6
- package/dist/{chunk-CCWI3622.cjs → chunk-VTYP25OW.cjs} +4 -4
- package/dist/{chunk-CCWI3622.cjs.map → chunk-VTYP25OW.cjs.map} +1 -1
- package/dist/{chunk-C5Y5T6GC.cjs → chunk-WIYSHSNU.cjs} +20 -20
- package/dist/{chunk-C5Y5T6GC.cjs.map → chunk-WIYSHSNU.cjs.map} +1 -1
- package/dist/{chunk-T3C3JLGV.cjs → chunk-WKX7DYFM.cjs} +8 -8
- package/dist/{chunk-T3C3JLGV.cjs.map → chunk-WKX7DYFM.cjs.map} +1 -1
- package/dist/{chunk-4WVWRFGP.js → chunk-WSRGTWQL.js} +9 -9
- package/dist/chunk-X7CEWD6V.cjs +20 -0
- package/dist/chunk-X7CEWD6V.cjs.map +1 -0
- package/dist/{chunk-I57XLISO.js → chunk-X7LGHPH5.js} +195 -15
- package/dist/chunk-X7LGHPH5.js.map +1 -0
- package/dist/{chunk-5JUTGEZE.js → chunk-XBTZOO74.js} +2 -2
- package/dist/{chunk-RWURXICE.cjs → chunk-XGD6SCHN.cjs} +44 -44
- package/dist/{chunk-RWURXICE.cjs.map → chunk-XGD6SCHN.cjs.map} +1 -1
- package/dist/{chunk-RB6L5EGM.cjs → chunk-XILTWY3L.cjs} +1131 -1131
- package/dist/{chunk-RB6L5EGM.cjs.map → chunk-XILTWY3L.cjs.map} +1 -1
- package/dist/{chunk-EHAYNUOL.cjs → chunk-XOGD2AME.cjs} +3 -3
- package/dist/{chunk-EHAYNUOL.cjs.map → chunk-XOGD2AME.cjs.map} +1 -1
- package/dist/{chunk-IIXB5REN.cjs → chunk-YEXV52L5.cjs} +16 -16
- package/dist/{chunk-IIXB5REN.cjs.map → chunk-YEXV52L5.cjs.map} +1 -1
- package/dist/{chunk-65EVGKFV.cjs → chunk-YQZXCJQL.cjs} +14 -14
- package/dist/{chunk-65EVGKFV.cjs.map → chunk-YQZXCJQL.cjs.map} +1 -1
- package/dist/{chunk-N6HNK25A.cjs → chunk-YWUZL3RT.cjs} +11 -11
- package/dist/{chunk-N6HNK25A.cjs.map → chunk-YWUZL3RT.cjs.map} +1 -1
- package/dist/{chunk-VE52MSYC.js → chunk-Z7UIO5RQ.js} +8 -8
- package/dist/components/calendar.cjs +10 -10
- package/dist/components/calendar.js +2 -2
- package/dist/components/case-studies/index.cjs +30 -30
- package/dist/components/case-studies/index.js +14 -14
- package/dist/components/chat/embeddable-chat.d.ts +1 -1
- package/dist/components/chat/index.cjs +9 -9
- package/dist/components/chat/index.js +8 -8
- package/dist/components/chat/utils/source-row-cta.d.ts +1 -1
- package/dist/components/command.d.ts +7 -7
- package/dist/components/contact/index.cjs +15 -15
- package/dist/components/contact/index.js +14 -14
- package/dist/components/docs/index.cjs +18 -18
- package/dist/components/docs/index.js +17 -17
- package/dist/components/embeds/index.cjs +15 -15
- package/dist/components/embeds/index.js +14 -14
- package/dist/components/faq/index.cjs +16 -16
- package/dist/components/faq/index.js +15 -15
- package/dist/components/features/index.cjs +14 -14
- package/dist/components/features/index.js +13 -13
- package/dist/components/help-center-pages/index.cjs +37 -37
- package/dist/components/help-center-pages/index.js +28 -28
- package/dist/components/icons/index.cjs +3 -3
- package/dist/components/icons/index.js +2 -2
- package/dist/components/index.cjs +115 -115
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +31 -31
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +119 -119
- package/dist/components/meeting-scheduler/index.js +15 -15
- package/dist/components/navigation/index.cjs +17 -17
- package/dist/components/navigation/index.js +16 -16
- package/dist/components/onboarding-guides/index.cjs +18 -18
- package/dist/components/onboarding-guides/index.js +17 -17
- package/dist/components/related-content/index.cjs +10 -10
- package/dist/components/related-content/index.js +9 -9
- package/dist/components/resizable.d.ts +1 -1
- package/dist/components/tickets/index.cjs +19 -19
- package/dist/components/tickets/index.js +18 -18
- package/dist/components/ui/file-manager/index.cjs +57 -57
- package/dist/components/ui/file-manager/index.js +4 -4
- package/dist/components/ui/index.cjs +14 -14
- package/dist/components/ui/index.js +13 -13
- package/dist/contexts/chat-runtime-context.d.ts +1 -1
- package/dist/contexts/index.cjs +2 -2
- package/dist/contexts/index.js +1 -1
- package/dist/hooks/index.cjs +7 -7
- package/dist/hooks/index.js +6 -6
- package/dist/index.cjs +36 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -22
- package/dist/index.js.map +1 -1
- package/dist/platform-domains.cjs +43 -0
- package/dist/platform-domains.cjs.map +1 -1
- package/dist/platform-domains.d.ts +62 -4
- package/dist/platform-domains.d.ts.map +1 -1
- package/dist/platform-domains.js +39 -1
- package/dist/platform-domains.js.map +1 -1
- package/dist/types/index.cjs +0 -104
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +0 -104
- package/dist/types/index.js.map +1 -1
- package/dist/utils/cn.d.ts +0 -21
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/index.cjs +53 -25
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +49 -25
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/platform-domains.test.ts +124 -0
- package/src/components/chat/embeddable-chat.tsx +2 -2
- package/src/components/chat/utils/__tests__/source-row-cta.test.ts +2 -2
- package/src/components/chat/utils/source-row-cta.ts +4 -4
- package/src/components/made-with-love.tsx +2 -2
- package/src/contexts/chat-runtime-context.tsx +1 -1
- package/src/platform-domains.ts +99 -4
- package/src/utils/.cn.md +3 -23
- package/src/utils/cn.ts +0 -47
- package/src/utils/index.ts +9 -2
- package/dist/chunk-23V5BSHD.cjs +0 -169
- package/dist/chunk-23V5BSHD.cjs.map +0 -1
- package/dist/chunk-CBXZSTAG.cjs.map +0 -1
- package/dist/chunk-I57XLISO.js.map +0 -1
- package/dist/chunk-O4MCCKKN.js +0 -169
- package/dist/chunk-O4MCCKKN.js.map +0 -1
- /package/dist/{chunk-FOSIR4QF.js.map → chunk-3DWDJ54N.js.map} +0 -0
- /package/dist/{chunk-3DGRXC74.js.map → chunk-3PGYHT67.js.map} +0 -0
- /package/dist/{chunk-4EEUB62O.js.map → chunk-4HVWGYHI.js.map} +0 -0
- /package/dist/{chunk-G5U4JP45.js.map → chunk-5ONM3FHQ.js.map} +0 -0
- /package/dist/{chunk-PFV4DAX5.js.map → chunk-6PMUA6JW.js.map} +0 -0
- /package/dist/{chunk-KJWPAJRT.js.map → chunk-7EI3NES7.js.map} +0 -0
- /package/dist/{chunk-S2KMNFFN.js.map → chunk-EI3SLIWL.js.map} +0 -0
- /package/dist/{chunk-KEKN76JR.js.map → chunk-FRQ2DE5Z.js.map} +0 -0
- /package/dist/{chunk-JOV64HW5.js.map → chunk-GRBZC5N3.js.map} +0 -0
- /package/dist/{chunk-UEXIMEVU.js.map → chunk-GSNX2GDA.js.map} +0 -0
- /package/dist/{chunk-LPMDCQLL.js.map → chunk-H3EJDISW.js.map} +0 -0
- /package/dist/{chunk-RNMGKAS6.js.map → chunk-HDCIDJSP.js.map} +0 -0
- /package/dist/{chunk-7Q5XXPCB.js.map → chunk-HHE7UNGR.js.map} +0 -0
- /package/dist/{chunk-KOLVBEW5.js.map → chunk-IWISVG4P.js.map} +0 -0
- /package/dist/{chunk-27RD5XTP.js.map → chunk-JZVSQT2V.js.map} +0 -0
- /package/dist/{chunk-F2KBCLUG.js.map → chunk-KKSSA4CS.js.map} +0 -0
- /package/dist/{chunk-MRIOYSXH.js.map → chunk-KYIOOOQY.js.map} +0 -0
- /package/dist/{chunk-FKBM6U43.js.map → chunk-LZLT67PE.js.map} +0 -0
- /package/dist/{chunk-B3Z3RJRW.js.map → chunk-M4AD2PHE.js.map} +0 -0
- /package/dist/{chunk-BVQEU5JB.js.map → chunk-MT5A25AX.js.map} +0 -0
- /package/dist/{chunk-TTVOBWAH.js.map → chunk-MTC6DWVH.js.map} +0 -0
- /package/dist/{chunk-HOGOQA2X.js.map → chunk-R3CH2ASE.js.map} +0 -0
- /package/dist/{chunk-SKABQX44.js.map → chunk-RUC2V3VH.js.map} +0 -0
- /package/dist/{chunk-HPWLIYRL.js.map → chunk-T36DLNMO.js.map} +0 -0
- /package/dist/{chunk-IXD6SHQ6.js.map → chunk-ULJNU46H.js.map} +0 -0
- /package/dist/{chunk-4WVWRFGP.js.map → chunk-WSRGTWQL.js.map} +0 -0
- /package/dist/{chunk-5JUTGEZE.js.map → chunk-XBTZOO74.js.map} +0 -0
- /package/dist/{chunk-VE52MSYC.js.map → chunk-Z7UIO5RQ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-UPKZU6QU.cjs","../src/contexts/chat-runtime-context.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACiCA,8BAA0C;AAgPnC,IAAM,mBAAA,EAAqB,kCAAA,IAAsC,CAAA;AAQjE,SAAS,cAAA,CAAA,EAAqC;AACnD,EAAA,OAAO,+BAAA,kBAA6B,CAAA;AACtC;AAUO,SAAS,sBAAA,CAAA,EAAsC;AACpD,EAAA,MAAM,EAAA,EAAI,+BAAA,kBAA6B,CAAA;AACvC,EAAA,GAAA,CAAI,CAAC,CAAA,EAAG;AACN,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IAMF,CAAA;AAAA,EACF;AACA,EAAA,OAAO,CAAA;AACT;ADnSA;AACA;AACE;AACA;AACA;AACF,kJAAC","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-UPKZU6QU.cjs","sourcesContent":[null,"'use client';\n\n/**\n * Chat runtime context — single seam for embedding the chat panel in a\n * different host (e.g. user1.openframe.ai reverse-proxying API calls\n * under /api/mingo-guide/* to hub.openframe.ai/api/*).\n *\n * Three concerns, one context:\n * 1. API endpoints: chatStreamUrl / approvalToolUrl / commandsUrl /\n * buildListUrl + attachment endpoints + chat-identity. The chat\n * reads them from runtime; hub vs embedded app supply different\n * strings via different providers.\n * 2. Navigation mode + callbacks: 'host' or 'embed' mode. Host wires\n * its own router/docNav via the optional `navigate` callback\n * (plain function, NOT a hook); embed forces new-tab via\n * `defaultContentOrigin` + lib's `resolveExternalNavigation`.\n * 3. Identity context: only `source` (required for localStorage\n * namespacing). The display identity (greeting first-name etc.)\n * comes from the server via `useChatIdentity()` — never injected\n * client-side, so it always matches the server-resolved auth.\n *\n * Sibling of EndpointsRuntimeContext (announcement bar, contact form,\n * access codes). Each runtime stays an independent React context so\n * embedders can opt into either feature without forcing the other.\n *\n * IMPORTANT for embedders: memoize the value passed to\n * `<ChatRuntimeContext.Provider value={...}>` (e.g. via React.useMemo).\n * Every change to its reference identity invalidates downstream\n * `useMemo` consumers (the chat input's slash-commands binding,\n * useNavLink's embed-resolution memo, useDocChat's streamFn factory).\n * The hub's `<HubRuntimeProvider>` already memoizes correctly with\n * stable deps. Embedded apps that build the value inline on each render\n * will pay an avoidable re-render cost across the entire chat tree.\n */\n\nimport { createContext, useContext } from 'react';\n\nimport type { ComposeContentUrl } from '../utils/content-href';\n\n/**\n * Runtime config consumed by the chat panel.\n */\nexport interface ChatRuntime {\n endpoints: {\n /** POST streaming chat. Hub: '/api/docs/chat'. */\n chatStreamUrl: string;\n /** POST agent approve/reject. Hub: '/api/chat/agent/confirm-tool'. */\n approvalToolUrl: string;\n /** Customer-ticket agent endpoints (Help Center). OPTIONAL — when unset,\n * the ticket hooks fall back to the bare hub paths\n * (`/api/chat/agent/{find-ticket,ticket-action,list-engagements}`).\n * Embedders behind a reverse proxy set these to their proxied paths\n * (e.g. `/content/api/chat/agent/...`) so tickets route through the SAME\n * endpoint config + proxy as every other endpoint. */\n findTicketUrl?: string;\n ticketActionUrl?: string;\n listEngagementsUrl?: string;\n /** Ticket live-stream + read-receipt endpoints (Help Center\n * realtime). OPTIONAL — unset → bare hub paths under the DEDICATED\n * ticket surface (`/api/tickets/{stream,read}` — deliberately NOT\n * the chat agent's `/api/chat/agent/*` prefix). Reverse-proxy\n * embedders set their proxied paths. Consumed by\n * `TicketLiveProvider`. The unread summary has NO endpoint — it\n * arrives as `ticket-summary` frames on the stream and in\n * `ticket-read` responses. */\n ticketStreamUrl?: string;\n ticketReadUrl?: string;\n /** GET slash-command catalog. Hub: '/api/docs/commands'. */\n commandsUrl: string;\n /** GET server-side conversation history (`?conversationId=<id>`) — the\n * chat panel's mount-time hydration read against the server transcript\n * store (localStorage keeps only the server-issued conversation id).\n * OPTIONAL — defaults to `<chatStreamUrl>/history`, which is correct for\n * same-origin hosts AND for reverse-proxy embedders (the proxied chat\n * prefix covers it). Set explicitly only when the history route lives\n * elsewhere. */\n chatHistoryUrl?: string;\n /**\n * Conversation-list surface for the SSE/Guide chat — the server-side\n * transcript store exposed as a dialog list:\n * GET `<url>?status=active|archived&cursor=&limit=&search=` → `{ dialogs, nextCursor }`\n * PATCH `<url>/<id>` with `{ title }` (rename) or `{ archived }` (archive / restore)\n * Hub: '/api/docs/chat/conversations'. OPTIONAL and NEVER derived: unset =\n * the Guide adapter has no dialog list and the panel keeps its single-thread\n * UI. Set it to enable the \"Current Chats\" rail / archive / rename in Guide\n * mode (the same UX openframe gets in Mingo mode). Selecting a row hydrates\n * through `chatHistoryUrl`.\n */\n chatConversationsUrl?: string;\n /** GET RAG-search endpoint behind `<DocSearchBar>` (the in-source search\n * bar mounted by `<DocViewer>` / `<DocsHubPage>` when `showAIChat` is on).\n * Hub: '/api/docs/search'. OPTIONAL — falls back to the hub path so\n * same-origin Next.js hosts don't need to set it. Cross-origin embedders\n * set their proxied path so the search bar routes through the same\n * reverse proxy as everything else. Same pattern as `findTicketUrl`. */\n docsSearchUrl?: string;\n /** POST internal-link resolver. The in-source markdown renderer (lib or\n * custom) calls `<DocViewer>`'s `handlers.onResolveLink(href, currentPath)`\n * for relative hrefs like `./getting-started/intro.md` — that callback\n * posts to this URL with `{ link, currentPath, source }` and expects a\n * `ResolveLinkResult` back. Hub: '/api/docs/resolve-link'. OPTIONAL — same\n * fall-back chain as `docsSearchUrl`: prop override → runtime → default. */\n docsResolveLinkUrl?: string;\n /** GET per-platform empty-state config (admin-edited in\n * `/admin/chat-config`): `{ greeting, enabledRagTableIds, suggestedQueries }`.\n * Hub: '/api/docs/empty-state'. OPTIONAL — the in-app (host-mode) chat\n * injects these values as SSR props instead, so it leaves this unset.\n * Cross-origin EMBEDDERS (no server hop) set it to their proxied path\n * (e.g. '/content/api/docs/empty-state') so `<EmbeddableChat>` can fetch\n * the greeting / quick-action chips / RAG-source filter at runtime. When\n * unset, the chat falls back to the explicit `emptyStateGreeting` /\n * `suggestedQueries` / `enabledRagTableIds` props (or in-code defaults). */\n emptyStateUrl?: string;\n /** Build the per-agent display-config URL for an OpenFrame AI agent\n * (Fae/Mingo). OPTIONAL. The returned endpoint MUST be byte-compatible\n * with the empty-state wire shape ({ greeting, suggestedQueries,\n * enabledRagTableIds }). When set AND `EmbeddableChat` receives an\n * `activeAgentSlug` in embed mode, the chat fetches THIS url instead of\n * `emptyStateUrl` to render the selected agent's greeting + suggested\n * prompts (the \"agent mode\" URL override). Hub: `(slug) =>\n * '/api/ai-agents/' + encodeURIComponent(slug)`. */\n aiAgentConfigUrl?: (slug: string) => string;\n /** Build entity-card list URL for a content type + ids. Hub delegates\n * to the rag-table-config registry; embedded app provides its own\n * per-type URL builder against the reverse proxy. Returns null when\n * the type has no list endpoint (caller skips rendering). */\n buildListUrl: (type: string, ids: string[]) => string | null;\n /** Chat-attachment endpoints — added for the v2 attachment feature.\n *\n * Three concerns:\n * - `attachmentUploadUrl` — POSTed by the chat-attachment hook\n * to mint a Supabase signed-upload-URL + HMAC view token.\n * - `attachmentViewUrlPrefix` — embedded in markdown URLs the\n * chat hosts in user message bubbles (`![]()` / `[Attached]`).\n * Stored in chat history; chosen at SEND time. In host mode the\n * relative `/api/storage/view/chat-attachments/` is sufficient\n * (same-origin); embedders supply an absolute hub URL so the\n * browser can fetch cross-origin.\n * - `identityUrl` — GET endpoint the `useChatIdentity` hook\n * hits to learn the `{authTier, source, attachmentsEnabled}`\n * capability bag for the current session. Used beyond chat\n * (tickets / contact form / any embedded surface that needs\n * to identify the proxied customer), so the name has no\n * \"chat\" prefix even though the consuming hook still does. */\n attachmentUploadUrl: string;\n attachmentViewUrlPrefix: string;\n identityUrl: string;\n /** Optional URL prefix for the image proxy (`<prefix>?url=<external>`).\n * When unset, lib's `getProxiedImageUrl` returns the original URL\n * unchanged. Hub default: '/api/image-proxy'. Embedders that don't\n * host an image-proxy route leave this undefined → images load\n * directly cross-origin (CORS-permitting). */\n imageProxyUrlPrefix?: string;\n /** Optional list of hostnames that should bypass the image proxy\n * (rendered direct). Hub uses ['openmsp.ai']; embedders typically\n * leave it unset. Matches the `skipDomains` parameter of\n * `getProxiedImageUrl`. */\n imageProxySkipDomains?: string[];\n /** Optional base URL for the branded og-placeholder image route — the\n * DEFAULT cover-image fallback for entity cards with no image. The lib\n * appends `?title=…` (+ `w`/`h` for square slots) itself, so this is\n * the base, NOT a full URL: relative (`/api/og-placeholder`) for same-\n * origin hosts, or the proxied path (`/content/api/og-placeholder`) for\n * cross-origin embedders. May carry baked-in query params (preserved when\n * the lib layers `title`/dimensions on top) — but per-platform brand\n * colors are NO LONGER baked here; the `/api/og-placeholder` route\n * resolves them server-side from the platform. Most hosts leave this unset\n * and let the lib derive the base from `imageProxyUrlPrefix`.\n *\n * OPTIONAL — when unset the lib derives the base from the sibling\n * `imageProxyUrlPrefix` (same API base, route name swapped), then falls\n * back to the relative `/api/og-placeholder`. So an embedder that already\n * proxies images needs NO og-placeholder wiring. See\n * `resolveOgPlaceholderBase` / `buildOgPlaceholderUrl` in `../utils`. */\n ogPlaceholderUrl?: string;\n /** Base URL prefix for the captions route (`/api/captions` — the native\n * `<track>` VTT endpoint every video surface uses since captions stopped\n * being burned into video pixels). Plain path base, no query params.\n * Embedders point it at their proxied route (e.g. `/content/api/captions`);\n * unset ⇒ the same-origin relative `/api/captions` (the hub). Consumed via\n * `getEntityCaptionUrls` / `rebaseCaptionsUrl` in\n * `components/features/captions-url.ts`. */\n captionsUrlPrefix?: string;\n /** Supabase storage origin (e.g. `https://xyz.supabase.co`) — used\n * by `useVideoWarmup` to scope the `<link rel=\"preload\" as=\"video\">`\n * hint to MP4s the deployment actually hosts. Hub wires it via\n * `getSupabaseStorageOrigin()`; embedders without a Supabase\n * storage origin leave it unset (preload is then skipped; Mux/\n * YouTube preconnect still fires). */\n supabaseStorageOrigin?: string;\n };\n navigation: {\n /** ONE knob, two behaviors:\n * - 'host' = use the host page's existing click-routing untouched.\n * The chat panel calls `navigate?.()` for in-app routing.\n * - 'embed' = guest inside another app: short-circuit at the top\n * of click handlers to force new-tab + absolutize via\n * resolveExternalNavigation. */\n mode: 'host' | 'embed';\n /** Embed-only fallback origin for relative URLs whose target platform\n * can't be inferred. Used by resolveExternalNavigation when\n * `targetPlatform` is null — without this, a relative `/foo` href would\n * window.open against the embedder's origin, which is WRONG.\n * Set to your content host (e.g. 'https://hub.openframe.ai').\n * Required by the embedded app whenever mode='embed'. */\n defaultContentOrigin?: string;\n /** Override for opening external URLs. MUST BE SYNCHRONOUS —\n * Safari/Firefox block popups opened outside a direct user gesture.\n * Default: window.open(href, '_blank', 'noopener,noreferrer'). */\n openExternal?: (href: string) => void;\n /** Optional in-app navigation callback (host-mode only).\n * Returns `true` if the host handled the click in-app\n * (router.push + docNav.navigate); returns `false`, `undefined`,\n * or `void` → lib falls back to window.location.assign(href).\n * Hub wires this via HubRuntimeProvider's HubNavigationWiring;\n * embedders not in Next.js leave it undefined. */\n navigate?: (input: { href: string; path?: string | null; targetPlatform?: string | null }) => boolean | void;\n /** Optional new-tab decision callback. Returns true → lib opens in\n * new tab; false → same tab via `navigate`. Hub wires the existing\n * `decideNewTab` logic from use-nav-link.tsx (re-imports the pure\n * helper from lib). Embedders may omit; lib defaults to:\n * same-origin/same-platform → same tab, else new tab. */\n decideNewTab?: (args: { href: string; targetPlatform?: string | null }) => boolean;\n };\n /** Optional content-URL composer. Returns the platform-aware href +\n * target-platform tuple for a content entity. Hub wires this to its\n * `buildContentURL(type, slug, extractPrimaryPlatform(platforms))`\n * pipeline so the lib catalog/detail views can derive cross-\n * platform hrefs without knowing the hub's platform topology\n * (openmsp.ai / openframe.app / flamingo.run / tmcg).\n *\n * THE single content-href authority for every embeddable surface — page\n * views (onboarding catalog/detail, releases) AND chat cards / chips /\n * search results all resolve content links through this one seam, so a\n * given type lands in the SAME place regardless of where it's rendered.\n * Embedders wire `makeComposeContentUrl({ hostedTypes, contentOrigin })`;\n * omit it and lib views fall back to a same-origin relative path\n * (`buildDefaultHref`).\n *\n * Takes a single `ComposeContentUrlInput`: `type` + `identifier` (page\n * views pass the slug; chat rows pass the id + `externalUrl`, whose path\n * yields the slug for in-app routing) + optional `platforms` /\n * `externalUrl` / `targetPlatform`. */\n composeContentUrl?: ComposeContentUrl;\n /** Per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC replacement for\n * the single `chipBasePlatform` prop. Maps a doc-table documentType\n * (`'markdown'`, `'data_room_doc'`, …) → `{ platform, basePath }` for the PUBLIC\n * doc viewer that hosts it. Doc chips with no `externalUrl` resolve PER ROW to\n * `getBaseUrl(platform)/<basePath>/<path>`, so a chat mixing several doc sources\n * sends EACH to its own home (markdown→flamingo/knowledge-base,\n * data_room_doc→company-hub/data-room) instead of one static fallback. The hub\n * may keep using `chipBasePlatform` (one doc source per platform); embedders that\n * surface multiple doc sources wire this. Threaded into `resolveSourceRowCTA`. */\n docPlatformTargets?: Record<string, { platform: string; basePath: string }>;\n /** Chat source / platform identifier — OPTIONAL. The hub sets it from\n * `currentPlatform()`; EMBEDDERS leave it unset and stay platform-agnostic.\n *\n * It is NOT required for chat to work. The wire resolves source server-side\n * (`/docs/chat|search|commands` reject any client `source`); the\n * same-tab-vs-new-tab link decision falls back to an origin comparison when\n * it's absent (`decideNewTab` → `isCrossOriginUrl`); and the localStorage\n * history namespace falls back to a stable constant. Set it only where the\n * client legitimately needs to know its platform a priori — i.e. the hub,\n * where several platforms share related origins so \"same platform\" can't be\n * inferred from a URL alone. */\n source?: string;\n // NOTE: No `user` field. The chat's display identity (greeting\n // first-name, etc.) comes from the SERVER-resolved auth via\n // `useChatIdentity()` — the same identity the server uses to\n // authorize requests. Letting embedders pass a client-side `user`\n // would let it desync from the actual auth tier, causing greetings\n // like \"Hey Bob\" while the server treats the session as\n // alice@example.com. Single source of truth: the server.\n}\n\nexport const ChatRuntimeContext = createContext<ChatRuntime | null>(null);\n\n/**\n * Returns the active runtime, or null when no provider is mounted.\n * NULL is a first-class value — it signals \"no chat runtime configured.\"\n * Optional consumers fall back to no-op behavior; strict consumers\n * use `useRequiredChatRuntime` (below).\n */\nexport function useChatRuntime(): ChatRuntime | null {\n return useContext(ChatRuntimeContext);\n}\n\n/**\n * Strict variant used INSIDE the chat panel. Throws if no provider.\n * The hub guarantees one exists by mounting `<HubRuntimeProvider>` at\n * root; the embedded app mounts its own `<ChatRuntimeContext.Provider>`\n * at the tree root. In Jest / Storybook tests that render chat\n * internals directly, wrap with `<HubRuntimeProvider>` (hub defaults)\n * or supply `<ChatRuntimeContext.Provider value={mockedRuntime}>`.\n */\nexport function useRequiredChatRuntime(): ChatRuntime {\n const v = useContext(ChatRuntimeContext);\n if (!v) {\n throw new Error(\n '[chat-runtime] hook called outside a <ChatRuntimeContext.Provider>. ' +\n 'The hub mounts <HubRuntimeProvider> at root — this only fires when ' +\n 'chat internals are rendered above the provider tree. ' +\n 'Fix: ensure the rendering subtree descends from the runtime provider. ' +\n 'In tests/Storybook: wrap with <HubRuntimeProvider> or supply ' +\n 'a <ChatRuntimeContext.Provider value={mockedRuntime}>.',\n );\n }\n return v;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-U2YLMFJK.cjs","../src/contexts/chat-runtime-context.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACiCA,8BAA0C;AAgPnC,IAAM,mBAAA,EAAqB,kCAAA,IAAsC,CAAA;AAQjE,SAAS,cAAA,CAAA,EAAqC;AACnD,EAAA,OAAO,+BAAA,kBAA6B,CAAA;AACtC;AAUO,SAAS,sBAAA,CAAA,EAAsC;AACpD,EAAA,MAAM,EAAA,EAAI,+BAAA,kBAA6B,CAAA;AACvC,EAAA,GAAA,CAAI,CAAC,CAAA,EAAG;AACN,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,IAMF,CAAA;AAAA,EACF;AACA,EAAA,OAAO,CAAA;AACT;ADnSA;AACA;AACE;AACA;AACA;AACF,kJAAC","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-U2YLMFJK.cjs","sourcesContent":[null,"'use client';\n\n/**\n * Chat runtime context — single seam for embedding the chat panel in a\n * different host (e.g. user1.openframe.ai reverse-proxying API calls\n * under /api/mingo-guide/* to hub.openframe.ai/api/*).\n *\n * Three concerns, one context:\n * 1. API endpoints: chatStreamUrl / approvalToolUrl / commandsUrl /\n * buildListUrl + attachment endpoints + chat-identity. The chat\n * reads them from runtime; hub vs embedded app supply different\n * strings via different providers.\n * 2. Navigation mode + callbacks: 'host' or 'embed' mode. Host wires\n * its own router/docNav via the optional `navigate` callback\n * (plain function, NOT a hook); embed forces new-tab via\n * `defaultContentOrigin` + lib's `resolveExternalNavigation`.\n * 3. Identity context: only `source` (required for localStorage\n * namespacing). The display identity (greeting first-name etc.)\n * comes from the server via `useChatIdentity()` — never injected\n * client-side, so it always matches the server-resolved auth.\n *\n * Sibling of EndpointsRuntimeContext (announcement bar, contact form,\n * access codes). Each runtime stays an independent React context so\n * embedders can opt into either feature without forcing the other.\n *\n * IMPORTANT for embedders: memoize the value passed to\n * `<ChatRuntimeContext.Provider value={...}>` (e.g. via React.useMemo).\n * Every change to its reference identity invalidates downstream\n * `useMemo` consumers (the chat input's slash-commands binding,\n * useNavLink's embed-resolution memo, useDocChat's streamFn factory).\n * The hub's `<HubRuntimeProvider>` already memoizes correctly with\n * stable deps. Embedded apps that build the value inline on each render\n * will pay an avoidable re-render cost across the entire chat tree.\n */\n\nimport { createContext, useContext } from 'react';\n\nimport type { ComposeContentUrl } from '../utils/content-href';\n\n/**\n * Runtime config consumed by the chat panel.\n */\nexport interface ChatRuntime {\n endpoints: {\n /** POST streaming chat. Hub: '/api/docs/chat'. */\n chatStreamUrl: string;\n /** POST agent approve/reject. Hub: '/api/chat/agent/confirm-tool'. */\n approvalToolUrl: string;\n /** Customer-ticket agent endpoints (Help Center). OPTIONAL — when unset,\n * the ticket hooks fall back to the bare hub paths\n * (`/api/chat/agent/{find-ticket,ticket-action,list-engagements}`).\n * Embedders behind a reverse proxy set these to their proxied paths\n * (e.g. `/content/api/chat/agent/...`) so tickets route through the SAME\n * endpoint config + proxy as every other endpoint. */\n findTicketUrl?: string;\n ticketActionUrl?: string;\n listEngagementsUrl?: string;\n /** Ticket live-stream + read-receipt endpoints (Help Center\n * realtime). OPTIONAL — unset → bare hub paths under the DEDICATED\n * ticket surface (`/api/tickets/{stream,read}` — deliberately NOT\n * the chat agent's `/api/chat/agent/*` prefix). Reverse-proxy\n * embedders set their proxied paths. Consumed by\n * `TicketLiveProvider`. The unread summary has NO endpoint — it\n * arrives as `ticket-summary` frames on the stream and in\n * `ticket-read` responses. */\n ticketStreamUrl?: string;\n ticketReadUrl?: string;\n /** GET slash-command catalog. Hub: '/api/docs/commands'. */\n commandsUrl: string;\n /** GET server-side conversation history (`?conversationId=<id>`) — the\n * chat panel's mount-time hydration read against the server transcript\n * store (localStorage keeps only the server-issued conversation id).\n * OPTIONAL — defaults to `<chatStreamUrl>/history`, which is correct for\n * same-origin hosts AND for reverse-proxy embedders (the proxied chat\n * prefix covers it). Set explicitly only when the history route lives\n * elsewhere. */\n chatHistoryUrl?: string;\n /**\n * Conversation-list surface for the SSE/Guide chat — the server-side\n * transcript store exposed as a dialog list:\n * GET `<url>?status=active|archived&cursor=&limit=&search=` → `{ dialogs, nextCursor }`\n * PATCH `<url>/<id>` with `{ title }` (rename) or `{ archived }` (archive / restore)\n * Hub: '/api/docs/chat/conversations'. OPTIONAL and NEVER derived: unset =\n * the Guide adapter has no dialog list and the panel keeps its single-thread\n * UI. Set it to enable the \"Current Chats\" rail / archive / rename in Guide\n * mode (the same UX openframe gets in Mingo mode). Selecting a row hydrates\n * through `chatHistoryUrl`.\n */\n chatConversationsUrl?: string;\n /** GET RAG-search endpoint behind `<DocSearchBar>` (the in-source search\n * bar mounted by `<DocViewer>` / `<DocsHubPage>` when `showAIChat` is on).\n * Hub: '/api/docs/search'. OPTIONAL — falls back to the hub path so\n * same-origin Next.js hosts don't need to set it. Cross-origin embedders\n * set their proxied path so the search bar routes through the same\n * reverse proxy as everything else. Same pattern as `findTicketUrl`. */\n docsSearchUrl?: string;\n /** POST internal-link resolver. The in-source markdown renderer (lib or\n * custom) calls `<DocViewer>`'s `handlers.onResolveLink(href, currentPath)`\n * for relative hrefs like `./getting-started/intro.md` — that callback\n * posts to this URL with `{ link, currentPath, source }` and expects a\n * `ResolveLinkResult` back. Hub: '/api/docs/resolve-link'. OPTIONAL — same\n * fall-back chain as `docsSearchUrl`: prop override → runtime → default. */\n docsResolveLinkUrl?: string;\n /** GET per-platform empty-state config (admin-edited in\n * `/admin/chat-config`): `{ greeting, enabledRagTableIds, suggestedQueries }`.\n * Hub: '/api/docs/empty-state'. OPTIONAL — the in-app (host-mode) chat\n * injects these values as SSR props instead, so it leaves this unset.\n * Cross-origin EMBEDDERS (no server hop) set it to their proxied path\n * (e.g. '/content/api/docs/empty-state') so `<EmbeddableChat>` can fetch\n * the greeting / quick-action chips / RAG-source filter at runtime. When\n * unset, the chat falls back to the explicit `emptyStateGreeting` /\n * `suggestedQueries` / `enabledRagTableIds` props (or in-code defaults). */\n emptyStateUrl?: string;\n /** Build the per-agent display-config URL for an OpenFrame AI agent\n * (Fae/Mingo). OPTIONAL. The returned endpoint MUST be byte-compatible\n * with the empty-state wire shape ({ greeting, suggestedQueries,\n * enabledRagTableIds }). When set AND `EmbeddableChat` receives an\n * `activeAgentSlug` in embed mode, the chat fetches THIS url instead of\n * `emptyStateUrl` to render the selected agent's greeting + suggested\n * prompts (the \"agent mode\" URL override). Hub: `(slug) =>\n * '/api/ai-agents/' + encodeURIComponent(slug)`. */\n aiAgentConfigUrl?: (slug: string) => string;\n /** Build entity-card list URL for a content type + ids. Hub delegates\n * to the rag-table-config registry; embedded app provides its own\n * per-type URL builder against the reverse proxy. Returns null when\n * the type has no list endpoint (caller skips rendering). */\n buildListUrl: (type: string, ids: string[]) => string | null;\n /** Chat-attachment endpoints — added for the v2 attachment feature.\n *\n * Three concerns:\n * - `attachmentUploadUrl` — POSTed by the chat-attachment hook\n * to mint a Supabase signed-upload-URL + HMAC view token.\n * - `attachmentViewUrlPrefix` — embedded in markdown URLs the\n * chat hosts in user message bubbles (`![]()` / `[Attached]`).\n * Stored in chat history; chosen at SEND time. In host mode the\n * relative `/api/storage/view/chat-attachments/` is sufficient\n * (same-origin); embedders supply an absolute hub URL so the\n * browser can fetch cross-origin.\n * - `identityUrl` — GET endpoint the `useChatIdentity` hook\n * hits to learn the `{authTier, source, attachmentsEnabled}`\n * capability bag for the current session. Used beyond chat\n * (tickets / contact form / any embedded surface that needs\n * to identify the proxied customer), so the name has no\n * \"chat\" prefix even though the consuming hook still does. */\n attachmentUploadUrl: string;\n attachmentViewUrlPrefix: string;\n identityUrl: string;\n /** Optional URL prefix for the image proxy (`<prefix>?url=<external>`).\n * When unset, lib's `getProxiedImageUrl` returns the original URL\n * unchanged. Hub default: '/api/image-proxy'. Embedders that don't\n * host an image-proxy route leave this undefined → images load\n * directly cross-origin (CORS-permitting). */\n imageProxyUrlPrefix?: string;\n /** Optional list of hostnames that should bypass the image proxy\n * (rendered direct). Hub uses ['openmsp.ai']; embedders typically\n * leave it unset. Matches the `skipDomains` parameter of\n * `getProxiedImageUrl`. */\n imageProxySkipDomains?: string[];\n /** Optional base URL for the branded og-placeholder image route — the\n * DEFAULT cover-image fallback for entity cards with no image. The lib\n * appends `?title=…` (+ `w`/`h` for square slots) itself, so this is\n * the base, NOT a full URL: relative (`/api/og-placeholder`) for same-\n * origin hosts, or the proxied path (`/content/api/og-placeholder`) for\n * cross-origin embedders. May carry baked-in query params (preserved when\n * the lib layers `title`/dimensions on top) — but per-platform brand\n * colors are NO LONGER baked here; the `/api/og-placeholder` route\n * resolves them server-side from the platform. Most hosts leave this unset\n * and let the lib derive the base from `imageProxyUrlPrefix`.\n *\n * OPTIONAL — when unset the lib derives the base from the sibling\n * `imageProxyUrlPrefix` (same API base, route name swapped), then falls\n * back to the relative `/api/og-placeholder`. So an embedder that already\n * proxies images needs NO og-placeholder wiring. See\n * `resolveOgPlaceholderBase` / `buildOgPlaceholderUrl` in `../utils`. */\n ogPlaceholderUrl?: string;\n /** Base URL prefix for the captions route (`/api/captions` — the native\n * `<track>` VTT endpoint every video surface uses since captions stopped\n * being burned into video pixels). Plain path base, no query params.\n * Embedders point it at their proxied route (e.g. `/content/api/captions`);\n * unset ⇒ the same-origin relative `/api/captions` (the hub). Consumed via\n * `getEntityCaptionUrls` / `rebaseCaptionsUrl` in\n * `components/features/captions-url.ts`. */\n captionsUrlPrefix?: string;\n /** Supabase storage origin (e.g. `https://xyz.supabase.co`) — used\n * by `useVideoWarmup` to scope the `<link rel=\"preload\" as=\"video\">`\n * hint to MP4s the deployment actually hosts. Hub wires it via\n * `getSupabaseStorageOrigin()`; embedders without a Supabase\n * storage origin leave it unset (preload is then skipped; Mux/\n * YouTube preconnect still fires). */\n supabaseStorageOrigin?: string;\n };\n navigation: {\n /** ONE knob, two behaviors:\n * - 'host' = use the host page's existing click-routing untouched.\n * The chat panel calls `navigate?.()` for in-app routing.\n * - 'embed' = guest inside another app: short-circuit at the top\n * of click handlers to force new-tab + absolutize via\n * resolveExternalNavigation. */\n mode: 'host' | 'embed';\n /** Embed-only fallback origin for relative URLs whose target platform\n * can't be inferred. Used by resolveExternalNavigation when\n * `targetPlatform` is null — without this, a relative `/foo` href would\n * window.open against the embedder's origin, which is WRONG.\n * Set to your content host (e.g. 'https://hub.openframe.ai').\n * Required by the embedded app whenever mode='embed'. */\n defaultContentOrigin?: string;\n /** Override for opening external URLs. MUST BE SYNCHRONOUS —\n * Safari/Firefox block popups opened outside a direct user gesture.\n * Default: window.open(href, '_blank', 'noopener,noreferrer'). */\n openExternal?: (href: string) => void;\n /** Optional in-app navigation callback (host-mode only).\n * Returns `true` if the host handled the click in-app\n * (router.push + docNav.navigate); returns `false`, `undefined`,\n * or `void` → lib falls back to window.location.assign(href).\n * Hub wires this via HubRuntimeProvider's HubNavigationWiring;\n * embedders not in Next.js leave it undefined. */\n navigate?: (input: { href: string; path?: string | null; targetPlatform?: string | null }) => boolean | void;\n /** Optional new-tab decision callback. Returns true → lib opens in\n * new tab; false → same tab via `navigate`. Hub wires the existing\n * `decideNewTab` logic from use-nav-link.tsx (re-imports the pure\n * helper from lib). Embedders may omit; lib defaults to:\n * same-origin/same-platform → same tab, else new tab. */\n decideNewTab?: (args: { href: string; targetPlatform?: string | null }) => boolean;\n };\n /** Optional content-URL composer. Returns the platform-aware href +\n * target-platform tuple for a content entity. Hub wires this to its\n * `buildContentURL(type, slug, extractPrimaryPlatform(platforms))`\n * pipeline so the lib catalog/detail views can derive cross-\n * platform hrefs without knowing the hub's platform topology\n * (openmsp.ai / openframe.app / flamingo.run / tmcg).\n *\n * THE single content-href authority for every embeddable surface — page\n * views (onboarding catalog/detail, releases) AND chat cards / chips /\n * search results all resolve content links through this one seam, so a\n * given type lands in the SAME place regardless of where it's rendered.\n * Embedders wire `makeComposeContentUrl({ hostedTypes, contentOrigin })`;\n * omit it and lib views fall back to a same-origin relative path\n * (`buildDefaultHref`).\n *\n * Takes a single `ComposeContentUrlInput`: `type` + `identifier` (page\n * views pass the slug; chat rows pass the id + `externalUrl`, whose path\n * yields the slug for in-app routing) + optional `platforms` /\n * `externalUrl` / `targetPlatform`. */\n composeContentUrl?: ComposeContentUrl;\n /** Per-`documentType` doc-viewer targets — the UNIFIED, DYNAMIC replacement for\n * the single `chipBasePlatform` prop. Maps a doc-table documentType\n * (`'markdown'`, `'data_room_doc'`, …) → `{ platform, basePath }` for the PUBLIC\n * doc viewer that hosts it. Doc chips with no `externalUrl` resolve PER ROW to\n * `getPlatformUrl(platform)/<basePath>/<path>`, so a chat mixing several doc sources\n * sends EACH to its own home (markdown→flamingo/knowledge-base,\n * data_room_doc→company-hub/data-room) instead of one static fallback. The hub\n * may keep using `chipBasePlatform` (one doc source per platform); embedders that\n * surface multiple doc sources wire this. Threaded into `resolveSourceRowCTA`. */\n docPlatformTargets?: Record<string, { platform: string; basePath: string }>;\n /** Chat source / platform identifier — OPTIONAL. The hub sets it from\n * `currentPlatform()`; EMBEDDERS leave it unset and stay platform-agnostic.\n *\n * It is NOT required for chat to work. The wire resolves source server-side\n * (`/docs/chat|search|commands` reject any client `source`); the\n * same-tab-vs-new-tab link decision falls back to an origin comparison when\n * it's absent (`decideNewTab` → `isCrossOriginUrl`); and the localStorage\n * history namespace falls back to a stable constant. Set it only where the\n * client legitimately needs to know its platform a priori — i.e. the hub,\n * where several platforms share related origins so \"same platform\" can't be\n * inferred from a URL alone. */\n source?: string;\n // NOTE: No `user` field. The chat's display identity (greeting\n // first-name, etc.) comes from the SERVER-resolved auth via\n // `useChatIdentity()` — the same identity the server uses to\n // authorize requests. Letting embedders pass a client-side `user`\n // would let it desync from the actual auth tier, causing greetings\n // like \"Hey Bob\" while the server treats the session as\n // alice@example.com. Single source of truth: the server.\n}\n\nexport const ChatRuntimeContext = createContext<ChatRuntime | null>(null);\n\n/**\n * Returns the active runtime, or null when no provider is mounted.\n * NULL is a first-class value — it signals \"no chat runtime configured.\"\n * Optional consumers fall back to no-op behavior; strict consumers\n * use `useRequiredChatRuntime` (below).\n */\nexport function useChatRuntime(): ChatRuntime | null {\n return useContext(ChatRuntimeContext);\n}\n\n/**\n * Strict variant used INSIDE the chat panel. Throws if no provider.\n * The hub guarantees one exists by mounting `<HubRuntimeProvider>` at\n * root; the embedded app mounts its own `<ChatRuntimeContext.Provider>`\n * at the tree root. In Jest / Storybook tests that render chat\n * internals directly, wrap with `<HubRuntimeProvider>` (hub defaults)\n * or supply `<ChatRuntimeContext.Provider value={mockedRuntime}>`.\n */\nexport function useRequiredChatRuntime(): ChatRuntime {\n const v = useContext(ChatRuntimeContext);\n if (!v) {\n throw new Error(\n '[chat-runtime] hook called outside a <ChatRuntimeContext.Provider>. ' +\n 'The hub mounts <HubRuntimeProvider> at root — this only fires when ' +\n 'chat internals are rendered above the provider tree. ' +\n 'Fix: ensure the rendering subtree descends from the runtime provider. ' +\n 'In tests/Storybook: wrap with <HubRuntimeProvider> or supply ' +\n 'a <ChatRuntimeContext.Provider value={mockedRuntime}>.',\n );\n }\n return v;\n}\n"]}
|
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkXILTWY3Lcjs = require('./chunk-XILTWY3L.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkJH5P72AFcjs = require('./chunk-JH5P72AF.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkYWUZL3RTcjs = require('./chunk-YWUZL3RT.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _chunk3J7YNAYIcjs = require('./chunk-3J7YNAYI.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkGSD62VAYcjs = require('./chunk-GSD62VAY.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkF6U2H42Lcjs = require('./chunk-F6U2H42L.cjs');
|
|
32
32
|
|
|
33
33
|
// src/components/contact/contact-form.tsx
|
|
34
34
|
var _zod = require('@hookform/resolvers/zod');
|
|
@@ -110,14 +110,14 @@ function ContactForm({
|
|
|
110
110
|
successRedirectUrl = "/blog#community",
|
|
111
111
|
successToastMessage = "Redirecting you to join our community..."
|
|
112
112
|
} = {}) {
|
|
113
|
-
const attachments =
|
|
114
|
-
const builtInSubmission =
|
|
113
|
+
const attachments = _chunk3J7YNAYIcjs.useChatAttachments.call(void 0, );
|
|
114
|
+
const builtInSubmission = _chunkJH5P72AFcjs.useContactSubmission.call(void 0, {
|
|
115
115
|
userId,
|
|
116
116
|
successRedirectUrl,
|
|
117
117
|
successToastMessage
|
|
118
118
|
});
|
|
119
119
|
const [customSubmitting, setCustomSubmitting] = _react.useState.call(void 0, false);
|
|
120
|
-
const { honeypotInputProps, getSignals, resetSignals } =
|
|
120
|
+
const { honeypotInputProps, getSignals, resetSignals } = _chunkJH5P72AFcjs.useHumanitySignals.call(void 0, );
|
|
121
121
|
const isSubmitting = onCustomSubmit ? customSubmitting : builtInSubmission.isSubmitting;
|
|
122
122
|
const isSuccess = onCustomSubmit ? false : builtInSubmission.isSuccess;
|
|
123
123
|
const {
|
|
@@ -172,7 +172,7 @@ function ContactForm({
|
|
|
172
172
|
className: `flex h-full flex-col ${!noBorder ? "rounded-2xl border border-ods-border md:rounded-3xl" : ""} ${!noPadding ? "p-6 md:p-8 lg:p-10" : ""}`,
|
|
173
173
|
children: [
|
|
174
174
|
(title || subtitle) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-6 md:mb-8", children: [
|
|
175
|
-
title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: `${
|
|
175
|
+
title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: `${_chunk3J7YNAYIcjs.SECTION_HEADING_CLASS} mb-3 md:mb-4`, children: title }),
|
|
176
176
|
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-primary text-h4", children: subtitle })
|
|
177
177
|
] }),
|
|
178
178
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -185,22 +185,22 @@ function ContactForm({
|
|
|
185
185
|
);
|
|
186
186
|
}),
|
|
187
187
|
className: "flex flex-grow flex-col space-y-4 md:space-y-6",
|
|
188
|
-
...
|
|
188
|
+
..._chunkXILTWY3Lcjs.HUBSPOT_DO_NOT_COLLECT_FORM_PROPS,
|
|
189
189
|
children: [
|
|
190
190
|
!showName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("name") }),
|
|
191
191
|
!showEmail && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("email") }),
|
|
192
192
|
!showHelpCategory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("helpCategory") }),
|
|
193
193
|
!showMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("message") }),
|
|
194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.HoneypotField, { ...honeypotInputProps }),
|
|
195
195
|
extraTopField,
|
|
196
196
|
showNameEmailRow && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6", children: [
|
|
197
197
|
showName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
198
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
198
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "name", children: [
|
|
199
199
|
"Your Name",
|
|
200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
200
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYWUZL3RTcjs.RequiredMark, {})
|
|
201
201
|
] }),
|
|
202
202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
203
|
-
|
|
203
|
+
_chunkYWUZL3RTcjs.Input,
|
|
204
204
|
{
|
|
205
205
|
id: "name",
|
|
206
206
|
type: "text",
|
|
@@ -215,12 +215,12 @@ function ContactForm({
|
|
|
215
215
|
errors.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "name-error", className: "mt-1 text-ods-error text-h6", children: errors.name.message })
|
|
216
216
|
] }),
|
|
217
217
|
showEmail && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
218
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
218
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "email", children: [
|
|
219
219
|
"Email",
|
|
220
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYWUZL3RTcjs.RequiredMark, {})
|
|
221
221
|
] }),
|
|
222
222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
223
|
-
|
|
223
|
+
_chunkYWUZL3RTcjs.Input,
|
|
224
224
|
{
|
|
225
225
|
id: "email",
|
|
226
226
|
type: "email",
|
|
@@ -237,46 +237,46 @@ function ContactForm({
|
|
|
237
237
|
] }),
|
|
238
238
|
(showCompanySize || showReferralSource) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6", children: [
|
|
239
239
|
showCompanySize && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
240
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "companySize", children: "Company Size" }),
|
|
241
241
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
242
|
_reacthookform.Controller,
|
|
243
243
|
{
|
|
244
244
|
control,
|
|
245
245
|
name: "companySize",
|
|
246
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
246
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXILTWY3Lcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
247
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
248
|
-
|
|
248
|
+
_chunkXILTWY3Lcjs.SelectTrigger,
|
|
249
249
|
{
|
|
250
250
|
id: "companySize",
|
|
251
251
|
"aria-label": "Company Size",
|
|
252
252
|
className: "h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary",
|
|
253
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
253
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectValue, { placeholder: "Select company size" })
|
|
254
254
|
}
|
|
255
255
|
),
|
|
256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectContent, { children: companySizeOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
257
257
|
] })
|
|
258
258
|
}
|
|
259
259
|
),
|
|
260
260
|
errors.companySize && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "companySize-error", className: "mt-1 text-ods-error text-h6", children: errors.companySize.message })
|
|
261
261
|
] }),
|
|
262
262
|
showReferralSource && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
263
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
263
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "referralSource", children: "How did you hear about us?" }),
|
|
264
264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
265
265
|
_reacthookform.Controller,
|
|
266
266
|
{
|
|
267
267
|
control,
|
|
268
268
|
name: "referralSource",
|
|
269
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
269
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXILTWY3Lcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
270
270
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
271
|
-
|
|
271
|
+
_chunkXILTWY3Lcjs.SelectTrigger,
|
|
272
272
|
{
|
|
273
273
|
id: "referralSource",
|
|
274
274
|
"aria-label": "Referral Source",
|
|
275
275
|
className: "h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary",
|
|
276
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectValue, { placeholder: "Select an option" })
|
|
277
277
|
}
|
|
278
278
|
),
|
|
279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectContent, { children: referralSourceOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
280
280
|
] })
|
|
281
281
|
}
|
|
282
282
|
),
|
|
@@ -284,39 +284,39 @@ function ContactForm({
|
|
|
284
284
|
] })
|
|
285
285
|
] }),
|
|
286
286
|
showHelpCategory && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
287
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
287
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "helpCategory", children: [
|
|
288
288
|
"Choose your main interest",
|
|
289
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYWUZL3RTcjs.RequiredMark, {})
|
|
290
290
|
] }),
|
|
291
291
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
292
292
|
_reacthookform.Controller,
|
|
293
293
|
{
|
|
294
294
|
control,
|
|
295
295
|
name: "helpCategory",
|
|
296
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
296
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXILTWY3Lcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
297
297
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
298
|
-
|
|
298
|
+
_chunkXILTWY3Lcjs.SelectTrigger,
|
|
299
299
|
{
|
|
300
300
|
id: "helpCategory",
|
|
301
301
|
"aria-label": "Help Category",
|
|
302
302
|
"aria-required": true,
|
|
303
303
|
className: "h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary",
|
|
304
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
304
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectValue, { placeholder: "Choose your main interest" })
|
|
305
305
|
}
|
|
306
306
|
),
|
|
307
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
307
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectContent, { children: helpCategoryOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXILTWY3Lcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
308
308
|
] })
|
|
309
309
|
}
|
|
310
310
|
),
|
|
311
311
|
errors.helpCategory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "helpCategory-error", className: "mt-1 text-ods-error text-h6", children: errors.helpCategory.message })
|
|
312
312
|
] }),
|
|
313
313
|
showMessage && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-grow flex-col", children: [
|
|
314
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
314
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGSD62VAYcjs.Label, { htmlFor: "message", children: [
|
|
315
315
|
"Your Message",
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYWUZL3RTcjs.RequiredMark, {})
|
|
317
317
|
] }),
|
|
318
318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
319
|
-
|
|
319
|
+
_chunkXILTWY3Lcjs.Textarea,
|
|
320
320
|
{
|
|
321
321
|
id: "message",
|
|
322
322
|
...register("message"),
|
|
@@ -331,7 +331,7 @@ function ContactForm({
|
|
|
331
331
|
] }),
|
|
332
332
|
attachmentsEnabled && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2", children: [
|
|
333
333
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
334
|
-
|
|
334
|
+
_chunk3J7YNAYIcjs.ChatAttachmentChipStrip,
|
|
335
335
|
{
|
|
336
336
|
attachments: attachments.attachments,
|
|
337
337
|
onRemove: attachments.removeAttachment,
|
|
@@ -340,7 +340,7 @@ function ContactForm({
|
|
|
340
340
|
),
|
|
341
341
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
342
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
343
|
-
|
|
343
|
+
_chunk3J7YNAYIcjs.ChatAttachmentAddButton,
|
|
344
344
|
{
|
|
345
345
|
attachmentsEnabled: true,
|
|
346
346
|
attachmentsCount: attachments.attachments.length,
|
|
@@ -354,7 +354,7 @@ function ContactForm({
|
|
|
354
354
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-auto flex w-full flex-col items-center justify-end gap-4 pt-2 md:flex-row md:gap-6", children: [
|
|
355
355
|
footerText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-ods-text-secondary text-h6 md:text-left", children: footerText }),
|
|
356
356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
357
|
-
|
|
357
|
+
_chunkF6U2H42Lcjs.Button,
|
|
358
358
|
{
|
|
359
359
|
type: "submit",
|
|
360
360
|
loading: isSubmitting,
|
|
@@ -376,4 +376,4 @@ function ContactForm({
|
|
|
376
376
|
|
|
377
377
|
|
|
378
378
|
exports.ContactForm = ContactForm;
|
|
379
|
-
//# sourceMappingURL=chunk-
|
|
379
|
+
//# sourceMappingURL=chunk-UF7AUQ3M.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-B5IFXCRF.cjs","../src/components/contact/contact-form.tsx","../src/schemas/contact-schema.ts"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AAC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;AACI,0BAAA;AACQ,0BAAA;AACE,0BAAA;AACH,0BAAA;AAE2C,0BAAA;AAAA,wBAAA;AACvD,sBAAA;AAIO,sCAAA;AAIT,oBAAA;AAAA,kBAAA;AAEJ,gBAAA;AAGY,gBAAA;AAGd,cAAA;AAKE,cAAA;AAAyB,gCAAA;AAAA,kBAAA;AAET,kCAAA;AAChB,gBAAA;AACA,gCAAA;AAAC,kBAAA;AAAA,kBAAA;AACI,oBAAA;AACmB,oBAAA;AACV,oBAAA;AACW,oBAAA;AACV,oBAAA;AACI,oBAAA;AACP,oBAAA;AAAA,kBAAA;AACZ,gBAAA;AAGoB,gBAAA;AAGtB,cAAA;AAUE,cAAA;AAAA,gCAAA;AAAC,kBAAA;AAAA,kBAAA;AAC0B,oBAAA;AACH,oBAAA;AACZ,oBAAA;AAAA,kBAAA;AACZ,gBAAA;AAEE,gCAAA;AAAA,kCAAA;AAAC,oBAAA;AAAA,oBAAA;AACmB,sBAAA;AACwB,sBAAA;AAClB,sBAAA;AACd,sBAAA;AAAA,oBAAA;AACZ,kBAAA;AACyE,kCAAA;AAC3E,gBAAA;AACF,cAAA;AAIC,8BAAA;AAAkG,gBAAA;AACnG,gCAAA;AAAC,kBAAA;AAAA,kBAAA;AACM,oBAAA;AACI,oBAAA;AACiE,oBAAA;AACjE,oBAAA;AACqC,oBAAA;AAEZ,oBAAA;AAAA,kBAAA;AACpC,gBAAA;AACF,cAAA;AAAA,YAAA;AAAA,UAAA;AACF,QAAA;AAAA,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;ADrI0J;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-B5IFXCRF.cjs","sourcesContent":[null,"'use client';\n\n/**\n * `<ContactForm />` — the canonical contact form used by every public\n * surface (TMCG join, case-study pitch, generic /contact, Help Center\n * ticket creation, etc.).\n *\n * Self-contained inside the lib — host-specific values (user id for\n * tracking, platform-specific contact reasons, reddit-click attribution\n * id) flow IN via props. The hub passes them via a thin\n * `<ContactForm>` wrapper that resolves them from `useAuth` /\n * `getAppConfig` / `getStoredRedditClickId`. Other embedders pass\n * whatever they have (or omit).\n *\n * Field-hide + custom-submit + extra-top-field knobs let one form\n * serve both contact and ticket-creation flows without forking:\n * - Contact page: rendered with all fields visible, built-in submit\n * flow to `/api/contact` via `useContactSubmission`.\n * - Ticket page: hides name/email/companySize/referralSource/\n * helpCategory; supplies `extraTopField` (a Subject input) +\n * `onCustomSubmit` wired to `useTicketActions.submitTicket`.\n */\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useState, type ReactNode } from 'react';\nimport { useForm, Controller } from 'react-hook-form';\nimport { useContactSubmission } from '../../hooks/use-contact-submission';\nimport { useHumanitySignals } from '../../hooks/use-humanity-signals';\nimport {\n ContactSchema,\n type ContactFormData,\n companySizeOptions,\n referralSourceOptions,\n defaultHelpCategoryOptions,\n} from '../../schemas/contact-schema';\nimport { HUBSPOT_DO_NOT_COLLECT_FORM_PROPS } from '../../utils/hubspot-collected-forms';\nimport { ChatAttachmentAddButton, ChatAttachmentChipStrip } from '../chat/chat-attachment-bar';\nimport { useChatAttachments } from '../chat/hooks/use-chat-attachments';\nimport type { ChatAttachment } from '../chat/utils/chat-attachment-markdown';\nimport { SECTION_HEADING_CLASS } from '../layout/page-heading';\nimport {\n Button,\n type ButtonProps,\n Input,\n Textarea,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n Label,\n} from '../ui';\nimport { HoneypotField } from '../ui/honeypot-field';\nimport { RequiredMark } from '../ui/required-mark';\n\n/**\n * Fields the caller can suppress. Six values — every primary form\n * field plus `name` and `email` (newly hideable so ticket-creation\n * surfaces can hide them; they still need to validate, so the caller\n * MUST supply pre-filled values via `defaultValues` when hiding them).\n */\nexport type ContactFormHideableField = 'name' | 'email' | 'companySize' | 'referralSource' | 'helpCategory' | 'message';\n\nexport interface ContactFormProps {\n /** Host-side user id passed to `useContactSubmission` for attribution.\n * Hub wrapper passes `useAuth().user?.id`; lib's Help Center surface\n * passes `useChatIdentity().user?.id`. Omit for anon flows. */\n userId?: string;\n /** Platform-specific help-category dropdown options. Hub wrapper\n * passes `getAppConfig().contact.contactReasons`. Defaults to the\n * lib's `defaultHelpCategoryOptions`. */\n helpCategoryOptions?: readonly string[];\n /** Reddit click attribution id. Caller resolves from wherever they\n * stash it (hub: sessionStorage via `getStoredRedditClickId`). When\n * set, it's spread into the submission payload. */\n rdtCid?: string;\n /** Called after a successful submit so the caller can clear their\n * attribution storage (hub wrapper calls `clearStoredRedditClickId`).\n * Fires for BOTH the built-in and custom submit paths. */\n onSubmitSuccess?: () => void;\n\n prefilledReason?: string;\n prefilledMessage?: string;\n hideFields?: ContactFormHideableField[];\n /** Authoritative pre-fill for any field the caller hides. Merged\n * into react-hook-form's `defaultValues` AFTER the legacy\n * `prefilledReason` / `prefilledMessage` props (caller-supplied\n * wins). REQUIRED when hiding `name` / `email` / `helpCategory` —\n * those fields are still validated by Zod even when not rendered. */\n defaultValues?: Partial<ContactFormData>;\n /** Optional custom submit handler. When provided, the form bypasses\n * the built-in `useContactSubmission` flow (no /api/contact call,\n * no success-redirect, no built-in toast) — the caller owns the\n * entire side-effect chain. Reset + `onSubmitSuccess` still fire\n * on a successful await.\n *\n * Receives the schema-validated form payload PLUS the ready\n * attachments array (empty when `attachmentsEnabled === false` or\n * the user hasn't picked any). Caller forwards `attachments` to\n * whichever sink owns the upload (e.g. `actions.submitTicket`'s\n * `attachments` field for HubSpot Note engagements). */\n onCustomSubmit?: (data: ContactFormData, attachments: ChatAttachment[]) => Promise<void>;\n /** Turn on the attachments bar (file `+` button + chip strip) using\n * the same lib primitives the chat composer uses\n * (`<ChatAttachmentAddButton>` + `<ChatAttachmentChipStrip>` +\n * `useChatAttachments`). When `false` (the default), the form\n * doesn't render the bar AND the attachments array passed to\n * `onCustomSubmit` is always empty. */\n attachmentsEnabled?: boolean;\n /** Render slot for an EXTRA field at the very top of the form,\n * ABOVE the name/email row. Use this for ticket surfaces that need\n * a Subject input — the field is NOT part of `ContactSchema`, so\n * the caller manages its own state + validation and reads the\n * value back inside `onCustomSubmit`. */\n extraTopField?: ReactNode;\n\n title?: string;\n subtitle?: string;\n footerText?: string;\n noBorder?: boolean;\n noPadding?: boolean;\n buttonVariant?: ButtonProps['variant'];\n buttonClassName?: string;\n /** Submit-button label. Defaults to \"Send Message\". Override for\n * ticket surfaces (e.g. \"Open ticket\"). */\n submitLabel?: string;\n /** Success-state submit-button label (shown briefly after submit on\n * the built-in flow). Defaults to \"Message Sent!\". Has no effect\n * when `onCustomSubmit` is provided — the caller owns success UX. */\n submitSuccessLabel?: string;\n successRedirectUrl?: string;\n successToastMessage?: string;\n}\n\nexport function ContactForm({\n userId,\n helpCategoryOptions = defaultHelpCategoryOptions,\n rdtCid,\n onSubmitSuccess,\n prefilledReason,\n prefilledMessage,\n hideFields = [],\n defaultValues: defaultValuesProp,\n onCustomSubmit,\n extraTopField,\n attachmentsEnabled = false,\n title = 'Hit Us Up',\n subtitle,\n footerText = 'We typically respond within 24 hours. We respect your privacy – no spam, ever.',\n noBorder = false,\n noPadding = false,\n buttonVariant = 'accent',\n buttonClassName = '',\n submitLabel = 'Send Message',\n submitSuccessLabel = 'Message Sent!',\n successRedirectUrl = '/blog#community',\n successToastMessage = 'Redirecting you to join our community...',\n}: ContactFormProps = {}) {\n // Attachments staging — same hook the chat composer + ticket\n // detail-drawer composer use. Files upload to Supabase as soon as\n // the user picks them; `readyAttachments` is the wire-shape array\n // ready for the next submit. `hasInflightUploads` disables Send\n // until every upload settles.\n const attachments = useChatAttachments();\n // Built-in contact-API flow. Hook is called unconditionally (rules\n // of hooks); we just don't dispatch its `submit` when the caller\n // passes `onCustomSubmit`. The hook owns its own toast + redirect\n // chain so bypassing it cleanly hands all side-effects to the caller.\n const builtInSubmission = useContactSubmission({\n userId,\n successRedirectUrl,\n successToastMessage,\n });\n // Independent in-flight tracker for the custom path — we can't reuse\n // `builtInSubmission.isSubmitting` because that hook never sees a\n // request when `onCustomSubmit` is active.\n const [customSubmitting, setCustomSubmitting] = useState(false);\n\n // Invisible bot-protection signals (honeypot + timing). Spread into the\n // submit payload for BOTH the built-in and custom paths; reset on success.\n const { honeypotInputProps, getSignals, resetSignals } = useHumanitySignals();\n\n const isSubmitting = onCustomSubmit ? customSubmitting : builtInSubmission.isSubmitting;\n // `isSuccess` only ever fires on the built-in path; custom callers\n // own their own UX (no \"Message Sent!\" button-label flicker).\n const isSuccess = onCustomSubmit ? false : builtInSubmission.isSuccess;\n\n const {\n register,\n handleSubmit,\n control,\n formState: { errors },\n reset,\n } = useForm<ContactFormData>({\n resolver: zodResolver(ContactSchema),\n defaultValues: {\n ...(prefilledReason && { helpCategory: prefilledReason }),\n ...(prefilledMessage && { message: prefilledMessage }),\n // Caller-supplied defaults win over the legacy `prefilled*` props\n // (they're the authoritative seed for hidden fields).\n ...defaultValuesProp,\n },\n });\n\n const handleFormSubmit = async (data: ContactFormData) => {\n if (isSubmitting) return;\n if (attachmentsEnabled && attachments.hasInflightUploads) return;\n try {\n const payload = { ...data, ...(rdtCid && { rdt_cid: rdtCid }), ...getSignals() };\n const readyAttachments = attachmentsEnabled ? attachments.readyAttachments : [];\n if (onCustomSubmit) {\n setCustomSubmitting(true);\n try {\n await onCustomSubmit(payload, readyAttachments);\n } finally {\n setCustomSubmitting(false);\n }\n } else {\n await builtInSubmission.submit(payload);\n }\n onSubmitSuccess?.();\n reset();\n resetSignals();\n if (attachmentsEnabled) attachments.clear();\n } catch {\n // Error toast is owned by the active flow:\n // - built-in: `useContactSubmission` toasts inside `submit()`.\n // - custom: the caller toasts inside `onCustomSubmit`.\n // Either way we swallow here so a thrown error doesn't crash the\n // form tree (react-hook-form's onSubmit handler rejects upward).\n }\n };\n\n const showName = !hideFields.includes('name');\n const showEmail = !hideFields.includes('email');\n const showNameEmailRow = showName || showEmail;\n const showCompanySize = !hideFields.includes('companySize');\n const showReferralSource = !hideFields.includes('referralSource');\n const showHelpCategory = !hideFields.includes('helpCategory');\n const showMessage = !hideFields.includes('message');\n\n return (\n <div\n className={`flex h-full flex-col ${!noBorder ? 'rounded-2xl border border-ods-border md:rounded-3xl' : ''} ${!noPadding ? 'p-6 md:p-8 lg:p-10' : ''}`}\n >\n {(title || subtitle) && (\n <div className=\"mb-6 md:mb-8\">\n {title && <h2 className={`${SECTION_HEADING_CLASS} mb-3 md:mb-4`}>{title}</h2>}\n {subtitle && <p className=\"text-ods-text-primary text-h4\">{subtitle}</p>}\n </div>\n )}\n\n <form\n onSubmit={handleSubmit(handleFormSubmit, validationErrors => {\n // When validation fails on a HIDDEN field (e.g. ticket form\n // hides name/email/helpCategory and seeds them via\n // `defaultValues`), there's no visible error UI for the user\n // — the submit button just appears dead. Log so the broken\n // defaultValues wiring is at least discoverable in DevTools.\n console.warn(\n '[ContactForm] submit blocked by validation:',\n Object.fromEntries(Object.entries(validationErrors).map(([k, v]) => [k, v?.message ?? v])),\n );\n })}\n className=\"flex flex-grow flex-col space-y-4 md:space-y-6\"\n {...HUBSPOT_DO_NOT_COLLECT_FORM_PROPS}\n >\n {/* Hidden inputs for fields that are required by `ContactSchema`\n but suppressed from the visible UI via `hideFields`. Without\n these, `register('name')` never runs, react-hook-form skips\n the field at submit time, and Zod's required-string check\n fails silently — the user clicks Submit and NOTHING visible\n happens (no error, no network call). The caller-supplied\n `defaultValues` seed the values; the hidden inputs just tell\n RHF to include them in the submit payload. */}\n {!showName && <input type=\"hidden\" {...register('name')} />}\n {!showEmail && <input type=\"hidden\" {...register('email')} />}\n {!showHelpCategory && <input type=\"hidden\" {...register('helpCategory')} />}\n {!showMessage && <input type=\"hidden\" {...register('message')} />}\n\n {/* Invisible honeypot — real users never fill it; bots that fill every field trip it. */}\n <HoneypotField {...honeypotInputProps} />\n\n {/* Extra top field (e.g. Subject for ticket forms). Rendered\n outside the schema-driven layout so the caller fully owns\n label / placeholder / state. */}\n {extraTopField}\n\n {showNameEmailRow && (\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6\">\n {showName && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"name\">\n Your Name\n <RequiredMark />\n </Label>\n <Input\n id=\"name\"\n type=\"text\"\n {...register('name')}\n placeholder=\"Jane Doe\"\n aria-invalid={!!errors.name}\n aria-required\n aria-describedby=\"name-error\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.name && (\n <span id=\"name-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.name.message}\n </span>\n )}\n </div>\n )}\n {showEmail && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"email\">\n Email\n <RequiredMark />\n </Label>\n <Input\n id=\"email\"\n type=\"email\"\n {...register('email')}\n placeholder=\"jane@company.com\"\n aria-invalid={!!errors.email}\n aria-required\n aria-describedby=\"email-error\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.email && (\n <span id=\"email-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.email.message}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n {(showCompanySize || showReferralSource) && (\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6\">\n {showCompanySize && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"companySize\">Company Size</Label>\n <Controller\n control={control}\n name=\"companySize\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"companySize\"\n aria-label=\"Company Size\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Select company size\" />\n </SelectTrigger>\n <SelectContent>\n {companySizeOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.companySize && (\n <span id=\"companySize-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.companySize.message}\n </span>\n )}\n </div>\n )}\n {showReferralSource && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"referralSource\">How did you hear about us?</Label>\n <Controller\n control={control}\n name=\"referralSource\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"referralSource\"\n aria-label=\"Referral Source\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Select an option\" />\n </SelectTrigger>\n <SelectContent>\n {referralSourceOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.referralSource && (\n <span id=\"referralSource-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.referralSource.message}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n {showHelpCategory && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"helpCategory\">\n Choose your main interest\n <RequiredMark />\n </Label>\n <Controller\n control={control}\n name=\"helpCategory\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"helpCategory\"\n aria-label=\"Help Category\"\n aria-required\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Choose your main interest\" />\n </SelectTrigger>\n <SelectContent>\n {helpCategoryOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.helpCategory && (\n <span id=\"helpCategory-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.helpCategory.message}\n </span>\n )}\n </div>\n )}\n\n {showMessage && (\n <div className=\"flex flex-grow flex-col\">\n <Label htmlFor=\"message\">\n Your Message\n <RequiredMark />\n </Label>\n <Textarea\n id=\"message\"\n {...register('message')}\n placeholder=\"Share your current challenges or questions about open-source alternatives...\"\n aria-invalid={!!errors.message}\n aria-required\n aria-describedby=\"message-error\"\n className=\"h-full flex-grow border-ods-border bg-ods-card text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.message && (\n <span id=\"message-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.message.message}\n </span>\n )}\n </div>\n )}\n\n {/* Attachments — only renders when `attachmentsEnabled` is on.\n Uses the SAME chip strip + add button + staging hook the\n chat composer and ticket-drawer composer use, so the visual\n chip styling + upload-progress UX are identical everywhere\n attachments appear. */}\n {attachmentsEnabled && (\n <div className=\"flex flex-col gap-2\">\n <ChatAttachmentChipStrip\n attachments={attachments.attachments}\n onRemove={attachments.removeAttachment}\n disabled={isSubmitting}\n />\n <div className=\"flex items-center gap-2\">\n <ChatAttachmentAddButton\n attachmentsEnabled\n attachmentsCount={attachments.attachments.length}\n onAddFiles={attachments.addFiles}\n disabled={isSubmitting}\n />\n <span className=\"text-ods-text-secondary text-h6\">Attach files (optional)</span>\n </div>\n </div>\n )}\n\n <div className=\"mt-auto flex w-full flex-col items-center justify-end gap-4 pt-2 md:flex-row md:gap-6\">\n {footerText && <p className=\"text-center text-ods-text-secondary text-h6 md:text-left\">{footerText}</p>}\n <Button\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || isSuccess || (attachmentsEnabled && attachments.hasInflightUploads)}\n variant={buttonVariant}\n className={`w-full md:w-auto ${buttonClassName}`}\n >\n {isSuccess ? submitSuccessLabel : submitLabel}\n </Button>\n </div>\n </form>\n </div>\n );\n}\n","import { z } from 'zod';\n\n// Dropdown option constants — re-exported by `<ContactForm>` consumers\n// that want to surface their own custom Select widgets keyed on the\n// same allowed-value set.\nexport const companySizeOptions = ['1-10', '11-50', '51-200', '201-500', '501-1000', '1001+'] as const;\n\nexport const referralSourceOptions = [\n 'Google',\n 'LinkedIn',\n 'Twitter/X',\n 'Reddit',\n 'Friend / Colleague',\n 'Other',\n] as const;\n\n// Default fallback options — used when the embedder doesn't supply\n// platform-specific help-category options via the `helpCategoryOptions`\n// prop on `<ContactForm>`.\nexport const defaultHelpCategoryOptions = [\n 'Open-Source Alternatives',\n 'Vendor Cost Reduction',\n 'MSP Best Practices',\n 'Partnerships',\n 'Press',\n 'Other',\n] as const;\n\n// Reusable LinkedIn URL validator — the single source of truth. Every\n// public form schema, every admin update schema, every HubSpot push\n// validator MUST reference this so validation rules cannot drift\n// across boundaries.\n//\n// Host validation parses the URL and checks the hostname suffix so an\n// adversarial input like `https://evil.com/linkedin.com/x` is rejected\n// (substring match would have accepted it — CodeQL alert\n// \"Incomplete URL substring sanitization\").\nexport const LinkedInUrlSchema = z\n .string()\n .url({ message: 'Please enter a valid LinkedIn URL' })\n .refine(\n url => {\n try {\n const host = new URL(url).hostname.toLowerCase();\n return host === 'linkedin.com' || host.endsWith('.linkedin.com');\n } catch {\n return false;\n }\n },\n {\n message: 'Please enter a valid LinkedIn profile URL',\n },\n )\n .optional()\n .or(z.literal(''));\n\n/**\n * Base schema — fields shared by every contact-style form (main contact\n * form, TMCG join, data-room request, case-study pitch, etc.). Any\n * field that exists on a form but NOT on this schema is silently\n * stripped by `safeParse` — that's exactly the bug the LinkedIn field\n * hit historically.\n */\nexport const ContactBaseSchema = z.object({\n name: z.string().min(2, { message: 'Name must be at least 2 characters' }).max(255, { message: 'Name is too long' }),\n email: z.string().email({ message: 'Please enter a valid email address' }).max(255),\n linkedin_url: LinkedInUrlSchema,\n helpCategory: z\n .string()\n .min(1, { message: 'Please select what we can help you with' })\n .max(255, { message: 'Help category is too long' }),\n message: z\n .string()\n .min(10, { message: 'Message must be at least 10 characters' })\n .max(5000, { message: 'Message is too long (5,000 character limit)' }),\n rdt_cid: z.string().optional(),\n});\n\n// Public POST /api/contact validator — base + dropdown fields used by\n// the generic contact form. Other form-specific schemas extend\n// `ContactBaseSchema`.\nexport const ContactSchema = ContactBaseSchema.extend({\n companySize: z\n .string()\n .optional()\n .refine(val => !val || companySizeOptions.includes(val as (typeof companySizeOptions)[number]), {\n message: 'Please select a valid company size',\n }),\n referralSource: z\n .string()\n .optional()\n .refine(val => !val || referralSourceOptions.includes(val as (typeof referralSourceOptions)[number]), {\n message: 'Please select a valid referral source',\n }),\n});\n\nexport type ContactFormData = z.infer<typeof ContactSchema>;\n\nexport interface ContactApiResponse {\n success: boolean;\n error?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-UF7AUQ3M.cjs","../src/components/contact/contact-form.tsx","../src/schemas/contact-schema.ts"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACTA,8CAA4B;AAC5B,8BAAyC;AACzC,gDAAoC;ADWpC;AACA;AErCA,2BAAkB;AAKX,IAAM,mBAAA,EAAqB,CAAC,MAAA,EAAQ,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,UAAA,EAAY,OAAO,CAAA;AAErF,IAAM,sBAAA,EAAwB;AAAA,EACnC,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF,CAAA;AAKO,IAAM,2BAAA,EAA6B;AAAA,EACxC,0BAAA;AAAA,EACA,uBAAA;AAAA,EACA,oBAAA;AAAA,EACA,cAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA;AAWO,IAAM,kBAAA,EAAoB,OAAA,CAC9B,MAAA,CAAO,CAAA,CACP,GAAA,CAAI,EAAE,OAAA,EAAS,oCAAoC,CAAC,CAAA,CACpD,MAAA;AAAA,EACC,CAAA,GAAA,EAAA,GAAO;AACL,IAAA,IAAI;AACF,MAAA,MAAM,KAAA,EAAO,IAAI,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA,CAAS,WAAA,CA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AEZ,oBAAA;AAAA,kBAAA;AACpC,gBAAA;AACF,cAAA;AAAA,YAAA;AAAA,UAAA;AACF,QAAA;AAAA,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;ADrI0J;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-UF7AUQ3M.cjs","sourcesContent":[null,"'use client';\n\n/**\n * `<ContactForm />` — the canonical contact form used by every public\n * surface (TMCG join, case-study pitch, generic /contact, Help Center\n * ticket creation, etc.).\n *\n * Self-contained inside the lib — host-specific values (user id for\n * tracking, platform-specific contact reasons, reddit-click attribution\n * id) flow IN via props. The hub passes them via a thin\n * `<ContactForm>` wrapper that resolves them from `useAuth` /\n * `getAppConfig` / `getStoredRedditClickId`. Other embedders pass\n * whatever they have (or omit).\n *\n * Field-hide + custom-submit + extra-top-field knobs let one form\n * serve both contact and ticket-creation flows without forking:\n * - Contact page: rendered with all fields visible, built-in submit\n * flow to `/api/contact` via `useContactSubmission`.\n * - Ticket page: hides name/email/companySize/referralSource/\n * helpCategory; supplies `extraTopField` (a Subject input) +\n * `onCustomSubmit` wired to `useTicketActions.submitTicket`.\n */\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useState, type ReactNode } from 'react';\nimport { useForm, Controller } from 'react-hook-form';\nimport { useContactSubmission } from '../../hooks/use-contact-submission';\nimport { useHumanitySignals } from '../../hooks/use-humanity-signals';\nimport {\n ContactSchema,\n type ContactFormData,\n companySizeOptions,\n referralSourceOptions,\n defaultHelpCategoryOptions,\n} from '../../schemas/contact-schema';\nimport { HUBSPOT_DO_NOT_COLLECT_FORM_PROPS } from '../../utils/hubspot-collected-forms';\nimport { ChatAttachmentAddButton, ChatAttachmentChipStrip } from '../chat/chat-attachment-bar';\nimport { useChatAttachments } from '../chat/hooks/use-chat-attachments';\nimport type { ChatAttachment } from '../chat/utils/chat-attachment-markdown';\nimport { SECTION_HEADING_CLASS } from '../layout/page-heading';\nimport {\n Button,\n type ButtonProps,\n Input,\n Textarea,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n Label,\n} from '../ui';\nimport { HoneypotField } from '../ui/honeypot-field';\nimport { RequiredMark } from '../ui/required-mark';\n\n/**\n * Fields the caller can suppress. Six values — every primary form\n * field plus `name` and `email` (newly hideable so ticket-creation\n * surfaces can hide them; they still need to validate, so the caller\n * MUST supply pre-filled values via `defaultValues` when hiding them).\n */\nexport type ContactFormHideableField = 'name' | 'email' | 'companySize' | 'referralSource' | 'helpCategory' | 'message';\n\nexport interface ContactFormProps {\n /** Host-side user id passed to `useContactSubmission` for attribution.\n * Hub wrapper passes `useAuth().user?.id`; lib's Help Center surface\n * passes `useChatIdentity().user?.id`. Omit for anon flows. */\n userId?: string;\n /** Platform-specific help-category dropdown options. Hub wrapper\n * passes `getAppConfig().contact.contactReasons`. Defaults to the\n * lib's `defaultHelpCategoryOptions`. */\n helpCategoryOptions?: readonly string[];\n /** Reddit click attribution id. Caller resolves from wherever they\n * stash it (hub: sessionStorage via `getStoredRedditClickId`). When\n * set, it's spread into the submission payload. */\n rdtCid?: string;\n /** Called after a successful submit so the caller can clear their\n * attribution storage (hub wrapper calls `clearStoredRedditClickId`).\n * Fires for BOTH the built-in and custom submit paths. */\n onSubmitSuccess?: () => void;\n\n prefilledReason?: string;\n prefilledMessage?: string;\n hideFields?: ContactFormHideableField[];\n /** Authoritative pre-fill for any field the caller hides. Merged\n * into react-hook-form's `defaultValues` AFTER the legacy\n * `prefilledReason` / `prefilledMessage` props (caller-supplied\n * wins). REQUIRED when hiding `name` / `email` / `helpCategory` —\n * those fields are still validated by Zod even when not rendered. */\n defaultValues?: Partial<ContactFormData>;\n /** Optional custom submit handler. When provided, the form bypasses\n * the built-in `useContactSubmission` flow (no /api/contact call,\n * no success-redirect, no built-in toast) — the caller owns the\n * entire side-effect chain. Reset + `onSubmitSuccess` still fire\n * on a successful await.\n *\n * Receives the schema-validated form payload PLUS the ready\n * attachments array (empty when `attachmentsEnabled === false` or\n * the user hasn't picked any). Caller forwards `attachments` to\n * whichever sink owns the upload (e.g. `actions.submitTicket`'s\n * `attachments` field for HubSpot Note engagements). */\n onCustomSubmit?: (data: ContactFormData, attachments: ChatAttachment[]) => Promise<void>;\n /** Turn on the attachments bar (file `+` button + chip strip) using\n * the same lib primitives the chat composer uses\n * (`<ChatAttachmentAddButton>` + `<ChatAttachmentChipStrip>` +\n * `useChatAttachments`). When `false` (the default), the form\n * doesn't render the bar AND the attachments array passed to\n * `onCustomSubmit` is always empty. */\n attachmentsEnabled?: boolean;\n /** Render slot for an EXTRA field at the very top of the form,\n * ABOVE the name/email row. Use this for ticket surfaces that need\n * a Subject input — the field is NOT part of `ContactSchema`, so\n * the caller manages its own state + validation and reads the\n * value back inside `onCustomSubmit`. */\n extraTopField?: ReactNode;\n\n title?: string;\n subtitle?: string;\n footerText?: string;\n noBorder?: boolean;\n noPadding?: boolean;\n buttonVariant?: ButtonProps['variant'];\n buttonClassName?: string;\n /** Submit-button label. Defaults to \"Send Message\". Override for\n * ticket surfaces (e.g. \"Open ticket\"). */\n submitLabel?: string;\n /** Success-state submit-button label (shown briefly after submit on\n * the built-in flow). Defaults to \"Message Sent!\". Has no effect\n * when `onCustomSubmit` is provided — the caller owns success UX. */\n submitSuccessLabel?: string;\n successRedirectUrl?: string;\n successToastMessage?: string;\n}\n\nexport function ContactForm({\n userId,\n helpCategoryOptions = defaultHelpCategoryOptions,\n rdtCid,\n onSubmitSuccess,\n prefilledReason,\n prefilledMessage,\n hideFields = [],\n defaultValues: defaultValuesProp,\n onCustomSubmit,\n extraTopField,\n attachmentsEnabled = false,\n title = 'Hit Us Up',\n subtitle,\n footerText = 'We typically respond within 24 hours. We respect your privacy – no spam, ever.',\n noBorder = false,\n noPadding = false,\n buttonVariant = 'accent',\n buttonClassName = '',\n submitLabel = 'Send Message',\n submitSuccessLabel = 'Message Sent!',\n successRedirectUrl = '/blog#community',\n successToastMessage = 'Redirecting you to join our community...',\n}: ContactFormProps = {}) {\n // Attachments staging — same hook the chat composer + ticket\n // detail-drawer composer use. Files upload to Supabase as soon as\n // the user picks them; `readyAttachments` is the wire-shape array\n // ready for the next submit. `hasInflightUploads` disables Send\n // until every upload settles.\n const attachments = useChatAttachments();\n // Built-in contact-API flow. Hook is called unconditionally (rules\n // of hooks); we just don't dispatch its `submit` when the caller\n // passes `onCustomSubmit`. The hook owns its own toast + redirect\n // chain so bypassing it cleanly hands all side-effects to the caller.\n const builtInSubmission = useContactSubmission({\n userId,\n successRedirectUrl,\n successToastMessage,\n });\n // Independent in-flight tracker for the custom path — we can't reuse\n // `builtInSubmission.isSubmitting` because that hook never sees a\n // request when `onCustomSubmit` is active.\n const [customSubmitting, setCustomSubmitting] = useState(false);\n\n // Invisible bot-protection signals (honeypot + timing). Spread into the\n // submit payload for BOTH the built-in and custom paths; reset on success.\n const { honeypotInputProps, getSignals, resetSignals } = useHumanitySignals();\n\n const isSubmitting = onCustomSubmit ? customSubmitting : builtInSubmission.isSubmitting;\n // `isSuccess` only ever fires on the built-in path; custom callers\n // own their own UX (no \"Message Sent!\" button-label flicker).\n const isSuccess = onCustomSubmit ? false : builtInSubmission.isSuccess;\n\n const {\n register,\n handleSubmit,\n control,\n formState: { errors },\n reset,\n } = useForm<ContactFormData>({\n resolver: zodResolver(ContactSchema),\n defaultValues: {\n ...(prefilledReason && { helpCategory: prefilledReason }),\n ...(prefilledMessage && { message: prefilledMessage }),\n // Caller-supplied defaults win over the legacy `prefilled*` props\n // (they're the authoritative seed for hidden fields).\n ...defaultValuesProp,\n },\n });\n\n const handleFormSubmit = async (data: ContactFormData) => {\n if (isSubmitting) return;\n if (attachmentsEnabled && attachments.hasInflightUploads) return;\n try {\n const payload = { ...data, ...(rdtCid && { rdt_cid: rdtCid }), ...getSignals() };\n const readyAttachments = attachmentsEnabled ? attachments.readyAttachments : [];\n if (onCustomSubmit) {\n setCustomSubmitting(true);\n try {\n await onCustomSubmit(payload, readyAttachments);\n } finally {\n setCustomSubmitting(false);\n }\n } else {\n await builtInSubmission.submit(payload);\n }\n onSubmitSuccess?.();\n reset();\n resetSignals();\n if (attachmentsEnabled) attachments.clear();\n } catch {\n // Error toast is owned by the active flow:\n // - built-in: `useContactSubmission` toasts inside `submit()`.\n // - custom: the caller toasts inside `onCustomSubmit`.\n // Either way we swallow here so a thrown error doesn't crash the\n // form tree (react-hook-form's onSubmit handler rejects upward).\n }\n };\n\n const showName = !hideFields.includes('name');\n const showEmail = !hideFields.includes('email');\n const showNameEmailRow = showName || showEmail;\n const showCompanySize = !hideFields.includes('companySize');\n const showReferralSource = !hideFields.includes('referralSource');\n const showHelpCategory = !hideFields.includes('helpCategory');\n const showMessage = !hideFields.includes('message');\n\n return (\n <div\n className={`flex h-full flex-col ${!noBorder ? 'rounded-2xl border border-ods-border md:rounded-3xl' : ''} ${!noPadding ? 'p-6 md:p-8 lg:p-10' : ''}`}\n >\n {(title || subtitle) && (\n <div className=\"mb-6 md:mb-8\">\n {title && <h2 className={`${SECTION_HEADING_CLASS} mb-3 md:mb-4`}>{title}</h2>}\n {subtitle && <p className=\"text-ods-text-primary text-h4\">{subtitle}</p>}\n </div>\n )}\n\n <form\n onSubmit={handleSubmit(handleFormSubmit, validationErrors => {\n // When validation fails on a HIDDEN field (e.g. ticket form\n // hides name/email/helpCategory and seeds them via\n // `defaultValues`), there's no visible error UI for the user\n // — the submit button just appears dead. Log so the broken\n // defaultValues wiring is at least discoverable in DevTools.\n console.warn(\n '[ContactForm] submit blocked by validation:',\n Object.fromEntries(Object.entries(validationErrors).map(([k, v]) => [k, v?.message ?? v])),\n );\n })}\n className=\"flex flex-grow flex-col space-y-4 md:space-y-6\"\n {...HUBSPOT_DO_NOT_COLLECT_FORM_PROPS}\n >\n {/* Hidden inputs for fields that are required by `ContactSchema`\n but suppressed from the visible UI via `hideFields`. Without\n these, `register('name')` never runs, react-hook-form skips\n the field at submit time, and Zod's required-string check\n fails silently — the user clicks Submit and NOTHING visible\n happens (no error, no network call). The caller-supplied\n `defaultValues` seed the values; the hidden inputs just tell\n RHF to include them in the submit payload. */}\n {!showName && <input type=\"hidden\" {...register('name')} />}\n {!showEmail && <input type=\"hidden\" {...register('email')} />}\n {!showHelpCategory && <input type=\"hidden\" {...register('helpCategory')} />}\n {!showMessage && <input type=\"hidden\" {...register('message')} />}\n\n {/* Invisible honeypot — real users never fill it; bots that fill every field trip it. */}\n <HoneypotField {...honeypotInputProps} />\n\n {/* Extra top field (e.g. Subject for ticket forms). Rendered\n outside the schema-driven layout so the caller fully owns\n label / placeholder / state. */}\n {extraTopField}\n\n {showNameEmailRow && (\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6\">\n {showName && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"name\">\n Your Name\n <RequiredMark />\n </Label>\n <Input\n id=\"name\"\n type=\"text\"\n {...register('name')}\n placeholder=\"Jane Doe\"\n aria-invalid={!!errors.name}\n aria-required\n aria-describedby=\"name-error\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.name && (\n <span id=\"name-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.name.message}\n </span>\n )}\n </div>\n )}\n {showEmail && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"email\">\n Email\n <RequiredMark />\n </Label>\n <Input\n id=\"email\"\n type=\"email\"\n {...register('email')}\n placeholder=\"jane@company.com\"\n aria-invalid={!!errors.email}\n aria-required\n aria-describedby=\"email-error\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.email && (\n <span id=\"email-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.email.message}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n {(showCompanySize || showReferralSource) && (\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6\">\n {showCompanySize && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"companySize\">Company Size</Label>\n <Controller\n control={control}\n name=\"companySize\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"companySize\"\n aria-label=\"Company Size\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Select company size\" />\n </SelectTrigger>\n <SelectContent>\n {companySizeOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.companySize && (\n <span id=\"companySize-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.companySize.message}\n </span>\n )}\n </div>\n )}\n {showReferralSource && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"referralSource\">How did you hear about us?</Label>\n <Controller\n control={control}\n name=\"referralSource\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"referralSource\"\n aria-label=\"Referral Source\"\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Select an option\" />\n </SelectTrigger>\n <SelectContent>\n {referralSourceOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.referralSource && (\n <span id=\"referralSource-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.referralSource.message}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n {showHelpCategory && (\n <div className=\"flex flex-col\">\n <Label htmlFor=\"helpCategory\">\n Choose your main interest\n <RequiredMark />\n </Label>\n <Controller\n control={control}\n name=\"helpCategory\"\n render={({ field }) => (\n <Select onValueChange={field.onChange} defaultValue={field.value}>\n <SelectTrigger\n id=\"helpCategory\"\n aria-label=\"Help Category\"\n aria-required\n className=\"h-12 border-ods-border bg-ods-card px-3 text-ods-text-primary\"\n >\n <SelectValue placeholder=\"Choose your main interest\" />\n </SelectTrigger>\n <SelectContent>\n {helpCategoryOptions.map(opt => (\n <SelectItem key={opt} value={opt}>\n {opt}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n />\n {errors.helpCategory && (\n <span id=\"helpCategory-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.helpCategory.message}\n </span>\n )}\n </div>\n )}\n\n {showMessage && (\n <div className=\"flex flex-grow flex-col\">\n <Label htmlFor=\"message\">\n Your Message\n <RequiredMark />\n </Label>\n <Textarea\n id=\"message\"\n {...register('message')}\n placeholder=\"Share your current challenges or questions about open-source alternatives...\"\n aria-invalid={!!errors.message}\n aria-required\n aria-describedby=\"message-error\"\n className=\"h-full flex-grow border-ods-border bg-ods-card text-ods-text-primary placeholder-ods-text-secondary\"\n />\n {errors.message && (\n <span id=\"message-error\" className=\"mt-1 text-ods-error text-h6\">\n {errors.message.message}\n </span>\n )}\n </div>\n )}\n\n {/* Attachments — only renders when `attachmentsEnabled` is on.\n Uses the SAME chip strip + add button + staging hook the\n chat composer and ticket-drawer composer use, so the visual\n chip styling + upload-progress UX are identical everywhere\n attachments appear. */}\n {attachmentsEnabled && (\n <div className=\"flex flex-col gap-2\">\n <ChatAttachmentChipStrip\n attachments={attachments.attachments}\n onRemove={attachments.removeAttachment}\n disabled={isSubmitting}\n />\n <div className=\"flex items-center gap-2\">\n <ChatAttachmentAddButton\n attachmentsEnabled\n attachmentsCount={attachments.attachments.length}\n onAddFiles={attachments.addFiles}\n disabled={isSubmitting}\n />\n <span className=\"text-ods-text-secondary text-h6\">Attach files (optional)</span>\n </div>\n </div>\n )}\n\n <div className=\"mt-auto flex w-full flex-col items-center justify-end gap-4 pt-2 md:flex-row md:gap-6\">\n {footerText && <p className=\"text-center text-ods-text-secondary text-h6 md:text-left\">{footerText}</p>}\n <Button\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || isSuccess || (attachmentsEnabled && attachments.hasInflightUploads)}\n variant={buttonVariant}\n className={`w-full md:w-auto ${buttonClassName}`}\n >\n {isSuccess ? submitSuccessLabel : submitLabel}\n </Button>\n </div>\n </form>\n </div>\n );\n}\n","import { z } from 'zod';\n\n// Dropdown option constants — re-exported by `<ContactForm>` consumers\n// that want to surface their own custom Select widgets keyed on the\n// same allowed-value set.\nexport const companySizeOptions = ['1-10', '11-50', '51-200', '201-500', '501-1000', '1001+'] as const;\n\nexport const referralSourceOptions = [\n 'Google',\n 'LinkedIn',\n 'Twitter/X',\n 'Reddit',\n 'Friend / Colleague',\n 'Other',\n] as const;\n\n// Default fallback options — used when the embedder doesn't supply\n// platform-specific help-category options via the `helpCategoryOptions`\n// prop on `<ContactForm>`.\nexport const defaultHelpCategoryOptions = [\n 'Open-Source Alternatives',\n 'Vendor Cost Reduction',\n 'MSP Best Practices',\n 'Partnerships',\n 'Press',\n 'Other',\n] as const;\n\n// Reusable LinkedIn URL validator — the single source of truth. Every\n// public form schema, every admin update schema, every HubSpot push\n// validator MUST reference this so validation rules cannot drift\n// across boundaries.\n//\n// Host validation parses the URL and checks the hostname suffix so an\n// adversarial input like `https://evil.com/linkedin.com/x` is rejected\n// (substring match would have accepted it — CodeQL alert\n// \"Incomplete URL substring sanitization\").\nexport const LinkedInUrlSchema = z\n .string()\n .url({ message: 'Please enter a valid LinkedIn URL' })\n .refine(\n url => {\n try {\n const host = new URL(url).hostname.toLowerCase();\n return host === 'linkedin.com' || host.endsWith('.linkedin.com');\n } catch {\n return false;\n }\n },\n {\n message: 'Please enter a valid LinkedIn profile URL',\n },\n )\n .optional()\n .or(z.literal(''));\n\n/**\n * Base schema — fields shared by every contact-style form (main contact\n * form, TMCG join, data-room request, case-study pitch, etc.). Any\n * field that exists on a form but NOT on this schema is silently\n * stripped by `safeParse` — that's exactly the bug the LinkedIn field\n * hit historically.\n */\nexport const ContactBaseSchema = z.object({\n name: z.string().min(2, { message: 'Name must be at least 2 characters' }).max(255, { message: 'Name is too long' }),\n email: z.string().email({ message: 'Please enter a valid email address' }).max(255),\n linkedin_url: LinkedInUrlSchema,\n helpCategory: z\n .string()\n .min(1, { message: 'Please select what we can help you with' })\n .max(255, { message: 'Help category is too long' }),\n message: z\n .string()\n .min(10, { message: 'Message must be at least 10 characters' })\n .max(5000, { message: 'Message is too long (5,000 character limit)' }),\n rdt_cid: z.string().optional(),\n});\n\n// Public POST /api/contact validator — base + dropdown fields used by\n// the generic contact form. Other form-specific schemas extend\n// `ContactBaseSchema`.\nexport const ContactSchema = ContactBaseSchema.extend({\n companySize: z\n .string()\n .optional()\n .refine(val => !val || companySizeOptions.includes(val as (typeof companySizeOptions)[number]), {\n message: 'Please select a valid company size',\n }),\n referralSource: z\n .string()\n .optional()\n .refine(val => !val || referralSourceOptions.includes(val as (typeof referralSourceOptions)[number]), {\n message: 'Please select a valid referral source',\n }),\n});\n\nexport type ContactFormData = z.infer<typeof ContactSchema>;\n\nexport interface ContactApiResponse {\n success: boolean;\n error?: string;\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SearchInput
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T36DLNMO.js";
|
|
5
5
|
import {
|
|
6
6
|
contentFetch
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MT5A25AX.js";
|
|
8
8
|
import {
|
|
9
9
|
NEW_TAB_FEATURES,
|
|
10
10
|
resolveExternalNavigation,
|
|
11
11
|
resolveSourceIcon,
|
|
12
12
|
stripSameOriginToPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-X7LGHPH5.js";
|
|
14
14
|
import {
|
|
15
15
|
useDebounce
|
|
16
16
|
} from "./chunk-C3GXRBJD.js";
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
} from "./chunk-XXMHLZ3Y.js";
|
|
20
20
|
import {
|
|
21
21
|
decideNewTab
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3DWDJ54N.js";
|
|
23
23
|
import {
|
|
24
24
|
useChatRuntime
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3SMLYVM2.js";
|
|
26
26
|
|
|
27
27
|
// src/components/shared/doc-search/format-relative-path.ts
|
|
28
28
|
function formatRelativePath(fullPath) {
|
|
@@ -381,4 +381,4 @@ export {
|
|
|
381
381
|
resolveSearchResultAction,
|
|
382
382
|
useDocSearch
|
|
383
383
|
};
|
|
384
|
-
//# sourceMappingURL=chunk-
|
|
384
|
+
//# sourceMappingURL=chunk-ULJNU46H.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXOGD2AMEcjs = require('./chunk-XOGD2AME.cjs');
|
|
6
6
|
|
|
7
7
|
// src/utils/search-params.ts
|
|
8
8
|
function positiveInt(raw, fallback, { min = 1, max } = {}) {
|
|
@@ -122,9 +122,9 @@ function withQuery(path, queryString) {
|
|
|
122
122
|
|
|
123
123
|
// src/utils/embed-content-fetch.ts
|
|
124
124
|
var contentFetch = (input, init) => {
|
|
125
|
-
if (!
|
|
125
|
+
if (!_chunkXOGD2AMEcjs.hasEmbedAuthAdapter.call(void 0, )) return fetch(input, init);
|
|
126
126
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
127
|
-
return
|
|
127
|
+
return _chunkXOGD2AMEcjs.embedAuthedFetch.call(void 0, url, init);
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
|
|
@@ -142,4 +142,4 @@ var contentFetch = (input, init) => {
|
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
exports.contentFetch = contentFetch; exports.positiveInt = positiveInt; exports.PAGE_PARAM_LIMITS = PAGE_PARAM_LIMITS; exports.pageCount = pageCount; exports.clampPageToTotal = clampPageToTotal; exports.defineParamSchema = defineParamSchema; exports.fromKeys = fromKeys; exports.firstParamValue = firstParamValue; exports.parseSchemaParams = parseSchemaParams; exports.shouldIncludeInUrl = shouldIncludeInUrl; exports.createSearchParams = createSearchParams; exports.serializeSchemaParams = serializeSchemaParams; exports.withQuery = withQuery;
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-VTYP25OW.cjs.map
|