@planningcenter/chat-react-native 1.2.0 → 1.2.1-qa-44.1

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/.eslintrc.yml ADDED
@@ -0,0 +1,2 @@
1
+ root: true
2
+ extends: ['@react-native', '../../.eslintrc.yml']
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.2.1-qa-44.1 (2025-02-06)
7
+
8
+ **Note:** Version bump only for package @planningcenter/chat-react-native
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.2.0](https://github.com/planningcenter/chat-js/compare/v1.1.0...v1.2.0) (2025-01-16)
7
15
 
8
16
 
package/build/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
- import * as React from 'react';
2
- export declare function MyView(): React.JSX.Element;
1
+ import React from 'react';
2
+ export declare function PCOChat({ token, onTokenExpired, }: {
3
+ token?: OathToken;
4
+ onTokenExpired: () => void;
5
+ }): React.JSX.Element;
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,wBAAgB,MAAM,sBAErB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,cAAc,GACf,EAAE;IACD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B,qBAiCA"}
package/build/index.js CHANGED
@@ -1,7 +1,39 @@
1
- import * as React from 'react';
2
- // @ts-ignore
3
- import { Text } from 'react-native';
4
- export function MyView() {
5
- return <Text>Hello from the first package changes more change!</Text>;
1
+ import React, { useEffect, useState } from 'react';
2
+ import { FlatList, StyleSheet, Text } from 'react-native';
3
+ export function PCOChat({ token, onTokenExpired, }) {
4
+ const [conversations, setConversations] = useState(null);
5
+ const styles = useStyles();
6
+ useEffect(() => {
7
+ if (!token) {
8
+ return;
9
+ }
10
+ fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
11
+ headers: {
12
+ Authorization: `Bearer ${token.access_token}`,
13
+ },
14
+ })
15
+ .then(validateResponse)
16
+ .then(response => response.json())
17
+ .then(setConversations)
18
+ .catch(error => {
19
+ if (error.message === 'Token expired') {
20
+ onTokenExpired();
21
+ }
22
+ });
23
+ }, [onTokenExpired, token]);
24
+ return (<FlatList data={conversations?.data} ListEmptyComponent={<Text>No conversations</Text>} contentContainerStyle={styles.container} ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>} renderItem={({ item }) => <Text>{item.attributes.title}</Text>}/>);
6
25
  }
26
+ const useStyles = () => {
27
+ return StyleSheet.create({
28
+ container: { columnGap: 16 },
29
+ foo: { fontSize: 24 },
30
+ });
31
+ };
32
+ const validateResponse = (response) => {
33
+ const isExpired = response.status === 401;
34
+ if (isExpired) {
35
+ throw new Error('Token expired');
36
+ }
37
+ return response;
38
+ };
7
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,aAAa;AACb,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,UAAU,MAAM;IACpB,OAAO,CAAC,IAAI,CAAC,iDAAiD,EAAE,IAAI,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import * as React from 'react';\n// @ts-ignore\nimport { Text } from 'react-native';\n\nexport function MyView() {\n return <Text>Hello from the first package changes more change!</Text>;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"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AC,CAAC,CACnE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,EAC/D,CACH,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QAC5B,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;KACtB,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAA;IACzC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { FlatList, StyleSheet, Text } from 'react-native'\n\nexport function PCOChat({\n token,\n onTokenExpired,\n}: {\n token?: OathToken\n onTokenExpired: () => void\n}) {\n const [conversations, setConversations] = useState<any>(null)\n const styles = useStyles()\n\n useEffect(() => {\n if (!token) {\n return\n }\n\n fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {\n headers: {\n Authorization: `Bearer ${token.access_token}`,\n },\n })\n .then(validateResponse)\n .then(response => response.json())\n .then(setConversations)\n .catch(error => {\n if (error.message === 'Token expired') {\n onTokenExpired()\n }\n })\n }, [onTokenExpired, token])\n\n return (\n <FlatList\n data={conversations?.data}\n ListEmptyComponent={<Text>No conversations</Text>}\n contentContainerStyle={styles.container}\n ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}\n renderItem={({ item }) => <Text>{item.attributes.title}</Text>}\n />\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: { columnGap: 16 },\n foo: { fontSize: 24 },\n })\n}\n\nconst validateResponse = (response: Response) => {\n const isExpired = response.status === 401\n if (isExpired) {\n throw new Error('Token expired')\n }\n\n return response\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "1.2.0",
3
+ "version": "1.2.1-qa-44.1",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -10,11 +10,18 @@
10
10
  "clean": "expo-module clean",
11
11
  "lint": "expo-module lint",
12
12
  "test": "expo-module test",
13
- "prepublishOnly": "expo-module prepublishOnly",
14
- "postinstall": "yarn run build"
13
+ "prepublishOnly": "expo-module prepublishOnly"
14
+ },
15
+ "peerDependencies": {
16
+ "react": "*",
17
+ "react-native": "*"
15
18
  },
16
19
  "devDependencies": {
17
- "expo-module-scripts": "^3.4.0"
20
+ "@react-native/eslint-config": "^0.77.0",
21
+ "@typescript-eslint/parser": "^8.23.0",
22
+ "expo-module-scripts": "^3.4.0",
23
+ "prettier": "^3.4.2",
24
+ "react-native": "0.74.5"
18
25
  },
19
- "gitHead": "071d9fd8c01253cb7791c1300e2e5557a29f734e"
26
+ "gitHead": "93bd319b83622c779c45dc02d047ebe7805ac2c8"
20
27
  }
@@ -0,0 +1,12 @@
1
+ We currently maintain patches for:
2
+
3
+ - **stream-chat-expo**
4
+ - **stream-chat-react-native-core**
5
+
6
+ We expect these patches to be removed post-strexit
7
+
8
+
9
+ Some helpful context on the patches is available here: [chore(stream-chat): bump packages](https://github.com/planningcenter/ChurchCenterApp/pull/3534#discussion_r1852521860)
10
+
11
+
12
+ >"Streamchat doesn't follow new unreads but we have ui that allows you to swipe to mark read and unread. Their UI doesn't follow those updates so it feels like marking unread is broken because the UI doesn't update even though it totally works."
@@ -0,0 +1,105 @@
1
+ diff --git a/node_modules/stream-chat-expo/src/optionalDependencies/getLocalAssetUri.ts b/node_modules/stream-chat-expo/src/optionalDependencies/getLocalAssetUri.ts
2
+ index 3d79743..656c391 100644
3
+ --- a/node_modules/stream-chat-expo/src/optionalDependencies/getLocalAssetUri.ts
4
+ +++ b/node_modules/stream-chat-expo/src/optionalDependencies/getLocalAssetUri.ts
5
+ @@ -6,11 +6,11 @@ try {
6
+ // do nothing
7
+ }
8
+
9
+ -if (!MediaLibrary) {
10
+ - console.log(
11
+ - 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
12
+ - );
13
+ -}
14
+ +// if (!MediaLibrary) {
15
+ +// console.log(
16
+ +// 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
17
+ +// );
18
+ +// }
19
+
20
+ export const getLocalAssetUri = async (assetId: string): Promise<string | undefined> => {
21
+ try {
22
+ diff --git a/node_modules/stream-chat-expo/src/optionalDependencies/getPhotos.ts b/node_modules/stream-chat-expo/src/optionalDependencies/getPhotos.ts
23
+ index b40c745..4025b64 100644
24
+ --- a/node_modules/stream-chat-expo/src/optionalDependencies/getPhotos.ts
25
+ +++ b/node_modules/stream-chat-expo/src/optionalDependencies/getPhotos.ts
26
+ @@ -6,11 +6,11 @@ try {
27
+ // do nothing
28
+ }
29
+
30
+ -if (!MediaLibrary) {
31
+ - console.log(
32
+ - 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
33
+ - );
34
+ -}
35
+ +// if (!MediaLibrary) {
36
+ +// console.log(
37
+ +// 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
38
+ +// );
39
+ +// }
40
+ import type { Asset } from 'stream-chat-react-native-core';
41
+
42
+ type ReturnType = {
43
+ diff --git a/node_modules/stream-chat-expo/src/optionalDependencies/iOS14RefreshGallerySelection.ts b/node_modules/stream-chat-expo/src/optionalDependencies/iOS14RefreshGallerySelection.ts
44
+ index 49bfe50..22e1a39 100644
45
+ --- a/node_modules/stream-chat-expo/src/optionalDependencies/iOS14RefreshGallerySelection.ts
46
+ +++ b/node_modules/stream-chat-expo/src/optionalDependencies/iOS14RefreshGallerySelection.ts
47
+ @@ -8,11 +8,11 @@ try {
48
+ // do nothing
49
+ }
50
+
51
+ -if (!MediaLibrary) {
52
+ - console.log(
53
+ - 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
54
+ - );
55
+ -}
56
+ +// if (!MediaLibrary) {
57
+ +// console.log(
58
+ +// 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
59
+ +// );
60
+ +// }
61
+
62
+ const isAboveIOS14 = Platform.OS === 'ios' && parseInt(Platform.Version as string, 10) >= 14;
63
+
64
+ diff --git a/node_modules/stream-chat-expo/src/optionalDependencies/oniOS14GalleryLibrarySelectionChange.ts b/node_modules/stream-chat-expo/src/optionalDependencies/oniOS14GalleryLibrarySelectionChange.ts
65
+ index 89721ac..bdf6686 100644
66
+ --- a/node_modules/stream-chat-expo/src/optionalDependencies/oniOS14GalleryLibrarySelectionChange.ts
67
+ +++ b/node_modules/stream-chat-expo/src/optionalDependencies/oniOS14GalleryLibrarySelectionChange.ts
68
+ @@ -8,11 +8,11 @@ try {
69
+ // do nothing
70
+ }
71
+
72
+ -if (!MediaLibrary) {
73
+ - console.log(
74
+ - 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
75
+ - );
76
+ -}
77
+ +// if (!MediaLibrary) {
78
+ +// console.log(
79
+ +// 'expo-media-library is not installed. Please install it or you can choose to install expo-image-picker for native image picker.',
80
+ +// );
81
+ +// }
82
+
83
+ const isAboveIOS14 = Platform.OS === 'ios' && parseInt(Platform.Version as string, 10) >= 14;
84
+
85
+ diff --git a/node_modules/stream-chat-expo/src/optionalDependencies/triggerHaptic.ts b/node_modules/stream-chat-expo/src/optionalDependencies/triggerHaptic.ts
86
+ index e385bf3..476a13a 100644
87
+ --- a/node_modules/stream-chat-expo/src/optionalDependencies/triggerHaptic.ts
88
+ +++ b/node_modules/stream-chat-expo/src/optionalDependencies/triggerHaptic.ts
89
+ @@ -6,11 +6,11 @@ try {
90
+ // do nothing
91
+ }
92
+
93
+ -if (!Haptics) {
94
+ - console.log(
95
+ - 'expo-haptics is not installed. Installing this package will enable haptic feedback when scaling images in the image gallery if the scaling hits the higher or lower limits for its value.',
96
+ - );
97
+ -}
98
+ +// if (!Haptics) {
99
+ +// console.log(
100
+ +// 'expo-haptics is not installed. Installing this package will enable haptic feedback when scaling images in the image gallery if the scaling hits the higher or lower limits for its value.',
101
+ +// );
102
+ +// }
103
+
104
+ type HapticFeedbackTypes =
105
+ | 'impactHeavy'
@@ -0,0 +1,24 @@
1
+ diff --git a/node_modules/stream-chat-react-native-core/src/components/ChannelPreview/hooks/useChannelPreviewData.ts b/node_modules/stream-chat-react-native-core/src/components/ChannelPreview/hooks/useChannelPreviewData.ts
2
+ index a678e70..4beaf06 100644
3
+ --- a/node_modules/stream-chat-react-native-core/src/components/ChannelPreview/hooks/useChannelPreviewData.ts
4
+ +++ b/node_modules/stream-chat-react-native-core/src/components/ChannelPreview/hooks/useChannelPreviewData.ts
5
+ @@ -31,10 +31,16 @@ export const useChannelPreviewData = <
6
+ const channelLastMessageString = `${channelLastMessage?.id}${channelLastMessage?.updated_at}`;
7
+
8
+ useEffect(() => {
9
+ - const { unsubscribe } = client.on('notification.mark_read', () => {
10
+ + const handleMarkReadOrMarkUnread = () => {
11
+ setUnread(channel.countUnread());
12
+ - });
13
+ - return unsubscribe;
14
+ + }
15
+ +
16
+ + const listeners = [
17
+ + client.on('notification.mark_read', handleMarkReadOrMarkUnread),
18
+ + client.on('notification.mark_unread', handleMarkReadOrMarkUnread),
19
+ + ];
20
+ +
21
+ + return () => listeners.forEach((l) => l.unsubscribe());
22
+ }, [channel, client]);
23
+
24
+ useEffect(() => {
package/src/index.tsx CHANGED
@@ -1,7 +1,59 @@
1
- import * as React from 'react';
2
- // @ts-ignore
3
- import { Text } from 'react-native';
1
+ import React, { useEffect, useState } from 'react'
2
+ import { FlatList, StyleSheet, Text } from 'react-native'
4
3
 
5
- export function MyView() {
6
- return <Text>Hello from the first package changes more change!</Text>;
4
+ export function PCOChat({
5
+ token,
6
+ onTokenExpired,
7
+ }: {
8
+ token?: OathToken
9
+ onTokenExpired: () => void
10
+ }) {
11
+ const [conversations, setConversations] = useState<any>(null)
12
+ const styles = useStyles()
13
+
14
+ useEffect(() => {
15
+ if (!token) {
16
+ return
17
+ }
18
+
19
+ fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
20
+ headers: {
21
+ Authorization: `Bearer ${token.access_token}`,
22
+ },
23
+ })
24
+ .then(validateResponse)
25
+ .then(response => response.json())
26
+ .then(setConversations)
27
+ .catch(error => {
28
+ if (error.message === 'Token expired') {
29
+ onTokenExpired()
30
+ }
31
+ })
32
+ }, [onTokenExpired, token])
33
+
34
+ return (
35
+ <FlatList
36
+ data={conversations?.data}
37
+ ListEmptyComponent={<Text>No conversations</Text>}
38
+ contentContainerStyle={styles.container}
39
+ ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}
40
+ renderItem={({ item }) => <Text>{item.attributes.title}</Text>}
41
+ />
42
+ )
43
+ }
44
+
45
+ const useStyles = () => {
46
+ return StyleSheet.create({
47
+ container: { columnGap: 16 },
48
+ foo: { fontSize: 24 },
49
+ })
50
+ }
51
+
52
+ const validateResponse = (response: Response) => {
53
+ const isExpired = response.status === 401
54
+ if (isExpired) {
55
+ throw new Error('Token expired')
56
+ }
57
+
58
+ return response
7
59
  }
package/tsconfig.json CHANGED
@@ -1,9 +1,8 @@
1
- // @generated by expo-module-scripts
2
1
  {
3
2
  "extends": "expo-module-scripts/tsconfig.base",
4
3
  "compilerOptions": {
5
4
  "outDir": "./build"
6
5
  },
7
- "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
6
+ "include": ["./src", "../chat-core/types.d.ts"],
7
+ "exclude": ["**/__mocks__/*", "**/__tests__/*"],
9
8
  }