Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update common call/contact and manager portal examples to support OpenFin anywhere. #721

Merged
merged 35 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5d3a5ed
Add additional action for a workspace lifecycle event.
johnman Apr 10, 2024
2b0b4f1
Improving FDC3 docs to make it easier to learn about fdc3 (#704)
johnman Apr 11, 2024
1a52503
Merge branch 'main' into workspace/vnext
johnman Apr 12, 2024
194d60c
Update versioning in docs
johnman Apr 12, 2024
11f4a28
Window state improvements and dependency pinning.
johnman Apr 12, 2024
fc8bbdb
Update the launch script for workspace v18
johnman Apr 12, 2024
bbbb95e
Include window state on page save
johnman Apr 12, 2024
bbc2630
Remove rspack
johnman Apr 12, 2024
94a2ffe
Gave greater control over what is built.
johnman Apr 12, 2024
6592b97
Added Cloud Interop support with documentation.
johnman Apr 12, 2024
a92d043
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 12, 2024
bf7ffcf
Added option of creating analytics for your modules (except analytics…
johnman Apr 16, 2024
fd4c413
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 16, 2024
c9e78ce
Bump versions for v18 Beta Release
johnman Apr 18, 2024
d00722d
Improved how appIds associated with views/windows are validated (#708)
johnman Apr 19, 2024
d8d00ec
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 19, 2024
ec1bc66
Updated Snap to 0.3.0 (#710)
johnman Apr 23, 2024
c998fc8
Merge branch 'main' into workspace/vnext
johnman Apr 23, 2024
7cc29db
Update snap version to 0.3.0
johnman Apr 23, 2024
aeea0f3
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 23, 2024
8f8aa83
Bumping runtime version to take in patched runtime.
johnman Apr 24, 2024
6f155e8
Added a classic app example and the ability to easily test snap with …
johnman Apr 25, 2024
ea4a5ea
Added restrictive model for launch external process and updated docs …
johnman Apr 26, 2024
bfa42cf
Merge branch 'main' into workspace/vnext
johnman Apr 26, 2024
cf75f82
Update version paths in snap example
johnman Apr 26, 2024
ecca673
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 26, 2024
ca95520
Update workspace to 18.0.9
johnman Apr 27, 2024
0bd7992
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 27, 2024
440480f
Update cloud interop to 0.36.11
johnman Apr 30, 2024
20e1478
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman Apr 30, 2024
44ddca2
Remove native ui automation until a review is performed.
johnman Apr 30, 2024
4c391f9
Update cloud interop version
johnman May 7, 2024
2dabbae
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman May 7, 2024
9faf9d1
Merge remote-tracking branch 'origin/workspace/v18.0.0' into workspac…
johnman May 8, 2024
81b2a0a
Updated the common call and manager portal apps so they support runni…
johnman May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Call Application</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js"></script>
</head>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,38 @@ function initializeDOM() {
await appChannel.broadcast(context);
}

if (window.fdc3 !== undefined) {
/**
* Sets up the related fdc3 listeners once fdc3 is available.
*/
function setupListeners() {
const startCallIntent = 'StartCall';
const openAppIntent = 'OpenApp';
fdc3.addIntentListener(startCallIntent, (ctx, metadata) => {
console.log(`Received Context For Intent: ${startCallIntent}`, ctx, metadata);
updateCallInformation(ctx, startCallIntent);
return new Promise((resolve) => {
// To demonstrate getResult in fdc3 2.0 we simply return the context that was sent.
resolve(ctx);
try {
fdc3.addContextListener('fdc3.contact', (ctx, metadata) => {
console.log('Received Context', ctx, metadata);
updateCallInformation(ctx);
});
});
fdc3.addIntentListener(openAppIntent, (ctx, metadata) => {
console.log(`Received Context For Intent: ${openAppIntent}`, ctx, metadata);
updateCallInformation(ctx, openAppIntent);
});
fdc3.addContextListener('fdc3.contact', (ctx, metadata) => {
console.log('Received Context', ctx, metadata);
updateCallInformation(ctx);
fdc3.addIntentListener(startCallIntent, (ctx, metadata) => {
console.log(`Received Context For Intent: ${startCallIntent}`, ctx, metadata);
updateCallInformation(ctx, startCallIntent);
return new Promise((resolve) => {
// To demonstrate getResult in fdc3 2.0 we simply return the context that was sent.
resolve(ctx);
});
});
fdc3.addIntentListener(openAppIntent, (ctx, metadata) => {
console.log(`Received Context For Intent: ${openAppIntent}`, ctx, metadata);
updateCallInformation(ctx, openAppIntent);
});
} catch (error) {
console.error('Error setting up all of the fdc3 listeners', error);
}
}
if (window.fdc3 !== undefined) {
setupListeners();
} else {
window.addEventListener('fdc3Ready', async () => {
setupListeners();
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,17 @@ export function userToFdc3Context(user) {
* @returns The custom settings from the manifest.
*/
async function getManifestCustomSettings() {
// Get the manifest for the current application
const app = await fin.Application.getCurrent();
try {
if (window.fin) {
// Get the manifest for the current application
const app = await fin.Application.getCurrent();

// Extract the custom settings for this application
const manifest = await app.getManifest();
return manifest.customSettings ?? {};
// Extract the custom settings for this application
const manifest = await app.getManifest();
return manifest.customSettings ?? {};
}
} catch {
// not inside of an OpenFin container or there isn't app support.
}
return {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Investments &amp; Models</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js"></script>
</head>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@
* Initialize the DOM.
*/
function initializeDOM() {
if (window.fdc3) {
if (window.fdc3 !== undefined) {
setupListeners();
} else {
window.addEventListener('fdc3Ready', async () => {
setupListeners();
});
}
}

/**
* Sets up the related fdc3 listeners once fdc3 is available.
*/
function setupListeners() {
try {
window.fdc3.addContextListener(contextHandler);
window.fdc3.addIntentListener('ViewContact', contextHandler);
} catch (error) {
console.error('There was an error while setting up all of the fdc3 listeners', error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Participant History</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js"></script>
</head>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@
* Initialize the DOM.
*/
function initializeDOM() {
if (window.fdc3) {
if (window.fdc3 !== undefined) {
setupListeners();
} else {
window.addEventListener('fdc3Ready', async () => {
setupListeners();
});
}
}

/**
* Sets up the related fdc3 listeners once fdc3 is available.
*/
function setupListeners() {
try {
window.fdc3.addContextListener(contextHandler);
window.fdc3.addIntentListener('ViewContact', contextHandler);
} catch (error) {
console.error('There was an error while setting up all of the fdc3 listeners', error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Participant Selection</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js" type="module"></script>
<style>
.profile-pic {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,83 +6,92 @@ window.addEventListener('DOMContentLoaded', initializeDOM);
* Initialize the DOM.
*/
async function initializeDOM() {
if (window.fdc3) {
await usersModule.initialize();

let hasViewContactIntentHandler = false;
try {
const info = await fin.me.interop.getInfoForIntent({
name: 'ViewContact'
});
if (info) {
hasViewContactIntentHandler = true;
}
} catch {}

if (!hasViewContactIntentHandler) {
console.warn('No ViewContact intent handler is available, will not show Raise Intent button');
if (window.fdc3 !== undefined) {
setupListeners();
} else {
window.addEventListener('fdc3Ready', async () => {
setupListeners();
});
}
}

/**
* Sets up the related fdc3 listeners once fdc3 is available.
*/
async function setupListeners() {
await usersModule.initialize();

let hasViewContactIntentHandler = false;
try {
const info = await fdc3.findIntent('ViewContact');
if (info) {
hasViewContactIntentHandler = true;
}
} catch {}

const users = usersModule.getUsers();
if (!hasViewContactIntentHandler) {
console.warn('No ViewContact intent handler is available, will not show Raise Intent button');
}

const tbody = document.querySelector('tbody');
const users = usersModule.getUsers();

for (const user of users) {
const image = document.createElement('img');
image.src = usersModule.getProfilePic(user);
image.width = 28;
image.height = 28;
image.classList.add('profile-pic');
image.style.borderRadius = '5px';
const tbody = document.querySelector('tbody');

const imageCell = document.createElement('td');
imageCell.append(image);
for (const user of users) {
const image = document.createElement('img');
image.src = usersModule.getProfilePic(user);
image.width = 28;
image.height = 28;
image.classList.add('profile-pic');
image.style.borderRadius = '5px';

const dateCell = document.createElement('td');
dateCell.textContent = user.interactionDate;
const imageCell = document.createElement('td');
imageCell.append(image);

const nameCell = document.createElement('td');
nameCell.textContent = user.name;
const dateCell = document.createElement('td');
dateCell.textContent = user.interactionDate;

const emailCell = document.createElement('td');
emailCell.textContent = user.email;
const nameCell = document.createElement('td');
nameCell.textContent = user.name;

const typeCell = document.createElement('td');
typeCell.textContent = user.interactionType;
const emailCell = document.createElement('td');
emailCell.textContent = user.email;

const actionRow = document.createElement('div');
actionRow.classList.add('row');
actionRow.classList.add('gap10');
const typeCell = document.createElement('td');
typeCell.textContent = user.interactionType;

const actionCell = document.createElement('td');
actionCell.append(actionRow);
const actionRow = document.createElement('div');
actionRow.classList.add('row');
actionRow.classList.add('gap10');

const row = document.createElement('tr');
row.append(imageCell);
row.append(dateCell);
row.append(nameCell);
row.append(emailCell);
row.append(typeCell);
row.append(actionCell);
const actionCell = document.createElement('td');
actionCell.append(actionRow);

const selectButton = document.createElement('button');
selectButton.textContent = 'Select';
selectButton.classList.add('small');
selectButton.addEventListener('click', () => selectParticipant(user));
const row = document.createElement('tr');
row.append(imageCell);
row.append(dateCell);
row.append(nameCell);
row.append(emailCell);
row.append(typeCell);
row.append(actionCell);

actionRow.append(selectButton);
const selectButton = document.createElement('button');
selectButton.textContent = 'Select';
selectButton.classList.add('small');
selectButton.addEventListener('click', () => selectParticipant(user));

if (hasViewContactIntentHandler) {
const raiseIntentButton = document.createElement('button');
raiseIntentButton.textContent = 'Raise Intent';
raiseIntentButton.classList.add('small');
raiseIntentButton.classList.add('secondary');
raiseIntentButton.addEventListener('click', () => raiseIntent(user));
actionRow.append(raiseIntentButton);
}
actionRow.append(selectButton);

tbody.append(row);
if (hasViewContactIntentHandler) {
const raiseIntentButton = document.createElement('button');
raiseIntentButton.textContent = 'Raise Intent';
raiseIntentButton.classList.add('small');
raiseIntentButton.classList.add('secondary');
raiseIntentButton.addEventListener('click', () => raiseIntent(user));
actionRow.append(raiseIntentButton);
}

tbody.append(row);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Participant Summary</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js" type="module"></script>
<script type="module" src="../../../lib/wc-fin/wc-fin.esm.js"></script>
<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,30 @@ window.addEventListener('DOMContentLoaded', initializeDOM);
*/
async function initializeDOM() {
const contextPicker = document.querySelector('#context-group-picker');
contextPicker.style.display = fin.me.isWindow ? 'block' : 'none';
if (window.fin) {
contextPicker.style.display = fin.me.isWindow ? 'block' : 'none';
}

if (window.fdc3 !== undefined) {
setupListeners();
} else {
window.addEventListener('fdc3Ready', async () => {
setupListeners();
});
}
}

if (window.fdc3) {
/**
* Sets up the related fdc3 listeners once fdc3 is available.
*/
async function setupListeners() {
try {
await usersModule.initialize();

window.fdc3.addContextListener(contextHandler);

window.fdc3.addIntentListener('ViewContact', contextHandler);
} catch (error) {
console.error('There was an error while setting up all of the fdc3 listeners', error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>Call Application</title>
<link rel="icon" type="image/x-icon" href="../../../../favicon.ico" />
<link rel="stylesheet" href="../../../style/app.css" />
<script src="https://built-on-openfin.github.io/web-starter/web/v18.0.0/web-client-api/js/shim.api.bundle.js"></script>
<script defer="defer" src="./index.js"></script>
</head>

Expand Down
Loading
Loading