hemfixarna-web-components 1.6.1 → 1.6.2

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.
Files changed (243) hide show
  1. package/dist/{collection/utils/api.js → hemfixarna-components/api-36f73d0d.js} +6 -4
  2. package/dist/hemfixarna-components/api-36f73d0d.js.map +1 -0
  3. package/dist/hemfixarna-components/app-globals-0f993ce5.js +5 -0
  4. package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +1 -0
  5. package/dist/{collection/utils/calc.js → hemfixarna-components/calc-4c79b798.js} +6 -3
  6. package/dist/hemfixarna-components/calc-4c79b798.js.map +1 -0
  7. package/dist/hemfixarna-components/css-shim-62d2171c.js +6 -0
  8. package/dist/hemfixarna-components/css-shim-62d2171c.js.map +1 -0
  9. package/dist/hemfixarna-components/dom-46a68c9b.js +75 -0
  10. package/dist/hemfixarna-components/dom-46a68c9b.js.map +1 -0
  11. package/dist/{collection/utils/form.js → hemfixarna-components/form-c53dca29.js} +4 -2
  12. package/dist/hemfixarna-components/form-c53dca29.js.map +1 -0
  13. package/dist/{collection/components/hemfixarna-address/hemfixarna-address.js → hemfixarna-components/hemfixarna-address.entry.js} +14 -20
  14. package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +1 -0
  15. package/dist/hemfixarna-components/hemfixarna-box.entry.js +49 -0
  16. package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +1 -0
  17. package/dist/{collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js → hemfixarna-components/hemfixarna-breadcrumbs.entry.js} +13 -84
  18. package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +1 -0
  19. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +27 -0
  20. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +1 -0
  21. package/dist/{collection/components/hemfixarna-cart/hemfixarna-cart.js → hemfixarna-components/hemfixarna-cart.entry.js} +11 -31
  22. package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +1 -0
  23. package/dist/{collection/components/hemfixarna-category.tsx/hemfixarna-category.js → hemfixarna-components/hemfixarna-category.entry.js} +12 -6
  24. package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +1 -0
  25. package/dist/{collection/components/hemfixarna-checkout/hemfixarna-checkout.js → hemfixarna-components/hemfixarna-checkout.entry.js} +38 -33
  26. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +1 -0
  27. package/dist/hemfixarna-components/hemfixarna-component.entry.js +248 -0
  28. package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +1 -0
  29. package/dist/hemfixarna-components/hemfixarna-components.esm.js +162 -1
  30. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  31. package/dist/{collection/components/hemfixarna-contact/hemfixarna-contact.js → hemfixarna-components/hemfixarna-contact.entry.js} +10 -28
  32. package/dist/hemfixarna-components/hemfixarna-contact.entry.js.map +1 -0
  33. package/dist/{collection/components/hemfixarna-demo/hemfixarna-demo.js → hemfixarna-components/hemfixarna-demo.entry.js} +23 -46
  34. package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +1 -0
  35. package/dist/hemfixarna-components/hemfixarna-doro.entry.js +23 -0
  36. package/dist/hemfixarna-components/hemfixarna-doro.entry.js.map +1 -0
  37. package/dist/hemfixarna-components/hemfixarna-elfa.entry.js +24 -0
  38. package/dist/hemfixarna-components/hemfixarna-elfa.entry.js.map +1 -0
  39. package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js +21 -0
  40. package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js.map +1 -0
  41. package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js +21 -0
  42. package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js.map +1 -0
  43. package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js +23 -0
  44. package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js.map +1 -0
  45. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +770 -0
  46. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +1 -0
  47. package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js +24 -0
  48. package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js.map +1 -0
  49. package/dist/{collection/components/hemfixarna-info/hemfixarna-info.js → hemfixarna-components/hemfixarna-info.entry.js} +11 -7
  50. package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +1 -0
  51. package/dist/{collection/components/hemfixarna-invoice/hemfixarna-invoice.js → hemfixarna-components/hemfixarna-invoice.entry.js} +16 -27
  52. package/dist/hemfixarna-components/hemfixarna-invoice.entry.js.map +1 -0
  53. package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js +21 -0
  54. package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js.map +1 -0
  55. package/dist/hemfixarna-components/hemfixarna-klint.entry.js +20 -0
  56. package/dist/hemfixarna-components/hemfixarna-klint.entry.js.map +1 -0
  57. package/dist/hemfixarna-components/hemfixarna-kund.entry.js +20 -0
  58. package/dist/hemfixarna-components/hemfixarna-kund.entry.js.map +1 -0
  59. package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js +21 -0
  60. package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js.map +1 -0
  61. package/dist/{collection/components/hemfixarna-order/hemfixarna-order.js → hemfixarna-components/hemfixarna-order.entry.js} +11 -31
  62. package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +1 -0
  63. package/dist/{collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js → hemfixarna-components/hemfixarna-orderrows.entry.js} +12 -50
  64. package/dist/hemfixarna-components/hemfixarna-orderrows.entry.js.map +1 -0
  65. package/dist/hemfixarna-components/hemfixarna-power.entry.js +21 -0
  66. package/dist/hemfixarna-components/hemfixarna-power.entry.js.map +1 -0
  67. package/dist/{collection/components/hemfixarna-product/hemfixarna-product.js → hemfixarna-components/hemfixarna-product.entry.js} +18 -27
  68. package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +1 -0
  69. package/dist/{collection/components/hemfixarna-service/hemfixarna-service.js → hemfixarna-components/hemfixarna-service.entry.js} +12 -6
  70. package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +1 -0
  71. package/dist/hemfixarna-components/hemfixarna-skanska.entry.js +24 -0
  72. package/dist/hemfixarna-components/hemfixarna-skanska.entry.js.map +1 -0
  73. package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js +21 -0
  74. package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js.map +1 -0
  75. package/dist/{collection/components/hemfixarna-start/hemfixarna-start.js → hemfixarna-components/hemfixarna-start.entry.js} +11 -48
  76. package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +1 -0
  77. package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js +23 -0
  78. package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js.map +1 -0
  79. package/dist/hemfixarna-components/hemfixarna-superfront.entry.js +20 -0
  80. package/dist/hemfixarna-components/hemfixarna-superfront.entry.js.map +1 -0
  81. package/dist/hemfixarna-components/hemfixarna-tesla.entry.js +21 -0
  82. package/dist/hemfixarna-components/hemfixarna-tesla.entry.js.map +1 -0
  83. package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js +20 -0
  84. package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js.map +1 -0
  85. package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js +21 -0
  86. package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js.map +1 -0
  87. package/dist/hemfixarna-components/index-b6a6e994.js +256 -0
  88. package/dist/hemfixarna-components/index-b6a6e994.js.map +1 -0
  89. package/dist/{collection/types/index.js → hemfixarna-components/index-d90ad11b.js} +7 -4
  90. package/dist/hemfixarna-components/index-d90ad11b.js.map +1 -0
  91. package/dist/hemfixarna-components/index-f1a87cf1.js +3397 -0
  92. package/dist/{cjs/hemfixarna-address_36.cjs.entry.js.map → hemfixarna-components/index-f1a87cf1.js.map} +1 -1
  93. package/dist/hemfixarna-components/index.esm.js +1 -0
  94. package/dist/hemfixarna-components/index.esm.js.map +1 -1
  95. package/dist/{collection/utils/scroll.js → hemfixarna-components/scroll-6c26b5da.js} +4 -2
  96. package/dist/hemfixarna-components/scroll-6c26b5da.js.map +1 -0
  97. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +389 -0
  98. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +1 -0
  99. package/dist/{collection/utils/types.js → hemfixarna-components/types-641c9a1c.js} +6 -3
  100. package/dist/hemfixarna-components/types-641c9a1c.js.map +1 -0
  101. package/package.json +1 -1
  102. package/dist/cjs/hemfixarna-address_36.cjs.entry.js +0 -2763
  103. package/dist/cjs/hemfixarna-components.cjs.js +0 -28
  104. package/dist/cjs/hemfixarna-components.cjs.js.map +0 -1
  105. package/dist/cjs/index-b83343b9.js +0 -1687
  106. package/dist/cjs/index-b83343b9.js.map +0 -1
  107. package/dist/cjs/index.cjs.js +0 -4
  108. package/dist/cjs/index.cjs.js.map +0 -1
  109. package/dist/cjs/loader.cjs.js +0 -24
  110. package/dist/cjs/loader.cjs.js.map +0 -1
  111. package/dist/collection/assets/back.svg +0 -3
  112. package/dist/collection/assets/cart.svg +0 -10
  113. package/dist/collection/assets/checked.svg +0 -10
  114. package/dist/collection/assets/close.svg +0 -5
  115. package/dist/collection/assets/copy.png +0 -0
  116. package/dist/collection/assets/date.svg +0 -6
  117. package/dist/collection/assets/down.svg +0 -3
  118. package/dist/collection/assets/drag-drop.svg +0 -3
  119. package/dist/collection/assets/elfa.png +0 -0
  120. package/dist/collection/assets/gubbe-pensel.svg +0 -1
  121. package/dist/collection/assets/hemfixarna.svg +0 -11
  122. package/dist/collection/assets/hornbach/logo.svg +0 -42
  123. package/dist/collection/assets/hornbach/nav.jpg +0 -0
  124. package/dist/collection/assets/info.svg +0 -5
  125. package/dist/collection/assets/kbygg.svg +0 -29
  126. package/dist/collection/assets/minus.svg +0 -4
  127. package/dist/collection/assets/montering.svg +0 -15
  128. package/dist/collection/assets/norrgavel.svg +0 -1
  129. package/dist/collection/assets/pensel.svg +0 -1
  130. package/dist/collection/assets/plus.svg +0 -5
  131. package/dist/collection/assets/spinner.gif +0 -0
  132. package/dist/collection/assets/tesla.svg +0 -1
  133. package/dist/collection/assets/zaptec.svg +0 -1
  134. package/dist/collection/collection-manifest.json +0 -47
  135. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
  136. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +0 -184
  137. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +0 -1
  138. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.css +0 -0
  139. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +0 -123
  140. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +0 -1
  141. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.css +0 -0
  142. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +0 -142
  143. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +0 -1
  144. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +0 -132
  145. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +0 -1
  146. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +0 -132
  147. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +0 -1
  148. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.css +0 -0
  149. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +0 -123
  150. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +0 -1
  151. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.css +0 -0
  152. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +0 -142
  153. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +0 -1
  154. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +0 -132
  155. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +0 -1
  156. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +0 -113
  157. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +0 -1
  158. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +0 -113
  159. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +0 -1
  160. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +0 -132
  161. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +0 -1
  162. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +0 -131
  163. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +0 -1
  164. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
  165. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +0 -141
  166. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +0 -1
  167. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +0 -131
  168. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +0 -1
  169. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +0 -123
  170. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +0 -1
  171. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string.css +0 -0
  172. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +0 -113
  173. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +0 -1
  174. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +0 -132
  175. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +0 -1
  176. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +0 -113
  177. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +0 -1
  178. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +0 -132
  179. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +0 -1
  180. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +0 -1
  181. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +0 -138
  182. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +0 -1
  183. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +0 -1
  184. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +0 -1
  185. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +0 -1
  186. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +0 -1
  187. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +0 -483
  188. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +0 -1
  189. package/dist/collection/components/hemfixarna-component/hemfixarna.css +0 -1031
  190. package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +0 -1
  191. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +0 -135
  192. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +0 -1
  193. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +0 -91
  194. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +0 -1
  195. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +0 -1
  196. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.css +0 -76
  197. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +0 -1
  198. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +0 -1
  199. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +0 -1
  200. package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
  201. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +0 -1
  202. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +0 -1
  203. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +0 -1
  204. package/dist/collection/index.js +0 -2
  205. package/dist/collection/index.js.map +0 -1
  206. package/dist/collection/store/index.js +0 -62
  207. package/dist/collection/store/index.js.map +0 -1
  208. package/dist/collection/types/felixtypes.js +0 -3
  209. package/dist/collection/types/felixtypes.js.map +0 -1
  210. package/dist/collection/types/index.js.map +0 -1
  211. package/dist/collection/utils/api.js.map +0 -1
  212. package/dist/collection/utils/calc.js.map +0 -1
  213. package/dist/collection/utils/creditSafe.js +0 -18
  214. package/dist/collection/utils/creditSafe.js.map +0 -1
  215. package/dist/collection/utils/felixApi.js +0 -18
  216. package/dist/collection/utils/felixApi.js.map +0 -1
  217. package/dist/collection/utils/felixFunctions.js +0 -189
  218. package/dist/collection/utils/felixFunctions.js.map +0 -1
  219. package/dist/collection/utils/form.js.map +0 -1
  220. package/dist/collection/utils/scroll.js.map +0 -1
  221. package/dist/collection/utils/types.js.map +0 -1
  222. package/dist/esm/hemfixarna-address_36.entry.js +0 -2724
  223. package/dist/esm/hemfixarna-address_36.entry.js.map +0 -1
  224. package/dist/esm/hemfixarna-components.js +0 -23
  225. package/dist/esm/hemfixarna-components.js.map +0 -1
  226. package/dist/esm/index-8c417125.js +0 -1656
  227. package/dist/esm/index-8c417125.js.map +0 -1
  228. package/dist/esm/index.js +0 -3
  229. package/dist/esm/index.js.map +0 -1
  230. package/dist/esm/loader.js +0 -20
  231. package/dist/esm/loader.js.map +0 -1
  232. package/dist/esm/polyfills/core-js.js +0 -11
  233. package/dist/esm/polyfills/css-shim.js +0 -1
  234. package/dist/esm/polyfills/dom.js +0 -79
  235. package/dist/esm/polyfills/es5-html-element.js +0 -1
  236. package/dist/esm/polyfills/index.js +0 -34
  237. package/dist/esm/polyfills/system.js +0 -6
  238. package/dist/hemfixarna-components/p-211cfa04.entry.js +0 -2
  239. package/dist/hemfixarna-components/p-211cfa04.entry.js.map +0 -1
  240. package/dist/hemfixarna-components/p-852e7173.js +0 -3
  241. package/dist/hemfixarna-components/p-852e7173.js.map +0 -1
  242. package/dist/index.cjs.js +0 -1
  243. package/dist/index.js +0 -1
@@ -1,2763 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b83343b9.js');
6
-
7
- const appendToMap = (map, propName, value) => {
8
- const items = map.get(propName);
9
- if (!items) {
10
- map.set(propName, [value]);
11
- }
12
- else if (!items.includes(value)) {
13
- items.push(value);
14
- }
15
- };
16
- const debounce = (fn, ms) => {
17
- let timeoutId;
18
- return (...args) => {
19
- if (timeoutId) {
20
- clearTimeout(timeoutId);
21
- }
22
- timeoutId = setTimeout(() => {
23
- timeoutId = 0;
24
- fn(...args);
25
- }, ms);
26
- };
27
- };
28
-
29
- /**
30
- * Check if a possible element isConnected.
31
- * The property might not be there, so we check for it.
32
- *
33
- * We want it to return true if isConnected is not a property,
34
- * otherwise we would remove these elements and would not update.
35
- *
36
- * Better leak in Edge than to be useless.
37
- */
38
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
39
- const cleanupElements = debounce((map) => {
40
- for (let key of map.keys()) {
41
- map.set(key, map.get(key).filter(isConnected));
42
- }
43
- }, 2000);
44
- const stencilSubscription = () => {
45
- if (typeof index.getRenderingRef !== 'function') {
46
- // If we are not in a stencil project, we do nothing.
47
- // This function is not really exported by @stencil/core.
48
- return {};
49
- }
50
- const elmsToUpdate = new Map();
51
- return {
52
- dispose: () => elmsToUpdate.clear(),
53
- get: (propName) => {
54
- const elm = index.getRenderingRef();
55
- if (elm) {
56
- appendToMap(elmsToUpdate, propName, elm);
57
- }
58
- },
59
- set: (propName) => {
60
- const elements = elmsToUpdate.get(propName);
61
- if (elements) {
62
- elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
63
- }
64
- cleanupElements(elmsToUpdate);
65
- },
66
- reset: () => {
67
- elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
68
- cleanupElements(elmsToUpdate);
69
- },
70
- };
71
- };
72
-
73
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
74
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
75
- const unwrappedState = unwrap(defaultState);
76
- let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
77
- const handlers = {
78
- dispose: [],
79
- get: [],
80
- set: [],
81
- reset: [],
82
- };
83
- const reset = () => {
84
- var _a;
85
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
86
- // otherwise, the state won't be properly reset
87
- states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
88
- handlers.reset.forEach((cb) => cb());
89
- };
90
- const dispose = () => {
91
- // Call first dispose as resetting the state would
92
- // cause less updates ;)
93
- handlers.dispose.forEach((cb) => cb());
94
- reset();
95
- };
96
- const get = (propName) => {
97
- handlers.get.forEach((cb) => cb(propName));
98
- return states.get(propName);
99
- };
100
- const set = (propName, value) => {
101
- const oldValue = states.get(propName);
102
- if (shouldUpdate(value, oldValue, propName)) {
103
- states.set(propName, value);
104
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
105
- }
106
- };
107
- const state = (typeof Proxy === 'undefined'
108
- ? {}
109
- : new Proxy(unwrappedState, {
110
- get(_, propName) {
111
- return get(propName);
112
- },
113
- ownKeys(_) {
114
- return Array.from(states.keys());
115
- },
116
- getOwnPropertyDescriptor() {
117
- return {
118
- enumerable: true,
119
- configurable: true,
120
- };
121
- },
122
- has(_, propName) {
123
- return states.has(propName);
124
- },
125
- set(_, propName, value) {
126
- set(propName, value);
127
- return true;
128
- },
129
- }));
130
- const on = (eventName, callback) => {
131
- handlers[eventName].push(callback);
132
- return () => {
133
- removeFromArray(handlers[eventName], callback);
134
- };
135
- };
136
- const onChange = (propName, cb) => {
137
- const unSet = on('set', (key, newValue) => {
138
- if (key === propName) {
139
- cb(newValue);
140
- }
141
- });
142
- // We need to unwrap the defaultState because it might be a function.
143
- // Otherwise we might not be sending the right reset value.
144
- const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
145
- return () => {
146
- unSet();
147
- unReset();
148
- };
149
- };
150
- const use = (...subscriptions) => {
151
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
152
- if (subscription.set) {
153
- unsubs.push(on('set', subscription.set));
154
- }
155
- if (subscription.get) {
156
- unsubs.push(on('get', subscription.get));
157
- }
158
- if (subscription.reset) {
159
- unsubs.push(on('reset', subscription.reset));
160
- }
161
- if (subscription.dispose) {
162
- unsubs.push(on('dispose', subscription.dispose));
163
- }
164
- return unsubs;
165
- }, []);
166
- return () => unsubs.forEach((unsub) => unsub());
167
- };
168
- const forceUpdate = (key) => {
169
- const oldValue = states.get(key);
170
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
171
- };
172
- return {
173
- state,
174
- get,
175
- set,
176
- on,
177
- onChange,
178
- use,
179
- dispose,
180
- reset,
181
- forceUpdate,
182
- };
183
- };
184
- const removeFromArray = (array, item) => {
185
- const index = array.indexOf(item);
186
- if (index >= 0) {
187
- array[index] = array[array.length - 1];
188
- array.length--;
189
- }
190
- };
191
-
192
- const createStore = (defaultState, shouldUpdate) => {
193
- const map = createObservableMap(defaultState, shouldUpdate);
194
- map.use(stencilSubscription());
195
- return map;
196
- };
197
-
198
- const { state, onChange, } = createStore({
199
- step: 1,
200
- checkoutStep: 1,
201
- checkoutEdit: false,
202
- selectedCategory: null,
203
- selectedService: null,
204
- selectedProduct: null,
205
- cart: [],
206
- business: 'undefined',
207
- options: null,
208
- rut: true,
209
- rot: true,
210
- green: true,
211
- token: null,
212
- user: null,
213
- modal: null,
214
- rutOptions: null,
215
- rotOptions: null,
216
- greenOptions: null,
217
- customer: null,
218
- selectedCustomerCategory: null,
219
- parentCategory: null,
220
- creditSafeUser: null,
221
- checkoutInvoice: false,
222
- maleri: false,
223
- sources: null,
224
- });
225
- onChange('cart', cart => {
226
- window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
227
- });
228
- onChange('user', user => {
229
- window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
230
- });
231
- onChange('creditSafeUser', user => {
232
- window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
233
- });
234
- onChange('selectedProduct', product => {
235
- if (!state.customer || !product)
236
- return;
237
- const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
238
- const category = categories.find(c => c && c.id === product.category);
239
- if (category) {
240
- state.parentCategory = category;
241
- return;
242
- }
243
- state.parentCategory = null;
244
- });
245
- onChange('selectedCustomerCategory', category => {
246
- if (!state.customer || !category)
247
- return;
248
- if (category.parent) {
249
- const parent = state.customer.categories.find(c => c.id === category.parent);
250
- if (parent) {
251
- state.parentCategory = parent;
252
- return;
253
- }
254
- }
255
- state.parentCategory = null;
256
- });
257
-
258
- const hideField = (field) => {
259
- return field.split(' ').reduce((acc, curr) => {
260
- if (curr.length <= 2) {
261
- return acc + curr.slice(0, 1) + '* ';
262
- }
263
- else {
264
- return acc + curr.slice(0, 1) + '*'.repeat(curr.length - 2) + curr.slice(-1) + ' ';
265
- }
266
- }, '');
267
- };
268
-
269
- const scrollToTop = (el) => {
270
- if (!el)
271
- return;
272
- el.scrollTo({
273
- top: 0,
274
- behavior: 'smooth',
275
- });
276
- };
277
-
278
- const HemfixarnaAddress = class {
279
- constructor(hostRef) {
280
- index.registerInstance(this, hostRef);
281
- this.handleSubmit = (e) => {
282
- e.preventDefault();
283
- const streetValid = this.street.length > 0;
284
- if (!streetValid) {
285
- this.streetError = 'Ange en gatuadress';
286
- }
287
- const zipValid = this.zip.length > 0;
288
- const zipIsNumber = /^\s*\d[\d\s]*$/.test(this.zip);
289
- if (!zipIsNumber) {
290
- this.zipError = 'Postnummer får endast innehålla siffror';
291
- }
292
- if (!zipValid) {
293
- this.zipError = 'Ange ett postnummer';
294
- }
295
- const townValid = /^[^\d\s]{2,}$/.test(this.town);
296
- if (!townValid) {
297
- this.townError = 'Ange en ort';
298
- }
299
- if (streetValid && zipValid && townValid && zipIsNumber) {
300
- state.user = Object.assign(Object.assign({}, state.user), { street: this.street, zip: this.zip, town: this.town });
301
- state.checkoutStep = 2;
302
- state.checkoutEdit = false;
303
- const el = this.el.closest('.hemfixarna_content');
304
- scrollToTop(el);
305
- }
306
- };
307
- this.handleChangeStreet = (e) => {
308
- this.streetError = null;
309
- this.street = this.street === state.user.street ? '' : e.target.value;
310
- };
311
- this.handleChangeZip = (e) => {
312
- this.zipError = null;
313
- this.zip = this.zip === state.user.zip ? '' : e.target.value;
314
- };
315
- this.handleChangeTown = (e) => {
316
- this.townError = null;
317
- this.town = this.town === state.user.town ? '' : e.target.value;
318
- };
319
- this.render = () => {
320
- return (index.h("form", { class: "hemfixarna_address", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.street.length ? 'input_active' : ''}`, onInput: this.handleChangeStreet, type: "text", name: "street", value: this.street === state.user.street ? hideField(this.street) : this.street }), index.h("label", { htmlFor: "street" }, "Gatuaddress ")), this.streetError && index.h("span", null, this.streetError), index.h("div", null, index.h("input", { class: `${this.zip.length ? 'input_active' : ''}`, onInput: this.handleChangeZip, type: "tel", name: "zip", value: this.zip === state.user.zip ? hideField(this.zip) : this.zip }), index.h("label", { htmlFor: "zip" }, "Postnummer ")), this.zipError && index.h("span", null, this.zipError), index.h("div", null, index.h("input", { class: `${this.town.length ? 'input_active' : ''}`, onInput: this.handleChangeTown, type: "text", name: "town", value: this.town === state.user.town ? hideField(this.town) : this.town }), index.h("label", { htmlFor: "town" }, "Ort ")), this.townError && index.h("span", null, this.townError), index.h("input", { type: "submit", value: "Forts\u00E4tt" })));
321
- };
322
- this.street = '';
323
- this.streetError = null;
324
- this.zip = '';
325
- this.zipError = null;
326
- this.town = '';
327
- this.townError = null;
328
- }
329
- componentWillLoad() {
330
- if (state.user) {
331
- this.street = state.user.street;
332
- this.zip = state.user.zip;
333
- this.town = state.user.town;
334
- }
335
- }
336
- get el() { return index.getElement(this); }
337
- };
338
-
339
- const getRutPrice = (price) => {
340
- return Math.ceil(price / 2);
341
- };
342
- const getRotPrice = (price) => {
343
- return Math.ceil(price * 0.7);
344
- };
345
- const getGreenPrice = (price) => {
346
- return Math.ceil(price * 0.5);
347
- };
348
- const getProductPrice = (product, price, amount = 1) => {
349
- if (product.rot && state.rot) {
350
- return getRotPrice((price || product.price) * amount);
351
- }
352
- else if (product.rut && state.rut) {
353
- return getRutPrice((price || product.price) * amount);
354
- }
355
- else if (product.green && state.green) {
356
- return getGreenPrice((price || product.price) * amount);
357
- }
358
- else {
359
- return (price || product.price) * amount;
360
- }
361
- };
362
- const getProductPriceWithRotAndRut = (product) => {
363
- if (product.rot) {
364
- return getRotPrice(product.price);
365
- }
366
- else if (product.rut && state.rut) {
367
- return getRutPrice(product.price);
368
- }
369
- else {
370
- return product.price;
371
- }
372
- };
373
- const getPartPrice = (part, product, amount = 1) => {
374
- if (product.rot && state.rot) {
375
- return getRotPrice(part.price * amount);
376
- }
377
- else if (product.rut && state.rut) {
378
- return getRutPrice(part.price * amount);
379
- }
380
- else {
381
- return part.price * amount;
382
- }
383
- };
384
- const getStartFee = () => {
385
- if (!state.cart)
386
- return { rut: 0, rot: 0, green: 0 };
387
- const hasRut = state.cart.some(item => item.rut && item.start_fee);
388
- const hasRot = state.cart.some(item => item.rot && item.start_fee);
389
- const hasGreen = state.cart.some(item => item.green && item.start_fee);
390
- const rutPrice = state.rut ? getRutPrice(state.options.start_fee) : state.options.start_fee * 1;
391
- const rotPrice = state.rot ? getRotPrice(state.options.start_fee) : state.options.start_fee * 1;
392
- const greenPrice = state.green ? getGreenPrice(state.options.start_fee) : state.options.start_fee * 1;
393
- return { rut: hasRut ? rutPrice : 0, rot: hasRot ? rotPrice : 0, green: hasGreen ? greenPrice : 0, length: [hasRut, hasRot, hasGreen].filter(d => d).length };
394
- // if (hasRut && hasRot) {
395
- // return { rut: rutPrice, rot: rotPrice, length: 2 };
396
- // } else if (hasRut) {
397
- // return { rut: rutPrice, rot: 0, length: 1 };
398
- // } else if (hasRot) {
399
- // return { rut: 0, rot: rotPrice, length: 1 };
400
- // } else {
401
- // return { rut: 0, rot: 0, length: 0 };
402
- // }
403
- };
404
- const getItemPrice = (item) => {
405
- const partsPrice = item.parts.reduce((acc, curr) => {
406
- return acc + curr.price * curr.amount;
407
- }, 0);
408
- return getProductPrice(item, item.price * item.amount + partsPrice);
409
- };
410
- const calculateRot = () => {
411
- const totalWithRot = state.cart.reduce((acc, curr) => {
412
- return curr.rot ? acc + getItemPrice(curr) : acc;
413
- }, 0) + getStartFee().rot;
414
- const totalWithoutRot = state.cart.reduce((acc, curr) => {
415
- const partsPrice = curr.parts.reduce((acc, curr) => {
416
- return acc + curr.price * curr.amount;
417
- }, 0);
418
- return curr.rot ? acc + curr.price * curr.amount + partsPrice : acc;
419
- }, 0) + Number(state.options.start_fee);
420
- return totalWithoutRot - totalWithRot;
421
- };
422
- const calculateRut = () => {
423
- const totalWithRut = state.cart.reduce((acc, curr) => {
424
- return curr.rut ? acc + getItemPrice(curr) : acc;
425
- }, 0) + getStartFee().rut;
426
- const totalWithoutRut = state.cart.reduce((acc, curr) => {
427
- const partsPrice = curr.parts.reduce((acc, curr) => {
428
- return acc + curr.price * curr.amount;
429
- }, 0);
430
- return curr.rut ? acc + curr.price * curr.amount + partsPrice : acc;
431
- }, 0) + Number(state.options.start_fee);
432
- return totalWithoutRut - totalWithRut;
433
- };
434
- const calculateGreenDiscount = () => {
435
- const totalWithGreen = state.cart.reduce((acc, curr) => {
436
- return curr.green ? acc + getItemPrice(curr) : acc;
437
- }, 0) + getStartFee().green;
438
- const totalWithoutGreen = state.cart.reduce((acc, curr) => {
439
- const partsPrice = curr.parts.reduce((acc, curr) => {
440
- return acc + curr.price * curr.amount;
441
- }, 0);
442
- return curr.green ? acc + curr.price * curr.amount + partsPrice : acc;
443
- }, 0) + Number(state.options.start_fee);
444
- return totalWithoutGreen - totalWithGreen;
445
- };
446
- const getTotalPrice = () => {
447
- return state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;
448
- };
449
-
450
- var Business;
451
- (function (Business) {
452
- Business["kund"] = "kund";
453
- Business["byggmax"] = "byggmax";
454
- Business["skanska"] = "skanska";
455
- Business["string"] = "string-furniture";
456
- Business["hornbach"] = "hornbach";
457
- Business["forebygg"] = "forebygg";
458
- Business["doro"] = "doro";
459
- Business["elfa"] = "elfa";
460
- Business["kbygg"] = "k-bygg";
461
- Business["norrgavel"] = "norrgavel";
462
- Business["fargvaruhuset"] = "fargvaruhuset";
463
- Business["zaptec"] = "zaptec";
464
- Business["tesla"] = "tesla";
465
- Business["klint"] = "klint";
466
- Business["flyttsmart"] = "flyttsmart";
467
- Business["lg"] = "lg";
468
- Business["sparfonster"] = "sparfonster";
469
- Business["power"] = "power";
470
- Business["traningspartner"] = "traningspartner";
471
- Business["superfront"] = "superfront";
472
- })(Business || (Business = {}));
473
- var WidgetStyle;
474
- (function (WidgetStyle) {
475
- WidgetStyle["standard"] = "standard";
476
- WidgetStyle["alternative"] = "alternative";
477
- WidgetStyle["alternative_2"] = "alternative_2";
478
- WidgetStyle["alternative_3"] = "alternative_3";
479
- })(WidgetStyle || (WidgetStyle = {}));
480
- var TopCategory;
481
- (function (TopCategory) {
482
- TopCategory["byggmax"] = "category/bygg";
483
- })(TopCategory || (TopCategory = {}));
484
-
485
- const isProduct = (category) => {
486
- return category.post_name !== undefined;
487
- };
488
- const isBusiness = (partner) => {
489
- return Object.values(Business).includes(partner);
490
- };
491
-
492
- const HemfixarnaBox = class {
493
- constructor(hostRef) {
494
- index.registerInstance(this, hostRef);
495
- this.post = undefined;
496
- this.category = undefined;
497
- this.icon = undefined;
498
- this.postTitle = undefined;
499
- }
500
- setTaxonomy(taxonomy) {
501
- if (taxonomy) {
502
- if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
503
- state.selectedCategory = taxonomy;
504
- state.step = 2;
505
- }
506
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
507
- state.selectedService = taxonomy;
508
- state.step = 3;
509
- }
510
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
511
- state.selectedProduct = taxonomy;
512
- state.step = 4;
513
- }
514
- const el = this.el.closest('.hemfixarna_content');
515
- scrollToTop(el);
516
- }
517
- }
518
- setProduct() {
519
- state.selectedProduct = this.category;
520
- state.step = 4;
521
- state.selectedCustomerCategory = null;
522
- const el = this.el.closest('.hemfixarna_content');
523
- scrollToTop(el);
524
- }
525
- render() {
526
- return this.category ? (index.h(index.Fragment, null, isProduct(this.category) ? (index.h("li", { onClick: () => this.setProduct() }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.post_name }), index.h("div", null, index.h("p", null, this.category.title), !this.category.invoice ? index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.category), "kr") : null))) : (index.h("li", { onClick: () => (state.selectedCustomerCategory = this.category) }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.name }), index.h("div", null, index.h("p", null, this.category.name)))))) : (index.h("li", { onClick: () => this.setTaxonomy(this.post) }, this.post.icon && index.h("img", { class: "hemfixarna_logo", height: 82, src: this.icon, alt: this.postTitle }), index.h("div", null, index.h("p", null, this.postTitle), state.step === 3 && index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
527
- }
528
- get el() { return index.getElement(this); }
529
- };
530
-
531
- const HemfixarnaBreadcrumbs = class {
532
- constructor(hostRef) {
533
- index.registerInstance(this, hostRef);
534
- this.triggerScrollTotop = () => {
535
- const el = this.el.nextSibling;
536
- scrollToTop(el);
537
- };
538
- this.tree = undefined;
539
- this.closeModal = undefined;
540
- this.loadFromQuery = false;
541
- this.isDemo = false;
542
- }
543
- getCartLength() {
544
- return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
545
- }
546
- handleCartClick() {
547
- var _a;
548
- if ((_a = state.cart) === null || _a === void 0 ? void 0 : _a.length) {
549
- state.step = 5;
550
- this.triggerScrollTotop();
551
- }
552
- }
553
- handleHomePageClick() {
554
- state.step = 1;
555
- state.parentCategory = null;
556
- state.selectedCustomerCategory = null;
557
- this.triggerScrollTotop();
558
- setTimeout(() => {
559
- state.selectedCategory = null;
560
- state.selectedProduct = null;
561
- state.maleri = null;
562
- state.selectedService = null;
563
- }, 200);
564
- }
565
- render() {
566
- const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
567
- const close = index.getAssetPath(`./assets/close.svg`);
568
- const cart = index.getAssetPath(`./assets/cart.svg`);
569
- const back = index.getAssetPath(`./assets/back.svg`);
570
- return (index.h("div", null, index.h("div", { class: "hemfixarna_crumbs" }, index.h("div", { class: "hemfixarna_crumbs--links" }, index.h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), !this.loadFromQuery || this.isDemo ? index.h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }) : null, index.h("div", null, index.h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), index.h("div", { class: "hemfixarna_crumbs--right" }, index.h("hemfixarna-contact", null), index.h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, index.h("img", { src: cart, width: 24 }), index.h("span", null, this.getCartLength())))), [3, 4].includes(state.step) && !state.customer && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
571
- state.step = state.step === 4 ? 3 : 2;
572
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name))), !state.parentCategory && state.step && state.selectedCustomerCategory && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
573
- state.step = 1;
574
- state.selectedCustomerCategory = null;
575
- state.selectedProduct = null;
576
- state.maleri = null;
577
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se alla tj\u00E4nster"))), state.parentCategory && state.step < 5 && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
578
- state.step = 1;
579
- state.selectedCustomerCategory = state.parentCategory;
580
- state.selectedProduct = null;
581
- state.maleri = null;
582
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.parentCategory.name)))));
583
- }
584
- get el() { return index.getElement(this); }
585
- };
586
-
587
- const hemfixarnaByggmaxCss = "";
588
-
589
- const MyComponent$j = class {
590
- constructor(hostRef) {
591
- index.registerInstance(this, hostRef);
592
- this.tree = null;
593
- this.slug = undefined;
594
- this.id = undefined;
595
- this.forceOldTree = false;
596
- this.loadFromQuery = undefined;
597
- this.customer = undefined;
598
- this.widgetStyle = WidgetStyle.standard;
599
- this.buttonColor = undefined;
600
- this.buttonBg = undefined;
601
- }
602
- render() {
603
- return (index.h("hemfixarna-component", { forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax, loadFromQuery: Boolean(this.loadFromQuery), widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor }));
604
- }
605
- };
606
- MyComponent$j.style = hemfixarnaByggmaxCss;
607
-
608
- const HemfixarnaCart = class {
609
- constructor(hostRef) {
610
- index.registerInstance(this, hostRef);
611
- this.tree = undefined;
612
- }
613
- render() {
614
- const back = index.getAssetPath(`./assets/back.svg`);
615
- return (index.h("div", { class: "hemfixarna_cart" }, index.h("div", { class: "hemfixarna_cart--left" }, index.h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (index.h("button", { onClick: () => {
616
- state.checkoutStep = 1;
617
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Din bokning"), index.h("hemfixarna-orderrows", { tree: this.tree })), index.h("div", { class: "hemfixarna_cart--right" }, index.h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (index.h("button", { onClick: () => {
618
- state.checkoutStep = 1;
619
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }))), "Dina uppgifter"), index.h("hemfixarna-checkout", null), index.h("hemfixarna-info", null))));
620
- }
621
- };
622
-
623
- const HemfixarnaCategory = class {
624
- constructor(hostRef) {
625
- index.registerInstance(this, hostRef);
626
- }
627
- setSelectedService(service) {
628
- state.selectedService = service;
629
- state.step = 3;
630
- }
631
- render() {
632
- return (index.h("div", null, index.h("h2", null, state.selectedCategory.name), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("div", null, index.h("ul", { class: "hemfixarna_categories" }, state.selectedCategory.services
633
- .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
634
- .map(s => {
635
- var _a;
636
- return (index.h("hemfixarna-box", { post: s, icon: (_a = s.icon.url) !== null && _a !== void 0 ? _a : s.icon, postTitle: s.post_title }));
637
- }))), index.h("hemfixarna-info", null))));
638
- }
639
- };
640
-
641
- const base$2 = `${"https://hemfixarna.se"}/wp-json/headless` ;
642
- async function fetchWithType(request, options) {
643
- const response = await fetch(request, options);
644
- const body = await response.json();
645
- return body;
646
- }
647
- const getTaxonomy = async (endpoint) => {
648
- if (!endpoint) {
649
- return;
650
- }
651
- const type = endpoint.split('/')[0];
652
- const slug = endpoint.split('/')[1];
653
- try {
654
- const res = await fetch(`${base$2}/${type}/${slug}`);
655
- return await res.json();
656
- }
657
- catch (error) {
658
- console.log(error);
659
- }
660
- };
661
- const getCustomer = async (slug) => {
662
- try {
663
- const res = await fetch(`${base$2}/customer/${slug}`);
664
- return await res.json();
665
- }
666
- catch (error) {
667
- console.log(error);
668
- }
669
- };
670
- const getOptions = async () => {
671
- try {
672
- const res = await fetch(`${base$2}/webcoptions`);
673
- return (await res.json());
674
- }
675
- catch (error) {
676
- console.log(error);
677
- }
678
- };
679
- const getRut = async () => {
680
- try {
681
- const data = await fetchWithType(`${base$2}/rut`);
682
- return data;
683
- }
684
- catch (error) {
685
- console.log(error);
686
- }
687
- };
688
- const getRot = async () => {
689
- try {
690
- const res = await fetch(`${base$2}/rot`);
691
- return (await res.json());
692
- }
693
- catch (error) {
694
- console.log(error);
695
- }
696
- };
697
- const getGreenDiscount = async () => {
698
- try {
699
- const res = await fetch(`${base$2}/green-discount`);
700
- return await res.json();
701
- }
702
- catch (error) {
703
- console.log(error);
704
- }
705
- };
706
- const postOrder = async (data) => {
707
- try {
708
- const res = await fetch(`${base$2}/weborder`, {
709
- method: 'POST',
710
- body: JSON.stringify(data),
711
- headers: {
712
- 'Content-Type': 'application/json',
713
- },
714
- });
715
- return (await res.json());
716
- }
717
- catch (error) {
718
- console.log(error);
719
- }
720
- };
721
-
722
- const base$1 = `${"https://hemfixarna.se"}/wp-json/felix` ;
723
- const postPerson = async (felixOrder) => {
724
- try {
725
- return await fetchWithType(`${base$1}/createperson`, {
726
- method: 'POST',
727
- body: JSON.stringify(felixOrder),
728
- headers: {
729
- 'Content-Type': 'application/json',
730
- },
731
- });
732
- }
733
- catch (error) {
734
- console.log(error);
735
- }
736
- };
737
-
738
- const HemfixarnaCheckout = class {
739
- constructor(hostRef) {
740
- index.registerInstance(this, hostRef);
741
- this.handleChangeDate = (e) => {
742
- this.dateError = null;
743
- this.date = e.target.value;
744
- };
745
- this.handleChangeTerms = () => {
746
- this.generalError = null;
747
- };
748
- this.sendOrder = async () => {
749
- var _a, _b, _c, _d, _e;
750
- if (this.loading)
751
- return;
752
- this.loading = true;
753
- let order = {
754
- firstName: state.creditSafeUser.firstName,
755
- lastName: state.creditSafeUser.lastName,
756
- street: state.user.street,
757
- zip: state.user.zip,
758
- town: state.user.town,
759
- ssn: state.user.ssn,
760
- email: state.user.email,
761
- phone: state.user.phone,
762
- url: `${state.business === Business.string ? 'string' : state.business}-webk`,
763
- date: this.date,
764
- products: [
765
- ...state.cart.map(item => {
766
- const parts = item.parts.map(part => ({
767
- id: String(part.id),
768
- name: part.name,
769
- quantity: part.amount,
770
- rut: 0,
771
- rot: 0,
772
- }));
773
- return [
774
- {
775
- id: String(item.id),
776
- name: item.name,
777
- quantity: item.amount,
778
- rot: item.rot ? 1 : 0,
779
- rut: item.rut ? 1 : 0,
780
- },
781
- ...parts,
782
- ];
783
- }),
784
- ].flat(),
785
- creditSafe: state.creditSafeUser,
786
- customer: state.business,
787
- id_source: state.customer.source ? state.customer.source.fieldData._id : '',
788
- id_sub_source: (_a = this.selectedSubSource) !== null && _a !== void 0 ? _a : '',
789
- seller_id: (_b = this.sellerID) !== null && _b !== void 0 ? _b : '',
790
- referral_id: (_c = this.RefferalID) !== null && _c !== void 0 ? _c : '',
791
- };
792
- const felixOrder = await postPerson(order);
793
- if (!felixOrder || !((_e = (_d = felixOrder.response) === null || _d === void 0 ? void 0 : _d.scriptResult) === null || _e === void 0 ? void 0 : _e.includes('OK'))) {
794
- order = Object.assign(Object.assign({}, order), { felixStatus: 'error' });
795
- }
796
- else {
797
- order = Object.assign(Object.assign({}, order), { felixStatus: 'success' });
798
- }
799
- try {
800
- const { data: orderConfirm, status } = await postOrder(order);
801
- if (orderConfirm && status && status === 200) {
802
- state.step = 6;
803
- const el = this.el.closest('.hemfixarna_content');
804
- scrollToTop(el);
805
- }
806
- else {
807
- this.generalError = 'Något gick fel, försök igen senare';
808
- }
809
- }
810
- catch (error) {
811
- this.generalError = 'Något gick fel, försök igen senare';
812
- }
813
- this.loading = false;
814
- };
815
- this.handleSubmit = (e) => {
816
- e.preventDefault();
817
- this.generalError = null;
818
- const validDate = this.date.length > 0;
819
- if (!validDate) {
820
- this.dateError = 'Ange ett giltigt datum';
821
- }
822
- const checkBoxes = Array.from(this.el.querySelectorAll('input[type="checkbox"]'));
823
- const notValidTerms = checkBoxes.find(i => !i.checked);
824
- if (notValidTerms) {
825
- this.generalError = 'Du måste godkänna villkoren';
826
- }
827
- // if (state.customer.source) {
828
- // if (!this.sellerID) {
829
- // this.generalError = 'Ange säljare';
830
- // return;
831
- // }
832
- // if (state.customer.source.sub_sources?.length && !this.selectedSubSource) {
833
- // this.generalError = 'Välj underkälla';
834
- // return;
835
- // }
836
- // }
837
- if (validDate && !notValidTerms) {
838
- this.sendOrder();
839
- }
840
- };
841
- this.handleKeyDown = (event) => {
842
- this.enteredPin += event.key;
843
- const correctPin = '+0033';
844
- if (this.enteredPin.length === correctPin.length) {
845
- if (this.enteredPin === correctPin) {
846
- localStorage.setItem('show_sources', 'true');
847
- this.showSources = true;
848
- window.removeEventListener('keydown', this.handleKeyDown);
849
- }
850
- this.enteredPin = '';
851
- }
852
- clearTimeout(this.pinTimeout);
853
- this.pinTimeout = setTimeout(() => (this.enteredPin = ''), 5000);
854
- };
855
- this.render = () => {
856
- var _a;
857
- const dateLogo = index.getAssetPath(`./assets/date.svg`);
858
- const down = index.getAssetPath(`./assets/down.svg`);
859
- const loading = index.getAssetPath(`./assets/spinner.gif`);
860
- if (state.checkoutEdit) {
861
- return index.h("hemfixarna-address", null);
862
- }
863
- else if (state.checkoutStep === 1) {
864
- return index.h("hemfixarna-getuser", null);
865
- }
866
- else if (state.checkoutStep === 2) {
867
- return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(state.user.firstName)), index.h("p", null, hideField(state.user.lastName)), index.h("p", null, state.user.email), index.h("p", null, state.user.phone)), index.h("div", null, index.h("p", null, hideField(state.user.street)), index.h("p", null, hideField(state.user.zip)), index.h("p", null, hideField(state.user.town))), index.h("button", { onClick: () => (state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), index.h("form", { onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("img", { src: dateLogo, width: 24 }), index.h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), index.h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), index.h("img", { src: down, width: 24 })), this.dateError && index.h("span", null, this.dateError), state.customer.source && this.showSources ? (index.h(index.Fragment, null, index.h("p", null, "Inloggad som:", index.h("strong", null, " ", state.customer.source.fieldData.So01_Name)), index.h("label", null, "S\u00E4ljare (S\u00E4ljarId)", index.h("input", { type: "text", value: this.sellerID, onChange: e => (this.sellerID = e.target.value) })), index.h("label", null, "PartnerOrderID (RefferalID)", index.h("input", { type: "text", value: this.RefferalID, onChange: e => (this.RefferalID = e.target.value) })), ((_a = state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) ? (index.h("div", null, index.h("select", { onChange: e => (this.selectedSubSource = e.target.value) }, index.h("option", { disabled: true, selected: true, value: "null" }, "V\u00E4lj underk\u00E4lla"), state.customer.source.sub_sources.map(sub => (index.h("option", { value: sub['So_SubSource::_id'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("h4", null, "Det finns inga underk\u00E4llor att v\u00E4lja")))) : null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", { innerHTML: state.options.terms })), state.cart
868
- .filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
869
- .map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
870
- }
871
- };
872
- this.date = '';
873
- this.dateError = null;
874
- this.generalError = null;
875
- this.loading = false;
876
- this.enteredPin = '';
877
- this.selectedSubSource = null;
878
- this.partnerOrderId = null;
879
- this.showSources = false;
880
- this.sellerID = null;
881
- this.RefferalID = null;
882
- }
883
- componentWillLoad() {
884
- if (Boolean(state.user && state.user.street)) {
885
- state.checkoutStep = 2;
886
- }
887
- if (state.customer && state.customer.source) {
888
- window.addEventListener('keydown', this.handleKeyDown);
889
- }
890
- const showSources = localStorage.getItem('show_sources');
891
- if (showSources) {
892
- this.showSources = true;
893
- }
894
- }
895
- disconnectedCallback() {
896
- window.removeEventListener('keydown', this.handleKeyDown);
897
- }
898
- get el() { return index.getElement(this); }
899
- };
900
-
901
- const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\");\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n* {\n box-sizing: border-box;\n}\n\n:host {\n font-family: \"Inter\", sans-serif;\n}\n:host input[type=text] {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host .mb-2 {\n margin-bottom: 32px;\n}\n:host button {\n color: #474444;\n}\n:host form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n position: relative;\n}\n:host form button {\n position: absolute;\n right: 0;\n top: -1rem;\n}\n:host form img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n pointer-events: none;\n}\n:host form img:first-of-type {\n left: 16px;\n}\n:host form img:last-of-type {\n right: 16px;\n}\n:host form span {\n margin-top: -8px;\n color: #ec6632;\n}\n:host form p {\n text-align: center;\n}\n:host form p {\n margin: 0;\n}\n:host form div {\n position: relative;\n}\n:host form div label {\n pointer-events: none;\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n background: #fff;\n padding: 4px;\n transition: 0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host form div input {\n padding: 16px;\n width: 100%;\n font-size: 16px;\n border: 1px solid #fcd9c9;\n}\n:host form div input:focus ~ label,\n:host form div .input_active ~ label {\n top: 0;\n transform: translateY(-50%);\n background: linear-gradient(180deg, #fffaf2 50%, #fff 50%);\n}\n:host form select {\n padding: 0.75rem 1rem;\n width: 100%;\n}\n:host h1 {\n font-size: 24px;\n font-weight: 400;\n line-height: 32px;\n letter-spacing: -3%;\n text-align: left;\n margin: 0 0 8px;\n}\n:host h2 {\n margin: 0 0 24px;\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n letter-spacing: -3%;\n}\n:host p {\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna {\n width: 100%;\n /* Hide default HTML checkbox */\n /* The slider */\n}\n:host .hemfixarna_contact {\n display: flex;\n gap: 16px;\n}\n:host .hemfixarna_contact a {\n display: flex;\n align-items: center;\n gap: 8px;\n color: #474444;\n text-decoration: none;\n font-weight: 600;\n font-size: 13px;\n}\n:host .hemfixarna_contact a:hover {\n text-decoration: underline;\n}\n:host .hemfixarna_contact--horizontal span {\n display: none;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_contact--horizontal span {\n display: initial;\n }\n}\n:host .hemfixarna_painting {\n opacity: 0;\n padding: 0 1rem;\n animation: fadeIn 0.5s forwards 0.3s;\n}\n:host .hemfixarna_painting > h2,\n:host .hemfixarna_painting p {\n text-align: center;\n padding: 0 16px;\n}\n:host .hemfixarna_painting > h2 {\n margin: 0 0 8px;\n}\n:host .hemfixarna_partnerlogo {\n max-height: 50px;\n min-height: 45px;\n object-fit: contain;\n max-width: 150px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_partnerlogo {\n max-width: 200px;\n }\n}\n:host .hemfixarna_nav {\n position: absolute;\n top: 0;\n width: 100dvw;\n left: 0;\n height: 80px;\n z-index: 9999;\n}\n:host .hemfixarna_nav--links {\n display: none !important;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav--links {\n display: flex !important;\n }\n}\n:host .hemfixarna_nav--links a {\n color: #ec6632;\n text-decoration: none;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 56px;\n padding: 8px 32px;\n text-transform: capitalize;\n}\n:host .hemfixarna_nav > div {\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 16px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_nav > div {\n padding: 0 32px;\n }\n}\n:host .hemfixarna_nav > div > div {\n display: flex;\n gap: 32px;\n justify-content: space-between;\n}\n:host .hemfixarna_nav > div > img {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: -1;\n}\n:host .hemfixarna_nav a {\n text-decoration: none;\n}\n:host .hemfixarna_nav p {\n color: #474444;\n}\n:host .hemfixarna_nav p.with-bg {\n color: #fff;\n}\n:host .hemfixarna_standalone .hemfixarna_backdrop {\n background: #fffaf2;\n opacity: 1;\n}\n:host .hemfixarna_standalone .hemfixarna_modal {\n top: 80px;\n transform: translateX(-50%);\n border: none;\n height: calc(100dvh - 80px);\n opacity: 0;\n}\n:host .hemfixarna_standalone .hemfixarna_modal--open {\n opacity: 1;\n}\n:host .hemfixarna .switch {\n position: relative;\n display: inline-block;\n width: 40px;\n height: 20px;\n}\n:host .hemfixarna .switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n:host .hemfixarna .slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 34px;\n}\n:host .hemfixarna .slider:before {\n position: absolute;\n content: \"\";\n height: 18px;\n width: 18px;\n left: 2px;\n bottom: 1px;\n background-color: white;\n -webkit-transition: 0.4s;\n transition: 0.4s;\n border-radius: 50%;\n}\n:host .hemfixarna input:checked + .slider {\n background-color: #fcd9c9;\n}\n:host .hemfixarna input:focus + .slider {\n box-shadow: 0 0 1px #fcd9c9;\n}\n:host .hemfixarna input:checked + .slider:before {\n -webkit-transform: translateX(18px);\n -ms-transform: translateX(18px);\n transform: translateX(18px);\n background: #ec6632;\n}\n:host .hemfixarna_maleribox {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n width: 100%;\n min-height: 132px;\n padding: 24px;\n display: flex;\n align-items: center;\n gap: 24px;\n text-align: left;\n}\n:host .hemfixarna_maleribox:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_checkbox {\n display: grid;\n grid-template-columns: 40px auto;\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n letter-spacing: -3%;\n}\n:host .hemfixarna_checkbox > span {\n transform: translateY(6px);\n}\n:host .hemfixarna_checkbox span,\n:host .hemfixarna_checkbox span p {\n color: #474444;\n font-size: 14px;\n}\n:host .hemfixarna_checkbox p {\n text-align: left;\n}\n:host .hemfixarna_info {\n display: flex;\n flex-direction: column;\n gap: 24px;\n padding: 32px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n border-radius: 4px;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_info h2 {\n margin: 0;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_info {\n position: sticky;\n top: 0;\n }\n}\n:host .hemfixarna_infomodal {\n position: absolute;\n top: 40%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n max-width: 80%;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n padding: 32px;\n z-index: 99;\n border-radius: 4px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .hemfixarna_infomodal p,\n:host .hemfixarna_infomodal h4 {\n margin: 0;\n}\n:host .hemfixarna_infomodal button {\n background: #ec6632;\n color: #fff;\n border-radius: 60px;\n font-size: 16px;\n padding: 8px 16px;\n}\n:host .hemfixarna_addressinfo {\n padding: 16px 16px 64px;\n border: 1px solid #fcd9c9;\n position: relative;\n margin-bottom: 32px;\n display: grid;\n grid-template-columns: 1fr;\n gap: 8px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_addressinfo {\n grid-template-columns: 1fr 1fr;\n }\n}\n:host .hemfixarna_addressinfo button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n font-weight: 500;\n text-underline-offset: 2px;\n text-decoration: underline;\n}\n:host .hemfixarna_part {\n background: #fff;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: grid;\n padding: 16px;\n grid-template-columns: auto 75px;\n}\n:host .hemfixarna_counter {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_counter span {\n padding: 0 8px;\n}\n:host .hemfixarna_counter img {\n cursor: pointer;\n}\n:host .hemfixarna_counter img:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_description {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_description ul {\n list-style: disc;\n padding-right: 12px;\n transform: translateX(12px);\n}\n:host .hemfixarna_description--hidden {\n max-height: 140px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n}\n:host .hemfixarna_description--hidden::after {\n content: \"\";\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 128px;\n background: linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2);\n}\n:host .hemfixarna_terms {\n font-size: 14px;\n}\n:host .hemfixarna_terms a {\n color: inherit;\n}\n:host .hemfixarna_logo {\n height: 64px;\n}\n:host .hemfixarna_box {\n padding: 16px;\n display: flex;\n align-items: center;\n width: 100%;\n box-sizing: border-box;\n border-radius: 4px;\n gap: 16px 8px;\n border-radius: 4px;\n gap: 16px 8px;\n}\n:host .hemfixarna_box p,\n:host .hemfixarna_box span {\n font-size: 15px;\n}\n:host .hemfixarna_box .underline {\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n:host .hemfixarna_box .pointer {\n cursor: pointer;\n}\n:host .hemfixarna_box .p-s {\n font-size: 12px;\n}\n:host .hemfixarna_box > div {\n display: grid;\n gap: 8px;\n}\n:host .hemfixarna_box--standard {\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n}\n:host .hemfixarna_box--alternative, :host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n background: transparent;\n border: 1px solid #e3e3e3;\n}\n:host .hemfixarna_box--alternative_2, :host .hemfixarna_box--alternative_3 {\n box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.0784313725);\n}\n:host .hemfixarna_box--alternative_3 {\n justify-content: center;\n}\n:host .hemfixarna_altbtn {\n display: flex !important;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n margin-left: auto;\n}\n:host .hemfixarna_btn {\n margin-left: auto;\n}\n:host .hemfixarna_btn, :host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n border: none;\n border-radius: 60px;\n font-weight: 600;\n letter-spacing: 0.5px;\n line-height: 20px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_btn:not(.disabled):hover, :host .hemfixarna_buy:not(.disabled):hover,\n:host .hemfixarna input[type=submit]:not(.disabled):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna div:has(> input[type=submit]) {\n position: relative;\n}\n:host .hemfixarna div:has(> input[type=submit]) input {\n cursor: pointer;\n}\n:host .hemfixarna div:has(> input[type=submit]) img {\n display: none;\n}\n:host .hemfixarna .loading {\n cursor: default;\n opacity: 0.6;\n}\n:host .hemfixarna .loading > img {\n display: initial !important;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n:host .hemfixarna_btn {\n font-size: 14px;\n background: #c84e18;\n color: #fff;\n padding: 16px 24px;\n white-space: nowrap;\n position: relative;\n}\n:host .hemfixarna_btn span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_btn span {\n background: #25a710;\n color: #fff;\n right: 0 !important;\n}\n:host .hemfixarna_buy,\n:host .hemfixarna input[type=submit] {\n font-size: 21px;\n background: #25a710;\n color: #fff;\n padding: 16px 24px;\n}\n:host .hemfixarna .disabled {\n opacity: 0.5;\n cursor: default;\n}\n:host .hemfixarna_modal {\n position: fixed;\n background: #fffaf2;\n border: 1px solid #fcd9c9;\n border-radius: 4px;\n top: 50%;\n left: 50%;\n z-index: 1000;\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n transform: translate(-50%, -50%) scale(0.7);\n opacity: 0;\n height: 92%;\n width: 92%;\n max-width: 920px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n:host .hemfixarna_modal--open {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n}\n:host .hemfixarna_backdrop {\n z-index: 999;\n position: fixed;\n background: #474444;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n opacity: 0;\n transition: transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946);\n}\n:host .hemfixarna_backdrop--open {\n opacity: 0.3;\n}\n:host .hemfixarna_order {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n background-repeat: no-repeat !important;\n background-size: cover !important;\n background-position: center !important;\n display: grid;\n grid-template-columns: 1fr 1fr;\n padding: 48px 32px 64px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_order {\n grid-template-columns: 1fr;\n grid-template-rows: 0 auto;\n }\n}\n:host .hemfixarna_order > div:last-of-type {\n background: #fffaf2;\n padding: 32px;\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n}\n:host .hemfixarna_order img {\n cursor: pointer;\n}\n:host .hemfixarna_order button {\n margin: 16px 0;\n padding: 0;\n text-decoration: underline;\n text-underline-offset: 2px;\n font-size: 14px;\n font-weight: 600;\n}\n:host .hemfixarna_cart {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart {\n grid-template-columns: 1fr;\n gap: 0;\n }\n}\n:host .hemfixarna_cart--right h2, :host .hemfixarna_cart--left h2 {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_cart--right h2 img, :host .hemfixarna_cart--left h2 img {\n margin-top: 3.2px;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_cart--left h2 button {\n display: none;\n }\n}\n@media (max-width: 768px) {\n :host .hemfixarna_cart--right h2 button {\n display: none;\n }\n}\n:host .hemfixarna_cart--startfee {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--rutrot div {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_cart--additional {\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 16px;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--additional p {\n font-size: 14px;\n}\n:host .hemfixarna_cart--additional strong {\n text-decoration: underline;\n text-underline-offset: 2px;\n cursor: pointer;\n position: relative;\n}\n:host .hemfixarna_cart--additional strong img {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n right: -24px;\n}\n:host .hemfixarna_cart--price {\n border-top: 1px solid #fcd9c9;\n padding: 16px;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--price h3 {\n margin: 0;\n}\n:host .hemfixarna_cart--item {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 16px 0;\n border-top: 1px solid #fcd9c9;\n}\n:host .hemfixarna_cart--item span {\n font-size: 12px;\n}\n:host .hemfixarna_cart--item > div {\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_cart--item > div > div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n:host .hemfixarna_cart--item > div button {\n color: #ec6632;\n}\n:host .hemfixarna_categories {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .hemfixarna_categories--wrapper {\n gap: 32px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_categories--wrapper {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_categories li {\n position: relative;\n background: #fff;\n border-radius: 4px;\n min-height: 132px;\n padding: 24px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n display: flex;\n align-items: center;\n gap: 24px;\n cursor: pointer;\n}\n:host .hemfixarna_categories li:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_categories li > button {\n height: 100%;\n width: 100%;\n}\n:host .hemfixarna_categories li .price {\n font-weight: 700;\n}\n:host .hemfixarna_content {\n height: 100%;\n overflow: auto;\n padding: 0 32px 64px;\n}\n:host .hemfixarna_content--5 {\n padding-top: 16px;\n}\n:host .hemfixarna_content--painting {\n padding: 0;\n overflow: initial;\n}\n:host .hemfixarna_crumbs {\n position: relative;\n padding: 16px 24px;\n border-bottom: 1px solid #fcd9c9;\n display: flex;\n justify-content: space-between;\n}\n:host .hemfixarna_crumbs--back {\n padding: 16px 24px 8px;\n display: flex;\n align-items: center;\n gap: 8px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs--back:hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_crumbs img {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .close {\n position: absolute;\n right: -16px;\n top: -16px;\n z-index: 9;\n -webkit-transform: translate3d(0, 0, 0);\n}\n:host .hemfixarna_crumbs .cart {\n display: flex;\n padding-left: 16px;\n position: relative;\n}\n:host .hemfixarna_crumbs .cart img {\n cursor: inherit;\n}\n:host .hemfixarna_crumbs .cart span {\n position: absolute;\n background: #fff;\n border-radius: 100%;\n width: 24px;\n height: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n font-size: 13px;\n line-height: 11px;\n top: -6px;\n right: -12px;\n}\n:host .hemfixarna_crumbs .cart_active {\n cursor: pointer;\n}\n:host .hemfixarna_crumbs .cart_active span {\n background: #25a710;\n color: #fff;\n}\n:host .hemfixarna_crumbs--links {\n display: flex;\n align-items: center;\n gap: 16px;\n overflow: auto;\n}\n@media (min-width: 769px) {\n :host .hemfixarna_crumbs--links {\n -ms-overflow-style: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar {\n display: none;\n }\n :host .hemfixarna_crumbs--links::-webkit-scrollbar-button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs--right {\n display: flex;\n align-items: center;\n}\n:host .hemfixarna_crumbs button {\n white-space: nowrap;\n background: #f1ded6;\n border-radius: 64px;\n padding: 12px 16px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.3px;\n box-shadow: none !important;\n}\n:host .hemfixarna_crumbs button:not(.active):hover {\n transition: 0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);\n filter: brightness(1.02);\n transform: scale(1.01);\n box-shadow: 0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863);\n}\n@media (max-width: 768px) {\n :host .hemfixarna_crumbs button {\n display: none;\n }\n}\n:host .hemfixarna_crumbs .active {\n background: #fffaf2;\n cursor: default;\n}\n:host .hemfixarna_features {\n gap: 12px !important;\n}\n:host .hemfixarna_features li {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n:host .hemfixarna_address {\n margin-bottom: 16px;\n}\n:host .hemfixarna_product {\n display: grid;\n gap: 16px;\n}\n:host .hemfixarna_product--link {\n font-weight: 700;\n color: #474444;\n text-underline-offset: 4px;\n}\n:host .hemfixarna_product--left {\n gap: 32px;\n}\n:host .hemfixarna_product--right {\n gap: 32px;\n}\n:host .hemfixarna_product--price {\n margin-top: 4px;\n font-weight: 700;\n}\n:host .hemfixarna_product--total {\n text-align: center;\n margin: -16px 0;\n font-size: 21px;\n line-height: 28px;\n}\n:host .hemfixarna_product--item {\n background: #fff;\n padding: 16px;\n display: grid;\n grid-template-columns: auto 75px;\n box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);\n}\n:host .hemfixarna_product--grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 32px;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--grid {\n grid-template-columns: 1fr;\n }\n}\n:host .hemfixarna_product--grid > div {\n display: flex;\n flex-direction: column;\n}\n:host .hemfixarna_product--grid ul {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n:host .hemfixarna_product p {\n margin: 0;\n}\n:host .hemfixarna_product--top {\n display: flex;\n gap: 32px;\n}\n:host .hemfixarna_product--top img {\n object-fit: contain;\n}\n:host .hemfixarna_product--top > div {\n width: 100%;\n}\n:host .hemfixarna_product--top > div h1 {\n max-width: 80%;\n}\n@media (max-width: 768px) {\n :host .hemfixarna_product--top > div h1 {\n max-width: 100%;\n }\n}\n:host .hemfixarna_product--top h4 {\n margin-bottom: 8px;\n}\n:host h5,\n:host p {\n margin: 0;\n}\n:host input[type=submit] {\n cursor: pointer;\n}\n:host input[type=date] ~ label {\n left: 56px;\n}\n:host input[type=date] {\n border: 1px solid #fcd9c9;\n padding-left: 64px;\n}\n:host input[type=checkbox] {\n height: 18px;\n width: 18px;\n border: 1px solid #fcd9c9;\n}\n:host input[type=checkbox]:checked {\n background: red;\n}\n:host input[type=date]::-webkit-calendar-picker-indicator {\n background: transparent;\n bottom: 0;\n color: transparent;\n cursor: pointer;\n height: auto;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n width: auto;\n}\n:host button,\n:host a {\n cursor: pointer;\n background: none;\n border: none;\n}\n:host ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}";
902
-
903
- const HemfixarnaComponent = class {
904
- constructor(hostRef) {
905
- index.registerInstance(this, hostRef);
906
- this.slugIsOldFormat = (slug) => {
907
- if (!slug)
908
- return false;
909
- return ['product', 'service', 'category'].some(str => slug.includes(str));
910
- };
911
- this.triggerScrollTotop = () => {
912
- const el = this.el.shadowRoot.querySelector('.hemfixarna_content');
913
- scrollToTop(el);
914
- };
915
- this.modal = false;
916
- this.showModal = false;
917
- this.tree = null;
918
- this.product = null;
919
- this.proppedProduct = null;
920
- this.slug = undefined;
921
- this.id = undefined;
922
- this.business = undefined;
923
- this.topCategory = undefined;
924
- this.forceOldTree = false;
925
- this.loadFromQuery = false;
926
- this.isDemo = false;
927
- this.widgetStyle = undefined;
928
- this.nav = undefined;
929
- this.buttonColor = undefined;
930
- this.buttonBg = undefined;
931
- }
932
- loadCategoryOrProduct(id) {
933
- this.proppedProduct = null;
934
- if (id.startsWith('c-')) {
935
- const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
936
- const category = categories.find(c => c && c.id === id.replace('c-', ''));
937
- if (category) {
938
- state.selectedCustomerCategory = category;
939
- state.step = 2;
940
- }
941
- }
942
- else {
943
- const products = state.customer.categories
944
- .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
945
- .flat()
946
- .flat();
947
- const product = products.find(p => p && p.fields.ID === parseInt(id));
948
- if (product) {
949
- state.selectedProduct = product.fields;
950
- state.step = 4;
951
- this.proppedProduct = product.fields;
952
- }
953
- }
954
- }
955
- async watchSlugChange(newValue) {
956
- if (this.slugIsOldFormat(newValue)) {
957
- this.fetchNewTaxonomy(newValue);
958
- }
959
- else if (state.customer && newValue) {
960
- this.loadCategoryOrProduct(newValue);
961
- }
962
- }
963
- async watchIdChange(id) {
964
- if (id && state.customer) {
965
- if (id === 'maleri') {
966
- state.maleri = true;
967
- state.step = 4;
968
- }
969
- else {
970
- this.loadCategoryOrProduct(id);
971
- }
972
- }
973
- }
974
- async fetchNewTaxonomy(slug) {
975
- state.selectedCategory = null;
976
- state.selectedProduct = null;
977
- state.selectedService = null;
978
- state.maleri = null;
979
- const res = await getTaxonomy(slug);
980
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found' || (res === null || res === void 0 ? void 0 : res.code) === 'rest_no_route') {
981
- console.log('taxonomy not found');
982
- }
983
- else if (res) {
984
- this.setTaxonomy(res);
985
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
986
- this.product = res;
987
- }
988
- }
989
- }
990
- async componentWillLoad() {
991
- state.business = this.business;
992
- const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
993
- if (cart) {
994
- state.cart = JSON.parse(cart);
995
- }
996
- const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);
997
- if (user) {
998
- state.user = JSON.parse(user);
999
- }
1000
- const creditSafeUser = window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);
1001
- if (creditSafeUser) {
1002
- state.creditSafeUser = JSON.parse(creditSafeUser);
1003
- }
1004
- const [tree, res, options, rut, rot, greenDiscount] = await Promise.all([
1005
- this.topCategory ? getTaxonomy(this.topCategory) : null,
1006
- this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
1007
- getOptions(),
1008
- getRut(),
1009
- getRot(),
1010
- getGreenDiscount(),
1011
- ]);
1012
- if ((!this.slug || !this.slugIsOldFormat(this.slug)) && !this.forceOldTree) {
1013
- try {
1014
- const customer = await getCustomer(this.business);
1015
- if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
1016
- console.warn('customer not found');
1017
- }
1018
- else if (customer) {
1019
- state.customer = customer;
1020
- if (this.id) {
1021
- if (this.id === 'maleri') {
1022
- state.maleri = true;
1023
- state.step = 4;
1024
- }
1025
- else {
1026
- this.loadCategoryOrProduct(this.id);
1027
- }
1028
- }
1029
- else if (this.slug && !this.slugIsOldFormat(this.slug)) {
1030
- this.loadCategoryOrProduct(this.slug);
1031
- }
1032
- }
1033
- }
1034
- catch (error) {
1035
- console.warn('customer not found');
1036
- }
1037
- }
1038
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
1039
- else if (tree) {
1040
- this.tree = tree;
1041
- }
1042
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
1043
- console.log('taxonomy not found');
1044
- }
1045
- else if (res) {
1046
- this.setTaxonomy(res);
1047
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
1048
- this.product = res;
1049
- }
1050
- }
1051
- if (this.loadFromQuery) {
1052
- const params = new URL(document.location.toString()).searchParams;
1053
- this.id = params.get('id');
1054
- if (!this.isDemo) {
1055
- this.openModal();
1056
- }
1057
- }
1058
- state.rotOptions = rot;
1059
- state.rutOptions = rut;
1060
- state.greenOptions = greenDiscount;
1061
- state.options = options;
1062
- }
1063
- setTaxonomy(taxonomy) {
1064
- if (taxonomy) {
1065
- if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
1066
- state.selectedCategory = taxonomy;
1067
- state.step = 2;
1068
- }
1069
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
1070
- state.selectedService = taxonomy;
1071
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === taxonomy.ID));
1072
- state.step = 3;
1073
- }
1074
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
1075
- state.selectedProduct = taxonomy;
1076
- state.selectedService = this.tree.sub_cats
1077
- .map(c => c.services)
1078
- .flat()
1079
- .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));
1080
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));
1081
- state.step = 4;
1082
- }
1083
- this.triggerScrollTotop();
1084
- }
1085
- }
1086
- // Open close modal && click outside event
1087
- openModal() {
1088
- this.modal = true;
1089
- setTimeout(() => {
1090
- this.showModal = true;
1091
- }, 50);
1092
- }
1093
- closeModal() {
1094
- this.showModal = false;
1095
- setTimeout(() => {
1096
- this.modal = false;
1097
- }, 200);
1098
- }
1099
- handleClick(e) {
1100
- if (this.loadFromQuery && !this.isDemo)
1101
- return;
1102
- if ((e === null || e === void 0 ? void 0 : e.composedPath()[0]).classList.contains('hemfixarna_backdrop')) {
1103
- this.closeModal();
1104
- }
1105
- const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');
1106
- if (infomodal) {
1107
- const isClickInside = infomodal.contains(e.composedPath()[0]);
1108
- if (!isClickInside) {
1109
- state.modal = null;
1110
- }
1111
- }
1112
- }
1113
- getCartLength() {
1114
- return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
1115
- }
1116
- render() {
1117
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1118
- const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
1119
- const pensel = index.getAssetPath(`./assets/pensel.svg`);
1120
- const monteringLogo = index.getAssetPath(`./assets/montering.svg`);
1121
- const navBackground = ((_a = this.nav) === null || _a === void 0 ? void 0 : _a.background) ? index.getAssetPath(this.nav.background) : '';
1122
- const navLogo = ((_b = this.nav) === null || _b === void 0 ? void 0 : _b.logo) ? index.getAssetPath(this.nav.logo) : '';
1123
- return (index.h("div", { class: `hemfixarna ${this.loadFromQuery ? 'hemfixarna_standalone' : ''}` }, this.loadFromQuery && !this.isDemo && this.nav ? (index.h("nav", { class: "hemfixarna_nav", style: { backgroundColor: (_c = this.nav.backgroundColor) !== null && _c !== void 0 ? _c : '' } }, index.h("div", null, index.h("div", { class: "hemfixarna_nav--logos" }, index.h("a", { href: this.nav.url, target: "_blank" }, index.h("img", { class: "hemfixarna_partnerlogo", src: navLogo, alt: `${this.business} logo` })), index.h("a", { href: "https://hemfixarna.se/", target: "_blank" }, index.h("p", { class: navBackground || this.nav.backgroundColor ? 'with-bg' : '' }, "I samarbete med:"), index.h("img", { src: logo, alt: "hemfixarna_logo", width: 104 }))), index.h("div", { class: "hemfixarna_nav--links" }, index.h("a", { href: this.nav.url, target: "_blank" }, "Till ", this.business), index.h("a", { href: "https://www.hemfixarna.se/", target: "_blank" }, "Till Hemfixarna")), navBackground ? index.h("img", { src: navBackground, class: "nav_background", alt: "nav_background" }) : null))) : null, !this.loadFromQuery || this.isDemo ? (index.h("div", { class: `hemfixarna_box hemfixarna_box--${this.widgetStyle}` }, [WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) ? (index.h("img", { src: this.id === 'maleri' ? pensel : monteringLogo, alt: "montering logo", width: 32, height: 32 })) : null, index.h("div", null, index.h("div", null, index.h("p", { onClick: () => this.openModal(), class: `pointer ${[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) && state.selectedProduct ? 'underline' : ''}` }, this.id === 'maleri' ? (index.h("span", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r")) : (index.h(index.Fragment, null, !state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (index.h(index.Fragment, null, ((_d = state.customer) === null || _d === void 0 ? void 0 : _d.widget_title) ? (index.h("span", null, state.customer.widget_title)) : (index.h("span", null, "Montering/Installation - ", index.h("strong", { class: "underline" }, "se priser h\u00E4r"))))) : (index.h(index.Fragment, null, ((_e = this.product) === null || _e === void 0 ? void 0 : _e.title) || ((_f = this.proppedProduct) === null || _f === void 0 ? void 0 : _f.title) || ((_g = state.selectedCustomerCategory) === null || _g === void 0 ? void 0 : _g.widget_title) || (index.h("span", null, "Montering", index.h("wbr", null), "/Installation ", (_j = (_h = state.selectedCustomerCategory) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : 'på plats', " - ", index.h("strong", { class: "underline" }, "se priser h\u00E4r"))), (this.product && ((_k = this.slug) === null || _k === void 0 ? void 0 : _k.includes('product'))) || (this.proppedProduct && !((_l = this.product) === null || _l === void 0 ? void 0 : _l.invoice) && !((_m = this.proppedProduct) === null || _m === void 0 ? void 0 : _m.invoice)) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || this.product), "kr"))) : null)))))), this.widgetStyle === WidgetStyle.standard ? index.h("img", { src: logo, width: 104 }) : null, this.widgetStyle === WidgetStyle.alternative ? (index.h("span", { class: "p-s" }, "Utf\u00F6rs av ", index.h("strong", null, "Hemfixarna"))) : null), [WidgetStyle.standard, WidgetStyle.alternative].includes(this.widgetStyle) ? (index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn", style: {
1124
- color: ((_o = this.buttonColor) === null || _o === void 0 ? void 0 : _o.startsWith('#')) || !((_p = this.buttonColor) === null || _p === void 0 ? void 0 : _p.length) ? this.buttonColor : `#${this.buttonColor}`,
1125
- backgroundColor: ((_q = this.buttonBg) === null || _q === void 0 ? void 0 : _q.startsWith('#')) || !((_r = this.buttonBg) === null || _r === void 0 ? void 0 : _r.length) ? this.buttonBg : `#${this.buttonBg}`,
1126
- } }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))) : null, WidgetStyle.alternative_2 === this.widgetStyle ? (index.h("div", { class: "hemfixarna_altbtn" }, index.h("strong", { class: "p-s" }, "Utf\u00F6rs av"), index.h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null)) : null, this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, state.modal.title && index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && (index.h("hemfixarna-breadcrumbs", { isDemo: this.isDemo, loadFromQuery: this.loadFromQuery, closeModal: () => this.closeModal(), tree: this.tree })), !state.customer || this.slugIsOldFormat(this.slug) ? (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))) : (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}` }, state.step < 4 && index.h("hemfixarna-start", null), state.step === 4 && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree })))), !this.isDemo ? index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` }) : null))));
1127
- }
1128
- static get assetsDirs() { return ["assets"]; }
1129
- get el() { return index.getElement(this); }
1130
- static get watchers() { return {
1131
- "slug": ["watchSlugChange"],
1132
- "id": ["watchIdChange"]
1133
- }; }
1134
- };
1135
- HemfixarnaComponent.style = hemfixarnaCss;
1136
-
1137
- const HemfixarnaInfo$1 = class {
1138
- constructor(hostRef) {
1139
- index.registerInstance(this, hostRef);
1140
- this.vertical = false;
1141
- }
1142
- render() {
1143
- return (index.h("div", { class: `hemfixarna_contact ${this.vertical ? 'hemfixarna_contact--vertical' : 'hemfixarna_contact--horizontal'}` }, index.h("a", { href: "tel:0770-220 720" }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M7 4V20H17V4H7ZM6 2H18C18.5523 2 19 2.44772 19 3V21C19 21.5523 18.5523 22 18 22H6C5.44772 22 5 21.5523 5 21V3C5 2.44772 5.44772 2 6 2ZM12 17C12.5523 17 13 17.4477 13 18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17Z", fill: "#C84E18" })), index.h("span", null, "0770-220 720")), index.h("a", { href: "https://hemfixarna.se/kundservice/", target: "_blank" }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { "clip-path": "url(#clip0_1001_894)" }, index.h("path", { d: "M21 12.22C21 6.73 16.74 3 12 3C7.31 3 3 6.65 3 12.28C2.4 12.62 2 13.26 2 14V16C2 17.1 2.9 18 4 18H5V11.9C5 8.03 8.13 4.9 12 4.9C15.87 4.9 19 8.03 19 11.9V19H11V21H19C20.1 21 21 20.1 21 19V17.78C21.59 17.47 22 16.86 22 16.14V13.84C22 13.14 21.59 12.53 21 12.22Z", fill: "#C84E18" }), index.h("path", { d: "M9 14C9.55228 14 10 13.5523 10 13C10 12.4477 9.55228 12 9 12C8.44772 12 8 12.4477 8 13C8 13.5523 8.44772 14 9 14Z", fill: "#C84E18" }), index.h("path", { d: "M15 14C15.5523 14 16 13.5523 16 13C16 12.4477 15.5523 12 15 12C14.4477 12 14 12.4477 14 13C14 13.5523 14.4477 14 15 14Z", fill: "#C84E18" }), index.h("path", { d: "M18 11.03C17.52 8.18 15.04 6 12.05 6C9.01997 6 5.75997 8.51 6.01997 12.45C8.48997 11.44 10.35 9.24 10.88 6.56C12.19 9.19 14.88 11 18 11.03Z", fill: "#C84E18" })), index.h("defs", null, index.h("clipPath", { id: "clip0_1001_894" }, index.h("rect", { width: "24", height: "24", fill: "white" })))), index.h("span", null, "Kundservice"))));
1144
- }
1145
- };
1146
-
1147
- const hemfixarnaDemoCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); :host{font-family:\"Inter\", sans-serif}:host .hemfixarna_widgetstyles label{cursor:pointer}:host .hemfixarna_widgetstyles>div{display:flex;gap:1rem}:host .hemfixarna_widgetstyles h5{margin:1rem 0}:host .hemfixarna_example{margin-bottom:16px;background:#000;padding:16px;color:#fff;display:flex;justify-content:space-between;cursor:pointer;max-width:500px;box-sizing:border-box;position:relative}:host .hemfixarna_example--tooltip{background:#000;top:-48px;font-size:16px;left:40%;color:white;padding:8px;position:absolute;opacity:0}:host .hemfixarna_example--tooltip::after{content:\"\";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#000 transparent transparent transparent}:host .hemfixarna_example:hover .hemfixarna_example--tooltip{opacity:1}:host .hemfixarna_example p{font-size:14px}:host .hemfixarna_example img{filter:invert(1)}:host .hemfixarna_install{display:grid;gap:8px;margin-top:16px}:host .hemfixarna_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:8px}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:3.2px 9.6px;border-radius:10px;margin-right:8px;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;border-bottom:1px solid black}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div:not(.hemfixarna_hosted){grid-template-columns:1fr 1fr}:host .hemfixarna_hosted .hemfixarna_scripts{display:none}:host>div{display:grid;gap:32px;width:100%;height:100vh;place-items:center;overflow:hidden;padding:16px 32px;box-sizing:border-box}:host>div>*{width:100%}:host>div>div{max-width:500px}:host>div ul{margin:0;padding:0;list-style:none}:host>div ul ul{gap:1px;display:grid}:host>div ul li{padding-left:16px;background:#fff}";
1148
-
1149
- const MyComponent$i = class {
1150
- constructor(hostRef) {
1151
- index.registerInstance(this, hostRef);
1152
- this.debounce = null;
1153
- this.cdnLink = '<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"></script>';
1154
- this.selectedSlug = undefined;
1155
- this.selectedID = undefined;
1156
- this.tooltipText = 'Kopiera till urklipp';
1157
- this.tree = null;
1158
- this.customer = null;
1159
- this.widgetStyle = WidgetStyle.standard;
1160
- this.buttonBg = '';
1161
- this.buttonColor = '';
1162
- this.partner = undefined;
1163
- this.colorAccessibility = undefined;
1164
- }
1165
- debouncedFunction() {
1166
- if (this.debounce !== null) {
1167
- clearTimeout(this.debounce);
1168
- this.debounce = null;
1169
- }
1170
- this.debounce = window.setTimeout(() => {
1171
- this.checkColorAccessibility();
1172
- this.debounce = null;
1173
- }, 1500);
1174
- }
1175
- async checkColorAccessibility() {
1176
- const defaultTextColor = '#fff';
1177
- const defaultBgColor = '#c84e18';
1178
- const firstColor = this.buttonBg.length ? (this.buttonBg.startsWith('#') ? this.buttonBg : `#${this.buttonBg}`) : defaultBgColor;
1179
- const secondColor = this.buttonColor.length ? (this.buttonColor.startsWith('#') ? this.buttonColor : `#${this.buttonColor}`) : defaultTextColor;
1180
- fetch('https://www.aremycolorsaccessible.com/api/are-they', {
1181
- mode: 'cors',
1182
- method: 'POST',
1183
- body: JSON.stringify({ colors: [firstColor, secondColor] }),
1184
- })
1185
- .then(response => response.json())
1186
- .then(json => {
1187
- if (json && (json)) {
1188
- this.colorAccessibility = json;
1189
- }
1190
- });
1191
- // Your color accessibility logic here
1192
- }
1193
- getTopLevelCategory() {
1194
- switch (process.env.BUSINESS) {
1195
- case Business.byggmax:
1196
- return TopCategory.byggmax;
1197
- default:
1198
- return '';
1199
- }
1200
- }
1201
- getColor(rating) {
1202
- switch (rating) {
1203
- case 'AAA':
1204
- return 'green';
1205
- case 'AA':
1206
- return 'orange';
1207
- case 'A':
1208
- return 'yellow';
1209
- case 'Fail':
1210
- return 'red';
1211
- default:
1212
- return 'black';
1213
- }
1214
- }
1215
- async componentWillLoad() {
1216
- var _a;
1217
- if (process.env.FORCE_OLD_TREE) {
1218
- const tree = await getTaxonomy(this.getTopLevelCategory());
1219
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
1220
- else if (tree) {
1221
- this.tree = tree;
1222
- }
1223
- }
1224
- else {
1225
- const partner = window.location.pathname.replace('/', '');
1226
- this.partner = isBusiness(partner) ? partner : (_a = process.env.BUSINESS) !== null && _a !== void 0 ? _a : Business.kund;
1227
- const customer = await getCustomer(this.partner);
1228
- if (customer.code !== 'not_found' && customer) {
1229
- this.customer = customer;
1230
- }
1231
- }
1232
- }
1233
- getExample() {
1234
- return `<hemfixarna-${this.partner}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}${this.selectedID ? ` id="${this.selectedID}" ` : ''} ${this.widgetStyle === WidgetStyle.standard ? '' : `widget-style="${this.widgetStyle}"`} ${this.buttonColor.length ? `button-color="${this.buttonColor}"` : ''} ${this.buttonBg.length ? `button-bg="${this.buttonBg}"` : ''}></hemfixarna-${this.partner}>`;
1235
- }
1236
- copyExample() {
1237
- navigator.clipboard.writeText(this.getExample());
1238
- this.tooltipText = 'Snippet kopierad';
1239
- setTimeout(() => {
1240
- this.tooltipText = 'Kopiera till urklipp';
1241
- }, 2000);
1242
- }
1243
- copyCdn() {
1244
- navigator.clipboard.writeText(this.cdnLink);
1245
- this.tooltipText = 'Text kopierad';
1246
- setTimeout(() => {
1247
- this.tooltipText = 'Kopiera till urklipp';
1248
- }, 2000);
1249
- }
1250
- copyNpmInstall() {
1251
- navigator.clipboard.writeText('npm i hemfixarna-web-components');
1252
- this.tooltipText = 'Text kopierad';
1253
- setTimeout(() => {
1254
- this.tooltipText = 'Kopiera till urklipp';
1255
- }, 2000);
1256
- }
1257
- showMaleri() {
1258
- var _a;
1259
- const allCategories = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.categories.map(c => (c.sub_categories ? c.sub_categories : c)).flat();
1260
- return allCategories === null || allCategories === void 0 ? void 0 : allCategories.some(c => c.add_painting);
1261
- }
1262
- render() {
1263
- var _a;
1264
- const copy = index.getAssetPath(`./assets/copy.png`);
1265
- return (index.h("div", { class: ((_a = this.customer) === null || _a === void 0 ? void 0 : _a.at_hemfixarna) ? 'hemfixarna_hosted' : '' }, index.h("div", { class: "hemfixarna_scripts" }, index.h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, index.h("p", null, this.getExample()), index.h("img", { src: copy, height: 20 }), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), this.partner === Business.byggmax && (index.h("hemfixarna-byggmax", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, forceOldTree: Boolean(process.env.FORCE_OLD_TREE), slug: this.selectedSlug, id: this.selectedID })), this.partner === Business.skanska && index.h("hemfixarna-skanska", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.sparfonster && (index.h("hemfixarna-sparfonster", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.string && (index.h("hemfixarna-string-furniture", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.hornbach && (index.h("hemfixarna-hornbach", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.traningspartner && (index.h("hemfixarna-traningspartner", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.superfront && (index.h("hemfixarna-superfront", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.zaptec && (index.h("hemfixarna-zaptec", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.tesla && (index.h("hemfixarna-tesla", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.forebygg && (index.h("hemfixarna-forebygg", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.doro && index.h("hemfixarna-doro", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.elfa && index.h("hemfixarna-elfa", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.kbygg && (index.h("hemfixarna-kbygg", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.fargvaruhuset && (index.h("hemfixarna-fargvaruhuset", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.norrgavel && (index.h("hemfixarna-norrgavel", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.klint && index.h("hemfixarna-klint", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.flyttsmart && (index.h("hemfixarna-flyttsmart", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.power && index.h("hemfixarna-power", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.kund && index.h("hemfixarna-kund", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), index.h("div", { class: "hemfixarna_install" }, index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 }))), index.h("div", { class: "hemfixarna_widgetstyles" }, index.h("h5", null, "Widget styles"), index.h("div", null, Object.values(WidgetStyle).map(style => (index.h("label", { key: style }, index.h("input", { type: "radio", value: style, checked: this.widgetStyle === style, onChange: () => (this.widgetStyle = style) }), style)))), index.h("div", null, index.h("div", null, index.h("h5", null, "Button background color"), index.h("input", { type: "text", value: this.buttonBg, onInput: e => (this.buttonBg = e.target.value) })), index.h("div", null, index.h("h5", null, "Button text color"), index.h("input", { type: "text", value: this.buttonColor, onInput: e => (this.buttonColor = e.target.value) })))), index.h("span", null, "Write an hexa code no # needed"), this.colorAccessibility ? (index.h("div", null, index.h("h5", null, "Tillg\u00E4nglighetsrapport"), index.h("div", null, index.h("strong", null, "Liten text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.small) } }, this.colorAccessibility.small), index.h("br", null), index.h("strong", null, "Fet text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.bold) } }, this.colorAccessibility.bold), index.h("br", null), index.h("strong", null, "Stor text:"), index.h("span", { style: { color: this.getColor(this.colorAccessibility.large) } }, this.colorAccessibility.large), index.h("br", null), index.h("strong", null, "Kontrastf\u00F6rh\u00E5llande:"), " ", this.colorAccessibility.contrast))) : null), index.h("ul", { class: "hemfixarna_categories" }, this.customer ? (index.h("div", null, this.customer.logo ? (index.h("div", { style: { width: '100%', display: 'flex', justifyContent: 'center' } }, index.h("img", { style: { maxWidth: '250px', height: 'auto', margin: '0 auto 2rem' }, src: this.customer.logo.url, alt: this.customer.post_title }))) : null, this.showMaleri() ? (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, "M\u00E5leriverktyget"), index.h("span", null, "maleri")), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText('maleri') }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => { var _a; return navigator.clipboard.writeText(`${(_a = "https://hemfixarna.se") !== null && _a !== void 0 ? _a : 'https://hemfixarna.se'}/partner/${this.customer.post_name}?id=maleri`); } }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = 'maleri') }, "Ladda m\u00E5leri")))))) : null, this.customer.categories.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `c-${c.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${c.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => { var _a; return navigator.clipboard.writeText(`${(_a = "https://hemfixarna.se") !== null && _a !== void 0 ? _a : 'https://hemfixarna.se'}/partner/${this.customer.post_name}?id=c-${c.id}`); } }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = `c-${c.id}`) }, "Ladda kategori")))), c.show_products && c.products ? (index.h("ul", null, c.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => { var _a; return navigator.clipboard.writeText(`${(_a = "https://hemfixarna.se") !== null && _a !== void 0 ? _a : 'https://hemfixarna.se'}/partner/${this.customer.post_name}?id=${p.fields.ID}`); } }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt"))))))))) : (index.h("ul", null, c.sub_categories &&
1266
- c.sub_categories.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.name), index.h("span", null, `c-${sc.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${sc.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => { var _a; return navigator.clipboard.writeText(`${(_a = "https://hemfixarna.se") !== null && _a !== void 0 ? _a : 'https://hemfixarna.se'}/partner/${this.customer.post_name}?id=c-${c.id}`); } }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = `c-${sc.id}`) }, "Ladda kategori")))), index.h("ul", null, sc.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (index.h("button", { onClick: () => { var _a; return navigator.clipboard.writeText(`${(_a = "https://hemfixarna.se") !== null && _a !== void 0 ? _a : 'https://hemfixarna.se'}/partner/${this.customer.post_name}?id=${p.fields.ID}`); } }, "Kopiera URL")) : (index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt")))))))))))))))))) : this.tree ? (index.h("div", null, this.tree.sub_cats.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `category/${c.slug}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`category/${c.slug}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `category/${c.slug}`) }, "Ladda kategori"))), index.h("ul", null, c.services.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `service/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`service/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `service/${sc.post_name}`) }, "Ladda kategori"))), index.h("ul", null, sc.products.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `product/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`product/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `product/${sc.post_name}`) }, "Ladda produkt")))))))))))))))) : null)));
1267
- }
1268
- static get watchers() { return {
1269
- "buttonBg": ["debouncedFunction"],
1270
- "buttonColor": ["debouncedFunction"]
1271
- }; }
1272
- };
1273
- MyComponent$i.style = hemfixarnaDemoCss;
1274
-
1275
- const hemfixarnaDoroCss = "";
1276
-
1277
- const MyComponent$h = class {
1278
- constructor(hostRef) {
1279
- index.registerInstance(this, hostRef);
1280
- this.id = undefined;
1281
- this.loadFromQuery = undefined;
1282
- this.widgetStyle = WidgetStyle.standard;
1283
- this.buttonColor = undefined;
1284
- this.buttonBg = undefined;
1285
- }
1286
- render() {
1287
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.doro }));
1288
- }
1289
- };
1290
- MyComponent$h.style = hemfixarnaDoroCss;
1291
-
1292
- const hemfixarnaElfaCss = "";
1293
-
1294
- const MyComponent$g = class {
1295
- constructor(hostRef) {
1296
- index.registerInstance(this, hostRef);
1297
- this.id = undefined;
1298
- this.loadFromQuery = 'true';
1299
- this.widgetStyle = WidgetStyle.standard;
1300
- this.buttonColor = undefined;
1301
- this.buttonBg = undefined;
1302
- this.isDemo = false;
1303
- }
1304
- render() {
1305
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://elfa.com', logo: 'assets/elfa.png' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.elfa, isDemo: this.isDemo }));
1306
- }
1307
- };
1308
- MyComponent$g.style = hemfixarnaElfaCss;
1309
-
1310
- const MyComponent$f = class {
1311
- constructor(hostRef) {
1312
- index.registerInstance(this, hostRef);
1313
- this.id = undefined;
1314
- this.loadFromQuery = undefined;
1315
- this.widgetStyle = WidgetStyle.standard;
1316
- this.buttonColor = undefined;
1317
- this.buttonBg = undefined;
1318
- this.isDemo = false;
1319
- }
1320
- render() {
1321
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.fargvaruhuset, isDemo: this.isDemo }));
1322
- }
1323
- };
1324
-
1325
- const MyComponent$e = class {
1326
- constructor(hostRef) {
1327
- index.registerInstance(this, hostRef);
1328
- this.id = undefined;
1329
- this.loadFromQuery = undefined;
1330
- this.widgetStyle = WidgetStyle.standard;
1331
- this.buttonColor = undefined;
1332
- this.buttonBg = undefined;
1333
- this.isDemo = false;
1334
- }
1335
- render() {
1336
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.flyttsmart, isDemo: this.isDemo }));
1337
- }
1338
- };
1339
-
1340
- const hemfixarnaForebyggCss = "";
1341
-
1342
- const MyComponent$d = class {
1343
- constructor(hostRef) {
1344
- index.registerInstance(this, hostRef);
1345
- this.id = undefined;
1346
- this.loadFromQuery = undefined;
1347
- this.widgetStyle = WidgetStyle.standard;
1348
- this.buttonColor = undefined;
1349
- this.buttonBg = undefined;
1350
- }
1351
- render() {
1352
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.forebygg }));
1353
- }
1354
- };
1355
- MyComponent$d.style = hemfixarnaForebyggCss;
1356
-
1357
- // src/errors.ts
1358
- var PersonnummerError = class extends Error {
1359
- constructor() {
1360
- super("Invalid swedish personal identity number");
1361
- }
1362
- };
1363
-
1364
- // src/utils.ts
1365
- var compareAsc = (dateLeft, dateRight) => {
1366
- const diff = dateLeft.getTime() - dateRight.getTime();
1367
- return diff < 0 ? -1 : diff > 0 ? 1 : diff;
1368
- };
1369
- var diffInYears = (dateLeft, dateRight) => {
1370
- const sign = compareAsc(dateLeft, dateRight);
1371
- const yearDiff = Math.abs(dateLeft.getFullYear() - dateRight.getFullYear());
1372
- dateLeft.setFullYear(dateLeft.getFullYear() - sign * yearDiff);
1373
- const isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
1374
- const result = sign * (yearDiff - +isLastYearNotFull);
1375
- return result === 0 ? 0 : result;
1376
- };
1377
- var luhn = (str) => {
1378
- let sum = 0;
1379
- str += "";
1380
- for (let i = 0, l = str.length; i < l; i++) {
1381
- let v = parseInt(str[i]);
1382
- v *= 2 - i % 2;
1383
- if (v > 9) {
1384
- v -= 9;
1385
- }
1386
- sum += v;
1387
- }
1388
- return Math.ceil(sum / 10) * 10 - sum;
1389
- };
1390
- var testDate = (year, month, day) => {
1391
- month -= 1;
1392
- const date = new Date(year, month, day);
1393
- return !(date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day);
1394
- };
1395
-
1396
- // src/index.ts
1397
- var Personnummer = class {
1398
- /**
1399
- * Personnummer constructor.
1400
- *
1401
- * @param {string} pin
1402
- * @param {object} options
1403
- */
1404
- constructor(pin, options) {
1405
- /**
1406
- * Personnummer century.
1407
- *
1408
- * @var {string}
1409
- */
1410
- this._century = "";
1411
- /**
1412
- * Personnummer full year.
1413
- *
1414
- * @var {string}
1415
- */
1416
- this._fullYear = "";
1417
- /**
1418
- * Personnummer year.
1419
- *
1420
- * @var {string}
1421
- */
1422
- this._year = "";
1423
- /**
1424
- * Personnummer month.
1425
- *
1426
- * @var {string}
1427
- */
1428
- this._month = "";
1429
- /**
1430
- * Personnummer day.
1431
- *
1432
- * @var {string}
1433
- */
1434
- this._day = "";
1435
- /**
1436
- * Personnummer seperator.
1437
- *
1438
- * @var {string}
1439
- */
1440
- this._sep = "";
1441
- /**
1442
- * Personnumer first three of the last four numbers.
1443
- *
1444
- * @var {string}
1445
- */
1446
- this._num = "";
1447
- /**
1448
- * The last number of the personnummer.
1449
- *
1450
- * @var {string}
1451
- */
1452
- this._check = "";
1453
- this.parse(pin, {
1454
- allowCoordinationNumber: true,
1455
- allowInterimNumber: false,
1456
- ...options
1457
- });
1458
- }
1459
- /**
1460
- * Get century.
1461
- *
1462
- * @return {string}
1463
- */
1464
- get century() {
1465
- return this._century;
1466
- }
1467
- /**
1468
- * Get age.
1469
- *
1470
- * @return {string}
1471
- */
1472
- get fullYear() {
1473
- return this._fullYear;
1474
- }
1475
- /**
1476
- * Get age.
1477
- *
1478
- * @return {string}
1479
- */
1480
- get year() {
1481
- return this._year;
1482
- }
1483
- /**
1484
- * Get month.
1485
- *
1486
- * @return {string}
1487
- */
1488
- get month() {
1489
- return this._month;
1490
- }
1491
- /**
1492
- * Get day.
1493
- *
1494
- * @return {string}
1495
- */
1496
- get day() {
1497
- return this._day;
1498
- }
1499
- /**
1500
- * Get sep.
1501
- *
1502
- * @return {string}
1503
- */
1504
- get sep() {
1505
- return this._sep;
1506
- }
1507
- /**
1508
- * Get num.
1509
- *
1510
- * @return {string}
1511
- */
1512
- get num() {
1513
- return this._num;
1514
- }
1515
- /**
1516
- * Get check.
1517
- *
1518
- * @return {string}
1519
- */
1520
- get check() {
1521
- return this._check;
1522
- }
1523
- /**
1524
- * Parse personnummer.
1525
- *
1526
- * @param {string} pin
1527
- * @param {object} options
1528
- *
1529
- * @return {Personnummer}
1530
- */
1531
- static parse(pin, options) {
1532
- return new Personnummer(pin, options);
1533
- }
1534
- /**
1535
- * Validate a Swedish personal identity number.
1536
- *
1537
- * @param {string} str
1538
- * @param {object} options
1539
- *
1540
- * @return {boolean}
1541
- */
1542
- static valid(pin, options) {
1543
- try {
1544
- Personnummer.parse(pin, options);
1545
- return true;
1546
- } catch (e) {
1547
- return false;
1548
- }
1549
- }
1550
- /**
1551
- * Parse personnummer and set class properties.
1552
- *
1553
- * @param {string} pin
1554
- * @param {object} options
1555
- */
1556
- parse(pin, options) {
1557
- if (pin.length < 10 || pin.length > 13) {
1558
- throw new PersonnummerError();
1559
- }
1560
- const reg = /^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;
1561
- const match = reg.exec(pin);
1562
- if (!match) {
1563
- throw new PersonnummerError();
1564
- }
1565
- const century = match[1];
1566
- const year = match[2];
1567
- const month = match[3];
1568
- const day = match[4];
1569
- const sep = match[5];
1570
- const num = match[6];
1571
- const check = match[7];
1572
- if (typeof century === "undefined" || !century.length) {
1573
- const d = /* @__PURE__ */ new Date();
1574
- let baseYear = 0;
1575
- if (sep === "+") {
1576
- this._sep = "+";
1577
- baseYear = d.getFullYear() - 100;
1578
- } else {
1579
- this._sep = "-";
1580
- baseYear = d.getFullYear();
1581
- }
1582
- this._century = ("" + (baseYear - (baseYear - parseInt(year)) % 100)).substr(0, 2);
1583
- } else {
1584
- this._century = century;
1585
- if ((/* @__PURE__ */ new Date()).getFullYear() - parseInt(century + year, 10) < 100) {
1586
- this._sep = "-";
1587
- } else {
1588
- this._sep = "+";
1589
- }
1590
- }
1591
- this._year = year;
1592
- this._fullYear = this._century + year;
1593
- this._month = month;
1594
- this._day = day;
1595
- this._num = num;
1596
- this._check = check;
1597
- if (!this.valid()) {
1598
- throw new PersonnummerError();
1599
- }
1600
- if (!(options == null ? void 0 : options.allowCoordinationNumber) && this.isCoordinationNumber()) {
1601
- throw new PersonnummerError();
1602
- }
1603
- if (!(options == null ? void 0 : options.allowInterimNumber) && this.isInterimNumber()) {
1604
- throw new PersonnummerError();
1605
- }
1606
- }
1607
- /**
1608
- * Validate a Swedish personal identity number.
1609
- *
1610
- * @return {boolean}
1611
- */
1612
- valid() {
1613
- const valid = luhn(
1614
- this.year + this.month + this.day + this.num.replace(/[TRSUWXJKLMN]/, "1")
1615
- ) === +this.check && !!this.check;
1616
- if (valid && testDate(parseInt(this.century + this.year), +this.month, +this.day)) {
1617
- return valid;
1618
- }
1619
- return valid && testDate(parseInt(this.century + this.year), +this.month, +this.day - 60);
1620
- }
1621
- /**
1622
- * Format a Swedish personal identity number as one of the official formats,
1623
- * A long format or a short format.
1624
- *
1625
- * If the input number could not be parsed a empty string will be returned.
1626
- *
1627
- * @param {boolean} longFormat
1628
- *
1629
- * @return {string}
1630
- */
1631
- format(longFormat = false) {
1632
- if (longFormat) {
1633
- return `${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`;
1634
- }
1635
- return `${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`;
1636
- }
1637
- /**
1638
- * Get age from a Swedish personal identity number.
1639
- *
1640
- * @return {number}
1641
- */
1642
- getAge() {
1643
- const date = this.getDate();
1644
- return diffInYears(new Date(Date.now()), date);
1645
- }
1646
- /**
1647
- * Get date from a Swedish personal identity number.
1648
- *
1649
- * @return {Date}
1650
- */
1651
- getDate() {
1652
- let ageDay = +this.day;
1653
- if (this.isCoordinationNumber()) {
1654
- ageDay -= 60;
1655
- }
1656
- const ageDate = this.century + this.year + "-" + this.month + "-" + (ageDay < 10 ? "0" + ageDay : ageDay);
1657
- return new Date(ageDate);
1658
- }
1659
- /**
1660
- * Check if a Swedish personal identity number is a interim number or not.
1661
- *
1662
- * @return {boolean}
1663
- */
1664
- isInterimNumber() {
1665
- return /[TRSUWXJKLMN]/.test(this.num[0]);
1666
- }
1667
- /**
1668
- * Check if a Swedish personal identity number is a coordination number or not.
1669
- *
1670
- * @return {boolean}
1671
- */
1672
- isCoordinationNumber() {
1673
- return testDate(
1674
- parseInt(this.century + this.year),
1675
- +this.month,
1676
- +this.day - 60
1677
- );
1678
- }
1679
- /**
1680
- * Check if a Swedish personal identity number is for a female.
1681
- *
1682
- * @return {boolean}
1683
- */
1684
- isFemale() {
1685
- return !this.isMale();
1686
- }
1687
- /**
1688
- * Check if a Swedish personal identity number is for a male.
1689
- *
1690
- * @return {boolean}
1691
- */
1692
- isMale() {
1693
- const sexDigit = parseInt(this.num.substr(-1));
1694
- return sexDigit % 2 === 1;
1695
- }
1696
- };
1697
- var src_default = Personnummer;
1698
-
1699
- function createCommonjsModule(fn, basedir, module) {
1700
- return module = {
1701
- path: basedir,
1702
- exports: {},
1703
- require: function (path, base) {
1704
- return commonjsRequire();
1705
- }
1706
- }, fn(module, module.exports), module.exports;
1707
- }
1708
-
1709
- function commonjsRequire () {
1710
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1711
- }
1712
-
1713
- var utf8 = createCommonjsModule(function (module, exports) {
1714
- // tslint:disable:no-bitwise
1715
- Object.defineProperty(exports, "__esModule", { value: true });
1716
- exports.utf8 = void 0;
1717
- exports.utf8 = {
1718
- encode: encode,
1719
- decode: decode,
1720
- };
1721
- function encode(unicodeText) {
1722
- unicodeText = unicodeText.replace(/\r\n/g, "\n");
1723
- var result = "";
1724
- for (var i = 0; i < unicodeText.length; i++) {
1725
- var char = unicodeText.charCodeAt(i);
1726
- if (char < 128) {
1727
- result += String.fromCharCode(char);
1728
- }
1729
- else if (char > 127 && char < 2048) {
1730
- result += String.fromCharCode((char >> 6) | 192);
1731
- result += String.fromCharCode((char & 63) | 128);
1732
- }
1733
- else {
1734
- result += String.fromCharCode((char >> 12) | 224);
1735
- result += String.fromCharCode(((char >> 6) & 63) | 128);
1736
- result += String.fromCharCode((char & 63) | 128);
1737
- }
1738
- }
1739
- return result;
1740
- }
1741
- function decode(utf8Text) {
1742
- var result = "";
1743
- var i = 0;
1744
- var char1 = 0;
1745
- var char2 = 0;
1746
- var char3 = 0;
1747
- while (i < utf8Text.length) {
1748
- char1 = utf8Text.charCodeAt(i);
1749
- if (char1 < 128) {
1750
- result += String.fromCharCode(char1);
1751
- i++;
1752
- }
1753
- else if (char1 > 191 && char1 < 224) {
1754
- char2 = utf8Text.charCodeAt(i + 1);
1755
- result += String.fromCharCode(((char1 & 31) << 6) | (char2 & 63));
1756
- i += 2;
1757
- }
1758
- else {
1759
- char2 = utf8Text.charCodeAt(i + 1);
1760
- char3 = utf8Text.charCodeAt(i + 2);
1761
- result += String.fromCharCode(((char1 & 15) << 12) | ((char2 & 63) << 6) | (char3 & 63));
1762
- i += 3;
1763
- }
1764
- }
1765
- return result;
1766
- }
1767
- });
1768
-
1769
- var md5 = createCommonjsModule(function (module, exports) {
1770
- // tslint:disable:no-bitwise
1771
- Object.defineProperty(exports, "__esModule", { value: true });
1772
- exports.generate = void 0;
1773
-
1774
- function generate(unicodeText) {
1775
- var x = [];
1776
- var k;
1777
- var AA;
1778
- var BB;
1779
- var CC;
1780
- var DD;
1781
- var a;
1782
- var b;
1783
- var c;
1784
- var d;
1785
- var S11 = 7;
1786
- var S12 = 12;
1787
- var S13 = 17;
1788
- var S14 = 22;
1789
- var S21 = 5;
1790
- var S22 = 9;
1791
- var S23 = 14;
1792
- var S24 = 20;
1793
- var S31 = 4;
1794
- var S32 = 11;
1795
- var S33 = 16;
1796
- var S34 = 23;
1797
- var S41 = 6;
1798
- var S42 = 10;
1799
- var S43 = 15;
1800
- var S44 = 21;
1801
- var utf8Text = utf8.utf8.encode(unicodeText);
1802
- x = convertToWordArray(utf8Text);
1803
- a = 0x67452301;
1804
- b = 0xefcdab89;
1805
- c = 0x98badcfe;
1806
- d = 0x10325476;
1807
- for (k = 0; k < x.length; k += 16) {
1808
- AA = a;
1809
- BB = b;
1810
- CC = c;
1811
- DD = d;
1812
- a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);
1813
- d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);
1814
- c = FF(c, d, a, b, x[k + 2], S13, 0x242070db);
1815
- b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);
1816
- a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);
1817
- d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);
1818
- c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613);
1819
- b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501);
1820
- a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8);
1821
- d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);
1822
- c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);
1823
- b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);
1824
- a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122);
1825
- d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193);
1826
- c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e);
1827
- b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821);
1828
- a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);
1829
- d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340);
1830
- c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);
1831
- b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);
1832
- a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);
1833
- d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
1834
- c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);
1835
- b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);
1836
- a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);
1837
- d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);
1838
- c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);
1839
- b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);
1840
- a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);
1841
- d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);
1842
- c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);
1843
- b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);
1844
- a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);
1845
- d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681);
1846
- c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);
1847
- b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);
1848
- a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);
1849
- d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);
1850
- c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);
1851
- b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);
1852
- a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);
1853
- d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);
1854
- c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);
1855
- b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05);
1856
- a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);
1857
- d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);
1858
- c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);
1859
- b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);
1860
- a = II(a, b, c, d, x[k + 0], S41, 0xf4292244);
1861
- d = II(d, a, b, c, x[k + 7], S42, 0x432aff97);
1862
- c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7);
1863
- b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039);
1864
- a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3);
1865
- d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);
1866
- c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d);
1867
- b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1);
1868
- a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);
1869
- d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);
1870
- c = II(c, d, a, b, x[k + 6], S43, 0xa3014314);
1871
- b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);
1872
- a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82);
1873
- d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235);
1874
- c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);
1875
- b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391);
1876
- a = addUnsigned(a, AA);
1877
- b = addUnsigned(b, BB);
1878
- c = addUnsigned(c, CC);
1879
- d = addUnsigned(d, DD);
1880
- }
1881
- return wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
1882
- }
1883
- exports.generate = generate;
1884
- function rotateLeft(lValue, iShiftBits) {
1885
- return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
1886
- }
1887
- function addUnsigned(lX, lY) {
1888
- var lX4;
1889
- var lY4;
1890
- var lX8;
1891
- var lY8;
1892
- var lResult;
1893
- lX8 = lX & 0x80000000;
1894
- lY8 = lY & 0x80000000;
1895
- lX4 = lX & 0x40000000;
1896
- lY4 = lY & 0x40000000;
1897
- lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);
1898
- if (lX4 & lY4) {
1899
- return lResult ^ 0x80000000 ^ lX8 ^ lY8;
1900
- }
1901
- if (lX4 | lY4) {
1902
- if (lResult & 0x40000000) {
1903
- return lResult ^ 0xc0000000 ^ lX8 ^ lY8;
1904
- }
1905
- else {
1906
- return lResult ^ 0x40000000 ^ lX8 ^ lY8;
1907
- }
1908
- }
1909
- else {
1910
- return lResult ^ lX8 ^ lY8;
1911
- }
1912
- }
1913
- function F(x, y, z) {
1914
- return (x & y) | (~x & z);
1915
- }
1916
- function G(x, y, z) {
1917
- return (x & z) | (y & ~z);
1918
- }
1919
- function H(x, y, z) {
1920
- return x ^ y ^ z;
1921
- }
1922
- function I(x, y, z) {
1923
- return y ^ (x | ~z);
1924
- }
1925
- function FF(a, b, c, d, x, s, ac) {
1926
- a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
1927
- return addUnsigned(rotateLeft(a, s), b);
1928
- }
1929
- function GG(a, b, c, d, x, s, ac) {
1930
- a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
1931
- return addUnsigned(rotateLeft(a, s), b);
1932
- }
1933
- function HH(a, b, c, d, x, s, ac) {
1934
- a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
1935
- return addUnsigned(rotateLeft(a, s), b);
1936
- }
1937
- function II(a, b, c, d, x, s, ac) {
1938
- a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
1939
- return addUnsigned(rotateLeft(a, s), b);
1940
- }
1941
- function convertToWordArray(value) {
1942
- var lWordCount;
1943
- var lMessageLength = value.length;
1944
- var lNumberOfWordsTemp1 = lMessageLength + 8;
1945
- var lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64;
1946
- var lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16;
1947
- var lWordArray = Array(lNumberOfWords - 1);
1948
- var lBytePosition = 0;
1949
- var lByteCount = 0;
1950
- while (lByteCount < lMessageLength) {
1951
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
1952
- lBytePosition = (lByteCount % 4) * 8;
1953
- lWordArray[lWordCount] =
1954
- lWordArray[lWordCount] | (value.charCodeAt(lByteCount) << lBytePosition);
1955
- lByteCount++;
1956
- }
1957
- lWordCount = (lByteCount - (lByteCount % 4)) / 4;
1958
- lBytePosition = (lByteCount % 4) * 8;
1959
- lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
1960
- lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
1961
- lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
1962
- return lWordArray;
1963
- }
1964
- function wordToHex(lValue) {
1965
- var wordToHexValue = "";
1966
- var wordToHexValueTemp = "";
1967
- var lByte;
1968
- var lCount;
1969
- for (lCount = 0; lCount <= 3; lCount++) {
1970
- lByte = (lValue >>> (lCount * 8)) & 255;
1971
- wordToHexValueTemp = "0" + lByte.toString(16);
1972
- wordToHexValue =
1973
- wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2);
1974
- }
1975
- return wordToHexValue;
1976
- }
1977
- });
1978
-
1979
- var lib = createCommonjsModule(function (module, exports) {
1980
- Object.defineProperty(exports, "__esModule", { value: true });
1981
- exports.MD5 = exports.generate = void 0;
1982
-
1983
- var md5_2 = md5;
1984
- Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return md5_2.generate; } });
1985
- exports.MD5 = {
1986
- generate: md5.generate,
1987
- };
1988
- });
1989
-
1990
- const apiSearch = async (query) => {
1991
- var _a;
1992
- const res = await fetch((_a = "https://hemfixare-lookup.vercel.app/api") !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
1993
- method: 'POST',
1994
- headers: {
1995
- 'Content-Type': 'application/json',
1996
- },
1997
- body: JSON.stringify({
1998
- query,
1999
- hash: lib.MD5.generate(String.fromCharCode(83, 101, 67, 82, 101, 116) + query),
2000
- }),
2001
- });
2002
- const data = await res.json();
2003
- return data;
2004
- };
2005
-
2006
- const HemfixarnaGetuser = class {
2007
- constructor(hostRef) {
2008
- index.registerInstance(this, hostRef);
2009
- this.handleChangeEmail = (e) => {
2010
- this.emailError = null;
2011
- this.email = e.target.value;
2012
- };
2013
- this.handleChangePhone = (e) => {
2014
- this.phoneError = null;
2015
- this.phone = e.target.value;
2016
- };
2017
- this.handleChangessn = (e) => {
2018
- this.ssnError = null;
2019
- this.ssn = e.target.value;
2020
- };
2021
- this.handleSubmit = async (e) => {
2022
- e.preventDefault();
2023
- const emailRegex = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
2024
- const validEmail = emailRegex.test(this.email);
2025
- if (!validEmail) {
2026
- this.emailError = 'Ange en giltig e-postadress';
2027
- }
2028
- const validPhone = /^[\d\s()+-]{6,}$/.test(this.phone);
2029
- if (!validPhone) {
2030
- this.phoneError = 'Ange ett giltigt telefonnummer';
2031
- }
2032
- const validssn = src_default.valid(this.ssn);
2033
- if (!validssn) {
2034
- this.ssnError = 'Ange ett giltigt personnummer';
2035
- }
2036
- else if (validssn) {
2037
- const pn = src_default.parse(this.ssn).format(true);
2038
- this.ssn = [pn.slice(0, 8), '-', pn.slice(8)].join('');
2039
- }
2040
- if (validEmail && validPhone && validssn) {
2041
- try {
2042
- const creditSafeData = await apiSearch(this.ssn);
2043
- if (creditSafeData) {
2044
- state.creditSafeUser = creditSafeData;
2045
- state.checkoutStep = 2;
2046
- state.user = Object.assign(Object.assign({}, creditSafeData), { email: this.email, phone: this.phone, ssn: this.ssn });
2047
- }
2048
- else {
2049
- this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';
2050
- }
2051
- }
2052
- catch (e) {
2053
- this.ssnError = 'Vi kunde tyvärr inte hitta en address med ditt angivna personnummer';
2054
- console.log(e);
2055
- }
2056
- finally {
2057
- const el = this.el.closest('.hemfixarna_content');
2058
- scrollToTop(el);
2059
- }
2060
- }
2061
- };
2062
- this.render = () => {
2063
- return (index.h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), index.h("label", { htmlFor: "email" }, "E-post ")), this.emailError && index.h("span", null, this.emailError), index.h("div", null, index.h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), index.h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && index.h("span", null, this.phoneError), index.h("div", null, index.h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), index.h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && index.h("span", null, this.ssnError), index.h("input", { type: "submit", value: "Forts\u00E4tt*" }), index.h("p", null, "*Vi h\u00E4mtar din adress")));
2064
- };
2065
- this.email = '';
2066
- this.emailError = null;
2067
- this.phone = '';
2068
- this.phoneError = null;
2069
- this.ssn = '';
2070
- this.ssnError = null;
2071
- }
2072
- componentWillLoad() {
2073
- if (state.user) {
2074
- this.email = state.user.email;
2075
- this.phone = state.user.phone;
2076
- this.ssn = state.user.ssn;
2077
- }
2078
- }
2079
- get el() { return index.getElement(this); }
2080
- };
2081
-
2082
- const hemfixarnaHornbachCss = "";
2083
-
2084
- const MyComponent$c = class {
2085
- constructor(hostRef) {
2086
- index.registerInstance(this, hostRef);
2087
- this.id = undefined;
2088
- this.loadFromQuery = 'true';
2089
- this.isDemo = false;
2090
- this.widgetStyle = WidgetStyle.standard;
2091
- this.buttonColor = undefined;
2092
- this.buttonBg = undefined;
2093
- }
2094
- render() {
2095
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.hornbach.se/', logo: 'assets/hornbach/logo.svg', background: './assets/hornbach/nav.jpg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.hornbach }));
2096
- }
2097
- };
2098
- MyComponent$c.style = hemfixarnaHornbachCss;
2099
-
2100
- const HemfixarnaInfo = class {
2101
- constructor(hostRef) {
2102
- index.registerInstance(this, hostRef);
2103
- this.logo = index.getAssetPath(`./assets/hemfixarna.svg`);
2104
- }
2105
- render() {
2106
- var _a;
2107
- const checked = index.getAssetPath(`./assets/checked.svg`);
2108
- return (index.h("div", { class: "hemfixarna_info" }, state.step < 5 ? (index.h(index.Fragment, null, index.h("h2", null, state.customer.info_title), index.h("p", null, state.customer.info_text))) : (index.h("h2", null, state.customer.checkout_title)), index.h("ul", { class: "hemfixarna_features" }, state.step < 5 ? (index.h(index.Fragment, null, ((_a = state.customer.trust_badges) === null || _a === void 0 ? void 0 : _a.length) ? (index.h(index.Fragment, null, state.customer.trust_badges.map(l => (index.h("li", { key: l.text }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.text)))))) : (index.h(index.Fragment, null, state.options.trust.map(l => (index.h("li", { key: l.trust_badge }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.trust_badge)))))))) : (index.h(index.Fragment, null, state.customer.checkout_trust_badges.map(l => (index.h("li", { key: l.text }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.text))))))), index.h("img", { src: this.logo, width: 200, alt: "hemfixarna" }), index.h("a", { class: "hemfixarna_product--link", target: "_blank", href: state.options.link.url }, state.options.link.title)));
2109
- }
2110
- };
2111
-
2112
- const hemfixarnaInvoiceCss = ":host .invoice{gap:16px;display:grid}:host .invoice form>span{text-align:center;padding:16px 0}:host .invoice img{right:unset;left:unset;position:initial;transform:none}:host .invoice label{cursor:pointer;font-size:14px;display:flex;align-items:flex-start;padding:16px 0}:host .invoice label input{margin:0 5px 0 0;accent-color:#ea662c}:host .invoice-preview{display:flex;gap:4px}:host .invoice-preview div{position:relative}:host .invoice-preview div button{position:absolute;top:0;right:0;padding:0}:host .invoice-preview div button img{width:24px;height:24px}:host .invoice-preview div>img{width:100px;height:80px;object-fit:cover}:host .invoice input[type=email],:host .invoice input[type=tel],:host .invoice textarea{padding:16px;border:1px solid #fcd9c9;font-size:16px}:host .invoice textarea{resize:none;height:200px;font-family:\"Inter\", sans-serif}:host .invoice div:has(>input[type=file]){display:flex;align-items:center;justify-content:center;cursor:pointer;background:#fff;border:1px solid #fcd9c9;padding:32px 16px;gap:16px}:host .invoice div:has(>input[type=file]) span{color:#000;font-size:12px}:host .invoice input[type=file]{display:none}";
2113
-
2114
- const base = `${"https://hemfixarna.se"}/wp-json/headless` ;
2115
- const HemfixarnaInvoice = class {
2116
- constructor(hostRef) {
2117
- index.registerInstance(this, hostRef);
2118
- this.formError = null;
2119
- this.displayImages = [];
2120
- this.formImages = [];
2121
- this.formState = 'initial';
2122
- }
2123
- isValidEmail(email) {
2124
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2125
- return emailRegex.test(email);
2126
- }
2127
- componentDidRender() {
2128
- const form = this.el.querySelector('form');
2129
- if (form) {
2130
- form.addEventListener('input', () => {
2131
- this.formError = null;
2132
- });
2133
- }
2134
- }
2135
- disconnectedCallback() {
2136
- const form = this.el.querySelector('form');
2137
- if (form) {
2138
- form.removeEventListener('input', () => {
2139
- this.formError = null;
2140
- });
2141
- }
2142
- }
2143
- async submit(e) {
2144
- var _a;
2145
- e.preventDefault();
2146
- this.formState = 'loading';
2147
- this.formError = null;
2148
- const form = e.currentTarget.elements;
2149
- const values = {
2150
- description: form.descriptionInput.value.length ? form.descriptionInput.value : null,
2151
- email: form.emailInput.value.length ? form.emailInput.value : null,
2152
- tel: form.telInput.value.length ? form.telInput.value : null,
2153
- terms: (_a = form.termsInput) === null || _a === void 0 ? void 0 : _a.checked,
2154
- };
2155
- if (!values.description) {
2156
- this.formError = 'Vänligen fyll i formulärtexten';
2157
- this.formState = 'initial';
2158
- return;
2159
- }
2160
- if (!values.email || !this.isValidEmail(values.email)) {
2161
- this.formError = 'Vänligen ange en giltig e-postadress';
2162
- this.formState = 'initial';
2163
- return;
2164
- }
2165
- if (!values.tel) {
2166
- this.formError = 'Vänligen ange ditt telefonnummer';
2167
- this.formState = 'initial';
2168
- return;
2169
- }
2170
- if (state.selectedProduct.terms_show_checkbox && !values.terms) {
2171
- this.formError = 'Vänligen acceptera villkoren';
2172
- this.formState = 'initial';
2173
- return;
2174
- }
2175
- const formData = new FormData();
2176
- formData.append('text', values.description);
2177
- formData.append('email', values.email);
2178
- formData.append('phone', values.tel);
2179
- formData.append('customer', state.business);
2180
- this.formImages.forEach(file => {
2181
- formData.append('images[]', file);
2182
- });
2183
- formData.append('product', JSON.stringify({
2184
- title: state.selectedProduct.title,
2185
- amount: 1,
2186
- has_rut: state.selectedProduct.rut,
2187
- has_rot: state.selectedProduct.rot,
2188
- has_green: state.selectedProduct.green,
2189
- ID: state.selectedProduct.ID,
2190
- parts: [],
2191
- }));
2192
- try {
2193
- const res = await fetch(`${base}/saveinvoiceproduct`, {
2194
- method: 'POST',
2195
- body: formData,
2196
- });
2197
- const { response } = await res.json();
2198
- if (response.code === 200) {
2199
- state.checkoutInvoice = true;
2200
- state.step = 6;
2201
- }
2202
- else {
2203
- this.formError = 'Vi kan inte ta emot din beställning just nu';
2204
- this.formState = 'initial';
2205
- }
2206
- }
2207
- catch (error) {
2208
- this.formError = 'Vi kan inte ta emot din beställning just nu';
2209
- this.formState = 'initial';
2210
- }
2211
- }
2212
- handleImageDrop(e) {
2213
- e.preventDefault();
2214
- const files = e.dataTransfer.files;
2215
- for (let i = 0; i < files.length; i++) {
2216
- const file = files[i];
2217
- if (file.type.startsWith('image/')) {
2218
- const reader = new FileReader();
2219
- reader.onload = () => {
2220
- this.displayImages = [...this.displayImages, reader.result];
2221
- this.formImages = [...this.formImages, file];
2222
- };
2223
- reader.readAsDataURL(file);
2224
- }
2225
- }
2226
- }
2227
- handleFileInputChange(e) {
2228
- e.preventDefault();
2229
- const files = e.target.files;
2230
- for (let i = 0; i < files.length; i++) {
2231
- const file = files[i];
2232
- if (file.type.startsWith('image/')) {
2233
- const reader = new FileReader();
2234
- reader.onload = () => {
2235
- this.displayImages = [...this.displayImages, reader.result];
2236
- this.formImages = [...this.formImages, file];
2237
- };
2238
- reader.readAsDataURL(file);
2239
- }
2240
- }
2241
- }
2242
- handleImageClick() {
2243
- this.el.querySelector('.hemfixarna-file-upload').click();
2244
- }
2245
- preventDragOver(e) {
2246
- e.preventDefault();
2247
- }
2248
- removeImage(index) {
2249
- this.displayImages = this.displayImages.filter((_, i) => i !== index);
2250
- this.formImages = this.formImages.filter((_, i) => i !== index);
2251
- }
2252
- render() {
2253
- const upload = index.getAssetPath(`./assets/drag-drop.svg`);
2254
- return (index.h("div", { class: "invoice" }, index.h("p", null, state.selectedProduct.invoice_description), index.h("form", { onSubmit: e => this.submit(e) }, index.h("textarea", { name: "descriptionInput", placeholder: "Beskriv ditt \u00E4rende" }), index.h("div", { role: "button", "aria-label": "upload image", onDragOver: e => this.preventDragOver(e), onDrop: e => this.handleImageDrop(e), onClick: () => this.handleImageClick() }, index.h("img", { src: upload, alt: "hemfixarna_logo", width: 24 }), index.h("div", null, index.h("p", null, "Bifoga ev bilder"), index.h("span", null, "(dra bilder hit)")), index.h("input", { onChange: e => this.handleFileInputChange(e), class: "hemfixarna-file-upload", accept: "image/*", type: "file", multiple: true, name: "fileInput" })), index.h("div", { class: "invoice-preview" }, this.displayImages.map((img, i) => (index.h("div", { key: i }, index.h("img", { src: img, alt: "uploaded image" }), index.h("button", { onClick: () => this.removeImage(i) }, index.h("img", { src: index.getAssetPath(`./assets/close.svg`), alt: "close" })))))), index.h("input", { placeholder: "E-post", type: "email", name: "emailInput" }), index.h("input", { placeholder: "Telefonnummer", type: "tel", name: "telInput" }), state.selectedProduct.terms_show_checkbox ? (index.h("label", null, index.h("input", { type: "checkbox", name: "termsInput" }), state.selectedProduct.terms)) : null, this.formError ? index.h("span", null, this.formError) : null, index.h("input", { type: "submit", value: this.formState === 'loading' ? 'Skickar' : 'Kontakta mig' }))));
2255
- }
2256
- get el() { return index.getElement(this); }
2257
- };
2258
- HemfixarnaInvoice.style = hemfixarnaInvoiceCss;
2259
-
2260
- const MyComponent$b = class {
2261
- constructor(hostRef) {
2262
- index.registerInstance(this, hostRef);
2263
- this.id = undefined;
2264
- this.loadFromQuery = 'true';
2265
- this.widgetStyle = WidgetStyle.standard;
2266
- this.buttonColor = undefined;
2267
- this.buttonBg = undefined;
2268
- this.isDemo = false;
2269
- }
2270
- render() {
2271
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://k-bygg.se', logo: 'assets/kbygg.svg', backgroundColor: '#651d32' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.kbygg, isDemo: this.isDemo }));
2272
- }
2273
- };
2274
-
2275
- const MyComponent$a = class {
2276
- constructor(hostRef) {
2277
- index.registerInstance(this, hostRef);
2278
- this.id = undefined;
2279
- this.loadFromQuery = undefined;
2280
- this.widgetStyle = WidgetStyle.standard;
2281
- this.buttonColor = undefined;
2282
- this.buttonBg = undefined;
2283
- }
2284
- render() {
2285
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.klint }));
2286
- }
2287
- };
2288
-
2289
- const MyComponent$9 = class {
2290
- constructor(hostRef) {
2291
- index.registerInstance(this, hostRef);
2292
- this.id = undefined;
2293
- this.loadFromQuery = undefined;
2294
- this.widgetStyle = WidgetStyle.standard;
2295
- this.buttonColor = undefined;
2296
- this.buttonBg = undefined;
2297
- }
2298
- render() {
2299
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.kund }));
2300
- }
2301
- };
2302
-
2303
- const MyComponent$8 = class {
2304
- constructor(hostRef) {
2305
- index.registerInstance(this, hostRef);
2306
- this.id = undefined;
2307
- this.loadFromQuery = 'true';
2308
- this.widgetStyle = WidgetStyle.standard;
2309
- this.buttonColor = undefined;
2310
- this.buttonBg = undefined;
2311
- this.isDemo = false;
2312
- }
2313
- render() {
2314
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://norrgavel.se', logo: 'assets/norrgavel.svg' }, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.norrgavel, isDemo: this.isDemo }));
2315
- }
2316
- };
2317
-
2318
- const HemfixarnaOrder = class {
2319
- constructor(hostRef) {
2320
- index.registerInstance(this, hostRef);
2321
- this.render = () => {
2322
- return (index.h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, index.h("div", null), index.h("div", null, index.h("h2", null, state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), state.checkoutInvoice ? index.h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, state.checkoutInvoice ? index.h("div", null) : index.h("hemfixarna-orderrows", { tree: this.tree, cart: false }), index.h("span", { onClick: () => this.resetShop() }, index.h("button", null, "G\u00F6r en ny bokning")), index.h("hemfixarna-info", null))));
2323
- };
2324
- this.tree = undefined;
2325
- }
2326
- resetShop() {
2327
- state.step = 1;
2328
- state.cart = [];
2329
- state.selectedCategory = null;
2330
- state.selectedService = null;
2331
- state.selectedProduct = null;
2332
- state.maleri = null;
2333
- state.checkoutStep = 1;
2334
- }
2335
- disconnectedCallback() {
2336
- this.resetShop();
2337
- }
2338
- };
2339
-
2340
- const HemfixarnaOrderrows = class {
2341
- constructor(hostRef) {
2342
- index.registerInstance(this, hostRef);
2343
- this.cart = true;
2344
- this.tree = undefined;
2345
- }
2346
- goToProduct(id) {
2347
- if (state.customer) {
2348
- const products = state.customer.categories
2349
- .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
2350
- .flat()
2351
- .flat();
2352
- const product = products.find(p => p && p.fields.ID === id);
2353
- if (product) {
2354
- state.selectedProduct = product.fields;
2355
- state.step = 4;
2356
- }
2357
- }
2358
- else {
2359
- const services = this.tree.sub_cats.map((c) => c.services).flat();
2360
- const products = services.map((s) => s.products).flat();
2361
- const product = products.find((p) => p.ID === id);
2362
- const service = services.find((s) => s.products.find((p) => p.ID === id));
2363
- const category = this.tree.sub_cats.find((c) => c.services.find((s) => s.products.find((p) => p.ID === id)));
2364
- state.selectedCategory = category;
2365
- state.selectedService = service;
2366
- state.selectedProduct = product;
2367
- state.step = 4;
2368
- }
2369
- }
2370
- openRot() {
2371
- state.modal = {
2372
- title: state.rotOptions.rot_start_fee_heading,
2373
- text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],
2374
- };
2375
- }
2376
- openRut() {
2377
- state.modal = {
2378
- title: state.rutOptions.rut_start_fee_heading,
2379
- text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],
2380
- };
2381
- }
2382
- openGreen() {
2383
- state.modal = {
2384
- title: state.greenOptions.green_start_fee_heading,
2385
- text: [state.greenOptions.green_start_fee_text, state.greenOptions.green_start_fee_text_secondary],
2386
- };
2387
- }
2388
- getDiscountedInfo(item) {
2389
- if (item.rut && state.rut) {
2390
- return ' (efter RUT-avdrag)';
2391
- }
2392
- else if (item.rot && state.rot) {
2393
- return ' (efter ROT-avdrag)';
2394
- }
2395
- else if (item.green && state.green) {
2396
- return ' (efter Grön teknik avdrag)';
2397
- }
2398
- else {
2399
- return '';
2400
- }
2401
- }
2402
- render() {
2403
- const info = index.getAssetPath(`./assets/info.svg`);
2404
- return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, state.cart.map(item => {
2405
- var _a;
2406
- return (index.h("li", { class: "hemfixarna_cart--item" }, index.h("div", null, index.h("div", null, item.icon && index.h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), index.h("p", null, index.h("strong", null, item.amount, "x "), item.name)), this.cart && index.h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), index.h("p", null, index.h("strong", null, getProductPrice(item, item.price, item.amount), "kr"), index.h("span", null, this.getDiscountedInfo(item))), item.parts.length > 0 && (index.h("ul", null, item.parts.map(part => (index.h("li", null, index.h("p", null, index.h("strong", null, part.amount, "x "), part.name), index.h("p", null, index.h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
2407
- })), index.h("div", { class: "hemfixarna_cart--additional" }, index.h("div", null, getStartFee().rot > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rut, "kr"))), getStartFee().green > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openGreen() }, state.greenOptions.green_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().green, "kr")))), state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), index.h("span", { class: "slider" }))), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)"))), state.cart.find((item) => item.green) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.green = !state.green), checked: state.green, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "Gr\u00F6n teknik avdrag")), index.h("p", null, "(-", state.green ? calculateGreenDiscount() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
2408
- }
2409
- };
2410
-
2411
- const MyComponent$7 = class {
2412
- constructor(hostRef) {
2413
- index.registerInstance(this, hostRef);
2414
- this.id = undefined;
2415
- this.customer = undefined;
2416
- this.loadFromQuery = undefined;
2417
- this.widgetStyle = WidgetStyle.standard;
2418
- this.buttonColor = undefined;
2419
- this.buttonBg = undefined;
2420
- }
2421
- render() {
2422
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.power }));
2423
- }
2424
- };
2425
-
2426
- const hemfixarnaProductCss = "";
2427
-
2428
- const HemfixarnaProduct = class {
2429
- constructor(hostRef) {
2430
- index.registerInstance(this, hostRef);
2431
- this.amount = 0;
2432
- this.hideDescription = true;
2433
- }
2434
- addProduct() {
2435
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2436
- if (productInCart) {
2437
- productInCart.amount++;
2438
- state.cart = [...state.cart];
2439
- }
2440
- else {
2441
- state.cart = [
2442
- ...state.cart,
2443
- {
2444
- id: state.selectedProduct.ID,
2445
- rut: state.selectedProduct.rut,
2446
- rot: state.selectedProduct.rot,
2447
- green: state.selectedProduct.green,
2448
- amount: 1,
2449
- parts: [],
2450
- price: state.selectedProduct.price,
2451
- name: state.selectedProduct.title,
2452
- start_fee: !state.selectedProduct.hide_start_fee,
2453
- terms_checkout: state.selectedProduct.terms_checkout,
2454
- icon: state.selectedProduct.icon,
2455
- },
2456
- ];
2457
- }
2458
- }
2459
- removeProduct() {
2460
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2461
- if (productInCart && productInCart.amount > 1) {
2462
- productInCart.amount--;
2463
- state.cart = [...state.cart];
2464
- }
2465
- else {
2466
- state.cart = state.cart.filter(p => p.id !== state.selectedProduct.ID);
2467
- }
2468
- }
2469
- //Handle cart and parts
2470
- addPart(part) {
2471
- var _a;
2472
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2473
- if (productInCart) {
2474
- const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
2475
- if (partInCart) {
2476
- partInCart.amount++;
2477
- productInCart.parts = [...productInCart.parts];
2478
- }
2479
- else {
2480
- productInCart.parts = [...productInCart.parts, { id: part.ID, amount: 1, price: part.price, name: (_a = part.title) !== null && _a !== void 0 ? _a : part.title }];
2481
- }
2482
- state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];
2483
- }
2484
- }
2485
- removePart(part) {
2486
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2487
- if (productInCart) {
2488
- const partInCart = productInCart.parts.find(sp => sp.id === part.ID);
2489
- if (partInCart && partInCart.amount > 1) {
2490
- partInCart.amount--;
2491
- productInCart.parts = [...productInCart.parts];
2492
- }
2493
- else {
2494
- productInCart.parts = productInCart.parts.filter(sp => sp.id !== part.ID);
2495
- }
2496
- state.cart = [...state.cart.filter(p => p.id !== productInCart.id), productInCart];
2497
- }
2498
- }
2499
- goToCart() {
2500
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2501
- if (productInCart) {
2502
- state.step = 5;
2503
- const el = this.el.closest('.hemfixarna_content');
2504
- scrollToTop(el);
2505
- }
2506
- }
2507
- getAmount() {
2508
- var _a;
2509
- return ((_a = state.cart.find(p => p.id === state.selectedProduct.ID)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
2510
- }
2511
- getPartAmount(partId) {
2512
- var _a;
2513
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2514
- return ((_a = productInCart === null || productInCart === void 0 ? void 0 : productInCart.parts.find(sp => sp.id === partId)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
2515
- }
2516
- getTotalPrice() {
2517
- let price = 0;
2518
- const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
2519
- if (productInCart) {
2520
- const partsPrice = productInCart.parts.reduce((acc, curr) => {
2521
- const part = state.selectedProduct.parts.find(p => p.ID === curr.id);
2522
- if (part) {
2523
- return acc + part.price * curr.amount;
2524
- }
2525
- return acc;
2526
- }, 0);
2527
- price = state.selectedProduct.price * productInCart.amount + partsPrice;
2528
- }
2529
- else {
2530
- price = state.selectedProduct.price;
2531
- }
2532
- return getProductPrice(state.selectedProduct, price);
2533
- }
2534
- componentDidRender() {
2535
- const linkElem = document.createElement('link');
2536
- linkElem.setAttribute('rel', 'stylesheet');
2537
- linkElem.setAttribute('href', 'https://painting-frontend.vercel.app/static/css/main.css');
2538
- const fonts = document.createElement('link');
2539
- fonts.setAttribute('rel', 'stylesheet');
2540
- fonts.setAttribute('href', 'https://painting-frontend.vercel.app/fonts.css');
2541
- const checkAndInjectCSS = () => {
2542
- const parents = this.el.getElementsByTagName('hemfixare-calculator');
2543
- if (parents.length > 0 && parents[0].shadowRoot !== null) {
2544
- parents[0].shadowRoot.appendChild(linkElem);
2545
- parents[0].shadowRoot.appendChild(fonts);
2546
- }
2547
- else {
2548
- setTimeout(checkAndInjectCSS, 1);
2549
- }
2550
- };
2551
- checkAndInjectCSS();
2552
- }
2553
- render() {
2554
- var _a, _b, _c;
2555
- const checked = index.getAssetPath(`./assets/checked.svg`);
2556
- const plus = index.getAssetPath(`./assets/plus.svg`);
2557
- const minus = index.getAssetPath(`./assets/minus.svg`);
2558
- if (state.maleri) {
2559
- return (index.h("div", { class: "hemfixarna_painting" }, index.h("script", { type: "text/javascript", src: ['localhost', 'vercel'].some(v => window.location.href.includes(v))
2560
- ? 'https://painting-dev.vercel.app/static/js/main.js'
2561
- : 'https://painting-frontend.vercel.app/static/js/main.js', defer: true, async: true }), index.h("hemfixare-calculator", { title: state.options.maleri_title, subtitle: state.options.maleri_text, modal: "true", customer: state.business === Business.string ? 'string' : state.business })));
2562
- }
2563
- return state.selectedProduct ? (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.title })), index.h("div", null, index.h("h1", null, state.selectedProduct.title), !state.selectedProduct.invoice ? index.h("h2", null, getProductPrice(state.selectedProduct), " kr/st") : index.h("h2", null, state.selectedProduct.invoice_price))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), state.selectedProduct.description && (index.h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: state.selectedProduct.description }))), index.h("div", { class: "hemfixarna_product--right" }, state.selectedProduct.invoice ? (index.h("hemfixarna-invoice", null)) : (index.h(index.Fragment, null, index.h("ul", null, index.h("li", { class: "hemfixarna_product--item" }, index.h("div", null, index.h("p", null, state.selectedProduct.title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), index.h("span", null, this.getAmount()), index.h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
2564
- state.selectedProduct.parts.map(p => {
2565
- var _a;
2566
- return (index.h("li", { class: "hemfixarna_part" }, index.h("div", null, index.h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.title), index.h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), index.h("span", null, this.getPartAmount(p.ID)), index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
2567
- })), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Forts\u00E4tt"))), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", null))))) : null;
2568
- }
2569
- get el() { return index.getElement(this); }
2570
- };
2571
- HemfixarnaProduct.style = hemfixarnaProductCss;
2572
-
2573
- const HemfixarnaService = class {
2574
- constructor(hostRef) {
2575
- index.registerInstance(this, hostRef);
2576
- }
2577
- render() {
2578
- return (index.h("div", null, index.h("h2", null, state.selectedService.post_title), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("div", null, index.h("ul", { class: "hemfixarna_categories" }, state.selectedService.products
2579
- .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
2580
- .map(p => {
2581
- var _a;
2582
- return (index.h("hemfixarna-box", { post: p, icon: (_a = p.icon.url) !== null && _a !== void 0 ? _a : p.icon, postTitle: p.title }));
2583
- }))), index.h("hemfixarna-info", null))));
2584
- }
2585
- };
2586
-
2587
- const hemfixarnaSkanskaCss = "";
2588
-
2589
- const MyComponent$6 = class {
2590
- constructor(hostRef) {
2591
- index.registerInstance(this, hostRef);
2592
- this.id = undefined;
2593
- this.customer = undefined;
2594
- this.loadFromQuery = undefined;
2595
- this.widgetStyle = WidgetStyle.standard;
2596
- this.buttonColor = undefined;
2597
- this.buttonBg = undefined;
2598
- }
2599
- render() {
2600
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.skanska }));
2601
- }
2602
- };
2603
- MyComponent$6.style = hemfixarnaSkanskaCss;
2604
-
2605
- const MyComponent$5 = class {
2606
- constructor(hostRef) {
2607
- index.registerInstance(this, hostRef);
2608
- this.id = undefined;
2609
- this.customer = undefined;
2610
- this.loadFromQuery = undefined;
2611
- this.widgetStyle = WidgetStyle.standard;
2612
- this.buttonColor = undefined;
2613
- this.buttonBg = undefined;
2614
- }
2615
- render() {
2616
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.sparfonster }));
2617
- }
2618
- };
2619
-
2620
- const HemfixarnaGrid = class {
2621
- constructor(hostRef) {
2622
- index.registerInstance(this, hostRef);
2623
- this.tree = undefined;
2624
- this.slug = undefined;
2625
- }
2626
- isMainCategory(category) {
2627
- return category.show_products !== undefined;
2628
- }
2629
- handleMaleriClick() {
2630
- state.step = 4;
2631
- state.maleri = true;
2632
- }
2633
- render() {
2634
- var _a;
2635
- const maleriLogo = index.getAssetPath('./assets/gubbe-pensel.svg');
2636
- return state.customer ? (index.h("div", null, index.h("h2", null, state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, ((_a = state.selectedCustomerCategory) === null || _a === void 0 ? void 0 : _a.add_painting) ? (index.h("button", { onClick: () => this.handleMaleriClick(), class: "hemfixarna_maleribox" }, index.h("img", { height: 64, src: maleriLogo, alt: "M\u00E5leri Logotyp" }), index.h("p", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r"))) : null, state.selectedCustomerCategory
2637
- ? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products
2638
- ? state.selectedCustomerCategory.sub_categories.map(c => index.h("hemfixarna-box", { category: c }))
2639
- : state.selectedCustomerCategory.products
2640
- ? state.selectedCustomerCategory.products.map(c => index.h("hemfixarna-box", { category: c.fields }))
2641
- : null
2642
- : state.customer.categories.map(c => index.h("hemfixarna-box", { category: c }))), index.h("hemfixarna-info", null)))) : (index.h("div", null, index.h("h2", null, "Alla tj\u00E4nster"), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, this.tree.sub_cats
2643
- .sort((a, b) => (a.name < b.name ? -1 : 1))
2644
- .map(c => {
2645
- var _a;
2646
- return (index.h("hemfixarna-box", { post: c, icon: (_a = c.icon.url) !== null && _a !== void 0 ? _a : c.icon, postTitle: c.name }));
2647
- })), index.h("hemfixarna-info", null))));
2648
- }
2649
- };
2650
-
2651
- const hemfixarnaStringCss = "";
2652
-
2653
- const MyComponent$4 = class {
2654
- constructor(hostRef) {
2655
- index.registerInstance(this, hostRef);
2656
- this.id = undefined;
2657
- this.loadFromQuery = undefined;
2658
- this.widgetStyle = WidgetStyle.standard;
2659
- this.buttonColor = undefined;
2660
- this.buttonBg = undefined;
2661
- }
2662
- render() {
2663
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.string }));
2664
- }
2665
- };
2666
- MyComponent$4.style = hemfixarnaStringCss;
2667
-
2668
- const MyComponent$3 = class {
2669
- constructor(hostRef) {
2670
- index.registerInstance(this, hostRef);
2671
- this.id = undefined;
2672
- this.loadFromQuery = undefined;
2673
- this.widgetStyle = WidgetStyle.standard;
2674
- this.buttonColor = undefined;
2675
- this.buttonBg = undefined;
2676
- }
2677
- render() {
2678
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.superfront }));
2679
- }
2680
- };
2681
-
2682
- const MyComponent$2 = class {
2683
- constructor(hostRef) {
2684
- index.registerInstance(this, hostRef);
2685
- this.id = undefined;
2686
- this.loadFromQuery = 'true';
2687
- this.isDemo = false;
2688
- this.widgetStyle = WidgetStyle.standard;
2689
- this.buttonColor = undefined;
2690
- this.buttonBg = undefined;
2691
- }
2692
- render() {
2693
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.tesla.com/sv_se/home-charging', logo: 'assets/tesla.svg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.tesla }));
2694
- }
2695
- };
2696
-
2697
- const MyComponent$1 = class {
2698
- constructor(hostRef) {
2699
- index.registerInstance(this, hostRef);
2700
- this.id = undefined;
2701
- this.loadFromQuery = undefined;
2702
- this.widgetStyle = WidgetStyle.standard;
2703
- this.buttonColor = undefined;
2704
- this.buttonBg = undefined;
2705
- }
2706
- render() {
2707
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.traningspartner }));
2708
- }
2709
- };
2710
-
2711
- const MyComponent = class {
2712
- constructor(hostRef) {
2713
- index.registerInstance(this, hostRef);
2714
- this.id = undefined;
2715
- this.loadFromQuery = 'true';
2716
- this.isDemo = false;
2717
- this.widgetStyle = WidgetStyle.standard;
2718
- this.buttonColor = undefined;
2719
- this.buttonBg = undefined;
2720
- }
2721
- render() {
2722
- return (index.h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, nav: { url: 'https://www.zaptec.com/sv/laddningslosningar/zaptec-go', logo: 'assets/zaptec.svg' }, isDemo: this.isDemo, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.zaptec }));
2723
- }
2724
- };
2725
-
2726
- exports.hemfixarna_address = HemfixarnaAddress;
2727
- exports.hemfixarna_box = HemfixarnaBox;
2728
- exports.hemfixarna_breadcrumbs = HemfixarnaBreadcrumbs;
2729
- exports.hemfixarna_byggmax = MyComponent$j;
2730
- exports.hemfixarna_cart = HemfixarnaCart;
2731
- exports.hemfixarna_category = HemfixarnaCategory;
2732
- exports.hemfixarna_checkout = HemfixarnaCheckout;
2733
- exports.hemfixarna_component = HemfixarnaComponent;
2734
- exports.hemfixarna_contact = HemfixarnaInfo$1;
2735
- exports.hemfixarna_demo = MyComponent$i;
2736
- exports.hemfixarna_doro = MyComponent$h;
2737
- exports.hemfixarna_elfa = MyComponent$g;
2738
- exports.hemfixarna_fargvaruhuset = MyComponent$f;
2739
- exports.hemfixarna_flyttsmart = MyComponent$e;
2740
- exports.hemfixarna_forebygg = MyComponent$d;
2741
- exports.hemfixarna_getuser = HemfixarnaGetuser;
2742
- exports.hemfixarna_hornbach = MyComponent$c;
2743
- exports.hemfixarna_info = HemfixarnaInfo;
2744
- exports.hemfixarna_invoice = HemfixarnaInvoice;
2745
- exports.hemfixarna_kbygg = MyComponent$b;
2746
- exports.hemfixarna_klint = MyComponent$a;
2747
- exports.hemfixarna_kund = MyComponent$9;
2748
- exports.hemfixarna_norrgavel = MyComponent$8;
2749
- exports.hemfixarna_order = HemfixarnaOrder;
2750
- exports.hemfixarna_orderrows = HemfixarnaOrderrows;
2751
- exports.hemfixarna_power = MyComponent$7;
2752
- exports.hemfixarna_product = HemfixarnaProduct;
2753
- exports.hemfixarna_service = HemfixarnaService;
2754
- exports.hemfixarna_skanska = MyComponent$6;
2755
- exports.hemfixarna_sparfonster = MyComponent$5;
2756
- exports.hemfixarna_start = HemfixarnaGrid;
2757
- exports.hemfixarna_string_furniture = MyComponent$4;
2758
- exports.hemfixarna_superfront = MyComponent$3;
2759
- exports.hemfixarna_tesla = MyComponent$2;
2760
- exports.hemfixarna_traningspartner = MyComponent$1;
2761
- exports.hemfixarna_zaptec = MyComponent;
2762
-
2763
- //# sourceMappingURL=hemfixarna-address_36.cjs.entry.js.map