@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,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Home space — branded greeting header, the "start a conversation" card, a
|
|
5
|
+
* preview of recent threads and a team/availability strip.
|
|
6
|
+
* Port of `client/src/widget/components/HomeView.tsx`.
|
|
7
|
+
*
|
|
8
|
+
* The header meets the white body on a straight seam, the same as the web
|
|
9
|
+
* widget. Whether that seam is a hard edge or the background washing out into
|
|
10
|
+
* white is the dashboard's `homeBackgroundFade` toggle, and the start card sits
|
|
11
|
+
* astride it either way: top over the brand background, bottom over white.
|
|
12
|
+
*
|
|
13
|
+
* Everything on this screen comes from the widget config or the conversations
|
|
14
|
+
* the visitor already has; nothing here assumes a field the backend does not
|
|
15
|
+
* send today.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { Fragment, useEffect, useRef } from 'react';
|
|
19
|
+
import { Animated, Easing, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
20
|
+
import { Avatar } from "../../components/Avatar.js";
|
|
21
|
+
import { ConversationRow } from "../../components/ConversationRow.js";
|
|
22
|
+
import { FadeOverlay, GradientBackground } from "../../components/Gradient.js";
|
|
23
|
+
import { AlertIcon, ArrowRightIcon, ChatIcon, ChatOutlineIcon, CloseIcon } from "../../components/icons.js";
|
|
24
|
+
import { useReduceMotion } from "../../hooks/use-reduce-motion.js";
|
|
25
|
+
import { globalStyles } from "../../styles/global.js";
|
|
26
|
+
import { contrastingTextColor, palette, spacing, withAlpha } from "../../styles/theme.js";
|
|
27
|
+
import { flipForRTL } from "../../utils/rtl.js";
|
|
28
|
+
import { personalizeGreeting } from "./greeting.js";
|
|
29
|
+
import { CLOSE_ICON_SIZE, HEADER_BOTTOM_PADDING, HEADER_FADE_HEIGHT, START_CARD_LIFT, styles } from "./HomeView.styles.js";
|
|
30
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
31
|
+
/**
|
|
32
|
+
* The admin's explicit black/white toggle always wins. Older configs can omit
|
|
33
|
+
* it, and defaulting to dark text over a dark brand header is unreadable, so
|
|
34
|
+
* derive something legible from the background instead.
|
|
35
|
+
*/
|
|
36
|
+
function resolveHeaderTextColor(config, fallbackColor) {
|
|
37
|
+
if (config?.homeHeaderTextColor === 'white') return palette.white;
|
|
38
|
+
if (config?.homeHeaderTextColor === 'black') return palette.ink;
|
|
39
|
+
if (config?.homeBackgroundType === 'image') return palette.white;
|
|
40
|
+
if (config?.homeBackgroundType === 'gradient') {
|
|
41
|
+
return contrastingTextColor(config.homeBackgroundGradientStart || fallbackColor);
|
|
42
|
+
}
|
|
43
|
+
return contrastingTextColor(config?.homeBackgroundColor || fallbackColor);
|
|
44
|
+
}
|
|
45
|
+
export function HomeView({
|
|
46
|
+
config,
|
|
47
|
+
color,
|
|
48
|
+
visitorName,
|
|
49
|
+
conversationCount,
|
|
50
|
+
recentConversations,
|
|
51
|
+
unreadByConversation,
|
|
52
|
+
teamAgents,
|
|
53
|
+
isOnline,
|
|
54
|
+
offlineMessage,
|
|
55
|
+
startConversationLabel,
|
|
56
|
+
replyTimeLabel,
|
|
57
|
+
allowNewConversations,
|
|
58
|
+
showPreviousConversations,
|
|
59
|
+
labels,
|
|
60
|
+
onClose,
|
|
61
|
+
onStartConversation,
|
|
62
|
+
onViewConversations,
|
|
63
|
+
onOpenConversation
|
|
64
|
+
}) {
|
|
65
|
+
const heading = personalizeGreeting(config?.welcomeHeading, visitorName, 'Hi there');
|
|
66
|
+
// Both lines render exactly as the dashboard sent them, so the admin sees the
|
|
67
|
+
// same header in the preview and on the phone, even when the subheading
|
|
68
|
+
// repeats the reply time printed on the start card below.
|
|
69
|
+
const subheading = config?.welcomeSubheading || 'How can we help?';
|
|
70
|
+
const textColor = resolveHeaderTextColor(config, color);
|
|
71
|
+
const secondaryTextColor = textColor === palette.white ? withAlpha(palette.white, 0.8) : 'rgba(26,26,26,0.58)';
|
|
72
|
+
// A pale brand color would otherwise put a white glyph on a near-white disc.
|
|
73
|
+
const startIconColor = contrastingTextColor(color);
|
|
74
|
+
const backgroundType = config?.homeBackgroundType ?? 'solid';
|
|
75
|
+
const gradientColors = [config?.homeBackgroundGradientStart || '#f2f2f2', config?.homeBackgroundGradientMiddle || '', config?.homeBackgroundGradientEnd || '#bfbfbf'].filter(Boolean);
|
|
76
|
+
// Off, the background stops dead at the seam. On, it washes out into the body
|
|
77
|
+
// colour over the bottom of the header, so the start card lands on near-white.
|
|
78
|
+
const fade = config?.homeBackgroundFade ? /*#__PURE__*/_jsx(FadeOverlay, {
|
|
79
|
+
height: HEADER_FADE_HEIGHT
|
|
80
|
+
}) : null;
|
|
81
|
+
const showRecent = showPreviousConversations && recentConversations.length > 0;
|
|
82
|
+
const showViewAll = conversationCount > recentConversations.length;
|
|
83
|
+
const showEmptyHint = showPreviousConversations && conversationCount === 0 && allowNewConversations;
|
|
84
|
+
// One agent already has their face in the row above; repeating it reads as a bug.
|
|
85
|
+
const showAvatarStack = teamAgents.length >= 2;
|
|
86
|
+
|
|
87
|
+
// The start card is pulled up over the seam by a fixed amount, so the header
|
|
88
|
+
// pads its bottom by that same amount and the greeting never slides under it.
|
|
89
|
+
const headerStyle = [styles.header, allowNewConversations ? {
|
|
90
|
+
paddingBottom: HEADER_BOTTOM_PADDING + START_CARD_LIFT
|
|
91
|
+
} : null];
|
|
92
|
+
const headerContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
93
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
94
|
+
style: styles.headerTop,
|
|
95
|
+
children: [config?.homeLogoUrl ? /*#__PURE__*/_jsx(Image, {
|
|
96
|
+
source: {
|
|
97
|
+
uri: config.homeLogoUrl
|
|
98
|
+
},
|
|
99
|
+
style: styles.logo,
|
|
100
|
+
resizeMode: "contain",
|
|
101
|
+
accessibilityIgnoresInvertColors: true
|
|
102
|
+
}) : /*#__PURE__*/_jsx(View, {}), /*#__PURE__*/_jsx(Pressable, {
|
|
103
|
+
onPress: onClose,
|
|
104
|
+
accessibilityRole: "button",
|
|
105
|
+
accessibilityLabel: labels.close,
|
|
106
|
+
hitSlop: 12,
|
|
107
|
+
style: styles.closeButton,
|
|
108
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
109
|
+
size: CLOSE_ICON_SIZE,
|
|
110
|
+
color: textColor
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
114
|
+
style: styles.headerSpacer
|
|
115
|
+
}), /*#__PURE__*/_jsxs(FadeSlideIn, {
|
|
116
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
117
|
+
style: [styles.heading, {
|
|
118
|
+
color: textColor
|
|
119
|
+
}],
|
|
120
|
+
children: heading
|
|
121
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
122
|
+
style: [styles.subheading, {
|
|
123
|
+
color: secondaryTextColor
|
|
124
|
+
}],
|
|
125
|
+
children: subheading
|
|
126
|
+
})]
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
return /*#__PURE__*/_jsxs(ScrollView, {
|
|
130
|
+
style: globalStyles.screen,
|
|
131
|
+
contentContainerStyle: styles.contentContainer,
|
|
132
|
+
keyboardShouldPersistTaps: "handled",
|
|
133
|
+
children: [backgroundType === 'image' && config?.homeBackgroundImageUrl ? /*#__PURE__*/_jsxs(View, {
|
|
134
|
+
style: headerStyle,
|
|
135
|
+
children: [/*#__PURE__*/_jsx(Image, {
|
|
136
|
+
source: {
|
|
137
|
+
uri: config.homeBackgroundImageUrl
|
|
138
|
+
},
|
|
139
|
+
style: StyleSheet.absoluteFill,
|
|
140
|
+
resizeMode: "cover",
|
|
141
|
+
accessibilityIgnoresInvertColors: true
|
|
142
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
143
|
+
style: styles.imageScrim
|
|
144
|
+
}), headerContent, fade]
|
|
145
|
+
}) : backgroundType === 'gradient' ? /*#__PURE__*/_jsxs(GradientBackground, {
|
|
146
|
+
colors: gradientColors,
|
|
147
|
+
style: headerStyle,
|
|
148
|
+
children: [headerContent, fade]
|
|
149
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
150
|
+
style: [headerStyle, {
|
|
151
|
+
backgroundColor: config?.homeBackgroundColor || '#f2f2f2'
|
|
152
|
+
}],
|
|
153
|
+
children: [headerContent, fade]
|
|
154
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
155
|
+
style: styles.body,
|
|
156
|
+
children: [allowNewConversations ? /*#__PURE__*/_jsx(View, {
|
|
157
|
+
style: styles.startCardSlot,
|
|
158
|
+
children: /*#__PURE__*/_jsx(FadeSlideIn, {
|
|
159
|
+
delay: 40,
|
|
160
|
+
children: /*#__PURE__*/_jsxs(Pressable, {
|
|
161
|
+
onPress: onStartConversation,
|
|
162
|
+
accessibilityRole: "button",
|
|
163
|
+
android_ripple: {
|
|
164
|
+
color: palette.borderSoft
|
|
165
|
+
},
|
|
166
|
+
style: ({
|
|
167
|
+
pressed
|
|
168
|
+
}) => [styles.startCard, pressed && styles.startCardPressed],
|
|
169
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
170
|
+
style: [styles.startIcon, {
|
|
171
|
+
backgroundColor: color
|
|
172
|
+
}],
|
|
173
|
+
children: /*#__PURE__*/_jsx(ChatIcon, {
|
|
174
|
+
size: 18,
|
|
175
|
+
color: startIconColor
|
|
176
|
+
})
|
|
177
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
178
|
+
style: styles.startCopy,
|
|
179
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
180
|
+
style: styles.startTitle,
|
|
181
|
+
children: startConversationLabel
|
|
182
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
183
|
+
style: styles.startSubtitle,
|
|
184
|
+
children: replyTimeLabel
|
|
185
|
+
})]
|
|
186
|
+
}), /*#__PURE__*/_jsx(ArrowRightIcon, {
|
|
187
|
+
size: 18,
|
|
188
|
+
color: color,
|
|
189
|
+
style: flipForRTL()
|
|
190
|
+
})]
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
194
|
+
style: styles.bodyContent,
|
|
195
|
+
children: [offlineMessage ? /*#__PURE__*/_jsx(FadeSlideIn, {
|
|
196
|
+
delay: 70,
|
|
197
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
198
|
+
style: styles.offlineNotice,
|
|
199
|
+
children: [/*#__PURE__*/_jsx(AlertIcon, {
|
|
200
|
+
size: 18
|
|
201
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
202
|
+
style: styles.offlineText,
|
|
203
|
+
children: offlineMessage
|
|
204
|
+
})]
|
|
205
|
+
})
|
|
206
|
+
}) : null, showRecent ? /*#__PURE__*/_jsxs(FadeSlideIn, {
|
|
207
|
+
delay: 140,
|
|
208
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
209
|
+
style: styles.recentHeader,
|
|
210
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
211
|
+
style: styles.recentTitle,
|
|
212
|
+
children: labels.recentTitle
|
|
213
|
+
}), showViewAll ? /*#__PURE__*/_jsx(Pressable, {
|
|
214
|
+
onPress: onViewConversations,
|
|
215
|
+
accessibilityRole: "button",
|
|
216
|
+
accessibilityLabel: labels.viewPrevious,
|
|
217
|
+
hitSlop: 10,
|
|
218
|
+
style: ({
|
|
219
|
+
pressed
|
|
220
|
+
}) => [styles.viewAllButton, pressed && globalStyles.pressed],
|
|
221
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
222
|
+
style: [styles.viewAllLabel, {
|
|
223
|
+
color
|
|
224
|
+
}],
|
|
225
|
+
children: labels.viewAll
|
|
226
|
+
})
|
|
227
|
+
}) : null]
|
|
228
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
229
|
+
style: [globalStyles.card, styles.recentCard],
|
|
230
|
+
children: recentConversations.map((conversation, index) => /*#__PURE__*/_jsxs(Fragment, {
|
|
231
|
+
children: [index > 0 ? /*#__PURE__*/_jsx(View, {
|
|
232
|
+
style: [globalStyles.divider, styles.recentDivider]
|
|
233
|
+
}) : null, /*#__PURE__*/_jsx(ConversationRow, {
|
|
234
|
+
conversation: conversation,
|
|
235
|
+
color: color,
|
|
236
|
+
fallbackName: labels.team,
|
|
237
|
+
timeLabels: labels.time,
|
|
238
|
+
unreadCount: unreadByConversation[conversation.id] ?? 0,
|
|
239
|
+
unreadLabel: labels.unread,
|
|
240
|
+
horizontalPadding: spacing.lg,
|
|
241
|
+
onPress: () => onOpenConversation(conversation.id)
|
|
242
|
+
})]
|
|
243
|
+
}, conversation.id))
|
|
244
|
+
})]
|
|
245
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
246
|
+
style: styles.spacer,
|
|
247
|
+
children: showEmptyHint ? /*#__PURE__*/_jsx(FadeSlideIn, {
|
|
248
|
+
delay: 140,
|
|
249
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
250
|
+
style: styles.emptyHint,
|
|
251
|
+
children: [/*#__PURE__*/_jsx(ChatOutlineIcon, {
|
|
252
|
+
size: 30,
|
|
253
|
+
color: palette.disabled
|
|
254
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
255
|
+
style: styles.emptyHintText,
|
|
256
|
+
children: labels.noConversations
|
|
257
|
+
})]
|
|
258
|
+
})
|
|
259
|
+
}) : null
|
|
260
|
+
}), /*#__PURE__*/_jsx(FadeSlideIn, {
|
|
261
|
+
delay: 200,
|
|
262
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
263
|
+
style: styles.statusStrip,
|
|
264
|
+
children: [showAvatarStack ? /*#__PURE__*/_jsx(View, {
|
|
265
|
+
style: styles.avatarStack,
|
|
266
|
+
children: teamAgents.map((agent, index) => /*#__PURE__*/_jsx(Avatar, {
|
|
267
|
+
avatar: agent.avatar,
|
|
268
|
+
name: agent.name,
|
|
269
|
+
size: 26,
|
|
270
|
+
color: color,
|
|
271
|
+
style: [styles.avatarStackItem, index > 0 ? styles.avatarStackOverlap : null]
|
|
272
|
+
}, `${agent.name ?? 'agent'}-${index}`))
|
|
273
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
274
|
+
style: [styles.statusDot, {
|
|
275
|
+
backgroundColor: isOnline ? palette.online : palette.textSubtle
|
|
276
|
+
}]
|
|
277
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
278
|
+
style: styles.statusText,
|
|
279
|
+
numberOfLines: 1,
|
|
280
|
+
children: isOnline ? labels.statusOnline : labels.statusAway
|
|
281
|
+
})]
|
|
282
|
+
})
|
|
283
|
+
})]
|
|
284
|
+
})]
|
|
285
|
+
})]
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Staggered entrance for the body sections. Opacity and translate only, so the
|
|
291
|
+
* whole thing runs on the native driver and never touches layout.
|
|
292
|
+
*/
|
|
293
|
+
function FadeSlideIn({
|
|
294
|
+
delay = 0,
|
|
295
|
+
children
|
|
296
|
+
}) {
|
|
297
|
+
const reduceMotion = useReduceMotion();
|
|
298
|
+
const progress = useRef(new Animated.Value(0)).current;
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
// `null` means the reduce-motion answer has not landed yet; hold at 0
|
|
301
|
+
// rather than animating and snapping back.
|
|
302
|
+
if (reduceMotion === null) return undefined;
|
|
303
|
+
if (reduceMotion) {
|
|
304
|
+
progress.setValue(1);
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
Animated.timing(progress, {
|
|
308
|
+
toValue: 1,
|
|
309
|
+
duration: 260,
|
|
310
|
+
delay,
|
|
311
|
+
easing: Easing.out(Easing.quad),
|
|
312
|
+
useNativeDriver: true
|
|
313
|
+
}).start();
|
|
314
|
+
return () => {
|
|
315
|
+
progress.stopAnimation();
|
|
316
|
+
};
|
|
317
|
+
}, [delay, progress, reduceMotion]);
|
|
318
|
+
const translateY = progress.interpolate({
|
|
319
|
+
inputRange: [0, 1],
|
|
320
|
+
outputRange: [12, 0]
|
|
321
|
+
});
|
|
322
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
323
|
+
style: {
|
|
324
|
+
opacity: progress,
|
|
325
|
+
transform: [{
|
|
326
|
+
translateY
|
|
327
|
+
}]
|
|
328
|
+
},
|
|
329
|
+
children: children
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=HomeView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Fragment","useEffect","useRef","Animated","Easing","Image","Pressable","ScrollView","StyleSheet","Text","View","Avatar","ConversationRow","FadeOverlay","GradientBackground","AlertIcon","ArrowRightIcon","ChatIcon","ChatOutlineIcon","CloseIcon","useReduceMotion","globalStyles","contrastingTextColor","palette","spacing","withAlpha","flipForRTL","personalizeGreeting","CLOSE_ICON_SIZE","HEADER_BOTTOM_PADDING","HEADER_FADE_HEIGHT","START_CARD_LIFT","styles","jsx","_jsx","jsxs","_jsxs","_Fragment","resolveHeaderTextColor","config","fallbackColor","homeHeaderTextColor","white","ink","homeBackgroundType","homeBackgroundGradientStart","homeBackgroundColor","HomeView","color","visitorName","conversationCount","recentConversations","unreadByConversation","teamAgents","isOnline","offlineMessage","startConversationLabel","replyTimeLabel","allowNewConversations","showPreviousConversations","labels","onClose","onStartConversation","onViewConversations","onOpenConversation","heading","welcomeHeading","subheading","welcomeSubheading","textColor","secondaryTextColor","startIconColor","backgroundType","gradientColors","homeBackgroundGradientMiddle","homeBackgroundGradientEnd","filter","Boolean","fade","homeBackgroundFade","height","showRecent","length","showViewAll","showEmptyHint","showAvatarStack","headerStyle","header","paddingBottom","headerContent","children","style","headerTop","homeLogoUrl","source","uri","logo","resizeMode","accessibilityIgnoresInvertColors","onPress","accessibilityRole","accessibilityLabel","close","hitSlop","closeButton","size","headerSpacer","FadeSlideIn","screen","contentContainerStyle","contentContainer","keyboardShouldPersistTaps","homeBackgroundImageUrl","absoluteFill","imageScrim","colors","backgroundColor","body","startCardSlot","delay","android_ripple","borderSoft","pressed","startCard","startCardPressed","startIcon","startCopy","startTitle","startSubtitle","bodyContent","offlineNotice","offlineText","recentHeader","recentTitle","viewPrevious","viewAllButton","viewAllLabel","viewAll","card","recentCard","map","conversation","index","divider","recentDivider","fallbackName","team","timeLabels","time","unreadCount","id","unreadLabel","unread","horizontalPadding","lg","spacer","emptyHint","disabled","emptyHintText","noConversations","statusStrip","avatarStack","agent","avatar","name","avatarStackItem","avatarStackOverlap","statusDot","online","textSubtle","statusText","numberOfLines","statusOnline","statusAway","reduceMotion","progress","Value","current","undefined","setValue","timing","toValue","duration","easing","out","quad","useNativeDriver","start","stopAnimation","translateY","interpolate","inputRange","outputRange","opacity","transform"],"sourceRoot":"../../../../../src","sources":["ui/screens/home/H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ACa,aAAa,CAAC,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAACrE,KAAK,EAAEwD,QAAQ,EAAED,YAAY,CAAC,CAAC;EAEnC,MAAMe,UAAU,GAAGd,QAAQ,CAACe,WAAW,CAAC;IAAEC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAAEC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;EAAE,CAAC,CAAC;EAErF,oBACE9J,IAAA,CAAC/B,QAAQ,CAACO,IAAI;IAACiF,KAAK,EAAE;MAAEsG,OAAO,EAAElB,QAAQ;MAAEmB,SAAS,EAAE,CAAC;QAAEL;MAAW,CAAC;IAAE,CAAE;IAAAnG,QAAA,EACtEA;EAAQ,CACI,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Styles and layout constants for the Home space. The constants live next to
|
|
5
|
+
* the sheet so the component and the styles can never disagree about them.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { I18nManager, StyleSheet } from 'react-native';
|
|
9
|
+
import { rowDividerInset } from "../../components/ConversationRow.js";
|
|
10
|
+
import { fontSize, palette, radius, shadows, spacing } from "../../styles/theme.js";
|
|
11
|
+
import { START_ALIGN } from "../../utils/rtl.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Header geometry in dp, measured off the web widget so the two surfaces line
|
|
15
|
+
* up: a tall header with the greeting pinned low, a start card that overhangs
|
|
16
|
+
* the seam by a fixed amount rather than half its height, and a fade that is a
|
|
17
|
+
* straight white ramp over the bottom of the header, starting just under the
|
|
18
|
+
* heading.
|
|
19
|
+
*/
|
|
20
|
+
export const HEADER_MIN_HEIGHT = 228;
|
|
21
|
+
/** Between the greeting and whatever comes next: the seam, or the start card. */
|
|
22
|
+
export const HEADER_BOTTOM_PADDING = 36;
|
|
23
|
+
export const START_CARD_LIFT = 28;
|
|
24
|
+
export const START_CARD_MIN_HEIGHT = 76;
|
|
25
|
+
export const HEADER_FADE_HEIGHT = 90;
|
|
26
|
+
export const CLOSE_BUTTON_SIZE = 28;
|
|
27
|
+
export const CLOSE_ICON_SIZE = 14;
|
|
28
|
+
export const styles = StyleSheet.create({
|
|
29
|
+
contentContainer: {
|
|
30
|
+
flexGrow: 1
|
|
31
|
+
},
|
|
32
|
+
// Tall on purpose, with the greeting pinned to the bottom by `headerSpacer`:
|
|
33
|
+
// the close row stays at the top and the heading sits just above the seam.
|
|
34
|
+
header: {
|
|
35
|
+
minHeight: HEADER_MIN_HEIGHT,
|
|
36
|
+
paddingHorizontal: spacing.xl,
|
|
37
|
+
paddingTop: spacing.xl,
|
|
38
|
+
// When the start card is shown the component grows this to clear the card.
|
|
39
|
+
paddingBottom: HEADER_BOTTOM_PADDING,
|
|
40
|
+
overflow: 'hidden'
|
|
41
|
+
},
|
|
42
|
+
imageScrim: {
|
|
43
|
+
...StyleSheet.absoluteFillObject,
|
|
44
|
+
backgroundColor: 'rgba(0,0,0,0.16)'
|
|
45
|
+
},
|
|
46
|
+
// Always as tall as the logo slot, so the greeting lands in the same place
|
|
47
|
+
// whether or not the workspace uploaded a logo.
|
|
48
|
+
headerTop: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'flex-start',
|
|
51
|
+
justifyContent: 'space-between',
|
|
52
|
+
minHeight: 40
|
|
53
|
+
},
|
|
54
|
+
// Soaks up the header's spare height so the greeting hugs the seam, and
|
|
55
|
+
// never shrinks below the gap the web widget keeps under the close row.
|
|
56
|
+
headerSpacer: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
minHeight: 40
|
|
59
|
+
},
|
|
60
|
+
logo: {
|
|
61
|
+
width: 132,
|
|
62
|
+
height: 40
|
|
63
|
+
},
|
|
64
|
+
closeButton: {
|
|
65
|
+
marginStart: 'auto',
|
|
66
|
+
padding: (CLOSE_BUTTON_SIZE - CLOSE_ICON_SIZE) / 2,
|
|
67
|
+
borderRadius: radius.pill,
|
|
68
|
+
backgroundColor: 'rgba(255,255,255,0.18)'
|
|
69
|
+
},
|
|
70
|
+
heading: {
|
|
71
|
+
textAlign: START_ALIGN,
|
|
72
|
+
fontSize: fontSize.display,
|
|
73
|
+
lineHeight: fontSize.display * 1.15,
|
|
74
|
+
fontWeight: '600',
|
|
75
|
+
marginBottom: spacing.md
|
|
76
|
+
},
|
|
77
|
+
subheading: {
|
|
78
|
+
textAlign: START_ALIGN,
|
|
79
|
+
fontSize: fontSize.body,
|
|
80
|
+
lineHeight: fontSize.body * 1.4
|
|
81
|
+
},
|
|
82
|
+
// Meets the header on a straight seam. No top padding here: the start card
|
|
83
|
+
// is pulled up past this edge, and the rest of the content takes its spacing
|
|
84
|
+
// from `bodyContent`.
|
|
85
|
+
body: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
backgroundColor: palette.white,
|
|
88
|
+
paddingHorizontal: spacing.xl,
|
|
89
|
+
paddingBottom: spacing.xxl
|
|
90
|
+
},
|
|
91
|
+
bodyContent: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
paddingTop: spacing.xl
|
|
94
|
+
},
|
|
95
|
+
offlineNotice: {
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'flex-start',
|
|
98
|
+
gap: spacing.sm + 2,
|
|
99
|
+
padding: spacing.md,
|
|
100
|
+
borderRadius: radius.md,
|
|
101
|
+
backgroundColor: palette.warningBg,
|
|
102
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
103
|
+
borderColor: palette.warningBorder,
|
|
104
|
+
marginBottom: spacing.lg
|
|
105
|
+
},
|
|
106
|
+
offlineText: {
|
|
107
|
+
textAlign: START_ALIGN,
|
|
108
|
+
flex: 1,
|
|
109
|
+
fontSize: fontSize.meta,
|
|
110
|
+
lineHeight: fontSize.meta * 1.4,
|
|
111
|
+
color: palette.warningText
|
|
112
|
+
},
|
|
113
|
+
startCardSlot: {
|
|
114
|
+
marginTop: -START_CARD_LIFT
|
|
115
|
+
},
|
|
116
|
+
// Neutral and opaque, like the web card: it spans two backgrounds, and a
|
|
117
|
+
// translucent or brand-tinted fill would let the header bleed through its
|
|
118
|
+
// top or stain the seam. Shadowed because without it the half over the
|
|
119
|
+
// header reads as a flat cut-out.
|
|
120
|
+
startCard: {
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
gap: spacing.md,
|
|
124
|
+
minHeight: START_CARD_MIN_HEIGHT,
|
|
125
|
+
paddingHorizontal: spacing.xl,
|
|
126
|
+
paddingVertical: spacing.lg + 2,
|
|
127
|
+
borderRadius: radius.lg,
|
|
128
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
129
|
+
borderColor: palette.border,
|
|
130
|
+
backgroundColor: palette.surface,
|
|
131
|
+
...shadows.card
|
|
132
|
+
},
|
|
133
|
+
startCardPressed: {
|
|
134
|
+
opacity: 0.85
|
|
135
|
+
},
|
|
136
|
+
startIcon: {
|
|
137
|
+
width: 40,
|
|
138
|
+
height: 40,
|
|
139
|
+
borderRadius: 20,
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
justifyContent: 'center'
|
|
142
|
+
},
|
|
143
|
+
startCopy: {
|
|
144
|
+
flex: 1,
|
|
145
|
+
minWidth: 0
|
|
146
|
+
},
|
|
147
|
+
startTitle: {
|
|
148
|
+
textAlign: START_ALIGN,
|
|
149
|
+
fontSize: fontSize.title,
|
|
150
|
+
fontWeight: '600',
|
|
151
|
+
color: palette.ink
|
|
152
|
+
},
|
|
153
|
+
startSubtitle: {
|
|
154
|
+
textAlign: START_ALIGN,
|
|
155
|
+
fontSize: fontSize.meta,
|
|
156
|
+
color: palette.textSubtle,
|
|
157
|
+
marginTop: 2
|
|
158
|
+
},
|
|
159
|
+
recentHeader: {
|
|
160
|
+
flexDirection: 'row',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
justifyContent: 'space-between',
|
|
163
|
+
minHeight: 28,
|
|
164
|
+
marginBottom: spacing.sm
|
|
165
|
+
},
|
|
166
|
+
recentTitle: {
|
|
167
|
+
textAlign: START_ALIGN,
|
|
168
|
+
fontSize: fontSize.caption,
|
|
169
|
+
fontWeight: '700',
|
|
170
|
+
color: palette.textMuted,
|
|
171
|
+
letterSpacing: I18nManager.isRTL ? 0 : 0.6,
|
|
172
|
+
textTransform: 'uppercase'
|
|
173
|
+
},
|
|
174
|
+
viewAllButton: {
|
|
175
|
+
minHeight: 32,
|
|
176
|
+
paddingHorizontal: spacing.xs,
|
|
177
|
+
justifyContent: 'center'
|
|
178
|
+
},
|
|
179
|
+
viewAllLabel: {
|
|
180
|
+
textAlign: START_ALIGN,
|
|
181
|
+
fontSize: fontSize.meta,
|
|
182
|
+
fontWeight: '600'
|
|
183
|
+
},
|
|
184
|
+
// Border rather than a shadow: `overflow: hidden` keeps the rows' ripple
|
|
185
|
+
// inside the rounded corners, and would clip a shadow on iOS anyway.
|
|
186
|
+
recentCard: {
|
|
187
|
+
overflow: 'hidden'
|
|
188
|
+
},
|
|
189
|
+
recentDivider: {
|
|
190
|
+
marginStart: rowDividerInset(spacing.lg)
|
|
191
|
+
},
|
|
192
|
+
// Absorbs the slack so the status strip stays pinned to the bottom, and
|
|
193
|
+
// centers the empty hint when there is nothing else to show.
|
|
194
|
+
spacer: {
|
|
195
|
+
flex: 1,
|
|
196
|
+
minHeight: spacing.lg,
|
|
197
|
+
justifyContent: 'center'
|
|
198
|
+
},
|
|
199
|
+
emptyHint: {
|
|
200
|
+
alignItems: 'center',
|
|
201
|
+
gap: spacing.sm,
|
|
202
|
+
paddingVertical: spacing.xl
|
|
203
|
+
},
|
|
204
|
+
emptyHintText: {
|
|
205
|
+
fontSize: fontSize.meta,
|
|
206
|
+
color: palette.textSubtle,
|
|
207
|
+
textAlign: 'center'
|
|
208
|
+
},
|
|
209
|
+
statusStrip: {
|
|
210
|
+
flexDirection: 'row',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
gap: spacing.sm + 2,
|
|
213
|
+
minHeight: 56,
|
|
214
|
+
paddingTop: spacing.lg,
|
|
215
|
+
marginTop: spacing.lg,
|
|
216
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
217
|
+
borderTopColor: palette.borderSoft
|
|
218
|
+
},
|
|
219
|
+
avatarStack: {
|
|
220
|
+
flexDirection: 'row',
|
|
221
|
+
alignItems: 'center'
|
|
222
|
+
},
|
|
223
|
+
avatarStackItem: {
|
|
224
|
+
borderWidth: 2,
|
|
225
|
+
borderColor: palette.white
|
|
226
|
+
},
|
|
227
|
+
avatarStackOverlap: {
|
|
228
|
+
marginStart: -10
|
|
229
|
+
},
|
|
230
|
+
statusDot: {
|
|
231
|
+
width: 8,
|
|
232
|
+
height: 8,
|
|
233
|
+
borderRadius: 4
|
|
234
|
+
},
|
|
235
|
+
statusText: {
|
|
236
|
+
textAlign: START_ALIGN,
|
|
237
|
+
flex: 1,
|
|
238
|
+
fontSize: fontSize.meta,
|
|
239
|
+
color: palette.textMuted
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
//# sourceMappingURL=HomeView.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["I18nManager","StyleSheet","rowDividerInset","fontSize","palette","radius","shadows","spacing","START_ALIGN","HEADER_MIN_HEIGHT","HEADER_BOTTOM_PADDING","START_CARD_LIFT","START_CARD_MIN_HEIGHT","HEADER_FADE_HEIGHT","CLOSE_BUTTON_SIZE","CLOSE_ICON_SIZE","styles","create","contentContainer","flexGrow","header","minHeight","paddingHorizontal","xl","paddingTop","paddingBottom","overflow","imageScrim","absoluteFillObject","backgroundColor","headerTop","flexDirection","alignItems","justifyContent","headerSpacer","flex","logo","width","height","closeButton","marginStart","padding","borderRadius","pill","heading","textAlign","display","lineHeight","fontWeight","marginBottom","md","subheading","body","white","xxl","bodyContent","offlineNotice","gap","sm","warningBg","borderWidth","hairlineWidth","borderColor","warningBorder","lg","offlineText","meta","color","warningText","startCardSlot","marginTop","startCard","paddingVertical","border","surface","card","startCardPressed","opacity","startIcon","startCopy","minWidth","startTitle","title","ink","startSubtitle","textSubtle","recentHeader","recentTitle","caption","textMuted","letterSpacing","isRTL","textTransform","viewAllButton","xs","viewAllLabel","recentCard","recentDivider","spacer","emptyHint","emptyHintText","statusStrip","borderTopWidth","borderTopColor","borderSoft","avatarStack","avatarStackItem","avatarStackOverlap","statusDot","statusText"],"sourceRoot":"../../../../../src","sources":["ui/screens/home/HomeView.styles.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,UAAU,QAAQ,cAAc;AAEtD,SAASC,eAAe,QAAQ,qCAAkC;AAClE,SAASC,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,QAAQ,uBAAoB;AAChF,SAASC,WAAW,QAAQ,oBAAiB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,GAAG;AACpC;AACA,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,eAAe,GAAG,EAAE;AACjC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,kBAAkB,GAAG,EAAE;AACpC,OAAO,MAAMC,iBAAiB,GAAG,EAAE;AACnC,OAAO,MAAMC,eAAe,GAAG,EAAE;AAEjC,OAAO,MAAMC,MAAM,GAAGf,UAAU,CAACgB,MAAM,CAAC;EACtCC,gBAAgB,EAAE;IAChBC,QAAQ,EAAE;EACZ,CAAC;EACD;EACA;EACAC,MAAM,EAAE;IACNC,SAAS,EAAEZ,iBAAiB;IAC5Ba,iBAAiB,EAAEf,OAAO,CAACgB,EAAE;IAC7BC,UAAU,EAAEjB,OAAO,CAACgB,EAAE;IACtB;IACAE,aAAa,EAAEf,qBAAqB;IACpCgB,QAAQ,EAAE;EACZ,CAAC;EACDC,UAAU,EAAE;IACV,GAAG1B,UAAU,CAAC2B,kBAAkB;IAChCC,eAAe,EAAE;EACnB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../../../src","sources":["ui/screens/home/HomeView.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Greeting helpers for the Home space. The admin's heading renders exactly as
|
|
5
|
+
* the dashboard sent it, with one exception: an explicit name token, which is
|
|
6
|
+
* the admin asking for the visitor's first name to be filled in.
|
|
7
|
+
* Deliberately free of React and React Native so they stay trivial to test.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** `{{name}}`, `{name}`, `{{first_name}}` all stand in for the visitor's first name. */
|
|
11
|
+
const NAME_TOKEN = /\{\{?\s*(?:name|first_?name)\s*\}?\}/gi;
|
|
12
|
+
const EMAIL_LIKE = /@/;
|
|
13
|
+
const PHONE_LIKE = /^[\d\s+()\-.]+$/;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* First name suitable for greeting someone by. Hosts sometimes put an email or
|
|
17
|
+
* a phone number in the name field, and greeting "Hi rep@acme.com" is worse
|
|
18
|
+
* than not personalizing at all.
|
|
19
|
+
*/
|
|
20
|
+
export function firstName(fullName) {
|
|
21
|
+
const trimmed = (fullName ?? '').trim();
|
|
22
|
+
if (!trimmed || EMAIL_LIKE.test(trimmed) || PHONE_LIKE.test(trimmed)) return null;
|
|
23
|
+
const candidate = (trimmed.split(/\s+/)[0] ?? '').replace(/[,;:.]+$/, '');
|
|
24
|
+
// Under 2 rejects a bare initial; over 24 means a sentence landed in the field.
|
|
25
|
+
if (candidate.length < 2 || candidate.length > 24) return null;
|
|
26
|
+
return candidate;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Repair the spacing and punctuation left behind when a token resolves to nothing. */
|
|
30
|
+
function tidy(value) {
|
|
31
|
+
return value.replace(/\s+/g, ' ').replace(/\s+([,!?.:;])/g, '$1').replace(/^[\s,]+/, '').trim();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the admin's heading against the visitor's name. Only an explicit
|
|
36
|
+
* token is substituted: a generic "Hi there" stays "Hi there", because that is
|
|
37
|
+
* what the dashboard preview shows the admin and the phone has to match it.
|
|
38
|
+
*/
|
|
39
|
+
export function personalizeGreeting(template, visitorName, fallback) {
|
|
40
|
+
const base = (template ?? '').trim() || fallback;
|
|
41
|
+
const tokenized = base.replace(NAME_TOKEN, firstName(visitorName) ?? '');
|
|
42
|
+
return tokenized === base ? base : tidy(tokenized);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=greeting.js.map
|