@uselingu/react-native-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -0
- package/lib/commonjs/components/LinguChat.js +283 -0
- package/lib/commonjs/components/LinguChat.js.map +1 -0
- package/lib/commonjs/components/LinguWebView.js +203 -0
- package/lib/commonjs/components/LinguWebView.js.map +1 -0
- package/lib/commonjs/components/MessageBubble.js +91 -0
- package/lib/commonjs/components/MessageBubble.js.map +1 -0
- package/lib/commonjs/components/NativeChatUI.js +192 -0
- package/lib/commonjs/components/NativeChatUI.js.map +1 -0
- package/lib/commonjs/components/TypingIndicator.js +92 -0
- package/lib/commonjs/components/TypingIndicator.js.map +1 -0
- package/lib/commonjs/context/LinguProvider.js +47 -0
- package/lib/commonjs/context/LinguProvider.js.map +1 -0
- package/lib/commonjs/context/index.js +17 -0
- package/lib/commonjs/context/index.js.map +1 -0
- package/lib/commonjs/hooks/useLinguChat.js +295 -0
- package/lib/commonjs/hooks/useLinguChat.js.map +1 -0
- package/lib/commonjs/index.js +129 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/services/LinguAPI.js +196 -0
- package/lib/commonjs/services/LinguAPI.js.map +1 -0
- package/lib/commonjs/services/SessionManager.js +131 -0
- package/lib/commonjs/services/SessionManager.js.map +1 -0
- package/lib/commonjs/services/StorageManager.js +116 -0
- package/lib/commonjs/services/StorageManager.js.map +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +49 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/index.js +28 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/theme.js +150 -0
- package/lib/commonjs/theme/theme.js.map +1 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/animations.js +118 -0
- package/lib/commonjs/utils/animations.js.map +1 -0
- package/lib/commonjs/utils/formatters.js +89 -0
- package/lib/commonjs/utils/formatters.js.map +1 -0
- package/lib/commonjs/utils/index.js +28 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/components/LinguChat.js +277 -0
- package/lib/module/components/LinguChat.js.map +1 -0
- package/lib/module/components/LinguWebView.js +195 -0
- package/lib/module/components/LinguWebView.js.map +1 -0
- package/lib/module/components/MessageBubble.js +83 -0
- package/lib/module/components/MessageBubble.js.map +1 -0
- package/lib/module/components/NativeChatUI.js +184 -0
- package/lib/module/components/NativeChatUI.js.map +1 -0
- package/lib/module/components/TypingIndicator.js +84 -0
- package/lib/module/components/TypingIndicator.js.map +1 -0
- package/lib/module/context/LinguProvider.js +38 -0
- package/lib/module/context/LinguProvider.js.map +1 -0
- package/lib/module/context/index.js +6 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/hooks/useLinguChat.js +288 -0
- package/lib/module/hooks/useLinguChat.js.map +1 -0
- package/lib/module/index.js +30 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/services/LinguAPI.js +190 -0
- package/lib/module/services/LinguAPI.js.map +1 -0
- package/lib/module/services/SessionManager.js +124 -0
- package/lib/module/services/SessionManager.js.map +1 -0
- package/lib/module/services/StorageManager.js +108 -0
- package/lib/module/services/StorageManager.js.map +1 -0
- package/lib/module/theme/ThemeProvider.js +40 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/index.js +7 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/theme.js +142 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/animations.js +106 -0
- package/lib/module/utils/animations.js.map +1 -0
- package/lib/module/utils/formatters.js +78 -0
- package/lib/module/utils/formatters.js.map +1 -0
- package/lib/module/utils/index.js +7 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/components/LinguChat.d.ts +18 -0
- package/lib/typescript/components/LinguChat.d.ts.map +1 -0
- package/lib/typescript/components/LinguWebView.d.ts +16 -0
- package/lib/typescript/components/LinguWebView.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble.d.ts +13 -0
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -0
- package/lib/typescript/components/NativeChatUI.d.ts +16 -0
- package/lib/typescript/components/NativeChatUI.d.ts.map +1 -0
- package/lib/typescript/components/TypingIndicator.d.ts +7 -0
- package/lib/typescript/components/TypingIndicator.d.ts.map +1 -0
- package/lib/typescript/context/LinguProvider.d.ts +32 -0
- package/lib/typescript/context/LinguProvider.d.ts.map +1 -0
- package/lib/typescript/context/index.d.ts +5 -0
- package/lib/typescript/context/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useLinguChat.d.ts +18 -0
- package/lib/typescript/hooks/useLinguChat.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +19 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/services/LinguAPI.d.ts +39 -0
- package/lib/typescript/services/LinguAPI.d.ts.map +1 -0
- package/lib/typescript/services/SessionManager.d.ts +46 -0
- package/lib/typescript/services/SessionManager.d.ts.map +1 -0
- package/lib/typescript/services/StorageManager.d.ts +36 -0
- package/lib/typescript/services/StorageManager.d.ts.map +1 -0
- package/lib/typescript/theme/ThemeProvider.d.ts +23 -0
- package/lib/typescript/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +6 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/theme.d.ts +130 -0
- package/lib/typescript/theme/theme.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +50 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/utils/animations.d.ts +34 -0
- package/lib/typescript/utils/animations.d.ts.map +1 -0
- package/lib/typescript/utils/formatters.d.ts +25 -0
- package/lib/typescript/utils/formatters.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +6 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/package.json +98 -0
- package/src/components/LinguChat.tsx +309 -0
- package/src/components/LinguWebView.tsx +216 -0
- package/src/components/MessageBubble.tsx +120 -0
- package/src/components/NativeChatUI.tsx +247 -0
- package/src/components/TypingIndicator.tsx +84 -0
- package/src/context/LinguProvider.tsx +53 -0
- package/src/context/index.ts +5 -0
- package/src/hooks/useLinguChat.ts +314 -0
- package/src/index.ts +43 -0
- package/src/services/LinguAPI.ts +214 -0
- package/src/services/SessionManager.ts +131 -0
- package/src/services/StorageManager.ts +111 -0
- package/src/theme/ThemeProvider.tsx +58 -0
- package/src/theme/index.ts +6 -0
- package/src/theme/theme.ts +254 -0
- package/src/types/index.ts +59 -0
- package/src/utils/animations.ts +141 -0
- package/src/utils/formatters.ts +80 -0
- package/src/utils/index.ts +6 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Configuration
|
|
3
|
+
* Centralized design tokens for the SDK
|
|
4
|
+
* Colors are sourced from backend widget config
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Default typography (constant across themes)
|
|
8
|
+
export const defaultTypography = {
|
|
9
|
+
fontSizes: {
|
|
10
|
+
xs: 12,
|
|
11
|
+
sm: 14,
|
|
12
|
+
base: 15,
|
|
13
|
+
lg: 16,
|
|
14
|
+
xl: 18,
|
|
15
|
+
'2xl': 20,
|
|
16
|
+
'3xl': 24
|
|
17
|
+
},
|
|
18
|
+
fontWeights: {
|
|
19
|
+
normal: '400',
|
|
20
|
+
medium: '500',
|
|
21
|
+
semibold: '600',
|
|
22
|
+
bold: '700'
|
|
23
|
+
},
|
|
24
|
+
lineHeights: {
|
|
25
|
+
tight: 1.2,
|
|
26
|
+
normal: 1.5,
|
|
27
|
+
relaxed: 1.75
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Default spacing (constant across themes)
|
|
32
|
+
export const defaultSpacing = {
|
|
33
|
+
xs: 4,
|
|
34
|
+
sm: 8,
|
|
35
|
+
md: 12,
|
|
36
|
+
lg: 16,
|
|
37
|
+
xl: 20,
|
|
38
|
+
'2xl': 24,
|
|
39
|
+
'3xl': 32
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Default border radius (constant across themes)
|
|
43
|
+
export const defaultBorderRadius = {
|
|
44
|
+
sm: 4,
|
|
45
|
+
md: 8,
|
|
46
|
+
lg: 12,
|
|
47
|
+
xl: 16,
|
|
48
|
+
full: 9999
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Default shadows (constant across themes)
|
|
52
|
+
export const defaultShadows = {
|
|
53
|
+
sm: {
|
|
54
|
+
shadowColor: '#000',
|
|
55
|
+
shadowOffset: {
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 1
|
|
58
|
+
},
|
|
59
|
+
shadowOpacity: 0.1,
|
|
60
|
+
shadowRadius: 2,
|
|
61
|
+
elevation: 2
|
|
62
|
+
},
|
|
63
|
+
md: {
|
|
64
|
+
shadowColor: '#000',
|
|
65
|
+
shadowOffset: {
|
|
66
|
+
width: 0,
|
|
67
|
+
height: 2
|
|
68
|
+
},
|
|
69
|
+
shadowOpacity: 0.15,
|
|
70
|
+
shadowRadius: 4,
|
|
71
|
+
elevation: 4
|
|
72
|
+
},
|
|
73
|
+
lg: {
|
|
74
|
+
shadowColor: '#000',
|
|
75
|
+
shadowOffset: {
|
|
76
|
+
width: 0,
|
|
77
|
+
height: 4
|
|
78
|
+
},
|
|
79
|
+
shadowOpacity: 0.2,
|
|
80
|
+
shadowRadius: 8,
|
|
81
|
+
elevation: 8
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Default animation durations (constant across themes)
|
|
86
|
+
export const defaultAnimations = {
|
|
87
|
+
fast: 150,
|
|
88
|
+
normal: 300,
|
|
89
|
+
slow: 500
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Create theme colors from backend widget config
|
|
94
|
+
*/
|
|
95
|
+
export const createThemeColors = (primaryColor, backgroundColor, textColor, theme = 'light') => {
|
|
96
|
+
const isLight = theme === 'light';
|
|
97
|
+
return {
|
|
98
|
+
primary: primaryColor,
|
|
99
|
+
background: backgroundColor,
|
|
100
|
+
text: textColor,
|
|
101
|
+
// Semantic colors
|
|
102
|
+
userBubble: primaryColor,
|
|
103
|
+
botBubble: isLight ? '#ffffff' : '#2d3748',
|
|
104
|
+
userText: '#ffffff',
|
|
105
|
+
botText: isLight ? '#1f2937' : '#f9fafb',
|
|
106
|
+
inputBackground: isLight ? '#f9fafb' : '#2d3748',
|
|
107
|
+
inputBorder: isLight ? '#e5e7eb' : '#4a5568',
|
|
108
|
+
inputText: isLight ? '#1f2937' : '#f9fafb',
|
|
109
|
+
headerBackground: primaryColor,
|
|
110
|
+
headerText: '#ffffff',
|
|
111
|
+
errorBackground: '#fef2f2',
|
|
112
|
+
errorText: '#991b1b',
|
|
113
|
+
badge: '#ef4444',
|
|
114
|
+
loadingIndicator: primaryColor,
|
|
115
|
+
// Neutral colors
|
|
116
|
+
gray50: '#f9fafb',
|
|
117
|
+
gray100: '#f3f4f6',
|
|
118
|
+
gray200: '#e5e7eb',
|
|
119
|
+
gray300: '#d1d5db',
|
|
120
|
+
gray400: '#9ca3af',
|
|
121
|
+
gray500: '#6b7280',
|
|
122
|
+
gray600: '#4b5563',
|
|
123
|
+
gray700: '#374151',
|
|
124
|
+
gray800: '#1f2937',
|
|
125
|
+
gray900: '#111827'
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Create complete theme from backend widget config
|
|
131
|
+
*/
|
|
132
|
+
export const createTheme = (primaryColor = '#4ade80', backgroundColor = '#ffffff', textColor = '#1f2937', themeMode = 'light') => {
|
|
133
|
+
return {
|
|
134
|
+
colors: createThemeColors(primaryColor, backgroundColor, textColor, themeMode),
|
|
135
|
+
typography: defaultTypography,
|
|
136
|
+
spacing: defaultSpacing,
|
|
137
|
+
borderRadius: defaultBorderRadius,
|
|
138
|
+
shadows: defaultShadows,
|
|
139
|
+
animations: defaultAnimations
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultTypography","fontSizes","xs","sm","base","lg","xl","fontWeights","normal","medium","semibold","bold","lineHeights","tight","relaxed","defaultSpacing","md","defaultBorderRadius","full","defaultShadows","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","defaultAnimations","fast","slow","createThemeColors","primaryColor","backgroundColor","textColor","theme","isLight","primary","background","text","userBubble","botBubble","userText","botText","inputBackground","inputBorder","inputText","headerBackground","headerText","errorBackground","errorText","badge","loadingIndicator","gray50","gray100","gray200","gray300","gray400","gray500","gray600","gray700","gray800","gray900","createTheme","themeMode","colors","typography","spacing","borderRadius","shadows","animations"],"sources":["theme.ts"],"sourcesContent":["/**\n * Theme Configuration\n * Centralized design tokens for the SDK\n * Colors are sourced from backend widget config\n */\n\nexport interface ThemeColors {\n primary: string;\n background: string;\n text: string;\n // Semantic colors\n userBubble: string;\n botBubble: string;\n userText: string;\n botText: string;\n inputBackground: string;\n inputBorder: string;\n inputText: string;\n headerBackground: string;\n headerText: string;\n errorBackground: string;\n errorText: string;\n badge: string;\n loadingIndicator: string;\n // Neutral colors\n gray50: string;\n gray100: string;\n gray200: string;\n gray300: string;\n gray400: string;\n gray500: string;\n gray600: string;\n gray700: string;\n gray800: string;\n gray900: string;\n}\n\nexport interface Typography {\n fontSizes: {\n xs: number;\n sm: number;\n base: number;\n lg: number;\n xl: number;\n '2xl': number;\n '3xl': number;\n };\n fontWeights: {\n normal: '400';\n medium: '500';\n semibold: '600';\n bold: '700';\n };\n lineHeights: {\n tight: number;\n normal: number;\n relaxed: number;\n };\n}\n\nexport interface Spacing {\n xs: number;\n sm: number;\n md: number;\n lg: number;\n xl: number;\n '2xl': number;\n '3xl': number;\n}\n\nexport interface BorderRadius {\n sm: number;\n md: number;\n lg: number;\n xl: number;\n full: number;\n}\n\nexport interface Shadows {\n sm: {\n shadowColor: string;\n shadowOffset: { width: number; height: number };\n shadowOpacity: number;\n shadowRadius: number;\n elevation: number;\n };\n md: {\n shadowColor: string;\n shadowOffset: { width: number; height: number };\n shadowOpacity: number;\n shadowRadius: number;\n elevation: number;\n };\n lg: {\n shadowColor: string;\n shadowOffset: { width: number; height: number };\n shadowOpacity: number;\n shadowRadius: number;\n elevation: number;\n };\n}\n\nexport interface AnimationDurations {\n fast: number;\n normal: number;\n slow: number;\n}\n\nexport interface Theme {\n colors: ThemeColors;\n typography: Typography;\n spacing: Spacing;\n borderRadius: BorderRadius;\n shadows: Shadows;\n animations: AnimationDurations;\n}\n\n// Default typography (constant across themes)\nexport const defaultTypography: Typography = {\n fontSizes: {\n xs: 12,\n sm: 14,\n base: 15,\n lg: 16,\n xl: 18,\n '2xl': 20,\n '3xl': 24,\n },\n fontWeights: {\n normal: '400',\n medium: '500',\n semibold: '600',\n bold: '700',\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.5,\n relaxed: 1.75,\n },\n};\n\n// Default spacing (constant across themes)\nexport const defaultSpacing: Spacing = {\n xs: 4,\n sm: 8,\n md: 12,\n lg: 16,\n xl: 20,\n '2xl': 24,\n '3xl': 32,\n};\n\n// Default border radius (constant across themes)\nexport const defaultBorderRadius: BorderRadius = {\n sm: 4,\n md: 8,\n lg: 12,\n xl: 16,\n full: 9999,\n};\n\n// Default shadows (constant across themes)\nexport const defaultShadows: Shadows = {\n sm: {\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.1,\n shadowRadius: 2,\n elevation: 2,\n },\n md: {\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.15,\n shadowRadius: 4,\n elevation: 4,\n },\n lg: {\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 4 },\n shadowOpacity: 0.2,\n shadowRadius: 8,\n elevation: 8,\n },\n};\n\n// Default animation durations (constant across themes)\nexport const defaultAnimations: AnimationDurations = {\n fast: 150,\n normal: 300,\n slow: 500,\n};\n\n/**\n * Create theme colors from backend widget config\n */\nexport const createThemeColors = (\n primaryColor: string,\n backgroundColor: string,\n textColor: string,\n theme: 'light' | 'dark' = 'light'\n): ThemeColors => {\n const isLight = theme === 'light';\n\n return {\n primary: primaryColor,\n background: backgroundColor,\n text: textColor,\n // Semantic colors\n userBubble: primaryColor,\n botBubble: isLight ? '#ffffff' : '#2d3748',\n userText: '#ffffff',\n botText: isLight ? '#1f2937' : '#f9fafb',\n inputBackground: isLight ? '#f9fafb' : '#2d3748',\n inputBorder: isLight ? '#e5e7eb' : '#4a5568',\n inputText: isLight ? '#1f2937' : '#f9fafb',\n headerBackground: primaryColor,\n headerText: '#ffffff',\n errorBackground: '#fef2f2',\n errorText: '#991b1b',\n badge: '#ef4444',\n loadingIndicator: primaryColor,\n // Neutral colors\n gray50: '#f9fafb',\n gray100: '#f3f4f6',\n gray200: '#e5e7eb',\n gray300: '#d1d5db',\n gray400: '#9ca3af',\n gray500: '#6b7280',\n gray600: '#4b5563',\n gray700: '#374151',\n gray800: '#1f2937',\n gray900: '#111827',\n };\n};\n\n/**\n * Create complete theme from backend widget config\n */\nexport const createTheme = (\n primaryColor: string = '#4ade80',\n backgroundColor: string = '#ffffff',\n textColor: string = '#1f2937',\n themeMode: 'light' | 'dark' = 'light'\n): Theme => {\n return {\n colors: createThemeColors(primaryColor, backgroundColor, textColor, themeMode),\n typography: defaultTypography,\n spacing: defaultSpacing,\n borderRadius: defaultBorderRadius,\n shadows: defaultShadows,\n animations: defaultAnimations,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAiHA;AACA,OAAO,MAAMA,iBAA6B,GAAG;EAC1CC,SAAS,EAAE;IACRC,EAAE,EAAE,EAAE;IACNC,EAAE,EAAE,EAAE;IACNC,IAAI,EAAE,EAAE;IACRC,EAAE,EAAE,EAAE;IACNC,EAAE,EAAE,EAAE;IAC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CACxB/B,YAAoB,GAAG,SAAS,EAChCC,eAAuB,GAAG,SAAS,EACnCC,SAAiB,GAAG,SAAS,EAC7B8B,SAA2B,GAAG,OAAO,KAC5B;EACT,OAAO;IACJC,MAAM,EAAElC,iBAAiB,CAACC,YAAY,EAAEC,eAAe,EAAEC,SAAS,EAAE8B,SAAS,CAAC;IAC9EE,UAAU,EAAEjE,iBAAiB;IAC7BkE,OAAO,EAAEnD,cAAc;IACvBoD,YAAY,EAAElD,mBAAmB;IACjCmD,OAAO,EAAEjD,cAAc;IACvBkD,UAAU,EAAE1C;EACf,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["/**\n * Core types for Lingu React Native SDK\n */\n\nexport interface LinguConfig {\n apiKey: string;\n baseURL?: string;\n autoOpen?: boolean;\n onSessionStart?: (sessionId: string) => void;\n onSessionEnd?: (sessionId: string) => void;\n onMessageSent?: (message: string) => void;\n onMessageReceived?: (message: string) => void;\n}\n\nexport type ChatPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';\n\nexport type ThemeMode = 'light' | 'dark' | 'system';\n\nexport type MessageSender = 'user' | 'bot';\n\nexport interface Message {\n id: string;\n text: string;\n sender: MessageSender;\n timestamp: Date;\n}\n\nexport interface WidgetConfig {\n widgetPosition: ChatPosition;\n widgetSize: 'small' | 'medium' | 'large';\n theme: ThemeMode;\n primaryColor: string;\n backgroundColor: string;\n textColor: string;\n brandName?: string;\n brandLogo?: string;\n greetingMessage: string;\n}\n\nexport interface SessionData {\n sessionId: string;\n startedAt: Date;\n lastActivity: Date;\n}\n\nexport interface ApiResponse<T> {\n success: boolean;\n data: T;\n error?: string;\n}\n\nexport interface ChatResponse {\n message: string;\n context?: any[];\n}\n\nexport interface SessionResponse {\n sessionId: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation Utilities
|
|
3
|
+
* Reusable animation functions for SDK components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Animated, Easing } from 'react-native';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Fade in animation
|
|
10
|
+
*/
|
|
11
|
+
export const fadeIn = (animatedValue, duration = 300, toValue = 1) => {
|
|
12
|
+
return Animated.timing(animatedValue, {
|
|
13
|
+
toValue,
|
|
14
|
+
duration,
|
|
15
|
+
easing: Easing.out(Easing.ease),
|
|
16
|
+
useNativeDriver: true
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fade out animation
|
|
22
|
+
*/
|
|
23
|
+
export const fadeOut = (animatedValue, duration = 300, toValue = 0) => {
|
|
24
|
+
return Animated.timing(animatedValue, {
|
|
25
|
+
toValue,
|
|
26
|
+
duration,
|
|
27
|
+
easing: Easing.in(Easing.ease),
|
|
28
|
+
useNativeDriver: true
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Slide up animation (for messages)
|
|
34
|
+
*/
|
|
35
|
+
export const slideUp = (animatedValue, duration = 300) => {
|
|
36
|
+
return Animated.timing(animatedValue, {
|
|
37
|
+
toValue: 0,
|
|
38
|
+
duration,
|
|
39
|
+
easing: Easing.out(Easing.cubic),
|
|
40
|
+
useNativeDriver: true
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Scale animation (for FAB entrance)
|
|
46
|
+
*/
|
|
47
|
+
export const scaleIn = animatedValue => {
|
|
48
|
+
return Animated.spring(animatedValue, {
|
|
49
|
+
toValue: 1,
|
|
50
|
+
friction: 8,
|
|
51
|
+
tension: 40,
|
|
52
|
+
useNativeDriver: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Pulse animation (for unread badge on FAB)
|
|
58
|
+
*/
|
|
59
|
+
export const pulse = animatedValue => {
|
|
60
|
+
return Animated.loop(Animated.sequence([Animated.timing(animatedValue, {
|
|
61
|
+
toValue: 1.2,
|
|
62
|
+
duration: 500,
|
|
63
|
+
easing: Easing.inOut(Easing.ease),
|
|
64
|
+
useNativeDriver: true
|
|
65
|
+
}), Animated.timing(animatedValue, {
|
|
66
|
+
toValue: 1,
|
|
67
|
+
duration: 500,
|
|
68
|
+
easing: Easing.inOut(Easing.ease),
|
|
69
|
+
useNativeDriver: true
|
|
70
|
+
})]));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Typing indicator animation (for the dots)
|
|
75
|
+
*/
|
|
76
|
+
export const typingDotAnimation = (animatedValue, delay = 0) => {
|
|
77
|
+
return Animated.loop(Animated.sequence([Animated.delay(delay), Animated.timing(animatedValue, {
|
|
78
|
+
toValue: -8,
|
|
79
|
+
duration: 400,
|
|
80
|
+
easing: Easing.inOut(Easing.ease),
|
|
81
|
+
useNativeDriver: true
|
|
82
|
+
}), Animated.timing(animatedValue, {
|
|
83
|
+
toValue: 0,
|
|
84
|
+
duration: 400,
|
|
85
|
+
easing: Easing.inOut(Easing.ease),
|
|
86
|
+
useNativeDriver: true
|
|
87
|
+
})]));
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Message entrance animation (slide up + fade in)
|
|
92
|
+
*/
|
|
93
|
+
export const messageEntrance = (translateY, opacity, duration = 300) => {
|
|
94
|
+
return Animated.parallel([Animated.timing(translateY, {
|
|
95
|
+
toValue: 0,
|
|
96
|
+
duration,
|
|
97
|
+
easing: Easing.out(Easing.cubic),
|
|
98
|
+
useNativeDriver: true
|
|
99
|
+
}), Animated.timing(opacity, {
|
|
100
|
+
toValue: 1,
|
|
101
|
+
duration,
|
|
102
|
+
easing: Easing.out(Easing.ease),
|
|
103
|
+
useNativeDriver: true
|
|
104
|
+
})]);
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=animations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Animated","Easing","fadeIn","animatedValue","duration","toValue","timing","easing","out","ease","useNativeDriver","fadeOut","in","slideUp","cubic","scaleIn","spring","friction","tension","pulse","loop","sequence","inOut","typingDotAnimation","delay","messageEntrance","translateY","opacity","parallel"],"sources":["animations.ts"],"sourcesContent":["/**\n * Animation Utilities\n * Reusable animation functions for SDK components\n */\n\nimport { Animated, Easing } from 'react-native';\n\n/**\n * Fade in animation\n */\nexport const fadeIn = (\n animatedValue: Animated.Value,\n duration: number = 300,\n toValue: number = 1\n): Animated.CompositeAnimation => {\n return Animated.timing(animatedValue, {\n toValue,\n duration,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n });\n};\n\n/**\n * Fade out animation\n */\nexport const fadeOut = (\n animatedValue: Animated.Value,\n duration: number = 300,\n toValue: number = 0\n): Animated.CompositeAnimation => {\n return Animated.timing(animatedValue, {\n toValue,\n duration,\n easing: Easing.in(Easing.ease),\n useNativeDriver: true,\n });\n};\n\n/**\n * Slide up animation (for messages)\n */\nexport const slideUp = (\n animatedValue: Animated.Value,\n duration: number = 300\n): Animated.CompositeAnimation => {\n return Animated.timing(animatedValue, {\n toValue: 0,\n duration,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n });\n};\n\n/**\n * Scale animation (for FAB entrance)\n */\nexport const scaleIn = (\n animatedValue: Animated.Value\n): Animated.CompositeAnimation => {\n return Animated.spring(animatedValue, {\n toValue: 1,\n friction: 8,\n tension: 40,\n useNativeDriver: true,\n });\n};\n\n/**\n * Pulse animation (for unread badge on FAB)\n */\nexport const pulse = (\n animatedValue: Animated.Value\n): Animated.CompositeAnimation => {\n return Animated.loop(\n Animated.sequence([\n Animated.timing(animatedValue, {\n toValue: 1.2,\n duration: 500,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(animatedValue, {\n toValue: 1,\n duration: 500,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ])\n );\n};\n\n/**\n * Typing indicator animation (for the dots)\n */\nexport const typingDotAnimation = (\n animatedValue: Animated.Value,\n delay: number = 0\n): Animated.CompositeAnimation => {\n return Animated.loop(\n Animated.sequence([\n Animated.delay(delay),\n Animated.timing(animatedValue, {\n toValue: -8,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(animatedValue, {\n toValue: 0,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ])\n );\n};\n\n/**\n * Message entrance animation (slide up + fade in)\n */\nexport const messageEntrance = (\n translateY: Animated.Value,\n opacity: Animated.Value,\n duration: number = 300\n): Animated.CompositeAnimation => {\n return Animated.parallel([\n Animated.timing(translateY, {\n toValue: 0,\n duration,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }),\n Animated.timing(opacity, {\n toValue: 1,\n duration,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n }),\n ]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,cAAc;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAGA,CACnBC,aAA6B,EAC7BC,QAAgB,GAAG,GAAG,EACtBC,OAAe,GAAG,CAAC,KACY;EAC/B,OAAOL,QAAQ,CAACM,MAAM,CAACH,aAAa,EAAE;IACnCE,OAAO;IACPD,QAAQ;IACRG,MAAM,EAAEN,MAAM,CAACO,GAAG,CAACP,MAAM,CAACQ,IAAI,CAAC;IAC/BC,eAAe,EAAE;EACpB,CAAC,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CACpBR,aAA6B,EAC7BC,QAAgB,GAAG,GAAG,EACtBC,OAAe,GAAG,CAAC,KACY;EAC/B,OAAOL,QAAQ,CAACM,MAAM,CAACH,aAAa,EAAE;IACnCE,OAAO;IACPD,QAAQ;IACRG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,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting Utilities
|
|
3
|
+
* Helper functions for formatting data in the SDK
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Format a date to relative time (e.g., "just now", "2m ago", "1h ago")
|
|
8
|
+
*/
|
|
9
|
+
export const formatRelativeTime = date => {
|
|
10
|
+
const now = new Date();
|
|
11
|
+
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
12
|
+
if (diffInSeconds < 10) {
|
|
13
|
+
return 'just now';
|
|
14
|
+
}
|
|
15
|
+
if (diffInSeconds < 60) {
|
|
16
|
+
return `${diffInSeconds}s ago`;
|
|
17
|
+
}
|
|
18
|
+
const diffInMinutes = Math.floor(diffInSeconds / 60);
|
|
19
|
+
if (diffInMinutes < 60) {
|
|
20
|
+
return `${diffInMinutes}m ago`;
|
|
21
|
+
}
|
|
22
|
+
const diffInHours = Math.floor(diffInMinutes / 60);
|
|
23
|
+
if (diffInHours < 24) {
|
|
24
|
+
return `${diffInHours}h ago`;
|
|
25
|
+
}
|
|
26
|
+
const diffInDays = Math.floor(diffInHours / 24);
|
|
27
|
+
if (diffInDays < 7) {
|
|
28
|
+
return `${diffInDays}d ago`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// For dates older than a week, show the actual date
|
|
32
|
+
return date.toLocaleDateString();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Format time for display (e.g., "2:30 PM")
|
|
37
|
+
*/
|
|
38
|
+
export const formatTime = date => {
|
|
39
|
+
return date.toLocaleTimeString([], {
|
|
40
|
+
hour: '2-digit',
|
|
41
|
+
minute: '2-digit'
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Truncate text with ellipsis
|
|
47
|
+
*/
|
|
48
|
+
export const truncate = (text, maxLength) => {
|
|
49
|
+
if (text.length <= maxLength) {
|
|
50
|
+
return text;
|
|
51
|
+
}
|
|
52
|
+
return text.substring(0, maxLength - 3) + '...';
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Check if a color is light or dark (for text contrast)
|
|
57
|
+
*/
|
|
58
|
+
export const isLightColor = color => {
|
|
59
|
+
// Remove # if present
|
|
60
|
+
const hex = color.replace('#', '');
|
|
61
|
+
|
|
62
|
+
// Convert to RGB
|
|
63
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
64
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
65
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
66
|
+
|
|
67
|
+
// Calculate luminance
|
|
68
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
69
|
+
return luminance > 0.5;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get contrasting text color for a background
|
|
74
|
+
*/
|
|
75
|
+
export const getContrastingColor = backgroundColor => {
|
|
76
|
+
return isLightColor(backgroundColor) ? '#000000' : '#ffffff';
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["formatRelativeTime","date","now","Date","diffInSeconds","Math","floor","getTime","diffInMinutes","diffInHours","diffInDays","toLocaleDateString","formatTime","toLocaleTimeString","hour","minute","truncate","text","maxLength","length","substring","isLightColor","color","hex","replace","r","parseInt","g","b","luminance","getContrastingColor","backgroundColor"],"sources":["formatters.ts"],"sourcesContent":["/**\n * Formatting Utilities\n * Helper functions for formatting data in the SDK\n */\n\n/**\n * Format a date to relative time (e.g., \"just now\", \"2m ago\", \"1h ago\")\n */\nexport const formatRelativeTime = (date: Date): string => {\n const now = new Date();\n const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (diffInSeconds < 10) {\n return 'just now';\n }\n\n if (diffInSeconds < 60) {\n return `${diffInSeconds}s ago`;\n }\n\n const diffInMinutes = Math.floor(diffInSeconds / 60);\n if (diffInMinutes < 60) {\n return `${diffInMinutes}m ago`;\n }\n\n const diffInHours = Math.floor(diffInMinutes / 60);\n if (diffInHours < 24) {\n return `${diffInHours}h ago`;\n }\n\n const diffInDays = Math.floor(diffInHours / 24);\n if (diffInDays < 7) {\n return `${diffInDays}d ago`;\n }\n\n // For dates older than a week, show the actual date\n return date.toLocaleDateString();\n};\n\n/**\n * Format time for display (e.g., \"2:30 PM\")\n */\nexport const formatTime = (date: Date): string => {\n return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n};\n\n/**\n * Truncate text with ellipsis\n */\nexport const truncate = (text: string, maxLength: number): string => {\n if (text.length <= maxLength) {\n return text;\n }\n return text.substring(0, maxLength - 3) + '...';\n};\n\n/**\n * Check if a color is light or dark (for text contrast)\n */\nexport const isLightColor = (color: string): boolean => {\n // Remove # if present\n const hex = color.replace('#', '');\n\n // Convert to RGB\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n\n // Calculate luminance\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n\n return luminance > 0.5;\n};\n\n/**\n * Get contrasting text color for a background\n */\nexport const getContrastingColor = (backgroundColor: string): string => {\n return isLightColor(backgroundColor) ? '#000000' : '#ffffff';\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,GAAIC,IAAU,IAAa;EACvD,MAAMC,GAAG,GAAG,IAAIC,IAAI,CAAC,CAAC;EACtB,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAAC,CAACJ,GAAG,CAACK,OAAO,CAAC,CAAC,GAAGN,IAAI,CAACM,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC;EAEzE,IAAIH,aAAa,GAAG,EAAE,EAAE;IACrB,OAAO,UAAU;EACpB;EAEA,IAAIA,aAAa,GAAG,EAAE,EA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,EAAE,CAAC;EAC3C,MAAMO,CAAC,GAAGD,QAAQ,CAACH,GAAG,CAACH,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;EAC3C,MAAMQ,CAAC,GAAGF,QAAQ,CAACH,GAAG,CAACH,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;;EAE3C;EACA,MAAMS,SAAS,GAAG,CAAC,KAAK,GAAGJ,CAAC,GAAG,KAAK,GAAGE,CAAC,GAAG,KAAK,GAAGC,CAAC,IAAI,GAAG;EAE3D,OAAOC,SAAS,GAAG,GAAG;AACzB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIC,eAAuB,IAAa;EACrE,OAAOV,YAAY,CAACU,eAAe,CAAC,GAAG,SAAS,GAAG,SAAS;AAC/D,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["/**\n * Utilities exports\n */\n\nexport * from './animations';\nexport * from './formatters';\n"],"mappings":"AAAA;AACA;AACA;;AAEA,cAAc,cAAc;AAC5B,cAAc,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LinguChat Component
|
|
3
|
+
* Full-page chat interface with back navigation
|
|
4
|
+
* Now with theme support and improved styling
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { LinguConfig, ChatPosition } from '../types';
|
|
8
|
+
export interface LinguChatProps extends LinguConfig {
|
|
9
|
+
onBackPress?: () => void;
|
|
10
|
+
showBackButton?: boolean;
|
|
11
|
+
position?: ChatPosition;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* LinguChat - Main exported component
|
|
15
|
+
* Wraps everything in LinguProvider for standalone state management
|
|
16
|
+
*/
|
|
17
|
+
export declare const LinguChat: React.FC<LinguChatProps>;
|
|
18
|
+
//# sourceMappingURL=LinguChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinguChat.d.ts","sourceRoot":"","sources":["../../../src/components/LinguChat.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAa3D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,cAAe,SAAQ,WAAW;IAChD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;CAC1B;AAmMD;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAiB9C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LinguWebView Component
|
|
3
|
+
* Wraps the existing web widget in a WebView with native bridge
|
|
4
|
+
* Now with comprehensive logging and message display
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { Message, WidgetConfig } from '../types';
|
|
8
|
+
interface LinguWebViewProps {
|
|
9
|
+
config: WidgetConfig | null;
|
|
10
|
+
messages: Message[];
|
|
11
|
+
onSendMessage: (message: string) => void;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const LinguWebView: React.FC<LinguWebViewProps>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=LinguWebView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinguWebView.d.ts","sourceRoot":"","sources":["../../../src/components/LinguWebView.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAItD,UAAU,iBAAiB;IACzB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4LpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Bubble Component
|
|
3
|
+
* Displays a single message with animations and styling
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { Message } from '../types';
|
|
7
|
+
interface MessageBubbleProps {
|
|
8
|
+
message: Message;
|
|
9
|
+
showTimestamp?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const MessageBubble: React.FC<MessageBubbleProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=MessageBubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,kBAAkB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkFtD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native Chat UI Component
|
|
3
|
+
* Pure React Native implementation without WebView
|
|
4
|
+
* Now with theme support and enhanced styling
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { Message, WidgetConfig } from '../types';
|
|
8
|
+
interface NativeChatUIProps {
|
|
9
|
+
config: WidgetConfig | null;
|
|
10
|
+
messages: Message[];
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
onSendMessage: (message: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const NativeChatUI: React.FC<NativeChatUIProps>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=NativeChatUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeChatUI.d.ts","sourceRoot":"","sources":["../../../src/components/NativeChatUI.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAc3D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAItD,UAAU,iBAAiB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuKpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/TypingIndicator.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAmDnC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lingu SDK Context Provider
|
|
3
|
+
* Provides standalone state management for the SDK
|
|
4
|
+
* Completely isolated from host application state
|
|
5
|
+
*/
|
|
6
|
+
import React, { ReactNode } from 'react';
|
|
7
|
+
import type { Message, WidgetConfig, LinguConfig } from '../types';
|
|
8
|
+
interface LinguContextValue {
|
|
9
|
+
messages: Message[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
config: WidgetConfig | null;
|
|
12
|
+
sendMessage: (text: string) => Promise<void>;
|
|
13
|
+
startSession: () => Promise<void>;
|
|
14
|
+
endSession: () => Promise<void>;
|
|
15
|
+
isSessionActive: boolean;
|
|
16
|
+
clearHistory: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
interface LinguProviderProps extends LinguConfig {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* LinguProvider - Wraps the SDK with standalone state management
|
|
23
|
+
* This ensures the SDK state is completely isolated from the host app
|
|
24
|
+
*/
|
|
25
|
+
export declare const LinguProvider: React.FC<LinguProviderProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Hook to access Lingu SDK context
|
|
28
|
+
* Must be used within a LinguProvider
|
|
29
|
+
*/
|
|
30
|
+
export declare const useLinguContext: () => LinguContextValue;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=LinguProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinguProvider.d.ts","sourceRoot":"","sources":["../../../src/context/LinguProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnE,UAAU,iBAAiB;IACxB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAID,UAAU,kBAAmB,SAAQ,WAAW;IAC7C,QAAQ,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAQtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,iBAMlC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for managing Lingu chat state and operations
|
|
3
|
+
* Now with message persistence and comprehensive logging
|
|
4
|
+
*/
|
|
5
|
+
import type { Message, WidgetConfig, LinguConfig } from '../types';
|
|
6
|
+
interface UseLinguChatReturn {
|
|
7
|
+
messages: Message[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
config: WidgetConfig | null;
|
|
10
|
+
sendMessage: (text: string) => Promise<void>;
|
|
11
|
+
startSession: () => Promise<void>;
|
|
12
|
+
endSession: () => Promise<void>;
|
|
13
|
+
isSessionActive: boolean;
|
|
14
|
+
clearHistory: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const useLinguChat: (linguConfig: LinguConfig) => UseLinguChatReturn;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useLinguChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinguChat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLinguChat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAInE,UAAU,kBAAkB;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,gBAAiB,WAAW,KAAG,kBAiSvD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lingu React Native SDK
|
|
3
|
+
* Standalone AI chat SDK with native UI and theme support
|
|
4
|
+
*/
|
|
5
|
+
export { LinguChat } from './components/LinguChat';
|
|
6
|
+
export { NativeChatUI } from './components/NativeChatUI';
|
|
7
|
+
export { LinguWebView } from './components/LinguWebView';
|
|
8
|
+
export { MessageBubble } from './components/MessageBubble';
|
|
9
|
+
export { TypingIndicator } from './components/TypingIndicator';
|
|
10
|
+
export { LinguProvider, useLinguContext } from './context';
|
|
11
|
+
export { ThemeProvider, useTheme, createTheme } from './theme';
|
|
12
|
+
export type { Theme, ThemeColors } from './theme';
|
|
13
|
+
export { useLinguChat } from './hooks/useLinguChat';
|
|
14
|
+
export { LinguAPI } from './services/LinguAPI';
|
|
15
|
+
export { SessionManager } from './services/SessionManager';
|
|
16
|
+
export { StorageManager } from './services/StorageManager';
|
|
17
|
+
export * from './utils';
|
|
18
|
+
export type { LinguConfig, ChatPosition, ThemeMode, Message, MessageSender, WidgetConfig, SessionData, ApiResponse, ChatResponse, SessionResponse, } from './types';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,cAAc,SAAS,CAAC;AAGxB,YAAY,EACT,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lingu API Client
|
|
3
|
+
* Handles all communication with the Lingu backend API
|
|
4
|
+
* Now with comprehensive logging
|
|
5
|
+
*/
|
|
6
|
+
import type { WidgetConfig } from '../types';
|
|
7
|
+
export declare class LinguAPI {
|
|
8
|
+
private client;
|
|
9
|
+
private apiKey;
|
|
10
|
+
private sessionId;
|
|
11
|
+
constructor(apiKey: string, baseURL?: string);
|
|
12
|
+
/**
|
|
13
|
+
* Get widget configuration from the API
|
|
14
|
+
*/
|
|
15
|
+
getConfig(): Promise<WidgetConfig>;
|
|
16
|
+
/**
|
|
17
|
+
* Start a new chat session
|
|
18
|
+
* Note: Backend manages sessions automatically, we just generate a client-side ID
|
|
19
|
+
*/
|
|
20
|
+
startSession(): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Send a message to the AI
|
|
23
|
+
*/
|
|
24
|
+
sendMessage(message: string, sessionId: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* End the current chat session
|
|
27
|
+
* Note: Backend doesn't have explicit session end, sessions timeout automatically
|
|
28
|
+
*/
|
|
29
|
+
endSession(sessionId: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Send heartbeat to keep session alive
|
|
32
|
+
*/
|
|
33
|
+
sendHeartbeat(sessionId: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the current session ID
|
|
36
|
+
*/
|
|
37
|
+
getSessionId(): string | null;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=LinguAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinguAPI.d.ts","sourceRoot":"","sources":["../../../src/services/LinguAPI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACT,YAAY,EAGd,MAAM,UAAU,CAAC;AAIlB,qBAAa,QAAQ;IAClB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAuB;gBAE5B,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAuC;IAiE5E;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IA0BxC;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAiBrC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCtE;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBrD;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;CAI/B"}
|