Skip to content

Commit

Permalink
Merge branch 'main' into jadahiya/edge_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jadahiya-MSFT authored Oct 1, 2024
2 parents 5b480e4 + 056aa96 commit e8b4d79
Show file tree
Hide file tree
Showing 45 changed files with 1,926 additions and 366 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cSpell.words": ["adal", "frameless", "ipados", "teamspace", "uninitialize", "xvfb"],
"cSpell.words": ["adal", "frameless", "ipados", "teamsjs", "teamspace", "uninitialize", "xvfb"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.workingDirectories": [
"./apps/ssr-test-app/",
Expand Down
2 changes: 1 addition & 1 deletion apps/teams-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:CDN": "pnpm lint && webpack --config webpack.cdn.config.js",
"build:local": "pnpm lint && webpack --config webpack.local.config.js && pnpm copy",
"clean": "rimraf ./build",
"copy": "shx cp ../../packages/teams-js/dist/MicrosoftTeams.min.js ./build/ && shx cp ../../packages/teams-js/dist/MicrosoftTeams.min.js.map ./build/",
"copy": "shx cp ../../packages/teams-js/dist/umd/MicrosoftTeams.min.js ./build/ && shx cp ../../packages/teams-js/dist/umd/MicrosoftTeams.min.js.map ./build/",
"lint": "pnpm eslint ./src --max-warnings 0 --fix --ext .tsx",
"start": "pnpm start:bundle",
"start:bundle": "webpack serve",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { externalAppCardActions } from '@microsoft/teams-js';
import { externalAppCardActions, IAdaptiveCardActionSubmit } from '@microsoft/teams-js';
import React from 'react';

import { ApiWithoutInput, ApiWithTextInput } from '../utils';
Expand All @@ -15,7 +15,7 @@ const CheckExternalAppCardActionsCapability = (): React.ReactElement =>
const ProcessActionSubmit = (): React.ReactElement =>
ApiWithTextInput<{
appId: string;
actionSubmitPayload: externalAppCardActions.IAdaptiveCardActionSubmit;
actionSubmitPayload: IAdaptiveCardActionSubmit;
}>({
name: 'processActionSubmit',
title: 'Process Action Submit',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { AppId, externalAppCardActionsForCEA, IAdaptiveCardActionSubmit } from '@microsoft/teams-js';
import React from 'react';

import { ApiWithoutInput, ApiWithTextInput } from '../utils';
import { ModuleWrapper } from '../utils/ModuleWrapper';

const CheckExternalAppCardActionsForCEACapability = (): React.ReactElement =>
ApiWithoutInput({
name: 'checkExternalAppCardActionsForCEACapability',
title: 'Check External App Card Actions For CEA Capability',
onClick: async () =>
`External App Card Actions For CEA module ${
externalAppCardActionsForCEA.isSupported() ? 'is' : 'is not'
} supported`,
});

const CECProcessActionSubmit = (): React.ReactElement =>
ApiWithTextInput<{
appId: AppId;
conversationId: string;
actionSubmitPayload: IAdaptiveCardActionSubmit;
}>({
name: 'processActionSubmitForCEA',
title: 'Process Action Submit For CEA',
onClick: {
validateInput: (input) => {
if (!input.appId) {
throw new Error('appId is required');
}
if (!input.actionSubmitPayload) {
throw new Error('actionSubmitPayload is required');
}
},
submit: async (input) => {
await externalAppCardActionsForCEA.processActionSubmit(
input.appId,
input.conversationId,
input.actionSubmitPayload,
);
return 'Completed';
},
},
defaultInput: JSON.stringify({
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a',
actionSubmitPayload: {
id: 'submitId',
data: 'data1',
},
}),
});

const CECProcessActionOpenUrl = (): React.ReactElement =>
ApiWithTextInput<{
appId: AppId;
conversationId: string;
url: string;
}>({
name: 'processActionOpenUrlForCEA',
title: 'Process Action Open Url For CEA',
onClick: {
validateInput: (input) => {
if (!input.appId) {
throw new Error('appId is required');
}
if (!input.url) {
throw new Error('url is required');
}
},
submit: async (input) => {
const result = await externalAppCardActionsForCEA.processActionOpenUrl(
input.appId,
input.conversationId,
new URL(input.url),
);
return JSON.stringify(result);
},
},
defaultInput: JSON.stringify({
appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a',
url: 'https://www.example.com',
}),
});

const ExternalAppCardActionsForCEAAPIs = (): React.ReactElement => (
<ModuleWrapper title="External App Card Actions For CEA">
<CheckExternalAppCardActionsForCEACapability />
<CECProcessActionSubmit />
<CECProcessActionOpenUrl />
</ModuleWrapper>
);

export default ExternalAppCardActionsForCEAAPIs;
2 changes: 2 additions & 0 deletions apps/teams-test-app/src/pages/TestApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import ChatAPIs from '../components/privateApis/ChatAPIs';
import CopilotAPIs from '../components/privateApis/CopilotAPIs';
import ExternalAppAuthenticationAPIs from '../components/privateApis/ExternalAppAuthenticationAPIs';
import ExternalAppCardActionsAPIs from '../components/privateApis/ExternalAppCardActionsAPIs';
import ExternalAppCardActionsForCEAAPIs from '../components/privateApis/ExternalAppCardActionsForCEAAPIs';
import ExternalAppCommandsAPIs from '../components/privateApis/ExternalAppCommandsAPIs';
import FilesAPIs from '../components/privateApis/FilesAPIs';
import FullTrustAPIs from '../components/privateApis/FullTrustAPIs';
Expand Down Expand Up @@ -114,6 +115,7 @@ export const TestApp: React.FC = () => {
<DialogUrlParentCommunicationAPIs childWindowRef={dialogWindowRef} />
<ExternalAppAuthenticationAPIs />
<ExternalAppCardActionsAPIs />
<ExternalAppCardActionsForCEAAPIs />
<ExternalAppCommandsAPIs />
<FilesAPIs />
<FullTrustAPIs />
Expand Down
26 changes: 26 additions & 0 deletions apps/tree-shaking-test-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "tree-shaking-test-app",
"private": true,
"author": "Noah",
"description": "Test app to test the tree-shakability of TeamsJS",
"version": "0.0.1",
"main": "index.ts",
"type": "module",
"scripts": {
"build-rollup": "pnpm clean && rollup --c",
"build-webpack": "webpack",
"clean": "rimraf ./dist"
},
"dependencies": {
"@microsoft/teams-js": "workspace:*"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/plugin-terser": "0.4.4",
"rollup": "^4.18.0",
"webpack": "^5.18.0",
"webpack-cli": "^4.3.1",
"testlibraryfortreeshaking": "^1.0.24"
}
}
28 changes: 28 additions & 0 deletions apps/tree-shaking-test-app/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';

// rollup.config.mjs
export default {
input: 'src/index.ts',
output: [
{
file: 'dist/bundle.js',
format: 'es',
sourcemap: true,
},
{
file: 'dist/bundle.min.js',
format: 'es',
plugins: [terser()],
sourcemap: true,
},
],
plugins: [
nodeResolve({
extension: ['.js', '.ts', '.d.ts', '.json'],
}),
typescript(),
],
treeshake: true,
};
5 changes: 5 additions & 0 deletions apps/tree-shaking-test-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { barCode } from 'testlibraryfortreeshaking';
import { geoLocation } from '@microsoft/teams-js';
barCode.hasPermission();
geoLocation.requestPermission();
geoLocation.map.isSupported();
28 changes: 28 additions & 0 deletions apps/tree-shaking-test-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "es6",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react",
"sourceMap": true,
"outDir": "./dist"
},
"include": ["src"],
"exclude": [
"**/build/*",
"build",
"node_modules",
"**/*.test.*",
"webpack.config.js",
"webpack.cdn.config.js",
"webpack.cdnV1.config.js",
"webpack.local.config.js"
]
}
30 changes: 30 additions & 0 deletions apps/tree-shaking-test-app/webpack.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint @typescript-eslint/no-var-requires: off*/
/* eslint-disable no-undef */
const path = require('path');

module.exports = {
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
mode: 'development',
optimization: {
usedExports: true,
innerGraph: true,
sideEffects: false,
},
devtool: false,
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};
2 changes: 1 addition & 1 deletion apps/typed-dependency-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "0.0.1",
"scripts": {
"build": "pnpm i && pnpm copy && pnpm tsc && pnpm clean",
"copy": "cp ./node_modules/@microsoft/teams-js/dist/MicrosoftTeams.d.ts ./ || xcopy .\\node_modules\\@microsoft\\teams-js\\dist\\MicrosoftTeams.d.ts .\\ /Y",
"copy": "cp ./node_modules/@microsoft/teams-js/dist/umd/MicrosoftTeams.d.ts ./ || xcopy .\\node_modules\\@microsoft\\teams-js\\dist\\umd\\MicrosoftTeams.d.ts .\\ /Y",
"clean": "rimraf node_modules && rimraf MicrosoftTeams.d.ts"
},
"dependencies": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added logging for version on startup",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added APIs for `externalAppCardActionsForCEA` capability.",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Updated internal app id validation",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added a Rollup built bundle of Teams-JS",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Renamed prepBetaRelease.js to use .cjs file extension",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added logging for current teamsjs instance and timestamps",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
"@mixer/webpack-bundle-compare": "^0.1.1",
"@next/eslint-plugin-next": "^14.2.4",
"@octokit/core": "^3.6.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "5.0.7",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.5.2",
"@types/jscodeshift": "^0.11.11",
Expand Down Expand Up @@ -80,9 +86,12 @@
"path": "^0.12.7",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"rollup": "^4.22.4",
"rollup-plugin-polyfill-node": "^0.13.0",
"shx": "^0.3.4",
"style-loader": "^3.3.4",
"ts-jest": "^29.1.2",
"tslib": "^2.3.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typedoc": "^0.24.8",
Expand Down
File renamed without changes.
File renamed without changes.
21 changes: 18 additions & 3 deletions packages/teams-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
"type": "git",
"url": "https://github.com/OfficeDev/microsoft-teams-library-js"
},
"main": "./dist/MicrosoftTeams.min.js",
"typings": "./dist/MicrosoftTeams.d.ts",
"main": "./dist/umd/MicrosoftTeams.min.js",
"typings": "./dist/umd/MicrosoftTeams.d.ts",
"module": "./dist/esm/packages/teams-js/src/index.js",
"type": "module",
"scripts": {
"build": "pnpm lint && webpack && pnpm docs:validate",
"build": "pnpm clean && pnpm lint && pnpm build-rollup && pnpm build-webpack && pnpm docs:validate",
"build-rollup": "pnpm clean && rollup -c",
"build-webpack": "webpack",
"clean": "rimraf ./dist",
"docs": "pnpm typedoc",
"docs:validate": "pnpm typedoc --emit none",
Expand All @@ -27,6 +31,17 @@
"devDependencies": {
"@types/debug": "^4.1.7"
},
"sideEffects": [
"src/internal/communication.ts",
"src/internal/nestedAppAuthUtils.ts",
"src/internal/utils.ts",
"src/internal/videoEffectsUtils.ts",
"src/private/constants.ts",
"src/private/interfaces.ts",
"src/public/constants.ts",
"src/public/handlers.ts",
"src/public/interfaces.ts"
],
"license": "MIT",
"files": [
"dist/**",
Expand Down
File renamed without changes.
Loading

0 comments on commit e8b4d79

Please sign in to comment.