module-pricing.bundle.js 8.2 KB

1
  1. (self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[]).push([[665],{489:e=>{e.exports=e=>{if(!e)throw new Error("Password is empty.");const t="(?=.*[!@#$%^&*])";let s={id:null,value:null,length:null,contains:[]},r=[];new RegExp("^(?=.*[a-z])").test(e)&&(r=[...r,{message:"lowercase"}]),new RegExp("^(?=.*[A-Z])").test(e)&&(r=[...r,{message:"uppercase"}]),new RegExp(`^${t}`).test(e)&&(r=[...r,{message:"symbol"}]),new RegExp("^(?=.*[0-9])").test(e)&&(r=[...r,{message:"number"}]);const o=new RegExp(`^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])${t}(?=.{8,})`),i=new RegExp(`^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[A-Z])${t})|((?=.*[a-z])${t})|((?=.*[0-9])${t}))(?=.{6,})`);return s=o.test(e)?{id:2,value:"Strong"}:i.test(e)?{id:1,value:"Medium"}:{id:0,value:"Weak"},s.length=e.length,s.contains=r,s}},2516:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>I});var r=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"pricing"}},[e.products.length?e._l(e.products,(function(e){return s("Product",{key:e.uuid,attrs:{product:e}})})):s("div",{staticClass:"loading"},[s("span",[e._v("Loading ...")])])],2)};r._withStripped=!0;var o=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("article",{staticClass:"product"},[s("header",[s("h1",{domProps:{innerHTML:e._s(e.product.title)}})]),e._v(" "),s("section",{staticClass:"content"},[s("div",{staticClass:"description",domProps:{innerHTML:e._s(e.product.body)}})]),e._v(" "),e.isAdherent?e._e():s("aside",e._l(e.product.variations,(function(t){return s("div",{key:t.id,staticClass:"variation"},[s("div",{staticClass:"variation-description",domProps:{innerHTML:e._s(t.description)}}),e._v(" "),s("button",{attrs:{type:"button",name:"addtocart"},on:{click:function(s){return s.stopPropagation(),e.checkaddtocart(s,t.id)}}},[e._v("\n "+e._s(e.$t("default.Add to cart"))+"\n ")])])})),0),e._v(" "),e.showLoginModal?s("Modal",{attrs:{styles:{width:"500px",height:"350px"}},on:{close:e.closeModal}},[s("section",{attrs:{id:"pricing-modal-login-register"}},[s("h2",[e._v(e._s(e.$t("materio.Please login or create a new account to order your access")))]),e._v(" "),s("LoginRegister",{attrs:{callbackargs:e.showLoginModal},on:{onLogedIn:e.onLogedIn,onRegistered:e.onRegistered}})],1)]):e._e()],1)};o._withStripped=!0;var i=s(2141),n=s(4408),a=s(629),c=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"overlay",on:{click:function(t){return t.target!==t.currentTarget?null:e.close(t)}}},[s("div",{staticClass:"modal",style:e.styles},[e._t("default")],2)])};c._withStripped=!0;const l={name:"",props:{styles:{default:function(){return{width:"500px",height:"350px"}},type:Object}},data:()=>({}),methods:{close(){this.$emit("close")}}};var d=s(1900),u=(0,d.Z)(l,c,[],!1,null,"b98ce164",null);u.options.__file="web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue";const h=u.exports;var m=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{attrs:{id:"login-register"}},[s("section",{staticClass:"login"},[s("h3",[e._v(e._s(e.$t("default.Login"))+" ")]),e._v(" "),s("LoginForm",{on:{onLogedIn:e.onLogedIn}})],1),e._v(" "),s("section",{staticClass:"register"},[s("h3",[e._v(e._s(e.$t("default.Register a new account")))]),e._v(" "),s("RegisterForm",{on:{onRegistered:e.onRegistered}})],1)])};m._withStripped=!0;var g=s(1094),p=s.n(g),_=s(9032);const f={name:"LoginForm",data:()=>({form:null,mail:null,password:null}),computed:{...(0,a.rn)({loginMessage:e=>e.User.loginMessage})},methods:{...(0,a.nv)({userLogin:"User/userLogin"}),getLoginForm(){_.MA.get("/materio_user/login_form").then((({data:e})=>{this.form=p().compile(e.rendered),this.$options.staticRenderFns=[],this._staticTrees=[],this.form.staticRenderFns.map((e=>this.$options.staticRenderFns.push(e)))})).catch((e=>{console.warn("Issue with getLoginForm",e)}))},login(){this.userLogin({mail:this.mail,pass:this.password}).then((()=>{this.$emit("onLogedIn")})).catch((e=>{console.warn("Issue with login from login component",e),Promise.reject(e)}))}},beforeMount(){this.form||this.getLoginForm()},mounted(){Drupal.attachBehaviors(this.$el)},render(e){return this.form?this.form.render.call(this):e("span","Loading ...")}};var v=(0,d.Z)(f,undefined,undefined,!1,null,"7bb795f8",null);v.options.__file="web/themes/custom/materiotheme/vuejs/components/Form/LoginForm.vue";const w=v.exports;var R=s(489),L=s.n(R);const b={name:"RegisterForm",data:()=>({form:null,mail:null,pass1:null,pass2:null,ps:""}),computed:{...(0,a.rn)({registerMessage:e=>e.User.registerMessage}),psswd_class:function(){return this.ps.toLowerCase()},can_register:function(){return"Strong"===this.ps?"can-register":""}},methods:{...(0,a.nv)({userRegister:"User/userRegister"}),getRegisterForm(){_.MA.get("/materio_user/register_form").then((({data:e})=>{this.form=p().compile(e.rendered),this.$options.staticRenderFns=[],this._staticTrees=[],this.form.staticRenderFns.map((e=>this.$options.staticRenderFns.push(e))),this.initFormBehaviours()})).catch((e=>{console.warn("Issue with getRegisterForm",e)}))},initFormBehaviours(){Drupal.attachBehaviors(this.$el),this.checkSubmitEnabled()},checkSubmitEnabled(){"Strong"===this.ps?this.$refs.register.disabled=!1:this.$refs.register.disabled=!0},register(){this.mail,this.pass1,this.pass2,this.pass1===this.pass2&&this.userRegister({name:this.mail,mail:this.mail,pass:this.pass1}).then((()=>{this.$emit("onRegistered")})).catch((e=>{console.warn("Issue with register from registerform component",e),Promise.reject(e)}))}},beforeMount(){this.form||this.getRegisterForm()},mounted(){this.form&&this.initForm()},render(e){return this.form?this.form.render.call(this):e("span","Loading ...")},watch:{pass1:function(e,t){e&&(this.ps=L()(e).value,this.ps,this.checkSubmitEnabled())}}};var $=(0,d.Z)(b,undefined,undefined,!1,null,"2acc57a0",null);$.options.__file="web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue";const F=$.exports,P={name:"LoginRegister",data:()=>({loginEmail:null,password:null,registerEmail:null}),props:["callbackargs"],methods:{...(0,a.nv)({userLogin:"User/userLogin",userRegister:"User/userRegister"}),onLogedIn(){this.$emit("onLogedIn",this.callbackargs)},onRegistered(){this.$emit("onRegistered",this.callbackargs)}},components:{LoginForm:w,RegisterForm:F}};var k=(0,d.Z)(P,m,[],!1,null,"340aa566",null);k.options.__file="web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegister.vue";const M=k.exports;drupalSettings.path.baseUrl,drupalSettings.path.pathPrefix;const C={name:"Product",router:n.Z,props:["product"],data:()=>({quantity:1,showLoginModal:!1}),computed:{...(0,a.rn)({isloggedin:e=>e.User.isloggedin,isAdherent:e=>e.User.isAdherent,csrftoken:e=>e.User.csrftoken})},methods:{closeModal(){this.showLoginModal=!1},checkaddtocart(e,t){this.isloggedin?this.addtocart(t):this.showLoginModal=t},onLogedIn(e){this.addtocart(e)},onRegistered(e){this.addtocart(e)},getCarts(){return i.Z.get("/cart?_format=json",{},{"X-CSRF-Token":this.csrftoken}).catch((e=>{console.warn("Issue with get cart",e),Promise.reject(e)}))},deleteCart:e=>i.Z.delete(`/cart/${e}/items?_format=json`).then((({data:e})=>{})).catch((t=>{console.warn(`Issue with cart ${e} deleting`,t),Promise.reject(t)})),clearCarts(e){let t=[];for(let s=0;s<e.length;s++)t.push(this.deleteCart(e[s].order_id));return Promise.all(t)},addtocart(e){this.getCarts().then((({data:t})=>{this.clearCarts(t).then((()=>{i.Z.post("/cart/add?_format=json",[{purchased_entity_type:"commerce_product_variation",purchased_entity_id:e,quantity:this.quantity}]).then((({data:e})=>{this.closeModal(),window.location.href=`/checkout/${e[0].order_id}/order_information`})).catch((e=>{console.warn("Issue with product add to cart",e),Promise.reject(e)}))}))}))}},components:{Modal:h,LoginRegister:M}};var y=(0,d.Z)(C,o,[],!1,null,"0f9e2147",null);y.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/Product.vue";const x=y.exports,E={name:"Pricing",computed:{...(0,a.rn)({products:e=>e.Pages.products})},created(){this.products.length||this.getProducts()},methods:{...(0,a.nv)({getProducts:"Pages/getProducts"})},components:{Product:x}};var j=(0,d.Z)(E,r,[],!1,null,"bdd44e2e",null);j.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Pricing.vue";const I=j.exports}}]);