Skip to content

Commit

Permalink
Update packages/teams-js/src/public/pages.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Harris <trharris@microsoft.com>
  • Loading branch information
2 people authored and Maggie G committed Feb 9, 2024
1 parent 9519301 commit 1a235c2
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions packages/teams-js/src/public/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,12 +1140,13 @@ export namespace pages {
*
* @beta
*/
conversionId: string;
conversationId: string;
}

/**
* Notify host apps to show the response button.
* @param params - Parameters sent to host apps contain the required information.
* @param params - Parameters {@link ResponseInfo} sent to host apps contain the required information.
* @returns Promise that resolves when the response button has been shown on the host app or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error.
*
* @beta
*/
Expand All @@ -1154,19 +1155,33 @@ export namespace pages {
if (!isSupported()) {
throw errorNotSupportedOnPlatform;
}
if (!params) {
throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
}
checkValidResponseInfo(params);
return sendAndHandleSdkErrorWithVersion(
getApiVersionTag(pagesTelemetryVersionNumber, ApiName.Pages_ResponseButton_ShowResponseButton),
'pages.responseButton.showResponseButton',
params,
);
}

function checkValidResponseInfo(info: ResponseInfo): void {
if (
!info ||
!info.responseId ||
info.responseId == '' ||
!info.messageId ||
info.messageId == '' ||
!info.conversationId ||
info.conversationId == '' ||
!info.oneDriveFileId ||
info.oneDriveFileId == ''
) {
throw { errorCode: ErrorCode.INVALID_ARGUMENTS };
}
}

/**
* Notify host apps to hide the response button
*
* @returns Promise that resolves when the response button has been shown on the host app or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error.
* @beta
*/
export function hideResponseButton(): Promise<void> {
Expand Down

0 comments on commit 1a235c2

Please sign in to comment.