vendor: 4,839 bytes, lines 1-13
1"use strict"; 2function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; } 3function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); } 4function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; } 5function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } 6function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } 7function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } 8function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } 9function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } 10function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } 11function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } 12function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } 13function _regenerator() { var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf;
13 var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); } 14function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); } 15function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } 16function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } 17function _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); } 18function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 19function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 20function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 21function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 22function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 23function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 24function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 25function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 26function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 27function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 28function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 29var TaxDisplay = function () { 30 function TaxDisplay() { 31 _classCallCheck(this, TaxDisplay); 32 } 33 return _createClass(TaxDisplay, null, [{ 34 key: "roundMoney", 35 value: function roundMoney(v) { 36 var n = +v; 37 if (!isFinite(n) || n === 0) { 38 return 0; 39 } 40 var a = Math.abs(n); 41 var _a$toExponential$spli = a.toExponential(14).split("e"), 42 _a$toExponential$spli2 = _slicedToArray(_a$toExponential$spli, 2), 43 mantissa = _a$toExponential$spli2[0], 44 exponent = _a$toExponential$spli2[1]; 45 var d = Number(mantissa.replace(".", "")); 46 var shift = +exponent - 12; 47 var cents; 48 if (shift >= 0) { 49 return n; 50 } else if (-shift > 22) { 51 cents = 0; 52 } else { 53 cents = Math.round(d / Math.pow(10, -shift)); 54 } 55 var out = (n < 0 ? -cents : cents) / 100; 56 return out === 0 ? 0 : out; 57 } 58 }, { 59 key: "split", 60 value: function split(ex_tax, rate_percent) { 61 var ex = TaxDisplay.roundMoney(ex_tax); 62 var rate = +rate_percent || 0; 63 var vat = TaxDisplay.roundMoney(ex * rate / 100); 64 return { 65 ex: ex, 66 vat: vat, 67 full: TaxDisplay.roundMoney(ex + vat) 68 }; 69 } 70 }, { 71 key: "newItemQuote", 72 value: function newItemQuote(ex_tax, rate_percent) { 73 var us_sales_tax = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
74 var s = TaxDisplay.split(ex_tax, rate_percent); 75 if (us_sales_tax) { 76 return { 77 quotedPriceFull: s.ex, 78 quotedVAT: 0 79 }; 80 } 81 return { 82 quotedPriceFull: s.full, 83 quotedVAT: s.vat 84 }; 85 } 86 }, { 87 key: "isUSSalesTax", 88 value: function isUSSalesTax(user_config, catalogue_config) { 89 if (user_config && typeof user_config.usSalesTax == "boolean") { 90 return user_config.usSalesTax; 91 } 92 return !!(catalogue_config && catalogue_config.USSalesTaxEnabled && !catalogue_config.isEUVATEntity && user_config && user_config.location === "USA"); 93 } 94 }, { 95 key: "label", 96 value: function label(user_config) { 97 var brand_info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 98 if (user_config && user_config.taxLabel) { 99 return user_config.taxLabel; 100 } 101 if (brand_info && brand_info.customVatLabel) { 102 return brand_info.customVatLabel; 103 } 104 return TaxDisplay.translate("checkout_vat", "VAT"); 105 } 106 }, { 107 key: "translate", 108 value: function translate(key, fallback) { 109 try { 110 if (typeof translation != "undefined" && translation) { 111 var v = translation.get(key); 112 if (v && v !== key) { 113 return v; 114 } 115 } 116 } catch (e) {} 117 return fallback; 118 } 119 }, { 120 key: "vatAreaAlpha3", 121 get: function get() { 122 return { 123 AUT: "AT", 124 BEL: "BE", 125 BGR: "BG", 126 CYP: "CY", 127 CZE: "CZ", 128 DEU: "DE", 129 DNK: "DK", 130 EST: "EE", 131 ESP: "ES", 132 FIN: "FI", 133 FRA: "FR", 134 GRC: "GR", 135 HRV: "HR", 136 HUN: "HU", 137 IRL: "IE", 138 ITA: "IT", 139 LTU: "LT", 140 LUX: "LU", 141 LVA: "LV", 142 MLT: "MT", 143 NLD: "NL", 144 POL: "PL", 145 PRT: "PT", 146 ROU: "RO", 147 SWE: "SE", 148 SVN: "SI", 149 SVK: "SK", 150 GBR: "GB", 151 IMN: "IM" 152 }; 153 } 154 }, { 155 key: "vatAreaAlpha2", 156 value: function vatAreaAlpha2(cc) { 157 if (!cc) return null; 158 var c = ("" + cc).toUpperCase(); 159 var map = TaxDisplay.vatAreaAlpha3; 160 if (c.length == 3) { 161 return map[c] || null; 162 } 163 if (c == "EL") return "GR"; 164 if (c == "UK") return "GB"; 165 return Object.values(map).includes(c) ? c : null; 166 } 167 }, { 168 key: "isVatArea", 169 value: function isVatArea(cc) { 170 return !!TaxDisplay.vatAreaAlpha2(cc); 171 } 172 }, { 173 key: "vatPrefix", 174 value: function vatPrefix(cc) { 175 var a2 = TaxDisplay.vatAreaAlpha2(cc); 176 switch (a2) { 177 case null: 178 return null; 179 case "GR": 180 return "EL"; 181 case "IM": 182 return "GB"; 183 default: 184 return a2; 185 } 186 } 187 }, { 188 key: "vatNumberTail", 189 value: function vatNumberTail(v, prefix) { 190 var s = ("" + (v || "")).replace(/[\s.\-]+/g, "").toUpperCase(); 191 if (prefix && s.indexOf(prefix) === 0) { 192 s = s.substring(prefix.length); 193 } 194 return s; 195 } 196 }]); 197}(); 198"use strict"; 199var SBProductPricing = function () { 200 function SBProductPricing() { 201 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 202 action: null, 203 currency: null, 204 isManaged: false, 205 periodMonths: null, 206 paymentType: "any", 207 price: null 208 }; 209 var isNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 210 var get_implied_price = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 211 _classCallCheck(this, SBProductPricing); 212 this.action = p.action; 213 this.currency = p.currency; 214 this.getImpliedPrice = get_implied_price; 215 this.periodMonths = p.periodMonths; 216 this.isManaged = p.isManaged; 217 this.managedMarkup = +p.managedMarkup; 218 this.managedMarkupType = p.managedMarkupType; 219 this.managedMarkedUpPrice = p.managedMarkedUpPrice; 220 this.isNew = isNew; 221 this.paymentType = p.paymentType; 222 this.price = p.price; 223 } 224 return _createClass(SBProductPricing, [{ 225 key: "periodMonths", 226 get: function get() { 227 return this._periodMonths; 228 }, 229 set: function set(v) { 230 if (this.price && v && this._periodMonths) { 231 this.price = Math.round(this.price * v * 100 / this._periodMonths) / 100; 232 } 233 this._periodMonths = v; 234 } 235 }, { 236 key: "price", 237 get: function get() { 238 if (this._price !== null) { 239 return this._price; 240 } 241 if (this.getImpliedPrice) { 242 var price = this.getImpliedPrice(); 243 if (price !== null) { 244 this._price = price; 245 this.getImpliedPrice = null; 246 } 247 return this._price; 248 } 249 return null; 250 }, 251 set: function set(v) { 252 this._price = v === null ? v : +v; 253 } 254 }, { 255 key: "matchesPaymentType", 256 value: function matchesPaymentType(t) { 257 if (t == this.paymentType) { 258 return true; 259 } 260 var real_types = SBasketService.realTypes.get(this.paymentType); 261 return !!real_types && real_types.includes(t); 262 } 263 }, { 264 key: "priceForMonths", 265 value: function priceForMonths(m) { 266 if (!this.price) return this.price; 267 if (m <= this.periodMonths) { 268 return this.price; 269 } else if (!this.periodMonths) { 270 return null; 271 } else { 272 return Math.round(this.price * 100 * Math.ceil(m / this.periodMonths)) / 100; 273 } 274 } 275 }, { 276 key: "toJSON", 277 value: function toJSON() { 278 return { 279 action: this.action, 280 currency: this.currency, 281 isManaged: this.isManaged, 282 managedMarkup: this.managedMarkup, 283 managedMarkupType: this.managedMarkupType, 284 managedMarkedUpPrice: this.managedMarkedUpPrice, 285 periodMonths: this.periodMonths, 286 paymentType: this.paymentType, 287 price: this.price 288 }; 289 } 290 }]); 291}(); 292var SBProduct = function () { 293 function SBProduct() { 294 _classCallCheck(this, SBProduct); 295 } 296 return _createClass(SBProduct, null, [{ 297 key: "classes", 298 get: function get() { 299 if (!this._classes) { 300 this._classes = {}; 301 } 302 return this._classes; 303 } 304 }, { 305 key: "create", 306 value: function create(p) { 307 var prefix = p.code.replace(/:.*/, ""); 308 if (!prefix.match(/^[a-z0-9_-]*$/)) { 309 throw new Error("Invalid type ".concat(prefix)); 310 } 311 if (this.classes[prefix]) { 312 return new this.classes[prefix](p); 313 } else { 314 return new SBGeneralProduct(p); 315 } 316 } 317 }, { 318 key: "register", 319 value: function register(classes) { 320 var _this = this;
321 classes.forEach(function (c) { 322 return _this.classes[c.prefix] = c; 323 }); 324 } 325 }, { 326 key: "usSalesTaxApplies", 327 value: (function () { 328 var _usSalesTaxApplies = _asyncToGenerator(_regenerator().m(function _callee() { 329 var _yield$Promise$all, _yield$Promise$all2, user_config, config, _t; 330 return _regenerator().w(function (_context) { 331 while (1) switch (_context.p = _context.n) { 332 case 0: 333 _context.p = 0; 334 _context.n = 1; 335 return Promise.all([UserCatalogue.inst.preloadSingle("userConfig"), UserCatalogue.inst.preloadSingle("config")]); 336 case 1: 337 _yield$Promise$all = _context.v; 338 _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2); 339 user_config = _yield$Promise$all2[0]; 340 config = _yield$Promise$all2[1]; 341 return _context.a(2, TaxDisplay.isUSSalesTax(user_config, config)); 342 case 2: 343 _context.p = 2; 344 _t = _context.v; 345 return _context.a(2, false); 346 } 347 }, _callee, null, [[0, 2]]); 348 })); 349 function usSalesTaxApplies() { 350 return _usSalesTaxApplies.apply(this, arguments); 351 } 352 return usSalesTaxApplies; 353 }()) 354 }, { 355 key: "upgradePricing", 356 value: function upgradePricing(from, to, real_payment_type, expiry_date) { 357 var general_payment_type; 358 if (real_payment_type) { 359 general_payment_type = SBasketService.generalTypesFor(real_payment_type).find(function (t) { 360 return from.pricing.some(function (p) { 361 return p.paymentType == t; 362 }) && to.pricing.some(function (p) { 363 return p.paymentType == t; 364 }); 365 }); 366 } else { 367 general_payment_type = from.pricing.map(function (p) { 368 return p.paymentType; 369 }).find(function (pt) { 370 return to.pricing.some(function (p) { 371 return p.paymentType == pt; 372 }); 373 }); 374 } 375 var to_price = to.expectedPriceExcludingVATForDate(general_payment_type, expiry_date); 376 var from_price = from.expectedPriceExcludingVATForDate(general_payment_type, expiry_date); 377 var sum = to_price - from_price; 378 return { 379 generalPaymentType: general_payment_type, 380 price: sum > 0 ? Math.round(sum * 2) / 2 : 0 381 }; 382 } 383 }]); 384}(); 385var SBGeneralProduct = function (_NetworkPropertySet) { 386 function SBGeneralProduct() { 387 var _p$shopDisplayOrder; 388 var _this2; 389 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 390 _classCallCheck(this, SBGeneralProduct); 391 _this2 = _callSuper(this, SBGeneralProduct); 392 if (!p) { 393 p = _this2.defaultContent; 394 _this2.isNew = true; 395 } else { 396 _this2.isNew = false; 397 } 398 _this2.location = null; 399 _this2.code = p.code; 400 _this2.expanded = false; 401 _this2._image = null; 402 _this2.hasImage = p.hasImage; 403 _this2.hasChangedImage = false; 404 var parts = _this2.code.split(":"); 405 if (parts[0] == 'stack_user_package_allowance') { 406 _this2.allowance = parts[1].split("-")[1]; 407 _this2.location = parts[1].split("-")[2] || "uk"; 408 } else { 409 _this2.allowance = null; 410 } 411 _this2.discontinued = p.discontinued; 412 _this2.hidden = p.hidden; 413 _this2.emailTemplate = p.emailTemplate; 414 _this2.affiliateCommission = p.affiliateCommission; 415 _this2.forUser = p.forUser || null; 416 _this2._label = p.label; 417 _this2.originalLabel = p.label; 418 _this2._pricing = null; 419 _this2.pricing = p.pricing.map(function (p) { 420 return p instanceof SBProductPricing ? p : new SBProductPricing(p, false); 421 }); 422 _this2.updating = false; 423 _this2.taxExempt = !!p.taxExempt; 424 _this2.shopDisplayOrder = (_p$shopDisplayOrder = p.shopDisplayOrder) !== null && _p$shopDisplayOrder !== void 0 ? _p$shopDisplayOrder : null; 425 return _this2; 426 } 427 _inherits(SBGeneralProduct, _NetworkPropertySet); 428 return _createClass(SBGeneralProduct, [{ 429 key: "defaultContent", 430 get: function get() { 431 return {
432 code: this.codePrefix + ":", 433 discontinued: false, 434 hidden: false, 435 label: null, 436 pricing: this.defaultPricing, 437 emailTemplate: null, 438 image: null 439 }; 440 } 441 }, { 442 key: "defaultPricing", 443 get: function get() { 444 throw new Error("Not implemented"); 445 } 446 }, { 447 key: "codeComponents", 448 get: function get() { 449 return this.code.split(/:/).slice(1); 450 }, 451 set: function set(v) { 452 this.code = [this.codePrefix].concat(v).join(":"); 453 } 454 }, { 455 key: "codePrefix", 456 get: function get() { 457 throw new Error("Not implemented"); 458 } 459 }, { 460 key: "forSale", 461 get: function get() { 462 return !this.discontinued; 463 }, 464 set: function set(v) { 465 this.discontinued = !v; 466 } 467 }, { 468 key: "image", 469 get: function get() { 470 return this._image; 471 }, 472 set: function set(v) { 473 if (this.image != v) { 474 this.hasChangedImage = true; 475 this.hasImage = true; 476 this.reload(["imageDataUrl"]); 477 } 478 this._image = v; 479 } 480 }, { 481 key: "isHidden", 482 get: function get() { 483 return this.hidden; 484 }, 485 set: function set(v) { 486 this.hidden = v; 487 } 488 }, { 489 key: "label", 490 get: function get() { 491 return this._label; 492 }, 493 set: function set(v) { 494 this._label = v; 495 } 496 }, { 497 key: "pricing", 498 get: function get() { 499 return this._pricing; 500 }, 501 set: function set(v) { 502 this._pricing = v; 503 } 504 }, { 505 key: "productEmailTemplate", 506 get: function get() { 507 return this.emailTemplate; 508 }, 509 set: function set(v) { 510 this.emailTemplate = v; 511 } 512 }, { 513 key: "lowestPrice", 514 get: function get() { 515 var _this3 = this; 516 var prices = null; 517 if (this.pricing.find(function (p) { 518 return p.action === null && p.currency == AnyBasket.inst.currency; 519 })) { 520 prices = this.pricing.filter(function (p) { 521 return p.action === null && p.currency === AnyBasket.inst.currency; 522 }); 523 } else { 524 prices = this.pricing.filter(function (p) { 525 return p.action === null && p.currency === null; 526 }); 527 } 528 return prices.reduce(function (carry, p) { 529 if (!carry) { 530 return p; 531 } else if (_this3.codePrefix === "domain") { 532 if (p.managedMarkedUpPrice !== null && p.managedMarkedUpPrice < carry.managedMarkedUpPrice) return p; 533 } else if (p.price !== null && p.price < carry.price) { 534 return p; 535 } else if (_this3.code.match(/cloud_server:/)) { 536 if (typeof CloudProductHelper === 'function') { 537 var h = CloudProductHelper.inst; 538 var lp = h.lowestPriceSB(); 539 return lp ? lp : carry; 540 } else { 541 throw new Error("For lowest price of cloud server products please load the CloudProductHelper class via CloudProductHelper.inst in mounted"); 542 } 543 } else { 544 return carry; 545 } 546 }, null); 547 } 548 }, { 549 key: "networkPropertyHandlers", 550 get: function get() { 551 var _this4 = this; 552 return { 553 imageDataUrl: function imageDataUrl() { 554 return $.ajax("/a/catalogue/productImage/".concat(_this4.code)); 555 } 556 }; 557 } 558 }, { 559 key: "type", 560 get: function get() { 561 return this.codeComponents[0]; 562 } 563 }, { 564 key: "basketItem", 565 value: (function () { 566 var _basketItem = _asyncToGenerator(function () { 567 var _this5 = this; 568 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 569 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 570 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 571 var quoted_price = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 572 return _regenerator().m(function _callee2() { 573 var vat_rate, pricingPrice, quote, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12; 574 return _regenerator().w(function (_context2) { 575 while (1) switch (_context2.n) { 576 case 0: 577 if (!pricing) { 578 pricing = _this5.pricing[0]; 579 } 580 if (!(pricing && pricing.price !== null && _this5.pricing.some(function (p) { 581 return p == pricing; 582 }))) { 583 _context2.n = 6; 584 break; 585 } 586 if (!_this5.taxExempt) { 587 _context2.n = 1; 588 break; 589 } 590 vat_rate = 0; 591 _context2.n = 3; 592 break; 593 case 1: 594 _context2.n = 2; 595 return UserCatalogue.inst.preloadSingle("userVATRate"); 596 case 2: 597 vat_rate = _context2.v; 598 case 3: 599 pricingPrice = pricing.managedMarkedUpPrice ? pricing.managedMarkedUpPrice : pricing.price; 600 _t2 = TaxDisplay; 601 _t3 = quoted_price || multiple * pricingPrice; 602 _t4 = vat_rate; 603 _context2.n = 4; 604 return SBProduct.usSalesTaxApplies(); 605 case 4: 606 quote = _t2.newItemQuote.call(_t2, _t3, _t4, _context2.v); 607 _t5 = SBasketItem; 608 _t6 = pricing.action; 609 _context2.n = 5; 610 return UserCatalogue.inst.preloadSingle("currency"); 611 case 5: 612 _t7 = _context2.v; 613 _t8 = {}; 614 _t9 = pricing.paymentType; 615 _t0 = multiple * pricing.periodMonths; 616 _t1 = _this5.code; 617 _t10 = quote.quotedPriceFull; 618 _t11 = quote.quotedVAT; 619 _t12 = { 620 action: _t6, 621 contact: null, 622 currency: _t7, 623 dependentItems: _t8, 624 name: null, 625 paymentRef: null, 626 paymentSelections: null, 627 paymentType: _t9, 628 periodMonths: _t0,
629 productCode: _t1, 630 productOptionSelections: null, 631 quotedPriceFull: _t10, 632 quotedVAT: _t11, 633 service: null, 634 serviceConfiguration: null, 635 upgradeFromProductCode: null 636 }; 637 return _context2.a(2, new _t5(_t12)); 638 case 6: 639 throw new Error("Matching pricing not found"); 640 case 7: 641 return _context2.a(2); 642 } 643 }, _callee2); 644 })(); 645 }); 646 function basketItem() { 647 return _basketItem.apply(this, arguments); 648 } 649 return basketItem; 650 }()) 651 }, { 652 key: "expectedPriceExcludingVATForDate", 653 value: function expectedPriceExcludingVATForDate(general_payment_type, expiry_date) { 654 var fuzz_date = new Date(expiry_date); 655 fuzz_date.setDate(fuzz_date.getDate() - 7); 656 var possible_prices = this.pricing.filter(function (p) { 657 return !p.action && p.paymentType == general_payment_type; 658 }).sort(function (a, b) { 659 return a.periodMonths - b.periodMonths; 660 }); 661 var price = null; 662 var _iterator = _createForOfIteratorHelper(possible_prices), 663 _step; 664 try { 665 for (_iterator.s(); !(_step = _iterator.n()).done;) { 666 var p = _step.value; 667 var target_date = new Date(); 668 target_date.setMonth(target_date.getMonth() + p.periodMonths); 669 if (target_date >= fuzz_date) { 670 price = p; 671 break; 672 } 673 } 674 } catch (err) { 675 _iterator.e(err); 676 } finally { 677 _iterator.f(); 678 } 679 if (!price) { 680 price = possible_prices.pop(); 681 } 682 var base_period_end = new Date(); 683 base_period_end.setMonth(base_period_end.getMonth() + price.periodMonths); 684 var base_period = base_period_end.valueOf() - new Date().valueOf(); 685 var target_period = Math.ceil((expiry_date.valueOf() - new Date().valueOf()) / 86400000) * 86400000; 686 return Math.round(price.price * target_period * 100 / base_period) / 100; 687 } 688 }, { 689 key: "initialPriceFor", 690 value: function initialPriceFor(payment_type, months) { 691 var price_info = this.pricingFor(payment_type, months); 692 return price_info && price_info.price; 693 } 694 }, { 695 key: "initialPriceForGeneral", 696 value: function initialPriceForGeneral(general_payment_type, months) { 697 var price_info = this.pricingForGeneral(general_payment_type, months); 698 return price_info && price_info.price; 699 } 700 }, { 701 key: "needsPrice", 702 value: function needsPrice(price_info) { 703 return price_info.paymentType == "any" && this.pricing.some(function (pr) { 704 return pr.paymentType != "any" && pr.periodMonths == price_info.periodMonths; 705 }); 706 } 707 }, { 708 key: "pricingFor", 709 value: function pricingFor(payment_type, months) { 710 return this.pricing.find(function (p) { 711 return p.periodMonths == months && p.matchesPaymentType(payment_type) && p.action === null; 712 }) || null; 713 } 714 }, { 715 key: "pricingForGeneral", 716 value: function pricingForGeneral(general_payment_type, months) { 717 return this.pricing.find(function (p) { 718 return p.periodMonths == months && p.paymentType == general_payment_type && p.action === null; 719 }) || null; 720 } 721 }, { 722 key: "pricingSupportsMonths", 723 value: function pricingSupportsMonths(months) { 724 return this.pricing.some(function (p) { 725 return p.periodMonths == months && p.action === null; 726 }); 727 } 728 }, { 729 key: "pricingSupportsRealType", 730 value: function pricingSupportsRealType(payment_type) { 731 return this.pricing.some(function (p) { 732 return p.matchesPaymentType(payment_type) && p.action === null; 733 }); 734 } 735 }, { 736 key: "upgradeBasketItem", 737 value: (function () { 738 var _upgradeBasketItem = _asyncToGenerator(function (from_product, for_service) { 739 var _this6 = this; 740 var real_payment_type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 741 return _regenerator().m(function _callee3() { 742 var vat_rate, upgrade_pricing, quote, _t13, _t14, _t15; 743 return _regenerator().w(function (_context3) { 744 while (1) switch (_context3.n) { 745 case 0: 746 _context3.n = 1; 747 return UserCatalogue.inst.preloadSingle("userVATRate"); 748 case 1: 749 vat_rate = _context3.v; 750 upgrade_pricing = SBProduct.upgradePricing(from_product, _this6, real_payment_type, new Date(for_service.expiry)); 751 _t13 = TaxDisplay; 752 _t14 = upgrade_pricing.price; 753 _t15 = vat_rate; 754 _context3.n = 2; 755 return SBProduct.usSalesTaxApplies(); 756 case 2: 757 quote = _t13.newItemQuote.call(_t13, _t14, _t15, _context3.v); 758 return _context3.a(2, new SBasketItem({ 759 action: null, 760 contact: null, 761 currency: UserCatalogue.inst.currency, 762 dependentItems: {}, 763 name: null, 764 paymentRef: null, 765 paymentSelections: null, 766 paymentType: upgrade_pricing.generalPaymentType, 767 periodMonths: 0,
768 productCode: _this6.code, 769 productOptionSelections: null, 770 quotedPriceFull: quote.quotedPriceFull, 771 quotedVAT: quote.quotedVAT, 772 service: for_service, 773 serviceConfiguration: null, 774 upgradeFromProductCode: from_product.code 775 })); 776 } 777 }, _callee3); 778 })(); 779 }); 780 function upgradeBasketItem(_x, _x2) { 781 return _upgradeBasketItem.apply(this, arguments); 782 } 783 return upgradeBasketItem; 784 }()) 785 }, { 786 key: "toJSON", 787 value: function toJSON() { 788 return { 789 discontinued: this.discontinued, 790 hidden: this.hidden, 791 forUser: this.forUser, 792 label: this.label, 793 location: this.location, 794 pricing: this.pricing, 795 emailTemplate: this.emailTemplate, 796 affiliateCommission: this.affiliateCommission 797 }; 798 } 799 }, { 800 key: "toJSONBulk", 801 value: function toJSONBulk() { 802 return { 803 code: this.code, 804 discontinued: this.discontinued, 805 hidden: this.hidden, 806 forUser: this.forUser, 807 label: this.label, 808 location: this.location, 809 emailTemplate: this.emailTemplate, 810 affiliateCommission: this.affiliateCommission, 811 pricing: this.pricing.filter(function (p) { 812 return p.price !== null; 813 }) 814 }; 815 } 816 }], [{ 817 key: "prefix", 818 get: function get() { 819 throw new Error("Not implemented"); 820 } 821 }]); 822}(NetworkPropertySet); 823var SBNonTransferProduct = function (_SBGeneralProduct) { 824 function SBNonTransferProduct() { 825 _classCallCheck(this, SBNonTransferProduct); 826 return _callSuper(this, SBNonTransferProduct, arguments); 827 } 828 _inherits(SBNonTransferProduct, _SBGeneralProduct); 829 return _createClass(SBNonTransferProduct, [{ 830 key: "defaultAbstractPaymentType", 831 get: function get() { 832 return "any"; 833 } 834 }, { 835 key: "defaultPricing", 836 get: function get() { 837 return [new SBProductPricing({ 838 action: null, 839 isManaged: false, 840 managedMarkup: 0, 841 managedMarkupType: null, 842 managedMarkedUpPrice: null, 843 periodMonths: null, 844 paymentType: this.defaultAbstractPaymentType, 845 price: null 846 })]; 847 } 848 }, { 849 key: "directAddToCartLinks", 850 get: function get() { 851 var out = {}; 852 var _iterator2 = _createForOfIteratorHelper(this.savedPricing), 853 _step2; 854 try { 855 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 856 var p = _step2.value; 857 if (p.paymentType == "any") { 858 var j = { 859 m: p.periodMonths, 860 c: this.code 861 }; 862 out[p.periodMonths] = btoa(JSON.stringify(j)); 863 } 864 } 865 } catch (err) { 866 _iterator2.e(err); 867 } finally { 868 _iterator2.f(); 869 } 870 return out; 871 } 872 }, { 873 key: "price", 874 get: function get() { 875 var p = this.pricing.find(function (p) { 876 return !p.action; 877 }); 878 return p ? p.price : null; 879 }, 880 set: function set(v) { 881 var p = this.pricing.find(function (p) { 882 return !p.action; 883 }); 884 if (p) { 885 p.price = v; 886 } else { 887 this.pricing.push(new SBProductPricing({ 888 action: null, 889 isManaged: false, 890 periodMonths: 12, 891 paymentType: this.defaultAbstractPaymentType, 892 price: v 893 })); 894 } 895 } 896 }, { 897 key: "savedPricing", 898 get: function get() { 899 return this.pricing.filter(function (p) { 900 return !p.isNew; 901 }); 902 } 903 }]); 904}(SBGeneralProduct); 905"use strict"; 906var SBBalanceProduct = function (_SBNonTransferProduct) { 907 function SBBalanceProduct() { 908 _classCallCheck(this, SBBalanceProduct); 909 return _callSuper(this, SBBalanceProduct, arguments); 910 } 911 _inherits(SBBalanceProduct, _SBNonTransferProduct); 912 return _createClass(SBBalanceProduct, [{ 913 key: "codePrefix", 914 get: function get() { 915 return "balance"; 916 } 917 }, { 918 key: "defaultAbstractPaymentType", 919 get: function get() { 920 return "any"; 921 } 922 }], [{ 923 key: "prefix", 924 get: function get() { 925 return "balance"; 926 } 927 }]); 928}(SBNonTransferProduct);
929SBProduct.register([SBBalanceProduct]); 930"use strict"; 931var SBCloudTimelineProduct = function (_SBNonTransferProduct2) { 932 function SBCloudTimelineProduct() { 933 _classCallCheck(this, SBCloudTimelineProduct); 934 return _callSuper(this, SBCloudTimelineProduct, arguments); 935 } 936 _inherits(SBCloudTimelineProduct, _SBNonTransferProduct2); 937 return _createClass(SBCloudTimelineProduct, [{ 938 key: "defaultAbstractPaymentType", 939 get: function get() { 940 return "any"; 941 } 942 }, { 943 key: "codePrefix", 944 get: function get() { 945 return "cloud_timeline"; 946 } 947 }, { 948 key: "typeRef", 949 get: function get() { 950 return this.codeComponents[0]; 951 } 952 }, { 953 key: "basketItem", 954 value: (function () { 955 var _basketItem2 = _asyncToGenerator(function () { 956 var _this7 = this; 957 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 958 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 959 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 960 var serviceConfiguration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 961 return _regenerator().m(function _callee4() { 962 var item; 963 return _regenerator().w(function (_context4) { 964 while (1) switch (_context4.n) { 965 case 0: 966 if (serviceConfiguration) { 967 _context4.n = 1; 968 break; 969 } 970 throw new Error("Cloud Timeline requires the config for a basket item"); 971 case 1: 972 if (!name) { 973 name = "".concat(_this7.label); 974 } 975 item = {}; 976 item.name = name; 977 item.periodMonths = 1; 978 item.basket_pricing = 1; 979 item.serviceConfiguration = serviceConfiguration; 980 return _context4.a(2, item); 981 } 982 }, _callee4); 983 })(); 984 }); 985 function basketItem() { 986 return _basketItem2.apply(this, arguments); 987 } 988 return basketItem; 989 }()) 990 }], [{ 991 key: "prefix", 992 get: function get() { 993 return "cloud_timeline"; 994 } 995 }]); 996}(SBNonTransferProduct); 997SBProduct.register([SBCloudTimelineProduct]); 998"use strict"; 999var SBCustomProduct = function (_SBNonTransferProduct3) { 1000 function SBCustomProduct() { 1001 _classCallCheck(this, SBCustomProduct); 1002 return _callSuper(this, SBCustomProduct, arguments); 1003 } 1004 _inherits(SBCustomProduct, _SBNonTransferProduct3); 1005 return _createClass(SBCustomProduct, [{ 1006 key: "codePrefix", 1007 get: function get() { 1008 return "custom"; 1009 } 1010 }, { 1011 key: "defaultAbstractPaymentType", 1012 get: function get() { 1013 return "any"; 1014 } 1015 }], [{ 1016 key: "prefix", 1017 get: function get() { 1018 return "custom"; 1019 } 1020 }]); 1021}(SBNonTransferProduct); 1022SBProduct.register([SBCustomProduct]); 1023"use strict"; 1024var SBCustomLimitAddonProduct = function (_SBNonTransferProduct4) { 1025 function SBCustomLimitAddonProduct() { 1026 _classCallCheck(this, SBCustomLimitAddonProduct); 1027 return _callSuper(this, SBCustomLimitAddonProduct, arguments); 1028 } 1029 _inherits(SBCustomLimitAddonProduct, _SBNonTransferProduct4); 1030 return _createClass(SBCustomLimitAddonProduct, [{ 1031 key: "basketItem", 1032 value: (function () { 1033 var _basketItem3 = _asyncToGenerator(function () { 1034 var _this8 = this; 1035 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1036 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 1037 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 1038 var serviceConfiguration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 1039 return _regenerator().m(function _callee5() { 1040 var item; 1041 return _regenerator().w(function (_context5) { 1042 while (1) switch (_context5.n) { 1043 case 0: 1044 if (serviceConfiguration) { 1045 _context5.n = 1; 1046 break; 1047 } 1048 throw new Error("Custom Limit addon requires config for a basket item"); 1049 case 1: 1050 if (!name) { 1051 name = serviceConfiguration.domain; 1052 } 1053 _context5.n = 2; 1054 return _superPropGet(SBCustomLimitAddonProduct, "basketItem", _this8, 3)([pricing]); 1055 case 2: 1056 item = _context5.v; 1057 item.name = name; 1058 item.periodMonths = item.periodMonths * multiple; 1059 item.quotedPriceFull = Math.round(item.quotedPriceFull * 100 * multiple) / 100; 1060 if (item.quotedVAT) { 1061 item.quotedVAT = Math.round(item.quotedVAT * 100 * multiple) / 100; 1062 } 1063 if (serviceConfiguration) { 1064 item.serviceConfiguration = serviceConfiguration; 1065 } 1066 return _context5.a(2, item); 1067 } 1068 }, _callee5); 1069 })(); 1070 }); 1071 function basketItem() { 1072 return _basketItem3.apply(this, arguments); 1073 } 1074 return basketItem; 1075 }()) 1076 }, { 1077 key: "typeRef", 1078 get: function get() {
1079 return this.codeComponents[0]; 1080 } 1081 }, { 1082 key: "codePrefix", 1083 get: function get() { 1084 return "custom_limit_addon"; 1085 } 1086 }, { 1087 key: "defaultAbstractPaymentType", 1088 get: function get() { 1089 return "any"; 1090 } 1091 }, { 1092 key: "defaultPricing", 1093 get: function get() { 1094 return StackBillingProduct.defaultPricingFor(this); 1095 } 1096 }], [{ 1097 key: "prefix", 1098 get: function get() { 1099 return "custom_limit_addon"; 1100 } 1101 }]); 1102}(SBNonTransferProduct); 1103SBProduct.register([SBCustomLimitAddonProduct]); 1104"use strict"; 1105var SBDomainPrivacyProduct = function (_SBNonTransferProduct5) { 1106 function SBDomainPrivacyProduct() { 1107 var _this9; 1108 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1109 _classCallCheck(this, SBDomainPrivacyProduct); 1110 _this9 = _callSuper(this, SBDomainPrivacyProduct, [p]); 1111 _this9.codeComponents = ["domain_privacy"]; 1112 return _this9; 1113 } 1114 _inherits(SBDomainPrivacyProduct, _SBNonTransferProduct5); 1115 return _createClass(SBDomainPrivacyProduct, [{ 1116 key: "codePrefix", 1117 get: function get() { 1118 return "domain_privacy"; 1119 } 1120 }, { 1121 key: "defaultAbstractPaymentType", 1122 get: function get() { 1123 return "any"; 1124 } 1125 }, { 1126 key: "defaultPricing", 1127 get: function get() { 1128 return [new SBProductPricing({ 1129 action: null, 1130 isManaged: false, 1131 periodMonths: 12, 1132 paymentType: "any", 1133 price: null 1134 })]; 1135 } 1136 }, { 1137 key: "typeRef", 1138 get: function get() { 1139 return this.codeComponents[0]; 1140 } 1141 }, { 1142 key: "basketItemFor", 1143 value: (function () { 1144 var _basketItemFor = _asyncToGenerator(_regenerator().m(function _callee6(identity, service_ref) { 1145 var bi, expiry_date, whois_equivalent_data, quantity_needed, paid_expiry, _t16; 1146 return _regenerator().w(function (_context6) { 1147 while (1) switch (_context6.p = _context6.n) { 1148 case 0: 1149 _context6.n = 1; 1150 return this.basketItem(); 1151 case 1: 1152 bi = _context6.v; 1153 bi.name = identity; 1154 _context6.p = 2; 1155 _context6.n = 3; 1156 return $.ajax("/a/whoisEquivalentData/".concat(identity)); 1157 case 3: 1158 whois_equivalent_data = _context6.v; 1159 if (whois_equivalent_data) { 1160 _context6.n = 4; 1161 break; 1162 } 1163 throw new Error("No info found"); 1164 case 4: 1165 if (!(whois_equivalent_data.registrar == "tucows")) { 1166 _context6.n = 5; 1167 break; 1168 } 1169 expiry_date = new Date(whois_equivalent_data.expiryDate); 1170 if (expiry_date) { 1171 _context6.n = 5; 1172 break; 1173 } 1174 throw new Error("Could not check expiry date"); 1175 case 5: 1176 _context6.n = 7; 1177 break; 1178 case 6: 1179 _context6.p = 6; 1180 _t16 = _context6.v; 1181 console.log("WHOIS-equivalent check failed"); 1182 throw new Error("Could not check domain"); 1183 case 7: 1184 for (quantity_needed = 1, paid_expiry = new Date(+new Date() + 86400 * 183 * 1000); paid_expiry <= expiry_date; paid_expiry.setFullYear(paid_expiry.getFullYear() + 1), quantity_needed++); 1185 bi.periodMonths = 12 * quantity_needed; 1186 bi.quotedPriceFull = Math.round(bi.quotedPriceFull * quantity_needed * 100) / 100; 1187 bi.quotedVAT = Math.round(bi.quotedVAT * quantity_needed * 100) / 100; 1188 bi.serviceConfiguration = { 1189 parentService: service_ref, 1190 target: { 1191 expiry_date: expiry_date.toISOString() 1192 } 1193 }; 1194 return _context6.a(2, bi); 1195 } 1196 }, _callee6, this, [[2, 6]]); 1197 })); 1198 function basketItemFor(_x3, _x4) { 1199 return _basketItemFor.apply(this, arguments); 1200 } 1201 return basketItemFor; 1202 }()) 1203 }, { 1204 key: "basketItemForNewDomain", 1205 value: (function () { 1206 var _basketItemForNewDomain = _asyncToGenerator(_regenerator().m(function _callee7(identity) { 1207 var pricing, bi; 1208 return _regenerator().w(function (_context7) { 1209 while (1) switch (_context7.n) { 1210 case 0: 1211 pricing = this.pricingForNewDomain(); 1212 if (pricing) { 1213 _context7.n = 1; 1214 break; 1215 } 1216 throw new Error("No 12 month pricing for domain privacy"); 1217 case 1: 1218 _context7.n = 2; 1219 return this.basketItem(pricing); 1220 case 2: 1221 bi = _context7.v; 1222 bi.name = identity; 1223 return _context7.a(2, bi); 1224 } 1225 }, _callee7, this); 1226 })); 1227 function basketItemForNewDomain(_x5) { 1228 return _basketItemForNewDomain.apply(this, arguments); 1229 } 1230 return basketItemForNewDomain; 1231 }()) 1232 }, { 1233 key: "pricingForNewDomain", 1234 value: function pricingForNewDomain() { 1235 return this.pricingForGeneral("any", 12) || this.pricing.find(function (p) {
1236 return p.periodMonths == 12 && p.action === null && p.price !== null; 1237 }) || null; 1238 } 1239 }], [{ 1240 key: "prefix", 1241 get: function get() { 1242 return "domain_privacy"; 1243 } 1244 }]); 1245}(SBNonTransferProduct); 1246SBProduct.register([SBDomainPrivacyProduct]); 1247"use strict"; 1248var SBTLSCertificateProduct = function (_SBNonTransferProduct6) { 1249 function SBTLSCertificateProduct() { 1250 _classCallCheck(this, SBTLSCertificateProduct); 1251 return _callSuper(this, SBTLSCertificateProduct, arguments); 1252 } 1253 _inherits(SBTLSCertificateProduct, _SBNonTransferProduct6); 1254 return _createClass(SBTLSCertificateProduct, [{ 1255 key: "defaultAbstractPaymentType", 1256 get: function get() { 1257 return "any"; 1258 } 1259 }, { 1260 key: "codePrefix", 1261 get: function get() { 1262 return "tls_certificate"; 1263 } 1264 }, { 1265 key: "typeRef", 1266 get: function get() { 1267 return this.codeComponents[0]; 1268 } 1269 }, { 1270 key: "basketItem", 1271 value: (function () { 1272 var _basketItem4 = _asyncToGenerator(function () { 1273 var _this0 = this; 1274 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1275 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 1276 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 1277 var serviceConfiguration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 1278 return _regenerator().m(function _callee8() { 1279 var item; 1280 return _regenerator().w(function (_context8) { 1281 while (1) switch (_context8.n) { 1282 case 0: 1283 if (serviceConfiguration) { 1284 _context8.n = 1; 1285 break; 1286 } 1287 throw new Error("TLS/SSL requires the config for a basket item"); 1288 case 1: 1289 if (!name) { 1290 name = "".concat(_this0.label, " (").concat(serviceConfiguration.domain, ")"); 1291 } 1292 _context8.n = 2; 1293 return _superPropGet(SBTLSCertificateProduct, "basketItem", _this0, 3)([pricing]); 1294 case 2: 1295 item = _context8.v; 1296 item.name = name; 1297 item.periodMonths = item.periodMonths * multiple; 1298 item.quotedPriceFull = Math.round(item.quotedPriceFull * 100 * multiple) / 100; 1299 if (item.quotedVAT) { 1300 item.quotedVAT = Math.round(item.quotedVAT * 100 * multiple) / 100; 1301 } 1302 if (serviceConfiguration) { 1303 item.serviceConfiguration = serviceConfiguration; 1304 } 1305 return _context8.a(2, item); 1306 } 1307 }, _callee8); 1308 })(); 1309 }); 1310 function basketItem() { 1311 return _basketItem4.apply(this, arguments); 1312 } 1313 return basketItem; 1314 }()) 1315 }], [{ 1316 key: "prefix", 1317 get: function get() { 1318 return "tls_certificate"; 1319 } 1320 }]); 1321}(SBNonTransferProduct); 1322SBProduct.register([SBTLSCertificateProduct]); 1323"use strict"; 1324var SBVPSBackupProduct = function (_SBNonTransferProduct7) { 1325 function SBVPSBackupProduct() { 1326 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1327 _classCallCheck(this, SBVPSBackupProduct); 1328 return _callSuper(this, SBVPSBackupProduct, [p]); 1329 } 1330 _inherits(SBVPSBackupProduct, _SBNonTransferProduct7); 1331 return _createClass(SBVPSBackupProduct, [{ 1332 key: "codePrefix", 1333 get: function get() { 1334 return "vps_backup"; 1335 } 1336 }, { 1337 key: "defaultAbstractPaymentType", 1338 get: function get() { 1339 return "any"; 1340 } 1341 }, { 1342 key: "groupName", 1343 get: function get() { 1344 return this.label.replace(/ .*/, ""); 1345 } 1346 }, { 1347 key: "typeRef", 1348 get: function get() { 1349 return this.codeComponents[0]; 1350 } 1351 }], [{ 1352 key: "prefix", 1353 get: function get() { 1354 return "vps_backup"; 1355 } 1356 }]); 1357}(SBNonTransferProduct); 1358SBProduct.register([SBVPSBackupProduct]); 1359"use strict"; 1360var SBVPSOSProduct = function (_SBNonTransferProduct8) { 1361 function SBVPSOSProduct() { 1362 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1363 _classCallCheck(this, SBVPSOSProduct); 1364 return _callSuper(this, SBVPSOSProduct, [p]); 1365 } 1366 _inherits(SBVPSOSProduct, _SBNonTransferProduct8); 1367 return _createClass(SBVPSOSProduct, [{ 1368 key: "codePrefix", 1369 get: function get() { 1370 return "vps_os"; 1371 } 1372 }, { 1373 key: "defaultAbstractPaymentType", 1374 get: function get() { 1375 return "any"; 1376 } 1377 }, { 1378 key: "groupName", 1379 get: function get() { 1380 return this.label.replace(/ .*/, ""); 1381 } 1382 }, { 1383 key: "typeRef", 1384 get: function get() {
1385 return this.codeComponents[0]; 1386 } 1387 }, { 1388 key: "mayRebuildFrom", 1389 value: function mayRebuildFrom(other_option) { 1390 if (other_option instanceof SBVPSOSProduct) { 1391 var other_pricing_signatures = {}; 1392 other_option.pricing.forEach(function (p) { 1393 return other_pricing_signatures[JSON.stringify(p)] = true; 1394 }); 1395 return this.pricing.some(function (p) { 1396 return other_pricing_signatures[JSON.stringify(p)]; 1397 }); 1398 } else { 1399 return false; 1400 } 1401 } 1402 }, { 1403 key: "supportsApp", 1404 value: function supportsApp(app_code) { 1405 return this.typeRef == "rhel6"; 1406 } 1407 }], [{ 1408 key: "prefix", 1409 get: function get() { 1410 return "vps_os"; 1411 } 1412 }]); 1413}(SBNonTransferProduct); 1414var SBVPSFreeOS = function () { 1415 function SBVPSFreeOS(type_ref, label) { 1416 _classCallCheck(this, SBVPSFreeOS); 1417 this.typeRef = type_ref; 1418 this.label = label; 1419 } 1420 return _createClass(SBVPSFreeOS, [{ 1421 key: "groupName", 1422 get: function get() { 1423 return this.label.replace(/ .*/, ""); 1424 } 1425 }, { 1426 key: "lowestPrice", 1427 get: function get() { 1428 return new SBProductPricing({ 1429 action: null, 1430 isManaged: false, 1431 paymentType: "any", 1432 periodMonths: 1, 1433 price: 0 1434 }, false); 1435 } 1436 }, { 1437 key: "initialPriceFor", 1438 value: function initialPriceFor(payment_type, months) { 1439 return 0; 1440 } 1441 }, { 1442 key: "initialPriceForGeneral", 1443 value: function initialPriceForGeneral(general_payment_type, months) { 1444 return 0; 1445 } 1446 }, { 1447 key: "mayRebuildFrom", 1448 value: function mayRebuildFrom(other_option) { 1449 return other_option instanceof SBVPSFreeOS; 1450 } 1451 }, { 1452 key: "pricingSupportsMonths", 1453 value: function pricingSupportsMonths(months) { 1454 return true; 1455 } 1456 }, { 1457 key: "pricingSupportsRealType", 1458 value: function pricingSupportsRealType(payment_type) { 1459 return true; 1460 } 1461 }, { 1462 key: "supportsApp", 1463 value: function supportsApp(app_code) { 1464 return this.typeRef == "rhel6"; 1465 } 1466 }]); 1467}(); 1468SBProduct.register([SBVPSOSProduct]); 1469"use strict"; 1470var SBBespokeProduct = function (_SBNonTransferProduct9) { 1471 function SBBespokeProduct() { 1472 var _this1; 1473 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1474 _classCallCheck(this, SBBespokeProduct); 1475 _this1 = _callSuper(this, SBBespokeProduct, [p]); 1476 _this1.specifics = null; 1477 return _this1; 1478 } 1479 _inherits(SBBespokeProduct, _SBNonTransferProduct9); 1480 return _createClass(SBBespokeProduct, [{ 1481 key: "labels", 1482 get: function get() { 1483 try { 1484 var labels = JSON.parse(this._label); 1485 return labels; 1486 } catch (e) { 1487 return null; 1488 } 1489 } 1490 }, { 1491 key: "labelRaw", 1492 get: function get() { 1493 return this._label; 1494 } 1495 }, { 1496 key: "codePrefix", 1497 get: function get() { 1498 return "bespoke"; 1499 } 1500 }, { 1501 key: "defaultAbstractPaymentType", 1502 get: function get() { 1503 return "any"; 1504 } 1505 }, { 1506 key: "networkPropertyHandlers", 1507 get: function get() { 1508 var _this10 = this; 1509 return { 1510 imageDataUrl: function imageDataUrl() { 1511 return $.ajax("/a/catalogue/productImage/".concat(_this10.code)); 1512 }, 1513 specifics: function specifics() { 1514 return $.ajax("/n/catalogue/product/".concat(_this10.code, "/specifics")).done(function (s) { 1515 return s; 1516 }); 1517 } 1518 }; 1519 } 1520 }], [{ 1521 key: "prefix", 1522 get: function get() { 1523 return "bespoke"; 1524 } 1525 }]); 1526}(SBNonTransferProduct); 1527SBProduct.register([SBBespokeProduct]); 1528"use strict"; 1529var SBCloudBandwidthProduct = function (_SBNonTransferProduct0) { 1530 function SBCloudBandwidthProduct() { 1531 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1532 _classCallCheck(this, SBCloudBandwidthProduct); 1533 return _callSuper(this, SBCloudBandwidthProduct, [p]); 1534 } 1535 _inherits(SBCloudBandwidthProduct, _SBNonTransferProduct0); 1536 return _createClass(SBCloudBandwidthProduct, [{ 1537 key: "codePrefix", 1538 get: function get() { 1539 return "cloud_bandwidth"; 1540 } 1541 }, { 1542 key: "defaultAbstractPaymentType", 1543 get: function get() { 1544 return "any"; 1545 } 1546 }, { 1547 key: "networkPropertyHandlers", 1548 get: function get() { 1549 var _this11 = this; 1550 return { 1551 imageDataUrl: function imageDataUrl() { 1552 return $.ajax("/a/catalogue/productImage/".concat(_this11.code)); 1553 } 1554 }; 1555 } 1556 }], [{ 1557 key: "prefix", 1558 get: function get() { 1559 return "cloud_bandwidth"; 1560 } 1561 }]); 1562}(SBNonTransferProduct); 1563SBProduct.register([SBCloudBandwidthProduct]); 1564"use strict";
1565var SBCloudServerProduct = function (_SBNonTransferProduct1) { 1566 function SBCloudServerProduct() { 1567 var _this12; 1568 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1569 _classCallCheck(this, SBCloudServerProduct); 1570 _this12 = _callSuper(this, SBCloudServerProduct, [p]); 1571 _this12.provisioningInfo = null; 1572 _this12.vpsOSOptions = null; 1573 return _this12; 1574 } 1575 _inherits(SBCloudServerProduct, _SBNonTransferProduct1); 1576 return _createClass(SBCloudServerProduct, [{ 1577 key: "networkPropertyHandlers", 1578 get: function get() { 1579 var _this13 = this; 1580 return { 1581 imageDataUrl: function imageDataUrl() { 1582 return $.ajax("/a/catalogue/productImage/".concat(_this13.code)); 1583 }, 1584 cores: function cores() { 1585 return _this13.preloadSingle("provisioningInfo").then(function (i) { 1586 return i.CpuCores; 1587 }); 1588 }, 1589 disc: function disc() { 1590 return _this13.preloadSingle("provisioningInfo").then(function (i) { 1591 return i.OsDiskSizeGb * Math.pow(2, 30); 1592 }); 1593 }, 1594 provisioningInfo: function provisioningInfo() { 1595 return $.ajax("/n/catalogue/product/".concat(_this13.code, "/provisioningInfo")); 1596 }, 1597 ram: function ram() { 1598 return _this13.preloadSingle("provisioningInfo").then(function (i) { 1599 return i.RamMb * Math.pow(2, 20); 1600 }); 1601 }, 1602 vpsOSOptions: function vpsOSOptions() { 1603 return $.ajax("/n/catalogue/product/".concat(_this13.code, "/vpsOSOptions")); 1604 } 1605 }; 1606 } 1607 }, { 1608 key: "codePrefix", 1609 get: function get() { 1610 return "managed_vps"; 1611 } 1612 }, { 1613 key: "defaultAbstractPaymentType", 1614 get: function get() { 1615 return "any"; 1616 } 1617 }, { 1618 key: "operatingSystems", 1619 get: function get() { 1620 return null; 1621 } 1622 }, { 1623 key: "label", 1624 get: function get() { 1625 var p = this.code.split(":"); 1626 return p[1].toUpperCase() + " " + this._label; 1627 } 1628 }, { 1629 key: "typeRef", 1630 get: function get() { 1631 return this.codeComponents[0]; 1632 } 1633 }], [{ 1634 key: "prefix", 1635 get: function get() { 1636 return "cloud_server"; 1637 } 1638 }]); 1639}(SBNonTransferProduct); 1640SBProduct.register([SBCloudServerProduct]); 1641"use strict"; 1642var SBDomainProduct = function (_SBGeneralProduct2) { 1643 function SBDomainProduct() { 1644 var _this14$registerPrici, _this14$transferPrici; 1645 var _this14; 1646 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1647 _classCallCheck(this, SBDomainProduct); 1648 _this14 = _callSuper(this, SBDomainProduct, [p]); 1649 _this14.pricingHaveChanged = "".concat((_this14$registerPrici = _this14.registerPricing) === null || _this14$registerPrici === void 0 ? void 0 : _this14$registerPrici.managedMarkup).concat((_this14$transferPrici = _this14.transferPricing) === null || _this14$transferPrici === void 0 ? void 0 : _this14$transferPrici.managedMarkup); 1650 return _this14; 1651 } 1652 _inherits(SBDomainProduct, _SBGeneralProduct2); 1653 return _createClass(SBDomainProduct, [{ 1654 key: "codePrefix", 1655 get: function get() { 1656 return "domain"; 1657 } 1658 }, { 1659 key: "defaultPricing", 1660 get: function get() { 1661 return [new SBProductPricing({ 1662 action: null, 1663 isManaged: true, 1664 managedMarkup: 0, 1665 managedMarkupType: null, 1666 managedMarkedUpPrice: null, 1667 periodMonths: 12, 1668 paymentType: "any", 1669 price: null 1670 }), new SBProductPricing({ 1671 action: "transfer", 1672 isManaged: true, 1673 managedMarkup: 0, 1674 managedMarkupType: null, 1675 managedMarkedUpPrice: null, 1676 periodMonths: 12, 1677 paymentType: "any", 1678 price: null 1679 })]; 1680 } 1681 }, { 1682 key: "offerTransfer", 1683 get: function get() { 1684 return this.transferPrice !== null; 1685 } 1686 }, { 1687 key: "pricing", 1688 get: function get() { 1689 return this._pricing; 1690 }, 1691 set: function set(v) { 1692 var _this$registerPricing, _this$transferPricing; 1693 this._pricing = v; 1694 this.pricingHaveChanged = "".concat((_this$registerPricing = this.registerPricing) === null || _this$registerPricing === void 0 ? void 0 : _this$registerPricing.managedMarkup).concat((_this$transferPricing = this.transferPricing) === null || _this$transferPricing === void 0 ? void 0 : _this$transferPricing.managedMarkup); 1695 } 1696 }, { 1697 key: "registerPrice", 1698 get: function get() { 1699 return this.registerPricing ? this.registerPricing.price : null; 1700 }, 1701 set: function set(v) { 1702 if (this.registerPricing) { 1703 this.registerPricing.price = v; 1704 } else { 1705 this.pricing.push(new SBProductPricing({ 1706 action: null, 1707 isManaged: false, 1708 managedMarkup: 0, 1709 managedMarkupType: null, 1710 managedMarkedUpPrice: null, 1711 periodMonths: 12, 1712 paymentType: "any", 1713 price: v 1714 })); 1715 } 1716 } 1717 }, { 1718 key: "registerPricing", 1719 get: function get() { 1720 return this.pricing.find(function (p) { 1721 return !p.action; 1722 }); 1723 } 1724 }, { 1725 key: "tld", 1726 get: function get() {
1727 return this.codeComponents[0]; 1728 } 1729 }, { 1730 key: "transferPrice", 1731 get: function get() { 1732 return this.transferPricing ? this.transferPricing.price : null; 1733 }, 1734 set: function set(v) { 1735 if (this.transferPricing) { 1736 this.transferPricing.price = v; 1737 } else { 1738 this.pricing.push(new SBProductPricing({ 1739 action: "transfer", 1740 isManaged: false, 1741 managedMarkup: 0, 1742 managedMarkupType: null, 1743 managedMarkedUpPrice: null, 1744 periodMonths: 12, 1745 paymentType: "any", 1746 price: v 1747 })); 1748 } 1749 } 1750 }, { 1751 key: "transferPricing", 1752 get: function get() { 1753 if (!this.pricing.some(function (p) { 1754 return p.action == "transfer"; 1755 })) { 1756 this.pricing.push(new SBProductPricing({ 1757 action: "transfer", 1758 isManaged: false, 1759 managedMarkup: 0, 1760 managedMarkupType: null, 1761 managedMarkedUpPrice: null, 1762 periodMonths: 12, 1763 paymentType: "any", 1764 price: null 1765 })); 1766 } 1767 return this.pricing.find(function (p) { 1768 return p.action == "transfer"; 1769 }); 1770 } 1771 }, { 1772 key: "hasManagaedMarkupChange", 1773 get: function get() { 1774 var _this$registerPricing2, _this$transferPricing2; 1775 return "".concat((_this$registerPricing2 = this.registerPricing) === null || _this$registerPricing2 === void 0 ? void 0 : _this$registerPricing2.managedMarkup).concat((_this$transferPricing2 = this.transferPricing) === null || _this$transferPricing2 === void 0 ? void 0 : _this$transferPricing2.managedMarkup) != this.pricingHaveChanged; 1776 } 1777 }, { 1778 key: "basketItem", 1779 value: (function () { 1780 var _basketItem5 = _asyncToGenerator(function () { 1781 var _this15 = this; 1782 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1783 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 1784 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 1785 var quoted_price = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 1786 return _regenerator().m(function _callee9() { 1787 var item; 1788 return _regenerator().w(function (_context9) { 1789 while (1) switch (_context9.n) { 1790 case 0: 1791 if (name) { 1792 _context9.n = 1; 1793 break; 1794 } 1795 throw new Error("All domains must have a name"); 1796 case 1: 1797 _context9.n = 2; 1798 return _superPropGet(SBDomainProduct, "basketItem", _this15, 3)([pricing, name, multiple, quoted_price]); 1799 case 2: 1800 item = _context9.v; 1801 item.name = name; 1802 item.basket_pricing = true; 1803 return _context9.a(2, item); 1804 } 1805 }, _callee9); 1806 })(); 1807 }); 1808 function basketItem() { 1809 return _basketItem5.apply(this, arguments); 1810 } 1811 return basketItem; 1812 }()) 1813 }, { 1814 key: "matchesName", 1815 value: function matchesName(name) { 1816 return name.replace(/^[^.]*/, "") == this.tld; 1817 } 1818 }, { 1819 key: "anyPrice", 1820 get: function get() { 1821 var transfer_pricing = this.pricing.find(function (p) { 1822 return p.action == "transfer"; 1823 }); 1824 var regular_pricing = this.pricing.find(function (p) { 1825 return !p.action; 1826 }); 1827 var purchasePrice = regular_pricing.price; 1828 if (regular_pricing.isManaged && regular_pricing.managedMarkedUpPrice) { 1829 purchasePrice = regular_pricing.managedMarkedUpPrice; 1830 } 1831 if (transfer_pricing) { 1832 var transferPrice = transfer_pricing.price; 1833 if (transfer_pricing.isManaged && transfer_pricing.managedMarkedUpPrice) { 1834 transferPrice = transfer_pricing.managedMarkedUpPrice; 1835 } 1836 return { 1837 purchase: purchasePrice, 1838 transfer: transferPrice 1839 }; 1840 } else { 1841 return { 1842 purchase: purchasePrice 1843 }; 1844 } 1845 } 1846 }, { 1847 key: "priceForYears", 1848 value: function priceForYears(year) { 1849 var discovered_price = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 1850 var domainDiscount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 1851 var total = 0; 1852 for (var i = 1; i <= year; i++) { 1853 var _domainDiscount; 1854 total += +((_domainDiscount = domainDiscount === null || domainDiscount === void 0 ? void 0 : domainDiscount[i * 12]) !== null && _domainDiscount !== void 0 ? _domainDiscount : discovered_price || this.anyPrice.purchase); 1855 } 1856 return Math.round(+total * 100) / 100; 1857 } 1858 }], [{ 1859 key: "prefix", 1860 get: function get() { 1861 return "domain"; 1862 } 1863 }]); 1864}(SBGeneralProduct); 1865SBProduct.register([SBDomainProduct]); 1866"use strict";
1867var SBManagedVPSProduct = function (_SBNonTransferProduct10) { 1868 function SBManagedVPSProduct() { 1869 var _this16; 1870 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1871 _classCallCheck(this, SBManagedVPSProduct); 1872 _this16 = _callSuper(this, SBManagedVPSProduct, [p]); 1873 _this16.provisioningInfo = null; 1874 _this16.vpsOSOptions = null; 1875 return _this16; 1876 } 1877 _inherits(SBManagedVPSProduct, _SBNonTransferProduct10); 1878 return _createClass(SBManagedVPSProduct, [{ 1879 key: "networkPropertyHandlers", 1880 get: function get() { 1881 var _this17 = this; 1882 return { 1883 imageDataUrl: function imageDataUrl() { 1884 return $.ajax("/a/catalogue/productImage/".concat(_this17.code)); 1885 }, 1886 cores: function cores() { 1887 return _this17.preloadSingle("provisioningInfo").then(function (i) { 1888 return i.CpuCores; 1889 }); 1890 }, 1891 disc: function disc() { 1892 return _this17.preloadSingle("provisioningInfo").then(function (i) { 1893 return i.OsDiskSizeGb * Math.pow(2, 30); 1894 }); 1895 }, 1896 provisioningInfo: function provisioningInfo() { 1897 return $.ajax("/n/catalogue/product/".concat(_this17.code, "/provisioningInfo")); 1898 }, 1899 ram: function ram() { 1900 return _this17.preloadSingle("provisioningInfo").then(function (i) { 1901 return i.RamMb * Math.pow(2, 20); 1902 }); 1903 }, 1904 vpsOSOptions: function vpsOSOptions() { 1905 return $.ajax("/n/catalogue/product/".concat(_this17.code, "/vpsOSOptions")); 1906 } 1907 }; 1908 } 1909 }, { 1910 key: "codePrefix", 1911 get: function get() { 1912 return "managed_vps"; 1913 } 1914 }, { 1915 key: "defaultAbstractPaymentType", 1916 get: function get() { 1917 return "any"; 1918 } 1919 }, { 1920 key: "operatingSystems", 1921 get: function get() { 1922 return null; 1923 } 1924 }, { 1925 key: "typeRef", 1926 get: function get() { 1927 return this.codeComponents[0]; 1928 } 1929 }], [{ 1930 key: "prefix", 1931 get: function get() { 1932 return "managed_vps"; 1933 } 1934 }]); 1935}(SBNonTransferProduct); 1936SBProduct.register([SBManagedVPSProduct]); 1937"use strict"; 1938var SBHostingProduct = function (_SBNonTransferProduct11) { 1939 function SBHostingProduct() { 1940 var _this18; 1941 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 1942 _classCallCheck(this, SBHostingProduct); 1943 _this18 = _callSuper(this, SBHostingProduct, [p]); 1944 _this18.limits = null; 1945 _this18.platform = null; 1946 _this18.provisioningInfo = null; 1947 return _this18; 1948 } 1949 _inherits(SBHostingProduct, _SBNonTransferProduct11); 1950 return _createClass(SBHostingProduct, [{ 1951 key: "codePrefix", 1952 get: function get() { 1953 return "package"; 1954 } 1955 }, { 1956 key: "defaultAbstractPaymentType", 1957 get: function get() { 1958 return "any"; 1959 } 1960 }, { 1961 key: "networkPropertyHandlers", 1962 get: function get() { 1963 var _this19 = this; 1964 return { 1965 imageDataUrl: function imageDataUrl() { 1966 return $.ajax("/a/catalogue/productImage/".concat(_this19.code)); 1967 }, 1968 limits: function () { 1969 var _limits = _asyncToGenerator(_regenerator().m(function _callee0() { 1970 return _regenerator().w(function (_context0) { 1971 while (1) switch (_context0.n) { 1972 case 0: 1973 _context0.n = 1; 1974 return _this19.preloadSingle("provisioningInfo"); 1975 case 1: 1976 return _context0.a(2, _context0.v.limits); 1977 } 1978 }, _callee0); 1979 })); 1980 function limits() { 1981 return _limits.apply(this, arguments); 1982 } 1983 return limits; 1984 }(), 1985 platform: function () { 1986 var _platform = _asyncToGenerator(_regenerator().m(function _callee1() { 1987 return _regenerator().w(function (_context1) { 1988 while (1) switch (_context1.n) { 1989 case 0: 1990 _context1.n = 1; 1991 return _this19.preloadSingle("provisioningInfo"); 1992 case 1: 1993 return _context1.a(2, _context1.v.platform); 1994 } 1995 }, _callee1); 1996 })); 1997 function platform() { 1998 return _platform.apply(this, arguments); 1999 } 2000 return platform; 2001 }(), 2002 provisioningInfo: function provisioningInfo() { 2003 return $.ajax("/n/catalogue/product/".concat(_this19.code, "/provisioningInfo")).done(function (pi) { 2004 if (pi.platform == 'wordpress') { 2005 pi.limits.mysqlDatabases = 1; 2006 } 2007 return pi; 2008 }); 2009 } 2010 }; 2011 } 2012 }, { 2013 key: "typeRef", 2014 get: function get() {
2015 return this.codeComponents[0]; 2016 } 2017 }, { 2018 key: "basketItem", 2019 value: (function () { 2020 var _basketItem6 = _asyncToGenerator(function () { 2021 var _this20 = this; 2022 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 2023 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2024 return _regenerator().m(function _callee10() { 2025 var item; 2026 return _regenerator().w(function (_context10) { 2027 while (1) switch (_context10.n) { 2028 case 0: 2029 _context10.n = 1; 2030 return _superPropGet(SBHostingProduct, "basketItem", _this20, 3)([pricing]); 2031 case 1: 2032 item = _context10.v; 2033 item.name = name; 2034 return _context10.a(2, item); 2035 } 2036 }, _callee10); 2037 })(); 2038 }); 2039 function basketItem() { 2040 return _basketItem6.apply(this, arguments); 2041 } 2042 return basketItem; 2043 }()) 2044 }], [{ 2045 key: "prefix", 2046 get: function get() { 2047 return "package"; 2048 } 2049 }]); 2050}(SBNonTransferProduct); 2051SBProduct.register([SBHostingProduct]); 2052"use strict"; 2053var SBStackUserPackageAllowanceProduct = function (_SBNonTransferProduct12) { 2054 function SBStackUserPackageAllowanceProduct() { 2055 var _this21; 2056 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 2057 _classCallCheck(this, SBStackUserPackageAllowanceProduct); 2058 _this21 = _callSuper(this, SBStackUserPackageAllowanceProduct, [p]); 2059 _this21.limits = null; 2060 _this21.platform = null; 2061 _this21.provisioningInfo = null; 2062 return _this21; 2063 } 2064 _inherits(SBStackUserPackageAllowanceProduct, _SBNonTransferProduct12); 2065 return _createClass(SBStackUserPackageAllowanceProduct, [{ 2066 key: "basketItem", 2067 value: (function () { 2068 var _basketItem7 = _asyncToGenerator(function () { 2069 var _this22 = this; 2070 var pricing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 2071 var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 2072 var multiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 2073 var serviceConfiguration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 2074 return _regenerator().m(function _callee11() { 2075 var item; 2076 return _regenerator().w(function (_context11) { 2077 while (1) switch (_context11.n) { 2078 case 0: 2079 _context11.n = 1; 2080 return _superPropGet(SBStackUserPackageAllowanceProduct, "basketItem", _this22, 3)([pricing]); 2081 case 1: 2082 item = _context11.v; 2083 item.name = name; 2084 item.periodMonths = item.periodMonths * multiple; 2085 item.quotedPriceFull = Math.round(item.quotedPriceFull * 100 * multiple) / 100; 2086 if (item.quotedVAT) { 2087 item.quotedVAT = Math.round(item.quotedVAT * 100 * multiple) / 100; 2088 } 2089 if (serviceConfiguration) { 2090 item.serviceConfiguration = serviceConfiguration; 2091 } 2092 return _context11.a(2, item); 2093 } 2094 }, _callee11); 2095 })(); 2096 }); 2097 function basketItem() { 2098 return _basketItem7.apply(this, arguments); 2099 } 2100 return basketItem; 2101 }()) 2102 }, { 2103 key: "networkPropertyHandlers", 2104 get: function get() { 2105 var _this23 = this; 2106 return { 2107 imageDataUrl: function () { 2108 var _imageDataUrl = _asyncToGenerator(_regenerator().m(function _callee12() { 2109 return _regenerator().w(function (_context12) { 2110 while (1) switch (_context12.n) { 2111 case 0: 2112 if (!_this23.hasImage) { 2113 _context12.n = 2; 2114 break; 2115 } 2116 _context12.n = 1; 2117 return $.ajax("/a/catalogue/productImage/".concat(_this23.code)); 2118 case 1:
2119 return _context12.a(2, _context12.v); 2120 case 2: 2121 return _context12.a(2, null); 2122 case 3: 2123 return _context12.a(2); 2124 } 2125 }, _callee12); 2126 })); 2127 function imageDataUrl() { 2128 return _imageDataUrl.apply(this, arguments); 2129 } 2130 return imageDataUrl; 2131 }(), 2132 limits: function () { 2133 var _limits2 = _asyncToGenerator(_regenerator().m(function _callee13() { 2134 var _yield$_this23$preloa; 2135 var _t17, _t18, _t19; 2136 return _regenerator().w(function (_context13) { 2137 while (1) switch (_context13.n) { 2138 case 0: 2139 _context13.n = 1; 2140 return _this23.preloadSingle("provisioningInfo"); 2141 case 1: 2142 _t18 = _yield$_this23$preloa = _context13.v; 2143 _t17 = _t18 === null; 2144 if (_t17) { 2145 _context13.n = 2; 2146 break; 2147 } 2148 _t17 = _yield$_this23$preloa === void 0; 2149 case 2: 2150 if (!_t17) { 2151 _context13.n = 3; 2152 break; 2153 } 2154 _t19 = void 0; 2155 _context13.n = 4; 2156 break; 2157 case 3: 2158 _t19 = _yield$_this23$preloa.limits; 2159 case 4: 2160 return _context13.a(2, _t19); 2161 } 2162 }, _callee13); 2163 })); 2164 function limits() { 2165 return _limits2.apply(this, arguments); 2166 } 2167 return limits; 2168 }(), 2169 platform: function () { 2170 var _platform2 = _asyncToGenerator(_regenerator().m(function _callee14() { 2171 var _yield$_this23$preloa2; 2172 var _t20, _t21, _t22; 2173 return _regenerator().w(function (_context14) { 2174 while (1) switch (_context14.n) { 2175 case 0: 2176 _context14.n = 1; 2177 return _this23.preloadSingle("provisioningInfo"); 2178 case 1: 2179 _t21 = _yield$_this23$preloa2 = _context14.v; 2180 _t20 = _t21 === null; 2181 if (_t20) { 2182 _context14.n = 2; 2183 break; 2184 } 2185 _t20 = _yield$_this23$preloa2 === void 0; 2186 case 2: 2187 if (!_t20) { 2188 _context14.n = 3; 2189 break; 2190 } 2191 _t22 = void 0; 2192 _context14.n = 4; 2193 break; 2194 case 3: 2195 _t22 = _yield$_this23$preloa2.platform; 2196 case 4: 2197 return _context14.a(2, _t22); 2198 } 2199 }, _callee14); 2200 })); 2201 function platform() { 2202 return _platform2.apply(this, arguments); 2203 } 2204 return platform; 2205 }(), 2206 provisioningInfo: function () { 2207 var _provisioningInfo = _asyncToGenerator(_regenerator().m(function _callee15() { 2208 var pi; 2209 return _regenerator().w(function (_context15) { 2210 while (1) switch (_context15.n) { 2211 case 0: 2212 _context15.n = 1; 2213 return AnyStore.inst.preloadSingle("allPackageAllowanceProductInfo"); 2214 case 1: 2215 pi = AnyStore.inst.allPackageAllowanceProductInfo[_this23.code]; 2216 if (pi && pi.platform == 'wordpress') { 2217 pi.limits.mysqlDatabases = 1; 2218 } 2219 return _context15.a(2, pi); 2220 } 2221 }, _callee15); 2222 })); 2223 function provisioningInfo() { 2224 return _provisioningInfo.apply(this, arguments); 2225 } 2226 return provisioningInfo; 2227 }() 2228 }; 2229 } 2230 }, { 2231 key: "typeRef", 2232 get: function get() { 2233 return this.codeComponents[0]; 2234 } 2235 }, { 2236 key: "codePrefix", 2237 get: function get() { 2238 return "stack_user_package_allowance"; 2239 } 2240 }, { 2241 key: "defaultAbstractPaymentType", 2242 get: function get() { 2243 return "any"; 2244 } 2245 }, { 2246 key: "defaultPricing", 2247 get: function get() { 2248 return StackBillingProduct.defaultPricingFor(this); 2249 } 2250 }], [{ 2251 key: "prefix", 2252 get: function get() { 2253 return "stack_user_package_allowance"; 2254 } 2255 }]); 2256}(SBNonTransferProduct); 2257SBProduct.register([SBStackUserPackageAllowanceProduct]); 2258"use strict";
2259var SBVPSProduct = function (_SBNonTransferProduct13) { 2260 function SBVPSProduct() { 2261 var _this24; 2262 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 2263 _classCallCheck(this, SBVPSProduct); 2264 _this24 = _callSuper(this, SBVPSProduct, [p]); 2265 _this24.provisioningInfo = null; 2266 _this24.vpsOSOptions = null; 2267 return _this24; 2268 } 2269 _inherits(SBVPSProduct, _SBNonTransferProduct13); 2270 return _createClass(SBVPSProduct, [{ 2271 key: "networkPropertyHandlers", 2272 get: function get() { 2273 var _this25 = this; 2274 return { 2275 imageDataUrl: function imageDataUrl() { 2276 return $.ajax("/a/catalogue/productImage/".concat(_this25.code)); 2277 }, 2278 cores: function cores() { 2279 return _this25.preloadSingle("provisioningInfo").then(function (i) { 2280 return i.CpuCores; 2281 }); 2282 }, 2283 disc: function disc() { 2284 return _this25.preloadSingle("provisioningInfo").then(function (i) { 2285 return i.OsDiskSizeGb * Math.pow(2, 30); 2286 }); 2287 }, 2288 provisioningInfo: function provisioningInfo() { 2289 return $.ajax("/n/catalogue/product/".concat(_this25.code, "/provisioningInfo")); 2290 }, 2291 ram: function ram() { 2292 return _this25.preloadSingle("provisioningInfo").then(function (i) { 2293 return i.RamMb * Math.pow(2, 20); 2294 }); 2295 }, 2296 vpsOSOptions: function vpsOSOptions() { 2297 return $.ajax("/n/catalogue/product/".concat(_this25.code, "/vpsOSOptions")); 2298 } 2299 }; 2300 } 2301 }, { 2302 key: "codePrefix", 2303 get: function get() { 2304 return "vps"; 2305 } 2306 }, { 2307 key: "defaultAbstractPaymentType", 2308 get: function get() { 2309 return "any"; 2310 } 2311 }, { 2312 key: "operatingSystems", 2313 get: function get() { 2314 var _this26 = this; 2315 if (!this.vpsOSOptions) return null; 2316 var out = this.vpsOSOptions.free.map(function (o) { 2317 return new SBVPSFreeOS(o.code, o.label); 2318 }); 2319 var _iterator3 = _createForOfIteratorHelper(UserCatalogue.inst.products), 2320 _step3; 2321 try { 2322 var _loop = function _loop() { 2323 var p = _step3.value; 2324 if (p instanceof SBVPSOSProduct) { 2325 var options = _this26.vpsOSOptions.paid.find(function (o) { 2326 return o.code == p.typeRef; 2327 }); 2328 if (options) { 2329 out.push(p); 2330 } 2331 } 2332 }; 2333 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 2334 _loop(); 2335 } 2336 } catch (err) { 2337 _iterator3.e(err); 2338 } finally { 2339 _iterator3.f(); 2340 } 2341 return out; 2342 } 2343 }, { 2344 key: "typeRef", 2345 get: function get() { 2346 return this.codeComponents[0]; 2347 } 2348 }], [{ 2349 key: "prefix", 2350 get: function get() { 2351 return "vps"; 2352 } 2353 }]); 2354}(SBNonTransferProduct); 2355SBProduct.register([SBVPSProduct]); 2356"use strict"; 2357var SBVPSAddonProduct = function (_SBNonTransferProduct14) { 2358 function SBVPSAddonProduct() { 2359 var _this27; 2360 var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 2361 _classCallCheck(this, SBVPSAddonProduct); 2362 _this27 = _callSuper(this, SBVPSAddonProduct, [p]); 2363 _this27.provisioningRequirements = null; 2364 return _this27; 2365 } 2366 _inherits(SBVPSAddonProduct, _SBNonTransferProduct14); 2367 return _createClass(SBVPSAddonProduct, [{ 2368 key: "codePrefix", 2369 get: function get() { 2370 return "vps_addon"; 2371 } 2372 }, { 2373 key: "defaultAbstractPaymentType", 2374 get: function get() { 2375 return "any"; 2376 } 2377 }, { 2378 key: "networkPropertyHandlers", 2379 get: function get() { 2380 var _this28 = this; 2381 return { 2382 imageDataUrl: function imageDataUrl() { 2383 return $.ajax("/a/catalogue/productImage/".concat(_this28.code)); 2384 }, 2385 provisioningRequirements: function provisioningRequirements() { 2386 return $.ajax("/n/catalogue/product/".concat(_this28.code, "/provisioningRequirements")); 2387 } 2388 }; 2389 } 2390 }, { 2391 key: "typeRef", 2392 get: function get() { 2393 return this.codeComponents[0]; 2394 } 2395 }], [{ 2396 key: "prefix", 2397 get: function get() { 2398 return "vps_addon"; 2399 } 2400 }]); 2401}(SBNonTransferProduct); 2402SBProduct.register([SBVPSAddonProduct]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.