@planningcenter/chat-react-native 3.9.1-rc.5 → 3.9.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_giphy.d.ts","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4CAA4C,EAAE,MAAM,qDAAqD,CAAA;AA0BlH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAW;;;;;;
|
|
1
|
+
{"version":3,"file":"use_giphy.d.ts","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4CAA4C,EAAE,MAAM,qDAAqD,CAAA;AA0BlH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAW;;;;;;EAgDzC"}
|
package/build/hooks/use_giphy.js
CHANGED
|
@@ -12,7 +12,7 @@ export function useGiphy(term = '') {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
setIsSearching(true);
|
|
15
|
-
fetch(`https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&q=${term}&limit=20&rating=
|
|
15
|
+
fetch(`https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&q=${term}&limit=20&rating=pg`)
|
|
16
16
|
.then(response => response.json())
|
|
17
17
|
.then(data => {
|
|
18
18
|
const originalGiphys = data.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_giphy.js","sourceRoot":"","sources":["../../src/hooks/use_giphy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAyBtD,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE;IACxC,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,W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EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAEpB,OAAO;QACL,WAAW;QACX,MAAM;QACN,WAAW;QACX,UAAU;QACV,UAAU;KACX,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAY,EACZ,MAAkB;IAElB,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,IAAI;QACX,oBAAoB,EAAE,KAAK,CAAC,KAAK;QACjC,UAAU,EAAE,KAAK,CAAC,GAAG;QACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG;QACvC,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;YAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,YAAY;YACvC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB;YACnD,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,wBAAwB;YAC/D,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;YACrC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;YACjD,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SAC9D;KACF,CAAC,CAAC,CAAA;AACL,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useState } from 'react'\nimport { DenormalizedGiphyAttachmentResourceForCreate } from '../types/resources/denormalized_attachment_resource'\nimport { ChatContext } from '../contexts/chat_context'\n\ninterface GiphyGif {\n id: string\n url: string\n title: string\n images: {\n original: GiphyVariant\n fixed_height: GiphyVariant\n fixed_height_still: GiphyVariant\n fixed_height_downsampled: GiphyVariant\n fixed_width: GiphyVariant\n fixed_width_still: GiphyVariant\n fixed_width_downsampled: GiphyVariant\n }\n}\n\ninterface GiphyVariant {\n url: string\n width: string\n height: string\n size: string\n frames: string\n}\n\nexport function useGiphy(term: string = '') {\n const { giphyApiKey } = useContext(ChatContext)\n const [isSearching, setIsSearching] = useState(false)\n const [results, setResults] = useState<DenormalizedGiphyAttachmentResourceForCreate[]>([])\n const [resultIndex, setResultIndex] = useState(0)\n const result = results[resultIndex]\n\n useEffect(() => {\n if (!giphyApiKey || !term) {\n setResults([])\n return\n }\n\n setIsSearching(true)\n fetch(\n `https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&q=${term}&limit=20&rating=pg`\n )\n .then(response => response.json())\n .then(data => {\n const originalGiphys: GiphyGif[] = data.data\n const denormalizedGiphys = denormalizeGiphys(term, originalGiphys)\n\n setResults(denormalizedGiphys)\n setResultIndex(0)\n })\n .catch(error => {\n console.error('Error fetching gifs:', error)\n })\n .finally(() => {\n setIsSearching(false)\n })\n }, [giphyApiKey, term])\n\n const nextResult = useCallback(() => {\n setResultIndex(oldResultIndex => (oldResultIndex < results.length - 1 ? oldResultIndex + 1 : 0))\n }, [results.length])\n\n const prevResult = useCallback(() => {\n setResultIndex(oldResultIndex => (oldResultIndex > 0 ? oldResultIndex - 1 : results.length - 1))\n }, [results.length])\n\n return {\n isSearching,\n result,\n resultIndex,\n nextResult,\n prevResult,\n }\n}\n\nfunction denormalizeGiphys(\n term: string,\n giphys: GiphyGif[]\n): DenormalizedGiphyAttachmentResourceForCreate[] {\n return giphys.map(giphy => ({\n type: 'giphy',\n id: giphy.id,\n title: term,\n original_giphy_title: giphy.title,\n title_link: giphy.url,\n thumb_url: giphy.images.fixed_width.url,\n giphy: {\n original: giphy.images.original,\n fixed_height: giphy.images.fixed_height,\n fixed_height_still: giphy.images.fixed_height_still,\n fixed_height_downsampled: giphy.images.fixed_height_downsampled,\n fixed_width: giphy.images.fixed_width,\n fixed_width_still: giphy.images.fixed_width_still,\n fixed_width_downsampled: giphy.images.fixed_width_downsampled,\n },\n }))\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.9.1
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"prettier": "^3.4.2",
|
|
56
56
|
"typescript": "<5.6.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "412f23acbae8d6a7a8c199e2c5ce7ea2399a27b9"
|
|
59
59
|
}
|
package/src/hooks/use_giphy.ts
CHANGED
|
@@ -39,7 +39,9 @@ export function useGiphy(term: string = '') {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
setIsSearching(true)
|
|
42
|
-
fetch(
|
|
42
|
+
fetch(
|
|
43
|
+
`https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&q=${term}&limit=20&rating=pg`
|
|
44
|
+
)
|
|
43
45
|
.then(response => response.json())
|
|
44
46
|
.then(data => {
|
|
45
47
|
const originalGiphys: GiphyGif[] = data.data
|