@planningcenter/chat-react-native 1.2.1-qa-44.1 → 1.3.0-rc.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/CHANGELOG.md +14 -2
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +9 -19
- package/build/index.js.map +1 -1
- package/package.json +3 -7
- package/src/index.tsx +13 -32
- package/.eslintrc.yml +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
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.
|
|
6
|
+
## [1.3.0-rc.1](https://github.com/planningcenter/chat-js/compare/v1.2.0...v1.3.0-rc.1) (2025-02-06)
|
|
7
7
|
|
|
8
|
-
**Note:** Version bump only for package @planningcenter/chat-react-native
|
|
9
8
|
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add auth to the example app ([#50](https://github.com/planningcenter/chat-js/issues/50)) ([5e0ae00](https://github.com/planningcenter/chat-js/commit/5e0ae008345743f6bba388e982a3ad768265971a))
|
|
12
|
+
* drop stream and set global dependencies ([#49](https://github.com/planningcenter/chat-js/issues/49)) ([1214b9f](https://github.com/planningcenter/chat-js/commit/1214b9fbc17f4ab67a1de1d39954604a28268f35))
|
|
13
|
+
* **StreamChat:** export core package ([#41](https://github.com/planningcenter/chat-js/issues/41)) ([e9afde0](https://github.com/planningcenter/chat-js/commit/e9afde0e2a11d9c7e13b84f8eee8a6cfa7aff795)), closes [#45](https://github.com/planningcenter/chat-js/issues/45)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.3.0-rc.0](https://github.com/planningcenter/chat-js/compare/v1.2.0...v1.3.0-rc.0) (2025-01-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
10
21
|
|
|
22
|
+
* **StreamChat:** export core package ([#41](https://github.com/planningcenter/chat-js/issues/41)) ([e9afde0](https://github.com/planningcenter/chat-js/commit/e9afde0e2a11d9c7e13b84f8eee8a6cfa7aff795)), closes [#45](https://github.com/planningcenter/chat-js/issues/45)
|
|
11
23
|
|
|
12
24
|
|
|
13
25
|
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,cAAc,EAAE,MAAM,IAAI,CAAA;CAAE,qBA6BnG"}
|
package/build/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { FlatList,
|
|
3
|
-
export function PCOChat({ token, onTokenExpired
|
|
2
|
+
import { FlatList, Text } from 'react-native';
|
|
3
|
+
export function PCOChat({ token, onTokenExpired }) {
|
|
4
4
|
const [conversations, setConversations] = useState(null);
|
|
5
|
-
const styles = useStyles();
|
|
6
5
|
useEffect(() => {
|
|
7
|
-
if (!token)
|
|
6
|
+
if (!token)
|
|
8
7
|
return;
|
|
9
|
-
}
|
|
10
8
|
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
11
9
|
headers: {
|
|
12
|
-
Authorization: `Bearer ${token
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
.then(validateResponse)
|
|
10
|
+
Authorization: `Bearer ${token?.access_token}`
|
|
11
|
+
}
|
|
12
|
+
}).then(validateResponse)
|
|
16
13
|
.then(response => response.json())
|
|
17
14
|
.then(setConversations)
|
|
18
15
|
.catch(error => {
|
|
@@ -20,20 +17,13 @@ export function PCOChat({ token, onTokenExpired, }) {
|
|
|
20
17
|
onTokenExpired();
|
|
21
18
|
}
|
|
22
19
|
});
|
|
23
|
-
}, [
|
|
24
|
-
return (<FlatList data={conversations?.data} ListEmptyComponent={<Text>No conversations</Text>} contentContainerStyle={
|
|
20
|
+
}, [token]);
|
|
21
|
+
return (<FlatList data={conversations?.data} ListEmptyComponent={<Text>No conversations</Text>} contentContainerStyle={{ columnGap: 16 }} ListHeaderComponent={<Text style={{ fontWeight: '600', fontSize: 16 }}>Conversations</Text>} renderItem={({ item }) => <Text>{item.attributes.title}</Text>}/>);
|
|
25
22
|
}
|
|
26
|
-
const useStyles = () => {
|
|
27
|
-
return StyleSheet.create({
|
|
28
|
-
container: { columnGap: 16 },
|
|
29
|
-
foo: { fontSize: 24 },
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
23
|
const validateResponse = (response) => {
|
|
33
24
|
const isExpired = response.status === 401;
|
|
34
|
-
if (isExpired)
|
|
25
|
+
if (isExpired)
|
|
35
26
|
throw new Error('Token expired');
|
|
36
|
-
}
|
|
37
27
|
return response;
|
|
38
28
|
};
|
|
39
29
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,cAAc,E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S,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAA;IACzC,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAE/C,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { FlatList, Text } from 'react-native';\n\nexport function PCOChat({ token, onTokenExpired }: { token?: OathToken, onTokenExpired: () => void }) {\n const [conversations, setConversations] = useState<any>(null)\n\n useEffect(() => {\n if (!token) return\n\n fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {\n headers: {\n Authorization: `Bearer ${token?.access_token}`\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 }, [token])\n\n return (\n <FlatList \n data={conversations?.data}\n ListEmptyComponent={<Text>No conversations</Text>}\n contentContainerStyle={{ columnGap: 16 }}\n ListHeaderComponent={<Text style={{ fontWeight: '600', fontSize: 16 }}>Conversations</Text>}\n renderItem={({ item }) => <Text>{item.attributes.title}</Text>}\n />\n )\n}\n\nconst validateResponse = (response: Response) => {\n const isExpired = response.status === 401\n if (isExpired) throw new Error('Token expired')\n\n return response\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-rc.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -17,11 +17,7 @@
|
|
|
17
17
|
"react-native": "*"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"
|
|
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"
|
|
20
|
+
"expo-module-scripts": "^3.4.0"
|
|
25
21
|
},
|
|
26
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "e26d1788f1ff5fe95e5040ca6a16e3c0b0bab759"
|
|
27
23
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { FlatList,
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { FlatList, Text } from 'react-native';
|
|
3
3
|
|
|
4
|
-
export function PCOChat({
|
|
5
|
-
token,
|
|
6
|
-
onTokenExpired,
|
|
7
|
-
}: {
|
|
8
|
-
token?: OathToken
|
|
9
|
-
onTokenExpired: () => void
|
|
10
|
-
}) {
|
|
4
|
+
export function PCOChat({ token, onTokenExpired }: { token?: OathToken, onTokenExpired: () => void }) {
|
|
11
5
|
const [conversations, setConversations] = useState<any>(null)
|
|
12
|
-
const styles = useStyles()
|
|
13
6
|
|
|
14
7
|
useEffect(() => {
|
|
15
|
-
if (!token)
|
|
16
|
-
return
|
|
17
|
-
}
|
|
8
|
+
if (!token) return
|
|
18
9
|
|
|
19
10
|
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
20
11
|
headers: {
|
|
21
|
-
Authorization: `Bearer ${token
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
.then(validateResponse)
|
|
12
|
+
Authorization: `Bearer ${token?.access_token}`
|
|
13
|
+
}
|
|
14
|
+
}).then(validateResponse)
|
|
25
15
|
.then(response => response.json())
|
|
26
16
|
.then(setConversations)
|
|
27
17
|
.catch(error => {
|
|
@@ -29,31 +19,22 @@ export function PCOChat({
|
|
|
29
19
|
onTokenExpired()
|
|
30
20
|
}
|
|
31
21
|
})
|
|
32
|
-
}, [
|
|
22
|
+
}, [token])
|
|
33
23
|
|
|
34
24
|
return (
|
|
35
|
-
<FlatList
|
|
25
|
+
<FlatList
|
|
36
26
|
data={conversations?.data}
|
|
37
27
|
ListEmptyComponent={<Text>No conversations</Text>}
|
|
38
|
-
contentContainerStyle={
|
|
39
|
-
ListHeaderComponent={<Text style={
|
|
28
|
+
contentContainerStyle={{ columnGap: 16 }}
|
|
29
|
+
ListHeaderComponent={<Text style={{ fontWeight: '600', fontSize: 16 }}>Conversations</Text>}
|
|
40
30
|
renderItem={({ item }) => <Text>{item.attributes.title}</Text>}
|
|
41
31
|
/>
|
|
42
32
|
)
|
|
43
33
|
}
|
|
44
34
|
|
|
45
|
-
const useStyles = () => {
|
|
46
|
-
return StyleSheet.create({
|
|
47
|
-
container: { columnGap: 16 },
|
|
48
|
-
foo: { fontSize: 24 },
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
35
|
const validateResponse = (response: Response) => {
|
|
53
36
|
const isExpired = response.status === 401
|
|
54
|
-
if (isExpired)
|
|
55
|
-
throw new Error('Token expired')
|
|
56
|
-
}
|
|
37
|
+
if (isExpired) throw new Error('Token expired')
|
|
57
38
|
|
|
58
39
|
return response
|
|
59
|
-
}
|
|
40
|
+
}
|
package/.eslintrc.yml
DELETED