hemfixarna-web-components 0.9.2 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hemfixarna-address_16.cjs.entry.js +2 -2
- package/dist/esm/hemfixarna-address_16.entry.js +2 -2
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/p-2a4717d6.entry.js +2 -0
- package/package.json +3 -2
- package/dist/hemfixarna-components/p-c05e2af1.entry.js +0 -2
- /package/dist/hemfixarna-components/{p-c05e2af1.entry.js.map → p-2a4717d6.entry.js.map} +0 -0
|
@@ -489,7 +489,7 @@ const HemfixarnaCategory = class {
|
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
|
|
492
|
-
const base = `${"
|
|
492
|
+
const base = `${"https://hemfixarna.se"}/wp-json/headless` ;
|
|
493
493
|
const getTaxonomy = async (endpoint) => {
|
|
494
494
|
if (!endpoint) {
|
|
495
495
|
return;
|
|
@@ -1426,7 +1426,7 @@ exports.MD5 = {
|
|
|
1426
1426
|
|
|
1427
1427
|
const apiSearch = async (query) => {
|
|
1428
1428
|
var _a;
|
|
1429
|
-
const res = await fetch((_a = "https://hemfixare-lookup
|
|
1429
|
+
const res = await fetch((_a = "https://hemfixare-lookup.vercel.app/api") !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
|
|
1430
1430
|
method: 'POST',
|
|
1431
1431
|
headers: {
|
|
1432
1432
|
'Content-Type': 'application/json',
|
|
@@ -485,7 +485,7 @@ const HemfixarnaCategory = class {
|
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
487
|
|
|
488
|
-
const base = `${"
|
|
488
|
+
const base = `${"https://hemfixarna.se"}/wp-json/headless` ;
|
|
489
489
|
const getTaxonomy = async (endpoint) => {
|
|
490
490
|
if (!endpoint) {
|
|
491
491
|
return;
|
|
@@ -1422,7 +1422,7 @@ exports.MD5 = {
|
|
|
1422
1422
|
|
|
1423
1423
|
const apiSearch = async (query) => {
|
|
1424
1424
|
var _a;
|
|
1425
|
-
const res = await fetch((_a = "https://hemfixare-lookup
|
|
1425
|
+
const res = await fetch((_a = "https://hemfixare-lookup.vercel.app/api") !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
|
|
1426
1426
|
method: 'POST',
|
|
1427
1427
|
headers: {
|
|
1428
1428
|
'Content-Type': 'application/json',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as r}from"./p-8829e98e.js";export{s as setNonce}from"./p-8829e98e.js";const a=()=>{const r=import.meta.url;const a={};if(r!==""){a.resourcesUrl=new URL(".",r).href}return e(a)};a().then((e=>r([["p-
|
|
1
|
+
import{p as e,b as r}from"./p-8829e98e.js";export{s as setNonce}from"./p-8829e98e.js";const a=()=>{const r=import.meta.url;const a={};if(r!==""){a.resourcesUrl=new URL(".",r).href}return e(a)};a().then((e=>r([["p-2a4717d6",[[1,"hemfixarna-demo",{selectedSlug:[32],tooltipText:[32],tree:[32]}],[1,"hemfixarna-byggmax",{slug:[1],tree:[32]}],[1,"hemfixarna-component",{slug:[1],business:[1],topCategory:[1,"top-category"],modal:[32],showModal:[32],tree:[32],product:[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{tree:[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{tree:[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{tree:[16]}],[0,"hemfixarna-product",{amount:[32]}],[0,"hemfixarna-breadcrumbs",{tree:[16],closeModal:[16]}],[0,"hemfixarna-checkout",{date:[32],dateError:[32],generalError:[32]}],[0,"hemfixarna-address",{street:[32],streetError:[32],zip:[32],zipError:[32],town:[32],townError:[32]}],[0,"hemfixarna-getuser",{email:[32],emailError:[32],phone:[32],phoneError:[32],ssn:[32],ssnError:[32]}],[0,"hemfixarna-orderrows",{cart:[4],tree:[16]}],[0,"hemfixarna-box",{post:[16],icon:[1],postTitle:[1,"post-title"]}],[0,"hemfixarna-info",{list:[16]}]]]],e)));
|
|
2
2
|
//# sourceMappingURL=hemfixarna-components.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as t,f as e,r as i,h as r,a as n,F as s,c as a}from"./p-8829e98e.js";const o=(t,e,i)=>{const r=t.get(e);if(!r){t.set(e,[i])}else if(!r.includes(i)){r.push(i)}};const l=(t,e)=>{let i;return(...r)=>{if(i){clearTimeout(i)}i=setTimeout((()=>{i=0;t(...r)}),e)}};const h=t=>!("isConnected"in t)||t.isConnected;const c=l((t=>{for(let e of t.keys()){t.set(e,t.get(e).filter(h))}}),2e3);const u=()=>{if(typeof t!=="function"){return{}}const i=new Map;return{dispose:()=>i.clear(),get:e=>{const r=t();if(r){o(i,e,r)}},set:t=>{const r=i.get(t);if(r){i.set(t,r.filter(e))}c(i)},reset:()=>{i.forEach((t=>t.forEach(e)));c(i)}}};const d=t=>typeof t==="function"?t():t;const m=(t,e=((t,e)=>t!==e))=>{const i=d(t);let r=new Map(Object.entries(i!==null&&i!==void 0?i:{}));const n={dispose:[],get:[],set:[],reset:[]};const s=()=>{var e;r=new Map(Object.entries((e=d(t))!==null&&e!==void 0?e:{}));n.reset.forEach((t=>t()))};const a=()=>{n.dispose.forEach((t=>t()));s()};const o=t=>{n.get.forEach((e=>e(t)));return r.get(t)};const l=(t,i)=>{const s=r.get(t);if(e(i,s,t)){r.set(t,i);n.set.forEach((e=>e(t,i,s)))}};const h=typeof Proxy==="undefined"?{}:new Proxy(i,{get(t,e){return o(e)},ownKeys(t){return Array.from(r.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,e){return r.has(e)},set(t,e,i){l(e,i);return true}});const c=(t,e)=>{n[t].push(e);return()=>{f(n[t],e)}};const u=(e,i)=>{const r=c("set",((t,r)=>{if(t===e){i(r)}}));const n=c("reset",(()=>i(d(t)[e])));return()=>{r();n()}};const m=(...t)=>{const e=t.reduce(((t,e)=>{if(e.set){t.push(c("set",e.set))}if(e.get){t.push(c("get",e.get))}if(e.reset){t.push(c("reset",e.reset))}if(e.dispose){t.push(c("dispose",e.dispose))}return t}),[]);return()=>e.forEach((t=>t()))};const p=t=>{const e=r.get(t);n.set.forEach((i=>i(t,e,e)))};return{state:h,get:o,set:l,on:c,onChange:u,use:m,dispose:a,reset:s,forceUpdate:p}};const f=(t,e)=>{const i=t.indexOf(e);if(i>=0){t[i]=t[t.length-1];t.length--}};const p=(t,e)=>{const i=m(t,e);i.use(u());return i};const{state:x,onChange:g}=p({step:1,checkoutStep:1,checkoutEdit:false,selectedCategory:null,selectedService:null,selectedProduct:null,cart:[],business:"undefined",options:null,rut:true,rot:true,token:null,user:null,modal:null});g("cart",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-cart`,JSON.stringify(t))}));g("user",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-user`,JSON.stringify(t))}));const b=t=>t.split(" ").reduce(((t,e)=>e.length<2?e:t+e.slice(0,1)+"*".repeat(e.length-2)+e.slice(e.length-1,e.length)+" "),"");const v=class{constructor(t){i(this,t);this.handleSubmit=t=>{t.preventDefault();const e=this.street.length>0;if(!e){this.streetError="Ange en gatuadress"}const i=this.zip.length>0;if(!i){this.zipError="Ange ett postnummer"}const r=this.town.length>0;if(!r){this.townError="Ange en ort"}if(e&&i&&r){x.user=Object.assign(Object.assign({},x.user),{street:this.street,zip:this.zip,town:this.town});x.checkoutStep=2;x.checkoutEdit=false}};this.handleChangeStreet=t=>{this.streetError=null;this.street=this.street===x.user.street?"":t.target.value};this.handleChangeZip=t=>{this.zipError=null;this.zip=this.zip===x.user.zip?"":t.target.value};this.handleChangeTown=t=>{this.townError=null;this.town=this.town===x.user.town?"":t.target.value};this.render=()=>r("form",{class:"hemfixarna_address",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===x.user.street?b(this.street):this.street}),r("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&r("span",null,this.streetError),r("div",null,r("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===x.user.zip?b(this.zip):this.zip}),r("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&r("span",null,this.zipError),r("div",null,r("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===x.user.town?b(this.town):this.town}),r("label",{htmlFor:"town"},"Ort ")),this.townError&&r("span",null,this.townError),r("input",{type:"submit",value:"Fortsätt och Boka"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(x.user){this.street=x.user.street;this.zip=x.user.zip;this.town=x.user.town}}};const _=t=>Math.ceil(t/2);const k=t=>Math.ceil(t*.7);const w=(t,e,i=1)=>{if(t.rot&&x.rot){return k((e||t.price)*i)}else if(t.rut&&x.rut){return _((e||t.price)*i)}else{return(e||t.price)*i}};const y=t=>{if(t.rot){return k(t.price)}else if(t.rut&&x.rut){return _(t.price)}else{return t.price}};const $=(t,e,i=1)=>{if(e.rot&&x.rot){return k(t.price*i)}else if(e.rut&&x.rut){return _(t.price*i)}else{return t.price*i}};const C=()=>{if(!x.cart)return{rut:0,rot:0};const t=x.cart.some((t=>t.rut&&t.start_fee));const e=x.cart.some((t=>t.rot&&t.start_fee));const i=x.rut?_(x.options.start_fee):x.options.start_fee*1;const r=x.rot?k(x.options.start_fee):x.options.start_fee*1;if(t&&e){return{rut:i,rot:r,length:2}}else if(t){return{rut:i,rot:0,length:1}}else if(e){return{rut:0,rot:r,length:1}}else{return{rut:0,rot:0,length:0}}};const T=t=>{const e=t.parts.reduce(((t,e)=>t+e.price*e.amount),0);return w(t,t.price*t.amount+e)};const z=()=>{const t=x.cart.reduce(((t,e)=>e.rot?t+T(e):t),0)+C().rot;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rot?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const S=()=>{const t=x.cart.reduce(((t,e)=>e.rut?t+T(e):t),0)+C().rut;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rut?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const j=()=>x.cart.reduce(((t,e)=>t+T(e)),0)+C().rot+C().rut;const O=class{constructor(t){i(this,t);this.post=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.step=4}}}render(){return r("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&r("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),r("div",null,r("p",null,this.postTitle),x.step===3&&r("p",{class:"price"},"Från ",w(this.post),"kr")))}};const M=class{constructor(t){i(this,t);this.tree=undefined;this.closeModal=undefined}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}handleCartClick(){var t;if((t=x.cart)===null||t===void 0?void 0:t.length){x.step=5}}handleHomePageClick(){x.step=1;setTimeout((()=>{x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null}),200)}render(){const t=n(`./assets/hemfixarna.svg`);const e=n(`./assets/close.svg`);const i=n(`./assets/cart.svg`);const s=n(`./assets/back.svg`);return r("div",null,r("div",{class:"hemfixarna_crumbs"},r("div",{class:"hemfixarna_crumbs--links"},r("img",{onClick:()=>this.handleHomePageClick(),src:t,width:110}),r("img",{onClick:()=>this.closeModal(),class:"close",src:e,width:32}),r("div",null,r("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),r("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},r("img",{src:i,width:24}),r("span",null,this.getCartLength()))),[3,4].includes(x.step)&&r("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=x.step===4?3:2}},r("img",{width:24,src:s,alt:"back arrow"}),r("span",null,"Se allt ",x.step===4?x.selectedService.post_title:x.selectedCategory.name)))}};var N;(function(t){t["byggmax"]="byggmax"})(N||(N={}));var I;(function(t){t["byggmax"]="category/bygg"})(I||(I={}));const A="";const L=class{constructor(t){i(this,t);this.tree=null;this.slug=undefined}render(){return r("hemfixarna-component",{slug:this.slug,business:N.byggmax,topCategory:I.byggmax})}};L.style=A;const P=class{constructor(t){i(this,t);this.tree=undefined}render(){const t=n(`./assets/back.svg`);return r("div",{class:"hemfixarna_cart"},r("div",{class:"hemfixarna_cart--left"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Din bokning"),r("hemfixarna-orderrows",{tree:this.tree})),r("div",{class:"hemfixarna_cart--right"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Dina uppgifter"),r("hemfixarna-checkout",null),r("hemfixarna-info",null)))}};const R=class{constructor(t){i(this,t)}setSelectedService(t){x.selectedService=t;x.step=3}render(){return r("div",null,r("h2",null,x.selectedCategory.name),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedCategory.services.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const D=`${"https://hemfixarna.se"}/wp-json/headless`;const F=async t=>{if(!t){return}const e=t.split("/")[0];const i=t.split("/")[1];try{const t=await fetch(`${D}/${e}/${i}`);return await t.json()}catch(t){console.log(t)}};const K=async()=>{try{const t=await fetch(`${D}/webcoptions`);return await t.json()}catch(t){console.log(t)}};const J=async t=>{try{const e=await fetch(`${D}/weborder`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return await e.json()}catch(t){console.log(t)}};const E=class{constructor(t){i(this,t);this.handleChangeDate=t=>{this.dateError=null;this.date=t.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{const t={name:x.user.firstName+" "+x.user.lastName,customer:x.business,phone:x.user.phone,social_security_number:x.user.ssn,email:x.user.email,address:`${x.user.street} | ${x.user.zip} | ${x.user.town}`,earliest_visit_date:this.date,order_items:JSON.stringify(x.cart.map((t=>`${t.amount}st ${t.name} ${w(t,t.price,t.amount)}kr ${t.parts.length?`| ${t.parts.map((e=>`${e.amount}st ${e.name} ${$(e,t,e.amount)}kr`)).join(" | ")} `:""} ${t.rot&&x.rot?"(med rot)":x.rut&&t.rut?"(med rut)":"(utan rut/rot)"}`))),start_fee:`${C().rut>0?`Rut: ${C().rut}kr`:"Rut: 0"} `+`${C().rot>0?`Rot: ${C().rot}kr`:"Rot: 0"}`,total:j()};try{const{data:e,status:i}=await J(t);if(e&&i&&i===200){x.step=6}else{this.generalError="Något gick fel, försök igen senare"}}catch(t){this.generalError="Något gick fel, försök igen senare"}};this.handleSubmit=t=>{t.preventDefault();this.generalError=null;const e=this.date.length>0;if(!e){this.dateError="Ange ett giltigt datum"}const i=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const r=i.find((t=>!t.checked));if(r){this.generalError="Du måste godkänna villkoren"}if(e&&!r){this.sendOrder()}};this.render=()=>{const t=n(`./assets/date.svg`);const e=n(`./assets/down.svg`);if(x.checkoutEdit){return r("hemfixarna-address",null)}else if(x.checkoutStep===1){return r("hemfixarna-getuser",null)}else if(x.checkoutStep===2){return r("div",{class:"mb-2"},r("div",{class:"hemfixarna_addressinfo"},r("div",null,r("p",null,b(x.user.firstName)),r("p",null,b(x.user.lastName)),r("p",null,x.user.email),r("p",null,x.user.phone)),r("div",null,r("p",null,b(x.user.street)),r("p",null,b(x.user.zip)),r("p",null,b(x.user.town))),r("button",{onClick:()=>x.checkoutEdit=true},"Behöver du ändra adressen?")),r("form",{onSubmit:t=>this.handleSubmit(t)},r("div",null,r("img",{src:t,width:24}),r("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:t=>this.handleChangeDate(t),type:"date",name:"date",value:this.date}),r("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),r("img",{src:e,width:24})),this.dateError&&r("span",null,this.dateError),r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",{innerHTML:x.options.terms})),x.cart.filter((t=>t.terms_checkout&&t.terms_show_checkbox)).map((t=>r(s,null,r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",null,t.terms_checkout))))),this.generalError&&r("span",null,this.generalError),r("input",{type:"submit",value:"Slutför Bokning"})))}};this.date="";this.dateError=null;this.generalError=null}componentWillLoad(){if(Boolean(x.user&&x.user.street)){x.checkoutStep=2}}get el(){return a(this)}};const U='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); *{box-sizing:border-box}:host{font-family:"Inter", sans-serif}:host .mb-2{margin-bottom:2rem}:host form{display:flex;flex-direction:column;gap:1rem}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:1rem}:host form img:last-of-type{right:1rem}:host form span{margin-top:-0.5rem;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:1rem;top:50%;transform:translateY(-50%);background:#fff;padding:0.25rem;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:1rem;width:100%;font-size:1rem;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 0.5rem}:host h2{margin:0 0 1.5rem;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:"";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:2.5rem auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:1.5rem;padding:2rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:0.25rem;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:2rem;z-index:99;border-radius:0.25rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:1rem}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:0.5rem 1rem}:host .hemfixarna_addressinfo{padding:1rem 1rem 4rem;border:1px solid #fcd9c9;position:relative;margin-bottom:2rem;display:grid;grid-template-columns:1fr 1fr;gap:0.5rem}:host .hemfixarna_addressinfo button{position:absolute;bottom:1rem;right:1rem;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:1rem;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 0.5rem}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:4rem}:host .hemfixarna_box{padding:1rem;display:flex;align-items:center;justify-content:space-between;background:#fffaf2;border:1px solid #fcd9c9;width:100%;box-sizing:border-box;border-radius:0.25rem;gap:1rem 0.5rem}:host .hemfixarna_box>div{display:grid;gap:0.5rem}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:1rem 2rem;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:1rem 1.5rem}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:0.25rem;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:3rem 2rem 4rem}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:2rem;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:1rem 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:0.2rem}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:1rem;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:1rem;padding:1rem;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-1.5rem}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:1rem;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:0.5rem;padding:1rem 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:1rem}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:1.5rem}:host .hemfixarna_categories--wrapper{gap:2rem;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:0.25rem;min-height:132px;padding:1.5rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:1.5rem;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 2rem 4rem}:host .hemfixarna_content--5{padding-top:1rem}:host .hemfixarna_crumbs{position:relative;padding:1rem 1.5rem;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:1rem 1.5rem 0.5rem;display:flex;align-items:center;gap:0.5rem;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-1rem;top:-1rem;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:1rem;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:1rem;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:4rem;padding:0.75rem 1rem;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:0.75rem !important}:host .hemfixarna_features li{display:flex;gap:1rem;align-items:center}:host .hemfixarna_address{margin-bottom:1rem}:host .hemfixarna_product{display:grid;gap:1rem}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:0.25rem}:host .hemfixarna_product--left{gap:2rem}:host .hemfixarna_product--right{gap:2rem}:host .hemfixarna_product--price{margin-top:0.25rem;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-1rem 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:1rem;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:2rem}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:0.5rem}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:3.5rem}:host input[type=date]{border:1px solid #fcd9c9;padding-left:4rem}:host input[type=checkbox]{height:1.125rem;width:1.125rem;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}';const W=class{constructor(t){i(this,t);this.modal=false;this.showModal=false;this.tree=null;this.product=null;this.slug=undefined;this.business=undefined;this.topCategory=undefined}async fetchNewTaxonomy(t){x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null;const e=await F(t);if((e===null||e===void 0?void 0:e.code)==="not_found"||(e===null||e===void 0?void 0:e.code)==="rest_no_route"){console.log("taxonomy not found")}else if(e){this.setTaxonomy(e);if((e===null||e===void 0?void 0:e.post_type)==="ikea_product"){this.product=e}}}async componentWillLoad(){x.business=this.business;const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(t){x.cart=JSON.parse(t)}const e=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(e){x.user=JSON.parse(e)}const i=await F(this.topCategory);if((i===null||i===void 0?void 0:i.code)==="not_found"){console.warn("tree not found")}else if(i){this.tree=i}if(this.slug){const t=await F(this.slug);if((t===null||t===void 0?void 0:t.code)==="not_found"){console.log("taxonomy not found")}else if(t){this.setTaxonomy(t)}}const r=await K();x.options=r}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.selectedCategory=this.tree.sub_cats.find((e=>e.services.find((e=>e.ID===t.ID))));x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.selectedService=this.tree.sub_cats.map((t=>t.services)).flat().find((t=>t.products.find((t=>t.ID===x.selectedProduct.ID))));x.selectedCategory=this.tree.sub_cats.find((t=>t.services.find((t=>t.ID===x.selectedService.ID))));x.step=4}}}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(t){const e=this.el.shadowRoot.querySelector(".hemfixarna_modal");if(e){const i=e.contains(t.composedPath()[0]);if(!i){this.closeModal()}}const i=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(i){const e=i.contains(t.composedPath()[0]);if(!e){x.modal=null}}}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}render(){var t,e;const i=n(`./assets/hemfixarna.svg`);return r("div",{class:"hemfixarna"},r("div",{class:"hemfixarna_box"},r("div",null,r("div",null,r("p",null,((t=this.product)===null||t===void 0?void 0:t.post_title)||r("span",null,"Montering/Installation på plats - ",r("strong",null,"se priser här")),this.product&&((e=this.slug)===null||e===void 0?void 0:e.includes("product"))?r("span",null," från"," ",r("strong",null,y(this.product),"kr")):null)),r("img",{src:i,width:104})),r("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn"},"Till montering",this.getCartLength()>0&&r("span",null,this.getCartLength()))),this.modal&&r("div",null,r("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},x.modal&&r("div",{class:"hemfixarna_infomodal"},r("h2",null,x.modal.title),x.modal.text.map((t=>r("p",null,t))),r("div",null,r("button",{onClick:()=>x.modal=null},"Stäng"))),this.tree&&r("hemfixarna-breadcrumbs",{closeModal:()=>this.closeModal(),tree:this.tree}),r("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step===1&&this.tree&&r("hemfixarna-start",{tree:this.tree}),x.step===2&&x.selectedCategory&&r("hemfixarna-category",null),x.step===3&&x.selectedService&&r("hemfixarna-service",null),x.step===4&&x.selectedProduct&&r("hemfixarna-product",null),x.step===5&&r("hemfixarna-cart",{tree:this.tree}),x.step===6&&r("hemfixarna-order",{tree:this.tree}))),r("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`})))}static get assetsDirs(){return["assets"]}get el(){return a(this)}static get watchers(){return{slug:["fetchNewTaxonomy"]}}};W.style=U;const B='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_example{margin-bottom:1rem;background:#000;padding:1rem;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-3rem;font-size:16px;left:40%;color:white;padding:0.5rem;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:0.5rem;margin-top:1rem}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:0.5rem}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:0.2rem 0.6rem;border-radius:10px;margin-right:0.5rem;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;background:#9f9da9}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:2rem;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:1rem 2rem;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{background:#000;gap:1px;display:grid}:host>div ul li{padding-left:1rem;background:#fff}';const V=class{constructor(t){i(this,t);this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null}getTopLevelCategory(){switch("byggmax"){case N.byggmax:return I.byggmax;default:return""}}async componentWillLoad(){const t=await F(this.getTopLevelCategory());if((t===null||t===void 0?void 0:t.code)==="not_found"){console.warn("tree not found")}else if(t){this.tree=t}}getExample(){return`<hemfixarna-${"byggmax"}${this.selectedSlug?` slug="${this.selectedSlug}" `:""}></hemfixarna-${"byggmax"}>`}copyExample(){navigator.clipboard.writeText(this.getExample());this.tooltipText="Snippet kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyCdn(){navigator.clipboard.writeText(this.cdnLink);this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyNpmInstall(){navigator.clipboard.writeText("npm i hemfixarna-web-components");this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}render(){const t=n(`./assets/copy.png`);return r("div",null,r("div",null,r("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},r("p",null,this.getExample()),r("img",{src:t,height:20}),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),"byggmax"===N.byggmax&&r("hemfixarna-byggmax",{slug:this.selectedSlug}),r("div",{class:"hemfixarna_install"},r("div",null,r("a",{target:"_blank",href:"https://www.npmjs.com/package/hemfixarna-web-components"},"Install with npm")),r("div",{onClick:()=>this.copyNpmInstall(),class:"hemfixarna_example"},r("p",null,"npm i hemfixarna-web-components"),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})),r("p",null,"Or use cdn"),r("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},r("p",null,this.cdnLink),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})))),r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},r("div",null,r("p",null,t.name),r("span",null,`category/${t.slug}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`category/${t.slug}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`category/${t.slug}`},"Ladda kategori"))),r("ul",null,t.services.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`service/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`service/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`service/${t.post_name}`},"Ladda kategori"))),r("ul",null,t.products.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`product/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`product/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`product/${t.post_name}`},"Ladda kategori"))))))))))))))))}};V.style=B;var H=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var X=(t,e)=>{const i=t.getTime()-e.getTime();return i<0?-1:i>0?1:i};var Y=(t,e)=>{const i=X(t,e);const r=Math.abs(t.getFullYear()-e.getFullYear());t.setFullYear(t.getFullYear()-i*r);const n=X(t,e)===-i;const s=i*(r-+n);return s===0?0:s};var q=t=>{let e=0;t+="";for(let i=0,r=t.length;i<r;i++){let r=parseInt(t[i]);r*=2-i%2;if(r>9){r-=9}e+=r}return Math.ceil(e/10)*10-e};var G=(t,e,i)=>{e-=1;const r=new Date(t,e,i);return!(r.getFullYear()!==t||r.getMonth()!==e||r.getDate()!==i)};var Z=class{constructor(t,e){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(t,{allowCoordinationNumber:true,allowInterimNumber:false,...e})}get century(){return this._century}get fullYear(){return this._fullYear}get year(){return this._year}get month(){return this._month}get day(){return this._day}get sep(){return this._sep}get num(){return this._num}get check(){return this._check}static parse(t,e){return new Z(t,e)}static valid(t,e){try{Z.parse(t,e);return true}catch(t){return false}}parse(t,e){if(t.length<10||t.length>13){throw new H}const i=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const r=i.exec(t);if(!r){throw new H}const n=r[1];const s=r[2];const a=r[3];const o=r[4];const l=r[5];const h=r[6];const c=r[7];if(typeof n==="undefined"||!n.length){const t=new Date;let e=0;if(l==="+"){this._sep="+";e=t.getFullYear()-100}else{this._sep="-";e=t.getFullYear()}this._century=(""+(e-(e-parseInt(s))%100)).substr(0,2)}else{this._century=n;if((new Date).getFullYear()-parseInt(n+s,10)<100){this._sep="-"}else{this._sep="+"}}this._year=s;this._fullYear=this._century+s;this._month=a;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new H}if(!(e==null?void 0:e.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new H}if(!(e==null?void 0:e.allowInterimNumber)&&this.isInterimNumber()){throw new H}}valid(){const t=q(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(t&&G(parseInt(this.century+this.year),+this.month,+this.day)){return t}return t&&G(parseInt(this.century+this.year),+this.month,+this.day-60)}format(t=false){if(t){return`${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`}return`${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`}getAge(){const t=this.getDate();return Y(new Date(Date.now()),t)}getDate(){let t=+this.day;if(this.isCoordinationNumber()){t-=60}const e=this.century+this.year+"-"+this.month+"-"+(t<10?"0"+t:t);return new Date(e)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return G(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const t=parseInt(this.num.substr(-1));return t%2===1}};var Q=Z;function tt(t,e,i){return i={path:e,exports:{},require:function(t,e){return et()}},t(i,i.exports),i.exports}function et(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var it=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.utf8=void 0;e.utf8={encode:i,decode:r};function i(t){t=t.replace(/\r\n/g,"\n");var e="";for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r)}else if(r>127&&r<2048){e+=String.fromCharCode(r>>6|192);e+=String.fromCharCode(r&63|128)}else{e+=String.fromCharCode(r>>12|224);e+=String.fromCharCode(r>>6&63|128);e+=String.fromCharCode(r&63|128)}}return e}function r(t){var e="";var i=0;var r=0;var n=0;var s=0;while(i<t.length){r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r);i++}else if(r>191&&r<224){n=t.charCodeAt(i+1);e+=String.fromCharCode((r&31)<<6|n&63);i+=2}else{n=t.charCodeAt(i+1);s=t.charCodeAt(i+2);e+=String.fromCharCode((r&15)<<12|(n&63)<<6|s&63);i+=3}}return e}}));var rt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.generate=void 0;function i(t){var e=[];var i;var r;var s;var a;var o;var l;var p;var x;var g;var b=7;var v=12;var _=17;var k=22;var w=5;var y=9;var $=14;var C=20;var T=4;var z=11;var S=16;var j=23;var O=6;var M=10;var N=15;var I=21;var A=it.utf8.encode(t);e=m(A);l=1732584193;p=4023233417;x=2562383102;g=271733878;for(i=0;i<e.length;i+=16){r=l;s=p;a=x;o=g;l=h(l,p,x,g,e[i+0],b,3614090360);g=h(g,l,p,x,e[i+1],v,3905402710);x=h(x,g,l,p,e[i+2],_,606105819);p=h(p,x,g,l,e[i+3],k,3250441966);l=h(l,p,x,g,e[i+4],b,4118548399);g=h(g,l,p,x,e[i+5],v,1200080426);x=h(x,g,l,p,e[i+6],_,2821735955);p=h(p,x,g,l,e[i+7],k,4249261313);l=h(l,p,x,g,e[i+8],b,1770035416);g=h(g,l,p,x,e[i+9],v,2336552879);x=h(x,g,l,p,e[i+10],_,4294925233);p=h(p,x,g,l,e[i+11],k,2304563134);l=h(l,p,x,g,e[i+12],b,1804603682);g=h(g,l,p,x,e[i+13],v,4254626195);x=h(x,g,l,p,e[i+14],_,2792965006);p=h(p,x,g,l,e[i+15],k,1236535329);l=c(l,p,x,g,e[i+1],w,4129170786);g=c(g,l,p,x,e[i+6],y,3225465664);x=c(x,g,l,p,e[i+11],$,643717713);p=c(p,x,g,l,e[i+0],C,3921069994);l=c(l,p,x,g,e[i+5],w,3593408605);g=c(g,l,p,x,e[i+10],y,38016083);x=c(x,g,l,p,e[i+15],$,3634488961);p=c(p,x,g,l,e[i+4],C,3889429448);l=c(l,p,x,g,e[i+9],w,568446438);g=c(g,l,p,x,e[i+14],y,3275163606);x=c(x,g,l,p,e[i+3],$,4107603335);p=c(p,x,g,l,e[i+8],C,1163531501);l=c(l,p,x,g,e[i+13],w,2850285829);g=c(g,l,p,x,e[i+2],y,4243563512);x=c(x,g,l,p,e[i+7],$,1735328473);p=c(p,x,g,l,e[i+12],C,2368359562);l=u(l,p,x,g,e[i+5],T,4294588738);g=u(g,l,p,x,e[i+8],z,2272392833);x=u(x,g,l,p,e[i+11],S,1839030562);p=u(p,x,g,l,e[i+14],j,4259657740);l=u(l,p,x,g,e[i+1],T,2763975236);g=u(g,l,p,x,e[i+4],z,1272893353);x=u(x,g,l,p,e[i+7],S,4139469664);p=u(p,x,g,l,e[i+10],j,3200236656);l=u(l,p,x,g,e[i+13],T,681279174);g=u(g,l,p,x,e[i+0],z,3936430074);x=u(x,g,l,p,e[i+3],S,3572445317);p=u(p,x,g,l,e[i+6],j,76029189);l=u(l,p,x,g,e[i+9],T,3654602809);g=u(g,l,p,x,e[i+12],z,3873151461);x=u(x,g,l,p,e[i+15],S,530742520);p=u(p,x,g,l,e[i+2],j,3299628645);l=d(l,p,x,g,e[i+0],O,4096336452);g=d(g,l,p,x,e[i+7],M,1126891415);x=d(x,g,l,p,e[i+14],N,2878612391);p=d(p,x,g,l,e[i+5],I,4237533241);l=d(l,p,x,g,e[i+12],O,1700485571);g=d(g,l,p,x,e[i+3],M,2399980690);x=d(x,g,l,p,e[i+10],N,4293915773);p=d(p,x,g,l,e[i+1],I,2240044497);l=d(l,p,x,g,e[i+8],O,1873313359);g=d(g,l,p,x,e[i+15],M,4264355552);x=d(x,g,l,p,e[i+6],N,2734768916);p=d(p,x,g,l,e[i+13],I,1309151649);l=d(l,p,x,g,e[i+4],O,4149444226);g=d(g,l,p,x,e[i+11],M,3174756917);x=d(x,g,l,p,e[i+2],N,718787259);p=d(p,x,g,l,e[i+9],I,3951481745);l=n(l,r);p=n(p,s);x=n(x,a);g=n(g,o)}return f(l)+f(p)+f(x)+f(g)}e.generate=i;function r(t,e){return t<<e|t>>>32-e}function n(t,e){var i;var r;var n;var s;var a;n=t&2147483648;s=e&2147483648;i=t&1073741824;r=e&1073741824;a=(t&1073741823)+(e&1073741823);if(i&r){return a^2147483648^n^s}if(i|r){if(a&1073741824){return a^3221225472^n^s}else{return a^1073741824^n^s}}else{return a^n^s}}function s(t,e,i){return t&e|~t&i}function a(t,e,i){return t&i|e&~i}function o(t,e,i){return t^e^i}function l(t,e,i){return e^(t|~i)}function h(t,e,i,a,o,l,h){t=n(t,n(n(s(e,i,a),o),h));return n(r(t,l),e)}function c(t,e,i,s,o,l,h){t=n(t,n(n(a(e,i,s),o),h));return n(r(t,l),e)}function u(t,e,i,s,a,l,h){t=n(t,n(n(o(e,i,s),a),h));return n(r(t,l),e)}function d(t,e,i,s,a,o,h){t=n(t,n(n(l(e,i,s),a),h));return n(r(t,o),e)}function m(t){var e;var i=t.length;var r=i+8;var n=(r-r%64)/64;var s=(n+1)*16;var a=Array(s-1);var o=0;var l=0;while(l<i){e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|t.charCodeAt(l)<<o;l++}e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|128<<o;a[s-2]=i<<3;a[s-1]=i>>>29;return a}function f(t){var e="";var i="";var r;var n;for(n=0;n<=3;n++){r=t>>>n*8&255;i="0"+r.toString(16);e=e+i.substr(i.length-2,2)}return e}}));var nt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.MD5=e.generate=void 0;var i=rt;Object.defineProperty(e,"generate",{enumerable:true,get:function(){return i.generate}});e.MD5={generate:rt.generate}}));const st=async t=>{var e;const i=await fetch((e="https://hemfixare-lookup.vercel.app/api")!==null&&e!==void 0?e:"https://hemfixare-lookup.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,hash:nt.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+t)})});const r=await i.json();return r};const at=class{constructor(t){i(this,t);this.handleChangeEmail=t=>{this.emailError=null;this.email=t.target.value};this.handleChangePhone=t=>{this.phoneError=null;this.phone=t.target.value};this.handleChangessn=t=>{this.ssnError=null;this.ssn=t.target.value};this.handleSubmit=async t=>{t.preventDefault();const e=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);const i=e.test(this.email);if(!i){this.emailError="Ange en giltig e-postadress"}const r=this.phone.length>6;if(!r){this.phoneError="Ange ett giltigt telefonnummer"}const n=Q.valid(this.ssn);if(!n){this.ssnError="Ange ett giltigt personnummer"}else if(n){const t=Q.parse(this.ssn).format(true);this.ssn=[t.slice(0,8),"-",t.slice(8)].join("")}if(i&&r&&n){try{const t=await st(this.ssn);if(t){x.checkoutStep=2;x.user=Object.assign(Object.assign({},t),{email:this.email,phone:this.phone,ssn:this.ssn})}else{this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer"}}catch(t){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(t)}}};this.render=()=>r("form",{class:"mb-2",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("input",{class:`${this.email.length?"input_active":""}`,onChange:t=>this.handleChangeEmail(t),type:"email",name:"email",value:this.email}),r("label",{htmlFor:"email"},"E-post ")),this.emailError&&r("span",null,this.emailError),r("div",null,r("input",{class:`${this.phone.length?"input_active":""}`,onChange:t=>this.handleChangePhone(t),type:"tel",name:"phone",value:this.phone}),r("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&r("span",null,this.phoneError),r("div",null,r("input",{class:`${this.ssn.length?"input_active":""}`,onChange:t=>this.handleChangessn(t),type:"tel",name:"ssn",value:this.ssn}),r("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&r("span",null,this.ssnError),r("input",{type:"submit",value:"Fortsätt och Boka*"}),r("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(x.user){this.email=x.user.email;this.phone=x.user.phone;this.ssn=x.user.ssn}}};const ot=class{constructor(t){i(this,t);this.logo=n(`./assets/hemfixarna.svg`);this.checkoutList=[{trust_badge:"Efter att du fyllt i formuläret blir du kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}];this.list=null}getList(){return this.list?this.list:this.checkoutList}render(){const t=n(`./assets/checked.svg`);return r("div",{class:"hemfixarna_info"},x.step<5?r(s,null,r("h2",null,"Vilka är Hemfixarna?"),r("p",null,"Vi fixar allt från krångliga datorer till montering av möbler. Vi finns i hela Sverige och är alltid redo att rycka ut.")):r("h2",null,"Vad händer nu?"),r("ul",{class:"hemfixarna_features"},this.getList().map((e=>r("li",{key:e.trust_badge},r("img",{src:t,alt:"checked"}),r("p",null,e.trust_badge))))),r("img",{src:this.logo,width:200,alt:"hemfixarna"}),r("a",{class:"hemfixarna_product--link",target:"_blank",href:x.options.link.url},x.options.link.title))}};const lt=class{constructor(t){i(this,t);this.render=()=>r("div",{style:{background:`url(${x.options.thank_you_image})`},class:"hemfixarna_order"},r("div",null),r("div",null,r("h2",null,"Tack för din bokning"),r("hemfixarna-orderrows",{tree:this.tree,cart:false}),r("span",{onClick:()=>this.resetShop()},r("button",null,"Gör en ny bokning")),r("hemfixarna-info",{list:[{trust_badge:"Du kommer bli kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}]})));this.tree=undefined}resetShop(){x.step=1;x.cart=[];x.selectedCategory=null;x.selectedService=null;x.selectedProduct=null;x.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const ht=class{constructor(t){i(this,t);this.cart=true;this.tree=undefined}goToProduct(t){const e=this.tree.sub_cats.map((t=>t.services)).flat();const i=e.map((t=>t.products)).flat();const r=i.find((e=>e.ID===t));const n=e.find((e=>e.products.find((e=>e.ID===t))));const s=this.tree.sub_cats.find((e=>e.services.find((e=>e.products.find((e=>e.ID===t))))));x.selectedCategory=s;x.selectedService=n;x.selectedProduct=r;x.step=4}openMontering(){x.modal={title:"Monteringsavgift",text:["Monteringsavgiften är en fast avgift som läggs på din beställning. Avgiften täcker kostnader för att montera produkterna du beställer.","Monteringsavgiften debiteras per påbörjat nytt uppdrag. Om du bokar ett uppdrag som både innehåller RUT- och ROT-avdrag så kommer uppdraget att delas upp och således kommer två monteringsavgifter att debiteras och två fakturor att utställas."]}}render(){const t=n(`./assets/info.svg`);return r(s,null,r("ul",{class:"hemfixarna_cart--items"},x.cart.map((t=>{var e;return r("li",{class:"hemfixarna_cart--item"},r("div",null,r("div",null,t.icon&&r("img",{width:30,src:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,alt:t.name}),r("p",null,r("strong",null,t.amount,"x "),t.name)),this.cart&&r("button",{onClick:()=>this.goToProduct(t.id)},"Ändra")),r("p",null,r("strong",null,w(t,t.price,t.amount),"kr")),t.parts.length>0&&r("ul",null,t.parts.map((e=>r("li",null,r("p",null,r("strong",null,e.amount,"x "),e.name),r("p",null,r("strong",null,$(e,t,e.amount),"kr")))))))}))),r("div",{class:"hemfixarna_cart--additional"},C().length>0&&r("div",{class:"hemfixarna_cart--startfee"},r("p",null,C().length,"x"," ",r("strong",{onClick:()=>this.openMontering()},"Monteringsavgift",r("img",{height:16,src:t,alt:"info monteringsavgift"}))),r("p",null,C().rot+C().rut,"kr")),x.cart.find((t=>t.rot))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,this.cart&&r("label",{class:"switch"},r("input",{checked:x.rot,onChange:()=>x.rot=!x.rot,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"ROT-avdrag")),r("p",null,"(-",x.rot?z():0,"kr)")),x.cart.find((t=>t.rut))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,r("label",{class:"switch"},r("input",{onChange:()=>x.rut=!x.rut,checked:x.rut,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"RUT-avdrag")),r("p",null,"(-",x.rut?S():0,"kr)"))),r("div",{class:"hemfixarna_cart--price"},r("h2",null,"Totalbelopp: "),r("h2",null,j(),"kr")))}};const ct=class{constructor(t){i(this,t);this.amount=0}addProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){t.amount++;x.cart=[...x.cart]}else{x.cart=[...x.cart,{id:x.selectedProduct.ID,rut:x.selectedProduct.rut,rot:x.selectedProduct.rot,amount:1,parts:[],price:x.selectedProduct.price,name:x.selectedProduct.post_title,start_fee:!x.selectedProduct.start_fee,terms_checkout:x.selectedProduct.terms_checkout,terms_show_checkbox:x.selectedProduct.terms_show_checkbox,icon:x.selectedProduct.icon}]}}removeProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t&&t.amount>1){t.amount--;x.cart=[...x.cart]}else{x.cart=x.cart.filter((t=>t.id!==x.selectedProduct.ID))}}addPart(t){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i){i.amount++;e.parts=[...e.parts]}else{e.parts=[...e.parts,{id:t.ID,amount:1,price:t.price,name:t.post_title}]}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}removePart(t){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i&&i.amount>1){i.amount--;e.parts=[...e.parts]}else{e.parts=e.parts.filter((e=>e.id!==t.ID))}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}goToCart(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){x.step=5}}getAmount(){var t;return((t=x.cart.find((t=>t.id===x.selectedProduct.ID)))===null||t===void 0?void 0:t.amount)||0}getPartAmount(t){var e;const i=x.cart.find((t=>t.id===x.selectedProduct.ID));return((e=i===null||i===void 0?void 0:i.parts.find((e=>e.id===t)))===null||e===void 0?void 0:e.amount)||0}getTotalPrice(){let t=0;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.reduce(((t,e)=>{const i=x.selectedProduct.parts.find((t=>t.ID===e.id));if(i){return t+i.price*e.amount}return t}),0);t=x.selectedProduct.price*e.amount+i}else{t=x.selectedProduct.price}return w(x.selectedProduct,t)}render(){var t,e,i;const s=n(`./assets/checked.svg`);const a=n(`./assets/plus.svg`);const o=n(`./assets/minus.svg`);return r("div",{class:"hemfixarna_product"},r("div",{class:"hemfixarna_product--top"},x.selectedProduct.icon&&r("img",{width:80,src:(t=x.selectedProduct.icon.url)!==null&&t!==void 0?t:x.selectedProduct.icon,alt:x.selectedProduct.post_title}),r("div",null,r("h1",null,x.selectedProduct.post_title),r("h2",null,"Från: ",w(x.selectedProduct)," kr"))),r("div",{class:"hemfixarna_product--grid"},r("div",{class:"hemfixarna_product--left"},((e=x.selectedProduct.list)===null||e===void 0?void 0:e.length)&&r("ul",{class:"hemfixarna_features"},x.selectedProduct.list.map((t=>r("li",{key:t.bullet},r("img",{src:s,alt:"checked"}),r("p",null,t.bullet))))),r("p",{class:"hemfixarna_terms"},r("strong",null,"OBS! "),r("span",{innerHTML:x.selectedProduct.terms}))),r("div",{class:"hemfixarna_product--right"},r("ul",null,r("li",{class:"hemfixarna_product--item"},r("div",null,r("p",null,"Antal ",x.selectedProduct.post_title),r("p",{class:"hemfixarna_product--price"},w(x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:o,onClick:()=>this.removeProduct()}),r("span",null,this.getAmount()),r("img",{src:a,onClick:()=>this.addProduct()}))),((i=x.selectedProduct.parts)===null||i===void 0?void 0:i.length)&&x.selectedProduct.parts.map((t=>r("li",{class:"hemfixarna_part"},r("div",null,r("p",null,t.post_title),r("p",{class:"hemfixarna_product--price"},$(t,x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getPartAmount(t.ID)===0?"disabled":""}`,src:o,onClick:()=>this.removePart(t)}),r("span",null,this.getPartAmount(t.ID)),r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:a,onClick:()=>this.addPart(t)})))))),r("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),r("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Boka"),x.options&&r("hemfixarna-info",{list:x.options.trust}))))}};const ut=class{constructor(t){i(this,t)}setSelectedProduct(t){x.selectedProduct=t;x.step=4}render(){return r("div",null,r("h2",null,x.selectedService.post_title),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedService.products.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const dt=class{constructor(t){i(this,t);this.tree=undefined}render(){return r("div",null,r("h2",null,"Alla tjänster"),r("div",{class:"hemfixarna_categories--wrapper"},r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((t,e)=>t.name<e.name?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.name})}))),r("hemfixarna-info",{list:x.options.trust})))}};export{v as hemfixarna_address,O as hemfixarna_box,M as hemfixarna_breadcrumbs,L as hemfixarna_byggmax,P as hemfixarna_cart,R as hemfixarna_category,E as hemfixarna_checkout,W as hemfixarna_component,V as hemfixarna_demo,at as hemfixarna_getuser,ot as hemfixarna_info,lt as hemfixarna_order,ht as hemfixarna_orderrows,ct as hemfixarna_product,ut as hemfixarna_service,dt as hemfixarna_start};
|
|
2
|
+
//# sourceMappingURL=p-2a4717d6.entry.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hemfixarna-web-components",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"author": "Afonso <info@afonso.se> (http://afonso.se)",
|
|
5
5
|
"description": "Web components to integrate with hemfixarna api",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"start": "stencil build --dev --watch --serve",
|
|
25
25
|
"test": "stencil test --spec --e2e",
|
|
26
26
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
27
|
-
"generate": "stencil generate"
|
|
27
|
+
"generate": "stencil generate",
|
|
28
|
+
"deploy": "stencil build && npm publish"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@jumpgroup/stencil-env": "^0.0.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as t,f as e,r as i,h as r,a as n,F as s,c as a}from"./p-8829e98e.js";const o=(t,e,i)=>{const r=t.get(e);if(!r){t.set(e,[i])}else if(!r.includes(i)){r.push(i)}};const l=(t,e)=>{let i;return(...r)=>{if(i){clearTimeout(i)}i=setTimeout((()=>{i=0;t(...r)}),e)}};const h=t=>!("isConnected"in t)||t.isConnected;const c=l((t=>{for(let e of t.keys()){t.set(e,t.get(e).filter(h))}}),2e3);const u=()=>{if(typeof t!=="function"){return{}}const i=new Map;return{dispose:()=>i.clear(),get:e=>{const r=t();if(r){o(i,e,r)}},set:t=>{const r=i.get(t);if(r){i.set(t,r.filter(e))}c(i)},reset:()=>{i.forEach((t=>t.forEach(e)));c(i)}}};const d=t=>typeof t==="function"?t():t;const m=(t,e=((t,e)=>t!==e))=>{const i=d(t);let r=new Map(Object.entries(i!==null&&i!==void 0?i:{}));const n={dispose:[],get:[],set:[],reset:[]};const s=()=>{var e;r=new Map(Object.entries((e=d(t))!==null&&e!==void 0?e:{}));n.reset.forEach((t=>t()))};const a=()=>{n.dispose.forEach((t=>t()));s()};const o=t=>{n.get.forEach((e=>e(t)));return r.get(t)};const l=(t,i)=>{const s=r.get(t);if(e(i,s,t)){r.set(t,i);n.set.forEach((e=>e(t,i,s)))}};const h=typeof Proxy==="undefined"?{}:new Proxy(i,{get(t,e){return o(e)},ownKeys(t){return Array.from(r.keys())},getOwnPropertyDescriptor(){return{enumerable:true,configurable:true}},has(t,e){return r.has(e)},set(t,e,i){l(e,i);return true}});const c=(t,e)=>{n[t].push(e);return()=>{f(n[t],e)}};const u=(e,i)=>{const r=c("set",((t,r)=>{if(t===e){i(r)}}));const n=c("reset",(()=>i(d(t)[e])));return()=>{r();n()}};const m=(...t)=>{const e=t.reduce(((t,e)=>{if(e.set){t.push(c("set",e.set))}if(e.get){t.push(c("get",e.get))}if(e.reset){t.push(c("reset",e.reset))}if(e.dispose){t.push(c("dispose",e.dispose))}return t}),[]);return()=>e.forEach((t=>t()))};const p=t=>{const e=r.get(t);n.set.forEach((i=>i(t,e,e)))};return{state:h,get:o,set:l,on:c,onChange:u,use:m,dispose:a,reset:s,forceUpdate:p}};const f=(t,e)=>{const i=t.indexOf(e);if(i>=0){t[i]=t[t.length-1];t.length--}};const p=(t,e)=>{const i=m(t,e);i.use(u());return i};const{state:x,onChange:g}=p({step:1,checkoutStep:1,checkoutEdit:false,selectedCategory:null,selectedService:null,selectedProduct:null,cart:[],business:"undefined",options:null,rut:true,rot:true,token:null,user:null,modal:null});g("cart",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-cart`,JSON.stringify(t))}));g("user",(t=>{window.sessionStorage.setItem(`hemfixarna-${x.business}-user`,JSON.stringify(t))}));const b=t=>t.split(" ").reduce(((t,e)=>e.length<2?e:t+e.slice(0,1)+"*".repeat(e.length-2)+e.slice(e.length-1,e.length)+" "),"");const v=class{constructor(t){i(this,t);this.handleSubmit=t=>{t.preventDefault();const e=this.street.length>0;if(!e){this.streetError="Ange en gatuadress"}const i=this.zip.length>0;if(!i){this.zipError="Ange ett postnummer"}const r=this.town.length>0;if(!r){this.townError="Ange en ort"}if(e&&i&&r){x.user=Object.assign(Object.assign({},x.user),{street:this.street,zip:this.zip,town:this.town});x.checkoutStep=2;x.checkoutEdit=false}};this.handleChangeStreet=t=>{this.streetError=null;this.street=this.street===x.user.street?"":t.target.value};this.handleChangeZip=t=>{this.zipError=null;this.zip=this.zip===x.user.zip?"":t.target.value};this.handleChangeTown=t=>{this.townError=null;this.town=this.town===x.user.town?"":t.target.value};this.render=()=>r("form",{class:"hemfixarna_address",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("input",{class:`${this.street.length?"input_active":""}`,onInput:this.handleChangeStreet,type:"text",name:"street",value:this.street===x.user.street?b(this.street):this.street}),r("label",{htmlFor:"street"},"Gatuaddress ")),this.streetError&&r("span",null,this.streetError),r("div",null,r("input",{class:`${this.zip.length?"input_active":""}`,onInput:this.handleChangeZip,type:"tel",name:"zip",value:this.zip===x.user.zip?b(this.zip):this.zip}),r("label",{htmlFor:"zip"},"Postnummer ")),this.zipError&&r("span",null,this.zipError),r("div",null,r("input",{class:`${this.town.length?"input_active":""}`,onInput:this.handleChangeTown,type:"text",name:"town",value:this.town===x.user.town?b(this.town):this.town}),r("label",{htmlFor:"town"},"Ort ")),this.townError&&r("span",null,this.townError),r("input",{type:"submit",value:"Fortsätt och Boka"}));this.street="";this.streetError=null;this.zip="";this.zipError=null;this.town="";this.townError=null}componentWillLoad(){if(x.user){this.street=x.user.street;this.zip=x.user.zip;this.town=x.user.town}}};const _=t=>Math.ceil(t/2);const k=t=>Math.ceil(t*.7);const w=(t,e,i=1)=>{if(t.rot&&x.rot){return k((e||t.price)*i)}else if(t.rut&&x.rut){return _((e||t.price)*i)}else{return(e||t.price)*i}};const y=t=>{if(t.rot){return k(t.price)}else if(t.rut&&x.rut){return _(t.price)}else{return t.price}};const $=(t,e,i=1)=>{if(e.rot&&x.rot){return k(t.price*i)}else if(e.rut&&x.rut){return _(t.price*i)}else{return t.price*i}};const C=()=>{if(!x.cart)return{rut:0,rot:0};const t=x.cart.some((t=>t.rut&&t.start_fee));const e=x.cart.some((t=>t.rot&&t.start_fee));const i=x.rut?_(x.options.start_fee):x.options.start_fee*1;const r=x.rot?k(x.options.start_fee):x.options.start_fee*1;if(t&&e){return{rut:i,rot:r,length:2}}else if(t){return{rut:i,rot:0,length:1}}else if(e){return{rut:0,rot:r,length:1}}else{return{rut:0,rot:0,length:0}}};const T=t=>{const e=t.parts.reduce(((t,e)=>t+e.price*e.amount),0);return w(t,t.price*t.amount+e)};const z=()=>{const t=x.cart.reduce(((t,e)=>e.rot?t+T(e):t),0)+C().rot;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rot?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const S=()=>{const t=x.cart.reduce(((t,e)=>e.rut?t+T(e):t),0)+C().rut;const e=x.cart.reduce(((t,e)=>{const i=e.parts.reduce(((t,e)=>t+e.price*e.amount),0);return e.rut?t+e.price*e.amount+i:t}),0)+Number(x.options.start_fee);return e-t};const j=()=>x.cart.reduce(((t,e)=>t+T(e)),0)+C().rot+C().rut;const O=class{constructor(t){i(this,t);this.post=undefined;this.icon=undefined;this.postTitle=undefined}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.step=4}}}render(){return r("li",{onClick:()=>this.setTaxonomy(this.post)},this.post.icon&&r("img",{class:"hemfixarna_logo",height:82,src:this.icon,alt:this.postTitle}),r("div",null,r("p",null,this.postTitle),x.step===3&&r("p",{class:"price"},"Från ",w(this.post),"kr")))}};const M=class{constructor(t){i(this,t);this.tree=undefined;this.closeModal=undefined}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}handleCartClick(){var t;if((t=x.cart)===null||t===void 0?void 0:t.length){x.step=5}}handleHomePageClick(){x.step=1;setTimeout((()=>{x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null}),200)}render(){const t=n(`./assets/hemfixarna.svg`);const e=n(`./assets/close.svg`);const i=n(`./assets/cart.svg`);const s=n(`./assets/back.svg`);return r("div",null,r("div",{class:"hemfixarna_crumbs"},r("div",{class:"hemfixarna_crumbs--links"},r("img",{onClick:()=>this.handleHomePageClick(),src:t,width:110}),r("img",{onClick:()=>this.closeModal(),class:"close",src:e,width:32}),r("div",null,r("button",{onClick:()=>this.handleHomePageClick()},"Alla tjänster"))),r("div",{onClick:()=>this.handleCartClick(),class:`cart ${this.getCartLength()>0?"cart_active":""}`},r("img",{src:i,width:24}),r("span",null,this.getCartLength()))),[3,4].includes(x.step)&&r("button",{class:"hemfixarna_crumbs--back",onClick:()=>{x.step=x.step===4?3:2}},r("img",{width:24,src:s,alt:"back arrow"}),r("span",null,"Se allt ",x.step===4?x.selectedService.post_title:x.selectedCategory.name)))}};var N;(function(t){t["byggmax"]="byggmax"})(N||(N={}));var I;(function(t){t["byggmax"]="category/bygg"})(I||(I={}));const A="";const L=class{constructor(t){i(this,t);this.tree=null;this.slug=undefined}render(){return r("hemfixarna-component",{slug:this.slug,business:N.byggmax,topCategory:I.byggmax})}};L.style=A;const P=class{constructor(t){i(this,t);this.tree=undefined}render(){const t=n(`./assets/back.svg`);return r("div",{class:"hemfixarna_cart"},r("div",{class:"hemfixarna_cart--left"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Din bokning"),r("hemfixarna-orderrows",{tree:this.tree})),r("div",{class:"hemfixarna_cart--right"},r("h2",null,x.checkoutStep===2&&!x.checkoutEdit&&r("button",{onClick:()=>{x.checkoutStep=1}},r("img",{width:24,src:t,alt:"back arrow"})),"Dina uppgifter"),r("hemfixarna-checkout",null),r("hemfixarna-info",null)))}};const R=class{constructor(t){i(this,t)}setSelectedService(t){x.selectedService=t;x.step=3}render(){return r("div",null,r("h2",null,x.selectedCategory.name),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedCategory.services.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const D=`${"http://hemfixare.se.test"}/wp-json/headless`;const F=async t=>{if(!t){return}const e=t.split("/")[0];const i=t.split("/")[1];try{const t=await fetch(`${D}/${e}/${i}`);return await t.json()}catch(t){console.log(t)}};const K=async()=>{try{const t=await fetch(`${D}/webcoptions`);return await t.json()}catch(t){console.log(t)}};const J=async t=>{try{const e=await fetch(`${D}/weborder`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}});return await e.json()}catch(t){console.log(t)}};const E=class{constructor(t){i(this,t);this.handleChangeDate=t=>{this.dateError=null;this.date=t.target.value};this.handleChangeTerms=()=>{this.generalError=null};this.sendOrder=async()=>{const t={name:x.user.firstName+" "+x.user.lastName,customer:x.business,phone:x.user.phone,social_security_number:x.user.ssn,email:x.user.email,address:`${x.user.street} | ${x.user.zip} | ${x.user.town}`,earliest_visit_date:this.date,order_items:JSON.stringify(x.cart.map((t=>`${t.amount}st ${t.name} ${w(t,t.price,t.amount)}kr ${t.parts.length?`| ${t.parts.map((e=>`${e.amount}st ${e.name} ${$(e,t,e.amount)}kr`)).join(" | ")} `:""} ${t.rot&&x.rot?"(med rot)":x.rut&&t.rut?"(med rut)":"(utan rut/rot)"}`))),start_fee:`${C().rut>0?`Rut: ${C().rut}kr`:"Rut: 0"} `+`${C().rot>0?`Rot: ${C().rot}kr`:"Rot: 0"}`,total:j()};try{const{data:e,status:i}=await J(t);if(e&&i&&i===200){x.step=6}else{this.generalError="Något gick fel, försök igen senare"}}catch(t){this.generalError="Något gick fel, försök igen senare"}};this.handleSubmit=t=>{t.preventDefault();this.generalError=null;const e=this.date.length>0;if(!e){this.dateError="Ange ett giltigt datum"}const i=Array.from(this.el.querySelectorAll('input[type="checkbox"]'));const r=i.find((t=>!t.checked));if(r){this.generalError="Du måste godkänna villkoren"}if(e&&!r){this.sendOrder()}};this.render=()=>{const t=n(`./assets/date.svg`);const e=n(`./assets/down.svg`);if(x.checkoutEdit){return r("hemfixarna-address",null)}else if(x.checkoutStep===1){return r("hemfixarna-getuser",null)}else if(x.checkoutStep===2){return r("div",{class:"mb-2"},r("div",{class:"hemfixarna_addressinfo"},r("div",null,r("p",null,b(x.user.firstName)),r("p",null,b(x.user.lastName)),r("p",null,x.user.email),r("p",null,x.user.phone)),r("div",null,r("p",null,b(x.user.street)),r("p",null,b(x.user.zip)),r("p",null,b(x.user.town))),r("button",{onClick:()=>x.checkoutEdit=true},"Behöver du ändra adressen?")),r("form",{onSubmit:t=>this.handleSubmit(t)},r("div",null,r("img",{src:t,width:24}),r("input",{class:`${this.date.length?"input_active":""}`,min:(new Date).toISOString().split("T")[0],onChange:t=>this.handleChangeDate(t),type:"date",name:"date",value:this.date}),r("label",{htmlFor:"date"},"Tidigaste datum för hembesök"),r("img",{src:e,width:24})),this.dateError&&r("span",null,this.dateError),r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",{innerHTML:x.options.terms})),x.cart.filter((t=>t.terms_checkout&&t.terms_show_checkbox)).map((t=>r(s,null,r("label",{class:"hemfixarna_checkbox"},r("input",{onChange:()=>this.handleChangeTerms(),type:"checkbox"}),r("span",null,t.terms_checkout))))),this.generalError&&r("span",null,this.generalError),r("input",{type:"submit",value:"Slutför Bokning"})))}};this.date="";this.dateError=null;this.generalError=null}componentWillLoad(){if(Boolean(x.user&&x.user.street)){x.checkoutStep=2}}get el(){return a(this)}};const U='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); *{box-sizing:border-box}:host{font-family:"Inter", sans-serif}:host .mb-2{margin-bottom:2rem}:host form{display:flex;flex-direction:column;gap:1rem}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:1rem}:host form img:last-of-type{right:1rem}:host form span{margin-top:-0.5rem;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:1rem;top:50%;transform:translateY(-50%);background:#fff;padding:0.25rem;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:1rem;width:100%;font-size:1rem;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 0.5rem}:host h2{margin:0 0 1.5rem;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:"";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:2.5rem auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:1.5rem;padding:2rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:0.25rem;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:2rem;z-index:99;border-radius:0.25rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:1rem}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:0.5rem 1rem}:host .hemfixarna_addressinfo{padding:1rem 1rem 4rem;border:1px solid #fcd9c9;position:relative;margin-bottom:2rem;display:grid;grid-template-columns:1fr 1fr;gap:0.5rem}:host .hemfixarna_addressinfo button{position:absolute;bottom:1rem;right:1rem;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:1rem;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 0.5rem}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:4rem}:host .hemfixarna_box{padding:1rem;display:flex;align-items:center;justify-content:space-between;background:#fffaf2;border:1px solid #fcd9c9;width:100%;box-sizing:border-box;border-radius:0.25rem;gap:1rem 0.5rem}:host .hemfixarna_box>div{display:grid;gap:0.5rem}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:1rem 2rem;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:1rem 1.5rem}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:0.25rem;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:3rem 2rem 4rem}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order>div:last-of-type{background:#fffaf2;padding:2rem;display:flex;flex-direction:column;max-height:100%;overflow:auto}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:1rem 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:0.2rem}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:1rem;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:1rem;padding:1rem;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-1.5rem}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:1rem;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:0.5rem;padding:1rem 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:1rem}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:1.5rem}:host .hemfixarna_categories--wrapper{gap:2rem;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:0.25rem;min-height:132px;padding:1.5rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:1.5rem;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 2rem 4rem}:host .hemfixarna_content--5{padding-top:1rem}:host .hemfixarna_crumbs{position:relative;padding:1rem 1.5rem;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:1rem 1.5rem 0.5rem;display:flex;align-items:center;gap:0.5rem;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-1rem;top:-1rem;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:1rem;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:1rem;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:4rem;padding:0.75rem 1rem;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:0.75rem !important}:host .hemfixarna_features li{display:flex;gap:1rem;align-items:center}:host .hemfixarna_address{margin-bottom:1rem}:host .hemfixarna_product{display:grid;gap:1rem}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:0.25rem}:host .hemfixarna_product--left{gap:2rem}:host .hemfixarna_product--right{gap:2rem}:host .hemfixarna_product--price{margin-top:0.25rem;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-1rem 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:1rem;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:2rem}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:0.5rem}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:3.5rem}:host input[type=date]{border:1px solid #fcd9c9;padding-left:4rem}:host input[type=checkbox]{height:1.125rem;width:1.125rem;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}';const W=class{constructor(t){i(this,t);this.modal=false;this.showModal=false;this.tree=null;this.product=null;this.slug=undefined;this.business=undefined;this.topCategory=undefined}async fetchNewTaxonomy(t){x.selectedCategory=null;x.selectedProduct=null;x.selectedService=null;const e=await F(t);if((e===null||e===void 0?void 0:e.code)==="not_found"||(e===null||e===void 0?void 0:e.code)==="rest_no_route"){console.log("taxonomy not found")}else if(e){this.setTaxonomy(e);if((e===null||e===void 0?void 0:e.post_type)==="ikea_product"){this.product=e}}}async componentWillLoad(){x.business=this.business;const t=window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);if(t){x.cart=JSON.parse(t)}const e=window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);if(e){x.user=JSON.parse(e)}const i=await F(this.topCategory);if((i===null||i===void 0?void 0:i.code)==="not_found"){console.warn("tree not found")}else if(i){this.tree=i}if(this.slug){const t=await F(this.slug);if((t===null||t===void 0?void 0:t.code)==="not_found"){console.log("taxonomy not found")}else if(t){this.setTaxonomy(t)}}const r=await K();x.options=r}setTaxonomy(t){if(t){if((t===null||t===void 0?void 0:t.taxonomy)==="service_cat"){x.selectedCategory=t;x.step=2}else if((t===null||t===void 0?void 0:t.post_type)==="service"){x.selectedService=t;x.selectedCategory=this.tree.sub_cats.find((e=>e.services.find((e=>e.ID===t.ID))));x.step=3}else if((t===null||t===void 0?void 0:t.post_type)==="ikea_product"){x.selectedProduct=t;x.selectedService=this.tree.sub_cats.map((t=>t.services)).flat().find((t=>t.products.find((t=>t.ID===x.selectedProduct.ID))));x.selectedCategory=this.tree.sub_cats.find((t=>t.services.find((t=>t.ID===x.selectedService.ID))));x.step=4}}}openModal(){this.modal=true;setTimeout((()=>{this.showModal=true}),50)}closeModal(){this.showModal=false;setTimeout((()=>{this.modal=false}),200)}handleClick(t){const e=this.el.shadowRoot.querySelector(".hemfixarna_modal");if(e){const i=e.contains(t.composedPath()[0]);if(!i){this.closeModal()}}const i=this.el.shadowRoot.querySelector(".hemfixarna_infomodal");if(i){const e=i.contains(t.composedPath()[0]);if(!e){x.modal=null}}}getCartLength(){return x.cart.reduce(((t,e)=>t+e.amount),0)}render(){var t,e;const i=n(`./assets/hemfixarna.svg`);return r("div",{class:"hemfixarna"},r("div",{class:"hemfixarna_box"},r("div",null,r("div",null,r("p",null,((t=this.product)===null||t===void 0?void 0:t.post_title)||r("span",null,"Montering/Installation på plats - ",r("strong",null,"se priser här")),this.product&&((e=this.slug)===null||e===void 0?void 0:e.includes("product"))?r("span",null," från"," ",r("strong",null,y(this.product),"kr")):null)),r("img",{src:i,width:104})),r("button",{onClick:()=>this.openModal(),class:"hemfixarna_btn"},"Till montering",this.getCartLength()>0&&r("span",null,this.getCartLength()))),this.modal&&r("div",null,r("div",{class:`hemfixarna_modal ${this.showModal?"hemfixarna_modal--open":""}`},x.modal&&r("div",{class:"hemfixarna_infomodal"},r("h2",null,x.modal.title),x.modal.text.map((t=>r("p",null,t))),r("div",null,r("button",{onClick:()=>x.modal=null},"Stäng"))),this.tree&&r("hemfixarna-breadcrumbs",{closeModal:()=>this.closeModal(),tree:this.tree}),r("div",{class:`hemfixarna_content hemfixarna_content--${x.step}`},x.step===1&&this.tree&&r("hemfixarna-start",{tree:this.tree}),x.step===2&&x.selectedCategory&&r("hemfixarna-category",null),x.step===3&&x.selectedService&&r("hemfixarna-service",null),x.step===4&&x.selectedProduct&&r("hemfixarna-product",null),x.step===5&&r("hemfixarna-cart",{tree:this.tree}),x.step===6&&r("hemfixarna-order",{tree:this.tree}))),r("div",{class:`hemfixarna_backdrop ${this.showModal?"hemfixarna_backdrop--open":""}`})))}static get assetsDirs(){return["assets"]}get el(){return a(this)}static get watchers(){return{slug:["fetchNewTaxonomy"]}}};W.style=U;const B='@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"); :host{font-family:"Inter", sans-serif}:host .hemfixarna_example{margin-bottom:1rem;background:#000;padding:1rem;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-3rem;font-size:16px;left:40%;color:white;padding:0.5rem;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:0.5rem;margin-top:1rem}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:0.5rem}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:0.2rem 0.6rem;border-radius:10px;margin-right:0.5rem;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;background:#9f9da9}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:2rem;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:1rem 2rem;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{background:#000;gap:1px;display:grid}:host>div ul li{padding-left:1rem;background:#fff}';const V=class{constructor(t){i(this,t);this.cdnLink='<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"><\/script>';this.selectedSlug=undefined;this.tooltipText="Kopiera till urklipp";this.tree=null}getTopLevelCategory(){switch("byggmax"){case N.byggmax:return I.byggmax;default:return""}}async componentWillLoad(){const t=await F(this.getTopLevelCategory());if((t===null||t===void 0?void 0:t.code)==="not_found"){console.warn("tree not found")}else if(t){this.tree=t}}getExample(){return`<hemfixarna-${"byggmax"}${this.selectedSlug?` slug="${this.selectedSlug}" `:""}></hemfixarna-${"byggmax"}>`}copyExample(){navigator.clipboard.writeText(this.getExample());this.tooltipText="Snippet kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyCdn(){navigator.clipboard.writeText(this.cdnLink);this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}copyNpmInstall(){navigator.clipboard.writeText("npm i hemfixarna-web-components");this.tooltipText="Text kopierad";setTimeout((()=>{this.tooltipText="Kopiera till urklipp"}),2e3)}render(){const t=n(`./assets/copy.png`);return r("div",null,r("div",null,r("div",{onClick:()=>this.copyExample(),class:"hemfixarna_example"},r("p",null,this.getExample()),r("img",{src:t,height:20}),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText)),"byggmax"===N.byggmax&&r("hemfixarna-byggmax",{slug:this.selectedSlug}),r("div",{class:"hemfixarna_install"},r("div",null,r("a",{target:"_blank",href:"https://www.npmjs.com/package/hemfixarna-web-components"},"Install with npm")),r("div",{onClick:()=>this.copyNpmInstall(),class:"hemfixarna_example"},r("p",null,"npm i hemfixarna-web-components"),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})),r("p",null,"Or use cdn"),r("div",{onClick:()=>this.copyCdn(),class:"hemfixarna_example"},r("p",null,this.cdnLink),r("span",{class:"hemfixarna_example--tooltip"},this.tooltipText),r("img",{src:t,height:20})))),r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label hemfixarna_categories--label--big"},r("div",null,r("p",null,t.name),r("span",null,`category/${t.slug}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`category/${t.slug}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`category/${t.slug}`},"Ladda kategori"))),r("ul",null,t.services.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`service/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`service/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`service/${t.post_name}`},"Ladda kategori"))),r("ul",null,t.products.map((t=>r("li",null,r("div",{class:"hemfixarna_categories--label"},r("div",null,r("p",null,t.post_title),r("span",null,`product/${t.post_name}`)),r("div",null,r("button",{onClick:()=>navigator.clipboard.writeText(`product/${t.post_name}`)},"Kopiera slug"),r("button",{onClick:()=>this.selectedSlug=`product/${t.post_name}`},"Ladda kategori"))))))))))))))))}};V.style=B;var H=class extends Error{constructor(){super("Invalid swedish personal identity number")}};var X=(t,e)=>{const i=t.getTime()-e.getTime();return i<0?-1:i>0?1:i};var Y=(t,e)=>{const i=X(t,e);const r=Math.abs(t.getFullYear()-e.getFullYear());t.setFullYear(t.getFullYear()-i*r);const n=X(t,e)===-i;const s=i*(r-+n);return s===0?0:s};var q=t=>{let e=0;t+="";for(let i=0,r=t.length;i<r;i++){let r=parseInt(t[i]);r*=2-i%2;if(r>9){r-=9}e+=r}return Math.ceil(e/10)*10-e};var G=(t,e,i)=>{e-=1;const r=new Date(t,e,i);return!(r.getFullYear()!==t||r.getMonth()!==e||r.getDate()!==i)};var Z=class{constructor(t,e){this._century="";this._fullYear="";this._year="";this._month="";this._day="";this._sep="";this._num="";this._check="";this.parse(t,{allowCoordinationNumber:true,allowInterimNumber:false,...e})}get century(){return this._century}get fullYear(){return this._fullYear}get year(){return this._year}get month(){return this._month}get day(){return this._day}get sep(){return this._sep}get num(){return this._num}get check(){return this._check}static parse(t,e){return new Z(t,e)}static valid(t,e){try{Z.parse(t,e);return true}catch(t){return false}}parse(t,e){if(t.length<10||t.length>13){throw new H}const i=/^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;const r=i.exec(t);if(!r){throw new H}const n=r[1];const s=r[2];const a=r[3];const o=r[4];const l=r[5];const h=r[6];const c=r[7];if(typeof n==="undefined"||!n.length){const t=new Date;let e=0;if(l==="+"){this._sep="+";e=t.getFullYear()-100}else{this._sep="-";e=t.getFullYear()}this._century=(""+(e-(e-parseInt(s))%100)).substr(0,2)}else{this._century=n;if((new Date).getFullYear()-parseInt(n+s,10)<100){this._sep="-"}else{this._sep="+"}}this._year=s;this._fullYear=this._century+s;this._month=a;this._day=o;this._num=h;this._check=c;if(!this.valid()){throw new H}if(!(e==null?void 0:e.allowCoordinationNumber)&&this.isCoordinationNumber()){throw new H}if(!(e==null?void 0:e.allowInterimNumber)&&this.isInterimNumber()){throw new H}}valid(){const t=q(this.year+this.month+this.day+this.num.replace(/[TRSUWXJKLMN]/,"1"))===+this.check&&!!this.check;if(t&&G(parseInt(this.century+this.year),+this.month,+this.day)){return t}return t&&G(parseInt(this.century+this.year),+this.month,+this.day-60)}format(t=false){if(t){return`${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`}return`${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`}getAge(){const t=this.getDate();return Y(new Date(Date.now()),t)}getDate(){let t=+this.day;if(this.isCoordinationNumber()){t-=60}const e=this.century+this.year+"-"+this.month+"-"+(t<10?"0"+t:t);return new Date(e)}isInterimNumber(){return/[TRSUWXJKLMN]/.test(this.num[0])}isCoordinationNumber(){return G(parseInt(this.century+this.year),+this.month,+this.day-60)}isFemale(){return!this.isMale()}isMale(){const t=parseInt(this.num.substr(-1));return t%2===1}};var Q=Z;function tt(t,e,i){return i={path:e,exports:{},require:function(t,e){return et()}},t(i,i.exports),i.exports}function et(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var it=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.utf8=void 0;e.utf8={encode:i,decode:r};function i(t){t=t.replace(/\r\n/g,"\n");var e="";for(var i=0;i<t.length;i++){var r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r)}else if(r>127&&r<2048){e+=String.fromCharCode(r>>6|192);e+=String.fromCharCode(r&63|128)}else{e+=String.fromCharCode(r>>12|224);e+=String.fromCharCode(r>>6&63|128);e+=String.fromCharCode(r&63|128)}}return e}function r(t){var e="";var i=0;var r=0;var n=0;var s=0;while(i<t.length){r=t.charCodeAt(i);if(r<128){e+=String.fromCharCode(r);i++}else if(r>191&&r<224){n=t.charCodeAt(i+1);e+=String.fromCharCode((r&31)<<6|n&63);i+=2}else{n=t.charCodeAt(i+1);s=t.charCodeAt(i+2);e+=String.fromCharCode((r&15)<<12|(n&63)<<6|s&63);i+=3}}return e}}));var rt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.generate=void 0;function i(t){var e=[];var i;var r;var s;var a;var o;var l;var p;var x;var g;var b=7;var v=12;var _=17;var k=22;var w=5;var y=9;var $=14;var C=20;var T=4;var z=11;var S=16;var j=23;var O=6;var M=10;var N=15;var I=21;var A=it.utf8.encode(t);e=m(A);l=1732584193;p=4023233417;x=2562383102;g=271733878;for(i=0;i<e.length;i+=16){r=l;s=p;a=x;o=g;l=h(l,p,x,g,e[i+0],b,3614090360);g=h(g,l,p,x,e[i+1],v,3905402710);x=h(x,g,l,p,e[i+2],_,606105819);p=h(p,x,g,l,e[i+3],k,3250441966);l=h(l,p,x,g,e[i+4],b,4118548399);g=h(g,l,p,x,e[i+5],v,1200080426);x=h(x,g,l,p,e[i+6],_,2821735955);p=h(p,x,g,l,e[i+7],k,4249261313);l=h(l,p,x,g,e[i+8],b,1770035416);g=h(g,l,p,x,e[i+9],v,2336552879);x=h(x,g,l,p,e[i+10],_,4294925233);p=h(p,x,g,l,e[i+11],k,2304563134);l=h(l,p,x,g,e[i+12],b,1804603682);g=h(g,l,p,x,e[i+13],v,4254626195);x=h(x,g,l,p,e[i+14],_,2792965006);p=h(p,x,g,l,e[i+15],k,1236535329);l=c(l,p,x,g,e[i+1],w,4129170786);g=c(g,l,p,x,e[i+6],y,3225465664);x=c(x,g,l,p,e[i+11],$,643717713);p=c(p,x,g,l,e[i+0],C,3921069994);l=c(l,p,x,g,e[i+5],w,3593408605);g=c(g,l,p,x,e[i+10],y,38016083);x=c(x,g,l,p,e[i+15],$,3634488961);p=c(p,x,g,l,e[i+4],C,3889429448);l=c(l,p,x,g,e[i+9],w,568446438);g=c(g,l,p,x,e[i+14],y,3275163606);x=c(x,g,l,p,e[i+3],$,4107603335);p=c(p,x,g,l,e[i+8],C,1163531501);l=c(l,p,x,g,e[i+13],w,2850285829);g=c(g,l,p,x,e[i+2],y,4243563512);x=c(x,g,l,p,e[i+7],$,1735328473);p=c(p,x,g,l,e[i+12],C,2368359562);l=u(l,p,x,g,e[i+5],T,4294588738);g=u(g,l,p,x,e[i+8],z,2272392833);x=u(x,g,l,p,e[i+11],S,1839030562);p=u(p,x,g,l,e[i+14],j,4259657740);l=u(l,p,x,g,e[i+1],T,2763975236);g=u(g,l,p,x,e[i+4],z,1272893353);x=u(x,g,l,p,e[i+7],S,4139469664);p=u(p,x,g,l,e[i+10],j,3200236656);l=u(l,p,x,g,e[i+13],T,681279174);g=u(g,l,p,x,e[i+0],z,3936430074);x=u(x,g,l,p,e[i+3],S,3572445317);p=u(p,x,g,l,e[i+6],j,76029189);l=u(l,p,x,g,e[i+9],T,3654602809);g=u(g,l,p,x,e[i+12],z,3873151461);x=u(x,g,l,p,e[i+15],S,530742520);p=u(p,x,g,l,e[i+2],j,3299628645);l=d(l,p,x,g,e[i+0],O,4096336452);g=d(g,l,p,x,e[i+7],M,1126891415);x=d(x,g,l,p,e[i+14],N,2878612391);p=d(p,x,g,l,e[i+5],I,4237533241);l=d(l,p,x,g,e[i+12],O,1700485571);g=d(g,l,p,x,e[i+3],M,2399980690);x=d(x,g,l,p,e[i+10],N,4293915773);p=d(p,x,g,l,e[i+1],I,2240044497);l=d(l,p,x,g,e[i+8],O,1873313359);g=d(g,l,p,x,e[i+15],M,4264355552);x=d(x,g,l,p,e[i+6],N,2734768916);p=d(p,x,g,l,e[i+13],I,1309151649);l=d(l,p,x,g,e[i+4],O,4149444226);g=d(g,l,p,x,e[i+11],M,3174756917);x=d(x,g,l,p,e[i+2],N,718787259);p=d(p,x,g,l,e[i+9],I,3951481745);l=n(l,r);p=n(p,s);x=n(x,a);g=n(g,o)}return f(l)+f(p)+f(x)+f(g)}e.generate=i;function r(t,e){return t<<e|t>>>32-e}function n(t,e){var i;var r;var n;var s;var a;n=t&2147483648;s=e&2147483648;i=t&1073741824;r=e&1073741824;a=(t&1073741823)+(e&1073741823);if(i&r){return a^2147483648^n^s}if(i|r){if(a&1073741824){return a^3221225472^n^s}else{return a^1073741824^n^s}}else{return a^n^s}}function s(t,e,i){return t&e|~t&i}function a(t,e,i){return t&i|e&~i}function o(t,e,i){return t^e^i}function l(t,e,i){return e^(t|~i)}function h(t,e,i,a,o,l,h){t=n(t,n(n(s(e,i,a),o),h));return n(r(t,l),e)}function c(t,e,i,s,o,l,h){t=n(t,n(n(a(e,i,s),o),h));return n(r(t,l),e)}function u(t,e,i,s,a,l,h){t=n(t,n(n(o(e,i,s),a),h));return n(r(t,l),e)}function d(t,e,i,s,a,o,h){t=n(t,n(n(l(e,i,s),a),h));return n(r(t,o),e)}function m(t){var e;var i=t.length;var r=i+8;var n=(r-r%64)/64;var s=(n+1)*16;var a=Array(s-1);var o=0;var l=0;while(l<i){e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|t.charCodeAt(l)<<o;l++}e=(l-l%4)/4;o=l%4*8;a[e]=a[e]|128<<o;a[s-2]=i<<3;a[s-1]=i>>>29;return a}function f(t){var e="";var i="";var r;var n;for(n=0;n<=3;n++){r=t>>>n*8&255;i="0"+r.toString(16);e=e+i.substr(i.length-2,2)}return e}}));var nt=tt((function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.MD5=e.generate=void 0;var i=rt;Object.defineProperty(e,"generate",{enumerable:true,get:function(){return i.generate}});e.MD5={generate:rt.generate}}));const st=async t=>{var e;const i=await fetch((e="https://hemfixare-lookup-dev.vercel.app/api")!==null&&e!==void 0?e:"https://hemfixare-lookup.vercel.app/api",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t,hash:nt.MD5.generate(String.fromCharCode(83,101,67,82,101,116)+t)})});const r=await i.json();return r};const at=class{constructor(t){i(this,t);this.handleChangeEmail=t=>{this.emailError=null;this.email=t.target.value};this.handleChangePhone=t=>{this.phoneError=null;this.phone=t.target.value};this.handleChangessn=t=>{this.ssnError=null;this.ssn=t.target.value};this.handleSubmit=async t=>{t.preventDefault();const e=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);const i=e.test(this.email);if(!i){this.emailError="Ange en giltig e-postadress"}const r=this.phone.length>6;if(!r){this.phoneError="Ange ett giltigt telefonnummer"}const n=Q.valid(this.ssn);if(!n){this.ssnError="Ange ett giltigt personnummer"}else if(n){const t=Q.parse(this.ssn).format(true);this.ssn=[t.slice(0,8),"-",t.slice(8)].join("")}if(i&&r&&n){try{const t=await st(this.ssn);if(t){x.checkoutStep=2;x.user=Object.assign(Object.assign({},t),{email:this.email,phone:this.phone,ssn:this.ssn})}else{this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer"}}catch(t){this.ssnError="Vi kunde tyvärr inte hitta en address med ditt angivna personnummer";console.log(t)}}};this.render=()=>r("form",{class:"mb-2",onSubmit:t=>this.handleSubmit(t)},r("div",null,r("input",{class:`${this.email.length?"input_active":""}`,onChange:t=>this.handleChangeEmail(t),type:"email",name:"email",value:this.email}),r("label",{htmlFor:"email"},"E-post ")),this.emailError&&r("span",null,this.emailError),r("div",null,r("input",{class:`${this.phone.length?"input_active":""}`,onChange:t=>this.handleChangePhone(t),type:"tel",name:"phone",value:this.phone}),r("label",{htmlFor:"phone"},"Mobiltelefon ")),this.phoneError&&r("span",null,this.phoneError),r("div",null,r("input",{class:`${this.ssn.length?"input_active":""}`,onChange:t=>this.handleChangessn(t),type:"tel",name:"ssn",value:this.ssn}),r("label",{htmlFor:"phone"},"Personnummer*")),this.ssnError&&r("span",null,this.ssnError),r("input",{type:"submit",value:"Fortsätt och Boka*"}),r("p",null,"*Vi hämtar din adress"));this.email="";this.emailError=null;this.phone="";this.phoneError=null;this.ssn="";this.ssnError=null}componentWillLoad(){if(x.user){this.email=x.user.email;this.phone=x.user.phone;this.ssn=x.user.ssn}}};const ot=class{constructor(t){i(this,t);this.logo=n(`./assets/hemfixarna.svg`);this.checkoutList=[{trust_badge:"Efter att du fyllt i formuläret blir du kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}];this.list=null}getList(){return this.list?this.list:this.checkoutList}render(){const t=n(`./assets/checked.svg`);return r("div",{class:"hemfixarna_info"},x.step<5?r(s,null,r("h2",null,"Vilka är Hemfixarna?"),r("p",null,"Vi fixar allt från krångliga datorer till montering av möbler. Vi finns i hela Sverige och är alltid redo att rycka ut.")):r("h2",null,"Vad händer nu?"),r("ul",{class:"hemfixarna_features"},this.getList().map((e=>r("li",{key:e.trust_badge},r("img",{src:t,alt:"checked"}),r("p",null,e.trust_badge))))),r("img",{src:this.logo,width:200,alt:"hemfixarna"}),r("a",{class:"hemfixarna_product--link",target:"_blank",href:x.options.link.url},x.options.link.title))}};const lt=class{constructor(t){i(this,t);this.render=()=>r("div",{style:{background:`url(${x.options.thank_you_image})`},class:"hemfixarna_order"},r("div",null),r("div",null,r("h2",null,"Tack för din bokning"),r("hemfixarna-orderrows",{tree:this.tree,cart:false}),r("span",{onClick:()=>this.resetShop()},r("button",null,"Gör en ny bokning")),r("hemfixarna-info",{list:[{trust_badge:"Du kommer bli kontaktad av en Hemfixare för bokning av tid."},{trust_badge:"När jobbet är klart kommer du få en faktura med RUT/ROT-avdrag."}]})));this.tree=undefined}resetShop(){x.step=1;x.cart=[];x.selectedCategory=null;x.selectedService=null;x.selectedProduct=null;x.checkoutStep=1}disconnectedCallback(){this.resetShop()}};const ht=class{constructor(t){i(this,t);this.cart=true;this.tree=undefined}goToProduct(t){const e=this.tree.sub_cats.map((t=>t.services)).flat();const i=e.map((t=>t.products)).flat();const r=i.find((e=>e.ID===t));const n=e.find((e=>e.products.find((e=>e.ID===t))));const s=this.tree.sub_cats.find((e=>e.services.find((e=>e.products.find((e=>e.ID===t))))));x.selectedCategory=s;x.selectedService=n;x.selectedProduct=r;x.step=4}openMontering(){x.modal={title:"Monteringsavgift",text:["Monteringsavgiften är en fast avgift som läggs på din beställning. Avgiften täcker kostnader för att montera produkterna du beställer.","Monteringsavgiften debiteras per påbörjat nytt uppdrag. Om du bokar ett uppdrag som både innehåller RUT- och ROT-avdrag så kommer uppdraget att delas upp och således kommer två monteringsavgifter att debiteras och två fakturor att utställas."]}}render(){const t=n(`./assets/info.svg`);return r(s,null,r("ul",{class:"hemfixarna_cart--items"},x.cart.map((t=>{var e;return r("li",{class:"hemfixarna_cart--item"},r("div",null,r("div",null,t.icon&&r("img",{width:30,src:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,alt:t.name}),r("p",null,r("strong",null,t.amount,"x "),t.name)),this.cart&&r("button",{onClick:()=>this.goToProduct(t.id)},"Ändra")),r("p",null,r("strong",null,w(t,t.price,t.amount),"kr")),t.parts.length>0&&r("ul",null,t.parts.map((e=>r("li",null,r("p",null,r("strong",null,e.amount,"x "),e.name),r("p",null,r("strong",null,$(e,t,e.amount),"kr")))))))}))),r("div",{class:"hemfixarna_cart--additional"},C().length>0&&r("div",{class:"hemfixarna_cart--startfee"},r("p",null,C().length,"x"," ",r("strong",{onClick:()=>this.openMontering()},"Monteringsavgift",r("img",{height:16,src:t,alt:"info monteringsavgift"}))),r("p",null,C().rot+C().rut,"kr")),x.cart.find((t=>t.rot))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,this.cart&&r("label",{class:"switch"},r("input",{checked:x.rot,onChange:()=>x.rot=!x.rot,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"ROT-avdrag")),r("p",null,"(-",x.rot?z():0,"kr)")),x.cart.find((t=>t.rut))&&r("div",{class:"hemfixarna_cart--rutrot"},r("div",null,r("label",{class:"switch"},r("input",{onChange:()=>x.rut=!x.rut,checked:x.rut,type:"checkbox"}),r("span",{class:"slider"})),r("p",null,"RUT-avdrag")),r("p",null,"(-",x.rut?S():0,"kr)"))),r("div",{class:"hemfixarna_cart--price"},r("h2",null,"Totalbelopp: "),r("h2",null,j(),"kr")))}};const ct=class{constructor(t){i(this,t);this.amount=0}addProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){t.amount++;x.cart=[...x.cart]}else{x.cart=[...x.cart,{id:x.selectedProduct.ID,rut:x.selectedProduct.rut,rot:x.selectedProduct.rot,amount:1,parts:[],price:x.selectedProduct.price,name:x.selectedProduct.post_title,start_fee:!x.selectedProduct.start_fee,terms_checkout:x.selectedProduct.terms_checkout,terms_show_checkbox:x.selectedProduct.terms_show_checkbox,icon:x.selectedProduct.icon}]}}removeProduct(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t&&t.amount>1){t.amount--;x.cart=[...x.cart]}else{x.cart=x.cart.filter((t=>t.id!==x.selectedProduct.ID))}}addPart(t){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i){i.amount++;e.parts=[...e.parts]}else{e.parts=[...e.parts,{id:t.ID,amount:1,price:t.price,name:t.post_title}]}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}removePart(t){const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.find((e=>e.id===t.ID));if(i&&i.amount>1){i.amount--;e.parts=[...e.parts]}else{e.parts=e.parts.filter((e=>e.id!==t.ID))}x.cart=[...x.cart.filter((t=>t.id!==e.id)),e]}}goToCart(){const t=x.cart.find((t=>t.id===x.selectedProduct.ID));if(t){x.step=5}}getAmount(){var t;return((t=x.cart.find((t=>t.id===x.selectedProduct.ID)))===null||t===void 0?void 0:t.amount)||0}getPartAmount(t){var e;const i=x.cart.find((t=>t.id===x.selectedProduct.ID));return((e=i===null||i===void 0?void 0:i.parts.find((e=>e.id===t)))===null||e===void 0?void 0:e.amount)||0}getTotalPrice(){let t=0;const e=x.cart.find((t=>t.id===x.selectedProduct.ID));if(e){const i=e.parts.reduce(((t,e)=>{const i=x.selectedProduct.parts.find((t=>t.ID===e.id));if(i){return t+i.price*e.amount}return t}),0);t=x.selectedProduct.price*e.amount+i}else{t=x.selectedProduct.price}return w(x.selectedProduct,t)}render(){var t,e,i;const s=n(`./assets/checked.svg`);const a=n(`./assets/plus.svg`);const o=n(`./assets/minus.svg`);return r("div",{class:"hemfixarna_product"},r("div",{class:"hemfixarna_product--top"},x.selectedProduct.icon&&r("img",{width:80,src:(t=x.selectedProduct.icon.url)!==null&&t!==void 0?t:x.selectedProduct.icon,alt:x.selectedProduct.post_title}),r("div",null,r("h1",null,x.selectedProduct.post_title),r("h2",null,"Från: ",w(x.selectedProduct)," kr"))),r("div",{class:"hemfixarna_product--grid"},r("div",{class:"hemfixarna_product--left"},((e=x.selectedProduct.list)===null||e===void 0?void 0:e.length)&&r("ul",{class:"hemfixarna_features"},x.selectedProduct.list.map((t=>r("li",{key:t.bullet},r("img",{src:s,alt:"checked"}),r("p",null,t.bullet))))),r("p",{class:"hemfixarna_terms"},r("strong",null,"OBS! "),r("span",{innerHTML:x.selectedProduct.terms}))),r("div",{class:"hemfixarna_product--right"},r("ul",null,r("li",{class:"hemfixarna_product--item"},r("div",null,r("p",null,"Antal ",x.selectedProduct.post_title),r("p",{class:"hemfixarna_product--price"},w(x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:o,onClick:()=>this.removeProduct()}),r("span",null,this.getAmount()),r("img",{src:a,onClick:()=>this.addProduct()}))),((i=x.selectedProduct.parts)===null||i===void 0?void 0:i.length)&&x.selectedProduct.parts.map((t=>r("li",{class:"hemfixarna_part"},r("div",null,r("p",null,t.post_title),r("p",{class:"hemfixarna_product--price"},$(t,x.selectedProduct),"kr/st")),r("div",{class:"hemfixarna_counter"},r("img",{class:`${this.getPartAmount(t.ID)===0?"disabled":""}`,src:o,onClick:()=>this.removePart(t)}),r("span",null,this.getPartAmount(t.ID)),r("img",{class:`${this.getAmount()===0?"disabled":""}`,src:a,onClick:()=>this.addPart(t)})))))),r("h4",{class:"hemfixarna_product--total"},"Totalt ",this.getTotalPrice()," kr"),r("button",{onClick:()=>this.goToCart(),class:`hemfixarna_buy ${this.getAmount()===0?"disabled":""}`},"Boka"),x.options&&r("hemfixarna-info",{list:x.options.trust}))))}};const ut=class{constructor(t){i(this,t)}setSelectedProduct(t){x.selectedProduct=t;x.step=4}render(){return r("div",null,r("h2",null,x.selectedService.post_title),r("div",{class:"hemfixarna_categories--wrapper"},r("div",null,r("ul",{class:"hemfixarna_categories"},x.selectedService.products.sort(((t,e)=>t.post_title<e.post_title?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.post_title})})))),r("hemfixarna-info",{list:x.options.trust})))}};const dt=class{constructor(t){i(this,t);this.tree=undefined}render(){return r("div",null,r("h2",null,"Alla tjänster"),r("div",{class:"hemfixarna_categories--wrapper"},r("ul",{class:"hemfixarna_categories"},this.tree.sub_cats.sort(((t,e)=>t.name<e.name?-1:1)).map((t=>{var e;return r("hemfixarna-box",{post:t,icon:(e=t.icon.url)!==null&&e!==void 0?e:t.icon,postTitle:t.name})}))),r("hemfixarna-info",{list:x.options.trust})))}};export{v as hemfixarna_address,O as hemfixarna_box,M as hemfixarna_breadcrumbs,L as hemfixarna_byggmax,P as hemfixarna_cart,R as hemfixarna_category,E as hemfixarna_checkout,W as hemfixarna_component,V as hemfixarna_demo,at as hemfixarna_getuser,ot as hemfixarna_info,lt as hemfixarna_order,ht as hemfixarna_orderrows,ct as hemfixarna_product,ut as hemfixarna_service,dt as hemfixarna_start};
|
|
2
|
-
//# sourceMappingURL=p-c05e2af1.entry.js.map
|
|
File without changes
|