hemfixarna-web-components 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hemfixarna-address_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 +2724 -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
@@ -1,11 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
constructor(hostRef) {
|
8
|
-
registerInstance(this, hostRef);
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { hideField } from '../../utils/form';
|
4
|
+
import { scrollToTop } from '../../utils/scroll';
|
5
|
+
export class HemfixarnaAddress {
|
6
|
+
constructor() {
|
9
7
|
this.handleSubmit = (e) => {
|
10
8
|
e.preventDefault();
|
11
9
|
const streetValid = this.street.length > 0;
|
@@ -61,9 +59,17 @@ const HemfixarnaAddress = class {
|
|
61
59
|
this.town = state.user.town;
|
62
60
|
}
|
63
61
|
}
|
64
|
-
get
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
static get is() { return "hemfixarna-address"; }
|
63
|
+
static get states() {
|
64
|
+
return {
|
65
|
+
"street": {},
|
66
|
+
"streetError": {},
|
67
|
+
"zip": {},
|
68
|
+
"zipError": {},
|
69
|
+
"town": {},
|
70
|
+
"townError": {}
|
71
|
+
};
|
72
|
+
}
|
73
|
+
static get elementRef() { return "el"; }
|
74
|
+
}
|
75
|
+
//# sourceMappingURL=hemfixarna-address.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-address.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-address/hemfixarna-address.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,iBAAiB;;IAiB5B,iBAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;MAC1B,CAAC,CAAC,cAAc,EAAE,CAAC;MACnB,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;MAC3C,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC;OACzC;MACD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;MACrC,MAAM,WAAW,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esContent":["import { Component, Element, State, h } from '@stencil/core';\nimport state from '../../store';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-address',\n shadow: false,\n})\nexport class HemfixarnaAddress {\n @State() street: string = '';\n @State() streetError: string | null = null;\n @State() zip: string = '';\n @State() zipError: string | null = null;\n @State() town: string = '';\n @State() townError: string | null = null;\n @Element() private el: HTMLElement;\n\n componentWillLoad() {\n if (state.user) {\n this.street = state.user.street;\n this.zip = state.user.zip;\n this.town = state.user.town;\n }\n }\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n const streetValid = this.street.length > 0;\n if (!streetValid) {\n this.streetError = 'Ange en gatuadress';\n }\n const zipValid = this.zip.length > 0;\n const zipIsNumber = /^\\s*\\d[\\d\\s]*$/.test(this.zip);\n if (!zipIsNumber) {\n this.zipError = 'Postnummer får endast innehålla siffror';\n }\n if (!zipValid) {\n this.zipError = 'Ange ett postnummer';\n }\n const townValid = /^[^\\d\\s]{2,}$/.test(this.town);\n if (!townValid) {\n this.townError = 'Ange en ort';\n }\n if (streetValid && zipValid && townValid && zipIsNumber) {\n state.user = { ...state.user, street: this.street, zip: this.zip, town: this.town };\n state.checkoutStep = 2;\n state.checkoutEdit = false;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n };\n\n handleChangeStreet = (e: Event) => {\n this.streetError = null;\n this.street = this.street === state.user.street ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeZip = (e: Event) => {\n this.zipError = null;\n this.zip = this.zip === state.user.zip ? '' : (e.target as HTMLInputElement).value;\n };\n\n handleChangeTown = (e: Event) => {\n this.townError = null;\n this.town = this.town === state.user.town ? '' : (e.target as HTMLInputElement).value;\n };\n\n render = () => {\n return (\n <form class=\"hemfixarna_address\" onSubmit={e => this.handleSubmit(e)}>\n <div>\n <input\n class={`${this.street.length ? 'input_active' : ''}`}\n onInput={this.handleChangeStreet}\n type=\"text\"\n name=\"street\"\n value={this.street === state.user.street ? hideField(this.street) : this.street}\n />\n <label htmlFor=\"street\">Gatuaddress </label>\n </div>\n {this.streetError && <span>{this.streetError}</span>}\n <div>\n <input\n class={`${this.zip.length ? 'input_active' : ''}`}\n onInput={this.handleChangeZip}\n type=\"tel\"\n name=\"zip\"\n value={this.zip === state.user.zip ? hideField(this.zip) : this.zip}\n />\n <label htmlFor=\"zip\">Postnummer </label>\n </div>\n {this.zipError && <span>{this.zipError}</span>}\n <div>\n <input\n class={`${this.town.length ? 'input_active' : ''}`}\n onInput={this.handleChangeTown}\n type=\"text\"\n name=\"town\"\n value={this.town === state.user.town ? hideField(this.town) : this.town}\n />\n <label htmlFor=\"town\">Ort </label>\n </div>\n {this.townError && <span>{this.townError}</span>}\n <input type=\"submit\" value=\"Fortsätt\" />\n </form>\n );\n };\n}\n"]}
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import { Fragment, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { getProductPrice } from '../../utils/calc';
|
4
|
+
import { scrollToTop } from '../../utils/scroll';
|
5
|
+
import { isProduct } from '../../utils/types';
|
6
|
+
export class HemfixarnaBox {
|
7
|
+
constructor() {
|
8
|
+
this.post = undefined;
|
9
|
+
this.category = undefined;
|
10
|
+
this.icon = undefined;
|
11
|
+
this.postTitle = undefined;
|
12
|
+
}
|
13
|
+
setTaxonomy(taxonomy) {
|
14
|
+
if (taxonomy) {
|
15
|
+
if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
|
16
|
+
state.selectedCategory = taxonomy;
|
17
|
+
state.step = 2;
|
18
|
+
}
|
19
|
+
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
|
20
|
+
state.selectedService = taxonomy;
|
21
|
+
state.step = 3;
|
22
|
+
}
|
23
|
+
else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
|
24
|
+
state.selectedProduct = taxonomy;
|
25
|
+
state.step = 4;
|
26
|
+
}
|
27
|
+
const el = this.el.closest('.hemfixarna_content');
|
28
|
+
scrollToTop(el);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
setProduct() {
|
32
|
+
state.selectedProduct = this.category;
|
33
|
+
state.step = 4;
|
34
|
+
state.selectedCustomerCategory = null;
|
35
|
+
const el = this.el.closest('.hemfixarna_content');
|
36
|
+
scrollToTop(el);
|
37
|
+
}
|
38
|
+
render() {
|
39
|
+
return this.category ? (h(Fragment, null, isProduct(this.category) ? (h("li", { onClick: () => this.setProduct() }, h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.post_name }), h("div", null, h("p", null, this.category.title), !this.category.invoice ? h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.category), "kr") : null))) : (h("li", { onClick: () => (state.selectedCustomerCategory = this.category) }, h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.name }), h("div", null, h("p", null, this.category.name)))))) : (h("li", { onClick: () => this.setTaxonomy(this.post) }, this.post.icon && h("img", { class: "hemfixarna_logo", height: 82, src: this.icon, alt: this.postTitle }), h("div", null, h("p", null, this.postTitle), state.step === 3 && h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
|
40
|
+
}
|
41
|
+
static get is() { return "hemfixarna-box"; }
|
42
|
+
static get properties() {
|
43
|
+
return {
|
44
|
+
"post": {
|
45
|
+
"type": "unknown",
|
46
|
+
"mutable": false,
|
47
|
+
"complexType": {
|
48
|
+
"original": "Category | Product | Service",
|
49
|
+
"resolved": "Category | Product | Service",
|
50
|
+
"references": {
|
51
|
+
"Category": {
|
52
|
+
"location": "import",
|
53
|
+
"path": "../../types"
|
54
|
+
},
|
55
|
+
"Product": {
|
56
|
+
"location": "import",
|
57
|
+
"path": "../../types"
|
58
|
+
},
|
59
|
+
"Service": {
|
60
|
+
"location": "import",
|
61
|
+
"path": "../../types"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"required": false,
|
66
|
+
"optional": false,
|
67
|
+
"docs": {
|
68
|
+
"tags": [],
|
69
|
+
"text": ""
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"category": {
|
73
|
+
"type": "unknown",
|
74
|
+
"mutable": false,
|
75
|
+
"complexType": {
|
76
|
+
"original": "CustomerCategory | CustomerSubCategory | Product",
|
77
|
+
"resolved": "CustomerCategory | CustomerSubCategory | Product",
|
78
|
+
"references": {
|
79
|
+
"CustomerCategory": {
|
80
|
+
"location": "import",
|
81
|
+
"path": "../../types"
|
82
|
+
},
|
83
|
+
"CustomerSubCategory": {
|
84
|
+
"location": "import",
|
85
|
+
"path": "../../types"
|
86
|
+
},
|
87
|
+
"Product": {
|
88
|
+
"location": "import",
|
89
|
+
"path": "../../types"
|
90
|
+
}
|
91
|
+
}
|
92
|
+
},
|
93
|
+
"required": false,
|
94
|
+
"optional": false,
|
95
|
+
"docs": {
|
96
|
+
"tags": [],
|
97
|
+
"text": ""
|
98
|
+
}
|
99
|
+
},
|
100
|
+
"icon": {
|
101
|
+
"type": "string",
|
102
|
+
"mutable": false,
|
103
|
+
"complexType": {
|
104
|
+
"original": "string",
|
105
|
+
"resolved": "string",
|
106
|
+
"references": {}
|
107
|
+
},
|
108
|
+
"required": false,
|
109
|
+
"optional": false,
|
110
|
+
"docs": {
|
111
|
+
"tags": [],
|
112
|
+
"text": ""
|
113
|
+
},
|
114
|
+
"attribute": "icon",
|
115
|
+
"reflect": false
|
116
|
+
},
|
117
|
+
"postTitle": {
|
118
|
+
"type": "string",
|
119
|
+
"mutable": false,
|
120
|
+
"complexType": {
|
121
|
+
"original": "string",
|
122
|
+
"resolved": "string",
|
123
|
+
"references": {}
|
124
|
+
},
|
125
|
+
"required": false,
|
126
|
+
"optional": false,
|
127
|
+
"docs": {
|
128
|
+
"tags": [],
|
129
|
+
"text": ""
|
130
|
+
},
|
131
|
+
"attribute": "post-title",
|
132
|
+
"reflect": false
|
133
|
+
}
|
134
|
+
};
|
135
|
+
}
|
136
|
+
static get elementRef() { return "el"; }
|
137
|
+
}
|
138
|
+
//# sourceMappingURL=hemfixarna-box.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-box.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-box/hemfixarna-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAM9C,MAAM,OAAO,aAAa;;;;;;;EAOxB,WAAW,CAAC,QAAsC;IAChD,IAAI,QAAQ,EAAE;MACZ,IAAI,CAAC,QAAqB,aAArB,QAAQ,uBAAR,QAAQ,CAAe,QAAQ,MAAK,aAAa,EAAE;QACtD,KAAK,CAAC,gBAAgB,GAAG,QAAoB,CAAC;QAC9C,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;OAChB;WAAM,IAAI,CAAC,QAAoB,aAApB,QAAQ,uBAAR,QAAQ,CAAc,SAAS,MAAK,SAAS,EAAE;QACzD,KAAK,CAAC,eAAe,GAAG,QAAmB,CAAC;QAC5C,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;OAChB;WAAM,IAAI,CAAC,QAAoB,aAApB,QAAQ,uBAAR,QAAQ,CAAc,SAAS,MAAK,cAAc,EAAE;QAC9D,KAAK,CAAC,eAAe,GAAG,QAAmB,CAAC;QAC5C,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;OAChB;MACD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;MAClD,WAAW,CAAC,EAAE,CAAC,CAAC;K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B,CACH,CACN,CACQ,CACZ,CAAC,CAAC,CAAC,CACF,UAAI,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;MAC3C,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,WAAK,KAAK,EAAC,iBAAiB,EAAC,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,GAAI;MACnG;QACE,aAAI,IAAI,CAAC,SAAS,CAAK;QACtB,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,SAAG,KAAK,EAAC,OAAO;;UAAO,eAAe,CAAC,IAAI,CAAC,IAAe,CAAC;eAAO,CACpF,CACH,CACN,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, Prop, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category, CustomerCategory, CustomerSubCategory, Product, Service } from '../../types';\nimport { getProductPrice } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\nimport { isProduct } from '../../utils/types';\n\n@Component({\n tag: 'hemfixarna-box',\n shadow: false,\n})\nexport class HemfixarnaBox {\n @Prop() post: Category | Product | Service;\n @Prop() category: CustomerCategory | CustomerSubCategory | Product;\n @Prop() icon: string;\n @Prop() postTitle: string;\n @Element() private el: HTMLElement;\n\n setTaxonomy(taxonomy: Category | Service | Product) {\n if (taxonomy) {\n if ((taxonomy as Category)?.taxonomy === 'service_cat') {\n state.selectedCategory = taxonomy as Category;\n state.step = 2;\n } else if ((taxonomy as Service)?.post_type === 'service') {\n state.selectedService = taxonomy as Service;\n state.step = 3;\n } else if ((taxonomy as Product)?.post_type === 'ikea_product') {\n state.selectedProduct = taxonomy as Product;\n state.step = 4;\n }\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n }\n\n setProduct() {\n state.selectedProduct = this.category as Product;\n state.step = 4;\n state.selectedCustomerCategory = null;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n }\n\n render() {\n return this.category ? (\n <Fragment>\n {isProduct(this.category) ? (\n <li onClick={() => this.setProduct()}>\n <img class=\"hemfixarna_logo\" height={82} src={this.category.icon as string} alt={this.category.post_name} />\n <div>\n <p>{this.category.title}</p>\n {!this.category.invoice ? <p class=\"price\">Från {getProductPrice(this.category)}kr</p> : null}\n </div>\n </li>\n ) : (\n <li onClick={() => (state.selectedCustomerCategory = this.category as CustomerCategory)}>\n <img class=\"hemfixarna_logo\" height={82} src={this.category.icon} alt={this.category.name} />\n <div>\n <p>{this.category.name}</p>\n </div>\n </li>\n )}\n </Fragment>\n ) : (\n <li onClick={() => this.setTaxonomy(this.post)}>\n {this.post.icon && <img class=\"hemfixarna_logo\" height={82} src={this.icon} alt={this.postTitle} />}\n <div>\n <p>{this.postTitle}</p>\n {state.step === 3 && <p class=\"price\">Från {getProductPrice(this.post as Product)}kr</p>}\n </div>\n </li>\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 { getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { scrollToTop } from '../../utils/scroll';
|
4
|
+
export class HemfixarnaBreadcrumbs {
|
5
|
+
constructor() {
|
8
6
|
this.triggerScrollTotop = () => {
|
9
7
|
const el = this.el.nextSibling;
|
10
8
|
scrollToTop(el);
|
@@ -55,9 +53,82 @@ const HemfixarnaBreadcrumbs = class {
|
|
55
53
|
state.maleri = null;
|
56
54
|
} }, h("img", { width: 24, src: back, alt: "back arrow" }), h("span", null, "Se allt ", state.parentCategory.name)))));
|
57
55
|
}
|
58
|
-
get
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
static get is() { return "hemfixarna-breadcrumbs"; }
|
57
|
+
static get properties() {
|
58
|
+
return {
|
59
|
+
"tree": {
|
60
|
+
"type": "unknown",
|
61
|
+
"mutable": false,
|
62
|
+
"complexType": {
|
63
|
+
"original": "Category",
|
64
|
+
"resolved": "Category",
|
65
|
+
"references": {
|
66
|
+
"Category": {
|
67
|
+
"location": "import",
|
68
|
+
"path": "../../types"
|
69
|
+
}
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"required": false,
|
73
|
+
"optional": false,
|
74
|
+
"docs": {
|
75
|
+
"tags": [],
|
76
|
+
"text": ""
|
77
|
+
}
|
78
|
+
},
|
79
|
+
"closeModal": {
|
80
|
+
"type": "unknown",
|
81
|
+
"mutable": false,
|
82
|
+
"complexType": {
|
83
|
+
"original": "() => void",
|
84
|
+
"resolved": "() => void",
|
85
|
+
"references": {}
|
86
|
+
},
|
87
|
+
"required": false,
|
88
|
+
"optional": false,
|
89
|
+
"docs": {
|
90
|
+
"tags": [],
|
91
|
+
"text": ""
|
92
|
+
}
|
93
|
+
},
|
94
|
+
"loadFromQuery": {
|
95
|
+
"type": "boolean",
|
96
|
+
"mutable": false,
|
97
|
+
"complexType": {
|
98
|
+
"original": "boolean",
|
99
|
+
"resolved": "boolean",
|
100
|
+
"references": {}
|
101
|
+
},
|
102
|
+
"required": false,
|
103
|
+
"optional": false,
|
104
|
+
"docs": {
|
105
|
+
"tags": [],
|
106
|
+
"text": ""
|
107
|
+
},
|
108
|
+
"attribute": "load-from-query",
|
109
|
+
"reflect": false,
|
110
|
+
"defaultValue": "false"
|
111
|
+
},
|
112
|
+
"isDemo": {
|
113
|
+
"type": "boolean",
|
114
|
+
"mutable": false,
|
115
|
+
"complexType": {
|
116
|
+
"original": "boolean",
|
117
|
+
"resolved": "boolean",
|
118
|
+
"references": {}
|
119
|
+
},
|
120
|
+
"required": false,
|
121
|
+
"optional": false,
|
122
|
+
"docs": {
|
123
|
+
"tags": [],
|
124
|
+
"text": ""
|
125
|
+
},
|
126
|
+
"attribute": "is-demo",
|
127
|
+
"reflect": false,
|
128
|
+
"defaultValue": "false"
|
129
|
+
}
|
130
|
+
};
|
131
|
+
}
|
132
|
+
static get elementRef() { return "el"; }
|
133
|
+
}
|
134
|
+
//# sourceMappingURL=hemfixarna-breadcrumbs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,qBAAqB;;IAWhC,uBAAkB,GAAG,GAAG,EAAE;MACxB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,WAA0B,CAAC;MAC9C,WAAW,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC;;;yBAX+B,KAAK;kBACZ,KAAK;;EAG/B,aAAa;IACX,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;EAChE,CAAC;EAOD,eAAe;;IACb,IAAI,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,EAAE;MACtB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;EACH,CAAC;EAED,mBAAmB;IACjB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,KAAK,CAA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K,CAAC,IAAI,GAAG,CAAC,IAAI,CACzC,cACE,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,GAAG,EAAE;UACZ,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;UACf,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC;UACtD,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;UAC7B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG;QAC9C;;UAAe,KAAK,CAAC,cAAc,CAAC,IAAI,CAAQ,CACzC,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category } from '../../types';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-breadcrumbs',\n shadow: false,\n})\nexport class HemfixarnaBreadcrumbs {\n @Prop() tree: Category;\n @Prop() closeModal: () => void;\n @Prop() loadFromQuery: boolean = false;\n @Prop() isDemo: boolean = false;\n @Element() private el: HTMLElement;\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n triggerScrollTotop = () => {\n const el = this.el.nextSibling as HTMLElement;\n scrollToTop(el);\n };\n\n handleCartClick() {\n if (state.cart?.length) {\n state.step = 5;\n this.triggerScrollTotop();\n }\n }\n\n handleHomePageClick() {\n state.step = 1;\n state.parentCategory = null;\n state.selectedCustomerCategory = null;\n this.triggerScrollTotop();\n setTimeout(() => {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.maleri = null;\n state.selectedService = null;\n }, 200);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n const close = getAssetPath(`./assets/close.svg`);\n const cart = getAssetPath(`./assets/cart.svg`);\n const back = getAssetPath(`./assets/back.svg`);\n\n return (\n <div>\n <div class=\"hemfixarna_crumbs\">\n <div class=\"hemfixarna_crumbs--links\">\n <img onClick={() => this.handleHomePageClick()} src={logo} width={110} />\n {!this.loadFromQuery || this.isDemo ? <img onClick={() => this.closeModal()} class=\"close\" src={close} width={32} /> : null}\n <div>\n <button onClick={() => this.handleHomePageClick()}>Alla tjänster</button>\n </div>\n </div>\n <div class=\"hemfixarna_crumbs--right\">\n <hemfixarna-contact></hemfixarna-contact>\n <div onClick={() => this.handleCartClick()} class={`cart ${this.getCartLength() > 0 ? 'cart_active' : ''}`}>\n <img src={cart} width={24} />\n <span>{this.getCartLength()}</span>\n </div>\n </div>\n </div>\n {[3, 4].includes(state.step) && !state.customer && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = state.step === 4 ? 3 : 2;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name}</span>\n </button>\n )}\n {!state.parentCategory && state.step && state.selectedCustomerCategory && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = 1;\n state.selectedCustomerCategory = null;\n state.selectedProduct = null;\n state.maleri = null;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se alla tjänster</span>\n </button>\n )}\n {state.parentCategory && state.step < 5 && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = 1;\n state.selectedCustomerCategory = state.parentCategory;\n state.selectedProduct = null;\n state.maleri = null;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.parentCategory.name}</span>\n </button>\n )}\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 HemfixarnaCart {
|
4
|
+
constructor() {
|
7
5
|
this.tree = undefined;
|
8
6
|
}
|
9
7
|
render() {
|
@@ -14,8 +12,30 @@ const HemfixarnaCart = class {
|
|
14
12
|
state.checkoutStep = 1;
|
15
13
|
} }, h("img", { width: 24, src: back, alt: "back arrow" }))), "Dina uppgifter"), h("hemfixarna-checkout", null), h("hemfixarna-info", null))));
|
16
14
|
}
|
17
|
-
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
static get is() { return "hemfixarna-cart"; }
|
16
|
+
static get properties() {
|
17
|
+
return {
|
18
|
+
"tree": {
|
19
|
+
"type": "unknown",
|
20
|
+
"mutable": false,
|
21
|
+
"complexType": {
|
22
|
+
"original": "Category",
|
23
|
+
"resolved": "Category",
|
24
|
+
"references": {
|
25
|
+
"Category": {
|
26
|
+
"location": "import",
|
27
|
+
"path": "../../types"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"required": false,
|
32
|
+
"optional": false,
|
33
|
+
"docs": {
|
34
|
+
"tags": [],
|
35
|
+
"text": ""
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
}
|
40
|
+
}
|
41
|
+
//# sourceMappingURL=hemfixarna-cart.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-cart.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-cart/hemfixarna-cart.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;;;;EAGzB,MAAM;IACJ,MAAM,IAAI,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAE/C,OAAO,CACL,WAAK,KAAK,EAAC,iBAAiB;MAC1B,WAAK,KAAK,EAAC,uBAAuB;QAChC;UACG,KAAK,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAClD,cACE,OAAO,EAAE,GAAG,EAAE;cACZ,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;YACzB,CAAC;YAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG,CACvC,CACV;wBAEE;QACL,4BAAsB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CACrC;MACN,WAAK,KAAK,EAAC,wBAAwB;QACjC;UACG,KAAK,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAClD,cACE,OAAO,EAAE,GAAG,EAAE;cACZ,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;YACzB,CAAC;YAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG,CACvC,CACV;2BAEE;QACL,8BAAuB;QACvB,0BAAmB,CACf,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category } from '../../types';\n\n@Component({\n tag: 'hemfixarna-cart',\n shadow: false,\n})\nexport class HemfixarnaCart {\n @Prop() tree: Category;\n\n render() {\n const back = getAssetPath(`./assets/back.svg`);\n\n return (\n <div class=\"hemfixarna_cart\">\n <div class=\"hemfixarna_cart--left\">\n <h2>\n {state.checkoutStep === 2 && !state.checkoutEdit && (\n <button\n onClick={() => {\n state.checkoutStep = 1;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n </button>\n )}\n Din bokning\n </h2>\n <hemfixarna-orderrows tree={this.tree} />\n </div>\n <div class=\"hemfixarna_cart--right\">\n <h2>\n {state.checkoutStep === 2 && !state.checkoutEdit && (\n <button\n onClick={() => {\n state.checkoutStep = 1;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n </button>\n )}\n Dina uppgifter\n </h2>\n <hemfixarna-checkout />\n <hemfixarna-info />\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -1,10 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
const HemfixarnaCategory = class {
|
5
|
-
constructor(hostRef) {
|
6
|
-
registerInstance(this, hostRef);
|
7
|
-
}
|
1
|
+
import { h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
export class HemfixarnaCategory {
|
8
4
|
setSelectedService(service) {
|
9
5
|
state.selectedService = service;
|
10
6
|
state.step = 3;
|
@@ -17,8 +13,6 @@ const HemfixarnaCategory = class {
|
|
17
13
|
return (h("hemfixarna-box", { post: s, icon: (_a = s.icon.url) !== null && _a !== void 0 ? _a : s.icon, postTitle: s.post_title }));
|
18
14
|
}))), h("hemfixarna-info", null))));
|
19
15
|
}
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
//# sourceMappingURL=hemfixarna-category.entry.js.map
|
16
|
+
static get is() { return "hemfixarna-category"; }
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=hemfixarna-category.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-category.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-category.tsx/hemfixarna-category.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,aAAa,CAAC;AAOhC,MAAM,OAAO,kBAAkB;EAC7B,kBAAkB,CAAC,OAAgB;IACjC,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;EACjB,CAAC;EAED,MAAM;IACJ,OAAO,CACL;MACE,cAAK,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAM;MACtC,WAAK,KAAK,EAAC,gCAAgC;QACzC;UACE,UAAI,KAAK,EAAC,uBAAuB,IAC9B,KAAK,CAAC,gBAAgB,CAAC,QAAQ;aAC7B,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,UAAU,GAAmB,CACtH,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, Service } from '../../types';\n\n@Component({\n tag: 'hemfixarna-category',\n shadow: false,\n})\nexport class HemfixarnaCategory {\n setSelectedService(service: Service) {\n state.selectedService = service;\n state.step = 3;\n }\n\n render() {\n return (\n <div>\n <h2>{state.selectedCategory.name}</h2>\n <div class=\"hemfixarna_categories--wrapper\">\n <div>\n <ul class=\"hemfixarna_categories\">\n {state.selectedCategory.services\n .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))\n .map(s => (\n <hemfixarna-box post={s} icon={(s.icon as Icon).url ?? (s.icon as string)} postTitle={s.post_title}></hemfixarna-box>\n ))}\n </ul>\n </div>\n <hemfixarna-info />\n </div>\n </div>\n );\n }\n}\n"]}
|
@@ -1,29 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
try {
|
11
|
-
return await fetchWithType(`${base}/createperson`, {
|
12
|
-
method: 'POST',
|
13
|
-
body: JSON.stringify(felixOrder),
|
14
|
-
headers: {
|
15
|
-
'Content-Type': 'application/json',
|
16
|
-
},
|
17
|
-
});
|
18
|
-
}
|
19
|
-
catch (error) {
|
20
|
-
console.log(error);
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
const HemfixarnaCheckout = class {
|
25
|
-
constructor(hostRef) {
|
26
|
-
registerInstance(this, hostRef);
|
1
|
+
import { Fragment, getAssetPath, h } from '@stencil/core';
|
2
|
+
import state from '../../store';
|
3
|
+
import { Business } from '../../types';
|
4
|
+
import { postOrder } from '../../utils/api';
|
5
|
+
import { postPerson } from '../../utils/felixApi';
|
6
|
+
import { hideField } from '../../utils/form';
|
7
|
+
import { scrollToTop } from '../../utils/scroll';
|
8
|
+
export class HemfixarnaCheckout {
|
9
|
+
constructor() {
|
27
10
|
this.handleChangeDate = (e) => {
|
28
11
|
this.dateError = null;
|
29
12
|
this.date = e.target.value;
|
@@ -181,9 +164,21 @@ const HemfixarnaCheckout = class {
|
|
181
164
|
disconnectedCallback() {
|
182
165
|
window.removeEventListener('keydown', this.handleKeyDown);
|
183
166
|
}
|
184
|
-
get
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
167
|
+
static get is() { return "hemfixarna-checkout"; }
|
168
|
+
static get states() {
|
169
|
+
return {
|
170
|
+
"date": {},
|
171
|
+
"dateError": {},
|
172
|
+
"generalError": {},
|
173
|
+
"loading": {},
|
174
|
+
"enteredPin": {},
|
175
|
+
"selectedSubSource": {},
|
176
|
+
"partnerOrderId": {},
|
177
|
+
"showSources": {},
|
178
|
+
"sellerID": {},
|
179
|
+
"RefferalID": {}
|
180
|
+
};
|
181
|
+
}
|
182
|
+
static get elementRef() { return "el"; }
|
183
|
+
}
|
184
|
+
//# sourceMappingURL=hemfixarna-checkout.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hemfixarna-checkout.js","sourceRoot":"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E,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC,SAAS,GAAG,CACtD,CACD,CACH,CACP,CAAC;OACH;IACH,CAAC,CAAC;gBAnPsB,EAAE;qBACU,IAAI;wBACD,IAAI;mBACxB,KAAK;sBACM,EAAE;6BAGY,IAAI;0BACP,IAAI;uBACtB,KAAK;oBACO,IAAI;sBACF,IAAI;;EAyHzC,iBAAiB;IACf,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;MAC5C,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;KACxB;IACD,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;MAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KACxD;IACD,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,WAAW,EAAE;MACf,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;KACzB;EACH,CAAC;EAED,oBAAoB;IAClB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;EAC5D,CAAC;;;;;;;;;;;;;;;CAiGF","sourcesContent":["import { Component, Element, Fragment, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { FelixOrder, postPerson } from '../../utils/felixApi';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @State() loading = false;\n @State() enteredPin: string = '';\n @Element() private el: HTMLElement;\n private pinTimeout: any;\n @State() selectedSubSource: string | null = null;\n @State() partnerOrderId: string | null = null;\n @State() showSources = false;\n @State() sellerID: string | null = null;\n @State() RefferalID: string | null = null;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n if (this.loading) return;\n this.loading = true;\n let order: FelixOrder = {\n firstName: state.creditSafeUser.firstName,\n lastName: state.creditSafeUser.lastName,\n street: state.user.street,\n zip: state.user.zip,\n town: state.user.town,\n ssn: state.user.ssn,\n email: state.user.email,\n phone: state.user.phone,\n url: `${state.business === Business.string ? 'string' : state.business}-webk`,\n date: this.date,\n products: [\n ...state.cart.map(item => {\n const parts = item.parts.map(part => ({\n id: String(part.id),\n name: part.name,\n quantity: part.amount,\n rut: 0,\n rot: 0,\n }));\n return [\n {\n id: String(item.id),\n name: item.name,\n quantity: item.amount,\n rot: item.rot ? 1 : 0,\n rut: item.rut ? 1 : 0,\n },\n ...parts,\n ];\n }),\n ].flat(),\n creditSafe: state.creditSafeUser,\n customer: state.business,\n id_source: '',\n id_sub_source: '',\n seller_id: this.sellerID ?? '',\n referral_id: this.RefferalID ?? '',\n };\n\n const felixOrder = await postPerson(order);\n if (!felixOrder || !felixOrder.response?.scriptResult?.includes('OK')) {\n order = { ...order, felixStatus: 'error' };\n } else {\n order = { ...order, felixStatus: 'success' };\n }\n\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (error) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n this.loading = false;\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n // if (state.customer.source) {\n // if (!this.sellerID) {\n // this.generalError = 'Ange säljare';\n // return;\n // }\n // if (state.customer.source.sub_sources?.length && !this.selectedSubSource) {\n // this.generalError = 'Välj underkälla';\n // return;\n // }\n // }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n handleKeyDown = (event: KeyboardEvent) => {\n this.enteredPin += event.key;\n\n const correctPin = '+0033';\n\n if (this.enteredPin.length === correctPin.length) {\n if (this.enteredPin === correctPin) {\n localStorage.setItem('show_sources', 'true');\n this.showSources = true;\n window.removeEventListener('keydown', this.handleKeyDown);\n }\n this.enteredPin = '';\n }\n\n clearTimeout(this.pinTimeout);\n this.pinTimeout = setTimeout(() => (this.enteredPin = ''), 5000);\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n if (state.customer && state.customer.source) {\n window.addEventListener('keydown', this.handleKeyDown);\n }\n const showSources = localStorage.getItem('show_sources');\n if (showSources) {\n this.showSources = true;\n }\n }\n\n disconnectedCallback() {\n window.removeEventListener('keydown', this.handleKeyDown);\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n const loading = getAssetPath(`./assets/spinner.gif`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n {state.customer.source && this.showSources ? (\n <Fragment>\n <p>\n Inloggad som:\n <strong> {state.customer.source.fieldData.So01_Name}</strong>\n </p>\n <label>\n Säljare (SäljarId)\n <input type=\"text\" value={this.sellerID} onChange={e => (this.sellerID = (e.target as HTMLInputElement).value)} />\n </label>\n <label>\n PartnerOrderID (RefferalID)\n <input type=\"text\" value={this.RefferalID} onChange={e => (this.RefferalID = (e.target as HTMLInputElement).value)} />\n </label>\n {state.customer.source.sub_sources?.length ? (\n <div>\n <select onChange={e => (this.selectedSubSource = (e.target as HTMLSelectElement).value)}>\n <option disabled selected value=\"null\">\n Välj underkälla\n </option>\n {state.customer.source.sub_sources.map(sub => (\n <option value={sub['So_SubSource::_id']}>{sub['So_SubSource::Sus01_Name']}</option>\n ))}\n </select>\n </div>\n ) : (\n <h4>Det finns inga underkällor att välja</h4>\n )}\n </Fragment>\n ) : null}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout?.length)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <div class={this.loading ? 'loading' : ''}>\n <input type=\"submit\" value={this.loading ? '' : 'Skicka bokning'} />\n <img width={20} height={20} src={loading} alt=\"spinner\" />\n </div>\n </form>\n </div>\n );\n }\n };\n}\n"]}
|