wealth-alpha-chat-widget 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/styles/chat.module.css"],"sourcesContent":[".root {\n --wac-brand: #1a2d5a;\n --wac-brand-contrast: #ffffff;\n --wac-bg: #ffffff;\n --wac-fg: #1f2937;\n --wac-muted: #6b7280;\n --wac-border: #e5e7eb;\n --wac-bot-bg: #f3f4f6;\n --wac-user-bg: var(--wac-brand);\n --wac-chip-bg: #eef2ff;\n --wac-chip-fg: #1e293b;\n --wac-chip-active-bg: var(--wac-brand);\n --wac-chip-active-fg: #ffffff;\n --wac-radius: 14px;\n --wac-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n color: var(--wac-fg);\n box-sizing: border-box;\n}\n\n.root *,\n.root *::before,\n.root *::after {\n box-sizing: inherit;\n}\n\n.floatingButton {\n position: fixed;\n bottom: 24px;\n z-index: 2147483646;\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n cursor: pointer;\n box-shadow: var(--wac-shadow);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 26px;\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.floatingButton:hover {\n transform: translateY(-2px);\n box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);\n}\n\n.positionRight {\n right: 24px;\n}\n\n.positionLeft {\n left: 24px;\n}\n\n.widget {\n position: fixed;\n bottom: 24px;\n z-index: 2147483647;\n width: 420px;\n max-width: calc(100vw - 24px);\n height: min(760px, calc(100vh - 48px));\n background: var(--wac-bg);\n color: var(--wac-fg);\n border-radius: var(--wac-radius);\n box-shadow: var(--wac-shadow);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid var(--wac-border);\n}\n\n@media (max-width: 640px) {\n .widget {\n width: calc(100vw - 12px);\n height: calc(100vh - 24px);\n bottom: 12px;\n }\n .positionRight,\n .positionLeft {\n right: 6px;\n left: auto;\n }\n .floatingButton {\n width: 56px;\n height: 56px;\n bottom: 16px;\n }\n}\n\n.header {\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n padding: 14px 16px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n\n.headerTitle {\n font-weight: 600;\n font-size: 15px;\n line-height: 1.2;\n}\n\n.headerMeta {\n font-size: 11px;\n opacity: 0.85;\n margin-top: 2px;\n}\n\n.headerActions {\n display: flex;\n gap: 4px;\n align-items: center;\n}\n\n.iconButton {\n background: transparent;\n color: inherit;\n border: none;\n cursor: pointer;\n font-size: 18px;\n padding: 4px 8px;\n border-radius: 6px;\n line-height: 1;\n}\n\n.iconButton:hover {\n background: rgba(255, 255, 255, 0.15);\n}\n\n.body {\n flex: 1;\n overflow-y: auto;\n padding: 14px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n background: #fafafa;\n scroll-behavior: smooth;\n}\n\n.body::-webkit-scrollbar {\n width: 6px;\n}\n\n.body::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 3px;\n}\n\n.bubble {\n max-width: 80%;\n padding: 10px 14px;\n border-radius: 12px;\n font-size: 14px;\n line-height: 1.45;\n word-wrap: break-word;\n white-space: pre-wrap;\n}\n\n/* markdown-it output inside a bot bubble.\n markdown-it (breaks: true) emits a <br> for every \\n in the source,\n so we MUST NOT also apply white-space: pre-wrap here — otherwise every\n newline gets rendered twice (once via <br>, once via the literal \\n in\n CSS) and the bubble looks double-spaced. */\n.markdown {\n white-space: normal;\n}\n.markdown p {\n margin: 0 0 6px 0;\n}\n.markdown p:last-child {\n margin-bottom: 0;\n}\n.markdown br {\n /* Make consecutive <br>s collapse a bit — keeps line rhythm tight. */\n line-height: 1.4;\n}\n.markdown strong {\n font-weight: 700;\n color: var(--wac-fg);\n letter-spacing: 0.2px;\n}\n.markdown em {\n font-style: italic;\n color: var(--wac-muted);\n}\n.markdown ul,\n.markdown ol {\n margin: 4px 0 6px 0;\n padding-left: 22px;\n}\n.markdown li {\n margin: 1px 0;\n}\n.markdown a {\n color: var(--wac-brand);\n text-decoration: underline;\n}\n.markdown code {\n background: rgba(0, 0, 0, 0.06);\n padding: 1px 4px;\n border-radius: 4px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12.5px;\n}\n.markdown h1,\n.markdown h2,\n.markdown h3 {\n margin: 6px 0 2px 0;\n font-size: 14px;\n font-weight: 700;\n}\n\n.bubbleBot {\n align-self: flex-start;\n background: var(--wac-bot-bg);\n color: var(--wac-fg);\n border-bottom-left-radius: 4px;\n}\n\n.bubbleUser {\n align-self: flex-end;\n background: var(--wac-user-bg);\n color: var(--wac-brand-contrast);\n border-bottom-right-radius: 4px;\n}\n\n.bubbleMeta {\n font-size: 10px;\n color: var(--wac-muted);\n margin-top: 4px;\n text-align: right;\n}\n\n.chipRow {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-top: 8px;\n}\n\n.chip {\n padding: 7px 12px;\n background: var(--wac-chip-bg);\n color: var(--wac-chip-fg);\n border: 1px solid transparent;\n border-radius: 999px;\n font-size: 13px;\n cursor: pointer;\n transition: background 0.15s ease, transform 0.15s ease;\n font-family: inherit;\n}\n\n.chip:hover:not(:disabled) {\n background: #dbeafe;\n transform: translateY(-1px);\n}\n\n.chipActive {\n background: var(--wac-chip-active-bg);\n color: var(--wac-chip-active-fg);\n}\n\n.chipDisabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.typing {\n align-self: flex-start;\n display: inline-flex;\n gap: 4px;\n padding: 10px 14px;\n background: var(--wac-bot-bg);\n border-radius: 12px;\n border-bottom-left-radius: 4px;\n}\n\n.typingDot {\n width: 7px;\n height: 7px;\n background: var(--wac-muted);\n border-radius: 50%;\n animation: wacBlink 1.2s infinite ease-in-out both;\n}\n\n.typingDot:nth-child(2) {\n animation-delay: 0.18s;\n}\n.typingDot:nth-child(3) {\n animation-delay: 0.36s;\n}\n\n@keyframes wacBlink {\n 0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }\n 40% { opacity: 1; transform: scale(1); }\n}\n\n.input {\n display: flex;\n gap: 8px;\n padding: 10px 12px;\n border-top: 1px solid var(--wac-border);\n background: var(--wac-bg);\n}\n\n.inputBox {\n flex: 1;\n padding: 10px 14px;\n border: 1px solid var(--wac-border);\n border-radius: 999px;\n font-size: 14px;\n outline: none;\n font-family: inherit;\n background: #f9fafb;\n color: var(--wac-fg);\n}\n\n.inputBox:focus {\n border-color: var(--wac-brand);\n background: var(--wac-bg);\n}\n\n.inputBox:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.sendButton {\n padding: 0 16px;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n border-radius: 999px;\n font-weight: 600;\n cursor: pointer;\n font-size: 14px;\n font-family: inherit;\n}\n\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.authGate {\n margin: auto;\n text-align: center;\n padding: 32px 24px;\n max-width: 280px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: center;\n}\n\n.authGateIcon {\n font-size: 36px;\n}\n\n.authGateTitle {\n font-size: 16px;\n font-weight: 600;\n}\n\n.authGateText {\n font-size: 13px;\n color: var(--wac-muted);\n line-height: 1.5;\n}\n\n.authGateButton {\n margin-top: 8px;\n padding: 10px 20px;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n border-radius: 999px;\n cursor: pointer;\n font-weight: 600;\n font-size: 14px;\n font-family: inherit;\n}\n\n.authGateDisclaimer {\n margin-top: 16px;\n padding-top: 12px;\n border-top: 1px dashed var(--wac-border);\n font-size: 11px;\n color: var(--wac-muted);\n line-height: 1.5;\n text-align: left;\n width: 100%;\n}\n\n.authGateDisclaimerTitle {\n font-weight: 700;\n letter-spacing: 0.6px;\n font-size: 10px;\n margin-bottom: 4px;\n color: var(--wac-fg);\n}\n\n.errorBanner {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n padding: 8px 12px;\n font-size: 12px;\n border-radius: 8px;\n margin: 0 14px 8px;\n}\n"],"mappings":";AAAA,CAACA;AACC,eAAa;AACb,wBAAsB;AACtB,YAAU;AACV,YAAU;AACV,eAAa;AACb,gBAAc;AACd,gBAAc;AACd,iBAAe,IAAI;AACnB,iBAAe;AACf,iBAAe;AACf,wBAAsB,IAAI;AAC1B,wBAAsB;AACtB,gBAAc;AACd,gBAAc,EAAE,KAAK,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACxC;AAAA,IAAa,aAAa;AAAA,IAAE,kBAAkB;AAAA,IAAE,UAAU;AAAA,IAAE,MAAM;AAAA,IAAE,gBAAgB;AAAA,IAAE,KAAK;AAAA,IAAE;AAC7F,SAAO,IAAI;AACX,cAAY;AACd;AAEA,CApBCA,UAoBK;AACN,CArBCA,UAqBK,CAAC;AACP,CAtBCA,UAsBK,CAAC;AACL,cAAY;AACd;AAEA,CAACC;AACC,YAAU;AACV,UAAQ;AACR,WAAS;AACT,SAAO;AACP,UAAQ;AACR,iBAAe;AACf,cAAY,IAAI;AAChB,SAAO,IAAI;AACX,UAAQ;AACR,UAAQ;AACR,cAAY,IAAI;AAChB,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,aAAW;AACX,cAAY,UAAU,MAAM,IAAI,EAAE,WAAW,MAAM;AACrD;AAEA,CAnBCA,mBAmBc;AACb,aAAW,WAAW;AACtB,cAAY,EAAE,KAAK,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACxC;AAEA,CAACC;AACC,SAAO;AACT;AAEA,CAACC;AACC,QAAM;AACR;AAEA,CAACC;AACC,YAAU;AACV,UAAQ;AACR,WAAS;AACT,SAAO;AACP,aAAW,KAAK,MAAM,EAAE;AACxB,UAAQ,IAAI,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a;AACf;AAEA,CAACC;AACC,aAAW;AACX,SAAO,IAAI;AACX,eAAa;AACf;AAEA,CAACC;AACC,cAAY;AACZ,WAAS,KAAK;AACd,cAAY,IAAI;AAChB,SAAO,IAAI;AACX,UAAQ;AACR,iBAAe;AACf,UAAQ;AACR,eAAa;AACb,aAAW;AACX,eAAa;AACf;AAEA,CAACC;AACC,cAAY;AACZ,eAAa;AACb,cAAY,IAAI,OAAO,IAAI;AAC3B,aAAW;AACX,SAAO,IAAI;AACX,eAAa;AACb,cAAY;AACZ,SAAO;AACT;AAEA,CAACC;AACC,eAAa;AACb,kBAAgB;AAChB,aAAW;AACX,iBAAe;AACf,SAAO,IAAI;AACb;AAEA,CAACC;AACC,cAAY;AACZ,UAAQ,IAAI,MAAM;AAClB,SAAO;AACP,WAAS,IAAI;AACb,aAAW;AACX,iBAAe;AACf,UAAQ,EAAE,KAAK;AACjB;","names":["root","floatingButton","positionRight","positionLeft","widget","header","headerTitle","headerMeta","headerActions","iconButton","body","bubble","markdown","bubbleBot","bubbleUser","bubbleMeta","chipRow","chip","chipActive","chipDisabled","typing","typingDot","wacBlink","input","inputBox","sendButton","authGate","authGateIcon","authGateTitle","authGateText","authGateButton","authGateDisclaimer","authGateDisclaimerTitle","errorBanner"]}
1
+ {"version":3,"sources":["../src/styles/chat.module.css"],"sourcesContent":[".root {\n --wac-brand: #1a2d5a;\n --wac-brand-contrast: #ffffff;\n --wac-bg: #ffffff;\n --wac-fg: #1f2937;\n --wac-muted: #6b7280;\n --wac-border: #e5e7eb;\n --wac-bot-bg: #f3f4f6;\n --wac-user-bg: var(--wac-brand);\n --wac-chip-bg: #eef2ff;\n --wac-chip-fg: #1e293b;\n --wac-chip-active-bg: var(--wac-brand);\n --wac-chip-active-fg: #ffffff;\n --wac-radius: 14px;\n --wac-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n color: var(--wac-fg);\n box-sizing: border-box;\n}\n\n.root *,\n.root *::before,\n.root *::after {\n box-sizing: inherit;\n}\n\n.floatingButton {\n position: fixed;\n bottom: 24px;\n z-index: 2147483646;\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n cursor: pointer;\n box-shadow: var(--wac-shadow);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 26px;\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.floatingButton:hover {\n transform: translateY(-2px);\n box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);\n}\n\n.positionRight {\n right: 24px;\n}\n\n.positionLeft {\n left: 24px;\n}\n\n.widget {\n position: fixed;\n bottom: 24px;\n z-index: 2147483647;\n width: 420px;\n max-width: calc(100vw - 24px);\n height: min(760px, calc(100vh - 48px));\n background: var(--wac-bg);\n color: var(--wac-fg);\n border-radius: var(--wac-radius);\n box-shadow: var(--wac-shadow);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid var(--wac-border);\n}\n\n@media (max-width: 640px) {\n .widget {\n width: calc(100vw - 12px);\n height: calc(100vh - 24px);\n bottom: 12px;\n }\n .positionRight,\n .positionLeft {\n right: 6px;\n left: auto;\n }\n .floatingButton {\n width: 56px;\n height: 56px;\n bottom: 16px;\n }\n /* Both positions collapse to right: 6px on mobile, so sync popup */\n .popupBubbleLeft,\n .popupBubbleRight {\n right: 72px;\n left: auto;\n bottom: 16px;\n max-width: calc(100vw - 84px);\n }\n}\n\n.header {\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n padding: 14px 16px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n\n.headerTitle {\n font-weight: 600;\n font-size: 15px;\n line-height: 1.2;\n}\n\n.headerMeta {\n font-size: 11px;\n opacity: 0.85;\n margin-top: 2px;\n}\n\n.headerActions {\n display: flex;\n gap: 4px;\n align-items: center;\n}\n\n.iconButton {\n background: transparent;\n color: inherit;\n border: none;\n cursor: pointer;\n font-size: 18px;\n padding: 4px 8px;\n border-radius: 6px;\n line-height: 1;\n}\n\n.iconButton:hover {\n background: rgba(255, 255, 255, 0.15);\n}\n\n.body {\n flex: 1;\n overflow-y: auto;\n padding: 14px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n background: #fafafa;\n scroll-behavior: smooth;\n}\n\n.body::-webkit-scrollbar {\n width: 6px;\n}\n\n.body::-webkit-scrollbar-thumb {\n background: #d1d5db;\n border-radius: 3px;\n}\n\n.bubble {\n max-width: 80%;\n padding: 10px 14px;\n border-radius: 12px;\n font-size: 14px;\n line-height: 1.45;\n word-wrap: break-word;\n white-space: pre-wrap;\n}\n\n/* markdown-it output inside a bot bubble.\n markdown-it (breaks: true) emits a <br> for every \\n in the source,\n so we MUST NOT also apply white-space: pre-wrap here — otherwise every\n newline gets rendered twice (once via <br>, once via the literal \\n in\n CSS) and the bubble looks double-spaced. */\n.markdown {\n white-space: normal;\n}\n.markdown p {\n margin: 0 0 6px 0;\n}\n.markdown p:last-child {\n margin-bottom: 0;\n}\n.markdown br {\n /* Make consecutive <br>s collapse a bit — keeps line rhythm tight. */\n line-height: 1.4;\n}\n.markdown strong {\n font-weight: 700;\n color: var(--wac-fg);\n letter-spacing: 0.2px;\n}\n.markdown em {\n font-style: italic;\n color: var(--wac-muted);\n}\n.markdown ul,\n.markdown ol {\n margin: 4px 0 6px 0;\n padding-left: 22px;\n}\n.markdown li {\n margin: 1px 0;\n}\n.markdown a {\n color: var(--wac-brand);\n text-decoration: underline;\n}\n.markdown code {\n background: rgba(0, 0, 0, 0.06);\n padding: 1px 4px;\n border-radius: 4px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12.5px;\n}\n.markdown h1,\n.markdown h2,\n.markdown h3 {\n margin: 6px 0 2px 0;\n font-size: 14px;\n font-weight: 700;\n}\n\n.bubbleBot {\n align-self: flex-start;\n background: var(--wac-bot-bg);\n color: var(--wac-fg);\n border-bottom-left-radius: 4px;\n}\n\n.bubbleUser {\n align-self: flex-end;\n background: var(--wac-user-bg);\n color: var(--wac-brand-contrast);\n border-bottom-right-radius: 4px;\n}\n\n.bubbleMeta {\n font-size: 10px;\n color: var(--wac-muted);\n margin-top: 4px;\n text-align: right;\n}\n\n.chipRow {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-top: 8px;\n}\n\n.chip {\n padding: 7px 12px;\n background: var(--wac-chip-bg);\n color: var(--wac-chip-fg);\n border: 1px solid transparent;\n border-radius: 999px;\n font-size: 13px;\n cursor: pointer;\n transition: background 0.15s ease, transform 0.15s ease;\n font-family: inherit;\n}\n\n.chip:hover:not(:disabled) {\n background: #dbeafe;\n transform: translateY(-1px);\n}\n\n.chipActive {\n background: var(--wac-chip-active-bg);\n color: var(--wac-chip-active-fg);\n}\n\n.chipDisabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.typing {\n align-self: flex-start;\n display: inline-flex;\n gap: 4px;\n padding: 10px 14px;\n background: var(--wac-bot-bg);\n border-radius: 12px;\n border-bottom-left-radius: 4px;\n}\n\n.typingDot {\n width: 7px;\n height: 7px;\n background: var(--wac-muted);\n border-radius: 50%;\n animation: wacBlink 1.2s infinite ease-in-out both;\n}\n\n.typingDot:nth-child(2) {\n animation-delay: 0.18s;\n}\n.typingDot:nth-child(3) {\n animation-delay: 0.36s;\n}\n\n@keyframes wacBlink {\n 0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }\n 40% { opacity: 1; transform: scale(1); }\n}\n\n.input {\n display: flex;\n gap: 8px;\n padding: 10px 12px;\n border-top: 1px solid var(--wac-border);\n background: var(--wac-bg);\n}\n\n.inputBox {\n flex: 1;\n padding: 10px 14px;\n border: 1px solid var(--wac-border);\n border-radius: 999px;\n font-size: 14px;\n outline: none;\n font-family: inherit;\n background: #f9fafb;\n color: var(--wac-fg);\n}\n\n.inputBox:focus {\n border-color: var(--wac-brand);\n background: var(--wac-bg);\n}\n\n.inputBox:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.sendButton {\n padding: 0 16px;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n border-radius: 999px;\n font-weight: 600;\n cursor: pointer;\n font-size: 14px;\n font-family: inherit;\n}\n\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.hiddenFileInput {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.csvButton {\n flex-shrink: 0;\n padding: 0 12px;\n background: var(--wac-chip-bg);\n color: var(--wac-chip-fg);\n border: 1px solid var(--wac-border);\n border-radius: 999px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n white-space: nowrap;\n}\n\n.csvButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.authGate {\n margin: auto;\n text-align: center;\n padding: 32px 24px;\n max-width: 280px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: center;\n}\n\n.authGateIcon {\n font-size: 36px;\n}\n\n.authGateTitle {\n font-size: 16px;\n font-weight: 600;\n}\n\n.authGateText {\n font-size: 13px;\n color: var(--wac-muted);\n line-height: 1.5;\n}\n\n.authGateButton {\n margin-top: 8px;\n padding: 10px 20px;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border: none;\n border-radius: 999px;\n cursor: pointer;\n font-weight: 600;\n font-size: 14px;\n font-family: inherit;\n}\n\n.authGateDisclaimer {\n margin-top: 16px;\n padding-top: 12px;\n border-top: 1px dashed var(--wac-border);\n font-size: 11px;\n color: var(--wac-muted);\n line-height: 1.5;\n text-align: left;\n width: 100%;\n}\n\n.authGateDisclaimerTitle {\n font-weight: 700;\n letter-spacing: 0.6px;\n font-size: 10px;\n margin-bottom: 4px;\n color: var(--wac-fg);\n}\n\n.errorBanner {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n padding: 8px 12px;\n font-size: 12px;\n border-radius: 8px;\n margin: 0 14px 8px;\n}\n\n/* ── Greeting popup bubble ─────────────────────────────────────── */\n\n.popupBubble {\n position: fixed;\n bottom: 24px;\n z-index: 2147483646;\n background: var(--wac-brand);\n color: var(--wac-brand-contrast);\n border-radius: 12px;\n padding: 12px 36px 12px 14px;\n font-size: 13px;\n line-height: 1.45;\n box-shadow: var(--wac-shadow);\n border: none;\n max-width: 240px;\n animation: wacPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n\n/* Shared arrow base — direction is set per-position class below */\n.popupBubble::after {\n content: '';\n position: absolute;\n width: 12px;\n height: 12px;\n background: var(--wac-brand);\n}\n\n/* Popup to the LEFT of a right-positioned button — arrow points right */\n.popupBubbleRight {\n right: 94px;\n}\n\n.popupBubbleRight::after {\n right: -7px;\n top: 50%;\n border-top: 1px solid var(--wac-brand);\n border-right: 1px solid var(--wac-brand);\n transform: translateY(-50%) rotate(45deg);\n}\n\n/* Popup to the RIGHT of a left-positioned button — arrow points left */\n.popupBubbleLeft {\n left: 94px;\n}\n\n.popupBubbleLeft::after {\n left: -7px;\n top: 50%;\n border-bottom: 1px solid var(--wac-brand);\n border-left: 1px solid var(--wac-brand);\n transform: translateY(-50%) rotate(45deg);\n}\n\n.popupDismiss {\n position: absolute;\n top: 8px;\n right: 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--wac-brand-contrast);\n line-height: 1;\n padding: 2px 4px;\n border-radius: 4px;\n font-family: inherit;\n opacity: 0.75;\n}\n\n.popupDismiss:hover {\n background: rgba(255, 255, 255, 0.15);\n opacity: 1;\n}\n\n@keyframes wacPopIn {\n 0% { opacity: 0; transform: scale(0.85) translateY(8px); }\n 100% { opacity: 1; transform: scale(1) translateY(0); }\n}\n"],"mappings":";AAAA,CAACA;AACC,eAAa;AACb,wBAAsB;AACtB,YAAU;AACV,YAAU;AACV,eAAa;AACb,gBAAc;AACd,gBAAc;AACd,iBAAe,IAAI;AACnB,iBAAe;AACf,iBAAe;AAC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AACN,OAAK;AACL,iBAAe,IAAI,MAAM,IAAI;AAC7B,eAAa,IAAI,MAAM,IAAI;AAC3B,aAAW,WAAW,MAAM,OAAO;AACrC;AAEA,CAACkC;AACC,YAAU;AACV,OAAK;AACL,SAAO;AACP,cAAY;AACZ,UAAQ;AACR,UAAQ;AACR,aAAW;AACX,SAAO,IAAI;AACX,eAAa;AACb,WAAS,IAAI;AACb,iBAAe;AACf,eAAa;AACb,WAAS;AACX;AAEA,CAhBCA,iBAgBY;AACX,cAAY,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AAChC,WAAS;AACX;AAEA,WA3DaC;AA4DX;AAAK,aAAS;AAAG,eAAW,MAAM,MAAM,WAAW;AAAM;AACzD;AAAO,aAAS;AAAG,eAAW,MAAM,GAAG,WAAW;AAAI;AACxD;","names":["root","floatingButton","positionRight","positionLeft","widget","popupBubbleLeft","popupBubbleRight","header","headerTitle","headerMeta","headerActions","iconButton","body","bubble","markdown","bubbleBot","bubbleUser","bubbleMeta","chipRow","chip","chipActive","chipDisabled","typing","typingDot","wacBlink","input","inputBox","sendButton","hiddenFileInput","csvButton","authGate","authGateIcon","authGateTitle","authGateText","authGateButton","authGateDisclaimer","authGateDisclaimerTitle","errorBanner","popupBubble","popupDismiss","wacPopIn"]}
package/dist/index.d.cts CHANGED
@@ -55,6 +55,7 @@ interface WealthChatProps {
55
55
  position?: ChatPosition;
56
56
  defaultOpen?: boolean;
57
57
  showCountdown?: boolean;
58
+ greetingMessage?: string;
58
59
  onLogin?: () => void;
59
60
  onLogout?: () => void;
60
61
  onSessionExpire?: () => void;
@@ -133,8 +134,11 @@ interface FloatingButtonProps {
133
134
  position: ChatPosition;
134
135
  onClick: () => void;
135
136
  brandColor?: string;
137
+ showPopup?: boolean;
138
+ popupMessage?: string;
139
+ onPopupDismiss?: () => void;
136
140
  }
137
- declare function FloatingButton({ position, onClick, brandColor }: FloatingButtonProps): react_jsx_runtime.JSX.Element;
141
+ declare function FloatingButton({ position, onClick, brandColor, showPopup, popupMessage, onPopupDismiss }: FloatingButtonProps): react_jsx_runtime.JSX.Element;
138
142
 
139
143
  interface UseSessionOptions {
140
144
  ttlSeconds?: number;
@@ -176,6 +180,7 @@ interface UseChatOptions {
176
180
  interface UseChatReturn {
177
181
  state: ChatState;
178
182
  sendText: (text: string) => Promise<void>;
183
+ uploadCsv: (file: File) => Promise<void>;
179
184
  appendBotResponse: (resp: BotResponse) => void;
180
185
  appendUserMessage: (content: string) => Message;
181
186
  deactivatePriorChips: (keepId?: string) => void;
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ interface WealthChatProps {
55
55
  position?: ChatPosition;
56
56
  defaultOpen?: boolean;
57
57
  showCountdown?: boolean;
58
+ greetingMessage?: string;
58
59
  onLogin?: () => void;
59
60
  onLogout?: () => void;
60
61
  onSessionExpire?: () => void;
@@ -133,8 +134,11 @@ interface FloatingButtonProps {
133
134
  position: ChatPosition;
134
135
  onClick: () => void;
135
136
  brandColor?: string;
137
+ showPopup?: boolean;
138
+ popupMessage?: string;
139
+ onPopupDismiss?: () => void;
136
140
  }
137
- declare function FloatingButton({ position, onClick, brandColor }: FloatingButtonProps): react_jsx_runtime.JSX.Element;
141
+ declare function FloatingButton({ position, onClick, brandColor, showPopup, popupMessage, onPopupDismiss }: FloatingButtonProps): react_jsx_runtime.JSX.Element;
138
142
 
139
143
  interface UseSessionOptions {
140
144
  ttlSeconds?: number;
@@ -176,6 +180,7 @@ interface UseChatOptions {
176
180
  interface UseChatReturn {
177
181
  state: ChatState;
178
182
  sendText: (text: string) => Promise<void>;
183
+ uploadCsv: (file: File) => Promise<void>;
179
184
  appendBotResponse: (resp: BotResponse) => void;
180
185
  appendUserMessage: (content: string) => Message;
181
186
  deactivatePriorChips: (keepId?: string) => void;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useState, useRef, useEffect, useCallback, useReducer, useMemo } from 'react';
3
- import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import DOMPurify from 'isomorphic-dompurify';
5
5
 
6
6
  // src/components/WealthChat.tsx
@@ -278,6 +278,50 @@ async function sendMessage(apiBase, message, sessionId, context, signal) {
278
278
  signal
279
279
  });
280
280
  }
281
+ async function uploadPortfolioCsv(apiBase, file, sessionId, signal) {
282
+ const url = joinUrl(apiBase, "/upload-portfolio-csv");
283
+ const requestId = generateRequestId();
284
+ const session = readSession();
285
+ const form = new FormData();
286
+ form.append("sessionId", sessionId);
287
+ form.append("file", file, file.name);
288
+ const controller = new AbortController();
289
+ const timeoutId = setTimeout(() => controller.abort(), 6e4);
290
+ if (signal) {
291
+ if (signal.aborted) {
292
+ clearTimeout(timeoutId);
293
+ throw new DOMException("Aborted", "AbortError");
294
+ }
295
+ signal.addEventListener("abort", () => controller.abort(), { once: true });
296
+ }
297
+ try {
298
+ const headers = { "X-Request-Id": requestId };
299
+ if (session?.token) headers["Authorization"] = `Bearer ${session.token}`;
300
+ const res = await fetch(url, {
301
+ method: "POST",
302
+ headers,
303
+ body: form,
304
+ signal: controller.signal,
305
+ credentials: "same-origin"
306
+ });
307
+ if (res.status === 401 || res.status === 403) {
308
+ clearSession();
309
+ throw new AuthExpiredError(requestId);
310
+ }
311
+ if (!res.ok) {
312
+ let detail = res.statusText;
313
+ try {
314
+ const errBody = await res.json();
315
+ detail = errBody.message ?? errBody.detail ?? detail;
316
+ } catch {
317
+ }
318
+ throw new ApiError(detail || `HTTP ${res.status}`, res.status, requestId);
319
+ }
320
+ return await res.json();
321
+ } finally {
322
+ clearTimeout(timeoutId);
323
+ }
324
+ }
281
325
  async function logout(apiBase, signal) {
282
326
  try {
283
327
  await request(apiBase, "/auth/logout", {
@@ -424,6 +468,37 @@ function useChat(opts) {
424
468
  const deactivatePriorChips = useCallback((keepId) => {
425
469
  dispatch({ type: "DEACTIVATE_CHIPS", payload: { exceptId: keepId } });
426
470
  }, []);
471
+ const uploadCsv = useCallback(
472
+ async (file) => {
473
+ if (!sessionId) return;
474
+ abortRef.current?.abort();
475
+ const controller = new AbortController();
476
+ abortRef.current = controller;
477
+ deactivatePriorChips();
478
+ appendUserMessage(`Uploaded ${file.name}`);
479
+ dispatch({ type: "SET_TYPING", payload: true });
480
+ dispatch({ type: "SET_STATUS", payload: "sending" });
481
+ dispatch({ type: "SET_ERROR", payload: null });
482
+ try {
483
+ const resp = await uploadPortfolioCsv(apiBase, file, sessionId, controller.signal);
484
+ appendBotResponse(resp);
485
+ dispatch({ type: "SET_STATUS", payload: "idle" });
486
+ } catch (err) {
487
+ const error = err;
488
+ if (error.name === "AbortError") return;
489
+ if (error instanceof AuthExpiredError) {
490
+ onAuthExpiredRef.current?.();
491
+ } else {
492
+ onErrorRef.current?.(error);
493
+ dispatch({ type: "SET_ERROR", payload: error.message });
494
+ }
495
+ dispatch({ type: "SET_STATUS", payload: "error" });
496
+ } finally {
497
+ dispatch({ type: "SET_TYPING", payload: false });
498
+ }
499
+ },
500
+ [apiBase, sessionId, appendUserMessage, appendBotResponse, deactivatePriorChips]
501
+ );
427
502
  const sendText = useCallback(
428
503
  async (text) => {
429
504
  const trimmed = text.trim();
@@ -470,6 +545,7 @@ function useChat(opts) {
470
545
  return {
471
546
  state,
472
547
  sendText,
548
+ uploadCsv,
473
549
  appendBotResponse,
474
550
  appendUserMessage,
475
551
  deactivatePriorChips,
@@ -605,6 +681,8 @@ var chat_default = {
605
681
  positionRight: "chat_positionRight",
606
682
  positionLeft: "chat_positionLeft",
607
683
  widget: "chat_widget",
684
+ popupBubbleLeft: "chat_popupBubbleLeft",
685
+ popupBubbleRight: "chat_popupBubbleRight",
608
686
  header: "chat_header",
609
687
  headerTitle: "chat_headerTitle",
610
688
  headerMeta: "chat_headerMeta",
@@ -624,6 +702,7 @@ var chat_default = {
624
702
  input: "chat_input",
625
703
  inputBox: "chat_inputBox",
626
704
  sendButton: "chat_sendButton",
705
+ hiddenFileInput: "chat_hiddenFileInput",
627
706
  authGate: "chat_authGate",
628
707
  authGateIcon: "chat_authGateIcon",
629
708
  authGateTitle: "chat_authGateTitle",
@@ -631,7 +710,9 @@ var chat_default = {
631
710
  authGateButton: "chat_authGateButton",
632
711
  authGateDisclaimer: "chat_authGateDisclaimer",
633
712
  authGateDisclaimerTitle: "chat_authGateDisclaimerTitle",
634
- errorBanner: "chat_errorBanner"
713
+ errorBanner: "chat_errorBanner",
714
+ popupBubble: "chat_popupBubble",
715
+ popupDismiss: "chat_popupDismiss"
635
716
  };
636
717
  function AuthGate({ brandName, loginUrl, onLoginClick }) {
637
718
  const handleClick = () => {
@@ -841,16 +922,24 @@ function ChatHeader({
841
922
  }
842
923
  function ChatInput({ disabled, placeholder, onSend }) {
843
924
  const [value, setValue] = useState("");
925
+ const inputRef = useRef(null);
926
+ useEffect(() => {
927
+ if (!disabled) {
928
+ inputRef.current?.focus();
929
+ }
930
+ }, [disabled]);
844
931
  const submit = () => {
845
932
  const trimmed = value.trim();
846
933
  if (!trimmed || disabled) return;
847
934
  onSend(trimmed);
848
935
  setValue("");
936
+ inputRef.current?.focus();
849
937
  };
850
938
  return /* @__PURE__ */ jsxs("div", { className: chat_default.input, children: [
851
939
  /* @__PURE__ */ jsx(
852
940
  "input",
853
941
  {
942
+ ref: inputRef,
854
943
  type: "text",
855
944
  className: chat_default.inputBox,
856
945
  value,
@@ -878,25 +967,51 @@ function ChatInput({ disabled, placeholder, onSend }) {
878
967
  )
879
968
  ] });
880
969
  }
881
- function FloatingButton({ position, onClick, brandColor }) {
970
+ function FloatingButton({ position, onClick, brandColor, showPopup, popupMessage, onPopupDismiss }) {
882
971
  const posClass = position === "bottom-left" ? chat_default.positionLeft : chat_default.positionRight;
883
- return /* @__PURE__ */ jsx(
884
- "button",
885
- {
886
- type: "button",
887
- className: `${chat_default.floatingButton} ${posClass}`,
888
- onClick,
889
- "aria-label": "Open chat",
890
- style: brandColor ? { background: brandColor } : void 0,
891
- children: "\u{1F4AC}"
892
- }
893
- );
972
+ const popupPosClass = position === "bottom-left" ? chat_default.popupBubbleLeft : chat_default.popupBubbleRight;
973
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
974
+ showPopup && popupMessage ? /* @__PURE__ */ jsxs(
975
+ "div",
976
+ {
977
+ className: `${chat_default.popupBubble} ${popupPosClass}`,
978
+ role: "status",
979
+ "aria-live": "polite",
980
+ children: [
981
+ popupMessage,
982
+ /* @__PURE__ */ jsx(
983
+ "button",
984
+ {
985
+ type: "button",
986
+ className: chat_default.popupDismiss,
987
+ onClick: onPopupDismiss,
988
+ "aria-label": "Dismiss greeting",
989
+ children: "\u2715"
990
+ }
991
+ )
992
+ ]
993
+ }
994
+ ) : null,
995
+ /* @__PURE__ */ jsx(
996
+ "button",
997
+ {
998
+ type: "button",
999
+ className: `${chat_default.floatingButton} ${posClass}`,
1000
+ onClick,
1001
+ "aria-label": "Open chat",
1002
+ style: brandColor ? { background: brandColor } : void 0,
1003
+ children: "\u{1F4AC}"
1004
+ }
1005
+ )
1006
+ ] });
894
1007
  }
895
1008
  var DEFAULT_BRAND_NAME = "Wealth Alpha AI";
896
1009
  var DEFAULT_BRAND_COLOR = "#1a2d5a";
897
1010
  var DEFAULT_AUTH_CHECK = "/me";
1011
+ var DEFAULT_GREETING = "Hi! I'm your Wealth Alpha AI assistant. How can I help you?";
898
1012
  var DISCLAIMER_BLOCK = "DISCLAIMER:\n\u2022 AI-assisted analysis for educational purposes only.\n\u2022 Not financial advice. Markets involve risk.\n\u2022 Consult a SEBI-registered advisor before investing.";
899
1013
  var CTA_LINE = "Select a quick command below \u2014 or type your query to ask our AI Research Analyst directly.";
1014
+ var PORTFOLIO_CSV_CHIP_ID = "__portfolio_csv_upload";
900
1015
  function buildWelcome(name, plan) {
901
1016
  const greeting = name ? `Welcome back, ${name}! You have ${plan ? plan : "Premium"} access.` : `Welcome! You have ${plan ? plan : "Premium"} access.`;
902
1017
  return `${greeting}
@@ -917,6 +1032,7 @@ function WealthChat(props) {
917
1032
  position = "bottom-right",
918
1033
  defaultOpen = false,
919
1034
  showCountdown = true,
1035
+ greetingMessage = DEFAULT_GREETING,
920
1036
  onLogin,
921
1037
  onLogout,
922
1038
  onSessionExpire,
@@ -924,9 +1040,19 @@ function WealthChat(props) {
924
1040
  } = props;
925
1041
  const [mounted, setMounted] = useState(false);
926
1042
  const [open, setOpen] = useState(defaultOpen);
1043
+ const [showPopup, setShowPopup] = useState(false);
1044
+ const popupShownRef = useRef(defaultOpen);
927
1045
  useEffect(() => {
928
1046
  setMounted(true);
929
1047
  }, []);
1048
+ useEffect(() => {
1049
+ if (!mounted || open || popupShownRef.current) return;
1050
+ const timer = setTimeout(() => {
1051
+ setShowPopup(true);
1052
+ popupShownRef.current = true;
1053
+ }, 1e3);
1054
+ return () => clearTimeout(timer);
1055
+ }, [mounted, open]);
930
1056
  const {
931
1057
  session,
932
1058
  remainingMs,
@@ -954,9 +1080,11 @@ function WealthChat(props) {
954
1080
  },
955
1081
  [session, setHistory]
956
1082
  );
1083
+ const csvFileRef = useRef(null);
957
1084
  const {
958
1085
  state: chatState,
959
1086
  sendText,
1087
+ uploadCsv,
960
1088
  appendBotResponse,
961
1089
  appendUserMessage,
962
1090
  deactivatePriorChips,
@@ -996,6 +1124,11 @@ function WealthChat(props) {
996
1124
  async (chip) => {
997
1125
  touch();
998
1126
  deactivatePriorChips();
1127
+ if (chip.id === PORTFOLIO_CSV_CHIP_ID) {
1128
+ appendUserMessage(chip.label);
1129
+ csvFileRef.current?.click();
1130
+ return;
1131
+ }
999
1132
  appendUserMessage(chip.label);
1000
1133
  setTyping(true);
1001
1134
  try {
@@ -1007,6 +1140,17 @@ function WealthChat(props) {
1007
1140
  },
1008
1141
  [touch, deactivatePriorChips, appendUserMessage, callChip, setTyping, appendBotResponse]
1009
1142
  );
1143
+ const handleCsvFileSelected = useCallback(
1144
+ (e) => {
1145
+ const file = e.target.files?.[0];
1146
+ e.target.value = "";
1147
+ if (file) {
1148
+ touch();
1149
+ void uploadCsv(file);
1150
+ }
1151
+ },
1152
+ [touch, uploadCsv]
1153
+ );
1010
1154
  const handleSend = useCallback(
1011
1155
  (text) => {
1012
1156
  touch();
@@ -1014,6 +1158,10 @@ function WealthChat(props) {
1014
1158
  },
1015
1159
  [touch, sendText]
1016
1160
  );
1161
+ const handleFloatingButtonClick = useCallback(() => {
1162
+ setOpen(true);
1163
+ setShowPopup(false);
1164
+ }, []);
1017
1165
  const handleClose = useCallback(() => setOpen(false), []);
1018
1166
  const handleClear = useCallback(() => {
1019
1167
  clearChat();
@@ -1030,7 +1178,17 @@ function WealthChat(props) {
1030
1178
  ["--wac-brand"]: brandColor
1031
1179
  };
1032
1180
  return /* @__PURE__ */ jsxs("div", { className: chat_default.root, style: rootStyle, children: [
1033
- !open ? /* @__PURE__ */ jsx(FloatingButton, { position, onClick: () => setOpen(true), brandColor }) : null,
1181
+ !open ? /* @__PURE__ */ jsx(
1182
+ FloatingButton,
1183
+ {
1184
+ position,
1185
+ onClick: handleFloatingButtonClick,
1186
+ brandColor,
1187
+ showPopup,
1188
+ popupMessage: greetingMessage,
1189
+ onPopupDismiss: () => setShowPopup(false)
1190
+ }
1191
+ ) : null,
1034
1192
  open ? /* @__PURE__ */ jsxs(
1035
1193
  "div",
1036
1194
  {
@@ -1060,6 +1218,18 @@ function WealthChat(props) {
1060
1218
  onLoginClick: handleLoginClick
1061
1219
  }
1062
1220
  ),
1221
+ /* @__PURE__ */ jsx(
1222
+ "input",
1223
+ {
1224
+ ref: csvFileRef,
1225
+ type: "file",
1226
+ accept: ".csv,text/csv",
1227
+ className: chat_default.hiddenFileInput,
1228
+ onChange: handleCsvFileSelected,
1229
+ "aria-hidden": true,
1230
+ tabIndex: -1
1231
+ }
1232
+ ),
1063
1233
  isLoggedIn ? /* @__PURE__ */ jsx(
1064
1234
  ChatInput,
1065
1235
  {