diff --git a/package.json b/package.json index c03c83a..49bc18e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudux-starter-kit", - "version": "2.1.13", + "version": "2.2.2", "description": "Starter kit for UI developers in CloudUX", "main": "build/index.js", "scripts": { @@ -21,14 +21,12 @@ "license": "SEE LICENSE IN EULA.md", "dependencies": { "base64-img": "1.0.4", - "cloudux-starter-kit": "2.1.13", - "mediacentral-publish": "^0.3.2", - "mediacentral-sign": "^0.1.1" + "cloudux-starter-kit": "2.2.2" }, "devDependencies": { "autoprefixer": "9.6.1", "babel-core": "6.26.3", - "babel-eslint": "8.2.6", + "babel-eslint": "9.x", "babel-loader": "7.1.5", "babel-plugin-transform-class-properties": "6.24.1", "babel-plugin-transform-decorators": "6.24.1", @@ -45,8 +43,9 @@ "eslint-plugin-flowtype": "2.50.3", "eslint-plugin-import": "2.14.0", "eslint-plugin-jsx-a11y": "6.2.3", + "file-loader": "6.2.0", "html-loader": "0.5.5", - "http-proxy-middleware": "0.18.0", + "http-proxy-middleware": "^2.0.6", "mini-css-extract-plugin": "0.4.4", "node-fetch": "^2.6.1", "postcss-loader": "3.0.0", diff --git a/src/app/index.js b/src/app/index.js index a27a067..c616032 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -1,16 +1,15 @@ /** - * Copyright 2017 by Avid Technology, Inc. + * Copyright 2022 by Avid Technology, Inc. */ import { getLocalization } from './localization'; import l10nData from '../l10n/lang.en.json'; export default class ApplicationContainer { - constructor() { - this.div = document.createElement('div'); - this.div.innerHTML = getLocalization(l10nData)('example-plugin-message'); + getTitle() { + return 'Your first AVID app title'; } - returnElement() { - return this.div; + render(element) { + element.innerHTML = getLocalization(l10nData)('example-plugin-message'); } } diff --git a/src/avid_api/entry/EntryWrapper.js b/src/avid_api/entry/EntryWrapper.js index fedd6c2..341b04e 100644 --- a/src/avid_api/entry/EntryWrapper.js +++ b/src/avid_api/entry/EntryWrapper.js @@ -1,5 +1,5 @@ /** - * Copyright 2017 by Avid Technology, Inc. + * Copyright 2022 by Avid Technology, Inc. */ import appConfig from '../../package.json'; @@ -36,10 +36,6 @@ export default class EntryApp { console.log('[ExamplePlugin] onHide'); } - onUnrender() { - console.log('[ExamplePlugin] onUnrender'); - } - onBeforeUnrender() { console.log('[ExamplePlugin] onBeforeUnrender'); } @@ -51,6 +47,10 @@ export default class EntryApp { setContext(context) { console.log('[ExamplePlugin] context', context); } + + getTitle() { + return this.innerView.getTitle(); + } get publicScope() { return {}; diff --git a/src/avid_api/view/ViewWrapper.js b/src/avid_api/view/ViewWrapper.js index a41c9cf..cedefa3 100644 --- a/src/avid_api/view/ViewWrapper.js +++ b/src/avid_api/view/ViewWrapper.js @@ -1,5 +1,5 @@ /** - * Copyright 2017 by Avid Technology, Inc. + * Copyright 2022 by Avid Technology, Inc. */ /* eslint-disable */ @@ -7,21 +7,15 @@ import ApplicationContainer from '../../app/index'; // Need to be bcs it is used in main App : export default class ViewWrapper { - createElement() { - this.el = document.createElement('div'); - return Promise.resolve(this.el); - } - - onInit() { - this.pane = new ApplicationContainer({ - contextCallback: function (context) { - this.trigger('contextChange', context); - }.bind(this), - }); + onInit(config, { dispatch }) { + this.trigger = dispatch; + this.state = config.state; } - - onRender() { - this.el.appendChild(this.pane.returnElement()); + onRender({ domElement }) { + this.el = document.createElement('div'); + this.pane = new ApplicationContainer(); + this.pane.render(this.el); + domElement.appendChild(this.el); } onDestroy(data) {} @@ -60,7 +54,13 @@ export default class ViewWrapper { return 50; } + getTitle() { + return this.pane && this.pane.getTitle(); + } + get publicScope() { - return {}; + return { + getTitle: this.getTitle.bind(this), + }; } } diff --git a/src/index.js b/src/index.js index ea7f6ec..053a2a3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ /** - * Copyright 2017 by Avid Technology, Inc. + * Copyright 2022 by Avid Technology, Inc. */ import appConfig from './package.json'; @@ -9,14 +9,17 @@ import AppEntry from './avid_api/entry/EntryConfig'; import Action from './app/action'; import Binding from './app/binding'; +const isAdminApp = appConfig.avid.hasOwnProperty('mode') && appConfig.avid.mode[0] === 'admin'; +const providing = isAdminApp ? 'adminApps' : 'apps'; + export const avid = [ { name: `${appConfig.identity.appName}-view`, - provides: ['views'], + provides: ['appViews'], create: () => ViewConfig, }, { - name: `${appConfig.identity.appName}-view`, + name: `${appConfig.identity.appName}-default-theme`, provides: ['theme'], create: () => ({ key: 'dark', @@ -25,7 +28,7 @@ export const avid = [ }, { name: appConfig.identity.appName, - provides: ['apps'], + provides: [providing], create: () => AppEntry, }, { diff --git a/src/package.json b/src/package.json index f5ca786..8b8941c 100644 --- a/src/package.json +++ b/src/package.json @@ -5,7 +5,7 @@ "main": "index.js", "avid": { "format": "amd", - "autoload": true, + "autoload": false, "alias": "your-avid-app-id", "secret": "your-app-secred-from-myavid-com", "features": {