UNPKG

@arc-publishing/sdk-identity

Version:
55 lines 2.08 kB
import { __awaiter, __generator } from "tslib"; import { logPrefix } from './constants'; import Identity from './identity'; export function getThirdPartyTokens(service) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { if (service === 'DISQUS') { return [2, getDisqusData()]; } else { throw new Error("".concat(logPrefix, " Unsupported third party service requested.")); } return [2]; }); }); } function getDisqusData() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: if (!!Identity.userSettings) return [3, 2]; return [4, Identity.getUserSettings()]; case 1: _a.sent(); _a.label = 2; case 2: if (!!Identity.configOptions) return [3, 4]; return [4, Identity.getConfig()]; case 3: _a.sent(); _a.label = 4; case 4: if (Identity.configOptions && Identity.userSettings && Identity.configOptions.disqus && Identity.configOptions.disqus.enabled) { return [2, { enabled: true, publicKey: Identity.configOptions.disqus.publicKey, ssoToken: Identity.userSettings.disqus && Identity.userSettings.disqus.ssoKey }]; } else { return [2, { enabled: false }]; } return [2]; } }); }); } export default getThirdPartyTokens; //# sourceMappingURL=getThirdPartyTokens.js.map