hemfixarna-web-components 1.8.5 → 1.8.7
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_15.cjs.entry.js +2180 -0
- package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js +27 -0
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-category.cjs.entry.js +28 -0
- package/dist/cjs/hemfixarna-category.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-components.cjs.js +28 -0
- package/dist/cjs/hemfixarna-components.cjs.js.map +1 -0
- package/dist/cjs/hemfixarna-doro.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-doro.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-elfa.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-elfa.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-fargvaruhuset.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-fargvaruhuset.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-flyttsmart.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-flyttsmart.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-forebygg.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-forebygg.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-hornbach.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-hornbach.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-kbygg.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-kbygg.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-klint.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-klint.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-kund.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-kund.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-norrgavel.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-norrgavel.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-power.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-power.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-service.cjs.entry.js +24 -0
- package/dist/cjs/hemfixarna-service.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-skanska.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-skanska.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-sparfonster.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-sparfonster.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-string-furniture.cjs.entry.js +26 -0
- package/dist/cjs/hemfixarna-string-furniture.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-superfront.cjs.entry.js +24 -0
- package/dist/cjs/hemfixarna-superfront.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-tesla.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-tesla.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-traningspartner.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-traningspartner.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-zaptec.cjs.entry.js +23 -0
- package/dist/cjs/hemfixarna-zaptec.cjs.entry.js.map +1 -0
- package/dist/cjs/index-6cce99a1.js +264 -0
- package/dist/cjs/index-6cce99a1.js.map +1 -0
- package/dist/cjs/index-dc8e80e4.js +53 -0
- package/dist/cjs/index-dc8e80e4.js.map +1 -0
- package/dist/cjs/index-e6926623.js +1741 -0
- package/dist/cjs/index-e6926623.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +24 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/assets/back.svg +3 -0
- package/dist/collection/assets/cart.svg +10 -0
- package/dist/collection/assets/checked.svg +10 -0
- package/dist/collection/assets/close.svg +5 -0
- package/dist/collection/assets/copy.png +0 -0
- package/dist/collection/assets/date.svg +6 -0
- package/dist/collection/assets/down.svg +3 -0
- package/dist/collection/assets/drag-drop.svg +3 -0
- package/dist/collection/assets/elfa.png +0 -0
- package/dist/collection/assets/gubbe-pensel.svg +1 -0
- package/dist/collection/assets/hemfixarna.svg +11 -0
- package/dist/collection/assets/hornbach/logo.svg +42 -0
- package/dist/collection/assets/hornbach/nav.jpg +0 -0
- package/dist/collection/assets/info.svg +5 -0
- package/dist/collection/assets/kbygg.svg +29 -0
- package/dist/collection/assets/minus.svg +4 -0
- package/dist/collection/assets/montering.svg +15 -0
- package/dist/collection/assets/norrgavel.svg +1 -0
- package/dist/collection/assets/pensel.svg +1 -0
- package/dist/collection/assets/plus.svg +5 -0
- package/dist/collection/assets/spinner.gif +0 -0
- package/dist/collection/assets/tesla.svg +1 -0
- package/dist/collection/assets/zaptec.svg +1 -0
- package/dist/collection/collection-manifest.json +47 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +122 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.css +0 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +104 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.css +0 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +104 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +94 -0
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +94 -0
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.css +0 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +104 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.css +0 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +104 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +94 -0
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +94 -0
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +94 -0
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +94 -0
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +94 -0
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +104 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +94 -0
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +104 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string.css +0 -0
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +113 -0
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +94 -0
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +94 -0
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +94 -0
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-address.entry.js → collection/components/hemfixarna-address/hemfixarna-address.js} +20 -14
- package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +1 -0
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +138 -0
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-breadcrumbs.entry.js → collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js} +28 -13
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-cart.entry.js → collection/components/hemfixarna-cart/hemfixarna-cart.js} +6 -12
- package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -0
- package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js +18 -0
- package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-checkout.entry.js → collection/components/hemfixarna-checkout/hemfixarna-checkout.js} +26 -33
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +330 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +1061 -0
- package/dist/{hemfixarna-components/hemfixarna-contact.entry.js → collection/components/hemfixarna-contact/hemfixarna-contact.js} +29 -11
- package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +1 -0
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +135 -0
- package/dist/{hemfixarna-components/hemfixarna-demo.entry.js → collection/components/hemfixarna-demo/hemfixarna-demo.js} +46 -21
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -0
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +91 -0
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-info.entry.js → collection/components/hemfixarna-info/hemfixarna-info.js} +7 -11
- package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -0
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.css +76 -0
- package/dist/{hemfixarna-components/hemfixarna-invoice.entry.js → collection/components/hemfixarna-invoice/hemfixarna-invoice.js} +27 -16
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-order.entry.js → collection/components/hemfixarna-order/hemfixarna-order.js} +7 -11
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-orderrows.entry.js → collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js} +30 -12
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -0
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
- package/dist/{hemfixarna-components/hemfixarna-product.entry.js → collection/components/hemfixarna-product/hemfixarna-product.js} +27 -18
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -0
- package/dist/collection/components/hemfixarna-service/hemfixarna-service.js +14 -0
- package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-start.entry.js → collection/components/hemfixarna-start/hemfixarna-start.js} +48 -11
- package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/store/index.js +69 -0
- package/dist/collection/store/index.js.map +1 -0
- package/dist/collection/types/felixtypes.js +3 -0
- package/dist/collection/types/felixtypes.js.map +1 -0
- package/dist/collection/types/index.js +50 -0
- package/dist/collection/types/index.js.map +1 -0
- package/dist/{hemfixarna-components/api-e3c51cb3.js → collection/utils/api.js} +4 -7
- package/dist/collection/utils/api.js.map +1 -0
- package/dist/{hemfixarna-components/calc-b3b6593c.js → collection/utils/calc.js} +3 -6
- package/dist/collection/utils/calc.js.map +1 -0
- package/dist/collection/utils/creditSafe.js +18 -0
- package/dist/collection/utils/creditSafe.js.map +1 -0
- package/dist/{hemfixarna-components/enviroment-fd0a763a.js → collection/utils/enviroment.js} +6 -8
- package/dist/collection/utils/enviroment.js.map +1 -0
- package/dist/collection/utils/felixApi.js +19 -0
- package/dist/collection/utils/felixApi.js.map +1 -0
- package/dist/collection/utils/felixFunctions.js +188 -0
- package/dist/collection/utils/felixFunctions.js.map +1 -0
- package/dist/{hemfixarna-components/form-c53dca29.js → collection/utils/form.js} +2 -4
- package/dist/collection/utils/form.js.map +1 -0
- package/dist/{hemfixarna-components/scroll-6c26b5da.js → collection/utils/scroll.js} +2 -4
- package/dist/collection/utils/scroll.js.map +1 -0
- package/dist/{hemfixarna-components/types-6da209ae.js → collection/utils/types.js} +3 -6
- package/dist/collection/utils/types.js.map +1 -0
- package/dist/esm/hemfixarna-address_15.entry.js +2162 -0
- package/dist/esm/hemfixarna-address_15.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-byggmax.entry.js +2 -2
- package/dist/esm/hemfixarna-byggmax.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-category.entry.js +2 -2
- package/dist/esm/hemfixarna-category.entry.js.map +1 -0
- package/dist/esm/hemfixarna-components.js +23 -0
- package/dist/esm/hemfixarna-components.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-doro.entry.js +2 -2
- package/dist/esm/hemfixarna-doro.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-elfa.entry.js +2 -2
- package/dist/esm/hemfixarna-elfa.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-fargvaruhuset.entry.js +2 -2
- package/dist/esm/hemfixarna-fargvaruhuset.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-flyttsmart.entry.js +2 -2
- package/dist/esm/hemfixarna-flyttsmart.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-forebygg.entry.js +2 -2
- package/dist/esm/hemfixarna-forebygg.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-hornbach.entry.js +2 -2
- package/dist/esm/hemfixarna-hornbach.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-kbygg.entry.js +2 -2
- package/dist/esm/hemfixarna-kbygg.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-klint.entry.js +2 -2
- package/dist/esm/hemfixarna-klint.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-kund.entry.js +2 -2
- package/dist/esm/hemfixarna-kund.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-norrgavel.entry.js +2 -2
- package/dist/esm/hemfixarna-norrgavel.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-power.entry.js +2 -2
- package/dist/esm/hemfixarna-power.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-service.entry.js +2 -2
- package/dist/esm/hemfixarna-service.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-skanska.entry.js +2 -2
- package/dist/esm/hemfixarna-skanska.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-sparfonster.entry.js +2 -2
- package/dist/esm/hemfixarna-sparfonster.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-string-furniture.entry.js +2 -2
- package/dist/esm/hemfixarna-string-furniture.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-superfront.entry.js +2 -2
- package/dist/esm/hemfixarna-superfront.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-tesla.entry.js +2 -2
- package/dist/esm/hemfixarna-tesla.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-traningspartner.entry.js +2 -2
- package/dist/esm/hemfixarna-traningspartner.entry.js.map +1 -0
- package/dist/{hemfixarna-components → esm}/hemfixarna-zaptec.entry.js +2 -2
- package/dist/esm/hemfixarna-zaptec.entry.js.map +1 -0
- package/dist/{hemfixarna-components/index-c8ce6f4b.js → esm/index-17dff2be.js} +5 -1
- package/dist/esm/index-17dff2be.js.map +1 -0
- package/dist/{hemfixarna-components/index-21ba2b05.js → esm/index-20d4c934.js} +5 -6
- package/dist/esm/index-20d4c934.js.map +1 -0
- package/dist/esm/index-ea1d222e.js +1710 -0
- package/dist/esm/index-ea1d222e.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +20 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -162
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/hemfixarna-components/index.esm.js +0 -1
- package/dist/hemfixarna-components/index.esm.js.map +1 -1
- package/dist/hemfixarna-components/p-13c814e5.entry.js +2 -0
- package/dist/hemfixarna-components/p-13c814e5.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-22402dcd.entry.js +2 -0
- package/dist/hemfixarna-components/p-22402dcd.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-2af882e6.entry.js +2 -0
- package/dist/hemfixarna-components/p-2af882e6.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-3038b208.entry.js +2 -0
- package/dist/hemfixarna-components/p-3038b208.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-45ab00f1.entry.js +2 -0
- package/dist/hemfixarna-components/p-45ab00f1.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-5c9563b4.entry.js +2 -0
- package/dist/hemfixarna-components/p-5c9563b4.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-6bd272c5.entry.js +2 -0
- package/dist/hemfixarna-components/p-6bd272c5.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-6e20e1b0.js +2 -0
- package/dist/hemfixarna-components/p-6e20e1b0.js.map +1 -0
- package/dist/hemfixarna-components/p-7b495586.entry.js +2 -0
- package/dist/hemfixarna-components/p-7b495586.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-7c0e45f5.entry.js +2 -0
- package/dist/hemfixarna-components/p-7c0e45f5.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-7cb8e61f.entry.js +2 -0
- package/dist/hemfixarna-components/p-7cb8e61f.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-7df046a3.entry.js +2 -0
- package/dist/hemfixarna-components/p-7df046a3.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-81571614.entry.js +2 -0
- package/dist/hemfixarna-components/p-81571614.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-82273497.entry.js +2 -0
- package/dist/hemfixarna-components/p-82273497.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-8b7e8357.entry.js +2 -0
- package/dist/hemfixarna-components/p-8b7e8357.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-9c484473.entry.js +2 -0
- package/dist/hemfixarna-components/p-9c484473.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-9cf1fb6b.entry.js +2 -0
- package/dist/hemfixarna-components/p-9cf1fb6b.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-b115aec3.entry.js +2 -0
- package/dist/hemfixarna-components/p-b115aec3.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-c707b937.js +3 -0
- package/dist/hemfixarna-components/p-c707b937.js.map +1 -0
- package/dist/hemfixarna-components/p-cdc0d010.js +2 -0
- package/dist/hemfixarna-components/p-cdc0d010.js.map +1 -0
- package/dist/hemfixarna-components/p-de0582a4.entry.js +2 -0
- package/dist/hemfixarna-components/p-de0582a4.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-e162b027.entry.js +2 -0
- package/dist/hemfixarna-components/p-e162b027.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-ea31b5fc.entry.js +2 -0
- package/dist/hemfixarna-components/p-ea31b5fc.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-f9fdaa51.entry.js +2 -0
- package/dist/hemfixarna-components/p-f9fdaa51.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-fe40c699.entry.js +2 -0
- package/dist/hemfixarna-components/p-fe40c699.entry.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/types/index.d.ts +5 -1
- package/package.json +1 -1
- package/dist/hemfixarna-components/api-e3c51cb3.js.map +0 -1
- package/dist/hemfixarna-components/app-globals-0f993ce5.js +0 -5
- package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +0 -1
- package/dist/hemfixarna-components/calc-b3b6593c.js.map +0 -1
- package/dist/hemfixarna-components/css-shim-4fde41f0.js +0 -6
- package/dist/hemfixarna-components/css-shim-4fde41f0.js.map +0 -1
- package/dist/hemfixarna-components/dom-8de30773.js +0 -75
- package/dist/hemfixarna-components/dom-8de30773.js.map +0 -1
- package/dist/hemfixarna-components/enviroment-fd0a763a.js.map +0 -1
- package/dist/hemfixarna-components/form-c53dca29.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-box.entry.js +0 -49
- package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-component.entry.js +0 -189
- package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-contact.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-doro.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-elfa.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +0 -770
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-invoice.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-klint.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-kund.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-orderrows.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-power.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-skanska.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-superfront.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-tesla.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js.map +0 -1
- package/dist/hemfixarna-components/index-21ba2b05.js.map +0 -1
- package/dist/hemfixarna-components/index-2ce8b901.js +0 -3461
- package/dist/hemfixarna-components/index-2ce8b901.js.map +0 -1
- package/dist/hemfixarna-components/index-c8ce6f4b.js.map +0 -1
- package/dist/hemfixarna-components/scroll-6c26b5da.js.map +0 -1
- package/dist/hemfixarna-components/shadow-css-af2290df.js +0 -389
- package/dist/hemfixarna-components/shadow-css-af2290df.js.map +0 -1
- package/dist/hemfixarna-components/types-6da209ae.js.map +0 -1
@@ -0,0 +1,2180 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-e6926623.js');
|
6
|
+
const index$1 = require('./index-6cce99a1.js');
|
7
|
+
const index$2 = require('./index-dc8e80e4.js');
|
8
|
+
|
9
|
+
const hideField = (field) => {
|
10
|
+
return field.split(' ').reduce((acc, curr) => {
|
11
|
+
if (curr.length <= 2) {
|
12
|
+
return acc + curr.slice(0, 1) + '* ';
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
return acc + curr.slice(0, 1) + '*'.repeat(curr.length - 2) + curr.slice(-1) + ' ';
|
16
|
+
}
|
17
|
+
}, '');
|
18
|
+
};
|
19
|
+
|
20
|
+
const scrollToTop = (el) => {
|
21
|
+
if (!el)
|
22
|
+
return;
|
23
|
+
el.scrollTo({
|
24
|
+
top: 0,
|
25
|
+
behavior: 'smooth',
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
const HemfixarnaAddress = class {
|
30
|
+
constructor(hostRef) {
|
31
|
+
index.registerInstance(this, hostRef);
|
32
|
+
this.handleSubmit = (e) => {
|
33
|
+
e.preventDefault();
|
34
|
+
const streetValid = this.street.length > 0;
|
35
|
+
if (!streetValid) {
|
36
|
+
this.streetError = 'Ange en gatuadress';
|
37
|
+
}
|
38
|
+
const zipValid = this.zip.length > 0;
|
39
|
+
const zipIsNumber = /^\s*\d[\d\s]*$/.test(this.zip);
|
40
|
+
if (!zipIsNumber) {
|
41
|
+
this.zipError = 'Postnummer får endast innehålla siffror';
|
42
|
+
}
|
43
|
+
if (!zipValid) {
|
44
|
+
this.zipError = 'Ange ett postnummer';
|
45
|
+
}
|
46
|
+
const townValid = /^[^\d\s]{2,}$/.test(this.town);
|
47
|
+
if (!townValid) {
|
48
|
+
this.townError = 'Ange en ort';
|
49
|
+
}
|
50
|
+
if (streetValid && zipValid && townValid && zipIsNumber) {
|
51
|
+
index$1.state.user = Object.assign(Object.assign({}, index$1.state.user), { street: this.street, zip: this.zip, town: this.town });
|
52
|
+
index$1.state.checkoutStep = 2;
|
53
|
+
index$1.state.checkoutEdit = false;
|
54
|
+
const el = this.el.closest('.hemfixarna_content');
|
55
|
+
scrollToTop(el);
|
56
|
+
}
|
57
|
+
};
|
58
|
+
this.handleChangeStreet = (e) => {
|
59
|
+
this.streetError = null;
|
60
|
+
this.street = this.street === index$1.state.user.street ? '' : e.target.value;
|
61
|
+
};
|
62
|
+
this.handleChangeZip = (e) => {
|
63
|
+
this.zipError = null;
|
64
|
+
this.zip = this.zip === index$1.state.user.zip ? '' : e.target.value;
|
65
|
+
};
|
66
|
+
this.handleChangeTown = (e) => {
|
67
|
+
this.townError = null;
|
68
|
+
this.town = this.town === index$1.state.user.town ? '' : e.target.value;
|
69
|
+
};
|
70
|
+
this.render = () => {
|
71
|
+
return (index.h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === index$1.state.user.street ? hideField(this.street) : this.street }), index.h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && index.h("span", null, this.streetError), index.h("div", null, index.h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === index$1.state.user.zip ? hideField(this.zip) : this.zip }), index.h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && index.h("span", null, this.zipError), index.h("div", null, index.h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === index$1.state.user.town ? hideField(this.town) : this.town }), index.h("label", { htmlFor: "town" }, "Ort ")), this.townError && index.h("span", null, this.townError), index.h("input", { type: "submit", value: "Forts\u00E4tt" })));
|
72
|
+
};
|
73
|
+
this.street = '';
|
74
|
+
this.streetError = null;
|
75
|
+
this.zip = '';
|
76
|
+
this.zipError = null;
|
77
|
+
this.town = '';
|
78
|
+
this.townError = null;
|
79
|
+
}
|
80
|
+
componentWillLoad() {
|
81
|
+
if (index$1.state.user) {
|
82
|
+
this.street = index$1.state.user.street;
|
83
|
+
this.zip = index$1.state.user.zip;
|
84
|
+
this.town = index$1.state.user.town;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
get el() { return index.getElement(this); }
|
88
|
+
};
|
89
|
+
|
90
|
+
const getRutPrice = (price) => {
|
91
|
+
return Math.ceil(price / 2);
|
92
|
+
};
|
93
|
+
const getRotPrice = (price) => {
|
94
|
+
return Math.ceil(price / 2);
|
95
|
+
};
|
96
|
+
const getGreenPrice = (price) => {
|
97
|
+
return Math.ceil(price * 0.5);
|
98
|
+
};
|
99
|
+
const getProductPrice = (product, price, amount = 1) => {
|
100
|
+
if (product.rot && index$1.state.rot) {
|
101
|
+
return getRotPrice((price || product.price) * amount);
|
102
|
+
}
|
103
|
+
else if (product.rut && index$1.state.rut) {
|
104
|
+
return getRutPrice((price || product.price) * amount);
|
105
|
+
}
|
106
|
+
else if (product.green && index$1.state.green) {
|
107
|
+
return getGreenPrice((price || product.price) * amount);
|
108
|
+
}
|
109
|
+
else {
|
110
|
+
return (price || product.price) * amount;
|
111
|
+
}
|
112
|
+
};
|
113
|
+
const getProductPriceWithRotAndRut = (product) => {
|
114
|
+
if (product.rot) {
|
115
|
+
return getRotPrice(product.price);
|
116
|
+
}
|
117
|
+
else if (product.rut && index$1.state.rut) {
|
118
|
+
return getRutPrice(product.price);
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
return product.price;
|
122
|
+
}
|
123
|
+
};
|
124
|
+
const getPartPrice = (part, product, amount = 1) => {
|
125
|
+
if (product.rot && index$1.state.rot) {
|
126
|
+
return getRotPrice(part.price * amount);
|
127
|
+
}
|
128
|
+
else if (product.rut && index$1.state.rut) {
|
129
|
+
return getRutPrice(part.price * amount);
|
130
|
+
}
|
131
|
+
else if (product.green && index$1.state.green) {
|
132
|
+
return getGreenPrice(part.price * amount);
|
133
|
+
}
|
134
|
+
else {
|
135
|
+
return part.price * amount;
|
136
|
+
}
|
137
|
+
};
|
138
|
+
const groupCartItemsByStartFee = (cart) => {
|
139
|
+
return cart.reduce((groups, item) => {
|
140
|
+
var _a;
|
141
|
+
const startFeeID = ((_a = item.start_fee_obj) === null || _a === void 0 ? void 0 : _a.ID) || null;
|
142
|
+
if (!groups[startFeeID]) {
|
143
|
+
groups[startFeeID] = [];
|
144
|
+
}
|
145
|
+
groups[startFeeID].push(item);
|
146
|
+
return groups;
|
147
|
+
}, {});
|
148
|
+
};
|
149
|
+
const calculateStartFee = (cart = index$1.state.cart) => {
|
150
|
+
const uniqueStartFees = new Set();
|
151
|
+
let totalRut = 0;
|
152
|
+
let totalRot = 0;
|
153
|
+
let totalGreen = 0;
|
154
|
+
let totalDefault = 0;
|
155
|
+
cart.forEach(item => {
|
156
|
+
const startFee = item.start_fee_obj;
|
157
|
+
if (startFee && !uniqueStartFees.has(startFee.ID)) {
|
158
|
+
uniqueStartFees.add(startFee.ID);
|
159
|
+
if (item.rut) {
|
160
|
+
totalRut += index$1.state.rut ? getRutPrice(startFee.price) : startFee.price;
|
161
|
+
}
|
162
|
+
if (item.rot) {
|
163
|
+
totalRot += index$1.state.rot ? getRotPrice(startFee.price) : startFee.price;
|
164
|
+
}
|
165
|
+
if (item.green) {
|
166
|
+
totalGreen += index$1.state.green ? getGreenPrice(startFee.price) : startFee.price;
|
167
|
+
}
|
168
|
+
if (!item.rut && !item.rot && !item.green) {
|
169
|
+
totalDefault += startFee.price;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
});
|
173
|
+
const appliedDiscounts = [totalRut > 0, totalRot > 0, totalGreen > 0];
|
174
|
+
return {
|
175
|
+
rut: totalRut,
|
176
|
+
rot: totalRot,
|
177
|
+
green: totalGreen,
|
178
|
+
default: totalDefault,
|
179
|
+
length: appliedDiscounts.filter(Boolean).length,
|
180
|
+
};
|
181
|
+
};
|
182
|
+
const getItemPrice = (item) => {
|
183
|
+
const partsPrice = item.parts.reduce((acc, curr) => {
|
184
|
+
return acc + curr.price * curr.amount;
|
185
|
+
}, 0);
|
186
|
+
return getProductPrice(item, item.price * item.amount + partsPrice);
|
187
|
+
};
|
188
|
+
const calculateRot = () => {
|
189
|
+
const totalWithRot = index$1.state.cart.reduce((acc, curr) => {
|
190
|
+
return curr.rot ? acc + getItemPrice(curr) : acc;
|
191
|
+
}, 0) + (index$1.state.cart.some(item => item.rot) ? calculateStartFee().rot : 0);
|
192
|
+
const totalWithoutRot = index$1.state.cart.reduce((acc, curr) => {
|
193
|
+
var _a;
|
194
|
+
const partsPrice = curr.parts.reduce((acc, part) => {
|
195
|
+
return acc + part.price * part.amount;
|
196
|
+
}, 0);
|
197
|
+
const startFee = ((_a = curr.start_fee_obj) === null || _a === void 0 ? void 0 : _a.price) || 0;
|
198
|
+
if (curr.rot) {
|
199
|
+
if (!acc.startFeeApplied) {
|
200
|
+
acc.startFeeApplied = true;
|
201
|
+
acc.amount += curr.price * curr.amount + partsPrice + startFee;
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
acc.amount += curr.price * curr.amount + partsPrice;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
return acc;
|
208
|
+
}, { amount: 0, startFeeApplied: false }).amount;
|
209
|
+
return totalWithoutRot - totalWithRot;
|
210
|
+
};
|
211
|
+
const calculateGreenDiscount = () => {
|
212
|
+
const totalWithGreen = index$1.state.cart.reduce((acc, curr) => {
|
213
|
+
return curr.green ? acc + getItemPrice(curr) : acc;
|
214
|
+
}, 0) + (index$1.state.cart.some(item => item.green) ? calculateStartFee().green : 0);
|
215
|
+
const totalWithoutGreen = index$1.state.cart.reduce((acc, curr) => {
|
216
|
+
var _a;
|
217
|
+
const partsPrice = curr.parts.reduce((acc, part) => {
|
218
|
+
return acc + part.price * part.amount;
|
219
|
+
}, 0);
|
220
|
+
const startFee = ((_a = curr.start_fee_obj) === null || _a === void 0 ? void 0 : _a.price) || 0;
|
221
|
+
if (curr.green) {
|
222
|
+
if (!acc.startFeeApplied) {
|
223
|
+
acc.startFeeApplied = true;
|
224
|
+
acc.amount += curr.price * curr.amount + partsPrice + startFee;
|
225
|
+
}
|
226
|
+
else {
|
227
|
+
acc.amount += curr.price * curr.amount + partsPrice;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
return acc;
|
231
|
+
}, { amount: 0, startFeeApplied: false }).amount;
|
232
|
+
return totalWithoutGreen - totalWithGreen;
|
233
|
+
};
|
234
|
+
const calculateRut = () => {
|
235
|
+
const totalWithRut = index$1.state.cart.reduce((acc, curr) => {
|
236
|
+
return curr.rut ? acc + getItemPrice(curr) : acc;
|
237
|
+
}, 0) + (index$1.state.cart.some(item => item.rut) ? calculateStartFee().rut : 0);
|
238
|
+
const totalWithoutRut = index$1.state.cart.reduce((acc, curr) => {
|
239
|
+
var _a;
|
240
|
+
const partsPrice = curr.parts.reduce((acc, part) => {
|
241
|
+
return acc + part.price * part.amount;
|
242
|
+
}, 0);
|
243
|
+
const startFee = ((_a = curr.start_fee_obj) === null || _a === void 0 ? void 0 : _a.price) || 0;
|
244
|
+
if (curr.rut) {
|
245
|
+
if (!acc.startFeeApplied) {
|
246
|
+
acc.startFeeApplied = true;
|
247
|
+
acc.amount += curr.price * curr.amount + partsPrice + startFee;
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
acc.amount += curr.price * curr.amount + partsPrice;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
return acc;
|
254
|
+
}, { amount: 0, startFeeApplied: false }).amount;
|
255
|
+
return totalWithoutRut - totalWithRut;
|
256
|
+
};
|
257
|
+
const getTotalPrice = () => {
|
258
|
+
return index$1.state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + calculateStartFee().rot + calculateStartFee().rut + calculateStartFee().green + calculateStartFee().default;
|
259
|
+
};
|
260
|
+
|
261
|
+
const isProduct = (category) => {
|
262
|
+
return category.post_name !== undefined;
|
263
|
+
};
|
264
|
+
const isBusiness = (partner) => {
|
265
|
+
return Object.values(index$2.Business).includes(partner);
|
266
|
+
};
|
267
|
+
|
268
|
+
const HemfixarnaBox = class {
|
269
|
+
constructor(hostRef) {
|
270
|
+
index.registerInstance(this, hostRef);
|
271
|
+
this.post = undefined;
|
272
|
+
this.category = undefined;
|
273
|
+
this.icon = undefined;
|
274
|
+
this.postTitle = undefined;
|
275
|
+
}
|
276
|
+
setTaxonomy(taxonomy) {
|
277
|
+
if (taxonomy) {
|
278
|
+
if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
|
279
|
+
index$1.state.selectedCategory = taxonomy;
|
280
|
+
index$1.state.step = 2;
|
281
|
+
}
|
282
|
+
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
|
283
|
+
index$1.state.selectedService = taxonomy;
|
284
|
+
index$1.state.step = 3;
|
285
|
+
}
|
286
|
+
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
|
287
|
+
index$1.state.selectedProduct = taxonomy;
|
288
|
+
index$1.state.step = 4;
|
289
|
+
}
|
290
|
+
const el = this.el.closest('.hemfixarna_content');
|
291
|
+
scrollToTop(el);
|
292
|
+
}
|
293
|
+
}
|
294
|
+
setProduct() {
|
295
|
+
index$1.state.selectedProduct = this.category;
|
296
|
+
index$1.state.step = 4;
|
297
|
+
index$1.state.selectedCustomerCategory = null;
|
298
|
+
const el = this.el.closest('.hemfixarna_content');
|
299
|
+
scrollToTop(el);
|
300
|
+
}
|
301
|
+
render() {
|
302
|
+
return this.category ? (index.h(index.Fragment, null, isProduct(this.category) ? (index.h("li", { onClick: () => this.setProduct() }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.post_name }), index.h("div", null, index.h("p", null, this.category.title), !this.category.invoice ? index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.category), "kr") : null))) : (index.h("li", { onClick: () => (index$1.state.selectedCustomerCategory = this.category) }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.name }), index.h("div", null, index.h("p", null, this.category.name)))))) : (index.h("li", { onClick: () => this.setTaxonomy(this.post) }, this.post.icon && index.h("img", { class: "hemfixarna_logo", height: 82, src: this.icon, alt: this.postTitle }), index.h("div", null, index.h("p", null, this.postTitle), index$1.state.step === 3 && index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
|
303
|
+
}
|
304
|
+
get el() { return index.getElement(this); }
|
305
|
+
};
|
306
|
+
|
307
|
+
const HemfixarnaBreadcrumbs = class {
|
308
|
+
constructor(hostRef) {
|
309
|
+
index.registerInstance(this, hostRef);
|
310
|
+
this.triggerScrollTotop = () => {
|
311
|
+
const el = this.el.nextSibling;
|
312
|
+
scrollToTop(el);
|
313
|
+
};
|
314
|
+
this.closeModal = undefined;
|
315
|
+
}
|
316
|
+
getCartLength() {
|
317
|
+
return index$1.state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
318
|
+
}
|
319
|
+
handleCartClick() {
|
320
|
+
var _a;
|
321
|
+
if ((_a = index$1.state.cart) === null || _a === void 0 ? void 0 : _a.length) {
|
322
|
+
index$1.state.step = 5;
|
323
|
+
this.triggerScrollTotop();
|
324
|
+
}
|
325
|
+
}
|
326
|
+
handleHomePageClick() {
|
327
|
+
index$1.state.step = 1;
|
328
|
+
index$1.state.parentCategory = null;
|
329
|
+
index$1.state.selectedCustomerCategory = null;
|
330
|
+
this.triggerScrollTotop();
|
331
|
+
setTimeout(() => {
|
332
|
+
index$1.state.selectedCategory = null;
|
333
|
+
index$1.state.selectedProduct = null;
|
334
|
+
index$1.state.maleri = null;
|
335
|
+
index$1.state.selectedService = null;
|
336
|
+
}, 200);
|
337
|
+
}
|
338
|
+
render() {
|
339
|
+
const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
340
|
+
const close = index.getAssetPath(`./assets/close.svg`);
|
341
|
+
const cart = index.getAssetPath(`./assets/cart.svg`);
|
342
|
+
const back = index.getAssetPath(`./assets/back.svg`);
|
343
|
+
return (index.h("div", null, index.h("div", { class: "hemfixarna_crumbs" }, index.h("div", { class: "hemfixarna_crumbs--links" }, index.h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), index.h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }), index.h("div", null, index.h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), index.h("div", { class: "hemfixarna_crumbs--right" }, index.h("hemfixarna-contact", null), index.h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, index.h("img", { src: cart, width: 24 }), index.h("span", null, this.getCartLength())))), [3, 4].includes(index$1.state.step) && !index$1.state.customer && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
|
344
|
+
index$1.state.step = index$1.state.step === 4 ? 3 : 2;
|
345
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", index$1.state.step === 4 ? index$1.state.selectedService.post_title : index$1.state.selectedCategory.name))), !index$1.state.parentCategory && index$1.state.step && index$1.state.selectedCustomerCategory && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
|
346
|
+
index$1.state.step = 1;
|
347
|
+
index$1.state.selectedCustomerCategory = null;
|
348
|
+
index$1.state.selectedProduct = null;
|
349
|
+
index$1.state.maleri = null;
|
350
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se alla tj\u00E4nster"))), index$1.state.parentCategory && index$1.state.step < 5 && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
|
351
|
+
index$1.state.step = 1;
|
352
|
+
index$1.state.selectedCustomerCategory = index$1.state.parentCategory;
|
353
|
+
index$1.state.selectedProduct = null;
|
354
|
+
index$1.state.maleri = null;
|
355
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", index$1.state.parentCategory.name)))));
|
356
|
+
}
|
357
|
+
get el() { return index.getElement(this); }
|
358
|
+
};
|
359
|
+
|
360
|
+
const HemfixarnaCart = class {
|
361
|
+
constructor(hostRef) {
|
362
|
+
index.registerInstance(this, hostRef);
|
363
|
+
}
|
364
|
+
render() {
|
365
|
+
const back = index.getAssetPath(`./assets/back.svg`);
|
366
|
+
return (index.h("div", { class: "hemfixarna_cart" }, index.h("div", { class: "hemfixarna_cart--left" }, index.h("h2", null, index$1.state.checkoutStep === 2 && !index$1.state.checkoutEdit && (index.h("button", { onClick: () => {
|
367
|
+
index$1.state.checkoutStep = 1;
|
368
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Din bokning"), index.h("hemfixarna-orderrows", null)), index.h("div", { class: "hemfixarna_cart--right" }, index.h("h2", null, index$1.state.checkoutStep === 2 && !index$1.state.checkoutEdit && (index.h("button", { onClick: () => {
|
369
|
+
index$1.state.checkoutStep = 1;
|
370
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Dina uppgifter"), index.h("hemfixarna-checkout", null), index.h("hemfixarna-info", null))));
|
371
|
+
}
|
372
|
+
};
|
373
|
+
|
374
|
+
const livePreviewUrl = 'hemfixarna-partner.vercel.app';
|
375
|
+
const getDefaultApiUrl = () => {
|
376
|
+
if (window.location.href.includes('vercel.app') && !window.location.href.includes(livePreviewUrl)) {
|
377
|
+
return 'https://hemfixare.dev.afonso.se';
|
378
|
+
}
|
379
|
+
else {
|
380
|
+
return 'https://hemfixarna.se';
|
381
|
+
}
|
382
|
+
};
|
383
|
+
const getApiUrl = () => {
|
384
|
+
if (typeof process !== 'undefined' && process.env && "https://hemfixare.dev.afonso.se") {
|
385
|
+
return "https://hemfixare.dev.afonso.se";
|
386
|
+
}
|
387
|
+
return getDefaultApiUrl();
|
388
|
+
};
|
389
|
+
const getDefaultCreditSafeApiUrl = () => {
|
390
|
+
if (window.location.href.includes('vercel.app')) {
|
391
|
+
return 'https://hemfixare-lookup-dev.vercel.app/api';
|
392
|
+
}
|
393
|
+
else {
|
394
|
+
return 'https://hemfixare-lookup.vercel.app/api';
|
395
|
+
}
|
396
|
+
};
|
397
|
+
const getCreditSafeApiUrl = () => {
|
398
|
+
if (typeof process !== 'undefined' && process.env && "https://hemfixare-lookup-dev.vercel.app/api") {
|
399
|
+
return "https://hemfixare-lookup-dev.vercel.app/api";
|
400
|
+
}
|
401
|
+
return getDefaultCreditSafeApiUrl();
|
402
|
+
};
|
403
|
+
|
404
|
+
const base$2 = `${getApiUrl()}/wp-json/headless`;
|
405
|
+
async function fetchWithType(request, options) {
|
406
|
+
const response = await fetch(request, options);
|
407
|
+
const body = await response.json();
|
408
|
+
return body;
|
409
|
+
}
|
410
|
+
const getCustomer = async (slug) => {
|
411
|
+
try {
|
412
|
+
const res = await fetch(`${base$2}/customer/${slug}`);
|
413
|
+
return await res.json();
|
414
|
+
}
|
415
|
+
catch (error) {
|
416
|
+
console.log(error);
|
417
|
+
}
|
418
|
+
};
|
419
|
+
const loginCustomer = async ({ id, password }) => {
|
420
|
+
try {
|
421
|
+
const res = await fetch(`${base$2}/customer/login`, {
|
422
|
+
method: 'POST',
|
423
|
+
body: JSON.stringify({ id, password }),
|
424
|
+
headers: {
|
425
|
+
'Content-Type': 'application/json',
|
426
|
+
},
|
427
|
+
});
|
428
|
+
return res.status;
|
429
|
+
}
|
430
|
+
catch (error) {
|
431
|
+
console.log(error);
|
432
|
+
}
|
433
|
+
};
|
434
|
+
const getOptions = async () => {
|
435
|
+
try {
|
436
|
+
const res = await fetch(`${base$2}/webcoptions`);
|
437
|
+
return (await res.json());
|
438
|
+
}
|
439
|
+
catch (error) {
|
440
|
+
console.log(error);
|
441
|
+
}
|
442
|
+
};
|
443
|
+
const getRut = async () => {
|
444
|
+
try {
|
445
|
+
const data = await fetchWithType(`${base$2}/rut`);
|
446
|
+
return data;
|
447
|
+
}
|
448
|
+
catch (error) {
|
449
|
+
console.log(error);
|
450
|
+
}
|
451
|
+
};
|
452
|
+
const getRot = async () => {
|
453
|
+
try {
|
454
|
+
const res = await fetch(`${base$2}/rot`);
|
455
|
+
return (await res.json());
|
456
|
+
}
|
457
|
+
catch (error) {
|
458
|
+
console.log(error);
|
459
|
+
}
|
460
|
+
};
|
461
|
+
const getGreenDiscount = async () => {
|
462
|
+
try {
|
463
|
+
const res = await fetch(`${base$2}/green-discount`);
|
464
|
+
return await res.json();
|
465
|
+
}
|
466
|
+
catch (error) {
|
467
|
+
console.log(error);
|
468
|
+
}
|
469
|
+
};
|
470
|
+
const postOrder = async (data) => {
|
471
|
+
try {
|
472
|
+
const res = await fetch(`${base$2}/weborder`, {
|
473
|
+
method: 'POST',
|
474
|
+
body: JSON.stringify(data),
|
475
|
+
headers: {
|
476
|
+
'Content-Type': 'application/json',
|
477
|
+
},
|
478
|
+
});
|
479
|
+
return (await res.json());
|
480
|
+
}
|
481
|
+
catch (error) {
|
482
|
+
console.log(error);
|
483
|
+
}
|
484
|
+
};
|
485
|
+
|
486
|
+
const base$1 = `${getApiUrl()}/wp-json/felix`;
|
487
|
+
const postPerson = async (felixOrder) => {
|
488
|
+
try {
|
489
|
+
return await fetchWithType(`${base$1}/createperson`, {
|
490
|
+
method: 'POST',
|
491
|
+
body: JSON.stringify(felixOrder),
|
492
|
+
headers: {
|
493
|
+
'Content-Type': 'application/json',
|
494
|
+
},
|
495
|
+
});
|
496
|
+
}
|
497
|
+
catch (error) {
|
498
|
+
console.log(error);
|
499
|
+
}
|
500
|
+
};
|
501
|
+
|
502
|
+
const HemfixarnaCheckout = class {
|
503
|
+
constructor(hostRef) {
|
504
|
+
index.registerInstance(this, hostRef);
|
505
|
+
this.handleChangeDate = (e) => {
|
506
|
+
this.dateError = null;
|
507
|
+
this.date = e.target.value;
|
508
|
+
};
|
509
|
+
this.handleChangeTerms = () => {
|
510
|
+
this.generalError = null;
|
511
|
+
};
|
512
|
+
this.sendOrder = async () => {
|
513
|
+
var _a, _b, _c, _d;
|
514
|
+
if (this.loading)
|
515
|
+
return;
|
516
|
+
this.loading = true;
|
517
|
+
const startFees = index$1.state.cart
|
518
|
+
.filter(item => item.start_fee_obj)
|
519
|
+
.map(item => {
|
520
|
+
var _a, _b, _c;
|
521
|
+
return ({
|
522
|
+
ID: (_a = item.start_fee_obj) === null || _a === void 0 ? void 0 : _a.ID,
|
523
|
+
title: (_b = item.start_fee_obj) === null || _b === void 0 ? void 0 : _b.title,
|
524
|
+
price: (_c = item.start_fee_obj) === null || _c === void 0 ? void 0 : _c.price,
|
525
|
+
rut: item.rut ? 1 : 0,
|
526
|
+
rot: item.rot ? 1 : 0,
|
527
|
+
green: item.green ? 1 : 0,
|
528
|
+
});
|
529
|
+
});
|
530
|
+
let order = {
|
531
|
+
firstName: index$1.state.creditSafeUser.firstName,
|
532
|
+
lastName: index$1.state.creditSafeUser.lastName,
|
533
|
+
street: index$1.state.user.street,
|
534
|
+
zip: index$1.state.user.zip,
|
535
|
+
town: index$1.state.user.town,
|
536
|
+
ssn: index$1.state.user.ssn,
|
537
|
+
email: index$1.state.user.email,
|
538
|
+
phone: index$1.state.user.phone,
|
539
|
+
url: `${index$1.state.business === index$2.Business.string ? 'string' : index$1.state.business}-webk`,
|
540
|
+
date: this.date,
|
541
|
+
products: [
|
542
|
+
...index$1.state.cart.map(item => {
|
543
|
+
const parts = item.parts.map(part => ({
|
544
|
+
id: String(part.id),
|
545
|
+
name: part.name,
|
546
|
+
quantity: part.amount,
|
547
|
+
rut: 0,
|
548
|
+
rot: 0,
|
549
|
+
start_fee_id: item.start_fee_obj ? item.start_fee_obj.ID : null,
|
550
|
+
}));
|
551
|
+
return [
|
552
|
+
{
|
553
|
+
id: String(item.id),
|
554
|
+
name: item.name,
|
555
|
+
quantity: item.amount,
|
556
|
+
rot: item.rot ? 1 : 0,
|
557
|
+
rut: item.rut ? 1 : 0,
|
558
|
+
start_fee_id: item.start_fee_obj ? item.start_fee_obj.ID : null,
|
559
|
+
},
|
560
|
+
...parts,
|
561
|
+
];
|
562
|
+
}),
|
563
|
+
].flat(),
|
564
|
+
start_fees: startFees,
|
565
|
+
creditSafe: index$1.state.creditSafeUser,
|
566
|
+
customer: index$1.state.business,
|
567
|
+
id_source: index$1.state.customer.source ? index$1.state.customer.source.fieldData.So01_Name : '',
|
568
|
+
id_sub_source: this.selectedSubSource ? this.selectedSubSource : '',
|
569
|
+
seller_id: (_a = this.sellerID) !== null && _a !== void 0 ? _a : '',
|
570
|
+
referral_id: (_b = this.RefferalID) !== null && _b !== void 0 ? _b : '',
|
571
|
+
};
|
572
|
+
const felixOrder = await postPerson(order);
|
573
|
+
if (!felixOrder || !((_d = (_c = felixOrder.response) === null || _c === void 0 ? void 0 : _c.scriptResult) === null || _d === void 0 ? void 0 : _d.includes('OK'))) {
|
574
|
+
order = Object.assign(Object.assign({}, order), { felixStatus: 'error' });
|
575
|
+
}
|
576
|
+
else {
|
577
|
+
order = Object.assign(Object.assign({}, order), { felixStatus: 'success' });
|
578
|
+
}
|
579
|
+
try {
|
580
|
+
const { data: orderConfirm, status } = await postOrder(order);
|
581
|
+
if (orderConfirm && status && status === 200) {
|
582
|
+
index$1.state.step = 6;
|
583
|
+
const el = this.el.closest('.hemfixarna_content');
|
584
|
+
scrollToTop(el);
|
585
|
+
}
|
586
|
+
else {
|
587
|
+
this.generalError = 'Något gick fel, försök igen senare';
|
588
|
+
}
|
589
|
+
}
|
590
|
+
catch (error) {
|
591
|
+
this.generalError = 'Något gick fel, försök igen senare';
|
592
|
+
}
|
593
|
+
this.loading = false;
|
594
|
+
};
|
595
|
+
this.handleSubmit = (e) => {
|
596
|
+
var _a;
|
597
|
+
e.preventDefault();
|
598
|
+
this.generalError = null;
|
599
|
+
const validDate = this.date.length > 0;
|
600
|
+
if (!validDate) {
|
601
|
+
this.dateError = 'Ange ett giltigt datum';
|
602
|
+
}
|
603
|
+
const checkBoxes = Array.from(this.el.querySelectorAll('input[type="checkbox"]'));
|
604
|
+
const notValidTerms = checkBoxes.find(i => !i.checked);
|
605
|
+
if (notValidTerms) {
|
606
|
+
this.generalError = 'Du måste godkänna villkoren';
|
607
|
+
}
|
608
|
+
if (index$1.state.customer.source && index$1.state.selectSource) {
|
609
|
+
if (!this.sellerID) {
|
610
|
+
this.generalError = 'Ange säljare';
|
611
|
+
return;
|
612
|
+
}
|
613
|
+
if (((_a = index$1.state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) && !this.selectedSubSource) {
|
614
|
+
this.generalError = 'Välj underkälla';
|
615
|
+
return;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
if (validDate && !notValidTerms) {
|
619
|
+
this.sendOrder();
|
620
|
+
}
|
621
|
+
};
|
622
|
+
this.render = () => {
|
623
|
+
var _a;
|
624
|
+
const dateLogo = index.getAssetPath(`./assets/date.svg`);
|
625
|
+
const down = index.getAssetPath(`./assets/down.svg`);
|
626
|
+
const loading = index.getAssetPath(`./assets/spinner.gif`);
|
627
|
+
if (index$1.state.checkoutEdit) {
|
628
|
+
return index.h("hemfixarna-address", null);
|
629
|
+
}
|
630
|
+
else if (index$1.state.checkoutStep === 1) {
|
631
|
+
return index.h("hemfixarna-getuser", null);
|
632
|
+
}
|
633
|
+
else if (index$1.state.checkoutStep === 2) {
|
634
|
+
return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(index$1.state.user.firstName)), index.h("p", null, hideField(index$1.state.user.lastName)), index.h("p", null, index$1.state.user.email), index.h("p", null, index$1.state.user.phone)), index.h("div", null, index.h("p", null, hideField(index$1.state.user.street)), index.h("p", null, hideField(index$1.state.user.zip)), index.h("p", null, hideField(index$1.state.user.town))), index.h("button", { onClick: () => (index$1.state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), index.h("form", { onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("img", { src: dateLogo, width: 24 }), index.h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), index.h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), index.h("img", { src: down, width: 24 })), this.dateError && index.h("span", null, this.dateError), index$1.state.customer.source && index$1.state.selectSource ? (index.h(index.Fragment, null, index.h("p", null, "Inloggad som:", index.h("strong", null, " ", index$1.state.customer.source.fieldData.So01_Name)), index.h("label", null, "S\u00E4ljare (S\u00E4ljarId)", index.h("input", { type: "text", value: this.sellerID, onChange: e => (this.sellerID = e.target.value) })), index.h("label", null, "PartnerOrderID (RefferalID)", index.h("input", { type: "text", value: this.RefferalID, onChange: e => (this.RefferalID = e.target.value) })), ((_a = index$1.state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) ? (index.h("div", null, index.h("select", { onChange: e => (this.selectedSubSource = e.target.value) }, index.h("option", { disabled: true, selected: true, value: "null" }, "V\u00E4lj underk\u00E4lla"), index$1.state.customer.source.sub_sources.map(sub => (index.h("option", { value: sub['So_SubSource::Sus01_Name'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("p", null, "Det finns inga underk\u00E4llor att v\u00E4lja")))) : null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", { innerHTML: index$1.state.options.terms })), index$1.state.cart
|
635
|
+
.filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
|
636
|
+
.map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
|
637
|
+
}
|
638
|
+
};
|
639
|
+
this.date = '';
|
640
|
+
this.dateError = null;
|
641
|
+
this.generalError = null;
|
642
|
+
this.loading = false;
|
643
|
+
this.enteredPin = '';
|
644
|
+
this.selectedSubSource = null;
|
645
|
+
this.partnerOrderId = null;
|
646
|
+
this.sellerID = null;
|
647
|
+
this.RefferalID = null;
|
648
|
+
}
|
649
|
+
componentWillLoad() {
|
650
|
+
if (Boolean(index$1.state.user && index$1.state.user.street)) {
|
651
|
+
index$1.state.checkoutStep = 2;
|
652
|
+
}
|
653
|
+
}
|
654
|
+
get el() { return index.getElement(this); }
|
655
|
+
};
|
656
|
+
|
657
|
+
const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\");\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n* {\n box-sizing: border-box;\n}\n\n:host {\n font-family: \"Inter\", sans-serif;\n}\n:host input[type=text] {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host .mb-2 {\n margin-bottom: 32px;\n}\n:host button {\n color: #474444;\n}\n:host form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n}\n:host form button {\n position: absolute;\n right: 0;\n top: -1rem;\n}\n:host form img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n pointer-events: none;\n}\n:host form img:first-of-type {\n left: 16px;\n}\n:host form img:last-of-type {\n right: 16px;\n}\n:host form span {\n margin-top: -8px;\n color: #ec6632;\n}\n:host form p {\n text-align: center;\n}\n:host form p {\n margin: 0;\n}\n:host form div {\n position: relative;\n}\n:host form div label {\n pointer-events: none;\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n background: #fff;\n padding: 4px;\n transition: 0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host form div input {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host form div input:focus ~ label,\n:host form div .input_active ~ label {\n top: 0;\n transform: translateY(-50%);\n background: linear-gradient(180deg, #faf1e8 50%, #fff 50%);\n}\n:host form select {\n padding: 0.75rem 1rem;\n width: 100%;\n}\n:host h1 {\n font-size: 24px;\n font-weight: 400;\n line-height: 32px;\n letter-spacing: -3%;\n text-align: left;\n margin: 0 0 8px;\n}\n:host h2 {\n margin: 0 0 24px;\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -3%;\n}\n:host p {\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna {\n width: 100%;\n /* Hide default HTML checkbox */\n /* The slider */\n}\n:host .hemfixarna_source {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n:host .hemfixarna_source img {\n width: 20px;\n}\n:host .hemfixarna_source--pw {\n max-width: 300px !important;\n}\n:host .hemfixarna_source--pw input[type=password] {\n padding: 0.5rem;\n}\n:host .hemfixarna_source--pw form {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n:host .hemfixarna_contact {\n display: flex;\n gap: 16px;\n}\n:host .hemfixarna_contact a {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #474444;\n text-decoration: none;\n font-weight: 600;\n font-size: 13px;\n}\n:host .hemfixarna_contact a:hover {\n text-decoration: underline;\n}\n:host .hemfixarna_contact--horizontal span {\n display: none;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_contact--horizontal span {\n display: initial;\n }\n}\n:host .hemfixarna_painting {\n opacity: 0;\n padding: 0 1rem;\n animation: fadeIn 0.5s forwards 0.3s;\n}\n:host .hemfixarna_painting > h2,\n:host .hemfixarna_painting p {\n text-align: center;\n padding: 0 16px;\n}\n:host .hemfixarna_painting > h2 {\n margin: 0 0 8px;\n}\n:host .hemfixarna_partnerlogo {\n max-height: 50px;\n min-height: 45px;\n object-fit: contain;\n max-width: 150px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_partnerlogo {\n max-width: 200px;\n }\n}\n:host .hemfixarna_nav {\n position: absolute;\n top: 0;\n width: 100dvw;\n left: 0;\n height: 80px;\n z-index: 9999;\n}\n:host .hemfixarna_nav--links {\n display: none !important;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav--links {\n display: flex !important;\n }\n}\n:host .hemfixarna_nav--links a {\n color: #ec6632;\n text-decoration: none;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 56px;\n padding: 8px 32px;\n text-transform: capitalize;\n}\n:host .hemfixarna_nav > div {\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 16px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav > div {\n padding: 0 32px;\n }\n}\n:host .hemfixarna_nav > div > div {\n display: flex;\n gap: 32px;\n justify-content: space-between;\n}\n:host .hemfixarna_nav > div > img {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: -1;\n}\n:host .hemfixarna_nav a {\n text-decoration: none;\n}\n:host .hemfixarna_nav p {\n color: #474444;\n}\n:host .hemfixarna_nav p.with-bg {\n color: #fff;\n}\n:host .hemfixarna_standalone .hemfixarna_backdrop {\n background: #fffaf2;\n opacity: 1;\n}\n:host .hemfixarna_standalone .hemfixarna_modal {\n top: 80px;\n transform: translateX(-50%);\n border: none;\n height: calc(100dvh - 80px);\n opacity: 0;\n}\n:host .hemfixarna_standalone .hemfixarna_modal--open {\n opacity: 1;\n}\n:host .hemfixarna .switch {\n position: relative;\n display: inline-block;\n width: 40px;\n height: 20px;\n}\n:host .hemfixarna .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n:host .hemfixarna .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 34px;\n}\n:host .hemfixarna .slider:before {\n position: absolute;\n content: \"\";\n height: 18px;\n width: 18px;\n left: 2px;\n bottom: 1px;\n background-color: white;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 50%;\n}\n:host .hemfixarna input:checked + .slider {\n background-color: #fcd9c9;\n}\n:host .hemfixarna input:focus + .slider {\n box-shadow: 0 0 1px #fcd9c9;\n}\n:host .hemfixarna input:checked + .slider:before {\n -webkit-transform: translateX(18px);\n -ms-transform: translateX(18px);\n transform: translateX(18px);\n background: #ec6632;\n}\n:host .hemfixarna_maleribox {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n width: 100%;\n min-height: 132px;\n padding: 24px;\n display: flex;\n align-items: center;\n gap: 24px;\n text-align: left;\n}\n:host .hemfixarna_maleribox:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_checkbox {\n display: grid;\n grid-template-columns: 40px auto;\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna_checkbox > span {\n transform: translateY(6px);\n}\n:host .hemfixarna_checkbox span,\n:host .hemfixarna_checkbox span p {\n color: #474444;\n font-size: 14px;\n}\n:host .hemfixarna_checkbox p {\n text-align: left;\n}\n:host .hemfixarna_info {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 32px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n border-radius: 4px;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_info h2 {\n margin: 0;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_info {\n position: sticky;\n top: 0;\n }\n}\n:host .hemfixarna_infomodal {\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n max-width: 80%;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n padding: 32px;\n z-index: 99;\n border-radius: 4px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .hemfixarna_infomodal p,\n:host .hemfixarna_infomodal h4 {\n margin: 0;\n}\n:host .hemfixarna_infomodal button {\n background: #ec6632;\n color: #fff;\n border-radius: 60px;\n font-size: 16px;\n padding: 8px 16px;\n}\n:host .hemfixarna_addressinfo {\n padding: 16px 16px 64px;\n border: 1px solid #fcd9c9;\n position: relative;\n margin-bottom: 32px;\n display: grid;\n grid-template-columns: 1fr;\n gap: 8px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_addressinfo {\n grid-template-columns: 1fr 1fr;\n }\n}\n:host .hemfixarna_addressinfo button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n font-weight: 500;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n:host .hemfixarna_part {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: grid;\n padding: 16px;\n grid-template-columns: auto 75px;\n}\n:host .hemfixarna_counter {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_counter span {\n padding: 0 8px;\n}\n:host .hemfixarna_counter img {\n cursor: pointer;\n}\n:host .hemfixarna_counter img:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_description {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_description ul {\n list-style: disc;\n padding-right: 12px;\n transform: translateX(12px);\n}\n:host .hemfixarna_description--hidden {\n max-height: 140px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n}\n:host .hemfixarna_description--hidden::after {\n content: \"\";\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 128px;\n background: linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #faf1e8);\n}\n:host .hemfixarna_terms {\n font-size: 14px;\n}\n:host .hemfixarna_terms a {\n color: inherit;\n}\n:host .hemfixarna_logo {\n height: 64px;\n}\n:host .hemfixarna_box {\n padding: 16px;\n display: flex;\n align-items: center;\n width: 100%;\n box-sizing: border-box;\n border-radius: 4px;\n gap: 16px 8px;\n border-radius: 4px;\n gap: 16px 8px;\n}\n:host .hemfixarna_box p,\n:host .hemfixarna_box span {\n font-size: 15px;\n}\n:host .hemfixarna_box .underline {\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n:host .hemfixarna_box .pointer {\n cursor: pointer;\n}\n:host .hemfixarna_box .p-s {\n font-size: 12px;\n}\n:host .hemfixarna_box > div {\n display: grid;\n gap: 8px;\n}\n:host .hemfixarna_box--standard {\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_box--alternative, :host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n background: transparent;\n border: 1px solid #e3e3e3;\n}\n:host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725);\n}\n:host .hemfixarna_box--alternative_3 {\n justify-content: center;\n}\n:host .hemfixarna_altbtn {\n display: flex !important;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n margin-left: auto;\n}\n:host .hemfixarna_btn {\n margin-left: auto;\n}\n:host .hemfixarna_btn, :host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n border: none;\n border-radius: 60px;\n font-weight: 600;\n letter-spacing: 0.5px;\n line-height: 20px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_btn:not(.disabled):hover, :host .hemfixarna_buy:not(.disabled):hover,\n:host .hemfixarna input[type=submit]:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna div:has(> input[type=submit]) {\n position: relative;\n}\n:host .hemfixarna div:has(> input[type=submit]) input {\n cursor: pointer;\n}\n:host .hemfixarna div:has(> input[type=submit]) img {\n display: none;\n}\n:host .hemfixarna .loading {\n cursor: default;\n opacity: 0.6;\n}\n:host .hemfixarna .loading > img {\n display: initial !important;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n:host .hemfixarna_btn {\n font-size: 14px;\n background: #c84e18;\n color: #fff;\n padding: 16px 24px;\n white-space: nowrap;\n position: relative;\n}\n:host .hemfixarna_btn span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_btn span {\n background: #25a710;\n color: #fff;\n right: 0 !important;\n}\n:host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n font-size: 21px;\n background: #25a710;\n color: #fff;\n padding: 16px 24px;\n}\n:host .hemfixarna .disabled {\n opacity: 0.5;\n cursor: default;\n}\n:host .hemfixarna_modal {\n position: fixed;\n background: #faf1e8;\n border: 1px solid #fcd9c9;\n border-radius: 4px;\n top: 50%;\n left: 50%;\n z-index: 1000;\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n transform: translate(-50%, -50%) scale(0.7);\n opacity: 0;\n height: 92%;\n width: 92%;\n max-width: 920px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n:host .hemfixarna_modal--open {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n}\n:host .hemfixarna_backdrop {\n z-index: 999;\n position: fixed;\n background: #474444;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n opacity: 0;\n 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);\n}\n:host .hemfixarna_backdrop--open {\n opacity: 0.3;\n}\n:host .hemfixarna_order {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n background-repeat: no-repeat !important;\n background-size: cover !important;\n background-position: center !important;\n display: grid;\n grid-template-columns: 1fr 1fr;\n padding: 48px 32px 64px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_order {\n grid-template-columns: 1fr;\n grid-template-rows: 0 auto;\n }\n}\n:host .hemfixarna_order > div:last-of-type {\n background: #fffaf2;\n padding: 32px;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n}\n:host .hemfixarna_order img {\n cursor: pointer;\n}\n:host .hemfixarna_order button {\n margin: 16px 0;\n padding: 0;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-size: 14px;\n font-weight: 600;\n}\n:host .hemfixarna_cart {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart {\n grid-template-columns: 1fr;\n gap: 0;\n }\n}\n:host .hemfixarna_cart--right h2, :host .hemfixarna_cart--left h2 {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_cart--right h2 img, :host .hemfixarna_cart--left h2 img {\n margin-top: 3.2px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_cart--left h2 button {\n display: none;\n }\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart--right h2 button {\n display: none;\n }\n}\n:host .hemfixarna_cart--startfee {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot div {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_cart--additional {\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 16px;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--additional p {\n font-size: 14px;\n position: relative;\n}\n:host .hemfixarna_cart--additional p strong {\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n}\n:host .hemfixarna_cart--additional p img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n right: -20px;\n cursor: pointer;\n}\n:host .hemfixarna_cart--price {\n border-top: 1px solid #fcd9c9;\n padding: 16px;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--price h3 {\n margin: 0;\n}\n:host .hemfixarna_cart--item {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 0;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--item span {\n font-size: 12px;\n}\n:host .hemfixarna_cart--item > div {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--item > div > div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n:host .hemfixarna_cart--item > div button {\n color: #ec6632;\n}\n:host .hemfixarna_cart--group {\n border-radius: 16px;\n background: #fefaf6;\n margin-bottom: 16px;\n padding: 10px 20px;\n}\n:host .hemfixarna_cart--group ul li:first-of-type {\n border-top: 0;\n}\n:host .hemfixarna_categories {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .hemfixarna_categories--wrapper {\n gap: 32px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_categories--wrapper {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_categories li {\n position: relative;\n background: #fff;\n border-radius: 4px;\n min-height: 132px;\n padding: 24px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n align-items: center;\n gap: 24px;\n cursor: pointer;\n}\n:host .hemfixarna_categories li:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_categories li > button {\n height: 100%;\n width: 100%;\n}\n:host .hemfixarna_categories li .price {\n font-weight: 700;\n}\n:host .hemfixarna_content {\n height: 100%;\n overflow: auto;\n padding: 0 32px 64px;\n}\n:host .hemfixarna_content--5 {\n padding-top: 16px;\n}\n:host .hemfixarna_content--painting {\n padding: 0;\n overflow: initial;\n}\n:host .hemfixarna_crumbs {\n position: relative;\n padding: 16px 24px;\n border-bottom: 1px solid #fcd9c9;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_crumbs--back {\n padding: 16px 24px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs--back:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_crumbs img {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .close {\n position: absolute;\n right: -16px;\n top: -16px;\n z-index: 9;\n -webkit-transform: translate3d(0, 0, 0);\n}\n:host .hemfixarna_crumbs .cart {\n display: flex;\n padding-left: 16px;\n position: relative;\n}\n:host .hemfixarna_crumbs .cart img {\n cursor: inherit;\n}\n:host .hemfixarna_crumbs .cart span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_crumbs .cart_active {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .cart_active span {\n background: #25a710;\n color: #fff;\n}\n:host .hemfixarna_crumbs--links {\n display: flex;\n align-items: center;\n gap: 16px;\n overflow: auto;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_crumbs--links {\n -ms-overflow-style: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar {\n display: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar-button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs--right {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_crumbs button {\n white-space: nowrap;\n background: #f1ded6;\n border-radius: 64px;\n padding: 12px 16px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.3px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs button:not(.active):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n@media (max-width: 768px) {\n :host .hemfixarna_crumbs button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs .active {\n background: #fffaf2;\n cursor: default;\n}\n:host .hemfixarna_features {\n gap: 12px !important;\n}\n:host .hemfixarna_features li {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_address {\n margin-bottom: 16px;\n}\n:host .hemfixarna_product {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_product--link {\n font-weight: 700;\n color: #474444;\n text-underline-offset: 4px;\n}\n:host .hemfixarna_product--left {\n gap: 32px;\n}\n:host .hemfixarna_product--right {\n gap: 32px;\n}\n:host .hemfixarna_product--price {\n margin-top: 4px;\n font-weight: 700;\n}\n:host .hemfixarna_product--total {\n text-align: center;\n margin: -16px 0;\n font-size: 21px;\n line-height: 28px;\n}\n:host .hemfixarna_product--item {\n background: #fff;\n padding: 16px;\n display: grid;\n grid-template-columns: auto 75px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_product--grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--grid {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_product--grid > div {\n display: flex;\n flex-direction: column;\n}\n:host .hemfixarna_product--grid ul {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n:host .hemfixarna_product p {\n margin: 0;\n}\n:host .hemfixarna_product--top {\n display: flex;\n gap: 32px;\n}\n:host .hemfixarna_product--top img {\n object-fit: contain;\n}\n:host .hemfixarna_product--top > div {\n width: 100%;\n}\n:host .hemfixarna_product--top > div h1 {\n max-width: 80%;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--top > div h1 {\n max-width: 100%;\n }\n}\n:host .hemfixarna_product--top h4 {\n margin-bottom: 8px;\n}\n:host h5,\n:host p {\n margin: 0;\n}\n:host input[type=submit] {\n cursor: pointer;\n}\n:host input[type=date] ~ label {\n left: 56px;\n}\n:host input[type=date] {\n border: 1px solid #fcd9c9;\n padding-left: 64px;\n}\n:host input[type=checkbox] {\n height: 18px;\n width: 18px;\n border: 1px solid #fcd9c9;\n}\n:host input[type=checkbox]:checked {\n background: red;\n}\n:host input[type=date]::-webkit-calendar-picker-indicator {\n background: transparent;\n bottom: 0;\n color: transparent;\n cursor: pointer;\n height: auto;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n width: auto;\n}\n:host button,\n:host a {\n cursor: pointer;\n background: none;\n border: none;\n}\n:host ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}";
|
658
|
+
|
659
|
+
const HemfixarnaComponent = class {
|
660
|
+
constructor(hostRef) {
|
661
|
+
index.registerInstance(this, hostRef);
|
662
|
+
this.triggerScrollTotop = () => {
|
663
|
+
const el = this.el.shadowRoot.querySelector('.hemfixarna_content');
|
664
|
+
scrollToTop(el);
|
665
|
+
};
|
666
|
+
this.modal = false;
|
667
|
+
this.showModal = false;
|
668
|
+
this.product = null;
|
669
|
+
this.id = undefined;
|
670
|
+
this.slug = undefined;
|
671
|
+
this.business = undefined;
|
672
|
+
this.widgetStyle = index$2.WidgetStyle.standard;
|
673
|
+
this.buttonColor = undefined;
|
674
|
+
this.buttonBg = undefined;
|
675
|
+
this.proppedProduct = null;
|
676
|
+
this.loginSourceError = null;
|
677
|
+
}
|
678
|
+
loadCategoryOrProduct(id) {
|
679
|
+
this.proppedProduct = null;
|
680
|
+
if (id.startsWith('c-')) {
|
681
|
+
const categories = [...index$1.state.customer.categories, ...index$1.state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
|
682
|
+
const category = categories.find(c => c && c.id === id.replace('c-', ''));
|
683
|
+
if (category) {
|
684
|
+
index$1.state.selectedCustomerCategory = category;
|
685
|
+
index$1.state.step = 2;
|
686
|
+
}
|
687
|
+
}
|
688
|
+
else {
|
689
|
+
const products = index$1.state.customer.categories
|
690
|
+
.map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
|
691
|
+
.flat()
|
692
|
+
.flat();
|
693
|
+
const product = products.find(p => p && p.fields.ID === parseInt(id));
|
694
|
+
if (product) {
|
695
|
+
index$1.state.selectedProduct = product.fields;
|
696
|
+
index$1.state.step = 4;
|
697
|
+
this.proppedProduct = product.fields;
|
698
|
+
}
|
699
|
+
}
|
700
|
+
}
|
701
|
+
async watchIdChange(id) {
|
702
|
+
if (id && index$1.state.customer) {
|
703
|
+
if (id === 'maleri') {
|
704
|
+
index$1.state.maleri = true;
|
705
|
+
index$1.state.step = 4;
|
706
|
+
}
|
707
|
+
else {
|
708
|
+
this.loadCategoryOrProduct(id);
|
709
|
+
}
|
710
|
+
}
|
711
|
+
}
|
712
|
+
async componentWillLoad() {
|
713
|
+
index$1.state.business = this.business;
|
714
|
+
const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
|
715
|
+
if (cart) {
|
716
|
+
index$1.state.cart = JSON.parse(cart);
|
717
|
+
}
|
718
|
+
const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);
|
719
|
+
if (user) {
|
720
|
+
index$1.state.user = JSON.parse(user);
|
721
|
+
}
|
722
|
+
const creditSafeUser = window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);
|
723
|
+
if (creditSafeUser) {
|
724
|
+
index$1.state.creditSafeUser = JSON.parse(creditSafeUser);
|
725
|
+
}
|
726
|
+
const [options, rut, rot, greenDiscount] = await Promise.all([getOptions(), getRut(), getRot(), getGreenDiscount()]);
|
727
|
+
try {
|
728
|
+
const customer = await getCustomer(this.business);
|
729
|
+
if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
|
730
|
+
console.warn('customer not found');
|
731
|
+
}
|
732
|
+
else if (customer) {
|
733
|
+
index$1.state.customer = customer;
|
734
|
+
const id = this.id || this.slug;
|
735
|
+
if (id) {
|
736
|
+
if (id === 'maleri') {
|
737
|
+
index$1.state.maleri = true;
|
738
|
+
index$1.state.step = 4;
|
739
|
+
}
|
740
|
+
else {
|
741
|
+
this.loadCategoryOrProduct(id);
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
}
|
746
|
+
catch (error) {
|
747
|
+
console.warn('customer not found');
|
748
|
+
}
|
749
|
+
index$1.state.rotOptions = rot;
|
750
|
+
index$1.state.rutOptions = rut;
|
751
|
+
index$1.state.greenOptions = greenDiscount;
|
752
|
+
index$1.state.options = options;
|
753
|
+
if (localStorage.getItem('select_source')) {
|
754
|
+
index$1.state.selectSource = true;
|
755
|
+
}
|
756
|
+
}
|
757
|
+
// Open close modal && click outside event
|
758
|
+
openModal() {
|
759
|
+
if (this.id) {
|
760
|
+
if (this.id === 'maleri') {
|
761
|
+
index$1.state.maleri = true;
|
762
|
+
index$1.state.step = 4;
|
763
|
+
}
|
764
|
+
else {
|
765
|
+
index$1.state.maleri = false;
|
766
|
+
this.loadCategoryOrProduct(this.id);
|
767
|
+
}
|
768
|
+
}
|
769
|
+
this.modal = true;
|
770
|
+
setTimeout(() => {
|
771
|
+
this.showModal = true;
|
772
|
+
}, 50);
|
773
|
+
}
|
774
|
+
closeModal() {
|
775
|
+
this.showModal = false;
|
776
|
+
setTimeout(() => {
|
777
|
+
this.modal = false;
|
778
|
+
}, 200);
|
779
|
+
}
|
780
|
+
handleClick(e) {
|
781
|
+
if ((e === null || e === void 0 ? void 0 : e.composedPath()[0]).classList.contains('hemfixarna_backdrop')) {
|
782
|
+
this.closeModal();
|
783
|
+
}
|
784
|
+
const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');
|
785
|
+
if (infomodal) {
|
786
|
+
const isClickInside = infomodal.contains(e.composedPath()[0]);
|
787
|
+
if (!isClickInside) {
|
788
|
+
index$1.state.modal = null;
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
async handleLogin() {
|
793
|
+
this.loginSourceError = null;
|
794
|
+
const passwordInput = this.el.shadowRoot.querySelector('input[type="password"]');
|
795
|
+
const password = passwordInput.value;
|
796
|
+
try {
|
797
|
+
const status = await loginCustomer({ id: index$1.state.customer.ID, password: password });
|
798
|
+
if (status === 200) {
|
799
|
+
index$1.state.showSourcePasswordPrompt = false;
|
800
|
+
index$1.state.selectSource = true;
|
801
|
+
}
|
802
|
+
else {
|
803
|
+
this.loginSourceError = 'Fel lösenord';
|
804
|
+
}
|
805
|
+
}
|
806
|
+
catch (error) {
|
807
|
+
console.log(error);
|
808
|
+
this.loginSourceError = 'Fel lösenord';
|
809
|
+
}
|
810
|
+
}
|
811
|
+
getCartLength() {
|
812
|
+
return index$1.state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
813
|
+
}
|
814
|
+
render() {
|
815
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
816
|
+
const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
817
|
+
const pensel = index.getAssetPath(`./assets/pensel.svg`);
|
818
|
+
const monteringLogo = index.getAssetPath(`./assets/montering.svg`);
|
819
|
+
return (index.h("div", { class: `hemfixarna hemfixarna-${this.business}` }, index.h("div", { class: `hemfixarna_box hemfixarna_box--${this.widgetStyle}` }, [index$2.WidgetStyle.alternative_2, index$2.WidgetStyle.alternative_3].includes(this.widgetStyle) ? (index.h("img", { src: this.id === 'maleri' ? pensel : monteringLogo, alt: "montering logo", width: 32, height: 32 })) : null, index.h("div", null, index.h("div", null, index.h("p", { onClick: () => this.openModal(), class: `pointer ${[index$2.WidgetStyle.alternative_2, index$2.WidgetStyle.alternative_3].includes(this.widgetStyle) && index$1.state.selectedProduct ? 'underline' : ''}` }, this.id === 'maleri' ? (index.h("span", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r")) : (index.h(index.Fragment, null, !index$1.state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (index.h(index.Fragment, null, ((_a = index$1.state.customer) === null || _a === void 0 ? void 0 : _a.widget_title) ? (index.h("span", null, index$1.state.customer.widget_title)) : (index.h("span", null, "Montering/Installation - ", index.h("strong", { class: "underline" }, "se priser h\u00E4r"))))) : (index.h(index.Fragment, null, ((_b = this.product) === null || _b === void 0 ? void 0 : _b.title) || ((_c = this.proppedProduct) === null || _c === void 0 ? void 0 : _c.title) || ((_d = index$1.state.selectedCustomerCategory) === null || _d === void 0 ? void 0 : _d.widget_title) || (index.h("span", null, "Montering", index.h("wbr", null), "/Installation ", (_f = (_e = index$1.state.selectedCustomerCategory) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'på plats', " - ", index.h("strong", { class: "underline" }, "se priser h\u00E4r"))), this.proppedProduct && !((_g = this.product) === null || _g === void 0 ? void 0 : _g.invoice) && !((_h = this.proppedProduct) === null || _h === void 0 ? void 0 : _h.invoice) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || this.product), "kr"))) : null)))))), this.widgetStyle === index$2.WidgetStyle.standard ? index.h("img", { src: logo, width: 104 }) : null, this.widgetStyle === index$2.WidgetStyle.alternative ? (index.h("span", { class: "p-s" }, "Utf\u00F6rs av ", index.h("strong", null, "Hemfixarna"))) : null), [index$2.WidgetStyle.standard, index$2.WidgetStyle.alternative].includes(this.widgetStyle) ? (index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn", style: {
|
820
|
+
color: ((_j = this.buttonColor) === null || _j === void 0 ? void 0 : _j.startsWith('#')) || !((_k = this.buttonColor) === null || _k === void 0 ? void 0 : _k.length) ? this.buttonColor : `#${this.buttonColor}`,
|
821
|
+
backgroundColor: ((_l = this.buttonBg) === null || _l === void 0 ? void 0 : _l.startsWith('#')) || !((_m = this.buttonBg) === null || _m === void 0 ? void 0 : _m.length) ? this.buttonBg : `#${this.buttonBg}`,
|
822
|
+
} }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))) : null, index$2.WidgetStyle.alternative_2 === this.widgetStyle ? (index.h("div", { class: "hemfixarna_altbtn" }, index.h("strong", { class: "p-s" }, "Utf\u00F6rs av"), index.h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null), this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, index$1.state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, index$1.state.modal.title && index.h("h2", null, index$1.state.modal.title), index.h("p", { innerHTML: index$1.state.modal.text }), index.h("div", null, index.h("button", { onClick: () => (index$1.state.modal = null) }, "St\u00E4ng")))), index$1.state.showSourcePasswordPrompt ? (index.h("div", { class: "hemfixarna_source--pw hemfixarna_infomodal" }, index.h("form", { onSubmit: e => {
|
823
|
+
e.preventDefault();
|
824
|
+
this.handleLogin();
|
825
|
+
} }, index.h("input", { type: "password", placeholder: "L\u00F6senord" }), index.h("input", { type: "submit", value: "Logga in" }), this.loginSourceError && index.h("span", null, "Fel l\u00F6senord")))) : null, index$1.state.customer && index.h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal() }), index.h("div", { class: `hemfixarna_content hemfixarna_content--${index$1.state.step} ${index$1.state.step === 4 && index$1.state.maleri ? 'hemfixarna_content--painting' : ''}` }, index$1.state.step < 4 && index.h("hemfixarna-start", null), index$1.state.step === 4 && index.h("hemfixarna-product", null), index$1.state.step === 5 && index.h("hemfixarna-cart", null), index$1.state.step === 6 && index.h("hemfixarna-order", null))), index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
|
826
|
+
}
|
827
|
+
static get assetsDirs() { return ["assets"]; }
|
828
|
+
get el() { return index.getElement(this); }
|
829
|
+
static get watchers() { return {
|
830
|
+
"id": ["watchIdChange"]
|
831
|
+
}; }
|
832
|
+
};
|
833
|
+
HemfixarnaComponent.style = hemfixarnaCss;
|
834
|
+
|
835
|
+
const HemfixarnaInfo$1 = class {
|
836
|
+
constructor(hostRef) {
|
837
|
+
index.registerInstance(this, hostRef);
|
838
|
+
this.vertical = false;
|
839
|
+
}
|
840
|
+
render() {
|
841
|
+
return (index.h("div", { class: `hemfixarna_contact ${this.vertical ? 'hemfixarna_contact--vertical' : 'hemfixarna_contact--horizontal'}` }, index$1.state.customer.source ? (index.h("div", { onClick: () => {
|
842
|
+
if (!index$1.state.selectSource) {
|
843
|
+
index$1.state.showSourcePasswordPrompt = true;
|
844
|
+
}
|
845
|
+
}, class: "hemfixarna_source" }, index$1.state.selectSource ? (index.h("svg", { viewBox: "0 0 1024 1024", fill: "#C84E18", height: "1em", width: "1em" }, index.h("path", { d: "M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0z" }))) : (index.h("svg", { viewBox: "0 0 1024 1024", fill: "#C84E18", height: "1em", width: "1em" }, index.h("path", { d: "M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0zm152-237H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224z" }))))) : null, index.h("a", { href: "tel:0770-220 720" }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M7 4V20H17V4H7ZM6 2H18C18.5523 2 19 2.44772 19 3V21C19 21.5523 18.5523 22 18 22H6C5.44772 22 5 21.5523 5 21V3C5 2.44772 5.44772 2 6 2ZM12 17C12.5523 17 13 17.4477 13 18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17Z", fill: "#C84E18" })), index.h("span", null, "0770-220 720")), index.h("a", { href: "https://hemfixarna.se/kundservice/", target: "_blank" }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { "clip-path": "url(#clip0_1001_894)" }, index.h("path", { d: "M21 12.22C21 6.73 16.74 3 12 3C7.31 3 3 6.65 3 12.28C2.4 12.62 2 13.26 2 14V16C2 17.1 2.9 18 4 18H5V11.9C5 8.03 8.13 4.9 12 4.9C15.87 4.9 19 8.03 19 11.9V19H11V21H19C20.1 21 21 20.1 21 19V17.78C21.59 17.47 22 16.86 22 16.14V13.84C22 13.14 21.59 12.53 21 12.22Z", fill: "#C84E18" }), index.h("path", { d: "M9 14C9.55228 14 10 13.5523 10 13C10 12.4477 9.55228 12 9 12C8.44772 12 8 12.4477 8 13C8 13.5523 8.44772 14 9 14Z", fill: "#C84E18" }), index.h("path", { d: "M15 14C15.5523 14 16 13.5523 16 13C16 12.4477 15.5523 12 15 12C14.4477 12 14 12.4477 14 13C14 13.5523 14.4477 14 15 14Z", fill: "#C84E18" }), index.h("path", { d: "M18 11.03C17.52 8.18 15.04 6 12.05 6C9.01997 6 5.75997 8.51 6.01997 12.45C8.48997 11.44 10.35 9.24 10.88 6.56C12.19 9.19 14.88 11 18 11.03Z", fill: "#C84E18" })), index.h("defs", null, index.h("clipPath", { id: "clip0_1001_894" }, index.h("rect", { width: "24", height: "24", fill: "white" })))), index.h("span", null, "Kundservice"))));
|
846
|
+
}
|
847
|
+
};
|
848
|
+
|
849
|
+
const hemfixarnaDemoCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); :host{font-family:\"Inter\", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;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:-48px;font-size:16px;left:40%;color:white;padding:8px;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:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div:not(.hemfixarna_hosted){grid-template-columns:1fr 1fr}:host .hemfixarna_hosted .hemfixarna_scripts{display:none}:host>div{display:grid;gap:32px;width:100%;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;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{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}";
|
850
|
+
|
851
|
+
const MyComponent = class {
|
852
|
+
constructor(hostRef) {
|
853
|
+
index.registerInstance(this, hostRef);
|
854
|
+
this.debounce = null;
|
855
|
+
this.cdnLink = '<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"></script>';
|
856
|
+
this.selectedSlug = undefined;
|
857
|
+
this.selectedID = undefined;
|
858
|
+
this.tooltipText = 'Kopiera till urklipp';
|
859
|
+
this.tree = null;
|
860
|
+
this.customer = null;
|
861
|
+
this.widgetStyle = index$2.WidgetStyle.standard;
|
862
|
+
this.buttonBg = '';
|
863
|
+
this.buttonColor = '';
|
864
|
+
this.partner = undefined;
|
865
|
+
this.colorAccessibility = undefined;
|
866
|
+
this.loggedIn = false;
|
867
|
+
this.loginError = false;
|
868
|
+
}
|
869
|
+
debouncedFunction() {
|
870
|
+
if (this.debounce !== null) {
|
871
|
+
clearTimeout(this.debounce);
|
872
|
+
this.debounce = null;
|
873
|
+
}
|
874
|
+
this.debounce = window.setTimeout(() => {
|
875
|
+
this.checkColorAccessibility();
|
876
|
+
this.debounce = null;
|
877
|
+
}, 1500);
|
878
|
+
}
|
879
|
+
async checkColorAccessibility() {
|
880
|
+
const defaultTextColor = '#fff';
|
881
|
+
const defaultBgColor = '#c84e18';
|
882
|
+
const firstColor = this.buttonBg.length ? (this.buttonBg.startsWith('#') ? this.buttonBg : `#${this.buttonBg}`) : defaultBgColor;
|
883
|
+
const secondColor = this.buttonColor.length ? (this.buttonColor.startsWith('#') ? this.buttonColor : `#${this.buttonColor}`) : defaultTextColor;
|
884
|
+
try {
|
885
|
+
const response = await fetch('https://www.aremycolorsaccessible.com/api/are-they', {
|
886
|
+
mode: 'cors',
|
887
|
+
method: 'POST',
|
888
|
+
body: JSON.stringify({ colors: [firstColor, secondColor] }),
|
889
|
+
});
|
890
|
+
if (!response) {
|
891
|
+
throw new Error('Network response was not ok');
|
892
|
+
}
|
893
|
+
const json = await response.json();
|
894
|
+
if (json && (json)) {
|
895
|
+
this.colorAccessibility = json;
|
896
|
+
}
|
897
|
+
}
|
898
|
+
catch (error) {
|
899
|
+
console.warn('Error fetching color accessibility:', error);
|
900
|
+
}
|
901
|
+
}
|
902
|
+
getColor(rating) {
|
903
|
+
switch (rating) {
|
904
|
+
case 'AAA':
|
905
|
+
return 'green';
|
906
|
+
case 'AA':
|
907
|
+
return 'orange';
|
908
|
+
case 'A':
|
909
|
+
return 'yellow';
|
910
|
+
case 'Fail':
|
911
|
+
return 'red';
|
912
|
+
default:
|
913
|
+
return 'black';
|
914
|
+
}
|
915
|
+
}
|
916
|
+
async componentWillLoad() {
|
917
|
+
const partner = window.location.pathname.replace('/', '');
|
918
|
+
if (!isBusiness(partner) && partner)
|
919
|
+
return;
|
920
|
+
this.partner = partner ? partner : index$2.Business.kund;
|
921
|
+
const customer = await getCustomer(this.partner);
|
922
|
+
if (customer.code !== 'not_found' && customer) {
|
923
|
+
this.customer = customer;
|
924
|
+
if (!this.customer.password_protected || window.localStorage.getItem(`${this.customer.ID}-loggedin`)) {
|
925
|
+
this.loggedIn = true;
|
926
|
+
}
|
927
|
+
}
|
928
|
+
}
|
929
|
+
getExample() {
|
930
|
+
return `<hemfixarna-component business="${this.partner}"${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}${this.selectedID ? ` id="${this.selectedID}" ` : ''} ${this.widgetStyle === index$2.WidgetStyle.standard ? '' : `widget-style="${this.widgetStyle}"`} ${this.buttonColor.length ? `button-color="${this.buttonColor}"` : ''} ${this.buttonBg.length ? `button-bg="${this.buttonBg}"` : ''}></hemfixarna-component>`;
|
931
|
+
}
|
932
|
+
copyExample() {
|
933
|
+
navigator.clipboard.writeText(this.getExample());
|
934
|
+
this.tooltipText = 'Snippet kopierad';
|
935
|
+
setTimeout(() => {
|
936
|
+
this.tooltipText = 'Kopiera till urklipp';
|
937
|
+
}, 2000);
|
938
|
+
}
|
939
|
+
copyCdn() {
|
940
|
+
navigator.clipboard.writeText(this.cdnLink);
|
941
|
+
this.tooltipText = 'Text kopierad';
|
942
|
+
setTimeout(() => {
|
943
|
+
this.tooltipText = 'Kopiera till urklipp';
|
944
|
+
}, 2000);
|
945
|
+
}
|
946
|
+
copyNpmInstall() {
|
947
|
+
navigator.clipboard.writeText('npm i hemfixarna-web-components');
|
948
|
+
this.tooltipText = 'Text kopierad';
|
949
|
+
setTimeout(() => {
|
950
|
+
this.tooltipText = 'Kopiera till urklipp';
|
951
|
+
}, 2000);
|
952
|
+
}
|
953
|
+
showMaleri() {
|
954
|
+
var _a;
|
955
|
+
const allCategories = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.categories.map(c => (c.sub_categories ? c.sub_categories : c)).flat();
|
956
|
+
return allCategories === null || allCategories === void 0 ? void 0 : allCategories.some(c => c.add_painting);
|
957
|
+
}
|
958
|
+
async handleLogin() {
|
959
|
+
const shadowHost = document.querySelector('hemfixarna-demo');
|
960
|
+
const shadowRoot = shadowHost.shadowRoot;
|
961
|
+
const passwordInput = shadowRoot.querySelector('input[type="password"]');
|
962
|
+
const password = passwordInput.value;
|
963
|
+
this.loginError = false;
|
964
|
+
try {
|
965
|
+
const status = await loginCustomer({ id: this.customer.ID, password: password });
|
966
|
+
if (status === 200) {
|
967
|
+
this.loggedIn = true;
|
968
|
+
window.localStorage.setItem(`${this.customer.ID}-loggedin`, 'true');
|
969
|
+
}
|
970
|
+
else {
|
971
|
+
this.loginError = true;
|
972
|
+
}
|
973
|
+
}
|
974
|
+
catch (error) {
|
975
|
+
console.log(error);
|
976
|
+
this.loginError = true;
|
977
|
+
}
|
978
|
+
}
|
979
|
+
render() {
|
980
|
+
var _a;
|
981
|
+
const copy = index.getAssetPath(`./assets/copy.png`);
|
982
|
+
return this.customer ? (index.h(index.Fragment, null, this.loggedIn ? (index.h("div", { class: ((_a = this.customer) === null || _a === void 0 ? void 0 : _a.at_hemfixarna) ? 'hemfixarna_hosted' : '' }, index.h("div", { class: "hemfixarna_scripts" }, index.h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, index.h("p", null, this.getExample()), index.h("img", { src: copy, height: 20 }), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), index.h("hemfixarna-component", { business: this.partner, buttonBg: this.buttonBg, buttonColor: this.buttonColor, widgetStyle: this.widgetStyle, id: this.selectedID }), index.h("div", { class: "hemfixarna_install" }, index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 }))), index.h("div", { class: "hemfixarna_widgetstyles" }, index.h("h5", null, "Widget styles"), index.h("div", null, Object.values(index$2.WidgetStyle).map(style => (index.h("label", { key: style }, index.h("input", { type: "radio", value: style, checked: this.widgetStyle === style, onChange: () => (this.widgetStyle = style) }), style)))), index.h("div", null, index.h("div", null, index.h("h5", null, "Button background color"), index.h("input", { type: "text", value: this.buttonBg, onInput: e => (this.buttonBg = e.target.value) })), index.h("div", null, index.h("h5", null, "Button text color"), index.h("input", { type: "text", value: this.buttonColor, onInput: e => (this.buttonColor = e.target.value) })))), index.h("span", null, "Write an hexa code no # needed"), this.colorAccessibility ? (index.h("div", null, index.h("h5", null, "Tillg\u00E4nglighetsrapport"), index.h("div", null, index.h("strong", null, "Liten text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.small) } }, this.colorAccessibility.small), index.h("br", null), index.h("strong", null, "Fet text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.bold) } }, this.colorAccessibility.bold), index.h("br", null), index.h("strong", null, "Stor text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.large) } }, this.colorAccessibility.large), index.h("br", null), index.h("strong", null, "Kontrastf\u00F6rh\u00E5llande:"), " ", this.colorAccessibility.contrast))) : null), index.h("ul", { class: "hemfixarna_categories" }, index.h("div", null, this.customer.logo ? (index.h("div", { style: { width: '100%', display: 'flex', justifyContent: 'center' } }, index.h("img", { style: { maxWidth: '250px', height: 'auto', margin: '0 auto 2rem' }, src: this.customer.logo.url, alt: this.customer.post_title }))) : null, this.showMaleri() ? (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, "M\u00E5leriverktyget"), index.h("span", null, "maleri")), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText('maleri') }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=maleri`) }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = 'maleri') }, "Ladda m\u00E5leri")))))) : null, this.customer.categories.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `c-${c.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${c.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=c-${c.id}`) }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = `c-${c.id}`) }, "Ladda kategori")))), c.show_products && c.products ? (index.h("ul", null, c.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=${p.fields.ID}`) }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt"))))))))) : (index.h("ul", null, c.sub_categories &&
|
983
|
+
c.sub_categories.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.name), index.h("span", null, `c-${sc.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${sc.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=c-${c.id}`) }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = `c-${sc.id}`) }, "Ladda kategori")))), index.h("ul", null, sc.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=${p.fields.ID}`) }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt")))))))))))))))))))) : (index.h("div", null, index.h("form", { onSubmit: e => {
|
984
|
+
e.preventDefault();
|
985
|
+
this.handleLogin();
|
986
|
+
}, style: {
|
987
|
+
display: 'flex',
|
988
|
+
flexDirection: 'column',
|
989
|
+
gap: '1rem',
|
990
|
+
maxWidth: '300px',
|
991
|
+
margin: 'auto',
|
992
|
+
padding: '20px',
|
993
|
+
border: '1px solid #ccc',
|
994
|
+
borderRadius: '5px',
|
995
|
+
gridColumn: 'span 2',
|
996
|
+
} }, index.h("input", { type: "password", placeholder: "L\u00F6senord" }), index.h("button", { type: "submit" }, "Logga in"), this.loginError && index.h("span", null, "Fel l\u00F6senord")))))) : (index.h("h1", { style: {
|
997
|
+
textAlign: 'center',
|
998
|
+
margin: 'auto',
|
999
|
+
padding: '20px',
|
1000
|
+
fontSize: '24px',
|
1001
|
+
fontWeight: 'bold',
|
1002
|
+
color: 'red',
|
1003
|
+
} }, "No customer found"));
|
1004
|
+
}
|
1005
|
+
static get watchers() { return {
|
1006
|
+
"buttonBg": ["debouncedFunction"],
|
1007
|
+
"buttonColor": ["debouncedFunction"]
|
1008
|
+
}; }
|
1009
|
+
};
|
1010
|
+
MyComponent.style = hemfixarnaDemoCss;
|
1011
|
+
|
1012
|
+
// src/errors.ts
|
1013
|
+
var PersonnummerError = class extends Error {
|
1014
|
+
constructor() {
|
1015
|
+
super("Invalid swedish personal identity number");
|
1016
|
+
}
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
// src/utils.ts
|
1020
|
+
var compareAsc = (dateLeft, dateRight) => {
|
1021
|
+
const diff = dateLeft.getTime() - dateRight.getTime();
|
1022
|
+
return diff < 0 ? -1 : diff > 0 ? 1 : diff;
|
1023
|
+
};
|
1024
|
+
var diffInYears = (dateLeft, dateRight) => {
|
1025
|
+
const sign = compareAsc(dateLeft, dateRight);
|
1026
|
+
const yearDiff = Math.abs(dateLeft.getFullYear() - dateRight.getFullYear());
|
1027
|
+
dateLeft.setFullYear(dateLeft.getFullYear() - sign * yearDiff);
|
1028
|
+
const isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
|
1029
|
+
const result = sign * (yearDiff - +isLastYearNotFull);
|
1030
|
+
return result === 0 ? 0 : result;
|
1031
|
+
};
|
1032
|
+
var luhn = (str) => {
|
1033
|
+
let sum = 0;
|
1034
|
+
str += "";
|
1035
|
+
for (let i = 0, l = str.length; i < l; i++) {
|
1036
|
+
let v = parseInt(str[i]);
|
1037
|
+
v *= 2 - i % 2;
|
1038
|
+
if (v > 9) {
|
1039
|
+
v -= 9;
|
1040
|
+
}
|
1041
|
+
sum += v;
|
1042
|
+
}
|
1043
|
+
return Math.ceil(sum / 10) * 10 - sum;
|
1044
|
+
};
|
1045
|
+
var testDate = (year, month, day) => {
|
1046
|
+
month -= 1;
|
1047
|
+
const date = new Date(year, month, day);
|
1048
|
+
return !(date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day);
|
1049
|
+
};
|
1050
|
+
|
1051
|
+
// src/index.ts
|
1052
|
+
var Personnummer = class {
|
1053
|
+
/**
|
1054
|
+
* Personnummer constructor.
|
1055
|
+
*
|
1056
|
+
* @param {string} pin
|
1057
|
+
* @param {object} options
|
1058
|
+
*/
|
1059
|
+
constructor(pin, options) {
|
1060
|
+
/**
|
1061
|
+
* Personnummer century.
|
1062
|
+
*
|
1063
|
+
* @var {string}
|
1064
|
+
*/
|
1065
|
+
this._century = "";
|
1066
|
+
/**
|
1067
|
+
* Personnummer full year.
|
1068
|
+
*
|
1069
|
+
* @var {string}
|
1070
|
+
*/
|
1071
|
+
this._fullYear = "";
|
1072
|
+
/**
|
1073
|
+
* Personnummer year.
|
1074
|
+
*
|
1075
|
+
* @var {string}
|
1076
|
+
*/
|
1077
|
+
this._year = "";
|
1078
|
+
/**
|
1079
|
+
* Personnummer month.
|
1080
|
+
*
|
1081
|
+
* @var {string}
|
1082
|
+
*/
|
1083
|
+
this._month = "";
|
1084
|
+
/**
|
1085
|
+
* Personnummer day.
|
1086
|
+
*
|
1087
|
+
* @var {string}
|
1088
|
+
*/
|
1089
|
+
this._day = "";
|
1090
|
+
/**
|
1091
|
+
* Personnummer seperator.
|
1092
|
+
*
|
1093
|
+
* @var {string}
|
1094
|
+
*/
|
1095
|
+
this._sep = "";
|
1096
|
+
/**
|
1097
|
+
* Personnumer first three of the last four numbers.
|
1098
|
+
*
|
1099
|
+
* @var {string}
|
1100
|
+
*/
|
1101
|
+
this._num = "";
|
1102
|
+
/**
|
1103
|
+
* The last number of the personnummer.
|
1104
|
+
*
|
1105
|
+
* @var {string}
|
1106
|
+
*/
|
1107
|
+
this._check = "";
|
1108
|
+
this.parse(pin, {
|
1109
|
+
allowCoordinationNumber: true,
|
1110
|
+
allowInterimNumber: false,
|
1111
|
+
...options
|
1112
|
+
});
|
1113
|
+
}
|
1114
|
+
/**
|
1115
|
+
* Get century.
|
1116
|
+
*
|
1117
|
+
* @return {string}
|
1118
|
+
*/
|
1119
|
+
get century() {
|
1120
|
+
return this._century;
|
1121
|
+
}
|
1122
|
+
/**
|
1123
|
+
* Get age.
|
1124
|
+
*
|
1125
|
+
* @return {string}
|
1126
|
+
*/
|
1127
|
+
get fullYear() {
|
1128
|
+
return this._fullYear;
|
1129
|
+
}
|
1130
|
+
/**
|
1131
|
+
* Get age.
|
1132
|
+
*
|
1133
|
+
* @return {string}
|
1134
|
+
*/
|
1135
|
+
get year() {
|
1136
|
+
return this._year;
|
1137
|
+
}
|
1138
|
+
/**
|
1139
|
+
* Get month.
|
1140
|
+
*
|
1141
|
+
* @return {string}
|
1142
|
+
*/
|
1143
|
+
get month() {
|
1144
|
+
return this._month;
|
1145
|
+
}
|
1146
|
+
/**
|
1147
|
+
* Get day.
|
1148
|
+
*
|
1149
|
+
* @return {string}
|
1150
|
+
*/
|
1151
|
+
get day() {
|
1152
|
+
return this._day;
|
1153
|
+
}
|
1154
|
+
/**
|
1155
|
+
* Get sep.
|
1156
|
+
*
|
1157
|
+
* @return {string}
|
1158
|
+
*/
|
1159
|
+
get sep() {
|
1160
|
+
return this._sep;
|
1161
|
+
}
|
1162
|
+
/**
|
1163
|
+
* Get num.
|
1164
|
+
*
|
1165
|
+
* @return {string}
|
1166
|
+
*/
|
1167
|
+
get num() {
|
1168
|
+
return this._num;
|
1169
|
+
}
|
1170
|
+
/**
|
1171
|
+
* Get check.
|
1172
|
+
*
|
1173
|
+
* @return {string}
|
1174
|
+
*/
|
1175
|
+
get check() {
|
1176
|
+
return this._check;
|
1177
|
+
}
|
1178
|
+
/**
|
1179
|
+
* Parse personnummer.
|
1180
|
+
*
|
1181
|
+
* @param {string} pin
|
1182
|
+
* @param {object} options
|
1183
|
+
*
|
1184
|
+
* @return {Personnummer}
|
1185
|
+
*/
|
1186
|
+
static parse(pin, options) {
|
1187
|
+
return new Personnummer(pin, options);
|
1188
|
+
}
|
1189
|
+
/**
|
1190
|
+
* Validate a Swedish personal identity number.
|
1191
|
+
*
|
1192
|
+
* @param {string} str
|
1193
|
+
* @param {object} options
|
1194
|
+
*
|
1195
|
+
* @return {boolean}
|
1196
|
+
*/
|
1197
|
+
static valid(pin, options) {
|
1198
|
+
try {
|
1199
|
+
Personnummer.parse(pin, options);
|
1200
|
+
return true;
|
1201
|
+
} catch (e) {
|
1202
|
+
return false;
|
1203
|
+
}
|
1204
|
+
}
|
1205
|
+
/**
|
1206
|
+
* Parse personnummer and set class properties.
|
1207
|
+
*
|
1208
|
+
* @param {string} pin
|
1209
|
+
* @param {object} options
|
1210
|
+
*/
|
1211
|
+
parse(pin, options) {
|
1212
|
+
if (pin.length < 10 || pin.length > 13) {
|
1213
|
+
throw new PersonnummerError();
|
1214
|
+
}
|
1215
|
+
const reg = /^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;
|
1216
|
+
const match = reg.exec(pin);
|
1217
|
+
if (!match) {
|
1218
|
+
throw new PersonnummerError();
|
1219
|
+
}
|
1220
|
+
const century = match[1];
|
1221
|
+
const year = match[2];
|
1222
|
+
const month = match[3];
|
1223
|
+
const day = match[4];
|
1224
|
+
const sep = match[5];
|
1225
|
+
const num = match[6];
|
1226
|
+
const check = match[7];
|
1227
|
+
if (typeof century === "undefined" || !century.length) {
|
1228
|
+
const d = /* @__PURE__ */ new Date();
|
1229
|
+
let baseYear = 0;
|
1230
|
+
if (sep === "+") {
|
1231
|
+
this._sep = "+";
|
1232
|
+
baseYear = d.getFullYear() - 100;
|
1233
|
+
} else {
|
1234
|
+
this._sep = "-";
|
1235
|
+
baseYear = d.getFullYear();
|
1236
|
+
}
|
1237
|
+
this._century = ("" + (baseYear - (baseYear - parseInt(year)) % 100)).substr(0, 2);
|
1238
|
+
} else {
|
1239
|
+
this._century = century;
|
1240
|
+
if ((/* @__PURE__ */ new Date()).getFullYear() - parseInt(century + year, 10) < 100) {
|
1241
|
+
this._sep = "-";
|
1242
|
+
} else {
|
1243
|
+
this._sep = "+";
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
this._year = year;
|
1247
|
+
this._fullYear = this._century + year;
|
1248
|
+
this._month = month;
|
1249
|
+
this._day = day;
|
1250
|
+
this._num = num;
|
1251
|
+
this._check = check;
|
1252
|
+
if (!this.valid()) {
|
1253
|
+
throw new PersonnummerError();
|
1254
|
+
}
|
1255
|
+
if (!(options == null ? void 0 : options.allowCoordinationNumber) && this.isCoordinationNumber()) {
|
1256
|
+
throw new PersonnummerError();
|
1257
|
+
}
|
1258
|
+
if (!(options == null ? void 0 : options.allowInterimNumber) && this.isInterimNumber()) {
|
1259
|
+
throw new PersonnummerError();
|
1260
|
+
}
|
1261
|
+
}
|
1262
|
+
/**
|
1263
|
+
* Validate a Swedish personal identity number.
|
1264
|
+
*
|
1265
|
+
* @return {boolean}
|
1266
|
+
*/
|
1267
|
+
valid() {
|
1268
|
+
const valid = luhn(
|
1269
|
+
this.year + this.month + this.day + this.num.replace(/[TRSUWXJKLMN]/, "1")
|
1270
|
+
) === +this.check && !!this.check;
|
1271
|
+
if (valid && testDate(parseInt(this.century + this.year), +this.month, +this.day)) {
|
1272
|
+
return valid;
|
1273
|
+
}
|
1274
|
+
return valid && testDate(parseInt(this.century + this.year), +this.month, +this.day - 60);
|
1275
|
+
}
|
1276
|
+
/**
|
1277
|
+
* Format a Swedish personal identity number as one of the official formats,
|
1278
|
+
* A long format or a short format.
|
1279
|
+
*
|
1280
|
+
* If the input number could not be parsed a empty string will be returned.
|
1281
|
+
*
|
1282
|
+
* @param {boolean} longFormat
|
1283
|
+
*
|
1284
|
+
* @return {string}
|
1285
|
+
*/
|
1286
|
+
format(longFormat = false) {
|
1287
|
+
if (longFormat) {
|
1288
|
+
return `${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`;
|
1289
|
+
}
|
1290
|
+
return `${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`;
|
1291
|
+
}
|
1292
|
+
/**
|
1293
|
+
* Get age from a Swedish personal identity number.
|
1294
|
+
*
|
1295
|
+
* @return {number}
|
1296
|
+
*/
|
1297
|
+
getAge() {
|
1298
|
+
const date = this.getDate();
|
1299
|
+
return diffInYears(new Date(Date.now()), date);
|
1300
|
+
}
|
1301
|
+
/**
|
1302
|
+
* Get date from a Swedish personal identity number.
|
1303
|
+
*
|
1304
|
+
* @return {Date}
|
1305
|
+
*/
|
1306
|
+
getDate() {
|
1307
|
+
let ageDay = +this.day;
|
1308
|
+
if (this.isCoordinationNumber()) {
|
1309
|
+
ageDay -= 60;
|
1310
|
+
}
|
1311
|
+
const ageDate = this.century + this.year + "-" + this.month + "-" + (ageDay < 10 ? "0" + ageDay : ageDay);
|
1312
|
+
return new Date(ageDate);
|
1313
|
+
}
|
1314
|
+
/**
|
1315
|
+
* Check if a Swedish personal identity number is a interim number or not.
|
1316
|
+
*
|
1317
|
+
* @return {boolean}
|
1318
|
+
*/
|
1319
|
+
isInterimNumber() {
|
1320
|
+
return /[TRSUWXJKLMN]/.test(this.num[0]);
|
1321
|
+
}
|
1322
|
+
/**
|
1323
|
+
* Check if a Swedish personal identity number is a coordination number or not.
|
1324
|
+
*
|
1325
|
+
* @return {boolean}
|
1326
|
+
*/
|
1327
|
+
isCoordinationNumber() {
|
1328
|
+
return testDate(
|
1329
|
+
parseInt(this.century + this.year),
|
1330
|
+
+this.month,
|
1331
|
+
+this.day - 60
|
1332
|
+
);
|
1333
|
+
}
|
1334
|
+
/**
|
1335
|
+
* Check if a Swedish personal identity number is for a female.
|
1336
|
+
*
|
1337
|
+
* @return {boolean}
|
1338
|
+
*/
|
1339
|
+
isFemale() {
|
1340
|
+
return !this.isMale();
|
1341
|
+
}
|
1342
|
+
/**
|
1343
|
+
* Check if a Swedish personal identity number is for a male.
|
1344
|
+
*
|
1345
|
+
* @return {boolean}
|
1346
|
+
*/
|
1347
|
+
isMale() {
|
1348
|
+
const sexDigit = parseInt(this.num.substr(-1));
|
1349
|
+
return sexDigit % 2 === 1;
|
1350
|
+
}
|
1351
|
+
};
|
1352
|
+
var src_default = Personnummer;
|
1353
|
+
|
1354
|
+
function createCommonjsModule(fn, basedir, module) {
|
1355
|
+
return module = {
|
1356
|
+
path: basedir,
|
1357
|
+
exports: {},
|
1358
|
+
require: function (path, base) {
|
1359
|
+
return commonjsRequire();
|
1360
|
+
}
|
1361
|
+
}, fn(module, module.exports), module.exports;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
function commonjsRequire () {
|
1365
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
var utf8 = createCommonjsModule(function (module, exports) {
|
1369
|
+
// tslint:disable:no-bitwise
|
1370
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
1371
|
+
exports.utf8 = void 0;
|
1372
|
+
exports.utf8 = {
|
1373
|
+
encode: encode,
|
1374
|
+
decode: decode,
|
1375
|
+
};
|
1376
|
+
function encode(unicodeText) {
|
1377
|
+
unicodeText = unicodeText.replace(/\r\n/g, "\n");
|
1378
|
+
var result = "";
|
1379
|
+
for (var i = 0; i < unicodeText.length; i++) {
|
1380
|
+
var char = unicodeText.charCodeAt(i);
|
1381
|
+
if (char < 128) {
|
1382
|
+
result += String.fromCharCode(char);
|
1383
|
+
}
|
1384
|
+
else if (char > 127 && char < 2048) {
|
1385
|
+
result += String.fromCharCode((char >> 6) | 192);
|
1386
|
+
result += String.fromCharCode((char & 63) | 128);
|
1387
|
+
}
|
1388
|
+
else {
|
1389
|
+
result += String.fromCharCode((char >> 12) | 224);
|
1390
|
+
result += String.fromCharCode(((char >> 6) & 63) | 128);
|
1391
|
+
result += String.fromCharCode((char & 63) | 128);
|
1392
|
+
}
|
1393
|
+
}
|
1394
|
+
return result;
|
1395
|
+
}
|
1396
|
+
function decode(utf8Text) {
|
1397
|
+
var result = "";
|
1398
|
+
var i = 0;
|
1399
|
+
var char1 = 0;
|
1400
|
+
var char2 = 0;
|
1401
|
+
var char3 = 0;
|
1402
|
+
while (i < utf8Text.length) {
|
1403
|
+
char1 = utf8Text.charCodeAt(i);
|
1404
|
+
if (char1 < 128) {
|
1405
|
+
result += String.fromCharCode(char1);
|
1406
|
+
i++;
|
1407
|
+
}
|
1408
|
+
else if (char1 > 191 && char1 < 224) {
|
1409
|
+
char2 = utf8Text.charCodeAt(i + 1);
|
1410
|
+
result += String.fromCharCode(((char1 & 31) << 6) | (char2 & 63));
|
1411
|
+
i += 2;
|
1412
|
+
}
|
1413
|
+
else {
|
1414
|
+
char2 = utf8Text.charCodeAt(i + 1);
|
1415
|
+
char3 = utf8Text.charCodeAt(i + 2);
|
1416
|
+
result += String.fromCharCode(((char1 & 15) << 12) | ((char2 & 63) << 6) | (char3 & 63));
|
1417
|
+
i += 3;
|
1418
|
+
}
|
1419
|
+
}
|
1420
|
+
return result;
|
1421
|
+
}
|
1422
|
+
});
|
1423
|
+
|
1424
|
+
var md5 = createCommonjsModule(function (module, exports) {
|
1425
|
+
// tslint:disable:no-bitwise
|
1426
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
1427
|
+
exports.generate = void 0;
|
1428
|
+
|
1429
|
+
function generate(unicodeText) {
|
1430
|
+
var x = [];
|
1431
|
+
var k;
|
1432
|
+
var AA;
|
1433
|
+
var BB;
|
1434
|
+
var CC;
|
1435
|
+
var DD;
|
1436
|
+
var a;
|
1437
|
+
var b;
|
1438
|
+
var c;
|
1439
|
+
var d;
|
1440
|
+
var S11 = 7;
|
1441
|
+
var S12 = 12;
|
1442
|
+
var S13 = 17;
|
1443
|
+
var S14 = 22;
|
1444
|
+
var S21 = 5;
|
1445
|
+
var S22 = 9;
|
1446
|
+
var S23 = 14;
|
1447
|
+
var S24 = 20;
|
1448
|
+
var S31 = 4;
|
1449
|
+
var S32 = 11;
|
1450
|
+
var S33 = 16;
|
1451
|
+
var S34 = 23;
|
1452
|
+
var S41 = 6;
|
1453
|
+
var S42 = 10;
|
1454
|
+
var S43 = 15;
|
1455
|
+
var S44 = 21;
|
1456
|
+
var utf8Text = utf8.utf8.encode(unicodeText);
|
1457
|
+
x = convertToWordArray(utf8Text);
|
1458
|
+
a = 0x67452301;
|
1459
|
+
b = 0xefcdab89;
|
1460
|
+
c = 0x98badcfe;
|
1461
|
+
d = 0x10325476;
|
1462
|
+
for (k = 0; k < x.length; k += 16) {
|
1463
|
+
AA = a;
|
1464
|
+
BB = b;
|
1465
|
+
CC = c;
|
1466
|
+
DD = d;
|
1467
|
+
a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);
|
1468
|
+
d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);
|
1469
|
+
c = FF(c, d, a, b, x[k + 2], S13, 0x242070db);
|
1470
|
+
b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);
|
1471
|
+
a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);
|
1472
|
+
d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);
|
1473
|
+
c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613);
|
1474
|
+
b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501);
|
1475
|
+
a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8);
|
1476
|
+
d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);
|
1477
|
+
c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);
|
1478
|
+
b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);
|
1479
|
+
a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122);
|
1480
|
+
d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193);
|
1481
|
+
c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e);
|
1482
|
+
b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821);
|
1483
|
+
a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);
|
1484
|
+
d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340);
|
1485
|
+
c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);
|
1486
|
+
b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);
|
1487
|
+
a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);
|
1488
|
+
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
|
1489
|
+
c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);
|
1490
|
+
b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);
|
1491
|
+
a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);
|
1492
|
+
d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);
|
1493
|
+
c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);
|
1494
|
+
b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);
|
1495
|
+
a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);
|
1496
|
+
d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);
|
1497
|
+
c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);
|
1498
|
+
b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);
|
1499
|
+
a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);
|
1500
|
+
d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681);
|
1501
|
+
c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);
|
1502
|
+
b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);
|
1503
|
+
a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);
|
1504
|
+
d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);
|
1505
|
+
c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);
|
1506
|
+
b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);
|
1507
|
+
a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);
|
1508
|
+
d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);
|
1509
|
+
c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);
|
1510
|
+
b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05);
|
1511
|
+
a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);
|
1512
|
+
d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);
|
1513
|
+
c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);
|
1514
|
+
b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);
|
1515
|
+
a = II(a, b, c, d, x[k + 0], S41, 0xf4292244);
|
1516
|
+
d = II(d, a, b, c, x[k + 7], S42, 0x432aff97);
|
1517
|
+
c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7);
|
1518
|
+
b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039);
|
1519
|
+
a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3);
|
1520
|
+
d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);
|
1521
|
+
c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d);
|
1522
|
+
b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1);
|
1523
|
+
a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);
|
1524
|
+
d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);
|
1525
|
+
c = II(c, d, a, b, x[k + 6], S43, 0xa3014314);
|
1526
|
+
b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);
|
1527
|
+
a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82);
|
1528
|
+
d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235);
|
1529
|
+
c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);
|
1530
|
+
b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391);
|
1531
|
+
a = addUnsigned(a, AA);
|
1532
|
+
b = addUnsigned(b, BB);
|
1533
|
+
c = addUnsigned(c, CC);
|
1534
|
+
d = addUnsigned(d, DD);
|
1535
|
+
}
|
1536
|
+
return wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
|
1537
|
+
}
|
1538
|
+
exports.generate = generate;
|
1539
|
+
function rotateLeft(lValue, iShiftBits) {
|
1540
|
+
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
|
1541
|
+
}
|
1542
|
+
function addUnsigned(lX, lY) {
|
1543
|
+
var lX4;
|
1544
|
+
var lY4;
|
1545
|
+
var lX8;
|
1546
|
+
var lY8;
|
1547
|
+
var lResult;
|
1548
|
+
lX8 = lX & 0x80000000;
|
1549
|
+
lY8 = lY & 0x80000000;
|
1550
|
+
lX4 = lX & 0x40000000;
|
1551
|
+
lY4 = lY & 0x40000000;
|
1552
|
+
lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);
|
1553
|
+
if (lX4 & lY4) {
|
1554
|
+
return lResult ^ 0x80000000 ^ lX8 ^ lY8;
|
1555
|
+
}
|
1556
|
+
if (lX4 | lY4) {
|
1557
|
+
if (lResult & 0x40000000) {
|
1558
|
+
return lResult ^ 0xc0000000 ^ lX8 ^ lY8;
|
1559
|
+
}
|
1560
|
+
else {
|
1561
|
+
return lResult ^ 0x40000000 ^ lX8 ^ lY8;
|
1562
|
+
}
|
1563
|
+
}
|
1564
|
+
else {
|
1565
|
+
return lResult ^ lX8 ^ lY8;
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
function F(x, y, z) {
|
1569
|
+
return (x & y) | (~x & z);
|
1570
|
+
}
|
1571
|
+
function G(x, y, z) {
|
1572
|
+
return (x & z) | (y & ~z);
|
1573
|
+
}
|
1574
|
+
function H(x, y, z) {
|
1575
|
+
return x ^ y ^ z;
|
1576
|
+
}
|
1577
|
+
function I(x, y, z) {
|
1578
|
+
return y ^ (x | ~z);
|
1579
|
+
}
|
1580
|
+
function FF(a, b, c, d, x, s, ac) {
|
1581
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
|
1582
|
+
return addUnsigned(rotateLeft(a, s), b);
|
1583
|
+
}
|
1584
|
+
function GG(a, b, c, d, x, s, ac) {
|
1585
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
|
1586
|
+
return addUnsigned(rotateLeft(a, s), b);
|
1587
|
+
}
|
1588
|
+
function HH(a, b, c, d, x, s, ac) {
|
1589
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
|
1590
|
+
return addUnsigned(rotateLeft(a, s), b);
|
1591
|
+
}
|
1592
|
+
function II(a, b, c, d, x, s, ac) {
|
1593
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
|
1594
|
+
return addUnsigned(rotateLeft(a, s), b);
|
1595
|
+
}
|
1596
|
+
function convertToWordArray(value) {
|
1597
|
+
var lWordCount;
|
1598
|
+
var lMessageLength = value.length;
|
1599
|
+
var lNumberOfWordsTemp1 = lMessageLength + 8;
|
1600
|
+
var lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64;
|
1601
|
+
var lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16;
|
1602
|
+
var lWordArray = Array(lNumberOfWords - 1);
|
1603
|
+
var lBytePosition = 0;
|
1604
|
+
var lByteCount = 0;
|
1605
|
+
while (lByteCount < lMessageLength) {
|
1606
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
1607
|
+
lBytePosition = (lByteCount % 4) * 8;
|
1608
|
+
lWordArray[lWordCount] =
|
1609
|
+
lWordArray[lWordCount] | (value.charCodeAt(lByteCount) << lBytePosition);
|
1610
|
+
lByteCount++;
|
1611
|
+
}
|
1612
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
1613
|
+
lBytePosition = (lByteCount % 4) * 8;
|
1614
|
+
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
|
1615
|
+
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
|
1616
|
+
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
|
1617
|
+
return lWordArray;
|
1618
|
+
}
|
1619
|
+
function wordToHex(lValue) {
|
1620
|
+
var wordToHexValue = "";
|
1621
|
+
var wordToHexValueTemp = "";
|
1622
|
+
var lByte;
|
1623
|
+
var lCount;
|
1624
|
+
for (lCount = 0; lCount <= 3; lCount++) {
|
1625
|
+
lByte = (lValue >>> (lCount * 8)) & 255;
|
1626
|
+
wordToHexValueTemp = "0" + lByte.toString(16);
|
1627
|
+
wordToHexValue =
|
1628
|
+
wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2);
|
1629
|
+
}
|
1630
|
+
return wordToHexValue;
|
1631
|
+
}
|
1632
|
+
});
|
1633
|
+
|
1634
|
+
var lib = createCommonjsModule(function (module, exports) {
|
1635
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
1636
|
+
exports.MD5 = exports.generate = void 0;
|
1637
|
+
|
1638
|
+
var md5_2 = md5;
|
1639
|
+
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return md5_2.generate; } });
|
1640
|
+
exports.MD5 = {
|
1641
|
+
generate: md5.generate,
|
1642
|
+
};
|
1643
|
+
});
|
1644
|
+
|
1645
|
+
const apiSearch = async (query) => {
|
1646
|
+
const res = await fetch(getCreditSafeApiUrl(), {
|
1647
|
+
method: 'POST',
|
1648
|
+
headers: {
|
1649
|
+
'Content-Type': 'application/json',
|
1650
|
+
},
|
1651
|
+
body: JSON.stringify({
|
1652
|
+
query,
|
1653
|
+
hash: lib.MD5.generate(String.fromCharCode(83, 101, 67, 82, 101, 116) + query),
|
1654
|
+
}),
|
1655
|
+
});
|
1656
|
+
const data = await res.json();
|
1657
|
+
return data;
|
1658
|
+
};
|
1659
|
+
|
1660
|
+
const HemfixarnaGetuser = class {
|
1661
|
+
constructor(hostRef) {
|
1662
|
+
index.registerInstance(this, hostRef);
|
1663
|
+
this.handleChangeEmail = (e) => {
|
1664
|
+
this.emailError = null;
|
1665
|
+
this.email = e.target.value;
|
1666
|
+
};
|
1667
|
+
this.handleChangePhone = (e) => {
|
1668
|
+
this.phoneError = null;
|
1669
|
+
this.phone = e.target.value;
|
1670
|
+
};
|
1671
|
+
this.handleChangessn = (e) => {
|
1672
|
+
this.ssnError = null;
|
1673
|
+
this.ssn = e.target.value;
|
1674
|
+
};
|
1675
|
+
this.handleSubmit = async (e) => {
|
1676
|
+
e.preventDefault();
|
1677
|
+
const emailRegex = 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,}))$/);
|
1678
|
+
const validEmail = emailRegex.test(this.email);
|
1679
|
+
if (!validEmail) {
|
1680
|
+
this.emailError = 'Ange en giltig e-postadress';
|
1681
|
+
}
|
1682
|
+
const validPhone = /^[\d\s()+-]{6,}$/.test(this.phone);
|
1683
|
+
if (!validPhone) {
|
1684
|
+
this.phoneError = 'Ange ett giltigt telefonnummer';
|
1685
|
+
}
|
1686
|
+
const validssn = src_default.valid(this.ssn);
|
1687
|
+
if (!validssn) {
|
1688
|
+
this.ssnError = 'Ange ett giltigt personnummer';
|
1689
|
+
}
|
1690
|
+
else if (validssn) {
|
1691
|
+
const pn = src_default.parse(this.ssn).format(true);
|
1692
|
+
this.ssn = [pn.slice(0, 8), '-', pn.slice(8)].join('');
|
1693
|
+
}
|
1694
|
+
if (validEmail && validPhone && validssn) {
|
1695
|
+
try {
|
1696
|
+
const creditSafeData = await apiSearch(this.ssn);
|
1697
|
+
if (creditSafeData) {
|
1698
|
+
index$1.state.creditSafeUser = creditSafeData;
|
1699
|
+
index$1.state.checkoutStep = 2;
|
1700
|
+
index$1.state.user = Object.assign(Object.assign({}, creditSafeData), { email: this.email, phone: this.phone, ssn: this.ssn });
|
1701
|
+
}
|
1702
|
+
else {
|
1703
|
+
this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';
|
1704
|
+
}
|
1705
|
+
}
|
1706
|
+
catch (e) {
|
1707
|
+
this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';
|
1708
|
+
console.log(e);
|
1709
|
+
}
|
1710
|
+
finally {
|
1711
|
+
const el = this.el.closest('.hemfixarna_content');
|
1712
|
+
scrollToTop(el);
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
};
|
1716
|
+
this.render = () => {
|
1717
|
+
return (index.h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), index.h("label", { htmlFor: "email" }, "E-post ")), this.emailError && index.h("span", null, this.emailError), index.h("div", null, index.h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), index.h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && index.h("span", null, this.phoneError), index.h("div", null, index.h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), index.h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && index.h("span", null, this.ssnError), index.h("input", { type: "submit", value: "Forts\u00E4tt*" }), index.h("p", null, "*Vi h\u00E4mtar din adress")));
|
1718
|
+
};
|
1719
|
+
this.email = '';
|
1720
|
+
this.emailError = null;
|
1721
|
+
this.phone = '';
|
1722
|
+
this.phoneError = null;
|
1723
|
+
this.ssn = '';
|
1724
|
+
this.ssnError = null;
|
1725
|
+
}
|
1726
|
+
componentWillLoad() {
|
1727
|
+
if (index$1.state.user) {
|
1728
|
+
this.email = index$1.state.user.email;
|
1729
|
+
this.phone = index$1.state.user.phone;
|
1730
|
+
this.ssn = index$1.state.user.ssn;
|
1731
|
+
}
|
1732
|
+
}
|
1733
|
+
get el() { return index.getElement(this); }
|
1734
|
+
};
|
1735
|
+
|
1736
|
+
const HemfixarnaInfo = class {
|
1737
|
+
constructor(hostRef) {
|
1738
|
+
index.registerInstance(this, hostRef);
|
1739
|
+
this.logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
1740
|
+
}
|
1741
|
+
render() {
|
1742
|
+
var _a, _b;
|
1743
|
+
const checked = index.getAssetPath(`./assets/checked.svg`);
|
1744
|
+
return (index.h("div", { class: "hemfixarna_info" }, index$1.state.step < 5 ? (index.h(index.Fragment, null, index.h("h2", null, index$1.state.customer.info_title), index.h("p", null, index$1.state.customer.info_text))) : (index.h("h2", null, index$1.state.customer.checkout_title)), index.h("ul", { class: "hemfixarna_features" }, index$1.state.step < 5 ? (index.h(index.Fragment, null, ((_a = index$1.state.customer.trust_badges) === null || _a === void 0 ? void 0 : _a.length) ? (index.h(index.Fragment, null, index$1.state.customer.trust_badges.map(l => (index.h("li", { key: l.text }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.text)))))) : (index.h(index.Fragment, null, index$1.state.options.trust.map(l => (index.h("li", { key: l.trust_badge }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.trust_badge)))))))) : (index.h(index.Fragment, null, (_b = index$1.state.customer.checkout_trust_badges) === null || _b === void 0 ? void 0 : _b.map(l => (index.h("li", { key: l.text }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.text))))))), index.h("img", { src: this.logo, width: 200, alt: "hemfixarna" }), index.h("a", { class: "hemfixarna_product--link", target: "_blank", href: index$1.state.options.link.url }, index$1.state.options.link.title)));
|
1745
|
+
}
|
1746
|
+
};
|
1747
|
+
|
1748
|
+
const hemfixarnaInvoiceCss = ":host .invoice{gap:16px;display:grid}:host .invoice form>span{text-align:center;padding:16px 0}:host .invoice img{right:unset;left:unset;position:initial;transform:none}:host .invoice label{cursor:pointer;font-size:14px;display:flex;align-items:flex-start;padding:16px 0}:host .invoice label input{margin:0 5px 0 0;accent-color:#ea662c}:host .invoice-preview{display:flex;gap:4px}:host .invoice-preview div{position:relative}:host .invoice-preview div button{position:absolute;top:0;right:0;padding:0}:host .invoice-preview div button img{width:24px;height:24px}:host .invoice-preview div>img{width:100px;height:80px;object-fit:cover}:host .invoice input[type=email],:host .invoice input[type=tel],:host .invoice textarea{padding:16px;border:1px solid #fcd9c9;font-size:16px}:host .invoice textarea{resize:none;height:200px;font-family:\"Inter\", sans-serif}:host .invoice div:has(>input[type=file]){display:flex;align-items:center;justify-content:center;cursor:pointer;background:#fff;border:1px solid #fcd9c9;padding:32px 16px;gap:16px}:host .invoice div:has(>input[type=file]) span{color:#000;font-size:12px}:host .invoice input[type=file]{display:none}";
|
1749
|
+
|
1750
|
+
const base = `${getApiUrl()}/wp-json/headless`;
|
1751
|
+
const HemfixarnaInvoice = class {
|
1752
|
+
constructor(hostRef) {
|
1753
|
+
index.registerInstance(this, hostRef);
|
1754
|
+
this.formError = null;
|
1755
|
+
this.displayImages = [];
|
1756
|
+
this.formImages = [];
|
1757
|
+
this.formState = 'initial';
|
1758
|
+
}
|
1759
|
+
isValidEmail(email) {
|
1760
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
1761
|
+
return emailRegex.test(email);
|
1762
|
+
}
|
1763
|
+
componentDidRender() {
|
1764
|
+
const form = this.el.querySelector('form');
|
1765
|
+
if (form) {
|
1766
|
+
form.addEventListener('input', () => {
|
1767
|
+
this.formError = null;
|
1768
|
+
});
|
1769
|
+
}
|
1770
|
+
}
|
1771
|
+
disconnectedCallback() {
|
1772
|
+
const form = this.el.querySelector('form');
|
1773
|
+
if (form) {
|
1774
|
+
form.removeEventListener('input', () => {
|
1775
|
+
this.formError = null;
|
1776
|
+
});
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
async submit(e) {
|
1780
|
+
var _a;
|
1781
|
+
e.preventDefault();
|
1782
|
+
this.formState = 'loading';
|
1783
|
+
this.formError = null;
|
1784
|
+
const form = e.currentTarget.elements;
|
1785
|
+
const values = {
|
1786
|
+
description: form.descriptionInput.value.length ? form.descriptionInput.value : null,
|
1787
|
+
email: form.emailInput.value.length ? form.emailInput.value : null,
|
1788
|
+
tel: form.telInput.value.length ? form.telInput.value : null,
|
1789
|
+
terms: (_a = form.termsInput) === null || _a === void 0 ? void 0 : _a.checked,
|
1790
|
+
};
|
1791
|
+
if (!values.description) {
|
1792
|
+
this.formError = 'Vänligen fyll i formulärtexten';
|
1793
|
+
this.formState = 'initial';
|
1794
|
+
return;
|
1795
|
+
}
|
1796
|
+
if (!values.email || !this.isValidEmail(values.email)) {
|
1797
|
+
this.formError = 'Vänligen ange en giltig e-postadress';
|
1798
|
+
this.formState = 'initial';
|
1799
|
+
return;
|
1800
|
+
}
|
1801
|
+
if (!values.tel) {
|
1802
|
+
this.formError = 'Vänligen ange ditt telefonnummer';
|
1803
|
+
this.formState = 'initial';
|
1804
|
+
return;
|
1805
|
+
}
|
1806
|
+
if (index$1.state.selectedProduct.terms_show_checkbox && !values.terms) {
|
1807
|
+
this.formError = 'Vänligen acceptera villkoren';
|
1808
|
+
this.formState = 'initial';
|
1809
|
+
return;
|
1810
|
+
}
|
1811
|
+
const formData = new FormData();
|
1812
|
+
formData.append('text', values.description);
|
1813
|
+
formData.append('email', values.email);
|
1814
|
+
formData.append('phone', values.tel);
|
1815
|
+
formData.append('customer', index$1.state.business);
|
1816
|
+
this.formImages.forEach(file => {
|
1817
|
+
formData.append('images[]', file);
|
1818
|
+
});
|
1819
|
+
formData.append('product', JSON.stringify({
|
1820
|
+
title: index$1.state.selectedProduct.title,
|
1821
|
+
amount: 1,
|
1822
|
+
has_rut: index$1.state.selectedProduct.rut,
|
1823
|
+
has_rot: index$1.state.selectedProduct.rot,
|
1824
|
+
has_green: index$1.state.selectedProduct.green,
|
1825
|
+
ID: index$1.state.selectedProduct.ID,
|
1826
|
+
parts: [],
|
1827
|
+
}));
|
1828
|
+
try {
|
1829
|
+
const res = await fetch(`${base}/saveinvoiceproduct`, {
|
1830
|
+
method: 'POST',
|
1831
|
+
body: formData,
|
1832
|
+
});
|
1833
|
+
const { response } = await res.json();
|
1834
|
+
if (response.code === 200) {
|
1835
|
+
index$1.state.checkoutInvoice = true;
|
1836
|
+
index$1.state.step = 6;
|
1837
|
+
}
|
1838
|
+
else {
|
1839
|
+
this.formError = 'Vi kan inte ta emot din beställning just nu';
|
1840
|
+
this.formState = 'initial';
|
1841
|
+
}
|
1842
|
+
}
|
1843
|
+
catch (error) {
|
1844
|
+
this.formError = 'Vi kan inte ta emot din beställning just nu';
|
1845
|
+
this.formState = 'initial';
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
handleImageDrop(e) {
|
1849
|
+
e.preventDefault();
|
1850
|
+
const files = e.dataTransfer.files;
|
1851
|
+
for (let i = 0; i < files.length; i++) {
|
1852
|
+
const file = files[i];
|
1853
|
+
if (file.type.startsWith('image/')) {
|
1854
|
+
const reader = new FileReader();
|
1855
|
+
reader.onload = () => {
|
1856
|
+
this.displayImages = [...this.displayImages, reader.result];
|
1857
|
+
this.formImages = [...this.formImages, file];
|
1858
|
+
};
|
1859
|
+
reader.readAsDataURL(file);
|
1860
|
+
}
|
1861
|
+
}
|
1862
|
+
}
|
1863
|
+
handleFileInputChange(e) {
|
1864
|
+
e.preventDefault();
|
1865
|
+
const files = e.target.files;
|
1866
|
+
for (let i = 0; i < files.length; i++) {
|
1867
|
+
const file = files[i];
|
1868
|
+
if (file.type.startsWith('image/')) {
|
1869
|
+
const reader = new FileReader();
|
1870
|
+
reader.onload = () => {
|
1871
|
+
this.displayImages = [...this.displayImages, reader.result];
|
1872
|
+
this.formImages = [...this.formImages, file];
|
1873
|
+
};
|
1874
|
+
reader.readAsDataURL(file);
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
}
|
1878
|
+
handleImageClick() {
|
1879
|
+
this.el.querySelector('.hemfixarna-file-upload').click();
|
1880
|
+
}
|
1881
|
+
preventDragOver(e) {
|
1882
|
+
e.preventDefault();
|
1883
|
+
}
|
1884
|
+
removeImage(index) {
|
1885
|
+
this.displayImages = this.displayImages.filter((_, i) => i !== index);
|
1886
|
+
this.formImages = this.formImages.filter((_, i) => i !== index);
|
1887
|
+
}
|
1888
|
+
render() {
|
1889
|
+
var _a;
|
1890
|
+
const upload = index.getAssetPath(`./assets/drag-drop.svg`);
|
1891
|
+
return (index.h("div", { class: "invoice" }, ((_a = index$1.state.selectedProduct) === null || _a === void 0 ? void 0 : _a.invoice_description) ? index.h("p", null, index$1.state.selectedProduct.invoice_description) : null, index.h("form", { onSubmit: e => this.submit(e) }, index.h("textarea", { name: "descriptionInput", placeholder: "Beskriv ditt \u00E4rende" }), index.h("div", { role: "button", "aria-label": "upload image", onDragOver: e => this.preventDragOver(e), onDrop: e => this.handleImageDrop(e), onClick: () => this.handleImageClick() }, index.h("img", { src: upload, alt: "hemfixarna_logo", width: 24 }), index.h("div", null, index.h("p", null, "Bifoga ev bilder"), index.h("span", null, "(dra bilder hit)")), index.h("input", { onChange: e => this.handleFileInputChange(e), class: "hemfixarna-file-upload", accept: "image/*", type: "file", multiple: true, name: "fileInput" })), index.h("div", { class: "invoice-preview" }, this.displayImages.map((img, i) => (index.h("div", { key: i }, index.h("img", { src: img, alt: "uploaded image" }), index.h("button", { onClick: () => this.removeImage(i) }, index.h("img", { src: index.getAssetPath(`./assets/close.svg`), alt: "close" })))))), index.h("input", { placeholder: "E-post", type: "email", name: "emailInput" }), index.h("input", { placeholder: "Telefonnummer", type: "tel", name: "telInput" }), index$1.state.selectedProduct.terms_show_checkbox ? (index.h("label", null, index.h("input", { type: "checkbox", name: "termsInput" }), index$1.state.selectedProduct.terms)) : null, this.formError ? index.h("span", null, this.formError) : null, index.h("input", { type: "submit", value: this.formState === 'loading' ? 'Skickar' : 'Kontakta mig' }))));
|
1892
|
+
}
|
1893
|
+
get el() { return index.getElement(this); }
|
1894
|
+
};
|
1895
|
+
HemfixarnaInvoice.style = hemfixarnaInvoiceCss;
|
1896
|
+
|
1897
|
+
const HemfixarnaOrder = class {
|
1898
|
+
constructor(hostRef) {
|
1899
|
+
index.registerInstance(this, hostRef);
|
1900
|
+
this.render = () => {
|
1901
|
+
return (index.h("div", { style: { background: `url(${index$1.state.options.thank_you_image})` }, class: "hemfixarna_order" }, index.h("div", null), index.h("div", null, index.h("h2", null, index$1.state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), index$1.state.checkoutInvoice ? index.h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, index$1.state.checkoutInvoice ? index.h("div", null) : index.h("hemfixarna-orderrows", { cart: false }), index.h("span", { onClick: () => this.resetShop() }, index.h("button", null, "G\u00F6r en ny bokning")), index.h("hemfixarna-info", null))));
|
1902
|
+
};
|
1903
|
+
}
|
1904
|
+
resetShop() {
|
1905
|
+
index$1.state.step = 1;
|
1906
|
+
index$1.state.cart = [];
|
1907
|
+
index$1.state.selectedCategory = null;
|
1908
|
+
index$1.state.selectedService = null;
|
1909
|
+
index$1.state.selectedProduct = null;
|
1910
|
+
index$1.state.maleri = null;
|
1911
|
+
index$1.state.checkoutStep = 1;
|
1912
|
+
}
|
1913
|
+
disconnectedCallback() {
|
1914
|
+
this.resetShop();
|
1915
|
+
}
|
1916
|
+
};
|
1917
|
+
|
1918
|
+
const HemfixarnaOrderrows = class {
|
1919
|
+
constructor(hostRef) {
|
1920
|
+
index.registerInstance(this, hostRef);
|
1921
|
+
this.cart = true;
|
1922
|
+
}
|
1923
|
+
goToProduct(id) {
|
1924
|
+
const products = index$1.state.customer.categories
|
1925
|
+
.map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
|
1926
|
+
.flat()
|
1927
|
+
.flat();
|
1928
|
+
const product = products.find(p => p && p.fields.ID === id);
|
1929
|
+
if (product) {
|
1930
|
+
index$1.state.selectedProduct = product.fields;
|
1931
|
+
index$1.state.step = 4;
|
1932
|
+
}
|
1933
|
+
}
|
1934
|
+
openModal(title, text) {
|
1935
|
+
index$1.state.modal = {
|
1936
|
+
title,
|
1937
|
+
text,
|
1938
|
+
};
|
1939
|
+
}
|
1940
|
+
getDiscountedInfo(item) {
|
1941
|
+
if (item.rut && index$1.state.rut) {
|
1942
|
+
return ' (efter RUT-avdrag)';
|
1943
|
+
}
|
1944
|
+
else if (item.rot && index$1.state.rot) {
|
1945
|
+
return ' (efter ROT-avdrag)';
|
1946
|
+
}
|
1947
|
+
else if (item.green && index$1.state.green) {
|
1948
|
+
return ' (efter Grön teknik avdrag)';
|
1949
|
+
}
|
1950
|
+
else {
|
1951
|
+
return '';
|
1952
|
+
}
|
1953
|
+
}
|
1954
|
+
renderStartFees() {
|
1955
|
+
const startFees = new Set();
|
1956
|
+
const fees = [];
|
1957
|
+
index$1.state.cart.forEach(item => {
|
1958
|
+
const startFee = item.start_fee_obj;
|
1959
|
+
if (startFee && !startFees.has(startFee.ID)) {
|
1960
|
+
startFees.add(startFee.ID);
|
1961
|
+
const rotStartFee = item.rot ? calculateStartFee().rot : 0;
|
1962
|
+
const rutStartFee = item.rut ? calculateStartFee().rut : 0;
|
1963
|
+
const greenStartFee = item.green ? calculateStartFee().green : 0;
|
1964
|
+
fees.push({
|
1965
|
+
id: startFee.ID,
|
1966
|
+
name: startFee.title,
|
1967
|
+
price: startFee.price,
|
1968
|
+
text: startFee.pop_up,
|
1969
|
+
rot: rotStartFee,
|
1970
|
+
rut: rutStartFee,
|
1971
|
+
green: greenStartFee,
|
1972
|
+
});
|
1973
|
+
}
|
1974
|
+
});
|
1975
|
+
return fees.map(fee => (index.h("div", { key: fee.id, class: "hemfixarna_cart--startfee" }, index.h("p", { onClick: () => this.openModal(fee.name, fee.text) }, index.h("strong", null, fee.name), index.h("img", { height: 16, src: index.getAssetPath('./assets/info.svg'), alt: "info monteringsavgift" })), index.h("p", null, !fee.rut && !fee.rot && !fee.green && index.h("span", null, fee.price, "kr"), fee.rut > 0 && index.h("span", null, fee.rut, "kr (RUT)"), fee.rot > 0 && index.h("span", null, fee.rot, "kr (ROT)"), fee.green > 0 && index.h("span", null, fee.green, "kr (Gr\u00F6n teknik)")))));
|
1976
|
+
}
|
1977
|
+
render() {
|
1978
|
+
return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, Object.entries(groupCartItemsByStartFee(index$1.state.cart)).map(([startFeeID, items]) => (index.h("li", { key: startFeeID, class: "hemfixarna_cart--group" }, index.h("ul", null, items.map(item => {
|
1979
|
+
var _a;
|
1980
|
+
return (index.h("li", { class: "hemfixarna_cart--item", key: item.id }, 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"), index.h("span", null, this.getDiscountedInfo(item))), item.parts.length > 0 && (index.h("ul", null, item.parts.map(part => (index.h("li", { key: part.name }, 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")))))))));
|
1981
|
+
})))))), index.h("div", { class: "hemfixarna_cart--additional" }, this.renderStartFees(), this.cart && index$1.state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { checked: index$1.state.rot, onChange: () => (index$1.state.rot = !index$1.state.rot), type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", index$1.state.rot ? calculateRot() : 0, "kr)"))), this.cart && index$1.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: () => (index$1.state.rut = !index$1.state.rut), checked: index$1.state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", index$1.state.rut ? calculateRut() : 0, "kr)"))), this.cart && index$1.state.cart.find((item) => item.green) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (index$1.state.green = !index$1.state.green), checked: index$1.state.green, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "Gr\u00F6n teknik avdrag")), index.h("p", null, "(-", index$1.state.green ? calculateGreenDiscount() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
|
1982
|
+
}
|
1983
|
+
};
|
1984
|
+
|
1985
|
+
const hemfixarnaProductCss = "";
|
1986
|
+
|
1987
|
+
const HemfixarnaProduct = class {
|
1988
|
+
constructor(hostRef) {
|
1989
|
+
index.registerInstance(this, hostRef);
|
1990
|
+
this.amount = 0;
|
1991
|
+
this.hideDescription = true;
|
1992
|
+
}
|
1993
|
+
addProduct() {
|
1994
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
1995
|
+
if (productInCart) {
|
1996
|
+
productInCart.amount++;
|
1997
|
+
index$1.state.cart = [...index$1.state.cart];
|
1998
|
+
}
|
1999
|
+
else {
|
2000
|
+
index$1.state.cart = [
|
2001
|
+
...index$1.state.cart,
|
2002
|
+
{
|
2003
|
+
id: index$1.state.selectedProduct.ID,
|
2004
|
+
rut: index$1.state.selectedProduct.rut,
|
2005
|
+
rot: index$1.state.selectedProduct.rot,
|
2006
|
+
green: index$1.state.selectedProduct.green,
|
2007
|
+
amount: 1,
|
2008
|
+
parts: [],
|
2009
|
+
price: index$1.state.selectedProduct.price,
|
2010
|
+
name: index$1.state.selectedProduct.title,
|
2011
|
+
start_fee: !index$1.state.selectedProduct.hide_start_fee,
|
2012
|
+
terms_checkout: index$1.state.selectedProduct.terms_checkout,
|
2013
|
+
icon: index$1.state.selectedProduct.icon,
|
2014
|
+
start_fee_obj: index$1.state.selectedProduct.start_fee_obj,
|
2015
|
+
},
|
2016
|
+
];
|
2017
|
+
}
|
2018
|
+
}
|
2019
|
+
removeProduct() {
|
2020
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2021
|
+
if (productInCart && productInCart.amount > 1) {
|
2022
|
+
productInCart.amount--;
|
2023
|
+
index$1.state.cart = [...index$1.state.cart];
|
2024
|
+
}
|
2025
|
+
else {
|
2026
|
+
index$1.state.cart = index$1.state.cart.filter(p => p.id !== index$1.state.selectedProduct.ID);
|
2027
|
+
}
|
2028
|
+
}
|
2029
|
+
//Handle cart and parts
|
2030
|
+
addPart(part) {
|
2031
|
+
var _a;
|
2032
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2033
|
+
if (productInCart) {
|
2034
|
+
const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
|
2035
|
+
if (partInCart) {
|
2036
|
+
partInCart.amount++;
|
2037
|
+
productInCart.parts = [...productInCart.parts];
|
2038
|
+
}
|
2039
|
+
else {
|
2040
|
+
productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: (_a = part.title) !== null && _a !== void 0 ? _a : part.title }];
|
2041
|
+
}
|
2042
|
+
index$1.state.cart = [...index$1.state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
2043
|
+
}
|
2044
|
+
}
|
2045
|
+
removePart(part) {
|
2046
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2047
|
+
if (productInCart) {
|
2048
|
+
const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
|
2049
|
+
if (partInCart && partInCart.amount > 1) {
|
2050
|
+
partInCart.amount--;
|
2051
|
+
productInCart.parts = [...productInCart.parts];
|
2052
|
+
}
|
2053
|
+
else {
|
2054
|
+
productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);
|
2055
|
+
}
|
2056
|
+
index$1.state.cart = [...index$1.state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
2057
|
+
}
|
2058
|
+
}
|
2059
|
+
goToCart() {
|
2060
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2061
|
+
if (productInCart) {
|
2062
|
+
index$1.state.step = 5;
|
2063
|
+
const el = this.el.closest('.hemfixarna_content');
|
2064
|
+
scrollToTop(el);
|
2065
|
+
}
|
2066
|
+
}
|
2067
|
+
getAmount() {
|
2068
|
+
var _a;
|
2069
|
+
return ((_a = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
|
2070
|
+
}
|
2071
|
+
getPartAmount(partId) {
|
2072
|
+
var _a;
|
2073
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2074
|
+
return ((_a = productInCart === null || productInCart === void 0 ? void 0 : productInCart.parts.find(sp => sp.id === partId)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
|
2075
|
+
}
|
2076
|
+
getTotalPrice() {
|
2077
|
+
let price = 0;
|
2078
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2079
|
+
if (productInCart) {
|
2080
|
+
const partsPrice = productInCart.parts.reduce((acc, curr) => {
|
2081
|
+
const part = index$1.state.selectedProduct.parts.find(p => p.ID === curr.id);
|
2082
|
+
if (part) {
|
2083
|
+
return acc + part.price * curr.amount;
|
2084
|
+
}
|
2085
|
+
return acc;
|
2086
|
+
}, 0);
|
2087
|
+
price = index$1.state.selectedProduct.price * productInCart.amount + partsPrice;
|
2088
|
+
}
|
2089
|
+
else {
|
2090
|
+
price = index$1.state.selectedProduct.price;
|
2091
|
+
}
|
2092
|
+
return getProductPrice(index$1.state.selectedProduct, price);
|
2093
|
+
}
|
2094
|
+
componentDidRender() {
|
2095
|
+
const linkElem = document.createElement('link');
|
2096
|
+
linkElem.setAttribute('rel', 'stylesheet');
|
2097
|
+
linkElem.setAttribute('href', 'https://painting-frontend.vercel.app/static/css/main.css');
|
2098
|
+
const fonts = document.createElement('link');
|
2099
|
+
fonts.setAttribute('rel', 'stylesheet');
|
2100
|
+
fonts.setAttribute('href', 'https://painting-frontend.vercel.app/fonts.css');
|
2101
|
+
const checkAndInjectCSS = () => {
|
2102
|
+
const parents = this.el.getElementsByTagName('hemfixare-calculator');
|
2103
|
+
if (parents.length > 0 && parents[0].shadowRoot !== null) {
|
2104
|
+
parents[0].shadowRoot.appendChild(linkElem);
|
2105
|
+
parents[0].shadowRoot.appendChild(fonts);
|
2106
|
+
}
|
2107
|
+
else {
|
2108
|
+
setTimeout(checkAndInjectCSS, 1);
|
2109
|
+
}
|
2110
|
+
};
|
2111
|
+
checkAndInjectCSS();
|
2112
|
+
}
|
2113
|
+
render() {
|
2114
|
+
var _a, _b, _c, _d;
|
2115
|
+
const checked = index.getAssetPath(`./assets/checked.svg`);
|
2116
|
+
const plus = index.getAssetPath(`./assets/plus.svg`);
|
2117
|
+
const minus = index.getAssetPath(`./assets/minus.svg`);
|
2118
|
+
if (index$1.state.maleri) {
|
2119
|
+
return (index.h("div", { class: "hemfixarna_painting" }, index.h("script", { type: "text/javascript", src: ['localhost', 'vercel'].some(v => window.location.href.includes(v))
|
2120
|
+
? 'https://painting-dev.vercel.app/static/js/main.js'
|
2121
|
+
: 'https://painting-frontend.vercel.app/static/js/main.js', defer: true, async: true }), index.h("hemfixare-calculator", { title: index$1.state.options.maleri_title, subtitle: index$1.state.options.maleri_text, modal: "true", customer: index$1.state.business === index$2.Business.string ? 'string' : index$1.state.business })));
|
2122
|
+
}
|
2123
|
+
return index$1.state.selectedProduct ? (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, index$1.state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = index$1.state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : index$1.state.selectedProduct.icon, alt: index$1.state.selectedProduct.title })), index.h("div", null, index.h("h1", null, index$1.state.selectedProduct.title), !index$1.state.selectedProduct.invoice ? index.h("h2", null, getProductPrice(index$1.state.selectedProduct), " kr/st") : index.h("h2", null, index$1.state.selectedProduct.invoice_price))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = index$1.state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, index$1.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$1.state.selectedProduct.description && (index.h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: index$1.state.selectedProduct.description }))), index.h("div", { class: "hemfixarna_product--right" }, index$1.state.selectedProduct.invoice ? (index.h("hemfixarna-invoice", null)) : (index.h(index.Fragment, null, index.h("ul", null, index.h("li", { class: "hemfixarna_product--item" }, index.h("div", null, index.h("p", null, index$1.state.selectedProduct.title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(index$1.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 = index$1.state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
|
2124
|
+
index$1.state.selectedProduct.parts.map(p => {
|
2125
|
+
var _a;
|
2126
|
+
return (index.h("li", { class: "hemfixarna_part" }, index.h("div", null, index.h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.title), index.h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, index$1.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) }))));
|
2127
|
+
})), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"))), !index$1.state.selectedProduct.hide_start_fee && ((_d = index$1.state.selectedProduct.start_fee_obj) === null || _d === void 0 ? void 0 : _d.title) && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, index$1.state.selectedProduct.start_fee_obj.title), index.h("br", null), index.h("span", { innerHTML: index$1.state.selectedProduct.start_fee_obj.description }))), index$1.state.options && index.h("hemfixarna-info", null))))) : null;
|
2128
|
+
}
|
2129
|
+
get el() { return index.getElement(this); }
|
2130
|
+
};
|
2131
|
+
HemfixarnaProduct.style = hemfixarnaProductCss;
|
2132
|
+
|
2133
|
+
const HemfixarnaGrid = class {
|
2134
|
+
constructor(hostRef) {
|
2135
|
+
index.registerInstance(this, hostRef);
|
2136
|
+
this.tree = undefined;
|
2137
|
+
this.slug = undefined;
|
2138
|
+
}
|
2139
|
+
isMainCategory(category) {
|
2140
|
+
return category.show_products !== undefined;
|
2141
|
+
}
|
2142
|
+
handleMaleriClick() {
|
2143
|
+
index$1.state.step = 4;
|
2144
|
+
index$1.state.maleri = true;
|
2145
|
+
}
|
2146
|
+
render() {
|
2147
|
+
var _a;
|
2148
|
+
const maleriLogo = index.getAssetPath('./assets/gubbe-pensel.svg');
|
2149
|
+
return index$1.state.customer ? (index.h("div", null, index.h("h2", null, index$1.state.selectedCustomerCategory ? index$1.state.selectedCustomerCategory.name : 'Alla tjänster'), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, ((_a = index$1.state.selectedCustomerCategory) === null || _a === void 0 ? void 0 : _a.add_painting) ? (index.h("button", { onClick: () => this.handleMaleriClick(), class: "hemfixarna_maleribox" }, index.h("img", { height: 64, src: maleriLogo, alt: "M\u00E5leri Logotyp" }), index.h("p", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r"))) : null, index$1.state.selectedCustomerCategory
|
2150
|
+
? this.isMainCategory(index$1.state.selectedCustomerCategory) && index$1.state.selectedCustomerCategory.sub_categories && !index$1.state.selectedCustomerCategory.show_products
|
2151
|
+
? index$1.state.selectedCustomerCategory.sub_categories.map(c => index.h("hemfixarna-box", { category: c }))
|
2152
|
+
: index$1.state.selectedCustomerCategory.products
|
2153
|
+
? index$1.state.selectedCustomerCategory.products.map(c => index.h("hemfixarna-box", { category: c.fields }))
|
2154
|
+
: null
|
2155
|
+
: index$1.state.customer.categories.map(c => index.h("hemfixarna-box", { category: c }))), index.h("hemfixarna-info", null)))) : (index.h("div", null, index.h("h2", null, "Alla tj\u00E4nster"), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, this.tree.sub_cats
|
2156
|
+
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
2157
|
+
.map(c => {
|
2158
|
+
var _a;
|
2159
|
+
return (index.h("hemfixarna-box", { post: c, icon: (_a = c.icon.url) !== null && _a !== void 0 ? _a : c.icon, postTitle: c.name }));
|
2160
|
+
})), index.h("hemfixarna-info", null))));
|
2161
|
+
}
|
2162
|
+
};
|
2163
|
+
|
2164
|
+
exports.hemfixarna_address = HemfixarnaAddress;
|
2165
|
+
exports.hemfixarna_box = HemfixarnaBox;
|
2166
|
+
exports.hemfixarna_breadcrumbs = HemfixarnaBreadcrumbs;
|
2167
|
+
exports.hemfixarna_cart = HemfixarnaCart;
|
2168
|
+
exports.hemfixarna_checkout = HemfixarnaCheckout;
|
2169
|
+
exports.hemfixarna_component = HemfixarnaComponent;
|
2170
|
+
exports.hemfixarna_contact = HemfixarnaInfo$1;
|
2171
|
+
exports.hemfixarna_demo = MyComponent;
|
2172
|
+
exports.hemfixarna_getuser = HemfixarnaGetuser;
|
2173
|
+
exports.hemfixarna_info = HemfixarnaInfo;
|
2174
|
+
exports.hemfixarna_invoice = HemfixarnaInvoice;
|
2175
|
+
exports.hemfixarna_order = HemfixarnaOrder;
|
2176
|
+
exports.hemfixarna_orderrows = HemfixarnaOrderrows;
|
2177
|
+
exports.hemfixarna_product = HemfixarnaProduct;
|
2178
|
+
exports.hemfixarna_start = HemfixarnaGrid;
|
2179
|
+
|
2180
|
+
//# sourceMappingURL=hemfixarna-address_15.cjs.entry.js.map
|