{"version":3,"sources":["webpack:///./src/ac/js/components/Component.js","webpack:///./src/ac/js/components/Form.js","webpack:///./src/ac/js/components/ZipLocation.js","webpack:///./node_modules/form-serializer/jquery.serialize-object.js"],"names":["domTree","WeakMap","configuration","Component","el","config","arguments","length","undefined","_classCallCheck","this","Error","$el","jQuery","$","set","hasOwnProperty","dom","setupDefaults","addListeners","get","elements","_component","__webpack_require__","Form","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","call","$formLevelErrorContainer","prev","errorMessage","insertBefore","append","html","_Form2","ZipLocation","_get","prototype","endpoint","attr","_extends","$toggleBtn","find","$submitBtn","$changeLocation","$inputField","$changeLocationField","on","onZipSubmit","bind","onZipToggle","displayChangeLocationForm","e","preventDefault","addClass","parent","toggleClass","hasClass","focus","stopPropagation","checkValidity","submitZip","catch","err","console","log","postZip","res","success","redirectURL","response","redirectUrl","window","location","replace","clearFormLevelError","displayFormLevelError","message","data","serializeJSON","ajax","method","url","contentType","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","factory","exports","patterns","validate","key","push","fixed","named","FormSerializer","helper","$form","pushes","build","base","value","serialize","addPair","pair","test","name","obj","root","k","keys","match","pop","makeObject","encode","extend","addPairs","pairs","isArray","i","len","JSON","stringify","serializeObject","serializeArray","fn","apply","module"],"mappings":"uhBAAA,IAAMA,EAAU,IAAIC,QACdC,EAAgB,IAAID,QA4BpBE,aAOJ,SAAAA,EAAYC,GAAgB,IAAZC,EAAYC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,MAC1B,+FAD0BG,CAAAC,KAAAP,QACR,IAAPC,EACT,MAAM,IAAIO,MAAM,wEASlBD,KAAKE,IAAMR,aAAcS,EAAST,EAAKU,EAAEV,GAEjB,IAApBM,KAAKE,IAAIL,SAEbP,EAAQe,IAAIL,SACZR,EAAca,IAAIL,KAAML,GAEpBK,KAAKL,OAAOW,eAAe,SAC7BN,KAAKO,IAAMP,KAAKL,OAAOY,K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,EAAAlF,EAAAJ,MACA2G,SAAA3G,KAAAmH,kBACA5C,sBAGA,IAAAnE,EAAAgH,KACAhH,EAAAgH,GAAAF,gBAAA5B,EAAA4B,gBACA9G,EAAAgH,GAAA7C,cAAAe,EAAAf,eAGAQ,EAAAO,iBAEAA,GArIAV,GAAAG,EAAAlE,EAAA,UAEKf,KAFL+E,EAAA,SAAAE,EAAA3E,GACA,OAAA0E,EAAAC,EAAA3E,IACKiH,MAAAtC,EAAAH,MAAA0C,EAAAvC,QAAAF","file":"19.0a6381c2cc5bdb007a32.js","sourcesContent":["const domTree = new WeakMap();\nconst configuration = new WeakMap();\n\n/**\n * Component is a class that should be extended for every component that's being made. It\n * is a helper class to keep the code uniform.\n *\n * __PLEASE NOTE__: This is only to be extended, not instantiated.\n *\n * @example\n * import Component from 'component';\n *\n * class Foo extends Component {\n * construction(el){\n * super(el);\n * }\n *\n * setupDefaults(){\n * // ...defaults go here\n * }\n *\n * addListeners(){\n * // ...listeners go here\n * }\n * }\n *\n * // Create a new Foo component\n * new Foo('.foo');\n */\nclass Component {\n /**\n * Component constructor - see {@link config} on how to pass in additional configuration to the constructor\n *\n * @param {string|Object} el - Main DOM element, you can pass a string such as `'.foo'` __or__ a jQuery object such as `$('.foo')`\n * @param {Object} [config={ }] - Additional component configuration; reachable with `this.config`\n */\n constructor(el, config = {}){\n if (typeof el === 'undefined') {\n throw new Error('You must provide an element as a String type or a jQuery object type');\n }\n\n /**\n * Main class element, this will be a jQuery instance\n * This can be reachable at any time in your superclass with `this.$el`\n *\n * @type {Object}\n */\n this.$el = el instanceof jQuery ? el : $(el);\n\n if (this.$el.length === 0) return;\n\n domTree.set(this, {});\n configuration.set(this, config);\n\n if (this.config.hasOwnProperty('dom')) {\n this.dom = this.config.dom;\n }\n\n this.setupDefaults();\n this.addListeners();\n }\n\n /**\n * This method is used for override;\n * It's called directly after the element and configuration have been set up\n * @abstract\n */\n setupDefaults(){}\n\n /**\n * This method is used for override;\n * It's called directly after `setupDefaults()`, so everything is ready and setup at this point.\n * @abstract\n */\n addListeners(){}\n\n /**\n * Get component configuration\n *\n * @example\n * class Foo extends Component {\n * construction(el, config){\n * super(el, config);\n * }\n *\n * setupDefaults(){\n * console.log(this.config.name); // Outputs \"Foo\"\n * }\n * }\n *\n * // Create a new Foo component with some configuration\n * new Foo('.foo', {\n * name: 'Foo'\n * });\n *\n * @type {Object}\n */\n get config(){\n return configuration.get(this);\n }\n\n /**\n * Set DOM object\n *\n * @example\n * class Foo extends Component {\n * construction(el){\n * super(el);\n * }\n *\n * setupDefaults(){\n * this.dom = {\n * $container: this.$el.find('.container')\n * }\n * }\n *\n * addListeners(){\n * //DOM object is available\n * console.log(this.dom.$container);\n * }\n * }\n *\n * // Create a new Foo component\n * new Foo('.foo');\n *\n * @type {Object}\n */\n set dom(elements){\n elements = {\n ...this.dom,\n ...elements\n };\n\n domTree.set(this, elements);\n }\n\n /**\n * Get DOM object\n *\n * @example\n * this.dom\n *\n * @type {Object}\n */\n get dom(){\n return domTree.get(this);\n }\n}\n\nexport default Component;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ac/js/components/Component.js","import Component from 'component';\n\nclass Form extends Component {\n constructor(el, config) {\n super(el, config);\n }\n\n setupDefaults() {\n this.dom = {\n $formLevelErrorContainer: this.$el.prev('.form__global-error')\n };\n }\n\n displayFormLevelError(errorMessage) {\n if (typeof this.dom.$formLevelErrorContainer === 'undefined' || this.dom.$formLevelErrorContainer.length === 0) {\n $('
').insertBefore(this.$el);\n this.dom.$formLevelErrorContainer = this.$el.prev('.form__global-error').append(`${errorMessage}
`);\n } else {\n this.dom.$formLevelErrorContainer.append(`${errorMessage}
`);\n }\n }\n\n clearFormLevelError() {\n if (this.dom.$formLevelErrorContainer.length > 0) {\n this.dom.$formLevelErrorContainer.html('');\n }\n }\n}\n\nexport default Form;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ac/js/components/Form.js","import Form from '../components/Form';\nimport 'form-serializer';\n\nclass ZipLocation extends Form {\n setupDefaults() {\n super.setupDefaults();\n\n this.endpoint = this.$el.attr('action');\n\n this.dom = {\n ...this.dom,\n $toggleBtn: this.$el.find('.zip-locator__toggle'),\n $submitBtn: this.$el.find('.js-zip-location-submit'),\n $changeLocation: this.$el.find('.zip-locator__change-location'),\n $inputField: this.$el.find('.zip-locator__form-field'),\n $changeLocationField: this.$el.find('.zip-locator__change-location .zip-locator__form-field')\n };\n }\n\n addListeners() {\n this.$el.on('submit', ::this.onZipSubmit);\n this.dom.$toggleBtn.on('click', ::this.onZipToggle);\n this.dom.$submitBtn.on('click', ::this.onZipSubmit);\n this.dom.$changeLocationField.on('focus', ::this.displayChangeLocationForm);\n }\n\n displayChangeLocationForm(e) {\n e.preventDefault();\n this.dom.$changeLocation.addClass('zip-locator__change-location--opened');\n }\n\n onZipToggle(e) {\n this.$el.parent().toggleClass('zip-locator--open');\n\n if (this.$el.parent().hasClass('zip-locator--open')) {\n this.dom.$inputField.attr('tabindex', 0);\n this.dom.$submitBtn.attr('tabindex', 0);\n this.dom.$inputField.focus();\n } else {\n this.dom.$inputField.attr('tabindex', -1);\n this.dom.$submitBtn.attr('tabindex', -1);\n }\n }\n\n onZipSubmit(e) {\n e.stopPropagation();\n e.preventDefault();\n if (this.$el[0].checkValidity()) {\n this.submitZip().catch(err => {\n console.log('Server error: ', err);\n });\n }\n }\n\n async submitZip() {\n this.dom.$submitBtn.addClass('is-loading');\n this.dom.$inputField.addClass('is-loading');\n const res = await this.postZip()\n\n if (res.success) {\n const redirectURL = res.response.redirectUrl;\n window.location.replace(redirectURL);\n } else {\n //Error handling here\n this.clearFormLevelError();\n this.displayFormLevelError(res.message);\n }\n }\n\n postZip() {\n const data = this.$el.serializeJSON();\n return $.ajax({\n method: 'POST',\n url: this.endpoint,\n contentType: 'application/json',\n data\n })\n }\n}\n\nexport default ZipLocation;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ac/js/components/ZipLocation.js","/**\n * jQuery serializeObject\n * @copyright 2014, macek