@planningcenter/chat-react-native 4.7.1-qa-staging.7 → 4.7.1-qa-staging.9
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/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +2 -0
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +0 -2
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +16 -93
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/session_context.d.ts.map +1 -1
- package/build/contexts/session_context.js +3 -0
- package/build/contexts/session_context.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +3 -2
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +9 -9
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +12 -7
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_cache.d.ts +1 -3
- package/build/hooks/use_conversations_cache.d.ts.map +1 -1
- package/build/hooks/use_conversations_cache.js +79 -124
- package/build/hooks/use_conversations_cache.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +47 -20
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
- package/build/hooks/use_mark_latest_message_read.js +5 -4
- package/build/hooks/use_mark_latest_message_read.js.map +1 -1
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +93 -75
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/types/jolt_events/index.d.ts +2 -0
- package/build/types/jolt_events/index.d.ts.map +1 -1
- package/build/types/jolt_events/index.js.map +1 -1
- package/build/types/jolt_events/person_events.d.ts +9 -0
- package/build/types/jolt_events/person_events.d.ts.map +1 -0
- package/build/types/jolt_events/person_events.js +2 -0
- package/build/types/jolt_events/person_events.js.map +1 -0
- package/build/utils/jolt/parse_stream_user_event_type.d.ts +3 -0
- package/build/utils/jolt/parse_stream_user_event_type.d.ts.map +1 -0
- package/build/utils/jolt/parse_stream_user_event_type.js +9 -0
- package/build/utils/jolt/parse_stream_user_event_type.js.map +1 -0
- package/build/utils/product_analytics_token.d.ts +12 -0
- package/build/utils/product_analytics_token.d.ts.map +1 -0
- package/build/utils/product_analytics_token.js +84 -0
- package/build/utils/product_analytics_token.js.map +1 -0
- package/build/utils/throttled_refresh.d.ts +7 -0
- package/build/utils/throttled_refresh.d.ts.map +1 -0
- package/build/utils/throttled_refresh.js +42 -0
- package/build/utils/throttled_refresh.js.map +1 -0
- package/package.json +3 -3
- package/src/contexts/api_provider.tsx +2 -0
- package/src/contexts/chat_context.tsx +2 -58
- package/src/contexts/session_context.tsx +3 -0
- package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +229 -0
- package/src/hooks/__tests__/use_conversations_jolt_events.test.tsx +1 -0
- package/src/hooks/__tests__/use_conversations_mark_read.test.tsx +38 -12
- package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +23 -2
- package/src/hooks/__tests__/use_product_analytics.test.tsx +304 -0
- package/src/hooks/use_conversation_jolt_events.ts +2 -1
- package/src/hooks/use_conversations_actions.ts +7 -4
- package/src/hooks/use_conversations_cache.ts +1 -23
- package/src/hooks/use_conversations_jolt_events.ts +24 -10
- package/src/hooks/use_mark_latest_message_read.ts +6 -5
- package/src/hooks/use_product_analytics.ts +74 -41
- package/src/types/jolt_events/index.ts +2 -0
- package/src/types/jolt_events/person_events.ts +16 -0
- package/src/utils/__tests__/throttled_refresh.test.ts +101 -0
- package/src/utils/jolt/__tests__/parse_stream_user_event_type.test.ts +27 -0
- package/src/utils/jolt/parse_stream_user_event_type.ts +16 -0
- package/src/utils/product_analytics_token.ts +120 -0
- package/src/utils/throttled_refresh.ts +62 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { throttle } from 'lodash';
|
|
2
2
|
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { REFRESH_THROTTLE_MS } from '../utils/throttled_refresh';
|
|
3
4
|
import { useAppState } from './use_app_state';
|
|
4
5
|
import { useConversationsMarkRead } from './use_conversations_actions';
|
|
5
6
|
export function useMarkLatestMessageRead({
|
|
@@ -12,7 +13,7 @@ export function useMarkLatestMessageRead({
|
|
|
12
13
|
} = useConversationsMarkRead({
|
|
13
14
|
conversation
|
|
14
15
|
});
|
|
15
|
-
const
|
|
16
|
+
const throttledMarkRead = useMemo(() => throttle(markRead, REFRESH_THROTTLE_MS, {
|
|
16
17
|
leading: true,
|
|
17
18
|
trailing: true
|
|
18
19
|
}), [markRead]);
|
|
@@ -24,7 +25,7 @@ export function useMarkLatestMessageRead({
|
|
|
24
25
|
useEffect(() => {
|
|
25
26
|
if (!isActive || !shouldMarkRead) return;
|
|
26
27
|
firedOnce.current = true;
|
|
27
|
-
|
|
28
|
-
}, [
|
|
28
|
+
throttledMarkRead(true);
|
|
29
|
+
}, [throttledMarkRead, isActive, shouldMarkRead, unreadReaction]);
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=use_mark_latest_message_read.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_mark_latest_message_read.js","names":["
|
|
1
|
+
{"version":3,"file":"use_mark_latest_message_read.js","names":["throttle","useEffect","useMemo","useRef","REFRESH_THROTTLE_MS","useAppState","useConversationsMarkRead","useMarkLatestMessageRead","conversation","enabled","firedOnce","markRead","throttledMarkRead","leading","trailing","unreadCount","unreadReaction","shouldMarkRead","current","Boolean","appState","isActive"],"sources":["../../src/hooks/use_mark_latest_message_read.ts"],"sourcesContent":["import { throttle } from 'lodash'\nimport { useEffect, useMemo, useRef } from 'react'\nimport { ConversationResource, MessageResource } from '../types'\nimport { REFRESH_THROTTLE_MS } from '../utils/throttled_refresh'\nimport { useAppState } from './use_app_state'\nimport { useConversationsMarkRead } from './use_conversations_actions'\n\ninterface Props {\n conversation: ConversationResource\n messages: MessageResource[]\n enabled?: boolean\n}\n\nexport function useMarkLatestMessageRead({ conversation, enabled = true }: Props) {\n const firedOnce = useRef<boolean>(false)\n const { markRead } = useConversationsMarkRead({ conversation })\n const throttledMarkRead = useMemo(\n () => throttle(markRead, REFRESH_THROTTLE_MS, { leading: true, trailing: true }),\n [markRead]\n )\n const unreadCount = conversation.unreadCount\n const unreadReaction = conversation.unreadReaction\n\n const shouldMarkRead =\n !firedOnce.current || (enabled && Boolean(unreadCount >= 1 || unreadReaction))\n const appState = useAppState()\n const isActive = appState === 'active'\n\n useEffect(() => {\n if (!isActive || !shouldMarkRead) return\n\n firedOnce.current = true\n\n throttledMarkRead(true)\n }, [throttledMarkRead, isActive, shouldMarkRead, unreadReaction])\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAElD,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,wBAAwB,QAAQ,6BAA6B;AAQtE,OAAO,SAASC,wBAAwBA,CAAC;EAAEC,YAAY;EAAEC,OAAO,GAAG;AAAY,CAAC,EAAE;EAChF,MAAMC,SAAS,GAAGP,MAAM,CAAU,KAAK,CAAC;EACxC,MAAM;IAAEQ;EAAS,CAAC,GAAGL,wBAAwB,CAAC;IAAEE;EAAa,CAAC,CAAC;EAC/D,MAAMI,iBAAiB,GAAGV,OAAO,CAC/B,MAAMF,QAAQ,CAACW,QAAQ,EAAEP,mBAAmB,EAAE;IAAES,OAAO,EAAE,IAAI;IAAEC,QAAQ,EAAE;EAAK,CAAC,CAAC,EAChF,CAACH,QAAQ,CACX,CAAC;EACD,MAAMI,WAAW,GAAGP,YAAY,CAACO,WAAW;EAC5C,MAAMC,cAAc,GAAGR,YAAY,CAACQ,cAAc;EAElD,MAAMC,cAAc,GAClB,CAACP,SAAS,CAACQ,OAAO,IAAKT,OAAO,IAAIU,OAAO,CAACJ,WAAW,IAAI,CAAC,IAAIC,cAAc,CAAE;EAChF,MAAMI,QAAQ,GAAGf,WAAW,CAAC,CAAC;EAC9B,MAAMgB,QAAQ,GAAGD,QAAQ,KAAK,QAAQ;EAEtCnB,SAAS,CAAC,MAAM;IACd,IAAI,CAACoB,QAAQ,IAAI,CAACJ,cAAc,EAAE;IAElCP,SAAS,CAACQ,OAAO,GAAG,IAAI;IAExBN,iBAAiB,CAAC,IAAI,CAAC;EACzB,CAAC,EAAE,CAACA,iBAAiB,EAAES,QAAQ,EAAEJ,cAAc,EAAED,cAAc,CAAC,CAAC;AACnE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_product_analytics.d.ts","sourceRoot":"","sources":["../../src/hooks/use_product_analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use_product_analytics.d.ts","sourceRoot":"","sources":["../../src/hooks/use_product_analytics.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AAOjF,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;CAC5D;AAED,eAAO,MAAM,eAAe;;;;;CAKgC,CAAA;AAE5D,KAAK,kBAAkB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAA;AA+EhF,eAAO,MAAM,mBAAmB;yBA2BrB,kBAAkB,SAAQ,aAAa,KAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;4BAtBhE,KAAK,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAC;QAAC,IAAI,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC,KAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CA4B3F,CAAA;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,kBAAkB,EAC7B,IAAI,GAAE,aAAkB,QAYzB;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IACnD,iBAAiB,CAAC,EAAE,yBAAyB,CAAA;CAC9C,GACwE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC/F"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { isCancelledError, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
4
|
import { useChatContext } from '../contexts/chat_context';
|
|
4
5
|
import { keysToSnakeCase } from '../utils/client/utils';
|
|
6
|
+
import { Log } from '../utils/native_adapters/configuration';
|
|
7
|
+
import { fetchProductAnalyticsConfig } from '../utils/product_analytics_token';
|
|
8
|
+
import { isResponseLike, ResponseError } from '../utils/response_error';
|
|
5
9
|
import { SHA256, enc } from '../utils/sha_256';
|
|
6
10
|
export const analyticsEvents = {
|
|
7
11
|
conversation_index_opened: 'chat.mobile.conversations.index.opened',
|
|
@@ -12,6 +16,44 @@ export const analyticsEvents = {
|
|
|
12
16
|
function contentSha256(payload) {
|
|
13
17
|
return SHA256(payload).toString(enc.Hex);
|
|
14
18
|
}
|
|
19
|
+
const REPORT_TAGS = {
|
|
20
|
+
team: 'chat',
|
|
21
|
+
package: 'chat-react-native',
|
|
22
|
+
feature: 'product-analytics'
|
|
23
|
+
};
|
|
24
|
+
const isNetworkFailure = error => error instanceof TypeError && /network/i.test(error.message);
|
|
25
|
+
|
|
26
|
+
// HTTP failures from the API client are already reported by instrumentedFetch,
|
|
27
|
+
// network failures are expected on flaky connections, and queries are cancelled
|
|
28
|
+
// whenever the session changes. Anything else is a bug worth seeing in Sentry.
|
|
29
|
+
const isExpectedFailure = error => isResponseLike(error) || error instanceof ResponseError || isCancelledError(error) || isNetworkFailure(error);
|
|
30
|
+
function reportAnalyticsError(error, stage) {
|
|
31
|
+
if (__DEV__) {
|
|
32
|
+
console.warn(`Product Analytics ${stage} failed:`, error);
|
|
33
|
+
}
|
|
34
|
+
if (isExpectedFailure(error)) return;
|
|
35
|
+
const reported = error instanceof Error ? error : new Error(String(error));
|
|
36
|
+
Log.reportError(reported, {
|
|
37
|
+
tags: {
|
|
38
|
+
...REPORT_TAGS,
|
|
39
|
+
'analytics.stage': stage
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// The events endpoint is outside the chat API, so it isn't instrumented.
|
|
45
|
+
// A rejected batch here usually means the stored token is no longer accepted.
|
|
46
|
+
function reportRejectedEvents(response) {
|
|
47
|
+
const error = new Error(`HTTP ${response.status} POST product analytics events`);
|
|
48
|
+
error.name = `HTTPError${response.status}`;
|
|
49
|
+
Log.reportError(error, {
|
|
50
|
+
tags: {
|
|
51
|
+
...REPORT_TAGS,
|
|
52
|
+
'analytics.stage': 'send',
|
|
53
|
+
'http.status': String(response.status)
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
15
57
|
function sendEvents(events, config) {
|
|
16
58
|
// Split into chunks of 10 and make parallel requests
|
|
17
59
|
const chunks = [];
|
|
@@ -22,7 +64,7 @@ function sendEvents(events, config) {
|
|
|
22
64
|
const payload = JSON.stringify({
|
|
23
65
|
events: chunk
|
|
24
66
|
});
|
|
25
|
-
|
|
67
|
+
const response = await fetch(config.endpoint, {
|
|
26
68
|
method: 'POST',
|
|
27
69
|
headers: {
|
|
28
70
|
'Content-Type': 'application/json; charset=utf-8',
|
|
@@ -31,100 +73,72 @@ function sendEvents(events, config) {
|
|
|
31
73
|
},
|
|
32
74
|
body: payload
|
|
33
75
|
});
|
|
76
|
+
if (!response.ok) reportRejectedEvents(response);
|
|
77
|
+
return response;
|
|
34
78
|
})).catch(error => {
|
|
35
|
-
|
|
36
|
-
console.warn('Product Analytics request failed:', error);
|
|
37
|
-
}
|
|
79
|
+
reportAnalyticsError(error, 'send');
|
|
38
80
|
return [];
|
|
39
81
|
});
|
|
40
82
|
}
|
|
41
83
|
export const useProductAnalytics = () => {
|
|
42
|
-
const $ = _c(
|
|
84
|
+
const $ = _c(8);
|
|
43
85
|
const {
|
|
44
|
-
|
|
86
|
+
session
|
|
45
87
|
} = useChatContext();
|
|
46
|
-
|
|
88
|
+
const queryClient = useQueryClient();
|
|
47
89
|
let t0;
|
|
48
|
-
if ($[0] !==
|
|
49
|
-
t0 =
|
|
50
|
-
|
|
51
|
-
$[1] = t0;
|
|
52
|
-
} else {
|
|
53
|
-
t0 = $[1];
|
|
54
|
-
}
|
|
55
|
-
let t1;
|
|
56
|
-
if ($[2] !== t0) {
|
|
57
|
-
t1 = keysToSnakeCase(t0);
|
|
58
|
-
$[2] = t0;
|
|
59
|
-
$[3] = t1;
|
|
60
|
-
} else {
|
|
61
|
-
t1 = $[3];
|
|
62
|
-
}
|
|
63
|
-
const snakeCasedBaseMeta = t1;
|
|
64
|
-
let t2;
|
|
65
|
-
if ($[4] !== productAnalyticsConfig || $[5] !== snakeCasedBaseMeta) {
|
|
66
|
-
t2 = (name, t3) => {
|
|
67
|
-
const meta = t3 === undefined ? {} : t3;
|
|
68
|
-
if (!productAnalyticsConfig) {
|
|
69
|
-
if (__DEV__) {
|
|
70
|
-
console.warn("Product Analytics not available");
|
|
71
|
-
}
|
|
90
|
+
if ($[0] !== queryClient || $[1] !== session) {
|
|
91
|
+
t0 = events => {
|
|
92
|
+
if (!session.isAuthenticated) {
|
|
72
93
|
return Promise.resolve([]);
|
|
73
94
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
return fetchProductAnalyticsConfig(queryClient, session).then(config => {
|
|
96
|
+
const baseMeta = keysToSnakeCase(config.metadata || {});
|
|
97
|
+
const eventsWithMeta = events.map(event => ({
|
|
98
|
+
name: event.name,
|
|
99
|
+
meta: {
|
|
100
|
+
...baseMeta,
|
|
101
|
+
...event.meta
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
return sendEvents(eventsWithMeta, config);
|
|
105
|
+
}).catch(_temp);
|
|
82
106
|
};
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
107
|
+
$[0] = queryClient;
|
|
108
|
+
$[1] = session;
|
|
109
|
+
$[2] = t0;
|
|
86
110
|
} else {
|
|
87
|
-
|
|
111
|
+
t0 = $[2];
|
|
88
112
|
}
|
|
89
|
-
const
|
|
90
|
-
let
|
|
91
|
-
if ($[
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
const eventsWithMeta = events.map(event => ({
|
|
100
|
-
name: event.name,
|
|
101
|
-
meta: {
|
|
102
|
-
...snakeCasedBaseMeta,
|
|
103
|
-
...event.meta
|
|
104
|
-
}
|
|
105
|
-
}));
|
|
106
|
-
return sendEvents(eventsWithMeta, productAnalyticsConfig);
|
|
113
|
+
const publishEvents = t0;
|
|
114
|
+
let t1;
|
|
115
|
+
if ($[3] !== publishEvents) {
|
|
116
|
+
t1 = (name, t2) => {
|
|
117
|
+
const meta = t2 === undefined ? {} : t2;
|
|
118
|
+
return publishEvents([{
|
|
119
|
+
name,
|
|
120
|
+
meta
|
|
121
|
+
}]);
|
|
107
122
|
};
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[9] = t3;
|
|
123
|
+
$[3] = publishEvents;
|
|
124
|
+
$[4] = t1;
|
|
111
125
|
} else {
|
|
112
|
-
|
|
126
|
+
t1 = $[4];
|
|
113
127
|
}
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
if ($[
|
|
117
|
-
|
|
128
|
+
const publishEvent = t1;
|
|
129
|
+
let t2;
|
|
130
|
+
if ($[5] !== publishEvent || $[6] !== publishEvents) {
|
|
131
|
+
t2 = {
|
|
118
132
|
publishEvent,
|
|
119
133
|
publishEvents
|
|
120
134
|
};
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
135
|
+
$[5] = publishEvent;
|
|
136
|
+
$[6] = publishEvents;
|
|
137
|
+
$[7] = t2;
|
|
124
138
|
} else {
|
|
125
|
-
|
|
139
|
+
t2 = $[7];
|
|
126
140
|
}
|
|
127
|
-
return
|
|
141
|
+
return t2;
|
|
128
142
|
};
|
|
129
143
|
export function usePublishProductAnalyticsEvent(eventName, t0) {
|
|
130
144
|
const $ = _c(7);
|
|
@@ -166,4 +180,8 @@ export function usePublishProductAnalyticsEvent(eventName, t0) {
|
|
|
166
180
|
export function normalizeAnalyticsMetadata(resource) {
|
|
167
181
|
return keysToSnakeCase(resource?.analyticsMetadata?.metadata || {});
|
|
168
182
|
}
|
|
183
|
+
function _temp(error) {
|
|
184
|
+
reportAnalyticsError(error, "prepare");
|
|
185
|
+
return [];
|
|
186
|
+
}
|
|
169
187
|
//# sourceMappingURL=use_product_analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_product_analytics.js","names":["useCallback","useEffect","useMemo","useRef","useChatContext","keysToSnakeCase","SHA256","enc","analyticsEvents","conversation_index_opened","conversation_show_opened","search_performed","search_result_opened","contentSha256","payload","toString","Hex","sendEvents","events","config","chunks","i","length","push","slice","Promise","all","map","chunk","JSON","stringify","fetch","endpoint","method","headers","token","body","catch","error","__DEV__","console","warn","useProductAnalytics","$","_c","productAnalyticsConfig","metadata","t0","t1","snakeCasedBaseMeta","t2","name","t3","meta","undefined","resolve","mergedMeta","publishEvent","eventsWithMeta","event","publishEvents","t4","usePublishProductAnalyticsEvent","eventName","hasPublishedEventRef","current","normalizeAnalyticsMetadata","resource","analyticsMetadata"],"sources":["../../src/hooks/use_product_analytics.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { useChatContext } from '../contexts/chat_context'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { AnalyticsMetadataResource } from '../types/resources/analytics_metadata'\nimport { keysToSnakeCase } from '../utils/client/utils'\nimport { SHA256, enc } from '../utils/sha_256'\n\nexport interface EventMetadata {\n [key: string]: string | number | boolean | null | undefined\n}\n\nexport const analyticsEvents = {\n conversation_index_opened: 'chat.mobile.conversations.index.opened',\n conversation_show_opened: 'chat.mobile.conversations.show.opened',\n search_performed: 'chat.mobile.search.performed',\n search_result_opened: 'chat.mobile.search.result.opened',\n} as const satisfies Record<string, `chat.mobile.${string}`>\n\ntype AnalyticsEventName = (typeof analyticsEvents)[keyof typeof analyticsEvents]\n\ninterface AnalyticsEvent {\n name: string\n meta: EventMetadata\n}\n\nfunction contentSha256(payload: string): string {\n return SHA256(payload).toString(enc.Hex)\n}\n\nfunction sendEvents(events: AnalyticsEvent[], config: ProductAnalyticsConfig): Promise<Response[]> {\n // Split into chunks of 10 and make parallel requests\n const chunks: AnalyticsEvent[][] = []\n for (let i = 0; i < events.length; i += 10) {\n chunks.push(events.slice(i, i + 10))\n }\n\n return Promise.all(\n chunks.map(async chunk => {\n const payload = JSON.stringify({ events: chunk })\n return fetch(config.endpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Authorization': `Bearer ${config.token}`,\n 'X-Amz-Content-Sha256': contentSha256(payload),\n },\n body: payload,\n })\n })\n ).catch(error => {\n if (__DEV__) {\n console.warn('Product Analytics request failed:', error)\n }\n return [] as Response[]\n })\n}\n\nexport const useProductAnalytics = () => {\n const { productAnalyticsConfig } = useChatContext()\n\n const snakeCasedBaseMeta = useMemo(\n () => keysToSnakeCase(productAnalyticsConfig?.metadata || {}),\n [productAnalyticsConfig?.metadata]\n )\n\n const publishEvent = useCallback(\n (name: AnalyticsEventName, meta: EventMetadata = {}): Promise<Response[]> => {\n if (!productAnalyticsConfig) {\n if (__DEV__) {\n console.warn('Product Analytics not available')\n }\n return Promise.resolve([])\n }\n\n const mergedMeta = { ...snakeCasedBaseMeta, ...meta } as EventMetadata\n\n return sendEvents([{ name, meta: mergedMeta }], productAnalyticsConfig)\n },\n [productAnalyticsConfig, snakeCasedBaseMeta]\n )\n\n const publishEvents = useCallback(\n (events: Array<{ name: AnalyticsEventName; meta?: EventMetadata }>): Promise<Response[]> => {\n if (!productAnalyticsConfig) {\n if (__DEV__) {\n console.warn('Product Analytics not available')\n }\n return Promise.resolve([])\n }\n\n const eventsWithMeta = events.map(event => ({\n name: event.name,\n meta: { ...snakeCasedBaseMeta, ...event.meta } as EventMetadata,\n }))\n\n return sendEvents(eventsWithMeta, productAnalyticsConfig)\n },\n [productAnalyticsConfig, snakeCasedBaseMeta]\n )\n\n return { publishEvent, publishEvents }\n}\n\nexport function usePublishProductAnalyticsEvent(\n eventName: AnalyticsEventName,\n meta: EventMetadata = {}\n) {\n const { publishEvent } = useProductAnalytics()\n const hasPublishedEventRef = useRef(false)\n\n useEffect(() => {\n if (hasPublishedEventRef.current) return\n\n hasPublishedEventRef.current = true\n\n publishEvent(eventName, meta)\n }, [eventName, meta, publishEvent])\n}\n\nexport function normalizeAnalyticsMetadata(resource: {\n analyticsMetadata?: AnalyticsMetadataResource\n}) {\n return keysToSnakeCase(resource?.analyticsMetadata?.metadata || {}) as Record<string, unknown>\n}\n"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC/D,SAASC,cAAc,QAAQ,0BAA0B;AAGzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,MAAM,EAAEC,GAAG,QAAQ,kBAAkB;AAM9C,OAAO,MAAMC,eAAe,GAAG;EAC7BC,yBAAyB,EAAE,wCAAwC;EACnEC,wBAAwB,EAAE,uCAAuC;EACjEC,gBAAgB,EAAE,8BAA8B;EAChDC,oBAAoB,EAAE;AACxB,CAA4D;AAS5D,SAASC,aAAaA,CAACC,OAAe,EAAU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AAS;EAAA,IAAyBf,mBAAmB,CAAC,CAAC;EAC9C,MAAAsB,oBAAA,GAA6B7D,MAAM,CAAC,KAAK,CAAC;EAAA,IAAA+C,EAAA;EAAA,IAAAE,EAAA;EAAA,IAAAT,CAAA,QAAAoB,SAAA,IAAApB,CAAA,QAAAU,IAAA,IAAAV,CAAA,QAAAc,YAAA;IAEhCP,EAAA,GAAAA,CAAA;MACR,IAAIc,oBAAoB,CAAAC,OAAQ;QAAA;MAAA;MAEhCD,oBAAoB,CAAAC,OAAA,GAAW,IAAH;MAE5BR,YAAY,CAACM,SAAS,EAAEV,IAAI,CAAC;IAAA,CAC9B;IAAED,EAAA,IAACW,SAAS,EAAEV,IAAI,EAAEI,YAAY,CAAC;IAAAd,CAAA,MAAAoB,SAAA;IAAApB,CAAA,MAAAU,IAAA;IAAAV,CAAA,MAAAc,YAAA;IAAAd,CAAA,MAAAO,EAAA;IAAAP,CAAA,MAAAS,EAAA;EAAA;IAAAF,EAAA,GAAAP,CAAA;IAAAS,EAAA,GAAAT,CAAA;EAAA;EANlC1C,SAAS,CAACiD,EAMT,EAAEE,EAA+B,CAAC;AAAA;AAGrC,OAAO,SAASc,0BAA0BA,CAACC,QAE1C,EAAE;EACD,OAAO9D,eAAe,CAAC8D,QAAQ,EAAEC,iBAAiB,EAAEtB,QAAQ,IAAI,CAAC,CAAC,CAAC;AACrE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"use_product_analytics.js","names":["isCancelledError","useQueryClient","useCallback","useEffect","useRef","useChatContext","keysToSnakeCase","Log","fetchProductAnalyticsConfig","isResponseLike","ResponseError","SHA256","enc","analyticsEvents","conversation_index_opened","conversation_show_opened","search_performed","search_result_opened","contentSha256","payload","toString","Hex","REPORT_TAGS","team","package","feature","isNetworkFailure","error","TypeError","test","message","isExpectedFailure","reportAnalyticsError","stage","__DEV__","console","warn","reported","Error","String","reportError","tags","reportRejectedEvents","response","status","name","sendEvents","events","config","chunks","i","length","push","slice","Promise","all","map","chunk","JSON","stringify","fetch","endpoint","method","headers","token","body","ok","catch","useProductAnalytics","$","_c","session","queryClient","t0","isAuthenticated","resolve","then","baseMeta","metadata","eventsWithMeta","event","meta","_temp","publishEvents","t1","t2","undefined","publishEvent","usePublishProductAnalyticsEvent","eventName","hasPublishedEventRef","t3","current","normalizeAnalyticsMetadata","resource","analyticsMetadata"],"sources":["../../src/hooks/use_product_analytics.ts"],"sourcesContent":["import { isCancelledError, useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useEffect, useRef } from 'react'\nimport { useChatContext } from '../contexts/chat_context'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { AnalyticsMetadataResource } from '../types/resources/analytics_metadata'\nimport { keysToSnakeCase } from '../utils/client/utils'\nimport { Log } from '../utils/native_adapters/configuration'\nimport { fetchProductAnalyticsConfig } from '../utils/product_analytics_token'\nimport { isResponseLike, ResponseError } from '../utils/response_error'\nimport { SHA256, enc } from '../utils/sha_256'\n\nexport interface EventMetadata {\n [key: string]: string | number | boolean | null | undefined\n}\n\nexport const analyticsEvents = {\n conversation_index_opened: 'chat.mobile.conversations.index.opened',\n conversation_show_opened: 'chat.mobile.conversations.show.opened',\n search_performed: 'chat.mobile.search.performed',\n search_result_opened: 'chat.mobile.search.result.opened',\n} as const satisfies Record<string, `chat.mobile.${string}`>\n\ntype AnalyticsEventName = (typeof analyticsEvents)[keyof typeof analyticsEvents]\n\ninterface AnalyticsEvent {\n name: string\n meta: EventMetadata\n}\n\nfunction contentSha256(payload: string): string {\n return SHA256(payload).toString(enc.Hex)\n}\n\ntype AnalyticsStage = 'prepare' | 'send'\n\nconst REPORT_TAGS = {\n team: 'chat',\n package: 'chat-react-native',\n feature: 'product-analytics',\n} as const\n\nconst isNetworkFailure = (error: unknown) =>\n error instanceof TypeError && /network/i.test(error.message)\n\n// HTTP failures from the API client are already reported by instrumentedFetch,\n// network failures are expected on flaky connections, and queries are cancelled\n// whenever the session changes. Anything else is a bug worth seeing in Sentry.\nconst isExpectedFailure = (error: unknown) =>\n isResponseLike(error) ||\n error instanceof ResponseError ||\n isCancelledError(error) ||\n isNetworkFailure(error)\n\nfunction reportAnalyticsError(error: unknown, stage: AnalyticsStage) {\n if (__DEV__) {\n console.warn(`Product Analytics ${stage} failed:`, error)\n }\n if (isExpectedFailure(error)) return\n\n const reported = error instanceof Error ? error : new Error(String(error))\n Log.reportError(reported, { tags: { ...REPORT_TAGS, 'analytics.stage': stage } })\n}\n\n// The events endpoint is outside the chat API, so it isn't instrumented.\n// A rejected batch here usually means the stored token is no longer accepted.\nfunction reportRejectedEvents(response: Response) {\n const error = new Error(`HTTP ${response.status} POST product analytics events`)\n error.name = `HTTPError${response.status}`\n Log.reportError(error, {\n tags: { ...REPORT_TAGS, 'analytics.stage': 'send', 'http.status': String(response.status) },\n })\n}\n\nfunction sendEvents(events: AnalyticsEvent[], config: ProductAnalyticsConfig): Promise<Response[]> {\n // Split into chunks of 10 and make parallel requests\n const chunks: AnalyticsEvent[][] = []\n for (let i = 0; i < events.length; i += 10) {\n chunks.push(events.slice(i, i + 10))\n }\n\n return Promise.all(\n chunks.map(async chunk => {\n const payload = JSON.stringify({ events: chunk })\n const response = await fetch(config.endpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n 'X-Authorization': `Bearer ${config.token}`,\n 'X-Amz-Content-Sha256': contentSha256(payload),\n },\n body: payload,\n })\n if (!response.ok) reportRejectedEvents(response)\n return response\n })\n ).catch(error => {\n reportAnalyticsError(error, 'send')\n return [] as Response[]\n })\n}\n\nexport const useProductAnalytics = () => {\n const { session } = useChatContext()\n const queryClient = useQueryClient()\n\n const publishEvents = useCallback(\n (events: Array<{ name: AnalyticsEventName; meta?: EventMetadata }>): Promise<Response[]> => {\n if (!session.isAuthenticated) return Promise.resolve([])\n\n return fetchProductAnalyticsConfig(queryClient, session)\n .then(config => {\n const baseMeta = keysToSnakeCase(config.metadata || {})\n const eventsWithMeta = events.map(event => ({\n name: event.name,\n meta: { ...baseMeta, ...event.meta } as EventMetadata,\n }))\n\n return sendEvents(eventsWithMeta, config)\n })\n .catch(error => {\n reportAnalyticsError(error, 'prepare')\n return [] as Response[]\n })\n },\n [queryClient, session]\n )\n\n const publishEvent = useCallback(\n (name: AnalyticsEventName, meta: EventMetadata = {}): Promise<Response[]> =>\n publishEvents([{ name, meta }]),\n [publishEvents]\n )\n\n return { publishEvent, publishEvents }\n}\n\nexport function usePublishProductAnalyticsEvent(\n eventName: AnalyticsEventName,\n meta: EventMetadata = {}\n) {\n const { publishEvent } = useProductAnalytics()\n const hasPublishedEventRef = useRef(false)\n\n useEffect(() => {\n if (hasPublishedEventRef.current) return\n\n hasPublishedEventRef.current = true\n\n publishEvent(eventName, meta)\n }, [eventName, meta, publishEvent])\n}\n\nexport function normalizeAnalyticsMetadata(resource: {\n analyticsMetadata?: AnalyticsMetadataResource\n}) {\n return keysToSnakeCase(resource?.analyticsMetadata?.metadata || {}) as Record<string, unknown>\n}\n"],"mappings":";AAAA,SAASA,gBAAgB,EAAEC,cAAc,QAAQ,uBAAuB;AACxE,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AAGzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,GAAG,QAAQ,wCAAwC;AAC5D,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,cAAc,EAAEC,aAAa,QAAQ,yBAAyB;AACvE,SAASC,MAAM,EAAEC,GAAG,QAAQ,kBAAkB;AAM9C,OAAO,MAAMC,eAAe,GAAG;EAC7BC,yBAAyB,EAAE,wCAAwC;EACnEC,wBAAwB,EAAE,uCAAuC;EACjEC,gBAAgB,EAAE,8BAA8B;EAChDC,oBAAoB,EAAE;AACxB,CAA4D;AAS5D,SAASC,aAAaA,CAACC,OAAe,EAAU;EAC9C,OAAOR,MAAM,CAACQ,OAAO,CAAC,CAACC,QAAQ,CAACR,GAAG,CAACS,GAAG,CAAC;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A,MAAAsB,EAAA;EAAA;IAAAN,EAAA,GAAAhB,CAAA;IAAAsB,EAAA,GAAAtB,CAAA;EAAA;EANlClE,SAAS,CAACkF,EAMT,EAAEM,EAA+B,CAAC;AAAA;AAGrC,OAAO,SAASE,0BAA0BA,CAACC,QAE1C,EAAE;EACD,OAAOxF,eAAe,CAACwF,QAAQ,EAAEC,iBAAiB,EAAEjB,QAAQ,IAAI,CAAC,CAAC,CAAC;AACrE;AAvDmC,SAAAI,MAAAvD,KAAA;EAmBzBK,oBAAoB,CAACL,KAAK,EAAE,SAAS,CAAC;EAAA,OAC/B,EAAE;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AttachmentFlaggedEvent } from './attachment_events';
|
|
2
2
|
import type { ConversationCreatedEvent, ConversationDeletedEvent, ConversationUpdatedEvent, ConversationReadEvent } from './conversation_events';
|
|
3
3
|
import type { MessageCreatedEvent, MessageDeletedEvent, MessageUpdatedEvent } from './message_events';
|
|
4
|
+
import type { StreamUserEventType, StreamUserUpdatedEvent } from './person_events';
|
|
4
5
|
import type { ReactionCreatedEvent, ReactionDeletedEvent } from './reaction_events';
|
|
5
6
|
import type { TypingBroadcastEvent } from './typing_events';
|
|
6
7
|
export type JoltConversationEvent = ConversationCreatedEvent | ConversationUpdatedEvent | ConversationDeletedEvent | ConversationReadEvent;
|
|
@@ -8,6 +9,7 @@ export type JoltMessageEvent = MessageCreatedEvent | MessageUpdatedEvent | Messa
|
|
|
8
9
|
export type JoltReactionEvent = ReactionCreatedEvent | ReactionDeletedEvent;
|
|
9
10
|
export type JoltTypingEvent = TypingBroadcastEvent;
|
|
10
11
|
export type JoltAttachmentEvent = AttachmentFlaggedEvent;
|
|
12
|
+
export type { StreamUserEventType, StreamUserUpdatedEvent };
|
|
11
13
|
export type CustomJoltEvent = JoltConversationEvent | JoltMessageEvent | JoltReactionEvent | JoltTypingEvent | JoltAttachmentEvent;
|
|
12
14
|
export type JoltEventName = CustomJoltEvent['event'] | 'STREAM_USER_UPDATED';
|
|
13
15
|
export type JoltSubscriptionPattern = JoltEventName | 'reaction.*';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,qBAAqB,GAC7B,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GACxB,qBAAqB,CAAA;AACzB,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAC9F,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,oBAAoB,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAClD,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,qBAAqB,GAC7B,wBAAwB,GACxB,wBAAwB,GACxB,wBAAwB,GACxB,qBAAqB,CAAA;AACzB,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAC9F,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,oBAAoB,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAClD,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;AACxD,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAA;AAE3D,MAAM,MAAM,eAAe,GACvB,qBAAqB,GACrB,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,GACf,mBAAmB,CAAA;AAEvB,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,qBAAqB,CAAA;AAC5E,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/types/jolt_events/index.ts"],"sourcesContent":["import type { AttachmentFlaggedEvent } from './attachment_events'\nimport type {\n ConversationCreatedEvent,\n ConversationDeletedEvent,\n ConversationUpdatedEvent,\n ConversationReadEvent,\n} from './conversation_events'\nimport type {\n MessageCreatedEvent,\n MessageDeletedEvent,\n MessageUpdatedEvent,\n} from './message_events'\nimport type { ReactionCreatedEvent, ReactionDeletedEvent } from './reaction_events'\nimport type { TypingBroadcastEvent } from './typing_events'\n\nexport type JoltConversationEvent =\n | ConversationCreatedEvent\n | ConversationUpdatedEvent\n | ConversationDeletedEvent\n | ConversationReadEvent\nexport type JoltMessageEvent = MessageCreatedEvent | MessageUpdatedEvent | MessageDeletedEvent\nexport type JoltReactionEvent = ReactionCreatedEvent | ReactionDeletedEvent\nexport type JoltTypingEvent = TypingBroadcastEvent\nexport type JoltAttachmentEvent = AttachmentFlaggedEvent\n\nexport type CustomJoltEvent =\n | JoltConversationEvent\n | JoltMessageEvent\n | JoltReactionEvent\n | JoltTypingEvent\n | JoltAttachmentEvent\n\nexport type JoltEventName = CustomJoltEvent['event'] | 'STREAM_USER_UPDATED'\nexport type JoltSubscriptionPattern = JoltEventName | 'reaction.*'\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/types/jolt_events/index.ts"],"sourcesContent":["import type { AttachmentFlaggedEvent } from './attachment_events'\nimport type {\n ConversationCreatedEvent,\n ConversationDeletedEvent,\n ConversationUpdatedEvent,\n ConversationReadEvent,\n} from './conversation_events'\nimport type {\n MessageCreatedEvent,\n MessageDeletedEvent,\n MessageUpdatedEvent,\n} from './message_events'\nimport type { StreamUserEventType, StreamUserUpdatedEvent } from './person_events'\nimport type { ReactionCreatedEvent, ReactionDeletedEvent } from './reaction_events'\nimport type { TypingBroadcastEvent } from './typing_events'\n\nexport type JoltConversationEvent =\n | ConversationCreatedEvent\n | ConversationUpdatedEvent\n | ConversationDeletedEvent\n | ConversationReadEvent\nexport type JoltMessageEvent = MessageCreatedEvent | MessageUpdatedEvent | MessageDeletedEvent\nexport type JoltReactionEvent = ReactionCreatedEvent | ReactionDeletedEvent\nexport type JoltTypingEvent = TypingBroadcastEvent\nexport type JoltAttachmentEvent = AttachmentFlaggedEvent\nexport type { StreamUserEventType, StreamUserUpdatedEvent }\n\nexport type CustomJoltEvent =\n | JoltConversationEvent\n | JoltMessageEvent\n | JoltReactionEvent\n | JoltTypingEvent\n | JoltAttachmentEvent\n\nexport type JoltEventName = CustomJoltEvent['event'] | 'STREAM_USER_UPDATED'\nexport type JoltSubscriptionPattern = JoltEventName | 'reaction.*'\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection';
|
|
2
|
+
export type StreamUserEventType = 'message.created' | 'conversation.mark_read' | 'conversation.mark_unread' | 'conversation.destroy' | 'person.mark_all_read' | 'app_grant.synced';
|
|
3
|
+
export interface StreamUserUpdatedEvent extends CustomMessage {
|
|
4
|
+
event: 'STREAM_USER_UPDATED';
|
|
5
|
+
data: {
|
|
6
|
+
data: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=person_events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"person_events.d.ts","sourceRoot":"","sources":["../../../src/types/jolt_events/person_events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAE1F,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,wBAAwB,GACxB,0BAA0B,GAC1B,sBAAsB,GACtB,sBAAsB,GACtB,kBAAkB,CAAA;AAEtB,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,KAAK,EAAE,qBAAqB,CAAA;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"person_events.js","names":[],"sources":["../../../src/types/jolt_events/person_events.ts"],"sourcesContent":["import type { CustomMessage } from '@planningcenter/jolt-client/dist/types/JoltConnection'\n\nexport type StreamUserEventType =\n | 'message.created'\n | 'conversation.mark_read'\n | 'conversation.mark_unread'\n | 'conversation.destroy'\n | 'person.mark_all_read'\n | 'app_grant.synced'\n\nexport interface StreamUserUpdatedEvent extends CustomMessage {\n event: 'STREAM_USER_UPDATED'\n data: {\n data: string\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse_stream_user_event_type.d.ts","sourceRoot":"","sources":["../../../src/utils/jolt/parse_stream_user_event_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAM1F,eAAO,MAAM,wBAAwB,GACnC,OAAO,sBAAsB,KAC5B,mBAAmB,GAAG,SAOxB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse_stream_user_event_type.js","names":["parseStreamUserEventType","event","parsed","JSON","parse","data","event_type","undefined"],"sources":["../../../src/utils/jolt/parse_stream_user_event_type.ts"],"sourcesContent":["import type { StreamUserEventType, StreamUserUpdatedEvent } from '../../types/jolt_events'\n\ninterface StreamUserEventData {\n event_type?: StreamUserEventType\n}\n\nexport const parseStreamUserEventType = (\n event: StreamUserUpdatedEvent\n): StreamUserEventType | undefined => {\n try {\n const parsed = JSON.parse(event.data.data) as StreamUserEventData | null\n return parsed?.event_type\n } catch {\n return undefined\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,wBAAwB,GACnCC,KAA6B,IACO;EACpC,IAAI;IACF,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,IAAI,CAACA,IAAI,CAA+B;IACxE,OAAOH,MAAM,EAAEI,UAAU;EAC3B,CAAC,CAAC,MAAM;IACN,OAAOC,SAAS;EAClB;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { ProductAnalyticsConfig } from '../types/product_analytics';
|
|
3
|
+
import { Session } from './session';
|
|
4
|
+
export interface StoredProductAnalyticsConfig extends ProductAnalyticsConfig {
|
|
5
|
+
expiresAt: number;
|
|
6
|
+
personId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const TOKEN_EXPIRY_TIME: number;
|
|
9
|
+
export declare const productAnalyticsStorageKey: (session: Session) => string;
|
|
10
|
+
export declare const productAnalyticsQueryKey: (session: Session) => string[];
|
|
11
|
+
export declare function fetchProductAnalyticsConfig(queryClient: QueryClient, session: Session): Promise<StoredProductAnalyticsConfig>;
|
|
12
|
+
//# sourceMappingURL=product_analytics_token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product_analytics_token.d.ts","sourceRoot":"","sources":["../../src/utils/product_analytics_token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAGnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,MAAM,WAAW,4BAA6B,SAAQ,sBAAsB;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,iBAAiB,QAAwB,CAAA;AAKtD,eAAO,MAAM,0BAA0B,GAAI,SAAS,OAAO,WACjB,CAAA;AAE1C,eAAO,MAAM,wBAAwB,GAAI,SAAS,OAAO,aAIxD,CAAA;AAyED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,4BAA4B,CAAC,CASvC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { currentPersonQueryKey } from '../hooks/use_current_person';
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
import { Storage } from './native_adapters';
|
|
4
|
+
import { ONE_HOUR, toMs } from './time';
|
|
5
|
+
import { Uri } from './uri';
|
|
6
|
+
export const TOKEN_EXPIRY_TIME = toMs(7 * 24, 'hours');
|
|
7
|
+
const EXPIRY_MARGIN = ONE_HOUR;
|
|
8
|
+
|
|
9
|
+
// One slot per environment, tagged with the person it belongs to. Keying on
|
|
10
|
+
// session.id would miss on every access-token refresh and leave orphaned entries.
|
|
11
|
+
export const productAnalyticsStorageKey = session => `product-analytics-token:${session.env}`;
|
|
12
|
+
export const productAnalyticsQueryKey = session => ['product-analytics-token', session.env, session.id];
|
|
13
|
+
const renewalTime = config => config.expiresAt - EXPIRY_MARGIN;
|
|
14
|
+
const isStoredConfig = value => typeof value === 'object' && value !== null && typeof value.token === 'string' && typeof value.endpoint === 'string' && typeof value.expiresAt === 'number' && typeof value.personId === 'string';
|
|
15
|
+
async function readStoredConfig(key) {
|
|
16
|
+
try {
|
|
17
|
+
const raw = await Storage.getItem(key);
|
|
18
|
+
if (!raw) return undefined;
|
|
19
|
+
const parsed = JSON.parse(raw);
|
|
20
|
+
return isStoredConfig(parsed) ? parsed : undefined;
|
|
21
|
+
} catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function writeStoredConfig(key, config) {
|
|
26
|
+
return Storage.setItem(key, JSON.stringify(config)).catch(() => {});
|
|
27
|
+
}
|
|
28
|
+
function requestConfig(session, personId) {
|
|
29
|
+
const uri = new Uri({
|
|
30
|
+
session
|
|
31
|
+
});
|
|
32
|
+
const client = new Client({
|
|
33
|
+
root: uri.api('/chat/v2'),
|
|
34
|
+
defaultHeaders: uri.headers,
|
|
35
|
+
version: '2018-11-01'
|
|
36
|
+
});
|
|
37
|
+
return client.post({
|
|
38
|
+
url: '/me/product_analytics_authorize',
|
|
39
|
+
data: {
|
|
40
|
+
data: {
|
|
41
|
+
type: 'ProductAnalyticsToken',
|
|
42
|
+
attributes: {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}).then(res => ({
|
|
46
|
+
token: res.data.id,
|
|
47
|
+
endpoint: res.data.url,
|
|
48
|
+
metadata: res.data.metadata,
|
|
49
|
+
expiresAt: Date.now() + TOKEN_EXPIRY_TIME,
|
|
50
|
+
personId
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The chat screens that publish events already load /me, and the package's query
|
|
55
|
+
// client is cleared whenever the access token changes, so this is normally a cache hit.
|
|
56
|
+
async function currentPersonId(queryClient) {
|
|
57
|
+
const {
|
|
58
|
+
data
|
|
59
|
+
} = await queryClient.ensureQueryData({
|
|
60
|
+
queryKey: currentPersonQueryKey
|
|
61
|
+
});
|
|
62
|
+
return String(data.id);
|
|
63
|
+
}
|
|
64
|
+
async function loadConfig(queryClient, session) {
|
|
65
|
+
const personId = await currentPersonId(queryClient);
|
|
66
|
+
const key = productAnalyticsStorageKey(session);
|
|
67
|
+
const stored = await readStoredConfig(key);
|
|
68
|
+
if (stored && stored.personId === personId && renewalTime(stored) > Date.now()) return stored;
|
|
69
|
+
const config = await requestConfig(session, personId);
|
|
70
|
+
await writeStoredConfig(key, config);
|
|
71
|
+
return config;
|
|
72
|
+
}
|
|
73
|
+
export function fetchProductAnalyticsConfig(queryClient, session) {
|
|
74
|
+
return queryClient.fetchQuery({
|
|
75
|
+
queryKey: productAnalyticsQueryKey(session),
|
|
76
|
+
queryFn: () => loadConfig(queryClient, session),
|
|
77
|
+
staleTime: ({
|
|
78
|
+
state
|
|
79
|
+
}) => state.data ? Math.max(0, renewalTime(state.data) - state.dataUpdatedAt) : 0,
|
|
80
|
+
gcTime: TOKEN_EXPIRY_TIME,
|
|
81
|
+
retry: false
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=product_analytics_token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product_analytics_token.js","names":["currentPersonQueryKey","Client","Storage","ONE_HOUR","toMs","Uri","TOKEN_EXPIRY_TIME","EXPIRY_MARGIN","productAnalyticsStorageKey","session","env","productAnalyticsQueryKey","id","renewalTime","config","expiresAt","isStoredConfig","value","token","endpoint","personId","readStoredConfig","key","raw","getItem","undefined","parsed","JSON","parse","writeStoredConfig","setItem","stringify","catch","requestConfig","uri","client","root","api","defaultHeaders","headers","version","post","url","data","type","attributes","then","res","metadata","Date","now","currentPersonId","queryClient","ensureQueryData","queryKey","String","loadConfig","stored","fetchProductAnalyticsConfig","fetchQuery","queryFn","staleTime","state","Math","max","dataUpdatedAt","gcTime","retry"],"sources":["../../src/utils/product_analytics_token.ts"],"sourcesContent":["import { QueryClient } from '@tanstack/react-query'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { ApiResource, CurrentPersonResource } from '../types'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { Client } from './client'\nimport { Storage } from './native_adapters'\nimport { Session } from './session'\nimport { ONE_HOUR, toMs } from './time'\nimport { Uri } from './uri'\n\ninterface ProductAnalyticsTokenResponse {\n type: 'ProductAnalyticsToken'\n id: string\n url: string\n metadata: Record<string, unknown>\n}\n\nexport interface StoredProductAnalyticsConfig extends ProductAnalyticsConfig {\n expiresAt: number\n personId: string\n}\n\nexport const TOKEN_EXPIRY_TIME = toMs(7 * 24, 'hours')\nconst EXPIRY_MARGIN = ONE_HOUR\n\n// One slot per environment, tagged with the person it belongs to. Keying on\n// session.id would miss on every access-token refresh and leave orphaned entries.\nexport const productAnalyticsStorageKey = (session: Session) =>\n `product-analytics-token:${session.env}`\n\nexport const productAnalyticsQueryKey = (session: Session) => [\n 'product-analytics-token',\n session.env,\n session.id,\n]\n\nconst renewalTime = (config: StoredProductAnalyticsConfig) => config.expiresAt - EXPIRY_MARGIN\n\nconst isStoredConfig = (value: unknown): value is StoredProductAnalyticsConfig =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as StoredProductAnalyticsConfig).token === 'string' &&\n typeof (value as StoredProductAnalyticsConfig).endpoint === 'string' &&\n typeof (value as StoredProductAnalyticsConfig).expiresAt === 'number' &&\n typeof (value as StoredProductAnalyticsConfig).personId === 'string'\n\nasync function readStoredConfig(key: string): Promise<StoredProductAnalyticsConfig | undefined> {\n try {\n const raw = await Storage.getItem(key)\n if (!raw) return undefined\n\n const parsed: unknown = JSON.parse(raw)\n return isStoredConfig(parsed) ? parsed : undefined\n } catch {\n return undefined\n }\n}\n\nfunction writeStoredConfig(key: string, config: StoredProductAnalyticsConfig): Promise<void> {\n return Storage.setItem(key, JSON.stringify(config)).catch(() => {})\n}\n\nfunction requestConfig(session: Session, personId: string): Promise<StoredProductAnalyticsConfig> {\n const uri = new Uri({ session })\n const client = new Client({\n root: uri.api('/chat/v2'),\n defaultHeaders: uri.headers,\n version: '2018-11-01',\n })\n\n return client\n .post<ApiResource<ProductAnalyticsTokenResponse>>({\n url: '/me/product_analytics_authorize',\n data: { data: { type: 'ProductAnalyticsToken', attributes: {} } },\n })\n .then(res => ({\n token: res.data.id,\n endpoint: res.data.url,\n metadata: res.data.metadata,\n expiresAt: Date.now() + TOKEN_EXPIRY_TIME,\n personId,\n }))\n}\n\n// The chat screens that publish events already load /me, and the package's query\n// client is cleared whenever the access token changes, so this is normally a cache hit.\nasync function currentPersonId(queryClient: QueryClient): Promise<string> {\n const { data } = await queryClient.ensureQueryData<ApiResource<CurrentPersonResource>>({\n queryKey: currentPersonQueryKey,\n })\n return String(data.id)\n}\n\nasync function loadConfig(\n queryClient: QueryClient,\n session: Session\n): Promise<StoredProductAnalyticsConfig> {\n const personId = await currentPersonId(queryClient)\n const key = productAnalyticsStorageKey(session)\n const stored = await readStoredConfig(key)\n if (stored && stored.personId === personId && renewalTime(stored) > Date.now()) return stored\n\n const config = await requestConfig(session, personId)\n await writeStoredConfig(key, config)\n return config\n}\n\nexport function fetchProductAnalyticsConfig(\n queryClient: QueryClient,\n session: Session\n): Promise<StoredProductAnalyticsConfig> {\n return queryClient.fetchQuery({\n queryKey: productAnalyticsQueryKey(session),\n queryFn: () => loadConfig(queryClient, session),\n staleTime: ({ state }) =>\n state.data ? Math.max(0, renewalTime(state.data) - state.dataUpdatedAt) : 0,\n gcTime: TOKEN_EXPIRY_TIME,\n retry: false,\n })\n}\n"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,6BAA6B;AAGnE,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,OAAO,QAAQ,mBAAmB;AAE3C,SAASC,QAAQ,EAAEC,IAAI,QAAQ,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EAC/C,MAAMgD,MAAM,GAAG,MAAMpC,gBAAgB,CAACC,GAAG,CAAC;EAC1C,IAAImC,MAAM,IAAIA,MAAM,CAACrC,QAAQ,KAAKA,QAAQ,IAAIP,WAAW,CAAC4C,MAAM,CAAC,GAAGR,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,OAAOO,MAAM;EAE7F,MAAM3C,MAAM,GAAG,MAAMmB,aAAa,CAACxB,OAAO,EAAEW,QAAQ,CAAC;EACrD,MAAMS,iBAAiB,CAACP,GAAG,EAAER,MAAM,CAAC;EACpC,OAAOA,MAAM;AACf;AAEA,OAAO,SAAS4C,2BAA2BA,CACzCN,WAAwB,EACxB3C,OAAgB,EACuB;EACvC,OAAO2C,WAAW,CAACO,UAAU,CAAC;IAC5BL,QAAQ,EAAE3C,wBAAwB,CAACF,OAAO,CAAC;IAC3CmD,OAAO,EAAEA,CAAA,KAAMJ,UAAU,CAACJ,WAAW,EAAE3C,OAAO,CAAC;IAC/CoD,SAAS,EAAEA,CAAC;MAAEC;IAAM,CAAC,KACnBA,KAAK,CAACnB,IAAI,GAAGoB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEnD,WAAW,CAACiD,KAAK,CAACnB,IAAI,CAAC,GAAGmB,KAAK,CAACG,aAAa,CAAC,GAAG,CAAC;IAC7EC,MAAM,EAAE5D,iBAAiB;IACzB6D,KAAK,EAAE;EACT,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QueryClient, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
export declare const REFRESH_THROTTLE_MS = 3000;
|
|
3
|
+
type Refresh = () => unknown;
|
|
4
|
+
export declare const throttledRefresh: (queryClient: QueryClient, key: QueryKey, event: object, refresh: Refresh) => void;
|
|
5
|
+
export declare const cancelThrottledRefreshes: (queryClient: QueryClient) => void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=throttled_refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttled_refresh.d.ts","sourceRoot":"","sources":["../../src/utils/throttled_refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGtE,eAAO,MAAM,mBAAmB,OAAO,CAAA;AAEvC,KAAK,OAAO,GAAG,MAAM,OAAO,CAAA;AAqC5B,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,EACxB,KAAK,QAAQ,EACb,OAAO,MAAM,EACb,SAAS,OAAO,SAOjB,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,SAMhE,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { hashKey } from '@tanstack/react-query';
|
|
2
|
+
import { throttle } from 'lodash';
|
|
3
|
+
export const REFRESH_THROTTLE_MS = 3000;
|
|
4
|
+
const refreshesByClient = new WeakMap();
|
|
5
|
+
const refreshesFor = queryClient => {
|
|
6
|
+
const existing = refreshesByClient.get(queryClient);
|
|
7
|
+
if (existing) return existing;
|
|
8
|
+
const refreshes = new Map();
|
|
9
|
+
refreshesByClient.set(queryClient, refreshes);
|
|
10
|
+
return refreshes;
|
|
11
|
+
};
|
|
12
|
+
const throttledRefreshFor = (queryClient, key) => {
|
|
13
|
+
const refreshes = refreshesFor(queryClient);
|
|
14
|
+
const hashedKey = hashKey(key);
|
|
15
|
+
const existing = refreshes.get(hashedKey);
|
|
16
|
+
if (existing) return existing;
|
|
17
|
+
const created = {
|
|
18
|
+
run: throttle(refresh => {
|
|
19
|
+
refresh();
|
|
20
|
+
}, REFRESH_THROTTLE_MS, {
|
|
21
|
+
leading: true,
|
|
22
|
+
trailing: true
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
refreshes.set(hashedKey, created);
|
|
26
|
+
return created;
|
|
27
|
+
};
|
|
28
|
+
export const throttledRefresh = (queryClient, key, event, refresh) => {
|
|
29
|
+
const throttled = throttledRefreshFor(queryClient, key);
|
|
30
|
+
if (throttled.lastEvent === event) return;
|
|
31
|
+
throttled.lastEvent = event;
|
|
32
|
+
throttled.run(refresh);
|
|
33
|
+
};
|
|
34
|
+
export const cancelThrottledRefreshes = queryClient => {
|
|
35
|
+
const refreshes = refreshesByClient.get(queryClient);
|
|
36
|
+
if (!refreshes) return;
|
|
37
|
+
refreshes.forEach(({
|
|
38
|
+
run
|
|
39
|
+
}) => run.cancel());
|
|
40
|
+
refreshesByClient.delete(queryClient);
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=throttled_refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttled_refresh.js","names":["hashKey","throttle","REFRESH_THROTTLE_MS","refreshesByClient","WeakMap","refreshesFor","queryClient","existing","get","refreshes","Map","set","throttledRefreshFor","key","hashedKey","created","run","refresh","leading","trailing","throttledRefresh","event","throttled","lastEvent","cancelThrottledRefreshes","forEach","cancel","delete"],"sources":["../../src/utils/throttled_refresh.ts"],"sourcesContent":["import { hashKey, QueryClient, QueryKey } from '@tanstack/react-query'\nimport { DebouncedFuncLeading, throttle } from 'lodash'\n\nexport const REFRESH_THROTTLE_MS = 3000\n\ntype Refresh = () => unknown\n\ninterface ThrottledRefresh {\n run: DebouncedFuncLeading<(refresh: Refresh) => void>\n lastEvent?: object\n}\n\nconst refreshesByClient = new WeakMap<QueryClient, Map<string, ThrottledRefresh>>()\n\nconst refreshesFor = (queryClient: QueryClient) => {\n const existing = refreshesByClient.get(queryClient)\n if (existing) return existing\n\n const refreshes = new Map<string, ThrottledRefresh>()\n refreshesByClient.set(queryClient, refreshes)\n return refreshes\n}\n\nconst throttledRefreshFor = (queryClient: QueryClient, key: QueryKey) => {\n const refreshes = refreshesFor(queryClient)\n const hashedKey = hashKey(key)\n const existing = refreshes.get(hashedKey)\n if (existing) return existing\n\n const created: ThrottledRefresh = {\n run: throttle(\n (refresh: Refresh) => {\n refresh()\n },\n REFRESH_THROTTLE_MS,\n { leading: true, trailing: true }\n ),\n }\n refreshes.set(hashedKey, created)\n return created\n}\n\nexport const throttledRefresh = (\n queryClient: QueryClient,\n key: QueryKey,\n event: object,\n refresh: Refresh\n) => {\n const throttled = throttledRefreshFor(queryClient, key)\n if (throttled.lastEvent === event) return\n\n throttled.lastEvent = event\n throttled.run(refresh)\n}\n\nexport const cancelThrottledRefreshes = (queryClient: QueryClient) => {\n const refreshes = refreshesByClient.get(queryClient)\n if (!refreshes) return\n\n refreshes.forEach(({ run }) => run.cancel())\n refreshesByClient.delete(queryClient)\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAA+B,uBAAuB;AACtE,SAA+BC,QAAQ,QAAQ,QAAQ;AAEvD,OAAO,MAAMC,mBAAmB,GAAG,IAAI;AASvC,MAAMC,iBAAiB,GAAG,IAAIC,OAAO,CAA6C,CAAC;AAEnF,MAAMC,YAAY,GAAIC,WAAwB,IAAK;EACjD,MAAMC,QAAQ,GAAGJ,iBAAiB,CAACK,GAAG,CAACF,WAAW,CAAC;EACnD,IAAIC,QAAQ,EAAE,OAAOA,QAAQ;EAE7B,MAAME,SAAS,GAAG,IAAIC,GAAG,CAA2B,CAAC;EACrDP,iBAAiB,CAACQ,GAAG,CAACL,WAAW,EAAEG,SAAS,CAAC;EAC7C,OAAOA,SAAS;AAClB,CAAC;AAED,MAAMG,mBAAmB,GAAGA,CAACN,WAAwB,EAAEO,GAAa,KAAK;EACvE,MAAMJ,SAAS,GAAGJ,YAAY,CAACC,WAAW,CAAC;EAC3C,MAAMQ,SAAS,GAAGd,OAAO,CAACa,GAAG,CAAC;EAC9B,MAAMN,QAAQ,GAAGE,SAAS,CAACD,GAAG,CAACM,SAAS,CAAC;EACzC,IAAIP,QAAQ,EAAE,OAAOA,QAAQ;EAE7B,MAAMQ,OAAyB,GAAG;IAChCC,GAAG,EAAEf,QAAQ,CACVgB,OAAgB,IAAK;MACpBA,OAAO,CAAC,CAAC;IACX,CAAC,EACDf,mBAAmB,EACnB;MAAEgB,OAAO,EAAE,IAAI;MAAEC,QAAQ,EAAE;IAAK,CAClC;EACF,CAAC;EACDV,SAAS,CAACE,GAAG,CAACG,SAAS,EAAEC,OAAO,CAAC;EACjC,OAAOA,OAAO;AAChB,CAAC;AAED,OAAO,MAAMK,gBAAgB,GAAGA,CAC9Bd,WAAwB,EACxBO,GAAa,EACbQ,KAAa,EACbJ,OAAgB,KACb;EACH,MAAMK,SAAS,GAAGV,mBAAmB,CAACN,WAAW,EAAEO,GAAG,CAAC;EACvD,IAAIS,SAAS,CAACC,SAAS,KAAKF,KAAK,EAAE;EAEnCC,SAAS,CAACC,SAAS,GAAGF,KAAK;EAC3BC,SAAS,CAACN,GAAG,CAACC,OAAO,CAAC;AACxB,CAAC;AAED,OAAO,MAAMO,wBAAwB,GAAIlB,WAAwB,IAAK;EACpE,MAAMG,SAAS,GAAGN,iBAAiB,CAACK,GAAG,CAACF,WAAW,CAAC;EACpD,IAAI,CAACG,SAAS,EAAE;EAEhBA,SAAS,CAACgB,OAAO,CAAC,CAAC;IAAET;EAAI,CAAC,KAAKA,GAAG,CAACU,MAAM,CAAC,CAAC,CAAC;EAC5CvB,iBAAiB,CAACwB,MAAM,CAACrB,WAAW,CAAC;AACvC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.7.1-qa-staging.
|
|
3
|
+
"version": "4.7.1-qa-staging.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
35
35
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
36
|
-
"@planningcenter/emoji-keyboard": "4.7.1-qa-staging.
|
|
36
|
+
"@planningcenter/emoji-keyboard": "4.7.1-qa-staging.9",
|
|
37
37
|
"lodash-inflection": "^1.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "47aa10d415508bd5afbeaaf09a4876ee24702049"
|
|
88
88
|
}
|