Skip to content

Commit

Permalink
Merge pull request #125 from ankitsaini90/added-custom-engine-agents-…
Browse files Browse the repository at this point in the history
…plugins

Added plugins to test custom engine agent's flow
  • Loading branch information
ydogandjiev authored Dec 6, 2024
2 parents 726626b + 22585d0 commit ff90bec
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"start": "node server.js"
},
"dependencies": {
"@microsoft/teams-js": "^2.28.0",
"@microsoft/teams-js": "^2.29.0",
"express": "^4.20.0",
"history": "^5.0.0",
"serve-static": "^1.14.1"
Expand Down
238 changes: 238 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,244 @@ const initializeAppModules = () => {
},
})

addModule({
name: "ExternalAppAuthentication.authenticateWithSSOForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "1a69c0fd-6ec8-488e-8900-ff3a2fcf5f51"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "object",
name: "authTokenRequest",
defaultValue:
'{}',
}
],
action: function (appId, convId, authTokenRequest, output) {
microsoftTeams.externalAppAuthenticationForCEA
.authenticateWithSSO(appId, convId, authTokenRequest)
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

addModule({
name: "ExternalAppAuthentication.authenticateWithOauthForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "f46ad259-0fe5-4f12-872d-c737b174bcb4"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "object",
name: "authenticateParameters",
defaultValue: JSON.stringify({
url: new URL("https://token.botframework.com/api/oauth/signin?signin=78ed2ae53eb6442d8a784554003ca8f3"),
isExternal: true,
}),
}
],
action: function (appId, convId, authenticateParameters, output) {
microsoftTeams.externalAppAuthenticationForCEA
.authenticateWithOauth(appId, convId, authenticateParameters)
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

addModule({
name: "ExternalAppAuthentication.authenticateWithSSOAndResendRequestForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "1a69c0fd-6ec8-488e-8900-ff3a2fcf5f51"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "object",
name: "authTokenRequest",
defaultValue:
'{}',
},
{
type: "object",
name: "originalRequestInfo",
defaultValue:
JSON.stringify({
requestType: "ActionExecuteInvokeRequest",
type: "Action.Execute",
id: "mockId",
verb: "verb",
data: "data",
}),
}
],
action: function (appId, convId, authTokenRequest, originalRequestInfo, output) {
microsoftTeams.externalAppAuthenticationForCEA
.authenticateWithSSOAndResendRequest(appId, convId, authTokenRequest, originalRequestInfo)
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

addModule({
name: "ExternalAppAuthentication.authenticateWithOauthAndResendRequestForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "f46ad259-0fe5-4f12-872d-c737b174bcb4"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "object",
name: "authenticateParameters",
defaultValue: JSON.stringify({
url: new URL("https://ccmsteams.integrations.adobe.com/auth/v2/login?width=600&height=600&mode=bot"),
isExternal: true,
}),
},
{
type: "object",
name: "originalRequestInfo",
defaultValue:
JSON.stringify({
requestType: "ActionExecuteInvokeRequest",
type: "Action.Execute",
id: "mockId",
verb: "verb",
data: "data",
}),
}
],
action: function (appId, convId, authenticateParameters, originalRequestInfo, output) {
microsoftTeams.externalAppAuthenticationForCEA
.authenticateAndResendRequest(appId, convId, authenticateParameters, originalRequestInfo)
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

addModule({
name: "ExternalAppCardActions.processActionSubmitForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "f350a51f-0251-47f2-b355-e0819a1bc44a"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "object",
name: "actionSubmitPayload",
defaultValue: JSON.stringify({
id: "submitActionId",
title: "title",
data: {
msteams:{
type:"invoke",
}
}
})
}
],
action: function (appId, convId, actionSubmitPayload, output) {
microsoftTeams.externalAppCardActionsForCEA
.processActionSubmit(appId, convId, actionSubmitPayload)
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

addModule({
name: "ExternalAppCardActions.processActionOpenUrlForCEA",
initializedRequired: true,
hasOutput: true,
inputs: [
{
type: "string",
name: "appId",
defaultValue: "f350a51f-0251-47f2-b355-e0819a1bc44a"
},
{
type: "string",
name: "convId",
defaultValue: "mockConvId"
},
{
type: "string",
name: "url",
defaultValue: "https://bing.com"
}
],
action: function (appId, convId, url, output) {
microsoftTeams.externalAppCardActionsForCEA
.processActionOpenUrl(appId, convId, new URL(url))
.then((result) => {
output(result);
})
.catch((error) => {
output(error);
});
},
});

// Get the modal
var modal = document.getElementById("myModal");

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@microsoft/teams-js@^2.28.0":
version "2.28.0"
resolved "https://registry.yarnpkg.com/@microsoft/teams-js/-/teams-js-2.28.0.tgz#e7903eaff268d04a018a6494e6e770212fa8dd90"
integrity sha512-WcQ2vWY+AvTOxToANe4znqDBvURDvZTztpjy5sYT24vsFimWKydOwT3OFE1/Av+gzofPrtqn+mf9bq6i9ED7Tg==
"@microsoft/teams-js@^2.29.0":
version "2.29.0"
resolved "https://registry.yarnpkg.com/@microsoft/teams-js/-/teams-js-2.29.0.tgz#739167b79a045355cf5c6b79f5d586e58f2ba87f"
integrity sha512-g0nw3OR+Mz3AEbT4zeMcBE69MY2UOQx0MaYO26x0UVy/0Ilip2OUEA+qIRlw/uraTYJaCsh0csm1/i44UWGcLQ==
dependencies:
base64-js "^1.3.1"
debug "^4.3.3"
Expand Down

0 comments on commit ff90bec

Please sign in to comment.