Commit 010c44fd authored by Robert Knight's avatar Robert Knight

Add `contentPartner` configuration option

Add an option that enables the embedder to configure a content
provider/partner banner to be shown in the client, indicating who is
providing the content.
parent d0039747
...@@ -29,7 +29,7 @@ import { urlFromLinkTag } from './url-from-link-tag'; ...@@ -29,7 +29,7 @@ import { urlFromLinkTag } from './url-from-link-tag';
*/ */
function configurationKeys(appContext) { function configurationKeys(appContext) {
const contexts = { const contexts = {
annotator: ['clientUrl', 'subFrameIdentifier'], annotator: ['clientUrl', 'contentPartner', 'subFrameIdentifier'],
sidebar: [ sidebar: [
'appType', 'appType',
'annotations', 'annotations',
...@@ -106,6 +106,11 @@ const configDefinitions = { ...@@ -106,6 +106,11 @@ const configDefinitions = {
defaultValue: null, defaultValue: null,
getValue: settings => settings.clientUrl, getValue: settings => settings.clientUrl,
}, },
contentPartner: {
allowInBrowserExt: false,
defaultValue: null,
getValue: getHostPageSetting,
},
enableExperimentalNewNoteButton: { enableExperimentalNewNoteButton: {
allowInBrowserExt: false, allowInBrowserExt: false,
defaultValue: null, defaultValue: null,
......
...@@ -180,7 +180,9 @@ export class Guest { ...@@ -180,7 +180,9 @@ export class Guest {
* Integration that handles document-type specific functionality in the * Integration that handles document-type specific functionality in the
* guest. * guest.
*/ */
this._integration = createIntegration(this); this._integration = createIntegration(this, {
contentPartner: config.contentPartner,
});
/** /**
* Channel for host-guest communication. * Channel for host-guest communication.
......
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
/** /**
* @typedef {import('../../types/annotator').Annotator} Annotator * @typedef {import('../../types/annotator').Annotator} Annotator
* @typedef {import('../../types/annotator').ContentPartner} ContentPartner
* @typedef {import('../../types/annotator').Integration} Integration * @typedef {import('../../types/annotator').Integration} Integration
*/ */
...@@ -15,11 +16,14 @@ import { ...@@ -15,11 +16,14 @@ import {
* guest functionality. * guest functionality.
* *
* @param {Annotator} annotator * @param {Annotator} annotator
* @param {object} options
* @param {ContentPartner} [options.contentPartner] - Content partner banner to show,
* if supported by the integration.
* @return {Integration} * @return {Integration}
*/ */
export function createIntegration(annotator) { export function createIntegration(annotator, { contentPartner } = {}) {
if (isPDF()) { if (isPDF()) {
return new PDFIntegration(annotator); return new PDFIntegration(annotator, { contentPartner });
} }
const vsFrameRole = vitalSourceFrameRole(); const vsFrameRole = vitalSourceFrameRole();
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
*/ */
/** /**
* Name of a content partner to show branding for. * Specifies a content partner/provider to show branding for.
* *
* @typedef {'jstor'} ContentPartner * @typedef {'jstor'} ContentPartner
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment