hemfixarna-web-components 1.6.2 → 1.6.4
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 +2763 -0
- package/dist/{hemfixarna-components/index-f1a87cf1.js.map → cjs/hemfixarna-address_36.cjs.entry.js.map} +1 -1
- package/dist/cjs/hemfixarna-components.cjs.js +28 -0
- package/dist/cjs/hemfixarna-components.cjs.js.map +1 -0
- package/dist/cjs/index-b83343b9.js +1687 -0
- package/dist/cjs/index-b83343b9.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +24 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/assets/back.svg +3 -0
- package/dist/collection/assets/cart.svg +10 -0
- package/dist/collection/assets/checked.svg +10 -0
- package/dist/collection/assets/close.svg +5 -0
- package/dist/collection/assets/copy.png +0 -0
- package/dist/collection/assets/date.svg +6 -0
- package/dist/collection/assets/down.svg +3 -0
- package/dist/collection/assets/drag-drop.svg +3 -0
- package/dist/collection/assets/elfa.png +0 -0
- package/dist/collection/assets/gubbe-pensel.svg +1 -0
- package/dist/collection/assets/hemfixarna.svg +11 -0
- package/dist/collection/assets/hornbach/logo.svg +42 -0
- package/dist/collection/assets/hornbach/nav.jpg +0 -0
- package/dist/collection/assets/info.svg +5 -0
- package/dist/collection/assets/kbygg.svg +29 -0
- package/dist/collection/assets/minus.svg +4 -0
- package/dist/collection/assets/montering.svg +15 -0
- package/dist/collection/assets/norrgavel.svg +1 -0
- package/dist/collection/assets/pensel.svg +1 -0
- package/dist/collection/assets/plus.svg +5 -0
- package/dist/collection/assets/spinner.gif +0 -0
- package/dist/collection/assets/tesla.svg +1 -0
- package/dist/collection/assets/zaptec.svg +1 -0
- package/dist/collection/collection-manifest.json +47 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +184 -0
- package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.css +0 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +123 -0
- package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.css +0 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +142 -0
- package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +132 -0
- package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +132 -0
- package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.css +0 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +123 -0
- package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.css +0 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +142 -0
- package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +132 -0
- package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +113 -0
- package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +113 -0
- package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +132 -0
- package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +131 -0
- package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +141 -0
- package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +131 -0
- package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +123 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string.css +0 -0
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +113 -0
- package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +132 -0
- package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +113 -0
- package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +1 -0
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +132 -0
- package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-address.entry.js → collection/components/hemfixarna-address/hemfixarna-address.js} +20 -14
- package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +1 -0
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +138 -0
- package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-breadcrumbs.entry.js → collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js} +84 -13
- package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-cart.entry.js → collection/components/hemfixarna-cart/hemfixarna-cart.js} +31 -11
- package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-category.entry.js → collection/components/hemfixarna-category.tsx/hemfixarna-category.js} +6 -12
- package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-checkout.entry.js → collection/components/hemfixarna-checkout/hemfixarna-checkout.js} +27 -32
- package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +483 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -0
- package/dist/collection/components/hemfixarna-component/hemfixarna.css +1031 -0
- package/dist/{hemfixarna-components/hemfixarna-contact.entry.js → collection/components/hemfixarna-contact/hemfixarna-contact.js} +28 -10
- package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +1 -0
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +135 -0
- package/dist/{hemfixarna-components/hemfixarna-demo.entry.js → collection/components/hemfixarna-demo/hemfixarna-demo.js} +46 -23
- package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -0
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +91 -0
- package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-info.entry.js → collection/components/hemfixarna-info/hemfixarna-info.js} +7 -11
- package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -0
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.css +76 -0
- package/dist/{hemfixarna-components/hemfixarna-invoice.entry.js → collection/components/hemfixarna-invoice/hemfixarna-invoice.js} +27 -16
- package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-order.entry.js → collection/components/hemfixarna-order/hemfixarna-order.js} +31 -11
- package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-orderrows.entry.js → collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js} +50 -12
- package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -0
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
- package/dist/{hemfixarna-components/hemfixarna-product.entry.js → collection/components/hemfixarna-product/hemfixarna-product.js} +27 -18
- package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-service.entry.js → collection/components/hemfixarna-service/hemfixarna-service.js} +6 -12
- package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +1 -0
- package/dist/{hemfixarna-components/hemfixarna-start.entry.js → collection/components/hemfixarna-start/hemfixarna-start.js} +48 -11
- package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/store/index.js +62 -0
- package/dist/collection/store/index.js.map +1 -0
- package/dist/collection/types/felixtypes.js +3 -0
- package/dist/collection/types/felixtypes.js.map +1 -0
- package/dist/{hemfixarna-components/index-d90ad11b.js → collection/types/index.js} +4 -7
- package/dist/collection/types/index.js.map +1 -0
- package/dist/{hemfixarna-components/api-36f73d0d.js → collection/utils/api.js} +4 -6
- package/dist/collection/utils/api.js.map +1 -0
- package/dist/{hemfixarna-components/calc-4c79b798.js → collection/utils/calc.js} +3 -6
- package/dist/collection/utils/calc.js.map +1 -0
- package/dist/collection/utils/creditSafe.js +18 -0
- package/dist/collection/utils/creditSafe.js.map +1 -0
- package/dist/collection/utils/felixApi.js +18 -0
- package/dist/collection/utils/felixApi.js.map +1 -0
- package/dist/collection/utils/felixFunctions.js +189 -0
- package/dist/collection/utils/felixFunctions.js.map +1 -0
- package/dist/{hemfixarna-components/form-c53dca29.js → collection/utils/form.js} +2 -4
- package/dist/collection/utils/form.js.map +1 -0
- package/dist/{hemfixarna-components/scroll-6c26b5da.js → collection/utils/scroll.js} +2 -4
- package/dist/collection/utils/scroll.js.map +1 -0
- package/dist/{hemfixarna-components/types-641c9a1c.js → collection/utils/types.js} +3 -6
- package/dist/collection/utils/types.js.map +1 -0
- package/dist/esm/hemfixarna-address_36.entry.js +4090 -0
- package/dist/esm/hemfixarna-address_36.entry.js.map +1 -0
- package/dist/esm/hemfixarna-components.js +23 -0
- package/dist/esm/hemfixarna-components.js.map +1 -0
- package/dist/esm/index-8c417125.js +1656 -0
- package/dist/esm/index-8c417125.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +20 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -162
- package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
- package/dist/hemfixarna-components/index.esm.js +0 -1
- package/dist/hemfixarna-components/index.esm.js.map +1 -1
- package/dist/hemfixarna-components/p-852e7173.js +3 -0
- package/dist/hemfixarna-components/p-852e7173.js.map +1 -0
- package/dist/hemfixarna-components/p-97461831.entry.js +2 -0
- package/dist/hemfixarna-components/p-97461831.entry.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/dist/hemfixarna-components/api-36f73d0d.js.map +0 -1
- package/dist/hemfixarna-components/app-globals-0f993ce5.js +0 -5
- package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +0 -1
- package/dist/hemfixarna-components/calc-4c79b798.js.map +0 -1
- package/dist/hemfixarna-components/css-shim-62d2171c.js +0 -6
- package/dist/hemfixarna-components/css-shim-62d2171c.js.map +0 -1
- package/dist/hemfixarna-components/dom-46a68c9b.js +0 -75
- package/dist/hemfixarna-components/dom-46a68c9b.js.map +0 -1
- package/dist/hemfixarna-components/form-c53dca29.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-box.entry.js +0 -49
- package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +0 -27
- package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-component.entry.js +0 -248
- package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-contact.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-doro.entry.js +0 -23
- package/dist/hemfixarna-components/hemfixarna-doro.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-elfa.entry.js +0 -24
- package/dist/hemfixarna-components/hemfixarna-elfa.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js +0 -23
- package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +0 -770
- package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js +0 -24
- package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-invoice.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-klint.entry.js +0 -20
- package/dist/hemfixarna-components/hemfixarna-klint.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-kund.entry.js +0 -20
- package/dist/hemfixarna-components/hemfixarna-kund.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-orderrows.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-power.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-power.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-skanska.entry.js +0 -24
- package/dist/hemfixarna-components/hemfixarna-skanska.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js +0 -23
- package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-superfront.entry.js +0 -20
- package/dist/hemfixarna-components/hemfixarna-superfront.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-tesla.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-tesla.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js +0 -20
- package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js.map +0 -1
- package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js +0 -21
- package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js.map +0 -1
- package/dist/hemfixarna-components/index-b6a6e994.js +0 -256
- package/dist/hemfixarna-components/index-b6a6e994.js.map +0 -1
- package/dist/hemfixarna-components/index-d90ad11b.js.map +0 -1
- package/dist/hemfixarna-components/index-f1a87cf1.js +0 -3397
- package/dist/hemfixarna-components/scroll-6c26b5da.js.map +0 -1
- package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +0 -389
- package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +0 -1
- package/dist/hemfixarna-components/types-641c9a1c.js.map +0 -1
@@ -0,0 +1,76 @@
|
|
1
|
+
:host .invoice {
|
2
|
+
gap: 16px;
|
3
|
+
display: grid;
|
4
|
+
}
|
5
|
+
:host .invoice form > span {
|
6
|
+
text-align: center;
|
7
|
+
padding: 16px 0;
|
8
|
+
}
|
9
|
+
:host .invoice img {
|
10
|
+
right: unset;
|
11
|
+
left: unset;
|
12
|
+
position: initial;
|
13
|
+
transform: none;
|
14
|
+
}
|
15
|
+
:host .invoice label {
|
16
|
+
cursor: pointer;
|
17
|
+
font-size: 14px;
|
18
|
+
display: flex;
|
19
|
+
align-items: flex-start;
|
20
|
+
padding: 16px 0;
|
21
|
+
}
|
22
|
+
:host .invoice label input {
|
23
|
+
margin: 0 5px 0 0;
|
24
|
+
accent-color: #ea662c;
|
25
|
+
}
|
26
|
+
:host .invoice-preview {
|
27
|
+
display: flex;
|
28
|
+
gap: 4px;
|
29
|
+
}
|
30
|
+
:host .invoice-preview div {
|
31
|
+
position: relative;
|
32
|
+
}
|
33
|
+
:host .invoice-preview div button {
|
34
|
+
position: absolute;
|
35
|
+
top: 0;
|
36
|
+
right: 0;
|
37
|
+
padding: 0;
|
38
|
+
}
|
39
|
+
:host .invoice-preview div button img {
|
40
|
+
width: 24px;
|
41
|
+
height: 24px;
|
42
|
+
}
|
43
|
+
:host .invoice-preview div > img {
|
44
|
+
width: 100px;
|
45
|
+
height: 80px;
|
46
|
+
object-fit: cover;
|
47
|
+
}
|
48
|
+
:host .invoice input[type=email],
|
49
|
+
:host .invoice input[type=tel],
|
50
|
+
:host .invoice textarea {
|
51
|
+
padding: 16px;
|
52
|
+
border: 1px solid #fcd9c9;
|
53
|
+
font-size: 16px;
|
54
|
+
}
|
55
|
+
:host .invoice textarea {
|
56
|
+
resize: none;
|
57
|
+
height: 200px;
|
58
|
+
font-family: "Inter", sans-serif;
|
59
|
+
}
|
60
|
+
:host .invoice div:has(> input[type=file]) {
|
61
|
+
display: flex;
|
62
|
+
align-items: center;
|
63
|
+
justify-content: center;
|
64
|
+
cursor: pointer;
|
65
|
+
background: #fff;
|
66
|
+
border: 1px solid #fcd9c9;
|
67
|
+
padding: 32px 16px;
|
68
|
+
gap: 16px;
|
69
|
+
}
|
70
|
+
:host .invoice div:has(> input[type=file]) span {
|
71
|
+
color: #000;
|
72
|
+
font-size: 12px;
|
73
|
+
}
|
74
|
+
:host .invoice input[type=file] {
|
75
|
+
display: none;
|
76
|
+
}
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const base = "https://hemfixarna.se" ? `${"https://hemfixarna.se"}/wp-json/headless` : 'https://hemfixarna.se/wp-json/headless';
|
7
|
-
const HemfixarnaInvoice = class {
|
8
|
-
constructor(hostRef) {
|
9
|
-
registerInstance(this, hostRef);
|
1
|
+
import { getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
const base = process.env.API_URL ? `${process.env.API_URL}/wp-json/headless` : 'https://hemfixarna.se/wp-json/headless';
|
4
|
+
export class HemfixarnaInvoice {
|
5
|
+
constructor() {
|
10
6
|
this.formError = null;
|
11
7
|
this.displayImages = [];
|
12
8
|
this.formImages = [];
|
@@ -145,10 +141,25 @@ const HemfixarnaInvoice = class {
|
|
145
141
|
const upload = getAssetPath(`./assets/drag-drop.svg`);
|
146
142
|
return (h("div", { class: "invoice" }, h("p", null, state.selectedProduct.invoice_description), h("form", { onSubmit: e => this.submit(e) }, h("textarea", { name: "descriptionInput", placeholder: "Beskriv ditt \u00E4rende" }), h("div", { role: "button", "aria-label": "upload image", onDragOver: e => this.preventDragOver(e), onDrop: e => this.handleImageDrop(e), onClick: () => this.handleImageClick() }, h("img", { src: upload, alt: "hemfixarna_logo", width: 24 }), h("div", null, h("p", null, "Bifoga ev bilder"), h("span", null, "(dra bilder hit)")), h("input", { onChange: e => this.handleFileInputChange(e), class: "hemfixarna-file-upload", accept: "image/*", type: "file", multiple: true, name: "fileInput" })), h("div", { class: "invoice-preview" }, this.displayImages.map((img, i) => (h("div", { key: i }, h("img", { src: img, alt: "uploaded image" }), h("button", { onClick: () => this.removeImage(i) }, h("img", { src: getAssetPath(`./assets/close.svg`), alt: "close" })))))), h("input", { placeholder: "E-post", type: "email", name: "emailInput" }), h("input", { placeholder: "Telefonnummer", type: "tel", name: "telInput" }), state.selectedProduct.terms_show_checkbox ? (h("label", null, h("input", { type: "checkbox", name: "termsInput" }), state.selectedProduct.terms)) : null, this.formError ? h("span", null, this.formError) : null, h("input", { type: "submit", value: this.formState === 'loading' ? 'Skickar' : 'Kontakta mig' }))));
|
147
143
|
}
|
148
|
-
get
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
144
|
+
static get is() { return "hemfixarna-invoice"; }
|
145
|
+
static get originalStyleUrls() {
|
146
|
+
return {
|
147
|
+
"$": ["hemfixarna-invoice.scss"]
|
148
|
+
};
|
149
|
+
}
|
150
|
+
static get styleUrls() {
|
151
|
+
return {
|
152
|
+
"$": ["hemfixarna-invoice.css"]
|
153
|
+
};
|
154
|
+
}
|
155
|
+
static get states() {
|
156
|
+
return {
|
157
|
+
"formError": {},
|
158
|
+
"displayImages": {},
|
159
|
+
"formImages": {},
|
160
|
+
"formState": {}
|
161
|
+
};
|
162
|
+
}
|
163
|
+
static get elementRef() { return "el"; }
|
164
|
+
}
|
165
|
+
//# sourceMappingURL=hemfixarna-invoice.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-invoice.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-invoice/hemfixarna-invoice.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,wCAAwC,CAAC;AAsBxH,MAAM,OAAO,iBAAiB;;qBACQ,IAAI;yBAEc,EAAE;sBACrB,EAAE;qBACO,SAAS;;EAErD,YAAY,CAAC,KAAa;IACxB,MAAM,UAAU,GAAG,4BAA4B,CAAC;IAChD,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAChC,CA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EAAC,WAAW,GAAG,CACzI;QACN,WAAK,KAAK,EAAC,iBAAiB,IACzB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAClC,WAAK,GAAG,EAAE,CAAC;UACT,WAAK,GAAG,EAAE,GAAa,EAAE,GAAG,EAAC,gBAAgB,GAAG;UAChD,cAAQ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YACxC,WAAK,GAAG,EAAE,YAAY,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAC,OAAO,GAAG,CACrD,CACL,CACP,CAAC,CACE;QACN,aAAO,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,YAAY,GAAG;QAC7D,aAAO,WAAW,EAAC,eAAe,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAC,UAAU,GAAG;QAC/D,KAAK,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAC3C;UACE,aAAO,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,YAAY,GAAG;UAC1C,KAAK,CAAC,eAAe,CAAC,KAAK,CACtB,CACT,CAAC,CAAC,CAAC,IAAI;QACP,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAO,IAAI,CAAC,SAAS,CAAQ,CAAC,CAAC,CAAC,IAAI;QACtD,aAAO,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,GAAI,CACpF,CACH,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\n\nconst base = process.env.API_URL ? `${process.env.API_URL}/wp-json/headless` : 'https://hemfixarna.se/wp-json/headless';\n\ninterface FormElements extends HTMLCollection {\n descriptionInput: {\n value: string;\n };\n emailInput: {\n value: string;\n };\n telInput: {\n value: string;\n };\n termsInput: {\n checked: boolean;\n };\n}\n\n@Component({\n tag: 'hemfixarna-invoice',\n styleUrl: 'hemfixarna-invoice.scss',\n shadow: false,\n})\nexport class HemfixarnaInvoice {\n @State() formError: string | null = null;\n @Element() private el: HTMLElement;\n @State() displayImages: Array<string | ArrayBuffer> = [];\n @State() formImages: Array<File> = [];\n @State() formState: 'initial' | 'loading' = 'initial';\n\n isValidEmail(email: string) {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email);\n }\n\n componentDidRender() {\n const form = this.el.querySelector('form') as HTMLFormElement;\n if (form) {\n form.addEventListener('input', () => {\n this.formError = null;\n });\n }\n }\n\n disconnectedCallback() {\n const form = this.el.querySelector('form') as HTMLFormElement;\n if (form) {\n form.removeEventListener('input', () => {\n this.formError = null;\n });\n }\n }\n\n async submit(e: Event) {\n e.preventDefault();\n this.formState = 'loading';\n this.formError = null;\n const form = (e.currentTarget as HTMLFormElement).elements as FormElements;\n const values = {\n description: form.descriptionInput.value.length ? form.descriptionInput.value : null,\n email: form.emailInput.value.length ? form.emailInput.value : null,\n tel: form.telInput.value.length ? form.telInput.value : null,\n terms: form.termsInput?.checked,\n };\n\n if (!values.description) {\n this.formError = 'Vänligen fyll i formulärtexten';\n this.formState = 'initial';\n return;\n }\n if (!values.email || !this.isValidEmail(values.email)) {\n this.formError = 'Vänligen ange en giltig e-postadress';\n this.formState = 'initial';\n return;\n }\n if (!values.tel) {\n this.formError = 'Vänligen ange ditt telefonnummer';\n this.formState = 'initial';\n return;\n }\n if (state.selectedProduct.terms_show_checkbox && !values.terms) {\n this.formError = 'Vänligen acceptera villkoren';\n this.formState = 'initial';\n return;\n }\n\n const formData = new FormData();\n formData.append('text', values.description);\n formData.append('email', values.email);\n formData.append('phone', values.tel);\n formData.append('customer', state.business);\n\n this.formImages.forEach(file => {\n formData.append('images[]', file);\n });\n\n formData.append(\n 'product',\n JSON.stringify({\n title: state.selectedProduct.title,\n amount: 1,\n has_rut: state.selectedProduct.rut,\n has_rot: state.selectedProduct.rot,\n has_green: state.selectedProduct.green,\n ID: state.selectedProduct.ID,\n parts: [],\n }),\n );\n\n try {\n const res = await fetch(`${base}/saveinvoiceproduct`, {\n method: 'POST',\n body: formData,\n });\n const { response } = await res.json();\n if (response.code === 200) {\n state.checkoutInvoice = true;\n state.step = 6;\n } else {\n this.formError = 'Vi kan inte ta emot din beställning just nu';\n this.formState = 'initial';\n }\n } catch (error) {\n this.formError = 'Vi kan inte ta emot din beställning just nu';\n this.formState = 'initial';\n }\n }\n\n handleImageDrop(e: DragEvent) {\n e.preventDefault();\n const files = e.dataTransfer.files;\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n\n if (file.type.startsWith('image/')) {\n const reader = new FileReader();\n\n reader.onload = () => {\n this.displayImages = [...this.displayImages, reader.result];\n this.formImages = [...this.formImages, file];\n };\n\n reader.readAsDataURL(file);\n }\n }\n }\n\n handleFileInputChange(e: Event) {\n e.preventDefault();\n const files = (e.target as HTMLInputElement).files;\n\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n if (file.type.startsWith('image/')) {\n const reader = new FileReader();\n reader.onload = () => {\n this.displayImages = [...this.displayImages, reader.result];\n this.formImages = [...this.formImages, file];\n };\n\n reader.readAsDataURL(file);\n }\n }\n }\n\n handleImageClick() {\n (this.el.querySelector('.hemfixarna-file-upload') as HTMLInputElement).click();\n }\n\n preventDragOver(e: DragEvent) {\n e.preventDefault();\n }\n\n removeImage(index: number) {\n this.displayImages = this.displayImages.filter((_, i) => i !== index);\n this.formImages = this.formImages.filter((_, i) => i !== index);\n }\n\n render() {\n const upload = getAssetPath(`./assets/drag-drop.svg`);\n return (\n <div class=\"invoice\">\n <p>{state.selectedProduct.invoice_description}</p>\n <form onSubmit={e => this.submit(e)}>\n <textarea name=\"descriptionInput\" placeholder=\"Beskriv ditt ärende\" />\n <div role=\"button\" aria-label=\"upload image\" onDragOver={e => this.preventDragOver(e)} onDrop={e => this.handleImageDrop(e)} onClick={() => this.handleImageClick()}>\n <img src={upload} alt=\"hemfixarna_logo\" width={24} />\n <div>\n <p>Bifoga ev bilder</p>\n <span>(dra bilder hit)</span>\n </div>\n <input onChange={e => this.handleFileInputChange(e)} class=\"hemfixarna-file-upload\" accept=\"image/*\" type=\"file\" multiple name=\"fileInput\" />\n </div>\n <div class=\"invoice-preview\">\n {this.displayImages.map((img, i) => (\n <div key={i}>\n <img src={img as string} alt=\"uploaded image\" />\n <button onClick={() => this.removeImage(i)}>\n <img src={getAssetPath(`./assets/close.svg`)} alt=\"close\" />\n </button>\n </div>\n ))}\n </div>\n <input placeholder=\"E-post\" type=\"email\" name=\"emailInput\" />\n <input placeholder=\"Telefonnummer\" type=\"tel\" name=\"telInput\" />\n {state.selectedProduct.terms_show_checkbox ? (\n <label>\n <input type=\"checkbox\" name=\"termsInput\" />\n {state.selectedProduct.terms}\n </label>\n ) : null}\n {this.formError ? <span>{this.formError}</span> : null}\n <input type=\"submit\" value={this.formState === 'loading' ? 'Skickar' : 'Kontakta mig'} />\n </form>\n </div>\n );\n }\n}\n"]}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
constructor(hostRef) {
|
6
|
-
registerInstance(this, hostRef);
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
export class HemfixarnaOrder {
|
4
|
+
constructor() {
|
7
5
|
this.render = () => {
|
8
6
|
return (h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, h("div", null), h("div", null, h("h2", null, state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), state.checkoutInvoice ? h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, state.checkoutInvoice ? h("div", null) : h("hemfixarna-orderrows", { tree: this.tree, cart: false }), h("span", { onClick: () => this.resetShop() }, h("button", null, "G\u00F6r en ny bokning")), h("hemfixarna-info", null))));
|
9
7
|
};
|
@@ -21,8 +19,30 @@ const HemfixarnaOrder = class {
|
|
21
19
|
disconnectedCallback() {
|
22
20
|
this.resetShop();
|
23
21
|
}
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
static get is() { return "hemfixarna-order"; }
|
23
|
+
static get properties() {
|
24
|
+
return {
|
25
|
+
"tree": {
|
26
|
+
"type": "unknown",
|
27
|
+
"mutable": false,
|
28
|
+
"complexType": {
|
29
|
+
"original": "Category",
|
30
|
+
"resolved": "Category",
|
31
|
+
"references": {
|
32
|
+
"Category": {
|
33
|
+
"location": "import",
|
34
|
+
"path": "../../types"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"required": false,
|
39
|
+
"optional": false,
|
40
|
+
"docs": {
|
41
|
+
"tags": [],
|
42
|
+
"text": ""
|
43
|
+
}
|
44
|
+
}
|
45
|
+
};
|
46
|
+
}
|
47
|
+
}
|
48
|
+
//# sourceMappingURL=hemfixarna-order.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-order.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-order/hemfixarna-order.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,eAAe;;IAiB1B,WAAM,GAAG,GAAG,EAAE;MACZ,OAAO,CACL,WAAK,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,eAAe,GAAG,EAAE,EAAE,KAAK,EAAC,kBAAkB;QAC3F,cAAW;QACX;UACE,cAAK,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,sBAAsB,CAAM;UACnF,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,+FAA4E,CAAC,CAAC,CAAC,IAAI;UAC3G,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,cAAW,CAAC,CAAC,CAAC,4BAAsB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAyB;UAClH,YAAM,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;YACnC,2CAAkC,CAC7B;UACP,0BAAmB,CACf,CACF,CACP,CAAC;IACJ,CAAC,CAAC;;;EA7BF,SAAS;IACP,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;IAChB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;EACzB,CAAC;EAED,oBAAoB;IAClB,IAAI,CAAC,SAAS,EAAE,CAAC;EACnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAkBF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category } from '../../types';\n\n@Component({\n tag: 'hemfixarna-order',\n shadow: false,\n})\nexport class HemfixarnaOrder {\n @Prop() tree: Category;\n\n resetShop() {\n state.step = 1;\n state.cart = [];\n state.selectedCategory = null;\n state.selectedService = null;\n state.selectedProduct = null;\n state.maleri = null;\n state.checkoutStep = 1;\n }\n\n disconnectedCallback() {\n this.resetShop();\n }\n\n render = () => {\n return (\n <div style={{ background: `url(${state.options.thank_you_image})` }} class=\"hemfixarna_order\">\n <div></div>\n <div>\n <h2>{state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'}</h2>\n {state.checkoutInvoice ? <p>Vi återkommer inom kort till dig på angivet telefonnummer eller epost</p> : null}\n {state.checkoutInvoice ? <div></div> : <hemfixarna-orderrows tree={this.tree} cart={false}></hemfixarna-orderrows>}\n <span onClick={() => this.resetShop()}>\n <button>Gör en ny bokning</button>\n </span>\n <hemfixarna-info />\n </div>\n </div>\n );\n };\n}\n"]}
|
@@ -1,10 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
constructor(hostRef) {
|
7
|
-
registerInstance(this, hostRef);
|
1
|
+
import { Fragment, getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { calculateGreenDiscount, calculateRot, calculateRut, getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';
|
4
|
+
export class HemfixarnaOrderrows {
|
5
|
+
constructor() {
|
8
6
|
this.cart = true;
|
9
7
|
this.tree = undefined;
|
10
8
|
}
|
@@ -71,8 +69,48 @@ const HemfixarnaOrderrows = class {
|
|
71
69
|
return (h("li", { class: "hemfixarna_cart--item" }, h("div", null, h("div", null, item.icon && h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), h("p", null, h("strong", null, item.amount, "x "), item.name)), this.cart && h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), h("p", null, h("strong", null, getProductPrice(item, item.price, item.amount), "kr"), h("span", null, this.getDiscountedInfo(item))), item.parts.length > 0 && (h("ul", null, item.parts.map(part => (h("li", null, h("p", null, h("strong", null, part.amount, "x "), part.name), h("p", null, h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
|
72
70
|
})), h("div", { class: "hemfixarna_cart--additional" }, h("div", null, getStartFee().rot > 0 && (h("div", { class: "hemfixarna_cart--startfee" }, h("p", null, h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (h("div", { class: "hemfixarna_cart--startfee" }, h("p", null, h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), h("p", null, getStartFee().rut, "kr"))), getStartFee().green > 0 && (h("div", { class: "hemfixarna_cart--startfee" }, h("p", null, h("strong", { onClick: () => this.openGreen() }, state.greenOptions.green_start_fee_heading, h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), h("p", null, getStartFee().green, "kr")))), state.cart.find((item) => item.rot) && (h("div", { class: "hemfixarna_cart--rutrot" }, h("div", null, this.cart && (h("label", { class: "switch" }, h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), h("span", { class: "slider" }))), h("p", null, "ROT-avdrag")), h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (h("div", { class: "hemfixarna_cart--rutrot" }, h("div", null, h("label", { class: "switch" }, h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), h("span", { class: "slider" })), h("p", null, "RUT-avdrag")), h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)"))), state.cart.find((item) => item.green) && (h("div", { class: "hemfixarna_cart--rutrot" }, h("div", null, h("label", { class: "switch" }, h("input", { onChange: () => (state.green = !state.green), checked: state.green, type: "checkbox" }), h("span", { class: "slider" })), h("p", null, "Gr\u00F6n teknik avdrag")), h("p", null, "(-", state.green ? calculateGreenDiscount() : 0, "kr)")))), h("div", { class: "hemfixarna_cart--price" }, h("h2", null, "Totalbelopp: "), h("h2", null, getTotalPrice(), "kr"))));
|
73
71
|
}
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
static get is() { return "hemfixarna-orderrows"; }
|
73
|
+
static get properties() {
|
74
|
+
return {
|
75
|
+
"cart": {
|
76
|
+
"type": "boolean",
|
77
|
+
"mutable": false,
|
78
|
+
"complexType": {
|
79
|
+
"original": "boolean",
|
80
|
+
"resolved": "boolean",
|
81
|
+
"references": {}
|
82
|
+
},
|
83
|
+
"required": false,
|
84
|
+
"optional": false,
|
85
|
+
"docs": {
|
86
|
+
"tags": [],
|
87
|
+
"text": ""
|
88
|
+
},
|
89
|
+
"attribute": "cart",
|
90
|
+
"reflect": false,
|
91
|
+
"defaultValue": "true"
|
92
|
+
},
|
93
|
+
"tree": {
|
94
|
+
"type": "unknown",
|
95
|
+
"mutable": false,
|
96
|
+
"complexType": {
|
97
|
+
"original": "Category",
|
98
|
+
"resolved": "Category",
|
99
|
+
"references": {
|
100
|
+
"Category": {
|
101
|
+
"location": "import",
|
102
|
+
"path": "../../types"
|
103
|
+
}
|
104
|
+
}
|
105
|
+
},
|
106
|
+
"required": false,
|
107
|
+
"optional": false,
|
108
|
+
"docs": {
|
109
|
+
"tags": [],
|
110
|
+
"text": ""
|
111
|
+
}
|
112
|
+
}
|
113
|
+
};
|
114
|
+
}
|
115
|
+
}
|
116
|
+
//# sourceMappingURL=hemfixarna-orderrows.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-orderrows.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-orderrows/hemfixarna-orderrows.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMjJ,MAAM,OAAO,mBAAmB;;gBACN,IAAI;;;EAG5B,WAAW,CAAC,EAAU;IACpB,IAAI,KAAK,CAAC,QAAQ,EAAE;MAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU;SACvC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CA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O,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,UAAU,GAAG;cAC7F,YAAM,KAAK,EAAC,QAAQ,GAAQ,CACtB;YACR,uCAAyB,CACrB;UACN;;YAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,CAAC;kBAAQ,CACpD,CACP,CACG;MACN,WAAK,KAAK,EAAC,wBAAwB;QACjC,8BAAsB;QACtB;UAAK,aAAa,EAAE;eAAQ,CACxB,CACG,CACZ,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Fragment, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { CartItem, Category, Icon } from '../../types';\nimport { calculateGreenDiscount, calculateRot, calculateRut, getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';\n\n@Component({\n tag: 'hemfixarna-orderrows',\n shadow: false,\n})\nexport class HemfixarnaOrderrows {\n @Prop() cart: boolean = true;\n @Prop() tree: Category;\n\n goToProduct(id: number) {\n if (state.customer) {\n const products = state.customer.categories\n .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))\n .flat()\n .flat();\n const product = products.find(p => p && p.fields.ID === id);\n if (product) {\n state.selectedProduct = product.fields;\n state.step = 4;\n }\n } else {\n const services = this.tree.sub_cats.map((c: Category) => c.services).flat();\n const products = services.map((s: any) => s.products).flat();\n const product = products.find((p: any) => p.ID === id);\n const service = services.find((s: any) => s.products.find((p: any) => p.ID === id));\n const category = this.tree.sub_cats.find((c: any) => c.services.find((s: any) => s.products.find((p: any) => p.ID === id)));\n state.selectedCategory = category;\n state.selectedService = service;\n state.selectedProduct = product;\n state.step = 4;\n }\n }\n\n openRot() {\n state.modal = {\n title: state.rotOptions.rot_start_fee_heading,\n text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],\n };\n }\n\n openRut() {\n state.modal = {\n title: state.rutOptions.rut_start_fee_heading,\n text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],\n };\n }\n\n openGreen() {\n state.modal = {\n title: state.greenOptions.green_start_fee_heading,\n text: [state.greenOptions.green_start_fee_text, state.greenOptions.green_start_fee_text_secondary],\n };\n }\n\n getDiscountedInfo(item: CartItem) {\n if (item.rut && state.rut) {\n return ' (efter RUT-avdrag)';\n } else if (item.rot && state.rot) {\n return ' (efter ROT-avdrag)';\n } else if (item.green && state.green) {\n return ' (efter Grön teknik avdrag)';\n } else {\n return '';\n }\n }\n\n render() {\n const info = getAssetPath(`./assets/info.svg`);\n\n return (\n <Fragment>\n <ul class=\"hemfixarna_cart--items\">\n {state.cart.map(item => (\n <li class=\"hemfixarna_cart--item\">\n <div>\n <div>\n {item.icon && <img width={30} src={(item.icon as Icon).url ?? (item.icon as string)} alt={item.name} />}\n <p>\n <strong>{item.amount}x </strong>\n {item.name}\n </p>\n </div>\n {this.cart && <button onClick={() => this.goToProduct(item.id)}>Ändra</button>}\n </div>\n <p>\n <strong>{getProductPrice(item, item.price, item.amount)}kr</strong>\n <span>{this.getDiscountedInfo(item)}</span>\n </p>\n {item.parts.length > 0 && (\n <ul>\n {item.parts.map(part => (\n <li>\n <p>\n <strong>{part.amount}x </strong>\n {part.name}\n </p>\n <p>\n <strong>{getPartPrice(part, item, part.amount)}kr</strong>\n </p>\n </li>\n ))}\n </ul>\n )}\n </li>\n ))}\n </ul>\n <div class=\"hemfixarna_cart--additional\">\n <div>\n {getStartFee().rot > 0 && (\n <div class=\"hemfixarna_cart--startfee\">\n <p>\n <strong onClick={() => this.openRot()}>\n {state.rotOptions.rot_start_fee_heading}\n <img height={16} src={info} alt=\"info monteringsavgift\" />\n </strong>\n </p>\n <p>{getStartFee().rot}kr</p>\n </div>\n )}\n {getStartFee().rut > 0 && (\n <div class=\"hemfixarna_cart--startfee\">\n <p>\n <strong onClick={() => this.openRut()}>\n {state.rutOptions.rut_start_fee_heading}\n <img height={16} src={info} alt=\"info monteringsavgift\" />\n </strong>\n </p>\n <p>{getStartFee().rut}kr</p>\n </div>\n )}\n {getStartFee().green > 0 && (\n <div class=\"hemfixarna_cart--startfee\">\n <p>\n <strong onClick={() => this.openGreen()}>\n {state.greenOptions.green_start_fee_heading}\n <img height={16} src={info} alt=\"info monteringsavgift\" />\n </strong>\n </p>\n <p>{getStartFee().green}kr</p>\n </div>\n )}\n </div>\n {state.cart.find((item: CartItem) => item.rot) && (\n <div class=\"hemfixarna_cart--rutrot\">\n <div>\n {this.cart && (\n <label class=\"switch\">\n <input checked={state.rot} onChange={() => (state.rot = !state.rot)} type=\"checkbox\" />\n <span class=\"slider\"></span>\n </label>\n )}\n <p>ROT-avdrag</p>\n </div>\n <p>(-{state.rot ? calculateRot() : 0}kr)</p>\n </div>\n )}\n {state.cart.find((item: CartItem) => item.rut) && (\n <div class=\"hemfixarna_cart--rutrot\">\n <div>\n <label class=\"switch\">\n <input onChange={() => (state.rut = !state.rut)} checked={state.rut} type=\"checkbox\" />\n <span class=\"slider\"></span>\n </label>\n <p>RUT-avdrag</p>\n </div>\n <p>(-{state.rut ? calculateRut() : 0}kr)</p>\n </div>\n )}\n {state.cart.find((item: CartItem) => item.green) && (\n <div class=\"hemfixarna_cart--rutrot\">\n <div>\n <label class=\"switch\">\n <input onChange={() => (state.green = !state.green)} checked={state.green} type=\"checkbox\" />\n <span class=\"slider\"></span>\n </label>\n <p>Grön teknik avdrag</p>\n </div>\n <p>(-{state.green ? calculateGreenDiscount() : 0}kr)</p>\n </div>\n )}\n </div>\n <div class=\"hemfixarna_cart--price\">\n <h2>Totalbelopp: </h2>\n <h2>{getTotalPrice()}kr</h2>\n </div>\n </Fragment>\n );\n }\n}\n"]}
|
File without changes
|
@@ -1,14 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const HemfixarnaProduct = class {
|
10
|
-
constructor(hostRef) {
|
11
|
-
registerInstance(this, hostRef);
|
1
|
+
import { Fragment, getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { Business } from '../../types';
|
4
|
+
import { getPartPrice, getProductPrice } from '../../utils/calc';
|
5
|
+
import { scrollToTop } from '../../utils/scroll';
|
6
|
+
export class HemfixarnaProduct {
|
7
|
+
constructor() {
|
12
8
|
this.amount = 0;
|
13
9
|
this.hideDescription = true;
|
14
10
|
}
|
@@ -147,10 +143,23 @@ const HemfixarnaProduct = class {
|
|
147
143
|
return (h("li", { class: "hemfixarna_part" }, h("div", null, h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.title), h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), h("div", { class: "hemfixarna_counter" }, h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), h("span", null, this.getPartAmount(p.ID)), h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
|
148
144
|
})), h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), 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 && (h("p", { class: "hemfixarna_terms" }, h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), h("br", null), h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && h("hemfixarna-info", null))))) : null;
|
149
145
|
}
|
150
|
-
get
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
146
|
+
static get is() { return "hemfixarna-product"; }
|
147
|
+
static get originalStyleUrls() {
|
148
|
+
return {
|
149
|
+
"$": ["hemfixarna-product.scss"]
|
150
|
+
};
|
151
|
+
}
|
152
|
+
static get styleUrls() {
|
153
|
+
return {
|
154
|
+
"$": ["hemfixarna-product.css"]
|
155
|
+
};
|
156
|
+
}
|
157
|
+
static get states() {
|
158
|
+
return {
|
159
|
+
"amount": {},
|
160
|
+
"hideDescription": {}
|
161
|
+
};
|
162
|
+
}
|
163
|
+
static get elementRef() { return "el"; }
|
164
|
+
}
|
165
|
+
//# sourceMappingURL=hemfixarna-product.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-product.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-product/hemfixarna-product.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOjD,MAAM,OAAO,iBAAiB;;kBACF,CAAC;2BACS,IAAI;;EAGxC,UAAU;IACR,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,aAAa,EAAE;MACjB,aAAa,CAAC,MAAM,EAAE,CAAC;MACvB,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;KAC9B;SAAM;MACL,KAAK,CAAC,IAAI,GAAG;QACX,GAAG,KAAK,CAAC,IAAI;QACb;UACE,E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G,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,CAAU;YAC9H,aAAM;YACN,YAAM,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,GAAS,CAC7H,CACL;UACA,KAAK,CAAC,OAAO,IAAI,0BAAmB,CACjC,CACF,CACF,CACP,CAAC,CAAC,CAAC,IAAI,CAAC;EACX,CAAC;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business, Icon, Part } from '../../types';\nimport { getPartPrice, getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-product',\n styleUrl: 'hemfixarna-product.scss',\n shadow: false,\n})\nexport class HemfixarnaProduct {\n @State() amount: number = 0;\n @State() hideDescription: boolean = true;\n @Element() private el: HTMLElement;\n\n addProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n productInCart.amount++;\n state.cart = [...state.cart];\n } else {\n state.cart = [\n ...state.cart,\n {\n id: state.selectedProduct.ID,\n rut: state.selectedProduct.rut,\n rot: state.selectedProduct.rot,\n green: state.selectedProduct.green,\n amount: 1,\n parts: [],\n price: state.selectedProduct.price,\n name: state.selectedProduct.title,\n start_fee: !state.selectedProduct.hide_start_fee,\n terms_checkout: state.selectedProduct.terms_checkout,\n icon: state.selectedProduct.icon,\n },\n ];\n }\n }\n\n removeProduct() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart && productInCart.amount > 1) {\n productInCart.amount--;\n state.cart = [...state.cart];\n } else {\n state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);\n }\n }\n\n //Handle cart and parts\n addPart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart) {\n partInCart.amount++;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: part.title ?? part.title }];\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n removePart(part: Part) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partInCart = productInCart.parts.find(sp => sp.id === part.ID);\n if (partInCart && partInCart.amount > 1) {\n partInCart.amount--;\n productInCart.parts = [...productInCart.parts];\n } else {\n productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);\n }\n state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];\n }\n }\n\n goToCart() {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n state.step = 5;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n getAmount() {\n return state.cart.find(p => p.id === state.selectedProduct.ID)?.amount || 0;\n }\n\n getPartAmount(partId: number) {\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n return productInCart?.parts.find(sp => sp.id === partId)?.amount || 0;\n }\n\n getTotalPrice() {\n let price = 0;\n const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);\n if (productInCart) {\n const partsPrice = productInCart.parts.reduce((acc, curr) => {\n const part = state.selectedProduct.parts.find(p => p.ID === curr.id);\n if (part) {\n return acc + part.price * curr.amount;\n }\n return acc;\n }, 0);\n price = state.selectedProduct.price * productInCart.amount + partsPrice;\n } else {\n price = state.selectedProduct.price;\n }\n return getProductPrice(state.selectedProduct, price);\n }\n\n componentDidRender() {\n const linkElem = document.createElement('link');\n linkElem.setAttribute('rel', 'stylesheet');\n linkElem.setAttribute('href', 'https://painting-frontend.vercel.app/static/css/main.css');\n const fonts = document.createElement('link');\n fonts.setAttribute('rel', 'stylesheet');\n fonts.setAttribute('href', 'https://painting-frontend.vercel.app/fonts.css');\n\n const checkAndInjectCSS = () => {\n const parents = this.el.getElementsByTagName('hemfixare-calculator');\n if (parents.length > 0 && parents[0].shadowRoot !== null) {\n parents[0].shadowRoot.appendChild(linkElem);\n parents[0].shadowRoot.appendChild(fonts);\n } else {\n setTimeout(checkAndInjectCSS, 1);\n }\n };\n\n checkAndInjectCSS();\n }\n\n render() {\n const checked = getAssetPath(`./assets/checked.svg`);\n const plus = getAssetPath(`./assets/plus.svg`);\n const minus = getAssetPath(`./assets/minus.svg`);\n\n if (state.maleri) {\n return (\n <div class=\"hemfixarna_painting\">\n <script\n type=\"text/javascript\"\n src={\n ['localhost', 'vercel'].some(v => window.location.href.includes(v))\n ? 'https://painting-dev.vercel.app/static/js/main.js'\n : 'https://painting-frontend.vercel.app/static/js/main.js'\n }\n defer\n async\n ></script>\n <hemfixare-calculator\n title={state.options.maleri_title}\n subtitle={state.options.maleri_text}\n modal=\"true\"\n customer={state.business === Business.string ? 'string' : state.business}\n ></hemfixare-calculator>\n </div>\n );\n }\n\n return state.selectedProduct ? (\n <div class=\"hemfixarna_product\">\n <div class=\"hemfixarna_product--top\">\n {state.selectedProduct.icon && (\n <img width={80} src={(state.selectedProduct.icon as Icon).url ?? (state.selectedProduct.icon as string)} alt={state.selectedProduct.title} />\n )}\n <div>\n <h1>{state.selectedProduct.title}</h1>\n {!state.selectedProduct.invoice ? <h2>{getProductPrice(state.selectedProduct)} kr/st</h2> : <h2>{state.selectedProduct.invoice_price}</h2>}\n </div>\n </div>\n\n <div class=\"hemfixarna_product--grid\">\n <div class=\"hemfixarna_product--left\">\n {state.selectedProduct.list?.length && (\n <ul class=\"hemfixarna_features\">\n {state.selectedProduct.list.map(l => (\n <li key={l.bullet}>\n <img src={checked} alt=\"checked\" />\n <p>{l.bullet}</p>\n </li>\n ))}\n </ul>\n )}\n {state.selectedProduct.description && (\n <p\n onClick={() => (this.hideDescription = false)}\n class={`hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`}\n innerHTML={state.selectedProduct.description}\n ></p>\n )}\n </div>\n <div class=\"hemfixarna_product--right\">\n {state.selectedProduct.invoice ? (\n <hemfixarna-invoice />\n ) : (\n <Fragment>\n <ul>\n <li class=\"hemfixarna_product--item\">\n <div>\n <p>{state.selectedProduct.title}</p>\n <p class=\"hemfixarna_product--price\">{getProductPrice(state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removeProduct()} />\n <span>{this.getAmount()}</span>\n <img src={plus} onClick={() => this.addProduct()} />\n </div>\n </li>\n {state.selectedProduct.parts?.length &&\n state.selectedProduct.parts.map(p => (\n <li class=\"hemfixarna_part\">\n <div>\n <p>{p.title ?? p.title}</p>\n <p class=\"hemfixarna_product--price\">{getPartPrice(p, state.selectedProduct)}kr/st</p>\n </div>\n <div class=\"hemfixarna_counter\">\n <img class={`${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`} src={minus} onClick={() => this.removePart(p)} />\n <span>{this.getPartAmount(p.ID)}</span>\n <img class={`${this.getAmount() === 0 ? 'disabled' : ''}`} src={plus} onClick={() => this.addPart(p)} />\n </div>\n </li>\n ))}\n </ul>\n <h4 class=\"hemfixarna_product--total\">Totalt {this.getTotalPrice()} kr</h4>\n <button onClick={() => this.goToCart()} class={`hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}`}>\n Fortsätt\n </button>\n </Fragment>\n )}\n {!state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (\n <p class=\"hemfixarna_terms\">\n <strong>{state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading}</strong>\n <br />\n <span innerHTML={state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text}></span>\n </p>\n )}\n {state.options && <hemfixarna-info />}\n </div>\n </div>\n </div>\n ) : null;\n }\n}\n"]}
|
@@ -1,10 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
const HemfixarnaService = class {
|
5
|
-
constructor(hostRef) {
|
6
|
-
registerInstance(this, hostRef);
|
7
|
-
}
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
export class HemfixarnaService {
|
8
4
|
render() {
|
9
5
|
return (h("div", null, h("h2", null, state.selectedService.post_title), h("div", { class: "hemfixarna_categories--wrapper" }, h("div", null, h("ul", { class: "hemfixarna_categories" }, state.selectedService.products
|
10
6
|
.sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
|
@@ -13,8 +9,6 @@ const HemfixarnaService = class {
|
|
13
9
|
return (h("hemfixarna-box", { post: p, icon: (_a = p.icon.url) !== null && _a !== void 0 ? _a : p.icon, postTitle: p.title }));
|
14
10
|
}))), h("hemfixarna-info", null))));
|
15
11
|
}
|
16
|
-
}
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
//# sourceMappingURL=hemfixarna-service.entry.js.map
|
12
|
+
static get is() { return "hemfixarna-service"; }
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=hemfixarna-service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-service.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-service/hemfixarna-service.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,iBAAiB;EAC5B,MAAM;IACJ,OAAO,CACL;MACE,cAAK,KAAK,CAAC,eAAe,CAAC,UAAU,CAAM;MAC3C,WAAK,KAAK,EAAC,gCAAgC;QACzC;UACE,UAAI,KAAK,EAAC,uBAAuB,IAC9B,KAAK,CAAC,eAAe,CAAC,QAAQ;aAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACtD,GAAG,CAAC,CAAC,CAAC,EAAE;;YAAC,OAAA,CACR,sBAAgB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAC,CAAC,CAAC,IAAa,CAAC,GAAG,mCAAK,CAAC,CAAC,IAAe,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,GAAmB,CACjH,CAAA;WAAA,CAAC,CACD,CACD;QACN,0BAAmB,CACf,CACF,CACP,CAAC;EACJ,CAAC;;CACF","sourcesContent":["import { Component, h } from '@stencil/core';\nimport state from '../../store';\nimport { Icon } from '../../types';\n\n@Component({\n tag: 'hemfixarna-service',\n shadow: false,\n})\nexport class HemfixarnaService {\n render() {\n return (\n <div>\n <h2>{state.selectedService.post_title}</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <div>\n <ul class=\"hemfixarna_categories\">\n {state.selectedService.products\n .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))\n .map(p => (\n <hemfixarna-box post={p} icon={(p.icon as Icon).url ?? (p.icon as string)} postTitle={p.title}></hemfixarna-box>\n ))}\n </ul>\n </div>\n <hemfixarna-info />\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
constructor(hostRef) {
|
6
|
-
registerInstance(this, hostRef);
|
1
|
+
import { getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
export class HemfixarnaGrid {
|
4
|
+
constructor() {
|
7
5
|
this.tree = undefined;
|
8
6
|
this.slug = undefined;
|
9
7
|
}
|
@@ -30,8 +28,47 @@ const HemfixarnaGrid = class {
|
|
30
28
|
return (h("hemfixarna-box", { post: c, icon: (_a = c.icon.url) !== null && _a !== void 0 ? _a : c.icon, postTitle: c.name }));
|
31
29
|
})), h("hemfixarna-info", null))));
|
32
30
|
}
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
static get is() { return "hemfixarna-start"; }
|
32
|
+
static get properties() {
|
33
|
+
return {
|
34
|
+
"tree": {
|
35
|
+
"type": "unknown",
|
36
|
+
"mutable": false,
|
37
|
+
"complexType": {
|
38
|
+
"original": "Category",
|
39
|
+
"resolved": "Category",
|
40
|
+
"references": {
|
41
|
+
"Category": {
|
42
|
+
"location": "import",
|
43
|
+
"path": "../../types"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
"required": false,
|
48
|
+
"optional": true,
|
49
|
+
"docs": {
|
50
|
+
"tags": [],
|
51
|
+
"text": ""
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"slug": {
|
55
|
+
"type": "string",
|
56
|
+
"mutable": false,
|
57
|
+
"complexType": {
|
58
|
+
"original": "string",
|
59
|
+
"resolved": "string",
|
60
|
+
"references": {}
|
61
|
+
},
|
62
|
+
"required": false,
|
63
|
+
"optional": true,
|
64
|
+
"docs": {
|
65
|
+
"tags": [],
|
66
|
+
"text": ""
|
67
|
+
},
|
68
|
+
"attribute": "slug",
|
69
|
+
"reflect": false
|
70
|
+
}
|
71
|
+
};
|
72
|
+
}
|
73
|
+
}
|
74
|
+
//# sourceMappingURL=hemfixarna-start.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-start.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-start/hemfixarna-start.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,cAAc;;;;;EAIzB,cAAc,CAAC,QAAgD;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,CAAC,sBAAgB,QAAQ,EAAE,CAAC,CAAC,MAAM,GAAmB,CAAC;gBACzG,CAAC,CAAC,IAAI;YACV,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,sBAAgB,QAAQ,EAAE,CAAC,GAAmB,CAAC,CACnF;QACL,0BAAmB,CACf,CACF,CACP,CAAC,CAAC,CAAC,CACF;MACE,mCAAsB;MACtB,WAAK,KAAK,EAAC,gCAAgC;QACzC,UAAI,KAAK,EAAC,uBAAuB,IAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ;WAChB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;WAC1C,GAAG,CAAC,CAAC,CAAC,EAAE;;UAAC,OAAA,CACR,sBAAgB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAC,CAAC,CAAC,IAAa,CAAC,GAAG,mCAAK,CAAC,CAAC,IAAe,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,GAAmB,CAChH,CAAA;SAAA,CAAC,CACD;QACL,0BAAmB,CACf,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category, CustomerCategory, CustomerSubCategory, Icon } from '../../types';\n\n@Component({\n tag: 'hemfixarna-start',\n shadow: false,\n})\nexport class HemfixarnaGrid {\n @Prop() tree?: Category;\n @Prop() slug?: string;\n\n isMainCategory(category: CustomerCategory | CustomerSubCategory): category is CustomerCategory {\n return (category as CustomerCategory).show_products !== undefined;\n }\n\n handleMaleriClick() {\n state.step = 4;\n state.maleri = true;\n }\n\n render() {\n const maleriLogo = getAssetPath('./assets/gubbe-pensel.svg');\n return state.customer ? (\n <div>\n <h2>{state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'}</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <ul class=\"hemfixarna_categories\">\n {state.selectedCustomerCategory?.add_painting ? (\n <button onClick={() => this.handleMaleriClick()} class=\"hemfixarna_maleribox\">\n <img height={64} src={maleriLogo} alt=\"Måleri Logotyp\" />\n <p>Beräkna fast pris på måleri & tapetsering här</p>\n </button>\n ) : null}\n {state.selectedCustomerCategory\n ? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products\n ? state.selectedCustomerCategory.sub_categories.map(c => <hemfixarna-box category={c}></hemfixarna-box>)\n : state.selectedCustomerCategory.products\n ? state.selectedCustomerCategory.products.map(c => <hemfixarna-box category={c.fields}></hemfixarna-box>)\n : null\n : state.customer.categories.map(c => <hemfixarna-box category={c}></hemfixarna-box>)}\n </ul>\n <hemfixarna-info />\n </div>\n </div>\n ) : (\n <div>\n <h2>Alla tjänster</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <ul class=\"hemfixarna_categories\">\n {this.tree.sub_cats\n .sort((a, b) => (a.name < b.name ? -1 : 1))\n .map(c => (\n <hemfixarna-box post={c} icon={(c.icon as Icon).url ?? (c.icon as string)} postTitle={c.name}></hemfixarna-box>\n ))}\n </ul>\n <hemfixarna-info />\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './components';\n"]}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { createStore } from '@stencil/store';
|
2
|
+
const { state, onChange, } = createStore({
|
3
|
+
step: 1,
|
4
|
+
checkoutStep: 1,
|
5
|
+
checkoutEdit: false,
|
6
|
+
selectedCategory: null,
|
7
|
+
selectedService: null,
|
8
|
+
selectedProduct: null,
|
9
|
+
cart: [],
|
10
|
+
business: 'undefined',
|
11
|
+
options: null,
|
12
|
+
rut: true,
|
13
|
+
rot: true,
|
14
|
+
green: true,
|
15
|
+
token: null,
|
16
|
+
user: null,
|
17
|
+
modal: null,
|
18
|
+
rutOptions: null,
|
19
|
+
rotOptions: null,
|
20
|
+
greenOptions: null,
|
21
|
+
customer: null,
|
22
|
+
selectedCustomerCategory: null,
|
23
|
+
parentCategory: null,
|
24
|
+
creditSafeUser: null,
|
25
|
+
checkoutInvoice: false,
|
26
|
+
maleri: false,
|
27
|
+
sources: null,
|
28
|
+
});
|
29
|
+
onChange('cart', cart => {
|
30
|
+
window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
|
31
|
+
});
|
32
|
+
onChange('user', user => {
|
33
|
+
window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
|
34
|
+
});
|
35
|
+
onChange('creditSafeUser', user => {
|
36
|
+
window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
|
37
|
+
});
|
38
|
+
onChange('selectedProduct', product => {
|
39
|
+
if (!state.customer || !product)
|
40
|
+
return;
|
41
|
+
const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
|
42
|
+
const category = categories.find(c => c && c.id === product.category);
|
43
|
+
if (category) {
|
44
|
+
state.parentCategory = category;
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
state.parentCategory = null;
|
48
|
+
});
|
49
|
+
onChange('selectedCustomerCategory', category => {
|
50
|
+
if (!state.customer || !category)
|
51
|
+
return;
|
52
|
+
if (category.parent) {
|
53
|
+
const parent = state.customer.categories.find(c => c.id === category.parent);
|
54
|
+
if (parent) {
|
55
|
+
state.parentCategory = parent;
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
state.parentCategory = null;
|
60
|
+
});
|
61
|
+
export default state;
|
62
|
+
//# sourceMappingURL=index.js.map
|