@schibsted/account-sdk-browser 5.2.5 → 5.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +14 -15
- package/es5/global.js +92 -59
- package/es5/global.js.map +1 -1
- package/es5/global.min.js +1 -1
- package/es5/global.min.js.map +1 -1
- package/es5/identity.js +7 -2
- package/es5/identity.js.map +1 -1
- package/es5/identity.min.js +1 -1
- package/es5/identity.min.js.map +1 -1
- package/es5/index.js +92 -59
- package/es5/index.js.map +1 -1
- package/es5/index.min.js +1 -1
- package/es5/index.min.js.map +1 -1
- package/es5/monetization.js +562 -534
- package/es5/monetization.js.map +1 -1
- package/es5/monetization.min.js +1 -1
- package/es5/monetization.min.js.map +1 -1
- package/es5/payment.js +1 -1
- package/es5/payment.js.map +1 -1
- package/es5/payment.min.js.map +1 -1
- package/identity.js +1 -1
- package/index.js +1 -1
- package/monetization.js +1 -1
- package/package.json +3 -6
- package/payment.js +1 -1
- package/src/identity.js +3 -0
- package/src/monetization.js +18 -6
- package/src/payment.d.ts +1 -1
- package/src/payment.js +1 -1
- package/src/version.js +2 -2
package/es5/index.js
CHANGED
|
@@ -1613,6 +1613,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1613
1613
|
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
|
|
1614
1614
|
error: _context.t0
|
|
1615
1615
|
}, expiresIn);
|
|
1616
|
+
} else if (_context.t0 && _context.t0.code >= 500 && _context.t0.code < 600 && _this2._enableSessionCaching) {
|
|
1617
|
+
// Temporary fix: 30 seconds cache to limit number of calls when service is unavailable
|
|
1618
|
+
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
|
|
1619
|
+
error: _context.t0
|
|
1620
|
+
}, 30 * 1000);
|
|
1616
1621
|
}
|
|
1617
1622
|
throw _context.t0;
|
|
1618
1623
|
case 15:
|
|
@@ -12171,11 +12176,11 @@ function emulate(global) {
|
|
|
12171
12176
|
|
|
12172
12177
|
"use strict";
|
|
12173
12178
|
__webpack_require__.r(__webpack_exports__);
|
|
12174
|
-
//
|
|
12179
|
+
// Version is bumped automatically by release-please. See release-please-config.json.
|
|
12175
12180
|
|
|
12176
12181
|
|
|
12177
12182
|
|
|
12178
|
-
var version = '5.2.
|
|
12183
|
+
var version = '5.2.7'; // x-release-please-version
|
|
12179
12184
|
/* harmony default export */ __webpack_exports__["default"] = (version);
|
|
12180
12185
|
|
|
12181
12186
|
/***/ }),
|
|
@@ -12249,31 +12254,37 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12249
12254
|
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_15__);
|
|
12250
12255
|
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(173);
|
|
12251
12256
|
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_16__);
|
|
12252
|
-
/* harmony import */ var
|
|
12253
|
-
/* harmony import */ var
|
|
12254
|
-
/* harmony import */ var
|
|
12255
|
-
/* harmony import */ var
|
|
12256
|
-
/* harmony import */ var
|
|
12257
|
-
/* harmony import */ var
|
|
12258
|
-
/* harmony import */ var
|
|
12259
|
-
/* harmony import */ var
|
|
12260
|
-
/* harmony import */ var
|
|
12261
|
-
/* harmony import */ var
|
|
12262
|
-
/* harmony import */ var
|
|
12263
|
-
/* harmony import */ var
|
|
12264
|
-
/* harmony import */ var
|
|
12265
|
-
/* harmony import */ var
|
|
12266
|
-
/* harmony import */ var
|
|
12267
|
-
/* harmony import */ var
|
|
12268
|
-
/* harmony import */ var
|
|
12269
|
-
/* harmony import */ var
|
|
12270
|
-
/* harmony import */ var
|
|
12271
|
-
/* harmony import */ var
|
|
12272
|
-
/* harmony import */ var
|
|
12273
|
-
/* harmony import */ var
|
|
12274
|
-
/* harmony import */ var
|
|
12275
|
-
/* harmony import */ var
|
|
12276
|
-
/* harmony import */ var
|
|
12257
|
+
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(73);
|
|
12258
|
+
/* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_17__);
|
|
12259
|
+
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(182);
|
|
12260
|
+
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_18__);
|
|
12261
|
+
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(146);
|
|
12262
|
+
/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_19__);
|
|
12263
|
+
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(181);
|
|
12264
|
+
/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_20__);
|
|
12265
|
+
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(200);
|
|
12266
|
+
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_21__);
|
|
12267
|
+
/* harmony import */ var core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(175);
|
|
12268
|
+
/* harmony import */ var core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_async_iterator_js__WEBPACK_IMPORTED_MODULE_22__);
|
|
12269
|
+
/* harmony import */ var core_js_modules_es_symbol_to_string_tag_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(176);
|
|
12270
|
+
/* harmony import */ var core_js_modules_es_symbol_to_string_tag_js__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_to_string_tag_js__WEBPACK_IMPORTED_MODULE_23__);
|
|
12271
|
+
/* harmony import */ var core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(177);
|
|
12272
|
+
/* harmony import */ var core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_to_string_tag_js__WEBPACK_IMPORTED_MODULE_24__);
|
|
12273
|
+
/* harmony import */ var core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(178);
|
|
12274
|
+
/* harmony import */ var core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_math_to_string_tag_js__WEBPACK_IMPORTED_MODULE_25__);
|
|
12275
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(179);
|
|
12276
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_26__);
|
|
12277
|
+
/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(183);
|
|
12278
|
+
/* harmony import */ var _url_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(203);
|
|
12279
|
+
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(204);
|
|
12280
|
+
/* harmony import */ var tiny_emitter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(205);
|
|
12281
|
+
/* harmony import */ var tiny_emitter__WEBPACK_IMPORTED_MODULE_30___default = /*#__PURE__*/__webpack_require__.n(tiny_emitter__WEBPACK_IMPORTED_MODULE_30__);
|
|
12282
|
+
/* harmony import */ var _RESTClient_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(214);
|
|
12283
|
+
/* harmony import */ var _cache_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(206);
|
|
12284
|
+
/* harmony import */ var _spidTalk_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(222);
|
|
12285
|
+
/* harmony import */ var _SDKError_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(189);
|
|
12286
|
+
/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(223);
|
|
12287
|
+
/* harmony import */ var _global_registry_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(224);
|
|
12277
12288
|
/* Copyright 2024 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.
|
|
12278
12289
|
* See LICENSE.md in the project root.
|
|
12279
12290
|
*/
|
|
@@ -12282,6 +12293,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12282
12293
|
|
|
12283
12294
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12284
12295
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12296
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12297
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12298
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12299
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12300
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12301
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12285
12302
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12286
12303
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12287
12304
|
|
|
@@ -12304,6 +12321,9 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
12304
12321
|
|
|
12305
12322
|
|
|
12306
12323
|
|
|
12324
|
+
|
|
12325
|
+
|
|
12326
|
+
|
|
12307
12327
|
|
|
12308
12328
|
|
|
12309
12329
|
|
|
@@ -12360,21 +12380,22 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12360
12380
|
window = _ref$window === void 0 ? globalWindow() : _ref$window;
|
|
12361
12381
|
_classCallCheck(this, Monetization);
|
|
12362
12382
|
_this = _super.call(this);
|
|
12363
|
-
|
|
12383
|
+
_spidTalk_js__WEBPACK_IMPORTED_MODULE_33__["emulate"](window);
|
|
12364
12384
|
// validate options
|
|
12365
|
-
Object(
|
|
12366
|
-
_this.cache = new
|
|
12385
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isNonEmptyString"])(clientId), 'clientId parameter is required');
|
|
12386
|
+
_this.cache = new _cache_js__WEBPACK_IMPORTED_MODULE_32__["default"](function () {
|
|
12367
12387
|
return window && window.sessionStorage;
|
|
12368
12388
|
});
|
|
12369
12389
|
_this.clientId = clientId;
|
|
12370
12390
|
_this.env = env;
|
|
12371
12391
|
_this.redirectUri = redirectUri;
|
|
12392
|
+
_this.pendingHasAccessRequests = {};
|
|
12372
12393
|
_this._setSpidServerUrl(env);
|
|
12373
12394
|
if (sessionDomain) {
|
|
12374
|
-
Object(
|
|
12395
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isUrl"])(sessionDomain), 'sessionDomain parameter is not a valid URL');
|
|
12375
12396
|
_this._setSessionServiceUrl(sessionDomain);
|
|
12376
12397
|
}
|
|
12377
|
-
Object(
|
|
12398
|
+
Object(_global_registry_js__WEBPACK_IMPORTED_MODULE_36__["registerGlobal"])(window, 'Monetization', _assertThisInitialized(_this));
|
|
12378
12399
|
return _this;
|
|
12379
12400
|
}
|
|
12380
12401
|
|
|
@@ -12387,9 +12408,9 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12387
12408
|
_createClass(Monetization, [{
|
|
12388
12409
|
key: "_setSpidServerUrl",
|
|
12389
12410
|
value: function _setSpidServerUrl(url) {
|
|
12390
|
-
Object(
|
|
12391
|
-
this._spid = new
|
|
12392
|
-
serverUrl: Object(
|
|
12411
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isStr"])(url), "url parameter is invalid: ".concat(url));
|
|
12412
|
+
this._spid = new _RESTClient_js__WEBPACK_IMPORTED_MODULE_31__["default"]({
|
|
12413
|
+
serverUrl: Object(_url_js__WEBPACK_IMPORTED_MODULE_28__["urlMapper"])(url, _config_js__WEBPACK_IMPORTED_MODULE_29__["ENDPOINTS"].SPiD),
|
|
12393
12414
|
defaultParams: {
|
|
12394
12415
|
client_id: this.clientId,
|
|
12395
12416
|
redirect_uri: this.redirectUri
|
|
@@ -12406,15 +12427,15 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12406
12427
|
}, {
|
|
12407
12428
|
key: "_setSessionServiceUrl",
|
|
12408
12429
|
value: function _setSessionServiceUrl(domain) {
|
|
12409
|
-
Object(
|
|
12410
|
-
var client_sdrn = "sdrn:".concat(
|
|
12411
|
-
this._sessionService = new
|
|
12430
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isStr"])(domain), "domain parameter is invalid: ".concat(domain));
|
|
12431
|
+
var client_sdrn = "sdrn:".concat(_config_js__WEBPACK_IMPORTED_MODULE_29__["NAMESPACE"][this.env], ":client:").concat(this.clientId);
|
|
12432
|
+
this._sessionService = new _RESTClient_js__WEBPACK_IMPORTED_MODULE_31__["default"]({
|
|
12412
12433
|
serverUrl: domain,
|
|
12413
12434
|
log: this.log,
|
|
12414
12435
|
defaultParams: {
|
|
12415
12436
|
client_sdrn: client_sdrn,
|
|
12416
12437
|
redirect_uri: this.redirectUri,
|
|
12417
|
-
sdk_version:
|
|
12438
|
+
sdk_version: _version_js__WEBPACK_IMPORTED_MODULE_35__["default"]
|
|
12418
12439
|
}
|
|
12419
12440
|
});
|
|
12420
12441
|
}
|
|
@@ -12432,7 +12453,7 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12432
12453
|
key: "hasAccess",
|
|
12433
12454
|
value: function () {
|
|
12434
12455
|
var _hasAccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(productIds, userId) {
|
|
12435
|
-
var sortedIds, cacheKey, data, expiresSeconds;
|
|
12456
|
+
var sortedIds, cacheKey, data, promise, expiresSeconds;
|
|
12436
12457
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12437
12458
|
while (1) switch (_context.prev = _context.next) {
|
|
12438
12459
|
case 0:
|
|
@@ -12440,50 +12461,62 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12440
12461
|
_context.next = 2;
|
|
12441
12462
|
break;
|
|
12442
12463
|
}
|
|
12443
|
-
throw new
|
|
12464
|
+
throw new _SDKError_js__WEBPACK_IMPORTED_MODULE_34__["default"]("hasAccess can only be called if 'sessionDomain' is configured");
|
|
12444
12465
|
case 2:
|
|
12445
12466
|
if (userId) {
|
|
12446
12467
|
_context.next = 4;
|
|
12447
12468
|
break;
|
|
12448
12469
|
}
|
|
12449
|
-
throw new
|
|
12470
|
+
throw new _SDKError_js__WEBPACK_IMPORTED_MODULE_34__["default"]("'userId' must be specified");
|
|
12450
12471
|
case 4:
|
|
12451
12472
|
if (Array.isArray(productIds)) {
|
|
12452
12473
|
_context.next = 6;
|
|
12453
12474
|
break;
|
|
12454
12475
|
}
|
|
12455
|
-
throw new
|
|
12476
|
+
throw new _SDKError_js__WEBPACK_IMPORTED_MODULE_34__["default"]("'productIds' must be an array");
|
|
12456
12477
|
case 6:
|
|
12457
|
-
sortedIds = productIds.sort();
|
|
12458
|
-
cacheKey = this._accessCacheKey(
|
|
12478
|
+
sortedIds = _toConsumableArray(productIds).sort();
|
|
12479
|
+
cacheKey = this._accessCacheKey(sortedIds, userId);
|
|
12459
12480
|
data = this.cache.get(cacheKey);
|
|
12460
12481
|
if (data) {
|
|
12461
|
-
_context.next =
|
|
12482
|
+
_context.next = 21;
|
|
12462
12483
|
break;
|
|
12463
12484
|
}
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12485
|
+
if (!this.pendingHasAccessRequests[cacheKey]) {
|
|
12486
|
+
this.pendingHasAccessRequests[cacheKey] = this._sessionService.get("/hasAccess/".concat(sortedIds.join(',')));
|
|
12487
|
+
}
|
|
12488
|
+
promise = this.pendingHasAccessRequests[cacheKey];
|
|
12489
|
+
_context.prev = 12;
|
|
12490
|
+
_context.next = 15;
|
|
12491
|
+
return promise;
|
|
12492
|
+
case 15:
|
|
12467
12493
|
data = _context.sent;
|
|
12468
12494
|
expiresSeconds = data.ttl;
|
|
12469
12495
|
this.cache.set(cacheKey, data, expiresSeconds * 1000);
|
|
12470
|
-
case
|
|
12496
|
+
case 18:
|
|
12497
|
+
_context.prev = 18;
|
|
12498
|
+
// If it rejects, we still want to clear the pending request
|
|
12499
|
+
if (this.pendingHasAccessRequests[cacheKey] === promise) {
|
|
12500
|
+
delete this.pendingHasAccessRequests[cacheKey];
|
|
12501
|
+
}
|
|
12502
|
+
return _context.finish(18);
|
|
12503
|
+
case 21:
|
|
12471
12504
|
if (data.entitled) {
|
|
12472
|
-
_context.next =
|
|
12505
|
+
_context.next = 23;
|
|
12473
12506
|
break;
|
|
12474
12507
|
}
|
|
12475
12508
|
return _context.abrupt("return", null);
|
|
12476
|
-
case
|
|
12509
|
+
case 23:
|
|
12477
12510
|
this.emit('hasAccess', {
|
|
12478
12511
|
ids: sortedIds,
|
|
12479
12512
|
data: data
|
|
12480
12513
|
});
|
|
12481
12514
|
return _context.abrupt("return", data);
|
|
12482
|
-
case
|
|
12515
|
+
case 25:
|
|
12483
12516
|
case "end":
|
|
12484
12517
|
return _context.stop();
|
|
12485
12518
|
}
|
|
12486
|
-
}, _callee, this);
|
|
12519
|
+
}, _callee, this, [[12,, 18, 21]]);
|
|
12487
12520
|
}));
|
|
12488
12521
|
function hasAccess(_x, _x2) {
|
|
12489
12522
|
return _hasAccess.apply(this, arguments);
|
|
@@ -12512,7 +12545,7 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12512
12545
|
}, {
|
|
12513
12546
|
key: "_accessCacheKey",
|
|
12514
12547
|
value: function _accessCacheKey(productIds, userId) {
|
|
12515
|
-
return "prd_".concat(productIds.sort(), "_").concat(userId);
|
|
12548
|
+
return "prd_".concat(_toConsumableArray(productIds).sort(), "_").concat(userId);
|
|
12516
12549
|
}
|
|
12517
12550
|
|
|
12518
12551
|
/**
|
|
@@ -12524,7 +12557,7 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12524
12557
|
key: "subscriptionsUrl",
|
|
12525
12558
|
value: function subscriptionsUrl() {
|
|
12526
12559
|
var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
|
|
12527
|
-
Object(
|
|
12560
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isUrl"])(redirectUri), "subscriptionsUrl(): redirectUri is invalid");
|
|
12528
12561
|
return this._spid.makeUrl('account/subscriptions', {
|
|
12529
12562
|
redirect_uri: redirectUri
|
|
12530
12563
|
});
|
|
@@ -12539,14 +12572,14 @@ var Monetization = /*#__PURE__*/function (_EventEmitter) {
|
|
|
12539
12572
|
key: "productsUrl",
|
|
12540
12573
|
value: function productsUrl() {
|
|
12541
12574
|
var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
|
|
12542
|
-
Object(
|
|
12575
|
+
Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_27__["isUrl"])(redirectUri), "productsUrl(): redirectUri is invalid");
|
|
12543
12576
|
return this._spid.makeUrl('account/products', {
|
|
12544
12577
|
redirect_uri: redirectUri
|
|
12545
12578
|
});
|
|
12546
12579
|
}
|
|
12547
12580
|
}]);
|
|
12548
12581
|
return Monetization;
|
|
12549
|
-
}(
|
|
12582
|
+
}(tiny_emitter__WEBPACK_IMPORTED_MODULE_30___default.a);
|
|
12550
12583
|
/* harmony default export */ __webpack_exports__["default"] = (Monetization);
|
|
12551
12584
|
|
|
12552
12585
|
/***/ }),
|
|
@@ -12807,7 +12840,7 @@ var Payment = /*#__PURE__*/function () {
|
|
|
12807
12840
|
}
|
|
12808
12841
|
|
|
12809
12842
|
/**
|
|
12810
|
-
* @deprecated https://
|
|
12843
|
+
* @deprecated https://schibsted.ghe.com/user-identity/account-sdk-browser/issues/94
|
|
12811
12844
|
*
|
|
12812
12845
|
* Get the url for the paylink purchase
|
|
12813
12846
|
* @todo Check working-ness for BFF + SPiD
|