UNPKG

ecommerce

Version:

Easily create Ecommerce sites powered by Hanzo.

1,760 lines (1,391 loc) 297 kB
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ // // Shop.js Singe Page App Example // // // Pull in Shop.js module CommonJS module // const Shop = require('shop.js'); // // Start execution when all scripts are loaded. We have to wait for all scripts because there are jquery plugins that need to be // loaded as part of Shop.js // $(window).load(() => { // // Shop.use supports overwriting of the internal templates. // This is commonly done with the error template for the low level form controls to support various frameworks. // The below example is for Bootstrop. // Shop.use({ Controls: { Error: '<div class="text-danger" if="{ errorMessage }">{ errorMessage }</div>' } }); // // Shop.start starts the rendering engine with the passed in options and returns a reference to the Shop.js global // event mediator object. // const m = Shop.start(require('./settings')); // // The 'ready' event is sent when Shop.js has finished its first rendering and all the dynamic content is loaded // m.on('ready', () => { // // Remove the content loading class to hide the loading spinner and show the dynamic content. // $('.loading').removeClass('loading'); }); m.on('submit-success', () => { // // Show the thank you message after a user successfully checks out. Hide the checkout form since checkout submit // was a success. // $('.thanks.hidden').removeClass('hidden'); $('.checkout').addClass('hidden'); }); // // The .side-cart is the side cart modal // $sideCart = $('.side-cart'); // // The .checkout is the checkout dialog. .checkout is hidden until // the .checkout-button is clicked. // $checkout = $('.checkout'); // // The .buy-button opens the side cart // $buyButton = $('.buy-button'); // // The .back-button closes the side cart // $backButton = $('.back-button'); // // The .checkout-button submits the cart to checkout // $checkoutButton = $('.checkout-button') // // The .checkout-back-button exits the checkout and displays normal page content. // $checkoutBackButton = $('.checkout-back-button'); // // When the user clicks the .buy-button, add a Droney 2.0 to the user's cart, and then show the // side cart. // $buyButton.on('click', (event) => { // // If there is no Droney item of any type in the cart, add it 1. // if(!Shop.getItem('droney-2.0')) Shop.setItem('droney-2.0', 1); // // Show the side cart // $sideCart.removeClass('hidden'); // // Disable the .buy-button // $buyButton.attr('disabled', true); }); // // When the user clicks .back-button, close the side cart // $backButton.on('click', event => { // // Hide the side cart // $sideCart.addClass('hidden'); // // Enable the .buy-button // $buyButton.attr('disabled', false); }); // // When the user clicks the .checkout-button, show checkout dialog // and hide other page content. // $checkoutButton.on('click', event => { // // Hide the side cart // $sideCart.addClass('hidden'); // // Show the checkout dialog // $checkout.removeClass('hidden'); // // Hide other page content when checking out // $('.hide-when-co').addClass('hidden'); // // Scroll the page to the top of the checkout. // $('html, body').animate({ scrollTop: $checkout.offset().top }, 200); }); // // When the user clicks the .checkout-back-button, remove (hide) the checkout // dialog and show the default page content. // $checkoutBackButton.on('click', event => { // // Hide the checkout dialog // $checkout.addClass('hidden'); // // enable the .buy-button // $buyButton.attr('disabled', false); // // Show the default page content // $('.hide-when-co').removeClass('hidden'); // // Scroll the page back to the top. // $('html, body').animate({ // 50 is the height of the navbar. scrollTop: 50 }, 200); }); }); },{"./settings":2,"shop.js":40}],2:[function(require,module,exports){ module.exports = { key: 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJiaXQiOjQ1MDM2MTcwNzU2NzUxNzYsImp0aSI6IkNTaWFDckhpdDQ0Iiwic3ViIjoiRXFUR294cDV1MyJ9.fRcRQRRe0CrcnGSW12fmQ_8Cly6mqByIc5wTnANPdPWP3V1Bx9AIGbTVPTx_3KbBEziGewKJtNT1ys6WDXegyg', endpoint: 'https://api.staging.crowdstart.com', taxRates: [ { taxRate: 0.0875, city: 'san francisco', state: 'ca', country: 'us' }, { taxRate: 0.075, state: 'ca', country: 'us' } ] }; },{}],3:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CardCVC, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = CardCVC = (function(superClass) { extend(CardCVC, superClass); function CardCVC() { return CardCVC.__super__.constructor.apply(this, arguments); } CardCVC.prototype.tag = 'card-cvc'; CardCVC.prototype.lookup = 'payment.account.cvc'; return CardCVC; })(Text); },{"./text":25}],4:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CardExpiry, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = CardExpiry = (function(superClass) { extend(CardExpiry, superClass); function CardExpiry() { return CardExpiry.__super__.constructor.apply(this, arguments); } CardExpiry.prototype.tag = 'card-expiry'; CardExpiry.prototype.lookup = 'payment.account.expiry'; return CardExpiry; })(Text); },{"./text":25}],5:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CardNumber, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = CardNumber = (function(superClass) { extend(CardNumber, superClass); function CardNumber() { return CardNumber.__super__.constructor.apply(this, arguments); } CardNumber.prototype.tag = 'card-number'; CardNumber.prototype.lookup = 'payment.account.number'; return CardNumber; })(Text); },{"./text":25}],6:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Checkbox, Control, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Control = require('./control'); module.exports = Checkbox = (function(superClass) { extend(Checkbox, superClass); function Checkbox() { return Checkbox.__super__.constructor.apply(this, arguments); } Checkbox.prototype.tag = 'checkbox-control'; Checkbox.prototype.html = require('../templates/controls/checkbox'); Checkbox.prototype.getValue = function(event) { return event.target.checked; }; return Checkbox; })(Control); },{"../templates/controls/checkbox":43,"./control":7}],7:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Control, CrowdControl, Events, m, riot, scrolling, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; CrowdControl = require('crowdcontrol'); m = require('../mediator'); Events = require('../events'); riot = require('riot'); scrolling = false; module.exports = Control = (function(superClass) { extend(Control, superClass); function Control() { return Control.__super__.constructor.apply(this, arguments); } Control.prototype.init = function() { if ((this.input == null) && (this.inputs != null)) { this.input = this.inputs[this.lookup]; } if (this.input != null) { return Control.__super__.init.apply(this, arguments); } }; Control.prototype.getValue = function(event) { var ref; return (ref = $(event.target).val()) != null ? ref.trim() : void 0; }; Control.prototype.error = function(err) { if (err instanceof DOMException) { console.log('WARNING: Error in riot dom manipulation ignored.', err); return; } Control.__super__.error.apply(this, arguments); if (!scrolling) { scrolling = true; $('html, body').animate({ scrollTop: $(this.root).offset().top - $(window).height() / 2 }, { complete: function() { return scrolling = false; }, duration: 500 }); } return m.trigger(Events.ChangeFailed, this.input.name, this.input.ref.get(this.input.name)); }; Control.prototype.change = function() { Control.__super__.change.apply(this, arguments); return m.trigger(Events.Change, this.input.name, this.input.ref.get(this.input.name)); }; Control.prototype.changed = function(value) { m.trigger(Events.ChangeSuccess, this.input.name, value); return riot.update(); }; return Control; })(CrowdControl.Views.Input); },{"../events":32,"../mediator":41,"crowdcontrol":64,"riot":114}],8:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CountrySelect, Select, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Select = require('./select'); module.exports = CountrySelect = (function(superClass) { extend(CountrySelect, superClass); function CountrySelect() { return CountrySelect.__super__.constructor.apply(this, arguments); } CountrySelect.prototype.tag = 'country-select-control'; CountrySelect.prototype.options = function() { return require('../data/countries').data; }; return CountrySelect; })(Select); },{"../data/countries":29,"./select":16}],9:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var GiftEmail, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = GiftEmail = (function(superClass) { extend(GiftEmail, superClass); function GiftEmail() { return GiftEmail.__super__.constructor.apply(this, arguments); } GiftEmail.prototype.tag = 'gift-email'; GiftEmail.prototype.lookup = 'order.giftEmail'; return GiftEmail; })(Text); },{"./text":25}],10:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var GiftMessage, TextArea, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; TextArea = require('./textarea'); module.exports = GiftMessage = (function(superClass) { extend(GiftMessage, superClass); function GiftMessage() { return GiftMessage.__super__.constructor.apply(this, arguments); } GiftMessage.prototype.tag = 'gift-message'; GiftMessage.prototype.lookup = 'order.giftMessage'; return GiftMessage; })(TextArea); },{"./textarea":26}],11:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Checkbox, GiftToggle, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Checkbox = require('./checkbox'); module.exports = GiftToggle = (function(superClass) { extend(GiftToggle, superClass); function GiftToggle() { return GiftToggle.__super__.constructor.apply(this, arguments); } GiftToggle.prototype.tag = 'gift-toggle'; GiftToggle.prototype.lookup = 'order.gift'; return GiftToggle; })(Checkbox); },{"./checkbox":6}],12:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var GiftType, Select, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Select = require('./state-select'); module.exports = GiftType = (function(superClass) { extend(GiftType, superClass); function GiftType() { return GiftType.__super__.constructor.apply(this, arguments); } GiftType.prototype.tag = 'gift-type'; GiftType.prototype.lookup = 'order.giftType'; return GiftType; })(Select); },{"./state-select":23}],13:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 module.exports = { Control: require('./control'), Text: require('./text'), TextArea: require('./textarea'), Checkbox: require('./checkbox'), Select: require('./select'), QuantitySelect: require('./quantity-select'), CountrySelect: require('./country-select'), StateSelect: require('./state-select'), UserEmail: require('./user-email'), UserName: require('./user-name'), ShippingAddressLine1: require('./shippingaddress-line1'), ShippingAddressLine2: require('./shippingaddress-line2'), ShippingAddressCity: require('./shippingaddress-city'), ShippingAddressPostalCode: require('./shippingaddress-postalcode'), ShippingAddressState: require('./shippingaddress-state'), ShippingAddressCountry: require('./shippingaddress-country'), CardNumber: require('./card-number'), CardExpiry: require('./card-expiry'), CardCVC: require('./card-cvc'), Terms: require('./terms'), GiftToggle: require('./gift-toggle'), GiftType: require('./gift-type'), GiftEmail: require('./gift-email'), GiftMessage: require('./gift-message'), PromoCode: require('./promocode'), register: function() { this.Text.register(); this.TextArea.register(); this.Checkbox.register(); this.Select.register(); this.QuantitySelect.register(); this.CountrySelect.register(); this.StateSelect.register(); this.UserEmail.register(); this.UserName.register(); this.ShippingAddressLine1.register(); this.ShippingAddressLine2.register(); this.ShippingAddressCity.register(); this.ShippingAddressPostalCode.register(); this.ShippingAddressState.register(); this.ShippingAddressCountry.register(); this.CardNumber.register(); this.CardExpiry.register(); this.CardCVC.register(); this.Terms.register(); this.GiftToggle.register(); this.GiftType.register(); this.GiftEmail.register(); this.GiftMessage.register(); return this.PromoCode.register(); } }; },{"./card-cvc":3,"./card-expiry":4,"./card-number":5,"./checkbox":6,"./control":7,"./country-select":8,"./gift-email":9,"./gift-message":10,"./gift-toggle":11,"./gift-type":12,"./promocode":14,"./quantity-select":15,"./select":16,"./shippingaddress-city":17,"./shippingaddress-country":18,"./shippingaddress-line1":19,"./shippingaddress-line2":20,"./shippingaddress-postalcode":21,"./shippingaddress-state":22,"./state-select":23,"./terms":24,"./text":25,"./textarea":26,"./user-email":27,"./user-name":28}],14:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var PromoCode, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = PromoCode = (function(superClass) { extend(PromoCode, superClass); function PromoCode() { return PromoCode.__super__.constructor.apply(this, arguments); } PromoCode.prototype.tag = 'promocode'; PromoCode.prototype.lookup = 'order.promoCode'; return PromoCode; })(Text); },{"./text":25}],15:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Events, QuantitySelect, Select, i, j, m, opts, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Select = require('./select'); Events = require('../events'); m = require('../mediator'); opts = {}; for (i = j = 1; j < 100; i = ++j) { opts[i] = i; } module.exports = QuantitySelect = (function(superClass) { extend(QuantitySelect, superClass); function QuantitySelect() { return QuantitySelect.__super__.constructor.apply(this, arguments); } QuantitySelect.prototype.tag = 'quantity-select-control'; QuantitySelect.prototype.lookup = 'quantity'; QuantitySelect.prototype.options = function() { return opts; }; QuantitySelect.prototype.init = function() { return QuantitySelect.__super__.init.apply(this, arguments); }; QuantitySelect.prototype.readOnly = true; QuantitySelect.prototype.getValue = function(event) { var ref; return parseFloat((ref = $(event.target).val()) != null ? ref.trim() : void 0); }; QuantitySelect.prototype.change = function(e) { var newValue, oldValue; if (e.target == null) { return; } oldValue = this.data.get('quantity'); QuantitySelect.__super__.change.apply(this, arguments); newValue = this.data.get('quantity'); this.data.set('quantity', oldValue); return this.cart.set(this.data.get('productId'), newValue); }; return QuantitySelect; })(Select); },{"../events":32,"../mediator":41,"./select":16}],16:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Select, Text, coolDown, isABrokenBrowser, isObject, requestAnimationFrame, riot, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); riot = require('riot'); isObject = require('is-object'); requestAnimationFrame = require('raf'); isABrokenBrowser = window.navigator.userAgent.indexOf('MSIE') > 0 || window.navigator.userAgent.indexOf('Trident') > 0; coolDown = -1; module.exports = Select = (function(superClass) { extend(Select, superClass); function Select() { return Select.__super__.constructor.apply(this, arguments); } Select.prototype.tag = 'select-control'; Select.prototype.html = require('../templates/controls/select'); Select.prototype.tags = false; Select.prototype.min = 10; Select.prototype.selectOptions = {}; Select.prototype.options = function() { return this.selectOptions; }; Select.prototype.readOnly = false; Select.prototype.ignore = false; Select.prototype.events = { updated: function() { return this.onUpdated(); } }; Select.prototype.getValue = function(event) { var ref; return (ref = $(event.target).val()) != null ? ref.trim().toLowerCase() : void 0; }; Select.prototype.change = function() { Select.__super__.change.apply(this, arguments); return riot.update(); }; Select.prototype.initSelect = function($select) { var $input, invertedOptions, name, options, ref, value; options = []; invertedOptions = {}; ref = this.options(); for (value in ref) { name = ref[value]; options.push({ name: name, value: value }); invertedOptions[name] = value; } $select.selectize({ dropdownParent: 'body', valueField: 'value', labelField: 'name', searchField: 'name', items: [this.input.ref.get(this.input.name)] || [], options: options }).on('change', (function(_this) { return function(event) { if (coolDown !== -1) { return; } coolDown = setTimeout(function() { return coolDown = -1; }, 100); _this.change(event); event.preventDefault(); event.stopPropagation(); return false; }; })(this)); $input = $select.parent().find('.selectize-input input:first'); $input.on('change', function(event) { var val; val = $(event.target).val(); if (invertedOptions[val] != null) { return $select[0].selectize.setValue(invertedOptions[val]); } }); if (this.readOnly) { return $input.attr('readonly', true); } }; Select.prototype.init = function(opts) { Select.__super__.init.apply(this, arguments); return this.style = this.style || 'width:100%'; }; Select.prototype.onUpdated = function() { var $control, $select, select; if (this.input == null) { return; } $select = $(this.root).find('select'); select = $select[0]; if (select != null) { if (!this.initialized) { return requestAnimationFrame((function(_this) { return function() { _this.initSelect($select); return _this.initialized = true; }; })(this)); } else { select.selectize.clear(true); return select.selectize.addItem(this.input.ref.get(this.input.name), true); } } else { $control = $(this.root).find('.selectize-control'); if ($control[0] == null) { return requestAnimationFrame((function(_this) { return function() { return _this.update(); }; })(this)); } } }; return Select; })(Text); },{"../templates/controls/select":44,"./text":25,"is-object":99,"raf":101,"riot":114}],17:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var ShippingAddressCity, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = ShippingAddressCity = (function(superClass) { extend(ShippingAddressCity, superClass); function ShippingAddressCity() { return ShippingAddressCity.__super__.constructor.apply(this, arguments); } ShippingAddressCity.prototype.tag = 'shippingaddress-city'; ShippingAddressCity.prototype.lookup = 'order.shippingAddress.city'; return ShippingAddressCity; })(Text); },{"./text":25}],18:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CountrySelect, ShippingAddressCountry, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; CountrySelect = require('./country-select'); module.exports = ShippingAddressCountry = (function(superClass) { extend(ShippingAddressCountry, superClass); function ShippingAddressCountry() { return ShippingAddressCountry.__super__.constructor.apply(this, arguments); } ShippingAddressCountry.prototype.tag = 'shippingaddress-country'; ShippingAddressCountry.prototype.lookup = 'order.shippingAddress.country'; return ShippingAddressCountry; })(CountrySelect); },{"./country-select":8}],19:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var ShippingAddressLine1, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = ShippingAddressLine1 = (function(superClass) { extend(ShippingAddressLine1, superClass); function ShippingAddressLine1() { return ShippingAddressLine1.__super__.constructor.apply(this, arguments); } ShippingAddressLine1.prototype.tag = 'shippingaddress-line1'; ShippingAddressLine1.prototype.lookup = 'order.shippingAddress.line1'; return ShippingAddressLine1; })(Text); },{"./text":25}],20:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var ShippingAddressLine2, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = ShippingAddressLine2 = (function(superClass) { extend(ShippingAddressLine2, superClass); function ShippingAddressLine2() { return ShippingAddressLine2.__super__.constructor.apply(this, arguments); } ShippingAddressLine2.prototype.tag = 'shippingaddress-line2'; ShippingAddressLine2.prototype.lookup = 'order.shippingAddress.line2'; return ShippingAddressLine2; })(Text); },{"./text":25}],21:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var ShippingAddressPostalCode, Text, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = ShippingAddressPostalCode = (function(superClass) { extend(ShippingAddressPostalCode, superClass); function ShippingAddressPostalCode() { return ShippingAddressPostalCode.__super__.constructor.apply(this, arguments); } ShippingAddressPostalCode.prototype.tag = 'shippingaddress-postalcode'; ShippingAddressPostalCode.prototype.lookup = 'order.shippingAddress.postalCode'; return ShippingAddressPostalCode; })(Text); },{"./text":25}],22:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var ShippingAddressState, StateSelect, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; StateSelect = require('./state-select'); module.exports = ShippingAddressState = (function(superClass) { extend(ShippingAddressState, superClass); function ShippingAddressState() { return ShippingAddressState.__super__.constructor.apply(this, arguments); } ShippingAddressState.prototype.tag = 'shippingaddress-state'; ShippingAddressState.prototype.lookup = 'order.shippingAddress.state'; return ShippingAddressState; })(StateSelect); },{"./state-select":23}],23:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Select, StateSelect, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Select = require('./select'); module.exports = StateSelect = (function(superClass) { extend(StateSelect, superClass); function StateSelect() { return StateSelect.__super__.constructor.apply(this, arguments); } StateSelect.prototype.tag = 'state-select-control'; StateSelect.prototype.html = require('../templates/controls/state-select'); StateSelect.prototype.options = function() { return require('../data/states').data; }; StateSelect.prototype.countryField = 'order.shippingAddress.country'; StateSelect.prototype.onUpdated = function() { var value; if (this.input == null) { return; } if (this.input.ref(this.countryField) === 'us') { $(this.root).find('.selectize-control').show(); } else { $(this.root).find('.selectize-control').hide(); value = this.input.ref(this.input.name); if (value) { this.input.ref.set(this.input.name, value.toUpperCase()); } } return StateSelect.__super__.onUpdated.apply(this, arguments); }; return StateSelect; })(Select); },{"../data/states":31,"../templates/controls/state-select":45,"./select":16}],24:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Checkbox, Terms, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Checkbox = require('./checkbox'); module.exports = Terms = (function(superClass) { extend(Terms, superClass); function Terms() { return Terms.__super__.constructor.apply(this, arguments); } Terms.prototype.tag = 'terms'; Terms.prototype.lookup = 'terms'; return Terms; })(Checkbox); },{"./checkbox":6}],25:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Control, Text, placeholder, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Control = require('./control'); placeholder = require('../utils/placeholder'); module.exports = Text = (function(superClass) { extend(Text, superClass); function Text() { return Text.__super__.constructor.apply(this, arguments); } Text.prototype.tag = 'text-control'; Text.prototype.html = require('../templates/controls/text'); Text.prototype.formElement = 'input'; Text.prototype.init = function() { Text.__super__.init.apply(this, arguments); return this.on('updated', (function(_this) { return function() { var el; el = _this.root.getElementsByTagName(_this.formElement)[0]; return placeholder(el); }; })(this)); }; return Text; })(Control); },{"../templates/controls/text":46,"../utils/placeholder":55,"./control":7}],26:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Text, TextArea, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = TextArea = (function(superClass) { extend(TextArea, superClass); function TextArea() { return TextArea.__super__.constructor.apply(this, arguments); } TextArea.prototype.tag = 'textarea-control'; TextArea.prototype.html = require('../templates/controls/textarea'); TextArea.prototype.formElement = 'textarea'; return TextArea; })(Text); },{"../templates/controls/textarea":47,"./text":25}],27:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Text, UserName, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = UserName = (function(superClass) { extend(UserName, superClass); function UserName() { return UserName.__super__.constructor.apply(this, arguments); } UserName.prototype.tag = 'user-name'; UserName.prototype.lookup = 'user.name'; return UserName; })(Text); },{"./text":25}],28:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var Text, UserEmail, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Text = require('./text'); module.exports = UserEmail = (function(superClass) { extend(UserEmail, superClass); function UserEmail() { return UserEmail.__super__.constructor.apply(this, arguments); } UserEmail.prototype.tag = 'user-email'; UserEmail.prototype.lookup = 'user.email'; return UserEmail; })(Text); },{"./text":25}],29:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 module.exports = { data: { af: "Afghanistan", ax: "Åland Islands", al: "Albania", dz: "Algeria", as: "American Samoa", ad: "Andorra", ao: "Angola", ai: "Anguilla", aq: "Antarctica", ag: "Antigua and Barbuda", ar: "Argentina", am: "Armenia", aw: "Aruba", au: "Australia", at: "Austria", az: "Azerbaijan", bs: "Bahamas", bh: "Bahrain", bd: "Bangladesh", bb: "Barbados", by: "Belarus", be: "Belgium", bz: "Belize", bj: "Benin", bm: "Bermuda", bt: "Bhutan", bo: "Bolivia", bq: "Bonaire, Sint Eustatius and Saba", ba: "Bosnia and Herzegovina", bw: "Botswana", bv: "Bouvet Island", br: "Brazil", io: "British Indian Ocean Territory", bn: "Brunei Darussalam", bg: "Bulgaria", bf: "Burkina Faso", bi: "Burundi", kh: "Cambodia", cm: "Cameroon", ca: "Canada", cv: "Cabo Verde", ky: "Cayman Islands", cf: "Central African Republic", td: "Chad", cl: "Chile", cn: "China", cx: "Christmas Island", cc: "Cocos (Keeling) Islands", co: "Colombia", km: "Comoros", cg: "Congo", cd: "Congo (Democratic Republic)", ck: "Cook Islands", cr: "Costa Rica", ci: "Côte d'Ivoire", hr: "Croatia", cu: "Cuba", cw: "Curaçao", cy: "Cyprus", cz: "Czech Republic", dk: "Denmark", dj: "Djibouti", dm: "Dominica", "do": "Dominican Republic", ec: "Ecuador", eg: "Egypt", sv: "El Salvador", gq: "Equatorial Guinea", er: "Eritrea", ee: "Estonia", et: "Ethiopia", fk: "Falkland Islands", fo: "Faroe Islands", fj: "Fiji", fi: "Finland", fr: "France", gf: "French Guiana", pf: "French Polynesia", tf: "French Southern Territories", ga: "Gabon", gm: "Gambia", ge: "Georgia", de: "Germany", gh: "Ghana", gi: "Gibraltar", gr: "Greece", gl: "Greenland", gd: "Grenada", gp: "Guadeloupe", gu: "Guam", gt: "Guatemala", gg: "Guernsey", gn: "Guinea", gw: "Guinea-Bissau", gy: "Guyana", ht: "Haiti", hm: "Heard Island and McDonald Islands", va: "Holy See", hn: "Honduras", hk: "Hong Kong", hu: "Hungary", is: "Iceland", "in": "India", id: "Indonesia", ir: "Iran", iq: "Iraq", ie: "Ireland", im: "Isle of Man", il: "Israel", it: "Italy", jm: "Jamaica", jp: "Japan", je: "Jersey", jo: "Jordan", kz: "Kazakhstan", ke: "Kenya", ki: "Kiribati", kp: "Korea (Democratic People's Republic of)", kr: "Korea (Republic of)", kw: "Kuwait", kg: "Kyrgyzstan", la: "Lao People's Democratic Republic", lv: "Latvia", lb: "Lebanon", ls: "Lesotho", lr: "Liberia", ly: "Libya", li: "Liechtenstein", lt: "Lithuania", lu: "Luxembourg", mo: "Macao", mk: "Macedonia", mg: "Madagascar", mw: "Malawi", my: "Malaysia", mv: "Maldives", ml: "Mali", mt: "Malta", mh: "Marshall Islands", mq: "Martinique", mr: "Mauritania", mu: "Mauritius", yt: "Mayotte", mx: "Mexico", fm: "Micronesia", md: "Moldova", mc: "Monaco", mn: "Mongolia", me: "Montenegro", ms: "Montserrat", ma: "Morocco", mz: "Mozambique", mm: "Myanmar", na: "Namibia", nr: "Nauru", np: "Nepal", nl: "Netherlands", nc: "New Caledonia", nz: "New Zealand", ni: "Nicaragua", ne: "Niger", ng: "Nigeria", nu: "Niue", nf: "Norfolk Island", mp: "Northern Mariana Islands", no: "Norway", om: "Oman", pk: "Pakistan", pw: "Palau", ps: "Palestine", pa: "Panama", pg: "Papua New Guinea", py: "Paraguay", pe: "Peru", ph: "Philippines", pn: "Pitcairn", pl: "Poland", pt: "Portugal", pr: "Puerto Rico", qa: "Qatar", re: "Réunion", ro: "Romania", ru: "Russian Federation", rw: "Rwanda", bl: "Saint Barthélemy", sh: "Saint Helena, Ascension and Tristan da Cunha", kn: "Saint Kitts and Nevis", lc: "Saint Lucia", mf: "Saint Martin (French)", pm: "Saint Pierre and Miquelon", vc: "Saint Vincent and the Grenadines", ws: "Samoa", sm: "San Marino", st: "Sao Tome and Principe", sa: "Saudi Arabia", sn: "Senegal", rs: "Serbia", sc: "Seychelles", sl: "Sierra Leone", sg: "Singapore", sx: "Sint Maarten (Dutch)", sk: "Slovakia", si: "Slovenia", sb: "Solomon Islands", so: "Somalia", za: "South Africa", gs: "South Georgia and the South Sandwich Islands", ss: "South Sudan", es: "Spain", lk: "Sri Lanka", sd: "Sudan", sr: "Suriname", sj: "Svalbard and Jan Mayen", sz: "Swaziland", se: "Sweden", ch: "Switzerland", sy: "Syrian Arab Republic", tw: "Taiwan", tj: "Tajikistan", tz: "Tanzania", th: "Thailand", tl: "Timor-Leste", tg: "Togo", tk: "Tokelau", to: "Tonga", tt: "Trinidad and Tobago", tn: "Tunisia", tr: "Turkey", tm: "Turkmenistan", tc: "Turks and Caicos Islands", tv: "Tuvalu", ug: "Uganda", ua: "Ukraine", ae: "United Arab Emirates", gb: "United Kingdom of Great Britain and Northern Ireland", us: "United States of America", um: "United States Minor Outlying Islands", uy: "Uruguay", uz: "Uzbekistan", vu: "Vanuatu", ve: "Venezuela", vn: "Viet Nam", vg: "Virgin Islands (British)", vi: "Virgin Islands (U.S.)", wf: "Wallis and Futuna", eh: "Western Sahara", ye: "Yemen", zm: "Zambia", zw: "Zimbabwe" } }; },{}],30:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 module.exports = { data: { 'aud': '$', 'cad': '$', 'eur': '€', 'gbp': '£', 'hkd': '$', 'jpy': '¥', 'nzd': '$', 'sgd': '$', 'usd': '$', 'ghc': '¢', 'ars': '$', 'bsd': '$', 'bbd': '$', 'bmd': '$', 'bnd': '$', 'kyd': '$', 'clp': '$', 'cop': '$', 'xcd': '$', 'svc': '$', 'fjd': '$', 'gyd': '$', 'lrd': '$', 'mxn': '$', 'nad': '$', 'sbd': '$', 'srd': '$', 'tvd': '$', 'bob': '$b', 'uyu': '$u', 'egp': '£', 'fkp': '£', 'gip': '£', 'ggp': '£', 'imp': '£', 'jep': '£', 'lbp': '£', 'shp': '£', 'syp': '£', 'cny': '¥', 'afn': '؋', 'thb': '฿', 'khr': '៛', 'crc': '₡', 'trl': '₤', 'ngn': '₦', 'kpw': '₩', 'krw': '₩', 'ils': '₪', 'vnd': '₫', 'lak': '₭', 'mnt': '₮', 'cup': '₱', 'php': '₱', 'uah': '₴', 'mur': '₨', 'npr': '₨', 'pkr': '₨', 'scr': '₨', 'lkr': '₨', 'irr': '﷼', 'omr': '﷼', 'qar': '﷼', 'sar': '﷼', 'yer': '﷼', 'pab': 'b/.', 'vef': 'bs', 'bzd': 'bz$', 'nio': 'c$', 'chf': 'chf', 'huf': 'ft', 'awg': 'ƒ', 'ang': 'ƒ', 'pyg': 'gs', 'jmd': 'j$', 'czk': 'kč', 'bam': 'km', 'hrk': 'kn', 'dkk': 'kr', 'eek': 'kr', 'isk': 'kr', 'nok': 'kr', 'sek': 'kr', 'hnl': 'l', 'ron': 'lei', 'all': 'lek', 'lvl': 'ls', 'ltl': 'lt', 'mzn': 'mt', 'twd': 'nt$', 'bwp': 'p', 'byr': 'p.', 'gtq': 'q', 'zar': 'r', 'brl': 'r$', 'dop': 'rd$', 'myr': 'rm', 'idr': 'rp', 'sos': 's', 'pen': 's/.', 'ttd': 'tt$', 'zwd': 'z$', 'pln': 'zł', 'mkd': 'ден', 'rsd': 'Дин.', 'bgn': 'лв', 'kzt': 'лв', 'kgs': 'лв', 'uzs': 'лв', 'azn': 'ман', 'rub': 'руб', 'inr': '', 'try': '', '': '' } }; },{}],31:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 module.exports = { data: { al: 'Alabama', ak: 'Alaska', az: 'Arizona', ar: 'Arkansas', ca: 'California', co: 'Colorado', ct: 'Connecticut', de: 'Delaware', dc: 'District of Columbia', fl: 'Florida', ga: 'Georgia', hi: 'Hawaii', id: 'Idaho', il: 'Illinois', "in": 'Indiana', ia: 'Iowa', ks: 'Kansas', ky: 'Kentucky', la: 'Louisiana', me: 'Maine', mt: 'Montana', ne: 'Nebraska', nv: 'Nevada', nh: 'New Hampshire', nj: 'New Jersey', nm: 'New Mexico', ny: 'New York', nc: 'North Carolina', nd: 'North Dakota', oh: 'Ohio', ok: 'Oklahoma', or: 'Oregon', md: 'Maryland', ma: 'Massachusetts', mi: 'Michigan', mn: 'Minnesota', ms: 'Mississippi', mo: 'Missouri', pa: 'Pennsylvania', ri: 'Rhode Island', sc: 'South Carolina', sd: 'South Dakota', tn: 'Tennessee', tx: 'Texas', ut: 'Utah', vt: 'Vermont', va: 'Virginia', wa: 'Washington', wv: 'West Virginia', wi: 'Wisconsin', wy: 'Wyoming', aa: 'U.S. Armed Forces – Americas', ae: 'U.S. Armed Forces – Europe', ap: 'U.S. Armed Forces – Pacific' } }; },{}],32:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 module.exports = { Ready: 'ready', SetData: 'set-data', TryUpdateItem: 'try-update-item', UpdateItem: 'update-item', UpdateItems: 'update-items', Change: 'change', ChangeSuccess: 'change-success', ChangeFailed: 'change-failed', DeleteLineItem: 'delete-line-item', Submit: 'submit', SubmitSuccess: 'submit-success', SubmitFailed: 'submit-failed', ApplyCoupon: 'apply-coupon', ApplyCouponSuccess: 'apply-coupon-success', ApplyCouponFailed: 'apply-coupon-failed' }; },{}],33:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CartForm, CrowdControl, Events, m, riot, store, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; CrowdControl = require('crowdcontrol'); riot = require('riot'); m = require('../mediator'); Events = require('../events'); store = require('../utils/store'); require('../utils/patches'); module.exports = CartForm = (function(superClass) { extend(CartForm, superClass); function CartForm() { return CartForm.__super__.constructor.apply(this, arguments); } CartForm.prototype.tag = 'cart'; CartForm.prototype.html = '<yield>\n <lineitems if="{ !isEmpty() }"></lineitems>\n</yield>'; CartForm.prototype.init = function() { var promoCode; this.originalParentElement = this.root.parentElement; CartForm.__super__.init.apply(this, arguments); promoCode = store.get('promoCode'); if (promoCode) { this.data.set('order.promoCode', promoCode); this.applyPromoCode(); return this.update(); } }; CartForm.prototype.configs = require('./config'); CartForm.prototype.applying = false; CartForm.prototype.promoMessage = ''; CartForm.prototype.isEmpty = function() { return this.data('order.items').length === 0; }; CartForm.prototype.applyPromoCode = function() { var promoCode; this.promoMessage = ''; promoCode = this.data.get('order.promoCode'); if (!promoCode) { return; } store.set('promoCode', promoCode); this.promoMessage = 'Applying...'; this.applying = true; promoCode = promoCode.toUpperCase(); m.trigger(Events.ApplyCoupon, promoCode); return this.cart.promoCode(promoCode).then((function(_this) { return function() { var coupon; _this.applying = false; coupon = _this.data.get('order.coupon'); if (((coupon != null ? coupon.freeProductId : void 0) != null) && coupon.freeProductId !== "" && coupon.freeQuantity > 0) { _this.promoMessage = coupon.freeQuantity + " Free " + freeProduct.name; } else { _this.promoMessage = promoCode + ' Applied!'; } m.trigger(Events.ApplyCouponSuccess, coupon); return _this.update(); }; })(this))["catch"]((function(_this) { return function(err) { var coupon; store.remove('promoCode'); _this.applying = false; coupon = _this.data.get('order.coupon'); if (coupon != null ? coupon.enabled : void 0) { _this.promoMessage = 'This code is expired.'; } else { _this.promoMessage = 'This code is invalid.'; } m.trigger(Events.ApplyCouponFailed, err); return _this.update(); }; })(this)); }; return CartForm; })(CrowdControl.Views.Form); },{"../events":32,"../mediator":41,"../utils/patches":54,"../utils/store":56,"./config":35,"crowdcontrol":64,"riot":114}],34:[function(require,module,exports){ // Generated by CoffeeScript 1.10.0 var CheckoutForm, CrowdControl, Events, m, riot, store, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; CrowdControl = require('crowdcontrol'); riot = require('riot'); m = require('../mediator'); Events = require('../events'); store = require('../utils/store'); module.exports = CheckoutForm = (function(superClass) { extend(CheckoutForm, superClass); function CheckoutForm() { return CheckoutForm.__super__.constructor.apply(this, arguments); } CheckoutForm.prototype.tag = 'checkout'; CheckoutForm.prototype.html = '<form onsubmit={submit}>\n <yield/>\n</form>'; CheckoutForm.prototype.errorMessage = null; CheckoutForm.prototype.loading = false; CheckoutForm.prototype.checkedOut = false; CheckoutForm.prototype.configs = require('./config'); CheckoutForm.prototype._submit = function(event) { if (this.loading || this.checkedOut) { return; } this.loading = true; m.trigger(Events.Submit, this.tag); this.errorMessage = null; this.update(); return this.cart.checkout().then((function(_this) { return function(pRef) { var hasErrored; pRef.p["catch"](function(err) { var hasErrored, ref; if (typeof window !== "undefined" && window !== null) { if ((ref = window.Raven) != null) { ref.captureException(err); } } hasErrored = true; _this.loading = false; console.log("checkout submit Error: " + err); _this.errorMessage = 'Unable to complete your transaction. Please try again later.'; m.trigger(Events.SubmitFailed, _this.tag); return _this.update(); });