{"_id":"@accord-coop/use-teams","_rev":"1-082f526e921d71d7c8dda415acca6db5","name":"@accord-coop/use-teams","dist-tags":{"latest":"4.0.1"},"versions":{"4.0.1":{"name":"@accord-coop/use-teams","version":"4.0.1","description":"React helper components for Microsoft Teams apps","main":"lib/cjs/index.js","module":"lib/esm/index.js","types":"lib/cjs/index.d.ts","scripts":{"prepublishOnly ":"npm run clean && npm run build","build":"tsc -p tsconfig.json && tsc -p tsconfig.es.json","clean":"rimraf lib","test":"jest --ci --reporters=jest-junit --reporters=default --coverage --coverageDirectory='coverage' --collectCoverageFrom='src/**/*.{ts,tsx,js}'","lint":"eslint ./src/**/*.{js,ts,tsx}"},"keywords":["react","microsoft-teams","msteams","typescript","fluentui"],"author":{"name":"Wictor Wilén","url":"wictor@wictorwilen.se"},"maintainers":[{"name":"wsn_accord","email":"wsn@accord.coop"}],"repository":{"type":"git","url":"git+https://github.com/accord-coop/msteams-react-base-component.git"},"bugs":{"url":"https://github.com/accord-coop/msteams-react-base-component/issues"},"homepage":"https://github.com/accord-coop/msteams-react-base-component","license":"MIT","devDependencies":{"@microsoft/teams-js":"^1.8.0","@testing-library/react":"^11.2.5","@types/enzyme":"^3.10.8","@types/jest":"^26.0.20","@types/react":"^16.9.56","@types/react-dom":"^16.8.4","@typescript-eslint/eslint-plugin":"^4.7.0","@typescript-eslint/parser":"^4.7.0","eslint":"^7.13.0","eslint-config-standard":"^14.1.1","eslint-plugin-import":"^2.20.2","eslint-plugin-jest":"^24.1.5","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-react":"^7.19.0","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-standard":"^4.1.0","jest":"^26.6.3","jest-junit":"^12.0.0","mocha":"^8.3.0","react":"^16.8.6","react-dom":"^16.8.6","rimraf":"^3.0.2","ts-jest":"^26.5.2","typescript":"^4.0.3"},"peerDependencies":{"@microsoft/teams-js":"^1.8.0","react":"^16.8.6","react-dom":"^16.8.6"},"funding":{"type":"individual","url":"https://github.com/sponsors/wictorwilen/"},"gitHead":"adfdab51fb1d466946f74596445c32a49ddcb688","_id":"@accord-coop/use-teams@4.0.1","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"integrity":"sha512-Xx1uZbpJlnUfTI+ctIwbueQ2+6Klr9UbhJ0a4QHPGECipGX7U2fWewb1MUu/YZI32TfFDyFLEPb3pEh7pggWOg==","shasum":"30c44159d5611e51109a69a23d7d4e9a6e32db27","tarball":"https://registry.npmjs.org/@accord-coop/use-teams/-/use-teams-4.0.1.tgz","fileCount":17,"unpackedSize":21993,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3RzYCRA9TVsSAnZWagAAiAkP/1YrplsG2jj7xv/GiZr0\nA7+gubgehaq12nXKhU/vWGEHyrG8/dKcE1AahONvBlLmhRhzYL1dXkxvURux\nVK95iBJTkMpU+f3ofMSXYxyTY4LVcqdn1x/Xi1r1nz0olH8v7B6I7LFQI4+W\npwcjVRK65/jQEskrhvL6Eb1XrQ7hydPsEdbBgS++XAinWWvniL12y3CY82v+\n9lctcLpRM5SZzX1ha2q8XkDQ7OwCYdMnl/TqEKfoXNoF7PAn09n8DP2hpyhd\n52xTmYJVyr2CWoB/LkarCxE7l/8H+Hnkse6n1nOIU2F3heOVLwcP3m/pHy9B\nVKHcnZIUBRC1mH4UfJOB7tVlhs6pfjHWfkwflEvGQ3WRi4vO5LUrd9CvNQlc\n7oJR3sH97xTIl0AoOYXRbcn/YPIHU5xA9DqUAe6ny3nd9Te1He1jiNfzIx2R\nw1w4TMosuGyVqF+jBaC6EoR6quRzh4hEaanS9/S+2hhCR4mS8q7JXHmUrU3p\nhkl+vs/v6dBDF7JKADBsvFo2wagB90F518hVJ9paf4QaGHbWiLmUTxC14oL5\nHnxV+gz/lTA3W03TkH39hYujTnE5TEfRYynoiwN3MN8XtZgMWgG3yvvmvYtj\nJK27iLtWT3gekddz8Le09vOr21v1etMFw1Y4HnsMTvrDEXDjqpjpyiDTQwL1\n4OC0\r\n=5bgr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEAwh1AIRdTbnPFhJ5ZhmAhC8WRY4mgpDQnNVvRU+3efAiEA3ZkfsOPjH1+XhIzEuCOmJI9qvwghiO4n399iG2LBHog="}]},"_npmUser":{"name":"wsn_accord","email":"wsn@accord.coop"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-teams_4.0.1_1625103576267_0.9085122129729224"},"_hasShrinkwrap":false}},"time":{"created":"2021-07-01T01:39:35.919Z","4.0.1":"2021-07-01T01:39:36.390Z","modified":"2022-04-04T11:07:28.367Z"},"maintainers":[{"name":"wsn_accord","email":"wsn@accord.coop"}],"description":"React helper components for Microsoft Teams apps","homepage":"https://github.com/accord-coop/msteams-react-base-component","keywords":["react","microsoft-teams","msteams","typescript","fluentui"],"repository":{"type":"git","url":"git+https://github.com/accord-coop/msteams-react-base-component.git"},"author":{"name":"Wictor Wilén","url":"wictor@wictorwilen.se"},"bugs":{"url":"https://github.com/accord-coop/msteams-react-base-component/issues"},"license":"MIT","readme":"# Microsoft Teams UI Controls base component\n\n[![npm version](https://badge.fury.io/js/msteams-react-base-component.svg)](https://www.npmjs.com/package/msteams-react-base-component)\n[![npm](https://img.shields.io/npm/dt/msteams-react-base-component.svg)](https://www.npmjs.com/package/msteams-react-base-component)\n[![MIT](https://img.shields.io/npm/l/msteams-react-base-component.svg)](https://github.com/wictorwilen/msteams-react-base-component/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/wictorwilen/msteams-react-base-component.svg)](https://github.com/wictorwilen/msteams-react-base-component/issues)\n[![GitHub closed issues](https://img.shields.io/github/issues-closed/wictorwilen/msteams-react-base-component.svg)](https://github.com/wictorwilen/msteams-react-base-component/issues?q=is%3Aissue+is%3Aclosed)\n\nThis is a React hook based on the Microsoft Teams JavaScript SDK and the Fluent UI components, which is used when generating Microsoft Teams Apps using the [Microsoft Teams Yeoman Generator](https://aka.ms/yoteams). This fork for Accord Cooperative excludes the Fluent UI React Northstar dependency.\n\n | @master | @preview |\n :--------:|:---------:\n ![Build Status](https://img.shields.io/github/workflow/status/wictorwilen/msteams-react-base-component/msteams-react-base-component%20CI/master)|![Build Status](https://img.shields.io/github/workflow/status/wictorwilen/msteams-react-base-component/msteams-react-base-component%20CI/preview)\n\n## Usage\n\nTo use this package in a Teams tab or extension import the `useTeams` Hook and then call it inside a functional component.\n\n``` TypeScript\nconst [{inTeams}] = useTeams();\n```\n\nThe `useTeams` hook will return a tuple of where an object of properties are in the first field and an object of methods in the second.\n\n> **NOTE**: using the hook will automatically call `microsoftTeams.initialize()` and `microsoftTeams.getContext()` if the Microsoft Teams JS SDK is available.\n\n### useTeams Hook arguments\n\nThe `useTeams` hook can take an *optional* object argument:\n\n| Argument | Description |\n|----------|-------------|\n| `initialTheme?: string` | Manually set the initial theme (`default`, `dark` or `contrast`) |\n| `setThemeHandler?: (theme?: string) => void` | Custom handler for themes |\n\n### Available properties\n\n| Property name | Type | Description |\n|---------------|------|-------------|\n| `inTeams` | boolean? | `true` if hosted in Teams and `false` for outside of Microsoft Teams |\n| `fullScreen` | boolean? | `true` if the Tab is in full-screen, otherwise `false` |\n| `themeString` | string | The value of `default`, `dark` or `contrast` |\n| `context` | `microsoftTeams.Context?` | `undefined` while the Tab is loading or if not hosted in Teams, set to a value once the Tab is initialized and context available |\n\n### Available methods\n\n| Method name | Description |\n|-------------|-------------|\n| `setTheme(theme?: string)` | Method for manually setting the theme |\n\n## Full example\n\nExample of usage:\n\n```  TypeScript\nimport React, { useState, useEffect } from \"react\";\nimport { useTeams } from \"msteams-react-base-component\";\n\n/**\n * Implementation of the hooks Tab content page\n */\nexport const HooksTab = () => {\n    const [{ inTeams, theme }] = useTeams({});\n    const [message, setMessage] = useState(\"Loading...\");\n\n    useEffect(() => {\n        if (inTeams === true) {\n            setMessage(\"In Microsoft Teams!\");\n        } else {\n            if (inTeams !== undefined) {\n                setMessage(\"Not in Microsoft Teams\");\n            }\n        }\n    }, [inTeams]);\n\n    return (\n        <div>{message}</div>\n    );\n};\n```\n\n### Additional helper methods\n\nThe package also exports two helper methods, both used internally by the `useTeams` hook.\n\n`getQueryVariable(name: string): string` - returns the value of the query string variable identified by the name.\n\n`checkInTeams(): boolean` - returns true if hosted inside Microsoft Teams.\n\n## License\n\nCopyright (c) Wictor Wilén. All rights reserved.\n\nLicensed under the MIT license.\n","readmeFilename":"README.md"}