Merge pull request #1839 from andrewconnell/spfxdocs-meetingsapp

SPFx Teams Meetings app sample to for accompanying docs tutorial
This commit is contained in:
Hugo Bernier 2021-04-27 10:59:48 -04:00 committed by GitHub
commit 67a1180e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 21829 additions and 0 deletions

33
samples/js-teams-meeting-app/.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts

View File

@ -0,0 +1,12 @@
{
"@microsoft/generator-sharepoint": {
"isCreatingSolution": true,
"environment": "spo",
"version": "1.12.1-rc.3",
"libraryName": "teams-meeting-app",
"libraryId": "a70a8d1d-f76f-4535-bf43-0d1abd0377e6",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,68 @@
# SPFx WebPart in Teams Meetings App
Demo SPFx web part project that demonstrates using as a Microsoft Teams meetings app. This is associated with the SPFx docs tutorial: [Tutorial: Build meeting apps for Microsoft Teams with SPFx](https://docs.microsoft.com/sharepoint/dev//spfx/build-for-teams-meeting-app)
## Summary
This project demonstrates a SPFx web part used as a Microsoft Teams meetings app with minimal functionality.
![picture of the web part in action](assets/preview.png)
## Compatibility
![SPFx 1.12.1](https://img.shields.io/badge/SPFx-1.12.1-green.svg)
![Node.js LTS 14.x](https://img.shields.io/badge/Node.js-LTS%2014.x-green.svg)
![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg)
![Teams Yes: Designed for Microsoft Teams](https://img.shields.io/badge/Teams-Yes-green.svg "Designed for Microsoft Teams")
![Workbench Hosted: Does not work with local workbench](https://img.shields.io/badge/Workbench-Hosted-yellow.svg "Does not work with local workbench")
## Applies to
- [Microsoft Teams](https://aka.ms/microsoftteams)
- [SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
- [Microsoft 365 tenant](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
## Prerequisites
- Administrative access to MS Teams to deploy the package
## Solution
Solution|Author(s)
--------|---------
js-teams-meeting-app | [Andrew Connell](/andrewconnell) ([@andrewconnell](https://twitter.com/andrewconnell)), [Voitanos, LLC](https://www.voitanos.io)
## Version history
Version | Date | Comments
------- | -------------- | ---------------
1.0 | April 27, 2021 | Initial release
## Disclaimer
**THIS CODE IS PROVIDED *AS IS- WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
---
## Minimal Path to Awesome
Refer to the above mentioned SPFx tutorial for full repro instructions.
- Clone this repository
- ZIP the contents of the **./teams** folder, *but not the folder itself*
- rename the ZIP to **TeamsSPFxApp.zip**
- From the command line install all dependencies and create the package:
```console
npm install
gulp bundle -p
gulp package-solution -p
```
- Upload the **.sppkg** to your SPO tenant's app catalog & deploy it
- select the uploaded package, then select the **Sync to Teams** button in the **Files** tab in the ribbon
- In Microsoft Teams, create a new meeting using the **Calendar** app in the leftmost navigation bar
- After creating the meeting, edit it, and select the **+** in the tab bar
- Select the app you deployed to install the app
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/js-teams-meeting-app" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"my-first-teams-meeting-app-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/myFirstTeamsMeetingApp/MyFirstTeamsMeetingAppWebPart.js",
"manifest": "./src/webparts/myFirstTeamsMeetingApp/MyFirstTeamsMeetingAppWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"MyFirstTeamsMeetingAppWebPartStrings": "lib/webparts/myFirstTeamsMeetingApp/loc/{locale}.js"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "./release/assets/"
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "teams-meeting-app",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "teams-meeting-app-client-side-solution",
"id": "a70a8d1d-f76f-4535-bf43-0d1abd0377e6",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "Test User",
"websiteUrl": "https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview",
"privacyUrl": "https://microsoft.com/privacy",
"termsOfUseUrl": "https://microsoft.com/terms",
"mpnId": "000000"
}
},
"paths": {
"zippedPackage": "solution/teams-meeting-app.sppkg"
}
}

View File

@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -0,0 +1,16 @@
'use strict';
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
{
"name": "teams-meeting-app",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.12.1-rc.3",
"@microsoft/sp-property-pane": "1.12.1-rc.3",
"@microsoft/sp-webpart-base": "1.12.1-rc.3",
"@microsoft/sp-lodash-subset": "1.12.1-rc.3",
"@microsoft/sp-office-ui-fabric-core": "1.12.1-rc.3"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.12.1-rc.3",
"@microsoft/sp-tslint-rules": "1.12.1-rc.3",
"@microsoft/sp-module-interfaces": "1.12.1-rc.3",
"@microsoft/sp-webpart-workbench": "1.12.1-rc.3",
"@microsoft/rush-stack-compiler-3.7": "0.2.3",
"gulp": "~4.0.2",
"ajv": "~5.2.2",
"@types/webpack-env": "1.13.1"
}
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,27 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "ae096643-1ded-479b-a3d8-64dca8669d37",
"alias": "MyFirstTeamsMeetingAppWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsTab"],
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },
"title": { "default": "MyFirstTeamsMeetingApp" },
"description": { "default": "My first Microsoft Teams meeting app" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "MyFirstTeamsMeetingApp"
}
}]
}

View File

@ -0,0 +1,74 @@
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
.myFirstTeamsMeetingApp {
.container {
max-width: 700px;
margin: 0px auto;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.row {
@include ms-Grid-row;
@include ms-fontColor-white;
background-color: $ms-color-themeDark;
padding: 20px;
}
.column {
@include ms-Grid-col;
@include ms-lg10;
@include ms-xl8;
@include ms-xlPush2;
@include ms-lgPush1;
}
.title {
@include ms-font-xl;
@include ms-fontColor-white;
}
.subTitle {
@include ms-font-l;
@include ms-fontColor-white;
}
.description {
@include ms-font-l;
@include ms-fontColor-white;
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: $ms-color-themePrimary;
border-color: $ms-color-themePrimary;
color: $ms-color-white;
// Basic Button
outline: transparent;
position: relative;
font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
-webkit-font-smoothing: antialiased;
font-size: $ms-font-size-m;
font-weight: $ms-font-weight-regular;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: $ms-font-weight-semibold;
font-size: $ms-font-size-m;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -0,0 +1,71 @@
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { escape } from '@microsoft/sp-lodash-subset';
import styles from './MyFirstTeamsMeetingAppWebPart.module.scss';
import * as strings from 'MyFirstTeamsMeetingAppWebPartStrings';
export interface IMyFirstTeamsMeetingAppWebPartProps {
description: string;
}
export default class MyFirstTeamsMeetingAppWebPart extends BaseClientSideWebPart<IMyFirstTeamsMeetingAppWebPartProps> {
public render(): void {
let title: string = 'ERR: not in Microsoft Teams';
let subTitle: string = 'ERR: not in Microsoft Teams';
if (this.context.sdks.microsoftTeams) {
if (this.context.sdks.microsoftTeams.context.meetingId) {
title = "Welcome to Microsoft Teams!";
subTitle = "We are in the context of following meeting: " + this.context.sdks.microsoftTeams.context.meetingId;
} else {
title = "Welcome to Microsoft Teams!";
subTitle = "We are in the context of following team: " + this.context.sdks.microsoftTeams.context.teamName;
}
}
this.domElement.innerHTML = `
<div class="${ styles.myFirstTeamsMeetingApp }">
<div class="${ styles.container }">
<div class="${ styles.row }">
<div class="${ styles.column }">
<span class="${ styles.title }">${title}</span>
<p class="${ styles.subTitle }">${subTitle}</p>
</div>
</div>
</div>
</div>`;
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}

View File

@ -0,0 +1,7 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field"
}
});

View File

@ -0,0 +1,10 @@
declare interface IMyFirstTeamsMeetingAppWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
}
declare module 'MyFirstTeamsMeetingAppWebPartStrings' {
const strings: IMyFirstTeamsMeetingAppWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,52 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.8/MicrosoftTeams.schema.json",
"manifestVersion": "1.8",
"packageName": "ms365.spfx.teamsmeetingsapp",
"id": "ae096643-1ded-479b-a3d8-64dca8669d37",
"version": "1.0",
"developer": {
"name": "Contoso Developer Department",
"websiteUrl": "https://contoso.com/spfx-teams-meetings-app",
"privacyUrl": "https://contoso.com/privacystatement",
"termsOfUseUrl": "https://contoso.com/servicesagreement"
},
"name": {
"short": "SPFx Meetings App",
"full": "SPFx Meetings App - Tabs Demo"
},
"description": {
"short": "Demonstration SPFx web part used as MS Teams meeting app tab.",
"full": "This demonstration app shows how to create a meetings app using an SPFx web part that's displayed as a tab for the meeting."
},
"icons": {
"outline": "ae096643-1ded-479b-a3d8-64dca8669d37_outline.png",
"color": "ae096643-1ded-479b-a3d8-64dca8669d37_color.png"
},
"accentColor": "#004578",
"configurableTabs": [
{
"configurationUrl": "https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/_layouts/15/teamshostedapp.aspx%3Fteams%26componentId=ae096643-1ded-479b-a3d8-64dca8669d37",
"canUpdateConfiguration": false,
"scopes": [
"team",
"groupchat"
],
"context": [
"channelTab",
"privateChatTab",
"meetingSidePanel",
"meetingDetailsTab",
"meetingChatTab"
]
}
],
"validDomains": [
"*.login.microsoftonline.com",
"*.sharepoint.com",
"resourceseng.blob.core.windows.net"
],
"webApplicationInfo": {
"resource": "https://{teamSiteDomain}",
"id": "00000003-0000-0ff1-ce00-000000000000"
}
}

View File

@ -0,0 +1,35 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.7/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}

View File

@ -0,0 +1,30 @@
{
"extends": "./node_modules/@microsoft/sp-tslint-rules/base-tslint.json",
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"variable-name": false,
"whitespace": false
}
}