hemfixarna-web-components 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/cjs/{hemfixarna-address_36.cjs.entry.js → hemfixarna-address_15.cjs.entry.js} +341 -1030
  2. package/dist/cjs/hemfixarna-address_15.cjs.entry.js.map +1 -0
  3. package/dist/cjs/hemfixarna-byggmax.cjs.entry.js +26 -0
  4. package/dist/cjs/hemfixarna-byggmax.cjs.entry.js.map +1 -0
  5. package/dist/cjs/hemfixarna-category.cjs.entry.js +28 -0
  6. package/dist/cjs/hemfixarna-category.cjs.entry.js.map +1 -0
  7. package/dist/cjs/hemfixarna-components.cjs.js +1 -1
  8. package/dist/cjs/hemfixarna-components.cjs.js.map +1 -1
  9. package/dist/cjs/hemfixarna-doro.cjs.entry.js +26 -0
  10. package/dist/cjs/hemfixarna-doro.cjs.entry.js.map +1 -0
  11. package/dist/cjs/hemfixarna-elfa.cjs.entry.js +26 -0
  12. package/dist/cjs/hemfixarna-elfa.cjs.entry.js.map +1 -0
  13. package/dist/cjs/hemfixarna-fargvaruhuset.cjs.entry.js +23 -0
  14. package/dist/cjs/hemfixarna-fargvaruhuset.cjs.entry.js.map +1 -0
  15. package/dist/cjs/hemfixarna-flyttsmart.cjs.entry.js +23 -0
  16. package/dist/cjs/hemfixarna-flyttsmart.cjs.entry.js.map +1 -0
  17. package/dist/cjs/hemfixarna-forebygg.cjs.entry.js +26 -0
  18. package/dist/cjs/hemfixarna-forebygg.cjs.entry.js.map +1 -0
  19. package/dist/cjs/hemfixarna-hornbach.cjs.entry.js +26 -0
  20. package/dist/cjs/hemfixarna-hornbach.cjs.entry.js.map +1 -0
  21. package/dist/cjs/hemfixarna-kbygg.cjs.entry.js +23 -0
  22. package/dist/cjs/hemfixarna-kbygg.cjs.entry.js.map +1 -0
  23. package/dist/cjs/hemfixarna-klint.cjs.entry.js +23 -0
  24. package/dist/cjs/hemfixarna-klint.cjs.entry.js.map +1 -0
  25. package/dist/cjs/hemfixarna-kund.cjs.entry.js +23 -0
  26. package/dist/cjs/hemfixarna-kund.cjs.entry.js.map +1 -0
  27. package/dist/cjs/hemfixarna-norrgavel.cjs.entry.js +23 -0
  28. package/dist/cjs/hemfixarna-norrgavel.cjs.entry.js.map +1 -0
  29. package/dist/cjs/hemfixarna-power.cjs.entry.js +23 -0
  30. package/dist/cjs/hemfixarna-power.cjs.entry.js.map +1 -0
  31. package/dist/cjs/hemfixarna-service.cjs.entry.js +24 -0
  32. package/dist/cjs/hemfixarna-service.cjs.entry.js.map +1 -0
  33. package/dist/cjs/hemfixarna-skanska.cjs.entry.js +26 -0
  34. package/dist/cjs/hemfixarna-skanska.cjs.entry.js.map +1 -0
  35. package/dist/cjs/hemfixarna-sparfonster.cjs.entry.js +23 -0
  36. package/dist/cjs/hemfixarna-sparfonster.cjs.entry.js.map +1 -0
  37. package/dist/cjs/hemfixarna-string-furniture.cjs.entry.js +26 -0
  38. package/dist/cjs/hemfixarna-string-furniture.cjs.entry.js.map +1 -0
  39. package/dist/cjs/hemfixarna-superfront.cjs.entry.js +24 -0
  40. package/dist/cjs/hemfixarna-superfront.cjs.entry.js.map +1 -0
  41. package/dist/cjs/hemfixarna-tesla.cjs.entry.js +23 -0
  42. package/dist/cjs/hemfixarna-tesla.cjs.entry.js.map +1 -0
  43. package/dist/cjs/hemfixarna-traningspartner.cjs.entry.js +23 -0
  44. package/dist/cjs/hemfixarna-traningspartner.cjs.entry.js.map +1 -0
  45. package/dist/cjs/hemfixarna-zaptec.cjs.entry.js +23 -0
  46. package/dist/cjs/hemfixarna-zaptec.cjs.entry.js.map +1 -0
  47. package/dist/cjs/index-4695c475.js +258 -0
  48. package/dist/cjs/index-4695c475.js.map +1 -0
  49. package/dist/cjs/index-8054ce93.js +42 -0
  50. package/dist/cjs/index-8054ce93.js.map +1 -0
  51. package/dist/cjs/index-b83343b9.js.map +1 -1
  52. package/dist/cjs/loader.cjs.js +1 -1
  53. package/dist/cjs/loader.cjs.js.map +1 -1
  54. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +2 -82
  55. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -1
  56. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +1 -20
  57. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +1 -1
  58. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +1 -39
  59. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +1 -1
  60. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +1 -39
  61. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +1 -1
  62. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +1 -39
  63. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +1 -1
  64. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +1 -20
  65. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +1 -1
  66. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +1 -39
  67. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -1
  68. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +1 -39
  69. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +1 -1
  70. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +1 -20
  71. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +1 -1
  72. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +1 -20
  73. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +1 -1
  74. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +1 -39
  75. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +1 -1
  76. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +1 -38
  77. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +1 -1
  78. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +1 -38
  79. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -1
  80. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +1 -38
  81. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +1 -1
  82. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +1 -20
  83. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -1
  84. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +1 -1
  85. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +1 -1
  86. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +1 -39
  87. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +1 -1
  88. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +1 -20
  89. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +1 -1
  90. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +1 -39
  91. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +1 -1
  92. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js +1 -60
  93. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -1
  94. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js +1 -28
  95. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -1
  96. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +27 -236
  97. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
  98. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +75 -39
  99. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -1
  100. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js +2 -2
  101. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -1
  102. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js +2 -1
  103. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -1
  104. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js +1 -26
  105. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -1
  106. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +7 -41
  107. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -1
  108. package/dist/collection/types/index.js +4 -0
  109. package/dist/collection/types/index.js.map +1 -1
  110. package/dist/collection/utils/api.js +18 -2
  111. package/dist/collection/utils/api.js.map +1 -1
  112. package/dist/collection/utils/creditSafe.js +2 -2
  113. package/dist/collection/utils/creditSafe.js.map +1 -1
  114. package/dist/collection/utils/enviroment.js +31 -0
  115. package/dist/collection/utils/enviroment.js.map +1 -0
  116. package/dist/collection/utils/felixApi.js +2 -1
  117. package/dist/collection/utils/felixApi.js.map +1 -1
  118. package/dist/collection/utils/felixFunctions.js +0 -1
  119. package/dist/collection/utils/felixFunctions.js.map +1 -1
  120. package/dist/esm/{hemfixarna-address_36.entry.js → hemfixarna-address_15.entry.js} +150 -818
  121. package/dist/esm/hemfixarna-address_15.entry.js.map +1 -0
  122. package/dist/esm/hemfixarna-byggmax.entry.js +22 -0
  123. package/dist/esm/hemfixarna-byggmax.entry.js.map +1 -0
  124. package/dist/esm/hemfixarna-category.entry.js +24 -0
  125. package/dist/esm/hemfixarna-category.entry.js.map +1 -0
  126. package/dist/esm/hemfixarna-components.js +3 -3
  127. package/dist/esm/hemfixarna-components.js.map +1 -1
  128. package/dist/esm/hemfixarna-doro.entry.js +22 -0
  129. package/dist/esm/hemfixarna-doro.entry.js.map +1 -0
  130. package/dist/esm/hemfixarna-elfa.entry.js +22 -0
  131. package/dist/esm/hemfixarna-elfa.entry.js.map +1 -0
  132. package/dist/esm/hemfixarna-fargvaruhuset.entry.js +19 -0
  133. package/dist/esm/hemfixarna-fargvaruhuset.entry.js.map +1 -0
  134. package/dist/esm/hemfixarna-flyttsmart.entry.js +19 -0
  135. package/dist/esm/hemfixarna-flyttsmart.entry.js.map +1 -0
  136. package/dist/esm/hemfixarna-forebygg.entry.js +22 -0
  137. package/dist/esm/hemfixarna-forebygg.entry.js.map +1 -0
  138. package/dist/esm/hemfixarna-hornbach.entry.js +22 -0
  139. package/dist/esm/hemfixarna-hornbach.entry.js.map +1 -0
  140. package/dist/esm/hemfixarna-kbygg.entry.js +19 -0
  141. package/dist/esm/hemfixarna-kbygg.entry.js.map +1 -0
  142. package/dist/esm/hemfixarna-klint.entry.js +19 -0
  143. package/dist/esm/hemfixarna-klint.entry.js.map +1 -0
  144. package/dist/esm/hemfixarna-kund.entry.js +19 -0
  145. package/dist/esm/hemfixarna-kund.entry.js.map +1 -0
  146. package/dist/esm/hemfixarna-norrgavel.entry.js +19 -0
  147. package/dist/esm/hemfixarna-norrgavel.entry.js.map +1 -0
  148. package/dist/esm/hemfixarna-power.entry.js +19 -0
  149. package/dist/esm/hemfixarna-power.entry.js.map +1 -0
  150. package/dist/esm/hemfixarna-service.entry.js +20 -0
  151. package/dist/esm/hemfixarna-service.entry.js.map +1 -0
  152. package/dist/esm/hemfixarna-skanska.entry.js +22 -0
  153. package/dist/esm/hemfixarna-skanska.entry.js.map +1 -0
  154. package/dist/esm/hemfixarna-sparfonster.entry.js +19 -0
  155. package/dist/esm/hemfixarna-sparfonster.entry.js.map +1 -0
  156. package/dist/esm/hemfixarna-string-furniture.entry.js +22 -0
  157. package/dist/esm/hemfixarna-string-furniture.entry.js.map +1 -0
  158. package/dist/esm/hemfixarna-superfront.entry.js +20 -0
  159. package/dist/esm/hemfixarna-superfront.entry.js.map +1 -0
  160. package/dist/esm/hemfixarna-tesla.entry.js +19 -0
  161. package/dist/esm/hemfixarna-tesla.entry.js.map +1 -0
  162. package/dist/esm/hemfixarna-traningspartner.entry.js +19 -0
  163. package/dist/esm/hemfixarna-traningspartner.entry.js.map +1 -0
  164. package/dist/esm/hemfixarna-zaptec.entry.js +19 -0
  165. package/dist/esm/hemfixarna-zaptec.entry.js.map +1 -0
  166. package/dist/esm/{index-8c417125.js → index-04bcf90e.js} +2 -2
  167. package/dist/esm/index-04bcf90e.js.map +1 -0
  168. package/dist/esm/index-113a6b21.js +256 -0
  169. package/dist/esm/index-113a6b21.js.map +1 -0
  170. package/dist/esm/index-1fbc7a74.js +42 -0
  171. package/dist/esm/index-1fbc7a74.js.map +1 -0
  172. package/dist/esm/loader.js +3 -3
  173. package/dist/esm/loader.js.map +1 -1
  174. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
  175. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  176. package/dist/hemfixarna-components/p-12dbf4e6.entry.js +2 -0
  177. package/dist/hemfixarna-components/p-12dbf4e6.entry.js.map +1 -0
  178. package/dist/hemfixarna-components/p-1b80999e.entry.js +2 -0
  179. package/dist/hemfixarna-components/p-1b80999e.entry.js.map +1 -0
  180. package/dist/hemfixarna-components/p-1f875c7a.entry.js +2 -0
  181. package/dist/hemfixarna-components/p-1f875c7a.entry.js.map +1 -0
  182. package/dist/hemfixarna-components/{p-852e7173.js → p-32a8152b.js} +2 -2
  183. package/dist/hemfixarna-components/p-32a8152b.js.map +1 -0
  184. package/dist/hemfixarna-components/p-3acd1346.entry.js +2 -0
  185. package/dist/hemfixarna-components/p-3acd1346.entry.js.map +1 -0
  186. package/dist/hemfixarna-components/p-53afbc10.entry.js +2 -0
  187. package/dist/hemfixarna-components/p-53afbc10.entry.js.map +1 -0
  188. package/dist/hemfixarna-components/p-53f0abfa.entry.js +2 -0
  189. package/dist/hemfixarna-components/p-53f0abfa.entry.js.map +1 -0
  190. package/dist/hemfixarna-components/p-61b4597f.entry.js +2 -0
  191. package/dist/hemfixarna-components/p-61b4597f.entry.js.map +1 -0
  192. package/dist/hemfixarna-components/p-6c1d21dd.entry.js +2 -0
  193. package/dist/hemfixarna-components/p-6c1d21dd.entry.js.map +1 -0
  194. package/dist/hemfixarna-components/p-6f6601b8.entry.js +2 -0
  195. package/dist/hemfixarna-components/p-6f6601b8.entry.js.map +1 -0
  196. package/dist/hemfixarna-components/p-7c122f15.entry.js +2 -0
  197. package/dist/hemfixarna-components/p-7c122f15.entry.js.map +1 -0
  198. package/dist/hemfixarna-components/p-8356796a.entry.js +2 -0
  199. package/dist/hemfixarna-components/p-8356796a.entry.js.map +1 -0
  200. package/dist/hemfixarna-components/p-8d509bf1.entry.js +2 -0
  201. package/dist/hemfixarna-components/p-8d509bf1.entry.js.map +1 -0
  202. package/dist/hemfixarna-components/p-8f0a688c.entry.js +2 -0
  203. package/dist/hemfixarna-components/p-8f0a688c.entry.js.map +1 -0
  204. package/dist/hemfixarna-components/p-9b1e6bc2.entry.js +2 -0
  205. package/dist/hemfixarna-components/p-9b1e6bc2.entry.js.map +1 -0
  206. package/dist/hemfixarna-components/p-a3d759d9.js +2 -0
  207. package/dist/hemfixarna-components/p-a3d759d9.js.map +1 -0
  208. package/dist/hemfixarna-components/p-a9845efc.entry.js +2 -0
  209. package/dist/hemfixarna-components/p-a9845efc.entry.js.map +1 -0
  210. package/dist/hemfixarna-components/p-ae3fc85c.entry.js +2 -0
  211. package/dist/hemfixarna-components/p-ae3fc85c.entry.js.map +1 -0
  212. package/dist/hemfixarna-components/p-b6bc1537.entry.js +2 -0
  213. package/dist/hemfixarna-components/p-b6bc1537.entry.js.map +1 -0
  214. package/dist/hemfixarna-components/p-cb1634e8.entry.js +2 -0
  215. package/dist/hemfixarna-components/p-cb1634e8.entry.js.map +1 -0
  216. package/dist/hemfixarna-components/p-cfdc93e9.js +2 -0
  217. package/dist/hemfixarna-components/p-cfdc93e9.js.map +1 -0
  218. package/dist/hemfixarna-components/p-dabad8a7.entry.js +2 -0
  219. package/dist/hemfixarna-components/p-dabad8a7.entry.js.map +1 -0
  220. package/dist/hemfixarna-components/p-dfcefa54.entry.js +2 -0
  221. package/dist/hemfixarna-components/p-dfcefa54.entry.js.map +1 -0
  222. package/dist/hemfixarna-components/p-e0aad0ff.entry.js +2 -0
  223. package/dist/hemfixarna-components/p-e0aad0ff.entry.js.map +1 -0
  224. package/dist/hemfixarna-components/p-edac9f21.entry.js +2 -0
  225. package/dist/hemfixarna-components/p-edac9f21.entry.js.map +1 -0
  226. package/dist/types/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.d.ts +1 -6
  227. package/dist/types/components/customers/hemfixarna-doro/hemfixarna-doro.d.ts +0 -1
  228. package/dist/types/components/customers/hemfixarna-elfa/hemfixarna-elfa.d.ts +0 -2
  229. package/dist/types/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.d.ts +0 -2
  230. package/dist/types/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.d.ts +0 -2
  231. package/dist/types/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.d.ts +0 -1
  232. package/dist/types/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.d.ts +0 -2
  233. package/dist/types/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.d.ts +0 -2
  234. package/dist/types/components/customers/hemfixarna-klint/hemfixarna-klint.d.ts +0 -1
  235. package/dist/types/components/customers/hemfixarna-kund/hemfixarna-kund.d.ts +0 -1
  236. package/dist/types/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.d.ts +0 -2
  237. package/dist/types/components/customers/hemfixarna-power/hemfixarna-power.d.ts +0 -2
  238. package/dist/types/components/customers/hemfixarna-skanska/hemfixarna-skanska.d.ts +0 -2
  239. package/dist/types/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.d.ts +0 -2
  240. package/dist/types/components/customers/hemfixarna-string/hemfixarna-string-furniture.d.ts +0 -1
  241. package/dist/types/components/customers/hemfixarna-tesla/hemfixarna-tesla.d.ts +0 -2
  242. package/dist/types/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.d.ts +0 -1
  243. package/dist/types/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.d.ts +0 -2
  244. package/dist/types/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.d.ts +0 -4
  245. package/dist/types/components/hemfixarna-cart/hemfixarna-cart.d.ts +0 -2
  246. package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +2 -18
  247. package/dist/types/components/hemfixarna-demo/hemfixarna-demo.d.ts +4 -2
  248. package/dist/types/components/hemfixarna-order/hemfixarna-order.d.ts +0 -2
  249. package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +1 -2
  250. package/dist/types/components.d.ts +2 -100
  251. package/dist/types/types/index.d.ts +24 -22
  252. package/dist/types/utils/api.d.ts +5 -1
  253. package/dist/types/utils/enviroment.d.ts +3 -0
  254. package/package.json +4 -3
  255. package/readme.md +22 -0
  256. package/dist/cjs/hemfixarna-address_36.cjs.entry.js.map +0 -1
  257. package/dist/esm/hemfixarna-address_36.entry.js.map +0 -1
  258. package/dist/esm/index-8c417125.js.map +0 -1
  259. package/dist/hemfixarna-components/p-852e7173.js.map +0 -1
  260. package/dist/hemfixarna-components/p-97461831.entry.js +0 -2
  261. package/dist/hemfixarna-components/p-97461831.entry.js.map +0 -1
@@ -1,255 +1,6 @@
1
- import { g as getRenderingRef, f as forceUpdate, r as registerInstance, h, a as getElement, F as Fragment, c as getAssetPath } from './index-8c417125.js';
2
-
3
- const appendToMap = (map, propName, value) => {
4
- const items = map.get(propName);
5
- if (!items) {
6
- map.set(propName, [value]);
7
- }
8
- else if (!items.includes(value)) {
9
- items.push(value);
10
- }
11
- };
12
- const debounce = (fn, ms) => {
13
- let timeoutId;
14
- return (...args) => {
15
- if (timeoutId) {
16
- clearTimeout(timeoutId);
17
- }
18
- timeoutId = setTimeout(() => {
19
- timeoutId = 0;
20
- fn(...args);
21
- }, ms);
22
- };
23
- };
24
-
25
- /**
26
- * Check if a possible element isConnected.
27
- * The property might not be there, so we check for it.
28
- *
29
- * We want it to return true if isConnected is not a property,
30
- * otherwise we would remove these elements and would not update.
31
- *
32
- * Better leak in Edge than to be useless.
33
- */
34
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
35
- const cleanupElements = debounce((map) => {
36
- for (let key of map.keys()) {
37
- map.set(key, map.get(key).filter(isConnected));
38
- }
39
- }, 2000);
40
- const stencilSubscription = () => {
41
- if (typeof getRenderingRef !== 'function') {
42
- // If we are not in a stencil project, we do nothing.
43
- // This function is not really exported by @stencil/core.
44
- return {};
45
- }
46
- const elmsToUpdate = new Map();
47
- return {
48
- dispose: () => elmsToUpdate.clear(),
49
- get: (propName) => {
50
- const elm = getRenderingRef();
51
- if (elm) {
52
- appendToMap(elmsToUpdate, propName, elm);
53
- }
54
- },
55
- set: (propName) => {
56
- const elements = elmsToUpdate.get(propName);
57
- if (elements) {
58
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
59
- }
60
- cleanupElements(elmsToUpdate);
61
- },
62
- reset: () => {
63
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
64
- cleanupElements(elmsToUpdate);
65
- },
66
- };
67
- };
68
-
69
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
70
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
71
- const unwrappedState = unwrap(defaultState);
72
- let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
73
- const handlers = {
74
- dispose: [],
75
- get: [],
76
- set: [],
77
- reset: [],
78
- };
79
- const reset = () => {
80
- var _a;
81
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
82
- // otherwise, the state won't be properly reset
83
- states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
84
- handlers.reset.forEach((cb) => cb());
85
- };
86
- const dispose = () => {
87
- // Call first dispose as resetting the state would
88
- // cause less updates ;)
89
- handlers.dispose.forEach((cb) => cb());
90
- reset();
91
- };
92
- const get = (propName) => {
93
- handlers.get.forEach((cb) => cb(propName));
94
- return states.get(propName);
95
- };
96
- const set = (propName, value) => {
97
- const oldValue = states.get(propName);
98
- if (shouldUpdate(value, oldValue, propName)) {
99
- states.set(propName, value);
100
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
101
- }
102
- };
103
- const state = (typeof Proxy === 'undefined'
104
- ? {}
105
- : new Proxy(unwrappedState, {
106
- get(_, propName) {
107
- return get(propName);
108
- },
109
- ownKeys(_) {
110
- return Array.from(states.keys());
111
- },
112
- getOwnPropertyDescriptor() {
113
- return {
114
- enumerable: true,
115
- configurable: true,
116
- };
117
- },
118
- has(_, propName) {
119
- return states.has(propName);
120
- },
121
- set(_, propName, value) {
122
- set(propName, value);
123
- return true;
124
- },
125
- }));
126
- const on = (eventName, callback) => {
127
- handlers[eventName].push(callback);
128
- return () => {
129
- removeFromArray(handlers[eventName], callback);
130
- };
131
- };
132
- const onChange = (propName, cb) => {
133
- const unSet = on('set', (key, newValue) => {
134
- if (key === propName) {
135
- cb(newValue);
136
- }
137
- });
138
- // We need to unwrap the defaultState because it might be a function.
139
- // Otherwise we might not be sending the right reset value.
140
- const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
141
- return () => {
142
- unSet();
143
- unReset();
144
- };
145
- };
146
- const use = (...subscriptions) => {
147
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
148
- if (subscription.set) {
149
- unsubs.push(on('set', subscription.set));
150
- }
151
- if (subscription.get) {
152
- unsubs.push(on('get', subscription.get));
153
- }
154
- if (subscription.reset) {
155
- unsubs.push(on('reset', subscription.reset));
156
- }
157
- if (subscription.dispose) {
158
- unsubs.push(on('dispose', subscription.dispose));
159
- }
160
- return unsubs;
161
- }, []);
162
- return () => unsubs.forEach((unsub) => unsub());
163
- };
164
- const forceUpdate = (key) => {
165
- const oldValue = states.get(key);
166
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
167
- };
168
- return {
169
- state,
170
- get,
171
- set,
172
- on,
173
- onChange,
174
- use,
175
- dispose,
176
- reset,
177
- forceUpdate,
178
- };
179
- };
180
- const removeFromArray = (array, item) => {
181
- const index = array.indexOf(item);
182
- if (index >= 0) {
183
- array[index] = array[array.length - 1];
184
- array.length--;
185
- }
186
- };
187
-
188
- const createStore = (defaultState, shouldUpdate) => {
189
- const map = createObservableMap(defaultState, shouldUpdate);
190
- map.use(stencilSubscription());
191
- return map;
192
- };
193
-
194
- const { state, onChange, } = createStore({
195
- step: 1,
196
- checkoutStep: 1,
197
- checkoutEdit: false,
198
- selectedCategory: null,
199
- selectedService: null,
200
- selectedProduct: null,
201
- cart: [],
202
- business: 'undefined',
203
- options: null,
204
- rut: true,
205
- rot: true,
206
- green: true,
207
- token: null,
208
- user: null,
209
- modal: null,
210
- rutOptions: null,
211
- rotOptions: null,
212
- greenOptions: null,
213
- customer: null,
214
- selectedCustomerCategory: null,
215
- parentCategory: null,
216
- creditSafeUser: null,
217
- checkoutInvoice: false,
218
- maleri: false,
219
- sources: null,
220
- });
221
- onChange('cart', cart => {
222
- window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
223
- });
224
- onChange('user', user => {
225
- window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
226
- });
227
- onChange('creditSafeUser', user => {
228
- window.sessionStorage.setItem(`hemfixarna-${state.business}-creditSafeUser`, JSON.stringify(user));
229
- });
230
- onChange('selectedProduct', product => {
231
- if (!state.customer || !product)
232
- return;
233
- const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
234
- const category = categories.find(c => c && c.id === product.category);
235
- if (category) {
236
- state.parentCategory = category;
237
- return;
238
- }
239
- state.parentCategory = null;
240
- });
241
- onChange('selectedCustomerCategory', category => {
242
- if (!state.customer || !category)
243
- return;
244
- if (category.parent) {
245
- const parent = state.customer.categories.find(c => c.id === category.parent);
246
- if (parent) {
247
- state.parentCategory = parent;
248
- return;
249
- }
250
- }
251
- state.parentCategory = null;
252
- });
1
+ import { r as registerInstance, h, g as getElement, F as Fragment, a as getAssetPath } from './index-04bcf90e.js';
2
+ import { s as state } from './index-113a6b21.js';
3
+ import { B as Business, W as WidgetStyle } from './index-1fbc7a74.js';
253
4
 
254
5
  const hideField = (field) => {
255
6
  return field.split(' ').reduce((acc, curr) => {
@@ -443,41 +194,6 @@ const getTotalPrice = () => {
443
194
  return state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;
444
195
  };
445
196
 
446
- var Business;
447
- (function (Business) {
448
- Business["kund"] = "kund";
449
- Business["byggmax"] = "byggmax";
450
- Business["skanska"] = "skanska";
451
- Business["string"] = "string-furniture";
452
- Business["hornbach"] = "hornbach";
453
- Business["forebygg"] = "forebygg";
454
- Business["doro"] = "doro";
455
- Business["elfa"] = "elfa";
456
- Business["kbygg"] = "k-bygg";
457
- Business["norrgavel"] = "norrgavel";
458
- Business["fargvaruhuset"] = "fargvaruhuset";
459
- Business["zaptec"] = "zaptec";
460
- Business["tesla"] = "tesla";
461
- Business["klint"] = "klint";
462
- Business["flyttsmart"] = "flyttsmart";
463
- Business["lg"] = "lg";
464
- Business["sparfonster"] = "sparfonster";
465
- Business["power"] = "power";
466
- Business["traningspartner"] = "traningspartner";
467
- Business["superfront"] = "superfront";
468
- })(Business || (Business = {}));
469
- var WidgetStyle;
470
- (function (WidgetStyle) {
471
- WidgetStyle["standard"] = "standard";
472
- WidgetStyle["alternative"] = "alternative";
473
- WidgetStyle["alternative_2"] = "alternative_2";
474
- WidgetStyle["alternative_3"] = "alternative_3";
475
- })(WidgetStyle || (WidgetStyle = {}));
476
- var TopCategory;
477
- (function (TopCategory) {
478
- TopCategory["byggmax"] = "category/bygg";
479
- })(TopCategory || (TopCategory = {}));
480
-
481
197
  const isProduct = (category) => {
482
198
  return category.post_name !== undefined;
483
199
  };
@@ -531,10 +247,7 @@ const HemfixarnaBreadcrumbs = class {
531
247
  const el = this.el.nextSibling;
532
248
  scrollToTop(el);
533
249
  };
534
- this.tree = undefined;
535
250
  this.closeModal = undefined;
536
- this.loadFromQuery = false;
537
- this.isDemo = false;
538
251
  }
539
252
  getCartLength() {
540
253
  return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
@@ -563,7 +276,7 @@ const HemfixarnaBreadcrumbs = class {
563
276
  const close = getAssetPath(`./assets/close.svg`);
564
277
  const cart = getAssetPath(`./assets/cart.svg`);
565
278
  const back = getAssetPath(`./assets/back.svg`);
566
- return (h("div", null, h("div", { class: "hemfixarna_crumbs" }, h("div", { class: "hemfixarna_crumbs--links" }, h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), !this.loadFromQuery || this.isDemo ? h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }) : null, h("div", null, h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), h("div", { class: "hemfixarna_crumbs--right" }, h("hemfixarna-contact", null), h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, h("img", { src: cart, width: 24 }), h("span", null, this.getCartLength())))), [3, 4].includes(state.step) && !state.customer && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
279
+ return (h("div", null, h("div", { class: "hemfixarna_crumbs" }, h("div", { class: "hemfixarna_crumbs--links" }, h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }), h("div", null, h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), h("div", { class: "hemfixarna_crumbs--right" }, h("hemfixarna-contact", null), h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, h("img", { src: cart, width: 24 }), h("span", null, this.getCartLength())))), [3, 4].includes(state.step) && !state.customer && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
567
280
  state.step = state.step === 4 ? 3 : 2;
568
281
  } }, h("img", { width: 24, src: back, alt: "back arrow" }), h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name))), !state.parentCategory && state.step && state.selectedCustomerCategory && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
569
282
  state.step = 1;
@@ -580,84 +293,75 @@ const HemfixarnaBreadcrumbs = class {
580
293
  get el() { return getElement(this); }
581
294
  };
582
295
 
583
- const hemfixarnaByggmaxCss = "";
584
-
585
- const MyComponent$j = class {
586
- constructor(hostRef) {
587
- registerInstance(this, hostRef);
588
- this.tree = null;
589
- this.slug = undefined;
590
- this.id = undefined;
591
- this.forceOldTree = false;
592
- this.loadFromQuery = undefined;
593
- this.customer = undefined;
594
- this.widgetStyle = WidgetStyle.standard;
595
- this.buttonColor = undefined;
596
- this.buttonBg = undefined;
597
- }
598
- render() {
599
- return (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 }));
600
- }
601
- };
602
- MyComponent$j.style = hemfixarnaByggmaxCss;
603
-
604
296
  const HemfixarnaCart = class {
605
297
  constructor(hostRef) {
606
298
  registerInstance(this, hostRef);
607
- this.tree = undefined;
608
299
  }
609
300
  render() {
610
301
  const back = getAssetPath(`./assets/back.svg`);
611
302
  return (h("div", { class: "hemfixarna_cart" }, h("div", { class: "hemfixarna_cart--left" }, h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (h("button", { onClick: () => {
612
303
  state.checkoutStep = 1;
613
- } }, h("img", { width: 24, src: back, alt: "back arrow" }))), "Din bokning"), h("hemfixarna-orderrows", { tree: this.tree })), h("div", { class: "hemfixarna_cart--right" }, h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (h("button", { onClick: () => {
304
+ } }, h("img", { width: 24, src: back, alt: "back arrow" }))), "Din bokning"), h("hemfixarna-orderrows", null)), h("div", { class: "hemfixarna_cart--right" }, h("h2", null, state.checkoutStep === 2 && !state.checkoutEdit && (h("button", { onClick: () => {
614
305
  state.checkoutStep = 1;
615
306
  } }, h("img", { width: 24, src: back, alt: "back arrow" }))), "Dina uppgifter"), h("hemfixarna-checkout", null), h("hemfixarna-info", null))));
616
307
  }
617
308
  };
618
309
 
619
- const HemfixarnaCategory = class {
620
- constructor(hostRef) {
621
- registerInstance(this, hostRef);
310
+ const livePreviewUrl = 'hemfixarna-partner.vercel.app';
311
+ const getDefaultApiUrl = () => {
312
+ if (window.location.href.includes('vercel.app') && !window.location.href.includes(livePreviewUrl)) {
313
+ return 'https://hemfixare.dev.afonso.se';
622
314
  }
623
- setSelectedService(service) {
624
- state.selectedService = service;
625
- state.step = 3;
315
+ else {
316
+ return 'https://hemfixarna.se';
626
317
  }
627
- render() {
628
- return (h("div", null, h("h2", null, state.selectedCategory.name), h("div", { class: "hemfixarna_categories--wrapper" }, h("div", null, h("ul", { class: "hemfixarna_categories" }, state.selectedCategory.services
629
- .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
630
- .map(s => {
631
- var _a;
632
- return (h("hemfixarna-box", { post: s, icon: (_a = s.icon.url) !== null && _a !== void 0 ? _a : s.icon, postTitle: s.post_title }));
633
- }))), h("hemfixarna-info", null))));
318
+ };
319
+ const getApiUrl = () => {
320
+ if (typeof process !== 'undefined' && process.env && process.env.API_URL) {
321
+ return process.env.API_URL;
634
322
  }
323
+ return getDefaultApiUrl();
324
+ };
325
+ const getDefaultCreditSafeApiUrl = () => {
326
+ if (window.location.href.includes('vercel.app')) {
327
+ return 'https://hemfixare-lookup-dev.vercel.app/api';
328
+ }
329
+ else {
330
+ return 'https://hemfixare-lookup.vercel.app/api';
331
+ }
332
+ };
333
+ const getCreditSafeApiUrl = () => {
334
+ if (typeof process !== 'undefined' && process.env && process.env.CREDIT_SAFE_API_URL) {
335
+ return process.env.CREDIT_SAFE_API_URL;
336
+ }
337
+ return getDefaultCreditSafeApiUrl();
635
338
  };
636
339
 
637
- const base$2 = `${"https://hemfixarna.se"}/wp-json/headless` ;
340
+ const base$2 = `${getApiUrl()}/wp-json/headless`;
638
341
  async function fetchWithType(request, options) {
639
342
  const response = await fetch(request, options);
640
343
  const body = await response.json();
641
344
  return body;
642
345
  }
643
- const getTaxonomy = async (endpoint) => {
644
- if (!endpoint) {
645
- return;
646
- }
647
- const type = endpoint.split('/')[0];
648
- const slug = endpoint.split('/')[1];
346
+ const getCustomer = async (slug) => {
649
347
  try {
650
- const res = await fetch(`${base$2}/${type}/${slug}`);
348
+ const res = await fetch(`${base$2}/customer/${slug}`);
651
349
  return await res.json();
652
350
  }
653
351
  catch (error) {
654
352
  console.log(error);
655
353
  }
656
354
  };
657
- const getCustomer = async (slug) => {
355
+ const loginCustomer = async ({ id, password }) => {
658
356
  try {
659
- const res = await fetch(`${base$2}/customer/${slug}`);
660
- return await res.json();
357
+ const res = await fetch(`${base$2}/customer/login`, {
358
+ method: 'POST',
359
+ body: JSON.stringify({ id, password }),
360
+ headers: {
361
+ 'Content-Type': 'application/json',
362
+ },
363
+ });
364
+ return res.status;
661
365
  }
662
366
  catch (error) {
663
367
  console.log(error);
@@ -715,7 +419,7 @@ const postOrder = async (data) => {
715
419
  }
716
420
  };
717
421
 
718
- const base$1 = `${"https://hemfixarna.se"}/wp-json/felix` ;
422
+ const base$1 = `${getApiUrl()}/wp-json/felix`;
719
423
  const postPerson = async (felixOrder) => {
720
424
  try {
721
425
  return await fetchWithType(`${base$1}/createperson`, {
@@ -899,31 +603,19 @@ const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=In
899
603
  const HemfixarnaComponent = class {
900
604
  constructor(hostRef) {
901
605
  registerInstance(this, hostRef);
902
- this.slugIsOldFormat = (slug) => {
903
- if (!slug)
904
- return false;
905
- return ['product', 'service', 'category'].some(str => slug.includes(str));
906
- };
907
606
  this.triggerScrollTotop = () => {
908
607
  const el = this.el.shadowRoot.querySelector('.hemfixarna_content');
909
608
  scrollToTop(el);
910
609
  };
911
610
  this.modal = false;
912
611
  this.showModal = false;
913
- this.tree = null;
914
612
  this.product = null;
915
- this.proppedProduct = null;
916
- this.slug = undefined;
917
613
  this.id = undefined;
918
614
  this.business = undefined;
919
- this.topCategory = undefined;
920
- this.forceOldTree = false;
921
- this.loadFromQuery = false;
922
- this.isDemo = false;
923
- this.widgetStyle = undefined;
924
- this.nav = undefined;
615
+ this.widgetStyle = WidgetStyle.standard;
925
616
  this.buttonColor = undefined;
926
617
  this.buttonBg = undefined;
618
+ this.proppedProduct = null;
927
619
  }
928
620
  loadCategoryOrProduct(id) {
929
621
  this.proppedProduct = null;
@@ -948,14 +640,6 @@ const HemfixarnaComponent = class {
948
640
  }
949
641
  }
950
642
  }
951
- async watchSlugChange(newValue) {
952
- if (this.slugIsOldFormat(newValue)) {
953
- this.fetchNewTaxonomy(newValue);
954
- }
955
- else if (state.customer && newValue) {
956
- this.loadCategoryOrProduct(newValue);
957
- }
958
- }
959
643
  async watchIdChange(id) {
960
644
  if (id && state.customer) {
961
645
  if (id === 'maleri') {
@@ -967,22 +651,6 @@ const HemfixarnaComponent = class {
967
651
  }
968
652
  }
969
653
  }
970
- async fetchNewTaxonomy(slug) {
971
- state.selectedCategory = null;
972
- state.selectedProduct = null;
973
- state.selectedService = null;
974
- state.maleri = null;
975
- const res = await getTaxonomy(slug);
976
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found' || (res === null || res === void 0 ? void 0 : res.code) === 'rest_no_route') {
977
- console.log('taxonomy not found');
978
- }
979
- else if (res) {
980
- this.setTaxonomy(res);
981
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
982
- this.product = res;
983
- }
984
- }
985
- }
986
654
  async componentWillLoad() {
987
655
  state.business = this.business;
988
656
  const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
@@ -997,88 +665,33 @@ const HemfixarnaComponent = class {
997
665
  if (creditSafeUser) {
998
666
  state.creditSafeUser = JSON.parse(creditSafeUser);
999
667
  }
1000
- const [tree, res, options, rut, rot, greenDiscount] = await Promise.all([
1001
- this.topCategory ? getTaxonomy(this.topCategory) : null,
1002
- this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
1003
- getOptions(),
1004
- getRut(),
1005
- getRot(),
1006
- getGreenDiscount(),
1007
- ]);
1008
- if ((!this.slug || !this.slugIsOldFormat(this.slug)) && !this.forceOldTree) {
1009
- try {
1010
- const customer = await getCustomer(this.business);
1011
- if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
1012
- console.warn('customer not found');
1013
- }
1014
- else if (customer) {
1015
- state.customer = customer;
1016
- if (this.id) {
1017
- if (this.id === 'maleri') {
1018
- state.maleri = true;
1019
- state.step = 4;
1020
- }
1021
- else {
1022
- this.loadCategoryOrProduct(this.id);
1023
- }
668
+ const [options, rut, rot, greenDiscount] = await Promise.all([getOptions(), getRut(), getRot(), getGreenDiscount()]);
669
+ try {
670
+ const customer = await getCustomer(this.business);
671
+ if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
672
+ console.warn('customer not found');
673
+ }
674
+ else if (customer) {
675
+ state.customer = customer;
676
+ if (this.id) {
677
+ if (this.id === 'maleri') {
678
+ state.maleri = true;
679
+ state.step = 4;
1024
680
  }
1025
- else if (this.slug && !this.slugIsOldFormat(this.slug)) {
1026
- this.loadCategoryOrProduct(this.slug);
681
+ else {
682
+ this.loadCategoryOrProduct(this.id);
1027
683
  }
1028
684
  }
1029
685
  }
1030
- catch (error) {
1031
- console.warn('customer not found');
1032
- }
1033
- }
1034
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
1035
- else if (tree) {
1036
- this.tree = tree;
1037
- }
1038
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
1039
- console.log('taxonomy not found');
1040
- }
1041
- else if (res) {
1042
- this.setTaxonomy(res);
1043
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
1044
- this.product = res;
1045
- }
1046
686
  }
1047
- if (this.loadFromQuery) {
1048
- const params = new URL(document.location.toString()).searchParams;
1049
- this.id = params.get('id');
1050
- if (!this.isDemo) {
1051
- this.openModal();
1052
- }
687
+ catch (error) {
688
+ console.warn('customer not found');
1053
689
  }
1054
690
  state.rotOptions = rot;
1055
691
  state.rutOptions = rut;
1056
692
  state.greenOptions = greenDiscount;
1057
693
  state.options = options;
1058
694
  }
1059
- setTaxonomy(taxonomy) {
1060
- if (taxonomy) {
1061
- if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
1062
- state.selectedCategory = taxonomy;
1063
- state.step = 2;
1064
- }
1065
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
1066
- state.selectedService = taxonomy;
1067
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === taxonomy.ID));
1068
- state.step = 3;
1069
- }
1070
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
1071
- state.selectedProduct = taxonomy;
1072
- state.selectedService = this.tree.sub_cats
1073
- .map(c => c.services)
1074
- .flat()
1075
- .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));
1076
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));
1077
- state.step = 4;
1078
- }
1079
- this.triggerScrollTotop();
1080
- }
1081
- }
1082
695
  // Open close modal && click outside event
1083
696
  openModal() {
1084
697
  this.modal = true;
@@ -1093,8 +706,6 @@ const HemfixarnaComponent = class {
1093
706
  }, 200);
1094
707
  }
1095
708
  handleClick(e) {
1096
- if (this.loadFromQuery && !this.isDemo)
1097
- return;
1098
709
  if ((e === null || e === void 0 ? void 0 : e.composedPath()[0]).classList.contains('hemfixarna_backdrop')) {
1099
710
  this.closeModal();
1100
711
  }
@@ -1110,21 +721,18 @@ const HemfixarnaComponent = class {
1110
721
  return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
1111
722
  }
1112
723
  render() {
1113
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
724
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1114
725
  const logo = getAssetPath(`./assets/hemfixarna.svg`);
1115
726
  const pensel = getAssetPath(`./assets/pensel.svg`);
1116
727
  const monteringLogo = getAssetPath(`./assets/montering.svg`);
1117
- const navBackground = ((_a = this.nav) === null || _a === void 0 ? void 0 : _a.background) ? getAssetPath(this.nav.background) : '';
1118
- const navLogo = ((_b = this.nav) === null || _b === void 0 ? void 0 : _b.logo) ? getAssetPath(this.nav.logo) : '';
1119
- return (h("div", { class: `hemfixarna ${this.loadFromQuery ? 'hemfixarna_standalone' : ''}` }, this.loadFromQuery && !this.isDemo && this.nav ? (h("nav", { class: "hemfixarna_nav", style: { backgroundColor: (_c = this.nav.backgroundColor) !== null && _c !== void 0 ? _c : '' } }, h("div", null, h("div", { class: "hemfixarna_nav--logos" }, h("a", { href: this.nav.url, target: "_blank" }, h("img", { class: "hemfixarna_partnerlogo", src: navLogo, alt: `${this.business} logo` })), h("a", { href: "https://hemfixarna.se/", target: "_blank" }, h("p", { class: navBackground || this.nav.backgroundColor ? 'with-bg' : '' }, "I samarbete med:"), h("img", { src: logo, alt: "hemfixarna_logo", width: 104 }))), h("div", { class: "hemfixarna_nav--links" }, h("a", { href: this.nav.url, target: "_blank" }, "Till ", this.business), h("a", { href: "https://www.hemfixarna.se/", target: "_blank" }, "Till Hemfixarna")), navBackground ? h("img", { src: navBackground, class: "nav_background", alt: "nav_background" }) : null))) : null, !this.loadFromQuery || this.isDemo ? (h("div", { class: `hemfixarna_box hemfixarna_box--${this.widgetStyle}` }, [WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) ? (h("img", { src: this.id === 'maleri' ? pensel : monteringLogo, alt: "montering logo", width: 32, height: 32 })) : null, h("div", null, h("div", null, h("p", { onClick: () => this.openModal(), class: `pointer ${[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) && state.selectedProduct ? 'underline' : ''}` }, this.id === 'maleri' ? (h("span", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r")) : (h(Fragment, null, !state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (h(Fragment, null, ((_d = state.customer) === null || _d === void 0 ? void 0 : _d.widget_title) ? (h("span", null, state.customer.widget_title)) : (h("span", null, "Montering/Installation - ", h("strong", { class: "underline" }, "se priser h\u00E4r"))))) : (h(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) || (h("span", null, "Montering", h("wbr", null), "/Installation ", (_j = (_h = state.selectedCustomerCategory) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : 'på plats', " - ", 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)) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || this.product), "kr"))) : null)))))), this.widgetStyle === WidgetStyle.standard ? h("img", { src: logo, width: 104 }) : null, this.widgetStyle === WidgetStyle.alternative ? (h("span", { class: "p-s" }, "Utf\u00F6rs av ", h("strong", null, "Hemfixarna"))) : null), [WidgetStyle.standard, WidgetStyle.alternative].includes(this.widgetStyle) ? (h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn", style: {
1120
- 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}`,
1121
- 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}`,
1122
- } }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && h("span", null, this.getCartLength()))) : null, WidgetStyle.alternative_2 === this.widgetStyle ? (h("div", { class: "hemfixarna_altbtn" }, h("strong", { class: "p-s" }, "Utf\u00F6rs av"), h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null)) : null, this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && (h("hemfixarna-breadcrumbs", { isDemo: this.isDemo, loadFromQuery: this.loadFromQuery, closeModal: () => this.closeModal(), tree: this.tree })), !state.customer || this.slugIsOldFormat(this.slug) ? (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && h("hemfixarna-category", null), state.step === 3 && state.selectedService && h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree }))) : (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}` }, state.step < 4 && h("hemfixarna-start", null), state.step === 4 && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree })))), !this.isDemo ? h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` }) : null))));
728
+ return (h("div", { class: "hemfixarna" }, h("div", { class: `hemfixarna_box hemfixarna_box--${this.widgetStyle}` }, [WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) ? (h("img", { src: this.id === 'maleri' ? pensel : monteringLogo, alt: "montering logo", width: 32, height: 32 })) : null, h("div", null, h("div", null, h("p", { onClick: () => this.openModal(), class: `pointer ${[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) && state.selectedProduct ? 'underline' : ''}` }, this.id === 'maleri' ? (h("span", null, "Ber\u00E4kna fast pris p\u00E5 m\u00E5leri & tapetsering h\u00E4r")) : (h(Fragment, null, !state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (h(Fragment, null, ((_a = state.customer) === null || _a === void 0 ? void 0 : _a.widget_title) ? (h("span", null, state.customer.widget_title)) : (h("span", null, "Montering/Installation - ", h("strong", { class: "underline" }, "se priser h\u00E4r"))))) : (h(Fragment, null, ((_b = this.product) === null || _b === void 0 ? void 0 : _b.title) || ((_c = this.proppedProduct) === null || _c === void 0 ? void 0 : _c.title) || ((_d = state.selectedCustomerCategory) === null || _d === void 0 ? void 0 : _d.widget_title) || (h("span", null, "Montering", h("wbr", null), "/Installation ", (_f = (_e = state.selectedCustomerCategory) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'på plats', " - ", h("strong", { class: "underline" }, "se priser h\u00E4r"))), this.proppedProduct && !((_g = this.product) === null || _g === void 0 ? void 0 : _g.invoice) && !((_h = this.proppedProduct) === null || _h === void 0 ? void 0 : _h.invoice) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || this.product), "kr"))) : null)))))), this.widgetStyle === WidgetStyle.standard ? h("img", { src: logo, width: 104 }) : null, this.widgetStyle === WidgetStyle.alternative ? (h("span", { class: "p-s" }, "Utf\u00F6rs av ", h("strong", null, "Hemfixarna"))) : null), [WidgetStyle.standard, WidgetStyle.alternative].includes(this.widgetStyle) ? (h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn", style: {
729
+ color: ((_j = this.buttonColor) === null || _j === void 0 ? void 0 : _j.startsWith('#')) || !((_k = this.buttonColor) === null || _k === void 0 ? void 0 : _k.length) ? this.buttonColor : `#${this.buttonColor}`,
730
+ backgroundColor: ((_l = this.buttonBg) === null || _l === void 0 ? void 0 : _l.startsWith('#')) || !((_m = this.buttonBg) === null || _m === void 0 ? void 0 : _m.length) ? this.buttonBg : `#${this.buttonBg}`,
731
+ } }, "Best\u00E4ll h\u00E4r", this.getCartLength() > 0 && h("span", null, this.getCartLength()))) : null, WidgetStyle.alternative_2 === this.widgetStyle ? (h("div", { class: "hemfixarna_altbtn" }, h("strong", { class: "p-s" }, "Utf\u00F6rs av"), h("img", { src: logo, alt: "hemfixarna logo", width: 98 }))) : null), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), state.customer && h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal() }), h("div", { class: `hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}` }, state.step < 4 && h("hemfixarna-start", null), state.step === 4 && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", null), state.step === 6 && h("hemfixarna-order", null))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
1123
732
  }
1124
733
  static get assetsDirs() { return ["assets"]; }
1125
734
  get el() { return getElement(this); }
1126
735
  static get watchers() { return {
1127
- "slug": ["watchSlugChange"],
1128
736
  "id": ["watchIdChange"]
1129
737
  }; }
1130
738
  };
@@ -1142,7 +750,7 @@ const HemfixarnaInfo$1 = class {
1142
750
 
1143
751
  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}";
1144
752
 
1145
- const MyComponent$i = class {
753
+ const MyComponent = class {
1146
754
  constructor(hostRef) {
1147
755
  registerInstance(this, hostRef);
1148
756
  this.debounce = null;
@@ -1157,6 +765,8 @@ const MyComponent$i = class {
1157
765
  this.buttonColor = '';
1158
766
  this.partner = undefined;
1159
767
  this.colorAccessibility = undefined;
768
+ this.loggedIn = false;
769
+ this.loginError = false;
1160
770
  }
1161
771
  debouncedFunction() {
1162
772
  if (this.debounce !== null) {
@@ -1173,25 +783,22 @@ const MyComponent$i = class {
1173
783
  const defaultBgColor = '#c84e18';
1174
784
  const firstColor = this.buttonBg.length ? (this.buttonBg.startsWith('#') ? this.buttonBg : `#${this.buttonBg}`) : defaultBgColor;
1175
785
  const secondColor = this.buttonColor.length ? (this.buttonColor.startsWith('#') ? this.buttonColor : `#${this.buttonColor}`) : defaultTextColor;
1176
- fetch('https://www.aremycolorsaccessible.com/api/are-they', {
1177
- mode: 'cors',
1178
- method: 'POST',
1179
- body: JSON.stringify({ colors: [firstColor, secondColor] }),
1180
- })
1181
- .then(response => response.json())
1182
- .then(json => {
786
+ try {
787
+ const response = await fetch('https://www.aremycolorsaccessible.com/api/are-they', {
788
+ mode: 'cors',
789
+ method: 'POST',
790
+ body: JSON.stringify({ colors: [firstColor, secondColor] }),
791
+ });
792
+ if (!response) {
793
+ throw new Error('Network response was not ok');
794
+ }
795
+ const json = await response.json();
1183
796
  if (json && (json)) {
1184
797
  this.colorAccessibility = json;
1185
798
  }
1186
- });
1187
- // Your color accessibility logic here
1188
- }
1189
- getTopLevelCategory() {
1190
- switch (process.env.BUSINESS) {
1191
- case Business.byggmax:
1192
- return TopCategory.byggmax;
1193
- default:
1194
- return '';
799
+ }
800
+ catch (error) {
801
+ console.warn('Error fetching color accessibility:', error);
1195
802
  }
1196
803
  }
1197
804
  getColor(rating) {
@@ -1209,25 +816,20 @@ const MyComponent$i = class {
1209
816
  }
1210
817
  }
1211
818
  async componentWillLoad() {
1212
- var _a;
1213
- if (process.env.FORCE_OLD_TREE) {
1214
- const tree = await getTaxonomy(this.getTopLevelCategory());
1215
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
1216
- else if (tree) {
1217
- this.tree = tree;
1218
- }
1219
- }
1220
- else {
1221
- const partner = window.location.pathname.replace('/', '');
1222
- this.partner = isBusiness(partner) ? partner : (_a = process.env.BUSINESS) !== null && _a !== void 0 ? _a : Business.kund;
1223
- const customer = await getCustomer(this.partner);
1224
- if (customer.code !== 'not_found' && customer) {
1225
- this.customer = customer;
819
+ const partner = window.location.pathname.replace('/', '');
820
+ if (!isBusiness(partner) && partner)
821
+ return;
822
+ this.partner = partner ? partner : Business.kund;
823
+ const customer = await getCustomer(this.partner);
824
+ if (customer.code !== 'not_found' && customer) {
825
+ this.customer = customer;
826
+ if (!this.customer.password_protected || window.localStorage.getItem(`${this.customer.ID}-loggedin`)) {
827
+ this.loggedIn = true;
1226
828
  }
1227
829
  }
1228
830
  }
1229
831
  getExample() {
1230
- 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}>`;
832
+ return `<hemfixarna-component business="${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-component>`;
1231
833
  }
1232
834
  copyExample() {
1233
835
  navigator.clipboard.writeText(this.getExample());
@@ -1255,100 +857,59 @@ const MyComponent$i = class {
1255
857
  const allCategories = (_a = this.customer) === null || _a === void 0 ? void 0 : _a.categories.map(c => (c.sub_categories ? c.sub_categories : c)).flat();
1256
858
  return allCategories === null || allCategories === void 0 ? void 0 : allCategories.some(c => c.add_painting);
1257
859
  }
860
+ async handleLogin() {
861
+ const shadowHost = document.querySelector('hemfixarna-demo');
862
+ const shadowRoot = shadowHost.shadowRoot;
863
+ const passwordInput = shadowRoot.querySelector('input[type="password"]');
864
+ const password = passwordInput.value;
865
+ this.loginError = false;
866
+ try {
867
+ const status = await loginCustomer({ id: this.customer.ID, password: password });
868
+ if (status === 200) {
869
+ this.loggedIn = true;
870
+ window.localStorage.setItem(`${this.customer.ID}-loggedin`, 'true');
871
+ }
872
+ else {
873
+ this.loginError = true;
874
+ }
875
+ }
876
+ catch (error) {
877
+ console.log(error);
878
+ this.loginError = true;
879
+ }
880
+ }
1258
881
  render() {
1259
882
  var _a;
1260
883
  const copy = getAssetPath(`./assets/copy.png`);
1261
- return (h("div", { class: ((_a = this.customer) === null || _a === void 0 ? void 0 : _a.at_hemfixarna) ? 'hemfixarna_hosted' : '' }, h("div", { class: "hemfixarna_scripts" }, h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, h("p", null, this.getExample()), h("img", { src: copy, height: 20 }), h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), this.partner === Business.byggmax && (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 && h("hemfixarna-skanska", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.sparfonster && (h("hemfixarna-sparfonster", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.string && (h("hemfixarna-string-furniture", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.hornbach && (h("hemfixarna-hornbach", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.traningspartner && (h("hemfixarna-traningspartner", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.superfront && (h("hemfixarna-superfront", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.zaptec && (h("hemfixarna-zaptec", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.tesla && (h("hemfixarna-tesla", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.forebygg && (h("hemfixarna-forebygg", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.doro && h("hemfixarna-doro", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.elfa && h("hemfixarna-elfa", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.kbygg && (h("hemfixarna-kbygg", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.fargvaruhuset && (h("hemfixarna-fargvaruhuset", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.norrgavel && (h("hemfixarna-norrgavel", { isDemo: true, buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.klint && h("hemfixarna-klint", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.flyttsmart && (h("hemfixarna-flyttsmart", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID })), this.partner === Business.power && h("hemfixarna-power", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), this.partner === Business.kund && h("hemfixarna-kund", { buttonColor: this.buttonColor, buttonBg: this.buttonBg, widgetStyle: this.widgetStyle, id: this.selectedID }), h("div", { class: "hemfixarna_install" }, h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, h("p", null, this.cdnLink), h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), h("img", { src: copy, height: 20 }))), h("div", { class: "hemfixarna_widgetstyles" }, h("h5", null, "Widget styles"), h("div", null, Object.values(WidgetStyle).map(style => (h("label", { key: style }, h("input", { type: "radio", value: style, checked: this.widgetStyle === style, onChange: () => (this.widgetStyle = style) }), style)))), h("div", null, h("div", null, h("h5", null, "Button background color"), h("input", { type: "text", value: this.buttonBg, onInput: e => (this.buttonBg = e.target.value) })), h("div", null, h("h5", null, "Button text color"), h("input", { type: "text", value: this.buttonColor, onInput: e => (this.buttonColor = e.target.value) })))), h("span", null, "Write an hexa code no # needed"), this.colorAccessibility ? (h("div", null, h("h5", null, "Tillg\u00E4nglighetsrapport"), h("div", null, h("strong", null, "Liten text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.small) } }, this.colorAccessibility.small), h("br", null), h("strong", null, "Fet text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.bold) } }, this.colorAccessibility.bold), h("br", null), h("strong", null, "Stor text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.large) } }, this.colorAccessibility.large), h("br", null), h("strong", null, "Kontrastf\u00F6rh\u00E5llande:"), " ", this.colorAccessibility.contrast))) : null), h("ul", { class: "hemfixarna_categories" }, this.customer ? (h("div", null, this.customer.logo ? (h("div", { style: { width: '100%', display: 'flex', justifyContent: 'center' } }, h("img", { style: { maxWidth: '250px', height: 'auto', margin: '0 auto 2rem' }, src: this.customer.logo.url, alt: this.customer.post_title }))) : null, this.showMaleri() ? (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, h("div", null, h("p", null, "M\u00E5leriverktyget"), h("span", null, "maleri")), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText('maleri') }, "Kopiera ID"), this.customer.at_hemfixarna ? (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")) : (h("button", { onClick: () => (this.selectedID = 'maleri') }, "Ladda m\u00E5leri")))))) : null, this.customer.categories.map(c => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, h("div", null, h("p", null, c.name), h("span", null, `c-${c.id}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`c-${c.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (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")) : (h("button", { onClick: () => (this.selectedID = `c-${c.id}`) }, "Ladda kategori")))), c.show_products && c.products ? (h("ul", null, c.products.map(p => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, h("div", null, h("p", null, p.fields.title), h("span", null, p.fields.ID)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (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")) : (h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt"))))))))) : (h("ul", null, c.sub_categories &&
1262
- c.sub_categories.map(sc => (h("li", null, h("div", { class: "hemfixarna_categories--label" }, h("div", null, h("p", null, sc.name), h("span", null, `c-${sc.id}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`c-${sc.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (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")) : (h("button", { onClick: () => (this.selectedID = `c-${sc.id}`) }, "Ladda kategori")))), h("ul", null, sc.products.map(p => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, h("div", null, h("p", null, p.fields.title), h("span", null, p.fields.ID)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (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")) : (h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt")))))))))))))))))) : this.tree ? (h("div", null, this.tree.sub_cats.map(c => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, h("div", null, h("p", null, c.name), h("span", null, `category/${c.slug}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`category/${c.slug}`) }, "Kopiera slug"), h("button", { onClick: () => (this.selectedSlug = `category/${c.slug}`) }, "Ladda kategori"))), h("ul", null, c.services.map(sc => (h("li", null, h("div", { class: "hemfixarna_categories--label" }, h("div", null, h("p", null, sc.post_title), h("span", null, `service/${sc.post_name}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`service/${sc.post_name}`) }, "Kopiera slug"), h("button", { onClick: () => (this.selectedSlug = `service/${sc.post_name}`) }, "Ladda kategori"))), h("ul", null, sc.products.map(sc => (h("li", null, h("div", { class: "hemfixarna_categories--label" }, h("div", null, h("p", null, sc.post_title), h("span", null, `product/${sc.post_name}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`product/${sc.post_name}`) }, "Kopiera slug"), h("button", { onClick: () => (this.selectedSlug = `product/${sc.post_name}`) }, "Ladda produkt")))))))))))))))) : null)));
884
+ return this.customer ? (h(Fragment, null, this.loggedIn ? (h("div", { class: ((_a = this.customer) === null || _a === void 0 ? void 0 : _a.at_hemfixarna) ? 'hemfixarna_hosted' : '' }, h("div", { class: "hemfixarna_scripts" }, h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, h("p", null, this.getExample()), h("img", { src: copy, height: 20 }), h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), h("hemfixarna-component", { business: this.partner, buttonBg: this.buttonBg, buttonColor: this.buttonColor, widgetStyle: this.widgetStyle, id: this.selectedID }), h("div", { class: "hemfixarna_install" }, h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, h("p", null, this.cdnLink), h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), h("img", { src: copy, height: 20 }))), h("div", { class: "hemfixarna_widgetstyles" }, h("h5", null, "Widget styles"), h("div", null, Object.values(WidgetStyle).map(style => (h("label", { key: style }, h("input", { type: "radio", value: style, checked: this.widgetStyle === style, onChange: () => (this.widgetStyle = style) }), style)))), h("div", null, h("div", null, h("h5", null, "Button background color"), h("input", { type: "text", value: this.buttonBg, onInput: e => (this.buttonBg = e.target.value) })), h("div", null, h("h5", null, "Button text color"), h("input", { type: "text", value: this.buttonColor, onInput: e => (this.buttonColor = e.target.value) })))), h("span", null, "Write an hexa code no # needed"), this.colorAccessibility ? (h("div", null, h("h5", null, "Tillg\u00E4nglighetsrapport"), h("div", null, h("strong", null, "Liten text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.small) } }, this.colorAccessibility.small), h("br", null), h("strong", null, "Fet text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.bold) } }, this.colorAccessibility.bold), h("br", null), h("strong", null, "Stor text:"), h("span", { style: { color: this.getColor(this.colorAccessibility.large) } }, this.colorAccessibility.large), h("br", null), h("strong", null, "Kontrastf\u00F6rh\u00E5llande:"), " ", this.colorAccessibility.contrast))) : null), h("ul", { class: "hemfixarna_categories" }, h("div", null, this.customer.logo ? (h("div", { style: { width: '100%', display: 'flex', justifyContent: 'center' } }, h("img", { style: { maxWidth: '250px', height: 'auto', margin: '0 auto 2rem' }, src: this.customer.logo.url, alt: this.customer.post_title }))) : null, this.showMaleri() ? (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, h("div", null, h("p", null, "M\u00E5leriverktyget"), h("span", null, "maleri")), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText('maleri') }, "Kopiera ID"), this.customer.at_hemfixarna ? (h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=maleri`) }, "Kopiera URL")) : (h("button", { onClick: () => (this.selectedID = 'maleri') }, "Ladda m\u00E5leri")))))) : null, this.customer.categories.map(c => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, h("div", null, h("p", null, c.name), h("span", null, `c-${c.id}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`c-${c.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=c-${c.id}`) }, "Kopiera URL")) : (h("button", { onClick: () => (this.selectedID = `c-${c.id}`) }, "Ladda kategori")))), c.show_products && c.products ? (h("ul", null, c.products.map(p => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, h("div", null, h("p", null, p.fields.title), h("span", null, p.fields.ID)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=${p.fields.ID}`) }, "Kopiera URL")) : (h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt"))))))))) : (h("ul", null, c.sub_categories &&
885
+ c.sub_categories.map(sc => (h("li", null, h("div", { class: "hemfixarna_categories--label" }, h("div", null, h("p", null, sc.name), h("span", null, `c-${sc.id}`)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(`c-${sc.id}`) }, "Kopiera ID"), this.customer.at_hemfixarna ? (h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=c-${c.id}`) }, "Kopiera URL")) : (h("button", { onClick: () => (this.selectedID = `c-${sc.id}`) }, "Ladda kategori")))), h("ul", null, sc.products.map(p => (h("li", null, h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, h("div", null, h("p", null, p.fields.title), h("span", null, p.fields.ID)), h("div", null, h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), this.customer.at_hemfixarna ? (h("button", { onClick: () => navigator.clipboard.writeText(`${getApiUrl()}/partner/${this.customer.post_name}?id=${p.fields.ID}`) }, "Kopiera URL")) : (h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt")))))))))))))))))))) : (h("div", null, h("form", { onSubmit: e => {
886
+ e.preventDefault();
887
+ this.handleLogin();
888
+ }, style: {
889
+ display: 'flex',
890
+ flexDirection: 'column',
891
+ gap: '1rem',
892
+ maxWidth: '300px',
893
+ margin: 'auto',
894
+ padding: '20px',
895
+ border: '1px solid #ccc',
896
+ borderRadius: '5px',
897
+ gridColumn: 'span 2',
898
+ } }, h("input", { type: "password", placeholder: "L\u00F6senord" }), h("button", { type: "submit" }, "Logga in"), this.loginError && h("span", null, "Fel l\u00F6senord")))))) : (h("h1", { style: {
899
+ textAlign: 'center',
900
+ margin: 'auto',
901
+ padding: '20px',
902
+ fontSize: '24px',
903
+ fontWeight: 'bold',
904
+ color: 'red',
905
+ } }, "No customer found"));
1263
906
  }
1264
907
  static get watchers() { return {
1265
908
  "buttonBg": ["debouncedFunction"],
1266
909
  "buttonColor": ["debouncedFunction"]
1267
910
  }; }
1268
911
  };
1269
- MyComponent$i.style = hemfixarnaDemoCss;
1270
-
1271
- const hemfixarnaDoroCss = "";
1272
-
1273
- const MyComponent$h = class {
1274
- constructor(hostRef) {
1275
- registerInstance(this, hostRef);
1276
- this.id = undefined;
1277
- this.loadFromQuery = undefined;
1278
- this.widgetStyle = WidgetStyle.standard;
1279
- this.buttonColor = undefined;
1280
- this.buttonBg = undefined;
1281
- }
1282
- render() {
1283
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.doro }));
1284
- }
1285
- };
1286
- MyComponent$h.style = hemfixarnaDoroCss;
1287
-
1288
- const hemfixarnaElfaCss = "";
1289
-
1290
- const MyComponent$g = class {
1291
- constructor(hostRef) {
1292
- registerInstance(this, hostRef);
1293
- this.id = undefined;
1294
- this.loadFromQuery = 'true';
1295
- this.widgetStyle = WidgetStyle.standard;
1296
- this.buttonColor = undefined;
1297
- this.buttonBg = undefined;
1298
- this.isDemo = false;
1299
- }
1300
- render() {
1301
- return (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 }));
1302
- }
1303
- };
1304
- MyComponent$g.style = hemfixarnaElfaCss;
1305
-
1306
- const MyComponent$f = class {
1307
- constructor(hostRef) {
1308
- registerInstance(this, hostRef);
1309
- this.id = undefined;
1310
- this.loadFromQuery = undefined;
1311
- this.widgetStyle = WidgetStyle.standard;
1312
- this.buttonColor = undefined;
1313
- this.buttonBg = undefined;
1314
- this.isDemo = false;
1315
- }
1316
- render() {
1317
- return (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 }));
1318
- }
1319
- };
1320
-
1321
- const MyComponent$e = class {
1322
- constructor(hostRef) {
1323
- registerInstance(this, hostRef);
1324
- this.id = undefined;
1325
- this.loadFromQuery = undefined;
1326
- this.widgetStyle = WidgetStyle.standard;
1327
- this.buttonColor = undefined;
1328
- this.buttonBg = undefined;
1329
- this.isDemo = false;
1330
- }
1331
- render() {
1332
- return (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 }));
1333
- }
1334
- };
1335
-
1336
- const hemfixarnaForebyggCss = "";
1337
-
1338
- const MyComponent$d = class {
1339
- constructor(hostRef) {
1340
- registerInstance(this, hostRef);
1341
- this.id = undefined;
1342
- this.loadFromQuery = undefined;
1343
- this.widgetStyle = WidgetStyle.standard;
1344
- this.buttonColor = undefined;
1345
- this.buttonBg = undefined;
1346
- }
1347
- render() {
1348
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.forebygg }));
1349
- }
1350
- };
1351
- MyComponent$d.style = hemfixarnaForebyggCss;
912
+ MyComponent.style = hemfixarnaDemoCss;
1352
913
 
1353
914
  // src/errors.ts
1354
915
  var PersonnummerError = class extends Error {
@@ -1984,8 +1545,7 @@ exports.MD5 = {
1984
1545
  });
1985
1546
 
1986
1547
  const apiSearch = async (query) => {
1987
- var _a;
1988
- const res = await fetch((_a = "https://hemfixare-lookup.vercel.app/api") !== null && _a !== void 0 ? _a : 'https://hemfixare-lookup.vercel.app/api', {
1548
+ const res = await fetch(getCreditSafeApiUrl(), {
1989
1549
  method: 'POST',
1990
1550
  headers: {
1991
1551
  'Content-Type': 'application/json',
@@ -2075,39 +1635,21 @@ const HemfixarnaGetuser = class {
2075
1635
  get el() { return getElement(this); }
2076
1636
  };
2077
1637
 
2078
- const hemfixarnaHornbachCss = "";
2079
-
2080
- const MyComponent$c = class {
2081
- constructor(hostRef) {
2082
- registerInstance(this, hostRef);
2083
- this.id = undefined;
2084
- this.loadFromQuery = 'true';
2085
- this.isDemo = false;
2086
- this.widgetStyle = WidgetStyle.standard;
2087
- this.buttonColor = undefined;
2088
- this.buttonBg = undefined;
2089
- }
2090
- render() {
2091
- return (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 }));
2092
- }
2093
- };
2094
- MyComponent$c.style = hemfixarnaHornbachCss;
2095
-
2096
1638
  const HemfixarnaInfo = class {
2097
1639
  constructor(hostRef) {
2098
1640
  registerInstance(this, hostRef);
2099
1641
  this.logo = getAssetPath(`./assets/hemfixarna.svg`);
2100
1642
  }
2101
1643
  render() {
2102
- var _a;
1644
+ var _a, _b;
2103
1645
  const checked = getAssetPath(`./assets/checked.svg`);
2104
- return (h("div", { class: "hemfixarna_info" }, state.step < 5 ? (h(Fragment, null, h("h2", null, state.customer.info_title), h("p", null, state.customer.info_text))) : (h("h2", null, state.customer.checkout_title)), h("ul", { class: "hemfixarna_features" }, state.step < 5 ? (h(Fragment, null, ((_a = state.customer.trust_badges) === null || _a === void 0 ? void 0 : _a.length) ? (h(Fragment, null, state.customer.trust_badges.map(l => (h("li", { key: l.text }, h("img", { src: checked, alt: "checked" }), h("p", null, l.text)))))) : (h(Fragment, null, state.options.trust.map(l => (h("li", { key: l.trust_badge }, h("img", { src: checked, alt: "checked" }), h("p", null, l.trust_badge)))))))) : (h(Fragment, null, state.customer.checkout_trust_badges.map(l => (h("li", { key: l.text }, h("img", { src: checked, alt: "checked" }), h("p", null, l.text))))))), h("img", { src: this.logo, width: 200, alt: "hemfixarna" }), h("a", { class: "hemfixarna_product--link", target: "_blank", href: state.options.link.url }, state.options.link.title)));
1646
+ return (h("div", { class: "hemfixarna_info" }, state.step < 5 ? (h(Fragment, null, h("h2", null, state.customer.info_title), h("p", null, state.customer.info_text))) : (h("h2", null, state.customer.checkout_title)), h("ul", { class: "hemfixarna_features" }, state.step < 5 ? (h(Fragment, null, ((_a = state.customer.trust_badges) === null || _a === void 0 ? void 0 : _a.length) ? (h(Fragment, null, state.customer.trust_badges.map(l => (h("li", { key: l.text }, h("img", { src: checked, alt: "checked" }), h("p", null, l.text)))))) : (h(Fragment, null, state.options.trust.map(l => (h("li", { key: l.trust_badge }, h("img", { src: checked, alt: "checked" }), h("p", null, l.trust_badge)))))))) : (h(Fragment, null, (_b = state.customer.checkout_trust_badges) === null || _b === void 0 ? void 0 : _b.map(l => (h("li", { key: l.text }, h("img", { src: checked, alt: "checked" }), h("p", null, l.text))))))), h("img", { src: this.logo, width: 200, alt: "hemfixarna" }), h("a", { class: "hemfixarna_product--link", target: "_blank", href: state.options.link.url }, state.options.link.title)));
2105
1647
  }
2106
1648
  };
2107
1649
 
2108
1650
  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}";
2109
1651
 
2110
- const base = `${"https://hemfixarna.se"}/wp-json/headless` ;
1652
+ const base = `${getApiUrl()}/wp-json/headless`;
2111
1653
  const HemfixarnaInvoice = class {
2112
1654
  constructor(hostRef) {
2113
1655
  registerInstance(this, hostRef);
@@ -2253,71 +1795,12 @@ const HemfixarnaInvoice = class {
2253
1795
  };
2254
1796
  HemfixarnaInvoice.style = hemfixarnaInvoiceCss;
2255
1797
 
2256
- const MyComponent$b = class {
2257
- constructor(hostRef) {
2258
- registerInstance(this, hostRef);
2259
- this.id = undefined;
2260
- this.loadFromQuery = 'true';
2261
- this.widgetStyle = WidgetStyle.standard;
2262
- this.buttonColor = undefined;
2263
- this.buttonBg = undefined;
2264
- this.isDemo = false;
2265
- }
2266
- render() {
2267
- return (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 }));
2268
- }
2269
- };
2270
-
2271
- const MyComponent$a = class {
2272
- constructor(hostRef) {
2273
- registerInstance(this, hostRef);
2274
- this.id = undefined;
2275
- this.loadFromQuery = undefined;
2276
- this.widgetStyle = WidgetStyle.standard;
2277
- this.buttonColor = undefined;
2278
- this.buttonBg = undefined;
2279
- }
2280
- render() {
2281
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.klint }));
2282
- }
2283
- };
2284
-
2285
- const MyComponent$9 = class {
2286
- constructor(hostRef) {
2287
- registerInstance(this, hostRef);
2288
- this.id = undefined;
2289
- this.loadFromQuery = undefined;
2290
- this.widgetStyle = WidgetStyle.standard;
2291
- this.buttonColor = undefined;
2292
- this.buttonBg = undefined;
2293
- }
2294
- render() {
2295
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.kund }));
2296
- }
2297
- };
2298
-
2299
- const MyComponent$8 = class {
2300
- constructor(hostRef) {
2301
- registerInstance(this, hostRef);
2302
- this.id = undefined;
2303
- this.loadFromQuery = 'true';
2304
- this.widgetStyle = WidgetStyle.standard;
2305
- this.buttonColor = undefined;
2306
- this.buttonBg = undefined;
2307
- this.isDemo = false;
2308
- }
2309
- render() {
2310
- return (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 }));
2311
- }
2312
- };
2313
-
2314
1798
  const HemfixarnaOrder = class {
2315
1799
  constructor(hostRef) {
2316
1800
  registerInstance(this, hostRef);
2317
1801
  this.render = () => {
2318
- return (h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, h("div", null), h("div", null, h("h2", null, state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), state.checkoutInvoice ? h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, state.checkoutInvoice ? h("div", null) : h("hemfixarna-orderrows", { tree: this.tree, cart: false }), h("span", { onClick: () => this.resetShop() }, h("button", null, "G\u00F6r en ny bokning")), h("hemfixarna-info", null))));
1802
+ return (h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, h("div", null), h("div", null, h("h2", null, state.checkoutInvoice ? 'Tack för din förfrågan' : 'Tack för din bokning'), state.checkoutInvoice ? h("p", null, "Vi \u00E5terkommer inom kort till dig p\u00E5 angivet telefonnummer eller epost") : null, state.checkoutInvoice ? h("div", null) : h("hemfixarna-orderrows", { cart: false }), h("span", { onClick: () => this.resetShop() }, h("button", null, "G\u00F6r en ny bokning")), h("hemfixarna-info", null))));
2319
1803
  };
2320
- this.tree = undefined;
2321
1804
  }
2322
1805
  resetShop() {
2323
1806
  state.step = 1;
@@ -2337,29 +1820,15 @@ const HemfixarnaOrderrows = class {
2337
1820
  constructor(hostRef) {
2338
1821
  registerInstance(this, hostRef);
2339
1822
  this.cart = true;
2340
- this.tree = undefined;
2341
1823
  }
2342
1824
  goToProduct(id) {
2343
- if (state.customer) {
2344
- const products = state.customer.categories
2345
- .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
2346
- .flat()
2347
- .flat();
2348
- const product = products.find(p => p && p.fields.ID === id);
2349
- if (product) {
2350
- state.selectedProduct = product.fields;
2351
- state.step = 4;
2352
- }
2353
- }
2354
- else {
2355
- const services = this.tree.sub_cats.map((c) => c.services).flat();
2356
- const products = services.map((s) => s.products).flat();
2357
- const product = products.find((p) => p.ID === id);
2358
- const service = services.find((s) => s.products.find((p) => p.ID === id));
2359
- const category = this.tree.sub_cats.find((c) => c.services.find((s) => s.products.find((p) => p.ID === id)));
2360
- state.selectedCategory = category;
2361
- state.selectedService = service;
2362
- state.selectedProduct = product;
1825
+ const products = state.customer.categories
1826
+ .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
1827
+ .flat()
1828
+ .flat();
1829
+ const product = products.find(p => p && p.fields.ID === id);
1830
+ if (product) {
1831
+ state.selectedProduct = product.fields;
2363
1832
  state.step = 4;
2364
1833
  }
2365
1834
  }
@@ -2404,21 +1873,6 @@ const HemfixarnaOrderrows = class {
2404
1873
  }
2405
1874
  };
2406
1875
 
2407
- const MyComponent$7 = class {
2408
- constructor(hostRef) {
2409
- registerInstance(this, hostRef);
2410
- this.id = undefined;
2411
- this.customer = undefined;
2412
- this.loadFromQuery = undefined;
2413
- this.widgetStyle = WidgetStyle.standard;
2414
- this.buttonColor = undefined;
2415
- this.buttonBg = undefined;
2416
- }
2417
- render() {
2418
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.power }));
2419
- }
2420
- };
2421
-
2422
1876
  const hemfixarnaProductCss = "";
2423
1877
 
2424
1878
  const HemfixarnaProduct = class {
@@ -2566,53 +2020,6 @@ const HemfixarnaProduct = class {
2566
2020
  };
2567
2021
  HemfixarnaProduct.style = hemfixarnaProductCss;
2568
2022
 
2569
- const HemfixarnaService = class {
2570
- constructor(hostRef) {
2571
- registerInstance(this, hostRef);
2572
- }
2573
- render() {
2574
- return (h("div", null, h("h2", null, state.selectedService.post_title), h("div", { class: "hemfixarna_categories--wrapper" }, h("div", null, h("ul", { class: "hemfixarna_categories" }, state.selectedService.products
2575
- .sort((a, b) => (a.post_title < b.post_title ? -1 : 1))
2576
- .map(p => {
2577
- var _a;
2578
- return (h("hemfixarna-box", { post: p, icon: (_a = p.icon.url) !== null && _a !== void 0 ? _a : p.icon, postTitle: p.title }));
2579
- }))), h("hemfixarna-info", null))));
2580
- }
2581
- };
2582
-
2583
- const hemfixarnaSkanskaCss = "";
2584
-
2585
- const MyComponent$6 = class {
2586
- constructor(hostRef) {
2587
- registerInstance(this, hostRef);
2588
- this.id = undefined;
2589
- this.customer = undefined;
2590
- this.loadFromQuery = undefined;
2591
- this.widgetStyle = WidgetStyle.standard;
2592
- this.buttonColor = undefined;
2593
- this.buttonBg = undefined;
2594
- }
2595
- render() {
2596
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.skanska }));
2597
- }
2598
- };
2599
- MyComponent$6.style = hemfixarnaSkanskaCss;
2600
-
2601
- const MyComponent$5 = class {
2602
- constructor(hostRef) {
2603
- registerInstance(this, hostRef);
2604
- this.id = undefined;
2605
- this.customer = undefined;
2606
- this.loadFromQuery = undefined;
2607
- this.widgetStyle = WidgetStyle.standard;
2608
- this.buttonColor = undefined;
2609
- this.buttonBg = undefined;
2610
- }
2611
- render() {
2612
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.sparfonster }));
2613
- }
2614
- };
2615
-
2616
2023
  const HemfixarnaGrid = class {
2617
2024
  constructor(hostRef) {
2618
2025
  registerInstance(this, hostRef);
@@ -2644,81 +2051,6 @@ const HemfixarnaGrid = class {
2644
2051
  }
2645
2052
  };
2646
2053
 
2647
- const hemfixarnaStringCss = "";
2648
-
2649
- const MyComponent$4 = class {
2650
- constructor(hostRef) {
2651
- registerInstance(this, hostRef);
2652
- this.id = undefined;
2653
- this.loadFromQuery = undefined;
2654
- this.widgetStyle = WidgetStyle.standard;
2655
- this.buttonColor = undefined;
2656
- this.buttonBg = undefined;
2657
- }
2658
- render() {
2659
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.string }));
2660
- }
2661
- };
2662
- MyComponent$4.style = hemfixarnaStringCss;
2663
-
2664
- const MyComponent$3 = class {
2665
- constructor(hostRef) {
2666
- registerInstance(this, hostRef);
2667
- this.id = undefined;
2668
- this.loadFromQuery = undefined;
2669
- this.widgetStyle = WidgetStyle.standard;
2670
- this.buttonColor = undefined;
2671
- this.buttonBg = undefined;
2672
- }
2673
- render() {
2674
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.superfront }));
2675
- }
2676
- };
2677
-
2678
- const MyComponent$2 = class {
2679
- constructor(hostRef) {
2680
- registerInstance(this, hostRef);
2681
- this.id = undefined;
2682
- this.loadFromQuery = 'true';
2683
- this.isDemo = false;
2684
- this.widgetStyle = WidgetStyle.standard;
2685
- this.buttonColor = undefined;
2686
- this.buttonBg = undefined;
2687
- }
2688
- render() {
2689
- return (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 }));
2690
- }
2691
- };
2692
-
2693
- const MyComponent$1 = class {
2694
- constructor(hostRef) {
2695
- registerInstance(this, hostRef);
2696
- this.id = undefined;
2697
- this.loadFromQuery = undefined;
2698
- this.widgetStyle = WidgetStyle.standard;
2699
- this.buttonColor = undefined;
2700
- this.buttonBg = undefined;
2701
- }
2702
- render() {
2703
- return (h("hemfixarna-component", { widgetStyle: this.widgetStyle, buttonBg: this.buttonBg, buttonColor: this.buttonColor, loadFromQuery: Boolean(this.loadFromQuery), id: this.id, business: Business.traningspartner }));
2704
- }
2705
- };
2706
-
2707
- const MyComponent = class {
2708
- constructor(hostRef) {
2709
- registerInstance(this, hostRef);
2710
- this.id = undefined;
2711
- this.loadFromQuery = 'true';
2712
- this.isDemo = false;
2713
- this.widgetStyle = WidgetStyle.standard;
2714
- this.buttonColor = undefined;
2715
- this.buttonBg = undefined;
2716
- }
2717
- render() {
2718
- return (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 }));
2719
- }
2720
- };
2721
-
2722
- export { HemfixarnaAddress as hemfixarna_address, HemfixarnaBox as hemfixarna_box, HemfixarnaBreadcrumbs as hemfixarna_breadcrumbs, MyComponent$j as hemfixarna_byggmax, HemfixarnaCart as hemfixarna_cart, HemfixarnaCategory as hemfixarna_category, HemfixarnaCheckout as hemfixarna_checkout, HemfixarnaComponent as hemfixarna_component, HemfixarnaInfo$1 as hemfixarna_contact, MyComponent$i as hemfixarna_demo, MyComponent$h as hemfixarna_doro, MyComponent$g as hemfixarna_elfa, MyComponent$f as hemfixarna_fargvaruhuset, MyComponent$e as hemfixarna_flyttsmart, MyComponent$d as hemfixarna_forebygg, HemfixarnaGetuser as hemfixarna_getuser, MyComponent$c as hemfixarna_hornbach, HemfixarnaInfo as hemfixarna_info, HemfixarnaInvoice as hemfixarna_invoice, MyComponent$b as hemfixarna_kbygg, MyComponent$a as hemfixarna_klint, MyComponent$9 as hemfixarna_kund, MyComponent$8 as hemfixarna_norrgavel, HemfixarnaOrder as hemfixarna_order, HemfixarnaOrderrows as hemfixarna_orderrows, MyComponent$7 as hemfixarna_power, HemfixarnaProduct as hemfixarna_product, HemfixarnaService as hemfixarna_service, MyComponent$6 as hemfixarna_skanska, MyComponent$5 as hemfixarna_sparfonster, HemfixarnaGrid as hemfixarna_start, MyComponent$4 as hemfixarna_string_furniture, MyComponent$3 as hemfixarna_superfront, MyComponent$2 as hemfixarna_tesla, MyComponent$1 as hemfixarna_traningspartner, MyComponent as hemfixarna_zaptec };
2054
+ export { HemfixarnaAddress as hemfixarna_address, HemfixarnaBox as hemfixarna_box, HemfixarnaBreadcrumbs as hemfixarna_breadcrumbs, HemfixarnaCart as hemfixarna_cart, HemfixarnaCheckout as hemfixarna_checkout, HemfixarnaComponent as hemfixarna_component, HemfixarnaInfo$1 as hemfixarna_contact, MyComponent as hemfixarna_demo, HemfixarnaGetuser as hemfixarna_getuser, HemfixarnaInfo as hemfixarna_info, HemfixarnaInvoice as hemfixarna_invoice, HemfixarnaOrder as hemfixarna_order, HemfixarnaOrderrows as hemfixarna_orderrows, HemfixarnaProduct as hemfixarna_product, HemfixarnaGrid as hemfixarna_start };
2723
2055
 
2724
- //# sourceMappingURL=hemfixarna-address_36.entry.js.map
2056
+ //# sourceMappingURL=hemfixarna-address_15.entry.js.map