@envive-ai/react-hooks 0.3.21 → 0.3.22
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/dist/atoms/app/index.d.ts +7 -7
- package/dist/atoms/app/variant.d.cts +6 -6
- package/dist/atoms/chat/chatState.d.ts +17 -17
- package/dist/atoms/chat/form.d.cts +3 -3
- package/dist/atoms/chat/form.d.ts +2 -2
- package/dist/atoms/chat/index.d.cts +3 -3
- package/dist/atoms/chat/index.d.ts +2 -2
- package/dist/atoms/chat/lastMessage.d.cts +2 -2
- package/dist/atoms/chat/lastMessage.d.ts +2 -2
- package/dist/atoms/chat/messageQueue.d.cts +7 -7
- package/dist/atoms/chat/messageQueue.d.ts +6 -6
- package/dist/atoms/chat/performanceMetrics.d.cts +6 -6
- package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
- package/dist/atoms/chat/renderedWidgetRefs.d.cts +3 -3
- package/dist/atoms/chat/renderedWidgetRefs.d.ts +2 -2
- package/dist/atoms/chat/replies.d.cts +2 -2
- package/dist/atoms/chat/replies.d.ts +2 -2
- package/dist/atoms/chat/suggestions.d.cts +3 -3
- package/dist/atoms/chat/suggestions.d.ts +2 -2
- package/dist/atoms/envive/enviveConfig.d.cts +12 -12
- package/dist/atoms/envive/enviveConfig.d.ts +13 -13
- package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
- package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
- package/dist/atoms/org/customerService.d.cts +6 -6
- package/dist/atoms/org/customerService.d.ts +6 -6
- package/dist/atoms/org/graphqlConfig.d.cts +4 -4
- package/dist/atoms/org/graphqlConfig.d.ts +4 -4
- package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
- package/dist/atoms/org/newOrgConfigAtom.d.ts +2 -2
- package/dist/atoms/org/orgAnalyticsConfig.d.cts +5 -5
- package/dist/atoms/org/orgAnalyticsConfig.d.ts +5 -5
- package/dist/atoms/search/chatSearch.d.cts +17 -17
- package/dist/atoms/search/chatSearch.d.ts +17 -17
- package/dist/atoms/search/searchAPI.d.cts +13 -13
- package/dist/atoms/search/searchAPI.d.ts +13 -13
- package/dist/atoms/search/types.d.ts +1 -1
- package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
- package/dist/atoms/widget/chatPreviewLoading.d.ts +2 -2
- package/dist/contexts/amplitudeContext/amplitudeContext.cjs +9 -3
- package/dist/contexts/amplitudeContext/amplitudeContext.d.cts +2 -1
- package/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -1
- package/dist/contexts/amplitudeContext/amplitudeContext.js +9 -3
- package/dist/contexts/enviveContext/types.d.ts +1 -1
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.ts +2 -2
- package/dist/contexts/types.d.ts +1 -1
- package/dist/contexts/typesV3.d.cts +1 -1
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.ts +2 -2
- package/dist/hooks/Search/useSearch.cjs +12 -4
- package/dist/hooks/Search/useSearch.js +12 -4
- package/dist/hooks/SystemSettingsContext/useSystemSettingsContext.d.cts +2 -2
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.cjs +20 -27
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.cts +8 -8
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.ts +8 -8
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +21 -28
- package/dist/hooks/WidgetInteraction/types.cjs +25 -1
- package/dist/hooks/WidgetInteraction/types.d.cts +11 -2
- package/dist/hooks/WidgetInteraction/types.d.ts +11 -2
- package/dist/hooks/WidgetInteraction/types.js +24 -2
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.cjs +6 -2
- package/dist/hooks/WidgetInteraction/useWidgetInteraction.js +6 -2
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/services/amplitudeService/amplitudeService.cjs +9 -1
- package/dist/services/amplitudeService/amplitudeService.d.cts +2 -1
- package/dist/services/amplitudeService/amplitudeService.d.ts +2 -1
- package/dist/services/amplitudeService/amplitudeService.js +9 -1
- package/package.json +1 -1
- package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +31 -27
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +5 -2
- package/src/contexts/pageContext/__tests__/pageContext.test.tsx +10 -0
- package/src/hooks/Search/__tests__/useSearch.test.tsx +0 -4
- package/src/hooks/Search/useSearch.tsx +14 -8
- package/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts +27 -34
- package/src/hooks/WidgetInteraction/types.ts +25 -1
- package/src/hooks/WidgetInteraction/useWidgetInteraction.ts +3 -1
- package/src/services/amplitudeService/__tests__/amplitudeService.test.ts +69 -6
- package/src/services/amplitudeService/amplitudeService.ts +13 -0
|
@@ -56,6 +56,10 @@ export class AmplitudeService {
|
|
|
56
56
|
this.initialize();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
get isMockApiKey(): boolean {
|
|
60
|
+
return this.config.amplitudeApiKey === 'mock-amplitude-key';
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
get isReady(): boolean {
|
|
60
64
|
return Boolean(
|
|
61
65
|
this.config.userId &&
|
|
@@ -228,6 +232,14 @@ export class AmplitudeService {
|
|
|
228
232
|
return;
|
|
229
233
|
}
|
|
230
234
|
|
|
235
|
+
if (this.isMockApiKey) {
|
|
236
|
+
logger.logWarn(
|
|
237
|
+
'Mock API key detected — running in mock mode, no events will be sent to Amplitude.',
|
|
238
|
+
this.config.amplitudeApiKey,
|
|
239
|
+
);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
231
243
|
if (!this.amplitudeClient) {
|
|
232
244
|
const currentAmplitudeInstance: BrowserClient = createInstance();
|
|
233
245
|
|
|
@@ -353,6 +365,7 @@ export class AmplitudeService {
|
|
|
353
365
|
eventGroups,
|
|
354
366
|
alsoSendToGoogleAnalytics = false,
|
|
355
367
|
}: TrackEventParams): Promise<void> {
|
|
368
|
+
if (this.isMockApiKey) return;
|
|
356
369
|
logger.logDebug('Submitting event', eventName);
|
|
357
370
|
try {
|
|
358
371
|
const decoratedEventName = AmplitudeService.decorateEventName(eventName);
|