turbodesk-livechat-react-native 0.1.0-alpha.24 → 0.1.0-alpha.26
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/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/provider/LiveChatContext.js +2 -2
- package/dist/provider/LiveChatContext.js.map +1 -1
- package/dist/provider/LiveChatProvider.d.ts.map +1 -1
- package/dist/provider/LiveChatProvider.js +3 -4
- package/dist/provider/LiveChatProvider.js.map +1 -1
- package/dist/provider/types.d.ts +2 -2
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/ui/components/ConversationScreen.js +3 -2
- package/dist/ui/components/ConversationScreen.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -2
- package/src/provider/LiveChatContext.ts +2 -2
- package/src/provider/LiveChatProvider.tsx +396 -397
- package/src/provider/types.ts +63 -63
- package/src/ui/components/ConversationScreen.tsx +370 -370
- package/dist/hooks/use-suppress-foreground-notification.d.ts +0 -20
- package/dist/hooks/use-suppress-foreground-notification.d.ts.map +0 -1
- package/dist/hooks/use-suppress-foreground-notification.js +0 -31
- package/dist/hooks/use-suppress-foreground-notification.js.map +0 -1
- package/src/hooks/use-suppress-foreground-notification.ts +0 -28
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a function to check whether a foreground FCM notification
|
|
3
|
-
* should be suppressed because the user is already viewing that conversation.
|
|
4
|
-
*
|
|
5
|
-
* Usage in your FCM foreground handler:
|
|
6
|
-
*
|
|
7
|
-
* ```tsx
|
|
8
|
-
* const shouldSuppress = useSuppressForegroundNotification();
|
|
9
|
-
*
|
|
10
|
-
* useEffect(() => {
|
|
11
|
-
* return messaging().onMessage(async (remoteMessage) => {
|
|
12
|
-
* const conversationId = remoteMessage.data?.conversationId;
|
|
13
|
-
* if (shouldSuppress(conversationId)) return; // already viewing it
|
|
14
|
-
* // otherwise show local notification
|
|
15
|
-
* });
|
|
16
|
-
* }, []);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function useSuppressForegroundNotification(): (incomingConversationId?: string | null) => boolean;
|
|
20
|
-
//# sourceMappingURL=use-suppress-foreground-notification.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-suppress-foreground-notification.d.ts","sourceRoot":"","sources":["../../src/hooks/use-suppress-foreground-notification.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iCAAiC,KAGvC,yBAAyB,MAAM,GAAG,IAAI,KAAG,OAAO,CAIzD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSuppressForegroundNotification = useSuppressForegroundNotification;
|
|
4
|
-
const LiveChatContext_1 = require("../provider/LiveChatContext");
|
|
5
|
-
/**
|
|
6
|
-
* Returns a function to check whether a foreground FCM notification
|
|
7
|
-
* should be suppressed because the user is already viewing that conversation.
|
|
8
|
-
*
|
|
9
|
-
* Usage in your FCM foreground handler:
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* const shouldSuppress = useSuppressForegroundNotification();
|
|
13
|
-
*
|
|
14
|
-
* useEffect(() => {
|
|
15
|
-
* return messaging().onMessage(async (remoteMessage) => {
|
|
16
|
-
* const conversationId = remoteMessage.data?.conversationId;
|
|
17
|
-
* if (shouldSuppress(conversationId)) return; // already viewing it
|
|
18
|
-
* // otherwise show local notification
|
|
19
|
-
* });
|
|
20
|
-
* }, []);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function useSuppressForegroundNotification() {
|
|
24
|
-
const { activeConversationId } = (0, LiveChatContext_1.useLiveChatContext)();
|
|
25
|
-
return (incomingConversationId) => {
|
|
26
|
-
if (!incomingConversationId || !activeConversationId)
|
|
27
|
-
return false;
|
|
28
|
-
return String(incomingConversationId) === String(activeConversationId);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=use-suppress-foreground-notification.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-suppress-foreground-notification.js","sourceRoot":"","sources":["../../src/hooks/use-suppress-foreground-notification.ts"],"names":[],"mappings":";;AAoBA,8EAOC;AA3BD,iEAAiE;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,iCAAiC;IAC/C,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAA,oCAAkB,GAAE,CAAC;IAEtD,OAAO,CAAC,sBAAsC,EAAW,EAAE;QACzD,IAAI,CAAC,sBAAsB,IAAI,CAAC,oBAAoB;YAAE,OAAO,KAAK,CAAC;QACnE,OAAO,MAAM,CAAC,sBAAsB,CAAC,KAAK,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useLiveChatContext } from "../provider/LiveChatContext";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns a function to check whether a foreground FCM notification
|
|
5
|
-
* should be suppressed because the user is already viewing that conversation.
|
|
6
|
-
*
|
|
7
|
-
* Usage in your FCM foreground handler:
|
|
8
|
-
*
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const shouldSuppress = useSuppressForegroundNotification();
|
|
11
|
-
*
|
|
12
|
-
* useEffect(() => {
|
|
13
|
-
* return messaging().onMessage(async (remoteMessage) => {
|
|
14
|
-
* const conversationId = remoteMessage.data?.conversationId;
|
|
15
|
-
* if (shouldSuppress(conversationId)) return; // already viewing it
|
|
16
|
-
* // otherwise show local notification
|
|
17
|
-
* });
|
|
18
|
-
* }, []);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export function useSuppressForegroundNotification() {
|
|
22
|
-
const { activeConversationId } = useLiveChatContext();
|
|
23
|
-
|
|
24
|
-
return (incomingConversationId?: string | null): boolean => {
|
|
25
|
-
if (!incomingConversationId || !activeConversationId) return false;
|
|
26
|
-
return String(incomingConversationId) === String(activeConversationId);
|
|
27
|
-
};
|
|
28
|
-
}
|