@inkeep/cxkit-primitives 0.0.0-dev-20250221234142
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/atoms/api/analytics/conversation.cjs +1 -0
- package/dist/atoms/api/analytics/conversation.d.cts +3 -0
- package/dist/atoms/api/analytics/conversation.d.ts +3 -0
- package/dist/atoms/api/analytics/conversation.js +37 -0
- package/dist/atoms/api/analytics/events.cjs +1 -0
- package/dist/atoms/api/analytics/events.d.cts +2 -0
- package/dist/atoms/api/analytics/events.d.ts +2 -0
- package/dist/atoms/api/analytics/events.js +30 -0
- package/dist/atoms/api/analytics/feedback.cjs +1 -0
- package/dist/atoms/api/analytics/feedback.d.cts +11 -0
- package/dist/atoms/api/analytics/feedback.d.ts +11 -0
- package/dist/atoms/api/analytics/feedback.js +26 -0
- package/dist/atoms/avatars/ai.cjs +1 -0
- package/dist/atoms/avatars/ai.d.cts +3 -0
- package/dist/atoms/avatars/ai.d.ts +3 -0
- package/dist/atoms/avatars/ai.js +88 -0
- package/dist/atoms/avatars/user.cjs +1 -0
- package/dist/atoms/avatars/user.d.cts +3 -0
- package/dist/atoms/avatars/user.d.ts +3 -0
- package/dist/atoms/avatars/user.js +27 -0
- package/dist/atoms/codeblock/index.cjs +1 -0
- package/dist/atoms/codeblock/index.d.cts +10 -0
- package/dist/atoms/codeblock/index.d.ts +10 -0
- package/dist/atoms/codeblock/index.js +40 -0
- package/dist/atoms/custom-styles.cjs +1 -0
- package/dist/atoms/custom-styles.d.cts +5 -0
- package/dist/atoms/custom-styles.d.ts +5 -0
- package/dist/atoms/custom-styles.js +57 -0
- package/dist/atoms/dialog.cjs +1 -0
- package/dist/atoms/dialog.d.cts +68 -0
- package/dist/atoms/dialog.d.ts +68 -0
- package/dist/atoms/dialog.js +185 -0
- package/dist/atoms/icons/built-in-icon-renderer.cjs +1 -0
- package/dist/atoms/icons/built-in-icon-renderer.d.cts +6 -0
- package/dist/atoms/icons/built-in-icon-renderer.d.ts +6 -0
- package/dist/atoms/icons/built-in-icon-renderer.js +49 -0
- package/dist/atoms/icons/built-in-icons.cjs +1 -0
- package/dist/atoms/icons/built-in-icons.d.cts +72 -0
- package/dist/atoms/icons/built-in-icons.d.ts +72 -0
- package/dist/atoms/icons/built-in-icons.js +79 -0
- package/dist/atoms/icons/checkbox-icon.cjs +1 -0
- package/dist/atoms/icons/checkbox-icon.d.cts +1 -0
- package/dist/atoms/icons/checkbox-icon.d.ts +1 -0
- package/dist/atoms/icons/checkbox-icon.js +24 -0
- package/dist/atoms/icons/custom-icon.cjs +1 -0
- package/dist/atoms/icons/custom-icon.d.cts +6 -0
- package/dist/atoms/icons/custom-icon.d.ts +6 -0
- package/dist/atoms/icons/custom-icon.js +19 -0
- package/dist/atoms/icons/index.cjs +1 -0
- package/dist/atoms/icons/index.d.cts +2 -0
- package/dist/atoms/icons/index.d.ts +2 -0
- package/dist/atoms/icons/index.js +6 -0
- package/dist/atoms/icons/inkeep-default-icons.cjs +1 -0
- package/dist/atoms/icons/inkeep-default-icons.d.cts +2 -0
- package/dist/atoms/icons/inkeep-default-icons.d.ts +2 -0
- package/dist/atoms/icons/inkeep-default-icons.js +23 -0
- package/dist/atoms/link.cjs +1 -0
- package/dist/atoms/link.d.cts +14 -0
- package/dist/atoms/link.d.ts +14 -0
- package/dist/atoms/link.js +35 -0
- package/dist/atoms/markdown/components.cjs +1 -0
- package/dist/atoms/markdown/components.d.cts +27 -0
- package/dist/atoms/markdown/components.d.ts +27 -0
- package/dist/atoms/markdown/components.js +64 -0
- package/dist/atoms/markdown/index.cjs +1 -0
- package/dist/atoms/markdown/index.d.cts +15 -0
- package/dist/atoms/markdown/index.d.ts +15 -0
- package/dist/atoms/markdown/index.js +79 -0
- package/dist/atoms/markdown/rehype-inline-code-property.cjs +1 -0
- package/dist/atoms/markdown/rehype-inline-code-property.d.cts +1 -0
- package/dist/atoms/markdown/rehype-inline-code-property.d.ts +1 -0
- package/dist/atoms/markdown/rehype-inline-code-property.js +12 -0
- package/dist/atoms/portal-with-theme.cjs +1 -0
- package/dist/atoms/portal-with-theme.d.cts +2 -0
- package/dist/atoms/portal-with-theme.d.ts +2 -0
- package/dist/atoms/portal-with-theme.js +12 -0
- package/dist/atoms/portal.cjs +1 -0
- package/dist/atoms/portal.d.cts +8 -0
- package/dist/atoms/portal.d.ts +8 -0
- package/dist/atoms/portal.js +19 -0
- package/dist/atoms/shadow/context.cjs +2 -0
- package/dist/atoms/shadow/context.d.cts +14 -0
- package/dist/atoms/shadow/context.d.ts +14 -0
- package/dist/atoms/shadow/context.js +55 -0
- package/dist/atoms/shadow/create.cjs +1 -0
- package/dist/atoms/shadow/create.d.cts +8 -0
- package/dist/atoms/shadow/create.d.ts +8 -0
- package/dist/atoms/shadow/create.js +56 -0
- package/dist/atoms/shadow/index.d.cts +1 -0
- package/dist/atoms/shadow/index.d.ts +1 -0
- package/dist/atoms/shadow/root.cjs +1 -0
- package/dist/atoms/shadow/root.d.cts +5 -0
- package/dist/atoms/shadow/root.d.ts +5 -0
- package/dist/atoms/shadow/root.js +22 -0
- package/dist/atoms/shadow/use-ensured-forwarded-ref.cjs +1 -0
- package/dist/atoms/shadow/use-ensured-forwarded-ref.d.cts +2 -0
- package/dist/atoms/shadow/use-ensured-forwarded-ref.d.ts +2 -0
- package/dist/atoms/shadow/use-ensured-forwarded-ref.js +11 -0
- package/dist/atoms/shadow/utils.cjs +1 -0
- package/dist/atoms/shadow/utils.d.cts +9 -0
- package/dist/atoms/shadow/utils.d.ts +9 -0
- package/dist/atoms/shadow/utils.js +16 -0
- package/dist/components/chat-button.cjs +1 -0
- package/dist/components/chat-button.d.cts +11 -0
- package/dist/components/chat-button.d.ts +11 -0
- package/dist/components/chat-button.js +42 -0
- package/dist/components/embedded-chat/chat-provider.cjs +1 -0
- package/dist/components/embedded-chat/chat-provider.d.cts +19 -0
- package/dist/components/embedded-chat/chat-provider.d.ts +19 -0
- package/dist/components/embedded-chat/chat-provider.js +22 -0
- package/dist/components/embedded-chat/use-captcha.cjs +1 -0
- package/dist/components/embedded-chat/use-captcha.d.cts +13 -0
- package/dist/components/embedded-chat/use-captcha.d.ts +13 -0
- package/dist/components/embedded-chat/use-captcha.js +56 -0
- package/dist/components/embedded-chat/use-chat-action.cjs +1 -0
- package/dist/components/embedded-chat/use-chat-action.d.cts +9 -0
- package/dist/components/embedded-chat/use-chat-action.d.ts +9 -0
- package/dist/components/embedded-chat/use-chat-action.js +26 -0
- package/dist/components/embedded-chat/use-inkeep-chat.cjs +4 -0
- package/dist/components/embedded-chat/use-inkeep-chat.d.cts +25 -0
- package/dist/components/embedded-chat/use-inkeep-chat.d.ts +25 -0
- package/dist/components/embedded-chat/use-inkeep-chat.js +227 -0
- package/dist/components/embedded-chat.cjs +17 -0
- package/dist/components/embedded-chat.d.cts +415 -0
- package/dist/components/embedded-chat.d.ts +415 -0
- package/dist/components/embedded-chat.js +1840 -0
- package/dist/components/embedded-search/search-provider.cjs +1 -0
- package/dist/components/embedded-search/search-provider.d.cts +21 -0
- package/dist/components/embedded-search/search-provider.d.ts +21 -0
- package/dist/components/embedded-search/search-provider.js +19 -0
- package/dist/components/embedded-search/search-query.graphql.cjs +82 -0
- package/dist/components/embedded-search/search-query.graphql.js +86 -0
- package/dist/components/embedded-search/transform-results.cjs +1 -0
- package/dist/components/embedded-search/transform-results.d.cts +3 -0
- package/dist/components/embedded-search/transform-results.d.ts +3 -0
- package/dist/components/embedded-search/transform-results.js +113 -0
- package/dist/components/embedded-search/use-inkeep-search.cjs +1 -0
- package/dist/components/embedded-search/use-inkeep-search.d.cts +21 -0
- package/dist/components/embedded-search/use-inkeep-search.d.ts +21 -0
- package/dist/components/embedded-search/use-inkeep-search.js +137 -0
- package/dist/components/embedded-search.cjs +1 -0
- package/dist/components/embedded-search.d.cts +229 -0
- package/dist/components/embedded-search.d.ts +229 -0
- package/dist/components/embedded-search.js +390 -0
- package/dist/components/factory.cjs +1 -0
- package/dist/components/factory.d.cts +19 -0
- package/dist/components/factory.d.ts +19 -0
- package/dist/components/factory.js +39 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +11 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +31 -0
- package/dist/components/intelligent-form/actions/context-model-response.cjs +9 -0
- package/dist/components/intelligent-form/actions/context-model-response.d.cts +10 -0
- package/dist/components/intelligent-form/actions/context-model-response.d.ts +10 -0
- package/dist/components/intelligent-form/actions/context-model-response.js +36 -0
- package/dist/components/intelligent-form/actions/escalation-schema.cjs +1 -0
- package/dist/components/intelligent-form/actions/escalation-schema.d.cts +2 -0
- package/dist/components/intelligent-form/actions/escalation-schema.d.ts +2 -0
- package/dist/components/intelligent-form/actions/escalation-schema.js +48 -0
- package/dist/components/intelligent-form/actions/qa-model-messages.cjs +27 -0
- package/dist/components/intelligent-form/actions/qa-model-messages.d.cts +2 -0
- package/dist/components/intelligent-form/actions/qa-model-messages.d.ts +2 -0
- package/dist/components/intelligent-form/actions/qa-model-messages.js +45 -0
- package/dist/components/intelligent-form/actions/qa-model-response.cjs +1 -0
- package/dist/components/intelligent-form/actions/qa-model-response.d.cts +14 -0
- package/dist/components/intelligent-form/actions/qa-model-response.d.ts +14 -0
- package/dist/components/intelligent-form/actions/qa-model-response.js +46 -0
- package/dist/components/intelligent-form/intelligent-form-provider.cjs +1 -0
- package/dist/components/intelligent-form/intelligent-form-provider.d.cts +29 -0
- package/dist/components/intelligent-form/intelligent-form-provider.d.ts +29 -0
- package/dist/components/intelligent-form/intelligent-form-provider.js +23 -0
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.cjs +1 -0
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.cts +30 -0
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.ts +30 -0
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.js +157 -0
- package/dist/components/intelligent-form.cjs +1 -0
- package/dist/components/intelligent-form.d.cts +135 -0
- package/dist/components/intelligent-form.d.ts +135 -0
- package/dist/components/intelligent-form.js +568 -0
- package/dist/components/modal/modal-provider.cjs +1 -0
- package/dist/components/modal/modal-provider.d.cts +13 -0
- package/dist/components/modal/modal-provider.d.ts +13 -0
- package/dist/components/modal/modal-provider.js +8 -0
- package/dist/components/modal/use-inkeep-modal.cjs +1 -0
- package/dist/components/modal/use-inkeep-modal.d.cts +8 -0
- package/dist/components/modal/use-inkeep-modal.d.ts +8 -0
- package/dist/components/modal/use-inkeep-modal.js +30 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.cts +18 -0
- package/dist/components/modal.d.ts +18 -0
- package/dist/components/modal.js +40 -0
- package/dist/components/searchbar.cjs +1 -0
- package/dist/components/searchbar.d.cts +23 -0
- package/dist/components/searchbar.d.ts +23 -0
- package/dist/components/searchbar.js +54 -0
- package/dist/components/tagline-logo-icon.cjs +1 -0
- package/dist/components/tagline-logo-icon.d.cts +1 -0
- package/dist/components/tagline-logo-icon.d.ts +1 -0
- package/dist/components/tagline-logo-icon.js +34 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.d.cts +12 -0
- package/dist/hooks/index.d.ts +12 -0
- package/dist/hooks/index.js +27 -0
- package/dist/hooks/use-boolean.cjs +1 -0
- package/dist/hooks/use-boolean.d.cts +10 -0
- package/dist/hooks/use-boolean.d.ts +10 -0
- package/dist/hooks/use-boolean.js +17 -0
- package/dist/hooks/use-browser-storage.cjs +1 -0
- package/dist/hooks/use-browser-storage.d.cts +17 -0
- package/dist/hooks/use-browser-storage.d.ts +17 -0
- package/dist/hooks/use-browser-storage.js +88 -0
- package/dist/hooks/use-component-classnames.cjs +1 -0
- package/dist/hooks/use-component-classnames.d.cts +6 -0
- package/dist/hooks/use-component-classnames.d.ts +6 -0
- package/dist/hooks/use-component-classnames.js +14 -0
- package/dist/hooks/use-container-size.cjs +1 -0
- package/dist/hooks/use-container-size.d.cts +5 -0
- package/dist/hooks/use-container-size.d.ts +5 -0
- package/dist/hooks/use-container-size.js +18 -0
- package/dist/hooks/use-copy-to-clipboard.cjs +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.cts +3 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +3 -0
- package/dist/hooks/use-copy-to-clipboard.js +19 -0
- package/dist/hooks/use-instant-update.cjs +1 -0
- package/dist/hooks/use-instant-update.d.cts +17 -0
- package/dist/hooks/use-instant-update.d.ts +17 -0
- package/dist/hooks/use-instant-update.js +16 -0
- package/dist/hooks/use-is-mounted.cjs +1 -0
- package/dist/hooks/use-is-mounted.d.cts +1 -0
- package/dist/hooks/use-is-mounted.d.ts +1 -0
- package/dist/hooks/use-is-mounted.js +11 -0
- package/dist/hooks/use-media-query.cjs +1 -0
- package/dist/hooks/use-media-query.d.cts +1 -0
- package/dist/hooks/use-media-query.d.ts +1 -0
- package/dist/hooks/use-media-query.js +14 -0
- package/dist/hooks/use-resize-observer.cjs +1 -0
- package/dist/hooks/use-resize-observer.d.cts +12 -0
- package/dist/hooks/use-resize-observer.d.ts +12 -0
- package/dist/hooks/use-resize-observer.js +32 -0
- package/dist/hooks/use-scroll-to-bottom.cjs +1 -0
- package/dist/hooks/use-scroll-to-bottom.d.cts +13 -0
- package/dist/hooks/use-scroll-to-bottom.d.ts +13 -0
- package/dist/hooks/use-scroll-to-bottom.js +52 -0
- package/dist/hooks/use-scrolling-fades.cjs +1 -0
- package/dist/hooks/use-scrolling-fades.d.cts +2 -0
- package/dist/hooks/use-scrolling-fades.d.ts +2 -0
- package/dist/hooks/use-scrolling-fades.js +18 -0
- package/dist/hooks/use-settle-action.cjs +1 -0
- package/dist/hooks/use-settle-action.d.cts +3 -0
- package/dist/hooks/use-settle-action.d.ts +3 -0
- package/dist/hooks/use-settle-action.js +11 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +152 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.js +92 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.js +8 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/hi2/index.js +8 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.js +128 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconBase.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconBase.js +109 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconContext.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lib/iconContext.js +13 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs +1 -0
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js +68 -0
- package/dist/providers/attachment-item-provider.cjs +1 -0
- package/dist/providers/attachment-item-provider.d.cts +9 -0
- package/dist/providers/attachment-item-provider.d.ts +9 -0
- package/dist/providers/attachment-item-provider.js +13 -0
- package/dist/providers/attachments-bar-provider.cjs +1 -0
- package/dist/providers/attachments-bar-provider.d.cts +30 -0
- package/dist/providers/attachments-bar-provider.d.ts +30 -0
- package/dist/providers/attachments-bar-provider.js +64 -0
- package/dist/providers/base-events-provider.cjs +1 -0
- package/dist/providers/base-events-provider.d.cts +8 -0
- package/dist/providers/base-events-provider.d.ts +8 -0
- package/dist/providers/base-events-provider.js +39 -0
- package/dist/providers/chat-events-provider.cjs +1 -0
- package/dist/providers/chat-events-provider.d.cts +12 -0
- package/dist/providers/chat-events-provider.d.ts +12 -0
- package/dist/providers/chat-events-provider.js +66 -0
- package/dist/providers/chat-form-provider.cjs +1 -0
- package/dist/providers/chat-form-provider.d.cts +23 -0
- package/dist/providers/chat-form-provider.d.ts +23 -0
- package/dist/providers/chat-form-provider.js +66 -0
- package/dist/providers/config-provider.cjs +1 -0
- package/dist/providers/config-provider.d.cts +24 -0
- package/dist/providers/config-provider.d.ts +24 -0
- package/dist/providers/config-provider.js +37 -0
- package/dist/providers/conversation-provider.cjs +1 -0
- package/dist/providers/conversation-provider.d.cts +12 -0
- package/dist/providers/conversation-provider.d.ts +12 -0
- package/dist/providers/conversation-provider.js +49 -0
- package/dist/providers/feedback-item-provider.cjs +1 -0
- package/dist/providers/feedback-item-provider.d.cts +10 -0
- package/dist/providers/feedback-item-provider.d.ts +10 -0
- package/dist/providers/feedback-item-provider.js +16 -0
- package/dist/providers/feedback-provider.cjs +1 -0
- package/dist/providers/feedback-provider.d.cts +19 -0
- package/dist/providers/feedback-provider.d.ts +19 -0
- package/dist/providers/feedback-provider.js +82 -0
- package/dist/providers/form-field-provider.cjs +1 -0
- package/dist/providers/form-field-provider.d.cts +15 -0
- package/dist/providers/form-field-provider.d.ts +15 -0
- package/dist/providers/form-field-provider.js +17 -0
- package/dist/providers/help-menu-provider.cjs +1 -0
- package/dist/providers/help-menu-provider.d.cts +11 -0
- package/dist/providers/help-menu-provider.d.ts +11 -0
- package/dist/providers/help-menu-provider.js +19 -0
- package/dist/providers/index.cjs +1 -0
- package/dist/providers/index.d.cts +19 -0
- package/dist/providers/index.d.ts +19 -0
- package/dist/providers/index.js +63 -0
- package/dist/providers/intelligent-form-field-provider.cjs +1 -0
- package/dist/providers/intelligent-form-field-provider.d.cts +15 -0
- package/dist/providers/intelligent-form-field-provider.d.ts +15 -0
- package/dist/providers/intelligent-form-field-provider.js +19 -0
- package/dist/providers/markdown-provider.cjs +1 -0
- package/dist/providers/markdown-provider.d.cts +9 -0
- package/dist/providers/markdown-provider.d.ts +9 -0
- package/dist/providers/markdown-provider.js +8 -0
- package/dist/providers/message-attachments-provider.cjs +1 -0
- package/dist/providers/message-attachments-provider.d.cts +13 -0
- package/dist/providers/message-attachments-provider.d.ts +13 -0
- package/dist/providers/message-attachments-provider.js +27 -0
- package/dist/providers/message-provider.cjs +1 -0
- package/dist/providers/message-provider.d.cts +10 -0
- package/dist/providers/message-provider.d.ts +10 -0
- package/dist/providers/message-provider.js +14 -0
- package/dist/providers/root-provider.cjs +1 -0
- package/dist/providers/root-provider.d.cts +8 -0
- package/dist/providers/root-provider.d.ts +8 -0
- package/dist/providers/root-provider.js +21 -0
- package/dist/providers/search-events-provider.cjs +1 -0
- package/dist/providers/search-events-provider.d.cts +11 -0
- package/dist/providers/search-events-provider.d.ts +11 -0
- package/dist/providers/search-events-provider.js +18 -0
- package/dist/providers/source-item-provider.cjs +1 -0
- package/dist/providers/source-item-provider.d.cts +12 -0
- package/dist/providers/source-item-provider.d.ts +12 -0
- package/dist/providers/source-item-provider.js +13 -0
- package/dist/providers/theme-provider.cjs +1 -0
- package/dist/providers/theme-provider.d.cts +3 -0
- package/dist/providers/theme-provider.d.ts +3 -0
- package/dist/providers/theme-provider.js +65 -0
- package/dist/providers/user-provider.cjs +1 -0
- package/dist/providers/user-provider.d.cts +13 -0
- package/dist/providers/user-provider.d.ts +13 -0
- package/dist/providers/user-provider.js +34 -0
- package/dist/providers/widget-provider.cjs +1 -0
- package/dist/providers/widget-provider.d.cts +9 -0
- package/dist/providers/widget-provider.d.ts +9 -0
- package/dist/providers/widget-provider.js +8 -0
- package/dist/utils/component-ids.cjs +1 -0
- package/dist/utils/component-ids.d.cts +632 -0
- package/dist/utils/component-ids.d.ts +632 -0
- package/dist/utils/component-ids.js +340 -0
- package/dist/utils/compose-event-handlers.cjs +1 -0
- package/dist/utils/compose-event-handlers.d.cts +3 -0
- package/dist/utils/compose-event-handlers.d.ts +3 -0
- package/dist/utils/compose-event-handlers.js +10 -0
- package/dist/utils/compose-refs.cjs +1 -0
- package/dist/utils/compose-refs.d.cts +5 -0
- package/dist/utils/compose-refs.d.ts +5 -0
- package/dist/utils/compose-refs.js +30 -0
- package/dist/utils/default-settings.cjs +1 -0
- package/dist/utils/default-settings.d.cts +244 -0
- package/dist/utils/default-settings.d.ts +244 -0
- package/dist/utils/default-settings.js +75 -0
- package/dist/utils/form.cjs +1 -0
- package/dist/utils/form.d.cts +3 -0
- package/dist/utils/form.d.ts +3 -0
- package/dist/utils/form.js +17 -0
- package/dist/utils/generate-uid.cjs +1 -0
- package/dist/utils/generate-uid.d.cts +2 -0
- package/dist/utils/generate-uid.d.ts +2 -0
- package/dist/utils/generate-uid.js +14 -0
- package/dist/utils/get-message-metadata.cjs +10 -0
- package/dist/utils/get-message-metadata.d.cts +8 -0
- package/dist/utils/get-message-metadata.d.ts +8 -0
- package/dist/utils/get-message-metadata.js +142 -0
- package/dist/utils/graphql-client.cjs +1 -0
- package/dist/utils/graphql-client.d.cts +8 -0
- package/dist/utils/graphql-client.d.ts +8 -0
- package/dist/utils/graphql-client.js +23 -0
- package/dist/utils/highlight-emphasis.cjs +1 -0
- package/dist/utils/highlight-emphasis.d.cts +4 -0
- package/dist/utils/highlight-emphasis.d.ts +4 -0
- package/dist/utils/highlight-emphasis.js +15 -0
- package/dist/utils/merge-props.cjs +1 -0
- package/dist/utils/merge-props.d.cts +7 -0
- package/dist/utils/merge-props.d.ts +7 -0
- package/dist/utils/merge-props.js +41 -0
- package/dist/utils/misc.cjs +1 -0
- package/dist/utils/misc.d.cts +13 -0
- package/dist/utils/misc.d.ts +13 -0
- package/dist/utils/misc.js +36 -0
- package/dist/utils/reset-query-params.cjs +1 -0
- package/dist/utils/reset-query-params.d.cts +1 -0
- package/dist/utils/reset-query-params.d.ts +1 -0
- package/dist/utils/reset-query-params.js +13 -0
- package/dist/utils/tools/links-schema.cjs +1 -0
- package/dist/utils/tools/links-schema.d.cts +64 -0
- package/dist/utils/tools/links-schema.d.ts +64 -0
- package/dist/utils/tools/links-schema.js +85 -0
- package/dist/utils/transform-source/breadcrumbs.cjs +1 -0
- package/dist/utils/transform-source/breadcrumbs.d.cts +2 -0
- package/dist/utils/transform-source/breadcrumbs.d.ts +2 -0
- package/dist/utils/transform-source/breadcrumbs.js +16 -0
- package/dist/utils/transform-source/common-words/long.cjs +1 -0
- package/dist/utils/transform-source/common-words/long.d.cts +1 -0
- package/dist/utils/transform-source/common-words/long.d.ts +1 -0
- package/dist/utils/transform-source/common-words/long.js +69 -0
- package/dist/utils/transform-source/common-words/lowercase.cjs +1 -0
- package/dist/utils/transform-source/common-words/lowercase.d.cts +1 -0
- package/dist/utils/transform-source/common-words/lowercase.d.ts +1 -0
- package/dist/utils/transform-source/common-words/lowercase.js +48 -0
- package/dist/utils/transform-source/common-words/short.cjs +1 -0
- package/dist/utils/transform-source/common-words/short.d.cts +1 -0
- package/dist/utils/transform-source/common-words/short.d.ts +1 -0
- package/dist/utils/transform-source/common-words/short.js +141 -0
- package/dist/utils/transform-source/description.cjs +1 -0
- package/dist/utils/transform-source/description.d.cts +2 -0
- package/dist/utils/transform-source/description.d.ts +2 -0
- package/dist/utils/transform-source/description.js +10 -0
- package/dist/utils/transform-source/icon.cjs +1 -0
- package/dist/utils/transform-source/icon.d.cts +2 -0
- package/dist/utils/transform-source/icon.d.ts +2 -0
- package/dist/utils/transform-source/icon.js +9 -0
- package/dist/utils/transform-source/index.cjs +1 -0
- package/dist/utils/transform-source/index.d.cts +2 -0
- package/dist/utils/transform-source/index.d.ts +2 -0
- package/dist/utils/transform-source/index.js +21 -0
- package/dist/utils/transform-source/tabs.cjs +1 -0
- package/dist/utils/transform-source/tabs.d.cts +2 -0
- package/dist/utils/transform-source/tabs.d.ts +2 -0
- package/dist/utils/transform-source/tabs.js +13 -0
- package/dist/utils/transform-source/title.cjs +1 -0
- package/dist/utils/transform-source/title.d.cts +2 -0
- package/dist/utils/transform-source/title.d.ts +2 -0
- package/dist/utils/transform-source/title.js +12 -0
- package/dist/utils/transform-source/utils/description-without-title.cjs +1 -0
- package/dist/utils/transform-source/utils/description-without-title.d.cts +11 -0
- package/dist/utils/transform-source/utils/description-without-title.d.ts +11 -0
- package/dist/utils/transform-source/utils/description-without-title.js +12 -0
- package/dist/utils/transform-source/utils/index.cjs +1 -0
- package/dist/utils/transform-source/utils/index.d.cts +6 -0
- package/dist/utils/transform-source/utils/index.d.ts +6 -0
- package/dist/utils/transform-source/utils/index.js +16 -0
- package/dist/utils/transform-source/utils/misc.cjs +1 -0
- package/dist/utils/transform-source/utils/misc.d.cts +2 -0
- package/dist/utils/transform-source/utils/misc.d.ts +2 -0
- package/dist/utils/transform-source/utils/misc.js +15 -0
- package/dist/utils/transform-source/utils/standardize-common-words.cjs +1 -0
- package/dist/utils/transform-source/utils/standardize-common-words.d.cts +1 -0
- package/dist/utils/transform-source/utils/standardize-common-words.d.ts +1 -0
- package/dist/utils/transform-source/utils/standardize-common-words.js +26 -0
- package/dist/utils/transform-source/utils/standardize-organization-display-name.cjs +1 -0
- package/dist/utils/transform-source/utils/standardize-organization-display-name.d.cts +8 -0
- package/dist/utils/transform-source/utils/standardize-organization-display-name.d.ts +8 -0
- package/dist/utils/transform-source/utils/standardize-organization-display-name.js +10 -0
- package/dist/utils/transform-source/utils/standardize-suffixes.cjs +1 -0
- package/dist/utils/transform-source/utils/standardize-suffixes.d.cts +5 -0
- package/dist/utils/transform-source/utils/standardize-suffixes.d.ts +5 -0
- package/dist/utils/transform-source/utils/standardize-suffixes.js +16 -0
- package/dist/utils/transform-source/utils/strip-branding-keywords.cjs +1 -0
- package/dist/utils/transform-source/utils/strip-branding-keywords.d.cts +17 -0
- package/dist/utils/transform-source/utils/strip-branding-keywords.d.ts +17 -0
- package/dist/utils/transform-source/utils/strip-branding-keywords.js +14 -0
- package/package.json +111 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as d, useCallback as y, createContext as x, useContext as B } from "react";
|
|
4
|
+
import { logEvent as C } from "../atoms/api/analytics/events.js";
|
|
5
|
+
import { useInkeepConfig as P } from "./config-provider.js";
|
|
6
|
+
import { useUser as b } from "./user-provider.js";
|
|
7
|
+
const m = x(void 0), M = ({ children: e }) => {
|
|
8
|
+
const { baseSettings: t, interactionType: o } = P(), { apiKey: s, analyticsBaseUrl: n, tags: r, analytics: p, env: u } = t, { userProperties: a } = b(), i = d(
|
|
9
|
+
() => ({
|
|
10
|
+
widgetLibraryVersion: "0.4.9",
|
|
11
|
+
interactionType: o,
|
|
12
|
+
tags: r
|
|
13
|
+
}),
|
|
14
|
+
[o, r]
|
|
15
|
+
), c = !p.optOutAllAnalytics && u !== "DEVELOPMENT", E = { logEvent: y(
|
|
16
|
+
async (v) => {
|
|
17
|
+
const g = {
|
|
18
|
+
...i,
|
|
19
|
+
...v.properties
|
|
20
|
+
}, l = {
|
|
21
|
+
eventName: v.eventName,
|
|
22
|
+
properties: g,
|
|
23
|
+
userProperties: a
|
|
24
|
+
};
|
|
25
|
+
c && C(l, s, n), t.logEventCallback?.(l);
|
|
26
|
+
},
|
|
27
|
+
[c, t, s, n, a, i]
|
|
28
|
+
) };
|
|
29
|
+
return /* @__PURE__ */ f(m.Provider, { value: E, children: e });
|
|
30
|
+
}, O = () => {
|
|
31
|
+
const e = B(m);
|
|
32
|
+
if (!e)
|
|
33
|
+
throw new Error("useBaseEvents must be used within a BaseEventsProvider");
|
|
34
|
+
return e;
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
M as BaseEventsProvider,
|
|
38
|
+
O as useBaseEvents
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),s=require("react"),b=require("../atoms/api/analytics/conversation.cjs"),q=require("./config-provider.cjs"),x=require("./conversation-provider.cjs"),y=require("./user-provider.cjs"),g=require("./base-events-provider.cjs"),p=s.createContext(void 0),m=({children:t})=>{const{baseSettings:P}=q.useInkeepConfig(),{apiKey:u,analyticsBaseUrl:v,tags:d}=P,{userProperties:l}=y.useUser(),{logEvent:C}=g.useBaseEvents(),{conversation:i,setConversation:h}=x.useInkeepConversation(),o=s.useRef(i.id);s.useEffect(()=>{o.current=i.id},[i.id]);const f=["chat_message_submitted","chat_message_bot_response_received","intelligent_form_primary_submitted","intelligent_form_qa_response"],a=s.useCallback(async e=>{const n=o.current,r=await b.logConversation(n,{messages:e,tags:d,userProperties:l},u,v);return r&&h(r),r},[v,u,d,l,h]),_={logEvent:s.useCallback(async e=>{let n=o.current;if(f.includes(e.eventName)&&"messages"in e.properties){const E=await a(e.properties.messages);E&&(n=E.id,o.current=n)}const r={...e,properties:{...e.properties,conversationId:n}};C(r)},[C,a]),logConversation:a};return c.jsx(p.Provider,{value:_,children:t})},j=({children:t})=>c.jsx(g.BaseEventsProvider,{children:c.jsx(m,{children:t})}),w=()=>{const t=s.useContext(p);if(!t)throw new Error("useChatEvents must be used within a ChatEventsProvider");return t};exports.ChatEventsProvider=m;exports.ChatEventsProviderWithBase=j;exports.useChatEvents=w;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConversationResponse, InkeepEvent, Message } from '@inkeep/cxkit-types';
|
|
2
|
+
export type ChatEventsContextValue = {
|
|
3
|
+
logEvent: (event: InkeepEvent) => void;
|
|
4
|
+
logConversation: (messages: Message[]) => Promise<ConversationResponse | undefined>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ChatEventsProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ChatEventsProviderWithBase: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useChatEvents: () => ChatEventsContextValue;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConversationResponse, InkeepEvent, Message } from '@inkeep/cxkit-types';
|
|
2
|
+
export type ChatEventsContextValue = {
|
|
3
|
+
logEvent: (event: InkeepEvent) => void;
|
|
4
|
+
logConversation: (messages: Message[]) => Promise<ConversationResponse | undefined>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ChatEventsProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ChatEventsProviderWithBase: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useChatEvents: () => ChatEventsContextValue;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as _, useEffect as b, useCallback as C, createContext as x, useContext as P } from "react";
|
|
4
|
+
import { logConversation as w } from "../atoms/api/analytics/conversation.js";
|
|
5
|
+
import { useInkeepConfig as y } from "./config-provider.js";
|
|
6
|
+
import { useInkeepConversation as I } from "./conversation-provider.js";
|
|
7
|
+
import { useUser as B } from "./user-provider.js";
|
|
8
|
+
import { useBaseEvents as k, BaseEventsProvider as U } from "./base-events-provider.js";
|
|
9
|
+
const f = x(void 0), j = ({ children: t }) => {
|
|
10
|
+
const { baseSettings: h } = y(), { apiKey: c, analyticsBaseUrl: u, tags: v } = h, { userProperties: m } = B(), { logEvent: p } = k(), { conversation: r, setConversation: d } = I(), o = _(r.id);
|
|
11
|
+
b(() => {
|
|
12
|
+
o.current = r.id;
|
|
13
|
+
}, [r.id]);
|
|
14
|
+
const g = [
|
|
15
|
+
"chat_message_submitted",
|
|
16
|
+
"chat_message_bot_response_received",
|
|
17
|
+
"intelligent_form_primary_submitted",
|
|
18
|
+
"intelligent_form_qa_response"
|
|
19
|
+
], i = C(
|
|
20
|
+
async (e) => {
|
|
21
|
+
const s = o.current, n = await w(
|
|
22
|
+
s,
|
|
23
|
+
{
|
|
24
|
+
messages: e,
|
|
25
|
+
tags: v,
|
|
26
|
+
userProperties: m
|
|
27
|
+
},
|
|
28
|
+
c,
|
|
29
|
+
u
|
|
30
|
+
);
|
|
31
|
+
return n && d(n), n;
|
|
32
|
+
},
|
|
33
|
+
[u, c, v, m, d]
|
|
34
|
+
), E = {
|
|
35
|
+
logEvent: C(
|
|
36
|
+
async (e) => {
|
|
37
|
+
let s = o.current;
|
|
38
|
+
if (g.includes(e.eventName) && "messages" in e.properties) {
|
|
39
|
+
const l = await i(e.properties.messages);
|
|
40
|
+
l && (s = l.id, o.current = s);
|
|
41
|
+
}
|
|
42
|
+
const n = {
|
|
43
|
+
...e,
|
|
44
|
+
properties: {
|
|
45
|
+
...e.properties,
|
|
46
|
+
conversationId: s
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
p(n);
|
|
50
|
+
},
|
|
51
|
+
[p, i]
|
|
52
|
+
),
|
|
53
|
+
logConversation: i
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ a(f.Provider, { value: E, children: t });
|
|
56
|
+
}, A = ({ children: t }) => /* @__PURE__ */ a(U, { children: /* @__PURE__ */ a(j, { children: t }) }), D = () => {
|
|
57
|
+
const t = P(f);
|
|
58
|
+
if (!t)
|
|
59
|
+
throw new Error("useChatEvents must be used within a ChatEventsProvider");
|
|
60
|
+
return t;
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
j as ChatEventsProvider,
|
|
64
|
+
A as ChatEventsProviderWithBase,
|
|
65
|
+
D as useChatEvents
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),o=require("react"),M=require("react-hook-form"),O=require("./conversation-provider.cjs"),P=require("../components/modal/modal-provider.cjs"),R=require("../utils/form.cjs"),x="root.serverError",S=o.createContext(void 0);function f(){const[t,n]=o.useState(null),[C,u]=o.useState(!1),{conversation:i}=O.useInkeepConversation(),h=P.useModal(),v=e=>{n(e)},E=()=>{n(null),u(!1),t?.buttons.close?.action==="CLOSE_MODAL"&&h?.closeModal()},c=o.useMemo(()=>t?.fields.map(e=>{const r=e;return"_type"in e&&e._type==="INCLUDE_CHAT_SESSION"&&(r.required=!1,r.inputType="CHECKBOX",i.id||(r.isHidden=!0)),r}),[t?.fields,i.id]),a=c?.find(e=>"_type"in e&&e._type==="INCLUDE_CHAT_SESSION"),s=o.useMemo(()=>R.getFormDefaultValues(c),[c]),{control:F,handleSubmit:b,formState:{errors:m,isSubmitting:p},setError:_,reset:l}=M.useForm({defaultValues:s});o.useEffect(()=>{s&&l(s)},[l,s]);const w=b(async e=>{const r=typeof window>"u"?"":window.location.href,g=i.id&&a&&e[a.name]?i:null;try{await t?.buttons.submit.onSubmit({values:e,conversation:g,client:{currentUrl:r}}),u(!0)}catch(d){_(x,{message:d instanceof Error?d.message:"Something went wrong."})}}),y=m?.root?.serverError;return{form:t,openForm:v,closeForm:E,handleSubmit:w,isSuccess:C,isSubmitting:p,formError:y,fields:c,errors:m,control:F,defaultValues:s}}const I=({children:t})=>{const n=f();return q.jsx(S.Provider,{value:n,children:t})},H=()=>{const t=o.useContext(S);if(!t)throw new Error("useChatForm must be used within a ChatFormProvider");return t};exports.ChatFormProvider=I;exports.useChatForm=H;exports.useChatFormState=f;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormConfig, FormField } from '@inkeep/cxkit-types';
|
|
2
|
+
import { Message, FieldErrors, Control } from 'react-hook-form';
|
|
3
|
+
export type ChatFormContextValue = ReturnType<typeof useChatFormState>;
|
|
4
|
+
export declare function useChatFormState(): {
|
|
5
|
+
form: FormConfig | null;
|
|
6
|
+
openForm: (formConfig: FormConfig) => void;
|
|
7
|
+
closeForm: () => void;
|
|
8
|
+
handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
|
|
9
|
+
isSuccess: boolean;
|
|
10
|
+
isSubmitting: boolean;
|
|
11
|
+
formError: Partial<{
|
|
12
|
+
type: string | number;
|
|
13
|
+
message: Message;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
fields: FormField[] | undefined;
|
|
16
|
+
errors: FieldErrors<Record<string, any>>;
|
|
17
|
+
control: Control<Record<string, any>, any>;
|
|
18
|
+
defaultValues: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
export declare const ChatFormProvider: React.FC<{
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const useChatForm: () => ChatFormContextValue;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormConfig, FormField } from '@inkeep/cxkit-types';
|
|
2
|
+
import { Message, FieldErrors, Control } from 'react-hook-form';
|
|
3
|
+
export type ChatFormContextValue = ReturnType<typeof useChatFormState>;
|
|
4
|
+
export declare function useChatFormState(): {
|
|
5
|
+
form: FormConfig | null;
|
|
6
|
+
openForm: (formConfig: FormConfig) => void;
|
|
7
|
+
closeForm: () => void;
|
|
8
|
+
handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
|
|
9
|
+
isSuccess: boolean;
|
|
10
|
+
isSubmitting: boolean;
|
|
11
|
+
formError: Partial<{
|
|
12
|
+
type: string | number;
|
|
13
|
+
message: Message;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
fields: FormField[] | undefined;
|
|
16
|
+
errors: FieldErrors<Record<string, any>>;
|
|
17
|
+
control: Control<Record<string, any>, any>;
|
|
18
|
+
defaultValues: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
export declare const ChatFormProvider: React.FC<{
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const useChatForm: () => ChatFormContextValue;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
3
|
+
import { useState as f, useMemo as d, useEffect as I, createContext as O, useContext as M } from "react";
|
|
4
|
+
import { useForm as N } from "react-hook-form";
|
|
5
|
+
import { useInkeepConversation as R } from "./conversation-provider.js";
|
|
6
|
+
import { useModal as A } from "../components/modal/modal-provider.js";
|
|
7
|
+
import { getFormDefaultValues as D } from "../utils/form.js";
|
|
8
|
+
const H = "root.serverError", S = O(void 0);
|
|
9
|
+
function L() {
|
|
10
|
+
const [o, n] = f(null), [p, c] = f(!1), { conversation: s } = R(), C = A(), E = (t) => {
|
|
11
|
+
n(t);
|
|
12
|
+
}, h = () => {
|
|
13
|
+
n(null), c(!1), o?.buttons.close?.action === "CLOSE_MODAL" && C?.closeModal();
|
|
14
|
+
}, i = d(() => o?.fields.map((t) => {
|
|
15
|
+
const e = t;
|
|
16
|
+
return "_type" in t && t._type === "INCLUDE_CHAT_SESSION" && (e.required = !1, e.inputType = "CHECKBOX", s.id || (e.isHidden = !0)), e;
|
|
17
|
+
}), [o?.fields, s.id]), a = i?.find((t) => "_type" in t && t._type === "INCLUDE_CHAT_SESSION"), r = d(() => D(i), [i]), {
|
|
18
|
+
control: v,
|
|
19
|
+
handleSubmit: F,
|
|
20
|
+
formState: { errors: u, isSubmitting: b },
|
|
21
|
+
setError: _,
|
|
22
|
+
reset: m
|
|
23
|
+
} = N({
|
|
24
|
+
defaultValues: r
|
|
25
|
+
});
|
|
26
|
+
I(() => {
|
|
27
|
+
r && m(r);
|
|
28
|
+
}, [m, r]);
|
|
29
|
+
const w = F(async (t) => {
|
|
30
|
+
const e = typeof window > "u" ? "" : window.location.href, g = s.id && a && t[a.name] ? s : null;
|
|
31
|
+
try {
|
|
32
|
+
await o?.buttons.submit.onSubmit({ values: t, conversation: g, client: { currentUrl: e } }), c(!0);
|
|
33
|
+
} catch (l) {
|
|
34
|
+
_(H, {
|
|
35
|
+
message: l instanceof Error ? l.message : "Something went wrong."
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}), y = u?.root?.serverError;
|
|
39
|
+
return {
|
|
40
|
+
form: o,
|
|
41
|
+
openForm: E,
|
|
42
|
+
closeForm: h,
|
|
43
|
+
handleSubmit: w,
|
|
44
|
+
isSuccess: p,
|
|
45
|
+
isSubmitting: b,
|
|
46
|
+
formError: y,
|
|
47
|
+
fields: i,
|
|
48
|
+
errors: u,
|
|
49
|
+
control: v,
|
|
50
|
+
defaultValues: r
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const K = ({ children: o }) => {
|
|
54
|
+
const n = L();
|
|
55
|
+
return /* @__PURE__ */ x(S.Provider, { value: n, children: o });
|
|
56
|
+
}, X = () => {
|
|
57
|
+
const o = M(S);
|
|
58
|
+
if (!o)
|
|
59
|
+
throw new Error("useChatForm must be used within a ChatFormProvider");
|
|
60
|
+
return o;
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
K as ChatFormProvider,
|
|
64
|
+
X as useChatForm,
|
|
65
|
+
L as useChatFormState
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),p=require("merge-anything"),o=require("react"),r=require("../utils/default-settings.cjs"),E=require("../atoms/shadow/context.cjs"),a={ChatButton:"CHAT_BUTTON",CustomTrigger:"CUSTOM_TRIGGER",SearchBar:"SEARCH_BAR",EmbeddedChat:"EMBEDDED_CHAT",EmbeddedSearch:"EMBEDDED_SEARCH",EmbeddedSearchAndChat:"EMBEDDED_SEARCH_AND_CHAT",IntelligentForm:"INTELLIGENT_FORM"},c={prefix:"ikp",aiChatSettings:r.defaultInkeepAIChatSettings,baseSettings:r.defaultInkeepBaseSettings,searchSettings:r.defaultInkeepSearchSettings,interactionType:a.EmbeddedChat},g=o.createContext(c),h=({children:t,value:i})=>{const d=E.useShadow(),u=(s,e,n)=>(n==="apiKey"&&!e&&!i?.baseSettings?.baseUrl&&console.warn("Inkeep API key is missing."),n==="tools"&&Array.isArray(e)?(s||[]).concat(e):["baseSettings","searchSettings","aiChatSettings"].includes(n)&&!e?s:e),C={baseSettings:d??{}},S=p.mergeAndCompare(u,c,C,i??{});return f.jsx(g.Provider,{value:S,children:t})},I=()=>{const t=o.useContext(g);if(!t)throw new Error("useInkeepConfig must be used within a ConfigProvider");return t};exports.InkeepConfigProvider=h;exports.WebWidgetInteractionType=a;exports.useInkeepConfig=I;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DefaultInkeepAIChatSettings, DefaultInkeepBaseSettings, DefaultInkeepSearchSettings } from '../utils/default-settings';
|
|
3
|
+
import { InkeepConfig } from '@inkeep/cxkit-types';
|
|
4
|
+
export declare const WebWidgetInteractionType: {
|
|
5
|
+
readonly ChatButton: "CHAT_BUTTON";
|
|
6
|
+
readonly CustomTrigger: "CUSTOM_TRIGGER";
|
|
7
|
+
readonly SearchBar: "SEARCH_BAR";
|
|
8
|
+
readonly EmbeddedChat: "EMBEDDED_CHAT";
|
|
9
|
+
readonly EmbeddedSearch: "EMBEDDED_SEARCH";
|
|
10
|
+
readonly EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT";
|
|
11
|
+
readonly IntelligentForm: "INTELLIGENT_FORM";
|
|
12
|
+
};
|
|
13
|
+
export interface WidgetConfig extends InkeepConfig {
|
|
14
|
+
aiChatSettings: InkeepConfig['aiChatSettings'] & DefaultInkeepAIChatSettings;
|
|
15
|
+
baseSettings: InkeepConfig['baseSettings'] & DefaultInkeepBaseSettings;
|
|
16
|
+
searchSettings: InkeepConfig['searchSettings'] & DefaultInkeepSearchSettings;
|
|
17
|
+
}
|
|
18
|
+
interface InkeepConfigProviderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
value?: Partial<InkeepConfig>;
|
|
21
|
+
}
|
|
22
|
+
export declare const InkeepConfigProvider: ({ children, value }: InkeepConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const useInkeepConfig: () => WidgetConfig;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DefaultInkeepAIChatSettings, DefaultInkeepBaseSettings, DefaultInkeepSearchSettings } from '../utils/default-settings';
|
|
3
|
+
import { InkeepConfig } from '@inkeep/cxkit-types';
|
|
4
|
+
export declare const WebWidgetInteractionType: {
|
|
5
|
+
readonly ChatButton: "CHAT_BUTTON";
|
|
6
|
+
readonly CustomTrigger: "CUSTOM_TRIGGER";
|
|
7
|
+
readonly SearchBar: "SEARCH_BAR";
|
|
8
|
+
readonly EmbeddedChat: "EMBEDDED_CHAT";
|
|
9
|
+
readonly EmbeddedSearch: "EMBEDDED_SEARCH";
|
|
10
|
+
readonly EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT";
|
|
11
|
+
readonly IntelligentForm: "INTELLIGENT_FORM";
|
|
12
|
+
};
|
|
13
|
+
export interface WidgetConfig extends InkeepConfig {
|
|
14
|
+
aiChatSettings: InkeepConfig['aiChatSettings'] & DefaultInkeepAIChatSettings;
|
|
15
|
+
baseSettings: InkeepConfig['baseSettings'] & DefaultInkeepBaseSettings;
|
|
16
|
+
searchSettings: InkeepConfig['searchSettings'] & DefaultInkeepSearchSettings;
|
|
17
|
+
}
|
|
18
|
+
interface InkeepConfigProviderProps {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
value?: Partial<InkeepConfig>;
|
|
21
|
+
}
|
|
22
|
+
export declare const InkeepConfigProvider: ({ children, value }: InkeepConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const useInkeepConfig: () => WidgetConfig;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { mergeAndCompare as C } from "merge-anything";
|
|
4
|
+
import { createContext as g, useContext as p } from "react";
|
|
5
|
+
import { defaultInkeepSearchSettings as f, defaultInkeepBaseSettings as m, defaultInkeepAIChatSettings as E } from "../utils/default-settings.js";
|
|
6
|
+
import { useShadow as S } from "../atoms/shadow/context.js";
|
|
7
|
+
const h = {
|
|
8
|
+
ChatButton: "CHAT_BUTTON",
|
|
9
|
+
CustomTrigger: "CUSTOM_TRIGGER",
|
|
10
|
+
SearchBar: "SEARCH_BAR",
|
|
11
|
+
EmbeddedChat: "EMBEDDED_CHAT",
|
|
12
|
+
EmbeddedSearch: "EMBEDDED_SEARCH",
|
|
13
|
+
EmbeddedSearchAndChat: "EMBEDDED_SEARCH_AND_CHAT",
|
|
14
|
+
IntelligentForm: "INTELLIGENT_FORM"
|
|
15
|
+
}, i = {
|
|
16
|
+
prefix: "ikp",
|
|
17
|
+
// Default prefix
|
|
18
|
+
aiChatSettings: E,
|
|
19
|
+
baseSettings: m,
|
|
20
|
+
searchSettings: f,
|
|
21
|
+
interactionType: h.EmbeddedChat
|
|
22
|
+
}, s = g(i), B = ({ children: t, value: r }) => {
|
|
23
|
+
const a = S(), c = C((o, e, n) => (n === "apiKey" && !e && !r?.baseSettings?.baseUrl && console.warn("Inkeep API key is missing."), n === "tools" && Array.isArray(e) ? (o || []).concat(e) : ["baseSettings", "searchSettings", "aiChatSettings"].includes(n) && !e ? o : e), i, {
|
|
24
|
+
baseSettings: a ?? {}
|
|
25
|
+
}, r ?? {});
|
|
26
|
+
return /* @__PURE__ */ d(s.Provider, { value: c, children: t });
|
|
27
|
+
}, x = () => {
|
|
28
|
+
const t = p(s);
|
|
29
|
+
if (!t)
|
|
30
|
+
throw new Error("useInkeepConfig must be used within a ConfigProvider");
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
B as InkeepConfigProvider,
|
|
35
|
+
h as WebWidgetInteractionType,
|
|
36
|
+
x as useInkeepConfig
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),o=require("react"),h=require("./config-provider.cjs"),C="conversationId",l=o.createContext(null),S=({children:n})=>{const i=w(),{aiChatSettings:c}=h.useInkeepConfig(),t=c.chatId||i,s={id:"",messages:[]},[r,a]=o.useState(s),e=()=>{a(s)},u=o.useMemo(()=>({conversation:r,setConversation:a,chatId:t,resetConversation:e}),[r,t]);return p.jsx(l.Provider,{value:u,children:n})},f=()=>{const n=o.useContext(l);if(!n)throw new Error("useInkeepConversation must be used within an InkeepConversationProvider");return n};function w(){const[n,i]=o.useState(void 0),{aiChatSettings:c}=h.useInkeepConfig(),{shareChatUrlBasePath:t}=c;return o.useEffect(()=>{if(!t||typeof window>"u")return;const s=e=>e.endsWith("/")?e.slice(0,-1):e,r=()=>{const{origin:e,pathname:u,search:m}=window.location,d=new URL(t),I=s(u),P=s(d.pathname);if(e===d.origin&&I===P){const v=new URLSearchParams(m).get(C);v&&i(v)}};r();const a=()=>r();return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t]),n}exports.InkeepConversationProvider=S;exports.SHARE_QUERY_PARAM=C;exports.useInkeepConversation=f;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConversationResponse } from '@inkeep/cxkit-types';
|
|
2
|
+
export declare const SHARE_QUERY_PARAM = "conversationId";
|
|
3
|
+
export interface InkeepConversationContextValue {
|
|
4
|
+
conversation: ConversationResponse;
|
|
5
|
+
setConversation: React.Dispatch<React.SetStateAction<ConversationResponse>>;
|
|
6
|
+
chatId: string | undefined;
|
|
7
|
+
resetConversation: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const InkeepConversationProvider: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useInkeepConversation: () => InkeepConversationContextValue;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConversationResponse } from '@inkeep/cxkit-types';
|
|
2
|
+
export declare const SHARE_QUERY_PARAM = "conversationId";
|
|
3
|
+
export interface InkeepConversationContextValue {
|
|
4
|
+
conversation: ConversationResponse;
|
|
5
|
+
setConversation: React.Dispatch<React.SetStateAction<ConversationResponse>>;
|
|
6
|
+
chatId: string | undefined;
|
|
7
|
+
resetConversation: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const InkeepConversationProvider: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const useInkeepConversation: () => InkeepConversationContextValue;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
3
|
+
import { useState as u, useMemo as f, createContext as w, useContext as P, useEffect as S } from "react";
|
|
4
|
+
import { useInkeepConfig as m } from "./config-provider.js";
|
|
5
|
+
const g = "conversationId", v = w(null), z = ({ children: t }) => {
|
|
6
|
+
const a = x(), { aiChatSettings: i } = m(), n = i.chatId || a, o = {
|
|
7
|
+
id: "",
|
|
8
|
+
messages: []
|
|
9
|
+
}, [s, r] = u(o), e = () => {
|
|
10
|
+
r(o);
|
|
11
|
+
}, c = f(
|
|
12
|
+
() => ({
|
|
13
|
+
conversation: s,
|
|
14
|
+
setConversation: r,
|
|
15
|
+
chatId: n,
|
|
16
|
+
resetConversation: e
|
|
17
|
+
}),
|
|
18
|
+
[s, n]
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ I(v.Provider, { value: c, children: t });
|
|
21
|
+
}, L = () => {
|
|
22
|
+
const t = P(v);
|
|
23
|
+
if (!t)
|
|
24
|
+
throw new Error("useInkeepConversation must be used within an InkeepConversationProvider");
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
function x() {
|
|
28
|
+
const [t, a] = u(void 0), { aiChatSettings: i } = m(), { shareChatUrlBasePath: n } = i;
|
|
29
|
+
return S(() => {
|
|
30
|
+
if (!n || typeof window > "u") return;
|
|
31
|
+
const o = (e) => e.endsWith("/") ? e.slice(0, -1) : e, s = () => {
|
|
32
|
+
const { origin: e, pathname: c, search: C } = window.location, d = new URL(n), l = o(c), p = o(d.pathname);
|
|
33
|
+
if (e === d.origin && l === p) {
|
|
34
|
+
const h = new URLSearchParams(C).get(g);
|
|
35
|
+
h && a(h);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
s();
|
|
39
|
+
const r = () => s();
|
|
40
|
+
return window.addEventListener("popstate", r), () => {
|
|
41
|
+
window.removeEventListener("popstate", r);
|
|
42
|
+
};
|
|
43
|
+
}, [n]), t;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
z as InkeepConversationProvider,
|
|
47
|
+
g as SHARE_QUERY_PARAM,
|
|
48
|
+
L as useInkeepConversation
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),t=require("react"),r=t.createContext(void 0),s=({children:e,name:o})=>{const c=t.useRef(null);return n.jsx(r.Provider,{value:{name:o,focusItem:c},children:e})},u=()=>{const e=t.useContext(r);if(!e)throw new Error("useFeedbackItem must be used within a FeedbackItemProvider");return e};exports.FeedbackItemProvider=s;exports.useFeedbackItem=u;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FeedbackItemType } from '@inkeep/cxkit-types';
|
|
2
|
+
export type FeedbackItemContextValue = {
|
|
3
|
+
name: FeedbackItemType;
|
|
4
|
+
focusItem: React.RefObject<HTMLElement | null>;
|
|
5
|
+
};
|
|
6
|
+
export declare const FeedbackItemProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
name: FeedbackItemType;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const useFeedbackItem: () => FeedbackItemContextValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FeedbackItemType } from '@inkeep/cxkit-types';
|
|
2
|
+
export type FeedbackItemContextValue = {
|
|
3
|
+
name: FeedbackItemType;
|
|
4
|
+
focusItem: React.RefObject<HTMLElement | null>;
|
|
5
|
+
};
|
|
6
|
+
export declare const FeedbackItemProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
name: FeedbackItemType;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const useFeedbackItem: () => FeedbackItemContextValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as c, createContext as s, useContext as u } from "react";
|
|
4
|
+
const t = s(void 0), i = ({ children: e, name: o }) => {
|
|
5
|
+
const r = c(null);
|
|
6
|
+
return /* @__PURE__ */ n(t.Provider, { value: { name: o, focusItem: r }, children: e });
|
|
7
|
+
}, a = () => {
|
|
8
|
+
const e = u(t);
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("useFeedbackItem must be used within a FeedbackItemProvider");
|
|
11
|
+
return e;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as FeedbackItemProvider,
|
|
15
|
+
a as useFeedbackItem
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),n=require("react"),x=require("../atoms/api/analytics/feedback.cjs"),M=require("../components/embedded-chat/chat-provider.cjs"),l=require("../utils/misc.cjs"),S=require("./config-provider.cjs"),E=require("./conversation-provider.cjs"),j=require("./chat-events-provider.cjs"),I=require("./user-provider.cjs"),f=n.createContext(void 0);function R(){const{baseSettings:e}=S.useInkeepConfig(),{apiKey:s,analyticsBaseUrl:o}=e,[b,g]=n.useState(null),[F,h]=n.useState({}),{conversation:k}=E.useInkeepConversation(),{messages:c,selectedWorkflow:m}=M.useChat(),{userProperties:p}=I.useUser(),{logEvent:C}=j.useChatEvents(),r=n.useCallback(async(t,a,i=[])=>{const u=await x.submitFeedback({type:a,messageId:t,reasons:i,apiKey:s,apiUrl:o,userProperties:p});u&&h(d=>({...d,[t]:{type:u.type,reasons:u.reasons}}));const v=c.findIndex(d=>d.id===t),w=c[v],y={conversationId:k.id,question:l.getMessageContent(c[v-1]),answer:l.getMessageContent(w),messageId:t,reasons:i,workflowId:m?.id};C({eventName:a==="positive"?"chat_thumbs_up_feedback_submitted":"chat_thumbs_down_feedback_submitted",properties:y})},[c,k]),P=n.useCallback(async t=>{r(t,"positive")},[r]),q=n.useCallback(async(t,a)=>{const i=$(a);r(t,"negative",i)},[r]);return{feedback:F,currentFeedback:b,setCurrentFeedback:g,submitPositiveFeedback:P,submitNegativeFeedback:q}}const U=({children:e})=>{const s=R();return _.jsx(f.Provider,{value:s,children:e})},N=()=>{const e=n.useContext(f);if(!e)throw new Error("useFeedback must be used within a FeedbackProvider");return e};function $(e){const s=[];for(const o in e)e[o]==="on"&&s.push({label:o,details:e[`${o}:description`]||""});return s.length>0?s:[]}exports.FeedbackProvider=U;exports.useMessageFeedback=N;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FeebackReason, FeedbackType } from '@inkeep/cxkit-types';
|
|
2
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
export type FeedbackContextValue = ReturnType<typeof useFeedback>;
|
|
4
|
+
export type MessageFeedbackItem = Record<string, {
|
|
5
|
+
type: FeedbackType;
|
|
6
|
+
reasons: FeebackReason[] | null;
|
|
7
|
+
}>;
|
|
8
|
+
declare function useFeedback(): {
|
|
9
|
+
feedback: MessageFeedbackItem;
|
|
10
|
+
currentFeedback: string | null;
|
|
11
|
+
setCurrentFeedback: Dispatch<SetStateAction<string | null>>;
|
|
12
|
+
submitPositiveFeedback: (messageId: string) => Promise<void>;
|
|
13
|
+
submitNegativeFeedback: (messageId: string, reasonsData: Record<string, FormDataEntryValue>) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export declare const FeedbackProvider: React.FC<{
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const useMessageFeedback: () => FeedbackContextValue;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FeebackReason, FeedbackType } from '@inkeep/cxkit-types';
|
|
2
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
export type FeedbackContextValue = ReturnType<typeof useFeedback>;
|
|
4
|
+
export type MessageFeedbackItem = Record<string, {
|
|
5
|
+
type: FeedbackType;
|
|
6
|
+
reasons: FeebackReason[] | null;
|
|
7
|
+
}>;
|
|
8
|
+
declare function useFeedback(): {
|
|
9
|
+
feedback: MessageFeedbackItem;
|
|
10
|
+
currentFeedback: string | null;
|
|
11
|
+
setCurrentFeedback: Dispatch<SetStateAction<string | null>>;
|
|
12
|
+
submitPositiveFeedback: (messageId: string) => Promise<void>;
|
|
13
|
+
submitNegativeFeedback: (messageId: string, reasonsData: Record<string, FormDataEntryValue>) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export declare const FeedbackProvider: React.FC<{
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const useMessageFeedback: () => FeedbackContextValue;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as I, useContext as U, useState as f, useCallback as u } from "react";
|
|
4
|
+
import { submitFeedback as M } from "../atoms/api/analytics/feedback.js";
|
|
5
|
+
import { useChat as N } from "../components/embedded-chat/chat-provider.js";
|
|
6
|
+
import { getMessageContent as p } from "../utils/misc.js";
|
|
7
|
+
import { useInkeepConfig as S } from "./config-provider.js";
|
|
8
|
+
import { useInkeepConversation as j } from "./conversation-provider.js";
|
|
9
|
+
import { useChatEvents as q } from "./chat-events-provider.js";
|
|
10
|
+
import { useUser as B } from "./user-provider.js";
|
|
11
|
+
const l = I(void 0);
|
|
12
|
+
function K() {
|
|
13
|
+
const { baseSettings: e } = S(), { apiKey: s, analyticsBaseUrl: o } = e, [b, v] = f(null), [F, h] = f({}), { conversation: m } = j(), { messages: n, selectedWorkflow: g } = N(), { userProperties: C } = B(), { logEvent: w } = q(), r = u(
|
|
14
|
+
async (t, c, i = []) => {
|
|
15
|
+
const a = await M({
|
|
16
|
+
type: c,
|
|
17
|
+
messageId: t,
|
|
18
|
+
reasons: i,
|
|
19
|
+
apiKey: s,
|
|
20
|
+
apiUrl: o,
|
|
21
|
+
userProperties: C
|
|
22
|
+
});
|
|
23
|
+
a && h((d) => ({
|
|
24
|
+
...d,
|
|
25
|
+
[t]: { type: a.type, reasons: a.reasons }
|
|
26
|
+
}));
|
|
27
|
+
const k = n.findIndex((d) => d.id === t), y = n[k], P = {
|
|
28
|
+
conversationId: m.id,
|
|
29
|
+
question: p(n[k - 1]),
|
|
30
|
+
answer: p(y),
|
|
31
|
+
messageId: t,
|
|
32
|
+
reasons: i,
|
|
33
|
+
workflowId: g?.id
|
|
34
|
+
};
|
|
35
|
+
w({
|
|
36
|
+
eventName: c === "positive" ? "chat_thumbs_up_feedback_submitted" : "chat_thumbs_down_feedback_submitted",
|
|
37
|
+
properties: P
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
[n, m]
|
|
41
|
+
), _ = u(
|
|
42
|
+
async (t) => {
|
|
43
|
+
r(t, "positive");
|
|
44
|
+
},
|
|
45
|
+
[r]
|
|
46
|
+
), x = u(
|
|
47
|
+
async (t, c) => {
|
|
48
|
+
const i = R(c);
|
|
49
|
+
r(t, "negative", i);
|
|
50
|
+
},
|
|
51
|
+
[r]
|
|
52
|
+
);
|
|
53
|
+
return {
|
|
54
|
+
feedback: F,
|
|
55
|
+
currentFeedback: b,
|
|
56
|
+
setCurrentFeedback: v,
|
|
57
|
+
submitPositiveFeedback: _,
|
|
58
|
+
submitNegativeFeedback: x
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const O = ({ children: e }) => {
|
|
62
|
+
const s = K();
|
|
63
|
+
return /* @__PURE__ */ E(l.Provider, { value: s, children: e });
|
|
64
|
+
}, Q = () => {
|
|
65
|
+
const e = U(l);
|
|
66
|
+
if (!e)
|
|
67
|
+
throw new Error("useFeedback must be used within a FeedbackProvider");
|
|
68
|
+
return e;
|
|
69
|
+
};
|
|
70
|
+
function R(e) {
|
|
71
|
+
const s = [];
|
|
72
|
+
for (const o in e)
|
|
73
|
+
e[o] === "on" && s.push({
|
|
74
|
+
label: o,
|
|
75
|
+
details: e[`${o}:description`] || ""
|
|
76
|
+
});
|
|
77
|
+
return s.length > 0 ? s : [];
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
O as FeedbackProvider,
|
|
81
|
+
Q as useMessageFeedback
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),o=require("react"),F=require("./chat-form-provider.cjs"),t=o.createContext(void 0),d=({children:e,field:r,fieldProps:i,autoFocus:n})=>{const{errors:s}=F.useChatForm(),u=s[r.name];return c.jsx(t.Provider,{value:{field:r,fieldProps:i,error:u,autoFocus:n},children:e})},m=()=>{const e=o.useContext(t);if(!e)throw new Error("useFormField must be used within a FormFieldProvider");return e};exports.FormFieldProvider=d;exports.useFormField=m;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormField } from '@inkeep/cxkit-types';
|
|
2
|
+
import { ControllerRenderProps, FieldErrors } from 'react-hook-form';
|
|
3
|
+
interface FormFieldCtx {
|
|
4
|
+
field: FormField;
|
|
5
|
+
fieldProps: ControllerRenderProps<Record<string, any>, string>;
|
|
6
|
+
autoFocus?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface FormFieldContextValue extends FormFieldCtx {
|
|
9
|
+
error: FieldErrors<Record<string, any>>[number];
|
|
10
|
+
}
|
|
11
|
+
export declare const FormFieldProvider: React.FC<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
} & FormFieldCtx>;
|
|
14
|
+
export declare const useFormField: () => FormFieldContextValue;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormField } from '@inkeep/cxkit-types';
|
|
2
|
+
import { ControllerRenderProps, FieldErrors } from 'react-hook-form';
|
|
3
|
+
interface FormFieldCtx {
|
|
4
|
+
field: FormField;
|
|
5
|
+
fieldProps: ControllerRenderProps<Record<string, any>, string>;
|
|
6
|
+
autoFocus?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface FormFieldContextValue extends FormFieldCtx {
|
|
9
|
+
error: FieldErrors<Record<string, any>>[number];
|
|
10
|
+
}
|
|
11
|
+
export declare const FormFieldProvider: React.FC<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
} & FormFieldCtx>;
|
|
14
|
+
export declare const useFormField: () => FormFieldContextValue;
|
|
15
|
+
export {};
|