text: (window.webpackJsonp=window.webpackJsonp||[]).push([[9],{149:function(e,t,a){"use strict";a.r(t);a(28);var n=a(178),r=a.n(n),o=(a(74),a(166),a(76),a(6)),i=a.n(o),c=a(0),l=a.n(c),u=a(168),s=a.n(u),m=a(152),d=a.n(m),p=a(578),f=a(391),h=a(684),g=a(707),v=a(700),C=function(e){var t=e.items,a=e.removeFromCart,n=e.destroyCart,r=e.loading,o=e.completed;if(r)return l.a.createElement(p.a,{active:!0,inline:"centered"});if(o)return l.a.createElement(f.a,{success:!0},n(),l.a.createElement(f.a.Header,null,"C'est bon !"),l.a.createElement("p",null,"Merci ! Votre commande a été placée et votre paiement a été accepté.."));if(0===t.length)return l.a.createElement(f.a,{warning:!0},l.a.createElement(f.a.Header,null,"Votre panier est vide"),l.a.createElement("p",null,"Allez faire quelques emplettes puis revenez !"));return l.a.createElement(h.a.Group,{divided:!0,items:function(e){return e.map(function(e){var t=e.id,n=e.product_id,r=e.name,o=e.quantity,i=e.meta,c=e.image,u=i.display_price.with_tax.unit.formatted||"",s=c.href||"/static/moltin-light-hex.svg";return{childKey:t,header:l.a.createElement(h.a.Header,null,l.a.createElement(d.a,{to:"/product/"+n+"/"},r)),image:l.a.createElement(l.a.Fragment,null,l.a.createElement(g.a,Object.assign({as:function(){return l.a.createElement(h.a.Image,{src:s,alt:r,size:"small",style:{background:"none"}})}},g.a.onlyMobile)),l.a.createElement(g.a,{as:function(){return l.a.createElement(h.a.Image,{src:s,alt:r,size:"small",style:{background:"#f2f2f2"}})},minWidth:g.a.onlyTablet.minWidth})),meta:o+"x "+u,description:"Some more information goes here....",extra:l.a.createElement(v.a,{basic:!0,icon:"remove",floated:"right",onClick:function(){return a(t)}})}})}(t)})},E=a(579),y=a.n(E),x=a(694),b=a(704),k=function(e){var t=e.handleCheckout,a=e.customer,n=e.display_price.with_tax,r=n.amount,o=n.currency,i=n.formatted;return l.a.createElement("div",null,l.a.createElement(x.a,null),l.a.createElement(b.a,{clearing:!0,size:"large"},l.a.createElement("strong",null,"Sub total:")," ",i,l.a.createElement(y.a,{stripeKey:"pk_live_KHPjjFlsJHuvKObAxb9lt5O1",token:t,image:"https://via.placeholder.com/128",name:"Gatsby Store",amount:r,locale:"auto",billingAddress:!0,currency:o||"EUR",shippingAddress:!0,email:a.email,reconfigureOnUpdate:!1,triggerEvent:"onClick"},l.a.createElement(v.a,{color:"black",floated:"right"},"Commander"))))},I=a(158),w=a(170),_=a(180);a.d(t,"default",function(){return S});var S=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).state={items:[],loading:!0,completed:!1,customer:{email:"",name:""}},t._handleCheckout=function(e,a){var n=localStorage.getItem("mcart"),r=localStorage.getItem("mcustomer"),o=t.state,i={first_name:e.card.name.split(" ")[0],last_name:e.card.name.split(" ")[1]||"",line_1:e.card.address_line1,line_2:e.card.address_line2||"",city:e.card.address_city,postcode:e.card.address_zip,county:e.card.address_state||"",country:e.card.address_country},c={first_name:a.shipping_name.split(" ")[0],last_name:a.shipping_name.split(" ")[1]||"",line_1:a.shipping_address_line1,city:a.shipping_address_city,postcode:a.shipping_address_zip,county:a.shipping_address_zip,country:a.shipping_address_country};Object(_.checkoutCart)(n,r,i,c).then(function(a){var n=a.data.id;Object(_.payForOrder)(n,e,o.email).then(function(){t.setState({completed:!0})}).catch(function(e){console.error(e)})}).catch(function(e){console.log(e)})},t._handleRemoveFromCart=function(e,a){var n=t.state.cartId;Object(_.removeFromCart)(e,n).then(function(e){var r=e.data,o=e.meta,i=r.reduce(function(e,t){return e+t.quantity},0);a.updateCartCount(i,n),t.setState({items:r,meta:o})})},t._handleDestroyCart=function(e){var a=t.state.cartId;Object(_.getCartItems)(a).then(function(n){n.data.forEach(function(n){Object(_.removeFromCart)(n.id,a).then(function(n){var r=n.data,o=n.meta,i=r.reduce(function(e,t){return e+t.quantity},0);e.updateCartCount(i,a),t.setState({items:r,meta:o})})})})},t}i()(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=this,t=localStorage.getItem("mcart");Object(_.getCartItems)(t).then(function(a){var n=a.data,r=a.meta;e.setState({items:n,meta:r,cartId:t,loading:!1})}).catch(function(e){return console.error(e)}),Object(_.getCustomer)(localStorage.getItem("mcustomer")).then(function(t){e.setState({customer:{email:t.data.email,name:t.data.name}})}).catch(function(e){return console.error(e)})},a.render=function(){var e=this,t=this.state,a=t.meta,n=r()(t,["meta"]),o=n.loading;return l.a.createElement(w.a,{location:this.props.location},l.a.createElement(s.a,{title:"Cart"}),l.a.createElement(I.a.Consumer,null,function(t){return l.a.createElement(C,Object.assign({},n,{removeFromCart:function(a){return e._handleRemoveFromCart(a,t)},destroyCart:function(){return e._handleDestroyCart(t)}}))}),!o&&!n.completed&&this.state.items.length>0?l.a.createElement(k,Object.assign({},a,{customer:this.state.customer,handleCheckout:this._handleCheckout})):null)},t}(l.a.Component)},157:function(e,t,a){var n;e.exports=(n=a(167))&&n.default||n},158:function(e,t,a){"use strict";var n=a(0),r=a.n(n).a.createContext(null);t.a=r},159:function(e,t,a){"use strict";var n=a(0),r=a.n(n).a.createContext(null);t.a=r},167:function(e,t,a){"use strict";a.r(t);a(28);var n=a(0),r=a.n(n),o=a(4),i=a.n(o),c=a(48),l=a(2),u=function(e){var t=e.location,a=l.default.getResourcesForPathnameSync(t.pathname);return r.a.createElement(c.a,Object.assign({location:t,pageResources:a},a.json))};u.propTypes={location:i.a.shape({pathname:i.a.string.isRequired}).isRequired},t.default=u},169:function(e,t,a){"use strict";a.r(t),a.d(t,"graphql",function(){return f}),a.d(t,"StaticQueryContext",function(){return d}),a.d(t,"StaticQuery",function(){return p});var n=a(0),r=a.n(n),o=a(4),i=a.n(o),c=a(152),l=a.n(c);a.d(t,"Link",function(){return l.a}),a.d(t,"withPrefix",function(){return c.withPrefix}),a.d(t,"navigate",function(){return c.navigate}),a.d(t,"push",function(){return c.push}),a.d(t,"replace",function(){return c.replace}),a.d(t,"navigateTo",function(){return c.navigateTo});var u=a(157),s=a.n(u);a.d(t,"PageRenderer",function(){return s.a});var m=a(29);a.d(t,"parsePath",function(){return m.a});var d=r.a.createContext({}),p=function(e){return r.a.createElement(d.Consumer,null,function(t){return e.data||t[e.query]&&t[e.query].data?(e.render||e.children)(e.data?e.data.data:t[e.query].data):r.a.createElement("div",null,"Loading (StaticQuery)")})};function f(){throw new Error("It appears like Gatsby is misconfigured. Gatsby related `graphql` calls are supposed to only be evaluated at compile time, and then compiled away,. Unfortunately, something went wrong and the query was left in the compiled code.\n\n.Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.")}p.propTypes={data:i.a.object,query:i.a.string.isRequired,render:i.a.func,children:i.a.func}},170:function(e,t,a){"use strict";var n=a(0),r=a.n(n),o=a(695),i=a(187),c=a.n(i),l=a(168),u=a.n(l),s=a(152),m=a.n(s),d=(a(188),a(6)),p=a.n(d),f=a(159),h=function(e){function t(t){var a;return(a=e.call(this,t)||this).updateToken=function(){return a.setState({token:localStorage.getItem("customerToken")})},a.updateVerified=function(e){return a.setState({userVerified:e})},a.state={token:null,verified:null,updateToken:a.updateToken,updateVerified:a.updateVerified},a}p()(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=localStorage.getItem("customerToken");this.setState({token:e})},a.render=function(){var e=this.state,t=e.token,a=e.updateToken,n=e.verified,o=e.updateVerified;return r.a.createElement(f.a.Provider,{value:{verified:n,token:t,updateToken:a,updateVerified:o}},this.props.children)},t}(n.Component),g=(a(28),a(185),a(30),a(189),a(158)),v=function(e){function t(t){var a;return(a=e.call(this,t)||this).addToCart=function(e,t){var n=Number(a.state.cartCount)+Number(e);return localStorage.setItem("mdata",JSON.stringify({cartId:t,cartCount:n})),a.setState(function(){return{cartCount:n}})},a.updateCartCount=function(e,t){localStorage.setItem("mdata",JSON.stringify({cartId:t,cartCount:e})),a.setState(function(){return{cartCount:e}})},a.state={cartId:null,cartCount:0,addToCart:a.addToCart,updateCartCount:a.updateCartCount},a}p()(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=localStorage.getItem("mcart"),t=localStorage.getItem("mdata");if(e&&!t||!e){var a="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)});localStorage.setItem("mcart",a),localStorage.setItem("mdata",JSON.stringify({cartId:a,cartCount:0})),this.setState({cartId:a})}else{var n=localStorage.getItem("mdata"),r=JSON.parse(n);this.setState({cartCount:r.cartCount||0})}},a.render=function(){return r.a.createElement(g.a.Provider,{value:Object.assign({},this.state)},this.props.children)},t}(n.Component),C=a(707),E=a(701),y=a(302),x=(a(166),function(e){var t=e.cartCount,a=e.name;return r.a.createElement("div",null,r.a.createElement(y.a,{name:"cart"})," "+a+" ",t?t>9?r.a.createElement("span",{style:{fontSize:"smaller"}},"(9",r.a.createElement("sup",null,"+"),")"):"("+t+")":"(0)")}),b=a(685),k=a(172),I=a.n(k),w=function(){return r.a.createElement(b.a,{size:"mini",src:I.a,style:{marginRight:"1.5em"},alt:"I love Lamp"})},_=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).state={activeItem:t.props.location.pathname},t}p()(t,e);var a=t.prototype;return a.componentWillReceiveProps=function(e){var t=e.location.pathname;t!==this.props.location.pathname&&this.setState({activeItem:t})},a.render=function(){var e=this.state.activeItem,t=this.props,a=t.token,n=t.cartCount;return r.a.createElement(E.a,{size:"huge",borderless:!0,pointing:!0},r.a.createElement(o.a,{text:!0},r.a.createElement(E.a.Item,{active:e===Object(s.withPrefix)("/"),as:m.a,to:"/",header:!0},r.a.createElement(w,null),"Zazou !"),a?r.a.createElement(E.a.Menu,{position:"right"},r.a.createElement(E.a.Item,{as:m.a,to:"/myaccount/",active:e===Object(s.withPrefix)("/myaccount/")},r.a.createElement(y.a,{name:"user"}),"Mon compte"),r.a.createElement(E.a.Item,{as:m.a,to:"/cart/",active:e===Object(s.withPrefix)("/cart/")},r.a.createElement(x,{cartCount:n,name:"Cart"}))):r.a.createElement(E.a.Menu,{position:"right"},r.a.createElement(E.a.Item,{as:m.a,to:"/register/",active:e===Object(s.withPrefix)("/register/")},"S'inscrire"),r.a.createElement(E.a.Item,{as:m.a,to:"/login/",active:e===Object(s.withPrefix)("/login/")},"Se connecter"),r.a.createElement(E.a.Item,{as:m.a,to:"/cart/",active:e===Object(s.withPrefix)("/cart/")},r.a.createElement(x,{cartCount:n,name:"Panier"})))))},t}(n.Component),S=a(700),O=a(704),j=a(694),P=a(702),z=a(184),T=Object(z.a)(m.a).withConfig({displayName:"MobileMenu__StyledLink",componentId:"sc-45ix4h-0"})(["font-weight:bold;text-align:center;font-size:2em;&:hover{text-decoration:underline;}"]),M=Object(z.a)(S.a).withConfig({displayName:"MobileMenu__BurgerButton",componentId:"sc-45ix4h-1"})(["&&&{font-size:1rem;padding:0.785em 1.5em;box-shadow:0 0 0 1px transparent inset,0 0 0 0 rgba(34,36,38,0.15) inset;}"]),q=Object(z.a)(M).withConfig({displayName:"MobileMenu__CloseButton",componentId:"sc-45ix4h-2"})(["&&&{position:absolute;top:-4em;right:0em;padding:0.5em;font-size:1.5em;width:2em;height:2em;}"]),F=Object(z.a)(O.a).withConfig({displayName:"MobileMenu__StyledSegment",componentId:"sc-45ix4h-3"})(["&&&{position:fixed;top:0%;left:0vw;z-index:1000;width:100vw;height:110vh;}"]),N=z.a.div.withConfig({displayName:"MobileMenu__StyledContainer",componentId:"sc-45ix4h-4"})(["&&&{margin-top:6em;text-align:center;position:relative;}"]),R=Object(z.a)(j.a).withConfig({displayName:"MobileMenu__StyledDivider",componentId:"sc-45ix4h-5"})(["&&&{margin:2em;}"]),A=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),r=0;r<a;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).state={open:!1,activeItem:t.props.location.pathname},t.handleClick=function(){return t.setState({open:!t.state.open})},t.handleClose=function(){return t.setState({open:!1})},t}p()(t,e);var a=t.prototype;return a.componentWillReceiveProps=function(e){var t=e.location.pathname;t!==this.props.location.pathname&&this.setState({activeItem:t})},a.render=function(){var e=this.state,t=e.open,a=e.activeItem,n=this.props,i=n.token,c=n.cartCount;return r.a.createElement(E.a,{size:"huge",borderless:!0,pointing:!0},r.a.createElement(o.a,{text:!0},r.a.createElement(E.a.Item,{as:m.a,to:"/",header:!0,active:a===Object(s.withPrefix)("/")},r.a.createElement(w,null),"Zazou"),r.a.createElement(E.a.Menu,{position:"right"},r.a.createElement(E.a.Item,{as:m.a,to:"/cart/",active:a===Object(s.withPrefix)("/cart/")},r.a.createElement(x,{cartCount:c,name:""})),r.a.createElement(E.a.Item,{position:"right"},r.a.createElement(M,{basic:!0,onClick:this.handleClick,"aria-label":"Open Navigation Menu",autoFocus:!0},r.a.createElement(y.a,{fitted:!0,name:"bars"})))),r.a.createElement(P.a,{closeOnEscape:!0,onClose:this.handleClose,open:t},r.a.createElement(F,{className:!0,role:"dialog","aria-label":"Navigation Menu"},r.a.createElement(N,null,r.a.createElement(q,{"aria-label":"Close Navigation",basic:!0,circular:!0,onClick:this.handleClose,autoFocus:!0},"X"),r.a.createElement(T,{to:"/",onClick:this.handleClose},"Boutique"),r.a.createElement(R,null),r.a.createElement(T,{to:"/cart/",onClick:this.handleClose},"Panier "+(c?"("+c+")":"")),r.a.createElement(R,null),i?r.a.createElement(T,{to:"/myaccount/",onClick:this.handleClose},"Mon compte"):[r.a.createElement(T,{to:"/register/",onClick:this.handleClose,key:1},"S'inscrire"),r.a.createElement(R,{key:2}),r.a.createElement(T,{to:"/login/",onClick:this.handleClose,key:3},"Se connecter")])))))},t}(n.Component),W=function(e){function t(){return e.apply(this,arguments)||this}return p()(t,e),t.prototype.render=function(){var e=this;return r.a.createElement(f.a.Consumer,null,function(t){return r.a.createElement(g.a.Consumer,null,function(a){return r.a.createElement(r.a.Fragment,null,r.a.createElement(C.a,{maxWidth:C.a.onlyMobile.maxWidth},r.a.createElement(A,{location:e.props.location,token:t.token,cartCount:a.cartCount})),r.a.createElement(C.a,{minWidth:C.a.onlyTablet.minWidth},r.a.createElement(_,{location:e.props.location,token:t.token,cartCount:a.cartCount})))})})},t}(r.a.PureComponent),B=a(705),U=a(703),V=a(698),D=function(){return r.a.createElement(O.a,{vertical:!0,style:{padding:"4em 0em",marginTop:"3em",borderTop:"1px solid #f2f2f2"}},r.a.createElement(o.a,{text:!0},r.a.createElement(B.a,{stackable:!0},r.a.createElement(B.a.Row,null,r.a.createElement(B.a.Column,{width:4},r.a.createElement(U.a,{as:"h4",content:"À propos"}),r.a.createElement(V.a,null,r.a.createElement(V.a.Item,{as:m.a,to:"/privacy/"},"Données personnelles"),r.a.createElement(V.a.Item,{as:m.a,to:"/terms/"},"Conditions"))),r.a.createElement(B.a.Column,{width:5},r.a.createElement(U.a,{as:"h4",content:"Navigation"}),r.a.createElement(V.a,null,r.a.createElement(V.a.Item,{as:m.a,to:"/"},"Boutique"))),r.a.createElement(B.a.Column,{width:7},r.a.createElement(U.a,{as:"h4"},"Réseaux"),r.a.createElement("p",null,"Vous aimez mes bijoux ? Faites le moi savoir, et criez le autour de vous !"),r.a.createElement(V.a,{horizontal:!0},r.a.createElement(V.a.Item,{as:m.a,to:"/"},r.a.createElement(y.a,{name:"instagram"})),r.a.createElement(V.a.Item,{as:m.a,to:"/"},r.a.createElement(y.a,{name:"facebook"})),r.a.createElement(V.a.Item,{as:m.a,to:"/"},r.a.createElement(y.a,{name:"mail"}))))))))};t.a=function(e){var t=e.children,a=e.location;return r.a.createElement(h,null,r.a.createElement(v,null,r.a.createElement(u.a,{meta:[{name:"Zazou Paris",content:"Boutique en ligne Zazou-Paris de bijoux personnalisés faits à la main"},{name:"keywords",content:"bijoux, zazou, mode"},{name:"msapplication-TileColor",content:"#da532c"},{name:"theme-color",content:"#ffffff"}]},r.a.createElement("html",{lang:"en"}),r.a.createElement("link",{rel:"apple-touch-icon",sizes:"180x180",href:Object(s.withPrefix)("/favicons/apple-touch-icon.png")}),r.a.createElement("link",{rel:"icon",type:"image/png",sizes:"32x32",href:Object(s.withPrefix)("/favicons/favicon-32x32.png")}),r.a.createElement("link",{rel:"icon",type:"image/png",sizes:"16x16",href:Object(s.withPrefix)("/favicons/favicon-16x16.png")})),r.a.createElement(c.a,{upTolerance:10,downTolerance:10,style:{zIndex:"20",height:"6.5em"}},r.a.createElement(W,{location:a})),r.a.createElement(o.a,{text:!0},t),r.a.createElement(D,null)))}},172:function(e,t,a){e.exports=a.p+"static/logo-carre-2-8bccac38e7f1cfcb4a58878f146346b3.png"},180:function(e,t,a){"use strict";a.r(t),a.d(t,"getProducts",function(){return i}),a.d(t,"getProductById",function(){return c}),a.d(t,"addToCart",function(){return l}),a.d(t,"getCartItems",function(){return u}),a.d(t,"removeFromCart",function(){return s}),a.d(t,"deleteCart",function(){return m}),a.d(t,"checkoutCart",function(){return d}),a.d(t,"payForOrder",function(){return p}),a.d(t,"register",function(){return h}),a.d(t,"login",function(){return f}),a.d(t,"getOrders",function(){return g}),a.d(t,"getCustomer",function(){return v}),a.d(t,"findCustomerByEmail",function(){return C}),a.d(t,"updateCustomer",function(){return E}),a.d(t,"findCustomerByResetToken",function(){return y});a(166),a(28);var n=a(178),r=a.n(n),o=(a(193),(0,a(199).gateway)({client_id:"xdIRZLJFUU3T8LYrlFfhcm0QOlgn3UhPhy2swxrD79",client_secret:"YPkgK26eGb5qQE59yuHuBxUUt11H4V3Ob1Lyh9oXhZ",grant_type:"client_credentials"})),i=function(){return o.Products.With("main_image").All()},c=function(e){return o.Products.With("main_image").Get(e)},l=function(e,t,a){return o.Cart(e).AddProduct(t,a)},u=function(e){return o.Cart(e).Items()},s=function(e,t){return o.Cart(t).RemoveItem(e)},m=function(e){return o.Cart(e).Delete()},d=function(e,t,a,n){return o.Cart(e).Checkout(t,a,n)},p=function(e,t,a){return o.Orders.Payment(e,{gateway:"stripe",method:"purchase",payment:t.id,options:{receipt_email:a}})},f=function(e){var t=e.email,a=e.password;return o.Customers.Token(t,a).then(function(e){var t=e.data;return{id:t.customer_id,token:t.token}})},h=function(e){var t=e.email,a=e.password,n=r()(e,["email","password"]);return o.Customers.Create(Object.assign({email:t,password:a,type:"customer"},n)).then(function(e){var n=e.data,r=n.name,o=n.id;return f({email:t,password:a}).then(function(e){var a=e.token;return{id:o,name:r,email:t,token:a}})})},g=function(e){return o.Orders.With("items").All(e)},v=function(e){return o.Customers.Get(e)},C=function(e){return o.Customers.Filter({eq:{email:e}}).All()},E=function(e,t){return o.Customers.Update(e,t)},y=function(e){return o.Customers.Filter({eq:{resetPasswordToken:e}}).All().then(function(t){for(var a=0;a<t.data.length;a++)if(t.data[a].resetPasswordToken==e)return t.data[a]})}},200:function(e,t){},201:function(e,t){}}]);
  //# sourceMappingURL=component---src-pages-cart-js-25205f8eff1da31d0632.js.map