@planningcenter/chat-react-native 3.38.0-rc.5 → 3.38.0-rc.7
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/jest.js +1 -1
- package/build/jest.js.map +1 -1
- package/build/screens/avatar_picker/emoji_tab.js +1 -1
- package/build/screens/avatar_picker/emoji_tab.js.map +1 -1
- package/build/utils/client/instrumented_fetch.js +3 -5
- package/build/utils/client/instrumented_fetch.js.map +1 -1
- package/package.json +3 -6
- package/src/__tests__/jest.ts +1 -1
- package/src/jest.ts +1 -1
- package/src/screens/avatar_picker/emoji_tab.tsx +1 -1
- package/src/utils/client/__tests__/instrumented_fetch.test.ts +9 -5
- package/src/utils/client/instrumented_fetch.ts +3 -6
package/build/jest.js
CHANGED
package/build/jest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mCAAmC;IACnC,
|
|
1
|
+
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mCAAmC;IACnC,gCAAgC;IAChC,cAAc;CACf,CAAA","sourcesContent":["/**\n * Jest configuration helpers for consuming apps.\n *\n * Usage in jest.config.js:\n *\n * const { jestTransformPackages } = require('@planningcenter/chat-react-native/jest')\n *\n * const ignorePatterns = [\n * ...yourPatterns,\n * ...jestTransformPackages,\n * ].join('|')\n *\n * module.exports = {\n * transformIgnorePatterns: [`node_modules/(?!${ignorePatterns})`],\n * }\n */\nexport const jestTransformPackages = [\n '@planningcenter/chat-react-native',\n '@planningcenter/emoji-keyboard',\n '@fortawesome',\n]\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmojiKeyboard, emojisByCategory } from 'emoji-keyboard';
|
|
1
|
+
import { EmojiKeyboard, emojisByCategory } from '@planningcenter/emoji-keyboard';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { StyleSheet, View } from 'react-native';
|
|
4
4
|
import { useTheme } from '../../hooks';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emoji_tab.js","sourceRoot":"","sources":["../../../src/screens/avatar_picker/emoji_tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"emoji_tab.js","sourceRoot":"","sources":["../../../src/screens/avatar_picker/emoji_tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAkB,MAAM,gCAAgC,CAAA;AAChG,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAEtC,MAAM,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvD,GAAG,QAAQ;IACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CAC9D,CAAC,CAAC,CAAA;AAMH,MAAM,UAAU,QAAQ,CAAC,EAAE,aAAa,EAAiB;IACvD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,MAAM,mBAAmB,GAAG,WAAW,CACrC,CAAC,W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iBAChD;aACF;SACF,CAAC,EAEN;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,MAAM,CAAC,2BAA2B;SACpD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { EmojiKeyboard, emojisByCategory, type EmojiType } from '@planningcenter/emoji-keyboard'\nimport React, { useCallback } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useTheme } from '../../hooks'\n\nconst BLOCKED_EMOJIS = new Set(['🖕'])\n\nconst filteredEmojis = emojisByCategory.map(category => ({\n ...category,\n data: category.data.filter(e => !BLOCKED_EMOJIS.has(e.emoji)),\n}))\n\ninterface EmojiTabProps {\n onEmojiSelect: (emoji: string) => void\n}\n\nexport function EmojiTab({ onEmojiSelect }: EmojiTabProps) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n const handleEmojiSelected = useCallback(\n (emojiObject: EmojiType) => {\n onEmojiSelect(emojiObject.emoji)\n },\n [onEmojiSelect]\n )\n\n const emojiTheme = {\n container: colors.fillColorNeutral100Inverted,\n header: colors.textColorDefaultSecondary,\n knob: colors.fillColorNeutral040,\n skinTonesContainer: colors.fillColorNeutral060,\n category: {\n icon: colors.textColorDefaultSecondary,\n iconActive: colors.interaction,\n container: colors.fillColorNeutral100Inverted,\n containerActive: colors.fillColorNeutral080,\n },\n search: {\n background: colors.fillColorNeutral080,\n text: colors.textColorDefaultPrimary,\n placeholder: colors.textColorDefaultSecondary,\n icon: colors.textColorDefaultSecondary,\n },\n emoji: {\n selected: colors.fillColorNeutral080,\n },\n }\n\n return (\n <View style={styles.container}>\n <EmojiKeyboard\n categoryPosition=\"top\"\n emojisByCategory={filteredEmojis}\n onEmojiSelected={handleEmojiSelected}\n hideHeader\n enableSearchBar\n enableRecentlyUsed\n theme={emojiTheme}\n styles={{\n container: { borderRadius: 0 },\n category: {\n container: {\n borderRadius: 0,\n marginTop: -6,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultDim,\n },\n },\n }}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: colors.fillColorNeutral100Inverted,\n },\n })\n}\n"]}
|
|
@@ -13,7 +13,7 @@ export async function instrumentedFetch(url, init) {
|
|
|
13
13
|
return response;
|
|
14
14
|
}
|
|
15
15
|
catch (networkError) {
|
|
16
|
-
|
|
16
|
+
warnNetworkError(networkError, method, url);
|
|
17
17
|
throw networkError;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -34,11 +34,9 @@ function reportHttpError(response, method, url) {
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function warnNetworkError(networkError, method, url) {
|
|
38
38
|
const path = templatePath(url);
|
|
39
|
-
|
|
40
|
-
error.name = 'NetworkError';
|
|
41
|
-
Log.reportError(error, {
|
|
39
|
+
console.warn(`Network failure ${method} ${path}: ${networkError.message}`, {
|
|
42
40
|
scope: 'http',
|
|
43
41
|
tags: {
|
|
44
42
|
...SHARED_TAGS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumented_fetch.js","sourceRoot":"","sources":["../../../src/utils/client/instrumented_fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kCAAkC,CAAA;AAEtD,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,mBAAmB;CACpB,CAAA;AAEV,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAExC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAW,EA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KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;SACzD,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC","sourcesContent":["import { Log } from '../native_adapters/configuration'\n\nconst SHARED_TAGS = {\n team: 'chat',\n package: 'chat-react-native',\n} as const\n\nconst SKIPPED_STATUSES = [401, 403, 404]\n\nexport async function instrumentedFetch(url: string, init: RequestInit): Promise<Response> {\n const method = init.method ?? 'GET'\n try {\n const response = await fetch(url, init)\n if (!response.ok) reportHttpError(response, method, url)\n return response\n } catch (networkError) {\n warnNetworkError(networkError as Error, method, url)\n throw networkError\n }\n}\n\nfunction reportHttpError(response: Response, method: string, url: string) {\n const { status } = response\n if (SKIPPED_STATUSES.includes(status)) return\n\n const path = templatePath(url)\n const error = new Error(`HTTP ${status} ${method} ${path}`)\n error.name = `HTTPError${status}`\n\n Log.reportError(error, {\n scope: 'http',\n tags: {\n ...SHARED_TAGS,\n 'http.status': String(status),\n 'http.method': method,\n 'http.path': path,\n },\n })\n}\n\nfunction warnNetworkError(networkError: Error, method: string, url: string) {\n const path = templatePath(url)\n console.warn(`Network failure ${method} ${path}: ${networkError.message}`, {\n scope: 'http',\n tags: {\n ...SHARED_TAGS,\n 'http.method': method,\n 'http.path': path,\n 'http.error': 'network',\n },\n })\n}\n\nfunction templatePath(url: string): string {\n let path: string\n try {\n path = new URL(url).pathname\n } catch {\n path = url\n }\n\n return path\n .split('/')\n .map(segment => (/^\\d+$/.test(segment) ? ':id' : segment))\n .join('/')\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.38.0-rc.
|
|
3
|
+
"version": "3.38.0-rc.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "./src/index.tsx",
|
|
@@ -26,13 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
28
28
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
29
|
-
"emoji-keyboard": "3.38.0-rc.
|
|
29
|
+
"@planningcenter/emoji-keyboard": "3.38.0-rc.7",
|
|
30
30
|
"lodash-inflection": "^1.5.0",
|
|
31
31
|
"react-compiler-runtime": "^1.0.0"
|
|
32
32
|
},
|
|
33
|
-
"bundleDependencies": [
|
|
34
|
-
"emoji-keyboard"
|
|
35
|
-
],
|
|
36
33
|
"peerDependencies": {
|
|
37
34
|
"@planningcenter/datetime-fmt": ">=2.0.0",
|
|
38
35
|
"@planningcenter/icons": "^15.24.0",
|
|
@@ -75,5 +72,5 @@
|
|
|
75
72
|
"react-native-url-polyfill": "^2.0.0",
|
|
76
73
|
"typescript": "~5.9.2"
|
|
77
74
|
},
|
|
78
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "ea5571bc4ce4af6cebf789ea2b25493267eb1899"
|
|
79
76
|
}
|
package/src/__tests__/jest.ts
CHANGED
|
@@ -4,8 +4,8 @@ describe('jestTransformPackages', () => {
|
|
|
4
4
|
it('exports an array of package patterns', () => {
|
|
5
5
|
expect(jestTransformPackages).toEqual([
|
|
6
6
|
'@planningcenter/chat-react-native',
|
|
7
|
+
'@planningcenter/emoji-keyboard',
|
|
7
8
|
'@fortawesome',
|
|
8
|
-
'emoji-keyboard',
|
|
9
9
|
])
|
|
10
10
|
})
|
|
11
11
|
})
|
package/src/jest.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmojiKeyboard, emojisByCategory, type EmojiType } from 'emoji-keyboard'
|
|
1
|
+
import { EmojiKeyboard, emojisByCategory, type EmojiType } from '@planningcenter/emoji-keyboard'
|
|
2
2
|
import React, { useCallback } from 'react'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { useTheme } from '../../hooks'
|
|
@@ -5,15 +5,18 @@ const buildResponse = (status: number) => new Response('', { status })
|
|
|
5
5
|
|
|
6
6
|
describe('instrumentedFetch', () => {
|
|
7
7
|
let reportError: jest.SpyInstance
|
|
8
|
+
let warnSpy: jest.SpyInstance
|
|
8
9
|
let fetchSpy: jest.SpyInstance
|
|
9
10
|
|
|
10
11
|
beforeEach(() => {
|
|
11
12
|
reportError = jest.spyOn(Log, 'reportError').mockImplementation(() => {})
|
|
13
|
+
warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
|
|
12
14
|
fetchSpy = jest.spyOn(globalThis, 'fetch')
|
|
13
15
|
})
|
|
14
16
|
|
|
15
17
|
afterEach(() => {
|
|
16
18
|
reportError.mockRestore()
|
|
19
|
+
warnSpy.mockRestore()
|
|
17
20
|
fetchSpy.mockRestore()
|
|
18
21
|
})
|
|
19
22
|
|
|
@@ -27,6 +30,7 @@ describe('instrumentedFetch', () => {
|
|
|
27
30
|
|
|
28
31
|
expect(result).toBe(response)
|
|
29
32
|
expect(reportError).not.toHaveBeenCalled()
|
|
33
|
+
expect(warnSpy).not.toHaveBeenCalled()
|
|
30
34
|
})
|
|
31
35
|
|
|
32
36
|
it.each([400, 422, 500])(
|
|
@@ -63,7 +67,7 @@ describe('instrumentedFetch', () => {
|
|
|
63
67
|
expect(reportError).not.toHaveBeenCalled()
|
|
64
68
|
})
|
|
65
69
|
|
|
66
|
-
it('
|
|
70
|
+
it('warns on network failures instead of reporting them', async () => {
|
|
67
71
|
const networkError = new TypeError('Network request failed')
|
|
68
72
|
fetchSpy.mockRejectedValueOnce(networkError)
|
|
69
73
|
|
|
@@ -71,10 +75,10 @@ describe('instrumentedFetch', () => {
|
|
|
71
75
|
instrumentedFetch('https://api.example.com/conversations/123', { method: 'GET' })
|
|
72
76
|
).rejects.toBe(networkError)
|
|
73
77
|
|
|
74
|
-
expect(reportError).
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
expect(
|
|
78
|
+
expect(reportError).not.toHaveBeenCalled()
|
|
79
|
+
expect(warnSpy).toHaveBeenCalledTimes(1)
|
|
80
|
+
const [message, context] = warnSpy.mock.calls[0]
|
|
81
|
+
expect(message).toContain('Network failure GET /conversations/:id')
|
|
78
82
|
expect(context.tags).toMatchObject({
|
|
79
83
|
'http.method': 'GET',
|
|
80
84
|
'http.path': '/conversations/:id',
|
|
@@ -14,7 +14,7 @@ export async function instrumentedFetch(url: string, init: RequestInit): Promise
|
|
|
14
14
|
if (!response.ok) reportHttpError(response, method, url)
|
|
15
15
|
return response
|
|
16
16
|
} catch (networkError) {
|
|
17
|
-
|
|
17
|
+
warnNetworkError(networkError as Error, method, url)
|
|
18
18
|
throw networkError
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -38,12 +38,9 @@ function reportHttpError(response: Response, method: string, url: string) {
|
|
|
38
38
|
})
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function
|
|
41
|
+
function warnNetworkError(networkError: Error, method: string, url: string) {
|
|
42
42
|
const path = templatePath(url)
|
|
43
|
-
|
|
44
|
-
error.name = 'NetworkError'
|
|
45
|
-
|
|
46
|
-
Log.reportError(error, {
|
|
43
|
+
console.warn(`Network failure ${method} ${path}: ${networkError.message}`, {
|
|
47
44
|
scope: 'http',
|
|
48
45
|
tags: {
|
|
49
46
|
...SHARED_TAGS,
|