@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 2.35 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[18],{907:function(t,e,i){"use strict";i.r(e),i.d(e,"AuWidgetCart",(function(){return n})),i.d(e,"widget",(function(){return n}));var r=i(0),s=i(160),a=i(2),n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._isCartWidgetInited=!1,e}return Object(r.d)(e,t),e.prototype.updateParams=function(t){var e,i,s=this.driver.cart.price;if(this._isCartWidgetInited)for(var a=0;a<t.lineItems.length;a++){var n=t.lineItems[a];this.driver.cart.lineItems[a]._product=this.driver.products[n.productIndex],this.driver.cart.lineItems[a].quantity=!1===n.active?0:null===n.quantity||void 0===n.quantity?this.driver.cart.lineItems[a].quantity||1:n.quantity,this.driver.cart.lineItems[a].images=n.images||[],this.driver.cart.lineItems[a].downloadUrls=n.downloadUrls||[],this.driver.cart.lineItems[a].data=n.data||{},this.driver.cart.lineItems[a].logRequest=!0===n.logRequest||this.driver.settings.logRequest||!1,this.driver.cart.lineItems[a].useBackOffice=this.driver.cart.lineItems[a].useBackOffice||!0===n.useBackOffice||this.driver.settings.useBackOffice||!1,this.driver.cart.lineItems[a].props=n.props||{},this.driver.cart.lineItems[a].sku=n.sku||"",this.driver.cart.lineItems[a].customPrice=n.customPrice||0}else{var c=[];try{for(var d=Object(r.k)(t.lineItems),l=d.next();!l.done;l=d.next()){var u=l.value,o=(t.lineItems.indexOf(u),Object.assign({},u));o.settings=this.driver.settings,o.product=this.driver.products[o.productIndex],delete o.productIndex,!1===u.active&&(o.quantity=0);var h=o;this.driver.cart.lineItems[0]&&this.driver.cart.lineItems[0].data&&this.driver.cart.lineItems[0].data.snapshot&&0===c.length&&(h.snapshot=this.driver.cart.lineItems[0].data.snapshot,null!=this.driver.cart.lineItems[0].cartItemKey&&""!=this.driver.cart.lineItems[0].cartItemKey&&(h.key=this.driver.cart.lineItems[0].cartItemKey));var v=this.driver.buildOrder(h);c.push(v)}}catch(m){e={error:m}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}this.driver.cart.lineItems=c,this._isCartWidgetInited=!0}this.emitChange({},!1),this.driver.cart.price!==s&&this.driver.cart.updatePrice(s)},Object(r.c)([Object(a.c)(),Object(r.g)("design:type",Object)],e.prototype,"params",void 0),Object(r.c)([Object(a.a)("au-widget-cart")],e)}(s.a)}}]);