{"_id":"@buildersbank/use-notifications","name":"@buildersbank/use-notifications","dist-tags":{"latest":"0.1.7"},"versions":{"0.1.7":{"name":"@buildersbank/use-notifications","version":"0.1.7","description":"[![Build Status][check-badge]][workflows] [![codecov][codecov]](https://codecov.io/gh/platformbuilders/use-notifications) [![npm][npm-badge]][npm] [![MIT][license-badge]][license]","private":false,"license":"MIT","author":{"name":"Builders Bank","email":"adm@buildersbank.tech"},"repository":{"type":"git","url":"git+https://github.com/buildersbank/use-notifications.git"},"main":"dist/index.js","module":"dist/index.es.js","types":"dist/index.d.ts","scripts":{"test":"cross-env CI=1 react-scripts test --env=jsdom","test:watch":"react-scripts test --env=jsdom","build":"rm -rf dist && rollup -c","start":"rollup -c -w","prepare":"husky install && yarn build","pretty":"prettier --config ./.prettierrc.js --write \"src/**/*.{js,jsx,ts,tsx,json}\"","lint":"tsc && eslint '*/**/*.{ts, tsx}' --fix"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"**/*.ts?(x)":["yarn pretty","yarn lint","git add ."]},"peerDependencies":{"@react-native-firebase/app":"16.4.3","@react-native-firebase/messaging":"16.4.3","@notifee/react-native":"7.1.0","react":"16.13.1"},"devDependencies":{"@babel/core":"7.20.5","@babel/runtime":"7.20.6","@types/jest":"29.2.3","@types/react":"18.0.25","@typescript-eslint/eslint-plugin":"5.45.0","@typescript-eslint/parser":"5.45.0","cross-env":"7.0.3","eslint":"8.28.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-sonarjs":"0.16.0","eslint-plugin-typescript":"0.14.0","@react-native-firebase/app":"16.4.6","@react-native-firebase/messaging":"16.4.6","husky":"8.0.2","prettier":"2.8.0","react":"18.2.0","react-scripts":"5.0.1","react-test-renderer":"18.2.0","rollup":"2.77.0","rollup-plugin-babel":"4.4.0","rollup-plugin-commonjs":"10.1.0","rollup-plugin-node-resolve":"5.2.0","rollup-plugin-peer-deps-external":"2.2.4","rollup-plugin-typescript2":"0.34.1","rollup-plugin-url":"3.0.1","@notifee/react-native":"7.1.0","typescript":"4.9.3"},"gitHead":"dfb527f8fef8afe83f088cfbb7ea1f2fbbd9ce50","bugs":{"url":"https://github.com/buildersbank/use-notifications/issues"},"homepage":"https://github.com/buildersbank/use-notifications#readme","_id":"@buildersbank/use-notifications@0.1.7","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-uNu9gm+RGWewor1/KAe4rHHdfy2UhmHmPA2SpWR+SlcFe8ubMaV5PesmL5GFqDpADi0vQ/b7Bb1UcY3hGky9Ag==","shasum":"48a6f2c35cecf79380abfd4ad7303bc9fad8638e","tarball":"https://registry.npmjs.org/@buildersbank/use-notifications/-/use-notifications-0.1.7.tgz","fileCount":34,"unpackedSize":72700,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIqHKkAEWQ48X3aNve6gr17Fk7reOlWsl2l1HUXotRVwIhALLqhGuxXMbjEM6sbTb/G+T5krDHzc4083QiL4yvO1tK"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCh4JACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmovxg//XUGLWO+3ZHKrQYquECJpm+vPgLmKZwwkoh6n7sKN8pkNNkMD\r\nNxaggXN3lkopxkAiuhSFshB3m7Ey2SY/xRU9JKvXqilBZ/P63JgSZVpC8zlX\r\nwlNTNWqb2KyRS6VrFZ7+yCDdQsK3cUZNkLcU3jXqyIdbY4S4zF28T7jcPxa3\r\nMgwwUnEWSylUSrHlsCrGwFGX+HjmCr6r+srrjuZilMLVhTZyB5XfPY8FY2As\r\nq4I6lj0Usuxb8MxOFDrG10wgGDGw5ltaOOFcAe0JixwfACKtlSuwYlCy9njr\r\nRM7mcrrAmmSNfpfEcN8qIslvCD/rYHXns2YvB1tljECOL2d3Wn0T9tkgSRDL\r\nPyPq6XkjkvogozLFV6VSCgQNMG2xCkKTTg5pXvwfxU6H2/gC9ntTyQltgi9B\r\nV//Uos28YJHCZ3+s4o9T7Qs1Z1Fmen81brF4JswdQQ+2a+sBzkW5IrkKmmqK\r\nbXFqK1VqlkT70mfzvsbYQhrN8nrUYbwxK2EKc5VYJM9AYXiyxoozEl7q9vDN\r\ngmtKsKKQ752JcNs5qVg3NF8WnAGo+6GyPDY24bJvA8ne0zv0fymA4alM8wnL\r\nsRPrCyg2QYsmW1RDlIeHmJd8j8X/TbpIFtYXHyrXE1ob7CPJsHmcHPLCrO+5\r\nmxhuG0Yj5re6yX1z61I0k/BUXtrHzN2cr0c=\r\n=2Yiy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"buildersbank","email":"adm@buildersbank.tech"},"directories":{},"maintainers":[{"name":"buildersbank","email":"adm@buildersbank.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-notifications_0.1.7_1678384648837_0.20988909565663527"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-09T17:57:28.764Z","0.1.7":"2023-03-09T17:57:29.007Z","modified":"2023-03-09T17:57:29.173Z"},"maintainers":[{"name":"buildersbank","email":"adm@buildersbank.tech"}],"description":"[![Build Status][check-badge]][workflows] [![codecov][codecov]](https://codecov.io/gh/platformbuilders/use-notifications) [![npm][npm-badge]][npm] [![MIT][license-badge]][license]","homepage":"https://github.com/buildersbank/use-notifications#readme","repository":{"type":"git","url":"git+https://github.com/buildersbank/use-notifications.git"},"author":{"name":"Builders Bank","email":"adm@buildersbank.tech"},"bugs":{"url":"https://github.com/buildersbank/use-notifications/issues"},"license":"MIT","readme":"[![Build Status][check-badge]][workflows]\n[![codecov][codecov]](https://codecov.io/gh/platformbuilders/use-notifications)\n[![npm][npm-badge]][npm]\n[![MIT][license-badge]][license]\n\n[npm-badge]: https://img.shields.io/npm/v/@buildersbank/use-notifications.svg\n[npm]: https://www.npmjs.com/package/@buildersbank/use-notifications\n[license-badge]: https://img.shields.io/dub/l/vibe-d.svg\n[license]: https://raw.githubusercontent.com/platformbuilders/use-notifications/master/LICENSE.md\n[workflows]: https://github.com/platformbuilders/use-notifications/actions\n[check-badge]: https://github.com/platformbuilders/use-notifications/workflows/check/badge.svg\n[codecov]: https://codecov.io/gh/platformbuilders/use-notifications/branch/master/graph/badge.svg\n\n# @buildersbank/use-notification\n\nWrapping up `@react-native-firebase/messaging` and [`@notifee/react-native`](https://notifee.app/react-native/docs/overview) as a hook for simpler usage.\n\n## Install\n\n```\nyarn add @react-native-firebase/messaging @react-native-firebase/app @notifee/react-native @buildersbank/use-notifications\n```\n\nthen, navigate to `cd ios` and run `pod install`\n\n## Usage to configure\n\n```\nimport { useNotifications } from '@buildersbank/use-notifications';\n\nconst { configureNotifications, getFCMToken } = useNotifications();\n\nconst onRegisterNotification = async (token) => {\n  console.log('LOG: onRegisterNotification -> token', token);\n};\n\nconst onReceiveNotification = (notification) => {\n  console.log('LOG: onNotification -> notification', notification);\n};\n\nconst onOpenNotification = (notification) => {\n  console.log('LOG: onOpenNotification -> notification', notification);\n};\n\nconst onTokenRefresh = (token) => {\n  console.log('LOG: onTokenRefresh -> token', token);\n};\n\nconst getFirebaseToken = async () => {\n  const fcmToken = await getFCMToken();\n  console.log('LOG: getFirebaseToken -> fcmToken', fcmToken);\n};\n\nuseEffect(() => {\n  configureNotifications({\n    onRegister: onRegisterNotification,\n    onNotification: onReceiveNotification,\n    onNotificationOpened: onOpenNotification, // iOS\n    onTokenRefresh: onTokenRefresh\n  });\n}, []);\n\n```\n\n## Usage to display notifications\n\n```\nimport { useNotifications } from '@buildersbank/use-notifications';\n\nconst { displayNotification } = useNotifications();\n\nuseEffect(() => {\n  displayNotification({\n    title: 'Bem vindo ao App',\n    body: 'Faça login para continuar',\n  });\n}, []);\n\n```\n\n### New Version\n\n- To **test** locally see: [Testando NPM packages localmente](https://www.notion.so/platformbuilders/Testando-NPM-packages-localmente-28423b323abe4b3da1257283bff7d99d)\n\n- To **publish** a new version see: [Testando NPM packages localmente](https://www.notion.so/platformbuilders/Criando-e-distribuindo-Libs-f6de8ccf543c4485ac0cc17379480975)\n","readmeFilename":"README.md"}