@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,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translations come from the widget config (`translations[locale][key]`), with
|
|
3
|
+
* the widget's default locale as the fallback chain — same lookup as the web
|
|
4
|
+
* widget's `t()` in `client/src/widget/App.tsx`.
|
|
5
|
+
*/
|
|
6
|
+
import type { WidgetConfig } from './types';
|
|
7
|
+
export type Translator = (key: string, fallback: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Resolution order, most specific first: what the workspace configured for the
|
|
10
|
+
* active locale, what the SDK ships for it, then the same pair for the
|
|
11
|
+
* workspace's default locale, and finally the English built-in. Dashboard
|
|
12
|
+
* copy always outranks a bundled translation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTranslator(config: WidgetConfig | null, locale: string): Translator;
|
|
15
|
+
export declare const DEFAULT_LABELS: {
|
|
16
|
+
readonly back: "Back";
|
|
17
|
+
readonly loading: "Loading...";
|
|
18
|
+
readonly loadEarlier: "Load earlier messages";
|
|
19
|
+
readonly emptyConversation: "Send a message to start the conversation";
|
|
20
|
+
readonly messagePlaceholder: "Type a message...";
|
|
21
|
+
readonly attachFile: "Attach file";
|
|
22
|
+
readonly failedToSend: "Failed to send";
|
|
23
|
+
readonly thinking: "Typing";
|
|
24
|
+
readonly messages: "Messages";
|
|
25
|
+
readonly noMessages: "No messages yet";
|
|
26
|
+
readonly historyHidden: "Conversation history is hidden";
|
|
27
|
+
readonly startBelow: "Start a conversation below";
|
|
28
|
+
readonly preChatTitle: "Before we chat";
|
|
29
|
+
readonly preChatSubtitle: "Let us know a bit about you so we can help you better.";
|
|
30
|
+
readonly preChatSkip: "Skip";
|
|
31
|
+
readonly preChatSubmit: "Start chat";
|
|
32
|
+
readonly viewPreviousConversations: "View previous conversations";
|
|
33
|
+
readonly homeRecentTitle: "Recent";
|
|
34
|
+
readonly homeViewAllCount: "View all ({count})";
|
|
35
|
+
readonly homeNoConversations: "Your conversations will show up here";
|
|
36
|
+
readonly homeStatusOnline: "We're online";
|
|
37
|
+
readonly homeStatusAway: "We're away";
|
|
38
|
+
readonly unreadBadge: "{count} unread";
|
|
39
|
+
readonly team: "Team";
|
|
40
|
+
readonly home: "Home";
|
|
41
|
+
readonly close: "Close";
|
|
42
|
+
readonly retry: "Retry";
|
|
43
|
+
readonly connectionError: "We could not load the chat. Please try again.";
|
|
44
|
+
readonly connecting: "Connecting you to the team";
|
|
45
|
+
readonly chatUnavailable: "Chat is not available right now.";
|
|
46
|
+
readonly identityVerificationError: "We couldn't verify your account. Please sign in again.";
|
|
47
|
+
readonly widgetCrashed: "Something went wrong.";
|
|
48
|
+
readonly timeJustNow: "Just now";
|
|
49
|
+
readonly timeMinutes: "{count}m";
|
|
50
|
+
readonly timeHours: "{count}h";
|
|
51
|
+
readonly timeDays: "{count}d";
|
|
52
|
+
readonly timeMonths: "{count}mo";
|
|
53
|
+
readonly timeYears: "{count}y";
|
|
54
|
+
readonly today: "Today";
|
|
55
|
+
readonly yesterday: "Yesterday";
|
|
56
|
+
readonly conversationUpdated: "Conversation updated";
|
|
57
|
+
readonly procedureSend: "Send details";
|
|
58
|
+
readonly procedureSent: "Sent";
|
|
59
|
+
readonly fieldRequired: "{field} is required";
|
|
60
|
+
readonly invalidEmail: "Enter a valid email address";
|
|
61
|
+
readonly working: "Working...";
|
|
62
|
+
readonly outboundTitle: "New update";
|
|
63
|
+
readonly outboundCta: "Learn more";
|
|
64
|
+
readonly dismiss: "Dismiss";
|
|
65
|
+
readonly blockService: "Service";
|
|
66
|
+
readonly blockProduct: "Product";
|
|
67
|
+
readonly blockChooseTime: "Choose a time";
|
|
68
|
+
readonly blockProfessional: "Professional";
|
|
69
|
+
readonly blockPriceOffer: "Price offer";
|
|
70
|
+
};
|
|
71
|
+
export type LabelKey = keyof typeof DEFAULT_LABELS;
|
|
72
|
+
/**
|
|
73
|
+
* Fill `{token}` placeholders in a translated string. Interpolation belongs in
|
|
74
|
+
* the string layer so translators keep control of word order.
|
|
75
|
+
*/
|
|
76
|
+
export declare function formatLabel(template: string, values: Record<string, string | number>): string;
|
|
77
|
+
export declare function buildLabels(translate: Translator): Record<LabelKey, string>;
|
|
78
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAYxF;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DjB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,cAAc,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAI7F;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAM3E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @repzo/widget-react-native — the Repzo chat widget for React Native.
|
|
3
|
+
*
|
|
4
|
+
* Pure JavaScript: no native modules, no config plugin, no pod install. The
|
|
5
|
+
* public surface mirrors `@intercom/intercom-react-native` so swapping the two
|
|
6
|
+
* is a rename at each call site.
|
|
7
|
+
*/
|
|
8
|
+
import { RepzoWidgetEvents, type EventSubscription, type RepzoWidgetEvent } from './events';
|
|
9
|
+
import type { BootOptions, RepzoWidgetStorageAdapter, WidgetCustomAttributes, WidgetSpaceType, WidgetUser } from './types';
|
|
10
|
+
export { RepzoWidgetProvider } from './ui/WidgetProvider';
|
|
11
|
+
export { Launcher as RepzoWidgetLauncher } from './ui/components/Launcher';
|
|
12
|
+
export { RepzoWidgetEvents } from './events';
|
|
13
|
+
export { RepzoWidgetError } from './api/client';
|
|
14
|
+
export { DEFAULT_BASE_URL } from './types';
|
|
15
|
+
export { useWidgetState } from './state/use-widget-state';
|
|
16
|
+
export type { AgentUiAction, AgentUiBlock, BootOptions, Conversation, Message, OutboundMessage, PreChatField, RepzoWidgetErrorCode, RepzoWidgetStorageAdapter, WidgetAttachment, WidgetConfig, WidgetCustomAttributes, WidgetSpace, WidgetSpaceType, WidgetState, WidgetUser, WidgetView, } from './types';
|
|
17
|
+
export type { EventSubscription, MessageDidArrivePayload, RepzoWidgetEvent, RepzoWidgetEventPayloads, } from './events';
|
|
18
|
+
export type { WidgetTheme } from './ui/styles/theme';
|
|
19
|
+
/** Spaces the widget can open into — the analogue of Intercom's `Space`. */
|
|
20
|
+
export declare enum Space {
|
|
21
|
+
home = "home",
|
|
22
|
+
messages = "messages"
|
|
23
|
+
}
|
|
24
|
+
export type RepzoWidgetType = {
|
|
25
|
+
/**
|
|
26
|
+
* Start (or resume) a visitor session and connect realtime.
|
|
27
|
+
* Safe to call repeatedly — a boot for the same widget and user is a no-op,
|
|
28
|
+
* which matters because `POST /api/widget/init` is rate limited to 10/min.
|
|
29
|
+
*/
|
|
30
|
+
boot(options: BootOptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Drop any identity and start a fresh anonymous session. A previously
|
|
33
|
+
* identified user is fully signed out first (same as `logout()`).
|
|
34
|
+
*/
|
|
35
|
+
loginUnidentifiedUser(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Identify the visitor. Requires `userId` or `email`; conversations started
|
|
38
|
+
* anonymously on this device move to the identified visitor. If a
|
|
39
|
+
* *different* identified user's session is stored, it is signed out first
|
|
40
|
+
* (same as `logout()`) — their conversations never carry over.
|
|
41
|
+
*/
|
|
42
|
+
loginUserWithUserAttributes(user: WidgetUser): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Attach custom attributes to the visitor's identity so agents see them on
|
|
45
|
+
* the conversation (max 30 keys, 64-char keys, 512-char values).
|
|
46
|
+
*/
|
|
47
|
+
updateUser(attributes: WidgetCustomAttributes): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Sign the visitor out — await it in your app's sign-out flow. Revokes the
|
|
50
|
+
* token server-side and removes the push registration (best-effort, 5s cap
|
|
51
|
+
* each), wipes every user-scoped key, rotates the anonymous device id,
|
|
52
|
+
* closes realtime and resets the UI. Nothing re-inits until the next
|
|
53
|
+
* `boot()` / login call.
|
|
54
|
+
*/
|
|
55
|
+
logout(): Promise<void>;
|
|
56
|
+
/** Open the widget on its default space. */
|
|
57
|
+
present(): Promise<void>;
|
|
58
|
+
/** Open the widget on a specific space. */
|
|
59
|
+
presentSpace(space: Space | WidgetSpaceType): Promise<void>;
|
|
60
|
+
/** Open the widget directly on one conversation. */
|
|
61
|
+
presentConversation(conversationId: string): Promise<void>;
|
|
62
|
+
/** Dismiss the widget. */
|
|
63
|
+
hide(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Conversations with at least one unread team reply (Intercom's meaning).
|
|
66
|
+
* A thread stays unread until the visitor opens it — opening the messenger
|
|
67
|
+
* alone doesn't clear it.
|
|
68
|
+
*/
|
|
69
|
+
getUnreadConversationCount(): Promise<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Unread team replies across all conversations — the same number
|
|
72
|
+
* `UnreadCountDidChange` carries and the launcher badge shows.
|
|
73
|
+
*/
|
|
74
|
+
getUnreadMessageCount(): Promise<number>;
|
|
75
|
+
/** Record an analytics event against the visitor. */
|
|
76
|
+
logEvent(eventName: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
77
|
+
/** Switch the active translation locale. */
|
|
78
|
+
setLocale(locale: string): void;
|
|
79
|
+
/** Subscribe to `RepzoWidgetEvents.*`. Call `.remove()` on unmount. */
|
|
80
|
+
addEventListener<E extends RepzoWidgetEvent>(event: E, listener: (payload: any) => void): EventSubscription;
|
|
81
|
+
/** Key/value store for the device id, unread counts and cached theme. */
|
|
82
|
+
setStorageAdapter(adapter: RepzoWidgetStorageAdapter | null): void;
|
|
83
|
+
/**
|
|
84
|
+
* Keychain/Keystore-backed store for the visitor token and user key (e.g.
|
|
85
|
+
* `expo-secure-store`, `react-native-keychain` — see README). Without one
|
|
86
|
+
* they fall back to `setStorageAdapter`'s store. Call before `boot()`.
|
|
87
|
+
*/
|
|
88
|
+
setSecureStorageAdapter(adapter: RepzoWidgetStorageAdapter | null): void;
|
|
89
|
+
/**
|
|
90
|
+
* Manually register an FCM device token for push notifications — the escape
|
|
91
|
+
* hatch for hosts without `@react-native-firebase/messaging` (with it
|
|
92
|
+
* installed, `boot({ push: { enabled: true } })` handles everything).
|
|
93
|
+
*/
|
|
94
|
+
setPushToken(options: {
|
|
95
|
+
token: string;
|
|
96
|
+
platform?: 'ios' | 'android';
|
|
97
|
+
bundleId?: string;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
};
|
|
100
|
+
declare const RepzoWidget: RepzoWidgetType;
|
|
101
|
+
export default RepzoWidget;
|
|
102
|
+
export { RepzoWidgetEvents as Events };
|
|
103
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5F,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,YAAY,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,OAAO,EACP,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EAC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,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/E,4CAA4C;IAC5C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,uEAAuE;IACvE,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EACzC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAC/B,iBAAiB,CAAC;IAErB,yEAAyE;IACzE,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAC;IAEnE;;;;OAIG;IACH,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAC;IAEzE;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1G,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,eA4ClB,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,iBAAiB,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translations bundled with the SDK.
|
|
3
|
+
*
|
|
4
|
+
* A workspace can still override any key from the dashboard — those win. These
|
|
5
|
+
* exist so a widget running in a supported language is usable out of the box,
|
|
6
|
+
* instead of falling back to English for every string an admin has not filled
|
|
7
|
+
* in by hand.
|
|
8
|
+
*
|
|
9
|
+
* Keys mirror `DEFAULT_LABELS` in `./i18n`; `{token}` placeholders must be kept
|
|
10
|
+
* so word order stays under the translator's control.
|
|
11
|
+
*/
|
|
12
|
+
import type { DEFAULT_LABELS } from './i18n';
|
|
13
|
+
type LabelMap = Partial<Record<keyof typeof DEFAULT_LABELS, string>>;
|
|
14
|
+
export declare const BUNDLED_TRANSLATIONS: Record<string, LabelMap>;
|
|
15
|
+
/** `ar-JO`, `ar_SA` and `AR` all resolve to the `ar` bundle. */
|
|
16
|
+
export declare function baseLanguage(locale?: string | null): string;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/locales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AA4DrE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAErE,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FCM push notifications — optional.
|
|
3
|
+
*
|
|
4
|
+
* Powered by the HOST app's `@react-native-firebase/messaging` native module,
|
|
5
|
+
* loaded via a dynamic require so the SDK itself stays pure JavaScript. Hosts
|
|
6
|
+
* without Firebase installed get a warn-once no-op; hosts that can't install
|
|
7
|
+
* it can still register a token manually through `RepzoWidget.setPushToken()`.
|
|
8
|
+
*
|
|
9
|
+
* Supports both RNFB API generations: the modular API (`getMessaging()` etc.,
|
|
10
|
+
* the only one left in v26+) and the legacy namespaced `messaging()` factory.
|
|
11
|
+
*
|
|
12
|
+
* The Workstation channel must have its push provider set to FCM — with
|
|
13
|
+
* OneSignal selected these registrations are stored but unused.
|
|
14
|
+
*/
|
|
15
|
+
import type { WidgetApiClient } from '../api/client';
|
|
16
|
+
export interface WidgetPushOptions {
|
|
17
|
+
/** Register this device for FCM pushes after every successful session init. */
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Ask for notification permission before registering (default true). Set
|
|
21
|
+
* false when the host app runs its own permission prompt.
|
|
22
|
+
*/
|
|
23
|
+
requestPermission?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The app's bundle id / package name. Lets a Workstation channel that serves
|
|
26
|
+
* several apps pick the matching Firebase key for this device's tokens.
|
|
27
|
+
* Optional for single-app channels.
|
|
28
|
+
*/
|
|
29
|
+
bundleId?: string;
|
|
30
|
+
}
|
|
31
|
+
interface ManualToken {
|
|
32
|
+
token: string;
|
|
33
|
+
platform?: string;
|
|
34
|
+
bundleId?: string | null;
|
|
35
|
+
}
|
|
36
|
+
export declare class PushManager {
|
|
37
|
+
private client;
|
|
38
|
+
private openConversation;
|
|
39
|
+
private options;
|
|
40
|
+
private listenersWired;
|
|
41
|
+
private lastToken;
|
|
42
|
+
private manualToken;
|
|
43
|
+
private warnedMissingModule;
|
|
44
|
+
/** False while signed out — token refreshes must not register anywhere. */
|
|
45
|
+
private active;
|
|
46
|
+
/** Registrations still on the wire; unregister() waits for them. */
|
|
47
|
+
private inflight;
|
|
48
|
+
constructor(client: WidgetApiClient, openConversation: (conversationId: string) => void);
|
|
49
|
+
/** Remember the boot options; actual work happens in start() post-init. */
|
|
50
|
+
configure(options?: WidgetPushOptions): void;
|
|
51
|
+
/**
|
|
52
|
+
* Called after every successful session init — the widget token is valid
|
|
53
|
+
* from here. Re-running after a login switch re-registers the token under
|
|
54
|
+
* the new identity (the server upsert moves it).
|
|
55
|
+
*/
|
|
56
|
+
start(): Promise<void>;
|
|
57
|
+
/** Host-supplied token for apps without the Firebase module. */
|
|
58
|
+
setManualToken(manual: ManualToken): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Called by logout with the session's token captured up front: the DELETE
|
|
61
|
+
* is authenticated with it explicitly and never triggers a re-init.
|
|
62
|
+
* Waits for an in-flight registration first so its token is not missed.
|
|
63
|
+
*/
|
|
64
|
+
unregister(authToken: string | null): Promise<void>;
|
|
65
|
+
private register;
|
|
66
|
+
private wireTapHandlers;
|
|
67
|
+
/** Only widget pushes are ours — host app notifications pass through. */
|
|
68
|
+
private handleTap;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=push-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-notifications.d.ts","sourceRoot":"","sources":["../../../../src/push/push-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAuDD,qBAAa,WAAW;IAkBpB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,gBAAgB;IAlB1B,OAAO,CAAC,OAAO,CAAyB;IAExC,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,SAAS,CAAuB;IAExC,OAAO,CAAC,WAAW,CAA4B;IAE/C,OAAO,CAAC,mBAAmB,CAAS;IAEpC,2EAA2E;IAC3E,OAAO,CAAC,MAAM,CAAS;IAEvB,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAA4B;gBAGlC,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI;IAG5D,2EAA2E;IAC3E,SAAS,CAAC,OAAO,CAAC,EAAE,iBAAiB;IAIrC;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwD5B,gEAAgE;IAC1D,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxD;;;;OAIG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAazD,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,eAAe;IAevB,yEAAyE;IACzE,OAAO,CAAC,SAAS;CAQlB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React binding for the store. The store lives in the controller singleton, so
|
|
3
|
+
* the widget keeps its session, SSE stream and unread count even when no
|
|
4
|
+
* component is mounted; this hook only subscribes to it.
|
|
5
|
+
*/
|
|
6
|
+
import type { WidgetState } from '../types';
|
|
7
|
+
import type { WidgetStore } from './widget-store';
|
|
8
|
+
export declare function useWidgetState(): WidgetState;
|
|
9
|
+
export declare function useWidgetStore(): WidgetStore;
|
|
10
|
+
//# sourceMappingURL=use-widget-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-widget-state.d.ts","sourceRoot":"","sources":["../../../../src/state/use-widget-state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The widget's single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the web widget's `client/src/widget/hooks/use-widget-state.ts`
|
|
5
|
+
* plus the routing/tab logic in `client/src/widget/App.tsx`. Unlike the web
|
|
6
|
+
* version this is a plain store rather than a hook, because the SSE connection
|
|
7
|
+
* and the unread count must stay alive while the UI is closed — the modal is
|
|
8
|
+
* only a subscriber.
|
|
9
|
+
*/
|
|
10
|
+
import { WidgetApiClient } from '../api/client';
|
|
11
|
+
import { EventEmitter } from '../events';
|
|
12
|
+
import { PushManager } from '../push/push-notifications';
|
|
13
|
+
import type { AgentUiAction, BootOptions, WidgetAttachment, WidgetCustomAttributes, WidgetSpaceType, WidgetState, WidgetUser, WidgetView } from '../types';
|
|
14
|
+
export declare class WidgetStore {
|
|
15
|
+
readonly client: WidgetApiClient;
|
|
16
|
+
readonly events: EventEmitter;
|
|
17
|
+
readonly push: PushManager;
|
|
18
|
+
private state;
|
|
19
|
+
private subscribers;
|
|
20
|
+
private realtime;
|
|
21
|
+
private typingTimer;
|
|
22
|
+
private pendingAgentByConversation;
|
|
23
|
+
private bootConfig;
|
|
24
|
+
private bootPromise;
|
|
25
|
+
/** Identity key of the in-flight boot — a boot for someone else is not deduped. */
|
|
26
|
+
private bootingUserKey;
|
|
27
|
+
private currentUser;
|
|
28
|
+
/** Who the stored token was issued to; null = anonymous. */
|
|
29
|
+
private currentUserKey;
|
|
30
|
+
/** True once `currentUserKey` mirrors storage — memory is then authoritative. */
|
|
31
|
+
private userKeyLoaded;
|
|
32
|
+
private pendingConversationId;
|
|
33
|
+
private appStateSubscription;
|
|
34
|
+
private lastTypingPingAt;
|
|
35
|
+
private visitorTypingActive;
|
|
36
|
+
private seenMessageIds;
|
|
37
|
+
/**
|
|
38
|
+
* Identity generation. Bumped whenever boot/login/logout is requested; every
|
|
39
|
+
* async path that writes session state captures it first and bails once it
|
|
40
|
+
* moved, so a slow init for user A can never land after B logged in or
|
|
41
|
+
* after logout.
|
|
42
|
+
*/
|
|
43
|
+
private epoch;
|
|
44
|
+
/** Serializes identity ops (and 401 re-inits) — one init or wipe at a time. */
|
|
45
|
+
private identityQueue;
|
|
46
|
+
/** Shared by concurrent 401s: one re-init, not one per failed request. */
|
|
47
|
+
private reauthPromise;
|
|
48
|
+
/** Set by logout(); blocks 401 re-init and realtime until the next boot/login. */
|
|
49
|
+
private loggedOut;
|
|
50
|
+
/**
|
|
51
|
+
* True during wipeSession(). A 401 from a request still on the wire (a push
|
|
52
|
+
* registration it waits for) must not queue a re-init behind the wipe.
|
|
53
|
+
*/
|
|
54
|
+
private wiping;
|
|
55
|
+
/** Set by a terminal 403 — stops realtime and re-init until a successful init. */
|
|
56
|
+
private terminalErrorCode;
|
|
57
|
+
private lastStreamReauthAt;
|
|
58
|
+
/** Queued/running boot, login and logout ops — Retry must not cut in. */
|
|
59
|
+
private identityOpsInFlight;
|
|
60
|
+
/**
|
|
61
|
+
* Bumped whenever a different thread (or a fresh draft) takes the screen.
|
|
62
|
+
* Message loads capture it and drop their result once it moved, so a slow
|
|
63
|
+
* response for A never paints under B.
|
|
64
|
+
*/
|
|
65
|
+
private threadGeneration;
|
|
66
|
+
/**
|
|
67
|
+
* The in-flight first send of a draft, which creates its conversation.
|
|
68
|
+
* Sends from the same draft wait for its id instead of creating another.
|
|
69
|
+
*/
|
|
70
|
+
private conversationCreation;
|
|
71
|
+
/** Live events for a thread that may be the one the draft is creating. */
|
|
72
|
+
private draftEvents;
|
|
73
|
+
/** False until this stream's first `connected`; later ones are reconnects. */
|
|
74
|
+
private streamConnectedOnce;
|
|
75
|
+
/** The stream errored before its first `connected` — that one is a reconnect too. */
|
|
76
|
+
private streamErrored;
|
|
77
|
+
private readTimer;
|
|
78
|
+
private readConversationId;
|
|
79
|
+
constructor();
|
|
80
|
+
subscribe: (listener: () => void) => (() => void);
|
|
81
|
+
getState: () => WidgetState;
|
|
82
|
+
private setState;
|
|
83
|
+
private serialize;
|
|
84
|
+
/** Queue a requested identity op; anything older becomes stale right away. */
|
|
85
|
+
private enqueueIdentity;
|
|
86
|
+
private isStale;
|
|
87
|
+
boot(options: BootOptions): Promise<void>;
|
|
88
|
+
private userChanged;
|
|
89
|
+
/**
|
|
90
|
+
* Init for `user` — or, when undefined, for whoever the stored token
|
|
91
|
+
* belongs to. The stored token is only resumed when it is anonymous or
|
|
92
|
+
* already belongs to `user`: resuming another identified user's token would
|
|
93
|
+
* hand their conversations to this one, so that case signs them out first.
|
|
94
|
+
*/
|
|
95
|
+
private establishSession;
|
|
96
|
+
private runInit;
|
|
97
|
+
/** Every `await` is followed by an epoch check: stale results write nothing. */
|
|
98
|
+
private initSession;
|
|
99
|
+
/**
|
|
100
|
+
* The last config this device received, applied before init returns so the
|
|
101
|
+
* UI opens with the workspace's real theme instead of the built-in defaults.
|
|
102
|
+
* Skipped once a fresh config is in state — never downgrades live data.
|
|
103
|
+
*/
|
|
104
|
+
private seedCachedConfig;
|
|
105
|
+
private persistConfig;
|
|
106
|
+
private storedUserKey;
|
|
107
|
+
/**
|
|
108
|
+
* Called by the API client after a 401. Single-flight: concurrent 401s share
|
|
109
|
+
* one re-init. Runs in the identity queue but does not bump the epoch, so it
|
|
110
|
+
* can't cancel a boot/login queued behind it — and it gives up if one was.
|
|
111
|
+
*/
|
|
112
|
+
private reauthorize;
|
|
113
|
+
/** A terminal 403 (`messenger_api_disabled`, `identity_verification_failed`). */
|
|
114
|
+
private handleTerminalError;
|
|
115
|
+
loginUnidentifiedUser(): Promise<void>;
|
|
116
|
+
loginUserWithUserAttributes(user: WidgetUser): Promise<void>;
|
|
117
|
+
updateUser(attributes: WidgetCustomAttributes): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Signs the visitor out for good — hosts should await this on sign-out.
|
|
120
|
+
* Synchronously stops realtime, re-init and the UI; then (queued behind any
|
|
121
|
+
* in-flight init) wipes the session and tells the server.
|
|
122
|
+
*/
|
|
123
|
+
logout(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Full local + server sign-out of the stored session, used by logout() and
|
|
126
|
+
* by a login that switches to a different user. The local wipe runs first,
|
|
127
|
+
* so nothing of the old user stays readable even if the network hangs;
|
|
128
|
+
* then the push registration is removed and the token revoked — both
|
|
129
|
+
* authenticated with the captured token, time-boxed, and never re-initing.
|
|
130
|
+
* Only the cached channel theme survives (it carries no visitor data).
|
|
131
|
+
*/
|
|
132
|
+
private wipeSession;
|
|
133
|
+
private wipeSessionUnguarded;
|
|
134
|
+
/**
|
|
135
|
+
* Re-runs the last boot after a failure — wired to the error screen's retry
|
|
136
|
+
* and to foreground resume. Never rejects: the outcome lands in state.
|
|
137
|
+
*/
|
|
138
|
+
retry(): Promise<void>;
|
|
139
|
+
/** Drops every per-thread tracker — the visitor (or their session) changed. */
|
|
140
|
+
private resetThreadTracking;
|
|
141
|
+
private requireBootConfig;
|
|
142
|
+
private connectRealtime;
|
|
143
|
+
/** The stream got a 401: share the single-flight re-init, then reconnect. */
|
|
144
|
+
private reauthorizeStream;
|
|
145
|
+
private watchAppState;
|
|
146
|
+
private resumeFromBackground;
|
|
147
|
+
/**
|
|
148
|
+
* Re-read the config so availability and copy do not go stale. `isOnline` is
|
|
149
|
+
* otherwise a snapshot from boot, which a long-lived app would keep showing
|
|
150
|
+
* hours after the team went offline.
|
|
151
|
+
*/
|
|
152
|
+
private refreshConfig;
|
|
153
|
+
private handleRealtimeEvent;
|
|
154
|
+
/**
|
|
155
|
+
* The thread the visitor is looking at right now — the only one live
|
|
156
|
+
* messages, typing and events may paint into. The `isOpen` guard matters on
|
|
157
|
+
* mobile: the widget spends most of its life closed, and a stale
|
|
158
|
+
* `view === 'chat'` would otherwise swallow the unread increment. A blank
|
|
159
|
+
* draft matches nothing; its thread is adopted once the first send answers.
|
|
160
|
+
*/
|
|
161
|
+
private isThreadOnScreen;
|
|
162
|
+
/**
|
|
163
|
+
* While a draft's first send is in flight its conversation id is unknown,
|
|
164
|
+
* and the server may already stream the thread's first reply (or an "agent
|
|
165
|
+
* joined" event). Events for a thread this device doesn't know are held
|
|
166
|
+
* until the send answers, then replayed: into the draft if it is that
|
|
167
|
+
* thread, otherwise as ordinary unread traffic.
|
|
168
|
+
*/
|
|
169
|
+
private shouldHoldForDraft;
|
|
170
|
+
private replayDraftEvents;
|
|
171
|
+
private persistUnread;
|
|
172
|
+
/** Survives a relaunch so a reply received overnight is still marked unread. */
|
|
173
|
+
private loadUnread;
|
|
174
|
+
private clearUnreadFor;
|
|
175
|
+
private isReplayedMessage;
|
|
176
|
+
private handleNewMessage;
|
|
177
|
+
/** Trailing debounce: one read call per burst of live replies. */
|
|
178
|
+
private scheduleMarkRead;
|
|
179
|
+
/** Best effort and never re-inits — a missed cursor move only costs a badge. */
|
|
180
|
+
private flushMarkRead;
|
|
181
|
+
private cancelMarkRead;
|
|
182
|
+
private handleConversationEvent;
|
|
183
|
+
private rememberConversationAgent;
|
|
184
|
+
private applyConversationAgent;
|
|
185
|
+
private hydrateConversation;
|
|
186
|
+
/**
|
|
187
|
+
* Normalizes attachments from history pages and live payloads alike. Live
|
|
188
|
+
* payloads may omit `id`/`size`, so the list still gets a stable key.
|
|
189
|
+
*/
|
|
190
|
+
private hydrateAttachments;
|
|
191
|
+
private clearTypingTimer;
|
|
192
|
+
private scheduleTypingClear;
|
|
193
|
+
private resolveOpenView;
|
|
194
|
+
present(space?: WidgetSpaceType): void;
|
|
195
|
+
hide(): void;
|
|
196
|
+
toggle(space?: WidgetSpaceType): void;
|
|
197
|
+
setView(view: WidgetView): void;
|
|
198
|
+
setActiveTab(tab: WidgetSpaceType): void;
|
|
199
|
+
setLocale(locale: string): void;
|
|
200
|
+
startNewConversation(prefill?: string): void;
|
|
201
|
+
setPrefillText(prefill: string): void;
|
|
202
|
+
dismissOutboundMessage(): void;
|
|
203
|
+
refreshConversations(): Promise<void>;
|
|
204
|
+
openConversation(conversationId: string): Promise<void>;
|
|
205
|
+
loadMoreMessages(): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Re-reads the newest page of the thread on screen and merges in whatever
|
|
208
|
+
* the stream missed (reconnect, foreground, re-init). Deduped by server id.
|
|
209
|
+
* Only for a thread actually on screen: the first page also advances the
|
|
210
|
+
* server read cursor, which must not happen for a thread nobody is reading.
|
|
211
|
+
*/
|
|
212
|
+
private refreshOpenThread;
|
|
213
|
+
/** A history page (newest-first) as the oldest-first list the UI renders. */
|
|
214
|
+
private hydrateMessages;
|
|
215
|
+
sendMessage(body: string, attachments?: WidgetAttachment[], agentUiAction?: AgentUiAction): Promise<void>;
|
|
216
|
+
identifyVisitor(data: {
|
|
217
|
+
email?: string;
|
|
218
|
+
name?: string;
|
|
219
|
+
phone?: string;
|
|
220
|
+
}): Promise<void>;
|
|
221
|
+
/** Fire-and-forget visitor typing ping, throttled well under the 30/min cap. */
|
|
222
|
+
notifyTyping(isTyping: boolean): void;
|
|
223
|
+
track(event: string, metadata?: Record<string, unknown>): void;
|
|
224
|
+
private loadOutboundMessage;
|
|
225
|
+
destroy(): void;
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=widget-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-store.d.ts","sourceRoot":"","sources":["../../../../src/state/widget-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAyC,eAAe,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAIX,gBAAgB,EAEhB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,UAAU,EACV,UAAU,EACX,MAAM,UAAU,CAAC;AAkFlB,qBAAa,WAAW;IACtB,QAAQ,CAAC,MAAM,kBAAyB;IAExC,QAAQ,CAAC,MAAM,eAAsB;IAErC,QAAQ,CAAC,IAAI,cAEV;IAEH,OAAO,CAAC,KAAK,CAA8B;IAE3C,OAAO,CAAC,WAAW,CAAyB;IAE5C,OAAO,CAAC,QAAQ,CAAwB;IAExC,OAAO,CAAC,WAAW,CAA8C;IAEjE,OAAO,CAAC,0BAA0B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,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAY7F,gFAAgF;IAChF,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAoBrC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAWlE,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,IAAI,IAAI;CAShB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage adapters.
|
|
3
|
+
*
|
|
4
|
+
* `Storage` (device id, unread counts, cached theme) resolves: an adapter
|
|
5
|
+
* injected via `RepzoWidget.setStorageAdapter()`, then
|
|
6
|
+
* `@react-native-async-storage/async-storage` if the host app installed it,
|
|
7
|
+
* then an in-memory map. The in-memory fallback keeps the SDK working (the
|
|
8
|
+
* session just doesn't survive a relaunch) instead of crashing.
|
|
9
|
+
*
|
|
10
|
+
* `SecureStorage` (visitor token, user key) uses the adapter injected via
|
|
11
|
+
* `RepzoWidget.setSecureStorageAdapter()` — Keychain/Keystore backed — and
|
|
12
|
+
* falls back to `Storage` when the host provided none. AsyncStorage is
|
|
13
|
+
* plaintext on disk, so the bearer token belongs in the secure one.
|
|
14
|
+
*/
|
|
15
|
+
import type { RepzoWidgetStorageAdapter } from './types';
|
|
16
|
+
export declare const TOKEN_KEY = "repzo_widget_token";
|
|
17
|
+
/** Identity key (email/userId) the stored token was issued to; absent = anonymous. */
|
|
18
|
+
export declare const USER_KEY = "repzo_widget_user_key";
|
|
19
|
+
export declare const DEVICE_ID_KEY = "repzo_widget_device_id";
|
|
20
|
+
export declare const UNREAD_KEY = "repzo_widget_unread";
|
|
21
|
+
/** Last config received — repaints the real theme instantly on relaunch. */
|
|
22
|
+
/**
|
|
23
|
+
* v2 wraps the config with the channel/baseUrl/platform it came from. v1 held a
|
|
24
|
+
* bare config that a foreground refresh could overwrite with the web design,
|
|
25
|
+
* so it's ignored (and cleared) rather than painted.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CONFIG_KEY = "repzo_widget_config_v2";
|
|
28
|
+
export declare const LEGACY_CONFIG_KEY = "repzo_widget_config";
|
|
29
|
+
export declare function setStorageAdapter(adapter: RepzoWidgetStorageAdapter | null): void;
|
|
30
|
+
export declare const Storage: {
|
|
31
|
+
getItem(key: string): Promise<string | null>;
|
|
32
|
+
setItem(key: string, value: string): Promise<void>;
|
|
33
|
+
removeItem(key: string): Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
export declare function setSecureStorageAdapter(adapter: RepzoWidgetStorageAdapter | null): void;
|
|
36
|
+
export declare const SecureStorage: {
|
|
37
|
+
getItem(key: string): Promise<string | null>;
|
|
38
|
+
setItem(key: string, value: string): Promise<void>;
|
|
39
|
+
/** Clears both stores, so a pre-migration plaintext copy can't linger. */
|
|
40
|
+
removeItem(key: string): Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAC9C,sFAAsF;AACtF,eAAO,MAAM,QAAQ,0BAA0B,CAAC;AAChD,eAAO,MAAM,aAAa,2BAA2B,CAAC;AACtD,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD,4EAA4E;AAC5E;;;;GAIG;AACH,eAAO,MAAM,UAAU,2BAA2B,CAAC;AACnD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAyCvD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEjF;AAED,eAAO,MAAM,OAAO;iBACC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAS/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;oBAQlC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO7C,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAEvF;AAED,eAAO,MAAM,aAAa;iBACL,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAkB/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAexD,0EAA0E;oBACpD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU7C,CAAC"}
|