Created
September 13, 2018 19:01
-
-
Save jvehent/ab711101b9a84e78568825e0f3a68c9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
array-unique <https://github.com/jonschlinkert/array-unique> | |
Copyright (c) 2014-2015, Jon Schlinkert. | |
Licensed under the MIT License. | |
Bowser - a browser detector | |
https://github.com/ded/bowser | |
MIT License | (c) Dustin Diaz 2015 | |
*/ | |
'use strict'; | |
var recurly = function(e) { | |
/** | |
* @param {number} i | |
* @return {?} | |
*/ | |
function t(i) { | |
if (n[i]) { | |
return n[i].exports; | |
} | |
var module = n[i] = { | |
i : i, | |
l : false, | |
exports : {} | |
}; | |
return e[i].call(module.exports, module, module.exports, t), module.l = true, module.exports; | |
} | |
var n = {}; | |
return t.m = e, t.c = n, t.d = function(d, name, n) { | |
if (!t.o(d, name)) { | |
Object.defineProperty(d, name, { | |
configurable : false, | |
enumerable : true, | |
get : n | |
}); | |
} | |
}, t.n = function(module) { | |
/** @type {function(): ?} */ | |
var n = module && module.__esModule ? function() { | |
return module.default; | |
} : function() { | |
return module; | |
}; | |
return t.d(n, "a", n), n; | |
}, t.o = function(t, object) { | |
return Object.prototype.hasOwnProperty.call(t, object); | |
}, t.p = "/build/", t(t.s = 35); | |
}([function(e, exports, n) { | |
(function(process) { | |
/** | |
* @return {?} | |
*/ | |
function useColors() { | |
return !("undefined" == typeof window || !window.process || "renderer" !== window.process.type) || ("undefined" == typeof navigator || !navigator.userAgent || !navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) && ("undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || | |
"undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); | |
} | |
/** | |
* @param {string} a | |
* @return {undefined} | |
*/ | |
function formatArgs(a) { | |
var useColors = this.useColors; | |
if (a[0] = (useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + a[0] + (useColors ? "%c " : " ") + "+" + exports.humanize(this.diff), useColors) { | |
/** @type {string} */ | |
var c = "color: " + this.color; | |
a.splice(1, 0, c, "color: inherit"); | |
/** @type {number} */ | |
var tObj = 0; | |
/** @type {number} */ | |
var o = 0; | |
a[0].replace(/%[a-zA-Z%]/g, function(canCreateDiscussions) { | |
if ("%%" !== canCreateDiscussions) { | |
tObj++; | |
if ("%c" === canCreateDiscussions) { | |
o = tObj; | |
} | |
} | |
}); | |
a.splice(o, 0, c); | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function logger() { | |
return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); | |
} | |
/** | |
* @param {string} value | |
* @return {undefined} | |
*/ | |
function save(value) { | |
try { | |
if (null == value) { | |
exports.storage.removeItem("debug"); | |
} else { | |
/** @type {string} */ | |
exports.storage.debug = value; | |
} | |
} catch (e) { | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function load() { | |
var r; | |
try { | |
r = exports.storage.debug; | |
} catch (e) { | |
} | |
return !r && void 0 !== process && "env" in process && (r = process.env.DEBUG), r; | |
} | |
exports = e.exports = n(45); | |
/** @type {function(): ?} */ | |
exports.log = logger; | |
/** @type {function(string): undefined} */ | |
exports.formatArgs = formatArgs; | |
/** @type {function(string): undefined} */ | |
exports.save = save; | |
/** @type {function(): ?} */ | |
exports.load = load; | |
/** @type {function(): ?} */ | |
exports.useColors = useColors; | |
exports.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() { | |
try { | |
return window.localStorage; | |
} catch (e) { | |
} | |
}(); | |
/** @type {!Array} */ | |
exports.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", | |
"#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"]; | |
/** | |
* @param {?} date | |
* @return {?} | |
*/ | |
exports.formatters.j = function(date) { | |
try { | |
return JSON.stringify(date); | |
} catch (controlFlowAction) { | |
return "[UnexpectedJSONParseError]: " + controlFlowAction.message; | |
} | |
}; | |
exports.enable(load()); | |
}).call(exports, n(44)); | |
}, function(module, canCreateDiscussions, require) { | |
/** | |
* @param {!Array} name | |
* @param {?} options | |
* @return {?} | |
*/ | |
function self(name, options) { | |
return self.get(name, options); | |
} | |
var spawn = require(19); | |
/** @type {function(!Array, ?): ?} */ | |
module.exports = self; | |
self.map = {}; | |
/** @type {string} */ | |
self.baseURL = ""; | |
/** | |
* @param {string} value | |
* @return {undefined} | |
*/ | |
self.doc = function(value) { | |
/** @type {string} */ | |
self.baseURL = value; | |
}; | |
/** | |
* @param {?} id | |
* @param {?} data | |
* @return {?} | |
*/ | |
self.get = function(id, data) { | |
if (id in self.map) { | |
return new self.map[id](data); | |
} | |
throw new Error("invalid error: " + id); | |
}; | |
/** | |
* @param {string} name | |
* @param {number} options | |
* @return {?} | |
*/ | |
self.add = function(name, options) { | |
/** | |
* @param {!Object} args | |
* @return {undefined} | |
*/ | |
function execute(args) { | |
Error.call(this); | |
this.name = this.code = name; | |
if (options.message instanceof Function) { | |
this.message = options.message(args); | |
} else { | |
this.message = options.message; | |
} | |
spawn(this, args || {}); | |
if (options.help) { | |
this.help = self.baseURL + options.help; | |
this.message += " (need help? " + this.help + ")"; | |
} | |
} | |
return options = options || {}, execute.prototype = new Error, self.map[name] = execute; | |
}; | |
self.doc("https://docs.recurly.com/js"); | |
self.add("not-configured", { | |
message : "Not configured. You must first call recurly.configure().", | |
help : "#identify-your-site" | |
}); | |
self.add("config-missing-public-key", { | |
message : "The publicKey setting is required.", | |
help : "#identify-your-site" | |
}); | |
self.add("config-missing-fields", { | |
message : "The fields setting is required." | |
}); | |
self.add("missing-hosted-field-target", { | |
message : function(data) { | |
return "Target element not found for " + data.type + " field using selector '" + data.selector + "'"; | |
} | |
}); | |
self.add("api-error", { | |
message : "There was an error with your request." | |
}); | |
self.add("api-timeout", { | |
message : "The API request timed out." | |
}); | |
self.add("validation", { | |
message : "There was an error validating your request." | |
}); | |
self.add("missing-callback", { | |
message : "Missing callback" | |
}); | |
self.add("invalid-options", { | |
message : "Options must be an object" | |
}); | |
self.add("invalid-option", { | |
message : function(data) { | |
return "Option " + data.name + " must be " + data.expect; | |
} | |
}); | |
self.add("missing-plan", { | |
message : "A plan must be specified." | |
}); | |
self.add("missing-coupon", { | |
message : "A coupon must be specified." | |
}); | |
self.add("invalid-item", { | |
message : "The given item does not appear to be a valid recurly plan, coupon, addon, or taxable address." | |
}); | |
self.add("invalid-addon", { | |
message : "The given addon_code is not among the valid addons for the specified plan." | |
}); | |
self.add("invalid-currency", { | |
message : function(data) { | |
return "The given currency (" + data.currency + ") is not among the valid codes for the specified plan(s): " + data.allowed + "."; | |
} | |
}); | |
self.add("invalid-plan-currency", { | |
message : function(data) { | |
return "The requested plan (" + data.planCode + ") does not support the possible checkout currencies: " + data.currencies + "."; | |
} | |
}); | |
self.add("invalid-subscription-currency", { | |
message : "The given subscription does not support the currencies of this Checkout instance's existing subscriptions" | |
}); | |
self.add("unremovable-item", { | |
message : "The given item cannot be removed." | |
}); | |
self.add("fraud-data-collector-request-failed", { | |
message : function(data) { | |
return "There was an error getting the data collector fields: " + data.error; | |
} | |
}); | |
self.add("fraud-data-collector-missing-form", { | |
message : function(data) { | |
return "There was an error finding a form to inject the data collector fields using selector '" + data.selector + "'"; | |
} | |
}); | |
self.add("gift-card-currency-mismatch", { | |
message : "The giftcard currency does not match the given currency." | |
}); | |
self.add("apple-pay-not-supported", { | |
message : "Apple Pay is not supported by this device or browser." | |
}); | |
self.add("apple-pay-not-available", { | |
message : "Apple Pay is supported by this device, but the customer has not configured Apple Pay." | |
}); | |
self.add("apple-pay-config-missing", { | |
message : function(handler) { | |
return "Missing Apple Pay configuration option: '" + handler.opt + "'"; | |
} | |
}); | |
self.add("apple-pay-config-invalid", { | |
message : function(handler) { | |
return "Apple Pay configuration option '" + handler.opt + "' is not among your available options: " + handler.set + ".\n Please refer to your site configuration if the available options is incorrect."; | |
} | |
}); | |
self.add("apple-pay-factory-only", { | |
message : "Apple Pay must be initialized by calling recurly.ApplePay" | |
}); | |
self.add("apple-pay-init-error", { | |
message : function(req) { | |
/** @type {string} */ | |
var stream = "Apple Pay did not initialize due to a fatal error"; | |
return req.err && (stream = stream + (": " + req.err.message)), stream; | |
} | |
}); | |
self.add("apple-pay-payment-failure", { | |
message : "Apply Pay could not charge the customer" | |
}); | |
self.add("paypal-factory-only", { | |
message : "PayPal must be initialized by calling recurly.PayPal" | |
}); | |
self.add("paypal-config-missing", { | |
message : function(handler) { | |
return "Missing PayPal configuration option: '" + handler.opt + "'"; | |
} | |
}); | |
self.add("paypal-load-error", { | |
message : "Client libraries failed to load" | |
}); | |
self.add("paypal-client-error", { | |
message : "PayPal encountered an unexpected error" | |
}); | |
self.add("paypal-tokenize-error", { | |
message : "An error occurred while attempting to generate the PayPal token" | |
}); | |
self.add("paypal-tokenize-recurly-error", { | |
message : "An error occurred while attempting to generate the Recurly token" | |
}); | |
self.add("paypal-braintree-not-ready", { | |
message : "Braintree PayPal is not yet ready to create a checkout flow" | |
}); | |
self.add("paypal-braintree-api-error", { | |
message : "Braintree API experienced an error" | |
}); | |
self.add("paypal-braintree-tokenize-braintree-error", { | |
message : "An error occurred while attempting to generate the Braintree token" | |
}); | |
self.add("paypal-braintree-tokenize-recurly-error", { | |
message : "An error occurred while attempting to generate the Braintree token within Recurly" | |
}); | |
}, function(module, canCreateDiscussions) { | |
/** | |
* @param {!Array} obj | |
* @return {?} | |
*/ | |
function Emitter(obj) { | |
if (obj) { | |
return mixin(obj); | |
} | |
} | |
/** | |
* @param {!Object} object | |
* @return {?} | |
*/ | |
function mixin(object) { | |
var key; | |
for (key in Emitter.prototype) { | |
object[key] = Emitter.prototype[key]; | |
} | |
return object; | |
} | |
/** @type {function(!Array): ?} */ | |
module.exports = Emitter; | |
/** @type {function(string, ?): ?} */ | |
Emitter.prototype.on = Emitter.prototype.addEventListener = function(type, e) { | |
return this._callbacks = this._callbacks || {}, (this._callbacks[type] = this._callbacks[type] || []).push(e), this; | |
}; | |
/** | |
* @param {string} name | |
* @param {!Function} fn | |
* @return {?} | |
*/ | |
Emitter.prototype.once = function(name, fn) { | |
/** | |
* @return {undefined} | |
*/ | |
function f() { | |
$table.off(name, f); | |
fn.apply(this, arguments); | |
} | |
var $table = this; | |
return this._callbacks = this._callbacks || {}, f.fn = fn, this.on(name, f), this; | |
}; | |
/** @type {function(string, ?): ?} */ | |
Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn) { | |
if (this._callbacks = this._callbacks || {}, 0 == arguments.length) { | |
return this._callbacks = {}, this; | |
} | |
var callbacks = this._callbacks[event]; | |
if (!callbacks) { | |
return this; | |
} | |
if (1 == arguments.length) { | |
return delete this._callbacks[event], this; | |
} | |
var cb; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < callbacks.length; i++) { | |
if ((cb = callbacks[i]) === fn || cb.fn === fn) { | |
callbacks.splice(i, 1); | |
break; | |
} | |
} | |
return this; | |
}; | |
/** | |
* @param {string} name | |
* @return {?} | |
*/ | |
Emitter.prototype.emit = function(name) { | |
this._callbacks = this._callbacks || {}; | |
/** @type {!Array<?>} */ | |
var cmd_args = [].slice.call(arguments, 1); | |
var callbacks = this._callbacks[name]; | |
if (callbacks) { | |
callbacks = callbacks.slice(0); | |
/** @type {number} */ | |
var l = 0; | |
var i = callbacks.length; | |
for (; l < i; ++l) { | |
callbacks[l].apply(this, cmd_args); | |
} | |
} | |
return this; | |
}; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
Emitter.prototype.listeners = function(type) { | |
return this._callbacks = this._callbacks || {}, this._callbacks[type] || []; | |
}; | |
/** | |
* @param {?} event | |
* @return {?} | |
*/ | |
Emitter.prototype.hasListeners = function(event) { | |
return !!this.listeners(event).length; | |
}; | |
}, function(module, canCreateDiscussions, aggFn) { | |
/** | |
* @param {!Object} o | |
* @param {string} options | |
* @param {string} uuid | |
* @return {?} | |
*/ | |
function v4(o, options, uuid) { | |
var colWidth = options && uuid || 0; | |
if ("string" == typeof o) { | |
/** @type {(Array|null)} */ | |
options = "binary" === o ? new Array(16) : null; | |
/** @type {null} */ | |
o = null; | |
} | |
o = o || {}; | |
var config = o.random || (o.rng || v)(); | |
if (config[6] = 15 & config[6] | 64, config[8] = 63 & config[8] | 128, options) { | |
/** @type {number} */ | |
var k = 0; | |
for (; k < 16; ++k) { | |
options[colWidth + k] = config[k]; | |
} | |
} | |
return options || readConfigFile(config); | |
} | |
var v = aggFn(36); | |
var readConfigFile = aggFn(37); | |
/** @type {function(!Object, string, string): ?} */ | |
module.exports = v4; | |
}, function(mixin, canCreateDiscussions, $) { | |
/** | |
* @param {?} a | |
* @param {!Function} fn | |
* @param {!Object} instance | |
* @return {undefined} | |
*/ | |
function parse(a, fn, instance) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < a.length; ++i) { | |
fn.call(instance, a.charAt(i), i); | |
} | |
} | |
/** | |
* @param {!Object} obj | |
* @param {!Function} fn | |
* @param {!Object} context | |
* @return {undefined} | |
*/ | |
function forOwn(obj, fn, context) { | |
var i; | |
for (i in obj) { | |
if (has.call(obj, i)) { | |
fn.call(context, i, obj[i]); | |
} | |
} | |
} | |
/** | |
* @param {!Array} options | |
* @param {!Function} data | |
* @param {!Object} num | |
* @return {undefined} | |
*/ | |
function next(options, data, num) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < options.length; ++i) { | |
data.call(num, options[i], i); | |
} | |
} | |
try { | |
var h = $(9); | |
} catch (e) { | |
h = $(9); | |
} | |
var prefixed = $(40); | |
/** @type {function(this:Object, *): boolean} */ | |
var has = Object.prototype.hasOwnProperty; | |
/** | |
* @param {!Array} a | |
* @param {!Function} fn | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
mixin.exports = function(a, fn, obj) { | |
switch(fn = prefixed(fn), obj = obj || this, h(a)) { | |
case "array": | |
return next(a, fn, obj); | |
case "object": | |
return "number" == typeof a.length ? next(a, fn, obj) : forOwn(a, fn, obj); | |
case "string": | |
return parse(a, fn, obj); | |
} | |
}; | |
}, function(mixin, canCreateDiscussions, iter_f) { | |
/** | |
* @param {!Function} e | |
* @return {?} | |
*/ | |
function createFilenameMatcherFromPatterns(e) { | |
return function(item) { | |
var key; | |
for (key in e) { | |
if (item[key] != e[key]) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
} | |
var next = iter_f(67); | |
/** | |
* @param {!Array} array | |
* @param {!Function} value | |
* @return {?} | |
*/ | |
mixin.exports = function(array, value) { | |
if ("function" != typeof value) { | |
value = Object(value) === value ? createFilenameMatcherFromPatterns(value) : next(value); | |
} | |
/** @type {number} */ | |
var i = 0; | |
var length = array.length; | |
for (; i < length; ++i) { | |
if (value(array[i], i)) { | |
return array[i]; | |
} | |
} | |
}; | |
}, function(module, canCreateDiscussions, getNext) { | |
/** | |
* @param {!Object} x | |
* @return {?} | |
*/ | |
function f(x) { | |
var $M = window.jQuery; | |
var name = $M && x instanceof $M; | |
return (name || Array.isArray(x)) && (x = x[0]), !!x && (("undefined" != typeof HTMLElement ? x instanceof HTMLElement : 1 === x.nodeType) && x); | |
} | |
/** | |
* @param {string} a | |
* @param {?} d | |
* @return {?} | |
*/ | |
function i(a, d) { | |
return f(a) ? void 0 !== d ? find(a, d) : set(a) : null; | |
} | |
/** | |
* @param {!Object} e | |
* @return {?} | |
*/ | |
function set(e) { | |
e = f(e); | |
var h; | |
var type = e && e.type && e.type.toLowerCase(); | |
if (type) { | |
if ("options" in e) { | |
var hNode = e.options[e.selectedIndex] || e.options[0] || { | |
value : "" | |
}; | |
/** @type {string} */ | |
h = hNode.value; | |
} else { | |
if ("checkbox" === type) { | |
if (e.checked) { | |
h = e.value; | |
} | |
} else { | |
if ("radio" === type) { | |
/** @type {!NodeList<Element>} */ | |
var ierr = document.querySelectorAll('input[data-recurly="' + q(e, "recurly") + '"]'); | |
next(ierr, function(r) { | |
if (r.checked) { | |
h = r.value; | |
} | |
}); | |
} else { | |
if ("value" in e) { | |
h = e.value; | |
} | |
} | |
} | |
} | |
} else { | |
/** @type {string} */ | |
h = ""; | |
} | |
return h; | |
} | |
/** | |
* @param {string} response | |
* @param {string} t | |
* @return {undefined} | |
*/ | |
function find(response, t) { | |
if (!Array.isArray(response)) { | |
/** @type {!Array} */ | |
response = [response]; | |
} | |
next(response, function(el) { | |
if (el) { | |
if ("value" in el) { | |
/** @type {string} */ | |
el.value = t; | |
} else { | |
if ("textContent" in el) { | |
/** @type {string} */ | |
el.textContent = t; | |
} else { | |
if ("innerText" in el) { | |
/** @type {string} */ | |
el.innerText = t; | |
} | |
} | |
} | |
} | |
}); | |
} | |
/** | |
* @param {!Object} a | |
* @param {string} v | |
* @param {?} d | |
* @return {?} | |
*/ | |
function q(a, v, d) { | |
if (a = f(a)) { | |
return void 0 !== d ? u(a, v, d) : show(a, v); | |
} | |
} | |
/** | |
* @param {!Object} element | |
* @param {string} name | |
* @return {?} | |
*/ | |
function show(element, name) { | |
return element.dataset ? element.dataset[name] : element.getAttribute("data-" + r(name)); | |
} | |
/** | |
* @param {!Object} el | |
* @param {string} name | |
* @param {string} f | |
* @return {?} | |
*/ | |
function u(el, name, f) { | |
return el.dataset ? el.dataset[name] = f : el.setAttribute("data-" + r(name), f), "" + f; | |
} | |
/** | |
* @param {!Object} x | |
* @param {string} name | |
* @return {?} | |
*/ | |
function load(x, name) { | |
return x = f(x), x ? x.tagName.match(RegExp(name, "i")) ? x : load(x.parentNode, name) : null; | |
} | |
/** | |
* @return {?} | |
*/ | |
function render() { | |
var item = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; | |
/** @type {string} */ | |
var a = "input"; | |
if (~["button", "select"].indexOf(item.type)) { | |
a = item.type; | |
delete item.type; | |
} | |
var link = window.document.createElement(a); | |
return "type" in item || (item.type = "text"), "style" in item || (item.style = "position: absolute; top: 0px; left: -1000px; opacity: 0;"), Object.keys(item).forEach(function(i) { | |
return link.setAttribute(i, item[i]); | |
}), link; | |
} | |
var r = getNext(41); | |
var next = getNext(4); | |
module.exports = { | |
createHiddenInput : render, | |
data : q, | |
element : f, | |
findNodeInParents : load, | |
value : i | |
}; | |
}, function(module, canCreateDiscussions, factory) { | |
module.exports = factory(54); | |
}, function(module, canCreateDiscussions, require) { | |
/** | |
* @return {undefined} | |
*/ | |
function noop() { | |
} | |
/** | |
* @param {!Object} promise | |
* @return {?} | |
*/ | |
function getThen(promise) { | |
try { | |
return promise.then; | |
} catch (e) { | |
return ex = e, undefined; | |
} | |
} | |
/** | |
* @param {?} fn | |
* @param {?} a | |
* @return {?} | |
*/ | |
function tryCallOne(fn, a) { | |
try { | |
return fn(a); | |
} catch (e) { | |
return ex = e, undefined; | |
} | |
} | |
/** | |
* @param {!Function} callback | |
* @param {!Function} oRequest | |
* @param {!Function} sResponseHandler | |
* @return {?} | |
*/ | |
function load(callback, oRequest, sResponseHandler) { | |
try { | |
callback(oRequest, sResponseHandler); | |
} catch (e) { | |
return ex = e, undefined; | |
} | |
} | |
/** | |
* @param {!Function} callback | |
* @return {undefined} | |
*/ | |
function Promise(callback) { | |
if ("object" != typeof this) { | |
throw new TypeError("Promises must be constructed via new"); | |
} | |
if ("function" != typeof callback) { | |
throw new TypeError("not a function"); | |
} | |
/** @type {number} */ | |
this._45 = 0; | |
/** @type {number} */ | |
this._81 = 0; | |
/** @type {null} */ | |
this._65 = null; | |
/** @type {null} */ | |
this._54 = null; | |
if (callback !== noop) { | |
fn(callback, this); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {!Function} onFulfilled | |
* @param {!Function} onRejected | |
* @return {?} | |
*/ | |
function safeThen(self, onFulfilled, onRejected) { | |
return new self.constructor(function(partialValue, wrapped) { | |
var promise = new Promise(noop); | |
promise.then(partialValue, wrapped); | |
handle(self, new Handler(onFulfilled, onRejected, promise)); | |
}); | |
} | |
/** | |
* @param {string} self | |
* @param {string} deferred | |
* @return {?} | |
*/ | |
function handle(self, deferred) { | |
for (; 3 === self._81;) { | |
self = self._65; | |
} | |
if (Promise._10 && Promise._10(self), 0 === self._81) { | |
return 0 === self._45 ? (self._45 = 1, void(self._54 = deferred)) : 1 === self._45 ? (self._45 = 2, void(self._54 = [self._54, deferred])) : void self._54.push(deferred); | |
} | |
handleResolved(self, deferred); | |
} | |
/** | |
* @param {string} self | |
* @param {?} deferred | |
* @return {undefined} | |
*/ | |
function handleResolved(self, deferred) { | |
asap(function() { | |
var cb = 1 === self._81 ? deferred.onFulfilled : deferred.onRejected; | |
if (null === cb) { | |
return void(1 === self._81 ? resolve(deferred.promise, self._65) : reject(deferred.promise, self._65)); | |
} | |
var ret = tryCallOne(cb, self._65); | |
if (ret === undefined) { | |
reject(deferred.promise, ex); | |
} else { | |
resolve(deferred.promise, ret); | |
} | |
}); | |
} | |
/** | |
* @param {!Object} self | |
* @param {string} value | |
* @return {?} | |
*/ | |
function resolve(self, value) { | |
if (value === self) { | |
return reject(self, new TypeError("A promise cannot be resolved with itself.")); | |
} | |
if (value && ("object" == typeof value || "function" == typeof value)) { | |
var then = getThen(value); | |
if (then === undefined) { | |
return reject(self, ex); | |
} | |
if (then === self.then && value instanceof Promise) { | |
return self._81 = 3, self._65 = value, void finale(self); | |
} | |
if ("function" == typeof then) { | |
return void fn(then.bind(value), self); | |
} | |
} | |
/** @type {number} */ | |
self._81 = 1; | |
/** @type {string} */ | |
self._65 = value; | |
finale(self); | |
} | |
/** | |
* @param {!Object} self | |
* @param {?} newValue | |
* @return {undefined} | |
*/ | |
function reject(self, newValue) { | |
/** @type {number} */ | |
self._81 = 2; | |
self._65 = newValue; | |
if (Promise._97) { | |
Promise._97(self, newValue); | |
} | |
finale(self); | |
} | |
/** | |
* @param {!Function} self | |
* @return {undefined} | |
*/ | |
function finale(self) { | |
if (1 === self._45 && (handle(self, self._54), self._54 = null), 2 === self._45) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < self._54.length; i++) { | |
handle(self, self._54[i]); | |
} | |
/** @type {null} */ | |
self._54 = null; | |
} | |
} | |
/** | |
* @param {!Function} a | |
* @param {!Function} b | |
* @param {!Function} p | |
* @return {undefined} | |
*/ | |
function Handler(a, b, p) { | |
/** @type {(!Function|null)} */ | |
this.onFulfilled = "function" == typeof a ? a : null; | |
/** @type {(!Function|null)} */ | |
this.onRejected = "function" == typeof b ? b : null; | |
/** @type {!Function} */ | |
this.promise = p; | |
} | |
/** | |
* @param {!Function} type | |
* @param {!Object} x | |
* @return {undefined} | |
*/ | |
function fn(type, x) { | |
/** @type {boolean} */ | |
var isSrcArr = false; | |
var result = load(type, function(link) { | |
if (!isSrcArr) { | |
/** @type {boolean} */ | |
isSrcArr = true; | |
resolve(x, link); | |
} | |
}, function(val) { | |
if (!isSrcArr) { | |
/** @type {boolean} */ | |
isSrcArr = true; | |
reject(x, val); | |
} | |
}); | |
if (!(isSrcArr || result !== undefined)) { | |
/** @type {boolean} */ | |
isSrcArr = true; | |
reject(x, ex); | |
} | |
} | |
var asap = require(22); | |
/** @type {null} */ | |
var ex = null; | |
var undefined = {}; | |
/** @type {function(!Function): undefined} */ | |
module.exports = Promise; | |
/** @type {null} */ | |
Promise._10 = null; | |
/** @type {null} */ | |
Promise._97 = null; | |
/** @type {function(): undefined} */ | |
Promise._61 = noop; | |
/** | |
* @param {!Function} value | |
* @param {!Function} onRejected | |
* @return {?} | |
*/ | |
Promise.prototype.then = function(value, onRejected) { | |
if (this.constructor !== Promise) { | |
return safeThen(this, value, onRejected); | |
} | |
var prom = new Promise(noop); | |
return handle(this, new Handler(value, onRejected, prom)), prom; | |
}; | |
}, function(mixin, canCreateDiscussions) { | |
/** @type {function(this:*): string} */ | |
var objectToString$2 = Object.prototype.toString; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
mixin.exports = function(value) { | |
switch(objectToString$2.call(value)) { | |
case "[object Function]": | |
return "function"; | |
case "[object Date]": | |
return "date"; | |
case "[object RegExp]": | |
return "regexp"; | |
case "[object Arguments]": | |
return "arguments"; | |
case "[object Array]": | |
return "array"; | |
case "[object String]": | |
return "string"; | |
} | |
return null === value ? "null" : void 0 === value ? "undefined" : value && 1 === value.nodeType ? "element" : value === Object(value) ? "object" : typeof value; | |
}; | |
}, function(canCreateDiscussions, t, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function _possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {?} dataId | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function callback(dataId, data) { | |
return dataId && (0, _UiIcon2.default)(dataId, { | |
code : data | |
}); | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
t.Pricing = void 0; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(?, !Object): ?} */ | |
t.findByCode = callback; | |
var _prepareStyleProperties = __webpack_require__(65); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(2); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(5); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(11); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(1); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var _deepAssign = __webpack_require__(16); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var cb = __webpack_require__(0)("recurly:pricing"); | |
var offsetFromCenter = function(_EventEmitter) { | |
/** | |
* @param {!Object} state | |
* @return {?} | |
*/ | |
function Agent(state) { | |
_classCallCheck(this, Agent); | |
var _this = _possibleConstructorReturn(this, (Agent.__proto__ || Object.getPrototypeOf(Agent)).call(this)); | |
return _this.recurly = state, _this.debug = cb, _this.reset(), _this.reprice(), _this; | |
} | |
return _inherits(Agent, _EventEmitter), _createClass(Agent, [{ | |
key : "reset", | |
value : function() { | |
this.items = {}; | |
this.currency(this.recurly.config.currency); | |
} | |
}, { | |
key : "reprice", | |
value : function(fn) { | |
var self = this; | |
var link = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
var title = link.internal; | |
var add_title_to_td = void 0 !== title && title; | |
return this.debug("reprice"), (new _classlist2.default(function(obtainGETData, n) { | |
new self.Calculations(self, function(val) { | |
if (JSON.stringify(val) === JSON.stringify(self.price)) { | |
return obtainGETData(val); | |
} | |
/** @type {string} */ | |
self.price = val; | |
if (!add_title_to_td) { | |
self.emit("change:external", val); | |
} | |
self.emit("change", val); | |
obtainGETData(val); | |
}); | |
}, this)).nodeify(fn); | |
} | |
}, { | |
key : "remove", | |
value : function(x, callback) { | |
var event = this; | |
var result = void 0; | |
return this.debug("remove"), (new _classlist2.default(function(onstep, uid) { | |
/** @type {string} */ | |
var i = Object.keys(x)[0]; | |
var val = x[i]; | |
if (!~Object.keys(event.items).indexOf(i)) { | |
return event.error((0, _UiRippleInk2.default)("invalid-item"), uid); | |
} | |
if (Array.isArray(event.items[i])) { | |
var files = event.items[i].indexOf(callback(event.items[i], { | |
code : val | |
})); | |
if (~files) { | |
result = event.items[i].splice(files); | |
} | |
} else { | |
if (!event.items[i] || val !== event.items[i].code && true !== val) { | |
return event.error((0, _UiRippleInk2.default)("unremovable-item", { | |
type : i, | |
id : val, | |
reason : "does not exist on this pricing instance." | |
}), uid); | |
} | |
result = event.items[i]; | |
delete event.items[i]; | |
} | |
onstep(); | |
}, this)).nodeify(callback); | |
} | |
}, { | |
key : "itemUpdateFactory", | |
value : function(name, fn) { | |
var n = this; | |
return function(callback, i) { | |
if (JSON.stringify(fn) === JSON.stringify(n.items[name])) { | |
return callback(n.items[name]); | |
} | |
/** @type {!Object} */ | |
n.items[name] = fn; | |
cb("set." + name); | |
n.emit("set." + name, fn); | |
callback(fn); | |
}; | |
} | |
}, { | |
key : "error", | |
value : function(num) { | |
var socket = this; | |
var RHSong = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function() { | |
}; | |
var error = arguments[2]; | |
return error && error.split(".").reduce(function(ipasDir, name) { | |
return socket.emit(ipasDir + "." + name, num); | |
}, "error"), this.emit("error", num), RHSong(num); | |
} | |
}, { | |
key : "Calculations", | |
get : function() { | |
throw new Error("Not implemented"); | |
} | |
}, { | |
key : "PRICING_METHODS", | |
get : function() { | |
return ["reset", "remove", "reprice"]; | |
} | |
}, { | |
key : "hasPrice", | |
get : function() { | |
return !!this.price; | |
} | |
}, { | |
key : "totalNow", | |
get : function() { | |
return (0, _deepAssign2.default)(this.hasPrice ? this.price.now.total : 0); | |
} | |
}, { | |
key : "subtotalPreDiscountNow", | |
get : function() { | |
/** @type {number} */ | |
var e = parseFloat(this.price.now.subtotal) + parseFloat(this.price.now.discount); | |
return (0, _deepAssign2.default)(this.hasPrice ? e : 0); | |
} | |
}, { | |
key : "currencyCode", | |
get : function() { | |
return this.items.currency || ""; | |
} | |
}, { | |
key : "currencySymbol", | |
get : function() { | |
return (0, _prepareStyleProperties2.default)(this.currencyCode); | |
} | |
}]), Agent; | |
}(_normalizeDataUri2.default); | |
t.Pricing = offsetFromCenter; | |
}, function(canCreateDiscussions, t, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** | |
* @param {!Object} object | |
* @param {string} callback | |
* @param {?} options | |
* @return {?} | |
*/ | |
var callback = function get(object, callback, options) { | |
if (null === object) { | |
object = Function.prototype; | |
} | |
/** @type {(ObjectPropertyDescriptor<?>|undefined)} */ | |
var descriptor = Object.getOwnPropertyDescriptor(object, callback); | |
if (void 0 === descriptor) { | |
/** @type {(Object|null)} */ | |
var string = Object.getPrototypeOf(object); | |
return null === string ? void 0 : get(string, callback, options); | |
} | |
if ("value" in descriptor) { | |
return descriptor.value; | |
} | |
/** @type {(function(): ?|undefined)} */ | |
var get = descriptor.get; | |
if (void 0 !== get) { | |
return get.call(options); | |
} | |
}; | |
var _normalizeDataUri = __webpack_require__(7); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _prepareStyleProperties = __webpack_require__(19); | |
var append = (_interopRequireDefault(_prepareStyleProperties), __webpack_require__(0)("recurly:pricing:promise")); | |
var offsetFromCenter = function(_EventEmitter) { | |
/** | |
* @param {?} params | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function Slider(params, options) { | |
_classCallCheck(this, Slider); | |
append("create"); | |
var result = possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, params)); | |
return result.pricing = options, result.constructor = function(object) { | |
return new Slider(object, options); | |
}, options && options.PRICING_METHODS.forEach(function(direction) { | |
/** | |
* @return {?} | |
*/ | |
result[direction] = function() { | |
/** @type {number} */ | |
var _len8 = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len8); | |
/** @type {number} */ | |
var _key8 = 0; | |
for (; _key8 < _len8; _key8++) { | |
args[_key8] = arguments[_key8]; | |
} | |
return result.then(function() { | |
return options[direction].apply(options, args); | |
}); | |
}; | |
}), result; | |
} | |
return _inherits(Slider, _EventEmitter), _createClass(Slider, [{ | |
key : "done", | |
value : function() { | |
append("repricing"); | |
/** @type {number} */ | |
var _len8 = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len8); | |
/** @type {number} */ | |
var _key8 = 0; | |
for (; _key8 < _len8; _key8++) { | |
args[_key8] = arguments[_key8]; | |
} | |
return callback(Slider.prototype.__proto__ || Object.getPrototypeOf(Slider.prototype), "done", this).apply(this.then(this.reprice), args), this.pricing; | |
} | |
}, { | |
key : "nodeify", | |
value : function(arg) { | |
var _Object$getPrototypeO; | |
if ("function" == typeof arg) { | |
this.reprice(); | |
} | |
/** @type {number} */ | |
var length = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(length > 1 ? length - 1 : 0); | |
/** @type {number} */ | |
var i = 1; | |
for (; i < length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
return (_Object$getPrototypeO = callback(Slider.prototype.__proto__ || Object.getPrototypeOf(Slider.prototype), "nodeify", this)).call.apply(_Object$getPrototypeO, [this, arg].concat(args)); | |
} | |
}]), Slider; | |
}(_normalizeDataUri2.default); | |
t.default = offsetFromCenter; | |
}, function(canCreateDiscussions, t, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} z | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function calcLines(z, t) { | |
if (!(z instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} cond | |
* @param {string} t | |
* @return {?} | |
*/ | |
function test(cond, t) { | |
if (!cond) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? cond : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {!Object} spec | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function add(spec, options) { | |
/** @type {number} */ | |
var target = 1; | |
return "quantity" in options && (target = options.quantity), "quantity" in spec && (target = spec.quantity), parseInt(target, 10) || 0; | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** | |
* @param {!Object} o | |
* @param {string} name | |
* @param {?} args | |
* @return {?} | |
*/ | |
var callback = function f(o, name, args) { | |
if (null === o) { | |
o = Function.prototype; | |
} | |
/** @type {(ObjectPropertyDescriptor<?>|undefined)} */ | |
var node = Object.getOwnPropertyDescriptor(o, name); | |
if (void 0 === node) { | |
/** @type {(Object|null)} */ | |
var n = Object.getPrototypeOf(o); | |
return null === n ? void 0 : f(n, name, args); | |
} | |
if ("value" in node) { | |
return node.value; | |
} | |
/** @type {(function(): ?|undefined)} */ | |
var params = node.get; | |
if (void 0 !== params) { | |
return params.call(args); | |
} | |
}; | |
var _normalizeDataUri = __webpack_require__(3); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var OAuthCode = __webpack_require__(10); | |
var _prepareStyleProperties = __webpack_require__(11); | |
var o = _interopRequireDefault(_prepareStyleProperties); | |
var _UiIcon = __webpack_require__(87); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(33); | |
var _Complex2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(1); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var resolve = __webpack_require__(0)("recurly:pricing:subscription-pricing"); | |
var offsetFromCenter = function(e) { | |
/** | |
* @param {?} args | |
* @return {?} | |
*/ | |
function t(args) { | |
var npcObj = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
var key = npcObj.id; | |
var index = void 0 === key ? (0, _normalizeDataUri2.default)() : key; | |
calcLines(this, t); | |
var error = test(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, args)); | |
return error.id = index, error.debug = resolve, error; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "reset", | |
value : function() { | |
callback(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "reset", this).call(this); | |
/** @type {!Array} */ | |
this.items.addons = []; | |
} | |
}, { | |
key : "attach", | |
value : function(b) { | |
var self = this; | |
return this.attachment && this.attachment.detach(), this.attachment = new _Complex2.default(this, b), this.attachment.once("ready", function() { | |
return self.emit("attached"); | |
}), this.attachment; | |
} | |
}, { | |
key : "plan", | |
value : function() { | |
var me = this; | |
var self = this.resolvePlanOptions.apply(this, arguments); | |
var item = self.currentPlan; | |
var quantity = self.quantity; | |
var value = self.planCode; | |
var callback = (self.options, self.done); | |
return (new o.default(function(cb, responseData) { | |
if (item && item.code === value) { | |
return item.quantity = quantity, cb(item); | |
} | |
me.recurly.plan(value, function(n, item) { | |
if (n) { | |
return me.error(n, responseData, "plan"); | |
} | |
/** | |
* @return {undefined} | |
*/ | |
var failure = function() { | |
resolve("set.plan"); | |
me.emit("set.plan", item); | |
cb(item); | |
}; | |
item.quantity = quantity; | |
/** @type {!Object} */ | |
me.items.plan = item; | |
if (!(me.items.currency in item.price)) { | |
me.currency(Object.keys(item.price)[0]); | |
} | |
if (me.items.coupon) { | |
me.coupon(me.items.coupon.code).then(failure, failure); | |
} else { | |
failure(); | |
} | |
}); | |
}, this)).nodeify(callback); | |
} | |
}, { | |
key : "addon", | |
value : function(name, b, a) { | |
var res = this; | |
return "function" == typeof b && (a = b, b = void 0), b = b || {}, (new o.default(function(func, i) { | |
if (!res.items.plan) { | |
return res.error((0, _UiRippleInk2.default)("missing-plan"), i, "addon"); | |
} | |
var x = (0, OAuthCode.findByCode)(res.items.plan.addons, name); | |
if (!x) { | |
return res.error((0, _UiRippleInk2.default)("invalid-addon", { | |
planCode : res.items.plan.code, | |
addonCode : name | |
}), i, "addon"); | |
} | |
var num = add(b, x); | |
var args = (0, OAuthCode.findByCode)(res.items.addons, name); | |
if (0 === num) { | |
res.remove({ | |
addon : name | |
}); | |
} | |
if (args) { | |
args.quantity = num; | |
} else { | |
/** @type {*} */ | |
args = JSON.parse(JSON.stringify(x)); | |
args.quantity = num; | |
res.items.addons.push(args); | |
} | |
resolve("set.addon"); | |
res.emit("set.addon", args); | |
func(args); | |
}, this)).nodeify(a); | |
} | |
}, { | |
key : "giftcard", | |
value : function(num, callback) { | |
/** | |
* @param {!Function} user | |
* @return {undefined} | |
*/ | |
function call_user_is_writing(user) { | |
resolve("set.gift_card"); | |
/** @type {!Function} */ | |
response.items.gift_card = user; | |
response.emit("set.gift_card", user); | |
} | |
/** | |
* @param {?} planned | |
* @return {undefined} | |
*/ | |
function done(planned) { | |
resolve("unset.gift_card"); | |
delete response.items.gift_card; | |
response.emit("unset.gift_card"); | |
} | |
var response = this; | |
return (new o.default(function(verifier, err) { | |
if (done(), !num) { | |
return verifier(); | |
} | |
response.recurly.giftcard({ | |
giftcard : num | |
}, function(e, result) { | |
return e && "not-found" === e.code && done(), e ? response.error(e, err, "gift_card") : response.items.currency !== result.currency ? (done(), response.error((0, _UiRippleInk2.default)("gift-card-currency-mismatch"), err, "gift_card")) : (call_user_is_writing(result), void verifier(result)); | |
}); | |
}, this)).nodeify(callback); | |
} | |
}, { | |
key : "coupon", | |
value : function(num, callback) { | |
var item = this; | |
/** | |
* @return {undefined} | |
*/ | |
var next = function() { | |
resolve("unset.coupon"); | |
delete item.items.coupon; | |
item.emit("unset.coupon"); | |
}; | |
return (new o.default(function(func, script) { | |
if (!item.items.plan) { | |
return item.error((0, _UiRippleInk2.default)("missing-plan"), script, "coupon"); | |
} | |
if (item.items.coupon && item.remove({ | |
coupon : item.items.coupon.code | |
}), !num) { | |
return next(), func(); | |
} | |
/** | |
* @param {!Object} e | |
* @param {!Object} key | |
* @return {?} | |
*/ | |
var callback = function(e, key) { | |
return e && "not-found" === e.code && next(), e ? item.error(e, script, "coupon") : item.couponIsValidForSubscription(key) ? (resolve("set.coupon"), item.items.coupon = key, item.emit("set.coupon", key), func(key), void 0) : item.error("invalid-coupon-for-subscription", script, "coupon"); | |
}; | |
if ("string" == typeof num) { | |
item.recurly.coupon({ | |
plan : item.items.plan.code, | |
coupon : num | |
}, callback); | |
} else { | |
callback(null, num); | |
} | |
}, this)).nodeify(callback); | |
} | |
}, { | |
key : "address", | |
value : function(options, callback) { | |
return (new o.default(this.itemUpdateFactory("address", options), this)).nodeify(callback); | |
} | |
}, { | |
key : "shippingAddress", | |
value : function(options, callback) { | |
return (new o.default(this.itemUpdateFactory("shipping_address", options), this)).nodeify(callback); | |
} | |
}, { | |
key : "tax", | |
value : function(options, callback) { | |
return (new o.default(this.itemUpdateFactory("tax", options), this)).nodeify(callback); | |
} | |
}, { | |
key : "currency", | |
value : function(value, callback) { | |
var request = this; | |
var result = this.items.plan; | |
var i = this.items.currency; | |
return (new o.default(function($, s3Url) { | |
return i === value ? $(i) : !result || value in result.price ? (request.items.currency = value, resolve("set.currency"), request.emit("set.currency", value), void $(value)) : request.error((0, _UiRippleInk2.default)("invalid-currency", { | |
currency : value, | |
allowed : Object.keys(result.price) | |
}), s3Url, "currency"); | |
}, this)).nodeify(callback); | |
} | |
}, { | |
key : "couponIsValidForSubscription", | |
value : function(result) { | |
return !!result && (!!result.applies_to_plans && (!!result.applies_to_all_plans || !!~result.plans.indexOf(this.items.plan.code))); | |
} | |
}, { | |
key : "resolvePlanOptions", | |
value : function(num) { | |
var b = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
var e = arguments[2]; | |
var m = this.items.plan; | |
var value = void 0; | |
return "function" == typeof b && (e = b, b = {}), m && m.quantity && (value = m.quantity), b.quantity && (value = parseInt(b.quantity, 10)), (!value || value < 1) && (value = 1), { | |
currentPlan : m, | |
quantity : value, | |
planCode : num, | |
options : b, | |
done : e | |
}; | |
} | |
}, { | |
key : "Calculations", | |
get : function() { | |
return _UiIcon2.default; | |
} | |
}, { | |
key : "PRICING_METHODS", | |
get : function() { | |
return callback(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "PRICING_METHODS", this).concat(["addon", "address", "coupon", "currency", "giftcard", "plan", "shippingAddress", "tax"]); | |
} | |
}, { | |
key : "isValid", | |
get : function() { | |
return !(!this.items.plan || !this.price); | |
} | |
}, { | |
key : "taxCode", | |
get : function() { | |
if (this.items.tax) { | |
return this.items.tax.taxCode || this.items.tax.tax_code; | |
} | |
} | |
}, { | |
key : "taxExempt", | |
get : function() { | |
return this.items.plan && this.items.plan.tax_exempt; | |
} | |
}]), t; | |
}(OAuthCode.Pricing); | |
t.default = offsetFromCenter; | |
}, function(module, canCreateDiscussions, Type) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function clone(obj) { | |
switch(type(obj)) { | |
case "object": | |
var cloned = {}; | |
var key; | |
for (key in obj) { | |
if (obj.hasOwnProperty(key)) { | |
cloned[key] = clone(obj[key]); | |
} | |
} | |
return cloned; | |
case "array": | |
/** @type {!Array} */ | |
cloned = new Array(obj.length); | |
/** @type {number} */ | |
var i = 0; | |
var patchLen = obj.length; | |
for (; i < patchLen; i++) { | |
cloned[i] = clone(obj[i]); | |
} | |
return cloned; | |
case "regexp": | |
/** @type {string} */ | |
var modifiers = ""; | |
return modifiers = modifiers + (obj.multiline ? "m" : ""), modifiers = modifiers + (obj.global ? "g" : ""), modifiers = modifiers + (obj.ignoreCase ? "i" : ""), new RegExp(obj.source, modifiers); | |
case "date": | |
return new Date(obj.getTime()); | |
default: | |
return obj; | |
} | |
} | |
var type; | |
try { | |
type = Type(9); | |
} catch (e) { | |
type = Type(9); | |
} | |
/** @type {function(!Object): ?} */ | |
module.exports = clone; | |
}, function(canCreateDiscussions, meta, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {string} lst | |
* @param {!Object} v | |
* @param {number} total | |
* @return {?} | |
*/ | |
function fn(lst, v, total) { | |
var row = o.default.element(v); | |
var data = { | |
fields : {}, | |
values : {} | |
}; | |
return total = total || {}, row && "form" === row.nodeName.toLowerCase() ? (0, _normalizeDataUri2.default)(row.querySelectorAll("[data-recurly]"), function(value) { | |
var key = o.default.data(value, "recurly"); | |
if (~lst.indexOf(key)) { | |
/** @type {string} */ | |
data.fields[key] = value; | |
data.values[key] = o.default.value(value); | |
} | |
}) : data.values = v, total.parseCard && (data.values.number = (0, self.parseCard)(data.values.number)), data; | |
} | |
Object.defineProperty(meta, "__esModule", { | |
value : true | |
}); | |
/** @type {function(string, !Object, number): ?} */ | |
meta.normalize = fn; | |
var _normalizeDataUri = __webpack_require__(4); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _prepareStyleProperties = __webpack_require__(6); | |
var o = _interopRequireDefault(_prepareStyleProperties); | |
var self = __webpack_require__(21); | |
}, function(canCreateDiscussions, app, n) { | |
/** | |
* @param {!Object} obj | |
* @param {string} key | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function debug(obj, key, value) { | |
return key in obj ? Object.defineProperty(obj, key, { | |
value : value, | |
enumerable : true, | |
configurable : true, | |
writable : true | |
}) : obj[key] = value, obj; | |
} | |
/** | |
* @param {string} val | |
* @return {?} | |
*/ | |
function fn(val) { | |
/** @type {number} */ | |
var _len9 = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len9 > 1 ? _len9 - 1 : 0); | |
/** @type {number} */ | |
var _key9 = 1; | |
for (; _key9 < _len9; _key9++) { | |
args[_key9 - 1] = arguments[_key9]; | |
} | |
if (!args.length) { | |
return val; | |
} | |
var a = args.shift(); | |
if (isArray(val) && isArray(a)) { | |
var i; | |
for (i in a) { | |
if (isArray(a[i])) { | |
if (!val[i]) { | |
reset(val, debug({}, i, {})); | |
} | |
fn(val[i], a[i]); | |
} else { | |
reset(val, debug({}, i, a[i])); | |
} | |
} | |
} | |
return fn.apply(void 0, [val].concat(args)); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isArray(value) { | |
return value && "object" === (void 0 === value ? "undefined" : hasProperty(value)) && !Array.isArray(value); | |
} | |
Object.defineProperty(app, "__esModule", { | |
value : true | |
}); | |
/** @type {function(?): ?} */ | |
var hasProperty = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(exprCode) { | |
return typeof exprCode; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var reset = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(string): ?} */ | |
app.default = fn; | |
}, function(canCreateDiscussions, res, n) { | |
/** | |
* @param {number} num | |
* @return {?} | |
*/ | |
function n(num) { | |
return (Math.round(100 * num) / 100).toFixed(2); | |
} | |
Object.defineProperty(res, "__esModule", { | |
value : true | |
}); | |
/** @type {function(number): ?} */ | |
res.default = n; | |
}, function(e, exports, cb) { | |
(function(module) { | |
/** | |
* @param {string} obj | |
* @param {string} id | |
* @return {?} | |
*/ | |
function getValue(obj, id) { | |
return null == obj ? void 0 : obj[id]; | |
} | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
function _toString(value) { | |
/** @type {boolean} */ | |
var message = false; | |
if (null != value && "function" != typeof value.toString) { | |
try { | |
/** @type {boolean} */ | |
message = !!(value + ""); | |
} catch (e) { | |
} | |
} | |
return message; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function baseGetTag(value) { | |
return toString.call(value); | |
} | |
/** | |
* @param {undefined} value | |
* @return {?} | |
*/ | |
function some(value) { | |
return !(!isFunction(value) || conditionallyLowercase(value)) && (isUndefined(value) || _toString(value) ? reIsNative : regex).test(toSource(value)); | |
} | |
/** | |
* @param {string} object | |
* @param {string} key | |
* @return {?} | |
*/ | |
function getNative(object, key) { | |
var url = getValue(object, key); | |
return some(url) ? url : void 0; | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function conditionallyLowercase(value) { | |
return !!metadataPropertyName && metadataPropertyName in value; | |
} | |
/** | |
* @param {!Object} object | |
* @return {?} | |
*/ | |
function typeOf(object) { | |
var options = object && object.constructor; | |
return object === ("function" == typeof options && options.prototype || ObjProto); | |
} | |
/** | |
* @param {string} func | |
* @return {?} | |
*/ | |
function toSource(func) { | |
if (null != func) { | |
try { | |
return funcToString.call(func); | |
} catch (e) { | |
} | |
try { | |
return func + ""; | |
} catch (e) { | |
} | |
} | |
return ""; | |
} | |
/** | |
* @param {!Array} value | |
* @return {?} | |
*/ | |
function get(value) { | |
return isObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || toString.call(value) == selFun); | |
} | |
/** | |
* @param {!Object} d | |
* @return {?} | |
*/ | |
function isDefined(d) { | |
return null != d && isNaN(d.length) && !isUndefined(d); | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function isObject(value) { | |
return isString(value) && isDefined(value); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isEmpty(value) { | |
if (isDefined(value) && (isArray(value) || "string" == typeof value || "function" == typeof value.splice || isBuffer(value) || get(value))) { | |
return !value.length; | |
} | |
var tag = getTag(value); | |
if (tag == mapTag || tag == setTag) { | |
return !value.size; | |
} | |
if (type || typeOf(value)) { | |
return !nativeKeys(value).length; | |
} | |
var index; | |
for (index in value) { | |
if (hasOwnProperty.call(value, index)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function isUndefined(obj) { | |
var ch = isFunction(obj) ? toString.call(obj) : ""; | |
return ch == PRE_NEWLINE || ch == POST_NEWLINE; | |
} | |
/** | |
* @param {number} length | |
* @return {?} | |
*/ | |
function isNaN(length) { | |
return "number" == typeof length && length > -1 && length % 1 == 0 && length <= MAX_ARRAY_INDEX; | |
} | |
/** | |
* @param {!Object} o | |
* @return {?} | |
*/ | |
function isFunction(o) { | |
/** @type {string} */ | |
var tp = typeof o; | |
return !!o && ("object" == tp || "function" == tp); | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function isString(data) { | |
return !!data && "object" == typeof data; | |
} | |
/** | |
* @return {?} | |
*/ | |
function stubFalse() { | |
return false; | |
} | |
/** @type {number} */ | |
var MAX_ARRAY_INDEX = 9007199254740991; | |
/** @type {string} */ | |
var selFun = "[object Arguments]"; | |
/** @type {string} */ | |
var PRE_NEWLINE = "[object Function]"; | |
/** @type {string} */ | |
var POST_NEWLINE = "[object GeneratorFunction]"; | |
/** @type {string} */ | |
var mapTag = "[object Map]"; | |
/** @type {string} */ | |
var setTag = "[object Set]"; | |
/** @type {!RegExp} */ | |
var savedRegExp = /[\\^$.*+?()[\]{}|]/g; | |
/** @type {!RegExp} */ | |
var regex = /^\[object .+?Constructor\]$/; | |
var freeGlobal = "object" == typeof global && global && global.Object === Object && global; | |
/** @type {(Window|boolean)} */ | |
var freeSelf = "object" == typeof self && self && self.Object === Object && self; | |
var root = freeGlobal || freeSelf || Function("return this")(); | |
var freeExports = "object" == typeof exports && exports && !exports.nodeType && exports; | |
var freeModule = freeExports && "object" == typeof module && module && !module.nodeType && module; | |
var moduleExports = freeModule && freeModule.exports === freeExports; | |
var funcProto = Function.prototype; | |
var ObjProto = Object.prototype; | |
var coreJsData = root["__core-js_shared__"]; | |
var metadataPropertyName = function() { | |
/** @type {(Array<string>|null)} */ | |
var mixElem = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); | |
return mixElem ? "Symbol(src)_1." + mixElem : ""; | |
}(); | |
/** @type {function(this:!Function): string} */ | |
var funcToString = funcProto.toString; | |
var hasOwnProperty = ObjProto.hasOwnProperty; | |
var toString = ObjProto.toString; | |
/** @type {!RegExp} */ | |
var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(savedRegExp, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); | |
var Buffer = moduleExports ? root.Buffer : void 0; | |
var propertyIsEnumerable = ObjProto.propertyIsEnumerable; | |
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0; | |
var nativeKeys = function(e, callback) { | |
return function(a) { | |
return e(callback(a)); | |
}; | |
}(Object.keys, Object); | |
var DataView = getNative(root, "DataView"); | |
var Map = getNative(root, "Map"); | |
var Promise = getNative(root, "Promise"); | |
var Set = getNative(root, "Set"); | |
var WeakMap = getNative(root, "WeakMap"); | |
/** @type {boolean} */ | |
var type = !propertyIsEnumerable.call({ | |
valueOf : 1 | |
}, "valueOf"); | |
var dataViewCtorString = toSource(DataView); | |
var mapCtorString = toSource(Map); | |
var promiseCtorString = toSource(Promise); | |
var setCtorString = toSource(Set); | |
var weakMapCtorString = toSource(WeakMap); | |
/** @type {function(?): ?} */ | |
var getTag = baseGetTag; | |
if (DataView && "[object DataView]" != getTag(new DataView(new ArrayBuffer(1))) || Map && getTag(new Map) != mapTag || Promise && "[object Promise]" != getTag(Promise.resolve()) || Set && getTag(new Set) != setTag || WeakMap && "[object WeakMap]" != getTag(new WeakMap)) { | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
getTag = function(obj) { | |
var key = toString.call(obj); | |
var Ctor = "[object Object]" == key ? obj.constructor : void 0; | |
var ctorString = Ctor ? toSource(Ctor) : void 0; | |
if (ctorString) { | |
switch(ctorString) { | |
case dataViewCtorString: | |
return "[object DataView]"; | |
case mapCtorString: | |
return mapTag; | |
case promiseCtorString: | |
return "[object Promise]"; | |
case setCtorString: | |
return setTag; | |
case weakMapCtorString: | |
return "[object WeakMap]"; | |
} | |
} | |
return key; | |
}; | |
} | |
/** @type {function(*): boolean} */ | |
var isArray = Array.isArray; | |
var isBuffer = nativeIsBuffer || stubFalse; | |
/** @type {function(?): ?} */ | |
module.exports = isEmpty; | |
}).call(exports, cb(85)(e)); | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} name | |
* @param {string} o | |
* @return {?} | |
*/ | |
function bind(name, o) { | |
if (!name) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !o || "object" != typeof o && "function" != typeof o ? name : o; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function parseTXT(data) { | |
var div = data.style || {}; | |
return delete data.style, exports.FIELD_TYPES.forEach(function(i) { | |
if (data.fields && "string" == typeof data.fields[i]) { | |
data.fields[i] = { | |
selector : data.fields[i] | |
}; | |
} | |
if (div[i]) { | |
data.fields = data.fields || {}; | |
data.fields[i] = data.fields[i] || {}; | |
data.fields[i].style = (0, _noframeworkWaypoints2.default)({}, div[i], data.fields[i].style); | |
} | |
}), div.all && (data.fields = data.fields || {}, data.fields.all = { | |
style : div.all | |
}), data; | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.Recurly = void 0; | |
/** @type {function(?): ?} */ | |
var callback = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(canCreateDiscussions) { | |
return typeof canCreateDiscussions; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _classlist = __webpack_require__(13); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _custom = __webpack_require__(2); | |
var _custom2 = _interopRequireDefault(_custom); | |
var _AboutPage = __webpack_require__(3); | |
var _AboutPage2 = _interopRequireDefault(_AboutPage); | |
var _SearchUtility = __webpack_require__(1); | |
var _SearchUtility2 = _interopRequireDefault(_SearchUtility); | |
var _deepAssign = __webpack_require__(38); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _normalizeDataUri = __webpack_require__(39); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _AppDownload = __webpack_require__(47); | |
var _AppDownload2 = _interopRequireDefault(_AppDownload); | |
var _UiIcon = __webpack_require__(48); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _SearchIndex = __webpack_require__(49); | |
var _SearchIndex2 = _interopRequireDefault(_SearchIndex); | |
var _buildPageNumber = __webpack_require__(50); | |
var _buildPageNumber2 = _interopRequireDefault(_buildPageNumber); | |
var global = __webpack_require__(51); | |
var _config = __webpack_require__(26); | |
var Scope = __webpack_require__(63); | |
var childFsmDefinition = __webpack_require__(64); | |
var params = __webpack_require__(68); | |
var app = __webpack_require__(69); | |
var property = __webpack_require__(28); | |
var PROGRAM_SERVER = __webpack_require__(74); | |
var __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__ = __webpack_require__(76); | |
var exports = __webpack_require__(77); | |
var _base = __webpack_require__(82); | |
var _toHyphenCase = __webpack_require__(83); | |
var _toHyphenCase2 = _interopRequireDefault(_toHyphenCase); | |
var _reference = __webpack_require__(12); | |
var _reference2 = _interopRequireDefault(_reference); | |
var _noframeworkWaypoints = __webpack_require__(15); | |
var _noframeworkWaypoints2 = _interopRequireDefault(_noframeworkWaypoints); | |
var _prepareStyleProperties = __webpack_require__(92); | |
var debug = (_interopRequireDefault(_prepareStyleProperties), __webpack_require__(0)("recurly")); | |
var options = { | |
currency : "USD", | |
timeout : 6E4, | |
publicKey : "", | |
parent : true, | |
parentVersion : _deepAssign2.default, | |
cors : true, | |
fraud : { | |
kount : { | |
dataCollector : false | |
}, | |
litle : { | |
sessionId : void 0 | |
}, | |
braintree : { | |
deviceData : void 0 | |
} | |
}, | |
api : "https://api.recurly.com/js/v1", | |
fields : { | |
all : { | |
style : {} | |
}, | |
number : { | |
selector : "[data-recurly=number]", | |
style : {} | |
}, | |
month : { | |
selector : "[data-recurly=month]", | |
style : {} | |
}, | |
year : { | |
selector : "[data-recurly=year]", | |
style : {} | |
}, | |
cvv : { | |
selector : "[data-recurly=cvv]", | |
style : {} | |
}, | |
card : { | |
selector : "[data-recurly=card]", | |
style : {} | |
} | |
} | |
}; | |
var req = BeautifulProperties.Recurly = function(_EventEmitter) { | |
/** | |
* @param {?} url | |
* @return {?} | |
*/ | |
function Request(url) { | |
_classCallCheck(this, Request); | |
var node = bind(this, (Request.__proto__ || Object.getPrototypeOf(Request)).call(this)); | |
return node.id = (0, _AboutPage2.default)(), node.version = _deepAssign2.default, node.configured = false, node.readyState = 0, node.config = (0, _noframeworkWaypoints2.default)({}, options), url && node.configure(url), node.request = new global.Request({ | |
recurly : node | |
}), node.bankAccount = { | |
token : _normalizeDataUri2.default.token.bind(node), | |
bankInfo : _normalizeDataUri2.default.bankInfo.bind(node) | |
}, node.Pricing = function() { | |
return new _reference2.default(node); | |
}, node.Pricing.Checkout = function() { | |
return new _toHyphenCase2.default(node); | |
}, node.Pricing.Subscription = function() { | |
return new _reference2.default(node); | |
}, node; | |
} | |
return _inherits(Request, _EventEmitter), _createClass(Request, [{ | |
key : "url", | |
value : function(id) { | |
return this.config.api + id; | |
} | |
}, { | |
key : "ready", | |
value : function(value) { | |
if (this.readyState > 1) { | |
value(); | |
} else { | |
this.once("ready", value); | |
} | |
} | |
}, { | |
key : "configure", | |
value : function(data) { | |
if (debug("configure"), data = (0, _classlist2.default)(data), "string" == typeof data && (data = { | |
publicKey : data | |
}), data = parseTXT(data), data.publicKey) { | |
/** @type {string} */ | |
this.config.publicKey = data.publicKey; | |
} else { | |
if (!this.config.publicKey) { | |
throw (0, _SearchUtility2.default)("config-missing-public-key"); | |
} | |
} | |
if (data.api) { | |
this.config.api = data.api; | |
} | |
if (data.currency) { | |
this.config.currency = data.currency; | |
} | |
if ("cors" in data) { | |
this.config.cors = data.cors; | |
} | |
if ("fraud" in data) { | |
(0, _noframeworkWaypoints2.default)(this.config.fraud, data.fraud); | |
} | |
if ("parent" in data) { | |
this.config.parent = data.parent; | |
} | |
if ("object" === callback(data.fields)) { | |
(0, _noframeworkWaypoints2.default)(this.config.fields, data.fields); | |
} | |
this.config.required = data.required || this.config.required || []; | |
if (this.config.parent) { | |
this.parent(); | |
} else { | |
if (data.parentVersion) { | |
this.config.parentVersion = data.parentVersion; | |
} | |
} | |
/** @type {boolean} */ | |
this.configured = true; | |
} | |
}, { | |
key : "parent", | |
value : function() { | |
var c = this; | |
/** @type {boolean} */ | |
var t = false; | |
if (this.hostedFields && this.readyState > 1 && !this.hostedFields.integrityCheck(this.config.fields) && (t = true), t && (this.readyState = 0, this.hostedFields.reset()), this.readyState > 0) { | |
return void this.bus.send("hostedFields:configure", { | |
recurly : this.config | |
}); | |
} | |
if (!this.fraud) { | |
this.fraud = new __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__.Fraud(this); | |
} | |
if (this.bus) { | |
this.bus.stop(); | |
} | |
this.bus = new PROGRAM_SERVER.Bus({ | |
api : this.config.api | |
}); | |
this.bus.add(this); | |
if (!(this.hostedFields && !t)) { | |
this.hostedFields = new exports.HostedFields({ | |
recurly : this.config | |
}); | |
} | |
if (0 === this.hostedFields.errors.length) { | |
this.bus.add(this.hostedFields); | |
this.once("hostedFields:ready", function(canCreateDiscussions) { | |
/** @type {number} */ | |
c.readyState = 2; | |
c.emit("ready"); | |
}); | |
this.on("hostedFields:state:change", function(fieldArr) { | |
return c.emit("change", { | |
fields : fieldArr | |
}); | |
}); | |
this.on("hostedField:submit", function() { | |
return c.emit("field:submit"); | |
}); | |
/** @type {number} */ | |
this.readyState = 1; | |
} else { | |
/** @type {number} */ | |
this.readyState = 3; | |
this.emit("ready"); | |
} | |
} | |
}, { | |
key : "isParent", | |
get : function() { | |
return !!this.config.parent; | |
} | |
}, { | |
key : "deviceId", | |
get : function() { | |
return (0, _base.storage)({ | |
key : "deviceId", | |
otherwise : (0, _AboutPage2.default)() | |
}); | |
} | |
}, { | |
key : "sessionId", | |
get : function() { | |
return (0, _base.storage)({ | |
scope : "session", | |
key : "sessionId", | |
otherwise : (0, _AboutPage2.default)() | |
}); | |
} | |
}]), Request; | |
}(_custom2.default); | |
req.prototype.Adyen = Scope.factory; | |
req.prototype.ApplePay = childFsmDefinition.factory; | |
req.prototype.coupon = _AppDownload2.default; | |
req.prototype.Frame = params.factory; | |
req.prototype.giftCard = _UiIcon2.default; | |
req.prototype.giftcard = _UiIcon2.default; | |
req.prototype.PayPal = app.factory; | |
req.prototype.paypal = property.deprecated; | |
req.prototype.plan = _SearchIndex2.default; | |
req.prototype.tax = _buildPageNumber2.default; | |
req.prototype.token = _config.token; | |
req.prototype.validate = __webpack_require__(93); | |
}, function(mixin, canCreateDiscussions) { | |
if ("function" == typeof Object.keys) { | |
/** | |
* @param {!Array} params | |
* @param {undefined} value | |
* @return {undefined} | |
*/ | |
mixin.exports = function(params, value) { | |
Object.keys(value).forEach(function(prop) { | |
Object.defineProperty(params, prop, Object.getOwnPropertyDescriptor(value, prop)); | |
}); | |
}; | |
} else { | |
/** | |
* @param {!Object} component | |
* @param {!Object} data | |
* @return {undefined} | |
*/ | |
mixin.exports = function(component, data) { | |
var key; | |
for (key in data) { | |
if (data.hasOwnProperty(key)) { | |
component[key] = data[key]; | |
} | |
} | |
}; | |
} | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {!Object} string | |
* @return {?} | |
*/ | |
function h(string) { | |
return string.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\//g, "").replace(BRACES_ESCAPED, "").match(/[a-zA-Z_]\w*/g) || []; | |
} | |
/** | |
* @param {!Object} template | |
* @param {string} object | |
* @param {string} f | |
* @return {?} | |
*/ | |
function substitute(template, object, f) { | |
/** @type {!RegExp} */ | |
var STAT_RE = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\/|[a-zA-Z_]\w*/g; | |
return template.replace(STAT_RE, function(aTarget) { | |
return "(" == aTarget[aTarget.length - 1] ? f(aTarget) : ~object.indexOf(aTarget) ? f(aTarget) : aTarget; | |
}); | |
} | |
/** | |
* @param {!NodeList} m | |
* @return {?} | |
*/ | |
function f(m) { | |
/** @type {!Array} */ | |
var ret = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < m.length; i++) { | |
if (!~ret.indexOf(m[i])) { | |
ret.push(m[i]); | |
} | |
} | |
return ret; | |
} | |
/** | |
* @param {string} f | |
* @return {?} | |
*/ | |
function callable(f) { | |
return function(v12) { | |
return f + v12; | |
}; | |
} | |
/** @type {!RegExp} */ | |
var BRACES_ESCAPED = /\b(Array|Date|Object|Math|JSON)\b/g; | |
/** | |
* @param {!Object} value | |
* @param {string} fn | |
* @return {?} | |
*/ | |
mixin.exports = function(value, fn) { | |
var val = f(h(value)); | |
return fn && "string" == typeof fn && (fn = callable(fn)), fn ? substitute(value, val, fn) : val; | |
}; | |
}, function(canCreateDiscussions, self, n) { | |
/** | |
* @param {!Object} action | |
* @return {?} | |
*/ | |
function r(action) { | |
return (action || "").toString().replace(/[-\s]/g, ""); | |
} | |
Object.defineProperty(self, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object): ?} */ | |
self.parseCard = r; | |
}, function(module, canCreateDiscussions, n) { | |
/** | |
* @param {!Array} init | |
* @return {undefined} | |
*/ | |
function rawAsap(init) { | |
if (!a.length) { | |
requestFlush(); | |
/** @type {boolean} */ | |
s = true; | |
} | |
/** @type {!Array} */ | |
a[a.length] = init; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function err() { | |
for (; c < a.length;) { | |
var tag = c; | |
if (c = c + 1, a[tag].call(), c > midcolumn) { | |
/** @type {number} */ | |
var j = 0; | |
/** @type {number} */ | |
var C = a.length - c; | |
for (; j < C; j++) { | |
a[j] = a[j + c]; | |
} | |
a.length -= c; | |
/** @type {number} */ | |
c = 0; | |
} | |
} | |
/** @type {number} */ | |
a.length = 0; | |
/** @type {number} */ | |
c = 0; | |
/** @type {boolean} */ | |
s = false; | |
} | |
/** | |
* @param {!Function} callback | |
* @return {?} | |
*/ | |
function makeRequestCallFromTimer(callback) { | |
return function() { | |
/** | |
* @return {undefined} | |
*/ | |
function handleTimer() { | |
clearTimeout(timeoutHandle); | |
clearInterval(intervalHandle); | |
callback(); | |
} | |
/** @type {number} */ | |
var timeoutHandle = setTimeout(handleTimer, 0); | |
/** @type {number} */ | |
var intervalHandle = setInterval(handleTimer, 50); | |
}; | |
} | |
/** @type {function(!Array): undefined} */ | |
module.exports = rawAsap; | |
var requestFlush; | |
/** @type {!Array} */ | |
var a = []; | |
/** @type {boolean} */ | |
var s = false; | |
/** @type {number} */ | |
var c = 0; | |
/** @type {number} */ | |
var midcolumn = 1024; | |
var scope = "undefined" != typeof global ? global : self; | |
var RectObj = scope.MutationObserver || scope.WebKitMutationObserver; | |
requestFlush = "function" == typeof RectObj ? function(obj) { | |
/** @type {number} */ | |
var q = 1; | |
var o = new RectObj(obj); | |
/** @type {!Text} */ | |
var item = document.createTextNode(""); | |
return o.observe(item, { | |
characterData : true | |
}), function() { | |
/** @type {number} */ | |
q = -q; | |
/** @type {number} */ | |
item.data = q; | |
}; | |
}(err) : makeRequestCallFromTimer(err); | |
rawAsap.requestFlush = requestFlush; | |
/** @type {function(!Function): ?} */ | |
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; | |
}, function(module, canCreateDiscussions, bind) { | |
var toString = bind(61); | |
var fn = bind(62); | |
var v = bind(25); | |
module.exports = { | |
formats : v, | |
parse : fn, | |
stringify : toString | |
}; | |
}, function(canCreateDiscussions, exports, n) { | |
/** @type {function(this:Object, *): boolean} */ | |
var has = Object.prototype.hasOwnProperty; | |
var splits = function() { | |
/** @type {!Array} */ | |
var newNodeLists = []; | |
/** @type {number} */ | |
var alpha255 = 0; | |
for (; alpha255 < 256; ++alpha255) { | |
newNodeLists.push("%" + ((alpha255 < 16 ? "0" : "") + alpha255.toString(16)).toUpperCase()); | |
} | |
return newNodeLists; | |
}(); | |
/** | |
* @param {!Array} array | |
* @return {?} | |
*/ | |
var join = function(array) { | |
var result; | |
for (; array.length;) { | |
var subj = array.pop(); | |
if (result = subj.obj[subj.prop], Array.isArray(result)) { | |
/** @type {!Array} */ | |
var resultListArray = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < result.length; ++i) { | |
if (void 0 !== result[i]) { | |
resultListArray.push(result[i]); | |
} | |
} | |
/** @type {!Array} */ | |
subj.obj[subj.prop] = resultListArray; | |
} | |
} | |
return result; | |
}; | |
/** | |
* @param {!Object} arr | |
* @param {boolean} options | |
* @return {?} | |
*/ | |
exports.arrayToObject = function(arr, options) { | |
/** @type {!Object} */ | |
var ret = options && options.plainObjects ? Object.create(null) : {}; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < arr.length; ++i) { | |
if (void 0 !== arr[i]) { | |
ret[i] = arr[i]; | |
} | |
} | |
return ret; | |
}; | |
/** | |
* @param {!Object} obj | |
* @param {string} value | |
* @param {boolean} options | |
* @return {?} | |
*/ | |
exports.merge = function(obj, value, options) { | |
if (!value) { | |
return obj; | |
} | |
if ("object" != typeof value) { | |
if (Array.isArray(obj)) { | |
obj.push(value); | |
} else { | |
if ("object" != typeof obj) { | |
return [obj, value]; | |
} | |
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, value)) { | |
/** @type {boolean} */ | |
obj[value] = true; | |
} | |
} | |
return obj; | |
} | |
if ("object" != typeof obj) { | |
return [obj].concat(value); | |
} | |
/** @type {!Object} */ | |
var request = obj; | |
return Array.isArray(obj) && !Array.isArray(value) && (request = exports.arrayToObject(obj, options)), Array.isArray(obj) && Array.isArray(value) ? (value.forEach(function(val, key) { | |
if (has.call(obj, key)) { | |
if (obj[key] && "object" == typeof obj[key]) { | |
obj[key] = exports.merge(obj[key], val, options); | |
} else { | |
obj.push(val); | |
} | |
} else { | |
/** @type {string} */ | |
obj[key] = val; | |
} | |
}), obj) : Object.keys(value).reduce(function(obj, key) { | |
var val = value[key]; | |
return has.call(obj, key) ? obj[key] = exports.merge(obj[key], val, options) : obj[key] = val, obj; | |
}, request); | |
}; | |
/** | |
* @param {string} callback | |
* @param {string} obj | |
* @return {?} | |
*/ | |
exports.assign = function(callback, obj) { | |
return Object.keys(obj).reduce(function(_props, k) { | |
return _props[k] = obj[k], _props; | |
}, callback); | |
}; | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
exports.decode = function(str) { | |
try { | |
return decodeURIComponent(str.replace(/\+/g, " ")); | |
} catch (t) { | |
return str; | |
} | |
}; | |
/** | |
* @param {string} string | |
* @return {?} | |
*/ | |
exports.encode = function(string) { | |
if (0 === string.length) { | |
return string; | |
} | |
/** @type {string} */ | |
var t = "string" == typeof string ? string : String(string); | |
/** @type {string} */ | |
var s = ""; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < t.length; ++i) { | |
/** @type {number} */ | |
var k = t.charCodeAt(i); | |
if (45 === k || 46 === k || 95 === k || 126 === k || k >= 48 && k <= 57 || k >= 65 && k <= 90 || k >= 97 && k <= 122) { | |
/** @type {string} */ | |
s = s + t.charAt(i); | |
} else { | |
if (k < 128) { | |
s = s + splits[k]; | |
} else { | |
if (k < 2048) { | |
/** @type {string} */ | |
s = s + (splits[192 | k >> 6] + splits[128 | 63 & k]); | |
} else { | |
if (k < 55296 || k >= 57344) { | |
/** @type {string} */ | |
s = s + (splits[224 | k >> 12] + splits[128 | k >> 6 & 63] + splits[128 | 63 & k]); | |
} else { | |
/** @type {number} */ | |
i = i + 1; | |
/** @type {number} */ | |
k = 65536 + ((1023 & k) << 10 | 1023 & t.charCodeAt(i)); | |
/** @type {string} */ | |
s = s + (splits[240 | k >> 18] + splits[128 | k >> 12 & 63] + splits[128 | k >> 6 & 63] + splits[128 | 63 & k]); | |
} | |
} | |
} | |
} | |
} | |
return s; | |
}; | |
/** | |
* @param {!Object} object | |
* @return {?} | |
*/ | |
exports.compact = function(object) { | |
/** @type {!Array} */ | |
var subjects = [{ | |
obj : { | |
o : object | |
}, | |
prop : "o" | |
}]; | |
/** @type {!Array} */ | |
var seen_opts = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < subjects.length; ++i) { | |
var subj = subjects[i]; | |
var obj = subj.obj[subj.prop]; | |
/** @type {!Array<string>} */ | |
var c = Object.keys(obj); | |
/** @type {number} */ | |
var l = 0; | |
for (; l < c.length; ++l) { | |
/** @type {string} */ | |
var name = c[l]; | |
var t = obj[name]; | |
if ("object" == typeof t && null !== t && -1 === seen_opts.indexOf(t)) { | |
subjects.push({ | |
obj : obj, | |
prop : name | |
}); | |
seen_opts.push(t); | |
} | |
} | |
} | |
return join(subjects); | |
}; | |
/** | |
* @param {?} re | |
* @return {?} | |
*/ | |
exports.isRegExp = function(re) { | |
return "[object RegExp]" === Object.prototype.toString.call(re); | |
}; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
exports.isBuffer = function(obj) { | |
return null !== obj && void 0 !== obj && !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); | |
}; | |
}, function(module, canCreateDiscussions, n) { | |
/** @type {function(this:string, (RegExp|null|string), (!Function|null|string)): string} */ | |
var replace = String.prototype.replace; | |
/** @type {!RegExp} */ | |
var reUnescape = /%20/g; | |
module.exports = { | |
default : "RFC3986", | |
formatters : { | |
RFC1738 : function(value) { | |
return replace.call(value, reUnescape, "+"); | |
}, | |
RFC3986 : function(value) { | |
return value; | |
} | |
}, | |
RFC1738 : "RFC1738", | |
RFC3986 : "RFC3986" | |
}; | |
}, function(canCreateDiscussions, scope, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {string} uri | |
* @param {!Function} fn | |
* @return {?} | |
*/ | |
function handler(uri, fn) { | |
/** | |
* @param {?} context | |
* @param {!Object} args | |
* @return {?} | |
*/ | |
function cb(context, args) { | |
if (context) { | |
return fn(context); | |
} | |
if (results.fields.token && args.id) { | |
results.fields.token.value = args.id; | |
} | |
fn(null, args); | |
} | |
callback("token"); | |
var results = (0, s.normalize)(luckNumber, uri, { | |
parseCard : true | |
}); | |
var data = results.values; | |
if (!this.configured) { | |
throw (0, _UiIcon2.default)("not-configured"); | |
} | |
if ("function" != typeof fn) { | |
throw (0, _UiIcon2.default)("missing-callback"); | |
} | |
if (this.config.parent) { | |
if (data.fraud = this.fraud.params(data), this.hostedFields.errors.length > 0) { | |
throw this.hostedFields.errors[0]; | |
} | |
var id = (0, _normalizeDataUri2.default)(); | |
this.bus.send("token:init", { | |
id : id, | |
inputs : data | |
}); | |
this.once("token:done:" + id, function(result) { | |
return cb(result.err, result.token); | |
}); | |
} else { | |
var fields = parse.call(this, data); | |
if (fields.length) { | |
return fn((0, _UiIcon2.default)("validation", { | |
fields : fields | |
})); | |
} | |
this.request.post({ | |
route : "/token", | |
data : data, | |
done : cb | |
}); | |
} | |
} | |
/** | |
* @param {!Object} doc | |
* @return {?} | |
*/ | |
function parse(doc) { | |
/** @type {!Array} */ | |
var table = []; | |
return this.validate.cardNumber(doc.number) || table.push("number"), this.validate.expiry(doc.month, doc.year) || table.push("month", "year"), doc.first_name || table.push("first_name"), doc.last_name || table.push("last_name"), !~this.config.required.indexOf("cvv") && !doc.cvv || this.validate.cvv(doc.cvv) || table.push("cvv"), (0, _prepareStyleProperties2.default)(this.config.required, function(n) { | |
if (!doc[n] && ~luckNumber.indexOf(n)) { | |
table.push(n); | |
} | |
}), callback("validate errors", table), table; | |
} | |
Object.defineProperty(scope, "__esModule", { | |
value : true | |
}); | |
scope.FIELDS = void 0; | |
/** @type {function(string, !Function): ?} */ | |
scope.token = handler; | |
var _prepareStyleProperties = __webpack_require__(4); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var s = __webpack_require__(14); | |
var _normalizeDataUri = __webpack_require__(3); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(1); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var callback = __webpack_require__(0)("recurly:token"); | |
/** @type {!Array} */ | |
var luckNumber = scope.FIELDS = ["first_name", "last_name", "address1", "address2", "company", "country", "city", "state", "postal_code", "phone", "vat_number", "fraud_session_id", "token"]; | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {!Object} string | |
* @return {?} | |
*/ | |
function h(string) { | |
return string.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\//g, "").replace(BRACES_ESCAPED, "").match(/[a-zA-Z_]\w*/g) || []; | |
} | |
/** | |
* @param {!Object} template | |
* @param {string} map | |
* @param {string} transform | |
* @return {?} | |
*/ | |
function substitute(template, map, transform) { | |
/** @type {!RegExp} */ | |
var STAT_RE = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\/|[a-zA-Z_]\w*/g; | |
return template.replace(STAT_RE, function(move) { | |
return "(" == move[move.length - 1] ? transform(move) : ~map.indexOf(move) ? transform(move) : move; | |
}); | |
} | |
/** | |
* @param {!NodeList} m | |
* @return {?} | |
*/ | |
function f(m) { | |
/** @type {!Array} */ | |
var ret = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < m.length; i++) { | |
if (!~ret.indexOf(m[i])) { | |
ret.push(m[i]); | |
} | |
} | |
return ret; | |
} | |
/** | |
* @param {string} f | |
* @return {?} | |
*/ | |
function callable(f) { | |
return function(v12) { | |
return f + v12; | |
}; | |
} | |
/** @type {!RegExp} */ | |
var BRACES_ESCAPED = /\b(Array|Date|Object|Math|JSON)\b/g; | |
/** | |
* @param {!Object} value | |
* @param {string} fn | |
* @return {?} | |
*/ | |
mixin.exports = function(value, fn) { | |
var val = f(h(value)); | |
return fn && "string" == typeof fn && (fn = callable(fn)), fn ? substitute(value, val, fn) : val; | |
}; | |
}, function(canCreateDiscussions, d, _$$mdAnimate_) { | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function _possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {(Object|string)} message | |
* @param {?} cb | |
* @return {undefined} | |
*/ | |
function message(message, cb) { | |
animate("start"); | |
var coreConnection = this.Frame({ | |
path : "/paypal/start", | |
payload : message | |
}); | |
coreConnection.once("error", function(fallbackReleases) { | |
return cb(fallbackReleases); | |
}); | |
coreConnection.once("done", function(formattedSections) { | |
return cb(null, formattedSections); | |
}); | |
} | |
Object.defineProperty(d, "__esModule", { | |
value : true | |
}); | |
d.DirectStrategy = void 0; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function((Object|string), ?): undefined} */ | |
d.deprecated = message; | |
var clojIsReversed = _$$mdAnimate_(7); | |
var c = (function(isSlidingUp) { | |
if (isSlidingUp) { | |
isSlidingUp.__esModule; | |
} | |
}(clojIsReversed), _$$mdAnimate_(29)); | |
var animate = _$$mdAnimate_(0)("recurly:paypal:strategy:direct"); | |
d.DirectStrategy = function(_EventEmitter) { | |
/** | |
* @return {?} | |
*/ | |
function Agent() { | |
var _Object$getPrototypeO; | |
_classCallCheck(this, Agent); | |
/** @type {number} */ | |
var _len = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len); | |
/** @type {number} */ | |
var _key = 0; | |
for (; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Agent.__proto__ || Object.getPrototypeOf(Agent)).call.apply(_Object$getPrototypeO, [this].concat(args))); | |
return _this.emit("ready"), _this; | |
} | |
return _inherits(Agent, _EventEmitter), _createClass(Agent, [{ | |
key : "start", | |
value : function() { | |
var _ = this; | |
var payload = this.payload; | |
var coreConnection = this.recurly.Frame({ | |
path : "/paypal/start", | |
payload : payload | |
}); | |
coreConnection.once("error", function(xhr) { | |
return _.error("paypal-tokenize-error", { | |
cause : xhr | |
}); | |
}); | |
coreConnection.once("done", function(t) { | |
return _.emit("token", t); | |
}); | |
} | |
}, { | |
key : "payload", | |
get : function() { | |
var item = { | |
description : this.config.display.displayName | |
}; | |
return this.config.display.amount && (item.amount = this.config.display.amount), this.config.display.logoImageUrl && (item.logoImageUrl = this.config.display.logoImageUrl), this.config.display.headerImageUrl && (item.headerImageUrl = this.config.display.headerImageUrl), item; | |
} | |
}]), Agent; | |
}(c.PayPalStrategy); | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} z | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function calcLines(z, t) { | |
if (!(z instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} object | |
* @param {string} t | |
* @return {?} | |
*/ | |
function o(object, t) { | |
if (!object) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? object : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.PayPalStrategy = void 0; | |
/** @type {function(?): ?} */ | |
var type = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(canCreateDiscussions) { | |
return typeof canCreateDiscussions; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(70); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(2); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var GS = __webpack_require__(18); | |
var oracledb = __webpack_require__(10); | |
var _UiIcon = __webpack_require__(1); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var m = __webpack_require__(0)("recurly:paypal:strategy"); | |
/** @type {!Array} */ | |
var visibilityKey = ["amount", "currency", "displayName", "locale", "enableShippingAddress", "shippingAddressOverride", "shippingAddressEditable", "billingAgreementDescription", "landingPageType", "logoImageUrl", "headerImageUrl"]; | |
var config = { | |
display : { | |
locale : "en_US" | |
} | |
}; | |
BeautifulProperties.PayPalStrategy = function(e) { | |
/** | |
* @param {?} params | |
* @return {?} | |
*/ | |
function t(params) { | |
calcLines(this, t); | |
var image = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); | |
return image.isReady = false, image.config = {}, image.once("ready", function() { | |
return image.isReady = true; | |
}), image.configure(params), image; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "ready", | |
value : function(value) { | |
if (this.isReady) { | |
value(); | |
} else { | |
this.once("ready", value); | |
} | |
} | |
}, { | |
key : "configure", | |
value : function(result) { | |
var t = this; | |
if (!(result.recurly instanceof GS.Recurly)) { | |
throw this.error("paypal-factory-only"); | |
} | |
this.recurly = result.recurly; | |
this.config.display = {}; | |
if ("object" === type(result.display)) { | |
this.config.display = (0, _prepareStyleProperties2.default)(result.display, visibilityKey); | |
} | |
if (!this.config.display.locale) { | |
/** @type {string} */ | |
this.config.display.locale = config.display.locale; | |
} | |
if (result.pricing instanceof oracledb.Pricing) { | |
this.pricing = result.pricing; | |
this.pricing.on("change", function() { | |
return t.updatePriceFromPricing(); | |
}); | |
if (this.pricing.hasPrice) { | |
this.updatePriceFromPricing(); | |
} | |
} | |
} | |
}, { | |
key : "initialize", | |
value : function() { | |
m("Method 'initialize' not implemented"); | |
} | |
}, { | |
key : "start", | |
value : function() { | |
m("Method 'start' not implemented"); | |
} | |
}, { | |
key : "cancel", | |
value : function() { | |
this.emit("cancel"); | |
} | |
}, { | |
key : "onFail", | |
value : function(value) { | |
if (this.failure) { | |
value(); | |
} else { | |
this.once("fail", value); | |
} | |
} | |
}, { | |
key : "fail", | |
value : function(options, value) { | |
if (!this.failure) { | |
m("Failure scenario encountered", options, value); | |
var ribbonHTML = this.failure = this.error(options, value); | |
this.emit("fail", ribbonHTML); | |
} | |
} | |
}, { | |
key : "error", | |
value : function() { | |
var ribbonHTML = (arguments.length <= 0 ? void 0 : arguments[0]) instanceof Error ? arguments.length <= 0 ? void 0 : arguments[0] : _UiIcon2.default.apply(void 0, arguments); | |
return this.emit("error", ribbonHTML), ribbonHTML; | |
} | |
}, { | |
key : "updatePriceFromPricing", | |
value : function() { | |
this.config.display.amount = this.pricing.totalNow; | |
this.config.display.currency = this.pricing.currencyCode; | |
} | |
}]), t; | |
}(_normalizeDataUri2.default); | |
}, function(def, canCreateDiscussions, n) { | |
/** | |
* @param {!Array} arr | |
* @return {?} | |
*/ | |
def.exports = function(arr) { | |
if (!Array.isArray(arr)) { | |
throw new TypeError("array-unique expects an array."); | |
} | |
var l = arr.length; | |
/** @type {number} */ | |
var i = -1; | |
for (; i++ < l;) { | |
/** @type {number} */ | |
var j = i + 1; | |
for (; j < arr.length; ++j) { | |
if (arr[i] === arr[j]) { | |
arr.splice(j--, 1); | |
} | |
} | |
} | |
return arr; | |
}; | |
/** | |
* @param {!NodeList} value | |
* @return {?} | |
*/ | |
def.exports.immutable = function(value) { | |
if (!Array.isArray(value)) { | |
throw new TypeError("array-unique expects an array."); | |
} | |
var n = value.length; | |
/** @type {!Array} */ | |
var data = new Array(n); | |
/** @type {number} */ | |
var k = 0; | |
for (; k < n; k++) { | |
data[k] = value[k]; | |
} | |
return def.exports(data); | |
}; | |
}, function(canCreateDiscussions, exports, $) { | |
/** | |
* @param {string} x | |
* @return {undefined} | |
*/ | |
function wxWrapper(x) { | |
if ("number" == typeof this[x]) { | |
this[x] = (0, button.default)(this[x]); | |
} | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
/** @type {function(string): undefined} */ | |
exports.default = wxWrapper; | |
var button2 = $(16); | |
var button = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(button2); | |
}, function(canCreateDiscussions, exports, n) { | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
function round(value) { | |
return +(Math.ceil(value + "e+2") + "e-2"); | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
/** @type {function(string): ?} */ | |
exports.default = round; | |
}, function(canCreateDiscussions, inst, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} ctx | |
* @param {!Function} type | |
* @return {undefined} | |
*/ | |
function invoke(ctx, type) { | |
if (!(ctx instanceof type)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} dst | |
* @param {string} a | |
* @return {?} | |
*/ | |
function test(dst, a) { | |
if (!dst) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !a || "object" != typeof a && "function" != typeof a ? dst : a; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {?} r | |
* @return {undefined} | |
*/ | |
function callback(r) { | |
if ("not-found" !== r.code) { | |
throw r; | |
} | |
} | |
Object.defineProperty(inst, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(?): undefined} */ | |
inst.ignoreNotFound = callback; | |
var _normalizeDataUri = __webpack_require__(2); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(5); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _prepareStyleProperties = __webpack_require__(6); | |
var o = _interopRequireDefault(_prepareStyleProperties); | |
var trigger = __webpack_require__(0)("recurly:pricing:attachment"); | |
/** @type {string} */ | |
var changed = "init-all"; | |
var channel = function(_EventEmitter) { | |
/** | |
* @param {!Object} track | |
* @param {!Object} elem | |
* @return {?} | |
*/ | |
function start(track, elem) { | |
invoke(this, start); | |
var self = test(this, (start.__proto__ || Object.getPrototypeOf(start)).call(this)); | |
if (self.pricing = track, self.container = o.default.element(elem), !self.container) { | |
throw new Error("invalid dom element"); | |
} | |
return self.change = self.change.bind(self), self.update = self.update.bind(self), self.pricing.on("change", self.update), self.elements.all.forEach(function(input) { | |
input.addEventListener("change", self.change); | |
input.addEventListener("propertychange", self.change); | |
}), self.change(changed), self; | |
} | |
return _inherits(start, _EventEmitter), _createClass(start, [{ | |
key : "change", | |
value : function(event) { | |
var self = this; | |
trigger("change"); | |
var data = this.elements; | |
var itemData = event.target || event.srcElement; | |
var type = o.default.data(itemData, "recurly"); | |
/** | |
* @param {string} name | |
* @return {?} | |
*/ | |
var check = function(name) { | |
return name in data && event === changed || type === name; | |
}; | |
var a = data.addon && check("addon"); | |
var s = check("country") || check("postal_code"); | |
var result = check("currency"); | |
var l = data.coupon && (check("coupon") || check("plan")); | |
var f = data.gift_card && check("gift_card"); | |
var p = check("shipping_address.country") || check("shipping_address.postal_code"); | |
var m = check("vat_number") || check("tax_code"); | |
var item = this.pricing.plan(o.default.value(data.plan), { | |
quantity : o.default.value(data.plan_quantity) | |
}); | |
if (result) { | |
item = item.currency(o.default.value(data.currency)); | |
} | |
if (a) { | |
item = item.then(function() { | |
data.addon.forEach(function(value) { | |
var plan = self.pricing.items.plan; | |
var r = o.default.data(value, "recurlyAddon"); | |
var quantity = o.default.value(value); | |
if (plan.addons && (0, _UiIcon2.default)(plan.addons, { | |
code : r | |
})) { | |
item = item.addon(r, { | |
quantity : quantity | |
}); | |
} | |
}); | |
}); | |
} | |
if (l) { | |
item = item.coupon(o.default.value(data.coupon).trim()).then(null, callback); | |
} | |
if (f) { | |
item = item.giftcard(o.default.value(data.gift_card).trim()).then(null, callback); | |
} | |
if (s) { | |
item = item.address({ | |
country : o.default.value(data.country), | |
postal_code : o.default.value(data.postal_code) | |
}); | |
} | |
if (p) { | |
item = item.shippingAddress({ | |
country : o.default.value(data["shipping_address.country"]), | |
postal_code : o.default.value(data["shipping_address.postal_code"]) | |
}); | |
} | |
if (m) { | |
item = item.tax({ | |
vat_number : o.default.value(data.vat_number), | |
tax_code : o.default.value(data.tax_code) | |
}); | |
} | |
this.pricing = item.done(function() { | |
return event === changed && self.emit("ready"); | |
}); | |
} | |
}, { | |
key : "update", | |
value : function(event) { | |
var data = this.elements; | |
o.default.value(data.currency_code, event.currency.code); | |
o.default.value(data.currency_symbol, event.currency.symbol); | |
o.default.value(data.plan_base, event.base.plan.unit); | |
o.default.value(data.plan_interval, event.base.plan.interval); | |
["plan", "addons", "discount", "setup_fee", "subtotal", "tax", "total", "gift_card"].forEach(function(key) { | |
o.default.value(data[key + "_now"], event.now[key]); | |
o.default.value(data[key + "_next"], event.next[key]); | |
}); | |
if (data.addon_price) { | |
data.addon_price.forEach(function(value) { | |
var undefined = event.base.addons[o.default.data(value, "recurlyAddon")]; | |
if (undefined) { | |
o.default.value(value, undefined); | |
} | |
}); | |
} | |
} | |
}, { | |
key : "detach", | |
value : function() { | |
var state = this; | |
this.pricing.off("change", this.update); | |
this.elements.all.forEach(function(input) { | |
input.removeEventListener("change", state.change); | |
input.removeEventListener("propertychange", state.change); | |
}); | |
} | |
}, { | |
key : "elements", | |
get : function() { | |
if (this._elements) { | |
return this._elements; | |
} | |
var q = { | |
all : [].slice.call(this.container.querySelectorAll("[data-recurly]")) | |
}; | |
return q.all.forEach(function(t) { | |
var n = o.default.data(t, "recurly"); | |
if (!(n in q)) { | |
/** @type {!Array} */ | |
q[n] = []; | |
} | |
q[n].push(t); | |
}), this._elements = q, q; | |
} | |
}]), start; | |
}(_normalizeDataUri2.default); | |
inst.default = channel; | |
}, function(canCreateDiscussions, res, n) { | |
/** | |
* @param {!Object} num | |
* @return {?} | |
*/ | |
function value(num) { | |
var toBigInteger = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function(att) { | |
return att; | |
}; | |
return num.reduce(function(i, n) { | |
var a = toBigInteger(n); | |
return (i[a] = i[a] || []).push(n), i; | |
}, {}); | |
} | |
Object.defineProperty(res, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object): ?} */ | |
res.default = value; | |
}, function(module, ElementFactory, floor) { | |
var startYNew = floor(18); | |
module.exports = ElementFactory = new startYNew.Recurly; | |
ElementFactory.Recurly = startYNew.Recurly; | |
}, function(mixin, canCreateDiscussions) { | |
var done = "undefined" != typeof crypto && crypto.getRandomValues.bind(crypto) || "undefined" != typeof msCrypto && msCrypto.getRandomValues.bind(msCrypto); | |
if (done) { | |
/** @type {!Uint8Array} */ | |
var result = new Uint8Array(16); | |
/** | |
* @return {?} | |
*/ | |
mixin.exports = function() { | |
return done(result), result; | |
}; | |
} else { | |
/** @type {!Array} */ | |
var i = new Array(16); | |
/** | |
* @return {?} | |
*/ | |
mixin.exports = function() { | |
var e; | |
/** @type {number} */ | |
var id = 0; | |
for (; id < 16; id++) { | |
if (0 == (3 & id)) { | |
/** @type {number} */ | |
e = 4294967296 * Math.random(); | |
} | |
/** @type {number} */ | |
i[id] = e >>> ((3 & id) << 3) & 255; | |
} | |
return i; | |
}; | |
} | |
}, function(exp, canCreateDiscussions) { | |
/** | |
* @param {!Object} paths | |
* @param {number} callback | |
* @return {?} | |
*/ | |
function create(paths, callback) { | |
var done = callback || 0; | |
/** @type {!Array} */ | |
var node = firstChild; | |
return node[paths[done++]] + node[paths[done++]] + node[paths[done++]] + node[paths[done++]] + "-" + node[paths[done++]] + node[paths[done++]] + "-" + node[paths[done++]] + node[paths[done++]] + "-" + node[paths[done++]] + node[paths[done++]] + "-" + node[paths[done++]] + node[paths[done++]] + node[paths[done++]] + node[paths[done++]] + node[paths[done++]] + node[paths[done++]]; | |
} | |
/** @type {!Array} */ | |
var firstChild = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < 256; ++i) { | |
/** @type {string} */ | |
firstChild[i] = (i + 256).toString(16).substr(1); | |
} | |
/** @type {function(!Object, number): ?} */ | |
exp.exports = create; | |
}, function(mixin, canCreateDiscussions, n) { | |
/** @type {string} */ | |
mixin.exports = "4.8.7"; | |
}, function(scope, canCreateDiscussions, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {string} id | |
* @param {!Function} callback | |
* @return {?} | |
*/ | |
function handler(id, callback) { | |
next("token"); | |
var obj = (0, c.normalize)(jsontxt, id); | |
var val = obj.values; | |
var ks = prompt(val); | |
if ("function" != typeof callback) { | |
throw (0, _normalizeDataUri2.default)("missing-callback"); | |
} | |
if (ks.length) { | |
return callback((0, _normalizeDataUri2.default)("validation", { | |
fields : ks | |
})); | |
} | |
this.request.post({ | |
route : "/token", | |
data : val, | |
done : function(err, args) { | |
if (err) { | |
return callback(err); | |
} | |
if (obj.fields.token && args.id) { | |
obj.fields.token.value = args.id; | |
} | |
callback(null, args); | |
} | |
}); | |
} | |
/** | |
* @param {?} data | |
* @param {?} fn | |
* @return {?} | |
*/ | |
function render(data, fn) { | |
if (next("bankInfo"), "function" != typeof fn) { | |
throw (0, _normalizeDataUri2.default)("missing-callback"); | |
} | |
var html = data && data.routingNumber; | |
if (!html || "string" != typeof html) { | |
return fn((0, _normalizeDataUri2.default)("validation", { | |
fields : ["routingNumber"] | |
})); | |
} | |
this.request.get({ | |
route : "/bank", | |
data : { | |
routing_number : html | |
}, | |
done : function(err, img) { | |
if (err) { | |
return fn(err); | |
} | |
fn(null, img); | |
} | |
}); | |
} | |
/** | |
* @param {!NodeList} s | |
* @return {?} | |
*/ | |
function prompt(s) { | |
/** @type {!Array} */ | |
var csvContent = []; | |
return (0, _prepareStyleProperties2.default)(address_parts, function(i) { | |
if (!(s[i] && "string" == typeof s[i])) { | |
csvContent.push(i); | |
} | |
}), s.account_number !== s.account_number_confirmation && csvContent.push("account_number_confirmation"), next("validate errors", csvContent), csvContent; | |
} | |
var _prepareStyleProperties = __webpack_require__(4); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var c = __webpack_require__(14); | |
var _normalizeDataUri = __webpack_require__(1); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var next = __webpack_require__(0)("recurly:bankAccount"); | |
scope.exports = { | |
token : handler, | |
bankInfo : render | |
}; | |
/** @type {!Array} */ | |
var jsontxt = ["account_number", "account_number_confirmation", "routing_number", "name_on_account", "account_type", "address1", "address2", "company", "country", "city", "state", "postal_code", "phone", "vat_number", "token"]; | |
/** @type {!Array} */ | |
var address_parts = ["account_number", "account_number_confirmation", "routing_number", "account_type", "name_on_account", "country"]; | |
}, function(scope, canCreateDiscussions, MappedSelectModel) { | |
/** | |
* @param {!Array} v | |
* @return {?} | |
*/ | |
function compile(v) { | |
switch({}.toString.call(v)) { | |
case "[object Object]": | |
return fn(v); | |
case "[object Function]": | |
return v; | |
case "[object String]": | |
return parse(v); | |
case "[object RegExp]": | |
return log(v); | |
default: | |
return next(v); | |
} | |
} | |
/** | |
* @param {!Array} value | |
* @return {?} | |
*/ | |
function next(value) { | |
return function(rbd) { | |
return value === rbd; | |
}; | |
} | |
/** | |
* @param {?} result | |
* @return {?} | |
*/ | |
function log(result) { | |
return function(t) { | |
return result.test(t); | |
}; | |
} | |
/** | |
* @param {!Object} t | |
* @return {?} | |
*/ | |
function parse(t) { | |
return /^ *\W+/.test(t) ? new Function("_", "return _ " + t) : new Function("_", "return " + apply(t)); | |
} | |
/** | |
* @param {!Object} v | |
* @return {?} | |
*/ | |
function fn(v) { | |
var rules = {}; | |
var i; | |
for (i in v) { | |
rules[i] = "string" == typeof v[i] ? next(v[i]) : compile(v[i]); | |
} | |
return function(data) { | |
if ("object" != typeof data) { | |
return false; | |
} | |
var name; | |
for (name in rules) { | |
if (!(name in data)) { | |
return false; | |
} | |
if (!rules[name](data[name])) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
} | |
/** | |
* @param {!Object} a | |
* @return {?} | |
*/ | |
function apply(a) { | |
var d = m(a); | |
if (!d.length) { | |
return "_." + a; | |
} | |
var x; | |
var i; | |
var b; | |
/** @type {number} */ | |
i = 0; | |
for (; i < d.length; i++) { | |
b = d[i]; | |
/** @type {string} */ | |
x = "_." + b; | |
/** @type {string} */ | |
x = "('function' == typeof " + x + " ? " + x + "() : " + x + ")"; | |
a = get(b, a, x); | |
} | |
return a; | |
} | |
/** | |
* @param {string} error | |
* @param {!Object} t | |
* @param {number} n | |
* @return {?} | |
*/ | |
function get(error, t, n) { | |
return t.replace(new RegExp("(\\.)?" + error, "g"), function(undefined, isTemplate) { | |
return isTemplate ? undefined : n; | |
}); | |
} | |
var m; | |
try { | |
m = MappedSelectModel(20); | |
} catch (e) { | |
m = MappedSelectModel(20); | |
} | |
/** @type {function(!Array): ?} */ | |
scope.exports = compile; | |
}, function(module, canCreateDiscussions, addVertex) { | |
/** | |
* @param {!Array} text | |
* @return {?} | |
*/ | |
function encode(text) { | |
return i(text).replace(/\s/g, "-"); | |
} | |
var i = addVertex(42); | |
/** @type {function(!Array): ?} */ | |
module.exports = encode; | |
}, function(task, canCreateDiscussions, addVertex) { | |
/** | |
* @param {!Array} text | |
* @return {?} | |
*/ | |
function r(text) { | |
return i(text).replace(/[\W_]+(.|$)/g, function(canCreateDiscussions, static_id) { | |
return static_id ? " " + static_id : ""; | |
}); | |
} | |
var i = addVertex(43); | |
/** @type {function(!Array): ?} */ | |
task.exports = r; | |
}, function(module, canCreateDiscussions) { | |
/** | |
* @param {!Object} a | |
* @return {?} | |
*/ | |
function debug(a) { | |
return email_filter.test(a) ? a.toLowerCase() : (u.test(a) && (a = t(a)), i.test(a) && (a = r(a)), a.toLowerCase()); | |
} | |
/** | |
* @param {!Object} b | |
* @return {?} | |
*/ | |
function t(b) { | |
return b.replace(tokensRegExp, function(canCreateDiscussions, static_id) { | |
return static_id ? " " + static_id : ""; | |
}); | |
} | |
/** | |
* @param {!Object} val | |
* @return {?} | |
*/ | |
function r(val) { | |
return val.replace(reVowels, function(isSlidingUp, canCreateDiscussions, p_Interval) { | |
return canCreateDiscussions + " " + p_Interval.toLowerCase().split("").join(" "); | |
}); | |
} | |
/** @type {function(!Object): ?} */ | |
module.exports = debug; | |
/** @type {!RegExp} */ | |
var email_filter = /\s/; | |
/** @type {!RegExp} */ | |
var i = /[a-z][A-Z]/; | |
/** @type {!RegExp} */ | |
var u = /[\W_]/; | |
/** @type {!RegExp} */ | |
var tokensRegExp = /[\W_]+(.|$)/g; | |
/** @type {!RegExp} */ | |
var reVowels = /(.)([A-Z]+)/g; | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @return {?} | |
*/ | |
function defaultSetTimout() { | |
throw new Error("setTimeout has not been defined"); | |
} | |
/** | |
* @return {?} | |
*/ | |
function defaultClearTimeout() { | |
throw new Error("clearTimeout has not been defined"); | |
} | |
/** | |
* @param {!Function} fun | |
* @return {?} | |
*/ | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
return setTimeout(fun, 0); | |
} | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
return cachedSetTimeout = setTimeout, setTimeout(fun, 0); | |
} | |
try { | |
return cachedSetTimeout(fun, 0); | |
} catch (t) { | |
try { | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch (t) { | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
/** | |
* @param {?} marker | |
* @return {?} | |
*/ | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
return clearTimeout(marker); | |
} | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
return cachedClearTimeout = clearTimeout, clearTimeout(marker); | |
} | |
try { | |
return cachedClearTimeout(marker); | |
} catch (t) { | |
try { | |
return cachedClearTimeout.call(null, marker); | |
} catch (t) { | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function cleanUpNextTick() { | |
if (y && currentQueue) { | |
/** @type {boolean} */ | |
y = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
/** @type {number} */ | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function drainQueue() { | |
if (!y) { | |
var timeout = runTimeout(cleanUpNextTick); | |
/** @type {boolean} */ | |
y = true; | |
var len = queue.length; | |
for (; len;) { | |
currentQueue = queue; | |
/** @type {!Array} */ | |
queue = []; | |
for (; ++queueIndex < len;) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
/** @type {number} */ | |
queueIndex = -1; | |
/** @type {number} */ | |
len = queue.length; | |
} | |
/** @type {null} */ | |
currentQueue = null; | |
/** @type {boolean} */ | |
y = false; | |
runClearTimeout(timeout); | |
} | |
} | |
/** | |
* @param {(Object|string)} fun | |
* @param {!Array} array | |
* @return {undefined} | |
*/ | |
function Item(fun, array) { | |
/** @type {(Object|string)} */ | |
this.fun = fun; | |
/** @type {!Array} */ | |
this.array = array; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function noop() { | |
} | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
var process = mixin.exports = {}; | |
!function() { | |
try { | |
/** @type {!Function} */ | |
cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout; | |
} catch (e) { | |
/** @type {function(): ?} */ | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
/** @type {!Function} */ | |
cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout; | |
} catch (e) { | |
/** @type {function(): ?} */ | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
}(); | |
var currentQueue; | |
/** @type {!Array} */ | |
var queue = []; | |
/** @type {boolean} */ | |
var y = false; | |
/** @type {number} */ | |
var queueIndex = -1; | |
/** | |
* @param {!Function} fun | |
* @return {undefined} | |
*/ | |
process.nextTick = function(fun) { | |
/** @type {!Array} */ | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (!(1 !== queue.length || y)) { | |
runTimeout(drainQueue); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Item.prototype.run = function() { | |
this.fun.apply(null, this.array); | |
}; | |
/** @type {string} */ | |
process.title = "browser"; | |
/** @type {boolean} */ | |
process.browser = true; | |
process.env = {}; | |
/** @type {!Array} */ | |
process.argv = []; | |
/** @type {string} */ | |
process.version = ""; | |
process.versions = {}; | |
/** @type {function(): undefined} */ | |
process.on = noop; | |
/** @type {function(): undefined} */ | |
process.addListener = noop; | |
/** @type {function(): undefined} */ | |
process.once = noop; | |
/** @type {function(): undefined} */ | |
process.off = noop; | |
/** @type {function(): undefined} */ | |
process.removeListener = noop; | |
/** @type {function(): undefined} */ | |
process.removeAllListeners = noop; | |
/** @type {function(): undefined} */ | |
process.emit = noop; | |
/** @type {function(): undefined} */ | |
process.prependListener = noop; | |
/** @type {function(): undefined} */ | |
process.prependOnceListener = noop; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
process.listeners = function(type) { | |
return []; | |
}; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
process.binding = function(name) { | |
throw new Error("process.binding is not supported"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
process.cwd = function() { | |
return "/"; | |
}; | |
/** | |
* @param {?} dir | |
* @return {?} | |
*/ | |
process.chdir = function(dir) { | |
throw new Error("process.chdir is not supported"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
process.umask = function() { | |
return 0; | |
}; | |
}, function(mixin, exports, __webpack_require__) { | |
/** | |
* @param {string} obj | |
* @return {?} | |
*/ | |
function selectColor(obj) { | |
var i; | |
/** @type {number} */ | |
var hash = 0; | |
for (i in obj) { | |
hash = (hash << 5) - hash + obj.charCodeAt(i); | |
/** @type {number} */ | |
hash = hash | 0; | |
} | |
return exports.colors[Math.abs(hash) % exports.colors.length]; | |
} | |
/** | |
* @param {string} namespace | |
* @return {?} | |
*/ | |
function createDebug(namespace) { | |
/** | |
* @return {undefined} | |
*/ | |
function debug() { | |
if (debug.enabled) { | |
/** @type {function(): undefined} */ | |
var self = debug; | |
/** @type {number} */ | |
var curr = +new Date; | |
/** @type {number} */ | |
var ms = curr - (prevTime || curr); | |
/** @type {number} */ | |
self.diff = ms; | |
self.prev = prevTime; | |
/** @type {number} */ | |
self.curr = curr; | |
/** @type {number} */ | |
prevTime = curr; | |
/** @type {!Array} */ | |
var args = new Array(arguments.length); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < args.length; i++) { | |
args[i] = arguments[i]; | |
} | |
args[0] = exports.coerce(args[0]); | |
if ("string" != typeof args[0]) { | |
args.unshift("%O"); | |
} | |
/** @type {number} */ | |
var index = 0; | |
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(value, name) { | |
if ("%%" === value) { | |
return value; | |
} | |
index++; | |
var url = exports.formatters[name]; | |
if ("function" == typeof url) { | |
var format = args[index]; | |
value = url.call(self, format); | |
args.splice(index, 1); | |
index--; | |
} | |
return value; | |
}); | |
exports.formatArgs.call(self, args); | |
(debug.log || exports.log || console.log.bind(console)).apply(self, args); | |
} | |
} | |
var prevTime; | |
return debug.namespace = namespace, debug.enabled = exports.enabled(namespace), debug.useColors = exports.useColors(), debug.color = selectColor(namespace), debug.destroy = destroy, "function" == typeof exports.init && exports.init(debug), exports.instances.push(debug), debug; | |
} | |
/** | |
* @return {?} | |
*/ | |
function destroy() { | |
var existingProxyIndex = exports.instances.indexOf(this); | |
return -1 !== existingProxyIndex && (exports.instances.splice(existingProxyIndex, 1), true); | |
} | |
/** | |
* @param {string} key | |
* @return {undefined} | |
*/ | |
function enable(key) { | |
exports.save(key); | |
/** @type {!Array} */ | |
exports.names = []; | |
/** @type {!Array} */ | |
exports.skips = []; | |
var i; | |
/** @type {!Array<string>} */ | |
var subscriptions_array = ("string" == typeof key ? key : "").split(/[\s,]+/); | |
/** @type {number} */ | |
var l = subscriptions_array.length; | |
/** @type {number} */ | |
i = 0; | |
for (; i < l; i++) { | |
if (subscriptions_array[i]) { | |
/** @type {string} */ | |
key = subscriptions_array[i].replace(/\*/g, ".*?"); | |
if ("-" === key[0]) { | |
exports.skips.push(new RegExp("^" + key.substr(1) + "$")); | |
} else { | |
exports.names.push(new RegExp("^" + key + "$")); | |
} | |
} | |
} | |
/** @type {number} */ | |
i = 0; | |
for (; i < exports.instances.length; i++) { | |
var request = exports.instances[i]; | |
request.enabled = exports.enabled(request.namespace); | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function disable() { | |
exports.enable(""); | |
} | |
/** | |
* @param {!Object} a | |
* @return {?} | |
*/ | |
function enabled(a) { | |
if ("*" === a[a.length - 1]) { | |
return true; | |
} | |
var i; | |
var tableslen; | |
/** @type {number} */ | |
i = 0; | |
tableslen = exports.skips.length; | |
for (; i < tableslen; i++) { | |
if (exports.skips[i].test(a)) { | |
return false; | |
} | |
} | |
/** @type {number} */ | |
i = 0; | |
tableslen = exports.names.length; | |
for (; i < tableslen; i++) { | |
if (exports.names[i].test(a)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
/** | |
* @param {string} msg | |
* @return {?} | |
*/ | |
function coerce(msg) { | |
return msg instanceof Error ? msg.stack || msg.message : msg; | |
} | |
/** @type {function(string): ?} */ | |
exports = mixin.exports = createDebug.debug = createDebug.default = createDebug; | |
/** @type {function(string): ?} */ | |
exports.coerce = coerce; | |
/** @type {function(): undefined} */ | |
exports.disable = disable; | |
/** @type {function(string): undefined} */ | |
exports.enable = enable; | |
/** @type {function(!Object): ?} */ | |
exports.enabled = enabled; | |
exports.humanize = __webpack_require__(46); | |
/** @type {!Array} */ | |
exports.instances = []; | |
/** @type {!Array} */ | |
exports.names = []; | |
/** @type {!Array} */ | |
exports.skips = []; | |
exports.formatters = {}; | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
function parse(str) { | |
if (str = String(str), !(str.length > 100)) { | |
/** @type {(Array<string>|null)} */ | |
var m = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); | |
if (m) { | |
/** @type {number} */ | |
var i = parseFloat(m[1]); | |
switch((m[2] || "ms").toLowerCase()) { | |
case "years": | |
case "year": | |
case "yrs": | |
case "yr": | |
case "y": | |
return i * result; | |
case "days": | |
case "day": | |
case "d": | |
return i * n; | |
case "hours": | |
case "hour": | |
case "hrs": | |
case "hr": | |
case "h": | |
return i * h; | |
case "minutes": | |
case "minute": | |
case "mins": | |
case "min": | |
case "m": | |
return i * r; | |
case "seconds": | |
case "second": | |
case "secs": | |
case "sec": | |
case "s": | |
return i * a; | |
case "milliseconds": | |
case "millisecond": | |
case "msecs": | |
case "msec": | |
case "ms": | |
return i; | |
default: | |
return; | |
} | |
} | |
} | |
} | |
/** | |
* @param {number} d | |
* @return {?} | |
*/ | |
function short(d) { | |
return d >= n ? Math.round(d / n) + "d" : d >= h ? Math.round(d / h) + "h" : d >= r ? Math.round(d / r) + "m" : d >= a ? Math.round(d / a) + "s" : d + "ms"; | |
} | |
/** | |
* @param {number} ms | |
* @return {?} | |
*/ | |
function long(ms) { | |
return plural(ms, n, "day") || plural(ms, h, "hour") || plural(ms, r, "minute") || plural(ms, a, "second") || ms + " ms"; | |
} | |
/** | |
* @param {number} t | |
* @param {number} s | |
* @param {string} name | |
* @return {?} | |
*/ | |
function plural(t, s, name) { | |
if (!(t < s)) { | |
return t < 1.5 * s ? Math.floor(t / s) + " " + name : Math.ceil(t / s) + " " + name + "s"; | |
} | |
} | |
/** @type {number} */ | |
var a = 1E3; | |
/** @type {number} */ | |
var r = 60 * a; | |
/** @type {number} */ | |
var h = 60 * r; | |
/** @type {number} */ | |
var n = 24 * h; | |
/** @type {number} */ | |
var result = 365.25 * n; | |
/** | |
* @param {!Array} val | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
mixin.exports = function(val, options) { | |
options = options || {}; | |
/** @type {string} */ | |
var type = typeof val; | |
if ("string" === type && val.length > 0) { | |
return parse(val); | |
} | |
if ("number" === type && false === isNaN(val)) { | |
return options.long ? long(val) : short(val); | |
} | |
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val)); | |
}; | |
}, function(canCreateDiscussions, node, $) { | |
/** | |
* @return {undefined} | |
*/ | |
function update() { | |
var data = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; | |
var callback = arguments[1]; | |
UpdateCollisions("%j", data); | |
var relationship = data.coupon; | |
var err = data.plans; | |
var res = data.plan; | |
var currency = data.currency; | |
if (!relationship) { | |
throw (0, button.default)("missing-coupon"); | |
} | |
if ("function" != typeof callback) { | |
throw (0, button.default)("missing-callback"); | |
} | |
if (!err && res) { | |
/** @type {!Array} */ | |
err = [res]; | |
} | |
this.request.piped({ | |
route : "/coupons/" + relationship, | |
data : { | |
plan_codes : err, | |
currency : currency | |
}, | |
by : "plan_codes" | |
}).nodeify(callback); | |
} | |
Object.defineProperty(node, "__esModule", { | |
value : true | |
}); | |
/** @type {function(): undefined} */ | |
node.default = update; | |
var button2 = $(1); | |
var button = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(button2); | |
var UpdateCollisions = $(0)("recurly:coupon"); | |
}, function(canCreateDiscussions, res, __webpack_require__) { | |
/** | |
* @param {!Object} value | |
* @param {!Function} cb | |
* @return {undefined} | |
*/ | |
function r(value, cb) { | |
if (remove("%j", value), "function" != typeof cb) { | |
throw (0, _deepAssign2.default)("missing-callback"); | |
} | |
if ("object" !== (void 0 === value ? "undefined" : isArray(value))) { | |
throw (0, _deepAssign2.default)("invalid-options"); | |
} | |
if (!("giftcard" in value)) { | |
throw (0, _deepAssign2.default)("missing-giftcard"); | |
} | |
/** @type {string} */ | |
var route1Coords = "/gift_cards/" + value.giftcard; | |
this.request.get({ | |
route : route1Coords, | |
data : value, | |
done : cb | |
}); | |
} | |
Object.defineProperty(res, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object): ?} */ | |
var isArray = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(boundsMethod) { | |
return typeof boundsMethod; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
/** @type {function(!Object, !Function): undefined} */ | |
res.default = r; | |
var _deepAssign = __webpack_require__(1); | |
var _deepAssign2 = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(_deepAssign); | |
var remove = __webpack_require__(0)("recurly:giftcard"); | |
}, function(canCreateDiscussions, res, saveNotifs) { | |
/** | |
* @param {?} num | |
* @param {!Function} cb | |
* @return {?} | |
*/ | |
function r(num, cb) { | |
if (write("%s", num), "function" != typeof cb) { | |
throw new Error("Missing callback"); | |
} | |
if (void 0 === num) { | |
return cb(new Error("Missing plan code")); | |
} | |
/** @type {string} */ | |
var name = "/plans/" + num; | |
this.request.get({ | |
route : name, | |
done : cb | |
}); | |
} | |
Object.defineProperty(res, "__esModule", { | |
value : true | |
}); | |
/** @type {function(?, !Function): ?} */ | |
res.default = r; | |
var write = saveNotifs(0)("recurly:plan"); | |
}, function(canCreateDiscussions, obj, n) { | |
/** | |
* @param {!Object} data | |
* @param {!Function} callback | |
* @return {undefined} | |
*/ | |
function update(data, callback) { | |
if (data = unescape_html({}, data), "function" != typeof callback) { | |
throw new Error("Missing callback"); | |
} | |
this.request.get({ | |
cached : true, | |
route : "/tax", | |
data : { | |
country : data.country, | |
postal_code : data.postalCode || data.postal_code, | |
tax_code : data.taxCode || data.tax_code, | |
vat_number : data.vatNumber || data.vat_number | |
}, | |
done : callback | |
}); | |
} | |
Object.defineProperty(obj, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var unescape_html = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(!Object, !Function): undefined} */ | |
obj.default = update; | |
}, function(canCreateDiscussions, exports, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!Object} obj | |
* @param {string} key | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function test(obj, key, value) { | |
return key in obj ? Object.defineProperty(obj, key, { | |
value : value, | |
enumerable : true, | |
configurable : true, | |
writable : true | |
}) : obj[key] = value, obj; | |
} | |
/** | |
* @param {!NodeList} args | |
* @return {?} | |
*/ | |
function resolve(args) { | |
if (Array.isArray(args)) { | |
/** @type {number} */ | |
var i = 0; | |
/** @type {!Array} */ | |
var values = Array(args.length); | |
for (; i < args.length; i++) { | |
values[i] = args[i]; | |
} | |
return values; | |
} | |
return Array.from(args); | |
} | |
/** | |
* @param {!AudioNode} that | |
* @param {!Function} size | |
* @return {undefined} | |
*/ | |
function get(that, size) { | |
if (!(that instanceof size)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
exports.Request = void 0; | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var j = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var installNativeEvent$2 = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _normalizeDataUri = __webpack_require__(52); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(15); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(1); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(53); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var _deepAssign = __webpack_require__(7); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _prepareStyleProperties = __webpack_require__(23); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var log = __webpack_require__(0)("recurly:Request"); | |
var Future = function() { | |
var XHR = window.XMLHttpRequest; | |
var _XDomainRequest = window.XDomainRequest; | |
return XHR && "withCredentials" in new XHR ? XHR : _XDomainRequest || void 0; | |
}(); | |
/** | |
* @return {undefined} | |
*/ | |
var undefined = function() { | |
}; | |
exports.Request = function() { | |
/** | |
* @param {?} fn | |
* @return {undefined} | |
*/ | |
function n(fn) { | |
get(this, n); | |
this.recurly = fn.recurly; | |
this.cache = {}; | |
} | |
return installNativeEvent$2(n, [{ | |
key : "get", | |
value : function(v) { | |
var route = v.route; | |
var message = v.data; | |
var d = v.done; | |
var cache = v.cached; | |
return this[void 0 !== cache && cache ? "cached" : "request"]({ | |
method : "get", | |
route : route, | |
data : message | |
}, d); | |
} | |
}, { | |
key : "post", | |
value : function(v) { | |
var route = v.route; | |
var message = v.data; | |
var d = v.done; | |
var cache = v.cached; | |
return this[void 0 !== cache && cache ? "cached" : "request"]({ | |
method : "post", | |
route : route, | |
data : message | |
}, d); | |
} | |
}, { | |
key : "request", | |
value : function(v) { | |
var m = v.method; | |
var route = v.route; | |
var key = v.data; | |
var url = void 0 === key ? {} : key; | |
var data = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : undefined; | |
if (log("request", m, route, url), !this.recurly.configured) { | |
throw (0, _classlist2.default)("not-configured"); | |
} | |
var version = this.version; | |
var k = this.key; | |
var deviceId = this.deviceId; | |
var sessionId = this.sessionId; | |
var timeout = this.timeout; | |
var fileName = this.recurly.url(route); | |
return url = (0, _UiIcon2.default)({}, url, { | |
version : version, | |
key : k, | |
deviceId : deviceId, | |
sessionId : sessionId | |
}), this.shouldUseXHR ? this.xhr({ | |
method : m, | |
url : fileName, | |
data : url, | |
done : data, | |
timeout : timeout | |
}) : this.jsonp({ | |
url : fileName, | |
data : url, | |
done : data, | |
timeout : timeout | |
}); | |
} | |
}, { | |
key : "cached", | |
value : function(obj) { | |
var method = obj.method; | |
var path = obj.route; | |
var val = obj.data; | |
var predicate = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : undefined; | |
var data = this.cache; | |
/** @type {string} */ | |
var i = method + "-" + path + "-" + JSON.stringify(val); | |
if (data[i]) { | |
return predicate.apply(void 0, [null].concat(resolve(data[i]))); | |
} | |
this.request({ | |
method : method, | |
route : path, | |
data : val | |
}, function(modelFunctionName) { | |
/** @type {number} */ | |
var length = arguments.length; | |
/** @type {!Array} */ | |
var n = Array(length > 1 ? length - 1 : 0); | |
/** @type {number} */ | |
var i = 1; | |
for (; i < length; i++) { | |
n[i - 1] = arguments[i]; | |
} | |
if (!modelFunctionName) { | |
/** @type {!Array} */ | |
data[i] = n; | |
} | |
predicate.apply(void 0, [modelFunctionName].concat(n)); | |
}); | |
} | |
}, { | |
key : "piped", | |
value : function(data) { | |
var queue = this; | |
var msg = data.method; | |
var m = void 0 === msg ? "get" : msg; | |
var route = data.route; | |
var value = data.data; | |
var h = void 0 === value ? {} : value; | |
var c = data.by; | |
var i = data.size; | |
var date = void 0 === i ? 100 : i; | |
/** @type {!Array} */ | |
var a = []; | |
/** @type {!Array} */ | |
var names = []; | |
var deprecatedStylingMethods = (0, _normalizeDataUri2.default)(h[c], date).map(function(mapped) { | |
return j({}, h, test({}, c, mapped)); | |
}); | |
return 0 === deprecatedStylingMethods.length ? _deepAssign2.default.denodeify(this.request.bind(this))({ | |
method : m, | |
route : route, | |
data : h | |
}) : new _deepAssign2.default(function(fn, hide) { | |
/** | |
* @param {?} key | |
* @param {?} val | |
* @return {?} | |
*/ | |
var callback = function(key, val) { | |
if (key) { | |
if ("not-found" !== key.code) { | |
return hide(key); | |
} | |
names.push(key); | |
} | |
if (val) { | |
if (!Array.isArray(val)) { | |
return fn(val); | |
} | |
a.push(val); | |
} | |
if (a.length + names.length === deprecatedStylingMethods.length) { | |
if (a.length > 0) { | |
fn(a.reduce(function(e, t) { | |
return e.concat(t); | |
})); | |
} else { | |
hide(names[0]); | |
} | |
} | |
}; | |
deprecatedStylingMethods.forEach(function(instancesTypes) { | |
return queue.request({ | |
method : m, | |
route : route, | |
data : instancesTypes | |
}, callback); | |
}); | |
}); | |
} | |
}, { | |
key : "xhr", | |
value : function(obj) { | |
var method = obj.method; | |
var url = obj.url; | |
var r = obj.data; | |
var callback = obj.done; | |
var timeout = obj.timeout; | |
var request = new Future; | |
var body = _prepareStyleProperties2.default.stringify(r, { | |
encodeValuesOnly : true | |
}); | |
if ("get" === method) { | |
/** @type {string} */ | |
url = url + ("?" + body); | |
} | |
request.open(method, url); | |
request.timeout = timeout; | |
/** | |
* @return {?} | |
*/ | |
request.ontimeout = function() { | |
return callback((0, _classlist2.default)("api-timeout")); | |
}; | |
/** | |
* @return {?} | |
*/ | |
request.onerror = function() { | |
return callback((0, _classlist2.default)("api-error")); | |
}; | |
/** @type {function(): undefined} */ | |
request.onprogress = undefined; | |
/** | |
* @return {?} | |
*/ | |
request.onload = function() { | |
var result = void 0; | |
try { | |
/** @type {*} */ | |
result = JSON.parse(this.responseText); | |
} catch (file) { | |
return log(file, this.responseText), callback((0, _classlist2.default)("api-error", { | |
message : "There was a problem parsing the API response with: " + this.responseText | |
})); | |
} | |
if (result && result.error) { | |
callback((0, _classlist2.default)("api-error", result.error)); | |
} else { | |
callback(null, result); | |
} | |
}; | |
setTimeout(function() { | |
if ("post" === method) { | |
if (request.setRequestHeader) { | |
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
} | |
request.send(body); | |
} else { | |
request.send(); | |
} | |
}, 0); | |
} | |
}, { | |
key : "jsonp", | |
value : function(obj) { | |
var newUrl = obj.url; | |
var n = obj.data; | |
var callback = obj.done; | |
var to = obj.timeout; | |
newUrl = newUrl + ("?" + _prepareStyleProperties2.default.stringify(n, { | |
encodeValuesOnly : true | |
})); | |
(0, _UiRippleInk2.default)(newUrl, { | |
prefix : "__rjs", | |
timeout : to | |
}, function(undefined, t) { | |
if (undefined) { | |
return callback(undefined); | |
} | |
if (t.error) { | |
callback((0, _classlist2.default)("api-error", t.error)); | |
} else { | |
callback(null, t); | |
} | |
}); | |
} | |
}, { | |
key : "timeout", | |
get : function() { | |
return this.recurly.config.timeout || 6E4; | |
} | |
}, { | |
key : "key", | |
get : function() { | |
return this.recurly.config.publicKey; | |
} | |
}, { | |
key : "version", | |
get : function() { | |
return this.recurly.isParent ? this.recurly.version : this.recurly.config.parentVersion; | |
} | |
}, { | |
key : "deviceId", | |
get : function() { | |
return this.recurly.deviceId; | |
} | |
}, { | |
key : "sessionId", | |
get : function() { | |
return this.recurly.sessionId; | |
} | |
}, { | |
key : "shouldUseXHR", | |
get : function() { | |
return !!this.recurly.config.cors; | |
} | |
}]), n; | |
}(); | |
}, function(module, canCreateDiscussions) { | |
/** | |
* @param {number} array | |
* @param {string} start | |
* @param {string} end | |
* @return {?} | |
*/ | |
function baseSlice(array, start, end) { | |
/** @type {number} */ | |
var i = -1; | |
var length = array.length; | |
if (start < 0) { | |
start = -start > length ? 0 : length + start; | |
} | |
end = end > length ? length : end; | |
if (end < 0) { | |
end = end + length; | |
} | |
/** @type {number} */ | |
length = start > end ? 0 : end - start >>> 0; | |
/** @type {number} */ | |
start = start >>> 0; | |
/** @type {!Array} */ | |
var result = Array(length); | |
for (; ++i < length;) { | |
result[i] = array[i + start]; | |
} | |
return result; | |
} | |
/** | |
* @param {number} e | |
* @param {number} el | |
* @return {?} | |
*/ | |
function test(e, el) { | |
return !!(el = null == el ? max : el) && ("number" == typeof e || touchSystem.test(e)) && e > -1 && e % 1 == 0 && e < el; | |
} | |
/** | |
* @param {number} b | |
* @param {number} name | |
* @param {!Object} element | |
* @return {?} | |
*/ | |
function push(b, name, element) { | |
if (!isObject(element)) { | |
return false; | |
} | |
/** @type {string} */ | |
var undefined = typeof name; | |
return !!("number" == undefined ? h(element) && test(name, element.length) : "string" == undefined && name in element) && equals(element[name], b); | |
} | |
/** | |
* @param {number} array | |
* @param {number} size | |
* @param {!Object} guard | |
* @return {?} | |
*/ | |
function chunk(array, size, guard) { | |
/** @type {number} */ | |
size = (guard ? push(array, size, guard) : void 0 === size) ? 1 : nativeMax(toInteger(size), 0); | |
var length = array ? array.length : 0; | |
if (!length || size < 1) { | |
return []; | |
} | |
/** @type {number} */ | |
var index = 0; | |
/** @type {number} */ | |
var j = 0; | |
/** @type {!Array} */ | |
var result = Array(nativeCeil(length / size)); | |
for (; index < length;) { | |
result[j++] = baseSlice(array, index, index = index + size); | |
} | |
return result; | |
} | |
/** | |
* @param {number} leftObj | |
* @param {number} rightObj | |
* @return {?} | |
*/ | |
function equals(leftObj, rightObj) { | |
return leftObj === rightObj || leftObj !== leftObj && rightObj !== rightObj; | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function h(data) { | |
return null != data && isNumber(data.length) && !reduce(data); | |
} | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function reduce(obj) { | |
/** @type {string} */ | |
var type = isObject(obj) ? to_string.call(obj) : ""; | |
return type == TYPE_CLIP || type == TYPE_SCENE; | |
} | |
/** | |
* @param {number} val | |
* @return {?} | |
*/ | |
function isNumber(val) { | |
return "number" == typeof val && val > -1 && val % 1 == 0 && val <= max; | |
} | |
/** | |
* @param {!Object} o | |
* @return {?} | |
*/ | |
function isObject(o) { | |
/** @type {string} */ | |
var tp = typeof o; | |
return !!o && ("object" == tp || "function" == tp); | |
} | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
function type(name) { | |
return !!name && "object" == typeof name; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isFunction(value) { | |
return "symbol" == typeof value || type(value) && to_string.call(value) == arrayBufferTag; | |
} | |
/** | |
* @param {number} value | |
* @return {?} | |
*/ | |
function sign(value) { | |
if (!value) { | |
return 0 === value ? value : 0; | |
} | |
if ((value = toNumber(value)) === INFINITY$2 || value === -INFINITY$2) { | |
return (value < 0 ? -1 : 1) * g; | |
} | |
return value === value ? value : 0; | |
} | |
/** | |
* @param {number} x | |
* @return {?} | |
*/ | |
function toInteger(x) { | |
var result = sign(x); | |
/** @type {number} */ | |
var remainder = result % 1; | |
return result === result ? remainder ? result - remainder : result : 0; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function toNumber(value) { | |
if ("number" == typeof value) { | |
return value; | |
} | |
if (isFunction(value)) { | |
return NAN; | |
} | |
if (isObject(value)) { | |
var other = "function" == typeof value.valueOf ? value.valueOf() : value; | |
value = isObject(other) ? other + "" : other; | |
} | |
if ("string" != typeof value) { | |
return 0 === value ? value : +value; | |
} | |
/** @type {string} */ | |
value = value.replace(colorToken, ""); | |
/** @type {boolean} */ | |
var isBinary = trueRE.test(value); | |
return isBinary || reKeyword.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reValidName.test(value) ? NAN : +value; | |
} | |
/** @type {number} */ | |
var INFINITY$2 = 1 / 0; | |
/** @type {number} */ | |
var max = 9007199254740991; | |
/** @type {number} */ | |
var g = 1.7976931348623157E308; | |
/** @type {number} */ | |
var NAN = NaN; | |
/** @type {string} */ | |
var TYPE_CLIP = "[object Function]"; | |
/** @type {string} */ | |
var TYPE_SCENE = "[object GeneratorFunction]"; | |
/** @type {string} */ | |
var arrayBufferTag = "[object Symbol]"; | |
/** @type {!RegExp} */ | |
var colorToken = /^\s+|\s+$/g; | |
/** @type {!RegExp} */ | |
var reValidName = /^[-+]0x[0-9a-f]+$/i; | |
/** @type {!RegExp} */ | |
var trueRE = /^0b[01]+$/i; | |
/** @type {!RegExp} */ | |
var reKeyword = /^0o[0-7]+$/i; | |
/** @type {!RegExp} */ | |
var touchSystem = /^(?:0|[1-9]\d*)$/; | |
/** @type {function(*, (number|undefined)): number} */ | |
var freeParseInt = parseInt; | |
var ObjectPrototype = Object.prototype; | |
/** @type {function(this:*): string} */ | |
var to_string = ObjectPrototype.toString; | |
/** @type {function(?): number} */ | |
var nativeCeil = Math.ceil; | |
/** @type {function(...?): number} */ | |
var nativeMax = Math.max; | |
/** @type {function(number, number, !Object): ?} */ | |
module.exports = chunk; | |
}, function(module, canCreateDiscussions, saveNotifs) { | |
/** | |
* @return {undefined} | |
*/ | |
function originalCallback() { | |
} | |
/** | |
* @param {string} response | |
* @param {!Object} opts | |
* @param {!Object} cb | |
* @return {undefined} | |
*/ | |
function jsonp(response, opts, cb) { | |
/** | |
* @return {undefined} | |
*/ | |
function cleanup() { | |
el.parentNode.removeChild(el); | |
/** @type {function(): undefined} */ | |
window[callbackName] = originalCallback; | |
} | |
if ("function" == typeof opts) { | |
/** @type {!Object} */ | |
cb = opts; | |
opts = {}; | |
} | |
if (!opts) { | |
opts = {}; | |
} | |
var el; | |
var _takingTooLongTimeout; | |
var prefix = opts.prefix || "__jp"; | |
var cbkey = opts.param || "callback"; | |
var _SERVICE_TAKING_TOO_LONG = null != opts.timeout ? opts.timeout : 6E4; | |
/** @type {function(string): string} */ | |
var escape = encodeURIComponent; | |
/** @type {!Element} */ | |
var wafCss = document.getElementsByTagName("script")[0] || document.head; | |
var callbackName = prefix + count++; | |
if (_SERVICE_TAKING_TOO_LONG) { | |
/** @type {number} */ | |
_takingTooLongTimeout = setTimeout(function() { | |
cleanup(); | |
if (cb) { | |
cb(new Error("Timeout")); | |
} | |
}, _SERVICE_TAKING_TOO_LONG); | |
} | |
/** | |
* @param {?} km_data | |
* @return {undefined} | |
*/ | |
window[callbackName] = function(km_data) { | |
debug("jsonp got", km_data); | |
if (_takingTooLongTimeout) { | |
clearTimeout(_takingTooLongTimeout); | |
} | |
cleanup(); | |
if (cb) { | |
cb(null, km_data); | |
} | |
}; | |
/** @type {string} */ | |
response = response + ((~response.indexOf("?") ? "&" : "?") + cbkey + "=" + escape(callbackName)); | |
/** @type {string} */ | |
response = response.replace("?&", "?"); | |
debug('jsonp req "%s"', response); | |
/** @type {!Element} */ | |
el = document.createElement("script"); | |
/** @type {string} */ | |
el.src = response; | |
wafCss.parentNode.insertBefore(el, wafCss); | |
} | |
var debug = saveNotifs(0)("jsonp"); | |
/** @type {function(string, !Object, !Object): undefined} */ | |
module.exports = jsonp; | |
/** @type {number} */ | |
var count = 0; | |
}, function(module, canCreateDiscussions, factory) { | |
module.exports = factory(8); | |
factory(55); | |
factory(56); | |
factory(57); | |
factory(58); | |
factory(60); | |
}, function(mixin, canCreateDiscussions, NFA) { | |
var m = NFA(8); | |
mixin.exports = m; | |
/** | |
* @param {?} result | |
* @param {!Object} err | |
* @return {undefined} | |
*/ | |
m.prototype.done = function(result, err) { | |
(arguments.length ? this.then.apply(this, arguments) : this).then(null, function(canCreateDiscussions) { | |
setTimeout(function() { | |
throw canCreateDiscussions; | |
}, 0); | |
}); | |
}; | |
}, function(candidate, canCreateDiscussions, weightFunc) { | |
var d = weightFunc(8); | |
candidate.exports = d; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
d.prototype.finally = function(fn) { | |
return this.then(function(canCreateDiscussions) { | |
return d.resolve(fn()).then(function() { | |
return canCreateDiscussions; | |
}); | |
}, function(canCreateDiscussions) { | |
return d.resolve(fn()).then(function() { | |
throw canCreateDiscussions; | |
}); | |
}); | |
}; | |
}, function(module, canCreateDiscussions, require) { | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
function valuePromise(value) { | |
var p = new Promise(Promise._61); | |
return p._81 = 1, p._65 = value, p; | |
} | |
var Promise = require(8); | |
module.exports = Promise; | |
var FALSE = valuePromise(true); | |
var NULL = valuePromise(false); | |
var UNDEFINED = valuePromise(null); | |
var ZERO = valuePromise(void 0); | |
var TRUE = valuePromise(0); | |
var EMPTYSTRING = valuePromise(""); | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
Promise.resolve = function(value) { | |
if (value instanceof Promise) { | |
return value; | |
} | |
if (null === value) { | |
return UNDEFINED; | |
} | |
if (void 0 === value) { | |
return ZERO; | |
} | |
if (true === value) { | |
return FALSE; | |
} | |
if (false === value) { | |
return NULL; | |
} | |
if (0 === value) { | |
return TRUE; | |
} | |
if ("" === value) { | |
return EMPTYSTRING; | |
} | |
if ("object" == typeof value || "function" == typeof value) { | |
try { | |
var then = value.then; | |
if ("function" == typeof then) { | |
return new Promise(then.bind(value)); | |
} | |
} catch (formatedList) { | |
return new Promise(function(canCreateDiscussions, resolve) { | |
resolve(formatedList); | |
}); | |
} | |
} | |
return valuePromise(value); | |
}; | |
/** | |
* @param {string} obj | |
* @return {?} | |
*/ | |
Promise.all = function(obj) { | |
/** @type {!Array<?>} */ | |
var list = Array.prototype.slice.call(obj); | |
return new Promise(function(resolve, reject) { | |
/** | |
* @param {number} id | |
* @param {!Object} val | |
* @return {?} | |
*/ | |
function resolve(id, val) { | |
if (val && ("object" == typeof val || "function" == typeof val)) { | |
if (val instanceof Promise && val.then === Promise.prototype.then) { | |
for (; 3 === val._81;) { | |
val = val._65; | |
} | |
return 1 === val._81 ? resolve(id, val._65) : (2 === val._81 && reject(val._65), void val.then(function(y) { | |
resolve(id, y); | |
}, reject)); | |
} | |
var then = val.then; | |
if ("function" == typeof then) { | |
return void(new Promise(then.bind(val))).then(function(y) { | |
resolve(id, y); | |
}, reject); | |
} | |
} | |
/** @type {!Object} */ | |
list[id] = val; | |
if (0 == --asyncValueIndex) { | |
resolve(list); | |
} | |
} | |
if (0 === list.length) { | |
return resolve([]); | |
} | |
/** @type {number} */ | |
var asyncValueIndex = list.length; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < list.length; i++) { | |
resolve(i, list[i]); | |
} | |
}); | |
}; | |
/** | |
* @param {?} reason | |
* @return {?} | |
*/ | |
Promise.reject = function(reason) { | |
return new Promise(function(canCreateDiscussions, reject$2) { | |
reject$2(reason); | |
}); | |
}; | |
/** | |
* @param {!Array} answerPs | |
* @return {?} | |
*/ | |
Promise.race = function(answerPs) { | |
return new Promise(function(t, throwException) { | |
answerPs.forEach(function(e) { | |
Promise.resolve(e).then(t, throwException); | |
}); | |
}); | |
}; | |
/** | |
* @param {!Function} rejected | |
* @return {?} | |
*/ | |
Promise.prototype.catch = function(rejected) { | |
return this.then(null, rejected); | |
}; | |
}, function(module, canCreateDiscussions, require) { | |
/** | |
* @param {!NodeList} fn | |
* @param {number} argumentCount | |
* @return {?} | |
*/ | |
function denodeifyWithCount(fn, argumentCount) { | |
/** @type {!Array} */ | |
var args = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < argumentCount; i++) { | |
args.push("a" + i); | |
} | |
/** @type {string} */ | |
var body = ["return function (" + args.join(",") + ") {", "var self = this;", "return new Promise(function (rs, rj) {", "var res = fn.call(", ["self"].concat(args).concat([projectStage]).join(","), ");", "if (res &&", '(typeof res === "object" || typeof res === "function") &&', 'typeof res.then === "function"', ") {rs(res);}", "});", "};"].join(""); | |
return Function(["Promise", "fn"], body)(Promise, fn); | |
} | |
/** | |
* @param {!NodeList} fn | |
* @return {?} | |
*/ | |
function denodeifyWithoutCount(fn) { | |
/** @type {number} */ | |
var gH = Math.max(fn.length - 1, 3); | |
/** @type {!Array} */ | |
var args = []; | |
/** @type {number} */ | |
var y = 0; | |
for (; y < gH; y++) { | |
args.push("a" + y); | |
} | |
/** @type {string} */ | |
var body = ["return function (" + args.join(",") + ") {", "var self = this;", "var args;", "var argLength = arguments.length;", "if (arguments.length > " + gH + ") {", "args = new Array(arguments.length + 1);", "for (var i = 0; i < arguments.length; i++) {", "args[i] = arguments[i];", "}", "}", "return new Promise(function (rs, rj) {", "var cb = " + projectStage + ";", "var res;", "switch (argLength) {", args.concat(["extra"]).map(function(canCreateDiscussions, t) { | |
return "case " + t + ":res = fn.call(" + ["self"].concat(args.slice(0, t)).concat("cb").join(",") + ");break;"; | |
}).join(""), "default:", "args[argLength] = cb;", "res = fn.apply(self, args);", "}", "if (res &&", '(typeof res === "object" || typeof res === "function") &&', 'typeof res.then === "function"', ") {rs(res);}", "});", "};"].join(""); | |
return Function(["Promise", "fn"], body)(Promise, fn); | |
} | |
var Promise = require(8); | |
var asap = require(59); | |
module.exports = Promise; | |
/** | |
* @param {(Node|NodeList|string)} fn | |
* @param {number} argumentCount | |
* @return {?} | |
*/ | |
Promise.denodeify = function(fn, argumentCount) { | |
return "number" == typeof argumentCount && argumentCount !== 1 / 0 ? denodeifyWithCount(fn, argumentCount) : denodeifyWithoutCount(fn); | |
}; | |
/** @type {string} */ | |
var projectStage = "function (err, res) {if (err) { rj(err); } else { rs(res); }}"; | |
/** | |
* @param {!Function} fn | |
* @return {?} | |
*/ | |
Promise.nodeify = function(fn) { | |
return function() { | |
/** @type {!Array<?>} */ | |
var argsCopy = Array.prototype.slice.call(arguments); | |
var callback = "function" == typeof argsCopy[argsCopy.length - 1] ? argsCopy.pop() : null; | |
var ctx = this; | |
try { | |
return fn.apply(this, arguments).nodeify(callback, ctx); | |
} catch (routeArray) { | |
if (null === callback || void 0 === callback) { | |
return new Promise(function(canCreateDiscussions, addRoute) { | |
addRoute(routeArray); | |
}); | |
} | |
asap(function() { | |
callback.call(ctx, routeArray); | |
}); | |
} | |
}; | |
}; | |
/** | |
* @param {!Function} callback | |
* @param {?} ctx | |
* @return {?} | |
*/ | |
Promise.prototype.nodeify = function(callback, ctx) { | |
if ("function" != typeof callback) { | |
return this; | |
} | |
this.then(function(num_relations) { | |
asap(function() { | |
callback.call(ctx, null, num_relations); | |
}); | |
}, function(localMediaStream) { | |
asap(function() { | |
callback.call(ctx, localMediaStream); | |
}); | |
}); | |
}; | |
}, function(module, canCreateDiscussions, __webpack_require__) { | |
/** | |
* @return {undefined} | |
*/ | |
function throwFirstError() { | |
if (s.length) { | |
throw s.shift(); | |
} | |
} | |
/** | |
* @param {!Object} task | |
* @return {undefined} | |
*/ | |
function asap(task) { | |
var rawTask; | |
rawTask = strings.length ? strings.pop() : new RawTask; | |
/** @type {!Object} */ | |
rawTask.task = task; | |
rawAsap(rawTask); | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function RawTask() { | |
/** @type {null} */ | |
this.task = null; | |
} | |
var rawAsap = __webpack_require__(22); | |
/** @type {!Array} */ | |
var strings = []; | |
/** @type {!Array} */ | |
var s = []; | |
var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError); | |
/** @type {function(!Object): undefined} */ | |
module.exports = asap; | |
/** | |
* @return {undefined} | |
*/ | |
RawTask.prototype.call = function() { | |
try { | |
this.task.call(); | |
} catch (error) { | |
if (asap.onerror) { | |
asap.onerror(error); | |
} else { | |
s.push(error); | |
requestErrorThrow(); | |
} | |
} finally { | |
/** @type {null} */ | |
this.task = null; | |
strings[strings.length] = this; | |
} | |
}; | |
}, function(module, canCreateDiscussions, require) { | |
var Promise = require(8); | |
module.exports = Promise; | |
/** | |
* @return {undefined} | |
*/ | |
Promise.enableSynchronous = function() { | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.isPending = function() { | |
return 0 == this.getState(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.isFulfilled = function() { | |
return 1 == this.getState(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.isRejected = function() { | |
return 2 == this.getState(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.getValue = function() { | |
if (3 === this._81) { | |
return this._65.getValue(); | |
} | |
if (!this.isFulfilled()) { | |
throw new Error("Cannot get a value of an unfulfilled promise."); | |
} | |
return this._65; | |
}; | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.getReason = function() { | |
if (3 === this._81) { | |
return this._65.getReason(); | |
} | |
if (!this.isRejected()) { | |
throw new Error("Cannot get a rejection reason of a non-rejected promise."); | |
} | |
return this._65; | |
}; | |
/** | |
* @return {?} | |
*/ | |
Promise.prototype.getState = function() { | |
return 3 === this._81 ? this._65.getState() : -1 === this._81 || -2 === this._81 ? 0 : this._81; | |
}; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Promise.disableSynchronous = function() { | |
Promise.prototype.isPending = void 0; | |
Promise.prototype.isFulfilled = void 0; | |
Promise.prototype.isRejected = void 0; | |
Promise.prototype.getValue = void 0; | |
Promise.prototype.getReason = void 0; | |
Promise.prototype.getState = void 0; | |
}; | |
}, function(mixin, canCreateDiscussions, require) { | |
var utils = require(24); | |
var formats = require(25); | |
var arrayPrefixGenerators = { | |
brackets : function(prefix) { | |
return prefix + "[]"; | |
}, | |
indices : function(key, prefix) { | |
return key + "[" + prefix + "]"; | |
}, | |
repeat : function(s) { | |
return s; | |
} | |
}; | |
/** @type {function(this:Date): string} */ | |
var toISO = Date.prototype.toISOString; | |
var defaults = { | |
delimiter : "&", | |
encode : true, | |
encoder : utils.encode, | |
encodeValuesOnly : false, | |
serializeDate : function(date) { | |
return toISO.call(date); | |
}, | |
skipNulls : false, | |
strictNullHandling : false | |
}; | |
/** | |
* @param {?} value | |
* @param {string} prefix | |
* @param {?} generateArrayPrefix | |
* @param {string} strictNullHandling | |
* @param {boolean} skipNulls | |
* @param {boolean} encoder | |
* @param {!Object} filter | |
* @param {!Function} sort | |
* @param {string} allowDots | |
* @param {!Function} serializeDate | |
* @param {?} formatter | |
* @param {string} encodeValuesOnly | |
* @return {?} | |
*/ | |
var stringify = function stringify(value, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly) { | |
var obj = value; | |
if ("function" == typeof filter) { | |
obj = filter(prefix, obj); | |
} else { | |
if (obj instanceof Date) { | |
obj = serializeDate(obj); | |
} else { | |
if (null === obj) { | |
if (strictNullHandling) { | |
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix; | |
} | |
/** @type {string} */ | |
obj = ""; | |
} | |
} | |
} | |
if ("string" == typeof obj || "number" == typeof obj || "boolean" == typeof obj || utils.isBuffer(obj)) { | |
if (encoder) { | |
return [formatter(encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder)) + "=" + formatter(encoder(obj, defaults.encoder))]; | |
} | |
return [formatter(prefix) + "=" + formatter(String(obj))]; | |
} | |
/** @type {!Array} */ | |
var values = []; | |
if (void 0 === obj) { | |
return values; | |
} | |
var objKeys; | |
if (Array.isArray(filter)) { | |
/** @type {!Object} */ | |
objKeys = filter; | |
} else { | |
/** @type {!Array<string>} */ | |
var keys = Object.keys(obj); | |
/** @type {!Array<string>} */ | |
objKeys = sort ? keys.sort(sort) : keys; | |
} | |
/** @type {number} */ | |
var i = 0; | |
for (; i < objKeys.length; ++i) { | |
var key = objKeys[i]; | |
if (!(skipNulls && null === obj[key])) { | |
/** @type {!Array<?>} */ | |
values = Array.isArray(obj) ? values.concat(stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly)) : values.concat(stringify(obj[key], prefix + (allowDots ? "." + key : "[" + key + "]"), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly)); | |
} | |
} | |
return values; | |
}; | |
/** | |
* @param {!Object} value | |
* @param {boolean} params | |
* @return {?} | |
*/ | |
mixin.exports = function(value, params) { | |
/** @type {!Object} */ | |
var obj = value; | |
var options = params ? utils.assign({}, params) : {}; | |
if (null !== options.encoder && void 0 !== options.encoder && "function" != typeof options.encoder) { | |
throw new TypeError("Encoder has to be a function."); | |
} | |
var split = void 0 === options.delimiter ? defaults.delimiter : options.delimiter; | |
/** @type {boolean} */ | |
var strictNullHandling = "boolean" == typeof options.strictNullHandling ? options.strictNullHandling : defaults.strictNullHandling; | |
/** @type {boolean} */ | |
var skipNulls = "boolean" == typeof options.skipNulls ? options.skipNulls : defaults.skipNulls; | |
/** @type {boolean} */ | |
var encode = "boolean" == typeof options.encode ? options.encode : defaults.encode; | |
var encoder = "function" == typeof options.encoder ? options.encoder : defaults.encoder; | |
/** @type {(!Function|null)} */ | |
var sort = "function" == typeof options.sort ? options.sort : null; | |
var allowDots = void 0 !== options.allowDots && options.allowDots; | |
/** @type {!Function} */ | |
var serializeDate = "function" == typeof options.serializeDate ? options.serializeDate : defaults.serializeDate; | |
/** @type {boolean} */ | |
var encodeValuesOnly = "boolean" == typeof options.encodeValuesOnly ? options.encodeValuesOnly : defaults.encodeValuesOnly; | |
if (void 0 === options.format) { | |
options.format = formats.default; | |
} else { | |
if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { | |
throw new TypeError("Unknown format option provided."); | |
} | |
} | |
var objKeys; | |
var filter; | |
var formatter = formats.formatters[options.format]; | |
if ("function" == typeof options.filter) { | |
/** @type {!Function} */ | |
filter = options.filter; | |
obj = filter("", obj); | |
} else { | |
if (Array.isArray(options.filter)) { | |
filter = options.filter; | |
objKeys = filter; | |
} | |
} | |
/** @type {!Array} */ | |
var keys = []; | |
if ("object" != typeof obj || null === obj) { | |
return ""; | |
} | |
var arrayFormat; | |
arrayFormat = options.arrayFormat in arrayPrefixGenerators ? options.arrayFormat : "indices" in options ? options.indices ? "indices" : "repeat" : "indices"; | |
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; | |
if (!objKeys) { | |
/** @type {!Array<string>} */ | |
objKeys = Object.keys(obj); | |
} | |
if (sort) { | |
objKeys.sort(sort); | |
} | |
/** @type {number} */ | |
var i = 0; | |
for (; i < objKeys.length; ++i) { | |
/** @type {string} */ | |
var key = objKeys[i]; | |
if (!(skipNulls && null === obj[key])) { | |
/** @type {!Array<?>} */ | |
keys = keys.concat(stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode ? encoder : null, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly)); | |
} | |
} | |
/** @type {string} */ | |
var seq = keys.join(split); | |
/** @type {string} */ | |
var prefix = true === options.addQueryPrefix ? "?" : ""; | |
return seq.length > 0 ? prefix + seq : ""; | |
}; | |
}, function(mixin, canCreateDiscussions, __webpack_require__) { | |
var Utils = __webpack_require__(24); | |
/** @type {function(this:Object, *): boolean} */ | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var defaults = { | |
allowDots : false, | |
allowPrototypes : false, | |
arrayLimit : 20, | |
decoder : Utils.decode, | |
delimiter : "&", | |
depth : 5, | |
parameterLimit : 1E3, | |
plainObjects : false, | |
strictNullHandling : false | |
}; | |
/** | |
* @param {!Object} data | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
var parseValues = function(data, options) { | |
var obj = {}; | |
var value = options.ignoreQueryPrefix ? data.replace(/^\?/, "") : data; | |
var offset = options.parameterLimit === 1 / 0 ? void 0 : options.parameterLimit; | |
var parts = value.split(options.delimiter, offset); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < parts.length; ++i) { | |
var key; | |
var currentValue; | |
var part = parts[i]; | |
var d = part.indexOf("]="); | |
var pos = -1 === d ? part.indexOf("=") : d + 1; | |
if (-1 === pos) { | |
key = options.decoder(part, defaults.decoder); | |
/** @type {(null|string)} */ | |
currentValue = options.strictNullHandling ? null : ""; | |
} else { | |
key = options.decoder(part.slice(0, pos), defaults.decoder); | |
currentValue = options.decoder(part.slice(pos + 1), defaults.decoder); | |
} | |
if (hasOwnProperty.call(obj, key)) { | |
/** @type {!Array<?>} */ | |
obj[key] = [].concat(obj[key]).concat(currentValue); | |
} else { | |
obj[key] = currentValue; | |
} | |
} | |
return obj; | |
}; | |
/** | |
* @param {!Array} val | |
* @param {string} k | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
var parseObject = function(val, k, options) { | |
/** @type {string} */ | |
var obj = k; | |
/** @type {number} */ | |
var j = val.length - 1; | |
for (; j >= 0; --j) { | |
var v; | |
var p = val[j]; | |
if ("[]" === p) { | |
/** @type {!Array} */ | |
v = []; | |
/** @type {!Array<?>} */ | |
v = v.concat(obj); | |
} else { | |
/** @type {!Object} */ | |
v = options.plainObjects ? Object.create(null) : {}; | |
var name = "[" === p.charAt(0) && "]" === p.charAt(p.length - 1) ? p.slice(1, -1) : p; | |
/** @type {number} */ | |
var index = parseInt(name, 10); | |
if (!isNaN(index) && p !== name && String(index) === name && index >= 0 && options.parseArrays && index <= options.arrayLimit) { | |
/** @type {!Array} */ | |
v = []; | |
v[index] = obj; | |
} else { | |
v[name] = obj; | |
} | |
} | |
/** @type {!Object} */ | |
obj = v; | |
} | |
return obj; | |
}; | |
/** | |
* @param {string} givenKey | |
* @param {string} val | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
var parseKeys = function(givenKey, val, options) { | |
if (givenKey) { | |
var str = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; | |
/** @type {!RegExp} */ | |
var RE_comparison = /(\[[^[\]]*])/; | |
/** @type {!RegExp} */ | |
var rProps = /(\[[^[\]]*])/g; | |
/** @type {(Array<string>|null)} */ | |
var match = RE_comparison.exec(str); | |
var result = match ? str.slice(0, match.index) : str; | |
/** @type {!Array} */ | |
var item = []; | |
if (result) { | |
if (!options.plainObjects && hasOwnProperty.call(Object.prototype, result) && !options.allowPrototypes) { | |
return; | |
} | |
item.push(result); | |
} | |
/** @type {number} */ | |
var i = 0; | |
for (; null !== (match = rProps.exec(str)) && i < options.depth;) { | |
if (i = i + 1, !options.plainObjects && hasOwnProperty.call(Object.prototype, match[1].slice(1, -1)) && !options.allowPrototypes) { | |
return; | |
} | |
item.push(match[1]); | |
} | |
return match && item.push("[" + str.slice(match.index) + "]"), parseObject(item, val, options); | |
} | |
}; | |
/** | |
* @param {?} data | |
* @param {boolean} params | |
* @return {?} | |
*/ | |
mixin.exports = function(data, params) { | |
var options = params ? Utils.assign({}, params) : {}; | |
if (null !== options.decoder && void 0 !== options.decoder && "function" != typeof options.decoder) { | |
throw new TypeError("Decoder has to be a function."); | |
} | |
if (options.ignoreQueryPrefix = true === options.ignoreQueryPrefix, options.delimiter = "string" == typeof options.delimiter || Utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter, options.depth = "number" == typeof options.depth ? options.depth : defaults.depth, options.arrayLimit = "number" == typeof options.arrayLimit ? options.arrayLimit : defaults.arrayLimit, options.parseArrays = false !== options.parseArrays, options.decoder = "function" == typeof options.decoder ? | |
options.decoder : defaults.decoder, options.allowDots = "boolean" == typeof options.allowDots ? options.allowDots : defaults.allowDots, options.plainObjects = "boolean" == typeof options.plainObjects ? options.plainObjects : defaults.plainObjects, options.allowPrototypes = "boolean" == typeof options.allowPrototypes ? options.allowPrototypes : defaults.allowPrototypes, options.parameterLimit = "number" == typeof options.parameterLimit ? options.parameterLimit : defaults.parameterLimit, options.strictNullHandling = | |
"boolean" == typeof options.strictNullHandling ? options.strictNullHandling : defaults.strictNullHandling, "" === data || null === data || void 0 === data) { | |
return options.plainObjects ? Object.create(null) : {}; | |
} | |
var value = "string" == typeof data ? parseValues(data, options) : data; | |
/** @type {!Object} */ | |
var query = options.plainObjects ? Object.create(null) : {}; | |
/** @type {!Array<string>} */ | |
var requireOptionKeys = Object.keys(value); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < requireOptionKeys.length; ++i) { | |
/** @type {string} */ | |
var key = requireOptionKeys[i]; | |
var keys = parseKeys(key, value[key], options); | |
query = Utils.merge(query, keys, options); | |
} | |
return Utils.compact(query); | |
}; | |
}, function(canCreateDiscussions, app, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function _possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {string} data | |
* @return {?} | |
*/ | |
function config(data) { | |
return new MethodAST(parse({}, data, { | |
recurly : this | |
})); | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function assign(data) { | |
/** @type {!Array} */ | |
var cycle = []; | |
return data.skinCode && 8 != data.skinCode.length && cycle.push("skinCode should be 8 characters"), data.countryCode && 2 != data.countryCode.length && cycle.push("countryCode should be 2 characters"), data.shopperLocale && 5 != data.shopperLocale.length && cycle.push("shopperLocale should be 5 characters"), data.invoiceUuid || cycle.push("invoiceUuid cannot be blank"), call("validate errors", cycle), cycle; | |
} | |
Object.defineProperty(app, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var parse = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(string): ?} */ | |
app.factory = config; | |
var _prepareStyleProperties = __webpack_require__(2); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _deepAssign = __webpack_require__(1); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var call = __webpack_require__(0)("recurly:adyen"); | |
var MethodAST = function(_EventEmitter) { | |
/** | |
* @param {?} options | |
* @return {?} | |
*/ | |
function Agent(options) { | |
_classCallCheck(this, Agent); | |
call("Creating new Adyen session"); | |
var _this = _possibleConstructorReturn(this, (Agent.__proto__ || Object.getPrototypeOf(Agent)).call(this)); | |
return _this.recurly = options.recurly, _this; | |
} | |
return _inherits(Agent, _EventEmitter), _createClass(Agent, [{ | |
key : "start", | |
value : function(result) { | |
var _ = this; | |
call("Invoking Adyen Modal"); | |
var data = { | |
invoiceUuid : result.invoiceUuid, | |
countryCode : result.countryCode, | |
shopperLocale : result.shopperLocale, | |
skinCode : result.skinCode | |
}; | |
var fields = assign(data); | |
if (fields.length > 0) { | |
return this.error("validation", { | |
fields : fields | |
}); | |
} | |
var i = this.recurly.Frame({ | |
height : 600, | |
path : "/adyen/start", | |
payload : data | |
}); | |
i.once("error", function(xhr) { | |
return _.error("adyen-error", { | |
cause : xhr | |
}); | |
}); | |
i.once("done", function(e) { | |
return _.emit("token", e); | |
}); | |
} | |
}, { | |
key : "error", | |
value : function() { | |
var ribbonHTML = (arguments.length <= 0 ? void 0 : arguments[0]) instanceof Error ? arguments.length <= 0 ? void 0 : arguments[0] : _deepAssign2.default.apply(void 0, arguments); | |
return this.emit("error", ribbonHTML), ribbonHTML; | |
} | |
}]), Agent; | |
}(_prepareStyleProperties2.default); | |
}, function(canCreateDiscussions, app, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} z | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function calcLines(z, t) { | |
if (!(z instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} cond | |
* @param {string} t | |
* @return {?} | |
*/ | |
function test(cond, t) { | |
if (!cond) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? cond : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {string} names | |
* @return {?} | |
*/ | |
function config(names) { | |
return new CSLEDIT_Iterator(get({}, names, { | |
recurly : this | |
})); | |
} | |
/** | |
* @return {?} | |
*/ | |
function $() { | |
var noBtn = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""; | |
var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; | |
return { | |
label : noBtn, | |
amount : (0, _normalizeDataUri2.default)(e) | |
}; | |
} | |
Object.defineProperty(app, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var get = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(string): ?} */ | |
app.factory = config; | |
var _prepareStyleProperties = __webpack_require__(2); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _deepAssign = __webpack_require__(1); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _roundedCorners = __webpack_require__(10); | |
var perpVector = __webpack_require__(14); | |
var _normalizeDataUri = __webpack_require__(16); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _entityController = __webpack_require__(26); | |
var w = __webpack_require__(0)("recurly:apple-pay"); | |
var data = { | |
first_name : "givenName", | |
last_name : "familyName", | |
address1 : "addressLines", | |
address2 : "addressLines", | |
city : "locality", | |
state : "administrativeArea", | |
postal_code : "postalCode", | |
country : "countryCode" | |
}; | |
var i18n = { | |
authorizationLineItemLabel : "Card Authorization (Temporary)", | |
subtotalLineItemLabel : "Subtotal", | |
discountLineItemLabel : "Discount", | |
taxLineItemLabel : "Tax", | |
giftCardLineItemLabel : "Gift card" | |
}; | |
var CSLEDIT_Iterator = function(e) { | |
/** | |
* @param {?} e | |
* @return {?} | |
*/ | |
function t(e) { | |
calcLines(this, t); | |
var that = test(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); | |
return that._ready = false, that.config = { | |
i18n : i18n | |
}, that.once("ready", function() { | |
return that._ready = true; | |
}), window.ApplePaySession ? window.ApplePaySession.canMakePayments() || (that.initError = that.error("apple-pay-not-available")) : that.initError = that.error("apple-pay-not-supported"), that.initError || that.configure(e), that; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "ready", | |
value : function(value) { | |
if (this._ready) { | |
value(); | |
} else { | |
this.once("ready", value); | |
} | |
} | |
}, { | |
key : "configure", | |
value : function(data) { | |
var t = this; | |
if (!("label" in data)) { | |
return this.initError = this.error("apple-pay-config-missing", { | |
opt : "label" | |
}); | |
} | |
if (this.config.label = data.label, "form" in data && (this.config.form = data.form), this.config.lineItems = [], !("recurly" in data)) { | |
return this.initError = this.error("apple-pay-factory-only"); | |
} | |
this.recurly = data.recurly; | |
if ("i18n" in data) { | |
get(this.config.i18n, data.i18n); | |
} | |
var password = data.pricing; | |
if (password instanceof _roundedCorners.Pricing) { | |
this.config.pricing = password; | |
password.on("change", function(canCreateDiscussions) { | |
return t.onPricingChange(); | |
}); | |
if (password.hasPrice) { | |
this.onPricingChange(); | |
} | |
} else { | |
if (!("total" in data)) { | |
return this.initError = this.error("apple-pay-config-missing", { | |
opt : "total" | |
}); | |
} | |
this.config.total = data.total; | |
} | |
this.recurly.request.get({ | |
route : "/apple_pay/info", | |
done : this.applyRemoteConfig(data) | |
}); | |
} | |
}, { | |
key : "applyRemoteConfig", | |
value : function(x) { | |
var response = this; | |
return function(body, data) { | |
return body ? response.initError = response.error(body) : "countries" in data && ~data.countries.indexOf(x.country) ? (response.config.country = x.country, "currencies" in data && ~data.currencies.indexOf(x.currency) ? (response.config.currency = x.currency, response.config.merchantCapabilities = data.merchantCapabilities || [], response.config.supportedNetworks = data.supportedNetworks || [], void response.emit("ready")) : response.initError = response.error("apple-pay-config-invalid", | |
{ | |
opt : "currency", | |
set : data.currencies | |
})) : response.initError = response.error("apple-pay-config-invalid", { | |
opt : "country", | |
set : data.countries | |
}); | |
}; | |
} | |
}, { | |
key : "begin", | |
value : function() { | |
if (this.initError) { | |
return this.error("apple-pay-init-error", { | |
err : this.initError | |
}); | |
} | |
delete this._session; | |
this.session.begin(); | |
} | |
}, { | |
key : "addAuthorizationLineItem", | |
value : function() { | |
if (!(parseFloat(this.config.total) > 0)) { | |
this.config.lineItems.push(this.authorizationLineItem); | |
this.config.total = this.authorizationLineItem.amount; | |
} | |
} | |
}, { | |
key : "onPricingChange", | |
value : function() { | |
var data = this.config.pricing; | |
/** @type {!Array} */ | |
var range = this.config.lineItems = []; | |
if (this.config.total = data.totalNow, data.hasPrice) { | |
var n = data.price.now.taxes || data.price.now.tax; | |
range.push($(this.config.i18n.subtotalLineItemLabel, data.subtotalPreDiscountNow)); | |
if (+data.price.now.discount) { | |
range.push($(this.config.i18n.discountLineItemLabel, -data.price.now.discount)); | |
} | |
if (+n) { | |
range.push($(this.config.i18n.taxLineItemLabel, n)); | |
} | |
if (+data.price.now.giftCard) { | |
range.push($(this.config.i18n.giftCardLineItemLabel, -data.price.now.giftCard)); | |
} | |
/** @type {!Array} */ | |
this.config.lineItems = range; | |
} | |
} | |
}, { | |
key : "onValidateMerchant", | |
value : function(result) { | |
var timeline = this; | |
w("Validating Apple Pay merchant session", result); | |
var url = result.validationURL; | |
this.recurly.request.post({ | |
route : "/apple_pay/start", | |
data : { | |
validationURL : url | |
}, | |
done : function(time, result) { | |
if (time) { | |
return timeline.error(time); | |
} | |
timeline.session.completeMerchantValidation(result); | |
} | |
}); | |
} | |
}, { | |
key : "onPaymentMethodSelected", | |
value : function(result) { | |
w("Payment method selected", result); | |
this.session.completePaymentMethodSelection(this.finalTotalLineItem, this.lineItems); | |
} | |
}, { | |
key : "onShippingContactSelected", | |
value : function(num) { | |
var status = this.session.STATUS_SUCCESS; | |
/** @type {!Array} */ | |
var newShippingMethods = []; | |
this.session.completeShippingContactSelection(status, newShippingMethods, this.finalTotalLineItem, this.lineItems); | |
} | |
}, { | |
key : "onShippingMethodSelected", | |
value : function(num) { | |
this.session.completeShippingMethodSelection(this.finalTotalLineItem, this.lineItems); | |
} | |
}, { | |
key : "onPaymentAuthorized", | |
value : function(result) { | |
var self = this; | |
w("Payment authorization received", result); | |
var data = {}; | |
if (this.config.form) { | |
data = (0, perpVector.normalize)(_entityController.FIELDS, this.config.form, { | |
parseCard : false | |
}).values; | |
} | |
this.mapPaymentData(data, result.payment); | |
this.recurly.request.post({ | |
route : "/apple_pay/token", | |
data : data, | |
done : function(err, e) { | |
if (err) { | |
return self.session.completePayment(self.session.STATUS_FAILURE), self.error("apple-pay-payment-failure", err); | |
} | |
w("Token received", e); | |
self.session.completePayment(self.session.STATUS_SUCCESS); | |
self.emit("token", e); | |
} | |
}); | |
} | |
}, { | |
key : "onCancel", | |
value : function(result) { | |
w("User canceled Apple Pay payment", result); | |
this.emit("cancel", result); | |
} | |
}, { | |
key : "error", | |
value : function() { | |
var ribbonHTML = (arguments.length <= 0 ? void 0 : arguments[0]) instanceof Error ? arguments.length <= 0 ? void 0 : arguments[0] : _deepAssign2.default.apply(void 0, arguments); | |
return this.emit("error", ribbonHTML), ribbonHTML; | |
} | |
}, { | |
key : "mapPaymentData", | |
value : function(value, context) { | |
value.paymentData = context.token.paymentData; | |
value.paymentMethod = context.token.paymentMethod; | |
if (context.billingContact) { | |
if (!_entityController.FIELDS.some(function(subel) { | |
return value[subel]; | |
})) { | |
_entityController.FIELDS.forEach(function(k) { | |
if (data[k]) { | |
var d = context.billingContact[data[k]]; | |
if ("address1" === k) { | |
d = d[0]; | |
} else { | |
if ("address2" === k) { | |
d = d[1]; | |
} | |
} | |
value[k] = d; | |
} | |
}); | |
} | |
} | |
} | |
}, { | |
key : "session", | |
get : function() { | |
if (this._session) { | |
return this._session; | |
} | |
w("Creating new Apple Pay session"); | |
this.addAuthorizationLineItem(); | |
var session = new window.ApplePaySession(2, { | |
countryCode : this.config.country, | |
currencyCode : this.config.currency, | |
supportedNetworks : this.config.supportedNetworks, | |
merchantCapabilities : this.config.merchantCapabilities, | |
requiredBillingContactFields : ["postalAddress"], | |
total : this.totalLineItem | |
}); | |
return session.onvalidatemerchant = this.onValidateMerchant.bind(this), session.onshippingcontactselected = this.onShippingContactSelected.bind(this), session.onshippingmethodselected = this.onShippingMethodSelected.bind(this), session.onpaymentmethodselected = this.onPaymentMethodSelected.bind(this), session.onpaymentauthorized = this.onPaymentAuthorized.bind(this), session.oncancel = this.onCancel.bind(this), this._session = session; | |
} | |
}, { | |
key : "lineItems", | |
get : function() { | |
return [].concat(this.config.lineItems); | |
} | |
}, { | |
key : "totalLineItem", | |
get : function() { | |
return $(this.config.label, this.config.total); | |
} | |
}, { | |
key : "finalTotalLineItem", | |
get : function() { | |
return get({}, this.totalLineItem, { | |
type : "final" | |
}); | |
} | |
}, { | |
key : "authorizationLineItem", | |
get : function() { | |
return $(this.config.i18n.authorizationLineItemLabel, 1); | |
} | |
}]), t; | |
}(_prepareStyleProperties2.default); | |
}, function(mixin, canCreateDiscussions, interruptible) { | |
var action = interruptible(66); | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
mixin.exports = function(str) { | |
if ("string" == typeof str) { | |
/** @type {string} */ | |
var STORE_INJECT = str.toUpperCase(); | |
if (action.hasOwnProperty(STORE_INJECT)) { | |
return action[STORE_INJECT]; | |
} | |
} | |
}; | |
mixin.exports.currencySymbolMap = action; | |
}, function(root, canCreateDiscussions) { | |
root.exports = { | |
AED : "\u00d8\u00af.\u00d8\u00a5", | |
AFN : "\u00d8\u2039", | |
ALL : "L", | |
AMD : "\u00d6\u008f", | |
ANG : "\u00c6\u2019", | |
AOA : "Kz", | |
ARS : "$", | |
AUD : "$", | |
AWG : "\u00c6\u2019", | |
AZN : "\u00d0\u00bc\u00d0\u00b0\u00d0\u00bd", | |
BAM : "KM", | |
BBD : "$", | |
BDT : "\u00e0\u00a7\u00b3", | |
BGN : "\u00d0\u00bb\u00d0\u00b2", | |
BHD : ".\u00d8\u00af.\u00d8\u00a8", | |
BIF : "FBu", | |
BMD : "$", | |
BND : "$", | |
BOB : "$b", | |
BRL : "R$", | |
BSD : "$", | |
BTC : "\u00e0\u00b8\u00bf", | |
BTN : "Nu.", | |
BWP : "P", | |
BYR : "p.", | |
BZD : "BZ$", | |
CAD : "$", | |
CDF : "FC", | |
CHF : "CHF", | |
CLP : "$", | |
CNY : "\u00c2\u00a5", | |
COP : "$", | |
CRC : "\u00e2\u201a\u00a1", | |
CUC : "$", | |
CUP : "\u00e2\u201a\u00b1", | |
CVE : "$", | |
CZK : "K\u00c4\u008d", | |
DJF : "Fdj", | |
DKK : "kr", | |
DOP : "RD$", | |
DZD : "\u00d8\u00af\u00d8\u00ac", | |
EEK : "kr", | |
EGP : "\u00c2\u00a3", | |
ERN : "Nfk", | |
ETB : "Br", | |
ETH : "\u00ce\u017e", | |
EUR : "\u00e2\u201a\u00ac", | |
FJD : "$", | |
FKP : "\u00c2\u00a3", | |
GBP : "\u00c2\u00a3", | |
GEL : "\u00e2\u201a\u00be", | |
GGP : "\u00c2\u00a3", | |
GHC : "\u00e2\u201a\u00b5", | |
GHS : "GH\u00e2\u201a\u00b5", | |
GIP : "\u00c2\u00a3", | |
GMD : "D", | |
GNF : "FG", | |
GTQ : "Q", | |
GYD : "$", | |
HKD : "$", | |
HNL : "L", | |
HRK : "kn", | |
HTG : "G", | |
HUF : "Ft", | |
IDR : "Rp", | |
ILS : "\u00e2\u201a\u00aa", | |
IMP : "\u00c2\u00a3", | |
INR : "\u00e2\u201a\u00b9", | |
IQD : "\u00d8\u00b9.\u00d8\u00af", | |
IRR : "\u00ef\u00b7\u00bc", | |
ISK : "kr", | |
JEP : "\u00c2\u00a3", | |
JMD : "J$", | |
JOD : "JD", | |
JPY : "\u00c2\u00a5", | |
KES : "KSh", | |
KGS : "\u00d0\u00bb\u00d0\u00b2", | |
KHR : "\u00e1\u0178\u203a", | |
KMF : "CF", | |
KPW : "\u00e2\u201a\u00a9", | |
KRW : "\u00e2\u201a\u00a9", | |
KWD : "KD", | |
KYD : "$", | |
KZT : "\u00d0\u00bb\u00d0\u00b2", | |
LAK : "\u00e2\u201a\u00ad", | |
LBP : "\u00c2\u00a3", | |
LKR : "\u00e2\u201a\u00a8", | |
LRD : "$", | |
LSL : "M", | |
LTC : "\u00c5\u0081", | |
LTL : "Lt", | |
LVL : "Ls", | |
LYD : "LD", | |
MAD : "MAD", | |
MDL : "lei", | |
MGA : "Ar", | |
MKD : "\u00d0\u00b4\u00d0\u00b5\u00d0\u00bd", | |
MMK : "K", | |
MNT : "\u00e2\u201a\u00ae", | |
MOP : "MOP$", | |
MUR : "\u00e2\u201a\u00a8", | |
MVR : "Rf", | |
MWK : "MK", | |
MXN : "$", | |
MYR : "RM", | |
MZN : "MT", | |
NAD : "$", | |
NGN : "\u00e2\u201a\u00a6", | |
NIO : "C$", | |
NOK : "kr", | |
NPR : "\u00e2\u201a\u00a8", | |
NZD : "$", | |
OMR : "\u00ef\u00b7\u00bc", | |
PAB : "B/.", | |
PEN : "S/.", | |
PGK : "K", | |
PHP : "\u00e2\u201a\u00b1", | |
PKR : "\u00e2\u201a\u00a8", | |
PLN : "z\u00c5\u201a", | |
PYG : "Gs", | |
QAR : "\u00ef\u00b7\u00bc", | |
RMB : "\u00ef\u00bf\u00a5", | |
RON : "lei", | |
RSD : "\u00d0\u201d\u00d0\u00b8\u00d0\u00bd.", | |
RUB : "\u00e2\u201a\u00bd", | |
RWF : "R\u00e2\u201a\u00a3", | |
SAR : "\u00ef\u00b7\u00bc", | |
SBD : "$", | |
SCR : "\u00e2\u201a\u00a8", | |
SDG : "\u00d8\u00ac.\u00d8\u00b3.", | |
SEK : "kr", | |
SGD : "$", | |
SHP : "\u00c2\u00a3", | |
SLL : "Le", | |
SOS : "S", | |
SRD : "$", | |
SSP : "\u00c2\u00a3", | |
STD : "Db", | |
SVC : "$", | |
SYP : "\u00c2\u00a3", | |
SZL : "E", | |
THB : "\u00e0\u00b8\u00bf", | |
TJS : "SM", | |
TMT : "T", | |
TND : "\u00d8\u00af.\u00d8\u00aa", | |
TOP : "T$", | |
TRL : "\u00e2\u201a\u00a4", | |
TRY : "\u00e2\u201a\u00ba", | |
TTD : "TT$", | |
TVD : "$", | |
TWD : "NT$", | |
TZS : "TSh", | |
UAH : "\u00e2\u201a\u00b4", | |
UGX : "USh", | |
USD : "$", | |
UYU : "$U", | |
UZS : "\u00d0\u00bb\u00d0\u00b2", | |
VEF : "Bs", | |
VND : "\u00e2\u201a\u00ab", | |
VUV : "VT", | |
WST : "WS$", | |
XAF : "FCFA", | |
XBT : "\u00c9\u0192", | |
XCD : "$", | |
XOF : "CFA", | |
XPF : "\u00e2\u201a\u00a3", | |
YER : "\u00ef\u00b7\u00bc", | |
ZAR : "R", | |
ZWD : "Z$" | |
}; | |
}, function(scope, canCreateDiscussions, MappedSelectModel) { | |
/** | |
* @param {!Array} v | |
* @return {?} | |
*/ | |
function compile(v) { | |
switch({}.toString.call(v)) { | |
case "[object Object]": | |
return fn(v); | |
case "[object Function]": | |
return v; | |
case "[object String]": | |
return parse(v); | |
case "[object RegExp]": | |
return log(v); | |
default: | |
return next(v); | |
} | |
} | |
/** | |
* @param {!Array} value | |
* @return {?} | |
*/ | |
function next(value) { | |
return function(rbd) { | |
return value === rbd; | |
}; | |
} | |
/** | |
* @param {?} result | |
* @return {?} | |
*/ | |
function log(result) { | |
return function(t) { | |
return result.test(t); | |
}; | |
} | |
/** | |
* @param {!Object} t | |
* @return {?} | |
*/ | |
function parse(t) { | |
return /^ *\W+/.test(t) ? new Function("_", "return _ " + t) : new Function("_", "return " + apply(t)); | |
} | |
/** | |
* @param {!Object} v | |
* @return {?} | |
*/ | |
function fn(v) { | |
var rules = {}; | |
var i; | |
for (i in v) { | |
rules[i] = "string" == typeof v[i] ? next(v[i]) : compile(v[i]); | |
} | |
return function(data) { | |
if ("object" != typeof data) { | |
return false; | |
} | |
var name; | |
for (name in rules) { | |
if (!(name in data)) { | |
return false; | |
} | |
if (!rules[name](data[name])) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
} | |
/** | |
* @param {!Object} a | |
* @return {?} | |
*/ | |
function apply(a) { | |
var d = m(a); | |
if (!d.length) { | |
return "_." + a; | |
} | |
var x; | |
var i; | |
var b; | |
/** @type {number} */ | |
i = 0; | |
for (; i < d.length; i++) { | |
b = d[i]; | |
/** @type {string} */ | |
x = "_." + b; | |
/** @type {string} */ | |
x = "('function' == typeof " + x + " ? " + x + "() : " + x + ")"; | |
a = get(b, a, x); | |
} | |
return a; | |
} | |
/** | |
* @param {string} error | |
* @param {!Object} t | |
* @param {number} n | |
* @return {?} | |
*/ | |
function get(error, t, n) { | |
return t.replace(new RegExp("(\\.)?" + error, "g"), function(undefined, isTemplate) { | |
return isTemplate ? undefined : n; | |
}); | |
} | |
var m; | |
try { | |
m = MappedSelectModel(27); | |
} catch (e) { | |
m = MappedSelectModel(27); | |
} | |
/** @type {function(!Array): ?} */ | |
scope.exports = compile; | |
}, function(canCreateDiscussions, global, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} z | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function calcLines(z, t) { | |
if (!(z instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} vid | |
* @param {string} t | |
* @return {?} | |
*/ | |
function get(vid, t) { | |
if (!vid) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? vid : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {!Object} c | |
* @return {?} | |
*/ | |
function app(c) { | |
return c = walk({}, c, { | |
recurly : this | |
}), new Circle(c); | |
} | |
/** | |
* @param {(boolean|number|string)} val | |
* @param {(boolean|number|string)} from | |
* @param {number} _ | |
* @return {?} | |
*/ | |
function callback(val, from, _) { | |
return (val - from) / 2 + _; | |
} | |
Object.defineProperty(global, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var walk = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(!Object): ?} */ | |
global.factory = app; | |
var _deepAssign = __webpack_require__(23); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _normalizeDataUri = __webpack_require__(2); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(3); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _prepareStyleProperties = __webpack_require__(1); | |
var getText = (_interopRequireDefault(_prepareStyleProperties), __webpack_require__(0)("recurly:frame")); | |
var data = { | |
width : 450, | |
height : 535 | |
}; | |
var Circle = function(e) { | |
/** | |
* @param {!Object} params | |
* @return {?} | |
*/ | |
function t(params) { | |
calcLines(this, t); | |
var self = get(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); | |
return self.recurly = params.recurly, self.id = self.recurly.id.split("-")[0] + "-" + (0, _UiIcon2.default)().split("-")[0], self.name = "recurly-frame-" + self.id, self.width = params.width || data.width, self.height = params.height || data.height, self.prepare(params.path, params.payload), self.listen(), self; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "prepare", | |
value : function(id) { | |
var self = this; | |
var msg = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
getText("creating request frame"); | |
msg.version = this.recurly.version; | |
msg.event = this.name; | |
msg.key = this.recurly.config.publicKey; | |
this.once(msg.event, function(change) { | |
if (self.relay) { | |
window.document.body.removeChild(self.relay); | |
} | |
if (change.error) { | |
self.emit("error", change.error); | |
} else { | |
self.emit("done", change); | |
} | |
}); | |
this.url = this.recurly.url(id); | |
this.url += (~this.url.indexOf("?") ? "&" : "?") + _deepAssign2.default.stringify(msg, { | |
encodeValuesOnly : true | |
}); | |
} | |
}, { | |
key : "listen", | |
value : function(num) { | |
var directory_epub = this; | |
if (this.recurly.bus.add(this), "documentMode" in document) { | |
getText("Creating relay"); | |
/** @type {!Element} */ | |
var iframe = document.createElement("iframe"); | |
/** @type {number} */ | |
iframe.width = iframe.height = 0; | |
iframe.src = this.recurly.url("/relay"); | |
/** @type {string} */ | |
iframe.name = "recurly-relay-" + this.id; | |
/** @type {string} */ | |
iframe.style.display = "none"; | |
/** | |
* @return {?} | |
*/ | |
iframe.onload = function() { | |
return directory_epub.create(); | |
}; | |
window.document.body.appendChild(iframe); | |
/** @type {!Element} */ | |
this.relay = iframe; | |
getText("Created relay", iframe); | |
} else { | |
this.create(); | |
} | |
} | |
}, { | |
key : "create", | |
value : function() { | |
getText("opening frame window", this.url, this.name, this.attributes); | |
window.open(this.url, this.name, this.attributes); | |
} | |
}, { | |
key : "attributes", | |
get : function() { | |
return "\n resizable,scrollbars,\n width=" + this.width + ",\n height=" + this.height + ",\n top=" + this.top + ",\n left=" + this.left + "\n "; | |
} | |
}, { | |
key : "top", | |
get : function() { | |
var identifierPositions = window.outerHeight || window.document.documentElement.clientHeight; | |
/** @type {(number|undefined)} */ | |
var parent = null === window.screenY ? window.screenTop : window.screenY; | |
return callback(identifierPositions, this.height, parent); | |
} | |
}, { | |
key : "left", | |
get : function() { | |
var identifierPositions = window.outerWidth || window.document.documentElement.clientWidth; | |
/** @type {(number|undefined)} */ | |
var parent = null === window.screenX ? window.screenLeft : window.screenX; | |
return callback(identifierPositions, this.width, parent); | |
} | |
}]), t; | |
}(_normalizeDataUri2.default); | |
}, function(canCreateDiscussions, exports, __webpack_require__) { | |
/** | |
* @param {!AudioNode} t | |
* @param {!Function} x | |
* @return {undefined} | |
*/ | |
function r(t, x) { | |
if (!(t instanceof x)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} action | |
* @param {string} o | |
* @return {?} | |
*/ | |
function o(action, o) { | |
if (!action) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !o || "object" != typeof o && "function" != typeof o ? action : o; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function config(data) { | |
return data = merge({}, data, { | |
recurly : this | |
}), new Uint8Array(data); | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var merge = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
/** @type {function(!Object): ?} */ | |
exports.factory = config; | |
var _deepAssign = __webpack_require__(2); | |
var _deepAssign2 = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(_deepAssign); | |
var _fuse2 = __webpack_require__(28); | |
var FooNav = __webpack_require__(71); | |
var RHSong = __webpack_require__(0)("recurly:paypal"); | |
/** @type {!Array} */ | |
var events = ["ready", "token", "error", "cancel"]; | |
var Uint8Array = function(e) { | |
/** | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function t(options) { | |
r(this, t); | |
var result = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); | |
return result.isReady = false, result.options = options, result.once("ready", function() { | |
return result.isReady = true; | |
}), options.braintree ? (result.strategy = new FooNav.BraintreeStrategy(options), result.strategy.onFail(result.fallback.bind(result))) : result.strategy = new _fuse2.DirectStrategy(options), result.bindStrategy(), result; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "ready", | |
value : function(value) { | |
if (this.isReady) { | |
value(); | |
} else { | |
this.once("ready", value); | |
} | |
} | |
}, { | |
key : "start", | |
value : function() { | |
var strategy; | |
return (strategy = this.strategy).start.apply(strategy, arguments); | |
} | |
}, { | |
key : "fallback", | |
value : function() { | |
var mch = this; | |
RHSong("Initializing strategy fallback"); | |
/** @type {!Object} */ | |
var options = merge({}, this.options); | |
delete options.braintree; | |
this.strategy = new _fuse2.DirectStrategy(options); | |
this.bindStrategy(); | |
this.strategy.ready(function() { | |
return mch.emit("ready"); | |
}); | |
} | |
}, { | |
key : "bindStrategy", | |
value : function() { | |
var that = this; | |
events.forEach(function(dashedName) { | |
return that.strategy.on(dashedName, that.emit.bind(that, dashedName)); | |
}); | |
} | |
}]), t; | |
}(_deepAssign2.default); | |
}, function(module, canCreateDiscussions) { | |
/** | |
* @param {!Function} self | |
* @param {?} parser | |
* @param {!Object} args | |
* @return {?} | |
*/ | |
function next(self, parser, args) { | |
switch(args.length) { | |
case 0: | |
return self.call(parser); | |
case 1: | |
return self.call(parser, args[0]); | |
case 2: | |
return self.call(parser, args[0], args[1]); | |
case 3: | |
return self.call(parser, args[0], args[1], args[2]); | |
} | |
return self.apply(parser, args); | |
} | |
/** | |
* @param {number} array | |
* @param {!Function} callback | |
* @return {?} | |
*/ | |
function extend(array, callback) { | |
/** @type {number} */ | |
var i = -1; | |
var length = array ? array.length : 0; | |
/** @type {!Array} */ | |
var result = Array(length); | |
for (; ++i < length;) { | |
result[i] = callback(array[i], i, array); | |
} | |
return result; | |
} | |
/** | |
* @param {!Array} b | |
* @param {!NodeList} c | |
* @return {?} | |
*/ | |
function append(b, c) { | |
/** @type {number} */ | |
var n = -1; | |
var max = c.length; | |
var i = b.length; | |
for (; ++n < max;) { | |
b[i + n] = c[n]; | |
} | |
return b; | |
} | |
/** | |
* @param {!NodeList} b | |
* @param {number} i | |
* @param {!Function} v | |
* @param {?} e | |
* @param {!Array} a | |
* @return {?} | |
*/ | |
function o(b, i, v, e, a) { | |
/** @type {number} */ | |
var p = -1; | |
var q = b.length; | |
if (!v) { | |
/** @type {function(!Object): ?} */ | |
v = str; | |
} | |
if (!a) { | |
/** @type {!Array} */ | |
a = []; | |
} | |
for (; ++p < q;) { | |
var c = b[p]; | |
if (i > 0 && v(c)) { | |
if (i > 1) { | |
o(c, i - 1, v, e, a); | |
} else { | |
append(a, c); | |
} | |
} else { | |
if (!e) { | |
a[a.length] = c; | |
} | |
} | |
} | |
return a; | |
} | |
/** | |
* @param {!Object} obj | |
* @param {(Node|NodeList|string)} text | |
* @return {?} | |
*/ | |
function test(obj, text) { | |
return obj = Object(obj), add(obj, text, function(canCreateDiscussions, $values) { | |
return $values in obj; | |
}); | |
} | |
/** | |
* @param {!Object} layer | |
* @param {!NodeList} t | |
* @param {!Function} f | |
* @return {?} | |
*/ | |
function add(layer, t, f) { | |
/** @type {number} */ | |
var j = -1; | |
var tl = t.length; | |
var layer = {}; | |
for (; ++j < tl;) { | |
var a = t[j]; | |
var u = layer[a]; | |
if (f(u, a)) { | |
layer[a] = u; | |
} | |
} | |
return layer; | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function str(value) { | |
return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); | |
} | |
/** | |
* @param {number} value | |
* @return {?} | |
*/ | |
function config(value) { | |
if ("string" == typeof value || get(value)) { | |
return value; | |
} | |
/** @type {string} */ | |
var port = value + ""; | |
return "0" == port && 1 / value == -INFINITY ? "-0" : port; | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function isArguments(value) { | |
return isNumber(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || toString.call(value) == selFun); | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function isUndefined(value) { | |
return null != value && callback(value.length) && !getType(value); | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function isNumber(value) { | |
return isString(value) && isUndefined(value); | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function getType(value) { | |
var ch = isObject(value) ? toString.call(value) : ""; | |
return ch == PRE_NEWLINE || ch == POST_NEWLINE; | |
} | |
/** | |
* @param {number} val | |
* @return {?} | |
*/ | |
function callback(val) { | |
return "number" == typeof val && val > -1 && val % 1 == 0 && val <= target; | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function isObject(value) { | |
/** @type {string} */ | |
var type = typeof value; | |
return !!value && ("object" == type || "function" == type); | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function isString(data) { | |
return !!data && "object" == typeof data; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function get(value) { | |
return "symbol" == typeof value || isString(value) && toString.call(value) == arrayBufferTag; | |
} | |
/** @type {number} */ | |
var INFINITY = 1 / 0; | |
/** @type {number} */ | |
var target = 9007199254740991; | |
/** @type {string} */ | |
var selFun = "[object Arguments]"; | |
/** @type {string} */ | |
var PRE_NEWLINE = "[object Function]"; | |
/** @type {string} */ | |
var POST_NEWLINE = "[object GeneratorFunction]"; | |
/** @type {string} */ | |
var arrayBufferTag = "[object Symbol]"; | |
var freeGlobal = "object" == typeof global && global && global.Object === Object && global; | |
/** @type {(Window|boolean)} */ | |
var freeSelf = "object" == typeof self && self && self.Object === Object && self; | |
var root = freeGlobal || freeSelf || Function("return this")(); | |
var ObjProto = Object.prototype; | |
var hasOwnProperty = ObjProto.hasOwnProperty; | |
var toString = ObjProto.toString; | |
var Symbol = root.Symbol; | |
var propertyIsEnumerable = ObjProto.propertyIsEnumerable; | |
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : void 0; | |
/** @type {function(...?): number} */ | |
var nativeMax$1 = Math.max; | |
/** @type {function(*): boolean} */ | |
var isArray = Array.isArray; | |
var storeMixin = function(todo, index) { | |
return index = nativeMax$1(void 0 === index ? todo.length - 1 : index, 0), function() { | |
/** @type {!Arguments} */ | |
var arr = arguments; | |
/** @type {number} */ | |
var i = -1; | |
/** @type {number} */ | |
var length = nativeMax$1(arr.length - index, 0); | |
/** @type {!Array} */ | |
var result = Array(length); | |
for (; ++i < length;) { | |
result[i] = arr[index + i]; | |
} | |
/** @type {number} */ | |
i = -1; | |
/** @type {!Array} */ | |
var args = Array(index + 1); | |
for (; ++i < index;) { | |
args[i] = arr[i]; | |
} | |
return args[index] = result, next(todo, this, args); | |
}; | |
}(function(key, selector) { | |
return null == key ? {} : test(key, extend(o(selector, 1), config)); | |
}); | |
module.exports = storeMixin; | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} error | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function error(error, t) { | |
if (!(error instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} object | |
* @param {string} t | |
* @return {?} | |
*/ | |
function o(object, t) { | |
if (!object) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? object : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.BraintreeStrategy = BeautifulProperties.BRAINTREE_CLIENT_VERSION = void 0; | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var merge = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** | |
* @param {!Object} object | |
* @param {string} name | |
* @param {?} options | |
* @return {?} | |
*/ | |
var spinnerModifer = function get(object, name, options) { | |
if (null === object) { | |
object = Function.prototype; | |
} | |
/** @type {(ObjectPropertyDescriptor<?>|undefined)} */ | |
var output = Object.getOwnPropertyDescriptor(object, name); | |
if (void 0 === output) { | |
/** @type {(Object|null)} */ | |
var string = Object.getPrototypeOf(object); | |
return null === string ? void 0 : get(string, name, options); | |
} | |
if ("value" in output) { | |
return output.value; | |
} | |
/** @type {(function(): ?|undefined)} */ | |
var params = output.get; | |
if (void 0 !== params) { | |
return params.call(options); | |
} | |
}; | |
var _prepareStyleProperties = __webpack_require__(72); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(73); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(29); | |
var callback = __webpack_require__(0)("recurly:paypal:strategy:braintree"); | |
/** @type {string} */ | |
var module = BeautifulProperties.BRAINTREE_CLIENT_VERSION = "3.11.0"; | |
BeautifulProperties.BraintreeStrategy = function(_EventEmitter) { | |
/** | |
* @return {?} | |
*/ | |
function e() { | |
var _Object$getPrototypeO; | |
error(this, e); | |
/** @type {number} */ | |
var _len2 = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len2); | |
/** @type {number} */ | |
var _key2 = 0; | |
for (; _key2 < _len2; _key2++) { | |
args[_key2] = arguments[_key2]; | |
} | |
var note = o(this, (_Object$getPrototypeO = e.__proto__ || Object.getPrototypeOf(e)).call.apply(_Object$getPrototypeO, [this].concat(args))); | |
return note.load(), note; | |
} | |
return _inherits(e, _EventEmitter), _createClass(e, [{ | |
key : "configure", | |
value : function(num) { | |
if (spinnerModifer(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "configure", this).call(this, num), !num.braintree || !num.braintree.clientAuthorization) { | |
throw this.error("paypal-config-missing", { | |
opt : "braintree.clientAuthorization" | |
}); | |
} | |
this.config.clientAuthorization = num.braintree.clientAuthorization; | |
} | |
}, { | |
key : "load", | |
value : function() { | |
var e = this; | |
callback("loading Braintree libraries"); | |
var $ = (0, _normalizeDataUri2.default)(2, function() { | |
return e.initialize(); | |
}); | |
/** | |
* @param {string} name | |
* @return {undefined} | |
*/ | |
var push = function(name) { | |
var pushNewNotes = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function() { | |
}; | |
/** @type {string} */ | |
var artistTrack = "https://js.braintreegateway.com/web/" + module + "/js/" + name + ".min.js"; | |
(0, _prepareStyleProperties2.default)(artistTrack, function(xhr) { | |
if (xhr) { | |
e.error("paypal-load-error", { | |
cause : xhr | |
}); | |
} else { | |
pushNewNotes(); | |
} | |
}); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
var next = function() { | |
if (e.braintreeClientAvailable("paypal")) { | |
$(); | |
} else { | |
push("paypal", $); | |
} | |
if (e.braintreeClientAvailable("dataCollector")) { | |
$(); | |
} else { | |
push("data-collector", $); | |
} | |
}; | |
if (this.braintreeClientAvailable()) { | |
next(); | |
} else { | |
push("client", next); | |
} | |
} | |
}, { | |
key : "initialize", | |
value : function() { | |
var result = this; | |
callback("Initializing Braintree client"); | |
var token = this.config.clientAuthorization; | |
var hawk = window.braintree; | |
hawk.client.create({ | |
authorization : token | |
}, function(xhr, oothClient) { | |
if (xhr) { | |
return result.fail("paypal-braintree-api-error", { | |
cause : xhr | |
}); | |
} | |
callback("Braintree client created"); | |
hawk.dataCollector.create({ | |
client : oothClient, | |
paypal : true | |
}, function(xhr, connection) { | |
if (xhr) { | |
return result.fail("paypal-braintree-api-error", { | |
cause : xhr | |
}); | |
} | |
callback("Device data collector created"); | |
result.deviceFingerprint = connection.deviceData; | |
hawk.paypal.create({ | |
client : oothClient | |
}, function(xhr, n) { | |
if (xhr) { | |
return result.fail("paypal-braintree-api-error", { | |
cause : xhr | |
}); | |
} | |
callback("PayPal client created"); | |
/** @type {string} */ | |
result.paypal = n; | |
result.emit("ready"); | |
}); | |
}); | |
}); | |
} | |
}, { | |
key : "start", | |
value : function() { | |
var _ = this; | |
/** @type {!Object} */ | |
var t = merge({}, this.config.display, { | |
flow : "vault" | |
}); | |
this.paypal.tokenize(t, function(error, log) { | |
if (error) { | |
return "PAYPAL_POPUP_CLOSED" === error.code ? _.emit("cancel") : _.error("paypal-braintree-tokenize-braintree-error", { | |
cause : error | |
}); | |
} | |
callback("Token payload received", log); | |
if (_.deviceFingerprint) { | |
log.deviceFingerprint = _.deviceFingerprint; | |
} | |
_.recurly.request.post({ | |
route : "/paypal/token", | |
data : { | |
type : "braintree", | |
payload : log | |
}, | |
done : function(err, n) { | |
if (err) { | |
return _.error("paypal-braintree-tokenize-recurly-error", { | |
cause : err | |
}); | |
} | |
_.emit("token", n); | |
} | |
}); | |
}); | |
} | |
}, { | |
key : "braintreeClientAvailable", | |
value : function(type) { | |
var self = window.braintree; | |
return self && self.client && self.client.VERSION === module && (!type || type in self); | |
} | |
}]), e; | |
}(_UiIcon.PayPalStrategy); | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {!Element} e | |
* @param {!Object} o | |
* @return {undefined} | |
*/ | |
function validate(e, o) { | |
var j; | |
for (j in o) { | |
e.setAttribute(j, o[j]); | |
} | |
} | |
/** | |
* @param {!Node} script | |
* @param {!Object} callback | |
* @return {undefined} | |
*/ | |
function add(script, callback) { | |
/** | |
* @return {undefined} | |
*/ | |
script.onload = function() { | |
/** @type {null} */ | |
this.onerror = this.onload = null; | |
callback(null, script); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
script.onerror = function() { | |
/** @type {null} */ | |
this.onerror = this.onload = null; | |
callback(new Error("Failed to load " + this.src), script); | |
}; | |
} | |
/** | |
* @param {!Node} content | |
* @param {!Object} cont | |
* @return {undefined} | |
*/ | |
function webdav_save(content, cont) { | |
/** | |
* @return {undefined} | |
*/ | |
content.onreadystatechange = function() { | |
if (!("complete" != this.readyState && "loaded" != this.readyState)) { | |
/** @type {null} */ | |
this.onreadystatechange = null; | |
cont(null, content); | |
} | |
}; | |
} | |
/** | |
* @param {string} e | |
* @param {!Object} options | |
* @param {!Object} cb | |
* @return {undefined} | |
*/ | |
mixin.exports = function(e, options, cb) { | |
/** @type {!Element} */ | |
var el_head = document.head || document.getElementsByTagName("head")[0]; | |
/** @type {!Element} */ | |
var script = document.createElement("script"); | |
if ("function" == typeof options) { | |
/** @type {!Object} */ | |
cb = options; | |
options = {}; | |
} | |
options = options || {}; | |
cb = cb || function() { | |
}; | |
script.type = options.type || "text/javascript"; | |
script.charset = options.charset || "utf8"; | |
/** @type {boolean} */ | |
script.async = !("async" in options) || !!options.async; | |
/** @type {string} */ | |
script.src = e; | |
if (options.attrs) { | |
validate(script, options.attrs); | |
} | |
if (options.text) { | |
/** @type {string} */ | |
script.text = "" + options.text; | |
} | |
("onload" in script ? add : webdav_save)(script, cb); | |
if (!script.onload) { | |
add(script, cb); | |
} | |
el_head.appendChild(script); | |
}; | |
}, function(canCreateDiscussions, data, n) { | |
/** | |
* @return {?} | |
*/ | |
function app() { | |
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; | |
var route = arguments[1]; | |
/** @type {number} */ | |
var STATUS_ERROR = 0; | |
return function() { | |
return STATUS_ERROR++ && STATUS_ERROR === e && route(); | |
}; | |
} | |
Object.defineProperty(data, "__esModule", { | |
value : true | |
}); | |
/** @type {function(): ?} */ | |
data.default = app; | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} _xOff | |
* @param {!Function} _yOff | |
* @return {undefined} | |
*/ | |
function Module(_xOff, _yOff) { | |
if (!(_xOff instanceof _yOff)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} shape | |
* @param {string} t | |
* @return {?} | |
*/ | |
function validate(shape, t) { | |
if (!shape) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? shape : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @param {string} e | |
* @return {?} | |
*/ | |
function get(e) { | |
var message = window.document.createElement("a"); | |
return message.href = e, message.protocol + "//" + message.host; | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.Bus = void 0; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(2); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var models = __webpack_require__(75); | |
var _normalizeDataUri = __webpack_require__(3); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
BeautifulProperties.Bus = function(_EventEmitter) { | |
/** | |
* @return {?} | |
*/ | |
function Message() { | |
var me = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; | |
Module(this, Message); | |
var self = validate(this, (Message.__proto__ || Object.getPrototypeOf(Message)).call(this)); | |
return self.id = (0, _normalizeDataUri2.default)(), self.debug = __webpack_require__(0)("recurly:bus:" + self.id.split("-")[0]), self.emitters = [], self.recipients = [], self.receive = self.receive.bind(self), self.config = { | |
api : me.api | |
}, self.connect(), self.send = self.send.bind(self), self; | |
} | |
return _inherits(Message, _EventEmitter), _createClass(Message, [{ | |
key : "connect", | |
value : function() { | |
window.addEventListener("message", this.receive, false); | |
this.debug("listening for postMessage events on", window); | |
} | |
}, { | |
key : "receive", | |
value : function(data) { | |
if (this.originMatches(data.origin)) { | |
return "string" == typeof data.data ? this.receiveFromRelay(data) : void(data.data.event && (this.debug("message received", data.data), this.send(new models.Message(data), null, { | |
exclude : [data.srcElement] | |
}))); | |
} | |
} | |
}, { | |
key : "receiveFromRelay", | |
value : function(s) { | |
var args = void 0; | |
try { | |
/** @type {*} */ | |
args = JSON.parse(s.data); | |
} catch (correspondingDatumField) { | |
this.debug("failed to parse a string message", correspondingDatumField, s); | |
} | |
if (args) { | |
this.send(new models.Message(args.recurly_event, args.recurly_message)); | |
} | |
} | |
}, { | |
key : "add", | |
value : function(data) { | |
if (!~this.recipients.indexOf(data)) { | |
this.recipients.push(data); | |
if ("function" == typeof data.emit) { | |
data.emit("bus:added", this); | |
} | |
this.debug("added recipient", data); | |
} | |
} | |
}, { | |
key : "send", | |
value : function(name, data) { | |
var msgLabel = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { | |
exclude : [] | |
}; | |
var message = new models.Message(name, data); | |
msgLabel.exclude; | |
this.debug("sending message to " + this.recipients.length + " recipients", message); | |
this.recipients.forEach(function(self) { | |
if (self.postMessage) { | |
if ("function" == typeof self.postMessage) { | |
self.postMessage(message, "*"); | |
} | |
} else { | |
if ("function" == typeof self.emit) { | |
self.emit(message.event, message.body); | |
} | |
} | |
}); | |
} | |
}, { | |
key : "stop", | |
value : function() { | |
/** @type {!Array} */ | |
this.recipients = []; | |
window.removeEventListener("message", this.receive, false); | |
} | |
}, { | |
key : "originMatches", | |
value : function(token) { | |
return get(token) === get(this.config.api); | |
} | |
}]), Message; | |
}(_prepareStyleProperties2.default); | |
}, function(canCreateDiscussions, exports, n) { | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
exports.Message = function() { | |
/** | |
* @param {(Object|string)} event | |
* @return {?} | |
*/ | |
function Event(event) { | |
var body = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
if (_classCallCheck(this, Event), event instanceof Event) { | |
return event; | |
} | |
if (event instanceof window.MessageEvent) { | |
body = event.data.body; | |
event = event.data.event; | |
} | |
/** @type {(Object|string)} */ | |
this.event = event; | |
this.body = body; | |
} | |
return _createClass(Event, [{ | |
key : "format", | |
value : function() { | |
return { | |
event : this.event, | |
body : this.body | |
}; | |
} | |
}]), Event; | |
}(); | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} x | |
* @param {!Function} y | |
* @return {undefined} | |
*/ | |
function _init(x, y) { | |
if (!(x instanceof y)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} object | |
* @param {string} t | |
* @return {?} | |
*/ | |
function o(object, t) { | |
if (!object) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? object : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.Fraud = void 0; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(4); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(5); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(2); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _deepAssign = __webpack_require__(6); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _classlist = __webpack_require__(1); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var done = __webpack_require__(0)("recurly:fraud"); | |
BeautifulProperties.Fraud = function(_EventEmitter) { | |
/** | |
* @param {!Object} path | |
* @return {?} | |
*/ | |
function Agent(path) { | |
_init(this, Agent); | |
var i = o(this, (Agent.__proto__ || Object.getPrototypeOf(Agent)).call(this)); | |
return i.recurly = path, i.dataCollectorInitiated = false, i.shouldCollectData && path.ready(i.dataCollector.bind(i)), i; | |
} | |
return _inherits(Agent, _EventEmitter), _createClass(Agent, [{ | |
key : "params", | |
value : function(result) { | |
/** @type {!Array} */ | |
var queue = []; | |
return this.recurly.config.fraud.kount.dataCollector && result.fraud_session_id && queue.push({ | |
processor : "kount", | |
session_id : result.fraud_session_id | |
}), this.recurly.config.fraud.litle.sessionId && queue.push({ | |
processor : "litle_threat_metrix", | |
session_id : this.recurly.config.fraud.litle.sessionId | |
}), this.recurly.config.fraud.braintree.deviceData && queue.push({ | |
processor : "braintree", | |
session_id : this.recurly.config.fraud.braintree.deviceData | |
}), queue; | |
} | |
}, { | |
key : "dataCollector", | |
value : function() { | |
var that = this; | |
if (!this.dataCollectorInitiated) { | |
/** @type {boolean} */ | |
this.dataCollectorInitiated = true; | |
this.recurly.request.get({ | |
route : "/fraud_data_collector", | |
done : function(result, err) { | |
if (done("response from recurly data collector", result, err), result) { | |
throw (0, _classlist2.default)("fraud-data-collector-request-failed", { | |
error : result | |
}); | |
} | |
if (err.content) { | |
that.addNodes(err.content); | |
that.emit("ready"); | |
} | |
} | |
}); | |
} | |
} | |
}, { | |
key : "addNodes", | |
value : function(s) { | |
var com = this; | |
/** @type {!Element} */ | |
var div = document.createElement("div"); | |
/** @type {string} */ | |
div.innerHTML = s; | |
(0, _prepareStyleProperties2.default)(div.childNodes, function(elementInformation) { | |
return com.form.appendChild(elementInformation); | |
}); | |
} | |
}, { | |
key : "shouldCollectData", | |
get : function() { | |
return !!this.recurly.config.fraud.kount.dataCollector; | |
} | |
}, { | |
key : "form", | |
get : function() { | |
if (this._form) { | |
return this._form; | |
} | |
var obj = this.recurly.config.fields; | |
/** @type {!Array<?>} */ | |
var e = Object.keys(obj).map(function(index) { | |
return obj[index].selector; | |
}).filter(Boolean); | |
var entryToSend = void 0; | |
if ((0, _normalizeDataUri2.default)(e, function(nodeOrSelector) { | |
var entry = _deepAssign2.default.findNodeInParents(window.document.querySelector(nodeOrSelector), "form"); | |
if (_deepAssign2.default.element(entry)) { | |
entryToSend = entry; | |
} | |
}), entryToSend) { | |
return this._form = entryToSend; | |
} | |
throw (0, _classlist2.default)("fraud-data-collector-missing-form", { | |
selectors : e | |
}); | |
} | |
}]), Agent; | |
}(_UiIcon2.default); | |
}, function(canCreateDiscussions, exports, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} z | |
* @param {!Function} t | |
* @return {undefined} | |
*/ | |
function calcLines(z, t) { | |
if (!(z instanceof t)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} fn | |
* @param {string} t | |
* @return {?} | |
*/ | |
function $(fn, t) { | |
if (!fn) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? fn : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
exports.HostedFields = exports.FIELD_TYPES = void 0; | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var conflictPathWatch = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _normalizeDataUri = __webpack_require__(2); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(13); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(15); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _prepareStyleProperties = __webpack_require__(6); | |
var _AboutPage = (_interopRequireDefault(_prepareStyleProperties), __webpack_require__(1)); | |
var _deepAssign = (_interopRequireDefault(_AboutPage), __webpack_require__(78)); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var hydra = __webpack_require__(79); | |
/** @type {!Array} */ | |
var pipelets = (__webpack_require__(0)("recurly:hostedFields"), exports.FIELD_TYPES = ["number", "month", "year", "cvv", "card"]); | |
exports.HostedFields = function(e) { | |
/** | |
* @param {?} b | |
* @return {?} | |
*/ | |
function t(b) { | |
calcLines(this, t); | |
var self = $(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); | |
return self.ready = false, self.state = {}, self.fields = [], self.errors = [], self.initQueue = [], self.readyState = 0, self.configure(b), self.inject(), self.on("hostedField:tab:previous", self.onTab.bind(self, "previous")), self.on("hostedField:tab:next", self.onTab.bind(self, "next")), self.on("hostedField:state:change", self.update.bind(self)), self.on("bus:added", function(TypesHelper) { | |
/** @type {!Object} */ | |
self.bus = TypesHelper; | |
self.fields.forEach(function(type) { | |
return TypesHelper.add(type); | |
}); | |
}), self; | |
} | |
return _inherits(t, e), _createClass(t, [{ | |
key : "integrityCheck", | |
value : function(obj) { | |
var chartapp = this; | |
if (!this.ready) { | |
return false; | |
} | |
if (0 === this.fields.length) { | |
return false; | |
} | |
if (obj) { | |
if (Object.keys(obj).map(function(index) { | |
return obj[index].selector; | |
}).join("") !== Object.keys(this.config.recurly.fields).map(function(name) { | |
return chartapp.config.recurly.fields[name].selector; | |
}).join("")) { | |
return false; | |
} | |
} | |
return !~this.fields.map(function(_this4) { | |
return _this4.integrityCheck(); | |
}).indexOf(false); | |
} | |
}, { | |
key : "configure", | |
value : function(num) { | |
this.config = (0, _UiIcon2.default)(num || {}); | |
} | |
}, { | |
key : "inject", | |
value : function() { | |
var self = this; | |
if (this.on("hostedField:ready", this.onReady.bind(this)), pipelets.forEach(function(className) { | |
try { | |
self.fields.push(new hydra.HostedField(self.fieldConfig(className))); | |
self.initQueue.push(className); | |
} catch (n) { | |
if ("missing-hosted-field-target" !== n.name) { | |
throw n; | |
} | |
if (~["number", "month", "year", "card"].indexOf(className)) { | |
self.errors.push(n); | |
} | |
} | |
}), this.errors.some(function(verifiedEvent) { | |
return "card" === verifiedEvent.type; | |
})) { | |
if (1 === this.errors.filter(function(engineDiscovery) { | |
return "missing-hosted-field-target" === engineDiscovery.name; | |
}).length) { | |
this.errors = this.errors.filter(function(contractFunction) { | |
return !("missing-hosted-field-target" === contractFunction.name && "card" === contractFunction.type); | |
}); | |
} | |
} else { | |
this.errors = this.errors.filter(function(engineDiscovery) { | |
return "missing-hosted-field-target" !== engineDiscovery.name; | |
}); | |
} | |
this.on("hostedFields:configure", function(modulePath) { | |
self.configure(modulePath); | |
self.fields.forEach(function(t) { | |
if (self.bus) { | |
self.bus.send("hostedField:configure", self.fieldConfig(t.type)); | |
} | |
}); | |
}); | |
} | |
}, { | |
key : "reset", | |
value : function() { | |
this.off(); | |
/** @type {boolean} */ | |
this.ready = false; | |
/** @type {number} */ | |
this.readyState = 0; | |
this.fields.forEach(function(applyViewModelsSpy) { | |
return applyViewModelsSpy.reset(); | |
}); | |
/** @type {!Array} */ | |
this.fields = []; | |
/** @type {!Array} */ | |
this.errors = []; | |
/** @type {!Array} */ | |
this.initQueue = []; | |
} | |
}, { | |
key : "onReady", | |
value : function(obj) { | |
var existingProxyIndex = this.initQueue.indexOf(obj.type); | |
if (~existingProxyIndex) { | |
this.initQueue.splice(existingProxyIndex, 1); | |
} | |
if (0 === this.initQueue.length) { | |
this.off("hostedField:ready", this.onReady); | |
this.bus.send("hostedFields:ready"); | |
/** @type {boolean} */ | |
this.ready = true; | |
} | |
this.update(obj); | |
} | |
}, { | |
key : "onTab", | |
value : function(name, object) { | |
var re = this.getFieldByType(object.type); | |
if (re instanceof hydra.HostedField) { | |
var params = this.tabbableItems(); | |
var paramIndex = params.indexOf(re.tabbingProxy); | |
var inlineEditor2 = "previous" === name ? params[paramIndex - 1] : params[paramIndex + 1]; | |
if (inlineEditor2) { | |
inlineEditor2.focus(); | |
} | |
} | |
} | |
}, { | |
key : "tabbableItems", | |
value : function() { | |
return (0, _deepAssign2.default)(window.document.body); | |
} | |
}, { | |
key : "update", | |
value : function(item) { | |
/** @type {!Object} */ | |
var value = conflictPathWatch({}, item); | |
delete value.type; | |
/** @type {!Object} */ | |
this.state[item.type] = value; | |
if (this.ready) { | |
this.bus.send("hostedFields:state:change", this.state); | |
} | |
} | |
}, { | |
key : "fieldConfig", | |
value : function(key) { | |
var result = this.config.recurly.fields; | |
var me = result[key]; | |
if (result[key]) { | |
return { | |
type : key, | |
displayIcon : me.displayIcon, | |
format : me.format || result.all.format, | |
inputType : me.inputType, | |
recurly : this.config.recurly, | |
selector : me.selector, | |
style : (0, _classlist2.default)({}, result.all.style, me.style), | |
tabIndex : result.all.tabIndex || me.tabIndex | |
}; | |
} | |
} | |
}, { | |
key : "getFieldByType", | |
value : function(x) { | |
return this.fields.filter(function(t) { | |
return t.config.type === x; | |
})[0]; | |
} | |
}]), t; | |
}(_normalizeDataUri2.default); | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {!Document} document | |
* @return {?} | |
*/ | |
function init(document) { | |
/** | |
* @param {!Object} el | |
* @param {!Object} label | |
* @return {?} | |
*/ | |
function remove(el, label) { | |
if (el === document.documentElement) { | |
return false; | |
} | |
/** @type {number} */ | |
var i = 0; | |
/** @type {number} */ | |
var length = queue.length; | |
for (; i < length; i++) { | |
if (queue[i][0] === el) { | |
return queue[i][1]; | |
} | |
} | |
label = label || document.defaultView.getComputedStyle(el); | |
/** @type {boolean} */ | |
var id = false; | |
return "none" === label.display ? id = true : el.parentNode && (id = remove(el.parentNode)), queue.push([el, id]), id; | |
} | |
/** @type {!Array} */ | |
var queue = []; | |
return function(tag) { | |
if (tag === document.documentElement) { | |
return false; | |
} | |
var elem = document.defaultView.getComputedStyle(tag); | |
return !!remove(tag, elem) || "hidden" === elem.visibility; | |
}; | |
} | |
/** | |
* @param {!Object} el | |
* @param {number} input | |
* @return {?} | |
*/ | |
mixin.exports = function(el, input) { | |
input = input || {}; | |
var item = el.ownerDocument || el; | |
/** @type {!Array} */ | |
var array = []; | |
/** @type {!Array} */ | |
var cmds = []; | |
var a = init(item); | |
/** @type {!Array} */ | |
var types = ["input", "select", "a[href]", "textarea", "button", "[tabindex]"]; | |
var results = el.querySelectorAll(types.join(",")); | |
if (input.includeContainer) { | |
/** @type {function(this:Element, string): boolean} */ | |
var childResize = Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; | |
if (types.some(function(item) { | |
return childResize.call(el, item); | |
})) { | |
/** @type {!Array<?>} */ | |
results = Array.prototype.slice.apply(results); | |
results.unshift(el); | |
} | |
} | |
var elem; | |
var t; | |
/** @type {number} */ | |
var i = 0; | |
var l = results.length; | |
for (; i < l; i++) { | |
elem = results[i]; | |
if (!((t = parseInt(elem.getAttribute("tabindex"), 10) || elem.tabIndex) < 0 || "INPUT" === elem.tagName && "hidden" === elem.type || elem.disabled || a(elem, item))) { | |
if (0 === t) { | |
array.push(elem); | |
} else { | |
cmds.push({ | |
index : i, | |
tabIndex : t, | |
node : elem | |
}); | |
} | |
} | |
} | |
/** @type {!Array<?>} */ | |
var result = cmds.sort(function(a, b) { | |
return a.tabIndex === b.tabIndex ? a.index - b.index : a.tabIndex - b.tabIndex; | |
}).map(function(tblObject) { | |
return tblObject.node; | |
}); | |
return Array.prototype.push.apply(result, array), result; | |
}; | |
}, function(canCreateDiscussions, BeautifulProperties, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} x | |
* @param {!Function} y | |
* @return {undefined} | |
*/ | |
function _init(x, y) { | |
if (!(x instanceof y)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function _possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function testUserAgent() { | |
return browserInfo.mobile || browserInfo.tablet; | |
} | |
Object.defineProperty(BeautifulProperties, "__esModule", { | |
value : true | |
}); | |
BeautifulProperties.HostedField = void 0; | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var RHSong = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(2); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(13); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _deepAssign = __webpack_require__(6); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _UiIcon = __webpack_require__(1); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var browserInfo = __webpack_require__(80); | |
__webpack_require__(0)("recurly:hostedField"); | |
BeautifulProperties.HostedField = function(_EventEmitter) { | |
/** | |
* @param {?} c | |
* @return {?} | |
*/ | |
function Agent(c) { | |
_init(this, Agent); | |
var _this = _possibleConstructorReturn(this, (Agent.__proto__ || Object.getPrototypeOf(Agent)).call(this)); | |
return _this.onReady = _this.onReady.bind(_this), _this.onChange = _this.onChange.bind(_this), _this.onConfigure = _this.onConfigure.bind(_this), _this.onStateChange = _this.onStateChange.bind(_this), _this.focus = _this.focus.bind(_this), _this.ready = false, _this.state = {}, _this.configure(c), _this.inject(), _this.bindDeferredFocus(), _this.on("bus:added", function(hasMicrotasks) { | |
/** @type {!Object} */ | |
_this.bus = hasMicrotasks; | |
_this.bus.add(_this.window); | |
}), _this.on("hostedField:ready", _this.onReady), _this.on("hostedField:change", _this.onChange), _this.on("hostedField:configure", _this.onConfigure), _this.on("hostedField:state:change", _this.onStateChange), _this; | |
} | |
return _inherits(Agent, _EventEmitter), _createClass(Agent, [{ | |
key : "integrityCheck", | |
value : function() { | |
/** @type {!Array} */ | |
var jq_results = [this.target, this.container, this.iframe]; | |
var val = document.body.contains.bind(document.body); | |
return !~jq_results.map(val).indexOf(false); | |
} | |
}, { | |
key : "configure", | |
value : function(args) { | |
if (args = (0, _normalizeDataUri2.default)(args), this.target || (this.target = _deepAssign2.default.element(window.document.querySelector(args.selector))), !this.target) { | |
/** @type {!Object} */ | |
var obj = args; | |
var object_t = obj.type; | |
var query = obj.selector; | |
throw (0, _UiIcon2.default)("missing-hosted-field-target", { | |
type : object_t, | |
selector : query | |
}); | |
} | |
/** @type {!Object} */ | |
this.config = args; | |
} | |
}, { | |
key : "inject", | |
value : function() { | |
/** @type {string} */ | |
this.target.innerHTML = '\n <div class="' + this.classList + '">\n <iframe\n src="' + this.url + '"\n allowtransparency="true"\n border="0"\n frameborder="0"\n scrolling="no"\n style="background: transparent; width: 100%; height: 100%;">\n </iframe>\n </div>\n '; | |
this.container = this.target.children[0]; | |
this.iframe = this.container.querySelector("iframe"); | |
this.window = this.iframe.contentWindow; | |
if (testUserAgent()) { | |
this.tabbingProxy = _deepAssign2.default.createHiddenInput(); | |
this.tabbingProxy.addEventListener("focus", this.focus); | |
this.container.insertBefore(this.tabbingProxy, this.iframe); | |
} | |
} | |
}, { | |
key : "bindDeferredFocus", | |
value : function() { | |
var helper = this; | |
if (this.container.addEventListener("click", this.focus), this.target.id) { | |
var t = window.document.querySelectorAll("label[for=" + this.target.id + "]"); | |
[].slice.apply(t).forEach(function(el) { | |
el.addEventListener("click", helper.focus); | |
}); | |
} | |
} | |
}, { | |
key : "reset", | |
value : function() { | |
this.off(); | |
/** @type {string} */ | |
this.target.innerHTML = ""; | |
delete this.target; | |
delete this.iframe; | |
delete this.window; | |
} | |
}, { | |
key : "update", | |
value : function() { | |
this.container.className = this.classList; | |
this.iframe.setAttribute("tabindex", this.tabIndex); | |
} | |
}, { | |
key : "onReady", | |
value : function(obj) { | |
if (obj.type === this.type) { | |
/** @type {boolean} */ | |
this.ready = true; | |
this.off("hostedField:ready", this.onReady); | |
this.update(); | |
} | |
} | |
}, { | |
key : "onStateChange", | |
value : function(obj) { | |
if (obj.type === this.type) { | |
/** @type {!Object} */ | |
var value = RHSong({}, obj); | |
delete value.type; | |
/** @type {!Object} */ | |
this.state = value; | |
this.update(); | |
} | |
} | |
}, { | |
key : "onChange", | |
value : function(obj) { | |
if (obj.type === this.type) { | |
this.update(); | |
} | |
} | |
}, { | |
key : "onConfigure", | |
value : function(obj) { | |
if (obj.type === this.type) { | |
this.configure(obj); | |
this.update(); | |
} | |
} | |
}, { | |
key : "focus", | |
value : function() { | |
if (this.bus) { | |
this.bus.send("hostedField:" + this.type + ":focus!"); | |
} | |
} | |
}, { | |
key : "type", | |
get : function() { | |
return this.config.type; | |
} | |
}, { | |
key : "url", | |
get : function() { | |
/** @type {string} */ | |
var urlSafeNodeName = encodeURIComponent(JSON.stringify(this.config)); | |
return this.config.recurly.api + "/field.html#config=" + urlSafeNodeName; | |
} | |
}, { | |
key : "classList", | |
get : function() { | |
/** @type {string} */ | |
var baseCls = "recurly-hosted-field"; | |
/** @type {!Array} */ | |
var me = [baseCls]; | |
return this.ready && (me.push(baseCls + "-" + this.config.type), this.state.focus && (me.push(baseCls + "-focus"), me.push(baseCls + "-" + this.config.type + "-focus")), this.state.valid ? (me.push(baseCls + "-valid"), me.push(baseCls + "-" + this.config.type + "-valid")) : this.state.focus || this.state.empty || (me.push(baseCls + "-invalid"), me.push(baseCls + "-" + this.config.type + "-invalid"))), me.join(" "); | |
} | |
}, { | |
key : "tabIndex", | |
get : function() { | |
/** @type {number} */ | |
var majorGraduationTextSize = parseInt(this.config.tabIndex, 10); | |
return isNaN(majorGraduationTextSize) ? 0 : majorGraduationTextSize; | |
} | |
}]), Agent; | |
}(_prepareStyleProperties2.default); | |
}, function(module, canCreateDiscussions, errorHandler) { | |
!function(addedRenderer, isIron, req) { | |
if (void 0 !== module && module.exports) { | |
module.exports = req(); | |
} else { | |
errorHandler(81)("bowser", req); | |
} | |
}(0, 0, function() { | |
/** | |
* @param {!Object} item | |
* @return {?} | |
*/ | |
function detect(item) { | |
/** | |
* @param {!RegExp} obj | |
* @return {?} | |
*/ | |
function getFirstMatch(obj) { | |
var _list3 = item.match(obj); | |
return _list3 && _list3.length > 1 && _list3[1] || ""; | |
} | |
/** | |
* @param {!RegExp} msg | |
* @return {?} | |
*/ | |
function match(msg) { | |
var actual = item.match(msg); | |
return actual && actual.length > 1 && actual[2] || ""; | |
} | |
var result; | |
var id = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase(); | |
/** @type {boolean} */ | |
var ret = /like android/i.test(item); | |
/** @type {boolean} */ | |
var android = !ret && /android/i.test(item); | |
/** @type {boolean} */ | |
var nexusMobile = /nexus\s*[0-6]\s*/i.test(item); | |
/** @type {boolean} */ | |
var winRef = !nexusMobile && /nexus\s*[0-9]+/i.test(item); | |
/** @type {boolean} */ | |
var detailViewItem = /CrOS/.test(item); | |
/** @type {boolean} */ | |
var key = /silk/i.test(item); | |
/** @type {boolean} */ | |
var sailfish = /sailfish/i.test(item); | |
/** @type {boolean} */ | |
var largeiconViewItem = /tizen/i.test(item); | |
/** @type {boolean} */ | |
var naiveInsertIndex = /(web|hpw)os/i.test(item); | |
/** @type {boolean} */ | |
var checked = /windows phone/i.test(item); | |
/** @type {boolean} */ | |
var val = (/SamsungBrowser/i.test(item), !checked && /windows/i.test(item)); | |
/** @type {boolean} */ | |
var m = !id && !key && /macintosh/i.test(item); | |
/** @type {boolean} */ | |
var g = !android && !sailfish && !largeiconViewItem && !naiveInsertIndex && /linux/i.test(item); | |
var v = match(/edg([ea]|ios)\/(\d+(\.\d+)?)/i); | |
var versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i); | |
/** @type {boolean} */ | |
var inputWin = /tablet/i.test(item) && !/tablet pc/i.test(item); | |
/** @type {boolean} */ | |
var regex = !inputWin && /[^-]mobi/i.test(item); | |
/** @type {boolean} */ | |
var itemNew = /xbox/i.test(item); | |
if (/opera/i.test(item)) { | |
result = { | |
name : "Opera", | |
opera : t, | |
version : versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/opr\/|opios/i.test(item)) { | |
result = { | |
name : "Opera", | |
opera : t, | |
version : getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier | |
}; | |
} else { | |
if (/SamsungBrowser/i.test(item)) { | |
result = { | |
name : "Samsung Internet for Android", | |
samsungBrowser : t, | |
version : versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/coast/i.test(item)) { | |
result = { | |
name : "Opera Coast", | |
coast : t, | |
version : versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/yabrowser/i.test(item)) { | |
result = { | |
name : "Yandex Browser", | |
yandexbrowser : t, | |
version : versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/ucbrowser/i.test(item)) { | |
result = { | |
name : "UC Browser", | |
ucbrowser : t, | |
version : getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i) | |
}; | |
} else { | |
if (/mxios/i.test(item)) { | |
result = { | |
name : "Maxthon", | |
maxthon : t, | |
version : getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i) | |
}; | |
} else { | |
if (/epiphany/i.test(item)) { | |
result = { | |
name : "Epiphany", | |
epiphany : t, | |
version : getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i) | |
}; | |
} else { | |
if (/puffin/i.test(item)) { | |
result = { | |
name : "Puffin", | |
puffin : t, | |
version : getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i) | |
}; | |
} else { | |
if (/sleipnir/i.test(item)) { | |
result = { | |
name : "Sleipnir", | |
sleipnir : t, | |
version : getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i) | |
}; | |
} else { | |
if (/k-meleon/i.test(item)) { | |
result = { | |
name : "K-Meleon", | |
kMeleon : t, | |
version : getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i) | |
}; | |
} else { | |
if (checked) { | |
result = { | |
name : "Windows Phone", | |
osname : "Windows Phone", | |
windowsphone : t | |
}; | |
if (v) { | |
/** @type {boolean} */ | |
result.msedge = t; | |
result.version = v; | |
} else { | |
/** @type {boolean} */ | |
result.msie = t; | |
result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i); | |
} | |
} else { | |
if (/msie|trident/i.test(item)) { | |
result = { | |
name : "Internet Explorer", | |
msie : t, | |
version : getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (detailViewItem) { | |
result = { | |
name : "Chrome", | |
osname : "Chrome OS", | |
chromeos : t, | |
chromeBook : t, | |
chrome : t, | |
version : getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/edg([ea]|ios)/i.test(item)) { | |
result = { | |
name : "Microsoft Edge", | |
msedge : t, | |
version : v | |
}; | |
} else { | |
if (/vivaldi/i.test(item)) { | |
result = { | |
name : "Vivaldi", | |
vivaldi : t, | |
version : getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier | |
}; | |
} else { | |
if (sailfish) { | |
result = { | |
name : "Sailfish", | |
osname : "Sailfish OS", | |
sailfish : t, | |
version : getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/seamonkey\//i.test(item)) { | |
result = { | |
name : "SeaMonkey", | |
seamonkey : t, | |
version : getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/firefox|iceweasel|fxios/i.test(item)) { | |
result = { | |
name : "Firefox", | |
firefox : t, | |
version : getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i) | |
}; | |
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(item)) { | |
/** @type {boolean} */ | |
result.firefoxos = t; | |
/** @type {string} */ | |
result.osname = "Firefox OS"; | |
} | |
} else { | |
if (key) { | |
result = { | |
name : "Amazon Silk", | |
silk : t, | |
version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/phantom/i.test(item)) { | |
result = { | |
name : "PhantomJS", | |
phantom : t, | |
version : getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/slimerjs/i.test(item)) { | |
result = { | |
name : "SlimerJS", | |
slimer : t, | |
version : getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (/blackberry|\bbb\d+/i.test(item) || /rim\stablet/i.test(item)) { | |
result = { | |
name : "BlackBerry", | |
osname : "BlackBerry OS", | |
blackberry : t, | |
version : versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (naiveInsertIndex) { | |
result = { | |
name : "WebOS", | |
osname : "WebOS", | |
webos : t, | |
version : versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i) | |
}; | |
if (/touchpad\//i.test(item)) { | |
/** @type {boolean} */ | |
result.touchpad = t; | |
} | |
} else { | |
if (/bada/i.test(item)) { | |
result = { | |
name : "Bada", | |
osname : "Bada", | |
bada : t, | |
version : getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (largeiconViewItem) { | |
result = { | |
name : "Tizen", | |
osname : "Tizen", | |
tizen : t, | |
version : getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier | |
}; | |
} else { | |
if (/qupzilla/i.test(item)) { | |
result = { | |
name : "QupZilla", | |
qupzilla : t, | |
version : getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier | |
}; | |
} else { | |
if (/chromium/i.test(item)) { | |
result = { | |
name : "Chromium", | |
chromium : t, | |
version : getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier | |
}; | |
} else { | |
if (/chrome|crios|crmo/i.test(item)) { | |
result = { | |
name : "Chrome", | |
chrome : t, | |
version : getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) | |
}; | |
} else { | |
if (android) { | |
result = { | |
name : "Android", | |
version : versionIdentifier | |
}; | |
} else { | |
if (/safari|applewebkit/i.test(item)) { | |
result = { | |
name : "Safari", | |
safari : t | |
}; | |
if (versionIdentifier) { | |
result.version = versionIdentifier; | |
} | |
} else { | |
if (id) { | |
result = { | |
name : "iphone" == id ? "iPhone" : "ipad" == id ? "iPad" : "iPod" | |
}; | |
if (versionIdentifier) { | |
result.version = versionIdentifier; | |
} | |
} else { | |
/** @type {({googlebot: boolean, name: string, version: ?}|{name: ?, version: ?})} */ | |
result = /googlebot/i.test(item) ? { | |
name : "Googlebot", | |
googlebot : t, | |
version : getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier | |
} : { | |
name : getFirstMatch(/^(.*)\/(.*) /), | |
version : match(/^(.*)\/(.*) /) | |
}; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
if (!result.msedge && /(apple)?webkit/i.test(item)) { | |
if (/(apple)?webkit\/537\.36/i.test(item)) { | |
/** @type {string} */ | |
result.name = result.name || "Blink"; | |
/** @type {boolean} */ | |
result.blink = t; | |
} else { | |
/** @type {string} */ | |
result.name = result.name || "Webkit"; | |
/** @type {boolean} */ | |
result.webkit = t; | |
} | |
if (!result.version && versionIdentifier) { | |
result.version = versionIdentifier; | |
} | |
} else { | |
if (!result.opera && /gecko\//i.test(item)) { | |
/** @type {string} */ | |
result.name = result.name || "Gecko"; | |
/** @type {boolean} */ | |
result.gecko = t; | |
result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i); | |
} | |
} | |
if (result.windowsphone || !android && !result.silk) { | |
if (!result.windowsphone && id) { | |
/** @type {boolean} */ | |
result[id] = t; | |
/** @type {boolean} */ | |
result.ios = t; | |
/** @type {string} */ | |
result.osname = "iOS"; | |
} else { | |
if (m) { | |
/** @type {boolean} */ | |
result.mac = t; | |
/** @type {string} */ | |
result.osname = "macOS"; | |
} else { | |
if (itemNew) { | |
/** @type {boolean} */ | |
result.xbox = t; | |
/** @type {string} */ | |
result.osname = "Xbox"; | |
} else { | |
if (val) { | |
/** @type {boolean} */ | |
result.windows = t; | |
/** @type {string} */ | |
result.osname = "Windows"; | |
} else { | |
if (g) { | |
/** @type {boolean} */ | |
result.linux = t; | |
/** @type {string} */ | |
result.osname = "Linux"; | |
} | |
} | |
} | |
} | |
} | |
} else { | |
/** @type {boolean} */ | |
result.android = t; | |
/** @type {string} */ | |
result.osname = "Android"; | |
} | |
/** @type {string} */ | |
var osVersion = ""; | |
if (result.windows) { | |
osVersion = function(canCreateDiscussions) { | |
switch(canCreateDiscussions) { | |
case "NT": | |
return "NT"; | |
case "XP": | |
return "XP"; | |
case "NT 5.0": | |
return "2000"; | |
case "NT 5.1": | |
return "XP"; | |
case "NT 5.2": | |
return "2003"; | |
case "NT 6.0": | |
return "Vista"; | |
case "NT 6.1": | |
return "7"; | |
case "NT 6.2": | |
return "8"; | |
case "NT 6.3": | |
return "8.1"; | |
case "NT 10.0": | |
return "10"; | |
default: | |
return; | |
} | |
}(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i)); | |
} else { | |
if (result.windowsphone) { | |
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); | |
} else { | |
if (result.mac) { | |
osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i); | |
osVersion = osVersion.replace(/[_\s]/g, "."); | |
} else { | |
if (id) { | |
osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); | |
osVersion = osVersion.replace(/[_\s]/g, "."); | |
} else { | |
if (android) { | |
osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i); | |
} else { | |
if (result.webos) { | |
osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i); | |
} else { | |
if (result.blackberry) { | |
osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i); | |
} else { | |
if (result.bada) { | |
osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i); | |
} else { | |
if (result.tizen) { | |
osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
if (osVersion) { | |
/** @type {string} */ | |
result.osversion = osVersion; | |
} | |
/** @type {(boolean|string)} */ | |
var prevnum = !result.windows && osVersion.split(".")[0]; | |
return inputWin || winRef || "ipad" == id || android && (3 == prevnum || prevnum >= 4 && !regex) || result.silk ? result.tablet = t : (regex || "iphone" == id || "ipod" == id || android || nexusMobile || result.blackberry || result.webos || result.bada) && (result.mobile = t), result.msedge || result.msie && result.version >= 10 || result.yandexbrowser && result.version >= 15 || result.vivaldi && result.version >= 1 || result.chrome && result.version >= 20 || result.samsungBrowser && result.version >= | |
4 || result.firefox && result.version >= 20 || result.safari && result.version >= 6 || result.opera && result.version >= 10 || result.ios && result.osversion && result.osversion.split(".")[0] >= 6 || result.blackberry && result.version >= 10.1 || result.chromium && result.version >= 20 ? result.a = t : result.msie && result.version < 10 || result.chrome && result.version < 20 || result.firefox && result.version < 20 || result.safari && result.version < 6 || result.opera && result.version < | |
10 || result.ios && result.osversion && result.osversion.split(".")[0] < 6 || result.chromium && result.version < 20 ? result.c = t : result.x = t, result; | |
} | |
/** | |
* @param {string} version | |
* @return {?} | |
*/ | |
function getVersionPrecision(version) { | |
return version.split(".").length; | |
} | |
/** | |
* @param {!Object} array | |
* @param {!Function} iteratee | |
* @return {?} | |
*/ | |
function map(array, iteratee) { | |
var i; | |
/** @type {!Array} */ | |
var result = []; | |
if (Array.prototype.map) { | |
return Array.prototype.map.call(array, iteratee); | |
} | |
/** @type {number} */ | |
i = 0; | |
for (; i < array.length; i++) { | |
result.push(iteratee(array[i])); | |
} | |
return result; | |
} | |
/** | |
* @param {!Object} versions | |
* @return {?} | |
*/ | |
function compareVersions(versions) { | |
/** @type {number} */ | |
var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1])); | |
var chunks = map(versions, function(version) { | |
/** @type {number} */ | |
var delta = precision - getVersionPrecision(version); | |
return version = version + (new Array(delta + 1)).join(".0"), map(version.split("."), function(inRevIdx) { | |
return (new Array(20 - inRevIdx.length)).join("0") + inRevIdx; | |
}).reverse(); | |
}); | |
for (; --precision >= 0;) { | |
if (chunks[0][precision] > chunks[1][precision]) { | |
return 1; | |
} | |
if (chunks[0][precision] !== chunks[1][precision]) { | |
return -1; | |
} | |
if (0 === precision) { | |
return 0; | |
} | |
} | |
} | |
/** | |
* @param {!Object} minVersions | |
* @param {number} strictMode | |
* @param {!Object} ua | |
* @return {?} | |
*/ | |
function isUnsupportedBrowser(minVersions, strictMode, ua) { | |
var _bowser = bowser; | |
if ("string" == typeof strictMode) { | |
/** @type {number} */ | |
ua = strictMode; | |
strictMode = void 0; | |
} | |
if (void 0 === strictMode) { | |
/** @type {boolean} */ | |
strictMode = false; | |
} | |
if (ua) { | |
_bowser = detect(ua); | |
} | |
/** @type {string} */ | |
var version = "" + _bowser.version; | |
var browser; | |
for (browser in minVersions) { | |
if (minVersions.hasOwnProperty(browser) && _bowser[browser]) { | |
if ("string" != typeof minVersions[browser]) { | |
throw new Error("Browser version in the minVersion map should be a string: " + browser + ": " + String(minVersions)); | |
} | |
return compareVersions([version, minVersions[browser]]) < 0; | |
} | |
} | |
return strictMode; | |
} | |
/** | |
* @param {!Object} minVersions | |
* @param {undefined} strictMode | |
* @param {!Object} ua | |
* @return {?} | |
*/ | |
function check(minVersions, strictMode, ua) { | |
return !isUnsupportedBrowser(minVersions, strictMode, ua); | |
} | |
/** @type {boolean} */ | |
var t = true; | |
var bowser = detect("undefined" != typeof navigator ? navigator.userAgent || "" : ""); | |
return bowser.test = function(b) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < b.length; ++i) { | |
var type = b[i]; | |
if ("string" == typeof type && type in bowser) { | |
return true; | |
} | |
} | |
return false; | |
}, bowser.isUnsupportedBrowser = isUnsupportedBrowser, bowser.compareVersions = compareVersions, bowser.check = check, bowser._detect = detect, bowser.detect = detect, bowser; | |
}); | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @return {?} | |
*/ | |
mixin.exports = function() { | |
throw new Error("define cannot be used indirect"); | |
}; | |
}, function(canCreateDiscussions, self, n) { | |
/** | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function store(options) { | |
var string = options.scope; | |
var undefined = void 0 === string ? "local" : string; | |
var key = options.key; | |
var right = options.otherwise; | |
/** @type {(Storage|null)} */ | |
var hashedItemStore = "session" === undefined ? window.sessionStorage : window.localStorage; | |
/** @type {string} */ | |
var hash = Aid + "." + key; | |
/** @type {(null|string)} */ | |
var a = hashedItemStore.getItem(hash); | |
return null !== a || ~[null, void 0].indexOf(right) || (a = right, hashedItemStore.setItem(hash, a)), a; | |
} | |
Object.defineProperty(self, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object): ?} */ | |
self.storage = store; | |
/** @type {string} */ | |
var Aid = self.NAMESPACE = "__recurly__"; | |
}, function(canCreateDiscussions, t, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!Object} obj | |
* @param {string} key | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function clone(obj, key, value) { | |
return key in obj ? Object.defineProperty(obj, key, { | |
value : value, | |
enumerable : true, | |
configurable : true, | |
writable : true | |
}) : obj[key] = value, obj; | |
} | |
/** | |
* @param {!AudioNode} x | |
* @param {!Function} y | |
* @return {undefined} | |
*/ | |
function error(x, y) { | |
if (!(x instanceof y)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} self | |
* @param {string} call | |
* @return {?} | |
*/ | |
function _possibleConstructorReturn(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !call || "object" != typeof call && "function" != typeof call ? self : call; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var func = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
/** | |
* @param {!Object} o | |
* @param {string} name | |
* @param {?} args | |
* @return {?} | |
*/ | |
var callback = function f(o, name, args) { | |
if (null === o) { | |
o = Function.prototype; | |
} | |
/** @type {(ObjectPropertyDescriptor<?>|undefined)} */ | |
var node = Object.getOwnPropertyDescriptor(o, name); | |
if (void 0 === node) { | |
/** @type {(Object|null)} */ | |
var n = Object.getPrototypeOf(o); | |
return null === n ? void 0 : f(n, name, args); | |
} | |
if ("value" in node) { | |
return node.value; | |
} | |
/** @type {(function(): ?|undefined)} */ | |
var params = node.get; | |
if (void 0 !== params) { | |
return params.call(args); | |
} | |
}; | |
var _normalizeDataUri = __webpack_require__(5); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(84); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(17); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(86); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var _deepAssign = __webpack_require__(7); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _noframeworkWaypoints = __webpack_require__(30); | |
var _noframeworkWaypoints2 = _interopRequireDefault(_noframeworkWaypoints); | |
var _AboutPage = __webpack_require__(3); | |
var _AboutPage2 = _interopRequireDefault(_AboutPage); | |
var _AppDownload = __webpack_require__(1); | |
var _AppDownload2 = _interopRequireDefault(_AppDownload); | |
var __WEBPACK_IMPORTED_MODULE_1__internals__ = __webpack_require__(10); | |
var _prepareStyleProperties = __webpack_require__(11); | |
var o = _interopRequireDefault(_prepareStyleProperties); | |
var _buildPageNumber = __webpack_require__(12); | |
var _buildPageNumber2 = _interopRequireDefault(_buildPageNumber); | |
var _engine = __webpack_require__(88); | |
var _engine2 = _interopRequireDefault(_engine); | |
var _custom = __webpack_require__(89); | |
var _custom2 = _interopRequireDefault(_custom); | |
var _SearchUtility = __webpack_require__(90); | |
var _Complex2 = _interopRequireDefault(_SearchUtility); | |
var $ = __webpack_require__(0)("recurly:pricing:checkout-pricing"); | |
var offsetFromCenter = function(_EventEmitter) { | |
/** | |
* @return {?} | |
*/ | |
function e() { | |
var _Object$getPrototypeO; | |
error(this, e); | |
/** @type {number} */ | |
var _len2 = arguments.length; | |
/** @type {!Array} */ | |
var args = Array(_len2); | |
/** @type {number} */ | |
var _key2 = 0; | |
for (; _key2 < _len2; _key2++) { | |
args[_key2] = arguments[_key2]; | |
} | |
var s = _possibleConstructorReturn(this, (_Object$getPrototypeO = e.__proto__ || Object.getPrototypeOf(e)).call.apply(_Object$getPrototypeO, [this].concat(args))); | |
return s.debug = $, s; | |
} | |
return _inherits(e, _EventEmitter), _createClass(e, [{ | |
key : "reset", | |
value : function() { | |
callback(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "reset", this).call(this); | |
/** @type {!Array} */ | |
this.items.subscriptions = []; | |
/** @type {!Array} */ | |
this.items.adjustments = []; | |
} | |
}, { | |
key : "findSubscriptionById", | |
value : function(node) { | |
var t = (0, _normalizeDataUri2.default)(this.items.subscriptions, function(bookmark) { | |
return bookmark.id === node; | |
}); | |
if (t) { | |
return t.subscription; | |
} | |
} | |
}, { | |
key : "attach", | |
value : function(b) { | |
var self = this; | |
return this.attachment && this.attachment.detach(), this.attachment = new _Complex2.default(this, b), this.attachment.once("ready", function() { | |
return self.emit("attached"); | |
}), this.attachment; | |
} | |
}, { | |
key : "currency", | |
value : function(value) { | |
var request = this; | |
return new o.default(function(success, element) { | |
return request.items.currency === value ? success(request.items.currency) : request.subscriptionsAllowCurrency(value) ? (request.items.currency = value, void _deepAssign2.default.all(request.validSubscriptions.map(function(items) { | |
return $("checkout currency has changed. Updating subscription", items), items.currency(value).reprice(); | |
})).then(function() { | |
return request.giftCard(null); | |
}).then(function() { | |
$("set.currency"); | |
request.emit("set.currency", value); | |
success(value); | |
})) : request.error((0, _AppDownload2.default)("invalid-currency", { | |
currency : value, | |
allowed : request.subscriptionCurrencies | |
}), element, "currency"); | |
}, this); | |
} | |
}, { | |
key : "subscription", | |
value : function(data) { | |
var options = this; | |
return new o.default(function(callback, r) { | |
if (!(data instanceof _buildPageNumber2.default)) { | |
return options.error((0, _AppDownload2.default)("invalid-option", { | |
name : "subscription", | |
expect : "a {recurly.Pricing.Subscription}" | |
}), r, "subscription"); | |
} | |
if (options.items.subscriptions.some(function(options) { | |
return options.subscription === data; | |
})) { | |
return callback(data); | |
} | |
var plan = data.items.plan; | |
if (options.items.currency && plan) { | |
/** @type {!Array<string>} */ | |
var a = Object.keys(plan.price); | |
if (!~a.indexOf(options.currencyCode)) { | |
try { | |
options.resolveCurrency(a); | |
} catch (e) { | |
return options.error((0, _AppDownload2.default)("invalid-subscription-currency", { | |
checkoutCurrency : options.currencyCode, | |
checkoutSupportedCurrencies : options.subscriptionCurrencies, | |
subscriptionPlanCurrencies : a | |
}), r, "currency"); | |
} | |
} | |
} | |
if (!options.items.currency) { | |
options.currency(data.items.currency); | |
} | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
var check = function(value) { | |
return function(usesNameOnServer) { | |
return options.emit("set." + value, clone({ | |
subscription : { | |
id : data.id | |
} | |
}, value, usesNameOnServer)); | |
}; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
var create = function() { | |
data.on("change:external", function() { | |
return options.reprice(); | |
}); | |
data.on("set.plan", check("plan")); | |
data.on("set.addon", check("addon")); | |
options.items.subscriptions.push(new _engine2.default(data, options)); | |
$("set.subscription"); | |
options.emit("set.subscription", data); | |
callback(data); | |
}; | |
if (data.isValid) { | |
data.coupon(null).giftcard(null).then(create); | |
} else { | |
create(); | |
} | |
}, this); | |
} | |
}, { | |
key : "adjustment", | |
value : function(obj) { | |
var me = this; | |
var value = obj.amount; | |
var num = obj.quantity; | |
var path = obj.id; | |
var name = void 0 === path ? (0, _AboutPage2.default)() : path; | |
var currency = obj.currency; | |
var link_el = obj.taxExempt; | |
var c = obj.taxCode; | |
return new o.default(function(success, i) { | |
var item = (0, _normalizeDataUri2.default)(me.items.adjustments, function(mw) { | |
return mw.id === name; | |
}); | |
/** @type {boolean} */ | |
var a = true; | |
if (item && void 0 === value && (a = false), a && (value = Number(value), !(0, _UiRippleInk2.default)(value))) { | |
var overlay = { | |
name : "amount", | |
expect : "a finite Number" | |
}; | |
return me.error((0, _AppDownload2.default)("invalid-option", overlay), i, "adjustment"); | |
} | |
var data = {}; | |
if (item) { | |
if (void 0 !== value) { | |
data.amount = value; | |
} | |
if (void 0 !== currency) { | |
data.currency = currency; | |
} | |
if (void 0 !== num) { | |
/** @type {number} */ | |
data.quantity = parseInt(num, 10); | |
} | |
if (void 0 !== link_el) { | |
data.taxExempt = link_el; | |
} | |
if (void 0 !== c) { | |
data.taxCode = c; | |
} | |
func(item, data); | |
} else { | |
/** @type {number} */ | |
num = parseInt(num, 10); | |
if (isNaN(num)) { | |
/** @type {number} */ | |
num = 1; | |
} | |
currency = currency || me.items.currency; | |
/** @type {boolean} */ | |
link_el = !!link_el; | |
data = { | |
amount : value, | |
quantity : num, | |
id : name, | |
currency : currency, | |
taxExempt : link_el, | |
taxCode : c | |
}; | |
me.items.adjustments.push(data); | |
} | |
$("set.adjustment"); | |
me.emit("set.adjustment", data); | |
success(data); | |
}, this); | |
} | |
}, { | |
key : "coupon", | |
value : function(num) { | |
var that = this; | |
/** | |
* @return {undefined} | |
*/ | |
var change = function() { | |
$("unset.coupon"); | |
delete that.items.coupon; | |
that.emit("unset.coupon"); | |
}; | |
return (new o.default(function(verifier) { | |
return verifier(); | |
}, this)).then(function() { | |
if (that.items.coupon) { | |
return that.remove({ | |
coupon : that.items.coupon.code | |
}); | |
} | |
}).then(function() { | |
return new o.default(function(callback, i) { | |
if (!num) { | |
return change(), callback(); | |
} | |
that.recurly.coupon({ | |
plans : that.subscriptionPlanCodes, | |
coupon : num | |
}, function(e, val) { | |
if (e && "not-found" === e.code && change(), e) { | |
return that.error(e, i, "coupon"); | |
} | |
$("set.coupon"); | |
/** @type {!Function} */ | |
that.items.coupon = val; | |
that.emit("set.coupon", val); | |
callback(val); | |
}); | |
}); | |
}); | |
} | |
}, { | |
key : "address", | |
value : function(options) { | |
return new o.default(this.itemUpdateFactory("address", options), this); | |
} | |
}, { | |
key : "shippingAddress", | |
value : function(options) { | |
return new o.default(this.itemUpdateFactory("shippingAddress", options), this); | |
} | |
}, { | |
key : "tax", | |
value : function(options) { | |
return new o.default(this.itemUpdateFactory("tax", options), this); | |
} | |
}, { | |
key : "giftCard", | |
value : function(num) { | |
var _this = this; | |
/** | |
* @return {undefined} | |
*/ | |
var next = function() { | |
if (_this.items.giftCard) { | |
$("unset.giftCard"); | |
delete _this.items.giftCard; | |
_this.emit("unset.giftCard"); | |
} | |
}; | |
return new o.default(function(func, script) { | |
if (!num) { | |
return next(), func(); | |
} | |
_this.recurly.giftCard({ | |
giftcard : num | |
}, function(e, right) { | |
return e ? _this.error(e, script, "giftCard") : (next(), _this.items.currency !== right.currency ? _this.error((0, _AppDownload2.default)("gift-card-currency-mismatch"), script, "giftCard") : ($("set.giftCard"), _this.items.giftCard = right, _this.emit("set.giftCard", right), func(right), void 0)); | |
}); | |
}, this); | |
} | |
}, { | |
key : "remove", | |
value : function(obj) { | |
var self = this; | |
return new o.default(function(r, throwException) { | |
if (obj.subscription) { | |
self.removeFromSet("subscriptions", obj.subscription); | |
} else { | |
if (obj.adjustment) { | |
self.removeFromSet("adjustments", obj.adjustment); | |
} else { | |
if (obj.coupon) { | |
_deepAssign2.default.all(self.validSubscriptions.map(function(data) { | |
return data.coupon().reprice({ | |
internal : true | |
}); | |
})).then(function() { | |
return callback(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "remove", self).call(self, obj).then(r, throwException); | |
}); | |
} else { | |
callback(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "remove", self).call(self, obj).then(r, throwException); | |
} | |
} | |
} | |
}); | |
} | |
}, { | |
key : "removeFromSet", | |
value : function(id, a) { | |
this.items[id] = this.items[id].filter(function(s) { | |
return s.id !== a.id; | |
}); | |
} | |
}, { | |
key : "subscriptionsAllowCurrency", | |
value : function(num) { | |
return !!(0, _classlist2.default)(this.items.subscriptions) || !!~this.subscriptionCurrencies.indexOf(num); | |
} | |
}, { | |
key : "resolveCurrency", | |
value : function(d) { | |
var borderField = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
var originalCommit = borderField.commit; | |
var r = void 0 === originalCommit || originalCommit; | |
var e = void 0; | |
if (e = (0, _classlist2.default)(this.validSubscriptions) ? d : (0, _UiIcon2.default)(this.subscriptionCurrencies, d), (0, _classlist2.default)(e)) { | |
throw new Error("unresolvable"); | |
} | |
if (r) { | |
return this.currency(e[0]); | |
} | |
} | |
}, { | |
key : "Calculations", | |
get : function() { | |
return _custom2.default; | |
} | |
}, { | |
key : "PRICING_METHODS", | |
get : function() { | |
return callback(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "PRICING_METHODS", this).concat(["address", "adjustment", "coupon", "currency", "giftCard", "shippingAddress", "subscription", "tax"]); | |
} | |
}, { | |
key : "validAdjustments", | |
get : function() { | |
var ecommerceTransaction = this; | |
return this.items.adjustments.filter(function(self) { | |
return self.currency === ecommerceTransaction.items.currency; | |
}); | |
} | |
}, { | |
key : "validSubscriptions", | |
get : function() { | |
return this.items.subscriptions.filter(function(validatedToolbox) { | |
return validatedToolbox.isValid; | |
}); | |
} | |
}, { | |
key : "subscriptionCurrencies", | |
get : function() { | |
return (0, _UiIcon2.default)(this.validSubscriptions.map(function(result) { | |
return Object.keys(result.items.plan.price); | |
})); | |
} | |
}, { | |
key : "subscriptionPlanCodes", | |
get : function() { | |
return (0, _noframeworkWaypoints2.default)(this.validSubscriptions.map(function(result) { | |
return result.items.plan.code; | |
})); | |
} | |
}]), e; | |
}(__WEBPACK_IMPORTED_MODULE_1__internals__.Pricing); | |
t.default = offsetFromCenter; | |
}, function(blob, canCreateDiscussions) { | |
/** | |
* @param {!Object} args | |
* @return {?} | |
*/ | |
function get(args) { | |
var data = {}; | |
/** @type {number} */ | |
var n = args.length - 1; | |
var root = args[0]; | |
var collection = args[n]; | |
var i; | |
for (i in root) { | |
/** @type {number} */ | |
data[root[i]] = 0; | |
} | |
/** @type {number} */ | |
i = 1; | |
for (; i <= n; i++) { | |
var features = args[i]; | |
var featureIndex; | |
for (featureIndex in features) { | |
var feature = features[featureIndex]; | |
if (data[feature] === i - 1) { | |
/** @type {number} */ | |
data[feature] = i; | |
} | |
} | |
} | |
/** @type {!Array} */ | |
var bbox = []; | |
for (i in collection) { | |
feature = collection[i]; | |
if (data[feature] === n) { | |
bbox.push(feature); | |
} | |
} | |
return bbox; | |
} | |
/** | |
* @param {!Array} obj | |
* @param {(Node|NodeList|string)} name | |
* @return {?} | |
*/ | |
function data(obj, name) { | |
if (!name) { | |
return get(obj); | |
} | |
/** @type {!Array} */ | |
var result = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < obj.length; i++) { | |
if (parse(name, obj[i]) > -1) { | |
result.push(obj[i]); | |
} | |
} | |
return result; | |
} | |
/** | |
* @param {!NodeList} attributes | |
* @param {?} text | |
* @return {?} | |
*/ | |
function parse(attributes, text) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < attributes.length; i++) { | |
if (attributes[i] === text) { | |
return i; | |
} | |
} | |
return -1; | |
} | |
/** @type {function(!Array, (Node|NodeList|string)): ?} */ | |
blob.exports = data; | |
/** | |
* @param {!Array} array | |
* @param {!NodeList} value | |
* @return {?} | |
*/ | |
data.big = function(array, value) { | |
if (!value) { | |
return get(array); | |
} | |
/** @type {!Array} */ | |
var res = []; | |
var set = {}; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < value.length; i++) { | |
/** @type {boolean} */ | |
set[value[i]] = true; | |
} | |
/** @type {number} */ | |
i = 0; | |
for (; i < array.length; i++) { | |
if (set[array[i]]) { | |
res.push(array[i]); | |
} | |
} | |
return res; | |
}; | |
}, function(mixin, canCreateDiscussions) { | |
/** | |
* @param {!Object} module | |
* @return {?} | |
*/ | |
mixin.exports = function(module) { | |
return module.webpackPolyfill || (module.deprecate = function() { | |
}, module.paths = [], module.children || (module.children = []), Object.defineProperty(module, "loaded", { | |
enumerable : true, | |
get : function() { | |
return module.l; | |
} | |
}), Object.defineProperty(module, "id", { | |
enumerable : true, | |
get : function() { | |
return module.i; | |
} | |
}), module.webpackPolyfill = 1), module; | |
}; | |
}, function(module, canCreateDiscussions) { | |
/** | |
* @param {!Array} value | |
* @return {?} | |
*/ | |
function isFinite(value) { | |
return "number" == typeof value && global_isFinite(value); | |
} | |
var freeGlobal = "object" == typeof global && global && global.Object === Object && global; | |
/** @type {(Window|boolean)} */ | |
var freeSelf = "object" == typeof self && self && self.Object === Object && self; | |
var globals = freeGlobal || freeSelf || Function("return this")(); | |
var global_isFinite = globals.isFinite; | |
/** @type {function(!Array): ?} */ | |
module.exports = isFinite; | |
}, function(canCreateDiscussions, a, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} km | |
* @param {!Function} options | |
* @return {undefined} | |
*/ | |
function importNode(km, options) { | |
if (!(km instanceof options)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
Object.defineProperty(a, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var contains = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var barf = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(4); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(5); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(17); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(31); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(32); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var m = function() { | |
/** | |
* @param {!Object} options | |
* @param {?} callback | |
* @return {undefined} | |
*/ | |
function getData(options, callback) { | |
importNode(this, getData); | |
/** @type {!Object} */ | |
this.pricing = options; | |
this.items = options.items; | |
this.price = { | |
now : {}, | |
next : {}, | |
base : { | |
plan : {}, | |
addons : {} | |
}, | |
addons : {}, | |
currency : { | |
code : this.pricing.currencyCode, | |
symbol : this.pricing.currencySymbol | |
}, | |
taxes : [] | |
}; | |
this.subtotal(); | |
this.tax(function() { | |
this.total(); | |
this.giftCard(); | |
(0, _prepareStyleProperties2.default)(this.price.base.plan, _classlist2.default, this.price.base.plan); | |
(0, _prepareStyleProperties2.default)(this.price.base.addons, _classlist2.default, this.price.base.addons); | |
(0, _prepareStyleProperties2.default)(this.price.addons, _classlist2.default, this.price.addons); | |
(0, _prepareStyleProperties2.default)(this.price.now, _classlist2.default, this.price.now); | |
(0, _prepareStyleProperties2.default)(this.price.next, _classlist2.default, this.price.next); | |
callback(this.price); | |
}); | |
} | |
return barf(getData, [{ | |
key : "subtotal", | |
value : function() { | |
/** @type {number} */ | |
this.price.now.subtotal = 0; | |
/** @type {number} */ | |
this.price.next.subtotal = 0; | |
this.plan(); | |
this.price.now.subtotal += this.price.now.plan; | |
this.price.next.subtotal += this.price.next.plan; | |
this.addons(); | |
this.price.now.subtotal += this.price.now.addons; | |
this.price.next.subtotal += this.price.next.addons; | |
this.setupFee(); | |
this.discount(); | |
this.price.now.subtotal -= this.price.now.discount; | |
this.price.next.subtotal -= this.price.next.discount; | |
this.price.now.subtotal += this.price.now.setup_fee; | |
} | |
}, { | |
key : "total", | |
value : function() { | |
this.price.now.total = this.price.now.subtotal + this.price.now.tax; | |
this.price.next.total = this.price.next.subtotal + this.price.next.tax; | |
} | |
}, { | |
key : "tax", | |
value : function(obj) { | |
var self = this; | |
/** @type {number} */ | |
this.price.now.tax = 0; | |
/** @type {number} */ | |
this.price.next.tax = 0; | |
var layer = this.items.shipping_address || this.items.address; | |
/** @type {!Object} */ | |
var r = contains({}, layer, this.items.tax); | |
if ((0, _UiIcon2.default)(r)) { | |
obj.call(this); | |
} else { | |
this.pricing.recurly.tax(r, function(n, mmCoreSplitViewBlock) { | |
if (n) { | |
self.pricing.emit("error", n); | |
} else { | |
/** @type {!Array} */ | |
self.price.taxes = []; | |
(0, _prepareStyleProperties2.default)(mmCoreSplitViewBlock, function(ts) { | |
if (!self.pricing.taxExempt) { | |
self.price.now.tax += parseFloat((self.price.now.subtotal * ts.rate).toFixed(6)); | |
self.price.next.tax += parseFloat((self.price.next.subtotal * ts.rate).toFixed(6)); | |
self.price.taxes.push(ts); | |
} | |
}); | |
self.price.now.tax = (0, _UiRippleInk2.default)(self.price.now.tax); | |
self.price.next.tax = (0, _UiRippleInk2.default)(self.price.next.tax); | |
} | |
obj.call(self); | |
}); | |
} | |
} | |
}, { | |
key : "plan", | |
value : function() { | |
if (this.price.now.plan = 0, this.price.next.plan = 0, this.items.plan) { | |
var fullSpec = this.items.plan.price[this.items.currency]; | |
this.price.base.plan.unit = fullSpec.unit_amount; | |
this.price.base.plan.setup_fee = fullSpec.setup_fee; | |
var g = this.planPrice().amount; | |
this.price.now.plan = g; | |
this.price.next.plan = g; | |
if (this.isTrial()) { | |
/** @type {number} */ | |
this.price.now.plan = 0; | |
} | |
} | |
} | |
}, { | |
key : "addons", | |
value : function() { | |
var self = this; | |
/** @type {number} */ | |
this.price.now.addons = 0; | |
/** @type {number} */ | |
this.price.next.addons = 0; | |
if (this.items.plan && Array.isArray(this.items.plan.addons)) { | |
this.items.plan.addons.forEach(function($scope) { | |
if ("fixed" === $scope.add_on_type) { | |
var price = $scope.price[self.items.currency].unit_amount; | |
self.price.base.addons[$scope.code] = price; | |
self.price.addons[$scope.code] = price; | |
var item = (0, _normalizeDataUri2.default)(self.items.addons, { | |
code : $scope.code | |
}); | |
if (item) { | |
/** @type {number} */ | |
price = price * item.quantity; | |
if (!self.isTrial()) { | |
self.price.now.addons += price; | |
} | |
self.price.next.addons += price; | |
} | |
} | |
}); | |
} | |
} | |
}, { | |
key : "discount", | |
value : function() { | |
var $scope = this.items.coupon; | |
if (this.price.now.discount = 0, this.price.next.discount = 0, $scope) { | |
if ($scope.discount.rate) { | |
/** @type {number} */ | |
var ibitrate = parseFloat((this.price.now.subtotal * $scope.discount.rate).toFixed(6)); | |
/** @type {number} */ | |
var densityFaktor = parseFloat((this.price.next.subtotal * $scope.discount.rate).toFixed(6)); | |
/** @type {number} */ | |
this.price.now.discount = Math.round(100 * ibitrate) / 100; | |
/** @type {number} */ | |
this.price.next.discount = Math.round(100 * densityFaktor) / 100; | |
} else { | |
if ("free_trial" === $scope.discount.type) { | |
} else { | |
var minPxPerValUnit = this.price.now.subtotal + this.price.now.setup_fee; | |
var _optionsLength = this.price.next.subtotal; | |
/** @type {number} */ | |
this.price.now.discount = Math.min(minPxPerValUnit, $scope.discount.amount[this.items.currency]); | |
/** @type {number} */ | |
this.price.next.discount = Math.min(_optionsLength, $scope.discount.amount[this.items.currency]); | |
} | |
} | |
if ($scope.single_use) { | |
/** @type {number} */ | |
this.price.next.discount = 0; | |
} | |
} | |
} | |
}, { | |
key : "setupFee", | |
value : function() { | |
this.price.now.setup_fee = this.planPrice().setup_fee; | |
/** @type {number} */ | |
this.price.next.setup_fee = 0; | |
} | |
}, { | |
key : "giftCard", | |
value : function() { | |
/** | |
* @param {number} value | |
* @param {undefined} threshold | |
* @return {?} | |
*/ | |
function $(value, threshold) { | |
/** @type {number} */ | |
var used = 0; | |
/** @type {number} */ | |
var input = 0; | |
return threshold > value ? (used = value, input = threshold - value) : used = threshold, { | |
used : used, | |
remains : input | |
}; | |
} | |
if (this.pricing.items.gift_card) { | |
var x = this.price.now.total; | |
var total = this.price.next.total; | |
var self = $(x, this.pricing.items.gift_card.unit_amount); | |
var options = $(total, self.remains); | |
this.price.now.gift_card = self.used; | |
this.price.next.gift_card = options.used; | |
/** @type {number} */ | |
this.price.now.total = x - self.used; | |
/** @type {number} */ | |
this.price.next.total = total - options.used; | |
} | |
} | |
}, { | |
key : "planPrice", | |
value : function() { | |
var plan = this.items.plan; | |
if (!plan) { | |
return { | |
amount : 0, | |
setup_fee : 0 | |
}; | |
} | |
var transactionContributionFiat = plan.price[this.items.currency]; | |
return transactionContributionFiat.amount = transactionContributionFiat.unit_amount * (plan.quantity || 1), transactionContributionFiat; | |
} | |
}, { | |
key : "isTrial", | |
value : function() { | |
var key = this.items.coupon; | |
return !(!key || "free_trial" !== key.discount.type) || this.items.plan.trial; | |
} | |
}]), getData; | |
}(); | |
a.default = m; | |
}, function(canCreateDiscussions, exports, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} options | |
* @param {!Function} callback | |
* @return {undefined} | |
*/ | |
function addListener(options, callback) { | |
if (!(options instanceof callback)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} region | |
* @param {string} callback | |
* @return {?} | |
*/ | |
function callback(region, callback) { | |
return function() { | |
return new _deepAssign2.default(function(saveNotifs, canCreateDiscussions) { | |
return saveNotifs(); | |
}, callback); | |
}; | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
exports.DEFERRED_METHODS = exports.DISABLED_METHODS = void 0; | |
var debug = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _prepareStyleProperties = __webpack_require__(1); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _deepAssign = __webpack_require__(11); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _normalizeDataUri = __webpack_require__(12); | |
/** @type {!Array} */ | |
var pipelets = (_interopRequireDefault(_normalizeDataUri), exports.DISABLED_METHODS = ["address", "coupon", "currency", "giftcard", "shippingAddress"]); | |
/** @type {!Array} */ | |
var trytes = exports.DEFERRED_METHODS = ["couponIsValidForSubscription"]; | |
var SuggestList = function() { | |
/** | |
* @param {string} t | |
* @param {!Object} dt | |
* @return {undefined} | |
*/ | |
function show(t, dt) { | |
var _types = this; | |
addListener(this, show); | |
/** @type {string} */ | |
this.subscription = t; | |
/** @type {!Object} */ | |
this.checkout = dt; | |
pipelets.forEach(function(i) { | |
var m = t[i]; | |
t[i] = callback(i, t); | |
_types[i] = m.bind(t); | |
}); | |
trytes.forEach(function(i) { | |
/** | |
* @return {?} | |
*/ | |
_types[i] = function() { | |
return t[i].apply(t, arguments); | |
}; | |
}); | |
t.plan = this.plan.bind(this); | |
} | |
return debug(show, [{ | |
key : "plan", | |
value : function() { | |
var App; | |
var state = this; | |
var self = (App = this.subscription).resolvePlanOptions.apply(App, arguments); | |
var item = self.currentPlan; | |
var quantity = self.quantity; | |
var value = self.planCode; | |
var callback = (self.options, self.done); | |
return (new _deepAssign2.default(function(cb, n) { | |
if (item && item.code === value) { | |
return item.quantity = quantity, cb(item); | |
} | |
state.checkout.recurly.plan(value, function(e, item) { | |
if (e) { | |
return state.subscription.error(e, n, "plan"); | |
} | |
if (state.checkout.items.subscriptions.length > 1) { | |
try { | |
state.checkout.resolveCurrency(Object.keys(item.price), { | |
commit : false | |
}); | |
} catch (r) { | |
return n((0, _prepareStyleProperties2.default)("invalid-plan-currency", { | |
planCode : item.code, | |
currencies : state.checkout.subscriptionCurrencies | |
})); | |
} | |
} | |
item.quantity = quantity; | |
/** @type {!Object} */ | |
state.subscription.items.plan = item; | |
/** | |
* @return {undefined} | |
*/ | |
var get = function() { | |
state.subscription.emit("set.plan", item); | |
cb(item); | |
}; | |
if (state.checkout.currencyCode in item.price) { | |
get(); | |
} else { | |
try { | |
state.checkout.resolveCurrency(Object.keys(item.price)).then(get); | |
} catch (out) { | |
n(e); | |
} | |
} | |
}); | |
}, this.subscription)).nodeify(callback); | |
} | |
}, { | |
key : "id", | |
get : function() { | |
return this.subscription.id; | |
} | |
}, { | |
key : "isValid", | |
get : function() { | |
return this.subscription.isValid; | |
} | |
}, { | |
key : "items", | |
get : function() { | |
return this.subscription.items; | |
} | |
}, { | |
key : "price", | |
get : function() { | |
return this.subscription.price; | |
} | |
}, { | |
key : "taxCode", | |
get : function() { | |
return this.subscription.taxCode; | |
} | |
}, { | |
key : "taxExempt", | |
get : function() { | |
return this.subscription.taxExempt; | |
} | |
}]), show; | |
}(); | |
exports.default = SuggestList; | |
}, function(canCreateDiscussions, obj, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} value | |
* @param {!Function} model | |
* @return {undefined} | |
*/ | |
function process(value, model) { | |
if (!(value instanceof model)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} a | |
* @param {!Object} b | |
* @return {?} | |
*/ | |
function callback(a, b) { | |
var bId = b.id; | |
var addons = b.price; | |
return { | |
type : "subscription", | |
id : bId, | |
amount : addons[a].total, | |
setupFee : addons[a].setup_fee, | |
addons : addons[a].addons, | |
plan : addons[a].plan | |
}; | |
} | |
/** | |
* @param {!Object} search | |
* @return {?} | |
*/ | |
function init(search) { | |
if (!search.items.plan.trial) { | |
return 0; | |
} | |
var authorHeight = { | |
days : 86400, | |
months : 2678400 | |
}[search.items.plan.trial.interval] || 0; | |
return search.items.plan.trial.length * authorHeight; | |
} | |
/** | |
* @param {string} index | |
* @param {!Object} item | |
* @return {?} | |
*/ | |
function func(index, item) { | |
var oldPackageJson = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; | |
var DEFAULT_RECONNECT_TIME_INCREASE = oldPackageJson.setupFees; | |
var reconnectTimeIncrease = void 0 === DEFAULT_RECONNECT_TIME_INCREASE || DEFAULT_RECONNECT_TIME_INCREASE; | |
var order = item.price[index]; | |
/** @type {number} */ | |
var sum = parseFloat(order.subtotal) + parseFloat(order.discount); | |
return reconnectTimeIncrease || (sum = sum - parseFloat(order.setup_fee)), sum; | |
} | |
/** | |
* @param {string} e | |
* @param {string} node | |
* @return {?} | |
*/ | |
function s(e, node) { | |
return 0 === e.length ? e : node.applies_to_all_plans ? e : e.filter(function(pangu) { | |
return pangu.couponIsValidForSubscription(node); | |
}); | |
} | |
/** | |
* @param {number} litresInCubicFeet | |
* @return {?} | |
*/ | |
function format(litresInCubicFeet) { | |
return parseFloat((Math.round(100 * litresInCubicFeet) / 100).toFixed(6)); | |
} | |
Object.defineProperty(obj, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object, ...(Object|null)): !Object} */ | |
var binarySearch = Object.assign || function(b) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
var data = arguments[i]; | |
var k; | |
for (k in data) { | |
if (Object.prototype.hasOwnProperty.call(data, k)) { | |
b[k] = data[k]; | |
} | |
} | |
} | |
return b; | |
}; | |
var d3_selection = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _normalizeDataUri = __webpack_require__(4); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(17); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _promise = __webpack_require__(7); | |
var _promise2 = _interopRequireDefault(_promise); | |
var _classlist = __webpack_require__(30); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _UiRippleInk = __webpack_require__(31); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var _deepAssign = __webpack_require__(34); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _AboutPage = __webpack_require__(32); | |
var _AboutPage2 = _interopRequireDefault(_AboutPage); | |
var group = function() { | |
/** | |
* @param {!Object} state | |
* @param {?} f | |
* @return {undefined} | |
*/ | |
function update(state, f) { | |
var self = this; | |
process(this, update); | |
/** @type {!Object} */ | |
this.pricing = state; | |
this.items = state.items; | |
this._itemizedSets = { | |
now : {}, | |
next : {} | |
}; | |
this.price = { | |
now : { | |
items : [] | |
}, | |
next : { | |
items : [] | |
}, | |
currency : { | |
code : this.pricing.currencyCode, | |
symbol : this.pricing.currencySymbol | |
}, | |
taxes : [] | |
}; | |
this.subscriptions().then(function() { | |
return self.adjustments(); | |
}).then(function() { | |
return self.discounts(); | |
}).then(function() { | |
return self.subtotals(); | |
}).then(function() { | |
return self.taxes(); | |
}).then(function() { | |
return self.giftCards(); | |
}).then(function() { | |
return self.totals(); | |
}).then(function() { | |
return self.itemizedSets(); | |
}).catch(function(mnemonics) { | |
return self.pricing.error(mnemonics); | |
}).done(function() { | |
(0, _normalizeDataUri2.default)(self.price.now, _UiRippleInk2.default, self.price.now); | |
(0, _normalizeDataUri2.default)(self.price.next, _UiRippleInk2.default, self.price.next); | |
self.price.now.items.forEach(function(e) { | |
return (0, _normalizeDataUri2.default)(e, _UiRippleInk2.default, e); | |
}); | |
self.price.next.items.forEach(function(e) { | |
return (0, _normalizeDataUri2.default)(e, _UiRippleInk2.default, e); | |
}); | |
f(self.price); | |
}); | |
} | |
return d3_selection(update, [{ | |
key : "subscriptions", | |
value : function() { | |
var q = this; | |
return this.price.now.subscriptions = 0, this.price.next.subscriptions = 0, this._itemizedSets.now.subscriptions = [], this._itemizedSets.next.subscriptions = [], this.validSubscriptions.forEach(function(item) { | |
q.price.now.subscriptions += Number(item.price.now.total); | |
q.price.next.subscriptions += Number(item.price.next.total); | |
q._itemizedSets.now.subscriptions.push(callback("now", item)); | |
q._itemizedSets.next.subscriptions.push(callback("next", item)); | |
}), _promise2.default.resolve(); | |
} | |
}, { | |
key : "adjustments", | |
value : function() { | |
var _self = this; | |
return this.price.now.adjustments = 0, this.price.next.adjustments = 0, this._itemizedSets.now.adjustments = [], this.validAdjustments.forEach(function(item) { | |
var price = item.amount; | |
var quantity = item.quantity; | |
var note_id = item.id; | |
/** @type {number} */ | |
var total = price * quantity; | |
var data = { | |
type : "adjustment", | |
id : note_id, | |
amount : total, | |
quantity : quantity, | |
unitAmount : price | |
}; | |
_self.price.now.adjustments += total; | |
_self._itemizedSets.now.adjustments.push(data); | |
}), _promise2.default.resolve(); | |
} | |
}, { | |
key : "discounts", | |
value : function() { | |
var us = this; | |
var key = this.items.coupon; | |
var after_create_res = _promise2.default.resolve(); | |
if (this.price.now.discount = 0, this.price.next.discount = 0, this.validSubscriptions.forEach(function(data) { | |
after_create_res = after_create_res.then(function() { | |
return data.coupon().reprice(null, { | |
internal : true | |
}); | |
}); | |
}), !key) { | |
return after_create_res; | |
} | |
if ("free_trial" === key.discount.type) { | |
after_create_res = after_create_res.then(function() { | |
return us.applyFreeTrialCoupon(); | |
}); | |
} else { | |
var r = this.discountAmounts(); | |
var discount = r.discountNow; | |
var successProbability = r.discountNext; | |
this.price.now.discount = discount; | |
this.price.next.discount = successProbability; | |
} | |
return after_create_res.then(function() { | |
if (key.single_use) { | |
/** @type {number} */ | |
us.price.next.discount = 0; | |
} | |
}); | |
} | |
}, { | |
key : "subtotals", | |
value : function() { | |
var options = this.price; | |
var data = options.now; | |
var response = options.next; | |
return this.price.now.subtotal = data.subscriptions + data.adjustments - data.discount, this.price.next.subtotal = response.subscriptions - response.discount, _promise2.default.resolve(); | |
} | |
}, { | |
key : "taxes", | |
value : function() { | |
var self = this; | |
/** @type {number} */ | |
var left = this.price.now.taxes = 0; | |
/** @type {number} */ | |
var top = this.price.next.taxes = 0; | |
var item = this.items.shippingAddress || this.items.address; | |
/** @type {!Object} */ | |
var index = binarySearch({}, item, this.items.tax); | |
if ((0, _UiIcon2.default)(index)) { | |
return _promise2.default.resolve(); | |
} | |
var resolve = _promise2.default.denodeify(this.pricing.recurly.tax.bind(this.pricing.recurly)); | |
/** | |
* @param {!Object} line | |
* @return {?} | |
*/ | |
var cb = function(line) { | |
return resolve(binarySearch({}, index, { | |
taxCode : line.taxCode | |
})); | |
}; | |
/** | |
* @param {number} value | |
* @return {?} | |
*/ | |
var round = function(value) { | |
return parseFloat(value.toFixed(6)); | |
}; | |
/** @type {!Array} */ | |
var result = []; | |
return _promise2.default.all(this.taxableAdjustments.map(function(line) { | |
return cb(line).then(function(n) { | |
result = result.concat(n); | |
left = left + n.reduce(function(lot, spawnPattern) { | |
return lot + round(line.amount * line.quantity * spawnPattern.rate); | |
}, 0); | |
}); | |
})).then(function() { | |
return _promise2.default.all(self.taxableSubscriptions.map(function(item) { | |
return cb(item).then(function(r) { | |
result = result.concat(r); | |
r.forEach(function(spawnPattern) { | |
left = left + round(item.price.now.subtotal * spawnPattern.rate); | |
top = top + round(item.price.next.subtotal * spawnPattern.rate); | |
}); | |
}); | |
})); | |
}).then(function() { | |
if (self.items.coupon) { | |
var buffer = self.discountAmounts({ | |
taxExempt : false | |
}); | |
var rate = buffer.discountNow; | |
var offset = buffer.discountNext; | |
return resolve(index).then(function(wrappersTemplates) { | |
wrappersTemplates.forEach(function(settings) { | |
/** @type {number} */ | |
left = left - round(rate * settings.rate); | |
/** @type {number} */ | |
top = top - round(offset * settings.rate); | |
}); | |
}); | |
} | |
}).catch(function(t) { | |
return self.pricing.emit("error", t); | |
}).then(function() { | |
result = result.map(JSON.stringify).filter(function(sceneUid, canCreateDiscussions, scenes) { | |
return scenes.indexOf(sceneUid) === canCreateDiscussions; | |
}).map(JSON.parse); | |
self.price.taxes = result; | |
self.price.now.taxes = (0, _AboutPage2.default)(left); | |
self.price.next.taxes = (0, _AboutPage2.default)(top); | |
}); | |
} | |
}, { | |
key : "giftCards", | |
value : function() { | |
/** | |
* @param {number} start | |
* @param {undefined} x | |
* @return {?} | |
*/ | |
function $(start, x) { | |
/** @type {number} */ | |
var count = 0; | |
/** @type {number} */ | |
var read = 0; | |
return x > start ? (count = start, read = x - start) : count = x, { | |
used : count, | |
remains : read | |
}; | |
} | |
if (this.price.now.giftCard = 0, this.price.next.giftCard = 0, this.items.giftCard) { | |
var ts = this.price.now.subtotal + this.price.now.taxes; | |
var end = this.price.next.subtotal + this.price.next.taxes; | |
var self = $(ts, this.items.giftCard.unit_amount); | |
var start = self.used; | |
var a = self.remains; | |
var b = $(end, a); | |
var lengthIndex = b.used; | |
return this.price.now.giftCard = start, this.price.next.giftCard = lengthIndex, _promise2.default.resolve(); | |
} | |
} | |
}, { | |
key : "totals", | |
value : function() { | |
return this.price.now.total = this.price.now.subtotal + this.price.now.taxes - this.price.now.giftCard, this.price.next.total = this.price.next.subtotal + this.price.next.taxes - this.price.next.giftCard, _promise2.default.resolve(); | |
} | |
}, { | |
key : "itemizedSets", | |
value : function() { | |
return this.price.now.items = this._itemizedSets.now.subscriptions.concat(this._itemizedSets.now.adjustments), this.price.next.items = this._itemizedSets.next.subscriptions, _promise2.default.resolve(); | |
} | |
}, { | |
key : "applyFreeTrialCoupon", | |
value : function() { | |
var e = this; | |
var x = this.items.coupon; | |
return this.hasValidSubscriptions ? "subscription" === x.redemption_resource ? this.mostValuableSubscriptionForFreeTrial().coupon(x).reprice(null, { | |
internal : true | |
}).then(function() { | |
return e.subscriptions(); | |
}) : _promise2.default.all(this.validSubscriptions.map(function(order) { | |
return order.coupon(x).reprice(null, { | |
internal : true | |
}); | |
})).then(function() { | |
return e.subscriptions(); | |
}) : _promise2.default.resolve(); | |
} | |
}, { | |
key : "discountAmounts", | |
value : function() { | |
var data = (arguments.length > 0 && void 0 !== arguments[0] && arguments[0], this.items.coupon); | |
/** @type {number} */ | |
var val = 0; | |
/** @type {number} */ | |
var html = 0; | |
if (data) { | |
if ("free_trial" === data.discount.type) { | |
} else { | |
if (data.discount.rate) { | |
var response = this.discountableSubtotals(data, { | |
setupFees : false | |
}); | |
var rate = response.discountableNow; | |
var amount = response.discountableNext; | |
val = format(rate * data.discount.rate); | |
html = format(amount * data.discount.rate); | |
} else { | |
if (data.discount.amount) { | |
var d = this.discountableSubtotals(data); | |
var tmp = d.discountableNow; | |
var s = d.discountableNext; | |
var v = data.discount.amount[this.items.currency] || 0; | |
/** @type {number} */ | |
val = Math.min(tmp, v); | |
/** @type {number} */ | |
html = Math.min(s, v); | |
} | |
} | |
} | |
} | |
return { | |
discountNow : val, | |
discountNext : html | |
}; | |
} | |
}, { | |
key : "discountableSubtotals", | |
value : function(d) { | |
var args = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; | |
var endTest = args.setupFees; | |
var uncaughtHandle = void 0 === endTest || endTest; | |
var data_variable = args.taxExempt; | |
var withoutOldHits = void 0 === data_variable || data_variable; | |
/** @type {number} */ | |
var sum = 0; | |
/** @type {number} */ | |
var result = 0; | |
if (d.applies_to_non_plan_charges && (sum = sum + (withoutOldHits ? this.price.now.adjustments : this.validAdjustments.reduce(function(canCreateDiscussions, addOn) { | |
return canCreateDiscussions + (addOn.taxExempt ? 0 : addOn.amount * addOn.quantity); | |
}, 0))), d.applies_to_plans && this.hasValidSubscriptions) { | |
var value = void 0; | |
value = "subscription" === d.redemption_resource ? [this.mostValuableSubscriptionForDiscount()] : this.validSubscriptions; | |
value = s(value, d); | |
value.forEach(function(i) { | |
if (!(!withoutOldHits && i.taxExempt)) { | |
sum = sum + func("now", i, { | |
setupFees : uncaughtHandle | |
}); | |
result = result + func("next", i, { | |
setupFees : uncaughtHandle | |
}); | |
} | |
}); | |
} | |
return { | |
discountableNow : sum, | |
discountableNext : result | |
}; | |
} | |
}, { | |
key : "mostValuableSubscriptionForDiscount", | |
value : function() { | |
var value = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.validSubscriptions; | |
return value = s(value, this.items.coupon), value.sort(function(q, res) { | |
/** @type {number} */ | |
var x = parseFloat(q.price.now.subtotal); | |
/** @type {number} */ | |
var y = parseFloat(res.price.now.subtotal); | |
return x > y ? -1 : x < y ? 1 : 0; | |
})[0]; | |
} | |
}, { | |
key : "mostValuableSubscriptionForFreeTrial", | |
value : function() { | |
var e = s(this.validSubscriptions, this.items.coupon); | |
var r = (0, _deepAssign2.default)(e, init); | |
/** @type {string} */ | |
var TO_STRING = Object.keys(r).sort(function(b, a) { | |
return a - b; | |
})[0]; | |
return this.mostValuableSubscriptionForDiscount(r[TO_STRING]); | |
} | |
}, { | |
key : "validAdjustments", | |
get : function() { | |
return this.pricing.validAdjustments; | |
} | |
}, { | |
key : "validSubscriptions", | |
get : function() { | |
return this.pricing.validSubscriptions; | |
} | |
}, { | |
key : "hasValidSubscriptions", | |
get : function() { | |
return this.validSubscriptions.length > 0; | |
} | |
}, { | |
key : "taxableAdjustments", | |
get : function() { | |
return this.validAdjustments.filter(function(args) { | |
return !args.taxExempt && args.amount > 0; | |
}); | |
} | |
}, { | |
key : "taxableSubscriptions", | |
get : function() { | |
return this.validSubscriptions.filter(function(result) { | |
return !result.items.plan.tax_exempt; | |
}); | |
} | |
}, { | |
key : "taxCodes", | |
get : function() { | |
var navLinksArr = this.taxableAdjustments.concat(this.taxableSubscriptions); | |
return (0, _classlist2.default)(navLinksArr.map(function(line) { | |
return line.taxCode; | |
})); | |
} | |
}]), update; | |
}(); | |
obj.default = group; | |
}, function(canCreateDiscussions, obj, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!AudioNode} instance | |
* @param {!Function} Constructor | |
* @return {undefined} | |
*/ | |
function _classCallCheck(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
/** | |
* @param {string} fn | |
* @param {string} t | |
* @return {?} | |
*/ | |
function $(fn, t) { | |
if (!fn) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return !t || "object" != typeof t && "function" != typeof t ? fn : t; | |
} | |
/** | |
* @param {!Object} subClass | |
* @param {!Object} superClass | |
* @return {undefined} | |
*/ | |
function _inherits(subClass, superClass) { | |
if ("function" != typeof superClass && null !== superClass) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
/** @type {!Object} */ | |
subClass.prototype = Object.create(superClass && superClass.prototype, { | |
constructor : { | |
value : subClass, | |
enumerable : false, | |
writable : true, | |
configurable : true | |
} | |
}); | |
if (superClass) { | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(subClass, superClass); | |
} else { | |
/** @type {!Object} */ | |
subClass.__proto__ = superClass; | |
} | |
} | |
} | |
Object.defineProperty(obj, "__esModule", { | |
value : true | |
}); | |
var _createClass = function() { | |
/** | |
* @param {!Function} d | |
* @param {string} props | |
* @return {undefined} | |
*/ | |
function t(d, props) { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
/** @type {boolean} */ | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
/** @type {boolean} */ | |
descriptor.writable = true; | |
} | |
Object.defineProperty(d, descriptor.key, descriptor); | |
} | |
} | |
return function(p, n, a) { | |
return n && t(p.prototype, n), a && t(p, a), p; | |
}; | |
}(); | |
var _UiIcon = __webpack_require__(2); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _prepareStyleProperties = __webpack_require__(5); | |
var _deepAssign = (_interopRequireDefault(_prepareStyleProperties), __webpack_require__(7)); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _classlist = __webpack_require__(3); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _fieldLocale = __webpack_require__(12); | |
var _fieldLocale2 = _interopRequireDefault(_fieldLocale); | |
var _normalizeDataUri = __webpack_require__(6); | |
var o = _interopRequireDefault(_normalizeDataUri); | |
var _UiRippleInk = __webpack_require__(91); | |
var _UiRippleInk2 = _interopRequireDefault(_UiRippleInk); | |
var _noframeworkWaypoints = __webpack_require__(34); | |
var _noframeworkWaypoints2 = _interopRequireDefault(_noframeworkWaypoints); | |
var util_1 = __webpack_require__(33); | |
var RHSong = __webpack_require__(0)("recurly:pricing:checkout:attachment"); | |
/** @type {string} */ | |
var event = "init-all"; | |
var group = function(_EventEmitter) { | |
/** | |
* @param {!Object} instance | |
* @param {!Object} container | |
* @return {?} | |
*/ | |
function Editor(instance, container) { | |
_classCallCheck(this, Editor); | |
var self = $(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this)); | |
if (self.pricing = instance, self.recurly = instance.recurly, self.container = o.default.element(container), !self.container) { | |
throw new Error("invalid dom element"); | |
} | |
return self.onInputChange = self.onInputChange.bind(self), self.updateOutput = self.updateOutput.bind(self), self.pricing.on("change", self.updateOutput), self.elements.all.forEach(function($el) { | |
$el.addEventListener("change", self.onInputChange); | |
$el.addEventListener("propertychange", self.onInputChange); | |
}), self.onInputChange(event), self; | |
} | |
return _inherits(Editor, _EventEmitter), _createClass(Editor, [{ | |
key : "onInputChange", | |
value : function(type) { | |
var self = this; | |
RHSong("onInputChange"); | |
var data = this.elements; | |
var tipsy = (0, _classlist2.default)(); | |
(0, _UiRippleInk2.default)([data.plan, data.plan_quantity, data.addon, data.tax_code]).forEach(function(e) { | |
if (e) { | |
if (!o.default.data(e, "recurlySubscription")) { | |
o.default.data(e, "recurlySubscription", tipsy); | |
} | |
} | |
}); | |
var obj = (0, _noframeworkWaypoints2.default)(data.all, function(e) { | |
return o.default.data(e, "recurlySubscription"); | |
}); | |
delete obj.undefined; | |
this.pricing.items.subscriptions.forEach(function(sub) { | |
if (!obj[sub.id]) { | |
self.pricing.remove({ | |
subscription : sub | |
}); | |
} | |
}); | |
var viewedPagesIds = (data.adjustment || []).map(function(e) { | |
return o.default.data(e, "recurlyAdjustment"); | |
}); | |
this.pricing.items.adjustments.forEach(function(subPage) { | |
if (!~viewedPagesIds.indexOf(subPage.id)) { | |
self.pricing.remove({ | |
adjustment : subPage | |
}); | |
} | |
}); | |
_deepAssign2.default.all(Object.keys(obj).map(function(e) { | |
var options = (0, _noframeworkWaypoints2.default)(obj[e], function(e) { | |
return o.default.data(e, "recurly"); | |
}); | |
var model = self.pricing.findSubscriptionById(e); | |
if (!model) { | |
model = new _fieldLocale2.default(self.recurly, { | |
id : e | |
}); | |
self.pricing.subscription(model); | |
} | |
var quantity = o.default.value(options.plan_quantity) || 1; | |
return model.plan(o.default.value(options.plan), { | |
quantity : quantity | |
}).then(function() { | |
if (options.addon) { | |
return _deepAssign2.default.all(options.addon.map(function(value) { | |
var PremiumRequiresPaymentError = o.default.data(value, "recurlyAddon"); | |
var quantity = o.default.value(value); | |
return model.addon(PremiumRequiresPaymentError, { | |
quantity : quantity | |
}).catch(function(mnemonics) { | |
return self.pricing.error(mnemonics); | |
}); | |
})); | |
} | |
}).then(function() { | |
if (options.tax_code) { | |
return model.tax({ | |
tax_code : o.default.value(options.tax_code) | |
}); | |
} | |
}).reprice(); | |
})).then(function() { | |
if (data.adjustment) { | |
return _deepAssign2.default.all(data.adjustment.map(function(e) { | |
var weight = o.default.data(e, "recurlyAdjustment"); | |
var delta = o.default.data(e, "recurlyAdjustmentAmount"); | |
var value = o.default.value(e); | |
var code = o.default.data(e, "recurlyAdjustmentCurrency"); | |
var shippingTaxCode = o.default.data(e, "recurlyAdjustmentTaxCode"); | |
var intervalGroups = o.default.data(e, "recurlyAdjustmentTaxExempt"); | |
return self.pricing.adjustment({ | |
id : weight, | |
amount : delta, | |
quantity : value, | |
currency : code, | |
taxCode : shippingTaxCode, | |
taxExempt : intervalGroups | |
}); | |
})); | |
} | |
}).then(function() { | |
if (data.currency) { | |
return self.pricing.currency(o.default.value(data.currency)); | |
} | |
}).then(function() { | |
if (data.coupon) { | |
return self.pricing.coupon(o.default.value(data.coupon).trim()).then(null, util_1.ignoreNotFound); | |
} | |
}).then(function() { | |
if (data.gift_card) { | |
return self.pricing.giftCard(o.default.value(data.gift_card).trim()).then(null, util_1.ignoreNotFound); | |
} | |
}).then(function() { | |
if (data.country || data.postal_code) { | |
return self.pricing.address({ | |
country : o.default.value(data.country), | |
postal_code : o.default.value(data.postal_code) | |
}); | |
} | |
}).then(function() { | |
if (data["shipping_address.country"] || data["shipping_address.postal_code"]) { | |
return self.pricing.shippingAddress({ | |
country : o.default.value(data["shipping_address.country"]), | |
postal_code : o.default.value(data["shipping_address.postal_code"]) | |
}); | |
} | |
}).then(function() { | |
if (data.vat_number) { | |
return self.pricing.tax({ | |
vat_number : o.default.value(data.vat_number) | |
}); | |
} | |
}).then(function() { | |
return self.pricing.reprice(); | |
}).then(function() { | |
if (type === event) { | |
self.emit("ready"); | |
} | |
}).done(); | |
} | |
}, { | |
key : "updateOutput", | |
value : function(obj) { | |
var next = this; | |
var data = this.elements; | |
o.default.value(data.currency_code, obj.currency.code); | |
o.default.value(data.currency_symbol, obj.currency.symbol); | |
["subscriptions", "adjustments", "discount", "subtotal", "taxes", "total"].forEach(function(key) { | |
o.default.value(data[key + "_now"], obj.now[key]); | |
o.default.value(data[key + "_next"], obj.next[key]); | |
}); | |
o.default.value(data.gift_card_now, obj.now.giftCard); | |
o.default.value(data.gift_card_next, obj.next.giftCard); | |
if (data.addon_price) { | |
data.addon_price.forEach(function(key) { | |
var arg = o.default.data(key, "recurlySubscription"); | |
var value = arg && next.pricing.findSubscriptionById(arg); | |
if (value && value.isValid) { | |
var undefined = value.price.base.addons[o.default.data(key, "recurlyAddon")]; | |
if (undefined) { | |
o.default.value(key, undefined); | |
} | |
} | |
}); | |
} | |
} | |
}, { | |
key : "detach", | |
value : function() { | |
var _this = this; | |
this.pricing.off("change", this.updateOutput); | |
this.elements.all.forEach(function(element) { | |
element.removeEventListener("change", _this.onInputChange); | |
element.removeEventListener("propertychange", _this.onInputChange); | |
}); | |
} | |
}, { | |
key : "elements", | |
get : function() { | |
if (this._elements) { | |
return this._elements; | |
} | |
var q = { | |
all : [].slice.call(this.container.querySelectorAll("[data-recurly]")) | |
}; | |
return q.all.forEach(function(t) { | |
var n = o.default.data(t, "recurly"); | |
if (!(n in q)) { | |
/** @type {!Array} */ | |
q[n] = []; | |
} | |
q[n].push(t); | |
}), this._elements = q, q; | |
} | |
}]), Editor; | |
}(_UiIcon2.default); | |
obj.default = group; | |
}, function(canCreateDiscussions, app, n) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function fn(obj) { | |
return obj.reduce(function(keys, key) { | |
return keys.concat(Array.isArray(key) ? fn(key) : key); | |
}, []); | |
} | |
Object.defineProperty(app, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Object): ?} */ | |
app.default = fn; | |
}, function(canCreateDiscussions, isSlidingUp) { | |
}, function(canCreateDiscussions, data, __webpack_require__) { | |
/** | |
* @param {?} f | |
* @return {?} | |
*/ | |
function r(f) { | |
var str = (0, self.parseCard)(f); | |
var currentTimeScale = void 0; | |
/** @type {number} */ | |
var dateX = 0; | |
/** @type {number} */ | |
var mul = 1; | |
var i = str.length; | |
if (i < 12 || i > 19) { | |
return false; | |
} | |
for (; i--;) { | |
/** @type {number} */ | |
currentTimeScale = parseInt(str.charAt(i), 10) * mul; | |
/** @type {number} */ | |
dateX = dateX + (currentTimeScale - 9 * (currentTimeScale > 9)); | |
/** @type {number} */ | |
mul = mul ^ 3; | |
} | |
return dateX % 10 == 0 && dateX > 0; | |
} | |
/** | |
* @param {?} keywordArgs | |
* @return {?} | |
*/ | |
function save(keywordArgs) { | |
var result = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; | |
var item = (0, self.parseCard)(keywordArgs); | |
var r = item.length; | |
var response = (0, _deepAssign2.default)(idPlan, function(type) { | |
return type.pattern.test(item) && (result || ~type.lengths.indexOf(r)); | |
}); | |
return response && response.type || "unknown"; | |
} | |
/** | |
* @param {number} month | |
* @param {number} year | |
* @return {?} | |
*/ | |
function draw(month, year) { | |
if ((month = Number(month) - 1) < 0 || month > 11) { | |
return false; | |
} | |
/** @type {number} */ | |
year = Number(year); | |
/** @type {number} */ | |
year = year + (year < 100 ? 2E3 : 0); | |
/** @type {!Date} */ | |
var date = new Date; | |
return date.setYear(year), date.setDate(1), date.setHours(0), date.setMinutes(0), date.setSeconds(0), date.setMonth(month + 1), new Date < date; | |
} | |
/** | |
* @param {string} s | |
* @return {?} | |
*/ | |
function a(s) { | |
return s = String(s).trim(), !!~[3, 4].indexOf(s.length) && /^\d+$/.test(s); | |
} | |
Object.defineProperty(data, "__esModule", { | |
value : true | |
}); | |
/** @type {function(?): ?} */ | |
data.cardNumber = r; | |
/** @type {function(?): ?} */ | |
data.cardType = save; | |
/** @type {function(number, number): ?} */ | |
data.expiry = draw; | |
/** @type {function(string): ?} */ | |
data.cvv = a; | |
var _deepAssign = __webpack_require__(5); | |
var _deepAssign2 = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(_deepAssign); | |
var self = __webpack_require__(21); | |
/** @type {!Array} */ | |
var idPlan = [{ | |
type : "discover", | |
pattern : /^(6011|622|64[4-9]|65)/, | |
lengths : [16] | |
}, { | |
type : "master", | |
pattern : { | |
test : function(b) { | |
/** @type {number} */ | |
var t = parseInt(b.substr(0, 6), 10); | |
return !!/^5[1-5]/.test(b) || t >= 222100 && t <= 272099; | |
} | |
}, | |
lengths : [16] | |
}, { | |
type : "american_express", | |
pattern : /^3[47]/, | |
lengths : [15] | |
}, { | |
type : "visa", | |
pattern : /^4/, | |
lengths : [13, 16] | |
}, { | |
type : "jcb", | |
pattern : /^35[2-8]\d/, | |
lengths : [16] | |
}, { | |
type : "diners_club", | |
pattern : /^(30[0-5]|309|36|3[89]|54|55|2014|2149)/, | |
lengths : [14] | |
}]; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment