@revrag-ai/embed-react-native 1.0.16 → 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/README.md +6 -108
- package/android/build.gradle +3 -3
- 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/agent-event-emitter.js +114 -0
- package/dist/commonjs/events/agent-event-emitter.js.map +1 -0
- package/dist/commonjs/events/embed.event.js +93 -79
- 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/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 +99 -0
- package/dist/commonjs/utils/constant.js.map +1 -0
- package/dist/commonjs/utils/permision.js +48 -1
- package/dist/commonjs/utils/permision.js.map +1 -1
- 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/agent-event-emitter.js +109 -0
- package/dist/module/events/agent-event-emitter.js.map +1 -0
- package/dist/module/events/embed.event.js +82 -80
- 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/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 +93 -0
- package/dist/module/utils/constant.js.map +1 -0
- package/dist/module/utils/permision.js +48 -1
- package/dist/module/utils/permision.js.map +1 -1
- 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/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 +39 -21
- 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/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 +46 -0
- package/dist/typescript/src/utils/constant.d.ts.map +1 -0
- package/dist/typescript/src/utils/permision.d.ts.map +1 -1
- package/dist/typescript/src/utils/reanimated.helper.d.ts.map +1 -1
- package/package.json +16 -8
- 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
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.trackRageClick = exports.trackFormEvent = exports.trackEmbedEvent = exports.getRouteHierarchy = exports.getNavigationTree = exports.getAllRoutes = exports.getAllDefinedRoutes = exports.default = exports.EmbedProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _EmbedButton = require("../components/Embed/EmbedButton.js");
|
|
9
|
+
var _embedEvent = _interopRequireWildcard(require("../events/embed.event.js"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
/**
|
|
13
|
+
* @file EmbedProvider.tsx
|
|
14
|
+
* @description Core provider component for the Embed React Native library.
|
|
15
|
+
*
|
|
16
|
+
* This provider:
|
|
17
|
+
* - Tracks navigation state and screen changes
|
|
18
|
+
* - Conditionally renders the EmbedButton based on current screen
|
|
19
|
+
* - Provides utilities for extracting navigation hierarchy information
|
|
20
|
+
* - Manages event tracking integration with the Embed system
|
|
21
|
+
*
|
|
22
|
+
* @module EmbedProvider
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* ============================================================================
|
|
26
|
+
* TYPE DEFINITIONS
|
|
27
|
+
* ========================================================================== */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Props for the EmbedProvider component
|
|
31
|
+
* @interface EmbedProviderProps
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the complete hierarchical structure of the current navigation state
|
|
36
|
+
* @interface RouteHierarchy
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents a node in the navigation tree structure
|
|
41
|
+
* @interface NavigationTreeNode
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/* ============================================================================
|
|
45
|
+
* CONSTANTS
|
|
46
|
+
* ========================================================================== */
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Default list of screens where the EmbedButton should be displayed
|
|
50
|
+
* Used when no custom includeScreens prop is provided
|
|
51
|
+
* @constant
|
|
52
|
+
*/
|
|
53
|
+
const DEFAULT_INCLUDED_SCREENS = [];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Delay before setting up navigation listener (allows navigation to stabilize)
|
|
57
|
+
* @constant
|
|
58
|
+
*/
|
|
59
|
+
const NAVIGATION_LISTENER_DELAY = 1000;
|
|
60
|
+
|
|
61
|
+
/* ============================================================================
|
|
62
|
+
* UTILITY FUNCTIONS - NAVIGATION HIERARCHY
|
|
63
|
+
* ========================================================================== */
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Extracts complete route hierarchy information from navigation state
|
|
67
|
+
*
|
|
68
|
+
* This function traverses the navigation state tree recursively to build
|
|
69
|
+
* a comprehensive hierarchy object containing the current screen, full path,
|
|
70
|
+
* depth, and route information at each level.
|
|
71
|
+
*
|
|
72
|
+
* @param {any} state - Navigation state from navigationRef.current?.getRootState()
|
|
73
|
+
* @returns {RouteHierarchy | null} Complete route hierarchy or null if state is invalid
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const routeInfo = getRouteHierarchy(navigationRef.current?.getRootState());
|
|
78
|
+
* console.log(routeInfo);
|
|
79
|
+
* // {
|
|
80
|
+
* // currentScreen: "Product",
|
|
81
|
+
* // fullPath: "MainApp > Home > Product",
|
|
82
|
+
* // allRoutes: ["MainApp", "Home", "Product"],
|
|
83
|
+
* // depth: 3,
|
|
84
|
+
* // routesByLevel: { 0: "MainApp", 1: "Home", 2: "Product" },
|
|
85
|
+
* // parentRoute: "Home",
|
|
86
|
+
* // routeParams: { id: "123" }
|
|
87
|
+
* // }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
const getRouteHierarchy = state => {
|
|
91
|
+
if (!state) return null;
|
|
92
|
+
try {
|
|
93
|
+
const allRoutes = [];
|
|
94
|
+
const routesByLevel = {};
|
|
95
|
+
let currentRouteParams;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Recursively traverse the navigation state tree
|
|
99
|
+
* @param {any} currentState - Current state node
|
|
100
|
+
* @param {number} level - Current depth level (0 = root)
|
|
101
|
+
*/
|
|
102
|
+
const traverse = (currentState, level = 0) => {
|
|
103
|
+
if (!currentState || typeof currentState.index !== 'number') return;
|
|
104
|
+
const route = currentState.routes?.[currentState.index];
|
|
105
|
+
if (!route || !route.name) return;
|
|
106
|
+
const routeName = route.name;
|
|
107
|
+
allRoutes.push(routeName);
|
|
108
|
+
routesByLevel[level] = routeName;
|
|
109
|
+
|
|
110
|
+
// Capture parameters if this is the deepest (active) route
|
|
111
|
+
if (!route.state && route.params) {
|
|
112
|
+
currentRouteParams = route.params;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Recursively traverse nested navigation states
|
|
116
|
+
if (route.state) {
|
|
117
|
+
traverse(route.state, level + 1);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Start traversal from root
|
|
122
|
+
traverse(state);
|
|
123
|
+
|
|
124
|
+
// Return null if no routes were found
|
|
125
|
+
if (allRoutes.length === 0) return null;
|
|
126
|
+
|
|
127
|
+
// Build the hierarchy object
|
|
128
|
+
const currentScreen = allRoutes[allRoutes.length - 1] || 'Unknown';
|
|
129
|
+
const parentRoute = allRoutes.length > 1 ? allRoutes[allRoutes.length - 2] : undefined;
|
|
130
|
+
const depth = allRoutes.length;
|
|
131
|
+
const fullPath = allRoutes.join(' > ');
|
|
132
|
+
return {
|
|
133
|
+
currentScreen,
|
|
134
|
+
fullPath,
|
|
135
|
+
allRoutes,
|
|
136
|
+
depth,
|
|
137
|
+
routesByLevel,
|
|
138
|
+
parentRoute,
|
|
139
|
+
routeParams: currentRouteParams
|
|
140
|
+
};
|
|
141
|
+
} catch (error) {
|
|
142
|
+
// Return null if any error occurs during traversal
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Extracts ALL available routes (both mounted and defined) from navigation state
|
|
149
|
+
*
|
|
150
|
+
* This function traverses the navigation state and returns a flat array of:
|
|
151
|
+
* 1. Currently MOUNTED routes (routes that are rendered in the navigation tree)
|
|
152
|
+
* 2. DEFINED routes (from routeNames - routes that exist but may not be rendered yet)
|
|
153
|
+
*
|
|
154
|
+
* This is particularly useful because nested navigators (like tab navigators)
|
|
155
|
+
* won't appear in the state until you navigate to them, but their route names
|
|
156
|
+
* are still defined in the navigator configuration.
|
|
157
|
+
*
|
|
158
|
+
* @param {any} state - Navigation state from navigationRef.current?.getRootState()
|
|
159
|
+
* @returns {string[]} Array of unique route names
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const allRoutes = getAllRoutes(navigationRef.current?.getRootState());
|
|
164
|
+
* console.log(allRoutes);
|
|
165
|
+
* // ["Splash", "Welcome", "MainApp", "Home", "Transactions", "Profile"]
|
|
166
|
+
*
|
|
167
|
+
* // Check if a specific route is available
|
|
168
|
+
* const hasProfileScreen = allRoutes.includes("Profile");
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
exports.getRouteHierarchy = getRouteHierarchy;
|
|
172
|
+
const getAllRoutes = state => {
|
|
173
|
+
if (!state) return [];
|
|
174
|
+
|
|
175
|
+
// Use Set for O(1) lookup instead of O(n) with array.includes
|
|
176
|
+
const allRouteNamesSet = new Set();
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Recursively collect route names from navigation state
|
|
180
|
+
* @param {any} currentState - Current state node
|
|
181
|
+
*/
|
|
182
|
+
const collectRoutes = currentState => {
|
|
183
|
+
if (!currentState) return;
|
|
184
|
+
|
|
185
|
+
// Collect defined route names (ALL routes configured in the navigator)
|
|
186
|
+
if (currentState?.routeNames && Array.isArray(currentState.routeNames)) {
|
|
187
|
+
currentState.routeNames.forEach(routeName => {
|
|
188
|
+
if (routeName && typeof routeName === 'string') {
|
|
189
|
+
allRouteNamesSet.add(routeName);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Collect mounted routes (currently rendered routes)
|
|
195
|
+
if (!currentState?.routes || !Array.isArray(currentState.routes)) return;
|
|
196
|
+
currentState.routes.forEach(route => {
|
|
197
|
+
if (route?.name && typeof route.name === 'string') {
|
|
198
|
+
allRouteNamesSet.add(route.name);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Recursively check nested states (for mounted nested navigators)
|
|
202
|
+
if (route?.state) {
|
|
203
|
+
collectRoutes(route.state);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
try {
|
|
208
|
+
collectRoutes(state);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
// Fail silently and return empty array if state traversal fails
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
return Array.from(allRouteNamesSet);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Builds a complete navigation tree structure showing all routes and their relationships
|
|
218
|
+
*
|
|
219
|
+
* This function creates a hierarchical tree structure representing the entire
|
|
220
|
+
* navigation state, including all routes at all levels (not just the active path).
|
|
221
|
+
* Useful for visualizing or debugging your navigation structure.
|
|
222
|
+
*
|
|
223
|
+
* @param {any} state - Navigation state from navigationRef.current?.getRootState()
|
|
224
|
+
* @returns {NavigationTreeNode[]} Array of NavigationTreeNode representing the complete tree
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* const tree = getNavigationTree(navigationRef.current?.getRootState());
|
|
229
|
+
* console.log(JSON.stringify(tree, null, 2));
|
|
230
|
+
*
|
|
231
|
+
* // Example output:
|
|
232
|
+
* // [
|
|
233
|
+
* // {
|
|
234
|
+
* // "name": "MainApp",
|
|
235
|
+
* // "level": 0,
|
|
236
|
+
* // "children": [
|
|
237
|
+
* // {
|
|
238
|
+
* // "name": "Home",
|
|
239
|
+
* // "level": 1,
|
|
240
|
+
* // "children": [
|
|
241
|
+
* // { "name": "HomeMain", "level": 2 },
|
|
242
|
+
* // { "name": "Product", "level": 2, "params": { "id": "123" } }
|
|
243
|
+
* // ]
|
|
244
|
+
* // },
|
|
245
|
+
* // { "name": "Profile", "level": 1 }
|
|
246
|
+
* // ]
|
|
247
|
+
* // }
|
|
248
|
+
* // ]
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
exports.getAllRoutes = getAllRoutes;
|
|
252
|
+
const getNavigationTree = state => {
|
|
253
|
+
if (!state) return [];
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Recursively build the navigation tree
|
|
257
|
+
* @param {any} currentState - Current state node
|
|
258
|
+
* @param {number} level - Current depth level (0 = root)
|
|
259
|
+
* @returns {NavigationTreeNode[]} Array of tree nodes
|
|
260
|
+
*/
|
|
261
|
+
const buildTree = (currentState, level = 0) => {
|
|
262
|
+
if (!currentState?.routes || !Array.isArray(currentState.routes)) {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
return currentState.routes.filter(route => route && route.name).map(route => {
|
|
266
|
+
const node = {
|
|
267
|
+
name: route.name,
|
|
268
|
+
level,
|
|
269
|
+
params: route.params
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// Recursively build children if nested state exists
|
|
273
|
+
if (route.state) {
|
|
274
|
+
node.children = buildTree(route.state, level + 1);
|
|
275
|
+
}
|
|
276
|
+
return node;
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
try {
|
|
280
|
+
return buildTree(state);
|
|
281
|
+
} catch (error) {
|
|
282
|
+
// Return empty array if tree building fails
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Legacy alias for getAllRoutes()
|
|
289
|
+
* @deprecated Use getAllRoutes() instead
|
|
290
|
+
*
|
|
291
|
+
* Note: React Navigation limitation - nested navigator routes (like tabs inside a stack)
|
|
292
|
+
* only appear in the state AFTER they're mounted/rendered.
|
|
293
|
+
*
|
|
294
|
+
* @param {any} state - Navigation state
|
|
295
|
+
* @returns {string[]} Array of route names
|
|
296
|
+
*/
|
|
297
|
+
exports.getNavigationTree = getNavigationTree;
|
|
298
|
+
const getAllDefinedRoutes = state => {
|
|
299
|
+
return getAllRoutes(state);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/* ============================================================================
|
|
303
|
+
* UTILITY FUNCTIONS - APP VERSION
|
|
304
|
+
* ========================================================================== */
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Interface for app version information
|
|
308
|
+
* @interface AppVersionInfo
|
|
309
|
+
*/
|
|
310
|
+
exports.getAllDefinedRoutes = getAllDefinedRoutes;
|
|
311
|
+
/* ============================================================================
|
|
312
|
+
* UTILITY FUNCTIONS - EVENT TRACKING
|
|
313
|
+
* ========================================================================== */
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Track custom events with the Embed system
|
|
317
|
+
*
|
|
318
|
+
* This function provides a simple interface to send custom event data
|
|
319
|
+
* to the Embed analytics system. All errors are caught and handled silently
|
|
320
|
+
* to prevent analytics issues from affecting app functionality.
|
|
321
|
+
*
|
|
322
|
+
* @param {string} eventName - Name of the event to track
|
|
323
|
+
* @param {Record<string, any>} properties - Event properties/metadata (optional)
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* // Track a button click
|
|
328
|
+
* trackEmbedEvent('button_clicked', {
|
|
329
|
+
* buttonId: 'submit_form',
|
|
330
|
+
* screenName: 'Profile',
|
|
331
|
+
* });
|
|
332
|
+
*
|
|
333
|
+
* // Track a purchase
|
|
334
|
+
* trackEmbedEvent('purchase_completed', {
|
|
335
|
+
* amount: 99.99,
|
|
336
|
+
* currency: 'USD',
|
|
337
|
+
* items: ['item1', 'item2'],
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
const trackEmbedEvent = (eventName, properties = {}) => {
|
|
342
|
+
try {
|
|
343
|
+
_embedEvent.default.Event(_embedEvent.EventKeys.FORM_STATE, {
|
|
344
|
+
type: 'custom_event',
|
|
345
|
+
eventName,
|
|
346
|
+
properties,
|
|
347
|
+
timestamp: new Date().toISOString()
|
|
348
|
+
});
|
|
349
|
+
} catch (error) {
|
|
350
|
+
// Fail silently - analytics errors should not break the app
|
|
351
|
+
// You could log to a monitoring service here if needed
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Track rage clicks (repeated rapid clicks indicating user frustration)
|
|
357
|
+
*
|
|
358
|
+
* Rage clicks are detected when a user clicks the same element multiple times
|
|
359
|
+
* in rapid succession, which can indicate frustration with unresponsive UI.
|
|
360
|
+
* This data helps identify problem areas in the user experience.
|
|
361
|
+
*
|
|
362
|
+
* @param {string} elementId - Unique identifier of the clicked element
|
|
363
|
+
* @param {string} elementType - Type of element (e.g., 'button', 'link', 'text')
|
|
364
|
+
* @param {{ x: number; y: number }} coordinates - Screen coordinates of the clicks
|
|
365
|
+
* @param {number} clickCount - Number of rapid clicks detected
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* trackRageClick('submit_button', 'button', { x: 100, y: 200 }, 5);
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
exports.trackEmbedEvent = trackEmbedEvent;
|
|
373
|
+
const trackRageClick = (elementId, elementType, coordinates, clickCount) => {
|
|
374
|
+
try {
|
|
375
|
+
const eventData = {
|
|
376
|
+
type: 'rage_click',
|
|
377
|
+
elementId,
|
|
378
|
+
elementType,
|
|
379
|
+
coordinates,
|
|
380
|
+
clickCount,
|
|
381
|
+
timestamp: new Date().toISOString()
|
|
382
|
+
};
|
|
383
|
+
_embedEvent.default.Event(_embedEvent.EventKeys.FORM_STATE, eventData);
|
|
384
|
+
} catch (error) {
|
|
385
|
+
// Fail silently - analytics errors should not break the app
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Track form-related events (changes, submissions, errors)
|
|
391
|
+
*
|
|
392
|
+
* This function tracks various form interactions to help understand
|
|
393
|
+
* user behavior and identify potential issues in form flows.
|
|
394
|
+
*
|
|
395
|
+
* @param {string} formId - Unique identifier of the form
|
|
396
|
+
* @param {'form_change' | 'form_submit' | 'form_error'} eventType - Type of form event
|
|
397
|
+
* @param {Record<string, any>} formData - Form data/metadata (optional)
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* // Track form field change
|
|
402
|
+
* trackFormEvent('signup_form', 'form_change', {
|
|
403
|
+
* field: 'email',
|
|
404
|
+
* value: 'user@example.com',
|
|
405
|
+
* });
|
|
406
|
+
*
|
|
407
|
+
* // Track form submission
|
|
408
|
+
* trackFormEvent('signup_form', 'form_submit', {
|
|
409
|
+
* success: true,
|
|
410
|
+
* userId: '12345',
|
|
411
|
+
* });
|
|
412
|
+
*
|
|
413
|
+
* // Track form error
|
|
414
|
+
* trackFormEvent('signup_form', 'form_error', {
|
|
415
|
+
* field: 'password',
|
|
416
|
+
* error: 'Password too short',
|
|
417
|
+
* });
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
exports.trackRageClick = trackRageClick;
|
|
421
|
+
const trackFormEvent = (formId, eventType, formData = {}) => {
|
|
422
|
+
try {
|
|
423
|
+
const eventData = {
|
|
424
|
+
type: eventType,
|
|
425
|
+
formId,
|
|
426
|
+
formData,
|
|
427
|
+
timestamp: new Date().toISOString()
|
|
428
|
+
};
|
|
429
|
+
_embedEvent.default.Event(_embedEvent.EventKeys.FORM_STATE, eventData);
|
|
430
|
+
} catch (error) {
|
|
431
|
+
// Fail silently - analytics errors should not break the app
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/* ============================================================================
|
|
436
|
+
* MAIN COMPONENT
|
|
437
|
+
* ========================================================================== */
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* EmbedProvider Component
|
|
441
|
+
*
|
|
442
|
+
* Core provider component that wraps your application to enable Embed functionality.
|
|
443
|
+
* This provider:
|
|
444
|
+
* - Monitors navigation state changes
|
|
445
|
+
* - Automatically shows/hides the EmbedButton based on current screen
|
|
446
|
+
* - Tracks screen views and navigation hierarchy
|
|
447
|
+
* - Integrates with the Embed analytics system
|
|
448
|
+
*
|
|
449
|
+
* @param {EmbedProviderProps} props - Component props
|
|
450
|
+
* @returns {JSX.Element} Provider component with children and conditional EmbedButton
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* import { NavigationContainer } from '@react-navigation/native';
|
|
455
|
+
* import { EmbedProvider } from '@revrag/embed-react-native';
|
|
456
|
+
* import { useRef } from 'react';
|
|
457
|
+
*
|
|
458
|
+
* function App() {
|
|
459
|
+
* const navigationRef = useRef<NavigationContainerRef<any>>(null);
|
|
460
|
+
*
|
|
461
|
+
* return (
|
|
462
|
+
* // IMPORTANT: EmbedProvider must WRAP NavigationContainer
|
|
463
|
+
* <EmbedProvider
|
|
464
|
+
* navigationRef={navigationRef}
|
|
465
|
+
* includeScreens={['Home', 'Profile', 'Dashboard']}
|
|
466
|
+
* >
|
|
467
|
+
* <NavigationContainer ref={navigationRef}>
|
|
468
|
+
* {/* Your navigation stack *\/}
|
|
469
|
+
* </NavigationContainer>
|
|
470
|
+
* </EmbedProvider>
|
|
471
|
+
* );
|
|
472
|
+
* }
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
exports.trackFormEvent = trackFormEvent;
|
|
476
|
+
const EmbedProvider = ({
|
|
477
|
+
children,
|
|
478
|
+
navigationRef,
|
|
479
|
+
includeScreens = DEFAULT_INCLUDED_SCREENS,
|
|
480
|
+
appVersion: _appVersion
|
|
481
|
+
}) => {
|
|
482
|
+
// ========== Refs ==========
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Navigation reference - use provided ref or create a default one
|
|
486
|
+
* This allows the provider to work both with and without an external navigation ref
|
|
487
|
+
* Note: Using useRef instead of createRef to maintain same ref across renders
|
|
488
|
+
*/
|
|
489
|
+
const defaultNavRef = (0, _react.useRef)(null);
|
|
490
|
+
const navRef = navigationRef || defaultNavRef;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Track if component is mounted to prevent state updates after unmount
|
|
494
|
+
*/
|
|
495
|
+
const isMountedRef = (0, _react.useRef)(true);
|
|
496
|
+
|
|
497
|
+
// ========== State ==========
|
|
498
|
+
|
|
499
|
+
/** Whether the EmbedButton should be visible on the current screen */
|
|
500
|
+
const [showEmbedButton, setShowEmbedButton] = (0, _react.useState)(false);
|
|
501
|
+
|
|
502
|
+
// ========== Memoized Values ==========
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Included screens (from prop)
|
|
506
|
+
* Memoized to prevent recalculation on every render and filter falsy values
|
|
507
|
+
*/
|
|
508
|
+
const allIncludedScreens = (0, _react.useMemo)(() => {
|
|
509
|
+
return Array.from(new Set(includeScreens.filter(Boolean)));
|
|
510
|
+
}, [includeScreens]);
|
|
511
|
+
|
|
512
|
+
// ========== Effects ==========
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Memoized callback for tracking screen changes
|
|
516
|
+
* Uses useCallback to maintain stable reference and prevent unnecessary re-renders
|
|
517
|
+
*/
|
|
518
|
+
const trackScreen = (0, _react.useCallback)(async () => {
|
|
519
|
+
try {
|
|
520
|
+
// Safety check: Ensure navigation ref is available
|
|
521
|
+
if (!navRef.current) {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const state = navRef.current.getRootState();
|
|
525
|
+
if (!state) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
const routeInfo = getRouteHierarchy(state);
|
|
529
|
+
// Extract current screen name from navigation state
|
|
530
|
+
const screenName = routeInfo?.currentScreen || navRef.current.getCurrentRoute()?.name || '';
|
|
531
|
+
|
|
532
|
+
// Determine if EmbedButton should be visible
|
|
533
|
+
// Show button only on screens specified in includeScreens (prop + backend)
|
|
534
|
+
const hasIncludeFilter = allIncludedScreens.length > 0;
|
|
535
|
+
const isIncluded = allIncludedScreens.includes(screenName);
|
|
536
|
+
const shouldShowButton = screenName !== '' && (!hasIncludeFilter || isIncluded);
|
|
537
|
+
// Only update state if component is still mounted
|
|
538
|
+
if (isMountedRef.current) {
|
|
539
|
+
setShowEmbedButton(shouldShowButton);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// Track screen view event (if route info is available)
|
|
543
|
+
if (routeInfo) {
|
|
544
|
+
try {
|
|
545
|
+
// TODO: Uncomment when ready to enable screen view tracking
|
|
546
|
+
_embedEvent.default.Event(_embedEvent.EventKeys.FORM_STATE, {
|
|
547
|
+
type: 'screen_view',
|
|
548
|
+
...routeInfo,
|
|
549
|
+
screen: routeInfo.currentScreen,
|
|
550
|
+
// allAvailableRoutes: allRoutes,
|
|
551
|
+
app_version: _appVersion,
|
|
552
|
+
timestamp: new Date().toISOString()
|
|
553
|
+
});
|
|
554
|
+
} catch (error) {
|
|
555
|
+
// Silently fail - analytics should not break the app
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
} catch (error) {
|
|
559
|
+
// Catch-all error handler to prevent any tracking errors from breaking the app
|
|
560
|
+
}
|
|
561
|
+
}, [navRef, allIncludedScreens, _appVersion]);
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Effect: Navigation State Tracking
|
|
565
|
+
*
|
|
566
|
+
* Sets up listeners for navigation state changes and tracks:
|
|
567
|
+
* - Current screen name
|
|
568
|
+
* - Route hierarchy
|
|
569
|
+
* - Screen view events
|
|
570
|
+
* - EmbedButton visibility
|
|
571
|
+
*/
|
|
572
|
+
(0, _react.useEffect)(() => {
|
|
573
|
+
// Validate navigation ref
|
|
574
|
+
if (!navRef) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
let unsubscribe;
|
|
578
|
+
let delayTimer;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Set up navigation state listener
|
|
582
|
+
*/
|
|
583
|
+
const setupListener = () => {
|
|
584
|
+
// Only set up if navigation ref is ready
|
|
585
|
+
if (navRef.current) {
|
|
586
|
+
unsubscribe = navRef.current.addListener('state', trackScreen);
|
|
587
|
+
trackScreen(); // Track initial screen immediately
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
// Set up listener immediately for quick feedback
|
|
592
|
+
setupListener();
|
|
593
|
+
|
|
594
|
+
// Also set up after delay in case navigation wasn't ready
|
|
595
|
+
delayTimer = setTimeout(() => {
|
|
596
|
+
if (!unsubscribe && navRef.current) {
|
|
597
|
+
setupListener();
|
|
598
|
+
}
|
|
599
|
+
}, NAVIGATION_LISTENER_DELAY);
|
|
600
|
+
|
|
601
|
+
// Cleanup function
|
|
602
|
+
return () => {
|
|
603
|
+
if (delayTimer) {
|
|
604
|
+
clearTimeout(delayTimer);
|
|
605
|
+
}
|
|
606
|
+
if (unsubscribe) {
|
|
607
|
+
unsubscribe();
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
}, [navRef, trackScreen]);
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Effect: Component Lifecycle Management
|
|
614
|
+
*
|
|
615
|
+
* Tracks component mount/unmount state to prevent state updates after unmount
|
|
616
|
+
*/
|
|
617
|
+
(0, _react.useEffect)(() => {
|
|
618
|
+
isMountedRef.current = true;
|
|
619
|
+
return () => {
|
|
620
|
+
isMountedRef.current = false;
|
|
621
|
+
};
|
|
622
|
+
}, []);
|
|
623
|
+
|
|
624
|
+
// ========== Render ==========
|
|
625
|
+
|
|
626
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
627
|
+
children: [children, showEmbedButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedButton.EmbedButton, {})]
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
/* ============================================================================
|
|
632
|
+
* EXPORTS
|
|
633
|
+
* ========================================================================== */
|
|
634
|
+
|
|
635
|
+
// Default export
|
|
636
|
+
exports.EmbedProvider = EmbedProvider;
|
|
637
|
+
var _default = exports.default = EmbedProvider;
|
|
638
|
+
//# sourceMappingURL=EmbedProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_EmbedButton","_embedEvent","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_INCLUDED_SCREENS","NAVIGATION_LISTENER_DELAY","getRouteHierarchy","state","allRoutes","routesByLevel","currentRouteParams","traverse","currentState","level","index","route","routes","name","routeName","push","params","length","currentScreen","parentRoute","undefined","depth","fullPath","join","routeParams","error","exports","getAllRoutes","allRouteNamesSet","Set","collectRoutes","routeNames","Array","isArray","forEach","add","from","getNavigationTree","buildTree","filter","map","node","children","getAllDefinedRoutes","trackEmbedEvent","eventName","properties","Embed","Event","EventKeys","FORM_STATE","type","timestamp","Date","toISOString","trackRageClick","elementId","elementType","coordinates","clickCount","eventData","trackFormEvent","formId","eventType","formData","EmbedProvider","navigationRef","includeScreens","appVersion","_appVersion","defaultNavRef","useRef","navRef","isMountedRef","showEmbedButton","setShowEmbedButton","useState","allIncludedScreens","useMemo","Boolean","trackScreen","useCallback","current","getRootState","routeInfo","screenName","getCurrentRoute","hasIncludeFilter","isIncluded","includes","shouldShowButton","screen","app_version","useEffect","unsubscribe","delayTimer","setupListener","addListener","setTimeout","clearTimeout","jsxs","Fragment","jsx","EmbedButton","_default"],"sourceRoot":"../../../src","sources":["context/EmbedProvider.tsx"],"mappings":";;;;;;AAcA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAyD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,S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