@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.
Files changed (178) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/CONTRIBUTING.md +92 -0
  3. package/LICENSE +22 -0
  4. package/README.md +109 -0
  5. package/SECURITY.md +67 -0
  6. package/android/build.gradle +35 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/java/com/qafka/attestation/QafkaAttestationModule.kt +92 -0
  9. package/android/src/main/java/com/qafka/attestation/QafkaAttestationPackage.kt +22 -0
  10. package/android/src/main/java/com/qafka/audio/QafkaAudioModule.kt +290 -0
  11. package/android/src/main/java/com/qafka/clipboard/QafkaClipboardModule.kt +28 -0
  12. package/android/src/main/java/com/qafka/storage/QafkaStorageModule.kt +80 -0
  13. package/app.plugin.js +1 -0
  14. package/dist/QafkaSDK.d.ts +174 -0
  15. package/dist/QafkaSDK.js +461 -0
  16. package/dist/cards/bindings/resolveFieldName.d.ts +25 -0
  17. package/dist/cards/bindings/resolveFieldName.js +82 -0
  18. package/dist/cards/cta/CardContext.d.ts +16 -0
  19. package/dist/cards/cta/CardContext.js +58 -0
  20. package/dist/cards/cta/dispatcher.d.ts +7 -0
  21. package/dist/cards/cta/dispatcher.js +90 -0
  22. package/dist/cards/cta/types.d.ts +66 -0
  23. package/dist/cards/cta/types.js +2 -0
  24. package/dist/cards/index.d.ts +20 -0
  25. package/dist/cards/index.js +34 -0
  26. package/dist/cards/primitives/QButton.d.ts +10 -0
  27. package/dist/cards/primitives/QButton.js +115 -0
  28. package/dist/cards/primitives/QDivider.d.ts +7 -0
  29. package/dist/cards/primitives/QDivider.js +17 -0
  30. package/dist/cards/primitives/QIcon.d.ts +13 -0
  31. package/dist/cards/primitives/QIcon.js +26 -0
  32. package/dist/cards/primitives/QImage.d.ts +9 -0
  33. package/dist/cards/primitives/QImage.js +22 -0
  34. package/dist/cards/primitives/QText.d.ts +9 -0
  35. package/dist/cards/primitives/QText.js +30 -0
  36. package/dist/cards/primitives/QView.d.ts +8 -0
  37. package/dist/cards/primitives/QView.js +19 -0
  38. package/dist/cards/renderer/CardRenderer.d.ts +19 -0
  39. package/dist/cards/renderer/CardRenderer.js +64 -0
  40. package/dist/cards/renderer/renderNode.d.ts +13 -0
  41. package/dist/cards/renderer/renderNode.js +42 -0
  42. package/dist/cards/types.d.ts +110 -0
  43. package/dist/cards/types.js +6 -0
  44. package/dist/components/ActionResultBadge.d.ts +12 -0
  45. package/dist/components/ActionResultBadge.js +58 -0
  46. package/dist/components/ChatPage.d.ts +44 -0
  47. package/dist/components/ChatPage.js +84 -0
  48. package/dist/components/DataChip.d.ts +8 -0
  49. package/dist/components/DataChip.js +80 -0
  50. package/dist/components/DataChipList.d.ts +13 -0
  51. package/dist/components/DataChipList.js +21 -0
  52. package/dist/components/FloatingButton.d.ts +11 -0
  53. package/dist/components/FloatingButton.js +162 -0
  54. package/dist/components/InputArea.d.ts +57 -0
  55. package/dist/components/InputArea.js +142 -0
  56. package/dist/components/MarkdownText.d.ts +15 -0
  57. package/dist/components/MarkdownText.js +283 -0
  58. package/dist/components/MessageBubble.d.ts +134 -0
  59. package/dist/components/MessageBubble.js +384 -0
  60. package/dist/components/NavigationSuggestion.d.ts +11 -0
  61. package/dist/components/NavigationSuggestion.js +109 -0
  62. package/dist/components/Qafka.d.ts +39 -0
  63. package/dist/components/Qafka.handlers.d.ts +21 -0
  64. package/dist/components/Qafka.handlers.js +54 -0
  65. package/dist/components/Qafka.js +493 -0
  66. package/dist/components/Qafka.styles.d.ts +19 -0
  67. package/dist/components/Qafka.styles.js +101 -0
  68. package/dist/components/Qafka.types.d.ts +744 -0
  69. package/dist/components/Qafka.types.js +2 -0
  70. package/dist/components/Qafka.utils.d.ts +7 -0
  71. package/dist/components/Qafka.utils.js +34 -0
  72. package/dist/components/QafkaProvider.d.ts +12 -0
  73. package/dist/components/QafkaProvider.js +87 -0
  74. package/dist/components/QuickReplies.d.ts +14 -0
  75. package/dist/components/QuickReplies.js +48 -0
  76. package/dist/components/StepProgressIndicator.d.ts +12 -0
  77. package/dist/components/StepProgressIndicator.js +48 -0
  78. package/dist/components/SuggestionButton.d.ts +42 -0
  79. package/dist/components/SuggestionButton.js +67 -0
  80. package/dist/components/ToolStatusPill.d.ts +20 -0
  81. package/dist/components/ToolStatusPill.js +43 -0
  82. package/dist/components/TypingIndicator.d.ts +28 -0
  83. package/dist/components/TypingIndicator.js +109 -0
  84. package/dist/components/VoicePage.d.ts +48 -0
  85. package/dist/components/VoicePage.js +683 -0
  86. package/dist/components/defaults/DefaultCard.d.ts +14 -0
  87. package/dist/components/defaults/DefaultCard.js +156 -0
  88. package/dist/components/defaults/DefaultDetail.d.ts +14 -0
  89. package/dist/components/defaults/DefaultDetail.js +138 -0
  90. package/dist/components/defaults/DefaultList.d.ts +12 -0
  91. package/dist/components/defaults/DefaultList.js +98 -0
  92. package/dist/components/defaults/DefaultTable.d.ts +14 -0
  93. package/dist/components/defaults/DefaultTable.js +204 -0
  94. package/dist/components/defaults/index.d.ts +14 -0
  95. package/dist/components/defaults/index.js +25 -0
  96. package/dist/components/index.d.ts +22 -0
  97. package/dist/components/index.js +36 -0
  98. package/dist/constants.d.ts +10 -0
  99. package/dist/constants.js +13 -0
  100. package/dist/hooks/useChatMessages.d.ts +72 -0
  101. package/dist/hooks/useChatMessages.js +505 -0
  102. package/dist/hooks/useContextManager.d.ts +12 -0
  103. package/dist/hooks/useContextManager.js +46 -0
  104. package/dist/hooks/useProjectTheme.d.ts +19 -0
  105. package/dist/hooks/useProjectTheme.js +163 -0
  106. package/dist/hooks/useSDK.d.ts +31 -0
  107. package/dist/hooks/useSDK.js +103 -0
  108. package/dist/hooks/useVoiceChat.d.ts +110 -0
  109. package/dist/hooks/useVoiceChat.js +436 -0
  110. package/dist/index.d.ts +13 -0
  111. package/dist/index.js +59 -0
  112. package/dist/native/QafkaAttestation.d.ts +23 -0
  113. package/dist/native/QafkaAttestation.js +70 -0
  114. package/dist/native/QafkaAudio.d.ts +14 -0
  115. package/dist/native/QafkaAudio.js +31 -0
  116. package/dist/native/QafkaClipboard.d.ts +11 -0
  117. package/dist/native/QafkaClipboard.js +14 -0
  118. package/dist/native/QafkaStorage.d.ts +15 -0
  119. package/dist/native/QafkaStorage.js +12 -0
  120. package/dist/resolve-project-config.d.ts +35 -0
  121. package/dist/resolve-project-config.js +41 -0
  122. package/dist/runtime-config-loader.d.ts +37 -0
  123. package/dist/runtime-config-loader.js +53 -0
  124. package/dist/services/AttestationManager.d.ts +38 -0
  125. package/dist/services/AttestationManager.js +296 -0
  126. package/dist/services/BackendService.d.ts +156 -0
  127. package/dist/services/BackendService.js +755 -0
  128. package/dist/services/ConversationManager.d.ts +43 -0
  129. package/dist/services/ConversationManager.js +96 -0
  130. package/dist/services/NavigationHandler.d.ts +29 -0
  131. package/dist/services/NavigationHandler.js +70 -0
  132. package/dist/services/RealtimeService.d.ts +83 -0
  133. package/dist/services/RealtimeService.js +203 -0
  134. package/dist/services/storage.d.ts +11 -0
  135. package/dist/services/storage.js +15 -0
  136. package/dist/services/storageCore.d.ts +17 -0
  137. package/dist/services/storageCore.js +46 -0
  138. package/dist/themes/dark.d.ts +5 -0
  139. package/dist/themes/dark.js +129 -0
  140. package/dist/themes/index.d.ts +12 -0
  141. package/dist/themes/index.js +33 -0
  142. package/dist/themes/light.d.ts +5 -0
  143. package/dist/themes/light.js +129 -0
  144. package/dist/themes/types.d.ts +155 -0
  145. package/dist/themes/types.js +5 -0
  146. package/dist/types/chat.d.ts +126 -0
  147. package/dist/types/chat.js +5 -0
  148. package/dist/types/components.d.ts +56 -0
  149. package/dist/types/components.js +16 -0
  150. package/dist/types/external-navigation.d.ts +19 -0
  151. package/dist/types/external-navigation.js +8 -0
  152. package/dist/types/index.d.ts +9 -0
  153. package/dist/types/index.js +25 -0
  154. package/dist/types/navigation.d.ts +86 -0
  155. package/dist/types/navigation.js +5 -0
  156. package/dist/types/sdk.d.ts +36 -0
  157. package/dist/types/sdk.js +5 -0
  158. package/dist/utils/deepMerge.d.ts +46 -0
  159. package/dist/utils/deepMerge.js +70 -0
  160. package/dist/utils/fontUtils.d.ts +8 -0
  161. package/dist/utils/fontUtils.js +16 -0
  162. package/dist/validate-end-user.d.ts +18 -0
  163. package/dist/validate-end-user.js +74 -0
  164. package/expo-plugin/withQafkaAttestation.js +57 -0
  165. package/ios/QafkaAttestation.m +25 -0
  166. package/ios/QafkaAttestation.swift +128 -0
  167. package/ios/QafkaAudio.m +23 -0
  168. package/ios/QafkaAudio.swift +519 -0
  169. package/ios/QafkaClipboard.m +10 -0
  170. package/ios/QafkaClipboard.swift +21 -0
  171. package/ios/QafkaReactImports.h +2 -0
  172. package/ios/QafkaStorage.m +26 -0
  173. package/ios/QafkaStorage.swift +118 -0
  174. package/package.json +82 -0
  175. package/qafka.config.d.ts +9 -0
  176. package/qafka.config.js +9 -0
  177. package/react-native-qafka.podspec +28 -0
  178. package/react-native.config.js +14 -0
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.darkTheme = void 0;
4
+ /**
5
+ * Dark theme configuration
6
+ */
7
+ exports.darkTheme = {
8
+ name: 'dark',
9
+ colors: {
10
+ // Primary colors - iOS blue (adjusted for dark mode)
11
+ primary: '#0A84FF',
12
+ primaryLight: '#64D2FF',
13
+ primaryDark: '#0051D5',
14
+ // Background colors
15
+ background: '#000000',
16
+ surface: '#1C1C1E',
17
+ overlay: 'rgba(0, 0, 0, 0.7)',
18
+ // Text colors
19
+ text: '#FFFFFF',
20
+ textSecondary: '#8E8E93',
21
+ textLight: '#48484A',
22
+ textInverse: '#000000',
23
+ // Message bubble colors
24
+ userBubble: '#0A84FF',
25
+ userBubbleText: '#FFFFFF',
26
+ aiBubble: '#2C2C2E',
27
+ aiBubbleText: '#FFFFFF',
28
+ // UI element colors
29
+ border: '#38383A',
30
+ divider: '#2C2C2E',
31
+ error: '#FF453A',
32
+ success: '#32D74B',
33
+ warning: '#FF9F0A',
34
+ info: '#64D2FF',
35
+ // Input colors
36
+ inputBackground: '#1C1C1E',
37
+ inputBorder: '#38383A',
38
+ inputPlaceholder: '#8E8E93',
39
+ // Button colors
40
+ buttonBackground: '#0A84FF',
41
+ buttonText: '#FFFFFF',
42
+ buttonDisabled: '#48484A',
43
+ // Badge/notification
44
+ badge: '#FF453A',
45
+ badgeText: '#FFFFFF',
46
+ },
47
+ spacing: {
48
+ xs: 4,
49
+ sm: 8,
50
+ md: 16,
51
+ lg: 24,
52
+ xl: 32,
53
+ xxl: 48,
54
+ },
55
+ borderRadius: {
56
+ sm: 8,
57
+ md: 12,
58
+ lg: 16,
59
+ xl: 24,
60
+ full: 9999,
61
+ },
62
+ typography: {
63
+ fontFamily: 'System',
64
+ fontSize: {
65
+ xs: 12,
66
+ sm: 14,
67
+ md: 16,
68
+ lg: 18,
69
+ xl: 20,
70
+ xxl: 24,
71
+ },
72
+ fontWeight: {
73
+ regular: '400',
74
+ medium: '500',
75
+ semibold: '600',
76
+ bold: '700',
77
+ },
78
+ lineHeight: {
79
+ tight: 1.2,
80
+ normal: 1.5,
81
+ relaxed: 1.8,
82
+ },
83
+ },
84
+ shadows: {
85
+ small: {
86
+ shadowColor: '#000',
87
+ shadowOffset: { width: 0, height: 1 },
88
+ shadowOpacity: 0.3,
89
+ shadowRadius: 2,
90
+ elevation: 2,
91
+ },
92
+ medium: {
93
+ shadowColor: '#000',
94
+ shadowOffset: { width: 0, height: 2 },
95
+ shadowOpacity: 0.4,
96
+ shadowRadius: 4,
97
+ elevation: 4,
98
+ },
99
+ large: {
100
+ shadowColor: '#000',
101
+ shadowOffset: { width: 0, height: 4 },
102
+ shadowOpacity: 0.5,
103
+ shadowRadius: 8,
104
+ elevation: 8,
105
+ },
106
+ },
107
+ animation: {
108
+ duration: {
109
+ fast: 150,
110
+ normal: 300,
111
+ slow: 500,
112
+ },
113
+ easing: {
114
+ easeIn: 'ease-in',
115
+ easeOut: 'ease-out',
116
+ easeInOut: 'ease-in-out',
117
+ },
118
+ },
119
+ messages: {
120
+ user: {
121
+ padding: 12,
122
+ maxWidth: 70, // 70% of container width
123
+ },
124
+ ai: {
125
+ padding: 12,
126
+ maxWidth: 70, // 70% of container width
127
+ },
128
+ },
129
+ };
@@ -0,0 +1,12 @@
1
+ export * from './types';
2
+ export * from './light';
3
+ export * from './dark';
4
+ import { Theme } from './types';
5
+ /**
6
+ * Get theme by name
7
+ */
8
+ export declare function getTheme(themeName: 'light' | 'dark'): Theme;
9
+ /**
10
+ * Default theme
11
+ */
12
+ export declare const defaultTheme: Theme;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.defaultTheme = void 0;
18
+ exports.getTheme = getTheme;
19
+ __exportStar(require("./types"), exports);
20
+ __exportStar(require("./light"), exports);
21
+ __exportStar(require("./dark"), exports);
22
+ const light_1 = require("./light");
23
+ const dark_1 = require("./dark");
24
+ /**
25
+ * Get theme by name
26
+ */
27
+ function getTheme(themeName) {
28
+ return themeName === 'dark' ? dark_1.darkTheme : light_1.lightTheme;
29
+ }
30
+ /**
31
+ * Default theme
32
+ */
33
+ exports.defaultTheme = light_1.lightTheme;
@@ -0,0 +1,5 @@
1
+ import { Theme } from './types';
2
+ /**
3
+ * Light theme configuration
4
+ */
5
+ export declare const lightTheme: Theme;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lightTheme = void 0;
4
+ /**
5
+ * Light theme configuration
6
+ */
7
+ exports.lightTheme = {
8
+ name: 'light',
9
+ colors: {
10
+ // Primary colors - iOS blue
11
+ primary: '#007AFF',
12
+ primaryLight: '#5AC8FA',
13
+ primaryDark: '#0051D5',
14
+ // Background colors
15
+ background: '#FFFFFF',
16
+ surface: '#F2F2F7',
17
+ overlay: 'rgba(0, 0, 0, 0.5)',
18
+ // Text colors
19
+ text: '#000000',
20
+ textSecondary: '#8E8E93',
21
+ textLight: '#C7C7CC',
22
+ textInverse: '#FFFFFF',
23
+ // Message bubble colors
24
+ userBubble: '#007AFF',
25
+ userBubbleText: '#FFFFFF',
26
+ aiBubble: '#E9E9EB',
27
+ aiBubbleText: '#000000',
28
+ // UI element colors
29
+ border: '#C6C6C8',
30
+ divider: '#E5E5EA',
31
+ error: '#FF3B30',
32
+ success: '#34C759',
33
+ warning: '#FF9500',
34
+ info: '#5AC8FA',
35
+ // Input colors
36
+ inputBackground: '#F2F2F7',
37
+ inputBorder: '#C6C6C8',
38
+ inputPlaceholder: '#8E8E93',
39
+ // Button colors
40
+ buttonBackground: '#007AFF',
41
+ buttonText: '#FFFFFF',
42
+ buttonDisabled: '#C7C7CC',
43
+ // Badge/notification
44
+ badge: '#FF3B30',
45
+ badgeText: '#FFFFFF',
46
+ },
47
+ spacing: {
48
+ xs: 4,
49
+ sm: 8,
50
+ md: 16,
51
+ lg: 24,
52
+ xl: 32,
53
+ xxl: 48,
54
+ },
55
+ borderRadius: {
56
+ sm: 8,
57
+ md: 12,
58
+ lg: 16,
59
+ xl: 24,
60
+ full: 9999,
61
+ },
62
+ typography: {
63
+ fontFamily: 'System',
64
+ fontSize: {
65
+ xs: 12,
66
+ sm: 14,
67
+ md: 16,
68
+ lg: 18,
69
+ xl: 20,
70
+ xxl: 24,
71
+ },
72
+ fontWeight: {
73
+ regular: '400',
74
+ medium: '500',
75
+ semibold: '600',
76
+ bold: '700',
77
+ },
78
+ lineHeight: {
79
+ tight: 1.2,
80
+ normal: 1.5,
81
+ relaxed: 1.8,
82
+ },
83
+ },
84
+ shadows: {
85
+ small: {
86
+ shadowColor: '#000',
87
+ shadowOffset: { width: 0, height: 1 },
88
+ shadowOpacity: 0.1,
89
+ shadowRadius: 2,
90
+ elevation: 2,
91
+ },
92
+ medium: {
93
+ shadowColor: '#000',
94
+ shadowOffset: { width: 0, height: 2 },
95
+ shadowOpacity: 0.15,
96
+ shadowRadius: 4,
97
+ elevation: 4,
98
+ },
99
+ large: {
100
+ shadowColor: '#000',
101
+ shadowOffset: { width: 0, height: 4 },
102
+ shadowOpacity: 0.2,
103
+ shadowRadius: 8,
104
+ elevation: 8,
105
+ },
106
+ },
107
+ animation: {
108
+ duration: {
109
+ fast: 150,
110
+ normal: 300,
111
+ slow: 500,
112
+ },
113
+ easing: {
114
+ easeIn: 'ease-in',
115
+ easeOut: 'ease-out',
116
+ easeInOut: 'ease-in-out',
117
+ },
118
+ },
119
+ messages: {
120
+ user: {
121
+ padding: 12,
122
+ maxWidth: 70, // 70% of container width
123
+ },
124
+ ai: {
125
+ padding: 12,
126
+ maxWidth: 70, // 70% of container width
127
+ },
128
+ },
129
+ };
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Theme types for QafkaSDK
3
+ */
4
+ export interface ThemeColors {
5
+ primary: string;
6
+ primaryLight: string;
7
+ primaryDark: string;
8
+ background: string;
9
+ surface: string;
10
+ overlay: string;
11
+ text: string;
12
+ textSecondary: string;
13
+ textLight: string;
14
+ textInverse: string;
15
+ userBubble: string;
16
+ userBubbleText: string;
17
+ aiBubble: string;
18
+ aiBubbleText: string;
19
+ border: string;
20
+ divider: string;
21
+ error: string;
22
+ success: string;
23
+ warning: string;
24
+ info: string;
25
+ inputBackground: string;
26
+ inputBorder: string;
27
+ inputPlaceholder: string;
28
+ buttonBackground: string;
29
+ buttonText: string;
30
+ buttonDisabled: string;
31
+ badge: string;
32
+ badgeText: string;
33
+ }
34
+ export interface ThemeSpacing {
35
+ xs: number;
36
+ sm: number;
37
+ md: number;
38
+ lg: number;
39
+ xl: number;
40
+ xxl: number;
41
+ }
42
+ export interface ThemeBorderRadius {
43
+ sm: number;
44
+ md: number;
45
+ lg: number;
46
+ xl: number;
47
+ full: number;
48
+ }
49
+ export interface ThemeTypography {
50
+ fontFamily: string;
51
+ fontSize: {
52
+ xs: number;
53
+ sm: number;
54
+ md: number;
55
+ lg: number;
56
+ xl: number;
57
+ xxl: number;
58
+ };
59
+ /**
60
+ * Optional mapping for specific font families per weight/style.
61
+ * Useful for Android where font weights might need specific font files.
62
+ */
63
+ fonts?: {
64
+ regular?: string;
65
+ medium?: string;
66
+ semibold?: string;
67
+ bold?: string;
68
+ italic?: string;
69
+ light?: string;
70
+ code?: string;
71
+ };
72
+ fontWeight: {
73
+ regular: '400';
74
+ medium: '500';
75
+ semibold: '600';
76
+ bold: '700';
77
+ };
78
+ lineHeight: {
79
+ tight: number;
80
+ normal: number;
81
+ relaxed: number;
82
+ };
83
+ }
84
+ export interface ThemeShadows {
85
+ small: {
86
+ shadowColor: string;
87
+ shadowOffset: {
88
+ width: number;
89
+ height: number;
90
+ };
91
+ shadowOpacity: number;
92
+ shadowRadius: number;
93
+ elevation: number;
94
+ };
95
+ medium: {
96
+ shadowColor: string;
97
+ shadowOffset: {
98
+ width: number;
99
+ height: number;
100
+ };
101
+ shadowOpacity: number;
102
+ shadowRadius: number;
103
+ elevation: number;
104
+ };
105
+ large: {
106
+ shadowColor: string;
107
+ shadowOffset: {
108
+ width: number;
109
+ height: number;
110
+ };
111
+ shadowOpacity: number;
112
+ shadowRadius: number;
113
+ elevation: number;
114
+ };
115
+ }
116
+ export interface ThemeAnimation {
117
+ duration: {
118
+ fast: number;
119
+ normal: number;
120
+ slow: number;
121
+ };
122
+ easing: {
123
+ easeIn: string;
124
+ easeOut: string;
125
+ easeInOut: string;
126
+ };
127
+ }
128
+ export interface ThemeMessages {
129
+ user: {
130
+ padding: number;
131
+ maxWidth: number;
132
+ };
133
+ ai: {
134
+ padding: number;
135
+ maxWidth: number;
136
+ };
137
+ }
138
+ export interface Theme {
139
+ name: 'light' | 'dark';
140
+ colors: ThemeColors;
141
+ spacing: ThemeSpacing;
142
+ borderRadius: ThemeBorderRadius;
143
+ typography: ThemeTypography;
144
+ shadows: ThemeShadows;
145
+ animation: ThemeAnimation;
146
+ messages?: ThemeMessages;
147
+ }
148
+ /**
149
+ * Partial theme type for overrides
150
+ * Allows specifying only the properties you want to change
151
+ */
152
+ export type DeepPartial<T> = {
153
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
154
+ };
155
+ export type ThemeOverride = DeepPartial<Theme>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Theme types for QafkaSDK
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Chat and messaging related types
3
+ */
4
+ import { NavigationSuggestion } from './navigation';
5
+ import { ExternalSuggestion } from './external-navigation';
6
+ /**
7
+ * Message role
8
+ */
9
+ export type MessageRole = 'user' | 'assistant' | 'system';
10
+ /**
11
+ * Action button types
12
+ */
13
+ export type ActionButtonType = 'navigation' | 'custom';
14
+ /**
15
+ * Action button for interactive messages
16
+ */
17
+ export interface ActionButton {
18
+ id: string;
19
+ type: ActionButtonType;
20
+ label: string;
21
+ icon?: string;
22
+ data?: any;
23
+ style?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning';
24
+ }
25
+ /**
26
+ * Chat message
27
+ */
28
+ export interface ChatMessage {
29
+ id: string;
30
+ role: MessageRole;
31
+ text: string;
32
+ content: string;
33
+ timestamp: Date;
34
+ isStreaming?: boolean;
35
+ actions?: ActionButton[];
36
+ metadata?: {
37
+ isInitialMessage?: boolean;
38
+ };
39
+ /** Action execution results attached to this message */
40
+ actionResults?: Array<{
41
+ actionType: string;
42
+ success: boolean;
43
+ message: string;
44
+ }>;
45
+ /** Completed steps for multi-step tool flows */
46
+ completedSteps?: Array<{
47
+ tool: string;
48
+ step: string;
49
+ data: Record<string, any>;
50
+ }>;
51
+ /**
52
+ * External suggestions (WhatsApp, phone, map, etc.) attached to this
53
+ * assistant message.
54
+ */
55
+ externalSuggestions?: ExternalSuggestion[];
56
+ toolResponse?: {
57
+ toolKey: string;
58
+ data: any;
59
+ tool: {
60
+ key: string;
61
+ name: string;
62
+ response: {
63
+ type: 'list' | 'card' | 'detail' | 'table';
64
+ dataPath?: string;
65
+ itemComponent?: string;
66
+ maxItems?: number;
67
+ fallbackMessage?: string;
68
+ };
69
+ };
70
+ };
71
+ /**
72
+ * Optional card payload rendered alongside this message when a tool returns
73
+ * a card-type response. Rendered automatically by the widget; for headless
74
+ * usage the payload can also be passed directly to `<CardRenderer />`.
75
+ */
76
+ card?: {
77
+ templateId: string;
78
+ templateSlug: string;
79
+ /** CardDefinition — opaque to types.ts to avoid circular import. */
80
+ definition: any;
81
+ data: any;
82
+ };
83
+ }
84
+ /**
85
+ * Chat response from SDK or API
86
+ */
87
+ export interface ChatResponse {
88
+ id: string;
89
+ text?: string;
90
+ timestamp: Date;
91
+ navigationSuggestion?: NavigationSuggestion;
92
+ /** External suggestions (WhatsApp, phone, map, etc.) attached to the assistant reply. */
93
+ externalSuggestions?: ExternalSuggestion[];
94
+ }
95
+ /**
96
+ * SDK-supplied context attached to every backend request.
97
+ *
98
+ * Only universal temporal fields are auto-collected. Pass anything else
99
+ * (platform, device, user metadata) via `<Qafka context={...} />`.
100
+ */
101
+ export interface SdkContext {
102
+ dateTime: string;
103
+ timezone: string;
104
+ locale?: string;
105
+ }
106
+ export interface ChatRequest {
107
+ message: string;
108
+ sessionId: string;
109
+ conversationId?: string;
110
+ subProjectId?: string;
111
+ /**
112
+ * Explicit end-user identifier. Always a coerced/validated string by
113
+ * the time it leaves the SDK (the public `endUserId` prop accepts
114
+ * `string | number`; `validate-end-user.ts` normalises).
115
+ */
116
+ endUserId?: string;
117
+ /** Opt-in structured profile data for operator dashboards and tool action templates. */
118
+ endUserData?: Record<string, unknown>;
119
+ context?: {
120
+ currentRoute?: string;
121
+ previousMessages?: number;
122
+ metadata?: Record<string, any>;
123
+ };
124
+ sdkContext?: SdkContext;
125
+ isInitialMessage?: boolean;
126
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Chat and messaging related types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Component Registry types for Tool Registry
3
+ */
4
+ /**
5
+ * Props passed to custom components
6
+ */
7
+ export interface ToolComponentProps {
8
+ /**
9
+ * The data item to render (from API response)
10
+ */
11
+ data: any;
12
+ /**
13
+ * Tool definition (includes response config)
14
+ */
15
+ tool?: {
16
+ key: string;
17
+ response: {
18
+ type: 'list' | 'card' | 'detail' | 'table';
19
+ dataPath?: string;
20
+ itemComponent?: string;
21
+ maxItems?: number;
22
+ fallbackMessage?: string;
23
+ };
24
+ };
25
+ /**
26
+ * Theme object for styling
27
+ */
28
+ theme?: any;
29
+ /**
30
+ * Action callback for interactive elements
31
+ */
32
+ onAction?: (actionType: string, data: any) => void;
33
+ }
34
+ /**
35
+ * React Component Type (simple function component)
36
+ */
37
+ export type ComponentType<P = any> = (props: P) => any;
38
+ /**
39
+ * Component registry - maps component names to React components
40
+ */
41
+ export interface ComponentRegistry {
42
+ [componentName: string]: ComponentType<ToolComponentProps>;
43
+ }
44
+ /**
45
+ * Default component names
46
+ */
47
+ export declare enum DefaultComponents {
48
+ Card = "DefaultCard",
49
+ List = "DefaultList",
50
+ Detail = "DefaultDetail",
51
+ Table = "DefaultTable"
52
+ }
53
+ /**
54
+ * Tool response render type
55
+ */
56
+ export type ToolResponseType = 'list' | 'card' | 'detail' | 'table' | 'raw';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * Component Registry types for Tool Registry
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DefaultComponents = void 0;
7
+ /**
8
+ * Default component names
9
+ */
10
+ var DefaultComponents;
11
+ (function (DefaultComponents) {
12
+ DefaultComponents["Card"] = "DefaultCard";
13
+ DefaultComponents["List"] = "DefaultList";
14
+ DefaultComponents["Detail"] = "DefaultDetail";
15
+ DefaultComponents["Table"] = "DefaultTable";
16
+ })(DefaultComponents || (exports.DefaultComponents = DefaultComponents = {}));
@@ -0,0 +1,19 @@
1
+ /**
2
+ * External Navigation — SDK types.
3
+ *
4
+ * Describes external destinations (WhatsApp, phone, map, app store, etc.)
5
+ * that buttons under chat messages can redirect to outside the host app.
6
+ */
7
+ export type ExternalType = 'whatsapp' | 'phone' | 'sms' | 'email' | 'website' | 'map' | 'app_store' | 'social' | 'deeplink';
8
+ /**
9
+ * External suggestion emitted by the backend via the
10
+ * `external_navigation` SSE event after each assistant message.
11
+ */
12
+ export interface ExternalSuggestion {
13
+ id: string;
14
+ type: ExternalType;
15
+ label: string;
16
+ icon: string;
17
+ url: string;
18
+ fallbackUrl?: string;
19
+ }