UNPKG

@arc-publishing/sdk-amp

Version:
61 lines 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var utils_1 = require("./utils"); var constants_1 = require("./constants"); var getAMPReaderIDs_1 = tslib_1.__importDefault(require("./getAMPReaderIDs")); var saveAMPReaderID_1 = tslib_1.__importDefault(require("./saveAMPReaderID")); var checkAMPReaderID_1 = tslib_1.__importDefault(require("./checkAMPReaderID")); var logoutAMPReaderID_1 = tslib_1.__importDefault(require("./logoutAMPReaderID")); var authenticateAMPReaderID_1 = tslib_1.__importDefault(require("./authenticateAMPReaderID")); var options_1 = tslib_1.__importDefault(require("./options")); var constants_2 = require("./constants"); var Amp = (function () { function Amp() { } Object.defineProperty(Amp, "ampReaderId", { get: function () { try { if (!this._ampReaderId && this._selectedStorage) { var existingReaderId = JSON.parse(this._selectedStorage.getItem(constants_1.AMP_ID_STORAGE_KEY) || null); this._ampReaderId = existingReaderId ? existingReaderId : ''; } } catch (e) { console.error("".concat(constants_2.logPrefix, ": ").concat(e)); this._ampReaderId = ''; } return this._ampReaderId; }, set: function (ampReaderId) { try { if (ampReaderId) { this._selectedStorage.setItem(constants_1.AMP_ID_STORAGE_KEY, JSON.stringify(ampReaderId)); this._ampReaderId = ampReaderId; return; } this._selectedStorage.setItem(constants_1.AMP_ID_STORAGE_KEY, JSON.stringify(null)); this._ampReaderId = ''; } catch (e) { console.error("".concat(constants_2.logPrefix, ": ").concat(e)); return; } }, enumerable: false, configurable: true }); Amp.apiOrigin = ''; Amp._baseDomain = ''; Amp._selectedStorage = (0, utils_1.initStorage)(); Amp._ampReaderId = ''; Amp.options = options_1.default; Amp.checkAMPReaderID = checkAMPReaderID_1.default; Amp.getAMPReaderIDs = getAMPReaderIDs_1.default; Amp.saveAMPReaderID = saveAMPReaderID_1.default; Amp.logoutAMPReaderID = logoutAMPReaderID_1.default; Amp.authenticateAMPReaderID = authenticateAMPReaderID_1.default; return Amp; }()); exports.default = Amp; //# sourceMappingURL=amp.js.map