hemfixarna-web-components 1.6.2 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist/cjs/hemfixarna-address_36.cjs.entry.js +2763 -0
  2. package/dist/{hemfixarna-components/index-f1a87cf1.js.map → cjs/hemfixarna-address_36.cjs.entry.js.map} +1 -1
  3. package/dist/cjs/hemfixarna-components.cjs.js +28 -0
  4. package/dist/cjs/hemfixarna-components.cjs.js.map +1 -0
  5. package/dist/cjs/index-b83343b9.js +1687 -0
  6. package/dist/cjs/index-b83343b9.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +4 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +24 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/collection/assets/back.svg +3 -0
  12. package/dist/collection/assets/cart.svg +10 -0
  13. package/dist/collection/assets/checked.svg +10 -0
  14. package/dist/collection/assets/close.svg +5 -0
  15. package/dist/collection/assets/copy.png +0 -0
  16. package/dist/collection/assets/date.svg +6 -0
  17. package/dist/collection/assets/down.svg +3 -0
  18. package/dist/collection/assets/drag-drop.svg +3 -0
  19. package/dist/collection/assets/elfa.png +0 -0
  20. package/dist/collection/assets/gubbe-pensel.svg +1 -0
  21. package/dist/collection/assets/hemfixarna.svg +11 -0
  22. package/dist/collection/assets/hornbach/logo.svg +42 -0
  23. package/dist/collection/assets/hornbach/nav.jpg +0 -0
  24. package/dist/collection/assets/info.svg +5 -0
  25. package/dist/collection/assets/kbygg.svg +29 -0
  26. package/dist/collection/assets/minus.svg +4 -0
  27. package/dist/collection/assets/montering.svg +15 -0
  28. package/dist/collection/assets/norrgavel.svg +1 -0
  29. package/dist/collection/assets/pensel.svg +1 -0
  30. package/dist/collection/assets/plus.svg +5 -0
  31. package/dist/collection/assets/spinner.gif +0 -0
  32. package/dist/collection/assets/tesla.svg +1 -0
  33. package/dist/collection/assets/zaptec.svg +1 -0
  34. package/dist/collection/collection-manifest.json +47 -0
  35. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
  36. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js +184 -0
  37. package/dist/collection/components/customers/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -0
  38. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.css +0 -0
  39. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js +123 -0
  40. package/dist/collection/components/customers/hemfixarna-doro/hemfixarna-doro.js.map +1 -0
  41. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.css +0 -0
  42. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js +142 -0
  43. package/dist/collection/components/customers/hemfixarna-elfa/hemfixarna-elfa.js.map +1 -0
  44. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js +132 -0
  45. package/dist/collection/components/customers/hemfixarna-fargvaruhuset/hemfixarna-fargvaruhuset.js.map +1 -0
  46. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js +132 -0
  47. package/dist/collection/components/customers/hemfixarna-flyttsmart/hemfixarna-flyttsmart.js.map +1 -0
  48. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.css +0 -0
  49. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js +123 -0
  50. package/dist/collection/components/customers/hemfixarna-forebygg/hemfixarna-forebygg.js.map +1 -0
  51. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.css +0 -0
  52. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js +142 -0
  53. package/dist/collection/components/customers/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -0
  54. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js +132 -0
  55. package/dist/collection/components/customers/hemfixarna-kbygg/hemfixarna-kbygg.js.map +1 -0
  56. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js +113 -0
  57. package/dist/collection/components/customers/hemfixarna-klint/hemfixarna-klint.js.map +1 -0
  58. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js +113 -0
  59. package/dist/collection/components/customers/hemfixarna-kund/hemfixarna-kund.js.map +1 -0
  60. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js +132 -0
  61. package/dist/collection/components/customers/hemfixarna-norrgavel/hemfixarna-norrgavel.js.map +1 -0
  62. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js +131 -0
  63. package/dist/collection/components/customers/hemfixarna-power/hemfixarna-power.js.map +1 -0
  64. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
  65. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js +141 -0
  66. package/dist/collection/components/customers/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -0
  67. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js +131 -0
  68. package/dist/collection/components/customers/hemfixarna-sparfonster/hemfixarna-sparfonster.js.map +1 -0
  69. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js +123 -0
  70. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -0
  71. package/dist/collection/components/customers/hemfixarna-string/hemfixarna-string.css +0 -0
  72. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js +113 -0
  73. package/dist/collection/components/customers/hemfixarna-superfront.tsx/hemfixarna-superfront.js.map +1 -0
  74. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js +132 -0
  75. package/dist/collection/components/customers/hemfixarna-tesla/hemfixarna-tesla.js.map +1 -0
  76. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js +113 -0
  77. package/dist/collection/components/customers/hemfixarna-traningspartner/hemfixarna-traningspartner.js.map +1 -0
  78. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js +132 -0
  79. package/dist/collection/components/customers/hemfixarna-zaptec/hemfixarna-zaptec.js.map +1 -0
  80. package/dist/{hemfixarna-components/hemfixarna-address.entry.js → collection/components/hemfixarna-address/hemfixarna-address.js} +20 -14
  81. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +1 -0
  82. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +138 -0
  83. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -0
  84. package/dist/{hemfixarna-components/hemfixarna-breadcrumbs.entry.js → collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js} +84 -13
  85. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -0
  86. package/dist/{hemfixarna-components/hemfixarna-cart.entry.js → collection/components/hemfixarna-cart/hemfixarna-cart.js} +31 -11
  87. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -0
  88. package/dist/{hemfixarna-components/hemfixarna-category.entry.js → collection/components/hemfixarna-category.tsx/hemfixarna-category.js} +6 -12
  89. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +1 -0
  90. package/dist/{hemfixarna-components/hemfixarna-checkout.entry.js → collection/components/hemfixarna-checkout/hemfixarna-checkout.js} +27 -32
  91. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -0
  92. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +483 -0
  93. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -0
  94. package/dist/collection/components/hemfixarna-component/hemfixarna.css +1031 -0
  95. package/dist/{hemfixarna-components/hemfixarna-contact.entry.js → collection/components/hemfixarna-contact/hemfixarna-contact.js} +28 -10
  96. package/dist/collection/components/hemfixarna-contact/hemfixarna-contact.js.map +1 -0
  97. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +135 -0
  98. package/dist/{hemfixarna-components/hemfixarna-demo.entry.js → collection/components/hemfixarna-demo/hemfixarna-demo.js} +46 -23
  99. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -0
  100. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +91 -0
  101. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +1 -0
  102. package/dist/{hemfixarna-components/hemfixarna-info.entry.js → collection/components/hemfixarna-info/hemfixarna-info.js} +7 -11
  103. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -0
  104. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.css +76 -0
  105. package/dist/{hemfixarna-components/hemfixarna-invoice.entry.js → collection/components/hemfixarna-invoice/hemfixarna-invoice.js} +27 -16
  106. package/dist/collection/components/hemfixarna-invoice/hemfixarna-invoice.js.map +1 -0
  107. package/dist/{hemfixarna-components/hemfixarna-order.entry.js → collection/components/hemfixarna-order/hemfixarna-order.js} +31 -11
  108. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -0
  109. package/dist/{hemfixarna-components/hemfixarna-orderrows.entry.js → collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js} +50 -12
  110. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -0
  111. package/dist/collection/components/hemfixarna-product/hemfixarna-product.css +0 -0
  112. package/dist/{hemfixarna-components/hemfixarna-product.entry.js → collection/components/hemfixarna-product/hemfixarna-product.js} +27 -18
  113. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -0
  114. package/dist/{hemfixarna-components/hemfixarna-service.entry.js → collection/components/hemfixarna-service/hemfixarna-service.js} +6 -12
  115. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +1 -0
  116. package/dist/{hemfixarna-components/hemfixarna-start.entry.js → collection/components/hemfixarna-start/hemfixarna-start.js} +48 -11
  117. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -0
  118. package/dist/collection/index.js +2 -0
  119. package/dist/collection/index.js.map +1 -0
  120. package/dist/collection/store/index.js +62 -0
  121. package/dist/collection/store/index.js.map +1 -0
  122. package/dist/collection/types/felixtypes.js +3 -0
  123. package/dist/collection/types/felixtypes.js.map +1 -0
  124. package/dist/{hemfixarna-components/index-d90ad11b.js → collection/types/index.js} +4 -7
  125. package/dist/collection/types/index.js.map +1 -0
  126. package/dist/{hemfixarna-components/api-36f73d0d.js → collection/utils/api.js} +4 -6
  127. package/dist/collection/utils/api.js.map +1 -0
  128. package/dist/{hemfixarna-components/calc-4c79b798.js → collection/utils/calc.js} +3 -6
  129. package/dist/collection/utils/calc.js.map +1 -0
  130. package/dist/collection/utils/creditSafe.js +18 -0
  131. package/dist/collection/utils/creditSafe.js.map +1 -0
  132. package/dist/collection/utils/felixApi.js +18 -0
  133. package/dist/collection/utils/felixApi.js.map +1 -0
  134. package/dist/collection/utils/felixFunctions.js +189 -0
  135. package/dist/collection/utils/felixFunctions.js.map +1 -0
  136. package/dist/{hemfixarna-components/form-c53dca29.js → collection/utils/form.js} +2 -4
  137. package/dist/collection/utils/form.js.map +1 -0
  138. package/dist/{hemfixarna-components/scroll-6c26b5da.js → collection/utils/scroll.js} +2 -4
  139. package/dist/collection/utils/scroll.js.map +1 -0
  140. package/dist/{hemfixarna-components/types-641c9a1c.js → collection/utils/types.js} +3 -6
  141. package/dist/collection/utils/types.js.map +1 -0
  142. package/dist/esm/hemfixarna-address_36.entry.js +2724 -0
  143. package/dist/esm/hemfixarna-address_36.entry.js.map +1 -0
  144. package/dist/esm/hemfixarna-components.js +23 -0
  145. package/dist/esm/hemfixarna-components.js.map +1 -0
  146. package/dist/esm/index-8c417125.js +1656 -0
  147. package/dist/esm/index-8c417125.js.map +1 -0
  148. package/dist/esm/index.js +3 -0
  149. package/dist/esm/index.js.map +1 -0
  150. package/dist/esm/loader.js +20 -0
  151. package/dist/esm/loader.js.map +1 -0
  152. package/dist/esm/polyfills/core-js.js +11 -0
  153. package/dist/esm/polyfills/css-shim.js +1 -0
  154. package/dist/esm/polyfills/dom.js +79 -0
  155. package/dist/esm/polyfills/es5-html-element.js +1 -0
  156. package/dist/esm/polyfills/index.js +34 -0
  157. package/dist/esm/polyfills/system.js +6 -0
  158. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -162
  159. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  160. package/dist/hemfixarna-components/index.esm.js +0 -1
  161. package/dist/hemfixarna-components/index.esm.js.map +1 -1
  162. package/dist/hemfixarna-components/p-852e7173.js +3 -0
  163. package/dist/hemfixarna-components/p-852e7173.js.map +1 -0
  164. package/dist/hemfixarna-components/p-97461831.entry.js +2 -0
  165. package/dist/hemfixarna-components/p-97461831.entry.js.map +1 -0
  166. package/dist/index.cjs.js +1 -0
  167. package/dist/index.js +1 -0
  168. package/package.json +1 -1
  169. package/dist/hemfixarna-components/api-36f73d0d.js.map +0 -1
  170. package/dist/hemfixarna-components/app-globals-0f993ce5.js +0 -5
  171. package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +0 -1
  172. package/dist/hemfixarna-components/calc-4c79b798.js.map +0 -1
  173. package/dist/hemfixarna-components/css-shim-62d2171c.js +0 -6
  174. package/dist/hemfixarna-components/css-shim-62d2171c.js.map +0 -1
  175. package/dist/hemfixarna-components/dom-46a68c9b.js +0 -75
  176. package/dist/hemfixarna-components/dom-46a68c9b.js.map +0 -1
  177. package/dist/hemfixarna-components/form-c53dca29.js.map +0 -1
  178. package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +0 -1
  179. package/dist/hemfixarna-components/hemfixarna-box.entry.js +0 -49
  180. package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +0 -1
  181. package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +0 -1
  182. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +0 -27
  183. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +0 -1
  184. package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +0 -1
  185. package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +0 -1
  186. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +0 -1
  187. package/dist/hemfixarna-components/hemfixarna-component.entry.js +0 -248
  188. package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +0 -1
  189. package/dist/hemfixarna-components/hemfixarna-contact.entry.js.map +0 -1
  190. package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +0 -1
  191. package/dist/hemfixarna-components/hemfixarna-doro.entry.js +0 -23
  192. package/dist/hemfixarna-components/hemfixarna-doro.entry.js.map +0 -1
  193. package/dist/hemfixarna-components/hemfixarna-elfa.entry.js +0 -24
  194. package/dist/hemfixarna-components/hemfixarna-elfa.entry.js.map +0 -1
  195. package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js +0 -21
  196. package/dist/hemfixarna-components/hemfixarna-fargvaruhuset.entry.js.map +0 -1
  197. package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js +0 -21
  198. package/dist/hemfixarna-components/hemfixarna-flyttsmart.entry.js.map +0 -1
  199. package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js +0 -23
  200. package/dist/hemfixarna-components/hemfixarna-forebygg.entry.js.map +0 -1
  201. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +0 -770
  202. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +0 -1
  203. package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js +0 -24
  204. package/dist/hemfixarna-components/hemfixarna-hornbach.entry.js.map +0 -1
  205. package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +0 -1
  206. package/dist/hemfixarna-components/hemfixarna-invoice.entry.js.map +0 -1
  207. package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js +0 -21
  208. package/dist/hemfixarna-components/hemfixarna-kbygg.entry.js.map +0 -1
  209. package/dist/hemfixarna-components/hemfixarna-klint.entry.js +0 -20
  210. package/dist/hemfixarna-components/hemfixarna-klint.entry.js.map +0 -1
  211. package/dist/hemfixarna-components/hemfixarna-kund.entry.js +0 -20
  212. package/dist/hemfixarna-components/hemfixarna-kund.entry.js.map +0 -1
  213. package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js +0 -21
  214. package/dist/hemfixarna-components/hemfixarna-norrgavel.entry.js.map +0 -1
  215. package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +0 -1
  216. package/dist/hemfixarna-components/hemfixarna-orderrows.entry.js.map +0 -1
  217. package/dist/hemfixarna-components/hemfixarna-power.entry.js +0 -21
  218. package/dist/hemfixarna-components/hemfixarna-power.entry.js.map +0 -1
  219. package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +0 -1
  220. package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +0 -1
  221. package/dist/hemfixarna-components/hemfixarna-skanska.entry.js +0 -24
  222. package/dist/hemfixarna-components/hemfixarna-skanska.entry.js.map +0 -1
  223. package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js +0 -21
  224. package/dist/hemfixarna-components/hemfixarna-sparfonster.entry.js.map +0 -1
  225. package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +0 -1
  226. package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js +0 -23
  227. package/dist/hemfixarna-components/hemfixarna-string-furniture.entry.js.map +0 -1
  228. package/dist/hemfixarna-components/hemfixarna-superfront.entry.js +0 -20
  229. package/dist/hemfixarna-components/hemfixarna-superfront.entry.js.map +0 -1
  230. package/dist/hemfixarna-components/hemfixarna-tesla.entry.js +0 -21
  231. package/dist/hemfixarna-components/hemfixarna-tesla.entry.js.map +0 -1
  232. package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js +0 -20
  233. package/dist/hemfixarna-components/hemfixarna-traningspartner.entry.js.map +0 -1
  234. package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js +0 -21
  235. package/dist/hemfixarna-components/hemfixarna-zaptec.entry.js.map +0 -1
  236. package/dist/hemfixarna-components/index-b6a6e994.js +0 -256
  237. package/dist/hemfixarna-components/index-b6a6e994.js.map +0 -1
  238. package/dist/hemfixarna-components/index-d90ad11b.js.map +0 -1
  239. package/dist/hemfixarna-components/index-f1a87cf1.js +0 -3397
  240. package/dist/hemfixarna-components/scroll-6c26b5da.js.map +0 -1
  241. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +0 -389
  242. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +0 -1
  243. package/dist/hemfixarna-components/types-641c9a1c.js.map +0 -1
@@ -0,0 +1,483 @@
1
+ import { Fragment, getAssetPath, h } from '@stencil/core';
2
+ import state from '../../store';
3
+ import { WidgetStyle } from '../../types';
4
+ import { getCustomer, getGreenDiscount, getOptions, getRot, getRut, getTaxonomy } from '../../utils/api';
5
+ import { getProductPriceWithRotAndRut } from '../../utils/calc';
6
+ import { scrollToTop } from '../../utils/scroll';
7
+ export class HemfixarnaComponent {
8
+ constructor() {
9
+ this.slugIsOldFormat = (slug) => {
10
+ if (!slug)
11
+ return false;
12
+ return ['product', 'service', 'category'].some(str => slug.includes(str));
13
+ };
14
+ this.triggerScrollTotop = () => {
15
+ const el = this.el.shadowRoot.querySelector('.hemfixarna_content');
16
+ scrollToTop(el);
17
+ };
18
+ this.modal = false;
19
+ this.showModal = false;
20
+ this.tree = null;
21
+ this.product = null;
22
+ this.proppedProduct = null;
23
+ this.slug = undefined;
24
+ this.id = undefined;
25
+ this.business = undefined;
26
+ this.topCategory = undefined;
27
+ this.forceOldTree = false;
28
+ this.loadFromQuery = false;
29
+ this.isDemo = false;
30
+ this.widgetStyle = undefined;
31
+ this.nav = undefined;
32
+ this.buttonColor = undefined;
33
+ this.buttonBg = undefined;
34
+ }
35
+ loadCategoryOrProduct(id) {
36
+ this.proppedProduct = null;
37
+ if (id.startsWith('c-')) {
38
+ const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
39
+ const category = categories.find(c => c && c.id === id.replace('c-', ''));
40
+ if (category) {
41
+ state.selectedCustomerCategory = category;
42
+ state.step = 2;
43
+ }
44
+ }
45
+ else {
46
+ const products = state.customer.categories
47
+ .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
48
+ .flat()
49
+ .flat();
50
+ const product = products.find(p => p && p.fields.ID === parseInt(id));
51
+ if (product) {
52
+ state.selectedProduct = product.fields;
53
+ state.step = 4;
54
+ this.proppedProduct = product.fields;
55
+ }
56
+ }
57
+ }
58
+ async watchSlugChange(newValue) {
59
+ if (this.slugIsOldFormat(newValue)) {
60
+ this.fetchNewTaxonomy(newValue);
61
+ }
62
+ else if (state.customer && newValue) {
63
+ this.loadCategoryOrProduct(newValue);
64
+ }
65
+ }
66
+ async watchIdChange(id) {
67
+ if (id && state.customer) {
68
+ if (id === 'maleri') {
69
+ state.maleri = true;
70
+ state.step = 4;
71
+ }
72
+ else {
73
+ this.loadCategoryOrProduct(id);
74
+ }
75
+ }
76
+ }
77
+ async fetchNewTaxonomy(slug) {
78
+ state.selectedCategory = null;
79
+ state.selectedProduct = null;
80
+ state.selectedService = null;
81
+ state.maleri = null;
82
+ const res = await getTaxonomy(slug);
83
+ if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found' || (res === null || res === void 0 ? void 0 : res.code) === 'rest_no_route') {
84
+ console.log('taxonomy not found');
85
+ }
86
+ else if (res) {
87
+ this.setTaxonomy(res);
88
+ if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
89
+ this.product = res;
90
+ }
91
+ }
92
+ }
93
+ async componentWillLoad() {
94
+ state.business = this.business;
95
+ const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
96
+ if (cart) {
97
+ state.cart = JSON.parse(cart);
98
+ }
99
+ const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);
100
+ if (user) {
101
+ state.user = JSON.parse(user);
102
+ }
103
+ const creditSafeUser = window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);
104
+ if (creditSafeUser) {
105
+ state.creditSafeUser = JSON.parse(creditSafeUser);
106
+ }
107
+ const [tree, res, options, rut, rot, greenDiscount] = await Promise.all([
108
+ this.topCategory ? getTaxonomy(this.topCategory) : null,
109
+ this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
110
+ getOptions(),
111
+ getRut(),
112
+ getRot(),
113
+ getGreenDiscount(),
114
+ ]);
115
+ if ((!this.slug || !this.slugIsOldFormat(this.slug)) && !this.forceOldTree) {
116
+ try {
117
+ const customer = await getCustomer(this.business);
118
+ if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
119
+ console.warn('customer not found');
120
+ }
121
+ else if (customer) {
122
+ state.customer = customer;
123
+ if (this.id) {
124
+ if (this.id === 'maleri') {
125
+ state.maleri = true;
126
+ state.step = 4;
127
+ }
128
+ else {
129
+ this.loadCategoryOrProduct(this.id);
130
+ }
131
+ }
132
+ else if (this.slug && !this.slugIsOldFormat(this.slug)) {
133
+ this.loadCategoryOrProduct(this.slug);
134
+ }
135
+ }
136
+ }
137
+ catch (error) {
138
+ console.warn('customer not found');
139
+ }
140
+ }
141
+ if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
142
+ // console.warn('tree not found');
143
+ }
144
+ else if (tree) {
145
+ this.tree = tree;
146
+ }
147
+ if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
148
+ console.log('taxonomy not found');
149
+ }
150
+ else if (res) {
151
+ this.setTaxonomy(res);
152
+ if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
153
+ this.product = res;
154
+ }
155
+ }
156
+ if (this.loadFromQuery) {
157
+ const params = new URL(document.location.toString()).searchParams;
158
+ this.id = params.get('id');
159
+ if (!this.isDemo) {
160
+ this.openModal();
161
+ }
162
+ }
163
+ state.rotOptions = rot;
164
+ state.rutOptions = rut;
165
+ state.greenOptions = greenDiscount;
166
+ state.options = options;
167
+ }
168
+ setTaxonomy(taxonomy) {
169
+ if (taxonomy) {
170
+ if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
171
+ state.selectedCategory = taxonomy;
172
+ state.step = 2;
173
+ }
174
+ else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
175
+ state.selectedService = taxonomy;
176
+ state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === taxonomy.ID));
177
+ state.step = 3;
178
+ }
179
+ else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
180
+ state.selectedProduct = taxonomy;
181
+ state.selectedService = this.tree.sub_cats
182
+ .map(c => c.services)
183
+ .flat()
184
+ .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));
185
+ state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));
186
+ state.step = 4;
187
+ }
188
+ this.triggerScrollTotop();
189
+ }
190
+ }
191
+ // Open close modal && click outside event
192
+ openModal() {
193
+ this.modal = true;
194
+ setTimeout(() => {
195
+ this.showModal = true;
196
+ }, 50);
197
+ }
198
+ closeModal() {
199
+ this.showModal = false;
200
+ setTimeout(() => {
201
+ this.modal = false;
202
+ }, 200);
203
+ }
204
+ handleClick(e) {
205
+ if (this.loadFromQuery && !this.isDemo)
206
+ return;
207
+ if ((e === null || e === void 0 ? void 0 : e.composedPath()[0]).classList.contains('hemfixarna_backdrop')) {
208
+ this.closeModal();
209
+ }
210
+ const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');
211
+ if (infomodal) {
212
+ const isClickInside = infomodal.contains(e.composedPath()[0]);
213
+ if (!isClickInside) {
214
+ state.modal = null;
215
+ }
216
+ }
217
+ }
218
+ getCartLength() {
219
+ return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
220
+ }
221
+ render() {
222
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
223
+ const logo = getAssetPath(`./assets/hemfixarna.svg`);
224
+ const pensel = getAssetPath(`./assets/pensel.svg`);
225
+ const monteringLogo = getAssetPath(`./assets/montering.svg`);
226
+ const navBackground = ((_a = this.nav) === null || _a === void 0 ? void 0 : _a.background) ? getAssetPath(this.nav.background) : '';
227
+ const navLogo = ((_b = this.nav) === null || _b === void 0 ? void 0 : _b.logo) ? getAssetPath(this.nav.logo) : '';
228
+ 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: {
229
+ 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}`,
230
+ 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}`,
231
+ } }, "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))));
232
+ }
233
+ static get is() { return "hemfixarna-component"; }
234
+ static get encapsulation() { return "shadow"; }
235
+ static get originalStyleUrls() {
236
+ return {
237
+ "$": ["hemfixarna.scss"]
238
+ };
239
+ }
240
+ static get styleUrls() {
241
+ return {
242
+ "$": ["hemfixarna.css"]
243
+ };
244
+ }
245
+ static get assetsDirs() { return ["assets"]; }
246
+ static get properties() {
247
+ return {
248
+ "slug": {
249
+ "type": "string",
250
+ "mutable": false,
251
+ "complexType": {
252
+ "original": "string",
253
+ "resolved": "string",
254
+ "references": {}
255
+ },
256
+ "required": false,
257
+ "optional": true,
258
+ "docs": {
259
+ "tags": [],
260
+ "text": ""
261
+ },
262
+ "attribute": "slug",
263
+ "reflect": false
264
+ },
265
+ "id": {
266
+ "type": "string",
267
+ "mutable": false,
268
+ "complexType": {
269
+ "original": "string",
270
+ "resolved": "string",
271
+ "references": {}
272
+ },
273
+ "required": false,
274
+ "optional": true,
275
+ "docs": {
276
+ "tags": [],
277
+ "text": ""
278
+ },
279
+ "attribute": "id",
280
+ "reflect": false
281
+ },
282
+ "business": {
283
+ "type": "string",
284
+ "mutable": false,
285
+ "complexType": {
286
+ "original": "Business",
287
+ "resolved": "Business.byggmax | Business.doro | Business.elfa | Business.fargvaruhuset | Business.flyttsmart | Business.forebygg | Business.hornbach | Business.kbygg | Business.klint | Business.kund | Business.lg | Business.norrgavel | Business.power | Business.skanska | Business.sparfonster | Business.string | Business.superfront | Business.tesla | Business.traningspartner | Business.zaptec",
288
+ "references": {
289
+ "Business": {
290
+ "location": "import",
291
+ "path": "../../types"
292
+ }
293
+ }
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [],
299
+ "text": ""
300
+ },
301
+ "attribute": "business",
302
+ "reflect": false
303
+ },
304
+ "topCategory": {
305
+ "type": "string",
306
+ "mutable": false,
307
+ "complexType": {
308
+ "original": "TopCategory",
309
+ "resolved": "TopCategory",
310
+ "references": {
311
+ "TopCategory": {
312
+ "location": "import",
313
+ "path": "../../types"
314
+ }
315
+ }
316
+ },
317
+ "required": false,
318
+ "optional": true,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": ""
322
+ },
323
+ "attribute": "top-category",
324
+ "reflect": false
325
+ },
326
+ "forceOldTree": {
327
+ "type": "boolean",
328
+ "mutable": false,
329
+ "complexType": {
330
+ "original": "boolean",
331
+ "resolved": "boolean",
332
+ "references": {}
333
+ },
334
+ "required": false,
335
+ "optional": true,
336
+ "docs": {
337
+ "tags": [],
338
+ "text": ""
339
+ },
340
+ "attribute": "force-old-tree",
341
+ "reflect": false,
342
+ "defaultValue": "false"
343
+ },
344
+ "loadFromQuery": {
345
+ "type": "boolean",
346
+ "mutable": false,
347
+ "complexType": {
348
+ "original": "boolean",
349
+ "resolved": "boolean",
350
+ "references": {}
351
+ },
352
+ "required": false,
353
+ "optional": true,
354
+ "docs": {
355
+ "tags": [],
356
+ "text": ""
357
+ },
358
+ "attribute": "load-from-query",
359
+ "reflect": false,
360
+ "defaultValue": "false"
361
+ },
362
+ "isDemo": {
363
+ "type": "boolean",
364
+ "mutable": false,
365
+ "complexType": {
366
+ "original": "boolean",
367
+ "resolved": "boolean",
368
+ "references": {}
369
+ },
370
+ "required": false,
371
+ "optional": true,
372
+ "docs": {
373
+ "tags": [],
374
+ "text": ""
375
+ },
376
+ "attribute": "is-demo",
377
+ "reflect": false,
378
+ "defaultValue": "false"
379
+ },
380
+ "widgetStyle": {
381
+ "type": "string",
382
+ "mutable": false,
383
+ "complexType": {
384
+ "original": "WidgetStyle",
385
+ "resolved": "WidgetStyle.alternative | WidgetStyle.alternative_2 | WidgetStyle.alternative_3 | WidgetStyle.standard",
386
+ "references": {
387
+ "WidgetStyle": {
388
+ "location": "import",
389
+ "path": "../../types"
390
+ }
391
+ }
392
+ },
393
+ "required": false,
394
+ "optional": false,
395
+ "docs": {
396
+ "tags": [],
397
+ "text": ""
398
+ },
399
+ "attribute": "widget-style",
400
+ "reflect": false
401
+ },
402
+ "nav": {
403
+ "type": "unknown",
404
+ "mutable": false,
405
+ "complexType": {
406
+ "original": "{\n url: string;\n logo: string;\n background?: string;\n backgroundColor?: string;\n }",
407
+ "resolved": "{ url: string; logo: string; background?: string; backgroundColor?: string; }",
408
+ "references": {}
409
+ },
410
+ "required": false,
411
+ "optional": true,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": ""
415
+ },
416
+ "defaultValue": "undefined"
417
+ },
418
+ "buttonColor": {
419
+ "type": "string",
420
+ "mutable": false,
421
+ "complexType": {
422
+ "original": "string",
423
+ "resolved": "string",
424
+ "references": {}
425
+ },
426
+ "required": false,
427
+ "optional": true,
428
+ "docs": {
429
+ "tags": [],
430
+ "text": ""
431
+ },
432
+ "attribute": "button-color",
433
+ "reflect": false
434
+ },
435
+ "buttonBg": {
436
+ "type": "string",
437
+ "mutable": false,
438
+ "complexType": {
439
+ "original": "string",
440
+ "resolved": "string",
441
+ "references": {}
442
+ },
443
+ "required": false,
444
+ "optional": true,
445
+ "docs": {
446
+ "tags": [],
447
+ "text": ""
448
+ },
449
+ "attribute": "button-bg",
450
+ "reflect": false
451
+ }
452
+ };
453
+ }
454
+ static get states() {
455
+ return {
456
+ "modal": {},
457
+ "showModal": {},
458
+ "tree": {},
459
+ "product": {},
460
+ "proppedProduct": {}
461
+ };
462
+ }
463
+ static get elementRef() { return "el"; }
464
+ static get watchers() {
465
+ return [{
466
+ "propName": "slug",
467
+ "methodName": "watchSlugChange"
468
+ }, {
469
+ "propName": "id",
470
+ "methodName": "watchIdChange"
471
+ }];
472
+ }
473
+ static get listeners() {
474
+ return [{
475
+ "name": "click",
476
+ "method": "handleClick",
477
+ "target": undefined,
478
+ "capture": false,
479
+ "passive": false
480
+ }];
481
+ }
482
+ }
483
+ //# sourceMappingURL=hemfixarna-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hemfixarna-component.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-component/hemfixarna-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC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C,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,6BAAsB;YAE1C,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,uBAAiB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;YAExD,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,wBAAkB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CACtD,CACP,CACG;QACL,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,WAAK,KAAK,EAAE,uBAAuB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,EAAE,GAAQ,CAAC,CAAC,CAAC,IAAI,CACjH,CACP,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Fragment, Listen, Prop, State, Watch, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business, Category, Product, Service, TopCategory, WidgetStyle } from '../../types';\nimport { getCustomer, getGreenDiscount, getOptions, getRot, getRut, getTaxonomy } from '../../utils/api';\nimport { getProductPriceWithRotAndRut } from '../../utils/calc';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-component',\n styleUrl: 'hemfixarna.scss',\n shadow: true,\n assetsDirs: ['assets'],\n})\nexport class HemfixarnaComponent {\n @State() modal: boolean = false;\n @State() showModal: boolean = false;\n @State() tree: Category | null = null;\n @State() product: Product | null = null;\n @State() proppedProduct: Product | null = null;\n @Prop() slug?: string;\n @Prop() id?: string;\n @Prop() business: Business;\n @Prop() topCategory?: TopCategory;\n @Prop() forceOldTree?: boolean = false;\n @Prop() loadFromQuery?: boolean = false;\n @Prop() isDemo?: boolean = false;\n @Prop() widgetStyle: WidgetStyle;\n @Prop() nav?: {\n url: string;\n logo: string;\n background?: string;\n backgroundColor?: string;\n } = undefined;\n @Prop() buttonColor?: string;\n @Prop() buttonBg?: string;\n\n @Element() private el: HTMLElement;\n\n loadCategoryOrProduct(id: string) {\n this.proppedProduct = null;\n if (id.startsWith('c-')) {\n const categories = [...state.customer.categories, ...state.customer.categories.map(c => c.sub_categories ?? [])].flat();\n const category = categories.find(c => c && c.id === id.replace('c-', ''));\n if (category) {\n state.selectedCustomerCategory = category;\n state.step = 2;\n }\n } else {\n const products = state.customer.categories\n .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))\n .flat()\n .flat();\n const product = products.find(p => p && p.fields.ID === parseInt(id));\n if (product) {\n state.selectedProduct = product.fields;\n state.step = 4;\n this.proppedProduct = product.fields;\n }\n }\n }\n\n @Watch('slug')\n async watchSlugChange(newValue: string) {\n if (this.slugIsOldFormat(newValue)) {\n this.fetchNewTaxonomy(newValue);\n } else if (state.customer && newValue) {\n this.loadCategoryOrProduct(newValue);\n }\n }\n\n @Watch('id')\n async watchIdChange(id: string) {\n if (id && state.customer) {\n if (id === 'maleri') {\n state.maleri = true;\n state.step = 4;\n } else {\n this.loadCategoryOrProduct(id);\n }\n }\n }\n\n async fetchNewTaxonomy(slug: string) {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.selectedService = null;\n state.maleri = null;\n\n const res = await getTaxonomy(slug);\n if (res?.code === 'not_found' || res?.code === 'rest_no_route') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n }\n\n slugIsOldFormat = (slug?: string) => {\n if (!slug) return false;\n return ['product', 'service', 'category'].some(str => slug.includes(str));\n };\n\n async componentWillLoad() {\n state.business = this.business;\n const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);\n if (cart) {\n state.cart = JSON.parse(cart);\n }\n const user = window.sessionStorage.getItem(`hemfixarna-${this.business}-user`);\n if (user) {\n state.user = JSON.parse(user);\n }\n const creditSafeUser = window.sessionStorage.getItem(`hemfixarna-${this.business}-creditSafeUser`);\n if (creditSafeUser) {\n state.creditSafeUser = JSON.parse(creditSafeUser);\n }\n\n const [tree, res, options, rut, rot, greenDiscount] = await Promise.all([\n this.topCategory ? getTaxonomy(this.topCategory) : null,\n this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),\n getOptions(),\n getRut(),\n getRot(),\n getGreenDiscount(),\n ]);\n\n if ((!this.slug || !this.slugIsOldFormat(this.slug)) && !this.forceOldTree) {\n try {\n const customer = await getCustomer(this.business);\n if (customer?.code === 'not_found') {\n console.warn('customer not found');\n } else if (customer) {\n state.customer = customer;\n if (this.id) {\n if (this.id === 'maleri') {\n state.maleri = true;\n state.step = 4;\n } else {\n this.loadCategoryOrProduct(this.id);\n }\n } else if (this.slug && !this.slugIsOldFormat(this.slug)) {\n this.loadCategoryOrProduct(this.slug);\n }\n }\n } catch (error) {\n console.warn('customer not found');\n }\n }\n\n if (tree?.code === 'not_found') {\n // console.warn('tree not found');\n } else if (tree) {\n this.tree = tree;\n }\n\n if (res?.code === 'not_found') {\n console.log('taxonomy not found');\n } else if (res) {\n this.setTaxonomy(res);\n if ((res as Product)?.post_type === 'ikea_product') {\n this.product = res as Product;\n }\n }\n\n if (this.loadFromQuery) {\n const params = new URL(document.location.toString()).searchParams;\n this.id = params.get('id');\n if (!this.isDemo) {\n this.openModal();\n }\n }\n\n state.rotOptions = rot;\n state.rutOptions = rut;\n state.greenOptions = greenDiscount;\n state.options = options;\n }\n\n triggerScrollTotop = () => {\n const el = this.el.shadowRoot.querySelector('.hemfixarna_content');\n scrollToTop(el);\n };\n\n setTaxonomy(taxonomy: Category | Service | Product) {\n if (taxonomy) {\n if ((taxonomy as Category)?.taxonomy === 'service_cat') {\n state.selectedCategory = taxonomy as Category;\n state.step = 2;\n } else if ((taxonomy as Service)?.post_type === 'service') {\n state.selectedService = taxonomy as Service;\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === (taxonomy as Service).ID));\n state.step = 3;\n } else if ((taxonomy as Product)?.post_type === 'ikea_product') {\n state.selectedProduct = taxonomy as Product;\n state.selectedService = this.tree.sub_cats\n .map(c => c.services)\n .flat()\n .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));\n state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));\n state.step = 4;\n }\n this.triggerScrollTotop();\n }\n }\n\n // Open close modal && click outside event\n openModal() {\n this.modal = true;\n setTimeout(() => {\n this.showModal = true;\n }, 50);\n }\n closeModal() {\n this.showModal = false;\n setTimeout(() => {\n this.modal = false;\n }, 200);\n }\n @Listen('click')\n handleClick(e: Event) {\n if (this.loadFromQuery && !this.isDemo) return;\n if ((e?.composedPath()[0] as HTMLElement).classList.contains('hemfixarna_backdrop')) {\n this.closeModal();\n }\n const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');\n if (infomodal) {\n const isClickInside = infomodal.contains(e.composedPath()[0] as HTMLInputElement);\n if (!isClickInside) {\n state.modal = null;\n }\n }\n }\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n const pensel = getAssetPath(`./assets/pensel.svg`);\n const monteringLogo = getAssetPath(`./assets/montering.svg`);\n const navBackground = this.nav?.background ? getAssetPath(this.nav.background) : '';\n const navLogo = this.nav?.logo ? getAssetPath(this.nav.logo) : '';\n\n return (\n <div class={`hemfixarna ${this.loadFromQuery ? 'hemfixarna_standalone' : ''}`}>\n {this.loadFromQuery && !this.isDemo && this.nav ? (\n <nav class=\"hemfixarna_nav\" style={{ backgroundColor: this.nav.backgroundColor ?? '' }}>\n <div>\n <div class=\"hemfixarna_nav--logos\">\n <a href={this.nav.url} target=\"_blank\">\n <img class=\"hemfixarna_partnerlogo\" src={navLogo} alt={`${this.business} logo`} />\n </a>\n <a href=\"https://hemfixarna.se/\" target=\"_blank\">\n <p class={navBackground || this.nav.backgroundColor ? 'with-bg' : ''}>I samarbete med:</p>\n <img src={logo} alt=\"hemfixarna_logo\" width={104} />\n </a>\n </div>\n\n <div class=\"hemfixarna_nav--links\">\n <a href={this.nav.url} target=\"_blank\">\n Till {this.business}\n </a>\n <a href=\"https://www.hemfixarna.se/\" target=\"_blank\">\n Till Hemfixarna\n </a>\n </div>\n {navBackground ? <img src={navBackground} class=\"nav_background\" alt=\"nav_background\" /> : null}\n </div>\n </nav>\n ) : null}\n {!this.loadFromQuery || this.isDemo ? (\n <div class={`hemfixarna_box hemfixarna_box--${this.widgetStyle}`}>\n {[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) ? (\n <img src={this.id === 'maleri' ? pensel : monteringLogo} alt=\"montering logo\" width={32} height={32} />\n ) : null}\n <div>\n <div>\n <p\n onClick={() => this.openModal()}\n class={`pointer ${[WidgetStyle.alternative_2, WidgetStyle.alternative_3].includes(this.widgetStyle) && state.selectedProduct ? 'underline' : ''}`}\n >\n {this.id === 'maleri' ? (\n <span>Beräkna fast pris på måleri & tapetsering här</span>\n ) : (\n <Fragment>\n {!state.selectedCustomerCategory && !this.product && !this.proppedProduct ? (\n <Fragment>\n {state.customer?.widget_title ? (\n <span>{state.customer.widget_title}</span>\n ) : (\n <span>\n Montering/Installation - <strong class=\"underline\">se priser här</strong>\n </span>\n )}\n </Fragment>\n ) : (\n <Fragment>\n {this.product?.title || this.proppedProduct?.title || state.selectedCustomerCategory?.widget_title || (\n <span>\n Montering\n <wbr />\n /Installation {state.selectedCustomerCategory?.name ?? 'på plats'} - <strong class=\"underline\">se priser här</strong>\n </span>\n )}\n {(this.product && this.slug?.includes('product')) || (this.proppedProduct && !this.product?.invoice && !this.proppedProduct?.invoice) ? (\n <span>\n {' från'} <strong>{getProductPriceWithRotAndRut(this.proppedProduct || this.product)}kr</strong>\n </span>\n ) : null}\n </Fragment>\n )}\n </Fragment>\n )}\n </p>\n </div>\n {this.widgetStyle === WidgetStyle.standard ? <img src={logo} width={104} /> : null}\n {this.widgetStyle === WidgetStyle.alternative ? (\n <span class=\"p-s\">\n Utförs av <strong>Hemfixarna</strong>\n </span>\n ) : null}\n </div>\n {[WidgetStyle.standard, WidgetStyle.alternative].includes(this.widgetStyle) ? (\n <button\n onClick={() => this.openModal()}\n class=\"hemfixarna_btn\"\n style={{\n color: this.buttonColor?.startsWith('#') || !this.buttonColor?.length ? this.buttonColor : `#${this.buttonColor}`,\n backgroundColor: this.buttonBg?.startsWith('#') || !this.buttonBg?.length ? this.buttonBg : `#${this.buttonBg}`,\n }}\n >\n Beställ här\n {this.getCartLength() > 0 && <span>{this.getCartLength()}</span>}\n </button>\n ) : null}\n {WidgetStyle.alternative_2 === this.widgetStyle ? (\n <div class=\"hemfixarna_altbtn\">\n <strong class=\"p-s\">Utförs av</strong>\n <img src={logo} alt=\"hemfixarna logo\" width={98} />\n </div>\n ) : null}\n </div>\n ) : null}\n {this.modal && (\n <div>\n <div class={`hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}`}>\n {state.modal && (\n <div class=\"hemfixarna_infomodal\">\n {state.modal.title && <h2>{state.modal.title}</h2>}\n {state.modal.text.map((t: string) => (\n <p innerHTML={t}></p>\n ))}\n <div>\n <button onClick={() => (state.modal = null)}>Stäng</button>\n </div>\n </div>\n )}\n {(this.tree || state.customer) && (\n <hemfixarna-breadcrumbs isDemo={this.isDemo} loadFromQuery={this.loadFromQuery} closeModal={() => this.closeModal()} tree={this.tree} />\n )}\n {!state.customer || this.slugIsOldFormat(this.slug) ? (\n <div class={`hemfixarna_content hemfixarna_content--${state.step}`}>\n {/* // IF AT TOP LEVEL (step 1) */}\n {state.step === 1 && this.tree && <hemfixarna-start tree={this.tree} />}\n {/* // IF SELECTED CATEGORY (step 2) */}\n {state.step === 2 && state.selectedCategory && <hemfixarna-category />}\n {/* // IF SELECTED SERVICE (step 3) */}\n {state.step === 3 && state.selectedService && <hemfixarna-service />}\n {/* // IF SELECTED PRODUCT (step 4) */}\n {state.step === 4 && state.selectedProduct && <hemfixarna-product />}\n {/* // IF CHECKOUT (step 5) */}\n {state.step === 5 && <hemfixarna-cart tree={this.tree} />}\n {/* // IF ORDER CONFIRM (step 6) */}\n {state.step === 6 && <hemfixarna-order tree={this.tree} />}\n </div>\n ) : (\n <div class={`hemfixarna_content hemfixarna_content--${state.step} ${state.step === 4 && state.maleri ? 'hemfixarna_content--painting' : ''}`}>\n {state.step < 4 && <hemfixarna-start />}\n {/* // IF SELECTED PRODUCT (step 4) */}\n {state.step === 4 && <hemfixarna-product />}\n {/* // IF CHECKOUT (step 5) */}\n {state.step === 5 && <hemfixarna-cart tree={this.tree} />}\n {/* // IF ORDER CONFIRM (step 6) */}\n {state.step === 6 && <hemfixarna-order tree={this.tree} />}\n </div>\n )}\n </div>\n {!this.isDemo ? <div class={`hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}`}></div> : null}\n </div>\n )}\n </div>\n );\n }\n}\n"]}