UNPKG

@arc-publishing/sdk-amp

Version:
58 lines 2.16 kB
import { initStorage } from './utils'; import { AMP_ID_STORAGE_KEY } from './constants'; import getAMPReaderIDs from './getAMPReaderIDs'; import saveAMPReaderID from './saveAMPReaderID'; import checkAMPReaderID from './checkAMPReaderID'; import logoutAMPReaderID from './logoutAMPReaderID'; import authenticateAMPReaderID from './authenticateAMPReaderID'; import options from './options'; import { logPrefix } from './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(AMP_ID_STORAGE_KEY) || null); this._ampReaderId = existingReaderId ? existingReaderId : ''; } } catch (e) { console.error("".concat(logPrefix, ": ").concat(e)); this._ampReaderId = ''; } return this._ampReaderId; }, set: function (ampReaderId) { try { if (ampReaderId) { this._selectedStorage.setItem(AMP_ID_STORAGE_KEY, JSON.stringify(ampReaderId)); this._ampReaderId = ampReaderId; return; } this._selectedStorage.setItem(AMP_ID_STORAGE_KEY, JSON.stringify(null)); this._ampReaderId = ''; } catch (e) { console.error("".concat(logPrefix, ": ").concat(e)); return; } }, enumerable: false, configurable: true }); Amp.apiOrigin = ''; Amp._baseDomain = ''; Amp._selectedStorage = initStorage(); Amp._ampReaderId = ''; Amp.options = options; Amp.checkAMPReaderID = checkAMPReaderID; Amp.getAMPReaderIDs = getAMPReaderIDs; Amp.saveAMPReaderID = saveAMPReaderID; Amp.logoutAMPReaderID = logoutAMPReaderID; Amp.authenticateAMPReaderID = authenticateAMPReaderID; return Amp; }()); export default Amp; //# sourceMappingURL=amp.js.map