@qafka/react-native 2.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/CHANGELOG.md +12 -0
- package/CONTRIBUTING.md +92 -0
- package/LICENSE +22 -0
- package/README.md +109 -0
- package/SECURITY.md +67 -0
- package/android/build.gradle +35 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/qafka/attestation/QafkaAttestationModule.kt +92 -0
- package/android/src/main/java/com/qafka/attestation/QafkaAttestationPackage.kt +22 -0
- package/android/src/main/java/com/qafka/audio/QafkaAudioModule.kt +290 -0
- package/android/src/main/java/com/qafka/clipboard/QafkaClipboardModule.kt +28 -0
- package/android/src/main/java/com/qafka/storage/QafkaStorageModule.kt +80 -0
- package/app.plugin.js +1 -0
- package/dist/QafkaSDK.d.ts +174 -0
- package/dist/QafkaSDK.js +461 -0
- package/dist/cards/bindings/resolveFieldName.d.ts +25 -0
- package/dist/cards/bindings/resolveFieldName.js +82 -0
- package/dist/cards/cta/CardContext.d.ts +16 -0
- package/dist/cards/cta/CardContext.js +58 -0
- package/dist/cards/cta/dispatcher.d.ts +7 -0
- package/dist/cards/cta/dispatcher.js +90 -0
- package/dist/cards/cta/types.d.ts +66 -0
- package/dist/cards/cta/types.js +2 -0
- package/dist/cards/index.d.ts +20 -0
- package/dist/cards/index.js +34 -0
- package/dist/cards/primitives/QButton.d.ts +10 -0
- package/dist/cards/primitives/QButton.js +115 -0
- package/dist/cards/primitives/QDivider.d.ts +7 -0
- package/dist/cards/primitives/QDivider.js +17 -0
- package/dist/cards/primitives/QIcon.d.ts +13 -0
- package/dist/cards/primitives/QIcon.js +26 -0
- package/dist/cards/primitives/QImage.d.ts +9 -0
- package/dist/cards/primitives/QImage.js +22 -0
- package/dist/cards/primitives/QText.d.ts +9 -0
- package/dist/cards/primitives/QText.js +30 -0
- package/dist/cards/primitives/QView.d.ts +8 -0
- package/dist/cards/primitives/QView.js +19 -0
- package/dist/cards/renderer/CardRenderer.d.ts +19 -0
- package/dist/cards/renderer/CardRenderer.js +64 -0
- package/dist/cards/renderer/renderNode.d.ts +13 -0
- package/dist/cards/renderer/renderNode.js +42 -0
- package/dist/cards/types.d.ts +110 -0
- package/dist/cards/types.js +6 -0
- package/dist/components/ActionResultBadge.d.ts +12 -0
- package/dist/components/ActionResultBadge.js +58 -0
- package/dist/components/ChatPage.d.ts +44 -0
- package/dist/components/ChatPage.js +84 -0
- package/dist/components/DataChip.d.ts +8 -0
- package/dist/components/DataChip.js +80 -0
- package/dist/components/DataChipList.d.ts +13 -0
- package/dist/components/DataChipList.js +21 -0
- package/dist/components/FloatingButton.d.ts +11 -0
- package/dist/components/FloatingButton.js +162 -0
- package/dist/components/InputArea.d.ts +57 -0
- package/dist/components/InputArea.js +142 -0
- package/dist/components/MarkdownText.d.ts +15 -0
- package/dist/components/MarkdownText.js +283 -0
- package/dist/components/MessageBubble.d.ts +134 -0
- package/dist/components/MessageBubble.js +384 -0
- package/dist/components/NavigationSuggestion.d.ts +11 -0
- package/dist/components/NavigationSuggestion.js +109 -0
- package/dist/components/Qafka.d.ts +39 -0
- package/dist/components/Qafka.handlers.d.ts +21 -0
- package/dist/components/Qafka.handlers.js +54 -0
- package/dist/components/Qafka.js +493 -0
- package/dist/components/Qafka.styles.d.ts +19 -0
- package/dist/components/Qafka.styles.js +101 -0
- package/dist/components/Qafka.types.d.ts +744 -0
- package/dist/components/Qafka.types.js +2 -0
- package/dist/components/Qafka.utils.d.ts +7 -0
- package/dist/components/Qafka.utils.js +34 -0
- package/dist/components/QafkaProvider.d.ts +12 -0
- package/dist/components/QafkaProvider.js +87 -0
- package/dist/components/QuickReplies.d.ts +14 -0
- package/dist/components/QuickReplies.js +48 -0
- package/dist/components/StepProgressIndicator.d.ts +12 -0
- package/dist/components/StepProgressIndicator.js +48 -0
- package/dist/components/SuggestionButton.d.ts +42 -0
- package/dist/components/SuggestionButton.js +67 -0
- package/dist/components/ToolStatusPill.d.ts +20 -0
- package/dist/components/ToolStatusPill.js +43 -0
- package/dist/components/TypingIndicator.d.ts +28 -0
- package/dist/components/TypingIndicator.js +109 -0
- package/dist/components/VoicePage.d.ts +48 -0
- package/dist/components/VoicePage.js +683 -0
- package/dist/components/defaults/DefaultCard.d.ts +14 -0
- package/dist/components/defaults/DefaultCard.js +156 -0
- package/dist/components/defaults/DefaultDetail.d.ts +14 -0
- package/dist/components/defaults/DefaultDetail.js +138 -0
- package/dist/components/defaults/DefaultList.d.ts +12 -0
- package/dist/components/defaults/DefaultList.js +98 -0
- package/dist/components/defaults/DefaultTable.d.ts +14 -0
- package/dist/components/defaults/DefaultTable.js +204 -0
- package/dist/components/defaults/index.d.ts +14 -0
- package/dist/components/defaults/index.js +25 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +36 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +13 -0
- package/dist/hooks/useChatMessages.d.ts +72 -0
- package/dist/hooks/useChatMessages.js +505 -0
- package/dist/hooks/useContextManager.d.ts +12 -0
- package/dist/hooks/useContextManager.js +46 -0
- package/dist/hooks/useProjectTheme.d.ts +19 -0
- package/dist/hooks/useProjectTheme.js +163 -0
- package/dist/hooks/useSDK.d.ts +31 -0
- package/dist/hooks/useSDK.js +103 -0
- package/dist/hooks/useVoiceChat.d.ts +110 -0
- package/dist/hooks/useVoiceChat.js +436 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +59 -0
- package/dist/native/QafkaAttestation.d.ts +23 -0
- package/dist/native/QafkaAttestation.js +70 -0
- package/dist/native/QafkaAudio.d.ts +14 -0
- package/dist/native/QafkaAudio.js +31 -0
- package/dist/native/QafkaClipboard.d.ts +11 -0
- package/dist/native/QafkaClipboard.js +14 -0
- package/dist/native/QafkaStorage.d.ts +15 -0
- package/dist/native/QafkaStorage.js +12 -0
- package/dist/resolve-project-config.d.ts +35 -0
- package/dist/resolve-project-config.js +41 -0
- package/dist/runtime-config-loader.d.ts +37 -0
- package/dist/runtime-config-loader.js +53 -0
- package/dist/services/AttestationManager.d.ts +38 -0
- package/dist/services/AttestationManager.js +296 -0
- package/dist/services/BackendService.d.ts +156 -0
- package/dist/services/BackendService.js +755 -0
- package/dist/services/ConversationManager.d.ts +43 -0
- package/dist/services/ConversationManager.js +96 -0
- package/dist/services/NavigationHandler.d.ts +29 -0
- package/dist/services/NavigationHandler.js +70 -0
- package/dist/services/RealtimeService.d.ts +83 -0
- package/dist/services/RealtimeService.js +203 -0
- package/dist/services/storage.d.ts +11 -0
- package/dist/services/storage.js +15 -0
- package/dist/services/storageCore.d.ts +17 -0
- package/dist/services/storageCore.js +46 -0
- package/dist/themes/dark.d.ts +5 -0
- package/dist/themes/dark.js +129 -0
- package/dist/themes/index.d.ts +12 -0
- package/dist/themes/index.js +33 -0
- package/dist/themes/light.d.ts +5 -0
- package/dist/themes/light.js +129 -0
- package/dist/themes/types.d.ts +155 -0
- package/dist/themes/types.js +5 -0
- package/dist/types/chat.d.ts +126 -0
- package/dist/types/chat.js +5 -0
- package/dist/types/components.d.ts +56 -0
- package/dist/types/components.js +16 -0
- package/dist/types/external-navigation.d.ts +19 -0
- package/dist/types/external-navigation.js +8 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +25 -0
- package/dist/types/navigation.d.ts +86 -0
- package/dist/types/navigation.js +5 -0
- package/dist/types/sdk.d.ts +36 -0
- package/dist/types/sdk.js +5 -0
- package/dist/utils/deepMerge.d.ts +46 -0
- package/dist/utils/deepMerge.js +70 -0
- package/dist/utils/fontUtils.d.ts +8 -0
- package/dist/utils/fontUtils.js +16 -0
- package/dist/validate-end-user.d.ts +18 -0
- package/dist/validate-end-user.js +74 -0
- package/expo-plugin/withQafkaAttestation.js +57 -0
- package/ios/QafkaAttestation.m +25 -0
- package/ios/QafkaAttestation.swift +128 -0
- package/ios/QafkaAudio.m +23 -0
- package/ios/QafkaAudio.swift +519 -0
- package/ios/QafkaClipboard.m +10 -0
- package/ios/QafkaClipboard.swift +21 -0
- package/ios/QafkaReactImports.h +2 -0
- package/ios/QafkaStorage.m +26 -0
- package/ios/QafkaStorage.swift +118 -0
- package/package.json +82 -0
- package/qafka.config.d.ts +9 -0
- package/qafka.config.js +9 -0
- package/react-native-qafka.podspec +28 -0
- package/react-native.config.js +14 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Default Components
|
|
4
|
+
* Export all default components for Tool Registry
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.defaultComponentRegistry = exports.DefaultTable = exports.DefaultDetail = exports.DefaultList = exports.DefaultCard = void 0;
|
|
8
|
+
var DefaultCard_1 = require("./DefaultCard");
|
|
9
|
+
Object.defineProperty(exports, "DefaultCard", { enumerable: true, get: function () { return DefaultCard_1.DefaultCard; } });
|
|
10
|
+
var DefaultList_1 = require("./DefaultList");
|
|
11
|
+
Object.defineProperty(exports, "DefaultList", { enumerable: true, get: function () { return DefaultList_1.DefaultList; } });
|
|
12
|
+
var DefaultDetail_1 = require("./DefaultDetail");
|
|
13
|
+
Object.defineProperty(exports, "DefaultDetail", { enumerable: true, get: function () { return DefaultDetail_1.DefaultDetail; } });
|
|
14
|
+
var DefaultTable_1 = require("./DefaultTable");
|
|
15
|
+
Object.defineProperty(exports, "DefaultTable", { enumerable: true, get: function () { return DefaultTable_1.DefaultTable; } });
|
|
16
|
+
const DefaultCard_2 = require("./DefaultCard");
|
|
17
|
+
const DefaultList_2 = require("./DefaultList");
|
|
18
|
+
const DefaultDetail_2 = require("./DefaultDetail");
|
|
19
|
+
const DefaultTable_2 = require("./DefaultTable");
|
|
20
|
+
exports.defaultComponentRegistry = {
|
|
21
|
+
DefaultCard: DefaultCard_2.DefaultCard,
|
|
22
|
+
DefaultList: DefaultList_2.DefaultList,
|
|
23
|
+
DefaultDetail: DefaultDetail_2.DefaultDetail,
|
|
24
|
+
DefaultTable: DefaultTable_2.DefaultTable,
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI components for the Qafka SDK.
|
|
3
|
+
*/
|
|
4
|
+
export { QafkaProvider } from './QafkaProvider';
|
|
5
|
+
export { Qafka } from './Qafka';
|
|
6
|
+
export type { VoiceComponents, VoiceIndicatorProps, VoiceBackgroundProps, VoiceTranscriptProps, VoiceMuteButtonProps, QafkaHandle } from './Qafka.types';
|
|
7
|
+
export type { ToolResponseMode } from './Qafka.types';
|
|
8
|
+
export type { QafkaProps, QafkaProjectIds, ProjectIdOf } from './Qafka.types';
|
|
9
|
+
export { MessageBubble } from './MessageBubble';
|
|
10
|
+
export { InputArea } from './InputArea';
|
|
11
|
+
export { TypingIndicator } from './TypingIndicator';
|
|
12
|
+
export { FloatingButton } from './FloatingButton';
|
|
13
|
+
export { QuickReplies } from './QuickReplies';
|
|
14
|
+
export { NavigationSuggestionCard } from './NavigationSuggestion';
|
|
15
|
+
export { MarkdownText } from './MarkdownText';
|
|
16
|
+
export { ActionResultBadge } from './ActionResultBadge';
|
|
17
|
+
export { StepProgressIndicator } from './StepProgressIndicator';
|
|
18
|
+
export { SuggestionButton } from './SuggestionButton';
|
|
19
|
+
export type { AnySuggestion, SuggestionButtonProps } from './SuggestionButton';
|
|
20
|
+
export { ToolStatusPill } from './ToolStatusPill';
|
|
21
|
+
export type { ToolStatusPillProps } from './ToolStatusPill';
|
|
22
|
+
export { handleExternalSuggestionDefault } from './Qafka.handlers';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* UI components for the Qafka SDK.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handleExternalSuggestionDefault = exports.ToolStatusPill = exports.SuggestionButton = exports.StepProgressIndicator = exports.ActionResultBadge = exports.MarkdownText = exports.NavigationSuggestionCard = exports.QuickReplies = exports.FloatingButton = exports.TypingIndicator = exports.InputArea = exports.MessageBubble = exports.Qafka = exports.QafkaProvider = void 0;
|
|
7
|
+
// Main Components
|
|
8
|
+
var QafkaProvider_1 = require("./QafkaProvider");
|
|
9
|
+
Object.defineProperty(exports, "QafkaProvider", { enumerable: true, get: function () { return QafkaProvider_1.QafkaProvider; } });
|
|
10
|
+
var Qafka_1 = require("./Qafka");
|
|
11
|
+
Object.defineProperty(exports, "Qafka", { enumerable: true, get: function () { return Qafka_1.Qafka; } });
|
|
12
|
+
// UI Components
|
|
13
|
+
var MessageBubble_1 = require("./MessageBubble");
|
|
14
|
+
Object.defineProperty(exports, "MessageBubble", { enumerable: true, get: function () { return MessageBubble_1.MessageBubble; } });
|
|
15
|
+
var InputArea_1 = require("./InputArea");
|
|
16
|
+
Object.defineProperty(exports, "InputArea", { enumerable: true, get: function () { return InputArea_1.InputArea; } });
|
|
17
|
+
var TypingIndicator_1 = require("./TypingIndicator");
|
|
18
|
+
Object.defineProperty(exports, "TypingIndicator", { enumerable: true, get: function () { return TypingIndicator_1.TypingIndicator; } });
|
|
19
|
+
var FloatingButton_1 = require("./FloatingButton");
|
|
20
|
+
Object.defineProperty(exports, "FloatingButton", { enumerable: true, get: function () { return FloatingButton_1.FloatingButton; } });
|
|
21
|
+
var QuickReplies_1 = require("./QuickReplies");
|
|
22
|
+
Object.defineProperty(exports, "QuickReplies", { enumerable: true, get: function () { return QuickReplies_1.QuickReplies; } });
|
|
23
|
+
var NavigationSuggestion_1 = require("./NavigationSuggestion");
|
|
24
|
+
Object.defineProperty(exports, "NavigationSuggestionCard", { enumerable: true, get: function () { return NavigationSuggestion_1.NavigationSuggestionCard; } });
|
|
25
|
+
var MarkdownText_1 = require("./MarkdownText");
|
|
26
|
+
Object.defineProperty(exports, "MarkdownText", { enumerable: true, get: function () { return MarkdownText_1.MarkdownText; } });
|
|
27
|
+
var ActionResultBadge_1 = require("./ActionResultBadge");
|
|
28
|
+
Object.defineProperty(exports, "ActionResultBadge", { enumerable: true, get: function () { return ActionResultBadge_1.ActionResultBadge; } });
|
|
29
|
+
var StepProgressIndicator_1 = require("./StepProgressIndicator");
|
|
30
|
+
Object.defineProperty(exports, "StepProgressIndicator", { enumerable: true, get: function () { return StepProgressIndicator_1.StepProgressIndicator; } });
|
|
31
|
+
var SuggestionButton_1 = require("./SuggestionButton");
|
|
32
|
+
Object.defineProperty(exports, "SuggestionButton", { enumerable: true, get: function () { return SuggestionButton_1.SuggestionButton; } });
|
|
33
|
+
var ToolStatusPill_1 = require("./ToolStatusPill");
|
|
34
|
+
Object.defineProperty(exports, "ToolStatusPill", { enumerable: true, get: function () { return ToolStatusPill_1.ToolStatusPill; } });
|
|
35
|
+
var Qafka_handlers_1 = require("./Qafka.handlers");
|
|
36
|
+
Object.defineProperty(exports, "handleExternalSuggestionDefault", { enumerable: true, get: function () { return Qafka_handlers_1.handleExternalSuggestionDefault; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for SDK
|
|
3
|
+
*/
|
|
4
|
+
export declare const API_VERSION = "v1";
|
|
5
|
+
export declare const DEFAULT_API_TIMEOUT = 30000;
|
|
6
|
+
export declare const STORAGE_KEYS: {
|
|
7
|
+
readonly CONFIG: "@qafka/config";
|
|
8
|
+
readonly CONVERSATION_HISTORY: "@qafka/conversation_history";
|
|
9
|
+
readonly MESSAGE_QUEUE: "@qafka/message_queue";
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared constants for SDK
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.STORAGE_KEYS = exports.DEFAULT_API_TIMEOUT = exports.API_VERSION = void 0;
|
|
7
|
+
exports.API_VERSION = 'v1';
|
|
8
|
+
exports.DEFAULT_API_TIMEOUT = 30000;
|
|
9
|
+
exports.STORAGE_KEYS = {
|
|
10
|
+
CONFIG: '@qafka/config',
|
|
11
|
+
CONVERSATION_HISTORY: '@qafka/conversation_history',
|
|
12
|
+
MESSAGE_QUEUE: '@qafka/message_queue',
|
|
13
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FlatList } from 'react-native';
|
|
2
|
+
import { ChatMessage } from '../types/chat';
|
|
3
|
+
import type { ToolResponseMode } from '../components/Qafka.types';
|
|
4
|
+
export interface UseChatMessagesOptions {
|
|
5
|
+
enableStreaming?: boolean;
|
|
6
|
+
context?: Record<string, any>;
|
|
7
|
+
contextDescription?: string;
|
|
8
|
+
onMessageSent?: (message: string) => void;
|
|
9
|
+
onResponseReceived?: (response: any) => void;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
onNavigationSuggest?: (suggestion: any) => void;
|
|
12
|
+
onToolSuggested?: (tools: any[], addResponse: (data: any, tool: any, mode?: ToolResponseMode) => void) => void | Promise<void>;
|
|
13
|
+
onActionResult?: (results: Array<{
|
|
14
|
+
actionType: string;
|
|
15
|
+
success: boolean;
|
|
16
|
+
message: string;
|
|
17
|
+
}>) => void;
|
|
18
|
+
onStepCompleted?: (result: {
|
|
19
|
+
tool: string;
|
|
20
|
+
step: string;
|
|
21
|
+
data: Record<string, any>;
|
|
22
|
+
actionResults?: Array<{
|
|
23
|
+
actionType: string;
|
|
24
|
+
success: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
}) => void;
|
|
28
|
+
onFileUploadRequest?: (request: {
|
|
29
|
+
toolId: string;
|
|
30
|
+
fileInput: {
|
|
31
|
+
accept: string[];
|
|
32
|
+
maxSize: number;
|
|
33
|
+
sources: string[];
|
|
34
|
+
};
|
|
35
|
+
submit: (file: {
|
|
36
|
+
uri: string;
|
|
37
|
+
name: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}) => void;
|
|
40
|
+
cancel: () => void;
|
|
41
|
+
}) => void;
|
|
42
|
+
onExtractionResult?: (result: {
|
|
43
|
+
fileId: string;
|
|
44
|
+
toolId: string;
|
|
45
|
+
data: Record<string, any>;
|
|
46
|
+
status: 'success' | 'partial' | 'failed';
|
|
47
|
+
incompleteFields?: string[];
|
|
48
|
+
}) => void;
|
|
49
|
+
navigationLabelFormat?: (screenName: string) => string;
|
|
50
|
+
}
|
|
51
|
+
export interface ToolStatusState {
|
|
52
|
+
toolKey: string;
|
|
53
|
+
message: string;
|
|
54
|
+
stage: string;
|
|
55
|
+
}
|
|
56
|
+
export interface UseChatMessagesResult {
|
|
57
|
+
messages: ChatMessage[];
|
|
58
|
+
isTyping: boolean;
|
|
59
|
+
isSending: boolean;
|
|
60
|
+
streamingMessage: string;
|
|
61
|
+
/** active tool status pill for server-managed tool modes */
|
|
62
|
+
toolStatus: ToolStatusState | null;
|
|
63
|
+
flatListRef: React.RefObject<FlatList | null>;
|
|
64
|
+
handleSend: (message: string) => Promise<void>;
|
|
65
|
+
setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
|
|
66
|
+
setIsTyping: React.Dispatch<React.SetStateAction<boolean>>;
|
|
67
|
+
setStreamingMessage: React.Dispatch<React.SetStateAction<string>>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Custom hook for managing chat messages and sending
|
|
71
|
+
*/
|
|
72
|
+
export declare const useChatMessages: ({ enableStreaming, context, contextDescription, onMessageSent, onResponseReceived, onError, onNavigationSuggest, onToolSuggested, onActionResult, onStepCompleted, onFileUploadRequest, onExtractionResult, navigationLabelFormat, }: UseChatMessagesOptions) => UseChatMessagesResult;
|