hemfixarna-web-components 1.0.1 → 1.0.3
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 +55 -24
- package/dist/cjs/hemfixarna-address_16.cjs.entry.js.map +1 -1
- package/dist/cjs/hemfixarna-components.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +18 -14
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +36 -3
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +10 -7
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -1
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js +9 -4
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -1
- package/dist/collection/store/index.js +2 -0
- package/dist/collection/store/index.js.map +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/collection/utils/api.js +19 -1
- package/dist/collection/utils/api.js.map +1 -1
- package/dist/esm/hemfixarna-address_16.entry.js +55 -24
- package/dist/esm/hemfixarna-address_16.entry.js.map +1 -1
- package/dist/esm/hemfixarna-components.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/p-7c687f55.entry.js +2 -0
- package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +2 -1
- package/dist/types/components/hemfixarna-product/hemfixarna-product.d.ts +1 -0
- package/dist/types/store/index.d.ts +4 -2
- package/dist/types/types/index.d.ts +14 -2
- package/dist/types/utils/api.d.ts +4 -2
- package/package.json +1 -1
- package/dist/hemfixarna-components/p-985ba6dc.entry.js +0 -2
- /package/dist/hemfixarna-components/{p-985ba6dc.entry.js.map → p-7c687f55.entry.js.map} +0 -0
|
@@ -210,6 +210,8 @@ const { state, onChange, } = createStore({
|
|
|
210
210
|
token: null,
|
|
211
211
|
user: null,
|
|
212
212
|
modal: null,
|
|
213
|
+
rutOptions: null,
|
|
214
|
+
rotOptions: null,
|
|
213
215
|
});
|
|
214
216
|
onChange('cart', cart => {
|
|
215
217
|
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
|
@@ -535,6 +537,24 @@ const getOptions = async () => {
|
|
|
535
537
|
console.log(error);
|
|
536
538
|
}
|
|
537
539
|
};
|
|
540
|
+
const getRut = async () => {
|
|
541
|
+
try {
|
|
542
|
+
const res = await fetch(`${base}/rut`);
|
|
543
|
+
return (await res.json());
|
|
544
|
+
}
|
|
545
|
+
catch (error) {
|
|
546
|
+
console.log(error);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const getRot = async () => {
|
|
550
|
+
try {
|
|
551
|
+
const res = await fetch(`${base}/rot`);
|
|
552
|
+
return (await res.json());
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
console.log(error);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
538
558
|
const postOrder = async (data) => {
|
|
539
559
|
try {
|
|
540
560
|
const res = await fetch(`${base}/weborder`, {
|
|
@@ -633,7 +653,7 @@ const HemfixarnaCheckout = class {
|
|
|
633
653
|
get el() { return index.getElement(this); }
|
|
634
654
|
};
|
|
635
655
|
|
|
636
|
-
const hemfixarnaCss = "@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 button{color:#474444}: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}";
|
|
656
|
+
const hemfixarnaCss = "@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 button{color:#474444}: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 p,:host .hemfixarna_infomodal h4{margin:0}: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;gap:0.5rem}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}: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_description{display:grid;gap:1rem}:host .hemfixarna_description ul{list-style:disc;padding-right:0.75rem;transform:translateX(0.75rem)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:8rem;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}: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 1.5rem;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.25rem}: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}";
|
|
637
657
|
|
|
638
658
|
const HemfixarnaComponent = class {
|
|
639
659
|
constructor(hostRef) {
|
|
@@ -678,26 +698,30 @@ const HemfixarnaComponent = class {
|
|
|
678
698
|
if (user) {
|
|
679
699
|
state.user = JSON.parse(user);
|
|
680
700
|
}
|
|
681
|
-
const tree = await
|
|
701
|
+
const [tree, res, options, rut, rot] = await Promise.all([
|
|
702
|
+
getTaxonomy(this.topCategory),
|
|
703
|
+
this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
|
|
704
|
+
getOptions(),
|
|
705
|
+
getRut(),
|
|
706
|
+
getRot(),
|
|
707
|
+
]);
|
|
682
708
|
if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
|
|
683
709
|
console.warn('tree not found');
|
|
684
710
|
}
|
|
685
711
|
else if (tree) {
|
|
686
712
|
this.tree = tree;
|
|
687
713
|
}
|
|
688
|
-
if (
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
this.
|
|
695
|
-
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
|
696
|
-
this.product = res;
|
|
697
|
-
}
|
|
714
|
+
if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
|
|
715
|
+
console.log('taxonomy not found');
|
|
716
|
+
}
|
|
717
|
+
else if (res) {
|
|
718
|
+
this.setTaxonomy(res);
|
|
719
|
+
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
|
720
|
+
this.product = res;
|
|
698
721
|
}
|
|
699
722
|
}
|
|
700
|
-
|
|
723
|
+
state.rotOptions = rot;
|
|
724
|
+
state.rutOptions = rut;
|
|
701
725
|
state.options = options;
|
|
702
726
|
}
|
|
703
727
|
setTaxonomy(taxonomy) {
|
|
@@ -758,7 +782,7 @@ const HemfixarnaComponent = class {
|
|
|
758
782
|
render() {
|
|
759
783
|
var _a, _b;
|
|
760
784
|
const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
|
761
|
-
return (index.h("div", { class: "hemfixarna" }, index.h("div", { class: "hemfixarna_box" }, index.h("div", null, index.h("div", null, index.h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (index.h("span", null, "Montering/Installation p\u00E5 plats - ", index.h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), index.h("img", { src: logo, width: 104 })), index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))), this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p",
|
|
785
|
+
return (index.h("div", { class: "hemfixarna" }, index.h("div", { class: "hemfixarna_box" }, index.h("div", null, index.h("div", null, index.h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (index.h("span", null, "Montering", index.h("wbr", null), "/Installation p\u00E5 plats - ", index.h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), index.h("img", { src: logo, width: 104 })), index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))), this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, state.modal.title && index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), this.tree && index.h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))), index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
|
|
762
786
|
}
|
|
763
787
|
static get assetsDirs() { return ["assets"]; }
|
|
764
788
|
get el() { return index.getElement(this); }
|
|
@@ -1608,13 +1632,16 @@ const HemfixarnaOrderrows = class {
|
|
|
1608
1632
|
state.selectedProduct = product;
|
|
1609
1633
|
state.step = 4;
|
|
1610
1634
|
}
|
|
1611
|
-
|
|
1635
|
+
openRot() {
|
|
1636
|
+
state.modal = {
|
|
1637
|
+
title: state.rotOptions.rot_start_fee_heading,
|
|
1638
|
+
text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
openRut() {
|
|
1612
1642
|
state.modal = {
|
|
1613
|
-
title:
|
|
1614
|
-
text: [
|
|
1615
|
-
'Monteringsavgiften är en fast avgift som läggs på din beställning. Avgiften täcker kostnader för att montera produkterna du beställer.',
|
|
1616
|
-
'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.',
|
|
1617
|
-
],
|
|
1643
|
+
title: state.rutOptions.rut_start_fee_heading,
|
|
1644
|
+
text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],
|
|
1618
1645
|
};
|
|
1619
1646
|
}
|
|
1620
1647
|
render() {
|
|
@@ -1622,7 +1649,7 @@ const HemfixarnaOrderrows = class {
|
|
|
1622
1649
|
return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, state.cart.map(item => {
|
|
1623
1650
|
var _a;
|
|
1624
1651
|
return (index.h("li", { class: "hemfixarna_cart--item" }, index.h("div", null, index.h("div", null, item.icon && index.h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), index.h("p", null, index.h("strong", null, item.amount, "x "), item.name)), this.cart && index.h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), index.h("p", null, index.h("strong", null, getProductPrice(item, item.price, item.amount), "kr")), item.parts.length > 0 && (index.h("ul", null, item.parts.map(part => (index.h("li", null, index.h("p", null, index.h("strong", null, part.amount, "x "), part.name), index.h("p", null, index.h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
|
|
1625
|
-
})), index.h("div", { class: "hemfixarna_cart--additional" }, getStartFee().
|
|
1652
|
+
})), index.h("div", { class: "hemfixarna_cart--additional" }, getStartFee().rot > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rut, "kr"))), state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), index.h("span", { class: "slider" }))), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
|
|
1626
1653
|
}
|
|
1627
1654
|
};
|
|
1628
1655
|
|
|
@@ -1630,6 +1657,7 @@ const HemfixarnaProduct = class {
|
|
|
1630
1657
|
constructor(hostRef) {
|
|
1631
1658
|
index.registerInstance(this, hostRef);
|
|
1632
1659
|
this.amount = 0;
|
|
1660
|
+
this.hideDescription = true;
|
|
1633
1661
|
}
|
|
1634
1662
|
addProduct() {
|
|
1635
1663
|
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
|
@@ -1648,7 +1676,7 @@ const HemfixarnaProduct = class {
|
|
|
1648
1676
|
parts: [],
|
|
1649
1677
|
price: state.selectedProduct.price,
|
|
1650
1678
|
name: state.selectedProduct.post_title,
|
|
1651
|
-
start_fee: !state.selectedProduct.
|
|
1679
|
+
start_fee: !state.selectedProduct.hide_start_fee,
|
|
1652
1680
|
terms_checkout: state.selectedProduct.terms_checkout,
|
|
1653
1681
|
terms_show_checkbox: state.selectedProduct.terms_show_checkbox,
|
|
1654
1682
|
icon: state.selectedProduct.icon,
|
|
@@ -1735,8 +1763,11 @@ const HemfixarnaProduct = class {
|
|
|
1735
1763
|
const checked = index.getAssetPath(`./assets/checked.svg`);
|
|
1736
1764
|
const plus = index.getAssetPath(`./assets/plus.svg`);
|
|
1737
1765
|
const minus = index.getAssetPath(`./assets/minus.svg`);
|
|
1738
|
-
return (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.post_title })), index.h("div", null, index.h("h1", null, state.selectedProduct.post_title), index.h("h2", null, "Fr\u00E5n: ", getProductPrice(state.selectedProduct), " kr"))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), index.h("p", {
|
|
1739
|
-
state.selectedProduct.parts.map(p =>
|
|
1766
|
+
return (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.post_title })), index.h("div", null, index.h("h1", null, state.selectedProduct.post_title), index.h("h2", null, "Fr\u00E5n: ", getProductPrice(state.selectedProduct), " kr"))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), state.selectedProduct.description && (index.h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: state.selectedProduct.description }))), index.h("div", { class: "hemfixarna_product--right" }, index.h("ul", null, index.h("li", { class: "hemfixarna_product--item" }, index.h("div", null, index.h("p", null, "Antal ", state.selectedProduct.post_title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), index.h("span", null, this.getAmount()), index.h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
1767
|
+
state.selectedProduct.parts.map(p => {
|
|
1768
|
+
var _a;
|
|
1769
|
+
return (index.h("li", { class: "hemfixarna_part" }, index.h("div", null, index.h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), index.h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), index.h("span", null, this.getPartAmount(p.ID)), index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
|
|
1770
|
+
})), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", { list: state.options.trust })))));
|
|
1740
1771
|
}
|
|
1741
1772
|
get el() { return index.getElement(this); }
|
|
1742
1773
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-info.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-start.entry.cjs.js","mappings":"
|
|
1
|
+
{"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-info.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-start.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -20,7 +20,7 @@ const patchBrowser = () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
patchBrowser().then(options => {
|
|
23
|
-
return index.bootstrapLazy([["hemfixarna-address_16.cjs",[[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]}]]]], options);
|
|
23
|
+
return index.bootstrapLazy([["hemfixarna-address_16.cjs",[[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],"hideDescription":[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]}]]]], options);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["hemfixarna-address_16.cjs",[[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]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["hemfixarna-address_16.cjs",[[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],"hideDescription":[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]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAssetPath, h } from '@stencil/core';
|
|
2
2
|
import state from '../../store';
|
|
3
|
-
import { getTaxonomy, getOptions } from '../../utils/api';
|
|
3
|
+
import { getTaxonomy, getOptions, getRut, getRot } from '../../utils/api';
|
|
4
4
|
import { getProductPriceWithRotAndRut } from '../../utils/calc';
|
|
5
5
|
import { scrollToTop } from '../../utils/scroll';
|
|
6
6
|
export class HemfixarnaComponent {
|
|
@@ -45,26 +45,30 @@ export class HemfixarnaComponent {
|
|
|
45
45
|
if (user) {
|
|
46
46
|
state.user = JSON.parse(user);
|
|
47
47
|
}
|
|
48
|
-
const tree = await
|
|
48
|
+
const [tree, res, options, rut, rot] = await Promise.all([
|
|
49
|
+
getTaxonomy(this.topCategory),
|
|
50
|
+
this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
|
|
51
|
+
getOptions(),
|
|
52
|
+
getRut(),
|
|
53
|
+
getRot(),
|
|
54
|
+
]);
|
|
49
55
|
if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
|
|
50
56
|
console.warn('tree not found');
|
|
51
57
|
}
|
|
52
58
|
else if (tree) {
|
|
53
59
|
this.tree = tree;
|
|
54
60
|
}
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
-
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
|
63
|
-
this.product = res;
|
|
64
|
-
}
|
|
61
|
+
if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
|
|
62
|
+
console.log('taxonomy not found');
|
|
63
|
+
}
|
|
64
|
+
else if (res) {
|
|
65
|
+
this.setTaxonomy(res);
|
|
66
|
+
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
|
67
|
+
this.product = res;
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
state.rotOptions = rot;
|
|
71
|
+
state.rutOptions = rut;
|
|
68
72
|
state.options = options;
|
|
69
73
|
}
|
|
70
74
|
setTaxonomy(taxonomy) {
|
|
@@ -125,7 +129,7 @@ export class HemfixarnaComponent {
|
|
|
125
129
|
render() {
|
|
126
130
|
var _a, _b;
|
|
127
131
|
const logo = getAssetPath(`./assets/hemfixarna.svg`);
|
|
128
|
-
return (h("div", { class: "hemfixarna" }, h("div", { class: "hemfixarna_box" }, h("div", null, h("div", null, h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (h("span", null, "Montering/Installation p\u00E5 plats - ", h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), h("img", { src: logo, width: 104 })), h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && h("span", null, this.getCartLength()))), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p",
|
|
132
|
+
return (h("div", { class: "hemfixarna" }, h("div", { class: "hemfixarna_box" }, h("div", null, h("div", null, h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (h("span", null, "Montering", h("wbr", null), "/Installation p\u00E5 plats - ", h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), h("img", { src: logo, width: 104 })), h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && h("span", null, this.getCartLength()))), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), this.tree && h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && h("hemfixarna-category", null), state.step === 3 && state.selectedService && h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree }))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
|
|
129
133
|
}
|
|
130
134
|
static get is() { return "hemfixarna-component"; }
|
|
131
135
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AC,EAAE,EAAE,GAAQ,CAC1F,CACP,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h, State, Listen, Element, Watch } from '@stencil/core';\nimport { Business, Category, Product, Service, TopCategory } from '../../types';\nimport state from '../../store';\nimport { getTaxonomy, getOptions } from '../../utils/api';\nimport { getProductPriceWithRotAndRut } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-component',\n styleUrl: 'hemfixarna.scss',\n shadow: true,\n assetsDirs: ['assets'],\n})\nexport class HemfixarnaComponent {\n @State() modal: boolean = false;\n @State() showModal: boolean = false;\n @State() tree: Category | null = null;\n @State() product: Product | null = null;\n\n @Element() private el: HTMLElement;\n\n @Prop() slug: string;\n @Prop() business: Business;\n @Prop() topCategory: TopCategory;\n\n @Watch('slug')\n async watchSlugChange(newValue: string) {\n this.fetchNewTaxonomy(newValue);\n }\n\n async fetchNewTaxonomy(slug: string) {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.selectedService = null;\n\n const res = await getTaxonomy(slug);\n if (res?.code === 'not_found' || res?.code === 'rest_no_route') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n }\n\n async componentWillLoad() {\n state.business = this.business;\n const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);\n if (cart) {\n state.cart = JSON.parse(cart);\n }\n const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);\n if (user) {\n state.user = JSON.parse(user);\n }\n const tree = await getTaxonomy(this.topCategory);\n if (tree?.code === 'not_found') {\n console.warn('tree not found');\n } else if (tree) {\n this.tree = tree;\n }\n if (this.slug) {\n const res = await getTaxonomy(this.slug);\n if (res?.code === 'not_found') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n }\n const options = await getOptions();\n state.options = options;\n }\n\n triggerScrollTotop = () => {\n const el = this.el.shadowRoot.querySelector('.hemfixarna_content');\n scrollToTop(el);\n };\n\n setTaxonomy(taxonomy: Category | Service | Product) {\n if (taxonomy) {\n if ((taxonomy as Category)?.taxonomy === 'service_cat') {\n state.selectedCategory = taxonomy as Category;\n state.step = 2;\n } else if ((taxonomy as Service)?.post_type === 'service') {\n state.selectedService = taxonomy as Service;\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === (taxonomy as Service).ID));\n state.step = 3;\n } else if ((taxonomy as Product)?.post_type === 'ikea_product') {\n state.selectedProduct = taxonomy as Product;\n state.selectedService = this.tree.sub_cats\n .map(c => c.services)\n .flat()\n .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));\n state.step = 4;\n }\n this.triggerScrollTotop();\n }\n }\n\n // Open close modal && click outside event\n openModal() {\n this.modal = true;\n setTimeout(() => {\n this.showModal = true;\n }, 50);\n }\n closeModal() {\n this.showModal = false;\n setTimeout(() => {\n this.modal = false;\n }, 200);\n }\n @Listen('click')\n handleClick(e: Event) {\n const el = this.el.shadowRoot.querySelector('.hemfixarna_modal');\n if (el) {\n const isClickInside = el.contains(e.composedPath()[0] as HTMLInputElement);\n if (!isClickInside) {\n this.closeModal();\n }\n }\n const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');\n if (infomodal) {\n const isClickInside = infomodal.contains(e.composedPath()[0] as HTMLInputElement);\n if (!isClickInside) {\n state.modal = null;\n }\n }\n }\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n\n return (\n <div class=\"hemfixarna\">\n <div class=\"hemfixarna_box\">\n <div>\n <div>\n <p>\n {this.product?.post_title || (\n <span>\n Montering/Installation på plats - <strong>se priser här</strong>\n </span>\n )}\n {this.product && this.slug?.includes('product') ? (\n <span>\n {' från'} <strong>{getProductPriceWithRotAndRut(this.product)}kr</strong>\n </span>\n ) : null}\n </p>\n </div>\n <img src={logo} width={104} />\n </div>\n <button onClick={() => this.openModal()} class=\"hemfixarna_btn\">\n Till montering\n {this.getCartLength() > 0 && <span>{this.getCartLength()}</span>}\n </button>\n </div>\n {this.modal && (\n <div>\n <div class={`hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}`}>\n {state.modal && (\n <div class=\"hemfixarna_infomodal\">\n <h2>{state.modal.title}</h2>\n {state.modal.text.map((t: string) => (\n <p>{t}</p>\n ))}\n <div>\n <button onClick={() => (state.modal = null)}>Stäng</button>\n </div>\n </div>\n )}\n {this.tree && <hemfixarna-breadcrumbs closeModal={() => this.closeModal()} tree={this.tree} />}\n <div class={`hemfixarna_content hemfixarna_content--${state.step}`}>\n {/* // IF AT TOP LEVEL (step 1) */}\n {state.step === 1 && this.tree && <hemfixarna-start tree={this.tree} />}\n {/* // IF SELECTED CATEGORY (step 2) */}\n {state.step === 2 && state.selectedCategory && <hemfixarna-category />}\n {/* // IF SELECTED SERVICE (step 3) */}\n {state.step === 3 && state.selectedService && <hemfixarna-service />}\n {/* // IF SELECTED PRODUCT (step 4) */}\n {state.step === 4 && state.selectedProduct && <hemfixarna-product />}\n {/* // IF CHECKOUT (step 5) */}\n {state.step === 5 && <hemfixarna-cart tree={this.tree} />}\n {/* // IF ORDER CONFIRM (step 6) */}\n {state.step === 6 && <hemfixarna-order tree={this.tree} />}\n </div>\n </div>\n <div class={`hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}`}></div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hemfixarna-component.js","sourceRoot":"","sources":["../../../src/components/hemf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AAK,CAAC,IAAI,uBAAiB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;YAExD,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,wBAAkB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CACtD,CACF;QACN,WAAK,KAAK,EAAE,uBAAuB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,EAAE,GAAQ,CAC1F,CACP,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h, State, Listen, Element, Watch } from '@stencil/core';\nimport { Business, Category, Product, Service, TopCategory } from '../../types';\nimport state from '../../store';\nimport { getTaxonomy, getOptions, getRut, getRot } from '../../utils/api';\nimport { getProductPriceWithRotAndRut } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-component',\n styleUrl: 'hemfixarna.scss',\n shadow: true,\n assetsDirs: ['assets'],\n})\nexport class HemfixarnaComponent {\n @State() modal: boolean = false;\n @State() showModal: boolean = false;\n @State() tree: Category | null = null;\n @State() product: Product | null = null;\n\n @Element() private el: HTMLElement;\n\n @Prop() slug: string;\n @Prop() business: Business;\n @Prop() topCategory: TopCategory;\n\n @Watch('slug')\n async watchSlugChange(newValue: string) {\n this.fetchNewTaxonomy(newValue);\n }\n\n async fetchNewTaxonomy(slug: string) {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.selectedService = null;\n\n const res = await getTaxonomy(slug);\n if (res?.code === 'not_found' || res?.code === 'rest_no_route') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n }\n\n async componentWillLoad() {\n state.business = this.business;\n const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);\n if (cart) {\n state.cart = JSON.parse(cart);\n }\n const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);\n if (user) {\n state.user = JSON.parse(user);\n }\n\n const [tree, res, options, rut, rot] = await Promise.all([\n getTaxonomy(this.topCategory),\n this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),\n getOptions(),\n getRut(),\n getRot(),\n ]);\n\n if (tree?.code === 'not_found') {\n console.warn('tree not found');\n } else if (tree) {\n this.tree = tree;\n }\n\n if (res?.code === 'not_found') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n\n state.rotOptions = rot;\n state.rutOptions = rut;\n state.options = options;\n }\n\n triggerScrollTotop = () => {\n const el = this.el.shadowRoot.querySelector('.hemfixarna_content');\n scrollToTop(el);\n };\n\n setTaxonomy(taxonomy: Category | Service | Product) {\n if (taxonomy) {\n if ((taxonomy as Category)?.taxonomy === 'service_cat') {\n state.selectedCategory = taxonomy as Category;\n state.step = 2;\n } else if ((taxonomy as Service)?.post_type === 'service') {\n state.selectedService = taxonomy as Service;\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === (taxonomy as Service).ID));\n state.step = 3;\n } else if ((taxonomy as Product)?.post_type === 'ikea_product') {\n state.selectedProduct = taxonomy as Product;\n state.selectedService = this.tree.sub_cats\n .map(c => c.services)\n .flat()\n .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));\n state.step = 4;\n }\n this.triggerScrollTotop();\n }\n }\n\n // Open close modal && click outside event\n openModal() {\n this.modal = true;\n setTimeout(() => {\n this.showModal = true;\n }, 50);\n }\n closeModal() {\n this.showModal = false;\n setTimeout(() => {\n this.modal = false;\n }, 200);\n }\n @Listen('click')\n handleClick(e: Event) {\n const el = this.el.shadowRoot.querySelector('.hemfixarna_modal');\n if (el) {\n const isClickInside = el.contains(e.composedPath()[0] as HTMLInputElement);\n if (!isClickInside) {\n this.closeModal();\n }\n }\n const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');\n if (infomodal) {\n const isClickInside = infomodal.contains(e.composedPath()[0] as HTMLInputElement);\n if (!isClickInside) {\n state.modal = null;\n }\n }\n }\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n\n return (\n <div class=\"hemfixarna\">\n <div class=\"hemfixarna_box\">\n <div>\n <div>\n <p>\n {this.product?.post_title || (\n <span>\n Montering\n <wbr />\n /Installation på plats - <strong>se priser här</strong>\n </span>\n )}\n {this.product && this.slug?.includes('product') ? (\n <span>\n {' från'} <strong>{getProductPriceWithRotAndRut(this.product)}kr</strong>\n </span>\n ) : null}\n </p>\n </div>\n <img src={logo} width={104} />\n </div>\n <button onClick={() => this.openModal()} class=\"hemfixarna_btn\">\n Till montering\n {this.getCartLength() > 0 && <span>{this.getCartLength()}</span>}\n </button>\n </div>\n {this.modal && (\n <div>\n <div class={`hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}`}>\n {state.modal && (\n <div class=\"hemfixarna_infomodal\">\n {state.modal.title && <h2>{state.modal.title}</h2>}\n {state.modal.text.map((t: string) => (\n <p innerHTML={t}></p>\n ))}\n <div>\n <button onClick={() => (state.modal = null)}>Stäng</button>\n </div>\n </div>\n )}\n {this.tree && <hemfixarna-breadcrumbs closeModal={() => this.closeModal()} tree={this.tree} />}\n <div class={`hemfixarna_content hemfixarna_content--${state.step}`}>\n {/* // IF AT TOP LEVEL (step 1) */}\n {state.step === 1 && this.tree && <hemfixarna-start tree={this.tree} />}\n {/* // IF SELECTED CATEGORY (step 2) */}\n {state.step === 2 && state.selectedCategory && <hemfixarna-category />}\n {/* // IF SELECTED SERVICE (step 3) */}\n {state.step === 3 && state.selectedService && <hemfixarna-service />}\n {/* // IF SELECTED PRODUCT (step 4) */}\n {state.step === 4 && state.selectedProduct && <hemfixarna-product />}\n {/* // IF CHECKOUT (step 5) */}\n {state.step === 5 && <hemfixarna-cart tree={this.tree} />}\n {/* // IF ORDER CONFIRM (step 6) */}\n {state.step === 6 && <hemfixarna-order tree={this.tree} />}\n </div>\n </div>\n <div class={`hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}`}></div>\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -191,6 +191,10 @@
|
|
|
191
191
|
flex-direction: column;
|
|
192
192
|
gap: 1rem;
|
|
193
193
|
}
|
|
194
|
+
:host .hemfixarna_infomodal p,
|
|
195
|
+
:host .hemfixarna_infomodal h4 {
|
|
196
|
+
margin: 0;
|
|
197
|
+
}
|
|
194
198
|
:host .hemfixarna_infomodal button {
|
|
195
199
|
background: #ec6632;
|
|
196
200
|
color: #fff;
|
|
@@ -204,9 +208,14 @@
|
|
|
204
208
|
position: relative;
|
|
205
209
|
margin-bottom: 2rem;
|
|
206
210
|
display: grid;
|
|
207
|
-
grid-template-columns: 1fr
|
|
211
|
+
grid-template-columns: 1fr;
|
|
208
212
|
gap: 0.5rem;
|
|
209
213
|
}
|
|
214
|
+
@media (min-width: 769px) {
|
|
215
|
+
:host .hemfixarna_addressinfo {
|
|
216
|
+
grid-template-columns: 1fr 1fr;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
210
219
|
:host .hemfixarna_addressinfo button {
|
|
211
220
|
position: absolute;
|
|
212
221
|
bottom: 1rem;
|
|
@@ -238,6 +247,30 @@
|
|
|
238
247
|
transform: scale(1.01);
|
|
239
248
|
box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);
|
|
240
249
|
}
|
|
250
|
+
:host .hemfixarna_description {
|
|
251
|
+
display: grid;
|
|
252
|
+
gap: 1rem;
|
|
253
|
+
}
|
|
254
|
+
:host .hemfixarna_description ul {
|
|
255
|
+
list-style: disc;
|
|
256
|
+
padding-right: 0.75rem;
|
|
257
|
+
transform: translateX(0.75rem);
|
|
258
|
+
}
|
|
259
|
+
:host .hemfixarna_description--hidden {
|
|
260
|
+
max-height: 140px;
|
|
261
|
+
overflow: hidden;
|
|
262
|
+
position: relative;
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
}
|
|
265
|
+
:host .hemfixarna_description--hidden::after {
|
|
266
|
+
content: "";
|
|
267
|
+
position: absolute;
|
|
268
|
+
bottom: 0;
|
|
269
|
+
left: 0;
|
|
270
|
+
right: 0;
|
|
271
|
+
height: 8rem;
|
|
272
|
+
background: linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2);
|
|
273
|
+
}
|
|
241
274
|
:host .hemfixarna_terms {
|
|
242
275
|
font-size: 14px;
|
|
243
276
|
}
|
|
@@ -283,7 +316,7 @@
|
|
|
283
316
|
font-size: 14px;
|
|
284
317
|
background: #c84e18;
|
|
285
318
|
color: #fff;
|
|
286
|
-
padding: 1rem
|
|
319
|
+
padding: 1rem 1.5rem;
|
|
287
320
|
white-space: nowrap;
|
|
288
321
|
position: relative;
|
|
289
322
|
}
|
|
@@ -685,7 +718,7 @@
|
|
|
685
718
|
:host .hemfixarna_product--grid ul {
|
|
686
719
|
display: flex;
|
|
687
720
|
flex-direction: column;
|
|
688
|
-
gap: 0.
|
|
721
|
+
gap: 0.25rem;
|
|
689
722
|
}
|
|
690
723
|
:host .hemfixarna_product p {
|
|
691
724
|
margin: 0;
|
|
@@ -17,13 +17,16 @@ export class HemfixarnaOrderrows {
|
|
|
17
17
|
state.selectedProduct = product;
|
|
18
18
|
state.step = 4;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
openRot() {
|
|
21
21
|
state.modal = {
|
|
22
|
-
title:
|
|
23
|
-
text: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
title: state.rotOptions.rot_start_fee_heading,
|
|
23
|
+
text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
openRut() {
|
|
27
|
+
state.modal = {
|
|
28
|
+
title: state.rutOptions.rut_start_fee_heading,
|
|
29
|
+
text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
render() {
|
|
@@ -31,7 +34,7 @@ export class HemfixarnaOrderrows {
|
|
|
31
34
|
return (h(Fragment, null, h("ul", { class: "hemfixarna_cart--items" }, state.cart.map(item => {
|
|
32
35
|
var _a;
|
|
33
36
|
return (h("li", { class: "hemfixarna_cart--item" }, h("div", null, h("div", null, item.icon && h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), h("p", null, h("strong", null, item.amount, "x "), item.name)), this.cart && h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), h("p", null, h("strong", null, getProductPrice(item, item.price, item.amount), "kr")), item.parts.length > 0 && (h("ul", null, item.parts.map(part => (h("li", null, h("p", null, h("strong", null, part.amount, "x "), part.name), h("p", null, h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
|
|
34
|
-
})), h("div", { class: "hemfixarna_cart--additional" }, getStartFee().
|
|
37
|
+
})), h("div", { class: "hemfixarna_cart--additional" }, getStartFee().rot > 0 && (h("div", { class: "hemfixarna_cart--startfee" }, h("p", null, h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (h("div", { class: "hemfixarna_cart--startfee" }, h("p", null, h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), h("p", null, getStartFee().rut, "kr"))), state.cart.find((item) => item.rot) && (h("div", { class: "hemfixarna_cart--rutrot" }, h("div", null, this.cart && (h("label", { class: "switch" }, h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), h("span", { class: "slider" }))), h("p", null, "ROT-avdrag")), h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (h("div", { class: "hemfixarna_cart--rutrot" }, h("div", null, h("label", { class: "switch" }, h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), h("span", { class: "slider" })), h("p", null, "RUT-avdrag")), h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)")))), h("div", { class: "hemfixarna_cart--price" }, h("h2", null, "Totalbelopp: "), h("h2", null, getTotalPrice(), "kr"))));
|
|
35
38
|
}
|
|
36
39
|
static get is() { return "hemfixarna-orderrows"; }
|
|
37
40
|
static get properties() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hemfixarna-orderrows.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-orderrows/hemfixarna-orderrows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOzH,MAAM,OAAO,mBAAmB;;gBACN,IAAI;;;EAG5B,WAAW,CAAC,EAAU;IACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5E,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,MAAM,OAAO,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,GAAQ,CACtB,CACT;YACD,0BAAiB,CACb;UACN;;YAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;kBAAQ,CACxC,CACP;QACA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAChD,WAAK,KAAK,EAAC,yBAAyB;UAClC;YACE,aAAO,KAAK,EAAC,QAAQ;cACnB,aAAO,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAC,UAAU,GAAG;cACvF,YAAM,KAAK,EAAC,QAAQ,GAAQ,CACtB;YACR,0BAAiB,CACb;UACN;;YAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;kBAAQ,CACxC,CACP,CACG;MACN,WAAK,KAAK,EAAC,wBAAwB;QACjC,8BAAsB;QACtB;UAAK,aAAa,EAAE;eAAQ,CACxB,CACG,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Fragment, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { calculateRot, calculateRut, getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';\nimport { CartItem, Category, Icon } from '../../types';\n\n@Component({\n tag: 'hemfixarna-orderrows',\n shadow: false,\n})\nexport class HemfixarnaOrderrows {\n @Prop() cart: boolean = true;\n @Prop() tree: Category;\n\n goToProduct(id: number) {\n const services = this.tree.sub_cats.map((c: Category) => c.services).flat();\n const products = services.map((s: any) => s.products).flat();\n const product = products.find((p: any) => p.ID === id);\n const service = services.find((s: any) => s.products.find((p: any) => p.ID === id));\n const category = this.tree.sub_cats.find((c: any) => c.services.find((s: any) => s.products.find((p: any) => p.ID === id)));\n state.selectedCategory = category;\n state.selectedService = service;\n state.selectedProduct = product;\n state.step = 4;\n }\n\n openRot() {\n state.modal = {\n title: state.rotOptions.rot_start_fee_heading,\n text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],\n };\n }\n\n openRut() {\n state.modal = {\n title: state.rutOptions.rut_start_fee_heading,\n text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],\n };\n }\n\n render() {\n const info = getAssetPath(`./assets/info.svg`);\n\n return (\n <Fragment>\n <ul class=\"hemfixarna_cart--items\">\n {state.cart.map(item => (\n <li class=\"hemfixarna_cart--item\">\n <div>\n <div>\n {item.icon && <img width={30} src={(item.icon as Icon).url ?? (item.icon as string)} alt={item.name} />}\n <p>\n <strong>{item.amount}x </strong>\n {item.name}\n </p>\n </div>\n {this.cart && <button onClick={() => this.goToProduct(item.id)}>Ändra</button>}\n </div>\n <p>\n <strong>{getProductPrice(item, item.price, item.amount)}kr</strong>\n </p>\n {item.parts.length > 0 && (\n <ul>\n {item.parts.map(part => (\n <li>\n <p>\n <strong>{part.amount}x </strong>\n {part.name}\n </p>\n <p>\n <strong>{getPartPrice(part, item, part.amount)}kr</strong>\n </p>\n </li>\n ))}\n </ul>\n )}\n </li>\n ))}\n </ul>\n <div class=\"hemfixarna_cart--additional\">\n {getStartFee().rot > 0 && (\n <div class=\"hemfixarna_cart--startfee\">\n <p>\n <strong onClick={() => this.openRot()}>\n {state.rotOptions.rot_start_fee_heading}\n <img height={16} src={info} alt=\"info monteringsavgift\" />\n </strong>\n </p>\n <p>{getStartFee().rot}kr</p>\n </div>\n )}\n {getStartFee().rut > 0 && (\n <div class=\"hemfixarna_cart--startfee\">\n <p>\n <strong onClick={() => this.openRut()}>\n {state.rutOptions.rut_start_fee_heading}\n <img height={16} src={info} alt=\"info monteringsavgift\" />\n </strong>\n </p>\n <p>{getStartFee().rut}kr</p>\n </div>\n )}\n {state.cart.find((item: CartItem) => item.rot) && (\n <div class=\"hemfixarna_cart--rutrot\">\n <div>\n {this.cart && (\n <label class=\"switch\">\n <input checked={state.rot} onChange={() => (state.rot = !state.rot)} type=\"checkbox\" />\n <span class=\"slider\"></span>\n </label>\n )}\n <p>ROT-avdrag</p>\n </div>\n <p>(-{state.rot ? calculateRot() : 0}kr)</p>\n </div>\n )}\n {state.cart.find((item: CartItem) => item.rut) && (\n <div class=\"hemfixarna_cart--rutrot\">\n <div>\n <label class=\"switch\">\n <input onChange={() => (state.rut = !state.rut)} checked={state.rut} type=\"checkbox\" />\n <span class=\"slider\"></span>\n </label>\n <p>RUT-avdrag</p>\n </div>\n <p>(-{state.rut ? calculateRut() : 0}kr)</p>\n </div>\n )}\n </div>\n <div class=\"hemfixarna_cart--price\">\n <h2>Totalbelopp: </h2>\n <h2>{getTotalPrice()}kr</h2>\n </div>\n </Fragment>\n );\n }\n}\n"]}
|