diff --git a/ClickToCall/.eslintrc.json b/ClickToCall/.eslintrc.json
index dfc3da9..ed73777 100644
--- a/ClickToCall/.eslintrc.json
+++ b/ClickToCall/.eslintrc.json
@@ -24,7 +24,12 @@
"FirebaseKeyProvider": false,
"KeyProtect": false,
"USER_SECRET": false,
- "KMS_ARGON_WASM_URL": false
+ "KMS_ARGON_WASM_URL": false,
+ "GooglePeopleUserManager": false,
+ "AUTH_CONFIGURATION": false,
+ "AuthenticationManager": false,
+ "MockUserManager": false,
+ "AzureUserManager": false
},
"rules":
@@ -34,7 +39,7 @@
[
"error",
{
- "varsIgnorePattern": "makeCall|KMS_ARGON_WASM_URL|CONTACT_REG_ID|ID_PROVIDER_DOMAIN|USER_SECRET|ID_PROVIDER_ENVIRONMENT|createAuthManager|createUserManager|createKeyProvider|createKeyProtect"
+ "varsIgnorePattern": "AUTH_CONFIGURATION|makeCall|KMS_ARGON_WASM_URL|CONTACT_REG_ID|ID_PROVIDER_DOMAIN|USER_SECRET|ID_PROVIDER_ENVIRONMENT|createAuthManager|createUserManager"
}
]
}
diff --git a/ClickToCall/README.md b/ClickToCall/README.md
index f461da6..6de350c 100644
--- a/ClickToCall/README.md
+++ b/ClickToCall/README.md
@@ -1,15 +1,17 @@
-![BlackBerry Spark Communications Platform](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/resources/images/bnr-bbm-enterprise-sdk-title.png)
+![BlackBerry Spark Communications Services](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/resources/images/bnr-bbm-enterprise-sdk-title.png)
# Click To Call Sample for JavaScript
The Click to Call sample app demonstrates how to integrate a video call
-experience into your website with the Spark SDK for JavaScript. This app allows a user to click a button on a webpage to start a secure video call with a predefined user or agent. The bbmChat widget handles the rendering of messages within the chat, and allows the user to send text, picture, and file messages.
+experience into your website with the Spark Communications SDK. This app allows
+a user to click a button on a webpage to start a secure video call with a
+predefined user or agent. The bbmCall widget handles the rendering of the
+incoming and outgoing video streams.
### Features
This app demonstrates how easy it is to integrate the bbmCall widget into your
-webpage. It initializes the Spark SDK for JavaScript, and starts a
-video call with a predefined user.
+webpage. It initializes the SDK, and starts a video call with a predefined user.
@@ -19,9 +21,9 @@ video call with a predefined user.
## Getting Started
-This sample requires the Spark SDK, which you can find along with related resources at the location below.
+This sample requires the Spark Communications SDK for JavaScript, which you can find along with related resources at the location below.
-* Getting started with the [Spark SDK](https://developers.blackberry.com/us/en/products/blackberry-bbm-enterprise-sdk.html)
+* Getting started with the [Spark Communications SDK](https://developers.blackberry.com/us/en/products/blackberry-spark-communications-platform.html)
* [Development Guide](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/index.html)
* [API Reference](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/reference/javascript/index.html)
@@ -44,7 +46,7 @@ To use the ClickToCall example, you must set up the following elements in js/con
- Oauth2 configuration (AUTH_CONFIGURATION)
- A hard coded contact registration ID with whom anyone who views the page will talk (CONTACT_REG_ID)
-- Your Spark user domain (ID_PROVIDER_DOMAIN)
+- Your sandbox domain (ID_PROVIDER_DOMAIN)
- Firebase configuration (FIREBASE_CONFIG)
- User passcode (USER_SECRET)
@@ -53,7 +55,7 @@ To use the ClickToCall example, you must set up the following elements in js/con
Follow this guide for a walkthrough of how to integrate a video call into your webpage.
- [Import the bbmCall UI widget into your web application](#importCall)
-- [Initialize the Spark SDK for JavaScript](#init)
+- [Initialize the SDK](#init)
- [Perform setup](#setup)
- [Start a video call with a predefined user](#startCall)
@@ -65,7 +67,7 @@ Your web application needs to import the bbmCall widget in order to bring a vide
```
-### Initialize the Spark SDK for JavaScript
+### Initialize the SDK
```javascript
// Instantiate BBMEnterprise.
@@ -80,7 +82,7 @@ Your web application needs to import the bbmCall widget in order to bring a vide
});
```
-For more information about setting up the Spark SDK for JavaScript, visit the [Getting Started with Web](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/gettingStarted-web.html) section of the guide.
+For more information about setting up the SDK, visit the [Getting Started with Web](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/gettingStarted-web.html) section of the guide.
### Perform setup
```javascript
diff --git a/ClickToCall/callPopup.html b/ClickToCall/callPopup.html
index b77c492..eb04578 100644
--- a/ClickToCall/callPopup.html
+++ b/ClickToCall/callPopup.html
@@ -22,16 +22,37 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ClickToCall/js/callPopup.js b/ClickToCall/js/callPopup.js
index c5cf30b..09f9dc1 100644
--- a/ClickToCall/js/callPopup.js
+++ b/ClickToCall/js/callPopup.js
@@ -31,7 +31,21 @@
bbmCallWidget = document.createElement('bbm-call');
await window.customElements.whenDefined('bbm-call');
await BBMEnterprise.validateBrowser();
- const authManager = createAuthManager();
+ const authManager = new AuthenticationManager(AUTH_CONFIGURATION);
+ // Override getUserId() used by the MockAuthManager.
+ authManager.getUserId = () => new Promise((resolve, reject) => {
+ const userEmailDialog = document.createElement('bbm-user-email-dialog');
+ document.body.appendChild(userEmailDialog);
+ userEmailDialog.addEventListener('Ok', e => {
+ userEmailDialog.parentNode.removeChild(userEmailDialog);
+ resolve(e.detail.userEmail);
+ });
+ userEmailDialog.addEventListener('Cancel', () => {
+ userEmailDialog.parentNode.removeChild(userEmailDialog);
+ reject('Failed to get user email.');
+ });
+ });
+
const authUserInfo = await authManager.authenticate();
if (!authUserInfo) {
@@ -59,7 +73,6 @@
const userRegId = bbmeSdk.getRegistrationInfo().regId;
contactsManager = await createUserManager(userRegId,
authManager,
- bbmeSdk.getIdentitiesFromAppUserId,
bbmeSdk.getIdentitiesFromAppUserIds);
await contactsManager.initialize();
makeCall(CONTACT_REG_ID, true);
diff --git a/ClickToCall/js/config_azure.js b/ClickToCall/js/config_azure.js
new file mode 100644
index 0000000..876d81c
--- /dev/null
+++ b/ClickToCall/js/config_azure.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 BlackBerry. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Reg Id of the contact to start call with.
+const CONTACT_REG_ID = 'contact_reg_id';
+
+// This secret is used to protect user keys. Must be individual for each user.
+const USER_SECRET = 'user_secret';
+
+// Refer to the guide to set up your application to use Azure:
+// https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/azureForWebExamples.html
+
+// This domain is a string known to the BBM Enterprise server, which is
+// generally a GUID.
+// To create a new domain follow the link below
+// https://account.good.com/#/a/organization/applications/add
+const ID_PROVIDER_DOMAIN = 'your_idp_domain';
+
+// The client ID of application registered on OAuth 2.0 server.
+// To set up your application refer to
+// https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/azureIdentityManagement.html
+const CLIENT_ID = 'your_client_id';
+
+// The tenant ID of your organization.
+// To get your tenant ID refer to
+// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-howto-tenant
+const TENANT_ID = 'your_tenant_id';
+
+// =============================================================================
+// Configuration below does not require modifications. Change it only if you
+// want to change existing application behavior.
+
+// The environment of your BBM Enterprise server. Must be either 'Sandbox' or
+// 'Production'.
+const ID_PROVIDER_ENVIRONMENT = 'Sandbox';
+
+// The URL or relative path of the Argon2 WASM file.
+const KMS_ARGON_WASM_URL = '../../sdk/argon2.wasm';
+
+// This configuration contains service endpoints and information for OAuth2
+// authentication.
+const AUTH_CONFIGURATION = {
+ // OAuth 2.0 endpoint for requesting an access token.
+ authService: `https://login.microsoftonline.com/${TENANT_ID}/oauth2/v2.0/authorize`,
+
+ // The client ID of application registered on OAuth 2.0 server
+ clientId: CLIENT_ID,
+
+ // Scopes of OAuth 2.0 access token (which resources it can access)
+ scope: `api://${CLIENT_ID}/Messaging.All https://graph.microsoft.com/User.ReadWrite https://graph.microsoft.com/User.ReadBasic.All`
+};
+
+// Create the user manager for the Click To Call app.
+const createUserManager = (userRegId, authManager, getIdentities) =>
+ Promise.resolve(new AzureUserManager(userRegId, authManager, getIdentities));
diff --git a/ClickToCall/js/config.js b/ClickToCall/js/config_google.js
similarity index 52%
rename from ClickToCall/js/config.js
rename to ClickToCall/js/config_google.js
index 605b253..d7150f4 100644
--- a/ClickToCall/js/config.js
+++ b/ClickToCall/js/config_google.js
@@ -19,12 +19,24 @@
// Reg Id of the contact to start call with
const CONTACT_REG_ID = 'contact_reg_id';
-// This domain is a string known to the BBM Enterprise server, which is
+// This secret is used to protect user keys. Must be individual for each user.
+const USER_SECRET = 'user_secret';
+
+// Refer to the guide to set up your application to use Google:
+// https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/googleSignInForWebExamples.html
+
+// This domain is a string known to the BBM Enterprise server, which is
// generally a GUID.
+// To create a new domain follow the link below
+// https://account.good.com/#/a/organization/applications/add
const ID_PROVIDER_DOMAIN = 'your_idp_domain';
-// This secret is used to protect user keys. Must be individual for each user.
-const USER_SECRET = 'user_secret';
+// The client ID of application registered on OAuth 2.0 server.
+const CLIENT_ID = 'your_client_id';
+
+// =============================================================================
+// Configuration below does not require modifications. Change it only if you
+// want to change existing application behavior.
// The environment of your BBM Enterprise server. Must be either 'Sandbox' or
// 'Production'.
@@ -37,43 +49,16 @@ const KMS_ARGON_WASM_URL = '../../sdk/argon2.wasm';
// authentication.
const AUTH_CONFIGURATION = {
// OAuth 2.0 endpoint for requesting an access token
- // To use google OAuth service, put:
- // 'https://accounts.google.com/o/oauth2/v2/auth'
- authService : 'your_auth_service_endpoint',
-
- // OAuth 2.0 endpoint for token validation
- // To use google toke info service, put:
- // 'https://www.googleapis.com/oauth2/v3/tokeninfo'
- tokenInfoService : 'your_oauth_token_info_endpoint',
-
- // OAuth 2.0 endpoint for obtaining user information (name, email, avatar URL)
- // To use google user info service, put:
- // 'https://www.googleapis.com/plus/v1/people/me'
- userInfoService : 'your_oauth_user_info_endpoint',
-
+ authService : 'https://accounts.google.com/o/oauth2/v2/auth',
+
// Scopes of OAuth 2.0 access token (which resources it can access)
- // If google OAuth service is used, put following scopes:
- // 'https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/userinfo.email'
- scope : 'your_scope_oauth',
-
- // The client ID of application registered on OAuth 2.0 server
- clientId: 'your_client_id'
-};
+ scope : 'https://www.googleapis.com/auth/contacts',
-// Firebase config info
-const FIREBASE_CONFIG = {
- apiKey: 'your_api_key',
- authDomain: 'your_auth_domain',
- databaseURL: 'your_database_url',
- projectId: 'your_project_id',
- storageBucket: 'your_storage_bucket',
- messagingSenderId: 'your_messaging_sender_id'
+ // The client ID of application registered on OAuth 2.0 server.
+ clientId: CLIENT_ID
};
-// Create the auth manager for the Click To Call app.
-const createAuthManager = () => new GoogleAuthManager(AUTH_CONFIGURATION);
-
// Create the user manager for the Click To Call app.
-const createUserManager = (userRegId, authManager, getIdentity, getIdentities) =>
- FirebaseUserManager.factory.createInstance(FIREBASE_CONFIG,
- userRegId, authManager, GenericUserInfo, getIdentity, getIdentities);
\ No newline at end of file
+const createUserManager = (userRegId, authManager, getIdentities) =>
+ Promise.resolve(new GooglePeopleUserManager(userRegId, authManager,
+ getIdentities, AUTH_CONFIGURATION));
\ No newline at end of file
diff --git a/ClickToCall/js/config_mock.js b/ClickToCall/js/config_mock.js
new file mode 100644
index 0000000..5100aeb
--- /dev/null
+++ b/ClickToCall/js/config_mock.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 BlackBerry. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Reg Id of the contact to start call with
+const CONTACT_REG_ID = 'contact_reg_id';
+
+// This domain is a string known to the BBM Enterprise server, which is
+// generally a GUID.
+// To create a new domain follow the link below
+// https://account.good.com/#/a/organization/applications/add
+const ID_PROVIDER_DOMAIN = 'your_idp_domain';
+
+// This secret is used to protect user keys. Must be individual for each user.
+const USER_SECRET = 'user_secret';
+
+// =============================================================================
+// Configuration below does not require modifications. Change it only if you
+// want to change existing application behavior.
+
+const AUTH_CONFIGURATION = { };
+
+// The environment of your BBM Enterprise server. Must be either 'Sandbox' or
+// 'Production'.
+const ID_PROVIDER_ENVIRONMENT = 'Sandbox';
+
+// The URL or relative path of the Argon2 WASM file.
+const KMS_ARGON_WASM_URL = '../../sdk/argon2.wasm';
+
+// Create the user manager for the Click To Call app.
+const createUserManager = (userRegId, authManager, getIdentities) =>
+ Promise.resolve(new MockUserManager(userRegId, authManager, getIdentities,
+ ID_PROVIDER_DOMAIN));
\ No newline at end of file
diff --git a/ClickToCall/js/index.js b/ClickToCall/js/index.js
index 428e4ba..5e8f944 100644
--- a/ClickToCall/js/index.js
+++ b/ClickToCall/js/index.js
@@ -21,8 +21,8 @@
* of how to implement generic Click To Call functionality using bbm-call UI
* widget.
*
- * When user clicks "Start Secure Call" button, application will start BBME
- * call with the hard coded user RegId (CONTACT_REG_ID).
+ * When the user clicks the "Start Secure Call" button, the application will
+ * start a call with the hard coded user RegId (CONTACT_REG_ID).
*
* @class ClickToCall
* @memberof Examples
@@ -37,4 +37,4 @@ function makeCall() {
alert('Failed to create popup window. Please check that your browser' +
' allows popups on this page.');
}
-}
\ No newline at end of file
+}
diff --git a/ClickToCall/package.json b/ClickToCall/package.json
index ff7da97..58452c7 100644
--- a/ClickToCall/package.json
+++ b/ClickToCall/package.json
@@ -4,6 +4,7 @@
"version": "1.0.0",
"main": "index.html",
"dependencies": {
- "bbmCall": "file:../support/ui/widgets/bbmCall"
+ "bbmCall": "file:../support/ui/widgets/bbmCall",
+ "bbmUserEmailDialog": "file:../support/ui/widgets/bbmUserEmailDialog"
}
}
diff --git a/ClickToChat/.eslintrc.json b/ClickToChat/.eslintrc.json
index c6bb419..9d91ff1 100644
--- a/ClickToChat/.eslintrc.json
+++ b/ClickToChat/.eslintrc.json
@@ -26,7 +26,12 @@
"TimeRangeFormatter": false,
"MessageFormatter": false,
"USER_SECRET": false,
- "KMS_ARGON_WASM_URL": false
+ "KMS_ARGON_WASM_URL": false,
+ "GooglePeopleUserManager": false,
+ "AUTH_CONFIGURATION": false,
+ "AuthenticationManager": false,
+ "MockUserManager": false,
+ "AzureUserManager": false
},
"rules":
@@ -36,7 +41,7 @@
[
"error",
{
- "varsIgnorePattern": "startChat|KMS_ARGON_WASM_URL|CONTACT_REG_ID|ID_PROVIDER_DOMAIN|USER_SECRET|ID_PROVIDER_ENVIRONMENT|createAuthManager|createUserManager|createKeyProvider|createKeyProtect"
+ "varsIgnorePattern": "AUTH_CONFIGURATION|startChat|KMS_ARGON_WASM_URL|CONTACT_REG_ID|ID_PROVIDER_DOMAIN|USER_SECRET|ID_PROVIDER_ENVIRONMENT|createAuthManager|createUserManager"
}
]
}
diff --git a/ClickToChat/README.md b/ClickToChat/README.md
index 88f9f1b..9be6d04 100644
--- a/ClickToChat/README.md
+++ b/ClickToChat/README.md
@@ -1,9 +1,12 @@
-![BlackBerry Spark Communications Platform](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/resources/images/bnr-bbm-enterprise-sdk-title.png)
+![BlackBerry Spark Communications Services](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/resources/images/bnr-bbm-enterprise-sdk-title.png)
# Click To Chat Sample for JavaScript
-The Click to Chat sample app demonstrates how to integrate a chat
-experience into your website with the Spark SDK for JavaScript. This app allows a user to click a button on a webpage to start a secure chat with a predefined user or agent. The bbmChat widget handles the rendering of messages within the chat, and allows the user to send text, picture, and file messages.
+The Click to Chat sample app demonstrates how to integrate a chat experience
+into your website with the Spark Communications SDK. This app allows a user to
+click a button on a webpage to start a secure chat with a predefined user or
+agent. The bbmChat widget handles the rendering of messages within the chat,
+and allows the user to send text, picture, and file messages.
@@ -17,7 +20,9 @@ experience into your website with the Spark SDK for JavaScript. This app allows
### Features
-This app demonstrates how easy it is to integrate the bbmChat widget into your webpage. It initializes the Spark SDK for JavaScript, and starts a chat with a predefined user. The app then launches the bbmChat widget which allows the user to:
+This app demonstrates how easy it is to integrate the bbmChat widget into your
+webpage. It initializes the SDK, and starts a chat with a predefined user. The
+app then launches the bbmChat widget which allows the user to:
* View all sent and received messages in a chat
* Send a text message, picture, or file attachment
* Send high priority messages
@@ -37,9 +42,9 @@ This app demonstrates how easy it is to integrate the bbmChat widget into your w
## Getting Started
-This sample requires the Spark SDK, which you can find along with related resources at the location below.
+This sample requires the Spark Communications SDK for JavaScript, which you can find along with related resources at the location below.
-* Getting started with the [Spark SDK](https://developers.blackberry.com/us/en/products/blackberry-bbm-enterprise-sdk.html)
+* Getting started with the [Spark Communications SDK](https://developers.blackberry.com/us/en/products/blackberry-spark-communications-platform.html)
* [Development Guide](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/index.html)
* [API Reference](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/reference/javascript/index.html)
@@ -62,7 +67,7 @@ To use the ClickToChat example, you must set up the following elements in js/con
- Oauth2 configuration (AUTH_CONFIGURATION)
- A hardcoded contact registration ID with whom anyone who views the page will chat (CONTACT_REG_ID)
-- Your Spark user domain (ID_PROVIDER_DOMAIN)
+- Your sandbox domain (ID_PROVIDER_DOMAIN)
- Firebase configuration (FIREBASE_CONFIG)
- User passcode (USER_SECRET)
@@ -71,7 +76,7 @@ To use the ClickToChat example, you must set up the following elements in js/con
Follow this guide for a walkthrough of how to integrate a rich chat experience into your webpage.
- [Import the bbmChat UI widget into your web application](#importChat)
-- [Initialize the Spark SDK for JavaScript](#init)
+- [Initialize the SDK](#init)
- [Perform setup](#setup)
- [Start a chat with a predefined user](#startChat)
@@ -102,7 +107,7 @@ Create new instance of BBMEnterprise.
});
```
-For more information about setting up the Spark SDK for JavaScript, visit the [Getting Started with Web](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/gettingStarted-web.html) section of the guide.
+For more information about setting up the SDK, visit the [Getting Started with Web](https://developer.blackberry.com/files/bbm-enterprise/documents/guide/html/gettingStarted-web.html) section of the guide.
### Perform setup
diff --git a/ClickToChat/index.html b/ClickToChat/index.html
index dc73b7d..cc9bdc4 100644
--- a/ClickToChat/index.html
+++ b/ClickToChat/index.html
@@ -22,19 +22,38 @@