@salla.sa/twilight-components
Version:
Salla Web Component
4 lines • 5.33 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import{r as e,h as a,a as s}from"./p-BHYtfMwX.js";const l=class{constructor(a){e(this,a),this.hasError=!1,salla.event.on("size-guide::open",(e=>this.open(e))),salla.lang.onLoaded((()=>{this.placeholder_title=salla.lang.get("pages.products.size_guide_placeholder"),this.placeholder_description=salla.lang.get("pages.products.size_guide_placeholder_info"),this.modal_title=salla.lang.get("pages.products.size_guides")}))}async open(e){return this.modal.setTitle(this.modal_title),this.modal.open(),await salla.api.withoutNotifier((()=>salla.product.getSizeGuides(e))).then((e=>{this.guides=e.data})).catch((e=>{console.log(e),this.hasError=!0,this.placeholder_description=e.response?.data?.error?.message||e.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}showPlaceholder(){return a("salla-placeholder",{alignment:"center",iconSize:"xl"},a("div",{slot:"title"},this.placeholder_title),a("div",{slot:"description"},this.placeholder_description))}render(){return a("salla-modal",{key:"ad8cbc23e60bc0d463f5b94febeab699dd96e2b4",class:"s-product-size-guide-wrapper",id:"salla-product-size-guide-modal",isLoading:!0,"has-skeleton":!0,width:"md",ref:e=>this.modal=e},a("span",{key:"b3dc61221d36a2680f74280e5fdb7601e5e70e62",slot:"icon",class:"s-product-size-guide-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>pencil-ruler</title>\n<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>\n</svg>\n'}),a("div",{key:"9735c6681e3e7c15c5d346f6cfca4c7d34542061",slot:"loading"},a("div",{key:"65224399d086d931c5c978dd00cf2d4d1ec3c082",class:"s-product-size-guide-skeleton"},a("salla-skeleton",{key:"05c0eda8bc21f5a2e2a89424bed145e61cd5a29e",height:"15px",width:"25%"}),a("div",{key:"af0e4801d3e27f664b38577c61ae3fc15e4c5c95",class:"s-product-size-guide-skeleton-header"},a("salla-skeleton",{key:"614ad02c61d7c44ec768a060cf7a25f04b618056",height:"40px"}),a("salla-skeleton",{key:"a4da4e2fa6ded411938fd90c4e11d368baadf03e",height:"40px"}),a("salla-skeleton",{key:"fb2fc13e520d704ad02d9c90f3678d7ec18e89f9",height:"40px"}),a("salla-skeleton",{key:"8b4723988f62458876f4b915f11df73bbf7717a8",height:"40px"})),a("div",{key:"9ae65ff980ee9458d1c2996465dcd7815bae0c1f",class:"s-product-size-guide-skeleton-content"},a("salla-skeleton",{key:"9d970f8d2d116845a902f7bcab944b48c781024f",height:"15px",width:"25%"}),a("salla-skeleton",{key:"a8150338ad24a94552796f948b4dddfd280179aa",height:"10px",width:"75%"}),a("salla-skeleton",{key:"34446a9a1948c7c006f6e13b26cacd7e20d16238",height:"10px",width:"50%"}),a("salla-skeleton",{key:"8838c419ac7f384861188d7ab96e8f42473c04c0",height:"10px",width:"75%"}),a("salla-skeleton",{key:"21f8e182ba77e35b0f02f1cbcd21ee8effd94ac0",height:"10px",width:"100%"}),a("salla-skeleton",{key:"5391e8a3a133dd2ccf7087590113391da080ca8a",height:"10px",width:"25%"}),a("salla-skeleton",{key:"743ba490362dd541229cb5c60feb0b6dc5750714",height:"10px",width:"60%"}),a("salla-skeleton",{key:"58e6839c74e13e11f4ef84fa4ec85e1f2f9868f4",height:"10px",width:"45%"}),a("salla-skeleton",{key:"a6f771e12046112b282dede2d759ed3d019bedcc",height:"10px",width:"30%"})))),a("slot",{key:"3ed1875a19be5a65afbf912fb0819dd92ded3062",name:"header"}),!this.hasError&&this.guides?[a("salla-tabs",null,this.guides.map((e=>a("salla-tab-header",{slot:"header",name:e.name},a("span",null,e.name)))),this.guides.map((e=>a("salla-tab-content",{slot:"content",name:e.name},a("div",{innerHTML:e.description})))))]:this.showPlaceholder(),a("slot",{key:"ca9526f3f95675dab2a38d2715ed3cf842d93174",name:"footer"}))}get host(){return s(this)}};l.style="";export{l as salla_product_size_guide}