Skip to content

Commit

Permalink
feat: update all sample add-ons to 1.0.0 (#21)
Browse files Browse the repository at this point in the history
* feat: update all sample add-ons to 1.0.0

* fix: update startActivity to startCollaboration

* fix: remove branch deployment
  • Loading branch information
teddyward authored Sep 9, 2024
1 parent 9e106c7 commit 3311b73
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 43 deletions.
2 changes: 1 addition & 1 deletion addons-web-sdk/samples/animation-next-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@googleworkspace/meet-addons": "^0.12.0",
"@googleworkspace/meet-addons": "^1.0.0",
"next": "14.2.7",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 1 addition & 1 deletion addons-web-sdk/samples/hello-world-next-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@googleworkspace/meet-addons": "^0.9.1",
"@googleworkspace/meet-addons": "^1.0.0",
"next": "14.2.7",
"react": "^18",
"react-dom": "^18"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";
'use client';

import { useEffect } from 'react';
import { meet } from '@googleworkspace/meet-addons/meet.addons';
Expand All @@ -22,11 +22,12 @@ export default function Page() {
initializeMainStage();
}, []);


return (
<>
<div>This is the Add-on Main Stage. Everyone in the call can see this.</div>
<div>
This is the Add-on Main Stage. Everyone in the call can see this.
</div>
<div>Hello, world!</div>
</>
)
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"use client";
'use client';

import { useEffect, useState } from 'react';
import { meet, MeetSidePanelClient } from '@googleworkspace/meet-addons/meet.addons';
import {
meet,
MeetSidePanelClient,
} from '@googleworkspace/meet-addons/meet.addons';
import { CLOUD_PROJECT_NUMBER, MAIN_STAGE_URL } from '../../constants';

/**
Expand All @@ -11,11 +14,11 @@ export default function Page() {
const [sidePanelClient, setSidePanelClient] = useState<MeetSidePanelClient>();

// Launches the main stage when the main button is clicked.
async function startCollaboration(e: unknown) {
async function startActivity(e: unknown) {
if (!sidePanelClient) {
throw new Error("Side Panel is not yet initialized!");
throw new Error('Side Panel is not yet initialized!');
}
await sidePanelClient.startCollaboration({ mainStageUrl: MAIN_STAGE_URL });
await sidePanelClient.startActivity({ mainStageUrl: MAIN_STAGE_URL });
}

useEffect(() => {
Expand All @@ -34,7 +37,7 @@ export default function Page() {
return (
<>
<div>This is the Add-on Side Panel. Only you can see this.</div>
<button onClick={startCollaboration}>Launch Activity in Main Stage.</button>
<button onClick={startActivity}>Launch Activity in Main Stage.</button>
</>
)
);
}
4 changes: 2 additions & 2 deletions addons-web-sdk/samples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"build": "mkdir -p ../dist/hello-world && cp src/*.html ../dist/hello-world/ && npx webpack"
},
"dependencies": {
"@googleworkspace/meet-addons": "^0.9.1"
"@googleworkspace/meet-addons": "^1.0.0"
},
"devDependencies": {
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
}
}
}
17 changes: 10 additions & 7 deletions addons-web-sdk/samples/hello-world/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@
import { meet } from '@googleworkspace/meet-addons/meet.addons';

// TODO: Make sure that you modify these constants, if you fork this!
const CLOUD_PROJECT_NUMBER = "989911054302";
const MAIN_STAGE_URL = "https://googleworkspace.github.io/meet/hello-world/MainStage.html"
const CLOUD_PROJECT_NUMBER = '989911054302';
const MAIN_STAGE_URL =
'https://googleworkspace.github.io/meet/hello-world/MainStage.html';

/**
* Prepares the Add-on Side Panel Client, and adds an event to launch the main
* stage when the main button is clicked.
* Prepares the Add-on Side Panel Client, and adds an event to launch the
* activity in the main stage when the main button is clicked.
*/
export async function setUpAddon() {
const session = await meet.addon.createAddonSession({
cloudProjectNumber: CLOUD_PROJECT_NUMBER,
});
const sidePanelClient = await session.createSidePanelClient();
document.getElementById('start-activity').addEventListener('click', async () => {
await sidePanelClient.startCollaboration({ mainStageUrl: MAIN_STAGE_URL });
});
document
.getElementById('start-activity')
.addEventListener('click', async () => {
await sidePanelClient.startActivity({ mainStageUrl: MAIN_STAGE_URL });
});
}

/**
Expand Down
27 changes: 6 additions & 21 deletions addons-web-sdk/samples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3311b73

Please sign in to comment.