@revrag-ai/embed-react-native 1.0.17 → 1.0.18
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/android/build.gradle +3 -3
- package/dist/commonjs/events/agent-event-emitter.js +114 -0
- package/dist/commonjs/events/agent-event-emitter.js.map +1 -0
- package/dist/commonjs/events/embed.event.js +69 -142
- package/dist/commonjs/events/embed.event.js.map +1 -1
- package/dist/commonjs/events/embed.types.js +32 -0
- package/dist/commonjs/events/embed.types.js.map +1 -0
- package/dist/commonjs/events/embed.validators.js +36 -0
- package/dist/commonjs/events/embed.validators.js.map +1 -0
- package/dist/commonjs/events/index.js +47 -0
- package/dist/commonjs/events/index.js.map +1 -0
- package/dist/commonjs/utils/constant.js +11 -0
- package/dist/commonjs/utils/constant.js.map +1 -1
- package/dist/commonjs/utils/permision.js +48 -1
- package/dist/commonjs/utils/permision.js.map +1 -1
- package/dist/module/events/agent-event-emitter.js +109 -0
- package/dist/module/events/agent-event-emitter.js.map +1 -0
- package/dist/module/events/embed.event.js +59 -147
- package/dist/module/events/embed.event.js.map +1 -1
- package/dist/module/events/embed.types.js +33 -0
- package/dist/module/events/embed.types.js.map +1 -0
- package/dist/module/events/embed.validators.js +32 -0
- package/dist/module/events/embed.validators.js.map +1 -0
- package/dist/module/events/index.js +12 -0
- package/dist/module/events/index.js.map +1 -0
- package/dist/module/utils/constant.js +11 -0
- package/dist/module/utils/constant.js.map +1 -1
- package/dist/module/utils/permision.js +48 -1
- package/dist/module/utils/permision.js.map +1 -1
- package/dist/typescript/src/events/agent-event-emitter.d.ts +41 -0
- package/dist/typescript/src/events/agent-event-emitter.d.ts.map +1 -0
- package/dist/typescript/src/events/embed.event.d.ts +21 -67
- package/dist/typescript/src/events/embed.event.d.ts.map +1 -1
- package/dist/typescript/src/events/embed.types.d.ts +39 -0
- package/dist/typescript/src/events/embed.types.d.ts.map +1 -0
- package/dist/typescript/src/events/embed.validators.d.ts +17 -0
- package/dist/typescript/src/events/embed.validators.d.ts.map +1 -0
- package/dist/typescript/src/events/index.d.ts +10 -0
- package/dist/typescript/src/events/index.d.ts.map +1 -0
- package/dist/typescript/src/utils/constant.d.ts +1 -0
- package/dist/typescript/src/utils/constant.d.ts.map +1 -1
- package/dist/typescript/src/utils/permision.d.ts.map +1 -1
- package/package.json +11 -6
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { PermissionsAndroid, Platform } from 'react-native';
|
|
4
|
+
import { buildEventPayload } from "./constant.js";
|
|
5
|
+
import { APIService } from "../api/api.js";
|
|
6
|
+
import { getAgentData } from "../store/store.key.js";
|
|
7
|
+
import { EventKeys } from "../events/embed.event.js";
|
|
4
8
|
export const checkPermissions = async () => {
|
|
5
9
|
try {
|
|
10
|
+
console.error('RECORD_AUDIO permission not available');
|
|
6
11
|
// Check for required permissions on Android
|
|
7
12
|
if (Platform.OS === 'android') {
|
|
8
13
|
const recordAudioPermission = PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
|
|
9
14
|
if (!recordAudioPermission) {
|
|
10
|
-
|
|
15
|
+
const error = new Error('RECORD_AUDIO permission not available');
|
|
16
|
+
await sendPermissionDeniedEvent('RECORD_AUDIO permission not available');
|
|
17
|
+
throw error;
|
|
11
18
|
}
|
|
12
19
|
const permissions = [recordAudioPermission];
|
|
13
20
|
const results = await Promise.all(permissions.map(permission => PermissionsAndroid.request(permission)));
|
|
14
21
|
const allGranted = results.every(result => result === PermissionsAndroid.RESULTS.GRANTED);
|
|
15
22
|
if (!allGranted) {
|
|
23
|
+
const deniedPermissions = permissions.filter((_, index) => results[index] !== PermissionsAndroid.RESULTS.GRANTED);
|
|
24
|
+
await sendPermissionDeniedEvent('Required permissions not granted', deniedPermissions);
|
|
16
25
|
throw new Error('Required permissions not granted');
|
|
17
26
|
}
|
|
18
27
|
}
|
|
@@ -21,4 +30,42 @@ export const checkPermissions = async () => {
|
|
|
21
30
|
throw new Error(errorMessage);
|
|
22
31
|
}
|
|
23
32
|
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Send permission denied event to backend
|
|
36
|
+
* @param reason - The reason for permission denial
|
|
37
|
+
* @param deniedPermissions - List of denied permissions
|
|
38
|
+
*/
|
|
39
|
+
async function sendPermissionDeniedEvent(reason, deniedPermissions) {
|
|
40
|
+
try {
|
|
41
|
+
// Get user identity to include app_user_id
|
|
42
|
+
const userIdentity = await getAgentData(EventKeys.USER_DATA);
|
|
43
|
+
if (!userIdentity?.app_user_id) {
|
|
44
|
+
console.warn('[Permission] Cannot send permission denied event: User identity not found');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Build event payload
|
|
49
|
+
const payload = buildEventPayload({
|
|
50
|
+
eventKey: EventKeys.ANALYTICS_DATA,
|
|
51
|
+
app_user_id: userIdentity.app_user_id,
|
|
52
|
+
error_type: 'permission_denied',
|
|
53
|
+
event_name: 'mic_permission_denied',
|
|
54
|
+
error_message: reason,
|
|
55
|
+
denied_permissions: deniedPermissions,
|
|
56
|
+
platform: Platform.OS,
|
|
57
|
+
timestamp: new Date().toISOString()
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Send to backend
|
|
61
|
+
const apiService = APIService.getInstance();
|
|
62
|
+
const response = await apiService.updateUserData(payload);
|
|
63
|
+
if (!response.success) {
|
|
64
|
+
console.error('[Permission] Failed to send permission denied event:', response.error);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('[Permission] Error sending permission denied event:', error);
|
|
68
|
+
// Fail silently - permission events should not break the app
|
|
69
|
+
}
|
|
70
|
+
}
|
|
24
71
|
//# sourceMappingURL=permision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PermissionsAndroid","Platform","checkPermissions","OS","recordAudioPermission","PERMISSIONS","RECORD_AUDIO","Error","permissions","results","Promise","all","map","permission","request","allGranted","every","result","RESULTS","GRANTED","err","errorMessage","message"],"sourceRoot":"../../../src","sources":["utils/permision.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["PermissionsAndroid","Platform","buildEventPayload","APIService","getAgentData","EventKeys","checkPermissions","console","error","OS","recordAudioPermission","PERMISSIONS","RECORD_AUDIO","Error","sendPermissionDeniedEvent","permissions","results","Promise","all","map","permission","request","allGranted","every","result","RESULTS","GRANTED","deniedPermissions","filter","_","index","err","errorMessage","message","reason","userIdentity","USER_DATA","app_user_id","warn","payload","eventKey","ANALYTICS_DATA","error_type","event_name","error_message","denied_permissions","platform","timestamp","Date","toISOString","apiService","getInstance","response","updateUserData","success"],"sourceRoot":"../../../src","sources":["utils/permision.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,SAASC,iBAAiB,QAAQ,eAAY;AAC9C,SAASC,UAAU,QAAQ,eAAY;AACvC,SAASC,YAAY,QAAQ,uBAAoB;AACjD,SAASC,SAAS,QAAQ,0BAAuB;AAEjD,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAA2B;EACzD,IAAI;IACFC,OAAO,CAACC,KAAK,CAAC,uCAAuC,CAAC;IACtD;IACA,IAAIP,QAAQ,CAACQ,EAAE,KAAK,SAAS,EAAE;MAC7B,MAAMC,qBAAqB,GAAGV,kBAAkB,CAACW,WAAW,CAACC,YAAY;MACzE,IAAI,CAACF,qBAAqB,EAAE;QAC1B,MAAMF,KAAK,GAAG,IAAIK,KAAK,CAAC,uCAAuC,CAAC;QAChE,MAAMC,yBAAyB,CAC7B,uCACF,CAAC;QACD,MAAMN,KAAK;MACb;MAEA,MAAMO,WAAW,GAAG,CAACL,qBAAqB,CAAC;MAE3C,MAAMM,OAAO,GAAG,MAAMC,OAAO,CAACC,GAAG,CAC/BH,WAAW,CAACI,GAAG,CAAEC,UAAU,IAAKpB,kBAAkB,CAACqB,OAAO,CAACD,UAAU,CA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C,WAAW,CAAC;IACpC,CAAC,CAAC;;IAEF;IACA,MAAMC,UAAU,GAAG/C,UAAU,CAACgD,WAAW,CAAC,CAAC;IAC3C,MAAMC,QAAQ,GAAG,MAAMF,UAAU,CAACG,cAAc,CAACd,OAAO,CAAC;IAEzD,IAAI,CAACa,QAAQ,CAACE,OAAO,EAAE;MACrB/C,OAAO,CAACC,KAAK,CACX,sDAAsD,EACtD4C,QAAQ,CAAC5C,KACX,CAAC;IACH;EACF,CAAC,CAAC,OAAOA,KAAK,EAAE;IACdD,OAAO,CAACC,KAAK,CAAC,qDAAqD,EAAEA,KAAK,CAAC;IAC3E;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Event Emitter
|
|
3
|
+
* Handles listening to agent state changes (connection, disconnection, popup visibility)
|
|
4
|
+
* Also sends agent events to the backend API
|
|
5
|
+
*/
|
|
6
|
+
import type { EventCallback, AgentEvent } from './embed.types';
|
|
7
|
+
export declare class AgentEventEmitter {
|
|
8
|
+
private agentListeners;
|
|
9
|
+
/**
|
|
10
|
+
* Add an event listener for agent events
|
|
11
|
+
* @param eventKey - The agent event to listen for
|
|
12
|
+
* @param callback - Callback function to execute when event fires
|
|
13
|
+
*/
|
|
14
|
+
on(eventKey: AgentEvent, callback: EventCallback): void;
|
|
15
|
+
/**
|
|
16
|
+
* Remove an event listener for agent events
|
|
17
|
+
* @param eventKey - The agent event to stop listening to
|
|
18
|
+
* @param callback - The callback function to remove
|
|
19
|
+
*/
|
|
20
|
+
off(eventKey: AgentEvent, callback: EventCallback): void;
|
|
21
|
+
/**
|
|
22
|
+
* Emit an agent event to all registered listeners AND send to backend
|
|
23
|
+
* @param eventKey - The agent event to emit
|
|
24
|
+
* @param data - Data to pass to listeners
|
|
25
|
+
* @internal - Used internally by the library
|
|
26
|
+
*/
|
|
27
|
+
emit(eventKey: AgentEvent, data: any): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Send agent event data to backend API
|
|
30
|
+
* @param eventKey - The agent event type
|
|
31
|
+
* @param data - Event data
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private sendToBackend;
|
|
35
|
+
/**
|
|
36
|
+
* Remove all listeners for a specific event
|
|
37
|
+
* @param eventKey - The agent event to clear listeners for
|
|
38
|
+
*/
|
|
39
|
+
removeAllListeners(eventKey?: AgentEvent): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agent-event-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-event-emitter.d.ts","sourceRoot":"","sources":["../../../../src/events/agent-event-emitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG/D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,cAAc,CAAiD;IAEvE;;;;OAIG;IACH,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAOvD;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IASxD;;;;;OAKG;IACG,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1D;;;;;OAKG;YACW,aAAa;IAuC3B;;;OAGG;IACH,kBAAkB,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI;CAOhD"}
|
|
@@ -1,81 +1,33 @@
|
|
|
1
|
-
type EventCallback = (data: any) => void;
|
|
2
|
-
export declare enum EventKeys {
|
|
3
|
-
USER_DATA = "user_data",
|
|
4
|
-
SCREEN_STATE = "screen_state",
|
|
5
|
-
OFFER_STATE = "offer_state",
|
|
6
|
-
CUSTOM_EVENT = "custom_event",
|
|
7
|
-
FORM_STATE = "form_state",
|
|
8
|
-
ACTION_STATE = "action_state",
|
|
9
|
-
ERROR_STATE = "error_state",
|
|
10
|
-
SUCCESS_STATE = "success_state",
|
|
11
|
-
WARNING_STATE = "warning_state",
|
|
12
|
-
INFO_STATE = "info_state",
|
|
13
|
-
DEBUG_STATE = "debug_state"
|
|
14
|
-
}
|
|
15
|
-
export declare enum AgentEvent {
|
|
16
|
-
AGENT_CONNECTED = "agent_connected",
|
|
17
|
-
AGENT_DISCONNECTED = "agent_disconnected",
|
|
18
|
-
POPUP_MESSAGE_VISIBLE = "popup_message_visible"
|
|
19
|
-
}
|
|
20
|
-
export interface AgentConnectedData {
|
|
21
|
-
timestamp: string;
|
|
22
|
-
metadata?: Record<string, any>;
|
|
23
|
-
}
|
|
24
|
-
export interface AgentDisconnectedData {
|
|
25
|
-
timestamp: string;
|
|
26
|
-
metadata?: Record<string, any>;
|
|
27
|
-
}
|
|
28
|
-
export interface PopupMessageVisibleData {
|
|
29
|
-
value: boolean;
|
|
30
|
-
metadata?: {
|
|
31
|
-
trigger?: string;
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
1
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Also sends agent events to the backend API
|
|
2
|
+
* Embed Event Manager
|
|
3
|
+
* Main class for managing embed events and agent communication
|
|
39
4
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
on(eventKey: AgentEvent, callback: EventCallback): void;
|
|
5
|
+
import { AgentEventEmitter } from './agent-event-emitter';
|
|
6
|
+
import type { EventCallback, EventKeys } from './embed.types';
|
|
7
|
+
declare class Embed {
|
|
8
|
+
private events;
|
|
9
|
+
event: AgentEventEmitter;
|
|
10
|
+
constructor();
|
|
48
11
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
51
|
-
* @param callback - The callback function to remove
|
|
12
|
+
* Automatically adds a default listener if none exists
|
|
13
|
+
* @private
|
|
52
14
|
*/
|
|
53
|
-
|
|
15
|
+
private ensureDefaultListener;
|
|
54
16
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
* @param data - Data to pass to listeners
|
|
58
|
-
* @internal - Used internally by the library
|
|
17
|
+
* Enriches event data with user identity
|
|
18
|
+
* @private
|
|
59
19
|
*/
|
|
60
|
-
|
|
20
|
+
private enrichEventData;
|
|
61
21
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @param eventKey - The agent event type
|
|
64
|
-
* @param data - Event data
|
|
22
|
+
* Sends event data to the backend API
|
|
65
23
|
* @private
|
|
66
24
|
*/
|
|
67
|
-
private
|
|
25
|
+
private sendEventToAPI;
|
|
68
26
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
27
|
+
* Triggers local event listeners
|
|
28
|
+
* @private
|
|
71
29
|
*/
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
declare class Embed {
|
|
75
|
-
private events;
|
|
76
|
-
event: AgentEventEmitter;
|
|
77
|
-
constructor();
|
|
78
|
-
private ensureDefaultListener;
|
|
30
|
+
private triggerEventListeners;
|
|
79
31
|
/**
|
|
80
32
|
* Send an event to the AI agent
|
|
81
33
|
* @param eventKey - The event type to send
|
|
@@ -90,4 +42,6 @@ declare class Embed {
|
|
|
90
42
|
}
|
|
91
43
|
declare const embed: Embed;
|
|
92
44
|
export default embed;
|
|
45
|
+
export { EventKeys, AgentEvent } from './embed.types';
|
|
46
|
+
export type { EventCallback, AgentConnectedData, AgentDisconnectedData, PopupMessageVisibleData, } from './embed.types';
|
|
93
47
|
//# sourceMappingURL=embed.event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.event.d.ts","sourceRoot":"","sources":["../../../../src/events/embed.event.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embed.event.d.ts","sourceRoot":"","sources":["../../../../src/events/embed.event.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,cAAM,KAAK;IACT,OAAO,CAAC,MAAM,CAAgD;IAGvD,KAAK,EAAE,iBAAiB,CAAC;;IAMhC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;OAGG;YACW,eAAe;IAW7B;;;OAGG;YACW,cAAc;IA0B5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;;;OAIG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvD;;;OAGG;IACH,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;CAMvD;AAED,QAAA,MAAM,KAAK,OAAc,CAAC;AAC1B,eAAe,KAAK,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types and interfaces for Embed events
|
|
3
|
+
*/
|
|
4
|
+
export type EventCallback = (data: any) => void;
|
|
5
|
+
export declare enum EventKeys {
|
|
6
|
+
USER_DATA = "user_data",
|
|
7
|
+
SCREEN_STATE = "screen_state",
|
|
8
|
+
OFFER_STATE = "offer_state",
|
|
9
|
+
CUSTOM_EVENT = "custom_event",
|
|
10
|
+
FORM_STATE = "form_state",
|
|
11
|
+
ANALYTICS_DATA = "analytics_data",
|
|
12
|
+
ACTION_STATE = "action_state",
|
|
13
|
+
ERROR_STATE = "error_state",
|
|
14
|
+
SUCCESS_STATE = "success_state",
|
|
15
|
+
WARNING_STATE = "warning_state",
|
|
16
|
+
INFO_STATE = "info_state",
|
|
17
|
+
DEBUG_STATE = "debug_state"
|
|
18
|
+
}
|
|
19
|
+
export declare enum AgentEvent {
|
|
20
|
+
AGENT_CONNECTED = "agent_connected",
|
|
21
|
+
AGENT_DISCONNECTED = "agent_disconnected",
|
|
22
|
+
POPUP_MESSAGE_VISIBLE = "popup_message_visible"
|
|
23
|
+
}
|
|
24
|
+
export interface AgentConnectedData {
|
|
25
|
+
timestamp: string;
|
|
26
|
+
metadata?: Record<string, any>;
|
|
27
|
+
}
|
|
28
|
+
export interface AgentDisconnectedData {
|
|
29
|
+
timestamp: string;
|
|
30
|
+
metadata?: Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
export interface PopupMessageVisibleData {
|
|
33
|
+
value: boolean;
|
|
34
|
+
metadata?: {
|
|
35
|
+
trigger?: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=embed.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.types.d.ts","sourceRoot":"","sources":["../../../../src/events/embed.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;AAGhD,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAGD,oBAAY,UAAU;IACpB,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;CAChD;AAGD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation helpers for Embed events
|
|
3
|
+
*/
|
|
4
|
+
import type { EventPayload } from '../utils/constant';
|
|
5
|
+
/**
|
|
6
|
+
* Validates event key is valid
|
|
7
|
+
* @param eventKey - The event key to validate
|
|
8
|
+
* @throws Error if event key is invalid
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateEventKey(eventKey: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Validates analytics events have required event_name
|
|
13
|
+
* @param paramsData - The event payload to validate
|
|
14
|
+
* @throws Error if analytics event is missing event_name
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateAnalyticsEvent(paramsData: EventPayload): void;
|
|
17
|
+
//# sourceMappingURL=embed.validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.validators.d.ts","sourceRoot":"","sources":["../../../../src/events/embed.validators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAQrE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Events module
|
|
3
|
+
* Exports the main Embed event manager and related types
|
|
4
|
+
*/
|
|
5
|
+
export { default } from './embed.event';
|
|
6
|
+
export { EventKeys, AgentEvent } from './embed.types';
|
|
7
|
+
export type { EventCallback, AgentConnectedData, AgentDisconnectedData, PopupMessageVisibleData, } from './embed.types';
|
|
8
|
+
export { AgentEventEmitter } from './agent-event-emitter';
|
|
9
|
+
export { validateEventKey, validateAnalyticsEvent } from './embed.validators';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../../src/utils/constant.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,uBAAuB,CAAC;AAC7C,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAE3D;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACt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iFd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permision.d.ts","sourceRoot":"","sources":["../../../../src/utils/permision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"permision.d.ts","sourceRoot":"","sources":["../../../../src/utils/permision.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,IAAI,CAwCrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revrag-ai/embed-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"description": "A powerful React Native library for integrating AI-powered voice agents into mobile applications. Features real-time voice communication, intelligent speech processing, customizable UI components, and comprehensive event handling for building conversational AI experiences.",
|
|
6
6
|
"main": "./dist/commonjs/index.js",
|
|
@@ -47,12 +47,17 @@
|
|
|
47
47
|
"fix-js": "node fix-js-files.js",
|
|
48
48
|
"verify-setup": "node scripts/verify-setup.js",
|
|
49
49
|
"debug-network": "node scripts/debug-network.js",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
50
|
+
"precheck": "yarn lint && yarn typecheck && yarn test",
|
|
51
|
+
"prepublishOnly": "yarn clean && bob build && yarn fix-js",
|
|
52
|
+
"publish": "yarn precheck && yarn publish:safe",
|
|
53
53
|
"publish:safe": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public",
|
|
54
54
|
"publish:beta": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public --tag beta",
|
|
55
55
|
"publish:alpha": "yarn clean && bob build && yarn fix-js && yarn protect && npm publish --access public --tag alpha",
|
|
56
|
+
"release": "release-it",
|
|
57
|
+
"release:patch": "release-it patch",
|
|
58
|
+
"release:minor": "release-it minor",
|
|
59
|
+
"release:major": "release-it major",
|
|
60
|
+
"protect": "node -e \"const crypto = require('crypto'); const fs = require('fs'); const config = { hash: crypto.randomBytes(32).toString('hex'), createdAt: new Date().toISOString(), note: 'Protected build', version: require('./package.json').version }; fs.writeFileSync('.onwid-security.json', JSON.stringify(config, null, 2)); console.log('✅ Code protected');\"",
|
|
56
61
|
"docs:check": "echo '📚 Documentation files:' && ls -la *.md && echo '✅ Documentation is up to date'",
|
|
57
62
|
"docs:validate": "echo '🔍 Validating documentation...' && node -e \"const fs = require('fs'); const files = ['README.md', 'API.md', 'EXAMPLES.md']; files.forEach(f => { if (!fs.existsSync(f)) throw new Error('Missing: ' + f); }); console.log('✅ All documentation files present');\""
|
|
58
63
|
},
|
|
@@ -108,9 +113,9 @@
|
|
|
108
113
|
"react": "18.3.1",
|
|
109
114
|
"react-native": "0.75.4",
|
|
110
115
|
"react-native-builder-bob": "^0.30.2",
|
|
111
|
-
"react-native-gesture-handler": "
|
|
116
|
+
"react-native-gesture-handler": "~2.20.2",
|
|
112
117
|
"react-native-linear-gradient": "^2.8.3",
|
|
113
|
-
"react-native-reanimated": "
|
|
118
|
+
"react-native-reanimated": "~3.15.1",
|
|
114
119
|
"react-native-safe-area-context": "^4.12.0",
|
|
115
120
|
"release-it": "^15.0.0",
|
|
116
121
|
"typescript": "^5.2.2"
|