@repzo/widget-react-native 1.0.0
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 +482 -0
- package/lib/commonjs/agent-ui-blocks.js +159 -0
- package/lib/commonjs/agent-ui-blocks.js.map +1 -0
- package/lib/commonjs/api/client.js +267 -0
- package/lib/commonjs/api/client.js.map +1 -0
- package/lib/commonjs/api/realtime.js +193 -0
- package/lib/commonjs/api/realtime.js.map +1 -0
- package/lib/commonjs/api/sse-parser.js +58 -0
- package/lib/commonjs/api/sse-parser.js.map +1 -0
- package/lib/commonjs/controller.js +23 -0
- package/lib/commonjs/controller.js.map +1 -0
- package/lib/commonjs/device-id.js +75 -0
- package/lib/commonjs/device-id.js.map +1 -0
- package/lib/commonjs/events.js +49 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/i18n.js +106 -0
- package/lib/commonjs/i18n.js.map +1 -0
- package/lib/commonjs/index.js +98 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/locales.js +85 -0
- package/lib/commonjs/locales.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/push/push-notifications.js +208 -0
- package/lib/commonjs/push/push-notifications.js.map +1 -0
- package/lib/commonjs/state/use-widget-state.js +23 -0
- package/lib/commonjs/state/use-widget-state.js.map +1 -0
- package/lib/commonjs/state/widget-store.js +1682 -0
- package/lib/commonjs/state/widget-store.js.map +1 -0
- package/lib/commonjs/storage.js +147 -0
- package/lib/commonjs/storage.js.map +1 -0
- package/lib/commonjs/types.js +44 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/ui/WidgetProvider.js +404 -0
- package/lib/commonjs/ui/WidgetProvider.js.map +1 -0
- package/lib/commonjs/ui/components/AgentUiBlocks.js +864 -0
- package/lib/commonjs/ui/components/AgentUiBlocks.js.map +1 -0
- package/lib/commonjs/ui/components/Avatar.js +76 -0
- package/lib/commonjs/ui/components/Avatar.js.map +1 -0
- package/lib/commonjs/ui/components/ConversationRow.js +155 -0
- package/lib/commonjs/ui/components/ConversationRow.js.map +1 -0
- package/lib/commonjs/ui/components/ErrorBoundary.js +44 -0
- package/lib/commonjs/ui/components/ErrorBoundary.js.map +1 -0
- package/lib/commonjs/ui/components/Gradient.js +168 -0
- package/lib/commonjs/ui/components/Gradient.js.map +1 -0
- package/lib/commonjs/ui/components/Launcher.js +125 -0
- package/lib/commonjs/ui/components/Launcher.js.map +1 -0
- package/lib/commonjs/ui/components/Markdown.js +257 -0
- package/lib/commonjs/ui/components/Markdown.js.map +1 -0
- package/lib/commonjs/ui/components/OutboundMessageCard.js +157 -0
- package/lib/commonjs/ui/components/OutboundMessageCard.js.map +1 -0
- package/lib/commonjs/ui/components/WidgetPanel.js +131 -0
- package/lib/commonjs/ui/components/WidgetPanel.js.map +1 -0
- package/lib/commonjs/ui/components/icons.js +383 -0
- package/lib/commonjs/ui/components/icons.js.map +1 -0
- package/lib/commonjs/ui/hooks/use-keyboard-overlap.js +113 -0
- package/lib/commonjs/ui/hooks/use-keyboard-overlap.js.map +1 -0
- package/lib/commonjs/ui/hooks/use-reduce-motion.js +38 -0
- package/lib/commonjs/ui/hooks/use-reduce-motion.js.map +1 -0
- package/lib/commonjs/ui/hooks/use-widget-insets.js +41 -0
- package/lib/commonjs/ui/hooks/use-widget-insets.js.map +1 -0
- package/lib/commonjs/ui/screens/chat/ChatView.js +590 -0
- package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -0
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js +362 -0
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -0
- package/lib/commonjs/ui/screens/chat/ChatView.types.js +6 -0
- package/lib/commonjs/ui/screens/chat/ChatView.types.js.map +1 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.js +150 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.js.map +1 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.styles.js +118 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.styles.js.map +1 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.types.js +6 -0
- package/lib/commonjs/ui/screens/conversations/ConversationsList.types.js.map +1 -0
- package/lib/commonjs/ui/screens/home/HomeView.js +336 -0
- package/lib/commonjs/ui/screens/home/HomeView.js.map +1 -0
- package/lib/commonjs/ui/screens/home/HomeView.styles.js +245 -0
- package/lib/commonjs/ui/screens/home/HomeView.styles.js.map +1 -0
- package/lib/commonjs/ui/screens/home/HomeView.types.js +6 -0
- package/lib/commonjs/ui/screens/home/HomeView.types.js.map +1 -0
- package/lib/commonjs/ui/screens/home/greeting.js +49 -0
- package/lib/commonjs/ui/screens/home/greeting.js.map +1 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.js +229 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.js.map +1 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.styles.js +125 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.styles.js.map +1 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.types.js +6 -0
- package/lib/commonjs/ui/screens/pre-chat/PreChatForm.types.js.map +1 -0
- package/lib/commonjs/ui/styles/global.js +55 -0
- package/lib/commonjs/ui/styles/global.js.map +1 -0
- package/lib/commonjs/ui/styles/theme.js +148 -0
- package/lib/commonjs/ui/styles/theme.js.map +1 -0
- package/lib/commonjs/ui/utils/conversations.js +125 -0
- package/lib/commonjs/ui/utils/conversations.js.map +1 -0
- package/lib/commonjs/ui/utils/html.js +44 -0
- package/lib/commonjs/ui/utils/html.js.map +1 -0
- package/lib/commonjs/ui/utils/native-gradient.js +65 -0
- package/lib/commonjs/ui/utils/native-gradient.js.map +1 -0
- package/lib/commonjs/ui/utils/rtl.js +56 -0
- package/lib/commonjs/ui/utils/rtl.js.map +1 -0
- package/lib/commonjs/ui/utils/safe-url.js +67 -0
- package/lib/commonjs/ui/utils/safe-url.js.map +1 -0
- package/lib/module/agent-ui-blocks.js +152 -0
- package/lib/module/agent-ui-blocks.js.map +1 -0
- package/lib/module/api/client.js +261 -0
- package/lib/module/api/client.js.map +1 -0
- package/lib/module/api/realtime.js +189 -0
- package/lib/module/api/realtime.js.map +1 -0
- package/lib/module/api/sse-parser.js +53 -0
- package/lib/module/api/sse-parser.js.map +1 -0
- package/lib/module/controller.js +19 -0
- package/lib/module/controller.js.map +1 -0
- package/lib/module/device-id.js +69 -0
- package/lib/module/device-id.js.map +1 -0
- package/lib/module/events.js +44 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/i18n.js +99 -0
- package/lib/module/i18n.js.map +1 -0
- package/lib/module/index.js +55 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/locales.js +80 -0
- package/lib/module/locales.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/push/push-notifications.js +204 -0
- package/lib/module/push/push-notifications.js.map +1 -0
- package/lib/module/state/use-widget-state.js +18 -0
- package/lib/module/state/use-widget-state.js.map +1 -0
- package/lib/module/state/widget-store.js +1677 -0
- package/lib/module/state/widget-store.js.map +1 -0
- package/lib/module/storage.js +141 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/types.js +40 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/ui/WidgetProvider.js +400 -0
- package/lib/module/ui/WidgetProvider.js.map +1 -0
- package/lib/module/ui/components/AgentUiBlocks.js +857 -0
- package/lib/module/ui/components/AgentUiBlocks.js.map +1 -0
- package/lib/module/ui/components/Avatar.js +71 -0
- package/lib/module/ui/components/Avatar.js.map +1 -0
- package/lib/module/ui/components/ConversationRow.js +150 -0
- package/lib/module/ui/components/ConversationRow.js.map +1 -0
- package/lib/module/ui/components/ErrorBoundary.js +39 -0
- package/lib/module/ui/components/ErrorBoundary.js.map +1 -0
- package/lib/module/ui/components/Gradient.js +165 -0
- package/lib/module/ui/components/Gradient.js.map +1 -0
- package/lib/module/ui/components/Launcher.js +121 -0
- package/lib/module/ui/components/Launcher.js.map +1 -0
- package/lib/module/ui/components/Markdown.js +253 -0
- package/lib/module/ui/components/Markdown.js.map +1 -0
- package/lib/module/ui/components/OutboundMessageCard.js +153 -0
- package/lib/module/ui/components/OutboundMessageCard.js.map +1 -0
- package/lib/module/ui/components/WidgetPanel.js +127 -0
- package/lib/module/ui/components/WidgetPanel.js.map +1 -0
- package/lib/module/ui/components/icons.js +370 -0
- package/lib/module/ui/components/icons.js.map +1 -0
- package/lib/module/ui/hooks/use-keyboard-overlap.js +109 -0
- package/lib/module/ui/hooks/use-keyboard-overlap.js.map +1 -0
- package/lib/module/ui/hooks/use-reduce-motion.js +34 -0
- package/lib/module/ui/hooks/use-reduce-motion.js.map +1 -0
- package/lib/module/ui/hooks/use-widget-insets.js +37 -0
- package/lib/module/ui/hooks/use-widget-insets.js.map +1 -0
- package/lib/module/ui/screens/chat/ChatView.js +586 -0
- package/lib/module/ui/screens/chat/ChatView.js.map +1 -0
- package/lib/module/ui/screens/chat/ChatView.styles.js +358 -0
- package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -0
- package/lib/module/ui/screens/chat/ChatView.types.js +4 -0
- package/lib/module/ui/screens/chat/ChatView.types.js.map +1 -0
- package/lib/module/ui/screens/conversations/ConversationsList.js +146 -0
- package/lib/module/ui/screens/conversations/ConversationsList.js.map +1 -0
- package/lib/module/ui/screens/conversations/ConversationsList.styles.js +114 -0
- package/lib/module/ui/screens/conversations/ConversationsList.styles.js.map +1 -0
- package/lib/module/ui/screens/conversations/ConversationsList.types.js +4 -0
- package/lib/module/ui/screens/conversations/ConversationsList.types.js.map +1 -0
- package/lib/module/ui/screens/home/HomeView.js +332 -0
- package/lib/module/ui/screens/home/HomeView.js.map +1 -0
- package/lib/module/ui/screens/home/HomeView.styles.js +242 -0
- package/lib/module/ui/screens/home/HomeView.styles.js.map +1 -0
- package/lib/module/ui/screens/home/HomeView.types.js +4 -0
- package/lib/module/ui/screens/home/HomeView.types.js.map +1 -0
- package/lib/module/ui/screens/home/greeting.js +44 -0
- package/lib/module/ui/screens/home/greeting.js.map +1 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.js +225 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.js.map +1 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.styles.js +121 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.styles.js.map +1 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.types.js +4 -0
- package/lib/module/ui/screens/pre-chat/PreChatForm.types.js.map +1 -0
- package/lib/module/ui/styles/global.js +51 -0
- package/lib/module/ui/styles/global.js.map +1 -0
- package/lib/module/ui/styles/theme.js +137 -0
- package/lib/module/ui/styles/theme.js.map +1 -0
- package/lib/module/ui/utils/conversations.js +115 -0
- package/lib/module/ui/utils/conversations.js.map +1 -0
- package/lib/module/ui/utils/html.js +39 -0
- package/lib/module/ui/utils/html.js.map +1 -0
- package/lib/module/ui/utils/native-gradient.js +60 -0
- package/lib/module/ui/utils/native-gradient.js.map +1 -0
- package/lib/module/ui/utils/rtl.js +49 -0
- package/lib/module/ui/utils/rtl.js.map +1 -0
- package/lib/module/ui/utils/safe-url.js +59 -0
- package/lib/module/ui/utils/safe-url.js.map +1 -0
- package/lib/typescript/commonjs/agent-ui-blocks.d.ts +20 -0
- package/lib/typescript/commonjs/agent-ui-blocks.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/client.d.ts +115 -0
- package/lib/typescript/commonjs/api/client.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/realtime.d.ts +39 -0
- package/lib/typescript/commonjs/api/realtime.d.ts.map +1 -0
- package/lib/typescript/commonjs/api/sse-parser.d.ts +13 -0
- package/lib/typescript/commonjs/api/sse-parser.d.ts.map +1 -0
- package/lib/typescript/commonjs/controller.d.ts +15 -0
- package/lib/typescript/commonjs/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/device-id.d.ts +15 -0
- package/lib/typescript/commonjs/device-id.d.ts.map +1 -0
- package/lib/typescript/commonjs/events.d.ts +41 -0
- package/lib/typescript/commonjs/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n.d.ts +78 -0
- package/lib/typescript/commonjs/i18n.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +103 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/locales.d.ts +18 -0
- package/lib/typescript/commonjs/locales.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/push/push-notifications.d.ts +71 -0
- package/lib/typescript/commonjs/push/push-notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/use-widget-state.d.ts +10 -0
- package/lib/typescript/commonjs/state/use-widget-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/widget-store.d.ts +227 -0
- package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/storage.d.ts +42 -0
- package/lib/typescript/commonjs/storage.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +391 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/WidgetProvider.d.ts +15 -0
- package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts +27 -0
- package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Avatar.d.ts +19 -0
- package/lib/typescript/commonjs/ui/components/Avatar.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts +26 -0
- package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts +27 -0
- package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Gradient.d.ts +33 -0
- package/lib/typescript/commonjs/ui/components/Gradient.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Launcher.d.ts +18 -0
- package/lib/typescript/commonjs/ui/components/Launcher.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Markdown.d.ts +19 -0
- package/lib/typescript/commonjs/ui/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/OutboundMessageCard.d.ts +20 -0
- package/lib/typescript/commonjs/ui/components/OutboundMessageCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/WidgetPanel.d.ts +26 -0
- package/lib/typescript/commonjs/ui/components/WidgetPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts +38 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/use-keyboard-overlap.d.ts +33 -0
- package/lib/typescript/commonjs/ui/hooks/use-keyboard-overlap.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/use-reduce-motion.d.ts +11 -0
- package/lib/typescript/commonjs/ui/hooks/use-reduce-motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/use-widget-insets.d.ts +16 -0
- package/lib/typescript/commonjs/ui/hooks/use-widget-insets.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +11 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +349 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +48 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts +10 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.styles.d.ts +113 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts +31 -0
- package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts +17 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts +227 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts +40 -0
- package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/home/greeting.d.ts +19 -0
- package/lib/typescript/commonjs/ui/screens/home/greeting.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.d.ts +7 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.styles.d.ts +115 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.types.d.ts +20 -0
- package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/styles/global.d.ts +46 -0
- package/lib/typescript/commonjs/ui/styles/global.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/styles/theme.d.ts +103 -0
- package/lib/typescript/commonjs/ui/styles/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/conversations.d.ts +41 -0
- package/lib/typescript/commonjs/ui/utils/conversations.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/html.d.ts +10 -0
- package/lib/typescript/commonjs/ui/utils/html.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/native-gradient.d.ts +61 -0
- package/lib/typescript/commonjs/ui/utils/native-gradient.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/rtl.d.ts +33 -0
- package/lib/typescript/commonjs/ui/utils/rtl.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/safe-url.d.ts +21 -0
- package/lib/typescript/commonjs/ui/utils/safe-url.d.ts.map +1 -0
- package/lib/typescript/module/agent-ui-blocks.d.ts +20 -0
- package/lib/typescript/module/agent-ui-blocks.d.ts.map +1 -0
- package/lib/typescript/module/api/client.d.ts +115 -0
- package/lib/typescript/module/api/client.d.ts.map +1 -0
- package/lib/typescript/module/api/realtime.d.ts +39 -0
- package/lib/typescript/module/api/realtime.d.ts.map +1 -0
- package/lib/typescript/module/api/sse-parser.d.ts +13 -0
- package/lib/typescript/module/api/sse-parser.d.ts.map +1 -0
- package/lib/typescript/module/controller.d.ts +15 -0
- package/lib/typescript/module/controller.d.ts.map +1 -0
- package/lib/typescript/module/device-id.d.ts +15 -0
- package/lib/typescript/module/device-id.d.ts.map +1 -0
- package/lib/typescript/module/events.d.ts +41 -0
- package/lib/typescript/module/events.d.ts.map +1 -0
- package/lib/typescript/module/i18n.d.ts +78 -0
- package/lib/typescript/module/i18n.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +103 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/locales.d.ts +18 -0
- package/lib/typescript/module/locales.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/push/push-notifications.d.ts +71 -0
- package/lib/typescript/module/push/push-notifications.d.ts.map +1 -0
- package/lib/typescript/module/state/use-widget-state.d.ts +10 -0
- package/lib/typescript/module/state/use-widget-state.d.ts.map +1 -0
- package/lib/typescript/module/state/widget-store.d.ts +227 -0
- package/lib/typescript/module/state/widget-store.d.ts.map +1 -0
- package/lib/typescript/module/storage.d.ts +42 -0
- package/lib/typescript/module/storage.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +391 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/lib/typescript/module/ui/WidgetProvider.d.ts +15 -0
- package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts +27 -0
- package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Avatar.d.ts +19 -0
- package/lib/typescript/module/ui/components/Avatar.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ConversationRow.d.ts +26 -0
- package/lib/typescript/module/ui/components/ConversationRow.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ErrorBoundary.d.ts +27 -0
- package/lib/typescript/module/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Gradient.d.ts +33 -0
- package/lib/typescript/module/ui/components/Gradient.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Launcher.d.ts +18 -0
- package/lib/typescript/module/ui/components/Launcher.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Markdown.d.ts +19 -0
- package/lib/typescript/module/ui/components/Markdown.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OutboundMessageCard.d.ts +20 -0
- package/lib/typescript/module/ui/components/OutboundMessageCard.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/WidgetPanel.d.ts +26 -0
- package/lib/typescript/module/ui/components/WidgetPanel.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/icons.d.ts +38 -0
- package/lib/typescript/module/ui/components/icons.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/use-keyboard-overlap.d.ts +33 -0
- package/lib/typescript/module/ui/hooks/use-keyboard-overlap.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/use-reduce-motion.d.ts +11 -0
- package/lib/typescript/module/ui/hooks/use-reduce-motion.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/use-widget-insets.d.ts +16 -0
- package/lib/typescript/module/ui/hooks/use-widget-insets.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +11 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +349 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +48 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts +10 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.styles.d.ts +113 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.styles.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts +31 -0
- package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/home/HomeView.d.ts +17 -0
- package/lib/typescript/module/ui/screens/home/HomeView.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts +227 -0
- package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts +40 -0
- package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/home/greeting.d.ts +19 -0
- package/lib/typescript/module/ui/screens/home/greeting.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.d.ts +7 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.styles.d.ts +115 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.styles.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.types.d.ts +20 -0
- package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.types.d.ts.map +1 -0
- package/lib/typescript/module/ui/styles/global.d.ts +46 -0
- package/lib/typescript/module/ui/styles/global.d.ts.map +1 -0
- package/lib/typescript/module/ui/styles/theme.d.ts +103 -0
- package/lib/typescript/module/ui/styles/theme.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/conversations.d.ts +41 -0
- package/lib/typescript/module/ui/utils/conversations.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/html.d.ts +10 -0
- package/lib/typescript/module/ui/utils/html.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/native-gradient.d.ts +61 -0
- package/lib/typescript/module/ui/utils/native-gradient.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/rtl.d.ts +33 -0
- package/lib/typescript/module/ui/utils/rtl.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/safe-url.d.ts +21 -0
- package/lib/typescript/module/ui/utils/safe-url.d.ts.map +1 -0
- package/metro.js +40 -0
- package/package.json +116 -0
- package/src/agent-ui-blocks.ts +302 -0
- package/src/api/client.ts +332 -0
- package/src/api/realtime.ts +225 -0
- package/src/api/sse-parser.ts +51 -0
- package/src/controller.ts +20 -0
- package/src/device-id.ts +71 -0
- package/src/events.ts +74 -0
- package/src/i18n.ts +114 -0
- package/src/index.tsx +199 -0
- package/src/locales.ts +80 -0
- package/src/push/push-notifications.ts +254 -0
- package/src/state/use-widget-state.ts +20 -0
- package/src/state/widget-store.ts +1815 -0
- package/src/storage.ts +153 -0
- package/src/types.ts +445 -0
- package/src/ui/WidgetProvider.tsx +434 -0
- package/src/ui/components/AgentUiBlocks.tsx +912 -0
- package/src/ui/components/Avatar.tsx +86 -0
- package/src/ui/components/ConversationRow.tsx +163 -0
- package/src/ui/components/ErrorBoundary.tsx +49 -0
- package/src/ui/components/Gradient.tsx +165 -0
- package/src/ui/components/Launcher.tsx +128 -0
- package/src/ui/components/Markdown.tsx +291 -0
- package/src/ui/components/OutboundMessageCard.tsx +154 -0
- package/src/ui/components/WidgetPanel.tsx +133 -0
- package/src/ui/components/icons.tsx +315 -0
- package/src/ui/hooks/use-keyboard-overlap.ts +134 -0
- package/src/ui/hooks/use-reduce-motion.ts +39 -0
- package/src/ui/hooks/use-widget-insets.ts +44 -0
- package/src/ui/screens/chat/ChatView.styles.ts +357 -0
- package/src/ui/screens/chat/ChatView.tsx +690 -0
- package/src/ui/screens/chat/ChatView.types.ts +46 -0
- package/src/ui/screens/conversations/ConversationsList.styles.ts +111 -0
- package/src/ui/screens/conversations/ConversationsList.tsx +144 -0
- package/src/ui/screens/conversations/ConversationsList.types.ts +33 -0
- package/src/ui/screens/home/HomeView.styles.ts +246 -0
- package/src/ui/screens/home/HomeView.tsx +336 -0
- package/src/ui/screens/home/HomeView.types.ts +42 -0
- package/src/ui/screens/home/greeting.ts +50 -0
- package/src/ui/screens/pre-chat/PreChatForm.styles.ts +120 -0
- package/src/ui/screens/pre-chat/PreChatForm.tsx +221 -0
- package/src/ui/screens/pre-chat/PreChatForm.types.ts +22 -0
- package/src/ui/styles/global.ts +50 -0
- package/src/ui/styles/theme.ts +155 -0
- package/src/ui/utils/conversations.ts +122 -0
- package/src/ui/utils/html.ts +58 -0
- package/src/ui/utils/native-gradient.ts +60 -0
- package/src/ui/utils/rtl.ts +43 -0
- package/src/ui/utils/safe-url.ts +63 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<RepzoWidgetProvider>` — mount once at the app root.
|
|
3
|
+
*
|
|
4
|
+
* Hosts the chat modal and subscribes to the controller's store. It owns no
|
|
5
|
+
* session state: the SSE stream and unread count live in the store, so closing
|
|
6
|
+
* the modal (or never mounting it) never drops a conversation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useCallback, useMemo } from 'react';
|
|
10
|
+
import {
|
|
11
|
+
ActivityIndicator,
|
|
12
|
+
Modal,
|
|
13
|
+
Platform,
|
|
14
|
+
Pressable,
|
|
15
|
+
StyleSheet,
|
|
16
|
+
Text,
|
|
17
|
+
View,
|
|
18
|
+
} from 'react-native';
|
|
19
|
+
|
|
20
|
+
import { isTerminalErrorCode } from '../api/client';
|
|
21
|
+
import { controller } from '../controller';
|
|
22
|
+
import { buildLabels, createTranslator, formatLabel } from '../i18n';
|
|
23
|
+
import { useWidgetState } from '../state/use-widget-state';
|
|
24
|
+
import type { AgentUiAction, WidgetAttachment, WidgetSpaceType } from '../types';
|
|
25
|
+
import { WidgetErrorBoundary } from './components/ErrorBoundary';
|
|
26
|
+
import { AlertIcon } from './components/icons';
|
|
27
|
+
import { OutboundMessageCard } from './components/OutboundMessageCard';
|
|
28
|
+
import { WidgetPanel } from './components/WidgetPanel';
|
|
29
|
+
import { useKeyboardOverlap } from './hooks/use-keyboard-overlap';
|
|
30
|
+
import { useWidgetInsets } from './hooks/use-widget-insets';
|
|
31
|
+
import { ChatView } from './screens/chat/ChatView';
|
|
32
|
+
import { ConversationsList } from './screens/conversations/ConversationsList';
|
|
33
|
+
import { HomeView } from './screens/home/HomeView';
|
|
34
|
+
import { PreChatForm } from './screens/pre-chat/PreChatForm';
|
|
35
|
+
import { globalStyles } from './styles/global';
|
|
36
|
+
import { buildTheme, palette, radius, spacing, fontSize, withAlpha } from './styles/theme';
|
|
37
|
+
import { pickRecentConversations, pickTeamAgents } from './utils/conversations';
|
|
38
|
+
|
|
39
|
+
export interface RepzoWidgetProviderProps {
|
|
40
|
+
/** Rendered underneath the widget — usually the rest of the app. */
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
/** iOS sheet style. `pageSheet` keeps the native swipe-to-dismiss grabber. */
|
|
43
|
+
presentationStyle?: 'pageSheet' | 'fullScreen';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function RepzoWidgetProvider({
|
|
47
|
+
children,
|
|
48
|
+
presentationStyle = 'pageSheet',
|
|
49
|
+
}: RepzoWidgetProviderProps) {
|
|
50
|
+
const state = useWidgetState();
|
|
51
|
+
const store = controller.store;
|
|
52
|
+
const insets = useWidgetInsets();
|
|
53
|
+
// Lifts the whole panel — header, thread and composer — clear of the
|
|
54
|
+
// keyboard. It only listens while the modal is on screen, and its padding
|
|
55
|
+
// sits inside the safe-area padding below, so the two add up to exactly the
|
|
56
|
+
// keyboard's height.
|
|
57
|
+
const keyboard = useKeyboardOverlap(state.isOpen, insets.bottom);
|
|
58
|
+
|
|
59
|
+
// An iOS pageSheet is already inset below the status bar by the system; a
|
|
60
|
+
// fullScreen iOS modal and any Android modal (edge-to-edge since API 35) are
|
|
61
|
+
// not, so they own the top inset.
|
|
62
|
+
const topInset = Platform.OS === 'ios' && presentationStyle === 'pageSheet' ? 0 : insets.top;
|
|
63
|
+
|
|
64
|
+
const theme = useMemo(() => buildTheme(state.config), [state.config]);
|
|
65
|
+
const labels = useMemo(
|
|
66
|
+
() => buildLabels(createTranslator(state.config, state.locale)),
|
|
67
|
+
[state.config, state.locale]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// Home previews the two newest threads and credits the agents behind them.
|
|
71
|
+
const recentConversations = useMemo(
|
|
72
|
+
() => pickRecentConversations(state.conversations, 2),
|
|
73
|
+
[state.conversations]
|
|
74
|
+
);
|
|
75
|
+
const teamAgents = useMemo(() => pickTeamAgents(state.conversations, 3), [state.conversations]);
|
|
76
|
+
|
|
77
|
+
// Always the sum of the per-thread counts, so the tab badge tracks threads
|
|
78
|
+
// that are genuinely still unread.
|
|
79
|
+
const unreadThreadTotal = state.unreadCount;
|
|
80
|
+
|
|
81
|
+
// A cached theme is painted before init answers, so `config` alone says
|
|
82
|
+
// nothing about whether the chat works. Without a session (failed boot) or
|
|
83
|
+
// after a terminal 403, the UI must say so instead of looking usable.
|
|
84
|
+
const terminalError = !!state.error && isTerminalErrorCode(state.errorCode);
|
|
85
|
+
const blockingError = !!state.error && (!state.booted || terminalError);
|
|
86
|
+
|
|
87
|
+
const timeLabels = useMemo(
|
|
88
|
+
() => ({
|
|
89
|
+
justNow: labels.timeJustNow,
|
|
90
|
+
minutes: labels.timeMinutes,
|
|
91
|
+
hours: labels.timeHours,
|
|
92
|
+
days: labels.timeDays,
|
|
93
|
+
months: labels.timeMonths,
|
|
94
|
+
years: labels.timeYears,
|
|
95
|
+
}),
|
|
96
|
+
[labels]
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const blockLabels = useMemo(
|
|
100
|
+
() => ({
|
|
101
|
+
service: labels.blockService,
|
|
102
|
+
product: labels.blockProduct,
|
|
103
|
+
chooseTime: labels.blockChooseTime,
|
|
104
|
+
professional: labels.blockProfessional,
|
|
105
|
+
priceOffer: labels.blockPriceOffer,
|
|
106
|
+
working: labels.working,
|
|
107
|
+
}),
|
|
108
|
+
[labels]
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const handleClose = useCallback(() => store.hide(), [store]);
|
|
112
|
+
|
|
113
|
+
const handleTabChange = useCallback((tab: WidgetSpaceType) => store.setActiveTab(tab), [store]);
|
|
114
|
+
|
|
115
|
+
const handleSendMessage = useCallback(
|
|
116
|
+
(body: string, attachments?: WidgetAttachment[], action?: AgentUiAction) => {
|
|
117
|
+
store.sendMessage(body, attachments ?? [], action).catch(() => {
|
|
118
|
+
// The failed bubble already surfaces this to the visitor.
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
[store]
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const handlePreChatSubmit = useCallback(
|
|
125
|
+
async (data: Record<string, string>) => {
|
|
126
|
+
try {
|
|
127
|
+
await store.identifyVisitor({ email: data.email, name: data.name, phone: data.phone });
|
|
128
|
+
} catch {
|
|
129
|
+
// Identification is best-effort — never block the conversation.
|
|
130
|
+
}
|
|
131
|
+
store.setView('chat');
|
|
132
|
+
},
|
|
133
|
+
[store]
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const handleBack = useCallback(() => {
|
|
137
|
+
store.setView(state.activeTab === 'messages' ? 'conversations' : 'home');
|
|
138
|
+
}, [state.activeTab, store]);
|
|
139
|
+
|
|
140
|
+
const handleStartConversation = useCallback(() => {
|
|
141
|
+
if (!theme.allowNewConversations) return;
|
|
142
|
+
store.startNewConversation();
|
|
143
|
+
}, [store, theme.allowNewConversations]);
|
|
144
|
+
|
|
145
|
+
const activeConversation = state.activeConversationId
|
|
146
|
+
? state.conversations.find((conversation) => conversation.id === state.activeConversationId)
|
|
147
|
+
: null;
|
|
148
|
+
const isHomeSurface = state.view === 'home';
|
|
149
|
+
|
|
150
|
+
const renderContent = () => {
|
|
151
|
+
if (state.loading && !state.config) {
|
|
152
|
+
return (
|
|
153
|
+
<View style={styles.centered}>
|
|
154
|
+
<ActivityIndicator color={theme.primaryColor} />
|
|
155
|
+
<Text style={styles.stateText}>{labels.connecting}</Text>
|
|
156
|
+
</View>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (blockingError) {
|
|
161
|
+
// Terminal codes need the host (or Workstation) to change something —
|
|
162
|
+
// a Retry button would only burn the rate-limited init.
|
|
163
|
+
const message = !terminalError
|
|
164
|
+
? labels.connectionError
|
|
165
|
+
: state.errorCode === 'identity_verification_failed'
|
|
166
|
+
? labels.identityVerificationError
|
|
167
|
+
: labels.chatUnavailable;
|
|
168
|
+
return (
|
|
169
|
+
<View style={styles.centered}>
|
|
170
|
+
<View
|
|
171
|
+
style={[styles.stateIcon, { backgroundColor: withAlpha(theme.primaryColor, 0.08) }]}>
|
|
172
|
+
<AlertIcon size={24} />
|
|
173
|
+
</View>
|
|
174
|
+
<Text style={styles.errorText}>{message}</Text>
|
|
175
|
+
{!terminalError ? (
|
|
176
|
+
<Pressable
|
|
177
|
+
onPress={() => void store.retry()}
|
|
178
|
+
accessibilityRole="button"
|
|
179
|
+
style={[styles.retryButton, { backgroundColor: theme.primaryColor }]}>
|
|
180
|
+
<Text style={styles.retryLabel}>{labels.retry}</Text>
|
|
181
|
+
</Pressable>
|
|
182
|
+
) : null}
|
|
183
|
+
<Pressable onPress={handleClose} accessibilityRole="button" hitSlop={8}>
|
|
184
|
+
<Text style={styles.closeLabel}>{labels.close}</Text>
|
|
185
|
+
</Pressable>
|
|
186
|
+
</View>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (state.view === 'prechat' && state.config) {
|
|
191
|
+
return (
|
|
192
|
+
<PreChatForm
|
|
193
|
+
fields={state.config.preChatFields}
|
|
194
|
+
color={theme.primaryColor}
|
|
195
|
+
labels={{
|
|
196
|
+
title: labels.preChatTitle,
|
|
197
|
+
subtitle: labels.preChatSubtitle,
|
|
198
|
+
skip: labels.preChatSkip,
|
|
199
|
+
submit: labels.preChatSubmit,
|
|
200
|
+
close: labels.close,
|
|
201
|
+
fieldRequired: labels.fieldRequired,
|
|
202
|
+
invalidEmail: labels.invalidEmail,
|
|
203
|
+
}}
|
|
204
|
+
onSubmit={handlePreChatSubmit}
|
|
205
|
+
onSkip={() => store.setView('chat')}
|
|
206
|
+
onClose={handleClose}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (state.view === 'chat') {
|
|
212
|
+
return (
|
|
213
|
+
<ChatView
|
|
214
|
+
messages={state.messages}
|
|
215
|
+
loading={state.messagesLoading}
|
|
216
|
+
hasMoreMessages={state.hasMoreMessages}
|
|
217
|
+
agentTyping={state.agentTyping}
|
|
218
|
+
color={theme.primaryColor}
|
|
219
|
+
agentName={activeConversation?.agentName}
|
|
220
|
+
agentAvatar={activeConversation?.agentAvatar}
|
|
221
|
+
isOnline={theme.isOnline}
|
|
222
|
+
locale={state.locale}
|
|
223
|
+
prefillText={state.prefillText}
|
|
224
|
+
offlineMessage={theme.offlineMessage}
|
|
225
|
+
labels={{
|
|
226
|
+
back: labels.back,
|
|
227
|
+
loading: labels.loading,
|
|
228
|
+
loadEarlier: labels.loadEarlier,
|
|
229
|
+
emptyConversation: labels.emptyConversation,
|
|
230
|
+
messagePlaceholder: labels.messagePlaceholder,
|
|
231
|
+
failedToSend: labels.failedToSend,
|
|
232
|
+
thinking: labels.thinking,
|
|
233
|
+
team: labels.team,
|
|
234
|
+
statusOnline: labels.homeStatusOnline,
|
|
235
|
+
statusAway: labels.homeStatusAway,
|
|
236
|
+
close: labels.close,
|
|
237
|
+
today: labels.today,
|
|
238
|
+
yesterday: labels.yesterday,
|
|
239
|
+
conversationUpdated: labels.conversationUpdated,
|
|
240
|
+
procedureSend: labels.procedureSend,
|
|
241
|
+
procedureSent: labels.procedureSent,
|
|
242
|
+
blocks: blockLabels,
|
|
243
|
+
}}
|
|
244
|
+
onSendMessage={handleSendMessage}
|
|
245
|
+
onIdentifyVisitor={(data) => store.identifyVisitor(data)}
|
|
246
|
+
onLoadMore={() => store.loadMoreMessages()}
|
|
247
|
+
onTyping={(isTyping) => store.notifyTyping(isTyping)}
|
|
248
|
+
onBack={handleBack}
|
|
249
|
+
onClose={handleClose}
|
|
250
|
+
/>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isHomeSurface) {
|
|
255
|
+
return (
|
|
256
|
+
<HomeView
|
|
257
|
+
config={state.config}
|
|
258
|
+
color={theme.primaryColor}
|
|
259
|
+
visitorName={state.visitorProfile.name}
|
|
260
|
+
conversationCount={state.conversations.length}
|
|
261
|
+
recentConversations={recentConversations}
|
|
262
|
+
unreadByConversation={state.unreadByConversation}
|
|
263
|
+
teamAgents={teamAgents}
|
|
264
|
+
isOnline={theme.isOnline}
|
|
265
|
+
offlineMessage={theme.offlineMessage}
|
|
266
|
+
startConversationLabel={theme.startConversationLabel}
|
|
267
|
+
replyTimeLabel={theme.replyTimeLabel}
|
|
268
|
+
allowNewConversations={theme.allowNewConversations}
|
|
269
|
+
showPreviousConversations={theme.showPreviousConversations}
|
|
270
|
+
labels={{
|
|
271
|
+
close: labels.close,
|
|
272
|
+
viewPrevious: labels.viewPreviousConversations,
|
|
273
|
+
viewAll: formatLabel(labels.homeViewAllCount, { count: state.conversations.length }),
|
|
274
|
+
recentTitle: labels.homeRecentTitle,
|
|
275
|
+
noConversations: labels.homeNoConversations,
|
|
276
|
+
statusOnline: labels.homeStatusOnline,
|
|
277
|
+
statusAway: labels.homeStatusAway,
|
|
278
|
+
team: labels.team,
|
|
279
|
+
time: timeLabels,
|
|
280
|
+
unread: labels.unreadBadge,
|
|
281
|
+
}}
|
|
282
|
+
onClose={handleClose}
|
|
283
|
+
onStartConversation={handleStartConversation}
|
|
284
|
+
onViewConversations={() => handleTabChange('messages')}
|
|
285
|
+
onOpenConversation={(conversationId) => store.openConversation(conversationId)}
|
|
286
|
+
/>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return (
|
|
291
|
+
<ConversationsList
|
|
292
|
+
conversations={state.conversations}
|
|
293
|
+
unreadByConversation={state.unreadByConversation}
|
|
294
|
+
color={theme.primaryColor}
|
|
295
|
+
allowNewConversations={theme.allowNewConversations}
|
|
296
|
+
showPreviousConversations={theme.showPreviousConversations}
|
|
297
|
+
startConversationLabel={theme.startConversationLabel}
|
|
298
|
+
isOnline={theme.isOnline}
|
|
299
|
+
labels={{
|
|
300
|
+
messages: labels.messages,
|
|
301
|
+
noMessages: labels.noMessages,
|
|
302
|
+
historyHidden: labels.historyHidden,
|
|
303
|
+
startBelow: labels.startBelow,
|
|
304
|
+
close: labels.close,
|
|
305
|
+
team: labels.team,
|
|
306
|
+
statusOnline: labels.homeStatusOnline,
|
|
307
|
+
statusAway: labels.homeStatusAway,
|
|
308
|
+
time: timeLabels,
|
|
309
|
+
unread: labels.unreadBadge,
|
|
310
|
+
}}
|
|
311
|
+
onSelect={(conversationId) => store.openConversation(conversationId)}
|
|
312
|
+
onNewConversation={handleStartConversation}
|
|
313
|
+
onRefresh={() => store.refreshConversations()}
|
|
314
|
+
onClose={handleClose}
|
|
315
|
+
/>
|
|
316
|
+
);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<>
|
|
321
|
+
{children}
|
|
322
|
+
<Modal
|
|
323
|
+
visible={state.isOpen}
|
|
324
|
+
animationType="slide"
|
|
325
|
+
presentationStyle={Platform.OS === 'ios' ? presentationStyle : undefined}
|
|
326
|
+
onRequestClose={handleClose}
|
|
327
|
+
statusBarTranslucent={false}>
|
|
328
|
+
<View style={[globalStyles.screen, { paddingTop: topInset, paddingBottom: insets.bottom }]}>
|
|
329
|
+
<View
|
|
330
|
+
onLayout={keyboard.onLayout}
|
|
331
|
+
style={[globalStyles.fill, { paddingBottom: keyboard.overlap }]}>
|
|
332
|
+
{/* Wraps only the widget's own UI — never the host's children. */}
|
|
333
|
+
<WidgetErrorBoundary
|
|
334
|
+
resetKey={`${state.isOpen}:${state.view}:${state.activeConversationId ?? ''}`}
|
|
335
|
+
fallback={(reset) => (
|
|
336
|
+
<View style={styles.centered}>
|
|
337
|
+
<Text style={styles.errorText}>{labels.widgetCrashed}</Text>
|
|
338
|
+
<Pressable
|
|
339
|
+
onPress={reset}
|
|
340
|
+
accessibilityRole="button"
|
|
341
|
+
style={[styles.retryButton, { backgroundColor: theme.primaryColor }]}>
|
|
342
|
+
<Text style={styles.retryLabel}>{labels.retry}</Text>
|
|
343
|
+
</Pressable>
|
|
344
|
+
<Pressable onPress={handleClose} accessibilityRole="button" hitSlop={8}>
|
|
345
|
+
<Text style={styles.closeLabel}>{labels.close}</Text>
|
|
346
|
+
</Pressable>
|
|
347
|
+
</View>
|
|
348
|
+
)}>
|
|
349
|
+
<WidgetPanel
|
|
350
|
+
color={theme.primaryColor}
|
|
351
|
+
activeTab={state.activeTab}
|
|
352
|
+
onTabChange={handleTabChange}
|
|
353
|
+
showTabs={!blockingError && state.view !== 'chat' && state.view !== 'prechat'}
|
|
354
|
+
spaces={state.config?.spaces ?? []}
|
|
355
|
+
unreadCount={unreadThreadTotal}
|
|
356
|
+
labels={{
|
|
357
|
+
home: labels.home,
|
|
358
|
+
messages: labels.messages,
|
|
359
|
+
unread: formatLabel(labels.unreadBadge, { count: unreadThreadTotal }),
|
|
360
|
+
}}>
|
|
361
|
+
{state.outboundMessage &&
|
|
362
|
+
!blockingError &&
|
|
363
|
+
state.view !== 'chat' &&
|
|
364
|
+
state.view !== 'prechat' ? (
|
|
365
|
+
<OutboundMessageCard
|
|
366
|
+
message={state.outboundMessage}
|
|
367
|
+
color={theme.primaryColor}
|
|
368
|
+
labels={{
|
|
369
|
+
title: labels.outboundTitle,
|
|
370
|
+
cta: labels.outboundCta,
|
|
371
|
+
dismiss: labels.dismiss,
|
|
372
|
+
}}
|
|
373
|
+
onDismiss={() => store.dismissOutboundMessage()}
|
|
374
|
+
onStartChat={(prefill) => {
|
|
375
|
+
store.dismissOutboundMessage();
|
|
376
|
+
store.startNewConversation(prefill);
|
|
377
|
+
}}
|
|
378
|
+
onTrack={(event, metadata) => store.track(event, metadata)}
|
|
379
|
+
/>
|
|
380
|
+
) : null}
|
|
381
|
+
{renderContent()}
|
|
382
|
+
</WidgetPanel>
|
|
383
|
+
</WidgetErrorBoundary>
|
|
384
|
+
</View>
|
|
385
|
+
</View>
|
|
386
|
+
</Modal>
|
|
387
|
+
</>
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const styles = StyleSheet.create({
|
|
392
|
+
centered: {
|
|
393
|
+
flex: 1,
|
|
394
|
+
alignItems: 'center',
|
|
395
|
+
justifyContent: 'center',
|
|
396
|
+
padding: spacing.xxl,
|
|
397
|
+
gap: spacing.lg,
|
|
398
|
+
},
|
|
399
|
+
stateText: {
|
|
400
|
+
fontSize: fontSize.meta,
|
|
401
|
+
color: palette.textSubtle,
|
|
402
|
+
textAlign: 'center',
|
|
403
|
+
},
|
|
404
|
+
stateIcon: {
|
|
405
|
+
width: 64,
|
|
406
|
+
height: 64,
|
|
407
|
+
borderRadius: 32,
|
|
408
|
+
alignItems: 'center',
|
|
409
|
+
justifyContent: 'center',
|
|
410
|
+
},
|
|
411
|
+
errorText: {
|
|
412
|
+
fontSize: fontSize.body,
|
|
413
|
+
color: palette.textMuted,
|
|
414
|
+
textAlign: 'center',
|
|
415
|
+
},
|
|
416
|
+
retryButton: {
|
|
417
|
+
borderRadius: radius.pill,
|
|
418
|
+
paddingHorizontal: spacing.xl,
|
|
419
|
+
paddingVertical: spacing.md,
|
|
420
|
+
minHeight: 44,
|
|
421
|
+
justifyContent: 'center',
|
|
422
|
+
},
|
|
423
|
+
retryLabel: {
|
|
424
|
+
color: palette.white,
|
|
425
|
+
fontSize: fontSize.meta,
|
|
426
|
+
fontWeight: '600',
|
|
427
|
+
},
|
|
428
|
+
closeLabel: {
|
|
429
|
+
color: palette.textSubtle,
|
|
430
|
+
fontSize: fontSize.meta,
|
|
431
|
+
fontWeight: '600',
|
|
432
|
+
padding: spacing.xs,
|
|
433
|
+
},
|
|
434
|
+
});
|