hemfixarna-web-components 1.6.4 → 1.7.0
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_36.cjs.entry.js → hemfixarna-address_15.cjs.entry.js} +341 -1030
- package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -0
- package/dist/cjs/hemfixarna-byggmax.cjs.entry.js +26 -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 +1 -1
- package/dist/cjs/hemfixarna-components.cjs.js.map +1 -1
- 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-4695c475.js +258 -0
- package/dist/cjs/index-4695c475.js.map +1 -0
- package/dist/cjs/index-8054ce93.js +42 -0
- package/dist/cjs/index-8054ce93.js.map +1 -0
- package/dist/cjs/index-b83343b9.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +2 -82
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +1 -20
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +1 -39
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +1 -39
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +1 -39
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +1 -20
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +1 -39
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +1 -39
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +1 -20
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +1 -20
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +1 -39
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +1 -38
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +1 -38
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +1 -38
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +1 -20
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +1 -1
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +1 -39
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +1 -20
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +1 -1
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +1 -39
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +1 -1
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js +1 -60
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -1
- package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js +1 -28
- package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -1
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +27 -236
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +75 -39
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -1
- package/dist/collection/components/hemfixarna-info/hemfixarna-info.js +2 -2
- package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -1
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js +2 -1
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -1
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js +1 -26
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -1
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +7 -41
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -1
- package/dist/collection/types/index.js +4 -0
- package/dist/collection/types/index.js.map +1 -1
- package/dist/collection/utils/api.js +18 -2
- package/dist/collection/utils/api.js.map +1 -1
- package/dist/collection/utils/creditSafe.js +2 -2
- package/dist/collection/utils/creditSafe.js.map +1 -1
- package/dist/collection/utils/enviroment.js +31 -0
- package/dist/collection/utils/enviroment.js.map +1 -0
- package/dist/collection/utils/felixApi.js +2 -1
- package/dist/collection/utils/felixApi.js.map +1 -1
- package/dist/collection/utils/felixFunctions.js +0 -1
- package/dist/collection/utils/felixFunctions.js.map +1 -1
- package/dist/esm/hemfixarna-address_15.entry.js +2056 -0
- package/dist/esm/hemfixarna-address_15.entry.js.map +1 -0
- package/dist/esm/hemfixarna-byggmax.entry.js +22 -0
- package/dist/esm/hemfixarna-byggmax.entry.js.map +1 -0
- package/dist/esm/hemfixarna-category.entry.js +24 -0
- package/dist/esm/hemfixarna-category.entry.js.map +1 -0
- package/dist/esm/hemfixarna-components.js +3 -3
- package/dist/esm/hemfixarna-components.js.map +1 -1
- package/dist/esm/hemfixarna-doro.entry.js +22 -0
- package/dist/esm/hemfixarna-doro.entry.js.map +1 -0
- package/dist/esm/hemfixarna-elfa.entry.js +22 -0
- package/dist/esm/hemfixarna-elfa.entry.js.map +1 -0
- package/dist/esm/hemfixarna-fargvaruhuset.entry.js +19 -0
- package/dist/esm/hemfixarna-fargvaruhuset.entry.js.map +1 -0
- package/dist/esm/hemfixarna-flyttsmart.entry.js +19 -0
- package/dist/esm/hemfixarna-flyttsmart.entry.js.map +1 -0
- package/dist/esm/hemfixarna-forebygg.entry.js +22 -0
- package/dist/esm/hemfixarna-forebygg.entry.js.map +1 -0
- package/dist/esm/hemfixarna-hornbach.entry.js +22 -0
- package/dist/esm/hemfixarna-hornbach.entry.js.map +1 -0
- package/dist/esm/hemfixarna-kbygg.entry.js +19 -0
- package/dist/esm/hemfixarna-kbygg.entry.js.map +1 -0
- package/dist/esm/hemfixarna-klint.entry.js +19 -0
- package/dist/esm/hemfixarna-klint.entry.js.map +1 -0
- package/dist/esm/hemfixarna-kund.entry.js +19 -0
- package/dist/esm/hemfixarna-kund.entry.js.map +1 -0
- package/dist/esm/hemfixarna-norrgavel.entry.js +19 -0
- package/dist/esm/hemfixarna-norrgavel.entry.js.map +1 -0
- package/dist/esm/hemfixarna-power.entry.js +19 -0
- package/dist/esm/hemfixarna-power.entry.js.map +1 -0
- package/dist/esm/hemfixarna-service.entry.js +20 -0
- package/dist/esm/hemfixarna-service.entry.js.map +1 -0
- package/dist/esm/hemfixarna-skanska.entry.js +22 -0
- package/dist/esm/hemfixarna-skanska.entry.js.map +1 -0
- package/dist/esm/hemfixarna-sparfonster.entry.js +19 -0
- package/dist/esm/hemfixarna-sparfonster.entry.js.map +1 -0
- package/dist/esm/hemfixarna-string-furniture.entry.js +22 -0
- package/dist/esm/hemfixarna-string-furniture.entry.js.map +1 -0
- package/dist/esm/hemfixarna-superfront.entry.js +20 -0
- package/dist/esm/hemfixarna-superfront.entry.js.map +1 -0
- package/dist/esm/hemfixarna-tesla.entry.js +19 -0
- package/dist/esm/hemfixarna-tesla.entry.js.map +1 -0
- package/dist/esm/hemfixarna-traningspartner.entry.js +19 -0
- package/dist/esm/hemfixarna-traningspartner.entry.js.map +1 -0
- package/dist/esm/hemfixarna-zaptec.entry.js +19 -0
- package/dist/esm/hemfixarna-zaptec.entry.js.map +1 -0
- package/dist/esm/{index-8c417125.js → index-04bcf90e.js} +2 -2
- package/dist/esm/index-04bcf90e.js.map +1 -0
- package/dist/esm/index-113a6b21.js +256 -0
- package/dist/esm/index-113a6b21.js.map +1 -0
- package/dist/esm/index-1fbc7a74.js +42 -0
- package/dist/esm/index-1fbc7a74.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/hemfixarna-components/p-12dbf4e6.entry.js +2 -0
- package/dist/hemfixarna-components/p-12dbf4e6.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-1b80999e.entry.js +2 -0
- package/dist/hemfixarna-components/p-1b80999e.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-1f875c7a.entry.js +2 -0
- package/dist/hemfixarna-components/p-1f875c7a.entry.js.map +1 -0
- package/dist/hemfixarna-components/{p-852e7173.js → p-32a8152b.js} +2 -2
- package/dist/hemfixarna-components/p-32a8152b.js.map +1 -0
- package/dist/hemfixarna-components/p-3acd1346.entry.js +2 -0
- package/dist/hemfixarna-components/p-3acd1346.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-53afbc10.entry.js +2 -0
- package/dist/hemfixarna-components/p-53afbc10.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-53f0abfa.entry.js +2 -0
- package/dist/hemfixarna-components/p-53f0abfa.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-61b4597f.entry.js +2 -0
- package/dist/hemfixarna-components/p-61b4597f.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-6c1d21dd.entry.js +2 -0
- package/dist/hemfixarna-components/p-6c1d21dd.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-6f6601b8.entry.js +2 -0
- package/dist/hemfixarna-components/p-6f6601b8.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-7c122f15.entry.js +2 -0
- package/dist/hemfixarna-components/p-7c122f15.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-8356796a.entry.js +2 -0
- package/dist/hemfixarna-components/p-8356796a.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-8d509bf1.entry.js +2 -0
- package/dist/hemfixarna-components/p-8d509bf1.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-8f0a688c.entry.js +2 -0
- package/dist/hemfixarna-components/p-8f0a688c.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-9b1e6bc2.entry.js +2 -0
- package/dist/hemfixarna-components/p-9b1e6bc2.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-a3d759d9.js +2 -0
- package/dist/hemfixarna-components/p-a3d759d9.js.map +1 -0
- package/dist/hemfixarna-components/p-a9845efc.entry.js +2 -0
- package/dist/hemfixarna-components/p-a9845efc.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-ae3fc85c.entry.js +2 -0
- package/dist/hemfixarna-components/p-ae3fc85c.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-b6bc1537.entry.js +2 -0
- package/dist/hemfixarna-components/p-b6bc1537.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-cb1634e8.entry.js +2 -0
- package/dist/hemfixarna-components/p-cb1634e8.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-cfdc93e9.js +2 -0
- package/dist/hemfixarna-components/p-cfdc93e9.js.map +1 -0
- package/dist/hemfixarna-components/p-dabad8a7.entry.js +2 -0
- package/dist/hemfixarna-components/p-dabad8a7.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-dfcefa54.entry.js +2 -0
- package/dist/hemfixarna-components/p-dfcefa54.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-e0aad0ff.entry.js +2 -0
- package/dist/hemfixarna-components/p-e0aad0ff.entry.js.map +1 -0
- package/dist/hemfixarna-components/p-edac9f21.entry.js +2 -0
- package/dist/hemfixarna-components/p-edac9f21.entry.js.map +1 -0
- package/dist/types/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.d.ts +1 -6
- package/dist/types/components/customers/hemfixarna-doro/hemfixarna-doro.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-elfa/hemfixarna-elfa.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-klint/hemfixarna-klint.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-kund/hemfixarna-kund.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-power/hemfixarna-power.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-skanska/hemfixarna-skanska.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-string/hemfixarna-string-furniture.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-tesla/hemfixarna-tesla.d.ts +0 -2
- package/dist/types/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.d.ts +0 -1
- package/dist/types/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.d.ts +0 -2
- package/dist/types/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.d.ts +0 -4
- package/dist/types/components/hemfixarna-cart/hemfixarna-cart.d.ts +0 -2
- package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +2 -18
- package/dist/types/components/hemfixarna-demo/hemfixarna-demo.d.ts +4 -2
- package/dist/types/components/hemfixarna-order/hemfixarna-order.d.ts +0 -2
- package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +1 -2
- package/dist/types/components.d.ts +2 -100
- package/dist/types/types/index.d.ts +24 -22
- package/dist/types/utils/api.d.ts +5 -1
- package/dist/types/utils/enviroment.d.ts +3 -0
- package/package.json +4 -3
- package/readme.md +22 -0
- package/dist/cjs/hemfixarna-address_36.cjs.entry.js.map +0 -1
- package/dist/esm/hemfixarna-address_36.entry.js +0 -4090
- package/dist/esm/hemfixarna-address_36.entry.js.map +0 -1
- package/dist/esm/index-8c417125.js.map +0 -1
- package/dist/hemfixarna-components/p-852e7173.js.map +0 -1
- package/dist/hemfixarna-components/p-97461831.entry.js +0 -2
- package/dist/hemfixarna-components/p-97461831.entry.js.map +0 -1
@@ -3,257 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-b83343b9.js');
|
6
|
-
|
7
|
-
const
|
8
|
-
const items = map.get(propName);
|
9
|
-
if (!items) {
|
10
|
-
map.set(propName, [value]);
|
11
|
-
}
|
12
|
-
else if (!items.includes(value)) {
|
13
|
-
items.push(value);
|
14
|
-
}
|
15
|
-
};
|
16
|
-
const debounce = (fn, ms) => {
|
17
|
-
let timeoutId;
|
18
|
-
return (...args) => {
|
19
|
-
if (timeoutId) {
|
20
|
-
clearTimeout(timeoutId);
|
21
|
-
}
|
22
|
-
timeoutId = setTimeout(() => {
|
23
|
-
timeoutId = 0;
|
24
|
-
fn(...args);
|
25
|
-
}, ms);
|
26
|
-
};
|
27
|
-
};
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Check if a possible element isConnected.
|
31
|
-
* The property might not be there, so we check for it.
|
32
|
-
*
|
33
|
-
* We want it to return true if isConnected is not a property,
|
34
|
-
* otherwise we would remove these elements and would not update.
|
35
|
-
*
|
36
|
-
* Better leak in Edge than to be useless.
|
37
|
-
*/
|
38
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
39
|
-
const cleanupElements = debounce((map) => {
|
40
|
-
for (let key of map.keys()) {
|
41
|
-
map.set(key, map.get(key).filter(isConnected));
|
42
|
-
}
|
43
|
-
}, 2000);
|
44
|
-
const stencilSubscription = () => {
|
45
|
-
if (typeof index.getRenderingRef !== 'function') {
|
46
|
-
// If we are not in a stencil project, we do nothing.
|
47
|
-
// This function is not really exported by @stencil/core.
|
48
|
-
return {};
|
49
|
-
}
|
50
|
-
const elmsToUpdate = new Map();
|
51
|
-
return {
|
52
|
-
dispose: () => elmsToUpdate.clear(),
|
53
|
-
get: (propName) => {
|
54
|
-
const elm = index.getRenderingRef();
|
55
|
-
if (elm) {
|
56
|
-
appendToMap(elmsToUpdate, propName, elm);
|
57
|
-
}
|
58
|
-
},
|
59
|
-
set: (propName) => {
|
60
|
-
const elements = elmsToUpdate.get(propName);
|
61
|
-
if (elements) {
|
62
|
-
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
63
|
-
}
|
64
|
-
cleanupElements(elmsToUpdate);
|
65
|
-
},
|
66
|
-
reset: () => {
|
67
|
-
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
68
|
-
cleanupElements(elmsToUpdate);
|
69
|
-
},
|
70
|
-
};
|
71
|
-
};
|
72
|
-
|
73
|
-
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
74
|
-
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
75
|
-
const unwrappedState = unwrap(defaultState);
|
76
|
-
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
77
|
-
const handlers = {
|
78
|
-
dispose: [],
|
79
|
-
get: [],
|
80
|
-
set: [],
|
81
|
-
reset: [],
|
82
|
-
};
|
83
|
-
const reset = () => {
|
84
|
-
var _a;
|
85
|
-
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
86
|
-
// otherwise, the state won't be properly reset
|
87
|
-
states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
88
|
-
handlers.reset.forEach((cb) => cb());
|
89
|
-
};
|
90
|
-
const dispose = () => {
|
91
|
-
// Call first dispose as resetting the state would
|
92
|
-
// cause less updates ;)
|
93
|
-
handlers.dispose.forEach((cb) => cb());
|
94
|
-
reset();
|
95
|
-
};
|
96
|
-
const get = (propName) => {
|
97
|
-
handlers.get.forEach((cb) => cb(propName));
|
98
|
-
return states.get(propName);
|
99
|
-
};
|
100
|
-
const set = (propName, value) => {
|
101
|
-
const oldValue = states.get(propName);
|
102
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
103
|
-
states.set(propName, value);
|
104
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
105
|
-
}
|
106
|
-
};
|
107
|
-
const state = (typeof Proxy === 'undefined'
|
108
|
-
? {}
|
109
|
-
: new Proxy(unwrappedState, {
|
110
|
-
get(_, propName) {
|
111
|
-
return get(propName);
|
112
|
-
},
|
113
|
-
ownKeys(_) {
|
114
|
-
return Array.from(states.keys());
|
115
|
-
},
|
116
|
-
getOwnPropertyDescriptor() {
|
117
|
-
return {
|
118
|
-
enumerable: true,
|
119
|
-
configurable: true,
|
120
|
-
};
|
121
|
-
},
|
122
|
-
has(_, propName) {
|
123
|
-
return states.has(propName);
|
124
|
-
},
|
125
|
-
set(_, propName, value) {
|
126
|
-
set(propName, value);
|
127
|
-
return true;
|
128
|
-
},
|
129
|
-
}));
|
130
|
-
const on = (eventName, callback) => {
|
131
|
-
handlers[eventName].push(callback);
|
132
|
-
return () => {
|
133
|
-
removeFromArray(handlers[eventName], callback);
|
134
|
-
};
|
135
|
-
};
|
136
|
-
const onChange = (propName, cb) => {
|
137
|
-
const unSet = on('set', (key, newValue) => {
|
138
|
-
if (key === propName) {
|
139
|
-
cb(newValue);
|
140
|
-
}
|
141
|
-
});
|
142
|
-
// We need to unwrap the defaultState because it might be a function.
|
143
|
-
// Otherwise we might not be sending the right reset value.
|
144
|
-
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
145
|
-
return () => {
|
146
|
-
unSet();
|
147
|
-
unReset();
|
148
|
-
};
|
149
|
-
};
|
150
|
-
const use = (...subscriptions) => {
|
151
|
-
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
152
|
-
if (subscription.set) {
|
153
|
-
unsubs.push(on('set', subscription.set));
|
154
|
-
}
|
155
|
-
if (subscription.get) {
|
156
|
-
unsubs.push(on('get', subscription.get));
|
157
|
-
}
|
158
|
-
if (subscription.reset) {
|
159
|
-
unsubs.push(on('reset', subscription.reset));
|
160
|
-
}
|
161
|
-
if (subscription.dispose) {
|
162
|
-
unsubs.push(on('dispose', subscription.dispose));
|
163
|
-
}
|
164
|
-
return unsubs;
|
165
|
-
}, []);
|
166
|
-
return () => unsubs.forEach((unsub) => unsub());
|
167
|
-
};
|
168
|
-
const forceUpdate = (key) => {
|
169
|
-
const oldValue = states.get(key);
|
170
|
-
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
171
|
-
};
|
172
|
-
return {
|
173
|
-
state,
|
174
|
-
get,
|
175
|
-
set,
|
176
|
-
on,
|
177
|
-
onChange,
|
178
|
-
use,
|
179
|
-
dispose,
|
180
|
-
reset,
|
181
|
-
forceUpdate,
|
182
|
-
};
|
183
|
-
};
|
184
|
-
const removeFromArray = (array, item) => {
|
185
|
-
const index = array.indexOf(item);
|
186
|
-
if (index >= 0) {
|
187
|
-
array[index] = array[array.length - 1];
|
188
|
-
array.length--;
|
189
|
-
}
|
190
|
-
};
|
191
|
-
|
192
|
-
const createStore = (defaultState, shouldUpdate) => {
|
193
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
194
|
-
map.use(stencilSubscription());
|
195
|
-
return map;
|
196
|
-
};
|
197
|
-
|
198
|
-
const { state, onChange, } = createStore({
|
199
|
-
step: 1,
|
200
|
-
checkoutStep: 1,
|
201
|
-
checkoutEdit: false,
|
202
|
-
selectedCategory: null,
|
203
|
-
selectedService: null,
|
204
|
-
selectedProduct: null,
|
205
|
-
cart: [],
|
206
|
-
business: 'undefined',
|
207
|
-
options: null,
|
208
|
-
rut: true,
|
209
|
-
rot: true,
|
210
|
-
green: true,
|
211
|
-
token: null,
|
212
|
-
user: null,
|
213
|
-
modal: null,
|
214
|
-
rutOptions: null,
|
215
|
-
rotOptions: null,
|
216
|
-
greenOptions: null,
|
217
|
-
customer: null,
|
218
|
-
selectedCustomerCategory: null,
|
219
|
-
parentCategory: null,
|
220
|
-
creditSafeUser: null,
|
221
|
-
checkoutInvoice: false,
|
222
|
-
maleri: false,
|
223
|
-
sources: null,
|
224
|
-
});
|
225
|
-
onChange('cart', cart => {
|
226
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
227
|
-
});
|
228
|
-
onChange('user', user => {
|
229
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
|
230
|
-
});
|
231
|
-
onChange('creditSafeUser', user => {
|
232
|
-
window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
|
233
|
-
});
|
234
|
-
onChange('selectedProduct', product => {
|
235
|
-
if (!state.customer || !product)
|
236
|
-
return;
|
237
|
-
const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
|
238
|
-
const category = categories.find(c => c && c.id === product.category);
|
239
|
-
if (category) {
|
240
|
-
state.parentCategory = category;
|
241
|
-
return;
|
242
|
-
}
|
243
|
-
state.parentCategory = null;
|
244
|
-
});
|
245
|
-
onChange('selectedCustomerCategory', category => {
|
246
|
-
if (!state.customer || !category)
|
247
|
-
return;
|
248
|
-
if (category.parent) {
|
249
|
-
const parent = state.customer.categories.find(c => c.id === category.parent);
|
250
|
-
if (parent) {
|
251
|
-
state.parentCategory = parent;
|
252
|
-
return;
|
253
|
-
}
|
254
|
-
}
|
255
|
-
state.parentCategory = null;
|
256
|
-
});
|
6
|
+
const index$1 = require('./index-4695c475.js');
|
7
|
+
const index$2 = require('./index-8054ce93.js');
|
257
8
|
|
258
9
|
const hideField = (field) => {
|
259
10
|
return field.split(' ').reduce((acc, curr) => {
|
@@ -297,27 +48,27 @@ const HemfixarnaAddress = class {
|
|
297
48
|
this.townError = 'Ange en ort';
|
298
49
|
}
|
299
50
|
if (streetValid && zipValid && townValid && zipIsNumber) {
|
300
|
-
state.user = Object.assign(Object.assign({}, state.user), { street: this.street, zip: this.zip, town: this.town });
|
301
|
-
state.checkoutStep = 2;
|
302
|
-
state.checkoutEdit = false;
|
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;
|
303
54
|
const el = this.el.closest('.hemfixarna_content');
|
304
55
|
scrollToTop(el);
|
305
56
|
}
|
306
57
|
};
|
307
58
|
this.handleChangeStreet = (e) => {
|
308
59
|
this.streetError = null;
|
309
|
-
this.street = this.street === state.user.street ? '' : e.target.value;
|
60
|
+
this.street = this.street === index$1.state.user.street ? '' : e.target.value;
|
310
61
|
};
|
311
62
|
this.handleChangeZip = (e) => {
|
312
63
|
this.zipError = null;
|
313
|
-
this.zip = this.zip === state.user.zip ? '' : e.target.value;
|
64
|
+
this.zip = this.zip === index$1.state.user.zip ? '' : e.target.value;
|
314
65
|
};
|
315
66
|
this.handleChangeTown = (e) => {
|
316
67
|
this.townError = null;
|
317
|
-
this.town = this.town === state.user.town ? '' : e.target.value;
|
68
|
+
this.town = this.town === index$1.state.user.town ? '' : e.target.value;
|
318
69
|
};
|
319
70
|
this.render = () => {
|
320
|
-
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 === 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 === 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 === 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" })));
|
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" })));
|
321
72
|
};
|
322
73
|
this.street = '';
|
323
74
|
this.streetError = null;
|
@@ -327,10 +78,10 @@ const HemfixarnaAddress = class {
|
|
327
78
|
this.townError = null;
|
328
79
|
}
|
329
80
|
componentWillLoad() {
|
330
|
-
if (state.user) {
|
331
|
-
this.street = state.user.street;
|
332
|
-
this.zip = state.user.zip;
|
333
|
-
this.town = state.user.town;
|
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;
|
334
85
|
}
|
335
86
|
}
|
336
87
|
get el() { return index.getElement(this); }
|
@@ -346,13 +97,13 @@ const getGreenPrice = (price) => {
|
|
346
97
|
return Math.ceil(price * 0.5);
|
347
98
|
};
|
348
99
|
const getProductPrice = (product, price, amount = 1) => {
|
349
|
-
if (product.rot && state.rot) {
|
100
|
+
if (product.rot && index$1.state.rot) {
|
350
101
|
return getRotPrice((price || product.price) * amount);
|
351
102
|
}
|
352
|
-
else if (product.rut && state.rut) {
|
103
|
+
else if (product.rut && index$1.state.rut) {
|
353
104
|
return getRutPrice((price || product.price) * amount);
|
354
105
|
}
|
355
|
-
else if (product.green && state.green) {
|
106
|
+
else if (product.green && index$1.state.green) {
|
356
107
|
return getGreenPrice((price || product.price) * amount);
|
357
108
|
}
|
358
109
|
else {
|
@@ -363,7 +114,7 @@ const getProductPriceWithRotAndRut = (product) => {
|
|
363
114
|
if (product.rot) {
|
364
115
|
return getRotPrice(product.price);
|
365
116
|
}
|
366
|
-
else if (product.rut && state.rut) {
|
117
|
+
else if (product.rut && index$1.state.rut) {
|
367
118
|
return getRutPrice(product.price);
|
368
119
|
}
|
369
120
|
else {
|
@@ -371,10 +122,10 @@ const getProductPriceWithRotAndRut = (product) => {
|
|
371
122
|
}
|
372
123
|
};
|
373
124
|
const getPartPrice = (part, product, amount = 1) => {
|
374
|
-
if (product.rot && state.rot) {
|
125
|
+
if (product.rot && index$1.state.rot) {
|
375
126
|
return getRotPrice(part.price * amount);
|
376
127
|
}
|
377
|
-
else if (product.rut && state.rut) {
|
128
|
+
else if (product.rut && index$1.state.rut) {
|
378
129
|
return getRutPrice(part.price * amount);
|
379
130
|
}
|
380
131
|
else {
|
@@ -382,14 +133,14 @@ const getPartPrice = (part, product, amount = 1) => {
|
|
382
133
|
}
|
383
134
|
};
|
384
135
|
const getStartFee = () => {
|
385
|
-
if (!state.cart)
|
136
|
+
if (!index$1.state.cart)
|
386
137
|
return { rut: 0, rot: 0, green: 0 };
|
387
|
-
const hasRut = state.cart.some(item => item.rut && item.start_fee);
|
388
|
-
const hasRot = state.cart.some(item => item.rot && item.start_fee);
|
389
|
-
const hasGreen = state.cart.some(item => item.green && item.start_fee);
|
390
|
-
const rutPrice = state.rut ? getRutPrice(state.options.start_fee) : state.options.start_fee * 1;
|
391
|
-
const rotPrice = state.rot ? getRotPrice(state.options.start_fee) : state.options.start_fee * 1;
|
392
|
-
const greenPrice = state.green ? getGreenPrice(state.options.start_fee) : state.options.start_fee * 1;
|
138
|
+
const hasRut = index$1.state.cart.some(item => item.rut && item.start_fee);
|
139
|
+
const hasRot = index$1.state.cart.some(item => item.rot && item.start_fee);
|
140
|
+
const hasGreen = index$1.state.cart.some(item => item.green && item.start_fee);
|
141
|
+
const rutPrice = index$1.state.rut ? getRutPrice(index$1.state.options.start_fee) : index$1.state.options.start_fee * 1;
|
142
|
+
const rotPrice = index$1.state.rot ? getRotPrice(index$1.state.options.start_fee) : index$1.state.options.start_fee * 1;
|
143
|
+
const greenPrice = index$1.state.green ? getGreenPrice(index$1.state.options.start_fee) : index$1.state.options.start_fee * 1;
|
393
144
|
return { rut: hasRut ? rutPrice : 0, rot: hasRot ? rotPrice : 0, green: hasGreen ? greenPrice : 0, length: [hasRut, hasRot, hasGreen].filter(d => d).length };
|
394
145
|
// if (hasRut && hasRot) {
|
395
146
|
// return { rut: rutPrice, rot: rotPrice, length: 2 };
|
@@ -408,85 +159,50 @@ const getItemPrice = (item) => {
|
|
408
159
|
return getProductPrice(item, item.price * item.amount + partsPrice);
|
409
160
|
};
|
410
161
|
const calculateRot = () => {
|
411
|
-
const totalWithRot = state.cart.reduce((acc, curr) => {
|
162
|
+
const totalWithRot = index$1.state.cart.reduce((acc, curr) => {
|
412
163
|
return curr.rot ? acc + getItemPrice(curr) : acc;
|
413
164
|
}, 0) + getStartFee().rot;
|
414
|
-
const totalWithoutRot = state.cart.reduce((acc, curr) => {
|
165
|
+
const totalWithoutRot = index$1.state.cart.reduce((acc, curr) => {
|
415
166
|
const partsPrice = curr.parts.reduce((acc, curr) => {
|
416
167
|
return acc + curr.price * curr.amount;
|
417
168
|
}, 0);
|
418
169
|
return curr.rot ? acc + curr.price * curr.amount + partsPrice : acc;
|
419
|
-
}, 0) + Number(state.options.start_fee);
|
170
|
+
}, 0) + Number(index$1.state.options.start_fee);
|
420
171
|
return totalWithoutRot - totalWithRot;
|
421
172
|
};
|
422
173
|
const calculateRut = () => {
|
423
|
-
const totalWithRut = state.cart.reduce((acc, curr) => {
|
174
|
+
const totalWithRut = index$1.state.cart.reduce((acc, curr) => {
|
424
175
|
return curr.rut ? acc + getItemPrice(curr) : acc;
|
425
176
|
}, 0) + getStartFee().rut;
|
426
|
-
const totalWithoutRut = state.cart.reduce((acc, curr) => {
|
177
|
+
const totalWithoutRut = index$1.state.cart.reduce((acc, curr) => {
|
427
178
|
const partsPrice = curr.parts.reduce((acc, curr) => {
|
428
179
|
return acc + curr.price * curr.amount;
|
429
180
|
}, 0);
|
430
181
|
return curr.rut ? acc + curr.price * curr.amount + partsPrice : acc;
|
431
|
-
}, 0) + Number(state.options.start_fee);
|
182
|
+
}, 0) + Number(index$1.state.options.start_fee);
|
432
183
|
return totalWithoutRut - totalWithRut;
|
433
184
|
};
|
434
185
|
const calculateGreenDiscount = () => {
|
435
|
-
const totalWithGreen = state.cart.reduce((acc, curr) => {
|
186
|
+
const totalWithGreen = index$1.state.cart.reduce((acc, curr) => {
|
436
187
|
return curr.green ? acc + getItemPrice(curr) : acc;
|
437
188
|
}, 0) + getStartFee().green;
|
438
|
-
const totalWithoutGreen = state.cart.reduce((acc, curr) => {
|
189
|
+
const totalWithoutGreen = index$1.state.cart.reduce((acc, curr) => {
|
439
190
|
const partsPrice = curr.parts.reduce((acc, curr) => {
|
440
191
|
return acc + curr.price * curr.amount;
|
441
192
|
}, 0);
|
442
193
|
return curr.green ? acc + curr.price * curr.amount + partsPrice : acc;
|
443
|
-
}, 0) + Number(state.options.start_fee);
|
194
|
+
}, 0) + Number(index$1.state.options.start_fee);
|
444
195
|
return totalWithoutGreen - totalWithGreen;
|
445
196
|
};
|
446
197
|
const getTotalPrice = () => {
|
447
|
-
return state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;
|
198
|
+
return index$1.state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;
|
448
199
|
};
|
449
200
|
|
450
|
-
var Business;
|
451
|
-
(function (Business) {
|
452
|
-
Business["kund"] = "kund";
|
453
|
-
Business["byggmax"] = "byggmax";
|
454
|
-
Business["skanska"] = "skanska";
|
455
|
-
Business["string"] = "string-furniture";
|
456
|
-
Business["hornbach"] = "hornbach";
|
457
|
-
Business["forebygg"] = "forebygg";
|
458
|
-
Business["doro"] = "doro";
|
459
|
-
Business["elfa"] = "elfa";
|
460
|
-
Business["kbygg"] = "k-bygg";
|
461
|
-
Business["norrgavel"] = "norrgavel";
|
462
|
-
Business["fargvaruhuset"] = "fargvaruhuset";
|
463
|
-
Business["zaptec"] = "zaptec";
|
464
|
-
Business["tesla"] = "tesla";
|
465
|
-
Business["klint"] = "klint";
|
466
|
-
Business["flyttsmart"] = "flyttsmart";
|
467
|
-
Business["lg"] = "lg";
|
468
|
-
Business["sparfonster"] = "sparfonster";
|
469
|
-
Business["power"] = "power";
|
470
|
-
Business["traningspartner"] = "traningspartner";
|
471
|
-
Business["superfront"] = "superfront";
|
472
|
-
})(Business || (Business = {}));
|
473
|
-
var WidgetStyle;
|
474
|
-
(function (WidgetStyle) {
|
475
|
-
WidgetStyle["standard"] = "standard";
|
476
|
-
WidgetStyle["alternative"] = "alternative";
|
477
|
-
WidgetStyle["alternative_2"] = "alternative_2";
|
478
|
-
WidgetStyle["alternative_3"] = "alternative_3";
|
479
|
-
})(WidgetStyle || (WidgetStyle = {}));
|
480
|
-
var TopCategory;
|
481
|
-
(function (TopCategory) {
|
482
|
-
TopCategory["byggmax"] = "category/bygg";
|
483
|
-
})(TopCategory || (TopCategory = {}));
|
484
|
-
|
485
201
|
const isProduct = (category) => {
|
486
202
|
return category.post_name !== undefined;
|
487
203
|
};
|
488
204
|
const isBusiness = (partner) => {
|
489
|
-
return Object.values(Business).includes(partner);
|
205
|
+
return Object.values(index$2.Business).includes(partner);
|
490
206
|
};
|
491
207
|
|
492
208
|
const HemfixarnaBox = class {
|
@@ -500,30 +216,30 @@ const HemfixarnaBox = class {
|
|
500
216
|
setTaxonomy(taxonomy) {
|
501
217
|
if (taxonomy) {
|
502
218
|
if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
|
503
|
-
state.selectedCategory = taxonomy;
|
504
|
-
state.step = 2;
|
219
|
+
index$1.state.selectedCategory = taxonomy;
|
220
|
+
index$1.state.step = 2;
|
505
221
|
}
|
506
222
|
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
|
507
|
-
state.selectedService = taxonomy;
|
508
|
-
state.step = 3;
|
223
|
+
index$1.state.selectedService = taxonomy;
|
224
|
+
index$1.state.step = 3;
|
509
225
|
}
|
510
226
|
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
|
511
|
-
state.selectedProduct = taxonomy;
|
512
|
-
state.step = 4;
|
227
|
+
index$1.state.selectedProduct = taxonomy;
|
228
|
+
index$1.state.step = 4;
|
513
229
|
}
|
514
230
|
const el = this.el.closest('.hemfixarna_content');
|
515
231
|
scrollToTop(el);
|
516
232
|
}
|
517
233
|
}
|
518
234
|
setProduct() {
|
519
|
-
state.selectedProduct = this.category;
|
520
|
-
state.step = 4;
|
521
|
-
state.selectedCustomerCategory = null;
|
235
|
+
index$1.state.selectedProduct = this.category;
|
236
|
+
index$1.state.step = 4;
|
237
|
+
index$1.state.selectedCustomerCategory = null;
|
522
238
|
const el = this.el.closest('.hemfixarna_content');
|
523
239
|
scrollToTop(el);
|
524
240
|
}
|
525
241
|
render() {
|
526
|
-
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: () => (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), state.step === 3 && index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
|
242
|
+
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"))));
|
527
243
|
}
|
528
244
|
get el() { return index.getElement(this); }
|
529
245
|
};
|
@@ -535,31 +251,28 @@ const HemfixarnaBreadcrumbs = class {
|
|
535
251
|
const el = this.el.nextSibling;
|
536
252
|
scrollToTop(el);
|
537
253
|
};
|
538
|
-
this.tree = undefined;
|
539
254
|
this.closeModal = undefined;
|
540
|
-
this.loadFromQuery = false;
|
541
|
-
this.isDemo = false;
|
542
255
|
}
|
543
256
|
getCartLength() {
|
544
|
-
return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
257
|
+
return index$1.state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
545
258
|
}
|
546
259
|
handleCartClick() {
|
547
260
|
var _a;
|
548
|
-
if ((_a = state.cart) === null || _a === void 0 ? void 0 : _a.length) {
|
549
|
-
state.step = 5;
|
261
|
+
if ((_a = index$1.state.cart) === null || _a === void 0 ? void 0 : _a.length) {
|
262
|
+
index$1.state.step = 5;
|
550
263
|
this.triggerScrollTotop();
|
551
264
|
}
|
552
265
|
}
|
553
266
|
handleHomePageClick() {
|
554
|
-
state.step = 1;
|
555
|
-
state.parentCategory = null;
|
556
|
-
state.selectedCustomerCategory = null;
|
267
|
+
index$1.state.step = 1;
|
268
|
+
index$1.state.parentCategory = null;
|
269
|
+
index$1.state.selectedCustomerCategory = null;
|
557
270
|
this.triggerScrollTotop();
|
558
271
|
setTimeout(() => {
|
559
|
-
state.selectedCategory = null;
|
560
|
-
state.selectedProduct = null;
|
561
|
-
state.maleri = null;
|
562
|
-
state.selectedService = null;
|
272
|
+
index$1.state.selectedCategory = null;
|
273
|
+
index$1.state.selectedProduct = null;
|
274
|
+
index$1.state.maleri = null;
|
275
|
+
index$1.state.selectedService = null;
|
563
276
|
}, 200);
|
564
277
|
}
|
565
278
|
render() {
|
@@ -567,101 +280,92 @@ const HemfixarnaBreadcrumbs = class {
|
|
567
280
|
const close = index.getAssetPath(`./assets/close.svg`);
|
568
281
|
const cart = index.getAssetPath(`./assets/cart.svg`);
|
569
282
|
const back = index.getAssetPath(`./assets/back.svg`);
|
570
|
-
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 }),
|
571
|
-
state.step = state.step === 4 ? 3 : 2;
|
572
|
-
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name))), !state.parentCategory && state.step && state.selectedCustomerCategory && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
|
573
|
-
state.step = 1;
|
574
|
-
state.selectedCustomerCategory = null;
|
575
|
-
state.selectedProduct = null;
|
576
|
-
state.maleri = null;
|
577
|
-
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se alla tj\u00E4nster"))), state.parentCategory && state.step < 5 && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
|
578
|
-
state.step = 1;
|
579
|
-
state.selectedCustomerCategory = state.parentCategory;
|
580
|
-
state.selectedProduct = null;
|
581
|
-
state.maleri = null;
|
582
|
-
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.parentCategory.name)))));
|
283
|
+
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: () => {
|
284
|
+
index$1.state.step = index$1.state.step === 4 ? 3 : 2;
|
285
|
+
} }, 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: () => {
|
286
|
+
index$1.state.step = 1;
|
287
|
+
index$1.state.selectedCustomerCategory = null;
|
288
|
+
index$1.state.selectedProduct = null;
|
289
|
+
index$1.state.maleri = null;
|
290
|
+
} }, 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: () => {
|
291
|
+
index$1.state.step = 1;
|
292
|
+
index$1.state.selectedCustomerCategory = index$1.state.parentCategory;
|
293
|
+
index$1.state.selectedProduct = null;
|
294
|
+
index$1.state.maleri = null;
|
295
|
+
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", index$1.state.parentCategory.name)))));
|
583
296
|
}
|
584
297
|
get el() { return index.getElement(this); }
|
585
298
|
};
|
586
299
|
|
587
|
-
const hemfixarnaByggmaxCss = "";
|
588
|
-
|
589
|
-
const MyComponent$j = class {
|
590
|
-
constructor(hostRef) {
|
591
|
-
index.registerInstance(this, hostRef);
|
592
|
-
this.tree = null;
|
593
|
-
this.slug = undefined;
|
594
|
-
this.id = undefined;
|
595
|
-
this.forceOldTree = false;
|
596
|
-
this.loadFromQuery = undefined;
|
597
|
-
this.customer = undefined;
|
598
|
-
this.widgetStyle = WidgetStyle.standard;
|
599
|
-
this.buttonColor = undefined;
|
600
|
-
this.buttonBg = undefined;
|
601
|
-
}
|
602
|
-
render() {
|
603
|
-
return (index.h("hemfixarna-component", { forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax, loadFromQuery: Boolean(this.loadFromQuery), widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
|
604
|
-
}
|
605
|
-
};
|
606
|
-
MyComponent$j.style = hemfixarnaByggmaxCss;
|
607
|
-
|
608
300
|
const HemfixarnaCart = class {
|
609
301
|
constructor(hostRef) {
|
610
302
|
index.registerInstance(this, hostRef);
|
611
|
-
this.tree = undefined;
|
612
303
|
}
|
613
304
|
render() {
|
614
305
|
const back = index.getAssetPath(`./assets/back.svg`);
|
615
|
-
return (index.h("div", { class: "hemfixarna_cart" }, index.h("div", { class: "hemfixarna_cart--left" }, index.h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (index.h("button", { onClick: () => {
|
616
|
-
state.checkoutStep = 1;
|
617
|
-
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Din bokning"), index.h("hemfixarna-orderrows",
|
618
|
-
state.checkoutStep = 1;
|
306
|
+
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: () => {
|
307
|
+
index$1.state.checkoutStep = 1;
|
308
|
+
} }, 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: () => {
|
309
|
+
index$1.state.checkoutStep = 1;
|
619
310
|
} }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Dina uppgifter"), index.h("hemfixarna-checkout", null), index.h("hemfixarna-info", null))));
|
620
311
|
}
|
621
312
|
};
|
622
313
|
|
623
|
-
const
|
624
|
-
|
625
|
-
|
314
|
+
const livePreviewUrl = 'hemfixarna-partner.vercel.app';
|
315
|
+
const getDefaultApiUrl = () => {
|
316
|
+
if (window.location.href.includes('vercel.app') && !window.location.href.includes(livePreviewUrl)) {
|
317
|
+
return 'https://hemfixare.dev.afonso.se';
|
626
318
|
}
|
627
|
-
|
628
|
-
|
629
|
-
state.step = 3;
|
319
|
+
else {
|
320
|
+
return 'https://hemfixarna.se';
|
630
321
|
}
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
var _a;
|
636
|
-
return (index.h("hemfixarna-box", { post: s, icon: (_a = s.icon.url) !== null && _a !== void 0 ? _a : s.icon, postTitle: s.post_title }));
|
637
|
-
}))), index.h("hemfixarna-info", null))));
|
322
|
+
};
|
323
|
+
const getApiUrl = () => {
|
324
|
+
if (typeof process !== 'undefined' && process.env && process.env.API_URL) {
|
325
|
+
return process.env.API_URL;
|
638
326
|
}
|
327
|
+
return getDefaultApiUrl();
|
328
|
+
};
|
329
|
+
const getDefaultCreditSafeApiUrl = () => {
|
330
|
+
if (window.location.href.includes('vercel.app')) {
|
331
|
+
return 'https://hemfixare-lookup-dev.vercel.app/api';
|
332
|
+
}
|
333
|
+
else {
|
334
|
+
return 'https://hemfixare-lookup.vercel.app/api';
|
335
|
+
}
|
336
|
+
};
|
337
|
+
const getCreditSafeApiUrl = () => {
|
338
|
+
if (typeof process !== 'undefined' && process.env && process.env.CREDIT_SAFE_API_URL) {
|
339
|
+
return process.env.CREDIT_SAFE_API_URL;
|
340
|
+
}
|
341
|
+
return getDefaultCreditSafeApiUrl();
|
639
342
|
};
|
640
343
|
|
641
|
-
const base$2 = `${
|
344
|
+
const base$2 = `${getApiUrl()}/wp-json/headless`;
|
642
345
|
async function fetchWithType(request, options) {
|
643
346
|
const response = await fetch(request, options);
|
644
347
|
const body = await response.json();
|
645
348
|
return body;
|
646
349
|
}
|
647
|
-
const
|
648
|
-
if (!endpoint) {
|
649
|
-
return;
|
650
|
-
}
|
651
|
-
const type = endpoint.split('/')[0];
|
652
|
-
const slug = endpoint.split('/')[1];
|
350
|
+
const getCustomer = async (slug) => {
|
653
351
|
try {
|
654
|
-
const res = await fetch(`${base$2}/${
|
352
|
+
const res = await fetch(`${base$2}/customer/${slug}`);
|
655
353
|
return await res.json();
|
656
354
|
}
|
657
355
|
catch (error) {
|
658
356
|
console.log(error);
|
659
357
|
}
|
660
358
|
};
|
661
|
-
const
|
359
|
+
const loginCustomer = async ({ id, password }) => {
|
662
360
|
try {
|
663
|
-
const res = await fetch(`${base$2}/customer
|
664
|
-
|
361
|
+
const res = await fetch(`${base$2}/customer/login`, {
|
362
|
+
method: 'POST',
|
363
|
+
body: JSON.stringify({ id, password }),
|
364
|
+
headers: {
|
365
|
+
'Content-Type': 'application/json',
|
366
|
+
},
|
367
|
+
});
|
368
|
+
return res.status;
|
665
369
|
}
|
666
370
|
catch (error) {
|
667
371
|
console.log(error);
|
@@ -719,7 +423,7 @@ const postOrder = async (data) => {
|
|
719
423
|
}
|
720
424
|
};
|
721
425
|
|
722
|
-
const base$1 = `${
|
426
|
+
const base$1 = `${getApiUrl()}/wp-json/felix`;
|
723
427
|
const postPerson = async (felixOrder) => {
|
724
428
|
try {
|
725
429
|
return await fetchWithType(`${base$1}/createperson`, {
|
@@ -751,18 +455,18 @@ const HemfixarnaCheckout = class {
|
|
751
455
|
return;
|
752
456
|
this.loading = true;
|
753
457
|
let order = {
|
754
|
-
firstName: state.creditSafeUser.firstName,
|
755
|
-
lastName: state.creditSafeUser.lastName,
|
756
|
-
street: state.user.street,
|
757
|
-
zip: state.user.zip,
|
758
|
-
town: state.user.town,
|
759
|
-
ssn: state.user.ssn,
|
760
|
-
email: state.user.email,
|
761
|
-
phone: state.user.phone,
|
762
|
-
url: `${state.business === Business.string ? 'string' : state.business}-webk`,
|
458
|
+
firstName: index$1.state.creditSafeUser.firstName,
|
459
|
+
lastName: index$1.state.creditSafeUser.lastName,
|
460
|
+
street: index$1.state.user.street,
|
461
|
+
zip: index$1.state.user.zip,
|
462
|
+
town: index$1.state.user.town,
|
463
|
+
ssn: index$1.state.user.ssn,
|
464
|
+
email: index$1.state.user.email,
|
465
|
+
phone: index$1.state.user.phone,
|
466
|
+
url: `${index$1.state.business === index$2.Business.string ? 'string' : index$1.state.business}-webk`,
|
763
467
|
date: this.date,
|
764
468
|
products: [
|
765
|
-
...state.cart.map(item => {
|
469
|
+
...index$1.state.cart.map(item => {
|
766
470
|
const parts = item.parts.map(part => ({
|
767
471
|
id: String(part.id),
|
768
472
|
name: part.name,
|
@@ -782,8 +486,8 @@ const HemfixarnaCheckout = class {
|
|
782
486
|
];
|
783
487
|
}),
|
784
488
|
].flat(),
|
785
|
-
creditSafe: state.creditSafeUser,
|
786
|
-
customer: state.business,
|
489
|
+
creditSafe: index$1.state.creditSafeUser,
|
490
|
+
customer: index$1.state.business,
|
787
491
|
id_source: '',
|
788
492
|
id_sub_source: '',
|
789
493
|
seller_id: (_a = this.sellerID) !== null && _a !== void 0 ? _a : '',
|
@@ -799,7 +503,7 @@ const HemfixarnaCheckout = class {
|
|
799
503
|
try {
|
800
504
|
const { data: orderConfirm, status } = await postOrder(order);
|
801
505
|
if (orderConfirm && status && status === 200) {
|
802
|
-
state.step = 6;
|
506
|
+
index$1.state.step = 6;
|
803
507
|
const el = this.el.closest('.hemfixarna_content');
|
804
508
|
scrollToTop(el);
|
805
509
|
}
|
@@ -857,14 +561,14 @@ const HemfixarnaCheckout = class {
|
|
857
561
|
const dateLogo = index.getAssetPath(`./assets/date.svg`);
|
858
562
|
const down = index.getAssetPath(`./assets/down.svg`);
|
859
563
|
const loading = index.getAssetPath(`./assets/spinner.gif`);
|
860
|
-
if (state.checkoutEdit) {
|
564
|
+
if (index$1.state.checkoutEdit) {
|
861
565
|
return index.h("hemfixarna-address", null);
|
862
566
|
}
|
863
|
-
else if (state.checkoutStep === 1) {
|
567
|
+
else if (index$1.state.checkoutStep === 1) {
|
864
568
|
return index.h("hemfixarna-getuser", null);
|
865
569
|
}
|
866
|
-
else if (state.checkoutStep === 2) {
|
867
|
-
return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(state.user.firstName)), index.h("p", null, hideField(state.user.lastName)), index.h("p", null, state.user.email), index.h("p", null, state.user.phone)), index.h("div", null, index.h("p", null, hideField(state.user.street)), index.h("p", null, hideField(state.user.zip)), index.h("p", null, hideField(state.user.town))), index.h("button", { onClick: () => (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), state.customer.source && this.showSources ? (index.h(index.Fragment, null, index.h("p", null, "Inloggad som:", index.h("strong", null, " ", 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 = 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"), state.customer.source.sub_sources.map(sub => (index.h("option", { value: sub['So_SubSource::_id'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("h4", 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: state.options.terms })), state.cart
|
570
|
+
else if (index$1.state.checkoutStep === 2) {
|
571
|
+
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 && this.showSources ? (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::_id'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("h4", 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
|
868
572
|
.filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
|
869
573
|
.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" })))));
|
870
574
|
}
|
@@ -881,10 +585,10 @@ const HemfixarnaCheckout = class {
|
|
881
585
|
this.RefferalID = null;
|
882
586
|
}
|
883
587
|
componentWillLoad() {
|
884
|
-
if (Boolean(state.user && state.user.street)) {
|
885
|
-
state.checkoutStep = 2;
|
588
|
+
if (Boolean(index$1.state.user && index$1.state.user.street)) {
|
589
|
+
index$1.state.checkoutStep = 2;
|
886
590
|
}
|
887
|
-
if (state.customer && state.customer.source) {
|
591
|
+
if (index$1.state.customer && index$1.state.customer.source) {
|
888
592
|
window.addEventListener('keydown', this.handleKeyDown);
|
889
593
|
}
|
890
594
|
const showSources = localStorage.getItem('show_sources');
|
@@ -903,185 +607,94 @@ const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=In
|
|
903
607
|
const HemfixarnaComponent = class {
|
904
608
|
constructor(hostRef) {
|
905
609
|
index.registerInstance(this, hostRef);
|
906
|
-
this.slugIsOldFormat = (slug) => {
|
907
|
-
if (!slug)
|
908
|
-
return false;
|
909
|
-
return ['product', 'service', 'category'].some(str => slug.includes(str));
|
910
|
-
};
|
911
610
|
this.triggerScrollTotop = () => {
|
912
611
|
const el = this.el.shadowRoot.querySelector('.hemfixarna_content');
|
913
612
|
scrollToTop(el);
|
914
613
|
};
|
915
614
|
this.modal = false;
|
916
615
|
this.showModal = false;
|
917
|
-
this.tree = null;
|
918
616
|
this.product = null;
|
919
|
-
this.proppedProduct = null;
|
920
|
-
this.slug = undefined;
|
921
617
|
this.id = undefined;
|
922
618
|
this.business = undefined;
|
923
|
-
this.
|
924
|
-
this.forceOldTree = false;
|
925
|
-
this.loadFromQuery = false;
|
926
|
-
this.isDemo = false;
|
927
|
-
this.widgetStyle = undefined;
|
928
|
-
this.nav = undefined;
|
619
|
+
this.widgetStyle = index$2.WidgetStyle.standard;
|
929
620
|
this.buttonColor = undefined;
|
930
621
|
this.buttonBg = undefined;
|
622
|
+
this.proppedProduct = null;
|
931
623
|
}
|
932
624
|
loadCategoryOrProduct(id) {
|
933
625
|
this.proppedProduct = null;
|
934
626
|
if (id.startsWith('c-')) {
|
935
|
-
const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
|
627
|
+
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();
|
936
628
|
const category = categories.find(c => c && c.id === id.replace('c-', ''));
|
937
629
|
if (category) {
|
938
|
-
state.selectedCustomerCategory = category;
|
939
|
-
state.step = 2;
|
630
|
+
index$1.state.selectedCustomerCategory = category;
|
631
|
+
index$1.state.step = 2;
|
940
632
|
}
|
941
633
|
}
|
942
634
|
else {
|
943
|
-
const products = state.customer.categories
|
635
|
+
const products = index$1.state.customer.categories
|
944
636
|
.map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
|
945
637
|
.flat()
|
946
638
|
.flat();
|
947
639
|
const product = products.find(p => p && p.fields.ID === parseInt(id));
|
948
640
|
if (product) {
|
949
|
-
state.selectedProduct = product.fields;
|
950
|
-
state.step = 4;
|
641
|
+
index$1.state.selectedProduct = product.fields;
|
642
|
+
index$1.state.step = 4;
|
951
643
|
this.proppedProduct = product.fields;
|
952
644
|
}
|
953
645
|
}
|
954
646
|
}
|
955
|
-
async watchSlugChange(newValue) {
|
956
|
-
if (this.slugIsOldFormat(newValue)) {
|
957
|
-
this.fetchNewTaxonomy(newValue);
|
958
|
-
}
|
959
|
-
else if (state.customer && newValue) {
|
960
|
-
this.loadCategoryOrProduct(newValue);
|
961
|
-
}
|
962
|
-
}
|
963
647
|
async watchIdChange(id) {
|
964
|
-
if (id && state.customer) {
|
648
|
+
if (id && index$1.state.customer) {
|
965
649
|
if (id === 'maleri') {
|
966
|
-
state.maleri = true;
|
967
|
-
state.step = 4;
|
650
|
+
index$1.state.maleri = true;
|
651
|
+
index$1.state.step = 4;
|
968
652
|
}
|
969
653
|
else {
|
970
654
|
this.loadCategoryOrProduct(id);
|
971
655
|
}
|
972
656
|
}
|
973
657
|
}
|
974
|
-
async fetchNewTaxonomy(slug) {
|
975
|
-
state.selectedCategory = null;
|
976
|
-
state.selectedProduct = null;
|
977
|
-
state.selectedService = null;
|
978
|
-
state.maleri = null;
|
979
|
-
const res = await getTaxonomy(slug);
|
980
|
-
if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found' || (res === null || res === void 0 ? void 0 : res.code) === 'rest_no_route') {
|
981
|
-
console.log('taxonomy not found');
|
982
|
-
}
|
983
|
-
else if (res) {
|
984
|
-
this.setTaxonomy(res);
|
985
|
-
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
986
|
-
this.product = res;
|
987
|
-
}
|
988
|
-
}
|
989
|
-
}
|
990
658
|
async componentWillLoad() {
|
991
|
-
state.business = this.business;
|
659
|
+
index$1.state.business = this.business;
|
992
660
|
const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
|
993
661
|
if (cart) {
|
994
|
-
state.cart = JSON.parse(cart);
|
662
|
+
index$1.state.cart = JSON.parse(cart);
|
995
663
|
}
|
996
664
|
const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);
|
997
665
|
if (user) {
|
998
|
-
state.user = JSON.parse(user);
|
666
|
+
index$1.state.user = JSON.parse(user);
|
999
667
|
}
|
1000
668
|
const creditSafeUser = window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);
|
1001
669
|
if (creditSafeUser) {
|
1002
|
-
state.creditSafeUser = JSON.parse(creditSafeUser);
|
670
|
+
index$1.state.creditSafeUser = JSON.parse(creditSafeUser);
|
1003
671
|
}
|
1004
|
-
const [
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
console.warn('customer not found');
|
1017
|
-
}
|
1018
|
-
else if (customer) {
|
1019
|
-
state.customer = customer;
|
1020
|
-
if (this.id) {
|
1021
|
-
if (this.id === 'maleri') {
|
1022
|
-
state.maleri = true;
|
1023
|
-
state.step = 4;
|
1024
|
-
}
|
1025
|
-
else {
|
1026
|
-
this.loadCategoryOrProduct(this.id);
|
1027
|
-
}
|
672
|
+
const [options, rut, rot, greenDiscount] = await Promise.all([getOptions(), getRut(), getRot(), getGreenDiscount()]);
|
673
|
+
try {
|
674
|
+
const customer = await getCustomer(this.business);
|
675
|
+
if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
|
676
|
+
console.warn('customer not found');
|
677
|
+
}
|
678
|
+
else if (customer) {
|
679
|
+
index$1.state.customer = customer;
|
680
|
+
if (this.id) {
|
681
|
+
if (this.id === 'maleri') {
|
682
|
+
index$1.state.maleri = true;
|
683
|
+
index$1.state.step = 4;
|
1028
684
|
}
|
1029
|
-
else
|
1030
|
-
this.loadCategoryOrProduct(this.
|
685
|
+
else {
|
686
|
+
this.loadCategoryOrProduct(this.id);
|
1031
687
|
}
|
1032
688
|
}
|
1033
689
|
}
|
1034
|
-
catch (error) {
|
1035
|
-
console.warn('customer not found');
|
1036
|
-
}
|
1037
|
-
}
|
1038
|
-
if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
|
1039
|
-
else if (tree) {
|
1040
|
-
this.tree = tree;
|
1041
690
|
}
|
1042
|
-
|
1043
|
-
console.
|
1044
|
-
}
|
1045
|
-
else if (res) {
|
1046
|
-
this.setTaxonomy(res);
|
1047
|
-
if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
|
1048
|
-
this.product = res;
|
1049
|
-
}
|
1050
|
-
}
|
1051
|
-
if (this.loadFromQuery) {
|
1052
|
-
const params = new URL(document.location.toString()).searchParams;
|
1053
|
-
this.id = params.get('id');
|
1054
|
-
if (!this.isDemo) {
|
1055
|
-
this.openModal();
|
1056
|
-
}
|
1057
|
-
}
|
1058
|
-
state.rotOptions = rot;
|
1059
|
-
state.rutOptions = rut;
|
1060
|
-
state.greenOptions = greenDiscount;
|
1061
|
-
state.options = options;
|
1062
|
-
}
|
1063
|
-
setTaxonomy(taxonomy) {
|
1064
|
-
if (taxonomy) {
|
1065
|
-
if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
|
1066
|
-
state.selectedCategory = taxonomy;
|
1067
|
-
state.step = 2;
|
1068
|
-
}
|
1069
|
-
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
|
1070
|
-
state.selectedService = taxonomy;
|
1071
|
-
state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === taxonomy.ID));
|
1072
|
-
state.step = 3;
|
1073
|
-
}
|
1074
|
-
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
|
1075
|
-
state.selectedProduct = taxonomy;
|
1076
|
-
state.selectedService = this.tree.sub_cats
|
1077
|
-
.map(c => c.services)
|
1078
|
-
.flat()
|
1079
|
-
.find(s => s.products.find(p => p.ID === state.selectedProduct.ID));
|
1080
|
-
state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));
|
1081
|
-
state.step = 4;
|
1082
|
-
}
|
1083
|
-
this.triggerScrollTotop();
|
691
|
+
catch (error) {
|
692
|
+
console.warn('customer not found');
|
1084
693
|
}
|
694
|
+
index$1.state.rotOptions = rot;
|
695
|
+
index$1.state.rutOptions = rut;
|
696
|
+
index$1.state.greenOptions = greenDiscount;
|
697
|
+
index$1.state.options = options;
|
1085
698
|
}
|
1086
699
|
// Open close modal && click outside event
|
1087
700
|
openModal() {
|
@@ -1097,8 +710,6 @@ const HemfixarnaComponent = class {
|
|
1097
710
|
}, 200);
|
1098
711
|
}
|
1099
712
|
handleClick(e) {
|
1100
|
-
if (this.loadFromQuery && !this.isDemo)
|
1101
|
-
return;
|
1102
713
|
if ((e === null || e === void 0 ? void 0 : e.composedPath()[0]).classList.contains('hemfixarna_backdrop')) {
|
1103
714
|
this.closeModal();
|
1104
715
|
}
|
@@ -1106,29 +717,26 @@ const HemfixarnaComponent = class {
|
|
1106
717
|
if (infomodal) {
|
1107
718
|
const isClickInside = infomodal.contains(e.composedPath()[0]);
|
1108
719
|
if (!isClickInside) {
|
1109
|
-
state.modal = null;
|
720
|
+
index$1.state.modal = null;
|
1110
721
|
}
|
1111
722
|
}
|
1112
723
|
}
|
1113
724
|
getCartLength() {
|
1114
|
-
return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
725
|
+
return index$1.state.cart.reduce((acc, curr) => acc + curr.amount, 0);
|
1115
726
|
}
|
1116
727
|
render() {
|
1117
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
728
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
1118
729
|
const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
1119
730
|
const pensel = index.getAssetPath(`./assets/pensel.svg`);
|
1120
731
|
const monteringLogo = index.getAssetPath(`./assets/montering.svg`);
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
backgroundColor: ((_q = this.buttonBg) === null || _q === void 0 ? void 0 : _q.startsWith('#')) || !((_r = this.buttonBg) === null || _r === void 0 ? void 0 : _r.length) ? this.buttonBg : `#${this.buttonBg}`,
|
1126
|
-
} }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))) : null, 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)) : null, this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, state.modal.title && index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && (index.h("hemfixarna-breadcrumbs", { isDemo: this.isDemo, loadFromQuery: this.loadFromQuery, closeModal: () => this.closeModal(), tree: this.tree })), !state.customer || this.slugIsOldFormat(this.slug) ? (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))) : (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}` }, state.step < 4 && index.h("hemfixarna-start", null), state.step === 4 && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree })))), !this.isDemo ? index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` }) : null))));
|
732
|
+
return (index.h("div", { class: "hemfixarna" }, 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: {
|
733
|
+
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}`,
|
734
|
+
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}`,
|
735
|
+
} }, "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$1.state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (index$1.state.modal = null) }, "St\u00E4ng")))), 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' : ''}` })))));
|
1127
736
|
}
|
1128
737
|
static get assetsDirs() { return ["assets"]; }
|
1129
738
|
get el() { return index.getElement(this); }
|
1130
739
|
static get watchers() { return {
|
1131
|
-
"slug": ["watchSlugChange"],
|
1132
740
|
"id": ["watchIdChange"]
|
1133
741
|
}; }
|
1134
742
|
};
|
@@ -1146,7 +754,7 @@ const HemfixarnaInfo$1 = class {
|
|
1146
754
|
|
1147
755
|
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}";
|
1148
756
|
|
1149
|
-
const MyComponent
|
757
|
+
const MyComponent = class {
|
1150
758
|
constructor(hostRef) {
|
1151
759
|
index.registerInstance(this, hostRef);
|
1152
760
|
this.debounce = null;
|
@@ -1156,11 +764,13 @@ const MyComponent$i = class {
|
|
1156
764
|
this.tooltipText = 'Kopiera till urklipp';
|
1157
765
|
this.tree = null;
|
1158
766
|
this.customer = null;
|
1159
|
-
this.widgetStyle = WidgetStyle.standard;
|
767
|
+
this.widgetStyle = index$2.WidgetStyle.standard;
|
1160
768
|
this.buttonBg = '';
|
1161
769
|
this.buttonColor = '';
|
1162
770
|
this.partner = undefined;
|
1163
771
|
this.colorAccessibility = undefined;
|
772
|
+
this.loggedIn = false;
|
773
|
+
this.loginError = false;
|
1164
774
|
}
|
1165
775
|
debouncedFunction() {
|
1166
776
|
if (this.debounce !== null) {
|
@@ -1177,25 +787,22 @@ const MyComponent$i = class {
|
|
1177
787
|
const defaultBgColor = '#c84e18';
|
1178
788
|
const firstColor = this.buttonBg.length ? (this.buttonBg.startsWith('#') ? this.buttonBg : `#${this.buttonBg}`) : defaultBgColor;
|
1179
789
|
const secondColor = this.buttonColor.length ? (this.buttonColor.startsWith('#') ? this.buttonColor : `#${this.buttonColor}`) : defaultTextColor;
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
790
|
+
try {
|
791
|
+
const response = await fetch('https://www.aremycolorsaccessible.com/api/are-they', {
|
792
|
+
mode: 'cors',
|
793
|
+
method: 'POST',
|
794
|
+
body: JSON.stringify({ colors: [firstColor, secondColor] }),
|
795
|
+
});
|
796
|
+
if (!response) {
|
797
|
+
throw new Error('Network response was not ok');
|
798
|
+
}
|
799
|
+
const json = await response.json();
|
1187
800
|
if (json && (json)) {
|
1188
801
|
this.colorAccessibility = json;
|
1189
802
|
}
|
1190
|
-
}
|
1191
|
-
|
1192
|
-
|
1193
|
-
getTopLevelCategory() {
|
1194
|
-
switch (process.env.BUSINESS) {
|
1195
|
-
case Business.byggmax:
|
1196
|
-
return TopCategory.byggmax;
|
1197
|
-
default:
|
1198
|
-
return '';
|
803
|
+
}
|
804
|
+
catch (error) {
|
805
|
+
console.warn('Error fetching color accessibility:', error);
|
1199
806
|
}
|
1200
807
|
}
|
1201
808
|
getColor(rating) {
|
@@ -1213,25 +820,20 @@ const MyComponent$i = class {
|
|
1213
820
|
}
|
1214
821
|
}
|
1215
822
|
async componentWillLoad() {
|
1216
|
-
|
1217
|
-
if (
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
const partner = window.location.pathname.replace('/', '');
|
1226
|
-
this.partner = isBusiness(partner) ? partner : (_a = process.env.BUSINESS) !== null && _a !== void 0 ? _a : Business.kund;
|
1227
|
-
const customer = await getCustomer(this.partner);
|
1228
|
-
if (customer.code !== 'not_found' && customer) {
|
1229
|
-
this.customer = customer;
|
823
|
+
const partner = window.location.pathname.replace('/', '');
|
824
|
+
if (!isBusiness(partner) && partner)
|
825
|
+
return;
|
826
|
+
this.partner = partner ? partner : index$2.Business.kund;
|
827
|
+
const customer = await getCustomer(this.partner);
|
828
|
+
if (customer.code !== 'not_found' && customer) {
|
829
|
+
this.customer = customer;
|
830
|
+
if (!this.customer.password_protected || window.localStorage.getItem(`${this.customer.ID}-loggedin`)) {
|
831
|
+
this.loggedIn = true;
|
1230
832
|
}
|
1231
833
|
}
|
1232
834
|
}
|
1233
835
|
getExample() {
|
1234
|
-
return `<hemfixarna
|
836
|
+
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>`;
|
1235
837
|
}
|
1236
838
|
copyExample() {
|
1237
839
|
navigator.clipboard.writeText(this.getExample());
|
@@ -1259,100 +861,59 @@ const MyComponent$i = class {
|
|
1259
861
|
const allCategories = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.categories.map(c => (c.sub_categories ? c.sub_categories : c)).flat();
|
1260
862
|
return allCategories === null || allCategories === void 0 ? void 0 : allCategories.some(c => c.add_painting);
|
1261
863
|
}
|
864
|
+
async handleLogin() {
|
865
|
+
const shadowHost = document.querySelector('hemfixarna-demo');
|
866
|
+
const shadowRoot = shadowHost.shadowRoot;
|
867
|
+
const passwordInput = shadowRoot.querySelector('input[type="password"]');
|
868
|
+
const password = passwordInput.value;
|
869
|
+
this.loginError = false;
|
870
|
+
try {
|
871
|
+
const status = await loginCustomer({ id: this.customer.ID, password: password });
|
872
|
+
if (status === 200) {
|
873
|
+
this.loggedIn = true;
|
874
|
+
window.localStorage.setItem(`${this.customer.ID}-loggedin`, 'true');
|
875
|
+
}
|
876
|
+
else {
|
877
|
+
this.loginError = true;
|
878
|
+
}
|
879
|
+
}
|
880
|
+
catch (error) {
|
881
|
+
console.log(error);
|
882
|
+
this.loginError = true;
|
883
|
+
}
|
884
|
+
}
|
1262
885
|
render() {
|
1263
886
|
var _a;
|
1264
887
|
const copy = index.getAssetPath(`./assets/copy.png`);
|
1265
|
-
return (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)),
|
1266
|
-
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: () =>
|
888
|
+
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 &&
|
889
|
+
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 => {
|
890
|
+
e.preventDefault();
|
891
|
+
this.handleLogin();
|
892
|
+
}, style: {
|
893
|
+
display: 'flex',
|
894
|
+
flexDirection: 'column',
|
895
|
+
gap: '1rem',
|
896
|
+
maxWidth: '300px',
|
897
|
+
margin: 'auto',
|
898
|
+
padding: '20px',
|
899
|
+
border: '1px solid #ccc',
|
900
|
+
borderRadius: '5px',
|
901
|
+
gridColumn: 'span 2',
|
902
|
+
} }, 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: {
|
903
|
+
textAlign: 'center',
|
904
|
+
margin: 'auto',
|
905
|
+
padding: '20px',
|
906
|
+
fontSize: '24px',
|
907
|
+
fontWeight: 'bold',
|
908
|
+
color: 'red',
|
909
|
+
} }, "No customer found"));
|
1267
910
|
}
|
1268
911
|
static get watchers() { return {
|
1269
912
|
"buttonBg": ["debouncedFunction"],
|
1270
913
|
"buttonColor": ["debouncedFunction"]
|
1271
914
|
}; }
|
1272
915
|
};
|
1273
|
-
MyComponent
|
1274
|
-
|
1275
|
-
const hemfixarnaDoroCss = "";
|
1276
|
-
|
1277
|
-
const MyComponent$h = class {
|
1278
|
-
constructor(hostRef) {
|
1279
|
-
index.registerInstance(this, hostRef);
|
1280
|
-
this.id = undefined;
|
1281
|
-
this.loadFromQuery = undefined;
|
1282
|
-
this.widgetStyle = WidgetStyle.standard;
|
1283
|
-
this.buttonColor = undefined;
|
1284
|
-
this.buttonBg = undefined;
|
1285
|
-
}
|
1286
|
-
render() {
|
1287
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.doro }));
|
1288
|
-
}
|
1289
|
-
};
|
1290
|
-
MyComponent$h.style = hemfixarnaDoroCss;
|
1291
|
-
|
1292
|
-
const hemfixarnaElfaCss = "";
|
1293
|
-
|
1294
|
-
const MyComponent$g = class {
|
1295
|
-
constructor(hostRef) {
|
1296
|
-
index.registerInstance(this, hostRef);
|
1297
|
-
this.id = undefined;
|
1298
|
-
this.loadFromQuery = 'true';
|
1299
|
-
this.widgetStyle = WidgetStyle.standard;
|
1300
|
-
this.buttonColor = undefined;
|
1301
|
-
this.buttonBg = undefined;
|
1302
|
-
this.isDemo = false;
|
1303
|
-
}
|
1304
|
-
render() {
|
1305
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://elfa.com', logo: 'assets/elfa.png' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.elfa, isDemo: this.isDemo }));
|
1306
|
-
}
|
1307
|
-
};
|
1308
|
-
MyComponent$g.style = hemfixarnaElfaCss;
|
1309
|
-
|
1310
|
-
const MyComponent$f = class {
|
1311
|
-
constructor(hostRef) {
|
1312
|
-
index.registerInstance(this, hostRef);
|
1313
|
-
this.id = undefined;
|
1314
|
-
this.loadFromQuery = undefined;
|
1315
|
-
this.widgetStyle = WidgetStyle.standard;
|
1316
|
-
this.buttonColor = undefined;
|
1317
|
-
this.buttonBg = undefined;
|
1318
|
-
this.isDemo = false;
|
1319
|
-
}
|
1320
|
-
render() {
|
1321
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.fargvaruhuset, isDemo: this.isDemo }));
|
1322
|
-
}
|
1323
|
-
};
|
1324
|
-
|
1325
|
-
const MyComponent$e = class {
|
1326
|
-
constructor(hostRef) {
|
1327
|
-
index.registerInstance(this, hostRef);
|
1328
|
-
this.id = undefined;
|
1329
|
-
this.loadFromQuery = undefined;
|
1330
|
-
this.widgetStyle = WidgetStyle.standard;
|
1331
|
-
this.buttonColor = undefined;
|
1332
|
-
this.buttonBg = undefined;
|
1333
|
-
this.isDemo = false;
|
1334
|
-
}
|
1335
|
-
render() {
|
1336
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.flyttsmart, isDemo: this.isDemo }));
|
1337
|
-
}
|
1338
|
-
};
|
1339
|
-
|
1340
|
-
const hemfixarnaForebyggCss = "";
|
1341
|
-
|
1342
|
-
const MyComponent$d = class {
|
1343
|
-
constructor(hostRef) {
|
1344
|
-
index.registerInstance(this, hostRef);
|
1345
|
-
this.id = undefined;
|
1346
|
-
this.loadFromQuery = undefined;
|
1347
|
-
this.widgetStyle = WidgetStyle.standard;
|
1348
|
-
this.buttonColor = undefined;
|
1349
|
-
this.buttonBg = undefined;
|
1350
|
-
}
|
1351
|
-
render() {
|
1352
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.forebygg }));
|
1353
|
-
}
|
1354
|
-
};
|
1355
|
-
MyComponent$d.style = hemfixarnaForebyggCss;
|
916
|
+
MyComponent.style = hemfixarnaDemoCss;
|
1356
917
|
|
1357
918
|
// src/errors.ts
|
1358
919
|
var PersonnummerError = class extends Error {
|
@@ -1988,8 +1549,7 @@ exports.MD5 = {
|
|
1988
1549
|
});
|
1989
1550
|
|
1990
1551
|
const apiSearch = async (query) => {
|
1991
|
-
|
1992
|
-
const res = await fetch((_a = "https://hemfixare-lookup.vercel.app/api") !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
|
1552
|
+
const res = await fetch(getCreditSafeApiUrl(), {
|
1993
1553
|
method: 'POST',
|
1994
1554
|
headers: {
|
1995
1555
|
'Content-Type': 'application/json',
|
@@ -2041,9 +1601,9 @@ const HemfixarnaGetuser = class {
|
|
2041
1601
|
try {
|
2042
1602
|
const creditSafeData = await apiSearch(this.ssn);
|
2043
1603
|
if (creditSafeData) {
|
2044
|
-
state.creditSafeUser = creditSafeData;
|
2045
|
-
state.checkoutStep = 2;
|
2046
|
-
state.user = Object.assign(Object.assign({}, creditSafeData), { email: this.email, phone: this.phone, ssn: this.ssn });
|
1604
|
+
index$1.state.creditSafeUser = creditSafeData;
|
1605
|
+
index$1.state.checkoutStep = 2;
|
1606
|
+
index$1.state.user = Object.assign(Object.assign({}, creditSafeData), { email: this.email, phone: this.phone, ssn: this.ssn });
|
2047
1607
|
}
|
2048
1608
|
else {
|
2049
1609
|
this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';
|
@@ -2070,48 +1630,30 @@ const HemfixarnaGetuser = class {
|
|
2070
1630
|
this.ssnError = null;
|
2071
1631
|
}
|
2072
1632
|
componentWillLoad() {
|
2073
|
-
if (state.user) {
|
2074
|
-
this.email = state.user.email;
|
2075
|
-
this.phone = state.user.phone;
|
2076
|
-
this.ssn = state.user.ssn;
|
1633
|
+
if (index$1.state.user) {
|
1634
|
+
this.email = index$1.state.user.email;
|
1635
|
+
this.phone = index$1.state.user.phone;
|
1636
|
+
this.ssn = index$1.state.user.ssn;
|
2077
1637
|
}
|
2078
1638
|
}
|
2079
1639
|
get el() { return index.getElement(this); }
|
2080
1640
|
};
|
2081
1641
|
|
2082
|
-
const hemfixarnaHornbachCss = "";
|
2083
|
-
|
2084
|
-
const MyComponent$c = class {
|
2085
|
-
constructor(hostRef) {
|
2086
|
-
index.registerInstance(this, hostRef);
|
2087
|
-
this.id = undefined;
|
2088
|
-
this.loadFromQuery = 'true';
|
2089
|
-
this.isDemo = false;
|
2090
|
-
this.widgetStyle = WidgetStyle.standard;
|
2091
|
-
this.buttonColor = undefined;
|
2092
|
-
this.buttonBg = undefined;
|
2093
|
-
}
|
2094
|
-
render() {
|
2095
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.hornbach.se/', logo: 'assets/hornbach/logo.svg', background: './assets/hornbach/nav.jpg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.hornbach }));
|
2096
|
-
}
|
2097
|
-
};
|
2098
|
-
MyComponent$c.style = hemfixarnaHornbachCss;
|
2099
|
-
|
2100
1642
|
const HemfixarnaInfo = class {
|
2101
1643
|
constructor(hostRef) {
|
2102
1644
|
index.registerInstance(this, hostRef);
|
2103
1645
|
this.logo = index.getAssetPath(`./assets/hemfixarna.svg`);
|
2104
1646
|
}
|
2105
1647
|
render() {
|
2106
|
-
var _a;
|
1648
|
+
var _a, _b;
|
2107
1649
|
const checked = index.getAssetPath(`./assets/checked.svg`);
|
2108
|
-
return (index.h("div", { class: "hemfixarna_info" }, state.step < 5 ? (index.h(index.Fragment, null, index.h("h2", null, state.customer.info_title), index.h("p", null, state.customer.info_text))) : (index.h("h2", null, state.customer.checkout_title)), index.h("ul", { class: "hemfixarna_features" }, state.step < 5 ? (index.h(index.Fragment, null, ((_a = state.customer.trust_badges) === null || _a === void 0 ? void 0 : _a.length) ? (index.h(index.Fragment, null, 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, 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, state.customer.checkout_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("img", { src: this.logo, width: 200, alt: "hemfixarna" }), index.h("a", { class: "hemfixarna_product--link", target: "_blank", href: state.options.link.url }, state.options.link.title)));
|
1650
|
+
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)));
|
2109
1651
|
}
|
2110
1652
|
};
|
2111
1653
|
|
2112
1654
|
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}";
|
2113
1655
|
|
2114
|
-
const base = `${
|
1656
|
+
const base = `${getApiUrl()}/wp-json/headless`;
|
2115
1657
|
const HemfixarnaInvoice = class {
|
2116
1658
|
constructor(hostRef) {
|
2117
1659
|
index.registerInstance(this, hostRef);
|
@@ -2167,7 +1709,7 @@ const HemfixarnaInvoice = class {
|
|
2167
1709
|
this.formState = 'initial';
|
2168
1710
|
return;
|
2169
1711
|
}
|
2170
|
-
if (state.selectedProduct.terms_show_checkbox && !values.terms) {
|
1712
|
+
if (index$1.state.selectedProduct.terms_show_checkbox && !values.terms) {
|
2171
1713
|
this.formError = 'Vänligen acceptera villkoren';
|
2172
1714
|
this.formState = 'initial';
|
2173
1715
|
return;
|
@@ -2176,17 +1718,17 @@ const HemfixarnaInvoice = class {
|
|
2176
1718
|
formData.append('text', values.description);
|
2177
1719
|
formData.append('email', values.email);
|
2178
1720
|
formData.append('phone', values.tel);
|
2179
|
-
formData.append('customer', state.business);
|
1721
|
+
formData.append('customer', index$1.state.business);
|
2180
1722
|
this.formImages.forEach(file => {
|
2181
1723
|
formData.append('images[]', file);
|
2182
1724
|
});
|
2183
1725
|
formData.append('product', JSON.stringify({
|
2184
|
-
title: state.selectedProduct.title,
|
1726
|
+
title: index$1.state.selectedProduct.title,
|
2185
1727
|
amount: 1,
|
2186
|
-
has_rut: state.selectedProduct.rut,
|
2187
|
-
has_rot: state.selectedProduct.rot,
|
2188
|
-
has_green: state.selectedProduct.green,
|
2189
|
-
ID: state.selectedProduct.ID,
|
1728
|
+
has_rut: index$1.state.selectedProduct.rut,
|
1729
|
+
has_rot: index$1.state.selectedProduct.rot,
|
1730
|
+
has_green: index$1.state.selectedProduct.green,
|
1731
|
+
ID: index$1.state.selectedProduct.ID,
|
2190
1732
|
parts: [],
|
2191
1733
|
}));
|
2192
1734
|
try {
|
@@ -2196,8 +1738,8 @@ const HemfixarnaInvoice = class {
|
|
2196
1738
|
});
|
2197
1739
|
const { response } = await res.json();
|
2198
1740
|
if (response.code === 200) {
|
2199
|
-
state.checkoutInvoice = true;
|
2200
|
-
state.step = 6;
|
1741
|
+
index$1.state.checkoutInvoice = true;
|
1742
|
+
index$1.state.step = 6;
|
2201
1743
|
}
|
2202
1744
|
else {
|
2203
1745
|
this.formError = 'Vi kan inte ta emot din beställning just nu';
|
@@ -2251,86 +1793,27 @@ const HemfixarnaInvoice = class {
|
|
2251
1793
|
}
|
2252
1794
|
render() {
|
2253
1795
|
const upload = index.getAssetPath(`./assets/drag-drop.svg`);
|
2254
|
-
return (index.h("div", { class: "invoice" }, index.h("p", null, state.selectedProduct.invoice_description), 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" }), state.selectedProduct.terms_show_checkbox ? (index.h("label", null, index.h("input", { type: "checkbox", name: "termsInput" }), 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' }))));
|
1796
|
+
return (index.h("div", { class: "invoice" }, index.h("p", null, index$1.state.selectedProduct.invoice_description), 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' }))));
|
2255
1797
|
}
|
2256
1798
|
get el() { return index.getElement(this); }
|
2257
1799
|
};
|
2258
1800
|
HemfixarnaInvoice.style = hemfixarnaInvoiceCss;
|
2259
1801
|
|
2260
|
-
const MyComponent$b = class {
|
2261
|
-
constructor(hostRef) {
|
2262
|
-
index.registerInstance(this, hostRef);
|
2263
|
-
this.id = undefined;
|
2264
|
-
this.loadFromQuery = 'true';
|
2265
|
-
this.widgetStyle = WidgetStyle.standard;
|
2266
|
-
this.buttonColor = undefined;
|
2267
|
-
this.buttonBg = undefined;
|
2268
|
-
this.isDemo = false;
|
2269
|
-
}
|
2270
|
-
render() {
|
2271
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://k-bygg.se', logo: 'assets/kbygg.svg', backgroundColor: '#651d32' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.kbygg, isDemo: this.isDemo }));
|
2272
|
-
}
|
2273
|
-
};
|
2274
|
-
|
2275
|
-
const MyComponent$a = class {
|
2276
|
-
constructor(hostRef) {
|
2277
|
-
index.registerInstance(this, hostRef);
|
2278
|
-
this.id = undefined;
|
2279
|
-
this.loadFromQuery = undefined;
|
2280
|
-
this.widgetStyle = WidgetStyle.standard;
|
2281
|
-
this.buttonColor = undefined;
|
2282
|
-
this.buttonBg = undefined;
|
2283
|
-
}
|
2284
|
-
render() {
|
2285
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.klint }));
|
2286
|
-
}
|
2287
|
-
};
|
2288
|
-
|
2289
|
-
const MyComponent$9 = class {
|
2290
|
-
constructor(hostRef) {
|
2291
|
-
index.registerInstance(this, hostRef);
|
2292
|
-
this.id = undefined;
|
2293
|
-
this.loadFromQuery = undefined;
|
2294
|
-
this.widgetStyle = WidgetStyle.standard;
|
2295
|
-
this.buttonColor = undefined;
|
2296
|
-
this.buttonBg = undefined;
|
2297
|
-
}
|
2298
|
-
render() {
|
2299
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.kund }));
|
2300
|
-
}
|
2301
|
-
};
|
2302
|
-
|
2303
|
-
const MyComponent$8 = class {
|
2304
|
-
constructor(hostRef) {
|
2305
|
-
index.registerInstance(this, hostRef);
|
2306
|
-
this.id = undefined;
|
2307
|
-
this.loadFromQuery = 'true';
|
2308
|
-
this.widgetStyle = WidgetStyle.standard;
|
2309
|
-
this.buttonColor = undefined;
|
2310
|
-
this.buttonBg = undefined;
|
2311
|
-
this.isDemo = false;
|
2312
|
-
}
|
2313
|
-
render() {
|
2314
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://norrgavel.se', logo: 'assets/norrgavel.svg' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.norrgavel, isDemo: this.isDemo }));
|
2315
|
-
}
|
2316
|
-
};
|
2317
|
-
|
2318
1802
|
const HemfixarnaOrder = class {
|
2319
1803
|
constructor(hostRef) {
|
2320
1804
|
index.registerInstance(this, hostRef);
|
2321
1805
|
this.render = () => {
|
2322
|
-
return (index.h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, index.h("div", null), index.h("div", null, index.h("h2", null, state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), state.checkoutInvoice ? index.h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, state.checkoutInvoice ? index.h("div", null) : index.h("hemfixarna-orderrows", {
|
1806
|
+
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))));
|
2323
1807
|
};
|
2324
|
-
this.tree = undefined;
|
2325
1808
|
}
|
2326
1809
|
resetShop() {
|
2327
|
-
state.step = 1;
|
2328
|
-
state.cart = [];
|
2329
|
-
state.selectedCategory = null;
|
2330
|
-
state.selectedService = null;
|
2331
|
-
state.selectedProduct = null;
|
2332
|
-
state.maleri = null;
|
2333
|
-
state.checkoutStep = 1;
|
1810
|
+
index$1.state.step = 1;
|
1811
|
+
index$1.state.cart = [];
|
1812
|
+
index$1.state.selectedCategory = null;
|
1813
|
+
index$1.state.selectedService = null;
|
1814
|
+
index$1.state.selectedProduct = null;
|
1815
|
+
index$1.state.maleri = null;
|
1816
|
+
index$1.state.checkoutStep = 1;
|
2334
1817
|
}
|
2335
1818
|
disconnectedCallback() {
|
2336
1819
|
this.resetShop();
|
@@ -2341,58 +1824,44 @@ const HemfixarnaOrderrows = class {
|
|
2341
1824
|
constructor(hostRef) {
|
2342
1825
|
index.registerInstance(this, hostRef);
|
2343
1826
|
this.cart = true;
|
2344
|
-
this.tree = undefined;
|
2345
1827
|
}
|
2346
1828
|
goToProduct(id) {
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
state.step = 4;
|
2356
|
-
}
|
2357
|
-
}
|
2358
|
-
else {
|
2359
|
-
const services = this.tree.sub_cats.map((c) => c.services).flat();
|
2360
|
-
const products = services.map((s) => s.products).flat();
|
2361
|
-
const product = products.find((p) => p.ID === id);
|
2362
|
-
const service = services.find((s) => s.products.find((p) => p.ID === id));
|
2363
|
-
const category = this.tree.sub_cats.find((c) => c.services.find((s) => s.products.find((p) => p.ID === id)));
|
2364
|
-
state.selectedCategory = category;
|
2365
|
-
state.selectedService = service;
|
2366
|
-
state.selectedProduct = product;
|
2367
|
-
state.step = 4;
|
1829
|
+
const products = index$1.state.customer.categories
|
1830
|
+
.map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
|
1831
|
+
.flat()
|
1832
|
+
.flat();
|
1833
|
+
const product = products.find(p => p && p.fields.ID === id);
|
1834
|
+
if (product) {
|
1835
|
+
index$1.state.selectedProduct = product.fields;
|
1836
|
+
index$1.state.step = 4;
|
2368
1837
|
}
|
2369
1838
|
}
|
2370
1839
|
openRot() {
|
2371
|
-
state.modal = {
|
2372
|
-
title: state.rotOptions.rot_start_fee_heading,
|
2373
|
-
text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],
|
1840
|
+
index$1.state.modal = {
|
1841
|
+
title: index$1.state.rotOptions.rot_start_fee_heading,
|
1842
|
+
text: [index$1.state.rotOptions.rot_start_fee_text, index$1.state.rotOptions.rot_start_fee_text_secondary],
|
2374
1843
|
};
|
2375
1844
|
}
|
2376
1845
|
openRut() {
|
2377
|
-
state.modal = {
|
2378
|
-
title: state.rutOptions.rut_start_fee_heading,
|
2379
|
-
text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],
|
1846
|
+
index$1.state.modal = {
|
1847
|
+
title: index$1.state.rutOptions.rut_start_fee_heading,
|
1848
|
+
text: [index$1.state.rutOptions.rut_start_fee_text, index$1.state.rutOptions.rut_start_fee_text_secondary],
|
2380
1849
|
};
|
2381
1850
|
}
|
2382
1851
|
openGreen() {
|
2383
|
-
state.modal = {
|
2384
|
-
title: state.greenOptions.green_start_fee_heading,
|
2385
|
-
text: [state.greenOptions.green_start_fee_text, state.greenOptions.green_start_fee_text_secondary],
|
1852
|
+
index$1.state.modal = {
|
1853
|
+
title: index$1.state.greenOptions.green_start_fee_heading,
|
1854
|
+
text: [index$1.state.greenOptions.green_start_fee_text, index$1.state.greenOptions.green_start_fee_text_secondary],
|
2386
1855
|
};
|
2387
1856
|
}
|
2388
1857
|
getDiscountedInfo(item) {
|
2389
|
-
if (item.rut && state.rut) {
|
1858
|
+
if (item.rut && index$1.state.rut) {
|
2390
1859
|
return ' (efter RUT-avdrag)';
|
2391
1860
|
}
|
2392
|
-
else if (item.rot && state.rot) {
|
1861
|
+
else if (item.rot && index$1.state.rot) {
|
2393
1862
|
return ' (efter ROT-avdrag)';
|
2394
1863
|
}
|
2395
|
-
else if (item.green && state.green) {
|
1864
|
+
else if (item.green && index$1.state.green) {
|
2396
1865
|
return ' (efter Grön teknik avdrag)';
|
2397
1866
|
}
|
2398
1867
|
else {
|
@@ -2401,25 +1870,10 @@ const HemfixarnaOrderrows = class {
|
|
2401
1870
|
}
|
2402
1871
|
render() {
|
2403
1872
|
const info = index.getAssetPath(`./assets/info.svg`);
|
2404
|
-
return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, state.cart.map(item => {
|
1873
|
+
return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, index$1.state.cart.map(item => {
|
2405
1874
|
var _a;
|
2406
1875
|
return (index.h("li", { class: "hemfixarna_cart--item" }, index.h("div", null, index.h("div", null, item.icon && index.h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), index.h("p", null, index.h("strong", null, item.amount, "x "), item.name)), this.cart && index.h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), index.h("p", null, index.h("strong", null, getProductPrice(item, item.price, item.amount), "kr"), index.h("span", null, this.getDiscountedInfo(item))), item.parts.length > 0 && (index.h("ul", null, item.parts.map(part => (index.h("li", null, index.h("p", null, index.h("strong", null, part.amount, "x "), part.name), index.h("p", null, index.h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
|
2407
|
-
})), index.h("div", { class: "hemfixarna_cart--additional" }, index.h("div", null, getStartFee().rot > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rut, "kr"))), getStartFee().green > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openGreen() }, state.greenOptions.green_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().green, "kr")))), state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), index.h("span", { class: "slider" }))), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)"))), 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: () => (state.green = !state.green), checked: state.green, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "Gr\u00F6n teknik avdrag")), index.h("p", null, "(-", state.green ? calculateGreenDiscount() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
|
2408
|
-
}
|
2409
|
-
};
|
2410
|
-
|
2411
|
-
const MyComponent$7 = class {
|
2412
|
-
constructor(hostRef) {
|
2413
|
-
index.registerInstance(this, hostRef);
|
2414
|
-
this.id = undefined;
|
2415
|
-
this.customer = undefined;
|
2416
|
-
this.loadFromQuery = undefined;
|
2417
|
-
this.widgetStyle = WidgetStyle.standard;
|
2418
|
-
this.buttonColor = undefined;
|
2419
|
-
this.buttonBg = undefined;
|
2420
|
-
}
|
2421
|
-
render() {
|
2422
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.power }));
|
1876
|
+
})), index.h("div", { class: "hemfixarna_cart--additional" }, index.h("div", null, getStartFee().rot > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRot() }, index$1.state.rotOptions.rot_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRut() }, index$1.state.rutOptions.rut_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rut, "kr"))), getStartFee().green > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openGreen() }, index$1.state.greenOptions.green_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().green, "kr")))), index$1.state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: 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)"))), 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)"))), 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"))));
|
2423
1877
|
}
|
2424
1878
|
};
|
2425
1879
|
|
@@ -2432,44 +1886,44 @@ const HemfixarnaProduct = class {
|
|
2432
1886
|
this.hideDescription = true;
|
2433
1887
|
}
|
2434
1888
|
addProduct() {
|
2435
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1889
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2436
1890
|
if (productInCart) {
|
2437
1891
|
productInCart.amount++;
|
2438
|
-
state.cart = [...state.cart];
|
1892
|
+
index$1.state.cart = [...index$1.state.cart];
|
2439
1893
|
}
|
2440
1894
|
else {
|
2441
|
-
state.cart = [
|
2442
|
-
...state.cart,
|
1895
|
+
index$1.state.cart = [
|
1896
|
+
...index$1.state.cart,
|
2443
1897
|
{
|
2444
|
-
id: state.selectedProduct.ID,
|
2445
|
-
rut: state.selectedProduct.rut,
|
2446
|
-
rot: state.selectedProduct.rot,
|
2447
|
-
green: state.selectedProduct.green,
|
1898
|
+
id: index$1.state.selectedProduct.ID,
|
1899
|
+
rut: index$1.state.selectedProduct.rut,
|
1900
|
+
rot: index$1.state.selectedProduct.rot,
|
1901
|
+
green: index$1.state.selectedProduct.green,
|
2448
1902
|
amount: 1,
|
2449
1903
|
parts: [],
|
2450
|
-
price: state.selectedProduct.price,
|
2451
|
-
name: state.selectedProduct.title,
|
2452
|
-
start_fee: !state.selectedProduct.hide_start_fee,
|
2453
|
-
terms_checkout: state.selectedProduct.terms_checkout,
|
2454
|
-
icon: state.selectedProduct.icon,
|
1904
|
+
price: index$1.state.selectedProduct.price,
|
1905
|
+
name: index$1.state.selectedProduct.title,
|
1906
|
+
start_fee: !index$1.state.selectedProduct.hide_start_fee,
|
1907
|
+
terms_checkout: index$1.state.selectedProduct.terms_checkout,
|
1908
|
+
icon: index$1.state.selectedProduct.icon,
|
2455
1909
|
},
|
2456
1910
|
];
|
2457
1911
|
}
|
2458
1912
|
}
|
2459
1913
|
removeProduct() {
|
2460
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1914
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2461
1915
|
if (productInCart && productInCart.amount > 1) {
|
2462
1916
|
productInCart.amount--;
|
2463
|
-
state.cart = [...state.cart];
|
1917
|
+
index$1.state.cart = [...index$1.state.cart];
|
2464
1918
|
}
|
2465
1919
|
else {
|
2466
|
-
state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);
|
1920
|
+
index$1.state.cart = index$1.state.cart.filter(p => p.id !== index$1.state.selectedProduct.ID);
|
2467
1921
|
}
|
2468
1922
|
}
|
2469
1923
|
//Handle cart and parts
|
2470
1924
|
addPart(part) {
|
2471
1925
|
var _a;
|
2472
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1926
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2473
1927
|
if (productInCart) {
|
2474
1928
|
const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
|
2475
1929
|
if (partInCart) {
|
@@ -2479,11 +1933,11 @@ const HemfixarnaProduct = class {
|
|
2479
1933
|
else {
|
2480
1934
|
productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: (_a = part.title) !== null && _a !== void 0 ? _a : part.title }];
|
2481
1935
|
}
|
2482
|
-
state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
1936
|
+
index$1.state.cart = [...index$1.state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
2483
1937
|
}
|
2484
1938
|
}
|
2485
1939
|
removePart(part) {
|
2486
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1940
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2487
1941
|
if (productInCart) {
|
2488
1942
|
const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
|
2489
1943
|
if (partInCart && partInCart.amount > 1) {
|
@@ -2493,43 +1947,43 @@ const HemfixarnaProduct = class {
|
|
2493
1947
|
else {
|
2494
1948
|
productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);
|
2495
1949
|
}
|
2496
|
-
state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
1950
|
+
index$1.state.cart = [...index$1.state.cart.filter(p => p.id !== productInCart.id), productInCart];
|
2497
1951
|
}
|
2498
1952
|
}
|
2499
1953
|
goToCart() {
|
2500
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1954
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2501
1955
|
if (productInCart) {
|
2502
|
-
state.step = 5;
|
1956
|
+
index$1.state.step = 5;
|
2503
1957
|
const el = this.el.closest('.hemfixarna_content');
|
2504
1958
|
scrollToTop(el);
|
2505
1959
|
}
|
2506
1960
|
}
|
2507
1961
|
getAmount() {
|
2508
1962
|
var _a;
|
2509
|
-
return ((_a = state.cart.find(p => p.id === state.selectedProduct.ID)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
|
1963
|
+
return ((_a = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
|
2510
1964
|
}
|
2511
1965
|
getPartAmount(partId) {
|
2512
1966
|
var _a;
|
2513
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1967
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2514
1968
|
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;
|
2515
1969
|
}
|
2516
1970
|
getTotalPrice() {
|
2517
1971
|
let price = 0;
|
2518
|
-
const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
|
1972
|
+
const productInCart = index$1.state.cart.find(p => p.id === index$1.state.selectedProduct.ID);
|
2519
1973
|
if (productInCart) {
|
2520
1974
|
const partsPrice = productInCart.parts.reduce((acc, curr) => {
|
2521
|
-
const part = state.selectedProduct.parts.find(p => p.ID === curr.id);
|
1975
|
+
const part = index$1.state.selectedProduct.parts.find(p => p.ID === curr.id);
|
2522
1976
|
if (part) {
|
2523
1977
|
return acc + part.price * curr.amount;
|
2524
1978
|
}
|
2525
1979
|
return acc;
|
2526
1980
|
}, 0);
|
2527
|
-
price = state.selectedProduct.price * productInCart.amount + partsPrice;
|
1981
|
+
price = index$1.state.selectedProduct.price * productInCart.amount + partsPrice;
|
2528
1982
|
}
|
2529
1983
|
else {
|
2530
|
-
price = state.selectedProduct.price;
|
1984
|
+
price = index$1.state.selectedProduct.price;
|
2531
1985
|
}
|
2532
|
-
return getProductPrice(state.selectedProduct, price);
|
1986
|
+
return getProductPrice(index$1.state.selectedProduct, price);
|
2533
1987
|
}
|
2534
1988
|
componentDidRender() {
|
2535
1989
|
const linkElem = document.createElement('link');
|
@@ -2555,68 +2009,21 @@ const HemfixarnaProduct = class {
|
|
2555
2009
|
const checked = index.getAssetPath(`./assets/checked.svg`);
|
2556
2010
|
const plus = index.getAssetPath(`./assets/plus.svg`);
|
2557
2011
|
const minus = index.getAssetPath(`./assets/minus.svg`);
|
2558
|
-
if (state.maleri) {
|
2012
|
+
if (index$1.state.maleri) {
|
2559
2013
|
return (index.h("div", { class: "hemfixarna_painting" }, index.h("script", { type: "text/javascript", src: ['localhost', 'vercel'].some(v => window.location.href.includes(v))
|
2560
2014
|
? 'https://painting-dev.vercel.app/static/js/main.js'
|
2561
|
-
: 'https://painting-frontend.vercel.app/static/js/main.js', defer: true, async: true }), index.h("hemfixare-calculator", { title: state.options.maleri_title, subtitle: state.options.maleri_text, modal: "true", customer: state.business === Business.string ? 'string' : state.business })));
|
2015
|
+
: '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 })));
|
2562
2016
|
}
|
2563
|
-
return state.selectedProduct ? (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.title })), index.h("div", null, index.h("h1", null, state.selectedProduct.title), !state.selectedProduct.invoice ? index.h("h2", null, getProductPrice(state.selectedProduct), " kr/st") : index.h("h2", null, state.selectedProduct.invoice_price))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), state.selectedProduct.description && (index.h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: state.selectedProduct.description }))), index.h("div", { class: "hemfixarna_product--right" }, 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, state.selectedProduct.title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), index.h("span", null, this.getAmount()), index.h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
|
2564
|
-
state.selectedProduct.parts.map(p => {
|
2017
|
+
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) &&
|
2018
|
+
index$1.state.selectedProduct.parts.map(p => {
|
2565
2019
|
var _a;
|
2566
|
-
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, 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) }))));
|
2567
|
-
})), 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"))), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", null))))) : null;
|
2020
|
+
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) }))));
|
2021
|
+
})), 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 && (index$1.state.selectedProduct.rot || index$1.state.selectedProduct.rut) && index$1.state.rutOptions && index$1.state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, index$1.state.selectedProduct.rot ? index$1.state.rotOptions.rot_start_fee_heading : index$1.state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: index$1.state.selectedProduct.rot ? index$1.state.rotOptions.rot_start_fee_text : index$1.state.rutOptions.rut_start_fee_text }))), index$1.state.options && index.h("hemfixarna-info", null))))) : null;
|
2568
2022
|
}
|
2569
2023
|
get el() { return index.getElement(this); }
|
2570
2024
|
};
|
2571
2025
|
HemfixarnaProduct.style = hemfixarnaProductCss;
|
2572
2026
|
|
2573
|
-
const HemfixarnaService = class {
|
2574
|
-
constructor(hostRef) {
|
2575
|
-
index.registerInstance(this, hostRef);
|
2576
|
-
}
|
2577
|
-
render() {
|
2578
|
-
return (index.h("div", null, index.h("h2", null, state.selectedService.post_title), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("div", null, index.h("ul", { class: "hemfixarna_categories" }, state.selectedService.products
|
2579
|
-
.sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
|
2580
|
-
.map(p => {
|
2581
|
-
var _a;
|
2582
|
-
return (index.h("hemfixarna-box", { post: p, icon: (_a = p.icon.url) !== null && _a !== void 0 ? _a : p.icon, postTitle: p.title }));
|
2583
|
-
}))), index.h("hemfixarna-info", null))));
|
2584
|
-
}
|
2585
|
-
};
|
2586
|
-
|
2587
|
-
const hemfixarnaSkanskaCss = "";
|
2588
|
-
|
2589
|
-
const MyComponent$6 = class {
|
2590
|
-
constructor(hostRef) {
|
2591
|
-
index.registerInstance(this, hostRef);
|
2592
|
-
this.id = undefined;
|
2593
|
-
this.customer = undefined;
|
2594
|
-
this.loadFromQuery = undefined;
|
2595
|
-
this.widgetStyle = WidgetStyle.standard;
|
2596
|
-
this.buttonColor = undefined;
|
2597
|
-
this.buttonBg = undefined;
|
2598
|
-
}
|
2599
|
-
render() {
|
2600
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.skanska }));
|
2601
|
-
}
|
2602
|
-
};
|
2603
|
-
MyComponent$6.style = hemfixarnaSkanskaCss;
|
2604
|
-
|
2605
|
-
const MyComponent$5 = class {
|
2606
|
-
constructor(hostRef) {
|
2607
|
-
index.registerInstance(this, hostRef);
|
2608
|
-
this.id = undefined;
|
2609
|
-
this.customer = undefined;
|
2610
|
-
this.loadFromQuery = undefined;
|
2611
|
-
this.widgetStyle = WidgetStyle.standard;
|
2612
|
-
this.buttonColor = undefined;
|
2613
|
-
this.buttonBg = undefined;
|
2614
|
-
}
|
2615
|
-
render() {
|
2616
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.sparfonster }));
|
2617
|
-
}
|
2618
|
-
};
|
2619
|
-
|
2620
2027
|
const HemfixarnaGrid = class {
|
2621
2028
|
constructor(hostRef) {
|
2622
2029
|
index.registerInstance(this, hostRef);
|
@@ -2627,19 +2034,19 @@ const HemfixarnaGrid = class {
|
|
2627
2034
|
return category.show_products !== undefined;
|
2628
2035
|
}
|
2629
2036
|
handleMaleriClick() {
|
2630
|
-
state.step = 4;
|
2631
|
-
state.maleri = true;
|
2037
|
+
index$1.state.step = 4;
|
2038
|
+
index$1.state.maleri = true;
|
2632
2039
|
}
|
2633
2040
|
render() {
|
2634
2041
|
var _a;
|
2635
2042
|
const maleriLogo = index.getAssetPath('./assets/gubbe-pensel.svg');
|
2636
|
-
return state.customer ? (index.h("div", null, index.h("h2", null, state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, ((_a = 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, state.selectedCustomerCategory
|
2637
|
-
? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products
|
2638
|
-
? state.selectedCustomerCategory.sub_categories.map(c => index.h("hemfixarna-box", { category: c }))
|
2639
|
-
: state.selectedCustomerCategory.products
|
2640
|
-
? state.selectedCustomerCategory.products.map(c => index.h("hemfixarna-box", { category: c.fields }))
|
2043
|
+
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
|
2044
|
+
? this.isMainCategory(index$1.state.selectedCustomerCategory) && index$1.state.selectedCustomerCategory.sub_categories && !index$1.state.selectedCustomerCategory.show_products
|
2045
|
+
? index$1.state.selectedCustomerCategory.sub_categories.map(c => index.h("hemfixarna-box", { category: c }))
|
2046
|
+
: index$1.state.selectedCustomerCategory.products
|
2047
|
+
? index$1.state.selectedCustomerCategory.products.map(c => index.h("hemfixarna-box", { category: c.fields }))
|
2641
2048
|
: null
|
2642
|
-
: 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
|
2049
|
+
: 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
|
2643
2050
|
.sort((a, b) => (a.name < b.name ? -1 : 1))
|
2644
2051
|
.map(c => {
|
2645
2052
|
var _a;
|
@@ -2648,116 +2055,20 @@ const HemfixarnaGrid = class {
|
|
2648
2055
|
}
|
2649
2056
|
};
|
2650
2057
|
|
2651
|
-
const hemfixarnaStringCss = "";
|
2652
|
-
|
2653
|
-
const MyComponent$4 = class {
|
2654
|
-
constructor(hostRef) {
|
2655
|
-
index.registerInstance(this, hostRef);
|
2656
|
-
this.id = undefined;
|
2657
|
-
this.loadFromQuery = undefined;
|
2658
|
-
this.widgetStyle = WidgetStyle.standard;
|
2659
|
-
this.buttonColor = undefined;
|
2660
|
-
this.buttonBg = undefined;
|
2661
|
-
}
|
2662
|
-
render() {
|
2663
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.string }));
|
2664
|
-
}
|
2665
|
-
};
|
2666
|
-
MyComponent$4.style = hemfixarnaStringCss;
|
2667
|
-
|
2668
|
-
const MyComponent$3 = class {
|
2669
|
-
constructor(hostRef) {
|
2670
|
-
index.registerInstance(this, hostRef);
|
2671
|
-
this.id = undefined;
|
2672
|
-
this.loadFromQuery = undefined;
|
2673
|
-
this.widgetStyle = WidgetStyle.standard;
|
2674
|
-
this.buttonColor = undefined;
|
2675
|
-
this.buttonBg = undefined;
|
2676
|
-
}
|
2677
|
-
render() {
|
2678
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.superfront }));
|
2679
|
-
}
|
2680
|
-
};
|
2681
|
-
|
2682
|
-
const MyComponent$2 = class {
|
2683
|
-
constructor(hostRef) {
|
2684
|
-
index.registerInstance(this, hostRef);
|
2685
|
-
this.id = undefined;
|
2686
|
-
this.loadFromQuery = 'true';
|
2687
|
-
this.isDemo = false;
|
2688
|
-
this.widgetStyle = WidgetStyle.standard;
|
2689
|
-
this.buttonColor = undefined;
|
2690
|
-
this.buttonBg = undefined;
|
2691
|
-
}
|
2692
|
-
render() {
|
2693
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.tesla.com/sv_se/home-charging', logo: 'assets/tesla.svg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.tesla }));
|
2694
|
-
}
|
2695
|
-
};
|
2696
|
-
|
2697
|
-
const MyComponent$1 = class {
|
2698
|
-
constructor(hostRef) {
|
2699
|
-
index.registerInstance(this, hostRef);
|
2700
|
-
this.id = undefined;
|
2701
|
-
this.loadFromQuery = undefined;
|
2702
|
-
this.widgetStyle = WidgetStyle.standard;
|
2703
|
-
this.buttonColor = undefined;
|
2704
|
-
this.buttonBg = undefined;
|
2705
|
-
}
|
2706
|
-
render() {
|
2707
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.traningspartner }));
|
2708
|
-
}
|
2709
|
-
};
|
2710
|
-
|
2711
|
-
const MyComponent = class {
|
2712
|
-
constructor(hostRef) {
|
2713
|
-
index.registerInstance(this, hostRef);
|
2714
|
-
this.id = undefined;
|
2715
|
-
this.loadFromQuery = 'true';
|
2716
|
-
this.isDemo = false;
|
2717
|
-
this.widgetStyle = WidgetStyle.standard;
|
2718
|
-
this.buttonColor = undefined;
|
2719
|
-
this.buttonBg = undefined;
|
2720
|
-
}
|
2721
|
-
render() {
|
2722
|
-
return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.zaptec.com/sv/laddningslosningar/zaptec-go', logo: 'assets/zaptec.svg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.zaptec }));
|
2723
|
-
}
|
2724
|
-
};
|
2725
|
-
|
2726
2058
|
exports.hemfixarna_address = HemfixarnaAddress;
|
2727
2059
|
exports.hemfixarna_box = HemfixarnaBox;
|
2728
2060
|
exports.hemfixarna_breadcrumbs = HemfixarnaBreadcrumbs;
|
2729
|
-
exports.hemfixarna_byggmax = MyComponent$j;
|
2730
2061
|
exports.hemfixarna_cart = HemfixarnaCart;
|
2731
|
-
exports.hemfixarna_category = HemfixarnaCategory;
|
2732
2062
|
exports.hemfixarna_checkout = HemfixarnaCheckout;
|
2733
2063
|
exports.hemfixarna_component = HemfixarnaComponent;
|
2734
2064
|
exports.hemfixarna_contact = HemfixarnaInfo$1;
|
2735
|
-
exports.hemfixarna_demo = MyComponent
|
2736
|
-
exports.hemfixarna_doro = MyComponent$h;
|
2737
|
-
exports.hemfixarna_elfa = MyComponent$g;
|
2738
|
-
exports.hemfixarna_fargvaruhuset = MyComponent$f;
|
2739
|
-
exports.hemfixarna_flyttsmart = MyComponent$e;
|
2740
|
-
exports.hemfixarna_forebygg = MyComponent$d;
|
2065
|
+
exports.hemfixarna_demo = MyComponent;
|
2741
2066
|
exports.hemfixarna_getuser = HemfixarnaGetuser;
|
2742
|
-
exports.hemfixarna_hornbach = MyComponent$c;
|
2743
2067
|
exports.hemfixarna_info = HemfixarnaInfo;
|
2744
2068
|
exports.hemfixarna_invoice = HemfixarnaInvoice;
|
2745
|
-
exports.hemfixarna_kbygg = MyComponent$b;
|
2746
|
-
exports.hemfixarna_klint = MyComponent$a;
|
2747
|
-
exports.hemfixarna_kund = MyComponent$9;
|
2748
|
-
exports.hemfixarna_norrgavel = MyComponent$8;
|
2749
2069
|
exports.hemfixarna_order = HemfixarnaOrder;
|
2750
2070
|
exports.hemfixarna_orderrows = HemfixarnaOrderrows;
|
2751
|
-
exports.hemfixarna_power = MyComponent$7;
|
2752
2071
|
exports.hemfixarna_product = HemfixarnaProduct;
|
2753
|
-
exports.hemfixarna_service = HemfixarnaService;
|
2754
|
-
exports.hemfixarna_skanska = MyComponent$6;
|
2755
|
-
exports.hemfixarna_sparfonster = MyComponent$5;
|
2756
2072
|
exports.hemfixarna_start = HemfixarnaGrid;
|
2757
|
-
exports.hemfixarna_string_furniture = MyComponent$4;
|
2758
|
-
exports.hemfixarna_superfront = MyComponent$3;
|
2759
|
-
exports.hemfixarna_tesla = MyComponent$2;
|
2760
|
-
exports.hemfixarna_traningspartner = MyComponent$1;
|
2761
|
-
exports.hemfixarna_zaptec = MyComponent;
|
2762
2073
|
|
2763
|
-
//# sourceMappingURL=hemfixarna-
|
2074
|
+
//# sourceMappingURL=hemfixarna-address_15.cjs.entry.js.map
|