UNPKG

@apicart/vue-components

Version:

Apicart Vue.Js components for simple e-commerce platform development

8 lines (6 loc) 5.51 kB
/** * @apicart/vue-components v1.0.0-alpha7 * (c) 2018-2020 Apicart Company * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@apicart/core-sdk"),require("./..")):"function"==typeof define&&define.amd?define(["@apicart/core-sdk","./.."],e):(t=t||self).ApicartCheckoutDialog=e(t.Apicart,t.components)}(this,(function(t,e){"use strict";function i(t,e,i,a){return new(i||(i=Promise))((function(c,o){function n(t){try{p(a.next(t))}catch(t){o(t)}}function r(t){try{p(a.throw(t))}catch(t){o(t)}}function p(t){var e;t.done?c(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(n,r)}p((a=a.apply(t,e||[])).next())}))}function a(t,e){var i,a,c,o,n={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return o={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function r(o){return function(r){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,a&&(c=2&o[0]?a.return:o[0]?a.throw||((c=a.return)&&c.call(a),0):a.next)&&!(c=c.call(a,o[1])).done)return c;switch(a=0,c&&(o=[2&o[0],c.value]),o[0]){case 0:case 1:c=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(c=n.trys,(c=c.length>0&&c[c.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!c||o[1]>c[0]&&o[1]<c[3])){n.label=o[1];break}if(6===o[0]&&n.label<c[1]){n.label=c[1],c=o;break}if(c&&n.label<c[2]){n.label=c[2],n.ops.push(o);break}c[2]&&n.ops.pop(),n.trys.pop();continue}o=e.call(t,n)}catch(t){o=[6,t],a=0}finally{i=c=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,r])}}}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var c={closeWhenCartIsEmpty:!0},o=null,n="undefined"!=typeof window,r={name:"apicart-checkout-dialog",components:{"apicart-checkout":n&&window.ApicartCheckout?window.ApicartCheckout:e.ApicartCheckout,"apicart-dialog":n&&window.ApicartDialog?window.ApicartDialog:e.ApicartDialog},methods:{open:function(){o&&o.apicartDialog.open()},close:function(){o&&o.apicartDialog.close()}},created:function(){c=t.Utils.Objects.merge(c,t.getConfigParameter("vueComponents.checkoutDialog"))},mounted:function(){var e=this;void 0!==this.$refs.apicartDialog&&(o=this.$refs,t.Utils.EventDispatcher.addListener("apicart-order-dialog-cart-finished"+this._uid,"apicart:cart:finished",(function(t){return i(e,void 0,void 0,(function(){return a(this,(function(t){return this.close(),[2]}))}))})),t.Utils.EventDispatcher.addListener("apicart-checkout-dialog-cart-events"+this._uid,"apicart:cart:updated",(function(t){return i(e,void 0,void 0,(function(){var e;return a(this,(function(i){switch(i.label){case 0:return(e=c.closeWhenCartIsEmpty)?[4,t.getItems()]:[3,2];case 1:e=0===i.sent().length,i.label=2;case 2:return e&&this.close(),[2]}}))}))})))}};!function(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css","top"===i&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=t:c.appendChild(document.createTextNode(t))}}(".apicart-checkout-dialog .apicart-dialog__container{height:94vh;padding:0}.apicart-checkout-dialog .apicart-checkout{height:100%;display:flex;flex-direction:column}.apicart-checkout-dialog .apicart-checkout .apicart-checkout__stepper{padding:0 8px}@media (min-width:768px){.apicart-checkout-dialog .apicart-checkout .apicart-checkout__stepper{padding:0 16px}}.apicart-checkout-dialog .apicart-checkout .apicart-checkout__step-tabs{margin-bottom:0;min-height:auto;padding:12px 16px}@media (min-width:768px){.apicart-checkout-dialog .apicart-checkout .apicart-checkout__step-tabs{padding:20px 30px}}.apicart-checkout-dialog .apicart-checkout .apicart-checkout__step-tab{left:16px;top:12px;width:calc(100% - 32px)}@media (min-width:768px){.apicart-checkout-dialog .apicart-checkout .apicart-checkout__step-tab{left:30px;top:20px;width:calc(100% - 60px)}}.apicart-checkout-dialog .apicart-checkout .apicart-checkout__footer{padding:12px 16px}@media (min-width:768px){.apicart-checkout-dialog .apicart-checkout .apicart-checkout__footer{padding:20px 30px}}");return function(t,e,i,a,c,o,n,r,p,s){"boolean"!=typeof n&&(p=r,r=n,n=!1);const u="function"==typeof i?i.options:i;let d;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,c&&(u.functional=!0)),a&&(u._scopeId=a),o?(d=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,p(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},u._ssrRegister=d):e&&(d=n?function(t){e.call(this,s(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),d)if(u.functional){const t=u.render;u.render=function(e,i){return d.call(i),t(e,i)}}else{const t=u.beforeCreate;u.beforeCreate=t?[].concat(t,d):[d]}return i}({render:function(){var t=this.$createElement,e=this._self._c||t;return e("apicart-dialog",{ref:"apicartDialog",staticClass:"apicart-checkout-dialog",attrs:{closeOnBgClick:!1,showTopCloseButton:!0}},[e("apicart-checkout",{on:{"continue-shopping":this.close}})],1)},staticRenderFns:[]},void 0,r,void 0,!1,void 0,!1,void 0,void 0,void 0)}));