@revrag-ai/embed-react-native 1.0.16 → 1.0.17
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 +6 -108
- package/dist/commonjs/api/api.js +6 -5
- package/dist/commonjs/api/api.js.map +1 -1
- package/dist/commonjs/components/Embed/EmbedButton.js +138 -345
- package/dist/commonjs/components/Embed/EmbedButton.js.map +1 -1
- package/dist/commonjs/components/Embed/EmbedVoice.js +16 -4
- package/dist/commonjs/components/Embed/EmbedVoice.js.map +1 -1
- package/dist/commonjs/context/EmbedProvider.js +638 -0
- package/dist/commonjs/context/EmbedProvider.js.map +1 -0
- package/dist/commonjs/events/embed.event.js +141 -54
- package/dist/commonjs/events/embed.event.js.map +1 -1
- package/dist/commonjs/hooks/EmbedButton.animations.js +181 -0
- package/dist/commonjs/hooks/EmbedButton.animations.js.map +1 -0
- package/dist/commonjs/hooks/EmbedButton.helpers.js +90 -0
- package/dist/commonjs/hooks/EmbedButton.helpers.js.map +1 -0
- package/dist/commonjs/hooks/EmbedButton.hooks.js +165 -0
- package/dist/commonjs/hooks/EmbedButton.hooks.js.map +1 -0
- package/dist/commonjs/hooks/initialize.js +65 -25
- package/dist/commonjs/hooks/initialize.js.map +1 -1
- package/dist/commonjs/hooks/voiceagent.js +1 -18
- package/dist/commonjs/hooks/voiceagent.js.map +1 -1
- package/dist/commonjs/index.js +16 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/index.types.js +1 -2
- package/dist/commonjs/index.types.js.map +1 -1
- package/dist/commonjs/utils/constant.js +88 -0
- package/dist/commonjs/utils/constant.js.map +1 -0
- package/dist/commonjs/utils/reanimated.helper.js +2 -3
- package/dist/commonjs/utils/reanimated.helper.js.map +1 -1
- package/dist/module/api/api.js +6 -6
- package/dist/module/api/api.js.map +1 -1
- package/dist/module/components/Embed/EmbedButton.js +140 -347
- package/dist/module/components/Embed/EmbedButton.js.map +1 -1
- package/dist/module/components/Embed/EmbedVoice.js +16 -4
- package/dist/module/components/Embed/EmbedVoice.js.map +1 -1
- package/dist/module/context/EmbedProvider.js +626 -0
- package/dist/module/context/EmbedProvider.js.map +1 -0
- package/dist/module/events/embed.event.js +143 -53
- package/dist/module/events/embed.event.js.map +1 -1
- package/dist/module/hooks/EmbedButton.animations.js +172 -0
- package/dist/module/hooks/EmbedButton.animations.js.map +1 -0
- package/dist/module/hooks/EmbedButton.helpers.js +80 -0
- package/dist/module/hooks/EmbedButton.helpers.js.map +1 -0
- package/dist/module/hooks/EmbedButton.hooks.js +160 -0
- package/dist/module/hooks/EmbedButton.hooks.js.map +1 -0
- package/dist/module/hooks/initialize.js +66 -26
- package/dist/module/hooks/initialize.js.map +1 -1
- package/dist/module/hooks/voiceagent.js +1 -17
- package/dist/module/hooks/voiceagent.js.map +1 -1
- package/dist/module/index.js +4 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/index.types.js +1 -2
- package/dist/module/index.types.js.map +1 -1
- package/dist/module/utils/constant.js +82 -0
- package/dist/module/utils/constant.js.map +1 -0
- package/dist/module/utils/reanimated.helper.js +2 -3
- package/dist/module/utils/reanimated.helper.js.map +1 -1
- package/dist/typescript/src/api/api.d.ts +4 -3
- package/dist/typescript/src/api/api.d.ts.map +1 -1
- package/dist/typescript/src/api/types/embed.api.types.d.ts +1 -1
- package/dist/typescript/src/api/types/embed.api.types.d.ts.map +1 -1
- package/dist/typescript/src/components/Embed/EmbedButton.d.ts +5 -25
- package/dist/typescript/src/components/Embed/EmbedButton.d.ts.map +1 -1
- package/dist/typescript/src/components/Embed/EmbedVoice.d.ts.map +1 -1
- package/dist/typescript/src/context/EmbedProvider.d.ts +306 -0
- package/dist/typescript/src/context/EmbedProvider.d.ts.map +1 -0
- package/dist/typescript/src/events/embed.event.d.ts +74 -10
- package/dist/typescript/src/events/embed.event.d.ts.map +1 -1
- package/dist/typescript/src/hooks/EmbedButton.animations.d.ts +38 -0
- package/dist/typescript/src/hooks/EmbedButton.animations.d.ts.map +1 -0
- package/dist/typescript/src/hooks/EmbedButton.helpers.d.ts +49 -0
- package/dist/typescript/src/hooks/EmbedButton.helpers.d.ts.map +1 -0
- package/dist/typescript/src/hooks/EmbedButton.hooks.d.ts +49 -0
- package/dist/typescript/src/hooks/EmbedButton.hooks.d.ts.map +1 -0
- package/dist/typescript/src/hooks/initialize.d.ts.map +1 -1
- package/dist/typescript/src/hooks/types/initialize.types.d.ts +1 -1
- package/dist/typescript/src/hooks/types/initialize.types.d.ts.map +1 -1
- package/dist/typescript/src/hooks/voiceagent.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts +10 -4
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/index.types.d.ts +2 -3
- package/dist/typescript/src/index.types.d.ts.map +1 -1
- package/dist/typescript/src/utils/constant.d.ts +45 -0
- package/dist/typescript/src/utils/constant.d.ts.map +1 -0
- package/dist/typescript/src/utils/reanimated.helper.d.ts.map +1 -1
- package/package.json +6 -3
- package/react-native.config.js +1 -0
- package/dist/commonjs/events/eventEmitter.js +0 -43
- package/dist/commonjs/events/eventEmitter.js.map +0 -1
- package/dist/module/events/eventEmitter.js +0 -39
- package/dist/module/events/eventEmitter.js.map +0 -1
- package/dist/typescript/src/events/eventEmitter.d.ts +0 -9
- package/dist/typescript/src/events/eventEmitter.d.ts.map +0 -1
package/dist/module/api/api.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { getAgentData, setAgentData } from "../store/store.key.js";
|
|
4
4
|
import { processApiError } from "./api.error.js";
|
|
5
|
-
|
|
5
|
+
import { DEFAULT_EMBED_URL } from "../utils/constant.js";
|
|
6
6
|
/**
|
|
7
7
|
* APIService class that ensures proper initialization before API calls
|
|
8
8
|
*/
|
|
@@ -30,12 +30,12 @@ export class APIService {
|
|
|
30
30
|
return; // Already initialized
|
|
31
31
|
}
|
|
32
32
|
const AgentData = await getAgentData();
|
|
33
|
-
if (AgentData
|
|
34
|
-
this.apiBaseUrl = AgentData.embedUrl;
|
|
35
|
-
this.isInitialized = true;
|
|
36
|
-
} else {
|
|
33
|
+
if (!AgentData) {
|
|
37
34
|
throw new Error('API base URL not found in keychain');
|
|
38
35
|
}
|
|
36
|
+
const resolvedEmbedUrl = AgentData.embedUrl && typeof AgentData.embedUrl === 'string' ? AgentData.embedUrl : DEFAULT_EMBED_URL;
|
|
37
|
+
this.apiBaseUrl = resolvedEmbedUrl;
|
|
38
|
+
this.isInitialized = true;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -103,7 +103,7 @@ export class APIService {
|
|
|
103
103
|
method: 'PUT',
|
|
104
104
|
headers,
|
|
105
105
|
body: JSON.stringify({
|
|
106
|
-
[params.
|
|
106
|
+
[params.type]: params.data
|
|
107
107
|
})
|
|
108
108
|
});
|
|
109
109
|
if (!response.ok) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getAgentData","setAgentData","processApiError","APIService","instance","apiBaseUrl","isInitialized","constructor","getInstance","initialize","AgentData","
|
|
1
|
+
{"version":3,"names":["getAgentData","setAgentData","processApiError","DEFAULT_EMBED_URL","APIService","instance","apiBaseUrl","isInitialized","constructor","getInstance","initialize","AgentData","Error","resolvedEmbedUrl","embedUrl","ensureInitialized","getHeaders","apiKey","registerOnInitialize","response","headers","fetch","method","data","json","ok","undefined","success","error","updateUserData","params","app_user_id","body","JSON","stringify","type","getTokenDetails","getPopupDescription","initializeApi","apiService"],"sourceRoot":"../../../src","sources":["api/api.ts"],"mappings":";;AACA,SAASA,YAAY,EAAEC,YAAY,QAAQ,uBAAoB;AAC/D,SAASC,eAAe,QAAQ,gBAAa;AAC7C,SAASC,iBAAiB,QAAQ,sBAAmB;AAGrD;AACA;AACA;AACA,OAAO,MAAMC,UAAU,CAAC;EACtB,OAAeC,QAAQ,GAAsB,IAAI;EACzCC,UAAU,GAAkB,IAAI;EAChCC,aAAa,GAAY,KAAK;EAE9BC,WAAWA,CAAA,EAAG,CAA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AO,MAAMM,eAAe,GAAG,MAAON,MAGrC,IAAK;EACJ,MAAMS,UAAU,GAAGnC,UAAU,CAACK,WAAW,CAAC,CAAC;EAC3C,OAAO,MAAM8B,UAAU,CAACH,eAAe,CAACN,MAAM,CAAC;AACjD,CAAC;AAED,OAAO,MAAMO,mBAAmB,GAAG,MAAOP,MAA+B,IAAK;EAC5E,MAAMS,UAAU,GAAGnC,UAAU,CAACK,WAAW,CAAC,CAAC;EAC3C,OAAO,MAAM8B,UAAU,CAACF,mBAAmB,CAACP,MAAM,CAAC;AACrD,CAAC","ignoreList":[]}
|
|
@@ -1,67 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file
|
|
5
|
-
* @description A customizable floating action button component for
|
|
6
|
-
*
|
|
4
|
+
* @file EmbedButton.tsx
|
|
5
|
+
* @description A customizable floating action button component for voice agent interactions.
|
|
6
|
+
* Features: draggable, expandable, animated, with call controls and auto-trigger support.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import LottieView from 'lottie-react-native';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { useMemo, useRef, useState, useEffect } from 'react';
|
|
11
|
+
import { Image, Text, TouchableOpacity, View } from 'react-native';
|
|
12
|
+
import { GestureDetector } from 'react-native-gesture-handler';
|
|
13
13
|
import LinearGradient from 'react-native-linear-gradient';
|
|
14
14
|
import { useVoiceAgent } from "../../hooks/voiceagent.js";
|
|
15
|
-
import { getAgentData } from "../../store/store.key.js";
|
|
16
15
|
import { createEmbedButtonStyles } from "../styles/EmbedButton.style.js";
|
|
17
|
-
import { getReanimatedAPI, showReanimatedSetupError } from "../../utils/reanimated.helper.js";
|
|
18
16
|
import Voice from "./EmbedVoice.js";
|
|
19
17
|
import { WaveformVisualizer } from "./EmbedAudioWave.js";
|
|
20
|
-
import { checkPermissions } from "../../utils/permision.js";
|
|
21
18
|
import Embed, { AgentEvent } from "../../events/embed.event.js";
|
|
22
19
|
|
|
23
|
-
//
|
|
24
|
-
import {
|
|
25
|
-
const {
|
|
26
|
-
useSharedValue,
|
|
27
|
-
useAnimatedStyle,
|
|
28
|
-
withTiming,
|
|
29
|
-
withSpring,
|
|
30
|
-
withRepeat,
|
|
31
|
-
withSequence,
|
|
32
|
-
runOnJS,
|
|
33
|
-
Easing,
|
|
34
|
-
Animated,
|
|
35
|
-
isAvailable: isReanimatedAvailable
|
|
36
|
-
} = getReanimatedAPI();
|
|
37
|
-
|
|
38
|
-
// Show warning if reanimated is not available
|
|
39
|
-
if (!isReanimatedAvailable) {
|
|
40
|
-
showReanimatedSetupError();
|
|
41
|
-
}
|
|
42
|
-
const {
|
|
43
|
-
width: SCREEN_WIDTH,
|
|
44
|
-
height: SCREEN_HEIGHT
|
|
45
|
-
} = Dimensions.get('window');
|
|
46
|
-
const BUTTON_WIDTH = 60;
|
|
47
|
-
const EXPANDED_WIDTH = SCREEN_WIDTH * 0.9;
|
|
48
|
-
const BUTTON_HEIGHT = 60;
|
|
49
|
-
const GRADIENT_COLORS = ['#1E0844', '#B391F3'];
|
|
20
|
+
// Helpers and constants
|
|
21
|
+
import { BUTTON_DIMENSIONS, DEFAULT_GRADIENT_COLORS, formatDuration, ICON_URLS } from "../../hooks/EmbedButton.helpers.js";
|
|
50
22
|
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
const MIC_OFF_ICON = 'https://revrag-dev.s3.ap-south-1.amazonaws.com/Avatars/unmute.png';
|
|
23
|
+
// Custom hooks
|
|
24
|
+
import { useCallDuration, useCallManagement, useConfigData, useInactivityBehavior } from "../../hooks/EmbedButton.hooks.js";
|
|
54
25
|
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
const AMPLIFY_ANIMATION = 'https://revrag-dev.s3.ap-south-1.amazonaws.com/Avatars/amplify.json';
|
|
26
|
+
// Animation hooks
|
|
27
|
+
import { Animated, createPanGesture, useAnimationValues, useBreathingAnimation, useButtonAnimatedStyles, useButtonAnimations, usePopupAnimatedStyles } from "../../hooks/EmbedButton.animations.js";
|
|
58
28
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*/
|
|
29
|
+
// ==================== STYLES CONFIG ====================
|
|
30
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
62
31
|
const defaultStyles = {
|
|
63
|
-
buttonWidth:
|
|
64
|
-
buttonHeight:
|
|
32
|
+
buttonWidth: BUTTON_DIMENSIONS.WIDTH,
|
|
33
|
+
buttonHeight: BUTTON_DIMENSIONS.HEIGHT,
|
|
65
34
|
borderRadius: 100,
|
|
66
35
|
marginBottom: 20,
|
|
67
36
|
spacing: {
|
|
@@ -74,37 +43,17 @@ const defaultStyles = {
|
|
|
74
43
|
}
|
|
75
44
|
};
|
|
76
45
|
|
|
46
|
+
// ==================== MAIN COMPONENT ====================
|
|
77
47
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* A floating action button that can be dragged around the screen and expanded to show additional content.
|
|
81
|
-
* Features include:
|
|
82
|
-
* - Draggable functionality
|
|
83
|
-
* - Expandable menu
|
|
84
|
-
* - Animated transitions
|
|
85
|
-
* - Gradient background
|
|
86
|
-
* - Customizable styling
|
|
48
|
+
* EmbedButton - Main voice agent floating action button
|
|
87
49
|
*
|
|
88
|
-
* @component
|
|
89
50
|
* @example
|
|
90
51
|
* ```tsx
|
|
91
|
-
* <
|
|
92
|
-
* isOpen={false}
|
|
93
|
-
* onPress={(isOpen) => console.log('Button pressed:', isOpen)}
|
|
94
|
-
* menuComponent={<YourMenuComponent />}
|
|
95
|
-
* />
|
|
52
|
+
* <EmbedButton />
|
|
96
53
|
* ```
|
|
97
54
|
*/
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Generates random sentences for testing or placeholder content
|
|
101
|
-
* @param count - Number of sentences to generate (default: 1)
|
|
102
|
-
* @param minWords - Minimum words per sentence (default: 5)
|
|
103
|
-
* @param maxWords - Maximum words per sentence (default: 15)
|
|
104
|
-
* @returns Array of random sentences
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
55
|
export function EmbedButton() {
|
|
56
|
+
// ==================== VOICE AGENT STATE ====================
|
|
108
57
|
const {
|
|
109
58
|
initializeVoiceAgent,
|
|
110
59
|
tokenDetails,
|
|
@@ -114,305 +63,143 @@ export function EmbedButton() {
|
|
|
114
63
|
muteMic,
|
|
115
64
|
unmuteMic,
|
|
116
65
|
connectionState,
|
|
117
|
-
roomRef
|
|
118
|
-
getPopupDescription
|
|
66
|
+
roomRef
|
|
119
67
|
} = useVoiceAgent();
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const [popupDescription, setPopupDescription] = useState('');
|
|
68
|
+
|
|
69
|
+
// ==================== LOCAL STATE ====================
|
|
123
70
|
const [isOpen, setIsOpen] = useState(false);
|
|
124
|
-
const [callDuration, setCallDuration] = useState(0);
|
|
125
|
-
const timerRef = useRef(null);
|
|
126
71
|
const lottieRef = useRef(null);
|
|
72
|
+
const styles = useMemo(() => createEmbedButtonStyles(defaultStyles), []);
|
|
127
73
|
|
|
128
|
-
//
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
74
|
+
// ==================== CUSTOM HOOKS ====================
|
|
75
|
+
const configData = useConfigData();
|
|
76
|
+
const {
|
|
77
|
+
callDuration,
|
|
78
|
+
resetDuration
|
|
79
|
+
} = useCallDuration(connectionState);
|
|
80
|
+
const {
|
|
81
|
+
handleStartCall,
|
|
82
|
+
handleEndCall,
|
|
83
|
+
handleMicToggle
|
|
84
|
+
} = useCallManagement({
|
|
85
|
+
initializeVoiceAgent,
|
|
86
|
+
endCall,
|
|
87
|
+
muteMic,
|
|
88
|
+
unmuteMic,
|
|
89
|
+
isMicMuted,
|
|
90
|
+
resetDuration,
|
|
91
|
+
setIsOpen
|
|
137
92
|
});
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
93
|
+
const {
|
|
94
|
+
isAutoOpen,
|
|
95
|
+
setIsAutoOpen
|
|
96
|
+
} = useInactivityBehavior({
|
|
97
|
+
configData,
|
|
98
|
+
isOpen,
|
|
99
|
+
isLoading,
|
|
100
|
+
hasActiveToken: !!tokenDetails?.token,
|
|
101
|
+
onStartCall: handleStartCall
|
|
141
102
|
});
|
|
142
|
-
const menuAnimation = useSharedValue(0);
|
|
143
|
-
const buttonWidth = useSharedValue(BUTTON_WIDTH);
|
|
144
|
-
const buttonScale = useSharedValue(1);
|
|
145
|
-
// Styles
|
|
146
|
-
const styles = createEmbedButtonStyles(defaultStyles);
|
|
147
|
-
const [isAutoOpen, setIsAutoOpen] = useState(false);
|
|
148
103
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Update previous state refs
|
|
167
|
-
previousIsOpenRef.current = isOpen;
|
|
168
|
-
previousIsAutoOpenRef.current = isAutoOpen;
|
|
169
|
-
}, [isOpen, isAutoOpen]);
|
|
170
|
-
useEffect(() => {
|
|
171
|
-
const autoOpenTimer = setTimeout(async () => {
|
|
172
|
-
if (!isOpen) {
|
|
173
|
-
const response = await getPopupDescription();
|
|
174
|
-
if (response) {
|
|
175
|
-
setPopupDescription(response);
|
|
176
|
-
setIsAutoOpen(true);
|
|
177
|
-
} else {
|
|
178
|
-
// todo: handle no popup description found
|
|
179
|
-
console.warn('No popup description found');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, 15000); // 15 seconds
|
|
183
|
-
|
|
184
|
-
return () => {
|
|
185
|
-
clearTimeout(autoOpenTimer);
|
|
186
|
-
};
|
|
187
|
-
}, [isOpen]);
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Fetch agent configuration data
|
|
191
|
-
*/
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
const fetchAgentData = async () => {
|
|
194
|
-
try {
|
|
195
|
-
const data = await getAgentData('@config_data');
|
|
196
|
-
setConfigData(data?.ui_config);
|
|
197
|
-
} catch (error) {
|
|
198
|
-
// todo: handle error fetching agent data
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
fetchAgentData();
|
|
202
|
-
}, []);
|
|
104
|
+
// ==================== ANIMATIONS ====================
|
|
105
|
+
const animationValues = useAnimationValues();
|
|
106
|
+
const {
|
|
107
|
+
isPressed,
|
|
108
|
+
offset,
|
|
109
|
+
start,
|
|
110
|
+
menuAnimation,
|
|
111
|
+
buttonWidth,
|
|
112
|
+
buttonScale
|
|
113
|
+
} = animationValues;
|
|
114
|
+
useButtonAnimations(isOpen, menuAnimation, buttonWidth);
|
|
115
|
+
useBreathingAnimation(isOpen, isAutoOpen, buttonScale);
|
|
116
|
+
const buttonAnimatedStyles = useButtonAnimatedStyles(isOpen, offset, buttonWidth, isPressed, buttonScale);
|
|
117
|
+
const popupAnimatedStyles = usePopupAnimatedStyles(offset, isPressed);
|
|
118
|
+
const panGesture = useMemo(() => createPanGesture(isPressed, offset, start, isOpen, setIsAutoOpen), [isPressed, offset, start, isOpen, setIsAutoOpen]);
|
|
203
119
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
*/
|
|
120
|
+
// ==================== AGENT EVENT EMISSIONS ====================
|
|
121
|
+
// Emit agent connected/disconnected events based on connection state
|
|
207
122
|
useEffect(() => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
timerRef.current = null;
|
|
123
|
+
const emitConnectionEvent = async () => {
|
|
124
|
+
if (connectionState === 'connected') {
|
|
125
|
+
await Embed.event.emit(AgentEvent.AGENT_CONNECTED, {
|
|
126
|
+
timestamp: new Date().toISOString(),
|
|
127
|
+
metadata: {
|
|
128
|
+
callDuration: 0
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
} else if (connectionState === 'disconnected' && callDuration > 0) {
|
|
132
|
+
// Only emit disconnected if we were previously connected
|
|
133
|
+
await Embed.event.emit(AgentEvent.AGENT_DISCONNECTED, {
|
|
134
|
+
timestamp: new Date().toISOString(),
|
|
135
|
+
metadata: {
|
|
136
|
+
callDuration
|
|
137
|
+
}
|
|
138
|
+
});
|
|
225
139
|
}
|
|
226
140
|
};
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Handle menu animation and button width transitions
|
|
231
|
-
*/
|
|
232
|
-
useEffect(() => {
|
|
233
|
-
menuAnimation.value = withTiming(isOpen ? 0.8 : 0, {
|
|
234
|
-
duration: 300
|
|
141
|
+
emitConnectionEvent().catch(error => {
|
|
142
|
+
console.error('Error emitting connection event:', error);
|
|
235
143
|
});
|
|
236
|
-
|
|
237
|
-
}, [isOpen, menuAnimation, buttonWidth]);
|
|
144
|
+
}, [connectionState, callDuration]);
|
|
238
145
|
|
|
239
|
-
//
|
|
146
|
+
// Emit popup visibility events when isAutoOpen changes
|
|
240
147
|
useEffect(() => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}), withTiming(1, {
|
|
248
|
-
duration: 1500,
|
|
249
|
-
// Reduced from 1000ms to 600ms
|
|
250
|
-
easing: Easing.inOut(Easing.ease)
|
|
251
|
-
})), -1,
|
|
252
|
-
// Infinite repeat
|
|
253
|
-
false // Don't reverse
|
|
254
|
-
);
|
|
255
|
-
} else {
|
|
256
|
-
// Reset animation
|
|
257
|
-
buttonScale.value = withTiming(1, {
|
|
258
|
-
duration: 300
|
|
148
|
+
const emitPopupEvent = async () => {
|
|
149
|
+
await Embed.event.emit(AgentEvent.POPUP_MESSAGE_VISIBLE, {
|
|
150
|
+
value: isAutoOpen,
|
|
151
|
+
metadata: {
|
|
152
|
+
trigger: isAutoOpen ? 'auto_inactivity' : 'manual_dismiss'
|
|
153
|
+
}
|
|
259
154
|
});
|
|
260
|
-
}
|
|
261
|
-
}, [isOpen, isAutoOpen]);
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Animated styles for the button
|
|
265
|
-
*/
|
|
266
|
-
const animatedStyles = useAnimatedStyle(() => {
|
|
267
|
-
const maxX = SCREEN_WIDTH - (isOpen ? EXPANDED_WIDTH : BUTTON_WIDTH) - 35;
|
|
268
|
-
const clampedX = Math.min(Math.max(offset.value.x, -maxX), 0);
|
|
269
|
-
return {
|
|
270
|
-
width: buttonWidth.value,
|
|
271
|
-
height: BUTTON_HEIGHT,
|
|
272
|
-
transform: [{
|
|
273
|
-
translateX: clampedX
|
|
274
|
-
}, {
|
|
275
|
-
translateY: offset.value.y
|
|
276
|
-
}, {
|
|
277
|
-
scale: withSpring(isPressed.value ? 0.95 : buttonScale.value)
|
|
278
|
-
}],
|
|
279
|
-
justifyContent: isOpen ? 'space-between' : 'flex-start',
|
|
280
|
-
overflow: 'hidden'
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Animated styles for the text
|
|
286
|
-
*/
|
|
287
|
-
const animatedTextStyles = useAnimatedStyle(() => {
|
|
288
|
-
const maxX = SCREEN_WIDTH;
|
|
289
|
-
const clampedX = Math.min(Math.max(offset.value.x, -maxX), 0);
|
|
290
|
-
return {
|
|
291
|
-
transform: [{
|
|
292
|
-
translateX: clampedX
|
|
293
|
-
}, {
|
|
294
|
-
translateY: offset.value.y
|
|
295
|
-
}, {
|
|
296
|
-
scale: withSpring(isPressed.value ? 1 : 1)
|
|
297
|
-
}]
|
|
298
|
-
};
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Pan gesture handler for drag functionality
|
|
303
|
-
*/
|
|
304
|
-
const gesture = Gesture.Pan().onBegin(() => {
|
|
305
|
-
isPressed.value = true;
|
|
306
|
-
if (isAutoOpen) {
|
|
307
|
-
runOnJS(setIsAutoOpen)(false);
|
|
308
|
-
}
|
|
309
|
-
}).onUpdate(e => {
|
|
310
|
-
const maxX = SCREEN_WIDTH - (isOpen ? EXPANDED_WIDTH : BUTTON_WIDTH) - 0;
|
|
311
|
-
const newX = Math.min(Math.max(e.translationX + start.value.x, -maxX), 0);
|
|
312
|
-
const maxY = SCREEN_HEIGHT - 150;
|
|
313
|
-
const newY = Math.min(Math.max(e.translationY + start.value.y, -maxY), 0);
|
|
314
|
-
offset.value = {
|
|
315
|
-
x: newX,
|
|
316
|
-
y: newY
|
|
317
155
|
};
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
323
|
-
}).onFinalize(() => {
|
|
324
|
-
isPressed.value = false;
|
|
325
|
-
});
|
|
156
|
+
emitPopupEvent().catch(error => {
|
|
157
|
+
console.error('Error emitting popup visibility event:', error);
|
|
158
|
+
});
|
|
159
|
+
}, [isAutoOpen]);
|
|
326
160
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
*/
|
|
330
|
-
const handlePress = () => {
|
|
161
|
+
// ==================== HANDLERS ====================
|
|
162
|
+
const handleButtonPress = () => {
|
|
331
163
|
setIsOpen(!isOpen);
|
|
332
164
|
setIsAutoOpen(false);
|
|
333
165
|
};
|
|
334
|
-
const handleStartCall = async () => {
|
|
335
|
-
await checkPermissions();
|
|
336
|
-
setCallDuration(0);
|
|
337
|
-
await initializeVoiceAgent();
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Render the button icon/animation
|
|
342
|
-
*/
|
|
343
|
-
|
|
344
|
-
const remoteSource = useMemo(() => ({
|
|
345
|
-
uri: configData?.icon_animation || AMPLIFY_ANIMATION
|
|
346
|
-
}), [configData?.icon_animation]);
|
|
347
|
-
const renderIcon = () => {
|
|
348
|
-
// When isAutoOpen is true, we don't play the Lottie animation
|
|
349
|
-
return /*#__PURE__*/_jsx(View, {
|
|
350
|
-
children: /*#__PURE__*/_jsx(LottieView, {
|
|
351
|
-
ref: lottieRef,
|
|
352
|
-
source: remoteSource,
|
|
353
|
-
autoPlay: true,
|
|
354
|
-
loop: true,
|
|
355
|
-
style: styles.iconImage,
|
|
356
|
-
enableMergePathsAndroidForKitKatAndAbove: true,
|
|
357
|
-
enableSafeModeAndroid: true
|
|
358
|
-
})
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
166
|
const handleConnected = () => {
|
|
362
|
-
//
|
|
363
|
-
};
|
|
364
|
-
const handleEndCall = async () => {
|
|
365
|
-
setIsOpen(false);
|
|
366
|
-
if (timerRef.current) {
|
|
367
|
-
clearInterval(timerRef.current);
|
|
368
|
-
timerRef.current = null;
|
|
369
|
-
}
|
|
370
|
-
setCallDuration(0);
|
|
371
|
-
await endCall();
|
|
372
|
-
};
|
|
373
|
-
const handleMicToggle = () => {
|
|
374
|
-
if (isMicMuted) {
|
|
375
|
-
unmuteMic();
|
|
376
|
-
} else {
|
|
377
|
-
muteMic();
|
|
378
|
-
}
|
|
167
|
+
// Hook for handling successful connection
|
|
379
168
|
};
|
|
380
169
|
|
|
381
|
-
//
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
170
|
+
// ==================== COMPUTED VALUES ====================
|
|
171
|
+
const lottieSource = useMemo(() => ({
|
|
172
|
+
uri: configData?.icon_animation || ICON_URLS.AMPLIFY_ANIMATION
|
|
173
|
+
}), [configData?.icon_animation]);
|
|
174
|
+
const statusText = useMemo(() => {
|
|
175
|
+
if (isLoading) return 'Connecting...';
|
|
176
|
+
if (tokenDetails?.token) return formatDuration(callDuration);
|
|
177
|
+
return configData?.agent_type || 'Onboarding Agent';
|
|
178
|
+
}, [isLoading, tokenDetails?.token, callDuration, configData?.agent_type]);
|
|
179
|
+
const gradientColors = configData?.gradient || DEFAULT_GRADIENT_COLORS;
|
|
180
|
+
const agentName = configData?.agent_name || 'Your AI Agent';
|
|
181
|
+
const popupText = configData?.popup_description || 'Any doubts? Ask agent now';
|
|
182
|
+
const connectButtonText = configData?.connect_button_title || 'Start Call';
|
|
388
183
|
|
|
389
|
-
//
|
|
390
|
-
const getStatusText = () => {
|
|
391
|
-
if (isLoading) {
|
|
392
|
-
return 'Connecting...';
|
|
393
|
-
} else if (tokenDetails?.token) {
|
|
394
|
-
return `${formatDuration(callDuration)}`;
|
|
395
|
-
} else {
|
|
396
|
-
return configData?.agent_type || 'Onboarding Agent';
|
|
397
|
-
}
|
|
398
|
-
};
|
|
184
|
+
// ==================== EARLY RETURNS ====================
|
|
399
185
|
if (!configData) return null;
|
|
186
|
+
|
|
187
|
+
// ==================== RENDER ====================
|
|
400
188
|
return /*#__PURE__*/_jsxs(View, {
|
|
401
189
|
style: styles.container,
|
|
402
190
|
children: [isAutoOpen && !isOpen && /*#__PURE__*/_jsx(Animated.View, {
|
|
403
|
-
style: [
|
|
191
|
+
style: [popupAnimatedStyles, styles.popupContainer],
|
|
404
192
|
children: /*#__PURE__*/_jsx(Text, {
|
|
405
193
|
style: styles.popupText,
|
|
406
|
-
children:
|
|
194
|
+
children: popupText
|
|
407
195
|
})
|
|
408
196
|
}), /*#__PURE__*/_jsx(GestureDetector, {
|
|
409
|
-
gesture:
|
|
197
|
+
gesture: panGesture,
|
|
410
198
|
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}],
|
|
199
|
+
pointerEvents: "auto",
|
|
200
|
+
style: [styles.button, buttonAnimatedStyles, styles.buttonContent],
|
|
414
201
|
children: /*#__PURE__*/_jsxs(LinearGradient, {
|
|
415
|
-
colors:
|
|
202
|
+
colors: gradientColors,
|
|
416
203
|
start: {
|
|
417
204
|
x: 0,
|
|
418
205
|
y: 0
|
|
@@ -428,25 +215,33 @@ export function EmbedButton() {
|
|
|
428
215
|
y: 0.5
|
|
429
216
|
},
|
|
430
217
|
children: [tokenDetails?.token && /*#__PURE__*/_jsx(Voice, {
|
|
431
|
-
url: tokenDetails
|
|
432
|
-
token: tokenDetails
|
|
218
|
+
url: tokenDetails.server_url,
|
|
219
|
+
token: tokenDetails.token,
|
|
433
220
|
onDisconnected: handleEndCall,
|
|
434
221
|
roomRef: roomRef,
|
|
435
222
|
onConnected: handleConnected
|
|
436
223
|
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
437
|
-
onPress:
|
|
224
|
+
onPress: handleButtonPress,
|
|
438
225
|
style: styles.pressable,
|
|
439
|
-
children:
|
|
226
|
+
children: /*#__PURE__*/_jsx(LottieView, {
|
|
227
|
+
ref: lottieRef,
|
|
228
|
+
source: lottieSource,
|
|
229
|
+
autoPlay: true,
|
|
230
|
+
loop: true,
|
|
231
|
+
style: styles.iconImage,
|
|
232
|
+
enableMergePathsAndroidForKitKatAndAbove: true,
|
|
233
|
+
enableSafeModeAndroid: true
|
|
234
|
+
})
|
|
440
235
|
}), isOpen && /*#__PURE__*/_jsxs(View, {
|
|
441
236
|
style: styles.expandedContentContainer,
|
|
442
237
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
443
238
|
style: styles.leftContentSection,
|
|
444
239
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
445
240
|
style: [styles.agentNameText, styles.leftAlignedText],
|
|
446
|
-
children:
|
|
241
|
+
children: agentName
|
|
447
242
|
}), /*#__PURE__*/_jsx(Text, {
|
|
448
243
|
style: [styles.leftAlignedText, styles.statusText],
|
|
449
|
-
children:
|
|
244
|
+
children: statusText
|
|
450
245
|
})]
|
|
451
246
|
}), /*#__PURE__*/_jsx(View, {
|
|
452
247
|
style: styles.middleContentSection,
|
|
@@ -462,7 +257,7 @@ export function EmbedButton() {
|
|
|
462
257
|
style: styles.startCallButton,
|
|
463
258
|
children: /*#__PURE__*/_jsx(Text, {
|
|
464
259
|
style: styles.startCallText,
|
|
465
|
-
children:
|
|
260
|
+
children: connectButtonText
|
|
466
261
|
})
|
|
467
262
|
})
|
|
468
263
|
}), tokenDetails?.token && /*#__PURE__*/_jsxs(View, {
|
|
@@ -472,7 +267,7 @@ export function EmbedButton() {
|
|
|
472
267
|
onPress: handleMicToggle,
|
|
473
268
|
children: /*#__PURE__*/_jsx(Image, {
|
|
474
269
|
source: {
|
|
475
|
-
uri: isMicMuted ?
|
|
270
|
+
uri: isMicMuted ? ICON_URLS.MIC_OFF : ICON_URLS.MIC_ON
|
|
476
271
|
},
|
|
477
272
|
style: styles.buttonImage
|
|
478
273
|
})
|
|
@@ -481,7 +276,7 @@ export function EmbedButton() {
|
|
|
481
276
|
style: styles.endCallButton,
|
|
482
277
|
children: /*#__PURE__*/_jsx(Image, {
|
|
483
278
|
source: {
|
|
484
|
-
uri:
|
|
279
|
+
uri: ICON_URLS.END_CALL
|
|
485
280
|
},
|
|
486
281
|
style: styles.buttonImage
|
|
487
282
|
})
|
|
@@ -494,7 +289,5 @@ export function EmbedButton() {
|
|
|
494
289
|
})]
|
|
495
290
|
});
|
|
496
291
|
}
|
|
497
|
-
|
|
498
|
-
// Export default for easier imports
|
|
499
292
|
export default EmbedButton;
|
|
500
293
|
//# sourceMappingURL=EmbedButton.js.map
|