Skip to content

Commit

Permalink
Merge branch 'main' into lakhveer/eligibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhveerk authored Nov 21, 2024
2 parents b867727 + 73a6890 commit ad12899
Show file tree
Hide file tree
Showing 26 changed files with 443 additions and 100 deletions.
4 changes: 2 additions & 2 deletions apps/teams-test-app/index_cdn.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script
src="https://res.cdn.office.net/teams-js/2.31.0/js/MicrosoftTeams.min.js"
integrity="sha384-A2y7iMKbK0AQrgKq1YKcLB8XgtyowB2MPzC40KFfA58nQObf6xU3C5NE0cTcis0V"
src="https://res.cdn.office.net/teams-js/2.31.1/js/MicrosoftTeams.min.js"
integrity="sha384-ihAqYgEJz9hzEU+HaYodG1aTzjebC/wKXQi1nWKZG7OLAUyOL9ZrzD/SfZu79Jeu"
crossorigin="anonymous"
></script>
<div id="root"></div>
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 @@ -3,7 +3,7 @@
"private": true,
"author": "Microsoft Teams",
"description": "Teams Test App utilizing Teams JavaScript client SDK to test Hosts",
"version": "2.31.0",
"version": "2.31.1",
"scripts": {
"build": "pnpm build:bundle",
"build:bundle": "pnpm lint && webpack",
Expand Down
13 changes: 12 additions & 1 deletion apps/teams-test-app/src/components/OtherAppStateChangeAPIs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { otherAppStateChange } from '@microsoft/teams-js';
import { AppId, otherAppStateChange } from '@microsoft/teams-js';
import React, { ReactElement } from 'react';

import { ApiWithoutInput } from './utils';
Expand Down Expand Up @@ -39,12 +39,23 @@ const UnregisterAppInstallHandler = (): React.ReactElement =>
},
});

const NotifyInstallCompletedHandler = (): React.ReactElement =>
ApiWithoutInput({
name: 'otherAppStateChange_notifyInstallCompleted',
title: 'Notify Install Completed',
onClick: async () => {
otherAppStateChange.notifyInstallCompleted(new AppId('12345'));
return 'notified';
},
});

const OtherAppStateChangedAPIs = (): ReactElement => (
<>
<ModuleWrapper title="OtherAppStateChanged">
<CheckOtherAppStateChangeCapability />
<RegisterAppInstallHandler />
<UnregisterAppInstallHandler />
<NotifyInstallCompletedHandler />
</ModuleWrapper>
</>
);
Expand Down
61 changes: 61 additions & 0 deletions apps/teams-test-app/src/components/StoreApis.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { AppId, store } from '@microsoft/teams-js';
import { ReactElement } from 'react';
import React from 'react';

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

const StoreAPIs = (): ReactElement => {
const CheckStoreCapability = (): ReactElement =>
ApiWithoutInput({
name: 'checkCapabilityStore',
title: 'Check Capability Store',
onClick: async () => {
if (store.isSupported()) {
return 'Store module is supported';
} else {
return 'Store module is not supported';
}
},
});

const OpenStore = (): ReactElement =>
ApiWithTextInput<{ dialogType: string; appId?: string; collectionId?: string }>({
name: 'storeOpen',
title: 'Store Open',
onClick: {
validateInput: (input) => {
if (input?.dialogType === undefined) {
throw new Error('store type undefined');
}
},
submit: async (input) => {
const appId = input.appId === undefined ? undefined : new AppId(input.appId);
const openStoreParam = {
dialogType: input.dialogType,
appId: appId,
collectionId: input.collectionId,
};
// eslint-disable-next-line no-useless-catch
try {
await store.openStoreExperience(openStoreParam as store.OpenStoreParams);
return 'store opened';
} catch (e) {
throw e;
}
},
},
defaultInput: JSON.stringify({
dialogType: 'appdetail',
appId: '1542629c-01b3-4a6d-8f76-1938b779e48d',
}),
});
return (
<ModuleWrapper title="Store">
<CheckStoreCapability />
<OpenStore />
</ModuleWrapper>
);
};

export default StoreAPIs;
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 @@ -60,6 +60,7 @@ import SecondaryBrowserAPIs from '../components/SecondaryBrowserAPIs';
import SharingAPIs from '../components/SharingAPIs';
import StageViewAPIs from '../components/StageViewAPIs';
import StageViewSelfAPIs from '../components/StageViewSelfAPIs';
import StoreAPIs from '../components/StoreApis';
import TeamsCoreAPIs from '../components/TeamsCoreAPIs';
import ThirdPartyCloudStorageAPIs from '../components/ThirdPartyCloudStorageAPIs';
import CookieAccessComponent from '../components/ThirdPatryCookies';
Expand Down Expand Up @@ -163,6 +164,7 @@ export const TestApp: React.FC = () => {
{ name: 'VideoAPIs', component: <VideoAPIs /> },
{ name: 'VideoExAPIs', component: <VideoExAPIs /> },
{ name: 'VisualMediaAPIs', component: <VisualMediaAPIs /> },
{ name: 'StoreAPIs', component: <StoreAPIs /> },
],
[],
);
Expand Down
6 changes: 0 additions & 6 deletions apps/typed-dependency-tester/.eslintrc.js

This file was deleted.

17 changes: 0 additions & 17 deletions apps/typed-dependency-tester/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions apps/typed-dependency-tester/package.json

This file was deleted.

16 changes: 0 additions & 16 deletions apps/typed-dependency-tester/tsconfig.json

This file was deleted.

5 changes: 0 additions & 5 deletions apps/typed-dependency-tester/tsconfig.strictNullChecks.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added `store` capability that will enable user to open several types of app store dialogs.. The capability is still awaiting support in one or most host applications. To track availability of this capability across different hosts see https://aka.ms/capmatrix",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Released 2.31.1",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "none"
}

This file was deleted.

11 changes: 10 additions & 1 deletion packages/teams-js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Change Log - @microsoft/teams-js

This log was last generated on Wed, 13 Nov 2024 19:22:01 GMT and should not be manually modified.
This log was last generated on Wed, 20 Nov 2024 19:25:55 GMT and should not be manually modified.

<!-- Start content -->

## 2.31.1

Wed, 20 Nov 2024 19:25:55 GMT

### Patches

- Fixed a bug causing `buffer` polyfill to stil be included
- Fixed bugs regarding `EduType`not being exported, and enum typings

## 2.31.0

Wed, 13 Nov 2024 19:22:01 GMT
Expand Down
8 changes: 4 additions & 4 deletions packages/teams-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv

### Production

You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.31.0/js/MicrosoftTeams.min.js) or point your package manager at them.
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.31.1/js/MicrosoftTeams.min.js) or point your package manager at them.

## Usage

Expand All @@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
```html
<!-- Microsoft Teams JavaScript API (via CDN) -->
<script
src="https://res.cdn.office.net/teams-js/2.31.0/js/MicrosoftTeams.min.js"
integrity="sha384-A2y7iMKbK0AQrgKq1YKcLB8XgtyowB2MPzC40KFfA58nQObf6xU3C5NE0cTcis0V"
src="https://res.cdn.office.net/teams-js/2.31.1/js/MicrosoftTeams.min.js"
integrity="sha384-ihAqYgEJz9hzEU+HaYodG1aTzjebC/wKXQi1nWKZG7OLAUyOL9ZrzD/SfZu79Jeu"
crossorigin="anonymous"
></script>

<!-- Microsoft Teams JavaScript API (via npm) -->
<script src="node_modules/@microsoft/[email protected].0/dist/MicrosoftTeams.min.js"></script>
<script src="node_modules/@microsoft/[email protected].1/dist/MicrosoftTeams.min.js"></script>

<!-- Microsoft Teams JavaScript API (via local) -->
<script src="MicrosoftTeams.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/teams-js",
"author": "Microsoft Teams",
"version": "2.31.0",
"version": "2.31.1",
"description": "Microsoft Client SDK for building app for Microsoft hosts",
"repository": {
"directory": "packages/teams-js",
Expand Down
2 changes: 2 additions & 0 deletions packages/teams-js/src/internal/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const enum ApiName {
Notifications_ShowNotification = 'notifications.showNotification',
OtherAppStateChange_Install = 'otherApp.install',
OtherAppStateChange_UnregisterInstall = 'otherApp.unregisterInstall',
OtherAppStateChange_NotifyInstallCompleted = 'otherApp.notifyInstallCompleted',
Pages_AppButton_OnClick = 'pages.appButton.onClick',
Pages_AppButton_OnHoverEnter = 'pages.appButton.onHoverEnter',
Pages_AppButton_OnHoverLeave = 'pages.appButton.onHoverLeave',
Expand Down Expand Up @@ -322,6 +323,7 @@ export const enum ApiName {
Sharing_ShareWebContent = 'sharing.shareWebContent',
StageView_Open = 'stageView.open',
StageView_Self_Close = 'stageView.self.close',
Store_Open = 'store.open',
Tasks_StartTask = 'tasks.startTask',
Tasks_SubmitTask = 'tasks.submitTask',
Tasks_UpdateTask = 'tasks.updateTask',
Expand Down
1 change: 1 addition & 0 deletions packages/teams-js/src/private/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export * as appEntity from './appEntity';
export * as teams from './teams/teams';
export * as videoEffectsEx from './videoEffectsEx';
export * as hostEntity from './hostEntity/hostEntity';
export * as store from './store';
27 changes: 26 additions & 1 deletion packages/teams-js/src/private/otherAppStateChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
* when another application has been installed.
*/

import { sendMessageToParent } from '../internal/communication';
import { callFunctionInHost, sendMessageToParent } from '../internal/communication';
import { registerHandler, removeHandler } from '../internal/handlers';
import { ensureInitialized } from '../internal/internalAPIs';
import { ApiName, ApiVersionNumber, getApiVersionTag } from '../internal/telemetry';
import { isNullOrUndefined } from '../internal/typeCheckUtilities';
import { AppId } from '../public/appId';
import { ErrorCode } from '../public/interfaces';
import { runtime } from '../public/runtime';

Expand Down Expand Up @@ -112,6 +113,30 @@ export function unregisterAppInstallationHandler(): void {
removeHandler(ApiName.OtherAppStateChange_Install);
}

/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* This function should be called by the Store App to notify the host that the
* app with the given appId has been installed.
*
* @throws Error if {@link app.initialize} has not successfully completed or if the platform
* does not support the otherAppStateChange capability.
*/
export function notifyInstallCompleted(appId: AppId): Promise<void> {
if (!isSupported()) {
throw new Error(ErrorCode.NOT_SUPPORTED_ON_PLATFORM.toString());
}

return callFunctionInHost(
ApiName.OtherAppStateChange_NotifyInstallCompleted,
[appId.toString()],
getApiVersionTag(otherAppStateChangeTelemetryVersionNumber, ApiName.OtherAppStateChange_NotifyInstallCompleted),
);
}

/**
* Checks if the otherAppStateChange capability is supported by the host
* @returns boolean to represent whether the otherAppStateChange capability is supported
Expand Down
Loading

0 comments on commit ad12899

Please sign in to comment.