@outreach/extensibility-sdk
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -69,2 +69,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
var EnvironmentMessage_1 = require("./sdk/messages/EnvironmentMessage"); | ||
var Application_1 = require("./manifest/Application"); | ||
var ManifestApi_1 = require("./manifest/ManifestApi"); | ||
var ConfigurationItem_1 = require("./configuration/ConfigurationItem"); | ||
var ManifestStore_1 = require("./manifest/ManifestStore"); | ||
var TabExtensionType_1 = require("./manifest/extensions/tabs/TabExtensionType"); | ||
var AccountTabExtension_1 = require("./manifest/extensions/tabs/types/AccountTabExtension"); | ||
var OpportunityTabExtension_1 = require("./manifest/extensions/tabs/types/OpportunityTabExtension"); | ||
var ProspectTabExtension_1 = require("./manifest/extensions/tabs/types/ProspectTabExtension"); | ||
var ShellExtensionType_1 = require("./manifest/extensions/shell/ShellExtensionType"); | ||
var ApplicationShellExtension_1 = require("./manifest/extensions/shell/types/ApplicationShellExtension"); | ||
__exportStar(require("./context/host/AccountContext"), exports); | ||
@@ -554,3 +564,3 @@ __exportStar(require("./context/host/ContextParam"), exports); | ||
this.preprocessInitMessage = function (initMessage) { | ||
RuntimeContext_1.default.application = initMessage.application; | ||
RuntimeContext_1.default.application = _this.hydrateApplication(initMessage.application); | ||
RuntimeContext_1.default.configuration = initMessage.configuration; | ||
@@ -608,2 +618,29 @@ RuntimeContext_1.default.extension = initMessage.extension; | ||
}; | ||
this.hydrateApplication = function (app) { | ||
var application = new Application_1.Application(); | ||
if (app.api) { | ||
application.api = Object.assign(new ManifestApi_1.ManifestApi(), app.api); | ||
} | ||
if (app.configuration) { | ||
application.configuration = app.configuration.map(function (item) { | ||
return Object.assign(new ConfigurationItem_1.ConfigurationItem(), item); | ||
}); | ||
} | ||
application.store = Object.assign(new ManifestStore_1.ManifestStore(), app.store); | ||
application.extensions = app.extensions.map(function (ext) { | ||
switch (ext.type) { | ||
case TabExtensionType_1.TabExtensionType.ACCOUNT: | ||
return Object.assign(new AccountTabExtension_1.AccountTabExtension(), ext); | ||
case TabExtensionType_1.TabExtensionType.OPPORTUNITY: | ||
return Object.assign(new OpportunityTabExtension_1.OpportunityTabExtension(), ext); | ||
case TabExtensionType_1.TabExtensionType.PROSPECT: | ||
return Object.assign(new ProspectTabExtension_1.ProspectTabExtension(), ext); | ||
case ShellExtensionType_1.ShellExtensionType.APPLICATION: | ||
return Object.assign(new ApplicationShellExtension_1.ApplicationShellExtension(), ext); | ||
default: | ||
throw new Error("Can't hydrate extension " + JSON.stringify(ext)); | ||
} | ||
}); | ||
return application; | ||
}; | ||
this.handleRefreshTokenMessage = function (tokenMessage) { | ||
@@ -610,0 +647,0 @@ tokenService_1.default.cacheToken({ |
{ | ||
"name": "@outreach/extensibility-sdk", | ||
"license": "MIT", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
627705
11093